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

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();
        int[] game=new int[n];
        int[] bill=new int[m];
        for (int i = 0; i <n ; i++) {
            game[i]=scan.nextInt();
        }
        for (int i = 0; i <m ; i++) {
            bill[i]=scan.nextInt();
        }
        int i=0;
        int j=0;
        int ans=0;
        while (i<m){
            boolean f=true;
            for (int k = j; k <n ; k++) {
                if (bill[i]>=game[k]){
                    ans++;
                    i++;
                    j=k+1;
                    f=false;
                    break;
                }
            }
            if (f){
                break;
            }
        }
        System.out.println(ans);
    }
}


 What is the time complexity of the previous code?
targets: linear
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class E {

	static long mod;
	static long[][] dp;
	static int n;
	static long[] nWaysToPlaceGroupOfSize;
	
	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		n=fs.nextInt();
		mod=fs.nextInt();
		precomp();
		dp=new long[n+1][n+1];
		for (int i=0; i<dp.length; i++) Arrays.fill(dp[i], -1);
		
		long ans=0;
		for (int nXsLeft=2; nXsLeft<=n; nXsLeft++) {
			long curAns=go(0, nXsLeft);
			ans=add(ans, curAns);
		}
		System.out.println(ans);
	}
	
	static long go(int position, int nXsLeft) {
		if (position==n) {
			//last thing was skipped, impossible
			return 0;
		}
		if (position==n+1) {
			//last thing was included, 1 way of doing that
			if (nXsLeft==0) return 1;
			return 0;
		}
		if (dp[position][nXsLeft]!=-1) {
			return dp[position][nXsLeft];
		}
		//TODO: brute force number of xs to place
		long ways=0;
		for (int nPlace=1; nPlace<=Math.min(nXsLeft, n-position); nPlace++) {
			long futureWays=go(position+nPlace+1, nXsLeft-nPlace);
			long waysToPlaceMe=nCk(nXsLeft, nPlace);
			if (nPlace>1) waysToPlaceMe=mul(waysToPlaceMe, nWaysToPlaceGroupOfSize[nPlace]);
			ways=add(ways, mul(waysToPlaceMe, futureWays));
		}
		return dp[position][nXsLeft]=ways;
	}
	
	static long nCk(int n, int k) {
		if (k>n) throw null;
		return mul(facts[n], mul(factInvs[k], factInvs[n-k]));
	}
	
	static long add(long a, long b) {
		return (a+b)%mod;
	}
	static long sub(long a, long b) {
		return ((a-b)%mod+mod)%mod;
	}
	static long mul(long a, long b) {
		return (a*b)%mod;
	}
	static long fastPow(long base, long e) {
		if (e==0) return 1;
		long half=fastPow(base, e/2);
		if (e%2==0) return mul(half, half);
		return mul(half, mul(half, base));
	}
	
	static long[] facts=new long[1_000_00];
	static long[] factInvs=new long[1_000_00];
	static void precomp() {
		facts[0]=1;
		for (int i=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: import java.util.Scanner;
import java.util.Vector;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();
        for (int i = 0; i < n; i++) b[i] = sc.nextInt();
        int c[] = new int[2 * n];
        c[0] = a[0];
        for (int i = 1; i < n; i++) {
            c[i * 2] = a[i];
            c[i * 2 - 1] = b[i];
            if (a[i] == 1 || b[i] == 1) {
                System.out.print(-1);
                System.exit(0);
            }
        }
        c[2 * n - 1] = b[0];
        if (a[0] == 1 || b[0] == 1) {
            System.out.print(-1);
            System.exit(0);
        }
        System.out.println(bin_search(c, m));
    }

    private static double bin_search(int[] c, int m) {
        double start = 0;
        double end = Integer.MAX_VALUE;
        double mid;
        while (start + 0.0000001 < end) {
            mid = (start + end) / 2;
            if (test(mid, m, c)) end = mid;
            else start = mid;
        }
        return end;
    }

    private static boolean test(double fuel, int m, int[] c) {
        for (int i = 0; i < c.length; i++) {
            fuel -= (m + fuel) / c[i];
            if (fuel < 0) {
                return false;
            }
        }
        return true;
    }
}
 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.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static int MOD = 1000000007;

    // After writing solution, quick scan for:
    //   array out of bounds
    //   special cases e.g. n=1?
    //   npe, particularly in maps
    //
    // Big numbers arithmetic bugs:
    //   int overflow
    //   sorting, or taking max, after MOD
    void solve() throws IOException {
        int[] nT = ril(2);
        int n = nT[0];
        int T = nT[1];
        int[][] tg = new int[n][];
        for (int i = 0; i < n; i++) tg[i] = ril(2);

        // dp[t][m][g] is the number of sequences possible to be formed from
        // songs indicated by mask m, having total time t, and whose last song
        // is genre g.
        int[][][] dp = new int[T+1][1 << n][3];
        for (int ti = 1; ti <= T; ti++) {
            for (int mask = 1; mask <= (1 << n); mask++) {
                // Iterate over the possible last song. It's genre will determine
                // what the third dimension should be
                for (int j = 0; j < n; j++) {
                    if (((1 << j) & mask) == 0) continue;
                    int time = tg[j][0];
                    int genre = tg[j][1]-1;
                    if (ti - time < 0) continue;
                    long base = dp[ti][mask][genre];
                    long add = 0;
                    if (ti - time == 0) {
                        // Base case: there is always one way regardless of what songs are available.
                        // The empty playlist
                        add = 1;
                    } else {
                        for (int g = 0; g < 3; g++) add += dp[ti-time][mask ^ (1 << j)][g];
                        add -= dp[ti-time][mask ^ (1 << j)][genre];
                    }
                    dp[ti][mask][genre] = (int) ((base + add) % MOD);
                }
            }
        }
        long ans = 0;
        for (int g = 0; g < 3; g++) ans += dp[T][(1 << n)-1][g];
        pw.println(ans % MOD);
    }
    //... Complexity:
targets: np
inputs: //~~~~~~~~~~~~~~~~~~~~~~~@@@@@@@@@@@@@@@_____________K_____S_____J__________@@@@@@@@@@@@@@@@@@@@@@@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~
    //Date:00/00/17
    //-------------


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

/*

    [[[[[[[[[[[[[[[      ]]]]]]]]]]]]]]]
    [::::::::::::::      ::::::::::::::]
    [::::::::::::::      ::::::::::::::]
    [::::::[[[[[[[:      :]]]]]]]::::::]
    [:::::[                      ]:::::]
    [:::::[                      ]:::::]
    [:::::[                      ]:::::]
    [:::::[                      ]:::::]
    [:::::[    CODE YOUR LIFE    ]:::::]
    [:::::[   Kripa Shankar jha  ]:::::]
    [:::::[                      ]:::::]
    [:::::[                      ]:::::]
    [:::::[                      ]:::::]
    [:::::[                      ]:::::]
    [::::::[[[[[[[:      :]]]]]]]::::::]
    [::::::::::::::      ::::::::::::::]
    [::::::::::::::      ::::::::::::::]
    [[[[[[[[[[[[[[[      ]]]]]]]]]]]]]]]
*/

public class prob3{
  

    static Parser sc=new Parser(System.in);
    static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
  
  static int p[]=new int[100005];
  public static void main(String[] args) throws IOException {
    // use ((((((( sc ............... for input

   
    int n=sc.nextInt();

    int arr[]=new int[n];

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

    int swap=0;

    for(int i=0;i<n;i++){
      for(int j=0;j<i;j++){
        if(arr[i]<arr[j]){
           swap++; 
        }
      }
    }

    swap%=2;


    int m=sc.nextInt();

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

      int a=sc.nextInt(),b=sc.nextInt();
      swap+=((b-a)*((b-a)+1))/2;

      swap%=2;

      if(swap%2==0){System.out.println("even");}
      else{System.out.println("odd");}
    }


          
  }

   

public static void union(int a,int b){
        int i=find(a);
        int j=find(b);

        if(p[i]!=j){
          p[i]=j;
        }
      }


      public static int find(int a){

        while(p[a]!=a){
          a=p[a];
        }

       ... 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        for (int i = s.length() - 1; i > 0; i--)
            for (int j = 0; j <= s.length() - i; j++)
                if (s.substring(0, j + i - 1).contains(s.substring(j, j + i))
                        || s.substring(j + 1).contains(s.substring(j, j + i))) {
                    System.out.println(i);
                    return;
                }
        System.out.println(0);
    }
}
 Complexity:
targets: cubic
inputs: import java.io.*;
import java.util.*;

public class B {

	static int n, t[], g[], MOD = (int) 1e9 + 7;
	static int[][][] memo1, memo2[], memo3[];

	static int dp1(int idx, int remCnt, int remSum) {
		if (idx == n)
			return remSum == 0 && remCnt == 0 ? 1 : 0;
		if (remCnt < 0 || remSum < 0)
			return 0;
		if (memo1[idx][remCnt][remSum] != -1)
			return memo1[idx][remCnt][remSum];
		int ans = dp1(idx + 1, remCnt, remSum);
		if (g[idx] == 0) {
			ans += dp1(idx + 1, remCnt - 1, remSum - t[idx]);
			if (ans >= MOD)
				ans -= MOD;
		}
		return memo1[idx][remCnt][remSum] = ans;
	}

	static int dp2(int idx, int remCnt1, int remCnt2, int remSum) {

		if (idx == n)
			return remSum == 0 && remCnt1 == 0 && remCnt2 == 0 ? 1 : 0;
		if (remSum < 0 || remCnt1 < 0 || remCnt2 < 0)
			return 0;
		if (memo2[idx][remCnt1][remCnt2][remSum] != -1)
			return memo2[idx][remCnt1][remCnt2][remSum];
		int ans = dp2(idx + 1, remCnt1, remCnt2, remSum);

		if (g[idx] == 1)
			ans += dp2(idx + 1, remCnt1 - 1, remCnt2, remSum - t[idx]);
		else if (g[idx] == 2)
			ans += dp2(idx + 1, remCnt1, remCnt2 - 1, remSum - t[idx]);
		if(ans>=MOD)
			ans-=MOD;
		return memo2[idx][remCnt1][remCnt2][remSum] = ans;
	}

	private static int dp3(int cnt0, int cnt1, int cnt2, int last) {
		if (cnt0 < 0 || cnt1 < 0 || cnt2 < 0)
			return 0;
		if (cnt0 + cnt1 + cnt2 == 0)
			return 1;
		if (memo3[last][cnt0][cnt1][cnt2] != -1)
			return memo3[last][cnt0][cnt1][cnt2];
		long ans = 0;
		if (last != 0)
			ans += dp3(cnt0 - 1, cnt1, cnt2, 0);
		if (last != 1)
			ans += dp3(cnt0, cnt1 - 1, cnt2, 1);
		if (last != 2)
			ans += dp3(cnt0, cnt1, cnt2 - 1, 2);
		return memo3[last][cnt0][cnt1][cnt2] = (int) (ans % MOD);

	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		n = sc.nextInt();
		int[] fac = new int[n + 1];
		t = new int[n];
		g = new int[n];
		int[] cnt = new int[3];
		fac[0] = 1;
		for (int i = 1; i <= n; i++)
			fac[i] = (int) (i * 1L * fac[i - 1] % MOD);
		int... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: cubic
inputs: import java.io.*;
import java.util.*;
import java.text.*;

public class FollowTrafficRules
{
	public Scanner in = new Scanner(System.in);
	public PrintStream out = System.out;

	public double len, d, w, vmax, a;
	
	DecimalFormat fmt = new DecimalFormat("0.0000000000000000");
	
	public void main()
	{
		a = in.nextDouble();
		vmax = in.nextDouble();
		len = in.nextDouble();
		d = in.nextDouble();
		w = in.nextDouble();
		
		out.println(fmt.format(T()));
	}//end public void main()
	
	public double T()
	{
		double t, s;
		
		double t1, s1;
		t1 = vmax / a;
		s1 = vmax*vmax/(2.0*a);
		
		double t3, s3;
		t3 = w/a;
		s3 = w*w/(2.0*a);
				
		if(w >= vmax)
		{
			if(s1 < len)
			{
				return t1 + (len - s1)/vmax;
			}
			else
			{
				return Math.sqrt(2.0*len/a);
			}			
		}
		else
		{
			//w < vmax
			
			double t2, s2, v2;
			t2 = Math.sqrt(2.0*d/a);
			v2 = a*t2;
			
			double tx, vx;
			vx = Math.sqrt((2.0*a*d + w*w)/2.0);
			tx = vx / a;	
			
			//vmax > w

			//v2 > vx > w
			
			if(v2 < w)
			{
				if(v2 > vmax)
				{
					//v2 > vmax > w
					if(vmax > vx)
					{
						return tx + (vx - w)/a + T2(w);
					}
					else
					{
						double ty, sy;
						ty = (vmax - w)/a;
						sy = ty * (vmax + w)/2.0;
						return t1 + ty + (d - s1 - sy)/vmax + T2(w);
					}
				}
				else
				{
					//v2 < w, v2 <= vmax
					return t2 + T2(v2);					
				}
			}
			else if(v2 > vmax) //v2 >= w, vmax > w
			{
				//v2 > vmax > w
				if(vmax > vx)
				{
					return tx + (vx - w)/a + T2(w);
				}
				else
				{
					double ty, sy;
					ty = (vmax - w)/a;
					sy = ty * (vmax + w)/2.0;
					return t1 + ty + (d - s1 - sy)/vmax + T2(w);
				}
			}
			else  //vmax >= v2 >= w
			{
				//out.println("Questionable.");
				//return binary() + T2(w);
				
				//return  t3 + (d-s3)/w + T2(w);

				return tx + (vx - w)/a + T2(w);
			}
		}
	}
	
	public double binary()
	{
		double low, high, t, s;
		low = 0.0; high = vmax/a;
		
		for(int c=0;c<50;++c)
		{
			t = (low+high)/2;
			s = (a*t*t)/2 + ((a*t - w)/a)*(a*t + w)/2.0;
			
			if(s > d)... What is the time complexity of the previous code?
targets: constant
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemA {
	

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

		String line = s.readLine();
		int len = line.length();
		int max = 0;
		for (int i = 0 ; i < len ; i++) {
			for (int j = i+1 ; j <= len ; j++) {
				String sch = line.substring(i, j);
				for (int k = i+1 ; k + (j - i) <= len ; k++) {
					String tch = line.substring(k, k+(j-i));
					if (sch.equals(tch)) {
						max = Math.max(max, (j-i));
					}
				}
			}
		}
		out.println(max);
		out.flush();
	}


	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: cubic
inputs: import java.util.ArrayList;
import java.util.Scanner;
import java.lang.StringBuilder;
import java.util.Arrays;
import java.util.Stack;
import java.util.TreeMap;
public class Test11   {  
    public static void main(String[] Args)   {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s0 = sc.nextLine();
        int s = 0; // S
        int m = 0;
        int l = 0;
        int s1 = 0;
        int l1 = 0;
        int s2 = 0;
        int l2 = 0;
        int s3 = 0;
        int l3 = 0;
        for (int i = 0; i < n; i++)  {
            s0 = sc.nextLine();
            if (s0.charAt(0) == 'S') s++;
            if (s0.charAt(0) == 'M') m++;
            if (s0.charAt(0) == 'L') l++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') s1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') s2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') s3++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') l1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') l2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') l3++;
        }    
        int rs = 0; // S
        int rm = 0;
        int rl = 0;
        int rs1 = 0;
        int rl1 = 0;
        int rs2 = 0;
        int rl2 = 0;
        int rs3 = 0;
        int rl3 = 0;
        for (int i = 0; i < n; i++)  {
            s0 = sc.nextLine();
            if (s0.charAt(0) == 'S') rs++;
            if (s0.charAt(0) == 'M') rm++;
            if (s0.charAt(0) == 'L') rl++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') rs1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') rs2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') rs3++;
           ... What is the time complexity of the previous code?
targets: linear
inputs: import java.util.ArrayList;
import java.util.Scanner;



public class primes {

public static void main(String []  args){

ArrayList<Integer> numb=new ArrayList<Integer>();
Scanner br1 = new Scanner(System.in);
int n=br1.nextInt();
int steps=br1.nextInt();
//if(n>2)numb.add(2);
if(n>=3)numb.add(3);
for(int j=4;j<=n;j++){
if(chekprime(j)==0){

numb.add(j);
//System.out.println(j);
}

}
int counter =0;
for(int give=0;give<numb.size();give++)
{if("YES".equals(sumup(numb, 2, numb.get(give)))){
 counter++;
// System.out.println(numb.get(give)+"ksjdfskldfgaskldfgasklfgaskldfgaklsfgasdklfgaskldfgaskldfgasdklfg");
 }



}

//System.out.println(counter);
if(counter>=steps)System.out.println("YES");
else System.out.println("NO");


}

public static String sumup(ArrayList<Integer> list,int number,int NUM){

String ret="NO";
    ArrayList<Integer> result=new ArrayList<Integer>();

ArrayList<Integer>[] arList=new ArrayList[number];
for(int i=0;i<number;i++){
arList[i]=new ArrayList<Integer>();
arList[i]=(ArrayList<Integer>)list.clone();
for(int k=0;k<i;k++){
arList[i].add(0,arList[i].remove(arList[i].size()-1));
}

}


    int [] temp=new int[list.size()];
    
for(int z=0;z<list.size();z++){
    for(int count=0;count<number;count++){
        
temp[z]+=arList[count].get(z);
//System.out.println(arList[count].get(z));
    }

result.add(temp[z]);

}

if(result.contains(NUM-1))
{    //System.out.println(NUM-1);
ret="YES";
}
return ret;
}



public static int chekprime(int n){
int flag=0;

for(int i=2;i<=Math.sqrt(n)+1;i++)
{
if(n%i==0){
flag=1;
break;
}

} 

return flag;

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

public class A023 {
	public static void main(String[] args) {
		System.out.println(f());
	}

	static int f() {
		Scanner in = new Scanner(System.in);
		String line = in.next();
		for (int length = line.length(); length > 0; length--) {
			for (int start = 0; start + length <= line.length(); start++) {
				if(line.indexOf(line.substring(start,start+length),start+1)>=0) {
					return length;
				}
			}
		}
		return 0;
	}
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: cubic
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskC {
        int MOD = (int) 1e9 + 7;

        long power(long a, long k) {
            long res = 1;
            while (k > 0) {
                if ((k & 1) != 0) {
                    res = res * a % MOD;
                }
                a = a * a % MOD;
                k /= 2;
            }
            return res;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long x = in.nextLong(), k = in.nextLong();
            if (x == 0) {
                out.println(0);
                return;
            }
            long res = ((power(2, k + 1) % MOD) * (x % MOD)) % MOD;
            long temp = power(2, k);
            res = res - temp + 1;
            while (res < 0) res += MOD;
            out.println(res);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

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

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

// Petya and Spiders
// 2011/9/3
public class P111C{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;

	int n, m;

	void run(){
		n=sc.nextInt();
		m=sc.nextInt();
		solve();
	}

	void solve(){
		if(n<m){
			int t=n;
			n=m;
			m=t;
		}
		int full=(1<<m)-1;
		int[][] dp=new int[1<<m][1<<m];
		int[][] tmp=new int[1<<m][1<<m];
		for(int i=0; i<1<<m; i++){
			fill(dp[i], INF);
		}
		for(int i=0; i<1<<m; i++){
			int b1=(i|(i>>1)|(i<<1))&full;
			int b2=i;
			dp[b1][b2]=Integer.bitCount(i);
		}
		for(int j=0; j<n-1; j++){
			for(int i=0; i<1<<m; i++){
				System.arraycopy(dp[i], 0, tmp[i], 0, 1<<m);
				fill(dp[i], INF);
			}

			for(int b1=0; b1<1<<m; b1++){
				for(int b2=0; b2<1<<m; b2++){
					for(int i=0; i<1<<m; i++){
						if((b1|i)!=full){
							continue;
						}
						int b=(i|(i>>1)|(i<<1))&full;
						dp[b2|b][i]=min(dp[b2|b][i],
								tmp[b1][b2]+Integer.bitCount(i));
					}
				}
			}
		}

		int min=INF;
		for(int i=0; i<1<<m; i++){
			min=min(min, dp[full][i]);
		}
		int ans=m*n-min;
		println(ans+"");
	}

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

	public static void main(String[] args){
		new P111C().run();
	}
}
 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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.io.InputStream;

public class BuildIn {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solve(in, out);
        out.close();
    }
    public static void solve(InputReader in, PrintWriter out) throws IOException
    {
    	int n = in.nextInt();
    	int[] list = new int[n];
    	for(int i = 0; i < n; i++)
    	{
    		list[i]=in.nextInt();
    	}
    	
    	int count = 0;
    	for(int i = 0; i < n-1; i++)
    	{
    		for(int j = i+1; j < n; j++)
    		{
    			if(list[j]<list[i])
    			{
    				count++;
    			}
    		}
    	}
    	
    	boolean sta = true;
    	if(count%2==1) sta = false;
    	
    	int m =  in.nextInt();
    	for(int i = 0; i <m; i++)
    	{
    		int a = in.nextInt();
    		int b = in.nextInt();
    		if((b-a)%4==2) sta = !sta;
    		if((b-a)%4==1) sta = !sta;    		
    		if(sta) out.println("even");
    		else out.println("odd");
    	}
	}

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

	        public InputReader(InputStream stream) {
	            reader = new BufferedReader(new InputStreamReader(stream), 32768);
	            tokenizer = null;
	        }

	        
	        public String next() {
	            while (tokenizer == null ||... Complexity:
targets: quadratic
inputs: import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {

    long mod = (long) (1e9 + 7);

    void solve() throws Throwable {
        long x = readLong(), k = readLong();
        if (x == 0) {
            System.out.println(0);
            return;
        }
        long r = solveFast(x, k);
        //long r2 = solveSlow(x, k) % mod;
        System.out.println(r);
        //System.out.println(r2);
    }

    private long solveSlow(long x, long k) {
        List<Long> a = new ArrayList<>();
        a.add(x);
        for (int i = 0; i < k; i++) {
            dodouble(a);
            a = eat(a);
        }
        dodouble(a);
        long sum = 0;
        for (Long v : a) {
            sum = (sum + v) % mod;
        }
        return sum * rev(a.size(), mod) % mod;
    }

    private List<Long> eat(List<Long> a) {
        List<Long> r = new ArrayList<>();
        for (Long v : a) {
            r.add(v);
            r.add((v - 1 + mod) % mod);
        }
        return r;
    }

    private void dodouble(List<Long> a) {
        for (int i = 0; i < a.size(); i++) {
            a.set(i, a.get(i) * 2 % mod);
        }
    }

    private long solveFast(long x, long k) {
        long n = binpow(2, k, mod);
        long ma = (binpow(2, k + 1, mod) * (x % mod)) % mod;
        long mi = (ma - n * 2 + 2 + mod * 100) % mod;
        return ((ma + mi) * rev(2, mod)) % mod;
    }

    private long rev(long a, long mod) {
        return binpow(a, mod - 2, mod);
    }

    //-------------------------------------------------

    final boolean ONLINE_JUDGE = !new File("input.txt").exists();

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    public void run() {
        Runnable run = () -> {
            try {
                long startTime = System.currentTimeMillis();
                Locale.setDefault(Locale.US);
                if (ONLINE_JUDGE) {
                    in = new BufferedReader(new InputStreamReader(System.in));
                    out = new... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: logn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. // //package ;
import java.io.*;
import java.util.*;

public class A
{
	public static int sol(String n,String p)
	{
		int sol=0;
		for(int i=0;i<n.length();i++)
		{
			if(n.charAt(i)!=p.charAt(i))
				sol++;
		}
		return sol;
	}
	public static void main(String[] args) throws IOException 
	{
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		int n=sc.nextInt();
		ArrayList<String>p=new ArrayList<>();
		ArrayList<String>ne=new ArrayList<>();
		for(int i=0;i<n;i++)
			p.add(sc.nextLine());
		for(int i=0;i<n;i++)
		{	
			String t=sc.nextLine();
			if(p.contains(t))
				p.remove(t);
			else
				ne.add(t);
		}
		Collections.sort(p);
		Collections.sort(ne);
		int ans=0;
		for(int i=0;i<ne.size();i++)
		{
			ans+=sol(ne.get(i),p.get(i));
		}
		System.out.println(ans);
		pw.close();    
	}
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;
		
		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.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());
		}
		
		String nextLine() throws IOException {
			return br.readLine();
		}
		boolean hasnext() throws IOException{
			return br.ready();
		}
		
	}
}
 Complexity:
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;

public class A {
	static String file = "";
	static BufferedReader br;
	static PrintWriter pw;
	static StringTokenizer st;

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		Locale.setDefault(Locale.US);

		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		long a = nextLong();
		long b = nextLong();
		if (a % 2 == 1 && b - a == 2 || b - a == 1 || a == b) {
			pw.print(-1);
		} else {
			if (a % 2 == 1)
				a++;
			pw.print(a + " " + (a + 1) + " " + (a + 2));
		}
		pw.close();
	}

	private static double yuza(double x1, double y1, double x2, double y2,
			double x3, double y3) {
		return (x1 * (y3 - y2) + x2 * (y1 - y3) + x3 * (y2 - y1));
	}

	private static void ffile() throws IOException {
		br = new BufferedReader(new FileReader(file + "in"));
		pw = new PrintWriter(new BufferedWriter(new FileWriter(file + "out")));
	}

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

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

	private static double nextDouble() throws NumberFormatException,
			IOException {
		return Double.parseDouble(next());
	}

	private static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new... Complexity:
targets: constant
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

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

    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        int n = nextInt();
        Set<Integer> set = new TreeSet<Integer>();

        for (int i = 0; i < n; i++) {
            set.add(nextInt());
        }
        set.remove(set.iterator().next());
        PrintWriter pw = new PrintWriter(System.out);
        if (set.isEmpty()) {
            pw.println("NO");
        } else {
            pw.println(set.iterator().next());
        }
        pw.close();
    }

    int nextInt() throws IOException {
        while (!st.hasMoreElements()) {
            st = new StringTokenizer(br.readLine());
        }
        return Integer.parseInt(st.nextToken());
    }

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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String input = in.nextLine();
        if (input.equals("1"))
            System.out.println("NO");
        else {
            if (checkNum(input))
                System.out.println("YES");
            else {
                int i = 2;
                while (i < Integer.parseInt(input)) {
                    if (checkNum(i + "")) {
                        if (Integer.parseInt(input) % i != 0)
                            i++;
                        else
                            break;
                    } else
                        i++;
                }
                if (i == Integer.parseInt(input))
                    System.out.println("NO");
                else
                    System.out.println("YES");
            }
        }
    }

    public static boolean checkNum(String s) {
        int i = 0;
        int flag = 0;
        while (i < s.length()) {
            if (s.charAt(i) == '4' || s.charAt(i) == '7') {
                flag = 1;
                i++;
            } else
                return false;
        }
        if (flag == 1)
            return true;
        return false;
    }
}
 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: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;

public class Main {
	
	public static void main(String[] args) throws Exception {
		
		int n = nextInt();
		String nn = Integer.toString(n);
		if(n >= 0){
			println(n);
		} else {
			println(Math.max(Integer.parseInt(nn.substring(0,nn.length() - 1)), Integer.parseInt(nn.substring(0, nn.length() - 2) + nn.charAt(nn.length() - 1))));
		}
	}
	
	private static PrintWriter out =  new PrintWriter(System.out);
	private static BufferedReader inB = new BufferedReader(new InputStreamReader(System.in));	
	private static StreamTokenizer in = new StreamTokenizer(inB);
	
	private static void exit(Object o) throws Exception {
		out.println(o);
		out.flush();
		System.exit(0);
	}
	private static void println(Object o) throws Exception{
		out.println(o);
		out.flush();
	}
	private static void print(Object o) throws Exception{
		out.print(o);
		out.flush();
	}
	private static long nextLong() throws Exception {
		in.nextToken();
		return (long)in.nval;
	}  
	private static int nextInt() throws Exception {
		in.nextToken();
		return (int)in.nval;
	}  
	private static String nextString() throws Exception {
		in.nextToken();
		return in.sval;        
	}
	
}  Complexity:
targets: constant
inputs: import java.util.Arrays;
import java.util.Scanner;
public class Main{
  public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       Long N = sc.nextLong();
       Long ans;
       sc.close();
       if(N <= 2)
           System.out.println(N);
       else{
           if(N % 6 == 0){
                ans = (N - 1) * (N - 2) * (N - 3);}
            else if(N % 2 == 0){
                ans = N * (N - 1) * (N - 3);
            }
            else{
                ans = N * (N - 1) * (N - 2);
            }
           System.out.println(ans);
       }
    }
} 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.*;
public class TwentyFive {
	
	public static void main(String[] args)
	{
		System.out.println("25");
	}
}
 Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: constant
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

    static class TaskF {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[][] graph = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++)
                    graph[i][j] = in.nextInt();
            }
            int[][] mn1 = new int[n][n];
            int[][] mn2 = new int[n][n];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++) {
                    int min_val = Integer.MAX_VALUE;
                    for (int k = 0; k < m; k++)
                        min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k]));
                    mn1[i][j] = min_val;
                    min_val = Integer.MAX_VALUE;
                    for (int k = 0; k < m - 1; k++) {
                        min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k + 1]));
                    }
                    mn2[i][j] = min_val;
                }
            int[][] dp = new int[(1 << (n + 2))][n];
            int ans = 0;
            for (int i = 0; i < n; i++) {
                for (int[] temp : dp)
                    Arrays.fill(temp, -1);
                for (int j = 0; j < n; j++) {
                    dp[1 << j][j] = (j == i ? Integer.MAX_VALUE : 0);
//                dp[1 << j][j] = (j == i ? 0: Integer.MAX_VALUE );
                }
         ... What is the time complexity of the previous code?
targets: np
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
import java.io.*;

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

	FastReader in = new FastReader();
	PrintWriter out = new PrintWriter(System.out);
	void run(){
		int t=in.nextInt();
		for(int i=0;i<t;i++) {
			out.println(work());
		}
		out.flush();
	}
	long mod=1000000007;
	long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	int work() {
		int n=in.nextInt();
		int m=in.nextInt();
		int[][] A=new int[n][m];
		int[][] B=new int[n][m];
		int[][] R=new int[m][2];
		for(int i=0;i<m;i++)R[i][1]=i;
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				A[i][j]=in.nextInt();
				R[j][0]=Math.max(R[j][0], A[i][j]);
			}
		}
		Arrays.sort(R,new Comparator<int[]>() {
			public int compare(int[] arr1,int[] arr2) {
				return arr2[0]-arr1[0];
			}
		});
		for(int j=0;j<m;j++) {
			int index=R[j][1];
			for(int i=0;i<n;i++) {
				B[i][j]=A[i][index];
			}
		}
		m=Math.min(n, m);
		int[][] dp=new int[m][1<<n];
		int[][] rec=new int[m][1<<n];
		for(int j=0;j<m;j++) {
			for(int s=0;s<n;s++) {//转
				for(int i=1;i<1<<n;i++) {
					int sum=0;
					for(int b=0;b<n;b++) {
						if(((1<<b)&i)>0) {
							sum+=B[(b+s)%n][j];
						}
					}
					rec[j][i]=Math.max(sum, rec[j][i]);
				}
			}
		}
		
		for(int j=0;j<m;j++) {
			for(int i=0;i<1<<n;i++) {
				if(j==0) {
					dp[j][i]=rec[j][i];
				}else {
					for(int p=i+1;;p++) {
						if(p>=1<<n)break;
						p=p|i;
						dp[j][p]=Math.max(dp[j][p], rec[j][i]+dp[j-1][p^i]);
					}
				}
			}
		}
		return dp[m-1][(1<<n)-1];
	}
}



class FastReader
{
	BufferedReader br;
	StringTokenizer st;

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

	public String next() 
	{
		if(st==null || !st.hasMoreElements())
		{
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

	public long nextLong()
	{
		return Long.parseLong(next());
	}
} Complexity:
targets: np
inputs: import java.io.*;
import java.util.*;

public class trafficerules {
 	
 	public static void main(String[] args) throws Exception {
 		if ("Satayev".equals(System.getProperty("user.name"))) {
			long start = System.nanoTime();
			new trafficerules().solve(new FileInputStream("input"));
			System.err.printf("Time elapsed: %d ms.\n", (System.nanoTime()-start)/1000000);
		}
		else
			new trafficerules().solve(System.in);
 	}

 	void solve(InputStream is) throws Exception {
		Scanner in = new Scanner(is);
		
		double a = in.nextDouble(), maxv = in.nextDouble(), s = in.nextDouble(), d = in.nextDouble(), w = in.nextDouble();
		
		if (maxv < w)
			w = maxv;
		
		double t = 0;
		
		// v = at
		// s = att/2
		double t1 = w / a;
		double s1 = a*t1*t1/2;
		double v1 = w;
		if ( s1 < d ) {
			v1 = w;
			
			if (v1 >= maxv)
				t1 += (d-s1)/v1;
			else {
				double tt = (maxv - v1)/a;
				double ss = v1*tt+a*tt*tt/2;
				ss *= 2;
				if (s1 + ss < d)
					t1 += tt*2 + (d-s1-ss)/maxv;
				else {
					ss = (d-s1)/2;
					// ss = v1*t + a*t*t/2;
					double A = a/2;
					double B = v1;
					double C = -ss;
					double D = B*B - 4 * A * C;
					tt = (-B + Math.sqrt(D))/2/A;
					t1 += tt*2;
				}
			}
			
			s1 = d;
		}
		if (s1 > d) {
			s1 = d;
			t1 = Math.sqrt(2*s1/a);
			v1 = a * t1;
		}
		
		t += t1;
		
		double t2 = (maxv - v1) / a;
		double s2 = v1*t2 + a*t2*t2/2;
		double v2 = maxv;
		if (s1 + s2 < s) {
			v2 = maxv;
			t2 += (s-s1-s2)/v2;
		}
		if (s1 + s2 > s) {
			s -= s1;
			// v = v1 + a*t
			// s = v1*t + a*t*t/2
			double A = a/2;
			double B = v1;
			double C = -s;
			double D = B*B - 4*A*C;
			
			t2 = (-B + Math.sqrt(D))/2/A;
		}
		
		t += t2;
		
		System.out.println(t);
 	}

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

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    class GraphBuilder {
        int n, m;
        int[] x, y;
        int index;
        int[] size;


        GraphBuilder(int n, int m) {
            this.n = n;
            this.m = m;
            x = new int[m];
            y = new int[m];
            size = new int[n];
        }

        void add(int u, int v) {
            x[index] = u;
            y[index] = v;
            size[u]++;
            size[v]++;
            index++;
        }

        int[][] build() {
            int[][] graph = new int[n][];
            for (int i = 0; i < n; i++) {
                graph[i] = new int[size[i]];
            }
            for (int i = index - 1; i >= 0; i--) {
                int u = x[i];
                int v = y[i];
                graph[u][--size[u]] = v;
                graph[v][--size[v]] = u;
            }
            return graph;
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws... 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: import java.util.*;

public class Rules {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    double maxSpeed = in.nextInt();
    double len = in.nextInt();
    double delayDist = in.nextInt();
    double delaySpeed = in.nextInt();
    
    // two cases: I reach the delayPoint at a speed higher than the delaySpeed, or I don't.
    double timeToDelayAtMax = travelS(a, 0.0, maxSpeed, delayDist);
    double timeToDelayAtDelay = travelS(a, 0.0, delaySpeed, delayDist);
    if (Math.abs(timeToDelayAtMax-timeToDelayAtDelay) < 0.00001) {
      // I can reach the delayPoint without being delayed
      double time = travelS(a, 0.0, maxSpeed, len);
      System.out.printf("%.9f\n", time);
      return;
    }
    
    // binary search to find best velocity to stop acceleration in beginning
    double lowV = delaySpeed;
    double highV = maxSpeed;
    int loopCount = 1000;
    double[] initial = null;
    double[] secondary = null;
    while (loopCount-->0) {
      double guessV = (lowV+highV)/2.0;
      initial = travelA(a, 0.0, guessV);
      secondary = travelA(a, guessV, Math.min(delaySpeed, maxSpeed));
      if (initial[1] + secondary[1] < delayDist) { // okay, we can go faster
        lowV = guessV;
      } else {
        highV = guessV;
      }
    }
    double totalTime = 0.0;
    double finalSpeed = 0.0;
    initial = travelA(a, 0.0, lowV);
    secondary = travelA(a, lowV, delaySpeed);
    totalTime = initial[0] + secondary[0];
    double totalDist = initial[1] + secondary[1];
    totalTime += (delayDist-totalDist)/maxSpeed;
    
    // now we have delayDist to go, and we are at delaySpeed
    totalTime += travelS(a, delaySpeed, maxSpeed, len-delayDist);
    System.out.printf("%.9f\n", totalTime);
  }
  
  // [0] = time in h, [1] = dist travelled, in km
  // input units are in km/h^2, km/h, km/h
  public static double[] travelA(int a, double startSpeed, double endSpeed) {
    if (startSpeed > endSpeed)
      a = -a;
    
    double time = (endSpeed -... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: constant