Muennighoff/xP3x-sample huggingface dataset:
inputs: import java.io.*;
import java.util.*;
public class CC {
	public static void main(String[] args)throws Throwable {
		MyScanner sc=new MyScanner();
		PrintWriter pw=new PrintWriter(System.out);
		
		int n=sc.nextInt();
		int r=sc.nextInt();
		int [] x=new int [n];
		for(int i=0;i<n;i++)
			x[i]=sc.nextInt();
		double [] ans=new double [n];
		ans[0]=r;
		for(int i=1;i<n;i++){
			ans[i]=r;
			for(int j=0;j<i;j++){
				double dx=Math.abs(x[i]-x[j]);
				if(dx>2*r)
					continue;
				double y=Math.sqrt((4*r*r)-(dx*dx));
				ans[i]=Math.max(ans[i], ans[j]+y);
			}
		}
		
		
		for(double z : ans)
			pw.print(z+" ");
		pw.flush();
		pw.close();
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.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 Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine(){String str = "";
		try {str = br.readLine();}
		catch (IOException e) {e.printStackTrace();}
		return str;}
	}
} What is the time complexity of the previous code?
targets: quadratic
inputs: import java.io.*;
import java.util.*;
import java.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays; 

public class   CF111111
{
  BufferedReader in;
  StringTokenizer as;
  int nums[],nums2[];
  int[] nums1[];
  boolean con = true;
 
  ArrayList < Integer >  ar = new ArrayList < Integer >();
  ArrayList < Integer >  fi = new ArrayList < Integer >();
  Map<Integer,Integer > map = new HashMap<Integer, Integer>();
  public static void main (String[] args)
  {
    new CF111111  ();
  }
  
  public int GCD(int a, int b) {
    if (b==0) return a;
    return GCD(b,a%b);
  }
  
  public int LIS(int arr[])
  {
    int n = arr.length;
    int sun[] = new int [n];
    int cur = 0;
    for(int x = 0;x<n;x++)
    {
      int temp = Arrays.binarySearch(sun,0,cur,arr[x]);
      if(temp < 0)
        temp = -temp -1;
      sun[temp] = arr[x];
      if(temp == cur)
        cur++;
    }
    return cur;
    
  }
  
  
  
  
  public CF111111  ()
  {
    try
    {
      
      in = new BufferedReader (new InputStreamReader (System.in));
      int a = nextInt();
      for(int xx1 = 0;xx1<a;xx1++)
      {
        int b = nextInt();
        nums = new int [b];
        for(int x = 0;x<b;x++)
        {
          nums[x] = nextInt();
        }
         int max = 0;
         int max2 = -1;
         for(int x = 0;x<b;x++)
         {
           if(nums[x] >= max)
           {
             max2 = max;
             max = nums[x];
           }
           else if(nums[x] >= max2)
             max2 = nums[x];
         }
        System.out.println(Math.min(max2, b-1)-1);
      }
    }
    catch(IOException e)
    {

    }
  }
  
  
  
  
  
  
  
  String next () throws IOException
  {
    while (as == null || !as.hasMoreTokens ())
    {
      as = new StringTokenizer (in.readLine ().trim ());
    }
    
    
    return as.nextToken ();
  }
  
  
  
  long nextLong () throws IOException
  {
    return Long.parseLong (next ());
  }
  
  
  int... 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: import java.util.Scanner;


public class K603 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        
        long a=sc.nextLong();
        long b=sc.nextLong();
        
        if(b-a<2){
            System.out.println(-1);
        }else if(b-a==2 && a%2==1){
            System.out.println(-1);
        }else if(b-a==2 && a%2==0){
            System.out.println(a+" "+(a+1)+" "+(a+2));
        }else{
            if(a%2==0){
                System.out.println(a+" "+(a+1)+" "+(a+2));
            }else{
                System.out.println((a+1)+" "+(a+2)+" "+(a+3));
            }
        }
    }
} 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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskC {
        static final int MODULO = (int) (1e9 + 7);

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) a[i] = removeSquares(in.nextInt());
            Arrays.sort(a);

            int[][] c = new int[n + 1][n + 1];
            c[0][0] = 1;
            for (int i = 1; i < c.length; ++i) {
                c[i][0] = 1;
                for (int j = 1; j < c.length; ++j) {
                    c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MODULO;
                }
            }

            int[] fact = new int[n + 1];
            fact[0] = 1;
            for (int i = 1; i < fact.length; ++i) {
                fact[i] = (int) (i * (long) fact[i - 1] % MODULO);
            }

            int i = 0;
            int[] ways = new int[]{1};

            while (i < n) {
                int j = i;
                while (j < n && a[j] == a[i]) ++j;

                int m = j - i;

                int[] nways = new int[j + 1];
                for (int old = 0; old < ways.length; ++old) {
                    long w = ways[old];
                    for (int blocks = 1; blocks <= m; ++blocks) {
                        for (int intoOld = 0; intoOld <=... 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: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. //package round97;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {

	static BufferedReader bf = new BufferedReader(new InputStreamReader(
			System.in));
	static StringTokenizer st;
	static PrintWriter out = new PrintWriter(System.out);

	static String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String s = bf.readLine();
			if (s == null)
				return null;
			st = new StringTokenizer(s);
		}

		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static String nextStr() throws IOException {
		return nextToken();
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public static void main(String[] args) throws IOException {
		int n = nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		Arrays.sort(a);
		
		for (int q = 0; q < n; q++) {
			if (a[q] != 1) {
				out.print("1");
				for (int i = 1; i < n; i++) {
					out.print(" " + a[i - 1]);
				}
				out.flush();
				return;
			}
		}
		
		for (int i = 0; i < n - 1; i++) {
			out.print("1 ");
		}
		out.println("2");
		out.flush();
		
		
	}
}
 Complexity:
targets: nlogn
inputs: import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class CottageVillage {
    
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>();
        while (n-->0) {
            tm.put(sc.nextInt(), sc.nextInt());
        }
        
        int cnt=2, x=0, a=0; 
        double diff=0;
        for(Map.Entry<Integer, Integer> e : tm.entrySet()) {
            if (x!=0 || a!=0) {
                diff = Math.abs(e.getKey()-x-e.getValue()*0.5-a*0.5); 
                if (diff-k>0) cnt+=2;
                else if (diff-k==0) cnt++;
            }
            x=e.getKey();
            a=e.getValue();
        }
        System.out.println(cnt);
    }
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: nlogn
inputs: import java.util.Scanner;
    public class New_Year_and_Curling {
        static final double E = 0.00001;
 
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
 
            int n = sc.nextInt();
            int r = sc.nextInt();
            double[] y = new double[n];
            int arr[] = new int[n];
 
            for (int i = 0; i < n; i++) {
                arr[i] =sc.nextInt();
                double top = r; // if we make it 0 and subtract from the result will get WA (do not know why!!!)
                int x = arr[i];
                for(int  j =0 ;j<i;j++)
                {
                    if(Math.abs(arr[j] -x )<=2*r) {
 
                            top = Math.max(top  , y[j] + Math.sqrt((4 * r * r) - ((arr[j] - x) * (arr[j] - x))));
 
                    }
                }
                y[i] = top ;
                double res = y[i] ;
                System.out.print(res+" ");
            }
 
        }
 
    } 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.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    long mod=1000000007;
    
    void solve() throws IOException {
        for (int tc=ni();tc>0;tc--) {
            long n=ni();
            long q=1;
            long p=1;
            boolean f=false;
            while (true) {
                if (p*2==n || p*4==n) { f=true; break; }
                q++;
                p=q*q;
                if (p>n) break;
            }
            if (f) out.println("YES");
            else out.println("NO");
        }
        out.flush();
    }
    
    int gcd(int a,int b) { return(b==0?a:gcd(b,a%b)); }
    long gcd(long a,long b) { return(b==0?a:gcd(b,a%b)); }
    long mp(long a,long p) { long r=1; while(p>0) { if ((p&1)==1) r=(r*a)%mod; p>>=1; a=(a*a)%mod; } return r; }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
} What is the time complexity of the previous code?
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.util.Arrays;

/**
 * @author piuspratik (Piyush Das)
 */
public class TaskA {

    class Contest implements Comparable<Contest>

    {
        int problems;
        int penalty;

        Contest (int problems, int penalty) {
            this.problems = problems;
            this.penalty = penalty;
        }

        public int compareTo(Contest contest) {
            if(problems != contest.problems) return contest.problems - problems;
            return penalty - contest.penalty;


        }
    }

    void run(){
        int n = nextInt(), k = nextInt();
        Contest[] c = new Contest[n];
        for(int i = 0; i < n; i++) {
            c[i] = new Contest(nextInt(), nextInt());
        }

        Arrays.sort(c);
        int cproblem = c[k - 1].problems, cpenalty = c[k - 1].penalty;

        int ans = 0;
        for(int i = 0; i < n; i++) {
            if(c[i].problems == cproblem && c[i].penalty == cpenalty) ans++;
        }

        System.out.println(ans);
    }

    int nextInt(){
        try{
            int c = System.in.read();
            if(c == -1) return c;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return c;
            }
            if(c == '-') return -nextInt();
            int res = 0;
            do{
                res *= 10;
                res += c - '0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

    long nextLong(){
        try{
            int c = System.in.read();
            if(c == -1) return -1;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return -1;
            }
            if(c == '-') return -nextLong();
            long res = 0;
            do{
                res *= 10;
                res += c-'0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
         ... 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.*;
import static java.lang.Math.*; 
import static java.util.Arrays.*;
import static java.lang.Character.*;
import static java.lang.Double.*;


public class A {

	Scanner scan = new Scanner(System.in);
	
	
	void solve() {
		int n = scan.nextInt();
		String[]A = new String[n];
		String[]B = new String[n];
		int res =0;
		for(int i=0;i<n;i++)A[i]=scan.next();
		for(int i=0;i<n;i++)B[i]=scan.next();
		for(int i=0;i<A.length;i++) {
			boolean fnd = false;
			for(int j=0;j<B.length;j++) {
				if(A[i].equals(B[j])) {
					fnd = true;
					B[j]="";
					break;
				}
			}
			if(!fnd)res++;
		}
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new A().solve();
	}
}
 Complexity:
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.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;

public class C {

	public static void main(String[] args) {
		FastScanner in = new FastScanner();
		int n = in.nextInt();
		double r = in.nextInt();
		double x[] = new double[n];
		for(int i = 0; i < n; i++)
			x[i] = in.nextDouble();
		
		double y[] = new double[n];
		y[0] = r;
		
		for(int i = 1; i < n; i++){
			double miny = r;
			for(int j = 0; j < i; j++){
				double dx = Math.abs(x[i]-x[j]);
				if(dx > r*2) continue;
				double yy = Math.sqrt(4*r*r-dx*dx);
				miny = Math.max(miny, yy+y[j]);
			}
			y[i] = miny;
		}
		for(int i = 0; i < n; i++){
			System.out.print(y[i]+" ");
		}
		

	}

	
	
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(String s) {
			try{
				br = new BufferedReader(new FileReader(s));
			}
			catch(FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		public FastScanner(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String nextToken()	{
			while(st == null ||!st.hasMoreElements()){
				try {
				st = new StringTokenizer(br.readLine());}
				catch(IOException e) {
					e.printStackTrace();
				}			
			}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(nextToken());
		}
		long nextLong() {
			return Long.parseLong(nextToken());
		}
		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
		String next() {
			return nextToken();
		}
		
	}
}
 Complexity:
targets: quadratic
inputs: import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        if (n%2==0) {
            System.out.println(4+" "+(n-4));
        } else {
            System.out.println(9+" "+(n-9));
        }

        in.close();
        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: constant
inputs: import java.io.*;
import java.util.*;

public class C
{	
	static long mod=(long)(1e9+7);
	public static long powMod(long e,long b)
	{
		/*e=e%mod;*/
		long res=1;
		
		while(e>0)
		{
			if(e%2==1)
				res=res*b%mod;
			e/=2;
			b=b*b%mod;
		}
		return res;
	}

		public static void main(String[] args) throws IOException 
		{
			Scanner sc=new Scanner(System.in);
			PrintWriter pw=new PrintWriter(System.out);
			long x=sc.nextLong(),k=sc.nextLong();
			if(x==0)
			{
				System.out.println(0);
				return;
			}
			
			if(k==0)
			{
				pw.println((2*x)%mod);
				
				
				pw.close();return;
			}
			
			long ans=2*x-1;
			ans=ans%mod;
			
			long b=powMod(k,2);
			ans=((ans*b)+1)%mod;
			
			
			pw.println(ans);
			
			pw.close();
		
			
		}
		
		
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
} What is the time complexity of the previous code?
targets: logn
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
 */
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);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt();
            boolean[] isF = new boolean[n];
            for (int i = 0; i < n; i++) {
                isF[i] = in.readCharacter() == 'f';
            }
            FenwickTree[] fenwickTrees = new FenwickTree[n + 1];
            for (int i = 0; i < fenwickTrees.length; i++) {
                fenwickTrees[i] = new FenwickTree(n + 1);
            }
            fenwickTrees[n].add(0, 1);
            for (int idx = n - 1; idx >= 0; idx--) {
                for (int indentLevel = 0; indentLevel < n; indentLevel++) {
                    long fenwickRes;
                    if (isF[idx]) {
                        fenwickRes = fenwickTrees[idx + 1].get(indentLevel + 1, indentLevel + 1);
                    } else {
                        fenwickRes = fenwickTrees[idx + 1].get(0, indentLevel);
                    }
                    fenwickTrees[idx].add(indentLevel, fenwickRes % MiscUtils.MOD7);
                }
            }
            out.printLine(fenwickTrees[0].get(0, 0));
        }
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int... 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.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class A {

    public A() throws Exception {
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = in.nextInt();
        int[] arr2 = arr.clone();
        Arrays.sort(arr2);
        int diff = 0;
        for (int i=0; i<n; i++) {
            if (arr2[i]!=arr[i]) diff++;
        }
        if (diff<=2) System.out.println("YES");
        else System.out.println("NO"); 
    }

    Scanner in = new Scanner(System.in);
    StringBuilder buf = new StringBuilder();
    public static void main(String[] args) throws Exception { // {{{
        new A();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
    public static class Scanner { // {{{
        BufferedReader br;
        String line;
        StringTokenizer st;
        public Scanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }
        public boolean hasNext() throws IOException {
            while ((st==null||!st.hasMoreTokens())&&(line=br.readLine())!=null)
                st = new StringTokenizer(line);
            return st.hasMoreTokens();
        }
        public String next() throws IOException {
            if (hasNext()) return st.nextToken();
            throw new NoSuchElementException();
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    } // }}}
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: nlogn
inputs: import java.io.*;
import java.math.*;
import java.util.*;

public class StringRepeat
{
	static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );

	public static void main( String[] args )
	{
		String s = in.next();
		int n = s.length(), ans = 0;
		for( int i = 0; i < n; i++ ) for( int j = i+1; j < n; j++ )
		{
			int l = 0;
			while( j+l<n && s.charAt(i+l)==s.charAt(j+l) ) l++;
			ans = Math.max( ans, l );
		}
		System.out.println( ans );
	}
}
 What is the time complexity of the previous code?
targets: cubic
inputs: import java.util.*;
import java.io.*;


public class C994{
	static double area(double x1,double y1,double x2,double y2,double x3,double y3){
		return Math.abs((x1 * (y2 - y3) +  
        x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0); 
	}
	public static void main(String args[])throws IOException{
		Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter pw=new PrintWriter(System.out);
		int x11=sc.nextInt();
		int y11=sc.nextInt();
		int x12=sc.nextInt();
		int y12=sc.nextInt();
		int x13=sc.nextInt();
		int y13=sc.nextInt();
		int x14=sc.nextInt();
		int y14=sc.nextInt();
		double x1c=(x11+x12+x13+x14)/4.0;
		double y1c=(y11+y12+y13+y14)/4.0;
		int x21=sc.nextInt();
		int y21=sc.nextInt();
		int x22=sc.nextInt();
		int y22=sc.nextInt();
		int x23=sc.nextInt();
		int y23=sc.nextInt();
		int x24=sc.nextInt();
		int y24=sc.nextInt();
		double x2c=(x21+x22+x23+x24)/4.0;
		double y2c=(y21+y22+y23+y24)/4.0;
		double a1=area(x11,y11,x12,y12,x13,y13)+area(x11,y11,x13,y13,x14,y14);
		double... 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: 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 {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void solve() throws IOException {
		int n = readInt();
		int m = readInt();
		int k = readInt();
		int[] a = readArr(n);
		Arrays.sort(a);
		for(int i = 0; i <= n; i++){
			int curR = k;
			for(int j = n-1; j >= n-i; j--){
				curR += a[j];
			}
			curR -= i;
			if(curR >= m){
				out.println(i);
				return;
			}
		}
		out.println(-1);
	}

	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()) {
			tok = new StringTokenizer(in.readLine());
		}
		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());
	}

	int[] readArr(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = readInt();
		}
		return res;
	}

	long[] readArrL(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = readLong();
		}
		return res;
	}

	public static void main(String[] args) {
		new A().run();
	}

	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
} Complexity:
targets: nlogn
inputs: import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class GeorgeAndInterestingGraph {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        int[] edgeFrom = new int[M];
        int[] edgeTo = new int[M];
        for (int i = 0; i < M; i++) {
        	edgeFrom[i] = sc.nextInt();
        	edgeTo[i] = sc.nextInt();
        }
        
        int best = Integer.MAX_VALUE;
    	boolean[][] adjMat = makeAdjMat(N, edgeFrom, edgeTo);
        for (int i = 0; i < N; i++) {
        	boolean[][] mat = copyOfArray2d(adjMat);
        	best = Math.min(best, count(mat, M, i));
        }
        
        System.out.println(best);
    }
    
    public static boolean[][] copyOfArray2d(boolean[][] arr) {
    	int N = arr.length;
    	int M = arr[0].length;
    	boolean[][] copy = new boolean[N][M];
    	for (int i = 0; i < N; i++) {
    		System.arraycopy(arr[i], 0, copy[i], 0, M);
    	}
    	return copy;
    }
    
    public static int count(boolean[][] mat, int M, int center) {
    	int N = mat.length;
    	
    	int centerCount = (mat[center][center]) ? 1 : 0;
    	for (int i = 0; i < N; i++) {
    		if (i != center) {
    			if (mat[i][center]) {
    				centerCount++;
    			}
    			if (mat[center][i]) {
    				centerCount++;
    			}
    		}
        	mat[i][center] = false;
        	mat[center][i] = false;
    	}
    	int other = M - centerCount;
    	
    	int matches = bipartiteMatching(mat);
    	
    	return (2 * N - 1 - centerCount + other - matches + N - 1 - matches);
    }
    
    public static boolean[][] makeAdjMat(int N, int[] edgeFrom, int[] edgeTo) {
    	boolean[][] mat = new boolean[N][N];
    	for (int i = 0; i < edgeFrom.length; i++) {
    		int from = edgeFrom[i] - 1;
    		int to = edgeTo[i] - 1;
    		mat[from][to] = true;
    	}
    	return mat;
    }
    
    /**
     * Returns true if a matching for... What is the time complexity of the previous code?
targets: cubic
inputs: import java.io.*;
import java.util.*;

public class E2
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    // BufferedReader in;
    StringTokenizer tok;

    public void go() throws IOException
    {
        // long start = System.nanoTime();
        // in = new BufferedReader(new FileReader(new File("input.txt")));
        StringTokenizer tok = new StringTokenizer(in.readLine());
        int zzz = Integer.parseInt(tok.nextToken());
        for (int zz = 0; zz < zzz; zz++)
        {
            ntok();
            int n = ipar();
            int m = ipar();
            int[][] mat = new int[m][n+1];
            for (int i = 0; i < n; i++)
            {
                ntok();
                for (int e = 0; e < m; e++)
                {
                    mat[e][i] = ipar();
                }
            }
            for (int i = 0; i < m; i++)
            {
                for (int e = 0; e < n; e++)
                {
                    mat[i][n] = Math.max(mat[i][n], mat[i][e]);
                }
            }
            ArrayList<int[]> list = new ArrayList<>();
            for (int i = 0; i < m; i++)
            {
                list.add(mat[i]);
            }
            Collections.sort(list, (a, b) -> {
                return -Integer.compare(a[n], b[n]);
            });
            for (int i = 0; i < m; i++)
            {
                mat[i] = list.get(i);
            }
            m = Math.min(m, n);

            int[][] dp = new int[1 << n][m+1];
            for (int i = m-1; i >= 0; i--)
            {
                int[] temp = new int[1 << n];
                for (int r = 0; r < n; r++)
                {
                    for (int j = 0; j < 1 << n; j++)
                    {
                        temp[j] = dp[j][i+1];
                    }
                    for (int j = 0; j < n; j++)
                    {
                        int val =... What is the time complexity of the previous code?
targets: np
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskG {
        static int[][] g;
        static int n;
        static int[] a;
        static int[][] edges;
        static long[] dp;
        static long[] dpPathToRootWithDetours;
        static int time = 0;
        static int[] appearance;
        static int[] firstAppearance;
        static int[] depth;

        public static void dfs(int i, int parE) {
            firstAppearance[i] = time;
            appearance[time++] = i;
            dp[i] = a[i];
            for (int eIndex : g[i]) {
                if (eIndex == parE) continue;
                int child = i ^ edges[eIndex][0] ^ edges[eIndex][1];
                dfs(child, eIndex);
                appearance[time++] = i;
                dp[i] += Math.max(dp[child] - edges[eIndex][2] * 2, 0);
            }
        }

        public static void dfs2(int i, int parE) {
            if (i == 0) {
                dpPathToRootWithDetours[i] = dp[i];
            } else {
                int par = i ^ edges[parE][0] ^ edges[parE][1];
                depth[i] = depth[par] + 1;
                dpPathToRootWithDetours[i] = dpPathToRootWithDetours[par] - Math.max(0, dp[i] - edges[parE][2] * 2);
                dpPathToRootWithDetours[i] -= edges[parE][2];
                dpPathToRootWithDetours[i] += dp[i];

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


public class ToyArmy {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException 
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		System.out.println(n / 2 * 3);
	}

}
 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.io.*;
import java.text.*;
import java.math.*;
import java.util.*;

public class Hexadec implements Runnable {

    final static String taskname = "filename";

    public void solve() throws Exception {
    //	int n = iread();	
    	int n = Integer.parseInt(in.readLine());
    	
    	
    	
    	out.write(n + " "+0+" "+0);
    //    out.write(ans_path + "\n");
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new BufferedWriter(new OutputStreamWriter(System.out));
//             in = new BufferedReader(new FileReader(taskname + ".in"));
//             out = new BufferedWriter(new FileWriter(taskname + ".out"));
            solve();
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public int iread() throws Exception {
        return Integer.parseInt(readword());
    }

    public double dread() throws Exception {
        return Double.parseDouble(readword());
    }

    public long lread() throws Exception {
        return Long.parseLong(readword());
    }

    BufferedReader in;

    BufferedWriter out;

    public String readword() throws IOException {
        StringBuilder b = new StringBuilder();
        int c;
        c = in.read();
        while (c >= 0 && c <= ' ')
            c = in.read();
        if (c < 0)
            return "";
        while (c > ' ') {
            b.append((char) c);
            c = in.read();
        }
        return b.toString();
    }

    public static void main(String[] args) {
        // Locale.setDefault(Locale.US);
        new Thread(new Hexadec()).start();
    }
} 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.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class ProblemB {
    
    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        String[] line = s.readLine().split(" ");
        long n = Long.valueOf(line[0]);
        long y = Long.valueOf(line[1]);
        long x = Long.valueOf(line[2]);
        long c = Long.valueOf(line[3]);
        
        long min = 0;
        long max = n*2L+20;
        for (int cnt = 0 ; cnt < 300 ; cnt++) {
            long med = (min+max) / 2L;
            long ct = isok(med, n, x, y, c); 
            if (ct >= c) {
                max = med;
            } else {
                min = med+1;
            }
        }
        
        long lst = max;
        for (long d = -2 ; d <= 2 ; d++) {
            if (max+d >= 0 && isok(max+d, n, x, y, c) >= c) {
                lst = Math.min(lst, max+d);
            }
        }
        
        out.println(lst);
        out.flush();
    }
    

    private static long isok(long time, long n, long x, long y, long c) {
        long total = time * 2 * (time + 1) + 1;
        long top = y - time;
        if (top <= 0) {
            long dy = Math.abs(top)+1;
            total -= dy*dy;
            long over = dy - x;
            if (over >= 1) {
                total += (1L + over) * over / 2; 
            }
            over = dy - ((n + 1) - x);
            if (over >= 1) {
                total += (1L + over) * over / 2; 
            }
        }
        
        long bottom = y + time;
        if (bottom > n) {
            long dy = Math.abs(bottom-n);
            total -= dy*dy;
            long over = dy - x;
            if (over >= 1) {
                total += (1L + over) * over / 2; 
            }
            over = dy - ((n + 1) -... What is the time complexity of the previous code?
targets: logn
inputs: import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class F1141 {
	
	private static class Interval {
		public int l;
		public int r;
		
		public Interval(int l,int r) {
			this.l = l;
			this.r = r;
		}
	}

	public static void main(String[] args) throws IOException {
//		BufferedReader br = new BufferedReader(new FileReader("F:/books/input.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		int n = Integer.parseInt(s);
		long[] a = new long[n];
		String[] as = br.readLine().split(" ");
		for(int i=0;i<n;i++) {
			a[i] = Long.parseLong(as[i]);
		}
		StringBuffer sb = solve(a,n);
		System.out.println(sb.toString());
	}

	private static StringBuffer solve(long[] a, int n) {
		StringBuffer ret = new StringBuffer("");
		Map<Long,List<Interval>> mp = new HashMap<Long,List<Interval>>();
		long max = 0,maxId = -1;
		for(int i=n-1;i>=0;i--) {
			long s=0;
			long prev = 1;
			for(int j=i;j<n;j++) {
				s+=a[j];
//				System.out.println(i+","+j);
				Interval inter = new Interval(i,j);
//				if(prev==1 || prev==-1) {
					List<Interval> ints = mp.get(s);
					if(ints==null) ints = new ArrayList<Interval>();
					if(ints.size()==0 || ints.get(0).l>j) {
						ints.add(0,inter);
					}
					if(ints.size()>max) {
						max = ints.size();
						maxId = s;
					}
					mp.put(s, ints);
//				}
				if(j<n-1) prev =  a[j+1]-a[j];
			}
		}
		List<Interval> l = mp.get(maxId);
		ret.append(l.size()+ "\n");
		for(Interval inter : l) {
			ret.append((inter.l+1) + " " + (inter.r+1) + "\n");
		}
		return ret;
	}

}
 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.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Round364C {
	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		k = 0;
		
		String line = sc.nextLine();
		
		ArrayList<Character> poks = new ArrayList<Character>();
		boolean ex[] = new boolean[256];
		
		for(int i=0; i<n; i++)
		{
			if(!ex[line.charAt(i)])
			{
				ex[line.charAt(i)] = true;
				poks.add(line.charAt(i));
			}
		}
		
		
		int l = 0;
		int r = 0;
		int dist = 1;
		int occ[] = new int[256];
		occ[line.charAt(0)] = 1;
		
		int min = n;
		while(r < n)
		{
			if(dist == poks.size())
				min = Math.min(min, r - l + 1);
			if(l < r && dist == poks.size())
			{
				
				occ[line.charAt(l)]--;
				if(occ[line.charAt(l)] == 0)
					dist--;
				l++;
				continue;
			}
			if(r < n-1){
				occ[line.charAt(r+1)]++;
				if(occ[line.charAt(r+1)] == 1)
					dist++;
			}
			r++;
		}
		System.out.println(min);
		
	}
	
	static int n,k;
	static int dp[][][];
	
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner(FileReader f) {
			br = new BufferedReader(f);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
	}
}
 Complexity:
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.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	private static class Interval implements Comparable<Interval> {
		public int start , end;
		public Interval(int start , int end) {
			this.start = start;
			this.end = end;			
		}
		@Override
		public int compareTo(Interval interval) {
			return this.end - interval.end;			
		}		
	}
	
	private static int getTotal(List<Interval> list) {
		int ans = 0 , i , n = list.size();
		for (i = 0;i < n;i ++) {
			int end = list.get(i).end;
			while (i < n && list.get(i).start <= end) {
				i ++;				
			}
			i --;
			ans ++;
		}		
		return ans;
	}
	
	private static void solve(List<Interval> list) {
		List<int[]> ans = new ArrayList<>();
		int i , n = list.size();
		for (i = 0;i < n;i ++) {
			int start = list.get(i).start , end = list.get(i).end;
			while (i < n && list.get(i).start <= end) {
				i ++;				
			}
			i --;
			ans.add(new int[] {start , end});
		}
		System.out.println(ans.size());
		for (int[] array : ans) {
			System.out.println(array[0] + " " + array[1]);
		}
	}
	
	private static long[] a = new long[2000];	
	
	public static void main(String[] args) {																	
	
		Scanner scan = new Scanner(System.in);				

		Map<Long , List<Interval>> map = new HashMap<>();		
		int i , j , n = scan.nextInt() , max = 0;
		long ans = 0;
		for (i = 1;i <= n;i ++) {
			a[i] = scan.nextLong();
		}
		for (i = 1;i <= n;i ++) {
			long sum = 0;
			for (j = i;j <= n;j ++) {				
				sum += a[j];
				if (!map.containsKey(sum)) {
					map.put(sum , new ArrayList<>());
				}
				map.get(sum).add(new Interval(i , j));				
			}
		}
		for (List<Interval> list : map.values()) {
			Collections.sort(list);			
		}		
		for (Map.Entry<Long , List<Interval>> entry : map.entrySet()) {
			int total = getTotal(entry.getValue());
			if (total > max) {
				max = total;
				ans = entry.getKey();				
			}
		}
		solve(map.get(ans));		
	
	}
    
}


 Complexity:
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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main2 {

    static int mod = 1000000007;
    static FastScanner scanner;

    public static void main(String[] args) {
        scanner = new FastScanner();
        long n = scanner.nextInt();
        long k = scanner.nextInt();

        if (sum(n) == k) {
            System.out.println(0);
            return;
        }

        long s = 0;
        long e = n + 1;
        while (s < e - 1) {
            long m = (s + e) / 2;
            long put = sum(n - m);
            long candiesLeft = put - m;
            if (candiesLeft == k) {
                System.out.println(m);
                return;
            }
            if (candiesLeft > k) {
                s = m;
            } else {
                e = m;
            }
        }
    }

    static long sum(long n) {
        long last = 1 + n - 1;
        return ((1 + last) * n) / 2;
    }

    static class WithIdx {
        int val, idx;

        public WithIdx(int val, int idx) {
            this.val = val;
            this.idx = idx;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
               ... Complexity:
targets: logn
inputs: import java.util.Scanner;

public class Task1 {

    public static void main(String[] args) {
        int n = new Scanner(System.in).nextInt();
        System.out.println(n*3/2);
    }
}
 What is the time complexity of the previous code?
targets: constant
inputs: import java.util.*;
import java.io.*;
import java.text.*;

public class CF_1523_C{
    //SOLUTION BEGIN
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int N = ni();
        int[] A = new int[N];
        for(int i = 0; i< N; i++)A[i] = ni();

//        Stack<Integer> stack = new Stack<>();
        int[] stack = new int[2*N];
        int sz = 0;
        for(int i = 0; i< N; i++){
            if(A[i] == 1)stack[sz++] = 1;
            else{
                while (sz > 0 && stack[sz-1]+1 != A[i])sz--;//!stack.isEmpty() && stack.peek()+1 != A[i])stack.pop();
                hold(sz != 0);
                stack[sz-1]++;
                hold(stack[sz-1] == A[i]);
            }
            hold(sz != 0);
            StringBuilder st = new StringBuilder();
            for(int s = 0; s< sz; s++){
                st.append(stack[s]);
                if(s+1 < sz)st.append(".");
            }
            pn(st.toString());
        }
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}
    final long IINF = (long)1e17;
    final int INF = (int)1e9+2;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = true, memory = true, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = multipleTC? ni():1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
       ... What is the time complexity of the previous code?
targets: cubic