Rosetta Problems

Sort from 1 to 4

https://atcoder.jp/contests/abc302/tasks/abc302_g