Muennighoff/xP3x-sample huggingface dataset:
inputs: /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

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

public class cf276d {

    static BufferedReader br;
    static Scanner sc;
    static PrintWriter out;

    public static void initA() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            //br = new BufferedReader(new FileReader("input.txt"));
            sc = new Scanner(System.in);
            //out = new PrintWriter("output.txt");
            out = new PrintWriter(System.out);
        } catch (Exception e) {
        }
    }

    public static void initB() {
        try {

            br = new BufferedReader(new FileReader("input.txt"));
            sc = new Scanner(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");

        } catch (Exception e) {
        }
    }

    public static String getString() {
        try {
            return br.readLine();
        } catch (Exception e) {
        }
        return "";
    }

    public static Integer getInt() {
        try {
            return Integer.parseInt(br.readLine());
        } catch (Exception e) {
        }
        return 0;
    }

    public static Integer[] getIntArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Integer temp2[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Integer.parseInt(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static Long[] getLongArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Long temp2[] = new Long[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Long.parseLong(temp.nextToken());
            }
            return temp2;
   ... 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.*;
import java.io.*;

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

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}

	

	public void solve() {
		int n = in.nextInt();
		HashSet<Long> ans = new HashSet<>();
		Long d = in.nextLong();
		long[] a = new long[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		for (int i = 0; i < a.length; i++) {
			long x = a[i] - d;
			boolean flag = true;
			for (int j = 0; j < a.length; j++) {
				if (Math.abs(a[j] - x) < d) {
					flag = false;
					break;
				}
			}
			if (flag) {
				ans.add(x);
			}
			x = a[i] + d;
			flag = true;
			for (int j = 0; j < a.length; j++) {
				if (Math.abs(a[j] - x) < d) {
					flag = false;
					break;
				}
			}
			if (flag) {
				ans.add(x);
			}
		}
		out.println(ans.size());
	}

	public void run() {

		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try... What is the time complexity of the previous code?
targets: linear
inputs: import static java.lang.Math.max;
import static java.lang.Math.min;

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

public class B {

	private void solve() throws IOException {
		int senators = nextInt();
		int candies = nextInt();
		scoreA = nextInt();
		lvl = new int[senators];
		unloyal = new int[senators];
		for (int i = 0; i < senators; i++) {
			lvl[i] = nextInt();
			unloyal[i] = 10 - nextInt() / 10;
		}
		n = senators;
		give = new int[n];
		res = 0;
		go(0, candies);
		out.println(res);
	}

	static double res;
	static int[] lvl;
	static int[] unloyal;
	static int[] give;
	static int n;
	static int scoreA;

	static double probability() {
		double res = 0;
		for (int mask = 0; mask < 1 << n; mask++) {
			double p = 1;
			int scoreB = 0;
			int cntGood = Integer.bitCount(mask);
			for (int i = 0; i < n; i++) {
				int cnt = unloyal[i] - give[i];
				if ((mask & (1 << i)) == 0) {
					scoreB += lvl[i];
					p *= cnt * .1;
				} else {
					p *= (10 - cnt) * .1;
				}
			}
			if (2 * cntGood > n) {
				res += p;
			} else {
				res += p * scoreA / (scoreA + scoreB);
			}
		}
		return res;
	}

	static void go(int man, int candies) {
		if (man == n) {
			res = max(res, probability());
			return;
		}
		give[man] = 0;
		go(man + 1, candies);
		for (int i = 1; i <= min(unloyal[man], candies); i++) {
			give[man] = i;
			go(man + 1, candies - i);
		}
	}

	public static void main(String[] args) {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			new B().solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(239);
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

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

	static int nextInt() throws IOException {
		return... What is the time complexity of the previous code?
targets: np
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));
   }
}

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

public class Main {

    private static void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();

        if (n < 6) {
            out.println(-1);
        } else {
            int m = (n - 2);
            for (int i = 2; i <= m; i++) {
                out.println("1 " + i);
            }
            out.println(m + " " + (m + 1));
            out.println(m + " " + (m + 2));
        }

        for (int i = 2; i <= n; i++) {
            out.println("1 " + i);
        }
    }

    private static void shuffleArray(int[] array) {
        int index;
        Random random = new Random();
        for (int i = array.length - 1; i > 0; i--) {
            index = random.nextInt(i + 1);
            if (index != i) {
                array[index] ^= array[i];
                array[i] ^= array[index];
                array[index] ^= array[i];
            }
        }
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        solve(in, out);
        in.close();
        out.close();
    }

    private static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        InputReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }

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

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        byte nextByte() {
            return Byte.parseByte(next());
        }

        short nextShort() {
           ... Complexity:
targets: linear
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class D11 {

	static StreamTokenizer in;
	static PrintWriter out;
	
	static int nextInt() throws IOException {
		in.nextToken();
		return (int)in.nval;
	}
	
	static String nextString() throws IOException {
		in.nextToken();
		return in.sval;
	}

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

		n = nextInt();
		m = nextInt();
		
		g = new boolean[n][n];
		for (int i = 0; i < m; i++) {
			int a = nextInt()-1, b = nextInt()-1;
			g[a][b] = g[b][a] = true;
		}
		
		long ans = 0;
		for (int i = n-1; i >= 0; i--) {
			long cur = solve(i);
			ans += cur;
		}
		
		out.println(ans/2);
		
		out.flush();
	}

	static int n, m;
	static boolean[][] g;
	
	static long solve(int v) {
		long[][] memo = new long[v][1 << v];
		
		for (int i = 0; i < v; i++)
			if (g[v][i])
				memo[i][1 << i] = 1;
		
		for (int mask = 1; mask < (1 << v); mask++)
			for (int i = 0; i < v; i++) if ((mask&(1 << i)) != 0)
				for (int j = 0; j < v; j++) if (g[i][j] && (mask&(1 << j)) == 0)
					memo[j][mask|(1 << j)] += memo[i][mask];
		
		long res = 0;
		for (int mask = 1; mask < (1 << v); mask++)
			for (int i = 0; i < v; i++)
				if (Integer.bitCount(mask) > 1 && g[v][i]) res += memo[i][mask];
		return res;
	}
}
 What is the time complexity of the previous code?
targets: np
inputs: import java.io.*;
import java.util.*;
import java.math.*;
public class A {
	@SuppressWarnings("unchecked")
	private static void solve() throws IOException {
		ArrayList<Num> c = new ArrayList<Num>();
		n = nextInt();
		a = nextInt();
		b = nextInt();
		for(int i = 0;  i < n; i++) {
			int next = nextInt();
			boolean found = false;
			for(int j = 0; j < c.size(); j++) {
				if(c.get(j).num == next) {
					c.get(j).freq++;
					found = true;
					break;
				}
			}
			if(!found)
				c.add(new Num(next));
		}
		Collections.sort(c);
		int below = 0;
		int above = n;
		boolean f = false;
		for(int i = 0; i < c.size(); i++) {
			below += c.get(i).freq;
			above -= c.get(i).freq;
			if(below == b && above == a) {
				if(i == c.size())
					break;
				System.out.println(c.get(i+1).num - c.get(i).num);
				f = true;
				break;
			}
		}
		if(!f)
			System.out.println(0);
	}
	
	static int n;
	static int a;
	static int b;
	public static void main(String[] args) {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(239);
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

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

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

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

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}
class Num implements Comparable<Num> {
	int num;
	int freq;
	Num(int n) {
		num = n;
		freq = 1;
	}
	public int compareTo(Num other) {
		return this.num - other.num;
	}
} 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: /* Codeforces Template */

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

import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	
	static long initTime;
	static final Random rnd = new Random(7777L);
	static boolean writeLog = false;
	
	public static void main(String[] args) throws IOException {
		initTime = System.currentTimeMillis();
		try {
			writeLog = "true".equals(System.getProperty("LOCAL_RUN_7777"));
		} catch (SecurityException e) {}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}
					long prevTime = System.currentTimeMillis();
					new Main().run();
					log("Total time: " + (System.currentTimeMillis() - prevTime) + " ms");
					log("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start(); 
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
		in.close();
	}
	
	/*************************************************************** 
	 * Solution
	 **************************************************************/

	void solve() throws IOException  {
		
		int n = nextInt();
		long k = nextLong();
		int[] a = nextIntArray(n);

		Set<Long> bad = new TreeSet<Long>();
		
		sort(a);
		
		int ans = 0;
		
		for (int x : a) {
			if (!bad.contains((long) x)) {
				bad.add(x * k);
				ans++;
			}
		}
		
		out.println(ans);
		
	}
	
	/*************************************************************** 
	 * Input 
	 **************************************************************/
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");
	
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: nlogn
inputs: import java.util.*;

public class Main
{
	static int MAX = 1000;
	
	static BitSet P = new BitSet(MAX + 1);
		
	public static boolean Noldbach(int n)
	{
		n--;
		
		int j;
		
		for(int i=2; i<=n; i++)
		{
			if(!P.get(i))
			{
				j = i + 1;
				
				while(P.get(j))
					j++;
				
				if(i+j == n)
				{
					if(!P.get(i+j+1))
					{
						//System.out.println((n+1)+" = "+i+" + "+(n-i)+" + 1");
					
						return true;
					}
				}
			}
		}
		
		return false;
	}
	
	public static void main(String[] args)
	{
		Scanner lee = new Scanner(System.in);	

		for(int i=2; i*i<=MAX; i++)
		{
		    if(!P.get(i))
		    {
		    	for(int j=i+i; j<=MAX; j+=i)
		    		P.set(j);
		    }
		}
		
		int n, k, c;
		
		n = lee.nextInt();
		k = lee.nextInt();
		
		c = 0;
		
		for(int i=2; i<=n; i++)
		{
			if(Noldbach(i))
				c++;
			
			if(c == k)
				break;
		}
		
		if(c == k)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 
import java.awt.Point;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.Scanner;

public class C {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new FileReader(new File("input.txt")));
        PrintWriter out = new PrintWriter(new File("output.txt"));
        int n = in.nextInt();
        int m = in.nextInt();
        int[][] T = new int[n][m];
        int k = in.nextInt();
        int[] X = new int[k];
        int[] Y = new int[k];
        for (int i = 0; i < k; i++) {
            X[i] = in.nextInt() - 1;
            Y[i] = in.nextInt() - 1;
        }
        int max = 0;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++) {
                int min = Integer.MAX_VALUE;
                for (int ii = 0; ii < k; ii++)
                    min = Math.min(min,
                            Math.abs(i - X[ii]) + Math.abs(j - Y[ii]));
                max = Math.max(max, T[i][j] = min);
            }
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                if (T[i][j] == max) {
                    out.println((i + 1) + " " + (j + 1));
                    out.flush();
                    return;
                }

    }
} Complexity:
targets: cubic
inputs: import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class Div1_503B {

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int N = Integer.parseInt(reader.readLine());
		printer.println("? 1");
		printer.flush();
		int v1 = Integer.parseInt(reader.readLine());

		printer.println("? " + (1 + N / 2));
		printer.flush();
		int v2 = Integer.parseInt(reader.readLine());

		if ((v1 + v2) % 2 != 0) {
			printer.println("! -1");
			printer.close();
			return;
		}

		if (v1 == v2) {
			printer.println("! 1");
			printer.close();
			return;
		}
		boolean less = v1 < v2;

		int low = 1;
		int high = (1 + N / 2);

		while (low != high) {
			int mid = (low + high) >> 1;

			printer.println("? " + mid);
			printer.flush();
			int r1 = Integer.parseInt(reader.readLine());

			int q2 = (mid + N / 2);
			if (q2 > N) {
				q2 -= N;
			}
			printer.println("? " + q2);
			printer.flush();
			int r2 = Integer.parseInt(reader.readLine());

			if (r1 == r2) {
				printer.println("! " + mid);
				printer.close();
				return;
			}

			if (r1 < r2 == less) {
				low = mid + 1;
			} else {
				high = mid - 1;
			}
		}
		printer.println("! " + low);
		printer.close();
		return;
	}
}
 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: //package que_a;

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

public class utkarsh {

    InputStream is;
    PrintWriter out;
    
    long mod = (long) (1e9 + 7);
    boolean SHOW_TIME;
    
    void solve() {
        //Enter code here utkarsh
        //SHOW_TIME = true;
        int n = ni();
        HashMap <String, Integer> mp = new HashMap<>();
        mp.put("M", 0);
        mp.put("S", 1); mp.put("XS", 2); mp.put("XXS", 3); mp.put("XXXS", 4);
        mp.put("L", 5); mp.put("XL", 6); mp.put("XXL", 7); mp.put("XXXL", 8);
        int a[] = new int[10];
        for(int i = 0; i < n; i++) {
            int j = mp.get(ns());
            a[j]++;
        }
        for(int i = 0; i < n; i++) {
            int j = mp.get(ns());
            a[j]--;
        }
        int ans = 0;
        for(int i = 0; i < 10; i++) {
            if(a[i] > 0)    ans += a[i];
        }
        out.println(ans);
    }

    //---------- I/O Template ----------
    
    public static void main(String[] args) { new utkarsh().run(); }
    void run() { 
        is = System.in; 
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis(); 
        solve(); 
        long end = System.currentTimeMillis();
        if(SHOW_TIME) out.println("\n" + (end - start) + " ms");
        out.flush();
    }
    
    byte input[] = new byte[1024];
    int len = 0, ptr = 0;
    
    int readByte() { 
        if(ptr >= len) { ptr = 0; 
            try { len = is.read(input); } 
            catch(IOException e) { throw new InputMismatchException(); } 
            if(len <= 0) { return -1; } 
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() { 
        int b = readByte(); 
        while(b != -1 && isSpaceChar(b)) { b = readByte(); } 
        return b;
    }
    
    char nc() { return (char)skip(); }
    String ns() { 
        int b = skip(); 
        StringBuilder sb = new StringBuilder(); 
        while(!isSpaceChar(b)) {... What is the time complexity of the previous code?
targets: linear
inputs: import static java.util.Arrays.deepToString;

import java.awt.datatransfer.StringSelection;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws IOException {
        int n = nextInt();
        if (n >= 0) {
            System.out.println(n);
        } else {
            String string = String.valueOf(n);
            int v1 = Integer.valueOf(string.substring(0, string.length() - 1));
            int v2 = Integer.valueOf(string.substring(0, string.length() - 2)
                    + string.charAt(string.length() - 1));
            if (v1 >= v2) {
                System.out.println(v1);
            } else {
                System.out.println(v2);
            }
        }
        
    }

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

        setTime();
        solve();
        printTime();
        printMemory();

        writer.close();
    }

    static BufferedReader reader;
    static PrintWriter writer;
    static StringTokenizer tok = new StringTokenizer("");
    static long systemTime;

    static void debug(Object... o) {
        System.err.println(deepToString(o));
    }

    static void setTime() {
        systemTime = System.currentTimeMillis();
    }

    static void printTime() {
        System.err.println("Time consumed: "
                + (System.currentTimeMillis() - systemTime));
    }

    static void printMemory() {
        System.err.println("Memory consumed: "
                + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()
                        .freeMemory()) / 1000 + "kb");
    }

    static String next() {
        while (!tok.hasMoreTokens()) {
            String w = null;
            try {
                w = reader.readLine();
            } catch (Exception e) {
... 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.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		long k = scan.nextLong();
		long total = k * (k - 1) / 2 + 1;
		if (total < n) {
			System.out.println(-1);
			return;
		}
		
		long left = total - n;
		long low = 1;
		long high = k - 1;
		while (low < high) {
			long mid = (low + high) / 2;
			long temp = mid * (mid + 1) / 2;
			if (temp < left) {
				low = mid + 1;
			} else {
				high = mid;
			}
		}
		long temp = low * (low + 1) / 2;
		if (temp == left) {
			System.out.println(k - 1 - low);
		} else {
			System.out.println(k - low);
		}
	}
}
 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.util.*;

public class Paint {
    public static void main (String srgs[] ){
        
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<n;++i){
            ts.add(sc.nextInt());
        }
        int x=0;
        int a[]=new int[ts.size()];
        for(int y:ts){
            a[x++]=y;
        }
        for(int i=0;i<ts.size()-1;++i){
            for(int j=i+1;j<ts.size();++j){
                if((a[i]!=-1)&&(a[j]!=-1)&&(a[j]%a[i]==0)){
                    a[j]=-1;
                }
            }
        }
        int c=0;
        for(int z:a){
            if(z!=-1)++c;
        }
        System.out.print(c);
    }
} Complexity:
targets: quadratic
inputs: import java.util.*;
    import java.io.*;
    import java.lang.*;
    import java.math.*;
    public class B {
        public static void main(String[] args) throws Exception {
            BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
            PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
            int n = Integer.parseInt(bf.readLine());
            StringTokenizer st = new StringTokenizer(bf.readLine());
            Integer[] a = new Integer[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
            Arrays.sort(a);
            int[] b = new int[n];
            for(int i=0; i<n; i++) b[i] = a[i].intValue();
            boolean diff = false;
            boolean diff2 = false;
            Set<Integer> vals = new HashSet<Integer>();
            vals.add(b[0]);
            int valval = 0;
            for(int i=1; i<n; i++) {
                vals.add(b[i]);
                if(b[i] == b[i-1]) {
                    if(!diff) {
                        diff = true;
                        valval = b[i];
                    }
                    else diff2 = true;
                }
            } 
            long sum = 0;
            for(int i : b) sum += i;
            sum -= 1L*n*(n-1)/2;

            if(diff && !diff2) {
                if(!vals.contains((valval-1)) && (valval > 0)) {
                    if(sum%2 == 0) out.println("cslnb"); else out.println("sjfnb");
                }
                else out.println("cslnb");
            }
            else if(diff2) out.println("cslnb");
            else if(sum%2 == 0) out.println("cslnb"); else out.println("sjfnb");
            // int n = Integer.parseInt(st.nextToken());
     
            
            out.close(); System.exit(0);
        }
    } What is the time complexity of the previous code?
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		s.close();
		
		if (r-l<2 || (r-l==2 && l%2==1)) {
			System.out.print("-1");
			return;
		}
		
		long beg = l%2==0 ? l : l+1;
		if (beg+2>r) System.out.print("-1");
		else System.out.print(beg+" "+(beg+1)+" "+(beg+2));
	}
}
 Complexity:
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.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

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

class TaskB {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        long n = in.nextLong();
        long k = in.nextLong();
        if (n == 1) {
            out.println(0);
            return;
        }
        if (k * (k - 1) < 2 * (n - 1)) {
            out.println(-1);
            return;
        }

        long sq2 = 4 * k * k - 4 * k + 1 - 4 * (2 * n - 2);
        double sqrt = Math.sqrt(sq2);
        long sq = (long) sqrt;
        if ((sq + 1) * (sq + 1) == sq2) {
            sq = sq + 1;
        } else if ((sq - 1) * (sq - 1) == sq2) {
            sq = sq - 1;
        }

        if (sq*sq == sq2) {
            long kmin = (sq + 3) / 2;
            out.println(k - kmin + 1);
        } else {
            long km = Math.max(2, (long) ((sqrt + 3) / 2.0) - 2);
            while (((km + k - 2)*(k - km + 1) >= 2*(n-1))) {
                ++km;
            }
            out.println(k - km + 2);
        }
    }
}
 Complexity:
targets: logn
inputs: import java.util.*;

public class Temppp {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
       
        long ans = (long) ((java.lang.Math.sqrt((9+(8*(n+k))))-3)/2);
        System.out.println(n-ans);
        
    }
    
}
 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.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class C
{
	String line;
	StringTokenizer inputParser;
	BufferedReader is;
	FileInputStream fstream;
	DataInputStream in;
	String FInput="";
	
	
	void openInput(String file)
	{

		if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
		else
		{
			try{
		
				
			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}
	
	void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " ");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}	
		
	}
	
	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);
		
		//System.out.println("I read this number: " + val);
		return val;
	}
	
	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}
	
	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}
			
	}
	
	public void readFInput()
	{
		for(;;)
		{
			try
			{
				readNextLine();
				FInput+=line+" ";
			}
			catch(Exception e)
			{
				break;
			}
		}
		inputParser = new StringTokenizer(FInput, " ");
	}
	
	long NextLong()
    {
            String n = inputParser.nextToken();
            
            long val = Long.parseLong(n);
            
            return val;
    }
	
	public static void main(String [] argv)
	{
		//String filePath="input.txt";
        String filePath=null;
        if(argv.length>0)filePath=argv[0];
		new C(filePath);
	}
	final int MOD = 1000000009;
	public C(String inputFile)
	{
		openInput(inputFile);
		StringBuilder sb = new StringBuilder();
		readNextLine();
    	int N=NextInt(), M=NextInt(), K=NextInt();
    	
    	if((N/K)<=(N-M))
    	{
    		sb.append(M);
 ... 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.util.Scanner;
import java.io.PrintWriter;
import java.util.*;


public class Order8C implements Runnable {
    private Scanner in = new Scanner(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    int mintime;
    String path;

    int xs;
    int ys;
    int n;
    int[] obx;
    int[] oby;


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

    private void read() {
	xs = in.nextInt();
	ys = in.nextInt();
	n = in.nextInt();
	obx = new int[n];
	oby = new int[n];
	for(int i = 0; i<n; i++){
	    obx[i] = in.nextInt();
	    oby[i] = in.nextInt();
	}
	
    }

    private void solve() {
	/* we will do dynamic programming over the subsets
	   best[m] will be the shortest for binary digits of m
	   being in. 
	   last[m] will be the last subset before m */

	int[] ds = new int[n];
	int[][] d = new int[n][n];

	int[] best = new int[1 << n];
	int[] last = new int[1 << n];


	for(int i = 0; i<n; i++){
	    ds[i] = (obx[i]-xs)*(obx[i]-xs) + (oby[i]-ys)*(oby[i]-ys);
	    for(int j = i+1; j<n; j++){
		d[i][j] = (obx[i]-obx[j])*(obx[i]-obx[j]) + (oby[i]-oby[j])*(oby[i]-oby[j]);
		d[j][i] = (obx[i]-obx[j])*(obx[i]-obx[j]) + (oby[i]-oby[j])*(oby[i]-oby[j]);
	    }
	}


	for(int i=0; i< (1<<n); i++){ //goes through subsets before supersets
	    best[i] = 100000000;
	}
	best[0] = 0;

	for(int i=0; i< (1<<n); i++){ //goes through subsets before supersets
	    /*if (i % 1000000 == 0 ){
		System.out.println(i);
		}*/
	    for(int j = 0; j<n; j++){
		if( ((1 << j) & i) != 0){ // if 2^j and i have bitwise sum nonzero
		    if(best[i - (1<<j)] + 2*ds[j] < best[i]){
			best[i] = best[i - (1<<j)] + 2*ds[j];
			last[i] = i - (1<< j);

		    }
		   for(int k = j+1; k<n; k++){
		       if( ((1 << k) & i) != 0){ // if 2^k and i have bitwise sum nonzero
			   if( (best[i-(1<<j) -(1<<k)] +ds[j]+ds[k]+d[j][k]) < best[i]){
			       best[i] = (best[i-(1<<j) -(1<<k)] +ds[j]+ds[k]+d[j][k]);
			       last[i] = i -(1<<j) - (1<< k);

			   }

		       }
		   }
		   break;... Complexity:
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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class E2RotateColumnsHardVersion {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            E2RotateColumnsHardVersion.Column[] columns = new E2RotateColumnsHardVersion.Column[m];
            for (int i = 0; i < columns.length; ++i) columns[i] = new E2RotateColumnsHardVersion.Column(new int[n]);
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < m; ++j) {
                    columns[j].v[i] = in.nextInt();
                    if (i == n - 1) columns[j].initMax();
                }
            }
            Arrays.sort(columns, (o1, o2) -> o2.max - o1.max);
            if (columns.length > n)
                columns = Arrays.copyOf(columns, n);

            long[] dp = new long[1 << n];
            for (E2RotateColumnsHardVersion.Column c : columns) {
                long[] ndp = new long[1 << n];
                System.arraycopy(dp, 0, ndp, 0, dp.length);

                for (int rot = 0; rot < n; ++rot) {
                    long[] temp = new long[1 << n];
                    System.arraycopy(dp, 0, temp, 0, dp.length);
                    for (int i = 0, pos = rot; i <... Complexity:
targets: np
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. //Utilities
import java.io.*;
import java.util.*;

public class Main {
	static int n, m, k;
	static int[][] horW, verW;
	static int[][][] dp = new int[505][505][15];
	
	public static void main(String[] args) throws IOException {
		for (int i = 0; i < 505; i++) {
			for (int j = 0; j < 505; j++) {
				for (int k = 0; k < 15; k++) {
					dp[i][j][k] = -1;
				}
			}
		}
		n = in.iscan(); m = in.iscan(); k =in.iscan();
		horW = new int[n+1][m]; verW = new int[n][m+1];
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m-1; j++) {
				horW[i][j] = in.iscan();
			}
		}
		for (int i = 1; i <= n-1; i++) {
			for (int j = 1; j <= m; j++) {
				verW[i][j] = in.iscan();
			}
		}
		int min = Integer.MAX_VALUE;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++) {
				if (k % 2 == 1) {
					out.print(-1 + " ");
					continue;
				}
				out.print(dfs(i, j, k/2) * 2 + " ");
			}
			out.println();
		}
		out.close();
	} 
	
	static int dfs(int r, int c, int k) {
		if (dp[r][c][k] != -1) {
			return dp[r][c][k];
		}
		if (k == 0) {
			return dp[r][c][k] = 0;
		}
		int min = Integer.MAX_VALUE;
		if (r - 1 >= 1) {
			min = Math.min(min, verW[r-1][c] + dfs(r-1, c, k-1));
		}
		if (r + 1 <= n) {
			min = Math.min(min, verW[r][c] + dfs(r+1, c, k-1));
		}
		if (c - 1 >= 1) {
			min = Math.min(min, horW[r][c-1] + dfs(r, c-1, k-1));
		}
		if (c + 1 <= m) {
			min = Math.min(min, horW[r][c] + dfs(r, c+1, k-1));
		}
		return dp[r][c][k] = min;
	}
	
	static INPUT in = new INPUT(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	private static class INPUT {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar, numChars;

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

		public INPUT (String file) throws IOException {
			this.stream = new FileInputStream (file);
		}

		public int cscan () throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read (buf);
			}
			
			if (numChars == -1)
				return... Complexity:
targets: cubic
inputs: import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class CottageVillage {
    
    class cl {
        int x=0;
        int a=0;
        
        cl(int x, int a){
            this.x=x; 
            this.a=a;
        }
    }
    
    class cmp implements Comparator<cl> {
        public int compare(cl d1, cl d2) {
            return d1.x<d2.x ? -1 : 1;
        }
    }
    
    public CottageVillage() {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        cl[] w = new cl[n];
        for(int i=0; i<n; i++)
            w[i] = new cl(sc.nextInt(), sc.nextInt());
        Arrays.sort(w, new cmp());
        
        int cnt=2, diff=0; 
        for(int i=1; i<n; i++) {
            diff = Math.abs(2*w[i].x-2*w[i-1].x-w[i].a-w[i-1].a)-2*k; 
            if (diff>0) cnt+=2;
            else if (diff==0) cnt++;
        }
        System.out.println(cnt);
    }
    
    public static void main(String... args) {
        new CottageVillage();
    }
} What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;


public class Main{

    static long MOD = 1_000_000_007L;
    //static long MOD = 998_244_353L;
    //static long MOD = 1_000_000_033L;
    static long inv2 = (MOD + 1) / 2;

    static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    static long lMax = 0x3f3f3f3f3f3f3f3fL;
    static int iMax = 0x3f3f3f3f;
    static HashMap <Long, Long> memo = new HashMap();
    static MyScanner sc = new MyScanner();
    //static ArrayList <Integer> primes;

    static int nn = 300000;
    static long[] pow2;
    static long [] fac;
    static long [] pow;
    static long [] inv;
    static long [] facInv;
    static int[] base;
    static int[] numOfDiffDiv;
    static int[] numOfDiv;
    static ArrayList <Integer> primes;
    //static int[] primes;
    static int ptr = 0;
    static boolean[] isPrime;

    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        // Start writing your solution here. -------------------------------------



        /*fac = new long[nn + 1];
        fac[1] = 1;
        for(int i = 2; i <= nn; i++)
            fac[i] = fac[i - 1] * i % MOD;*/


        /*pow2 = new long[nn + 1];
        pow2[0] = 1L;
        for(int i = 1; i <= nn; i++)
            pow2[i] = pow2[i - 1] * 2L;*/


        /*inv = new long[nn + 1];
        inv[1] = 1;
        for (int i = 2; i <= nn; ++i)
            inv[i] = (MOD - MOD / i) * inv[(int)(MOD % i)] % MOD;*/

        /*facInv = new long[nn + 1];
        facInv[0] = facInv[1] = 1;
        for (int i = 2; i <= nn; ++i)
            facInv[i] = facInv[i - 1] * inv[i]... What is the time complexity of the previous code?
targets: linear
inputs: import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;

/**
 *
 * @author pttrung
 */
public class C {

    public static double Epsilon = 1e-6;
    public static long x, y, d;
    public static long MOD = 1000000007;
    public static int[][][] dp;
    public static int min, max, need;

    public static void main(String[] args) {

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

        int n = in.nextInt();
        int m = in.nextInt();
        min = Math.min(n, m);
        max = (m + n) - min;
        dp = new int[max][1 << min][1 << min];

        for (int[][] temp : dp) {
            for (int[] val : temp) {
                Arrays.fill(val, -1);
            }
        }
        need = (1 << min) - 1;
        //System.out.println(add + total);
        //  System.out.println(min + " " + max);

        out.println(cal(0, 0, 0));

        out.close();

    }

    public static int cal(int index, int last, int lastHold) {

        if (index == max) {
            return 0;
        }
        if (dp[index][lastHold][last] != -1) {
            return dp[index][lastHold][last];
        }
        int result = 0;

        for (int i = 0; i < 1 << min; i++) {
            if ((i | last) == need || (index == 0)) {
              //  System.out.println("PREV " + index + " " + i + " " + last + " " + lastHold);
              //  System.out.println("NEXT " + index + " " + i + " " + (i | lastHold) + " " + i);
                //   System.out.println(Integer.bitCount(i) + " " + i);

//                if (index == 3) {
//                    System.out.println(last + " " + i + " " + match(i, last) + " " + next);
//                }
                if(index + 1 == max && match(i,lastHold)!= need){
                    continue;
                }
     ... What is the time complexity of the previous code?
targets: np
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class DConcatenatedMultiples {
        public void solve(int testNumber, ReaderFastIO in, PrintWriter out) {

            Map<Integer, Integer>[] mapMods = new HashMap[11];

            int n = in.nextInt();
            int k = in.nextInt();
            int[] a = in.readArrayInt(n);

            for (int i = 0; i < 11; i++) {
                mapMods[i] = new HashMap<>();
            }

            for (int i = 0; i < n; i++) {
                int pot = getPot(a[i]);
                mapMods[pot].put(a[i] % k, mapMods[pot].getOrDefault(a[i] % k, 0) + 1);
            }

            long ct = 0;

            for (int i = 0; i < n; i++) {

                int ownPot = getPot(a[i]);
                long suffix = a[i] * 10L;
                for (int j = 1; j <= 10; j++) {

                    int mod = (int) (suffix % k);
                    int comMod = (k - mod) % k;
                    int qt = mapMods[j].getOrDefault(comMod, 0);

                    if (j == ownPot && (a[i] % k) == comMod) {
                        qt--;
                    }

                    ct += qt;

                    suffix = (suffix * 10L) % k;
                }

            }

            out.println(ct);
        }

        public int getPot(int... What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.*;
import java.util.*;

import static java.lang.System.out;

public class Main {

    private FastScanner scanner = new FastScanner();

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

    private List<Integer>[] gr = new ArrayList[1000_000+5];
    private int dp[][] = new int[21][1000_000+5];
    private boolean used[] = new boolean[1000_000+5];

    void init(int v, int p) {
        Stack<Integer> st = new Stack<>();
        st.push(v);
        st.push(p);
        while (!st.isEmpty()) {
            p = st.pop();
            v = st.pop();
            used[v] = true;

            dp[0][v] =  p;
            for (int i = 1; i <= 20; i++) {
                if (dp[i - 1][v] != -1) {
                    dp[i][v] = dp[i - 1][dp[i - 1][v]];
                }
            }

            for (int next : gr[v]) {
                if (!used[next]) {
                    st.push(next);
                    st.push(v);
                }
            }

        }
    }


    private void solve() {
        int n = scanner.nextInt(), k = scanner.nextInt();
        boolean[] ans = new boolean[1000_000 + 5];

        for (int i = 0; i < n; i++) {
            gr[i] = new ArrayList<>();
        }

        for (int i = 0; i < n - 1; i ++) {
            int u = scanner.nextInt() - 1, v = scanner.nextInt() - 1;
            gr[u].add(v);
            gr[v].add(u);
        }

        k = n - k - 1;
        ans[n - 1] = true;

        init(n - 1 , n - 1);

        int t, d, next;
        for (int i = n - 2; i >= 0; i--) {
            t = i;
            d = 1;
            if (ans[i]) {
                continue;
            }
            for (int j = 20; j >= 0; j--){
                next = dp[j][t];
                if (next != -1 && !ans[next]) {
                    t = next;
                    d +=  1 << j;
                }
            }

            if (d <= k) {
                k -=d;
                t = i;

                while (!ans[t]) {
                    ans[t] = true;
              ... What is the time complexity of the previous code?
targets: nlogn