Muennighoff/xP3x-sample huggingface dataset:
inputs: import java.util.*;
import java.io.*;
import java.math.*;
public class A{

    void solve(){
        int n=ni();
        s=new char[n+1];
        s[0]='.';
        for(int i=1;i<=n;i++) s[i]=ns().charAt(0);
        dp=new long[5001][5001];

        dp[1][0]=1;
        long sum[]=new long[n+2];
        sum[0]=1;
        for(int i=2;i<=n;i++){
            for(int j=0;j<=n;j++) {
                if (s[i - 1] == 'f') {
                        if(j-1>=0) dp[i][j]=dp[i-1][j-1];
                        else dp[i][j]=0;
                }else {
                   dp[i][j]=sum[j];
                }
            }
            for(int j=n;j>=0;j--){
                sum[j]=(sum[j+1]+dp[i][j])%M;
            }
        }
        long ans=0;
        for(int i=0;i<=n;i++){
            ans+=dp[n][i];
            if(ans>=M) ans%=M;
        }
        pw.println(ans);

    }
    char s[];
    long dp[][];
    long go(int x,int cnt,int n){
   //    pw.println(x+" "+cnt);
        if(x>n) return 1;
        long cc=0;
        if(dp[x][cnt]!=-1) return dp[x][cnt];
        if(s[x]=='f'){
            cc=(cc+go(x+1,cnt+1,n))%M;
        }else {

            for(int j=cnt;j>=0;j--) cc=(cc+go(x+1,j,n))%M;
            if(x==n) cc=(cc-cnt+M)%M;
        }
        cc%=M;

        dp[x][cnt]=cc;
        return cc;
    }



    long M=(long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

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

    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... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: quadratic
inputs: import java.io.*;
import java.util.*;
import java.math.*;

public class p481a {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l <= 1) {
            System.out.println("-1");
        } else if (r - l >= 3) {
            if (l % 2 == 0) {
                System.out.println(l + " " + (l + 1) + " " + (l + 2));
            } else {
                System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));
            }
        } else {
            long g1 = GCD(l, (l + 1));
            long g2 = GCD((l + 1), (l + 2));
            long g3 = GCD(l, r);
            if (g1 == 1 && g2 == 1 && g3 != 1) {
                System.out.println(l + " " + (l + 1) + " " + r);
            } else {
                System.out.println("-1");
            }
        }
    }

    public static long GCD(long a, long b) {
        if (b == 0) return a;
        return GCD(b, a % b);
    }
} What is the time complexity of the previous code?
targets: constant
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
import java.io.*;

public class aaaaaaaaaaaaaaaa {
	public void run() throws Exception {
		Scanner file = new Scanner(System.in);
		int a = file.nextInt(), b= file.nextInt(), c = file.nextInt(), n = file.nextInt();
		a -= c;
		b -= c;
		if (a < 0 || b < 0) System.out.println(-1);
		else {
			int x = a + b + c;
			if (x >= n) System.out.println(-1);
			else System.out.println(n - x);
		}
	}

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

} Complexity:
targets: constant
inputs: import java.io.*;
import java.lang.reflect.*;

public class D {

	final int MOD = (int)1e9 + 7;
	final double eps = 1e-12;
	final int INF = (int)1e9;
	
	public D () {
		long L = sc.nextLong();
		long R = sc.nextLong();
		
		for (int i = 60; i >= 0; --i) {
			long b = (1L << i);
			long A = (L & b), B = (R & b);
			if (A != B)
				exit(2*b-1);
		}
		exit(0);
	}

	////////////////////////////////////////////////////////////////////////////////////

	/* Dear hacker, don't bother reading below this line, unless you want to help me debug my I/O routines :-) */
	
	static MyScanner sc = new MyScanner();
	
	static class MyScanner {
		public String next() {
			newLine();
			return line[index++];
		}
		
		public char nextChar() {
			return next().charAt(0);
		}
				
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		
		public String nextLine() {
			line = null;
			return readLine();
		}
		
		public String [] nextStrings() {
			line = null;
			return readLine().split(" ");
		}
		
		public char [] nextChars() {
			return next().toCharArray();
		}

		public Integer [] nextInts() {
			String [] L = nextStrings();
			Integer [] res = new Integer [L.length];
			for (int i = 0; i < L.length; ++i)
				res[i] = Integer.parseInt(L[i]);
			return res;
		}	
		
		public Long [] nextLongs() {
			String [] L = nextStrings();
			Long [] res = new Long [L.length];
			for (int i = 0; i < L.length; ++i)
				res[i] = Long.parseLong(L[i]);
			return res;
		}

		public Double [] nextDoubles() {
			String [] L = nextStrings();
			Double [] res = new Double [L.length];
			for (int i = 0; i < L.length; ++i)
				res[i] = Double.parseDouble(L[i]);
			return res;
		}

		public String [] next (int N) {
			String [] res = new String [N];
			for (int i = 0; i < N; ++i)
				res[i] = sc.next();
			return res;
		}
		
		public Integer [] nextInt (int N) {
			Integer [] res = new Integer... 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: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wilso
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class codeforces {
    static final long MOD2 = 998_244_353;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
       
        int tc = sc.ni();
//        int tc = 1;
        for (int rep = 0; rep < tc; rep++) {
            int N = sc.ni();
            int[] arr = sc.intArray(N);
            pw.println(solve(arr));
        }
        
        pw.close();
    }
 
    
    static String solve(int[] arr) {
        StringBuilder sb = new StringBuilder();
        List<Integer> list = new ArrayList();
        list.add(0);
        for (int i = 0; i < arr.length; i++) {
            int x = arr[i];
            for (int j = list.size() - 1; j >= 0; j--) {
                if (x - 1 == list.get(j)) {
                    list.set(j, x);
                    while (list.size() > j+1) {
                        list.remove(list.size() - 1);
                    }
                    list.add(0);
                    
                    //append
                    for (int idx = 0; idx < list.size() - 1; idx++) {
                        sb.append(list.get(idx) + ".");
                    }
                    sb.setLength(sb.length() - 1);
                    sb.append("\n");
                    break;
                }
            }
        }
        sb.setLength(sb.length() - 1);
        return sb.toString();
    }
   
    static int summation(int x) {
        return x * (x+1) / 2;
    }  
    static long pow(long num, long exp, long mod){
        long ans=1;
        for(int i=1;i<=exp;i++){
            ans=(ans*num)%mod;
        }
        return ans;
    }
    static boolean... Complexity:
targets: cubic
inputs: import java.io.*;
import java.util.*;
import java.math.*;

public class B {
	public static void main(String[] args) throws IOException {

		/**/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		/*/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("src/b.in"))));
		/**/
		
		int t = sc.nextInt();
		for (int z = 0; z < t; ++z) {
			int n = sc.nextInt();
			if (n%2==1) {
				System.out.println("NO");
				continue;
			}
			n/=2;
			int sqrt = (int)Math.sqrt(n);
			if (sqrt*sqrt==n) {
				System.out.println("YES");
				continue;
			}
			if (n%2==1) {
				System.out.println("NO");
				continue;
			}
			n/=2;
			sqrt = (int)Math.sqrt(n);
			if (sqrt*sqrt==n) {
				System.out.println("YES");
				continue;
			}
			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: 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 village {
    static int[] X, A;
    public void solve()
    {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(), T = in.nextInt();
        X = new int[N];
        A = new int[N];

        for(int i = 0; i < N; i++) {
            X[i] = in.nextInt(); A[i] = in.nextInt();
        }

        if(N == 1) {
            System.out.println("2");
            return; 
        }

        List<Integer> x = new ArrayList<Integer>();
        for(int i = 0; i < N; i++) {
            x.add(i);
        }

        Collections.sort(x, new Comp());

        int places = 0;
        for(int i = 0; i < N-1; i++) {
            double space = (X[x.get(i+1)]-X[x.get(i)]-A[x.get(i+1)]/2.0-A[x.get(i)]/2.0);
            if(space < T) {
                continue;
            } if(space - T < 1e-9) {
                places++;
            } else if(space > T) {
                places+=2;
            }
        }
        System.out.println(places+2);
    }

    public class Comp implements Comparator<Integer> {
            public int compare(Integer i1, Integer i2) {
                return X[i1]-X[i2];
            }
    }

    public static void main(String[] args)
    {
        new village().solve();
    }
}
  Complexity:
targets: nlogn
inputs: import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main {
    
    public static void main(String[] args) throws Exception {
        int i,j,k;
        int counter[] = new int[2];
        int a[] = new int[200];
        int needed;
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int N = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        for (i=1;i<=N;i++) {
            a[i] = Integer.parseInt(st.nextToken());
            counter[a[i]%2]++;
        }
        
        if (counter[0] == 1) {
            needed = 0;
        } else {
            needed = 1;
        }
        
        for (i=1;i<=N;i++) {
            if (a[i]%2 == needed) {
                System.out.println(i);
                return;
            }
        }
        
    }

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

public class A {

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

	void solve() throws IOException {
		int tot = nextInt();
		int ok = nextInt();
		
		int k = nextInt();
		
		int maxBad = tot / k;
		if (tot - maxBad >= ok) {
			out.println(ok);
			return;
		}
		
		
		int	dbl = ok + tot / k - tot;

		
		int dblPoints = pow(2, dbl + 1) - 2;
		while (dblPoints < 0)
			dblPoints += MOD;
		
		dblPoints = (int)((long)dblPoints * k % MOD);
		
		int rest = ok - dbl * k;
		
		int ans = dblPoints + rest;
		
		if (ans >= MOD)
			ans -= MOD;
		
		out.println(ans);
	}
	
	static int pow(int a, int b) {
		int ret = 1;
		while (b != 0) {
			if ((b & 1) == 1)
				ret = (int)((long)ret * a % MOD);
			a = (int)((long)a * a % MOD);
			b >>= 1;
		}
		return ret;
	}
	
	static final int MOD = 1000000009;

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

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

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	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: 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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class ElongatedMatrix {
	public static void main(String[] args) {
		InputStream input;
		OutputStream output;
		try {
			input = new FileInputStream("input.txt");
			output = new FileOutputStream("output.txt");
		} catch (FileNotFoundException e) {
			input = System.in;
			output = System.out;
		}
		Kattio io = new Kattio(input, output);
		(new Solve(io)).main();
		io.close();

		if (input instanceof FileInputStream)
			try {
				input.close();
			} catch (IOException e) {

			}
		if (output instanceof FileOutputStream)
			try {
				output.close();
			} catch (IOException e) {

			}
	}
}

class Solve {
	static final int oo = (int) 1e9;
	Kattio io;
	int n, m;
	int[][] a;
	int[][][] dp;
	int[][] diff;
	int[][] slant;

	Solve(Kattio io) {
		this.io = io;
	}

	int getbit(int x, int n) {
		n--;
		return (x >> n) & 1;
	}

	int setbit(int x, int n) {
		n--;
		return x | (1 << n);
	}

	int caldp(int currentRow, int firstRow, int mask) {
		if (dp[currentRow][firstRow][mask] != -1)
			return dp[currentRow][firstRow][mask];
		dp[currentRow][firstRow][mask] = 0;
		if (mask == (1 << n) - 1)
			dp[currentRow][firstRow][mask] = slant[currentRow][firstRow];
		else {
			for (int i = 1; i <= n; i++)
				if (getbit(mask, i) == 0) {
					dp[currentRow][firstRow][mask] = Math.max(
							Math.min(caldp(i, firstRow, setbit(mask, i)), diff[currentRow][i]),
							dp[currentRow][firstRow][mask]);

				}
		}
		return dp[currentRow][firstRow][mask];

	}

	void main() {
		n = io.getInt();
		m = io.getInt();
		a = new int[n+1][m+1];
		dp = new int[n+1][n+1][1<<n];
		
		for (int i=1; i<=n; i++)
			for (int j=1; j<=m; j++)
				a[i][j] = io.getInt();
		
		diff =... Complexity:
targets: np
inputs: import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		int parity = 0;
		for(int i = 0; i < n; i++) {
			int count = 0;
			for(int j = i + 1; j < n; j++) {
				if(arr[j] < arr[i]) {
					parity ^= 1;
				}			
			}
		}
		int m = s.nextInt();
		for(int i = 0; i < m; i++) {
			int l = s.nextInt(), r = s.nextInt();
			if(((r - l + 1) / 2) % 2 == 1) {
				parity ^= 1;
			}
			System.out.println(parity == 1 ? "odd" : "even");
		}
	}

}
 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.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Set;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zakhar Voit
 */
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);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();

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

        Set <Integer> vis = new TreeSet<Integer>();
        Arrays.sort(a);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (!(a[i] % k == 0 && vis.contains(a[i] / k))) {
                ++ans;
                vis.add(a[i]);
            }
        }

        out.println(ans);
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    public String nextToken() {
        if (!tok.hasMoreTokens()) {
            try {
                String newLine = in.readLine();
                if (newLine == null)
                    throw new InputMismatchException();
                tok = new StringTokenizer(newLine);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            return nextToken();
        }

        return tok.nextToken();
    }

    public int nextInt() {
        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: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	static long[] dx = new long[]{0, 1, 0, -1};
	static long[] dy = new long[]{-1, 0, 1, 0};
	public static void main(String[] args) {
		Scanner r = new Scanner(System.in);
		
		long N = r.nextLong();
		long X = r.nextLong();
		long Y = r.nextLong();
		long C = r.nextLong();
		
		long lo = 0, hi = N * 2;
		
		while(lo < hi){
			long T = (lo + hi) / 2;
			
			long[] NX = new long[4];
			long[] NY = new long[4];
			
			for(int d = 0; d < 4; d++){
				NX[d] = X + dx[d] * T;
				NY[d] = Y + dy[d] * T;
			}
			
			long ret = (T + 1) * (T + 1) + T * T;
			
			ret -= half(1 - NY[0]);
			ret -= half(NY[2] - N);
			ret -= half(NX[1] - N);
			ret -= half(1 - NX[3]);
			
			ret += quarter(1 - NY[0] - (N - X + 1));
			ret += quarter(1 - NY[0] - (X));
			ret += quarter(NY[2] - N - (N - X + 1));
			ret += quarter(NY[2] - N - (X));
			
			if(ret < C)lo = T + 1;
			else hi = T;
		}
		
		System.out.println(lo);
		
	}
	private static long half(long x) {
		if(x <= 0)return 0;
		else return 2 * quarter(x) - x;
	}
	private static long quarter(long x){
		if(x <= 0)return 0;
		return x * (x + 1) / 2;
	}

}
 Complexity:
targets: logn
inputs: import java.util.*;


public class Main {
    static int n=5;
    static int[] arr=new int[5];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int arr[]=new int[n];
        for (int i=0;i<n;i++)
        {
            arr[i]=sc.nextInt();
        }
        for (int i=0;i<n;i++)
        {
            if (arr[i]>=0)
            {
                arr[i]=-arr[i]-1;
            }
        }
        if (n%2!=0)
        {
            int min=0;
            for (int i=1;i<n;i++)
            {
                if (arr[i]<arr[min])
                    min=i;
            }
            arr[min]=-arr[min]-1;
        }
        for (int x:arr)
        {
            System.out.print(x + " ");
        }

    }
} 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.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class B176 {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        long n = in.nextLong() - 1;
        long k = in.nextLong() - 1;
        if (k * (k + 1) / 2 < n) out.println(-1);
        else if (n == 0) out.println(0);
        else if (n < k) out.println(1);
        else {
            long t = binSearch(n, k, 1, k);
            long ans = k - t + 1;
            if (k * (k + 1) / 2 - t * (t - 1) / 2 != n) ans++;
            out.println(ans);
        }
        out.close();
    }

    private static long binSearch(long n, long k, long from, long to) {
        if (from == to) return from;
        long mid = (from + to) / 2;
        if (k * (k + 1) / 2 - mid * (mid - 1) / 2 > n) return binSearch(n, k, mid + 1, to);
        else return binSearch(n, k, from, mid);
    }
}
 What is the time complexity of the previous code?
targets: logn
inputs: //package CF489; //comment this line

import java.io.*;
import java.util.*;
import java.math.*;
public class B
{
    private static long MOD=1000000007;
    private static BigInteger m=new BigInteger(1000000007+"");
    
    private static long pow(long x, long a)
    {
        if(a==0)
        return 1;
        
        long ans=pow(x,a/2);
        
        ans=(ans*ans)%MOD;
        
        if(a%2==1)
        ans=(ans*x)%MOD;
        
        return ans%MOD;
    }
    public static void main(String args[]) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        long N,K,ans;
        
        //System.out.println(); //comment this line
        String s[]=br.readLine().trim().split(" ");
        
        N=Long.parseLong(s[0]);
        K=Long.parseLong(s[1]);
        
        BigInteger bi=new BigInteger(N+"");
        BigInteger a=new BigInteger(N+"");
        BigInteger two=new BigInteger(2+"");
        
        if(N==0)
        {
            System.out.println(0);
            System.exit(0);
        }
        if(K==0)
        {
            a=a.multiply(two);
            a=a.mod(m);
            
            System.out.println(a);
            System.exit(0);
        }
        
        long p=pow(2,K);
        
        BigInteger p2=new BigInteger(p+"");
        BigInteger tmp=p2.subtract(BigInteger.ONE);
        tmp=tmp.mod(m);
        
        p2=p2.multiply(two);
        p2=p2.mod(m);
        
        a=a.multiply(p2);
        a=a.mod(m);
        
        a=a.subtract(tmp);
        a=a.mod(m);
        
        if(!(a.signum()==1)&&!(a.signum()==0))
        a.add(m);
        
        System.out.println(a);
    }
} 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 Subtractions {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int t=s.nextInt();
		while(t--!=0){
			int a=s.nextInt();
			int b=s.nextInt();
			int min=Math.min(a, b);
			int max=Math.max(a, b);
			int ops=0;
			while(true){
				int quo=max/min;
				ops+=quo;
				int rem=max%min;
				max=Math.max(rem, min);
				min=Math.min(min, rem);
				if(rem==0) break;
			}
			System.out.println(ops);
		}
	}

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

/**
 *
 * @author oleksiys
 */
public class A {
    public static void main(String [] args){
        try(Scanner s = new Scanner(System.in)){
            final int n = s.nextInt();
            final int m = s.nextInt();
            final int k = s.nextInt();
            final int [] a = new int [n];
            for (int i = 0; i < a.length; ++i){
                a[i] = s.nextInt();
            }
            Arrays.sort(a);
            int i = a.length - 1;
            int available = k;
            int filters = 0;
            while (available < m && i >= 0){
                available -= 1;
                available += a[i];
                filters++;
                i--;
            }
            if (available < m){
                System.out.println(-1);
            }else{
                System.out.println(filters);
            }
        }
    }
}
 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: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 13.05.11
 * Time: 23:21
 * To change this template use File | Settings | File Templates.
 */
public class ToyArmies {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        System.out.print(String.format("%d",(long)(n*1.5)));
    }
}
 Complexity:
targets: constant
inputs: import java.util.*;
import java.io.*;
public class B {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int T = sc.nextInt();
		while(T-->0) {
			int n = sc.nextInt();
			if(n % 2 == 0 && issq(n/2)) {
				System.out.println("YES");
			}
			else if(n % 4 == 0 && issq(n/4)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
		}

	}

	static boolean issq(long x) {
		long rx = (long)Math.sqrt(x);
		return rx * rx == x;
	}
	
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

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

public class B {
	
	public static void main(String[] args) {
		Scanner qwe = new Scanner(System.in);
		
		int n = qwe.nextInt();
		
		//! x11 y11 x12 y12 x21 y21 x22 y22" 
		
		
		
		int x11 = bins(true,1,2,n,qwe,true);
		int y11 = bins(true,1,2,n,qwe,false);
		int x12 = bins(false,0,1,n,qwe,true);
		int y12 = bins(false,0,1,n,qwe,false);
		int x21 = bins(true,0,1,n,qwe,true);
		int y21 = bins(true,0,1,n,qwe,false);
		int x22 = bins(false,1,2,n,qwe,true);
		int y22 = bins(false,1,2,n,qwe,false);
		
		int[] xsl = {x11,x21};
		int[] xsr = {x12,x22};
		int[] ysl = {y11,y21};
		int[] ysr = {y12,y22};
		
		
		int[] ans = new int[8];
		
		for(int xpl = 0; xpl < 2; xpl++){
			for(int xpr = 0; xpr < 2; xpr++)
				for(int ypl = 0; ypl < 2; ypl++){
					for(int ypr = 0; ypr < 2; ypr++){
						
						if(xsl[xpl] <= xsr[xpr] && xsl[1-xpl] <= xsr[1-xpr] && ysl[ypl] <= ysr[ypr] && ysl[1-ypl] <= ysr[1-ypr]){
							System.out.printf("? %d %d %d %d",xsl[xpl],ysl[ypl],xsr[xpr],ysr[ypr]);
							System.out.println();
							System.out.flush();
							int response1 = qwe.nextInt();
							
							System.out.printf("? %d %d %d %d",xsl[1-xpl],ysl[1-ypl],xsr[1-xpr],ysr[1-ypr]);
							System.out.println();
							System.out.flush();
							int response2 = qwe.nextInt();
							
							if(response1 == 1 && response2 == 1){
								ans = new int[]{xsl[xpl],ysl[ypl],xsr[xpr],ysr[ypr],xsl[1-xpl],ysl[1-ypl],xsr[1-xpr],ysr[1-ypr]};
							}
							
						}
						
						
					}
				
				
				
			}
		}
		
		
		System.out.printf("! %d %d %d %d %d %d %d %d",ans[0],ans[1],ans[2],ans[3],ans[4],ans[5],ans[6],ans[7]);
		System.out.println();
		System.out.flush();
		
		qwe.close();
	}
	
	static int bins(boolean leftbound, int small, int big, int n, Scanner qwe, boolean isx){
		
		int min = 0;
		int max = n;
		
		if(leftbound){
			min++;
			max++;
		}
		
		int y1 = 1;
		int y2 = n;
		int x1 = 1;
		int x2 = n;
		//"? x1 y1 x2 y2"
		while(min+1 < max){
			
			int med = (min+max)/2;
			if(isx){
				if(!leftbound) x2 =... Complexity:
targets: logn
inputs: import java.io.*;
import java.util.List;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Problem {
	
	public static Pair solve(Forest f, List<Pair> queue){
		Pair current = null, next = null;
		int index = 0;
		while(queue.size() > 0){
			current = queue.remove(0);
			index = f.desk[current.x][current.y];
				if(current.x>0){
					next = new Pair(current.x-1,current.y);
					if(f.desk[next.x][next.y]==0){
						f.desk[next.x][next.y] = index+1;
						queue.add(next);
					}
				}
				if(current.x<f.N-1){
					next = new Pair(current.x+1,current.y);
					if(f.desk[next.x][next.y]==0){
						f.desk[next.x][next.y] = index+1;
						queue.add(next);
					}
				}
				if(current.y>0){
					next = new Pair(current.x,current.y-1);
					if(f.desk[next.x][next.y]==0){
						f.desk[next.x][next.y] = index+1;
						queue.add(next);
					}
				}
				if(current.y<f.M-1){
					next = new Pair(current.x,current.y+1);
					if(f.desk[next.x][next.y]==0){
						f.desk[next.x][next.y] = index+1;
						queue.add(next);
					}
				}
		}
		return f.findMax();
	}

	public static void main(String[] args){
		String buffer = null;
		StringTokenizer st = null;
		Forest f = null;
		List<Pair> pairs = new LinkedList<Pair>();
		Integer N,M,K,x,y;
		try {
			BufferedReader in = new BufferedReader(
							new FileReader("input.txt")
							);
			FileWriter out = new FileWriter("output.txt");
			buffer = in.readLine();
			st = new StringTokenizer(buffer);
			N = new Integer(st.nextToken());
			M = new Integer(st.nextToken());
			f = new Forest(N,M);
			buffer = in.readLine();
			st = new StringTokenizer(buffer);
			K = new Integer(st.nextToken());
			buffer = in.readLine();
			st = new StringTokenizer(buffer);
			for(int i = 0; i<K; i++){
				x = new Integer(st.nextToken());
				y = new Integer(st.nextToken());
				f.desk[x-1][y-1] = 1;
				pairs.add(new Pair(x-1,y-1));
			}
			Pair res = solve(f,pairs);
			
			out.write(res.toString());
			out.flush();
		} catch (Exception e) {
		}
	}
}

class Pair {
	public... 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. import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Code implements Runnable {

    public static void main(String[] args) throws IOException {
        new Thread(new Code()).start();
    }

    private void solve() throws IOException {
        taskB();
    }

    private void taskB() throws IOException {
        int n = nextInt(), k = nextInt();
        int[] arr = new int[n];

        for(int i = 0; i < n; ++i)  arr[i] = nextInt();

        int i = 0;
        while(i < n - 1 && arr[i] == arr[i + 1])    ++i;

        if(k == 1)
            writer.println(1 + " " + 1);
        else if(k == 2 && i == n - 2)
            writer.println(n - 1 + " " + n);
        else {
            if(i == n - 1)
                writer.println(-1 + " " + -1);
            else {
                int l = i;
                Map<Integer, Integer> set = new HashMap<Integer, Integer>(n);
                while(i < n && set.size() < k) {
                    if(set.containsKey(arr[i])) set.put(arr[i], set.get(arr[i]) + 1);
                    else    set.put(arr[i], 1);
                    i += 1;
                }
                if(set.size() < k)  writer.println(-1 + " " + -1);
                else {
                    while(l < i && i - l > k && set.get(arr[l]) > 1) {
                        set.put(arr[l], set.get(arr[l]) - 1);
                        l += 1;
                    }
                    writer.println((l + 1) + " " + i);
                }
            }
        }
    }

    private class Pair<E extends Comparable, V extends Comparable> implements Comparable<Pair<E, V>> {
        public Pair(E first, V second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public int compareTo(Pair<E, V> obj) {
            if(first.equals(obj.first))  return second.compareTo(obj.second);
            return first.compareTo(obj.first);
        }

        @Override
        public boolean equals(Object obj) {
            Pair... Complexity:
targets: linear
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.StringTokenizer;
import javafx.util.Pair;

public class Solve6 {

    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter(System.out);
        new Solve6().solve(pw);
        pw.flush();
        pw.close();
    }

    public void solve(PrintWriter pw) throws IOException {
        FastReader sc = new FastReader();
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
        }
        HashMap<Integer, LinkedList<Pair<Integer, Integer>>> h = new HashMap();
        for (int i = 1; i <= n; i++) {
            int s = 0;
            for (int j = i; j >= 1; j--) {
                s += a[j];
                LinkedList<Pair<Integer, Integer>> l;
                if (!h.containsKey(s)) {
                    l = new LinkedList();
                } else {
                    l = h.get(s);
                }
                l.add(new Pair(j, i));
                h.put(s, l);
            }
        }
        LinkedList<Pair<Integer, Integer>>[] l = new LinkedList[h.size() + 1];
        for (int i = 1; i <= h.size(); i++) {
            l[i] = new LinkedList();
        }
        int k = 0, max = 0, index = 0;
        for (LinkedList<Pair<Integer, Integer>> temp : h.values()) {
            k++;
            int i = 0, size = 0;
            for (Pair<Integer, Integer> pair : temp) {
                if (pair.getKey() > i) {
                    i = pair.getValue();
                    l[k].add(pair);
                    size++;
                    if (size > max) {
                        max = size;
                        index = k;
                    }
                }
            }
        }
        pw.println(l[index].size());
        for (Pair<Integer, Integer> pair : l[index]) {
           ... What is the time complexity of the previous code?
targets: quadratic
inputs: import java.io.*;
import java.util.*;

public class r584p5 {
    private static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
    private static PrintWriter pw = new PrintWriter(System.out);
    private static int n, m, arr[][];
    private static ArrayList<HashSet<Integer>> chls;

    private static void gench(){
        chls.add(new HashSet<>());
        chls.get(0).add(0);

        for(int i=1; i<(1<<n); i++){
            int des = i^Integer.highestOneBit(i);
            HashSet<Integer> st = new HashSet<>();
            for(int z : chls.get(des)){
                st.add(z);
                st.add(z|Integer.highestOneBit(i));
            }
            chls.add(st);
        }
    }

    private static void cal(){
        int val[][] = new int[(1<<n)][m];

        for(int j=0; j<m; j++){
            val[0][j] = 0;
            for(int mask=1; mask<(1<<n); mask++){
                int max = 0;
                for(int begin=0; begin<n; begin++){
                    int sum = 0;
                    for(int ptr=begin, pos=0; pos<n; ptr=(ptr+1)%n, pos++){
                        if((mask&(1<<pos)) > 0)
                            sum += arr[ptr][j];
                    }
                    max = Math.max(max, sum);
                }
                val[mask][j] = max;
            }
        }

        int dp[][] = new int[(1<<n)][m];

        for(int mask=0; mask<(1<<n); mask++)
            dp[mask][0] = val[mask][0];

        for(int j=1; j<m; j++){
            dp[0][j] = 0;
            for(int mask=1; mask<(1<<n); mask++){

                dp[mask][j] = 0;
                for(int ch1 : chls.get(mask)){
                    int ch2 = mask^ch1;

                    dp[mask][j] = Math.max(dp[mask][j], val[ch1][j]+dp[ch2][j-1]);
                }
            }
        }

        pw.println(dp[(1<<n)-1][m-1]);
    }

    private static void run()throws IOException{
        StringTokenizer tk = new StringTokenizer(r.readLine());
        n = Integer.parseInt(tk.nextToken());
        m =... What is the time complexity of the previous code?
targets: np
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	
	static long MOD = (long) 1e9 + 7;
	static long[][] identity = {{1, 0}, {0, 1}};
	
	public static void main(String[] args) {
		FastScanner input = new FastScanner(System.in);
		
		long x = input.nextLong();
		long k = input.nextLong();
		
		long[][] matrix = {
			{2, MOD - 1},
			{0, 1}
		};
		
		if (x == 0)
			System.out.println(0);
		else if (k == 0) {
			System.out.println((x * 2) % MOD);
		} else {
			x %= MOD;
			matrix = matrixexpo(k, matrix);
			long low = (x * matrix[0][0] + matrix[0][1]) % MOD;
			long hi = x * mathpow(k, 2) % MOD;
			System.out.println((low + hi) % MOD);
		}
	}
	
	static long mathpow(long k, long x) {
		if (k == 0)
			return 1L;
		else return mathpow(k / 2, (x * x) % MOD) * (k % 2 == 1 ? x : 1) % MOD;
	}
	
	static long[][] matrixexpo(long k, long[][] matrix) { 
		if (k == 0)
			return identity;
		if (k % 2 == 0)
			return matrixexpo(k / 2, multiply(matrix, matrix));
		else
			return multiply(matrix, matrixexpo(k / 2, multiply(matrix, matrix)));
	}
	
	static long[][] multiply(long[][] arr, long[][] brr) { 
		int n = arr.length, m = arr[0].length, p = brr[0].length;
		
		long[][] product = new long[n][p];
		
		for (int i = 0; i < n; i++)
			for (int j = 0; j < p; j++)
				for (int k = 0; k < m; k++)
					product[i][j] = (product[i][j] + arr[i][k] * brr[k][j]) % MOD;
		return product;
	}
	
	// Matt Fontaine's Fast IO
	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

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

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

		boolean... Complexity:
targets: logn
inputs: import java.io.*;
import java.util.*;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Stack;

public class Main
{
      @SuppressWarnings("unchecked")
      public static void main(String args[])throws IOException
    {
         Reader ob=new Reader();
        Writer out=new Writer(System.out);
        Random oo=new Random();
        long k=ob.nL(),ans=0,p=9,num=0;
        for(int i=1;i<18;i++)
        {
            if(num+i*p<k)
            {
                num+=i*p;p*=10;
                ans=0;
                for(int j=0;j<i;j++)
                ans=9+ans*10;
            }
            else
            {
                long left=k-num;
                long r=left/i;
                left-=r*i;
                ans+=r;
                if(left>0)
                {
                 String s=Long.toString(ans+1);
                
                out.pln(s.charAt((int)left-1));
            }
            else
            {
                
                String s=Long.toString(ans);
                
                out.pln(s.charAt(i-1-(int)left));
            }
                break;
            }
            
        }
out.flush();
}
static void sort(int a[])
{
    RA(a);
    Arrays.sort(a);
}
 public static Pairs[] RA(Pairs [] array){
		Random rgen = new Random();  // Random number generator			
 
		for (int i=0; i<array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    Pairs temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
 
		return array;
	}
	
 public static int[] RA(int [] array){
		Random rgen = new Random();  // Random number generator			
 
		for (int i=0; i<array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
 
		return array;
	}
	static void sort(long a[])
{
    RA(a);
    Arrays.sort(a);
}
 public static long[] RA(long [] array){
		Random rgen = new Random();  // Random number... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: logn
inputs: import java.io.*;
import java.math.*;
import java.util.*;

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

	public static void main( String[] args )
	{
		int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;
		for( int i = 0; i < n; i++ )
		{
			h[i][0] = 2*in.nextInt();
			h[i][1] = in.nextInt();
		}
		Arrays.sort( h, new Comp() );
		for( int i = 1; i < n; i++ )
		{
			int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);
			if( d > t ) ans += 2;
			else if( d == t ) ans++;
		}
		System.out.println( ans );
	}

	static class Comp implements Comparator<int[]> { public int compare( int[] a, int[] b ) { return a[0]-b[0]; } }
}
 What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int inv=0;
		int []a=new int [n];
		for(int i=0;i<n;i++)
			a[i]=sc.nextInt();
		for(int j=0;j<n;j++)
			for(int i=j+1;i<n;i++)
				if(a[j]>a[i])
					inv=1-inv;

		int m=sc.nextInt();
		StringBuilder sb=new StringBuilder();
		while(m-->0)
		{
			int l=sc.nextInt();
			int r=sc.nextInt();
			int s=r-l+1;
			if(s*(s-1)/2%2==1)
				inv=1-inv;
			if(inv==1)
				sb.append("odd\n");
			else
				sb.append("even\n");
		}
		System.out.print(sb);

	}
	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 long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}
		
		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}
		
		public boolean ready() throws IOException {return br.ready();}


	}

}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: quadratic
inputs: import java.io.*;
import java.util.*;
import java.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... What is the time complexity of the previous code?
targets: linear