Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;
import java.util.*;
import java.util.stream.*;

public class ProblemF {
    private static boolean debug = false;

    private static int N;
    private static int[] A;

    private static void solveProblem(InputStream instr) throws Exception {
        InputReader sc = new InputReader(instr);
        int testCount = 1;
        if (debug) {
            testCount = sc.nextInt();
        }

        for (int t = 1; t <= testCount; t++) {
            printDebug("------ " + t + " ------");
            N = sc.nextInt();
            A = readInts(sc, N);
            Object result = solveTestCase();
            System.out.println(result);
        }
    }

    private static Object solveTestCase() {
        int sum[] = new int[N];
        sum[0] = A[0];
        for (int i = 1; i < N; i++) {
            sum[i] = sum[i - 1] + A[i];
        }
        TreeMap<Integer, List<int[]>> map = new TreeMap<>();
        for (int i = 0; i < N; i++) {
            for (int j = i; j < N; j++) {
                int groupSum = sum[j] - (i == 0 ? 0 : sum[i - 1]);
                map.putIfAbsent(groupSum, new ArrayList<>());
                map.get(groupSum).add(new int[]{i, j});
            }
        }
        int max = -1;
        List<int[]> maxAnswer = null;
        for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {
            List<int[]> values = entry.getValue();
            if (values.size() <= max) {
                continue;
            }
            List<int[]> curr = findMax(values);
            if (curr.size() > max) {
                max = curr.size();
                maxAnswer = curr;

            }
        }
        List<String> answer = new ArrayList<>();
        for (int[] value : maxAnswer) {
            answer.add((value[0] + 1) + " " + (value[1] + 1));
        }
        return max + "\n" + joinValues(answer, "\n");
    }

    private static List<int[]> findMax(List<int[]> values) {
        values.sort(new Comparator<int[]>() {
            @Override
            public int compare(int[] o1,... Complexity: