Muennighoff/xP3x-sample huggingface dataset:
inputs: import static java.lang.Math.*;
import java.io.*;
import java.math.*;
import java.util.*;

public class Solution implements Runnable {

	public static void main(String... strings) throws InterruptedException {
		new Thread(new Solution()).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String next() throws Exception {
		if (st == null || !st.hasMoreElements())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

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

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

	@Override
	public void run() {
		try {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter(new FileWriter("output.txt"));
			solve();
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			out.close();
		}
	}
	int n, m, k, xor = 0;
	boolean[][] used;
	HashSet<Long> [] set;
	void solve() throws Exception {
		n = nextInt();
		m = nextInt();
		k = nextInt();
		used = new boolean[n][m];
		set = new HashSet[2];
		for(int i = 0; i < 2; set[i++] = new HashSet<Long>());
		
		for(int i = 0; i < k; i++){
			int x = nextInt()-1, y = nextInt()-1;
			used[x][y] = true;
			set[0].add(10000L*x + y);
		}
		for (;;xor ^= 1){
			set[xor^1].clear();
			int ansx = -1, ansy = -1;
			for (long i : set[xor]){
				int x = (int)(i/10000), y = (int)(i%10000);
				if (ansx < 0){
					ansx = x+1;
					ansy = y+1;
				}
				add(x+1, y);
				add(x-1, y);
				add(x, y+1);
				add(x, y-1);
			}
			if (set[xor^1].size() == 0){
				out.println(ansx + " " + ansy);
				break;
			}
		}
	}
	public void add(int x, int y){
		if (!( x >= 0 && y >= 0 && x < n && y < m && !used[x][y])) return;
		set[xor^1].add(10000L*x + y);
		used[x][y] = true;
	}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author codeKNIGHT
 */
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(),k=in.nextInt()-1,i;
        scores a[]=new scores[n];
        for(i=0;i<n;i++)
            a[i]=new scores(in.nextInt(),in.nextInt());
        Arrays.sort(a);
        
        int c=1;
        for(i=k-1;i>=0;i--)
        {
            if(a[i].p==a[k].p&&a[i].t==a[k].t)
                c++;
            else break;
        }
        for(i=k+1;i<n;i++)
        {
            if(a[i].p==a[k].p&&a[i].t==a[k].t)
                c++;
            else break;
        }
        out.println(c);

	}
    class scores implements Comparable<scores>
    {
        int p,t;
        public scores(int p,int t)
        {
            this.p=p;
            this.t=t;
        }
        public int compareTo(scores a)
        {
            if(a.p>this.p)
                return 1;
            if(a.p==this.p&&a.t<this.t)
                return 1;
            return -1;
        }
    }
}

 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.*;

public class Alpha_Round {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] in = reader.readLine().split(" ");
        long n = Long.parseLong(in[0]);
        long k = Long.parseLong(in[1]);
        long D = 9 + 8*k + 8*n;
        long m = (long) ((-3 + Math.sqrt(D))/2);
        writer.write((n - m) + "");
        writer.close();
    }
} What is the time complexity of the previous code?
targets: logn
inputs: import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class CodeForces
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		System.out.println(input.nextInt() / 2 + 1);
	}
} 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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A135 {
	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(r.readLine());

		int[] ar = new int[n];
		StringTokenizer st = new StringTokenizer(r.readLine());
		for (int x = 0; x < n; x++) {
			ar[x] = Integer.parseInt(st.nextToken());
		}
		Arrays.sort(ar);
		if (n == 1) {

			System.out.println(ar[0]==1?"2":"1");
			return;
		}
		if (ar[n - 1] == 1) {
			ar[n - 2] = 2;
		}
		System.out.print("1");
		for (int x = 0; x < n - 1; x++) {
			System.out.print(" " + ar[x]);
		}
		System.out.println();
	}
}
 Complexity:
targets: nlogn
inputs: import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    long solve(long a, long b) {
        if (a == 0) {
            return 0;
        }
        long answer = a / b;
        a %= b;
        if (a != 0) {
            answer += 1 + solve(b - a, a);
        }
        return answer;
    }

    public void run() {
        try {
            long a = reader.nextLong();
            long b = reader.nextLong();
            writer.println(solve(a, b));
        } catch (IOException ex) {
        }
        writer.close();
    }

    InputReader reader;
    PrintWriter writer;

    Main() {
        reader = new InputReader();
        writer = new PrintWriter(System.out);
    }

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

}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    InputReader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

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

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

public class A {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    
    class Team implements Comparable<Team>{
        int ac;
        int penalty;
        
        public Team(int ac, int penalty) {
            this.ac = ac;
            this.penalty = penalty;
        }

        @Override
        public int compareTo(Team o) {
            if (ac != o.ac)
                return ac > o.ac ? -1 : 1;
            return (penalty == o.penalty) ? 0 : (penalty < o.penalty ? -1 : 1);
        }
        
    }

    void solve() throws IOException {
        int n = nextInt();
        int k = nextInt() - 1;
        
        Team[] a = new Team[n];
        for (int i = 0; i < n; i++)
            a[i] = new Team(nextInt(), nextInt());
        
        Arrays.sort(a);
        for (int i = 0; i < n;) {
            int j = i;
            while (j < n && a[j].compareTo(a[i]) == 0)
                j++;
            if (i <= k && k < j) {
                out.println(j - i);
                return;
            }
            i = j;
        }
    }

    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 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... 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.*;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int a = input.nextInt();
        int b = input.nextInt();
        int x[] = new int[n];
        for (int i=0; i<n; i++) x[i]=input.nextInt();
        Arrays.sort(x);
        int y[] = new int[n];
        for (int i=0; i<n; i++) y[i]=x[n-i-1];
        System.out.println(y[a-1]-y[a]);
    }
}
 Complexity:
targets: nlogn
inputs: import java.io.*;
import java.util.*;

public class B implements Runnable {

	void Solution() throws IOException {
		int n = nextInt(), k = nextInt();
		int[] mas = new int[n];
		for (int i = 0; i < n; i++)
			mas[i] = nextInt();
		int l = 0, r = 0;
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		map.put(mas[l], 1);
		int cur = 1;
		while (true) {
			if (cur == k) {
				print(l + 1, r + 1);
				return;
			}
			r++;
			if (r >= n)
				break;
			int kol = map.containsKey(mas[r]) ? map.remove(mas[r]) : 0;
			if (kol == 0) {
				cur++;
				map.put(mas[r], 1);
			} else
				map.put(mas[r], kol + 1);
			while (true) {
				kol = map.remove(mas[l]);
				if (kol == 1) {
					map.put(mas[l], 1);
					break;
				} else
					map.put(mas[l++], kol - 1);
			}
		}
		print(-1, -1);
	}

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

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			Solution();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(0);
		}
	}

	void print(Object... obj) {
		for (int i = 0; i < obj.length; i++) {
			if (i != 0)
				out.print(" ");
			out.print(obj[i]);
		}
	}

	void println(Object... obj) {
		print(obj);
		out.println();
	}

	void halt() {
		out.close();
		System.exit(0);
	}

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

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

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

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

	double nextDouble() throws NumberFormatException, 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: linear
inputs: import java.util.Scanner;


public class D
{

    public static void main(String[] args)
    {
        new D();
    }
    
    D()
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double v = in.nextDouble();
        double l = in.nextDouble();
        double d = in.nextDouble();
        double w = in.nextDouble();
        
        if (w>v) w=v;
        
        double dx=(v*v-w*w)/(2*a);
        double d0=(w*w)/(2*a);
        
        double t=0;
        if (d0>d) // doesn't make it to speed w before reaching d
        {
            if (d0>=l) // never gets to speed w
            {
                t=Math.sqrt(2*a*l)/a;
            }
            else
            {
                t=w/a;
                if (d0+dx>=l) // never gets to speed v
                {
                    t+=(-w+Math.sqrt(w*w+2*a*(l-d0)))/a;
                }
                else // makes it to speed v
                {
                    t+=(v-w)/a;
                    t+=(l-(d0+dx))/v;
                }
            }
        }
        else // makes it to speed w before reachig d
        {
            t=w/a; // get up to speed w 
            
            // get time after reaching d
            if (d+dx>l) // never makes it back to v after reaching d
            {
                t+=(-w+Math.sqrt(w*w+2*a*(l-d)))/a;
            }
            else // makes it to speed v after reaching d
            {
                t+=(v-w)/a;
                t+=(l-(d+dx))/v;
            }
            
            // handle getting to d
            if (d0+2*dx>d) // can't get to v before reaching d
            {
                double half=(d-d0)/2;
                t+=2*(-w+Math.sqrt(w*w+2*a*half))/a;
            }
            else // can get to v before reaching d
            {
                t+=2*(v-w)/a;
                t+=(d-2*dx-d0)/v;
            }
        }
        
        System.out.printf("%.12f%n", t+1e-11);
    }

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

import javax.lang.model.util.ElementScanner6;
public class codef
{
    public static void main(String ar[]) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer nk=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(nk.nextToken());
        int k=Integer.parseInt(nk.nextToken());
        String st[]=br.readLine().split(" ");
        
        int ans[]=new int[n];
        int a[]=new int[n];
        for(int i=0;i<n;i++)
            ans[i]=Integer.parseInt(st[i]);  

        for(int i=1;i<n;i++)
            a[i]=ans[i]-ans[i-1];
        a[0]=-1;

        Arrays.sort(a);
        int count=0,sum=0;
        for(int i=0;i<n;i++)
            if(a[i]<0)
                count++;
            else
                sum=sum+a[i];
        
        k=k-count;
        int i=n-1;
        while(k>0 && i>=0)
        {
            if(a[i]>-1)
            {
                sum=sum-a[i];
                k--;
            }
            i--;
        }
        System.out.println(sum);
    }
} 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.util.*;
import java.lang.*;
import java.io.*;

public class  ER23C {
    static long s;
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long n = in.nextLong();
        s = in.nextLong();
        long l = 0, h = n;
        while (l < h) {
            long mid = (l + h ) / 2;
           // System.out.println("mid is : " + mid);
           // System.out.println("high is : " + h);
            //System.out.println("low is : " + l);
            if (Ok(mid))
                h = mid;
            else
                l = mid + 1;
        }
        if (Ok(h))
            w.println(n - h + 1);
        else
            w.println(n - h);

        w.close();

    }
    static boolean Ok(long n) {
        int sum = 0;
        long temp = n;
        while (n > 0) {
            sum += (n % 10);
            n = n / 10;
        }
        //System.out.println("n is :" + n + " sum is : " + sum);
        return (temp - sum >= s);
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

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

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

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars =... 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.PrintWriter;
import java.util.*;


public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		// 1 = H, 0 = T
		
		int n = in.nextInt();
		String line = in.next();
		int h = 0;
		for (int i = 0; i < line.length(); i++) {
			if(line.charAt(i)=='H') h++;
		}
		line = line + line;
		
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			int ans = 0;
			for (int j = i; j < i+h; j++) {
				if(line.charAt(j)!='H') ans++;
			}
			if(min>ans) min = ans;
		}
		
		out.print(min);
		
		
		
		
		in.close();
		out.close();
	}

}
 Complexity:
targets: linear
inputs: import java.io.*;
import java.util.*;


public class A {
	public static boolean ok(int []x,int d,int X)
	{
		for(int i=0;i<x.length;i++)
			if(Math.abs(x[i]-X)<d)
				return false;
		return true;
	}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int ans=0;
		int n=sc.nextInt(),d=sc.nextInt();
		TreeSet<Integer> set=new TreeSet();
		int []x=new int [n];
		for(int i=0;i<n;i++)
			x[i]=sc.nextInt();
		for(int i=0;i<n;i++)
		{
			int x1=x[i]+d;
			if (ok(x,d,x1))
				set.add(x1);
			x1=x[i]-d;
			if (ok(x,d,x1))
				set.add(x1);
			
			
		}
		pw.println(set.size());
			
		
		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 Scanner(String s) throws FileNotFoundException {
		br = new BufferedReader(new FileReader(s));
	}
	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();
	}
}
}
 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: /**
 * author: derrick20
 * created: 3/19/21 11:57 PM
 */
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class E2_SquareFreeDivision2 {
    static FastScanner sc = new FastScanner();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
//        generate();
        int T = sc.nextInt();
        int MAX = (int) 1e7;
        int[] canonical = new int[MAX + 1];
        canonical[1] = 1;
        for (int factor = 2; factor <= MAX; factor++) {
            if (canonical[factor] == 0) {
                for (int mult = factor; mult <= MAX; mult += factor) {
                    int prev = canonical[mult / factor];
                    if (prev % factor == 0) {
                        canonical[mult] = prev / factor;
                    } else {
                        canonical[mult] = prev * factor;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(canonical));
        int[] freq = new int[MAX + 1];
        while (T-->0) {
            int N = sc.nextInt();
            int K = sc.nextInt();
            int[] a = new int[N + 1];
            for (int i = 1; i <= N; i++) {
                a[i] = canonical[sc.nextInt()];
            }
            int[][] transition = new int[K + 1][N + 1];
//            HashMap<Integer, Integer> freq = new HashMap<>();
            for (int k = 0; k <= K; k++) {
                int l = N + 1;
                int duplicates = 0;
                for (int r = N; r >= 1; r--) {
                    while (l - 1 >= 1) {
                        int nextDuplicates = duplicates;
                        if (freq[a[l - 1]] >= 1) {
                            nextDuplicates++;
                        }
                        if (nextDuplicates <= k) {
                            duplicates = nextDuplicates;
                            freq[a[l - 1]]++;
                            l--;
                        } else {
                            break;
           ... What is the time complexity of the previous code?
targets: cubic
inputs: import java.util.*;

public class Main {

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

  void solve() {

    Scanner cin = new Scanner(System.in);

    while( cin.hasNextInt() ) {

      int n = cin.nextInt();
      int arr[] = new int[n];
      for(int i=0; i<n; ++i) {
        arr[i] = cin.nextInt();
      }

      Arrays.sort(arr);

      int ret[] = new int[n];
      ret[0] = 1;
      for(int i=0; i<n-1; ++i) { ret[i + 1] = arr[i]; }
      if( arr[n - 1] == 1 ) { ret[n - 1] = 2; }

      String glue = "";
      for(int i=0; i<n; ++i) {
        System.out.print(glue + ret[i]);
        glue = " ";
      }

      System.out.println();

    }

  }

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

public class first {
	static int max = 1000000000;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] tab = new int[n];
		for(int i=0;i<n;i++) {
			tab[i] = sc.nextInt();
		}
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				if(i!=j)
				if(tab[i]>=tab[j] && tab[i]%tab[j]==0) {
					tab[i] = max;
				}
			}
		}
		int res = 0;
		for(int i=0;i<n;i++) {
			if(tab[i]!=max) res++;
		}
		System.out.println(res);
		//System.out.println(4%-1);
	}

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

public class ProblemA {
    InputReader in; PrintWriter out;
    void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = in.nextInt();
        Arrays.sort(a);
        int d = k;
        int cur = n - 1;
        int ans = 0;
        while (d < m && cur >= 0) {
            d += a[cur] - 1;
            cur--;
            ans++;
        }
        if (d >= m)
            out.println(ans);
        else
            out.println("-1");
    }
    
    ProblemA(){
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        try {
            if (oj) {
                in = new InputReader(System.in);
                out = new PrintWriter(System.out);
            }
            else {
                Writer w = new FileWriter("output.txt");
                in = new InputReader(new FileReader("input.txt"));
                out = new PrintWriter(w);
            }
        } catch(Exception e) {
            throw new RuntimeException(e);
        }
        solve();
        out.close();
    }
    public static void main(String[] args){
        new ProblemA();
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }
    
    public InputReader(FileReader fr) {
        reader = new BufferedReader(fr);
        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() {
... 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 static java.lang.Math.*;
import static java.util.Arrays.* ;

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

public class D
{
    int [][] adjList ;
    int dfs(int u , int p )
    {
        int size = 1 ;
        for(int v : adjList[u])
            if(v != p )
            {
                int curr = dfs(v,  u) ;
                size += curr ;
            }
        return size ;
    }

    void main() throws Exception
    {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt() ;
        int [] a = new int [n] ;
        boolean [] vis = new boolean[n] ;
        int cnt = 0 ;
        for(int i = 0 ;i < n ; i++)
            a[i] = sc.nextInt() ;
        sort(a);
        for(int i = 0 ;i  < n ; i ++)
        {
            if(!vis[i])
            {
                for(int j= i  ; j < n ; j++)
                    if(a[j] % a[i] == 0)
                        vis[j] = true ;

                cnt ++ ;
            }
        }

        out.println(cnt);
        out.flush();
        out.close();
    }

    class SegmentTree
    {
        int [] sTree ;
        int [] lazy ;
        int N ;

        SegmentTree(int n)
        {
            N = 1 << (32 - Integer.numberOfLeadingZeros(n - 1)) ;
            sTree = new int [N << 1] ;
            lazy= new int [N << 1] ;
        }
        void push(int node , int b , int e , int mid)
        {
            sTree[node << 1] += (mid - b + 1) * lazy[node] ;
            sTree[node << 1 | 1] += (e - mid) * lazy[node] ;
            lazy[node << 1] += lazy[node] ;
            lazy[node << 1 | 1] += lazy[node] ;
            lazy[node] = 0 ;
        }
        void updateRange(int node , int b , int e , int i , int j , int val)
        {
            if(i > e || j < b)return;

            if(i <= b && e <= j)
            {
                sTree[node] += (e - b + 1) * val ;
                lazy[node] += val ;
                return;
            }

            int mid = b + e >> 1 ;
     ... Complexity:
targets: quadratic
inputs: /*
 * Created on 17.05.2019
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Wolfgang Weck
 */
public class C01Easy {
	public static void main(String[] args) {
		try (BufferedReader r = new BufferedReader(new InputStreamReader(System.in))) {
			final String[] line = r.readLine().split(" ");
			final int N = Integer.parseInt(line[0]), P = Integer.parseInt(line[1]);
			final String[] numS = r.readLine().split(" ");
			if (numS.length != N) throw new IllegalArgumentException();
			final int[] n = new int[N];
			int sum1 = 0, sum2 = 0;
			for (int i = 0; i < N; i++) {
				n[i] = Integer.parseInt(numS[i]) % P;
				sum2 += n[i];
				if (sum2 >= P) sum2 -= P;
			}
			int max = sum2;
			for (int i = 0; i < N; i++) {
				sum1 += n[i];
				if (sum1 >= P) sum1 -= P;
				sum2 -= n[i];
				if (sum2 < 0) sum2 += P;
				final int s = sum1 + sum2;
				if (s > max) max = s;
			}
			System.out.println(max);
		}
		catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: linear
inputs: import java.util.Scanner;
 
public class pillar {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a[]=new int[200005];
		for (int i=1;i<=n;i++) 
		a[i]=sc.nextInt();
		for (int i=2;i<n;i++) 
		if (a[i-1]>a[i]&&a[i]<a[i+1]) {
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
	}
}

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

public class B {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));

        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        int n;
        int n2;
        InputReader in;
        PrintWriter out;

        public void solve(InputReader in, PrintWriter out) {
            this.in = in;
            this.out = out;
            n = in.readInt();
            n2 = n/2;

            int res = find();
            out.print("! ");
            out.println(res);
        }

        public int find() {
            if (n%4 != 0) return -1;
            int c = compare(0);
            if (c == 0) return 1;
            int s = 1;
            int f = n2-1;
            if (c > 0) {
                s = n2+1;
                f = n-1;
            }
            while (s <= f) {
                int m = (s+f)/2;
                int v = compare(m);
                if (v == 0) return m+1;
                else if (v < 0) s = m+1;
                else f = m-1;
            }
            return -1;
        }

        public int compare(int z) {
            out.print("? ");
            out.println(z+1);
            out.flush();
            int r1 = in.readInt();
            out.print("? ");
            out.println((z+n2)%n+1);
            out.flush();
            int r2 = in.readInt();
            return r1-r2;
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            this.reader = new BufferedReader(new InputStreamReader(stream));
        }

        public... Complexity:
targets: logn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. // Author : RegalBeast

import java.io.*;
import java.util.*;

public class Main {
  static final FastReader FR = new FastReader();
  static final BufferedWriter BW = new BufferedWriter(new OutputStreamWriter(System.out));

  public static void main(String[] args) throws IOException {
    StringBuilder solution = new StringBuilder();
    int rows = FR.nextInt();
    int cols = FR.nextInt();
    int moves = FR.nextInt();

    Map<Integer, Integer> horizontalEdgeWeights = new HashMap<Integer, Integer>();
    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < cols - 1; c++) {
        int hash = getHash(r, c);
        horizontalEdgeWeights.put(hash, FR.nextInt());
      }
    }

    Map<Integer, Integer> verticalEdgeWeights = new HashMap<Integer, Integer>();
    for (int r = 0; r < rows - 1; r++) {
      for (int c = 0; c < cols; c++) {
        int hash = getHash(r, c);
        verticalEdgeWeights.put(hash, FR.nextInt());
      }
    }
    
    List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);
    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < cols; c++) {
        int value = (result != null ? result.get(r).get(c) : -1);
        solution.append(value + " ");
      }
      solution.append("\n");
    }

		BW.write(solution.toString());
    BW.close();
  }

  static List<List<Integer>> getResult(int rows, int cols, int moves, Map<Integer, Integer> horizontalEdgeWeights, Map<Integer, Integer> verticalEdgeWeights) {
    if ((moves & 1) == 1) {
      return null;
    }

    int mid = moves >> 1;
    List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);
    for (int r = 0; r < rows; r++) {
      minForDistance.add(new ArrayList<List<Integer>>(cols));

      for (int c = 0; c < cols; c++) {
        minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));
        minForDistance.get(r).get(c).set(0, 0);
      }
    }

    for (int m = 1; m <= mid; m++) {
      for (int r = 0; r <... Complexity:
targets: cubic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 

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


public class A23 implements Runnable {

	private void Solution() throws IOException {
		String s = in.readLine();
		int n = s.length(), ans = 0;
		for (int i = 0; i < n; i ++) {
			for (int j = i; j < n; j ++) {
				for (int k = i+1; k <= n; k ++) {
					for (int g = k; g <= n; g ++) {
						if (s.substring(i,j).equals(s.substring(k,g))) {
							int l = s.substring(i,j).length();
							ans = Math.max(ans, l);
						}
					}
				}
			}
		}
		System.out.println(ans);
	}
	
	public static void main(String args[]) {
		new A23().run();
	}
	
	BufferedReader in;
	StringTokenizer tokenizer;
	
	public void run() {
		try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            Solution();
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
	}

	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}
	
	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(in.readLine());
		return tokenizer.nextToken();
	}
}
 Complexity:
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.PrintWriter;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
        var pw = new PrintWriter(System.out);
        
        int T = Integer.parseInt(sc.next());
        for(int t = 0; t < T; t++){
            int n = Integer.parseInt(sc.next());
            boolean ok = false;
            if(n%2 == 0){
                int a = n/2;
                int b = (int) Math.sqrt(a);
                if(b*b == a){
                    ok = true;
                }
            }
            if(n%4 == 0){
                int a = n/4;
                int b = (int) Math.sqrt(a);
                if(b*b == a){
                    ok = true;
                }
            }
            if(ok){
                pw.println("YES");
            }else{
                pw.println("NO");
            }
        }
        pw.flush();
    }
} Complexity:
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public class Fenvik {
		int[] sum;

		public Fenvik(int n) {
			sum = new int[n];
		}

		public void add(int x) {
			for (; x < sum.length; x = (x | (x + 1))) {
				sum[x]++;
			}
		}

		public int sum(int r) {
			int ans = 0;
			for (; r >= 0; r = (r & (r + 1)) - 1) {
				ans += sum[r];
			}
			return ans;
		}
	}
	
	public int gcd(int x, int y) {
		if (y == 0) {
			return x;
		}
		if (x == 0) {
			return y;
		}
		return gcd(y, x % y);
	}
	
	
	public class Edge {
		int to;
		long s;

		public Edge(int to, long s) {
			this.to = to;
			this.s = s;
		}
	}
	
	public long dfs(int v, int prev, long sumth, long minsum, long s) {
		tin[v] = timer;
		timer++;
		up[v][0] = new Edge(prev, s);
		for (int i = 1; i <= l; i++) {
			Edge e = up[v][i - 1];
			up[v][i] = new Edge(up[e.to][i - 1].to, up[e.to][i - 1].s + e.s);
		}
		minsum = Math.min(minsum, sumth);
		maxup[v] = sumth - minsum;
		long mxdown = sumth;
		for (Edge e : list[v]) {
			if (e.to != prev) {
				mxdown = Math.max(mxdown, dfs(e.to, v, sumth + e.s, minsum, e.s));
			}
		}
		tout[v] = timer;
		timer++;
		maxdown[v] = mxdown - sumth;
		return mxdown;
	}
	
	public boolean upper(int a1, int b1) {
		return tin[a1] <= tin[b1] && tout[a1] >= tout[b1];
	}
	
	public Edge lca(int a, int b) {
		if (a == b) {
			return new Edge(a, 0);
		}
		int v = -1;
		int a1 = a;
		int b1 = b;
		if (tin[a] <= tin[b] && tout[a] >= tout[b]) {
			v = b;
			long lenb = 0;
			for (int i = l; i >= 0; i--) {
				a1 = up[v][i].to;
				b1 = a;
				if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {
					lenb += up[v][i].s;
					v = up[v][i].to;
				}
			}
			lenb += up[v][0].s;
			v =... Complexity:
targets: quadratic
inputs: import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Task {

    public static void solve() throws Exception {
	int n = nextInt();
	int[] S = new int[n];
	for(int i=0;i<n;i++) {
	    S[i] = nextInt();
	    if(i > 0) {
		S[i] += S[i-1];
	    }
	}
	Map<Integer, List<L>> map = new HashMap<>();
	for(int j=0;j<n;j++) {
	    for(int i=j;i>=0;i--) {
		int sum = S[j];
		if(i > 0) {
		    sum -= S[i-1];
		}
		L l = new L();
		l.a = i;
		l.b = j;
		List<L> list = map.get(sum);
		if(list == null) {
		    list = new ArrayList<>();
		    map.put(sum, list);
		}
		list.add(l);
	    }
	}
	List<L> longest = null;
	for(Integer sum: map.keySet()) {
	    List<L> list = map.get(sum);
	    Collections.sort(list);
	    List<L> list2 = new ArrayList<>(list.size());
	    int from = list.get(0).a;
	    for(L l: list) {
		if(l.a >= from) {
		    list2.add(l);
		    from = l.b + 1;
		}
	    }
	    if(longest == null || longest.size() < list2.size()) {
		longest = list2;
	    }
	}
	
	println(longest.size());
	for(int i=0;i<longest.size();i++) {
	    L l = longest.get(i);
	    println((l.a+1) + " " + (l.b+1));
	}
    }
    
    private static class L implements Comparable<L>{
	int a;
	int b;
	
	@Override
	public int compareTo(L l2) {
	    return Integer.valueOf(b).compareTo(l2.b);
	}
    }
    
    public static void main(String[] args) throws Exception {
	try {
	    fastReader = new FastReader(System.in);
	    systemOut = new BufferedOutputStream(System.out);
	    solve();
	} finally {
	    systemOut.close();
	}
    }

    private static FastReader fastReader = null;
    private static BufferedOutputStream systemOut = null;

    public static void print(Object obj) {
	print(obj.toString());
    }

    public static void print(String str) {
	try {
	    systemOut.write(str.getBytes("utf-8"));
	} catch (Exception ex) {
	    throw new RuntimeException(ex);
	}
    }

    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: 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.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(new InputStreamReader(System.in));
        int n = sc.nextInt();
        String s = sc.next();
        sc.close();
        
        int cH = 0;
        for (int i=0; i < s.length(); i++)
            if (s.charAt(i) == 'H')
                cH++;
        
        int best = cH;
        
        for (int st=0; st < s.length(); st++) {
            int cur = st;
            int cnt = cH;
            for (int i=0; i < cH; i++) {
                if (s.charAt(cur) == 'H')
                    cnt--;
                cur++;
                if (cur == s.length()) cur = 0;
            }
            best = Math.min(best, cnt);
        }
        
        System.out.println(best);
    }
}
 Complexity:
targets: linear
inputs: import java.util.Scanner;


public class Prob023A
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        String s = scan.next();

        all: for ( int x = s.length() - 1; x >= 0; x-- )
            for ( int y = 0; x + y <= s.length(); y++ )
            {
                String sub = s.substring( y, y + x );
                if ( s.indexOf( sub, y + 1 ) >= 0 )
                {
                    System.out.println( x );
                    break all;
                }
            }
    }
}
 What is the time complexity of the previous code?
targets: cubic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;
import java.util.*;
 
import java.math.*;
import java.awt.Point;
 
public class Main {
    //static final long MOD = 1000000007L;
    //static final long MOD2 = 1000000009L;
    static final long MOD = 998244353L;
    //static final long INF = 500000000000L;
    static final int INF =   1000000005;
    static final int NINF = -1000000005;
    //static final long NINF = -1000000000000000000L;
    static FastScanner sc;
    static PrintWriter pw;
    static final int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}};


    public static void main(String[] args) {
        sc = new FastScanner();
        pw = new PrintWriter(System.out);
        


        int Q = sc.ni();
        for (int q = 0; q < Q; q++) {
            int N = sc.ni();
            String ans = "NO";
            if (N%2==0 && isSquare(N/2))
                ans = "YES";
            if (N%4==0 && isSquare(N/4))
                ans = "YES";
            pw.println(ans);
        }
        pw.close();
    }

    public static boolean isSquare(int x) {
        int s = (int)Math.round(Math.sqrt(x));
        return s*s==x;
    }

 
    public static void sort(int[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }
 
    public static void sort(long[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            long temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }
 
    //Sort an array (immune to quicksort TLE)
    public static void sort(int[][] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            int[] temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
       ... Complexity:
targets: linear
inputs: import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[n];
        HashMap<Integer, Integer> map = new HashMap<>();
        StringTokenizer st = new StringTokenizer(br.readLine());
        for (int i = 0; i < n; i++) {
            int x = Integer.parseInt(st.nextToken());
            arr[i] = x;
            if (!map.containsKey(x)) {
                map.put(x, 1);
            } else {
                map.replace(x, map.get(x) + 1);
            }
        }
        int[] power = new int[31];
        for (int i = 0; i < 31; i++) {
            power[i] = 1 << i; // 0 100=4 1000=8 10000=16
        }
        int c = 0;
        for (int i = 0; i < n; i++) {
        boolean f = false;
        for (int j = 0; j <= 30; j++) {
        int check = power[j] - arr[i];
                if ((map.containsKey(check) && check != arr[i])) {
                f = true; break;}
                if((map.containsKey(check) && check == arr[i] && map.get(check) >=2)) {
                    f = true; break;
                }
            }
            if (!f) {
                c++;
            }
        }
        System.out.println(c);
    }
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: nlogn
inputs: import java.io.*;
import java.util.*;


public class LuckyDivision
{
   public LuckyDivision(Scanner in)
   {
      int   n;

      n = in.nextInt();

      if ( (n % 4 == 0) ||
           (n % 7 == 0) ||
           (n % 44 == 0) ||
           (n % 47 == 0) ||
           (n % 74 == 0) ||
           (n % 77 == 0) ||
           (n % 444 == 0) ||
           (n % 447 == 0) ||
           (n % 474 == 0) ||
           (n % 477 == 0) ||
           (n % 744 == 0) ||
           (n % 747 == 0) ||
           (n % 774 == 0) ||
           (n % 777 == 0) )
         System.out.printf("YES%n");
      else
         System.out.printf("NO%n");
   }


   public static void main(String[] args)
   {
      new LuckyDivision(new Scanner(System.in));
   }
}

 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: constant