Rosetta Problems

Which is ahead?

https://atcoder.jp/contests/abc342/tasks/abc342_b