Muennighoff/xP3x-sample huggingface dataset:
inputs: import java.awt.Point;
import java.util.Scanner;

public class p105b {
    static int[] b, l;
    static int n;
    static int A;
    static boolean[] masks;
    static double max;

    public static double work(int index, int k, int mask) {
        if (index == n) {
            if (Integer.bitCount(mask) * 2 <= n) {
                int sum = 0;
                for (int i = 0; i < n; i++) {
                    if (((1 << i) & mask) == 0) {
                        sum += b[i];
                    }
                }
                return (A * 1.0) / (A * 1.0 + sum);
            }
            return 1;
        }
        double max = 0;
        int to = Math.min(k, (100 - l[index]) / 10);

        for (int i = to; i >= 0; i--) {
            double loy = l[index] + i * 10;

            double b = ((100.0 - loy) / 100.0) * work(index + 1, k - i, mask);

            double a = (loy / 100.0)
                    * work(index + 1, k - i, (mask | (1 << index)));

            max = Math.max(max, a + b);
        }
        return max;
    }

    public static void rec(int index, int k) {
        if (k == -1)
            return;
        if (index == n) {
            double tot = 0;
            for (int i = 0; i < 1 << n; i++) {
                double temp = 1.0;
                int bb = 0;
                for (int j = 0; j < n; j++) {
                    if(l[j]>100)
                        return;
                    if (((1 << j) & i) != 0) {
                        temp *= (l[j] * 1.0 / 100.0);
                    } else {
                        bb += b[j];
                        temp *= ((100.0 - l[j]) / 100.0);
                    }
                }
                if (Integer.bitCount(i) * 2 <= n) {
                    temp *= (A * 1.0) / (A * 1.0 + bb);
                }
                tot += temp;
            }
            max = Math.max(max, tot);
            return;
        }
        l[index] += 10;
        rec(index, k - 1);
        l[index] -= 10;
        rec(index + 1, k);
    }

    public static void... 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: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. //package Educational35;

//import FastScanner.Competitive;

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 D {
        String INPUT = "4\n" +
                "1 2 4 3\n" +
                "4\n" +
                "1 1\n" +
                "1 4\n" +
                "1 4\n" +
                "2 3";

        void solve()
        {
                final int n = i();
                final int[] a = ia(n);
                int count = 0 ;
                for(int i = 0 ; i<n-1 ; i++)
                {
                        for(int j = i+1; j<n ; j++)
                        {
                                if(a[j]<a[i])
                                {
                                        count++;
                                }
                        }
                }
                final int q = i();
                for(int i = 0 ; i<q ; i++)
                {
                        final int l = i(), r=i();
                        final int mid = (r-l+1)/2;
                        if(mid%2==0)
                        {
                                out.println(count%2==0?"even":"odd");
                        }
                        else
                        {
                                count++;
                                out.println(count%2==0?"even":"odd");
                        }
                }


        }
        ///////////////////////////////////////
        void run() throws Exception{
                is = oj ? System.in: new ByteArrayInputStream(INPUT.getBytes());
                //is = System.in;
                out = new PrintWriter(System.out);
                int t = 1;
                while(t-->0)	solve();
                out.flush();
        }
        public static void main(String[] args)throws Exception {
                new D().run();
        }
        InputStream is;
        PrintWriter out;
        private... 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.util.Scanner;

//import java.util.Scanner;




public class SingleWildcard {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input =new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		char[] s1 =new char[a];
		s1 = input.next().toCharArray();
		
		char[] s2 = new char[b];
		s2 = input.next().toCharArray();
	    boolean condition = false;
	    for(int i=0; i<a;i++){
	    	if(s1[i]=='*'){
	    		condition= true;
	    		break;
	    	}
	    }
	   
	    if(!condition){
	    	if(match(s1,s2)){
	    		System.out.println("YES");
	    		
	    	}
	    	else
	    		System.out.println("NO");
	       return;
	    }
	    else{
	    	int i=0;
	    	if(s1.length-1>s2.length){
	    		System.out.println("NO");
	    		return;
	    	}
	    	while(i<s1.length && i<s2.length && s1[i]==s2[i]){
	    		i++;
	    	}
	    	int j=s2.length-1;
	    	int k = s1.length-1;
	    	while(j>=0 && k>=0 &&  s1[k]==s2[j] && i<=j){
	    		j--;
	    		k--;
	    	}
	    	//System.out.println(i);
	    	if(i==k && i>=0 && i<s1.length && s1[i]=='*' ){
	    		System.out.println("YES");
	    		return;
	    	}
	    	System.out.println("NO");
	    }
		
		
	}
	
	static boolean match(char[] s1,char[] s2){
		if(s1.length!=s2.length)return false;
		for(int i=0; i<s1.length;i++){
			if(s1[i]!=s2[i])return false;
		}
		return true;
	}
	

}
 Complexity:
targets: linear
inputs: import java.util.Arrays;
import java.util.Scanner;
import static java.lang.Math.*;

public class a111 {
    public static void debug(Object... obs) {
        System.out.println(Arrays.deepToString(obs));
    }

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n=sc.nextInt();
        int[]a=new int[n];
        
        int su=0;
        for(int i=0;i<n;i++)
        {
            a[i]=-sc.nextInt();
            su+=-1*a[i];
        }
        Arrays.sort(a);
        
        
        int ss=0;
        for(int i=0;i<n;i++)
        {
            ss+=-1*a[i];
            su-=-1*a[i];
            if(ss > su)
            {
                System.out.println(i+1);
                return;
            }
        }
        
    }
}
 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 DD {
    public static void main(String args[]) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        long k=Long.parseLong(br.readLine());
        long ans=9*(int)Math.pow(10,0);
        int c=0;
        long start=0;
        while(k>ans) {
            c++;
            start=ans;
            ans+=9*(long)Math.pow(10,c)*(c+1);

        }
        long ms=(k-start-1)%(c+1);
        long a=(long)Math.pow(10,c)+(k-start-1)/(c+1);
        System.out.println((a+"").charAt((int)ms));
    }
}
 What is the time complexity of the previous code?
targets: logn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author pandusonu
 */
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 {
        public int mod = (int) Math.pow(10, 9) + 7;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            // out.print("Case #" + testNumber + ": ");
            int n = in.readInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.readString().charAt(0) == 'f' ? 1 : 0;
            }
            long[][] ans = new long[n][n + 2];
            ans[0][0] = 1;
            int indent = 0;
            if (a[0] == 1) indent++;
            for (int i = 1; i < n; i++) {
                if (a[i - 1] == 1) {
                    for (int j = indent - 1; j >= 1; j--) {
                        ans[i][j] = ans[i - 1][j - 1];
                    }
                    ans[i][indent] = 1;
                } else {
                    for (int j = indent; j >= 0; j--) {
                        ans[i][j] = (ans[i][j + 1] + ans[i - 1][j]) % mod;
                    }
                }
                indent += a[i];
            }/*
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                out.print(ans[i][j]+" ");
            }
            out.println();
        }*/
            long aa = 0;
            for (int i = 0; i < n + 2; i++) {
                aa = (aa + ans[n - 1][i]) % mod;
            }
           ... 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.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class C {

    static int MOD = 1_000_000_007;

    public static void main(String[] args) {

        MyScanner in = new MyScanner();
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        char prev = ' ';

        // index, maxNumOfIntents -> count
        int[][] dp = new int[n+1][n+2];

        dp[0][0] = 1;
        for(int i=0;i<n;++i){
            char ch = in.next().charAt(0);
            if(prev == 's'){
                int sum = 0;
                for(int j=n;j>=0;--j){
                    sum = (sum + dp[i-1][j]) % MOD;
                    dp[i][j] = sum;
                }
            }else if(prev == 'f'){
                for(int j=0;j<n;++j){
                    dp[i][j+1] = dp[i-1][j];
                }
            }

            prev = ch;
        }

        int result = 0;
        for(int i=0;i<=n;++i){
            result = (result + dp[n-1][i]) % MOD;
        }


        out.println(result);
        out.close();

    }


    // -----------MyScanner class for faster input----------
    public 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() {
           ... Complexity:
targets: quadratic
inputs: import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;

public class E3 {
	InputStream is;
	FastWriter out;
	String INPUT = "";
	
	void solve()
	{
		for(int T = ni();T > 0;T--)go();
	}

	int[] lpf = enumLowestPrimeFactors(10000000);

	void go()
	{
		int n = ni(), K = ni();
		int[] a = na(n);
		for(int i = 0;i < n;i++){
			a[i] = factorFast(a[i], lpf);
		}
		a = shrink(a);

		int[][] dp = new int[K+1][n+1];
		for(int i = 0;i <= K;i++){
			Arrays.fill(dp[i], 999999999);
		}
		for(int i = 0;i <= K;i++)dp[i][0] = 0;

		int[] prev = makePrev(a, n+1);

		int[] imos = new int[n+5];
		int[] pp = new int[K+1];
		int[] vs = new int[K+1];
		for(int i = 0;i < n;i++){
			int p = prev[i];
			imos[p+1]--;

			for(int j = 0;j <= K;j++){
				vs[j]++;
				if(pp[j] >= p+1){
					vs[j]--;
				}
				while(vs[j] > j){
					pp[j]++;
					vs[j] += imos[pp[j]];
				}
				for(int k = 0;k+j <= K;k++){
					dp[k+j][i+1] = Math.min(dp[k+j][i+1], dp[k][pp[j]] + 1);
				}
			}
		}
		out.println(dp[K][n]);
	}

	public static int[] shrink(int[] a) {
		int n = a.length;
		long[] b = new long[n];
		for (int i = 0; i < n; i++) b[i] = (long) a[i] << 32 | i;
		Arrays.sort(b);
		int[] ret = new int[n];
		int p = 0;
		for (int i = 0; i < n; i++) {
			if (i > 0 && (b[i] ^ b[i - 1]) >> 32 != 0) p++;
			ret[(int) b[i]] = p;
		}
		return ret;
	}


	public static int[] makePrev(int[] a, int sup)
	{
		int n = a.length;
		int[] mnext = new int[sup];
		Arrays.fill(mnext, -1);
		int[] next = new int[n];
		for(int i = 0;i < n;i++){
			next[i] = mnext[a[i]];
			mnext[a[i]] = i;
		}
		return next;
	}

	public static int factorFast(int n, int[] lpf)
	{
		int ret = 1;
		int e = 0;
		int last = -1;
		while(lpf[n] > 0) {
			int p = lpf[n];
			if (last != p) {
				if (last > 0 && e % 2 == 1) {
					ret = ret * last;
				}

				last = p;
				e = 1;
			} else {
				e++;
			}
			n /= p;
		}

		if(last > 0 && e % 2 == 1){
			ret *= last;
		}
		return ret;
	}


	public static int[]... 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.util.*;
import java.lang.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
 
public class Main {
    
    public static void main(String[] args) throws Exception{
        FastReader sc=new FastReader(); 
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Main mm=new Main();
        long n=sc.nextLong();
        long k=sc.nextLong();
        long l=0;
        long r=1000000000;
        long ans=-1;
        while(l<=r) {
            long mid=(l+r)/2;
            if(n-mid<=0) {
                r=mid-1;
            }
            else {
                long temp=(n-mid)*(n-mid+1)-(2*mid);
                if(temp==2*k) {
                    ans=mid;
                    break;
                }
                else if(temp<2*k) {
                    r=mid-1;
                }
                else if(temp>2*k) {
                    l=mid+1;
                }
            }
        }
        System.out.println(ans);
    }  
}


class FastReader 
{ 
    BufferedReader br; 
    StringTokenizer st; 
 
    public FastReader() 
    { 
        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) 
    ... What is the time complexity of the previous code?
targets: logn
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
public class Solution1 implements Runnable
{
	static final int MAX = 1000000007;
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}
		
		public 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++];
		}
	 
		public String nextLine()
		{
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();
			
			while(isSpaceChar(c)) 
				c = read();
			
			int sgn = 1;
			
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			
			int res = 0;
			do 
			{
				if(c<'0'||c>'9') 
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c)); 
			
			return res * sgn;
		}
		
		public long nextLong() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			long res = 0;
			
			do 
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}
		
		public double... What is the time complexity of the previous code?
targets: quadratic
inputs: import java.util.ArrayList;
import java.util.Scanner;

public class PaintTheNumber {

	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		
		ArrayList<Integer> l=new ArrayList<Integer>();
		
		for(int i=0; i<n; i++) {
			l.add(sc.nextInt());
		}
		
		boolean c=false;
		
		
			for(int i=0; i<l.size(); i++) {
				if(l.get(i)==-1)
					continue;
				for(int j=0; j<l.size(); j++) {
					
					if(i==j || l.get(j)==-1)
						continue;
					else {
						if(l.get(j)%l.get(i)==0) {
							l.set(j, -1);
						}
					}
				}
			}
			
			int nbr=0;
			for(int i=0; i<l.size(); i++)
				if(l.get(i)!=-1)
					nbr++;
			System.out.println(nbr);
	}

}
 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.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;


public class C_138B {
	private static BufferedReader in;
	private static StringTokenizer st;
	private static PrintWriter out;
	
	
	static String nextToken() throws IOException {
		while (!st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}
	
	static int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		st = new StringTokenizer("");
		out = new PrintWriter(new OutputStreamWriter(System.out));
		int n = nextInt();
		int k = nextInt();
		int [] a = new int [n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		Set<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < a.length; i++) {
			set.add(a[i]);
			if(set.size()==k){
				Set<Integer> set2 = new HashSet<Integer>();
				for (int j = i; j >= 0; j--) {
					set2.add(a[j]);
					if(set2.size()==k){
						out.print((j+1)+" "+(i+1));
						out.close();
						return;
					}
				}
			}
		}
		out.print("-1 -1");		
		out.close();
	}
}
 What is the time complexity of the previous code?
targets: linear
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class A {
	public static BufferedReader in;
	public static PrintWriter out;

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

		boolean showLineError = true;
		if (showLineError) {
			solve();
			out.close();
		} else {
			try {
				solve();
			} catch (Exception e) {
			} finally {
				out.close();
			}
		}

	}

	static void debug(Object... os) {
		out.println(Arrays.deepToString(os));
	}

	private static void solve() throws IOException {
		String[] line = in.readLine().split(" ");
		String l = Long.toBinaryString(Long.parseLong(line[0]));
		String r = Long.toBinaryString(Long.parseLong(line[1]));
		if(l.equals(r)){
			out.println(0);
			return;
		}
		int dif = r.length()-l.length();
		for(int i =0;i<dif;i++)
			l= "0"+l;
		int index=0;
		for(;index<r.length();index++){
			if(l.charAt(index)!=r.charAt(index))
				break;
		}
		long ret=1;
		for(int i=0;i<l.length()-index;i++)
			ret+=ret;
		ret--;
		out.println(ret);
		
	}

} What is the time complexity of the previous code?
targets: logn
inputs: import java.io.*;
import java.util.*;

public class A{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	public void solve(){
		int n=ni();
		int ans=0;
		int[] arr=na(n);
		for(int i=0;i<n;i++){
			for(int j=i+1; j<n; j++){
				if(arr[i] > arr[j]){
					ans^=1;
				}
			}
		}
		int m=ni();
		while(m-->0){
			int a=ni(), b=ni();
			int diff=Math.abs(a-b)+1;
			ans = ans ^ ((((diff-1)*diff)/2)%2);
			out.println(ans==0 ? "even" : "odd");
		}
	}

	void print(int n, long[][] memo){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				out.print(memo[i][j]+" ");
			}
			out.println();
		}
	}

	void run(){
		is = new DataInputStream(System.in);
		out = new PrintWriter(System.out);
		int t=1;while(t-->0)solve();
		out.flush();
	}
	public static void main(String[] args)throws Exception{new A().run();}
	//Fast I/O code is copied from uwi code.
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	private int readByte(){
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	private String ns(){
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	private char[] ns(int n){
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	private char[][] nm(int n, int m){
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return... 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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Solve4 {

    public static void main(String[] args) throws IOException {
      FastReader sc = new FastReader();
      int x= sc.nextInt();
      int y= sc.nextInt();
      int z= sc.nextInt();
      int t1= sc.nextInt();
      int t2= sc.nextInt();
      int t3= sc.nextInt();
      if(Math.abs(x-y)*t1 < (Math.abs(x-z)+Math.abs(x-y))*t2+3*t3 ) System.out.println("NO");
      else System.out.println("YES");
    }

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

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

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

        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());
        }

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException ex) {
            }
            return s;
        }
    }

}
 What is the time complexity of the previous code?
targets: constant
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long s = in.nextLong();
            long ans = 0;
            long i = 0;
            for (i = s; i <= n; i++) {
                long t = i - sum(i);
                if (t >= s) {
                    if (i % 10 == 9) {
                        break;
                    }
                    ans++;
                }
            }
            if (n >= s) {
                out.println(ans - i + n + 1);
            } else {
                out.println(0);
            }
        }

        static long sum(long a) {
            long sum = 0;
            while (a != 0) {
                sum += (a % 10);
                a /= 10;
            }
            return sum;
        }

    }
}

 What is the time complexity of the previous code?
targets: logn
inputs: import java.util.*;
import java.io.*;
import java.math.*;
import javax.script.*;

public class Noldbach {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		boolean[] sieve=new boolean[1001];
		sieve[2]=false;
		ArrayList<Integer> primes=new ArrayList<Integer>();
		for(int x=2;x<1001;x++)
			if(!sieve[x])
			{
				primes.add(x);
				for(int y=x;y<1001;y+=x)
					sieve[y]=true;
			}
		int sum=0;
		for(int x=2;x<=n;x++)
		{
			if(primes.contains(x))
			{
			int need=x-1;
			for(int y=0;y<primes.size()-1;y++)
			{
				if(primes.get(y)+primes.get(y+1)==need)
				{
					sum++;
					break;
				}
			}
			}
			if(sum==k)break;
		}
		if(sum==k)System.out.println("YES");
		else System.out.println("NO");
		
	}
	
} 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.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class A {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		String cur = sc.nextToken();
		int first = Integer.parseInt(cur);
		if(cur.length() > 1){
			String second = cur.substring(0,cur.length()-1);
			if(Character.isDigit(second.charAt(second.length()-1))){
				first = Math.max(first, Integer.parseInt(second));
			}
		}
		
		if(cur.length() > 2){
			String third = cur.substring(0,cur.length()-2) + cur.charAt(cur.length()-1);
			if(Character.isDigit(cur.charAt(cur.length()-2))){
				first = Math.max(first, Integer.parseInt(third));
			}
		}
		System.out.println(first);
		out.close();
	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				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) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}
 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.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
 
 
public class q5 {
	
	
	
    
  
	
 
	public static void main(String[] args) throws IOException {
	
	Reader.init(System.in);
	PrintWriter out=new PrintWriter(System.out);
	long n=Reader.nextInt();
	long k=Reader.nextLong();
	long v=8*n+8*k+4;
	long v2=(long) Math.sqrt(v);
	long v3=2*n+2;
	//long v4=(v3+v2)/2;
	long v5=(v3-v2)/2;
	out.println(v5);
	
	
	
	
	
	out.flush();
	}
}




 
 
 
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */
    static void init() throws IOException {
    	 reader = new BufferedReader(
                 new FileReader("detect.in"));
    tokenizer = new StringTokenizer("");
    }
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String nextLine() throws IOException{
    	return reader.readLine();
    }
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static 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: logn
inputs: import java.util.Scanner;


public class B {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Pipes pipes = new Pipes();
		pipes.solve();
		pipes.print();
	}

}

class Pipes {
	
	Pipes() {
		Scanner scr = new Scanner(System.in);
		n = scr.nextLong();
		k = scr.nextLong();
	}
	
	long bs(long nb, long nk) {
		
		long left = 2;
		long ls = (nk - left + 1) * (nk + left) / 2 - (nk - left);
		long right = nk;
		long rs = nk;
		
		if (nb > ls) {
			return -1;
		}
				
		long mid = left;
		
		while (rs < ls){
			mid = (left + right)/2;
			long ms = (nk - mid + 1) * (nk + mid) / 2 - (nk - mid);
			if (nb > ms) {
				right = mid;
				rs = ms;
			}
			else if (nb < ms){
				left = mid+1;
				ls = (nk - left + 1) * (nk + left) / 2 - (nk - left);
			}
			else {
				left = mid;
				break;
			} 
			
		}
		
		return left;
		
	}
	
	void solve() {
		long nn = n;
		long kk = k; 
		ans = 0;
		long ps = 1;
		long add;
		
		if (n == 1) {
			ans = 0;
			return;
		}
		
		nn = n - (ps - 1);
		while (nn > kk){
			add = bs(nn, kk);
			if (add == -1) {
				ans = -1;
				return;
			}
			else {
				ans = ans + (kk - add + 1);
			}
						
			long addn = (kk - add + 1) * (kk + add) / 2 - (kk - add); 
			ps = ps - 1 + addn;
			if (ps == n)
				return;
			nn = nn - (ps - 1);
			kk = add - 1;
		}
		
		if (nn > 0) {
			ans++;
		}
		
	}
	
	
	void print() {
		System.out.println(ans);
	}
	
	long ans;
	long n;
	long k;
}
 What is the time complexity of the previous code?
targets: logn
inputs: import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class _P015A{
    Scanner sc=new Scanner(System.in);

    int INF=1<<28;
    double EPS=1e-9;

    int n, t;
    int[][] a;

    void run(){
        n=sc.nextInt();
        t=sc.nextInt();
        a=new int[n][2];
        for(int i=0; i<n; i++){
            a[i][0]=sc.nextInt();
            a[i][1]=sc.nextInt();
        }
        solve();
    }

    void solve(){
        sort(a, new Comparator<int[]>(){
            @Override
            public int compare(int[] a0, int[] a1){
                return a0[0]-a1[0];
            }
        });
        int ans=2;
        for(int i=0; i<n-1; i++){
            int s=(a[i+1][0]*2-a[i+1][1])-(a[i][0]*2+a[i][1]);
            if(s>t*2){
                ans+=2;
            }else if(s==t*2){
                ans++;
            }
        }
        println(ans+"");
    }

    void println(String s){
        System.out.println(s);
    }

    void print(String s){
        System.out.print(s);
    }

    void debug(Object... os){
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args){
        new _P015A().run();
    }
}
 What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.*;
import java.util.*;

public class A {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    void solve() throws IOException {
        int n = nextInt();
        int[] a = new int[n];

        boolean onlyOnes = true;

        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
            if (a[i] != 1)
                onlyOnes = false;
        }

        Arrays.sort(a);
        if (onlyOnes) {
            for (int i = 0; i < n - 1; i++)
                out.print("1 ");
            out.print(2);
        } else {
            out.print("1 ");
            for (int i = 0; i < n - 1; i++)
                out.print(a[i] + " ");
        }

    }

    void inp() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

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

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    String nextString() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken("\n");
    }

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

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

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

}
 What is the time complexity of the previous code?
targets: nlogn
inputs: import java.util.Arrays;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        
        int n = s.nextInt();
        int m = s.nextInt();
        int k = s.nextInt();
        
        int a[] = new int [n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        int ans = 0;
        
        while(k < m){
            k--;
            int max = -1;
            int ix = -1;
            for (int i = 0; i < a.length; i++) {
                if(a[i] > max){
                    max = a[i];
                    ix = i;
                }
            }
            if(ix == -1){
                System.out.println("-1");
                return ;
            }
            k += a[ix];
            a[ix] = -1;
            ans++;
        }
        System.out.println(ans);
    }

}
 What is the time complexity of the previous code?
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 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();
		}
	}
} Complexity:
targets: logn
inputs: import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

/**
 * Created by timur on 28.03.15.
 */

public class TaskD {
    boolean eof;
    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

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

    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "-1";
            }
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }

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

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


    void run() throws IOException {
        InputStream input = System.in;
        PrintStream output = System.out;
        try {
            File f = new File("a.in");
            if (f.exists() && f.canRead()) {
                input = new FileInputStream(f);
                output = new PrintStream("a.out");
            }
        } catch (Throwable e) {
        }
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(output);
        solve();
        br.close();
        out.close();
    }

    long md(long x, long y, long x1, long y1) {
        return Math.abs(x - x1) + Math.abs(y - y1);
    }
    
    double md(double x, double y, double x1, double y1) {
        return Math.abs(x - x1) + Math.abs(y - y1);
    }

    double ed(double x, double y, double x1, double y1) {
        return Math.sqrt((x - x1) * (x - x1) +... What is the time complexity of the previous code?
targets: logn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;

public class Solution {

    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       long n = sc.nextLong();
       long itrIdx = 0;
       long itr = 0;
       long num = 0;
       while(itrIdx < n){
           itrIdx += (itr+1)*(Math.pow(10,itr+1) - Math.pow(10,itr));
           num+= (Math.pow(10,itr+1) - Math.pow(10,itr));
           itr++;
       }

        itrIdx -= itr*(Math.pow(10,itr)-Math.pow(10,itr-1));
        num -= (Math.pow(10,itr)-Math.pow(10,itr-1));
        long lastNum = num + ((n-itrIdx)/itr);
        long lastNumIndex = itrIdx + (itr* (lastNum-num));

        if(lastNumIndex == n){
            lastNumIndex = lastNumIndex-itr;
            lastNum -=1;
        }

        String nextNum = String.valueOf(lastNum+=1);
        System.out.println(nextNum.charAt((int) (n-lastNumIndex-1)));

    }
}


 Complexity:
targets: logn
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.nio.CharBuffer;
import java.util.NoSuchElementException;

public class P1195B {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int l = 0;
        int r = n;
        int ans = 0;
        while (l <= r) {
            int eat = (l + r) >> 1;
            int lastPut = n - eat;
            long totalPut = (long) (lastPut + 1) * lastPut / 2;
            long remain = totalPut - eat;
            if (remain == k) {
                ans = eat;
                break;
            } else if (remain > k)
                l = eat + 1;
            else
                r = eat - 1;
        }
        writer.println(ans);

        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
   ... Complexity:
targets: logn
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.math.BigInteger;
import java.util.*;

public class Main {
    static int MOD = 1000000007;

    // After writing solution, quick scan for:
    //   array out of bounds
    //   special cases e.g. n=1?
    //   npe, particularly in maps
    //
    // Big numbers arithmetic bugs:
    //   int overflow
    //   sorting, or taking max, after MOD
    void solve() throws IOException {
        int T = ri();
        for (int Ti = 0; Ti < T; Ti++) {
            int n = ri();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ri();
            Deque<int[]> stack = new ArrayDeque<>();
            stack.addLast(new int[]{1});
            pw.println("1");
            for (int i = 1; i < n; i++) {
                if (a[i] == 1) {
                    int[] prev = stack.peekLast();
                    int[] curr = new int[prev.length+1];
                    System.arraycopy(prev, 0, curr, 0, prev.length);
                    curr[curr.length-1] = 1;
                    printArr(curr);
                    stack.addLast(curr);
                    continue;
                }
                while (!stack.isEmpty()) {
                    int[] prev = stack.removeLast();
                    if (a[i] == prev[prev.length-1] + 1) {
                        prev[prev.length-1]++;
                        printArr(prev);
                        stack.addLast(prev);
                        break;
                    } else {
                        continue;
                    }
                }
            }
        }
    }
    // IMPORTANT
    // DID YOU CHECK THE COMMON MISTAKES ABOVE?

    void printArr(int[] a) {
        pw.print(a[0]);
        for (int j = 1; j < a.length; j++) pw.print("." + a[j]);
        pw.println();
    }

    // Template code below

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        Main m = new... Complexity:
targets: cubic
inputs: import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class A {
	public static void main(String[] args) throws Exception {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>(), list2;
		for (; n-- > 0;) {
			list.add(scan.nextInt());
		}
		list2 = new ArrayList<Integer>(list);
		Collections.sort(list2, new Comparator<Integer>() {
			public int compare(Integer o1, Integer o2) {
				return o1 % 2 - o2 % 2;
			}
		});
		System.out.println(list.indexOf(list2.get(list2.get(1) % 2 > 0 ? 0
				: list2.size() - 1)) + 1);
	}
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: linear