Muennighoff/xP3x-sample huggingface dataset:
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class A implements Runnable{
	
	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");
	
	void init() throws FileNotFoundException{
		if (ONLINE_JUDGE){
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}else{
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}
	
	String readString() throws IOException{
		while(!tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(in.readLine());
			}catch (Exception e){
				return null;
			}
		}
		return tok.nextToken();
	}
	
	int readInt() throws IOException{
		return Integer.parseInt(readString());
	}
	
	long readLong() throws IOException{
		return Long.parseLong(readString());
	}
	
	double readDouble() throws IOException{
		return Double.parseDouble(readString());
	}
	
	public static void main(String[] args){
		new Thread(null, new A(), "", 128 * (1L << 20)).start();
	}
	
	long timeBegin, timeEnd;

	void time(){
		timeEnd = System.currentTimeMillis();
		System.err.println("Time = " + (timeEnd - timeBegin));
	}
	
	long memoryTotal, memoryFree;
	

	void memory(){
		memoryFree = Runtime.getRuntime().freeMemory();
		System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10) + " KB");
	}
	
	void debug(Object... objects){
		if (DEBUG){
			for (Object o: objects){
				System.err.println(o.toString());
			}
		}
	}
	
	public void run(){
		try{
			timeBegin = System.currentTimeMillis();
			memoryTotal = Runtime.getRuntime().freeMemory();
			init();
			solve();
			out.close();
			time();
			memory();
		}catch (Exception e){
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
	
	boolean DEBUG = false;
	
	void solve() throws IOException{
		int n = readInt();
		
		int[] a = new int[n];
		Integer[] b = new Integer[n];
		for... Complexity:
targets: nlogn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Scanner;
import java.util.TreeMap;

public class B {

    static Scanner in;

    static void put(TreeMap<Integer, Integer> m, int key) {
        if (m.containsKey(key)) {
            m.put(key, m.get(key) + 1);
        } else {
            m.put(key, 1);
        }
    }

    static void remove(TreeMap<Integer, Integer> m, int key) {
        if (!m.containsKey(key))
            return;
        m.put(key, m.get(key) - 1);
        if (m.get(key) == 0) {
            m.remove(key);
        }
    }

    public static void main(String[] args) {
        in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        int i = 0;
        while (i + 1 < n && a[i + 1] == a[0]) {
            i++;
        }
        int left = i;
        TreeMap<Integer, Integer> used = new TreeMap<Integer, Integer>();
        for (; i < n; i++) {
            put(used, a[i]);
            if (used.size() == k) {
                while (used.get(a[left]) > 1) {
                    remove(used, a[left]);
                    left++;
                }
                System.out.println(left + 1 + " " + (i + 1));
                return;
            }
        }
        System.out.println("-1 -1");
    }

}
 Complexity:
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 	        			/*
	        		     * Author- Priyam Vora
	        		     * BTech 2nd Year DAIICT
	        		     */
	     
	     
	        		    import java.awt.Checkbox;
	import java.awt.Point;
	import java.io.*;
	        		    import java.math.*;
	        		    import java.util.*;
	import java.util.Map.Entry;
	
	import javax.print.attribute.SetOfIntegerSyntax;
	
	     
	        		    public class Main{
	        		  	private static InputStream stream;
	        		    	private static byte[] buf = new byte[1024];
	        		    	private static int curChar;
	        		    	private static int numChars;
	        		    	private static SpaceCharFilter filter;
	        		    	private static PrintWriter pw;
	        		    	private static long count = 0,mod=1000000007;
	        		    //	private static TreeSet<Integer> ts=new TreeSet[200000];
	        		    	public final static int INF = (int) 1E9;
	
	        		        
	        		        public static void main(String[] args) {
	        		        	InputReader(System.in);
	        		    		pw = new PrintWriter(System.out); 
	        		            new Thread(null ,new Runnable(){
	        		               public void run(){
	        		                   try{
	        		                       solve();
	        		                       pw.close();
	        		                   } catch(Exception e){
	        		                       e.printStackTrace();
	        		                   }
	        		               }
	        		           },"1",1<<26).start();
	        		       }
	        		        public static void test(){
	        		        	int t=nextInt();
	        		        	while(t-->0){
	        		        		solve();
	        		        	}
	        		        }
	        		        public static long pow(long n, long p,long mod) {
	        					if(p==0)
	        						return 1;
	        					if(p==1)
	        						return n%mod;
	        					if(p%2==0){
	        						long temp=pow(n, p/2,mod);
	        					return (temp*temp)%mod;
	        					}else{
	        						 	long... Complexity:
targets: logn
inputs: /**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static Reader scan;
    static PrintWriter pw;
    static int n,k,left[],right[],arr[];
    static long MOD = 1000000007,count[],dp[];
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new Reader();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        n = ni();
        k = ni();
        int stack[] = new int[1000001];
        int top = -1;
        arr = new int[n];
        left = new int[n];
        right = new int[n];
        for(int i=0;i<n;++i) {
            arr[i] = ni();
            while(top>=0 && arr[stack[top]]<=arr[i])
                top--;
            if(top==-1)
                left[i] = 0;
            else left[i] = stack[top]+1;
            stack[++top] = i;
        }
        top = -1;
        for(int i=n-1;i>=0;--i) {
            while(top>=0 && arr[stack[top]]<arr[i])
                top--;
            if(top==-1)
                right[i] = n-1;
            else right[i] = stack[top]-1;
            stack[++top] = i;
        }
        //pa("left", left);
        //pa("right", right);
        dp = new long[n+1];
        for(int i=0;i<=n;++i) {
            if(i<k)
              continue;
            dp[i] = dp[i-k+1] + (i-k+1);
        }
        count = new long[n];
        long ans = 0;
        for(int i=0;i<n;++i) {
            int len = right[i]-left[i]+1;
            int lef = i-left[i];
            int rig = right[i]-i;
            long count = dp[len] - dp[lef] - dp[rig];
            if(count>=MOD)
             ... What is the time complexity of the previous code?
targets: linear
inputs: import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;

/**
 * Created by hama_du on 2014/09/21.
 */
public class ProblemB {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        long a = in.nextLong();
        long b = in.nextLong();
        long[] x = new long[n];
        for (int i = 0; i < n; i++) {
            x[i] = in.nextLong();
        }

        Map<Long,Integer> idxmap = new HashMap<>();
        for (int i = 0; i < n; i++) {
            idxmap.put(x[i], i);
        }
        if (a == b) {
            solve1(x, a, idxmap, out);
            return;
        }

        int[] mark = new int[n];
        Arrays.fill(mark, -1);
        boolean isok = true;
        for (int i = 0 ; i < n ; i++) {
            if (mark[i] != -1) {
                continue;
            }
            long w = x[i];
            long aw = a - w;
            long bw = b - w;
            if (idxmap.containsKey(aw) && idxmap.containsKey(bw)) {
                continue;
            } else if (idxmap.containsKey(bw)) {
                long w1 = w;
                long w2 = bw;
                while (true) {
                    if (!idxmap.containsKey(w1) || !idxmap.containsKey(w2)) {
                        break;
                    }
                    int i1 = idxmap.get(w1);
                    int i2 = idxmap.get(w2);
                    if (mark[i1] == 0 || mark[i2] == 0) {
                        isok = false;
                    }
                    mark[i1] = 1;
                    mark[i2] = 1;
                    if (w1 + a - b == w2) {
                        break;
                    }
                    w1 += (a - b);
                    w2 += (b - a);
                }
            } else if (idxmap.containsKey(aw)){
                long w1... What is the time complexity of the previous code?
targets: linear
inputs: import java.util.*;
public class C23A {
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        String str=sc.next();

        for(int k=str.length()-1;k>=1;k--){
            for(int i=0;i<=str.length()-k;i++){
                for(int j=i+1;j<=str.length()-k;j++){
                    if(str.substring(i,i+k).equals(str.substring(j,j+k))){
                            System.out.println(k);
                            return;
                    }
                }
            }
        }
        System.out.println(0);

    }
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: cubic
inputs: //package practice;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;
import java.util.regex.Pattern;

public class ROUGH {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct 

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long mod = (long) (1e9+7);
	static int N = (int) 1e5;
//	Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		 FastReader sc = new FastReader();
		 int n = sc.nextInt();
		 int[] a = new int[n];
		 TreeSet<Integer> set = new TreeSet<Integer>();
		 for(int i=0;i<n;++i) {
			 a[i] = sc.nextInt();
			 set.add(a[i]);
		 }
		 long ans = 0;
		 while(set.size() > 0) {
			 ++ans;
			 int min = set.first();
			 TreeSet<Integer> temp = new TreeSet<>();
			 for(int x : set) {
				 if(x%min != 0) temp.add(x);
			 }
			 set = temp;
			 
		 }
		 out.print(ans);
		 
		 out.close();
	}
	
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: quadratic
inputs: 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,... What is the time complexity of the previous code?
targets: quadratic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Niyaz Nigmatullin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        long a = in.nextLong();
        long b = in.nextLong();
        if (a < b) {
            long t = a;
            a = b;
            b = t;
        }
        long ans = 0;
        while (b > 0) {
            ans += a / b;
            long t = a % b;
            a = b;
            b = t;
        }
        out.println(ans);
    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        if (c < 0) {
            return null;
        }
        while (c >= 0 && !isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

... Complexity:
targets: constant
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        TaskC.InputReader in = new TaskC.InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.Solve(in, out);
        out.close();
    }


    static class TaskC {

        private long mod = 1_000_000_007;
        private int n;
        private boolean[] s;

        public void Solve(InputReader in, PrintWriter out) {
            n = in.NextInt();
            s = new boolean[n];
            for (int i = 0; i < n; i++) {
                String ss = in.Next();
                s[i] = ss.charAt(0) == 'f';
            }
            if (s[n - 1]) {
                out.println(0);
                return;
            }
            long[] dpSum = new long[n + 1], lastDpSum = new long[n + 1];
            for (int i = 0; i <= n; i++) {
                lastDpSum[i] = i + 1;
            }
            for (int i = n - 2; i >= 0; i--) {
                for (int j = 0; j <= i; j++) {
                    if (!s[i]) {
                        dpSum[j] = lastDpSum[j];
                    } else {
                        dpSum[j] = lastDpSum[j + 1] - lastDpSum[j];
                    }
                    if (j != 0) {
                        dpSum[j] += dpSum[j - 1];
                    }
                    dpSum[j] %= mod;
                    while (dpSum[j] < 0) dpSum[j] += mod;

                }
                long[] temp = dpSum;
                dpSum = lastDpSum;
                lastDpSum = temp;
            }
            out.println(lastDpSum[0]);
        }

        public static int GetMax(int[] ar) {
            int max = Integer.MIN_VALUE;
            for (int a : ar) {
               ... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: quadratic
inputs: 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.*;

public class B {

	static int n, t[], g[], MOD = (int) 1e9 + 7;
	static int[][][] memo1, memo2[], memo3[];

	static int dp1(int idx, int remCnt, int remSum) {
		if (idx == n)
			return remSum == 0 && remCnt==0 ? 1 : 0;
		if (memo1[idx][remCnt][remSum] != -1)
			return memo1[idx][remCnt][remSum];
		int ans = dp1(idx + 1, remCnt, remSum);
		if (g[idx] == 0 && t[idx] <= remSum && remCnt>0) {
			ans += dp1(idx + 1, remCnt - 1, remSum - t[idx]);
			if (ans >= MOD)
				ans -= MOD;
		}
		return memo1[idx][remCnt][remSum] = ans;
	}

	static int dp2(int idx, int remCnt1, int remCnt2, int remSum) {
		int all = remCnt1 + remCnt2;
		if (all == 0)
			return remSum == 0 ? 1 : 0;
		if (idx == n || remSum == 0)
			return 0;
		if (memo2[idx][remCnt1][remCnt2][remSum] != -1)
			return memo2[idx][remCnt1][remCnt2][remSum];
		int ans = dp2(idx + 1, remCnt1, remCnt2, remSum);
		if (t[idx] <= remSum) {
			if (g[idx] == 1 && remCnt1 > 0)
				ans += dp2(idx + 1, remCnt1 - 1, remCnt2, remSum - t[idx]);
			else if (g[idx] == 2 && remCnt2 > 0)
				ans += dp2(idx + 1, remCnt1, remCnt2 - 1, remSum - t[idx]);

		}

		return memo2[idx][remCnt1][remCnt2][remSum] = ans;
	}

	private static int dp3(int cnt0, int cnt1, int cnt2, int last) {
		if (cnt0 + cnt1 + cnt2 == 0)
			return 1;
		if (memo3[last][cnt0][cnt1][cnt2] != -1)
			return memo3[last][cnt0][cnt1][cnt2];
		long ans = 0;
		if (cnt0 > 0 && last != 0)
			ans += dp3(cnt0 - 1, cnt1, cnt2, 0);
		if (cnt1 > 0 && last != 1)
			ans += dp3(cnt0, cnt1 - 1, cnt2, 1);
		if (cnt2 > 0 && last != 2)
			ans += dp3(cnt0, cnt1, cnt2 - 1, 2);
		return memo3[last][cnt0][cnt1][cnt2] = (int) (ans % MOD);

	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		n = sc.nextInt();
		int[] fac = new int[n + 1];
		t = new int[n];
		g = new int[n];
		int[] cnt = new int[3];
		fac[0] = 1;
		for (int i = 1; i <= n; i++)
			fac[i] = (int) (i * 1L * fac[i - 1] % MOD);
		int T =... Complexity:
targets: cubic
inputs: import java.util.Scanner;

public class B {
    public static String toB(String str){
        String row,col;
        int i=0;
        while(i<str.length() && str.charAt(i)<='Z'&&str.charAt(i)>='A')i++;
        col = str.substring(0,i);
        row = str.substring(i,str.length());
        StringBuffer sb = new StringBuffer(col);
        col = sb.reverse().toString();
        int accum = 0;
        for(i=0;i<col.length();i++){
            int val = getValue(col.charAt(i));
            accum+=val*Math.pow(26, i);
            }
        return "R"+row+"C"+accum;
        
    }
    public static String toA(String str){
        int i = str.indexOf('C');
        String row,col,ans="";
        row = str.substring(1,i);
        col = str.substring(i+1,str.length());
        int colVal = Integer.parseInt(col),mod;
        while(colVal>0){
            mod = colVal%26;
            if(mod==0){
                ans+='Z';
                colVal--;
            }
            else{
                ans+=getLetter(mod);
            }
            colVal/=26;
        }
        StringBuffer sb = new StringBuffer(ans);
        ans = sb.reverse().toString();
        return ans+row;
    }
    public static int getValue(char c){
        return c-'A'+1;
    }
    public static char getLetter(int n){
        return (char)(n+'A'-1);
    }
    public static void main(String[] args)throws Exception{
        Scanner in = new Scanner(System.in);
        int cases = in.nextInt();
        for(int i = 0;i<cases;i++){
            String str = in.next();
            if(str.charAt(0)=='R' && str.charAt(1)>='0'&&str.charAt(1)<='9' && str.indexOf('C')!=-1){
                System.out.println(toA(str));
            }
            else System.out.println(toB(str));
        }
        
    }
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {
	// write your code here
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int d = Integer.parseInt(s[1]);

        List<Integer> list = new ArrayList<>();
        s = reader.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            list.add(Integer.parseInt(s[i]));
        }

        HashSet<Integer> set = new HashSet<>();
        for (Integer i : list) {
            set.add(i - d);
            set.add(i + d);
        }

        HashSet<Integer> set2 = new HashSet<>();

        for (Integer i : set) {
            for (Integer x : list) {
                if (Math.abs(i - x) < d) {
                    set2.add(i);
            }
            }
        }

        set.removeAll(set2);
        System.out.println(set.size());

    }
}
 Complexity:
targets: linear
inputs: //package round429;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C2 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni();
		int[] a = na(n);
		for(int i = 0;i < n;i++){
			int v = a[i];
			for(int j = 2;j*j <= v;j++){
				while(v % (j*j) == 0){
					v /= j*j;
				}
			}
			a[i] = v;
		}
		
		Arrays.sort(a);
		int[] f = new int[n];
		int p = 0;
		for(int i= 0;i < n;i++){
			if(i > 0 && a[i] != a[i-1]){
				p++;
			}
			f[p]++;
		}
		f = Arrays.copyOf(f, p+1);
		int mod = 1000000007;
		
		int[][] fif = enumFIF(1000, mod);
		long[] res = countSameNeighborsSequence(f, fif, mod);
		long ans = res[0];
		for(int v : f){
			ans = ans * fif[0][v] % mod;
		}
		
		out.println(ans);
	}
	
	public static int[][] enumFIF(int n, int mod) {
		int[] f = new int[n + 1];
		int[] invf = new int[n + 1];
		f[0] = 1;
		for (int i = 1; i <= n; i++) {
			f[i] = (int) ((long) f[i - 1] * i % mod);
		}
		long a = f[n];
		long b = mod;
		long p = 1, q = 0;
		while (b > 0) {
			long c = a / b;
			long d;
			d = a;
			a = b;
			b = d % b;
			d = p;
			p = q;
			q = d - c * q;
		}
		invf[n] = (int) (p < 0 ? p + mod : p);
		for (int i = n - 1; i >= 0; i--) {
			invf[i] = (int) ((long) invf[i + 1] * (i + 1) % mod);
		}
		return new int[][] { f, invf };
	}

	
	public static long[] countSameNeighborsSequence(int[] a, int[][] fif, int mod)
	{
		int n = a.length;
		
		int bef = a[0];
		int aft = a[0];
		long[] dp = new long[bef];
		dp[bef-1] = 1;
		for(int u = 1;u < n;u++){
			int v = a[u];
			aft += v;
			long[][] ldp = new long[bef][aft];
			for(int i = 0;i < dp.length;i++){
				ldp[i][0] = dp[i];
			}
			
			for(int i = 0;i < v;i++){
				long[][] ndp = new long[bef][aft];
				for(int j = 0;j < bef;j++){
					for(int k = 0;j+k < aft;k++){
						if(ldp[j][k] == 0)continue;
						// XX -> XCX
						if(j > 0){
							ndp[j-1][k] += ldp[j][k] *... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: cubic
inputs: import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class E {
	
	static InputStream is;
	//String INPUT = "";

	public static void main(String[] args) throws IOException {
		is = System.in;
		int n = ni();
		int k = ni();
		
		int[][] aj = new int[n][n];
		
		for (int i = 0; i < aj.length; i++) {
			aj[i] = na(n);
		}
		
		int F = (n+1)/2;
		int B = n-F;
		
		int[] spanftf = new int[F];
		int[] spanftb = new int[F];
		for(int i =0; i < F; i++){
			for(int j =0; j < F; j++){
				if(i == j || aj[i][j] == 1){
					spanftf[i] |= 1<<j;
				}
			}
			for(int j =0; j< B; j++){
				if(aj[i][F+j] == 1){
					spanftb[i] |= 1<<j;
				}
			}
		}
		int[] maxes = new int[1<<B];
		for(int bm = 0; bm < (1<<F); bm++){
			int anded = (1<<F)-1;
			int spanToBack = (1<<B)-1;
			
			for(int i =0; i < F; i++){
				if((1<<i & bm) != 0){
					anded &= spanftf[i];
					spanToBack &= spanftb[i];
				}
			}
			
			if((anded & bm) == bm){
				maxes[spanToBack] = Math.max(maxes[spanToBack], Integer.bitCount(bm));
			}
		}
		int[] spanbtb = new int[B];
		for(int i =0; i < B; i++){
			for(int j =0; j< B; j++){
				if(aj[F+i][F+j] == 1 || i == j){
					spanbtb[i] |= 1<<j;
				}
			}
		}
		boolean[] isgood = new boolean[1<<B];
		for(int bm =0; bm < (1<<B); bm++){
			int anded = (1<<B)-1;
			
			for(int i =0; i < B; i++){
				if((1<<i & bm) != 0){
					anded &= spanbtb[i];
				}
			}
			
			if((anded & bm) == bm){
				isgood[bm] = true;
			}
			
		}
		bybc[] tosort = new bybc[1<<B];
		for (int i = 0; i < tosort.length; i++) {
			tosort[i]= new bybc(i);
		}
		Arrays.sort(tosort);
		
		int best = 1;
		for (int i = 0; i < tosort.length; i++) {
			int at  =tosort[i].mask;
			if(isgood[at]){
				best = Math.max(best, maxes[at]+Integer.bitCount(at));
			}
			
			for(int j =0; j < B; j++){
				if((1<<j & at) != 0){
					int to = at - (1<<j);
					maxes[to] = Math.max(maxes[to], maxes[at]);
				}
			}
			
		}
		
		//System.out.println("best: " + best);
		
		double ans= best*(best-1)/2.0 *... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: np
inputs: import java.util.*;
import java.io.*;

public class CFB {
    static int n;
    static FastScanner in;
    public static void main(String[] args) throws Exception {
        in = new FastScanner(System.in);
        n = in.nextInt();
        int a = query(1);
        if(((a % 2)+2) % 2== 1){
            System.out.println("! -1");
            return;
        }
        if(a == 0){
            System.out.println("! 1");
            return;
        }
        bins(1 , n/2 + 1 , a , -a);
    }
    static void bins(int lo , int hi , int losign , int hisign){
        int mid = (lo + hi)/2;
        int k = query(mid);
        if(k == 0){
            System.out.println("! " + mid);
            System.exit(0);
        }
        if(k > 0 && losign > 0 || k < 0 && losign < 0){
            bins(mid , hi , k , hisign);
        }
        else {
            bins(lo , mid , losign , k);
        }

    }
    static int query(int i){
        System.out.println("? " + i);
        int a1 = in.nextInt();
        System.out.println("? " + ((i + (n/2)) > n ? (i - (n/2)) : (i + (n/2))));
        int a2 = in.nextInt();
        return a1 - a2;
    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        boolean isEndline(int c) {
          ... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: logn
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class HexTheorem {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        int x = Integer.parseInt(read.readLine());
        System.out.println("0 0 "+x);
    }
}
 What is the time complexity of the previous code?
targets: constant
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import sun.reflect.generics.tree.Tree;

import java.io.*;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.util.*;

public class l {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMMMM      MMMMMM      OOO      OOO        SSSS   SSS     EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEE           MMMM MMM  MMM MMMM    OOO          OOO    SSSS       SSS   EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM  MMMMMM  MMMM   OOO            OOO   SSSS             EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM  OOO              OOO   SSSSSSS         EEEEE          /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO      SSSSSS       EEEEEEEEEEE    /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO         SSSSSSS   EEEEEEEEEEE    /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM   OOO            OOO              SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM    OOO         ... Complexity:
targets: nlogn
inputs: 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.*;
 

public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader kek = new BufferedReader(new InputStreamReader(System.in));
		//Scanner skek = new Scanner(System.in);
		PrintWriter outkek = new PrintWriter(System.out);

		int N = Integer.parseInt(kek.readLine());
		double[][] lake = new double[N][N];
		
		for(int i = 0; i < N; i++){
			String[] input = kek.readLine().split(" ");
			for(int j = 0; j < N; j++){
				lake[i][j] = Double.parseDouble(input[j]);
			}
		}
		
		int pow = (int)Math.pow(2, N);
		double[] res = new double[pow];
		res[pow - 1] = 1.0;
		
		for(int i = pow - 1; i >= 0; i--){
			int ones = Integer.bitCount(i); // So this is apparently a thing
			int possibleCombos = ones * (ones - 1) /2;
			
			for(int j = 0; j < N; j++){
				if((i >> j) % 2 == 0){ // (X >> Y) literally does the same thing as divis func. Bit operators are weird.
					continue;
				}
				for(int k = j + 1; k < N; k++){
					if((i >> k) % 2 == 0){
						continue;
					}
					res[i ^ (1 << k)] += res[i] * lake[j][k]/possibleCombos;
					res[i ^ (1 << j)] += res[i] * lake[k][j]/possibleCombos;
				}
			}
			
		}
		
		for(int i = 0; i < N; i++){
			outkek.print(res[1 << i] + " ");
		}
		
		kek.close();
		outkek.close();
	}	
	
	/*static int divis(int n, int a){
		for(int i = 0; i < a; i++){
			n /= 2;
		}
		return n;
	}*/
		
}
 Complexity:
targets: np
inputs: import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class ProblemA {
	public static void main (String args[]) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String s1=br.readLine();
		String[] s=s1.split(" ");
		int a[] = new int[n];
		for(int i = 0;i<n;i++)
		{
			a[i]=Integer.parseInt(s[i]);
		}
		Arrays.sort(a);
		System.out.println(findColour(a,n));
	}
	public static int findColour(int [] a , int n)
	{
		Map <Integer,Integer> mp = new HashMap<Integer,Integer>();
		int f=0;
		for(int i = 0; i<n;i++)
		{
			f=0;
			for (Map.Entry<Integer,Integer> entry : mp.entrySet()) 
			{
				if(a[i] % entry.getKey()==0)
				{
					f=1;
					break;
				}
			}
			if(f==0)
			{
				mp.put(a[i],1);
			}
				
		}
		return mp.size();
	}
}
 What is the time complexity of the previous code?
targets: quadratic
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.in;
import static java.lang.System.out;

public class SolutionD extends Thread {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                                            InputStreamReader(in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return parseInt(next());
        }

        long nextLong() {
            return parseLong(next());
        }

        double nextDouble() {
            return parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    private static final FastReader scanner = new FastReader();
    private static final PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        solve();
        out.close();
    }

    private static void solve() {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int k = scanner.nextInt();

        int[][] hori = new int[n][m-1];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m-1; j++) {
                int xij = scanner.nextInt();
                hori[i][j] = xij;
            }
        }

        int[][] vert = new int[n-1][m];
... What is the time complexity of the previous code?
targets: cubic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Math.*;

public class Main {

    private FastScanner scanner = new FastScanner();

    public static void main(String[] args) {
        new Main().solve();
    }


    private void solve() {
        int n = scanner.nextInt();

        Map<Integer, Integer> cnt = new HashMap<>();

        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();

            LinkedList<Character> st = new LinkedList<>();

            for (char c : s.toCharArray()) {
                if (c == ')' && !st.isEmpty() && st.getLast() == '(') {
                    st.pollLast();
                    continue;
                }
                st.addLast(c);
            }

            int t = st.size();
            Set<Character> set = new HashSet<>(st);
            if (set.size() > 1) {
                continue;
            }
            if (set.isEmpty()) {
                cnt.put(0, cnt.getOrDefault(0, 0) + 1);
                continue;
            }

            if (st.getLast() == '(') {
                cnt.put(t, cnt.getOrDefault(t, 0) + 1);
            } else {
                cnt.put(-t, cnt.getOrDefault(-t, 0) + 1);
            }
        }

        long ans = 0;

        for (int next : cnt.keySet()) {
            if (next == 0) {
                ans += (long) cnt.get(next) * (cnt.get(next) - 1) + cnt.get(next);
            } else if (next > 0) {
                int t = next * -1;
                if (cnt.containsKey(t)) {
                    ans += (long) cnt.get(next) * cnt.get(t);
                }
            }
        }

        System.out.print(ans);

    }

    class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        FastScanner() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null ||... Complexity:
targets: linear
inputs: import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException{
		Scanner cin = new Scanner(System.in);
		
		int t, n, m;
		
		t = cin.nextInt();
		
		while(t > 0) {
			t--;
			int sum = 0;
			n = cin.nextInt();
			m = cin.nextInt();
			while(n > 0 && m > 0) {
				if(n < m) {
					int k = n;
					n = m;
					m = k;
				}
				sum += n / m; n %= m;
			}
			
			System.out.println(sum);
		}
	}

}
	 		   	   	  			 	 	    	 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: constant
inputs: import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigInteger;

import static java.lang.Math.*;

// Solution is at the bottom of code

public class ProblemC_008 implements Runnable{
	
	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	
	BufferedReader in;
	OutputWriter out;
	StringTokenizer tok = new StringTokenizer("");
	
	public static void main(String[] args){
		new Thread(null, new ProblemC_008(), "", 128 * (1L << 20)).start();
	}
	
	/////////////////////////////////////////////////////////////////////
	
	void init() throws FileNotFoundException{
		Locale.setDefault(Locale.US);
		
		if (ONLINE_JUDGE){
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new OutputWriter(System.out);
		}else{
			in = new BufferedReader(new FileReader("input.txt"));
			out = new OutputWriter("output.txt");
		}
	}
	
	////////////////////////////////////////////////////////////////
	
	long timeBegin, timeEnd;

	void time(){
		timeEnd = System.currentTimeMillis();
		System.err.println("Time = " + (timeEnd - timeBegin));
	}
	
	void debug(Object... objects){
		if (ONLINE_JUDGE){
			for (Object o: objects){
				System.err.println(o.toString());
			}
		}
	}
	
	/////////////////////////////////////////////////////////////////////
	
	public void run(){
		try{
			timeBegin = System.currentTimeMillis();
			Locale.setDefault(Locale.US);
			
			init();
			solve();
			
			out.close();
			time();
		}catch (Exception e){
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
	
	/////////////////////////////////////////////////////////////////////
	
	String delim = " ";
	
	String readString() throws IOException{
		while(!tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(in.readLine());
			}catch (Exception e){
				return null;
			}
		}
		
		return tok.nextToken(delim);
	}
	
	String readLine() throws IOException{
		return in.readLine();
	}
	
	/////////////////////////////////////////////////////////////////
	
	final char NOT_A_SYMBOL = '\0';
	
	char... What is the time complexity of the previous code?
targets: np
inputs: import java.util.*;

public class Q3a {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();
		String s = in.nextLine();

		HashMap<Integer, Integer> seen = new HashMap<>();

		for (int i = 0; i < n; i++) {
			Character c = s.charAt(i);
			int ci = (int) c.charValue();
			// System.out.println(ci);
			seen.put(ci, seen.get(ci) == null ? 1 : seen.get(ci) + 1);
		}

		HashMap<Integer, Integer> sub = new HashMap<Integer, Integer>();
		int start = 0;
		int min = 10000000;
		for (int i = 0; i < n; i++) {
			Character c = s.charAt(i);
			int ci = (int) c.charValue();

			sub.put(ci, sub.get(ci) == null ? 1 : sub.get(ci) + 1);
			
			while(sub.size() == seen.size()) {
				min = Math.min(min, i - start + 1);
				c = s.charAt(start);
				start ++;
				ci = (int) c.charValue();
				if( sub.get(ci) == 1) 
					sub.remove(ci);
				else
					sub.put(ci, sub.get(ci) - 1);
			}
		}

		System.out.print(min);

		// System.out.println( seen_all_at - begin + 1);

		in.close();
	}
} What is the time complexity of the previous code?
targets: linear
inputs: import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {

  public static void main(String[] args) {
    Scanner cin=new Scanner(new BufferedInputStream(System.in));
    
    int n=cin.nextInt(),
        m=cin.nextInt(),
        k=cin.nextInt();
    int[] a=new int[51];
    
    for (int i=0;i<n;i++) {
      a[i]=-cin.nextInt();
    }
    Arrays.sort(a);
    
    if (m<=k) {
        System.out.println(0);
        return;
    }
    for (int i=0;i<Math.min(k,n);i++) {
      m+=a[i];
      if (m-(k-1-i)<=0) {
        System.out.println(i+1);
        return;
      }
    }
    for (int i=k;i<n;i++) {
      m+=a[i]+1;
      if (m<=0) {
        System.out.println(i+1);
        return;
      }
    }
    System.out.println(-1);
    
    cin.close();
  }

} What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        long maxk = (long) 1e18;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int t = in.nextInt();

            long maxn = 1;
            long val = 0;
            for (long i = 1; ; i++) {
                val = 1 + 4 * val;
                if (val >= maxk) {
                    maxn = i;
                    break;
                }
            }

            long[] vala = new long[(int) maxn + 1];

            vala[1] = 1;

            for (int i = 2; i <= maxn; i++) {
                vala[i] = 1 + 4 * vala[i - 1];
            }

            o:
            while (t-- > 0) {
                long n = in.nextInt();
                long k = in.nextLong();

                if (n - 1 >= maxn) {
                    out.println("YES " + (n - 1));
                    continue;
                }

                k--;

                if (k <= vala[(int) n - 1]) {
                    out.println("YES " + (n - 1));
                    continue;
                }

                long cs = n - 1;
                long cc = 3;
                int ind = 2;

                long end = -1;
                while (k > 0) {
                    if (k >= cc && cs > 0) {
       ... What is the time complexity of the previous code?
targets: logn