Muennighoff/xP3x-sample huggingface dataset:
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. //package educational.round23;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		long n = nl();
		long S = nl();
		long d = 1000000000000000000L;
		out.println(dfs(d, n, S));
	}
	
	long dfs(long d, long n, long S)
	{
		if(d == 0)return 0L;
		long ret = 0;
		for(int i = 0;i <= n/d;i++){
			if(S <= 0){
				ret += Math.min(n-i*d+1, d);
			}else if(S < d){
				ret += dfs(d/10, i == n/d ? n%d : d-1, S);
			}
			S -= d-1;
		}
		return ret;
	}
	
	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new C().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n... 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.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

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

class TaskA {
    private static final long MOD = 1000000009;

    public void solve(int testNumber, Reader in, OutputWriter out) {
        long answer = 0;
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        long l = -1;
        long r = n + 1;

        while (l + 1 < r) {
            long c = (l + r) / 2;
            if(n < c * k || canAchieve(n - c * k, k) >= m - c * k) {
                r = c;
            }
            else
                l = c;
        }

        //out.println(r);

        long c = r;

        answer = ((IntegerUtils.power(2, c + 1, MOD) - 2 + MOD) % MOD) * k % MOD;

        n -= k * c;
        m -= k * c;
        answer += m;
        answer %= MOD;

        out.println(answer);
    }

    private long canAchieve(long n, long k) {
        return n - n / k;
    }
}

class Reader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public Reader(BufferedReader reader) {
        this.reader = reader;
    }

    public Reader(InputStream stream) {
        this(new BufferedReader(new InputStreamReader(stream)));
    }

    public String nextString() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(readLine());
     ... Complexity:
targets: logn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;
import java.util.*;

public class A {
    public static void main(String args[]) {
        FastScanner scn = new FastScanner();
        int n = scn.nextInt();
        int s = scn.nextInt();
        if (s <= n) {
            System.out.println(1);
        } else if (s > n) {
            if(s%n == 0){
                System.out.println(s/n);
            } else {
                System.out.println(s/n + 1);
            }
        }

    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

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

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

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

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

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}
 Complexity:
targets: constant
inputs: import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class A
{
    public A()
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer mas[] = new Integer[n];
        int b = 0;
        for (int i = 0 ; i < n ; i ++)
        {
            mas[i] = sc.nextInt();
            b+=mas[i];
        }
        Arrays.sort(mas, new Comparator<Integer>()
        {

            @Override
            public int compare(Integer o1, Integer o2)
            {
                if(o1>o2)
                    return -1;
                else if(o1==o2)
                    return  0;
                else 
                    return 1;
            }      
        });
        int N = 0; int g = 0;
        for (int i = 0 ; i < n ; i ++)
        {
              g+=mas[i];
              if(g>(int)(b/2))
              {
                  System.out.println(i+1);
                  return;
              }
        }
        System.out.println(n);
    }
    public static void main(String[] args)
    {
        new A();      
    }
}
 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class ProblemB3 {
    Map<Integer, List<int[]>> dest;

    private ProblemB3() throws IOException {
        BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
        String h = rd.readLine();
        String[] q = h.split("\\s+");
        int a = Integer.parseInt(q[1]);
        int b = Integer.parseInt(q[2]);
        h = rd.readLine();
        q = h.split(" ");
        int n = q.length;
        int[] p = new int[n];
        for(int i=0;i<n;i++) {
            p[i] = Integer.parseInt(q[i]);
        }
        Set<Integer> pset = new HashSet<>();
        for(int x: p) {
            pset.add(x);
        }
        dest = new HashMap<>();
        boolean res = true;
        for(int x: p) {
            boolean aOk = pset.contains(a-x);
            boolean bOk = pset.contains(b-x);
            if(!aOk && !bOk) {
                res = false;
                break;
            } else {
                if(aOk) {
                    addEdgeAndBack(x,a-x,0);
                }
                if(bOk) {
                    addEdgeAndBack(x,b-x,1);
                }
            }
        }
        Set<Integer> aSet = new HashSet<>();

        if(res && a != b) {
            for(int x: p) {
                List<int[]> e = getEdges(x);
                if(e.size() == 1) {
                    int[] edge = e.get(0);
                    boolean odd = true;
                    int curA = edge[1];
                    int prev = x;
                    while(true) {
                        int cur = edge[0];
                        if(curA == 0 && odd) {
                            aSet.add(prev);
                            aSet.add(cur);
                        }
                        e = getEdges(cur);
                        if(e.size() == 1) {
                            if(!odd && e.get(0)[0] != cur) {
                                res = false;
                            }
          ... Complexity:
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
import java.lang.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.math.*;
public class Main {
    public void dfs(ArrayList<Integer>[] graph,int[] visited,int source) {
        
    }
    public static void main(String[] args) throws Exception{
        Reader.init(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Main mm =new Main();
        int n=Reader.nextInt();
        int m=Reader.nextInt();
        String s=Reader.next();
        int[][] count=new int[m][m];
        for(int i=1;i<n;i++) {
            count[s.charAt(i)-'a'][s.charAt(i-1)-'a']++;
            count[s.charAt(i-1)-'a'][s.charAt(i)-'a']++;
        }
        int[] dp=new int[1<<m];
        Arrays.fill(dp, Integer.MAX_VALUE/10);
        for(int i=0;i<m;i++) {
            dp[1<<i]=0;
        }
        for(int i=0;i<(1<<m);i++) {
            int extra=0;
            for(int j=0;j<m;j++) {
                if((i&(1<<j))>0) {
                for(int k=0;k<m;k++) {
                    if(j!=k &&  (i&(1<<k))==0) {
                        extra+=count[j][k];
                    }
                }
               }
            }
            for(int j=0;j<m;j++) {
                if((i&(1<<j))==0) {
                    dp[i|(1<<j)]=Math.min(dp[i|(1<<j)], dp[i]+extra);
                }
            }
        }
        out.println(dp[(1<<m)-1]);
        out.close();
}
}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */
    static void init() throws IOException {
         reader = new BufferedReader(
                 new FileReader("input.txt"));
    tokenizer = new StringTokenizer("");
    }
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static... Complexity:
targets: np
inputs: import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class A111
{
     public static void main(String args[])throws Exception
     {
         Scanner in=new Scanner(System.in);
         // br=new BufferedReader(new InputStreamReader(System.in));
         PrintWriter pw=new PrintWriter(System.out);
         int n,i,j,k=0,l;
         n=in.nextInt();
         int a[]=new int[n];
         int sum=0,sum1=0;
         for(i=0;i<n;i++)
         {
            a[i]=in.nextInt(); 
            sum+=a[i];
            }
            Arrays.sort(a);
         for(j=n-1;j>=0;j--)
         {
             sum1+=a[j];
             k++;
             if(sum1*2>sum)
             break;
            }
            pw.println(k);
         pw.flush();
     }
} What is the time complexity of the previous code?
targets: nlogn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class CodeForces1177B {
	
	public static char custBinSearch(long lower, long upper, long lowIndex, int ten, long position) {
		long half = Math.round((lower + upper) / 2.0);
		
		long lowBound = lowIndex + (half - lower)*(ten + 1);
		long upBound = lowBound + ten;
		
		if(position < lowBound) { //Less than the lowest index of half
			return custBinSearch(lower, half - 1, lowIndex, ten, position);
			
		} else if (position > upBound) { //Remember to update lowIndex here.
			lowIndex += (half + 1 - lower)*(ten + 1);
			return custBinSearch(half + 1, upper, lowIndex, ten, position);
			
		} else {
			return Long.toString(half).charAt((int) (position - lowBound)); //The final number will at max be 11 characters long, thus it is safe to convert and cast.
			
		}
		
	}
	
	public static void main(String[] args) throws IOException  {
		BufferedReader inputs = new BufferedReader(new InputStreamReader(System.in));
		
		long indexPosition = Long.parseLong(inputs.readLine());
		
		inputs.close();
		
		//Isolate possible combinations so that all further numbers will have the same length.
		int tenFactor = 0;
		long lowerBound = 1;
		long upperBound = (long) (Math.pow(10, 12));
		long lowerIndexBound = 1;
		long redIndex = 0;
		redIndex += indexPosition;
		
		while(redIndex > 0) {
			redIndex -= (long) (9*Math.pow(10, tenFactor)*(tenFactor + 1));
			if(redIndex <= 0) { //Stage 1: Completed Successfully.
				lowerBound = (long) (Math.pow(10, tenFactor));
				upperBound = (long) (Math.pow(10, tenFactor + 1) - 1);
				break;
			}
			
			lowerIndexBound += (long) (9*Math.pow(10, tenFactor)*(tenFactor + 1));
			tenFactor++;
			
		}
		
		System.out.println(custBinSearch(lowerBound, upperBound, lowerIndexBound, tenFactor, indexPosition));
		
	}
}
 Complexity:
targets: logn
inputs: import java.util.*;
import static java.lang.Math.*;
import java.io.*;

public class SolutionB {
      public static void main(String args[])throws IOException{
              Scanner sc = new Scanner(System.in);
              int a[] = new int[1501];
              for(int i = 0; i < 3; i++){
                     a[sc.nextInt()]++;
              }
              if(a[1] > 0 || a[2] > 1 || a[3] > 2 || (a[4] == 2 && a[2] == 1)){
                     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: constant
inputs: import java.util.*;
import java.awt.image.BandedSampleModel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Scanner;
public class D{

    static void sort(int[] A){

        int n = A.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = A[i];
            int randomPos = i + rnd.nextInt(n-i);
            A[i] = A[randomPos];
            A[randomPos] = tmp;
        }
        Arrays.sort(A);
    }

    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        //int cases = sc.nextInt();

        //for(int i=0;i<cases;i++)
        {
            int n = sc.nextInt();
            int m=sc.nextInt();
            int steps=sc.nextInt();
            long arr[][][] = new long[n][m][5];
            for(int j=0;j<n;j++)
            {
                for(int k=0;k<m-1;k++)
                {
                    long num=sc.nextLong();
                    arr[j][k][1]=num;
                    arr[j][k+1][3]=num;
                }
            }

            for(int j=0;j<n-1;j++)
            {
                for(int k=0;k<m;k++)
                {
                    long num=sc.nextLong();
                    arr[j][k][2]=num;
                    arr[j+1][k][4]=num;
                }
            }

            long temp[][]=new long[n][m];
            long ans[][]=new long[n][m];
            for(int i=0;i<steps/2;i++)
            {
                for(int j=0;j<n;j++)
                {
                    for(int k=0;k<m;k++)
                    {
                        long min=Long.MAX_VALUE;
                        if(k>0)
                        {
                            long f=arr[j][k][3]+ans[j][k-1];
                            min=Math.min(min,f);
                        }

                        if(k<m-1)
                        {
                            long f=arr[j][k][1]+ans[j][k+1];
                           ... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: cubic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;

public class Main implements Runnable {

    class Home implements Comparable<Home> {
        @Override
        public int compareTo(Home arg0) {
            return st - arg0.st;
        }

        int st, end;
        
    }
    
    public void solve() throws IOException {
        int n = nextInt(), t = nextInt() * 2;
        Home[] h = new Home[n];
        for(int i = 0; i < n; ++i) {
            int x = nextInt() * 2, a = nextInt() * 2;
            h[i] = new Home();
            h[i].st = x - a / 2;
            h[i].end = x + a / 2;           
        }             
        Arrays.sort(h);
        int ans = 2;
        for(int i = 0; i + 1 < n; ++i) {
            int delta = h[i + 1].st - h[i].end;
            if (delta == t)
                ans++;
            if (delta > t)
                ans += 2;
        }
        pw.println(ans);
    }
    
    static final String filename = "A";
    static final boolean fromConsole = true;

    public void run() {
        try {
            if (!fromConsole) {
                in = new BufferedReader(new FileReader(filename + ".in"));
                pw = new PrintWriter(filename + ".out");
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                pw = new PrintWriter(System.out);
            }
            st = new StringTokenizer("");
            long st = System.currentTimeMillis();
            solve();            
            //pw.printf("\nWorking time: %d ms\n", System.currentTimeMillis() - st);            
            pw.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        } 
    }
    
    private StringTokenizer st;
    private BufferedReader in;
    private PrintWriter pw; 
    
    boolean hasNext() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return false;
 ... Complexity:
targets: nlogn
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class MicroWorld {

	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		
		int[] temp = new int[1000001];
		
		StringTokenizer st1 = new StringTokenizer(br.readLine());
		
		for (int i = 0; i < n; i++){
			
			temp[Integer.parseInt(st1.nextToken())]++;
		}
		
		int b = k + 1;
		
		for (int i = 1000000; i > 0; i--){
			
			if (temp[i] > 0){
				if (b <= k){
					n -= temp[i];
				}
				b = 1;
			}else{
				b++;
			}
		}
		
		System.out.println(n);
		
	}

}
 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.lang.reflect.Array;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class A
{
	public static void main(String [] args) throws IOException
	{
		Scanner in = new Scanner(System.in);

		System.out.println(rec(in.nextLong(), in.nextLong()));

	}

	private static long rec(long a, long b)
	{
		return b == 0 ? 0 : a/b + rec(b, a%b);
	}

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

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

    static class DEhabIEsheOdnaOcherednayaZadachaNaXor {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int c = 0;
            int d = 0;

            int prevSign = 0;
            int nextSign;
            boolean zeroOut = true;
            for (int i = 29; i >= 0; i--) {
                if (zeroOut) {
                    print(c, d, out);
                    prevSign = read(in);
                }

                print((1 << i) | c, (1 << i) | d, out);
                nextSign = read(in);

                if (prevSign == nextSign) {
                    zeroOut = false;

                    print((1 << i) | c, d, out);
                    nextSign = read(in);

                    if (nextSign < 0) {
                        c = (1 << i) | c;
                        d = (1 << i) | d;
                    }
                } else {
                    zeroOut = true;

                    if (nextSign < 0) c = (1 << i) | c;
                    else d = (1 << i) | d;
                }
            }

            out.printf("! %d %d", c, d);
            out.flush();
        }

        private void print(int c, int d, PrintWriter out) {
            out.printf("? %d %d\n", c, d);
      ... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: logn
inputs: import java.io.*;
import java.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() {
           ... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: linear
inputs: import java.io.PrintWriter;
import java.util.*;

/**
 * Created by trung.pham on 28/12/17.
 */
public class C_Round_455_Div2 {
    static long[][]dp;

    static  long MOD =(long) 1e9 + 7;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        char[]data = new char[n];
        dp = new long[n][n];
        for(long []a : dp){
            Arrays.fill(a,-1);
        }
        for(int i = 0; i < n; i++){
            data[i] = in.next().charAt(0);
        }
        out.println(cal(0, 0, data));

        out.close();
    }

    static long cal(int index, int nested, char[]data ){
        //System.out.println(index + " " + nested);
        if(index + 1 == data.length){
            return 1;
        }
        if(dp[index][nested] != -1){
            return dp[index][nested];
        }
        long result = 0;
        boolean isLoop = data[index] == 'f';
        if(isLoop){
            result = cal(index + 1, nested + 1, data);
        }else{
            result = cal(index + 1, nested, data);
            if(nested > 0){
                result += cal(index, nested - 1, data);
                result %= MOD;
            }
        }
       // System.out.println(result + " " + index + " " + nested);
        return dp[index][nested]= result;

    }
}
 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 a {
public static void main(String[] args) throws IOException
{
    input.init(System.in);
    int n = input.nextInt(), k = input.nextInt();
    TreeSet<Integer> ts = new TreeSet<Integer>();
    int[] data = new int[n];
    for(int i = 0; i<n; i++)
    {
        data[i] = input.nextInt();
    }
    Arrays.sort(data);
    if(n>1 && k==1.*data[n-1]/data[0])
        System.out.println(n-1);
    else
    {
    for(int i = 0; i<n; i++)
    {
        if(data[i]%k != 0)
            ts.add(data[i]);
        else
        {
            if(!ts.contains(data[i]/k))
                ts.add(data[i]);
        }
    }
    System.out.println(ts.size());
    }
}
public static class input {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}
}
 Complexity:
targets: nlogn
inputs: import java.io.*;
import java.util.*;

public class TaskA  {
    public void run() {
        InputReader reader = new InputReader(System.in);
        PrintWriter writer = new PrintWriter(System.out, true);

        reader.nextLine();
        String statement = reader.next();

        if (!statement.startsWith("-")) {
            writer.println(statement);
        } else {
            try {
                int statement1 = Integer.parseInt(statement.substring(0, statement.length() - 1));
                int statement2 = Integer.parseInt(statement.substring(0, statement.length() - 2) + statement.charAt(statement.length() - 1));
                writer.println(Math.max(statement1, statement2));
            } catch (Exception e) {
                writer.println(statement);
            }
        }

        writer.close();
    }
    public static void main(String[] args) {
        new TaskA().run();
    }
    private class InputReader {
        BufferedReader reader;
        StringTokenizer token;

        private InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        private String next() {
            return token.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(this.next());
        }

        private double nextDouble() {
            return Double.parseDouble(this.next());
        }

        private long nextLong() {
            return Long.parseLong(this.next());
        }

        private String nextLine() {
            String line = "";
            try {
                line = reader.readLine();
                token = new StringTokenizer(line, " ");

            } catch(IOException e) {

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

public class Main {

    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
    ... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: np
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Scanner;

public class dwl {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String[] lr = sc.nextLine().split(" ");
		long l = Long.valueOf(lr[0]);
		long r = Long.valueOf(lr[1]);

		if (r - l <= 1 || (l == 1 && (r - l) == 2)
				|| (l % 2 != 0 && (r - l) < 3))
			System.out.println(-1);
		else {
			if (l == 1)
				System.out.println(2 + " " + 3 + " " + 4);
			else {
				if (l % 2 == 0) {
					String res = "";
					res += l + " ";
					res += (l + 1) + " ";
					res += (l + 2) + " ";
					res = res.trim();
					System.out.println(res);
				} else {
					String res = "";
					res += (l + 1) + " ";
					res += (l + 2) + " ";
					res += (l + 3) + " ";
					res = res.trim();
					System.out.println(res);

				}
			}

		}

	}

}
 Complexity:
targets: constant
inputs: import java.util.*;
import java.io.*;
import java.math.*;
public class Solution{
    
    static class Node implements Comparable<Node>{
        int sum;
        int l;
        int r;
        Node next;
        int nb;
        Node ini;
        boolean not;
        public Node(int sum,int l,int r){
            this.sum = sum;
            this.l = l;
            this.r = r;
            nb = 0;
            not = false;
            ini = null;
        }
        
        @Override
        public int compareTo(Node node){
            if(sum-node.sum!=0) return sum-node.sum;
            else if(l-node.l!=0) return l-node.l;
            else return r - node.r;
        }
    }
    
    public static void main(String[] args)throws IOException{
                
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        PrintWriter out = new PrintWriter(System.out);
        
        int n = Integer.parseInt(st.nextToken());
        
        TreeSet<Node> ts = new TreeSet<Node>();
        
        st = new StringTokenizer(br.readLine());
        int[] a = new int[n+1];
        for(int i=1;i<=n;i++) a[i] = Integer.parseInt(st.nextToken());
        
        int[] s = new int[n+1];
        for(int i=1;i<=n;i++) s[i] = s[i-1] + a[i];
        
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                ts.add(new Node(s[j]-s[i-1],i,j));
            }
        }
        int minvalue = -2000*(int)Math.pow(10,5);
        int maxvalue = 2000*(int)Math.pow(10,5);
        ts.add(new Node(minvalue,0,0));
        ts.add(new Node(maxvalue,0,0));
        //System.out.println(minvalue);
        Node node = ts.higher(ts.first());
        
        int sum = 0;
        
        
        
        int max = 0;
        Node m = null;
        
        while(node.sum!=maxvalue){
            
            sum = node.sum;
            while(node.sum==sum){
                node = ts.higher(node);
            }
            
  ... What is the time complexity of the previous code?
targets: quadratic
inputs: import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class mainA {
    public static PrintWriter out = new PrintWriter(System.out);
    public static FastScanner enter = new FastScanner(System.in);
    public static void main(String[] args) throws IOException {
        solve();
        out.close();
    }
    public static boolean[] was;
    private static void solve() throws IOException{
        int n=enter.nextInt();
        int[] arr=new int[n];
        was=new boolean[n];
        for (int i = 0; i <n ; i++) {
            arr[i]=enter.nextInt();
        }
        Arrays.sort(arr);
        int ans=0;
        for (int i = 0; i <n ; i++) {
            if(was[i]) continue;
            find(i, arr);
            ans++;
        }
        out.println(ans);
    }

    public static void find (int num, int[] arr){
        for (int i = num+1; i <arr.length ; i++) {
            if(arr[i]%arr[num]==0) was[i]=true;
        }
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer stok;

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

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

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

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

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

        char nextChar() throws IOException {
            return (char) (br.read());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }
    }
}
 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 c {
	public static void main(String[] args)
			throws IOException {
		BufferedReader r =	
				new BufferedReader(new InputStreamReader(System.in), 1);
		String s = r.readLine();
		int n = Integer.parseInt(s);
		String s2 = r.readLine();
		StringTokenizer st = new StringTokenizer(s2," ");
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(st.nextToken());
		Arrays.sort(a);
		if (a[n - 1] == 1) a[n - 1] = 2;
		else {a[n - 1] = 1; Arrays.sort(a);}
		for (int i = 0; i < n; i++)
			System.out.println(a[i]);
	}
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: nlogn
inputs: import java.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 BSRK Aditya (bsrkaditya@gmail.com)
 */
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) {
        long n = in.nextLong();

        if(n == 1) out.println("1");
        else if(n == 2) out.println("2");
        else if(n%2 == 1) out.println(n*(n-1)*(n-2));
        else if(n%6 == 0) out.println((n-1)*(n-2)*(n-3));
        else out.println(n*(n-1)*(n-3));
	}
}

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

public class CF1187G extends PrintWriter {
	CF1187G() { super(System.out); }
	static class Scanner {
		Scanner(InputStream in) { this.in = in; } InputStream in;
		int k, l; byte[] bb = new byte[1 << 15];
		byte getc() {
			if (k >= l) {
				k = 0;
				try { l = in.read(bb); } catch (IOException e) { l = 0; }
				if (l <= 0) return -1;
			}
			return bb[k++];
		}
		int nextInt() {
			byte c = 0; while (c <= 32) c = getc();
			int a = 0;
			while (c > 32) { a = a * 10 + c - '0'; c = getc(); }
			return a;
		}
	}
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1187G o = new CF1187G(); o.main(); o.flush();
	}

	static final int INF = 0x3f3f3f3f;
	ArrayList[] aa_;
	int n_, m_;
	int[] pi, dd, bb;
	int[] uu, vv, uv, cost;
	boolean[] iq;
	int[] cc;
	void init() {
		aa_ = new ArrayList[n_];
		for (int u = 0; u < n_; u++)
			aa_[u] = new ArrayList<Integer>();
		pi = new int[n_];
		dd = new int[n_];
		bb = new int[n_];
		iq = new boolean[n_];
		uu = new int[m_];
		vv = new int[m_];
		uv = new int[m_];
		cost = new int[m_];
		cc = new int[m_ * 2];
		m_ = 0;
	}
	void link(int u, int v, int cap, int cos) {
		int h = m_++;
		uu[h] = u;
		vv[h] = v;
		uv[h] = u ^ v;
		cost[h] = cos;
		cc[h << 1 ^ 0] = cap;
		aa_[u].add(h << 1 ^ 0);
		aa_[v].add(h << 1 ^ 1);
	}
	boolean dijkstra(int s, int t) {
		Arrays.fill(pi, INF);
		pi[s] = 0;
		TreeSet<Integer> pq = new TreeSet<>((u, v) -> pi[u] != pi[v] ? pi[u] - pi[v] : dd[u] != dd[v] ? dd[u] - dd[v] : u - v);
		pq.add(s); iq[s] = true;
		Integer first;
		while ((first = pq.pollFirst()) != null) {
			int u = first;
			iq[u] = false;
			int d = dd[u] + 1;
			ArrayList<Integer> adj = aa_[u];
			for (int h_ : adj)
				if (cc[h_] > 0) {
					int h = h_ >> 1;
					int p = pi[u] + ((h_ & 1) == 0 ? cost[h] : -cost[h]);
					int v = u ^ uv[h];
					if (pi[v] > p || pi[v] == p && dd[v] > d) {
						if (iq[v]) {
							pq.remove(v); iq[v] = false;
						}
						pi[v] = p;
						dd[v] = d;
						bb[v]... What is the time complexity of the previous code?
targets: cubic
inputs: import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

/* spar5h */

public class cf1 implements Runnable{    
	
	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		
		int t = 1;
		
		while(t-- > 0) {
			
			int n = s.nextInt(), m = s.nextInt();
			
			int[] a = new int[n + 1];
			
			for(int i = 1; i <= n; i++)
				a[i] = s.nextInt();
			
			int[] b = new int[n + 1];
			
			for(int i = 1; i <= n; i++)
				b[i] = s.nextInt();
			
			ArrayList<Integer> list = new ArrayList<Integer>();
			
			list.add(a[1]);
			
			for(int i = 2; i <= n; i++) {
				list.add(b[i]); list.add(a[i]);
			}
			
			list.add(b[1]);
			
			double wt = m;
			boolean check = true;
			
			for(int i = list.size() - 1; i >= 0; i--) {
				
				if(list.get(i) <= 1) {
					check = false; break;
				}
				
				double x = wt / (list.get(i) - 1);
						
				wt += x;
			}
			
			if(check)
				w.println(wt - m);
			else
				w.println(-1);
		}
		
		w.close();
	}
	
	static class InputReader {
		
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		
		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}
		
		public int read()
		{
			if (numChars==-1) 
				throw new InputMismatchException();
			
			if (curChar >= numChars)
			{
				curChar = 0;
				try 
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				
				if(numChars <= 0)				
					return -1;
			}
			return buf[curChar++];
		}
	 
		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c =... 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.*;
import java.io.*;

public class _1523_C {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int t = Integer.parseInt(in.readLine());
        while(t-- > 0) {
            int n = Integer.parseInt(in.readLine());
            int[] a = new int[n];
            for(int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.readLine());
            }
            boolean[][] used = new boolean[n][n + 1];
            boolean[] used2 = new boolean[n];
            String[][] res = new String[n][2];
            res[0][0] = "1";
            res[0][1] = "";
            for(int i = 1; i < n; i++) {
                if(a[i] == 1) {
                    for(int j = i - 1; j >= 0; j--) {
                        if(!used[j][a[i]] && !used2[j]) {
                            res[i][0] = res[j][0] + ".1";
                            res[i][1] = res[j][0];
                            used[j][a[i]] = true;
                            break;
                        }
                    }
                }else {
                    for(int j = i - 1; j >= 0; j--) {
                        if(!used[j][a[i]] && !used2[j] && a[j] == a[i] - 1) {
                            if(res[j][1].equals("")) {
                                res[i][0] = "" + a[i];
                            }else {
                                res[i][0] = res[j][1] + "." + a[i];
                            }
                            res[i][1] = res[j][1];
                            used[j][a[i]] = true;
                            break;
                        }
                        used2[j] = true;
                    }
                }
            }
            for(int i = 0; i < n; i++) {
                out.println(res[i][0]);
            }
        }
        in.close();
        out.close();
    }
}
 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.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;


public class P11D{
	static long mod=1000000007;
	
    public static void main(String[] args) throws Exception{           	
    	InputReader in = new InputReader(System.in);       
    	PrintWriter pw=new PrintWriter(System.out);   
    	
    	
    	//int t=in.readInt();
        //while(t-->0)
        //{
    	
        int n=in.readInt();
        int m=in.readInt();
        boolean v[][]=new boolean[n][n];
        for(int i=0;i<m;i++)
        {
        	int x=in.readInt()-1;
        	int y=in.readInt()-1;
        	v[x][y]=true;
        	v[y][x]=true;
        }
    	
       long dp[][]=new long[1<<n][n];
       for(int i=0;i<n;i++)
       {
    	   dp[1<<i][i]=1;
       }
       long ans=0;
    	for(int mask=1;mask<(1<<n);mask++)
    	{
    		int s=-1;
    		for(int i=0;i<n;i++)
    		{
    			if((mask&(1<<i))!=0)
    			{
    				s=i;
    				break;
    			}
    		}
    		for(int i=0;i<n;i++)
    		{
    			if(i!=s&&((1<<i)&mask)!=0)
    			{
    				for(int j=0;j<n;j++)
    				{
    					if((1<<j)!=0&&i!=j&&v[i][j])
    					{
    						int rem=(1<<i)^mask;
    						dp[mask][i]+=dp[rem][j];
    					}
    				}    			
    		
    				int c=Integer.bitCount(mask);
    				if(c>=3&&v[i][s])
    				{
    					ans+=dp[mask][i];
    				}
    			}
    		}
    	}
    	ans/=2;
		pw.println(ans);	     	
    	
    	//}
    	
    	pw.close();
    }
    

	
public static long gcd(long x,long y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int gcd(int x,int y)
{
	if(x%y==0)
		return y;
	else 
		return gcd(y,x%y);
}
public static int abs(int a,int b)
{
	return (int)Math.abs(a-b);
}
public static long abs(long a,long b)
{
	return (long)Math.abs(a-b);
}
public static int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static int min(int a,int b)
{
	if(a>b)
		return b;
	else 
		return a;
}
public static long max(long a,long b)
{
	if(a>b)
		return... Complexity:
targets: np