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

public class A {

	class Team implements Comparable<Team>{
		int p, t;
		public Team(int p, int t) {
			this.p = p;
			this.t = t;
		}
		public int compareTo(Team other) {
			if (this.p != other.p) return other.p - this.p;
			return this.t - other.t;
		}
	}
	
	public void solve() throws IOException {
		int n = nextInt();
		int K = nextInt() - 1;
		Team[] team = new Team[n];
		for (int i = 0; i < n; i++) 
			team[i] = new Team(nextInt(), nextInt());
		
		Arrays.sort(team);
		int ans = -1;
		int pre = 0;
		for (int i = 1; i < n; i++)
			if (team[i].compareTo(team[i - 1]) != 0) {
				if (K >= pre && K < i) {
					ans = i - pre;
					break;
				}
				pre = i;
			}
		if (ans == -1) ans = n - pre;
		writer.println(ans);
	}

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

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	public void run() {
		try {
			long tbegin = System.currentTimeMillis();
			reader = new BufferedReader(new InputStreamReader(System.in));
			//reader = new BufferedReader(new InputStreamReader(new FileInputStream("test.inp")));
			tokenizer = null;
			writer = new PrintWriter(System.out);
			//writer = new PrintWriter(new FileOutputStream("test.out"));
			solve();
			//reader.close();
			//System.out.println(System.currentTimeMillis() - tbegin + "ms");
			writer.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

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

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

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

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

}
 Complexity:
targets: nlogn
inputs: import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class A {

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

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) a[i] = file.nextInt();
		Arrays.sort(a);
		boolean[] used = new boolean[n];
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (!used[i]) {
				count++;
				for (int j = i; j < n; j++) {
					if (a[j] % a[i] == 0) {
						used[j] = true;
					}
				}
			}
		}
		System.out.println(count);
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public... 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 A558 {
  static BufferedReader in = null;
  static PrintWriter out = null;
  static StringTokenizer st = new StringTokenizer("");

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

  public static String readString() {
    while (!st.hasMoreTokens()) {
      try {
        st = new StringTokenizer(in.readLine(), " \n\r\t:");
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return st.nextToken();
  }


  public static int readInt() {
    return Integer.parseInt(readString());
  }

  public static long readLong() {
    return Long.parseLong(readString());
  }

  private static int MAX_VALUE = Integer.MAX_VALUE - 10000000;
  private static int[] dp;
  private static int[] parents;
  private static int[] powers;
  private static int[] x;
  private static int[] y;
  private static int[][] dist;
  private static int[] distFrom0;

  private static void solve() throws IOException {
    int x0 = readInt();
    int y0 = readInt();
    int n = readInt();
    long time = System.currentTimeMillis();
    x = new int[n];
    y = new int[n];
    for (int i = 0; i < n; i++) {
      x[i] = readInt() - x0;
      y[i] = readInt() - y0;
    }
    dist = new int[n][n];
    distFrom0 = new int[n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        dist[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
      }
    }
    for (int i = 0; i < n; i++) {
      distFrom0[i] = x[i] * x[i] + y[i] * y[i];
    }
    powers = new int[n + 1];
    powers[0] = 1;
    for (int i = 1; i < n + 1; i++) {
      powers[i] = powers[i - 1] * 2;
    }
    int maxMask = 1 << n;
    dp = new int[maxMask];
    parents = new int[maxMask];
    Arrays.fill(dp, MAX_VALUE);
    dp[0] = 0;
    for (int i = 0; i < maxMask; i++) {
     ... What is the time complexity of the previous code?
targets: np
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;
import java.util.*;

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int t=Integer.parseInt(bu.readLine());
        while(t-->0)
        {
            int n=Integer.parseInt(bu.readLine());
            int cur[]=new int[n],i,cr=-1;
            for(i=0;i<n;i++)
            {
                int j,d=Integer.parseInt(bu.readLine()),f=-1;
                for(j=cr;j>=0;j--)
                if(cur[j]==d-1) {f=j; break;}

                if(f==-1)
                {
                    cr++;
                    f=cr;
                }
                cur[f]=d;
                cr=f;
                for(j=f+1;j<n;j++) cur[j]=0;
                sb.append(cur[0]);
                for(j=1;j<n;j++)
                if(cur[j]==0) break;
                else sb.append("."+cur[j]);
                sb.append("\n");
            }
        }
        System.out.print(sb);
    }
}
 Complexity:
targets: cubic
inputs: import com.sun.java_cup.internal.runtime.virtual_parse_stack;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by ali on 2/3/14.
 */
public class D
{
	public static void main(String [] args)
	{
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int m = in.nextInt();

		boolean [][] graph = new boolean[n][n];
		for(int i = 0 ; i < m ; i++)
		{
			int a = in.nextInt() - 1;
			int b = in.nextInt() - 1;

			graph[a][b] = true;
		}

		int res = Integer.MAX_VALUE;
		for(int center = 0 ; center < n ; center++)
		{
			int calc = 0;
			for(int i = 0 ; i < n ; i++)
			{
				if(!graph[center][i])
					calc++;
				if(!graph[i][center])
					calc++;
			}

			if(!graph[center][center])
				calc--;

			int [] match = new int[n];
			Arrays.fill(match, -1);
			int max = 0;

			for(int i = 0 ; i < n ; i++)
				if(i != center)
					if(can(i, graph, new boolean[n], center, match))
						max++;

			int unusable = m - (2*n - 1 - calc) - max;
			calc += unusable;
			calc += (2*(n-1) - 2*max)/2;

			res = Math.min(res, calc);
		}

		System.out.println(res);


	}

	private static boolean can(int at, boolean[][] graph, boolean[] visited, int center, int [] match)
	{
		if(visited[at])
			return false;
		visited[at] = true;

		for(int to = 0 ; to < graph.length ; to++)
			if(graph[at][to])
				if(to != center)
					if(match[to] == -1 || can(match[to], graph, visited, center, match))
					{
						match[to] = at;
						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: cubic
inputs: // Author: aman_robotics

//package math_codet;

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

public class lets_do {
    FastReader in;
    PrintWriter out;
    Helper_class h;
    final long mod = 1000000009;
    final int MAXN = 1000005;
    final int lgN = 20;
    final long INF = (long)1e18;
    final long MAX_Ai = (long)1e12;
    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new FastReader(System.in);
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t = 1;
        while(t--> 0)
            solve();
        out.flush();
        out.close();
    }
    void solve(){
        int n = h.ni();
        long[] arr = new long[n];
        int i = 0, j = 0;
        for(i = 0; i < n; i++)
            arr[i] = h.nl();
        HashMap<Long, Integer> hmap = new HashMap<Long, Integer>();
        int cnt = 0;
        for(i = 0; i < n; i++){
            long sum = 0;
            for(j = i; j < n; j++){
                sum += arr[j];
                Integer x = hmap.get(sum);
                if(x == null)
                    hmap.put(sum, cnt++);
            }
        }
        TreeSet<Pair>[] tset = new TreeSet[cnt];
        for(i = 0; i < cnt; i++)
            tset[i] = new TreeSet<Pair>(com);
        for(i = 0; i < n; i++){
            long sum = 0;
            for(j = i; j < n; j++){
                sum += arr[j];
                tset[hmap.get(sum)].add(new Pair(i, j));
            }
        }
        int max = 0;
        int ind = -1;
        int max_x = 0, max_y = 0;
        for(i = 0; i < cnt; i++){
        	int curr_y = tset[i].first().y;
        	int cnt1 = 1;
            for(Pair yo : tset[i]){
                if(yo.x > curr_y) {
                	cnt1++;
                	curr_y = yo.y;
                }
            }
            if(max < cnt1) {
            	max = cnt1;
            	ind = i;
            }
        }
        h.pn(max);
        Pair hola_yee = new... What is the time complexity of the previous code?
targets: quadratic
inputs: import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

    static Map<BigInteger, BigInteger> mp = new HashMap<BigInteger, BigInteger>();

    public static void main(String[] args) {
        mp.clear();
        Scanner cin = new Scanner(new BufferedInputStream(System.in));
        BigInteger n = cin.nextBigInteger();
        BigInteger x = cin.nextBigInteger();
        mp.put(x, BigInteger.ONE);
        BigInteger sum = x;
        BigInteger ans = BigInteger.ZERO;
        for (int i = 2;i <= n.intValue(); i++) {
            x=cin.nextBigInteger();
            BigInteger tmp = x.multiply(BigInteger.valueOf(i-1)).subtract(sum);
            if (mp.containsKey(x.subtract(BigInteger.ONE))) tmp = tmp.subtract(mp.get(x.subtract(BigInteger.ONE)));
            if (mp.containsKey(x.add(BigInteger.ONE))) tmp = tmp.add(mp.get(x.add(BigInteger.ONE)));
            ans = ans.add(tmp);
            sum = sum.add(x);
            BigInteger xx;
            if (mp.containsKey(x)) xx = mp.get(x);
            else xx = BigInteger.ZERO;
            mp.put(x, xx.add(BigInteger.ONE));
        }
        System.out.println(ans);
    }
}
 What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.*;
import java.util.*;

public class Main {
//	static Scanner in;
	static PrintWriter out;
	static BufferedReader in;

	public static void main(String[] args) throws Exception {
//		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		in = new BufferedReader(new InputStreamReader(System.in));
		
		int n = new Integer(in.readLine());

		for (int i = 0; i < n; i++) {
			String s = in.readLine();
			int x = 0;
			while (s.charAt(x) - 'A' >= 0 && s.charAt(x) - 'Z' <= 0) x++;
			int y = s.length() - 1;
			while (s.charAt(y) - '0' >= 0 && s.charAt(y) - '9' <= 0) y--;

			if (x > y) {
				int k = 1;
				int a = 1;
				for (int j = 1; j < x; j++) {
					k *= 26;
					a += k;
				}
				for (int j = 0; j < x; j++) {
					a += k*(s.charAt(j) - 'A');
					k /= 26;
				}
				int b = Integer.parseInt(s.substring(x));
				out.println("R" + b + "C" + a);
			} else {
				while (s.charAt(x) - '0' >= 0 && s.charAt(x) - '9' <= 0) x++;
				int b = Integer.parseInt(s.substring(1, x));
				int a = Integer.parseInt(s.substring(x + 1));
				int num = 0;
				int k = 1;
				while (a >= k) {
					a -= k;
					k *= 26;
				}
				k /= 26;
				while (k > 0) {	
					out.print((char)('A' + (a/k)));
					a %= k;
					k /= 26;
				}
				out.println(b);
			}
		}
		out.close();
	}
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.math.BigInteger;
import java.io.InputStream;

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

class TaskA {
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int count = in.readInt();
		int[] array = IOUtils.readIntArray(in, count);
		int[] sorted = array.clone();
		ArrayUtils.sort(sorted, IntComparator.DEFAULT);
		int differs = 0;
		for (int i = 0; i < count; i++) {
			if (array[i] != sorted[i])
				differs++;
		}
		if (differs <= 2)
			out.printLine("YES");
		else
			out.printLine("NO");
	}
}

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 int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while... Complexity:
targets: nlogn
inputs: import java.util.Scanner;

public class B {
    static int n;
    static double A;
    static int[] L;
    static int[] B;
    static double max = 0;

    public static void rec(int index, int k) {
        if (k < 0)
            return;
        if (index == n) {
            double prob = 0;
            for (int i = 0; i < (1 << n); i++) {
                double b = 0;
                double temp = 1.0;
                for (int j = 0; j < n; j++) {
                    if (L[j] > 100)
                        return;
                    if ((i & (1 << j)) == 0) {
                        b += B[j];
                        temp *= (100 - L[j]) / 100.0;
                    } else
                        temp *= L[j] / 100.0;
                }
                if (Integer.bitCount(i) * 2 <= n)
                    temp *= A / (A + b);
                prob += temp;

            }
            max = Math.max(max, prob);
            return;
        }
        L[index] += 10;
        rec(index, k - 1);
        L[index] -= 10;
        rec(index + 1, k);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int k = in.nextInt();
        A = in.nextDouble();
        B = new int[n];
        L = new int[n];
        for (int i = 0; i < n; i++) {
            B[i] = in.nextInt();
            L[i] = in.nextInt();
        }
        rec(0, k);
        System.out.println(max);
    }
}
 What is the time complexity of the previous code?
targets: np
inputs: import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.security.SecureRandom;

public class WCS {
	
	public static class Vector implements Comparable <Vector>  {
		long x, y;
		int position;
		Vector first, second;
		boolean toReverse;
		
		public Vector(long xx, long yy, int p) {
			x = xx;
			y = yy;
			position = p;
			first = null;
			second = null;
			toReverse = false;
		}
		
		public Vector negate() {
			Vector vv = new Vector(-x, -y, position);
			vv.first = first;
			vv.second = second;
			vv.toReverse = !toReverse;
			return vv;
		}
		
		public Vector add(Vector v) {
			Vector sum = new Vector(this.x + v.x, this.y + v.y, position);
			sum.first = this;
			sum.second = v;
			return sum;
		}
		
		public Vector subtract(Vector v) {
			return this.add(v.negate());
		}
		
		public double euclideanNorm() {
			return Math.sqrt(x * x + y * y);
		}
		
		@Override
		public int compareTo(Vector v) {
			double thisa = Math.atan2(this.y, this.x);
			double va = Math.atan2(v.y, v.x);
			if(thisa < 0)
				thisa += 2 * Math.PI;
			if(va < 0)
				va += 2 * Math.PI;
			if(thisa < va)
				return -1;
			if(thisa > va)
				return 1;
			return Integer.compare(this.position, v.position);
		}
		
		@Override
		public String toString() {
			return x + " " + y;
		}
	}
	
	public static void dfs(Vector curr, int[] ans) {
		if(curr.first == null) {
			ans[curr.position] = curr.toReverse ? -1 : 1;
			return;
		}
		curr.first.toReverse ^= curr.toReverse;
		curr.second.toReverse ^= curr.toReverse;
		dfs(curr.first, ans);
		dfs(curr.second, ans);
	}
	
	public static boolean ok(Vector v1, Vector v2) {
		return v1.add(v2).euclideanNorm() <= Math.max(v1.euclideanNorm(), v2.euclideanNorm());
	}
	
	public static void stop(long k) {
		long time = System.currentTimeMillis();
		while(System.currentTimeMillis() - time < k);
	}
	
	public static void main(String[] args) throws IOException {
		int n = in.nextInt();
		TreeSet <Vector> vectors = new TreeSet <>... 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.BufferedInputStream;
import java.io.PrintStream;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(new BufferedInputStream(System.in));
		PrintStream out=System.out;
		int n=in.nextInt();
		if (n>=0) out.println(n);
		else out.println(Math.max(-((-n)/10), -((-n)/100*10+(-n)%10)));
		out.close();
		in.close();
	}
}
 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.math.*;
public class codeforces {
	 public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] data=new int[n];
		for(int i=0;i<n;i++)
			data[i]=sc.nextInt();
		Arrays.sort(data);
		if(data[n-1]!=1)
			data[n-1]=1;
		else
			data[n-1]=2;
		Arrays.sort(data);
		for(int i=0;i<n;i++)
		{
			System.out.print(data[i]);
			if(i!=n-1)
				System.out.print(" ");
		}
			
		
		return;
	}

}
 What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.math.*;
public class Main6{

static class Pair
	{ 
		int x;
		int y;
		int z;
		public Pair(int x,int y,int z) 
		{	 
			this.x= x; 
			this.y= y;
			this.z=z;
		}	 
		
	@Override
			public int hashCode() 
			{ 
				final int temp = 14; 
				int ans = 1; 
				ans =x*31+y*13; 
				return ans; 
			} 
	  
			// Equal objects must produce the same 
			// hash code as long as they are equal 
		@Override
		public boolean equals(Object o) 
		{ 
			if (this == o) { 
				return true; 
			} 
			if (o == null) { 
				return false; 
			} 
			if (this.getClass() != o.getClass()) { 
				return false; 
			} 
			Pair other = (Pair)o; 
			if (this.x != other.x || this.y!=other.y) { 
				return false; 
			} 
			return true; 
		} 
			
	} 
	static class Pair1
	{
		String x;
		int y;
		int z;
		
	}
	static class Compare
	{ 
		static void compare(Pair arr[], int n) 
		{ 
			// Comparator to sort the pair according to second element 
		/*	Arrays.sort(arr, new Comparator<Pair>() { 
				@Override public int compare(Pair p1, Pair p2) 
				{ 
					if(p1.start>p2.start)
					{
						return 1;
					}
					else if(p1.start==p2.start)
					{
						return 0;
					}
					else
					{
						return -1;
					}
				} 
			}); */
		}
		
	}
	
	
	public static long pow(long a, long b)
	{
		long result=1;
		while(b>0)
		{
			if (b % 2 != 0)
			{
				result=(result*a)%998244353;
				b--;
			} 
			a=(a*a)%998244353;
			b /= 2;
		}   
		return result;
	}
	public static long fact(long num)
	{
				long value=1;
				int i=0;
				for(i=2;i<num;i++)
				{
					value=((value%mod)*i%mod)%mod;
				}
				return value;
			}
			public static int gcd(int a, int b)
			{
				if (a == 0)
					return b;
				return gcd(b%a, a);
			}
			
	/*		public static... What is the time complexity of the previous code?
targets: quadratic
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

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

    static class BSportMafia {
        int MAXN = 200005;
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            long n = nl();
            long k = nl();
            long i = 0;
            k += n;
            for (i = 0; i < MAXN; i++) {
                long x = (i * (i + 3)) / 2;
                if (k == x) {
                    pn(n - i);
                    return;
                }
            }

        }

        long nl() {
            return in.nextLong();
        }

        void pn(long zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

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

        public int read() {
            if (numChars == -1) {
                throw new UnknownError();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0) {
                    return -1;
... 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: /* 
 * UMANG PANCHAL
 * DAIICT
 */
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
 
	static LinkedList<Integer> adj[];
	static ArrayList<Integer> adj1[];
	static int[] color,visited1;
	static boolean b[],visited[],possible;
	static int level[];
	static Map<Integer,HashSet<Integer>> s;
	static int totalnodes,colored;
	static int count[];
	static long sum[];
	static int nodes;
	static double ans=0;
	static long[] as=new long[10001];
	static long c1=0,c2=0;
	static int[] a,d,k;
	static int max=100000000;
	static long MOD = (long)1e9 + 7,sm=0,m=Long.MIN_VALUE;
	static boolean[] prime=new boolean[1000005];
	static int[] levl;
    static int[] eat;
    static int price[];
    static int size[],res[],par[];
    static int result=0;
	// --------------------My Code Starts Here----------------------
	
	public static void main(String[] args) throws IOException
	{
		in=new InputReader(System.in);
		w=new PrintWriter(System.out);
		 int n=ni();
		 int[] a=na(n);
		 int ans=0;
		 for(int i=0;i<n;i++)
		 {
			 for(int j=i+1;j<n;j++)
			 {
				 if(a[j]<a[i])
					 ans++;
			 }
		 }
		 int m=ni();
		 ans=ans%2;
		 while(m-->0)
		 {
			 int l=ni(),r=ni();
			 int range=r-l+1;
			 range=range*(range-1)/2;
			 range=range%2;
			 ans=(ans+range)%2;
			 if(ans==1)
				 w.println("odd");
			 else
				 w.println("even");
		 }
       w.close();
    }
	
	
	
	public static long nCrModp(long n, long r, long p)
	{
	    
	    long[] C=new long[(int)r+1];
	    
	 
	    C[0] = 1; 
	    
	    for (long i = 1; i <= n; i++)
	    {
	        
	        for (long j = Math.min(i, r); j > 0; j--)
	 
	            
	            C[(int)j] = (C[(int)j] + C[(int)(j-1)])%p;
	    }
	    return C[(int)r];
	}
	public static long nCr(long n, long r)
	{
		long x=1;
		for(long i=n;i>=n-r+1;i--)
			x=((x)*(i));
		for(long i=r;i>=1;i--)
			x=((x)/(i));
		
		return x%MOD;
	}
	public static long nCrModpDP(long n, long r, long p)
	{
	
	    long[] C=new long[(int)r+1];
	 
	    C[0] = 1; 
	 
	 
	    for (long i = 1; i <= n;... What is the time complexity of the previous code?
targets: quadratic
inputs: import java.text.DecimalFormat;
import java.util.Scanner;

/**
 *
 * @author Alvaro
 */
public class Main{
    public static int n;
    public static double [] dp;
    public static double [][] p;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        dp = new double[1<<n];
        p = new double[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                p[i][j]= in.nextDouble();                
            }
        }
        for (int i = 0; i <(1<<n); i++) {
            dp[i] = -1;            
        }
        dp[(1<<n)-1]=1;
        DecimalFormat d = new DecimalFormat("0.000000");
        System.out.print(d.format(f(1<<0)));
        for (int i = 1; i < n; i++) {
            System.out.print(" "+d.format(f(1<<i)));
        }
    }
    
    public static double f(int mask) {
        if(dp[mask]>-0.5) return dp[mask];
        dp[mask] = 0;
        int vivos = 1;
        for (int i = 0; i < n; i++) 
            if((mask>>i)%2==1) vivos++;
        double pares = (vivos*(vivos-1))/2;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if((mask&(1<<i))!=0&&(mask&(1<<j))==0){
                    dp[mask]+=f(mask|(1<<j))*p[i][j]/pares;
                }
            }
            
        }
        return dp[mask];
                
    }
       
}
 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: /**
* @author: Prasad Chaudhari
* @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
* @git: https://github.com/Prasad-Chaudhari
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;

public class Main {

    public static void main(String[] args) throws Exception {
        FastIO in = new FastIO(args);
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            LinkedList<Integer> l = new LinkedList<>();
            ArrayList<LinkedList<Integer>> al = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                int p = in.ni();
                if (p == 1) {
                    l.addFirst(1);
                } else {
                    while (true) {
                        if (l.peekFirst() == p - 1) {
                            l.addFirst(l.removeFirst() + 1);
                            break;
                        } else {
                            l.removeFirst();
                        }
                    }
                }
                al.add(new LinkedList<>(l));
            }
            for (LinkedList<Integer> ll : al) {
                while (ll.size() > 1) {
                    System.out.print(ll.removeLast() + ".");
                }
                System.out.println(ll.remove());
            }
            System.out.println();
        }
        in.bw.flush();
    }

    static boolean willbealive(int i, int a[]) {
        if (i < 0 || i >= a.length)
            return false;
        if (a.length == 1)
            return false;
        if (a[i] == 1)
            return false;
        if (i == 0)
            return a[1] == 1;
        else if (i == a.length - 1)
            return a[i - 1] == 1;
        else
            return (a[i - 1] == 1) ^ (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: cubic
inputs: import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

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

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

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

                for (int rot = 0; rot < n; ++rot) {
                    long[] temp = new long[1 << n];
                    System.arraycopy(dp, 0, temp, 0, dp.length);
                    for (int i = 0, pos = rot; i < n; ++i, ++pos) {
                        if (pos >= n)... What is the time complexity of the previous code?
targets: np
inputs: import java.util.*;
import java.io.*;

public class RGBSubstring {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int Q = scanner.nextInt();
        while(Q-->0) {
            int N = scanner.nextInt();
            int K = scanner.nextInt();
            String s1 = "RGB";
            String s2 = "GBR";
            String s3 = "BRG";
            char[] arr = scanner.next().toCharArray();
            int[] cnts = new int[3];
            for(int i = 0; i < K; i++) {
                int ind = i % 3;
                if (arr[i] != s1.charAt(ind)) cnts[0]++;
                if (arr[i] != s2.charAt(ind)) cnts[1]++;
                if (arr[i] != s3.charAt(ind)) cnts[2]++;
            }
            int ans = Math.min(Math.min(cnts[0], cnts[1]), cnts[2]);
            for(int i = K; i < N; i++) {
                int ind = (K-1)%3;
                int[] nextCnts = new int[3];
                nextCnts[1] = cnts[0];
                nextCnts[2] = cnts[1];
                nextCnts[0] = cnts[2];
                if ('R' != arr[i-K]) nextCnts[1]--;
                if ('G' != arr[i-K]) nextCnts[2]--;
                if ('B' != arr[i-K]) nextCnts[0]--;
                if (arr[i] != s1.charAt(ind)) nextCnts[0]++;
                if (arr[i] != s2.charAt(ind)) nextCnts[1]++;
                if (arr[i] != s3.charAt(ind)) nextCnts[2]++;
                cnts = nextCnts;
                for(int j = 0; j < 3; j++) ans = Math.min(ans, cnts[j]);
            }
            out.println(ans);
        }
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
  ... 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.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Scanner;
import java.util.Vector;

public class Main {
	
	private static final int SIM = 1;
	private static final int NAO = 2;
	
	public static void main(String[] args) {

		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		
		int n = in.nextInt();
		int m = in.nextInt();
		int[][] a = new int[n][m];
		int[][] graphVerticial = null;
		int[][] graphDiagonal = null;
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				a[i][j] = in.nextInt();
			}
		}
		
		graphVerticial = createGraphVertical(n, m, a);
		graphDiagonal = createGraphDiagonal(n, m, a);
		
//		print(graphVerticial);
//		System.out.println("##########################");
//		print(graphDiagonal);
		
		int result = 0;
		int k = 1;
		int piso = 0;
		int teto = 1000000000;
		
		while(true) {
			
			k = (int) Math.ceil((teto - piso) / 2.0) + piso;
			
			if(isOk(n, k, graphVerticial, graphDiagonal)) {
				result = Math.max(result, k);
				piso = k;
			}
			else{
				teto = k - 1;
			}

			//System.out.println(piso + ", " + teto);
			
			if(teto <= piso) break;
			
		}
		
		System.out.println(result);
		
	}
	
	public static int[][] createGraphVertical(int n, int m, int[][] a){
		
		int[][] graph = new int[n][n];
		
		for(int i = 0; i < n; i++) {
			
			for(int j = 0; j  < n; j++) {
				
				if(i == j) continue;
				if(i > j) {graph[i][j] = graph[j][i]; continue;}
				
				graph[i][j] = Integer.MAX_VALUE;
				
				for(int k = 0; k < m; k++) {
					graph[i][j] = Math.min(graph[i][j], Math.abs(a[i][k] - a[j][k]));
				}
			}
		}
		
		return graph;
	}
	
	public static int[][] createGraphDiagonal(int n, int m, int[][] a){
		
		int[][] graph = new int[n][n];
		
		for(int i = 0; i < n; i++) {
			
			for(int j = 0; j  < n; j++) {
				
				graph[i][j] = Integer.MAX_VALUE;
				
				for(int k = 0; k < m - 1; k++) {
					graph[i][j] = Math.min(graph[i][j], Math.abs(a[j][k] - a[i][k + 1]));
				}
			}
		}
		
		return... What is the time complexity of the previous code?
targets: np
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        //System.setIn(new FileInputStream("1"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        solve();

        in.close();
        out.close();
    }

    private static void solve() throws Exception {
        int n = nextInt();
        boolean[] use = new boolean[500];
        ArrayList<Integer> a = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            int v = nextInt();
            if (!use[250 + v]) {
                use[250 + v] = true;
                a.add(v);
            }
        }
        Collections.sort(a);
        if (a.size() < 2) {
            out.println("NO");
        } else {
            out.println(a.get(1));
        }
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer st;

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

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

    static double nextDouble() throws IOException {
        return Double.parseDouble(nextString());
    }
}
 Complexity:
targets: nlogn
inputs: import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub
		Scanner read = new Scanner(new FileInputStream(new File("input.txt")));
		PrintWriter out = new PrintWriter(new File("output.txt"));
		int n = read.nextInt(), m = read.nextInt(), k = read.nextInt(), tree[][] = new int[n][m], a[] = new int[k],
				b[] = new int[k], x = 0, y = 0, max = -1, d = 0;

		for (int i = 0; i < k; i++) {
			a[i] = read.nextInt() - 1;
			b[i] = read.nextInt() - 1;	
			tree[a[i]][b[i]] = 0;
		}
		for(int i = 0; i < n; i++){
			Arrays.fill(tree[i], Integer.MAX_VALUE);
		}
		for (int o = 0; o < k; o++) {
			for(int i = 0; i < n; i++){
				for(int j = 0; j < m; j++){
					d = Math.abs(a[o] - i) + Math.abs(b[o] - j);
					if(d < tree[i][j])
						tree[i][j] = d;
				}
			}
		}
		for(int i = 0; i<n; i++){
			for(int j = 0; j < m ; j ++){
				if(tree[i][j] > max){
					max=  tree[i][j];
					x=  i;
					y = j;
				}
			}
		}
		out.println(x + 1 + " " + (y + 1));
		out.close();
	}

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

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int arr[] = {4,7,47,74,447,474,477,744,747,774};
        int i=0, x = in.nextInt();
        while (i<arr.length)
        if (x%arr[i++] == 0)
        {
             System.out.print("YES");
             return;
        }
        System.out.print("NO");
    }
}
 What is the time complexity of the previous code?
targets: constant
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class C {
	public static void main(String[] args) throws IOException {
		FastScanner in= new FastScanner(System.in);
		PrintWriter out= new PrintWriter(System.out);
		
		int n= in.nextInt();
		int r= in.nextInt();
		int [] x= new int[n];
		for (int i = 0; i < x.length; i++) {
			x[i]= in.nextInt();
		}
		double [] res= new double[n];
		res[0]= r;
		for (int i = 1; i < x.length; i++) {
			boolean found = false;
			for (int j = 0; j < i; j++) {
				double dis= Math.abs(x[i]-x[j]);
				double rr= 4.0*r*r-1.0*dis*dis;
				if(rr>=0) {
					double del= Math.sqrt(rr);
					res[i]= Math.max(res[i], res[j]+del);
					found= true;
				}
			}
			if(!found) {
				res[i]= r;
			}
		}
		for (int i = 0; i < res.length; i++) {
			out.print(res[i]+" ");
		}
		out.close();
		
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}
 Complexity:
targets: quadratic
inputs: import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
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
 */
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 {
        public int mod = 1000000007;
        public int MAXN = 333;
        public int[][] w1;
        public long[] fact;
        public long[] ifact;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long[][] e = Factorials.getFIF(MAXN, mod);
            fact = e[0];
            ifact = e[1];
            w1 = new int[MAXN][MAXN];
            w1[0][0] = 1;
            for (int i = 1; i < MAXN; i++) {
                for (int j = 1; j < MAXN; j++) {
                    for (int k = 1; k <= i; k++) {
                        w1[i][j] += w1[i - k][j - 1];
                        if (w1[i][j] >= mod) w1[i][j] -= mod;
                    }
                }
            }

            int n = in.nextInt();
            int[] arr = in.readIntArray(n);
            boolean[] marked = new boolean[n];
            int[] fs = new int[n];
            int fidx = 0;
            for (int i = 0; i < n; i++) {
                if (marked[i]) continue;
                int count = 0;
                for (int j = 0; j < n; j++) {
                    if (isSquare(1L * arr[i] * arr[j])) {
                        if (marked[j]) System.exit(1);
                        marked[j] = true;
     ... 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.util.*;

// VK Cup 2012 Round2 Unofficial Div2 Edition
public class Main {
	
	void A(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int[] h = new int[n];
		for(int i=0; i<n; i++){
			h[i] = sc.nextInt();
		}
		Arrays.sort(h);
		System.out.println(h[b]-h[b-1]);
	}
	
	public static void main(String[] args) {
		new Main().A();
	}
}
 Complexity:
targets: nlogn
inputs: import java.io.*;
import java.util.*;


public class A {
    public static void main(String[] args) throws Exception {
        new A().solve();
    }
    void solve() throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(in.readLine());
        if (n == 0) {
            System.out.println("0 0 0");
            return;
        }
        int p2 = 0;
        int p1 = 1;
        while (true) {
            int now = p2 + p1;
            if (n == now) {
                System.out.println("0 " + p1 + " " + p2);
                return;
            } else {
                p2 = p1;
                p1 = now;
            }
        }
    }
}
 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.*;
import java.util.StringTokenizer;


public class Main {
    static int[] a;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        a = sc.nextIntArray(n);
        long inversions = divide(0, n - 1);
//        out.println(inversions);
//        System.err.println(Arrays.toString(a));
        if (n == 5) out.println("Petr");
        else {
            if (n % 2 == 0) out.println(inversions % 2 == 0 ? "Petr" : "Um_nik");
            else out.println(inversions % 2 != 0 ? "Petr" : "Um_nik");
        }
        out.flush();
        out.close();
    }

    static long divide(int b, int e) {
        if (b == e) return 0;
        long cnt = 0;
        int mid = b + e >> 1;
        cnt += divide(b, mid);
        cnt += divide(mid + 1, e);
        cnt += merge(b, mid, e);
        return cnt;
    }

    static long merge(int b, int mid, int e) {
        long cnt = 0;
        int len = e - b + 1;
        int[] tmp = new int[len];
        int i = b, j = mid + 1;
        for (int k = 0; k < len; k++) {
            if (i == mid + 1 || (j != e + 1 && a[i] > a[j])) {
                tmp[k] = a[j++];
                cnt += (mid + 1 - i);
            } else tmp[k] = a[i++];
        }
        for (int k = 0; k < len; k++)
            a[b + k] = tmp[k];
        return cnt;
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }


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

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
     ... Complexity:
targets: nlogn