Problem: 2062C - Cirno and Operations
Language: Java 8

Previous submission (verdict: Wrong answer on test 2):
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;



public class Main {
    static int MOD = (int) (1e9+7);
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out, false);
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
    static List<Long> list = new ArrayList<>();
    public static void main(String[] args) throws Exception {

        Main main = new Main();
        int T = in.nextInt();
        while (T-- > 0){
            main.solve();
        }
        out.flush();
    }

    void solve() {
        int n = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(in.nextInt());
        }
        int max = list.stream().reduce(0, Integer::sum);
        while (list.size() > 1){
            List<Integer> list0 = new ArrayList<>();
            for (int i = 1; i < list.size(); i++) {
                list0.add(list.get(i) - list.get(i - 1));
            }
            max = Math.max(max, Math.abs(list0.stream().reduce(0, Integer::sum)));
            list = list0;

        }
        out.println(max);
    }





}



Submission (verdict: Wrong answer on test 2):
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;



public class Main {
    static int MOD = (int) (1e9+7);
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out, false);
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
    static List<Long> list = new ArrayList<>();
    public static void main(String[] args) throws Exception {

        Main main = new Main();
        int T = in.nextInt();
        while (T-- > 0){
            main.solve();
        }
        out.flush();
    }

    void solve() {
        int n = in.nextInt();
        List<Integer> list = new ArrayList<>();
        long sum = 0;
        for (int i = 0; i < n; i++) {
            int t = in.nextInt();
            list.add(t);
            sum += t;
        }
        long max = sum;
        while (list.size() > 1){
            List<Integer> list0 = new ArrayList<>();
            sum = 0;
            for (int i = 1; i < list.size(); i++) {
                int t = list.get(i) - list.get(i - 1);
                list0.add(t);
                sum += t;
            }
            max = Math.max(max, Math.abs(sum));
            list = list0;

        }
        out.println(max);
    }





}