The problem statement is here: http://acm.timus.ru/problem.aspx?space=1&num=1264
Pretty straightforward problem. One thing to note that you should use long instead of int as for the max N and max M the result won’t be in the int range.
package codes; import FastIO.InputReader; import FastIO.OutputWriter; public class Task1264 { public void solve(int testNumber, InputReader in, OutputWriter out) { long n = in.nextLong(); long m = in.nextLong(); long res = n*(m+1); out.println(res); } }