Muennighoff/xP3x-sample huggingface dataset:
inputs: import java.util.*;
public class C {
	
	public static void main(String[] args) {
		Scanner qwe = new Scanner(System.in);
		int n = qwe.nextInt();
		double r = qwe.nextDouble();
		
		double[] fy = new double[n];
		Arrays.fill(fy, r);
		
		double[] xs = new double[n];
		for (int i = 0; i < xs.length; i++) {
			xs[i] = qwe.nextDouble();
		}
		
		for(int i =0; i < n; i++){
			
			for(int j = i+1; j < n; j++){
				double dx = xs[j]-xs[i];
				if(Math.abs(dx) > 2*r) continue;
				fy[j] = Math.max(fy[j], Math.sqrt(4*r*r-dx*dx)+fy[i]);
			}
			
		}
		
		StringBuilder stb = new StringBuilder();
		for (int i = 0; i < xs.length; i++) {
			stb.append(fy[i]+" ");
		}
		System.out.println(stb);
	}

}
 What is the time complexity of the previous code?
targets: quadratic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 
import java.util.Scanner;


public class A {
    public static void main(String[] args) {
       
        Scanner in = new Scanner(System.in);
        
        long l = in.nextLong();
        long r = in.nextLong();
        
        if(r-l < 2 ){
            System.out.println("-1");
        }
        
        else if(r-l == 2 && l %2 ==1){
            System.out.println("-1");
        }
        else{
            
            
            if(l%2 == 0){
                System.out.println(l+ " "+(l+1)+" "+(l+2));
                
            }
            else{
                System.out.println((l+1)+ " "+(l+2)+" "+(l+3));
            }
        }
            
        }
    }
 Complexity:
targets: constant
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
import java.io.*;

public class p3sol{

	static char[] c;
	static int[][] dp;
	static int mod = (int)1e9 + 7;

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

		for(int i = 0; i < n; i++)
			c[i] = br.readLine().charAt(0);

		dp = new int[n + 1][n + 1];

		dp[0][0] = 1;

		for(int i = 0; i < n - 1; i++){
			if(c[i] == 's'){
				int prev = 0;
				for(int j = i; j >= 0; j--){
					prev += dp[i][j];
					prev %= mod;
					dp[i + 1][j] += prev;
					dp[i + 1][j] %= mod;
				}
			}
			else{
				for(int j = 1; j <= n; j++){
					dp[i + 1][j] += dp[i][j - 1];
					dp[i + 1][j] %= mod;
				}
			}
		}

		int ans = 0;
		for(int i = 0; i < n; i++){
			ans += dp[n - 1][i];
			ans %= mod;
		}

		// print(dp);

		System.out.println(ans);
		
		br.close();
	}

	public static void print(int[][] a){
		for(int i = 0; i < a.length; i++){
			for(int j = 0; j < a[0].length; j++)
				System.out.print(a[i][j] + " ");
			System.out.println("");
		}
	}

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

import static java.lang.Math.*;


public class Main {
    FastScanner in;
    PrintWriter out;

    static final String FILE = "";

    public void solve() {
        out.print(25);
    }

    public void run() {
        if (FILE.equals("")) {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
        } else {
            try {
                in = new FastScanner(new FileInputStream(FILE +
                        ".in"));
                out = new PrintWriter(new FileOutputStream(FILE +
                        ".out"));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        solve();
        out.close();
    }

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

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

        public float nextFloat() {
            return Float.parseFloat(next());
        }
    }

    class Pair<A extends Comparable<A>, B extends Comparable<B>>
 ... Complexity:
targets: constant
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 
import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	public long gcd(long a, long b) {
		long tmp;
		while (b > 0) {
			a %= b;
			tmp = a;
			a = b;
			b = tmp;
		}
		return a;
	}
	
	public void solve() throws Exception {
		long a = sc.nextLong();
		long b = sc.nextLong();
		long ans = 0;
		long k = 0;
		if (a == 1 || b == 1) {
			out.println(max(a, b));
			return;
		}
		while (a > 1 && b > 1) {
			if (a > b) {
				k = a / b;
				ans += k;
				a -= (k * b);				
			} else {
				k = b / a;
				ans += k;
				b -= (k * a);
			}
			k = gcd(a, b);
			a /= k;
			b /= k;
		}
		if (a == 1)
			ans += b;
		else
			ans += a;
		out.println(ans);
	}
	
	static Throwable throwable;
	
	BufferedReader in;
	PrintWriter out;
	FastScanner sc;
	
	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", (1 << 26));
		thread.start();
		thread.join();
		if (throwable != null) {
			throw throwable;
		}
	}
	
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable throwable) {
			this.throwable = throwable;			
		} finally {
			out.close();
		}		
	}

}

class FastScanner {
	BufferedReader reader;
	StringTokenizer strTok;
	
	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}
	
	public String nextToken() throws Exception {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}
	
	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}
	
	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}
	
	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}
}
 Complexity:
targets: constant
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.*;
import java.util.*;

public class p343a
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.println();
        long a = sc.nextLong();
        long b = sc.nextLong();
        if(a==b) System.out.println("1");
        else if(b==1) System.out.println(a);
        else if(a==1) System.out.println(b);
        else if(a>b) System.out.println(count(a,b));
        else System.out.println(count(b,a));
    }

    public static long count(long a,long b)
    {
        long count = 0;
        while(b!=1)
        {
            long c = a/b;
            count += c;
            long d = a-(c*b);
            a = b;
            b = d;
            if(b==1)
            {
                count += a;
                break;
            }
        }
        return count;
    }
} Complexity:
targets: constant
inputs: import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Watermelon {
    static int[][] ans;static int n,m;static boolean[][] vis;
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(new File("input.txt"));
//        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter("output.txt");
        int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
        Queue<Integer> pq=new ArrayDeque<>();
        boolean[] vis=new boolean[n*m];
        for(int i=0;i<k;i++){
            int r=sc.nextInt()-1,c=sc.nextInt()-1;
            pq.add(m*r+c);
            vis[m*r+c]=true;
        }
        sc.close();
        int ans=0;
        while(pq.size()!=0){
            int x=pq.remove();

            ans=x;
            if(n!=1 && x%n==0){
                if(x+m<n*m&&!vis[x+m]){
                    pq.add(x+m);
                    vis[x+m]=true;
                }
                if(x-m>=0&&!vis[x-m]){
                    pq.add(x-m);
                    vis[x-m]=true;
                }
                if(x+1<n*m&&!vis[x+1]){
                    pq.add(x+1);
                    vis[x+1]=true;
                }
            }
            else if(n!=1 && (x+1)%n==0){
                if(x+m<n*m&&!vis[x+m]){
                    pq.add(x+m);
                    vis[x+m]=true;
                }
                if(x-m>=0&&!vis[x-m]){
                    pq.add(x-m);
                    vis[x-m]=true;
                }
                if(x-1>=0&&!vis[x-1]){
                    pq.add(x-1);
                    vis[x-1]=true;
                }
            }
            else{
                if(x+m<n*m&&!vis[x+m]){
                    pq.add(x+m);
                    vis[x+m]=true;
                }
                if(x-m>=0&&!vis[x-m]){
                    pq.add(x-m);
                    vis[x-m]=true;
                }
                if(x-1>=0&&!vis[x-1]){
                    pq.add(x-1);
                    vis[x-1]=true;
                }
            ... What is the time complexity of the previous code?
targets: cubic
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
public class G {
    static int n,t;
    static int[]a;
    static int[]g;
    static long[][][]dp;
    static final long MOD=1000000007;
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        t=sc.nextInt();
        a=new int[n];
        g=new int[n];
        for(int i=0;i<n;i++) {
            a[i] = sc.nextInt();
            g[i] = sc.nextInt();
        }
        dp=new long[4][1<<(n-1)+1][t+1];
        for(int i=0;i<4;i++)
            for(int j=0;j<1<<(n-1)+1;j++)
                for(int k=0;k<=t;k++)
                    dp[i][j][k]=-1;
        System.out.println(dp(0,0,t));
    }
    private static long dp(int genre,int mask,int time){
        if(time<0)
            return 0;
        if(dp[genre][mask][time]!=-1)
            return dp[genre][mask][time];
        if(time==0)
            return 1;
        dp[genre][mask][time]=0;
        for(int i=0;i<n;i++) {
            if (g[i] != genre && ((1 << i) & mask) == 0)
                dp[genre][mask][time] = (dp[genre][mask][time]+dp(g[i], mask | (1 << i), time - a[i]))%MOD;
        }
        return dp[genre][mask][time];
    }
} Complexity:
targets: np
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CoveredPointsCount {
	
	//UPSOLVE
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
	        
		int n = Integer.parseInt(st.nextToken());
	     
		long[] myArray = new long[2 * n];
	        
			for (int i = 0; i < n; i++)  {
	        	StringTokenizer st1 = new StringTokenizer(br.readLine());
	        	myArray[2 * i] = Long.parseLong(st1.nextToken()) * 2;
	        	myArray[2 * i + 1] = Long.parseLong(st1.nextToken()) * 2 + 1;
	        }  
	        
	        Arrays.sort(myArray);
	        long[] ans = new long[n + 1];
	        int cnt = 0;
	       
	        for (int i = 0; i < 2 * n - 1; i++)   {
	            if (myArray[i] % 2 == 0) cnt++; else cnt--;
	            ans[cnt] += (myArray[i + 1] + 1) / 2 - (myArray[i] + 1) / 2;
	        }   
	        
	        StringBuilder answer = new StringBuilder();
	        
	        for (int i = 1; i < n + 1; i++) {
	        	answer.append(ans[i]);
	        	answer.append(" ");
	        }  
	        
	        System.out.println(answer);

	}

}
 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: //package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter writer = new PrintWriter(System.out);
    StringTokenizer stringTokenizer;

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

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

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

    final int MOD = 1000 * 1000 * 1000 + 7;
    int sum(int a, int b) {
        a += b;
        return a >= MOD ? a - MOD : a;
    }

    @SuppressWarnings("unchecked")
    void solve() throws IOException {
        final int n = nextInt();
        int m = nextInt();
        int[] from = new int[m];
        int[] to = new int[m];
        for(int i = 0; i < m; i++) {
            from[i] = nextInt();
            to[i] = nextInt();
        }
        int ans = solve(n, m, from, to);
        writer.println(ans);
        writer.close();
    }

    private int solve(final int n, int m, int[] from, int[] to) {
        final List<List<Integer>> g = new ArrayList<>();
        final List<List<Integer>> rg = new ArrayList<>();
        for(int i = 0; i <= n; i++) {
            g.add(new ArrayList<Integer>());
            rg.add(new ArrayList<Integer>());
        }
        int[] c = new int[n + 1];
        int[] loop = new int[n + 1];
        for(int i = 0; i < m; i++) {
            int u = from[i];
            int v = to[i];
            g.get(u).add(v);
            rg.get(v).add(u);
            c[u]++;
            c[v]++;
            if(u == v) {
                loop[u]++;
            }
        }
        class Utils {
            int[] prev = new int[n + 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.lang.*;
import java.math.BigInteger;
import java.io.*;
import java.util.*;

public class Solution implements Runnable{
    public static BufferedReader br;
    public static PrintWriter out;
    public static StringTokenizer stk;
    public static boolean isStream = true;

    public static void main(String[] args) throws IOException {
    	if (isStream) {
            br = new BufferedReader(new InputStreamReader(System.in));
        } else {
            br = new BufferedReader(new FileReader("in.txt"));
        }
        out = new PrintWriter(System.out);
        new Thread(new Solution()).start();
    }

    public void loadLine() {
        try {
            stk = new StringTokenizer(br.readLine());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

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

    public String nextWord() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return stk.nextToken();
    }

    public Integer nextInt() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Integer.valueOf(stk.nextToken());
    }

    public Long nextLong() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Long.valueOf(stk.nextToken());
    }

    public Double nextDouble() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Double.valueOf(stk.nextToken());
    }
    
    public Float nextFloat() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Float.valueOf(stk.nextToken());
    }
    
    public void run() {
    	int n = nextInt();
    	int[] arr = new int[n];
    	for (int i = 0; i < n;i++) {
    		arr[i] = nextInt();
    	}
    	Arrays.sort(arr);
    	if (arr[n-1] != 1) arr[n-1] = 1;
    	else arr[n-1] = 2;
    	Arrays.sort(arr);
    	for (int i = 0; i < n; i++) {
    		out.print(arr[i]+" ");
    	}
   ... What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Locale;
import java.io.OutputStream;
import java.util.RandomAccess;
import java.io.PrintWriter;
import java.util.AbstractList;
import java.io.Writer;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.TreeMap;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Jacob Jiang
 */
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 n = in.nextInt();
        long k = in.nextInt();
        if (k == 1) {
            out.println(n);
            return;
        }
        long[] a = in.nextLongArray(n);
        ArrayUtils.safeSort(a);
        Map<Long, Integer> map = new TreeMap<Long, Integer>();
        for (int i = 0; i < n; i++) {
            map.put(a[i], i);
        }
        int answer = 0;
        boolean[] visited = new boolean[n];
        for (int i = 0; i < n; i++) {
            if (!visited[i]) {
                visited[i] = true;
                int count = 1;
                long cur = a[i];
                while (true) {
                    cur *= k;
                    Integer index = map.get(cur);
                    if (index == null)
                        break;
                    visited[index] = true;
                    count++;
                }
                answer += NumberUtils.upDiv(count, 2);
            }
        }
        out.println(answer);
    }
}

class InputReader {

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

public class Task343A {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Scanner {

		private final BufferedReader br;
		private String[] cache;
		private int cacheIndex;

		Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
			cache = new String[0];
			cacheIndex = 0;
		}

		int nextInt() throws IOException {
			if (cacheIndex >= cache.length) {
				cache = br.readLine().split(" ");
				cacheIndex = 0;
			}
			return Integer.parseInt(cache[cacheIndex++]);
		}

		long nextLong() throws IOException {
			if (cacheIndex >= cache.length) {
				cache = br.readLine().split(" ");
				cacheIndex = 0;
			}
			return Long.parseLong(cache[cacheIndex++]);
		}

		String next() throws IOException {
			if (cacheIndex >= cache.length) {
				cache = br.readLine().split(" ");
				cacheIndex = 0;
			}
			return cache[cacheIndex++];
		}

		void close() throws IOException {
			br.close();
		}

	}

	static class Solution {

		private static long r(long a, long b) {
			if (a == 0 || b == 0) {
				return 0;
			}
			if (a > b) {
				return a / b + r(b, a % b);
			}
			return b / a + r(a, b % a);
		}

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner sc = new Scanner(is);

			long a = sc.nextLong();
			long b = sc.nextLong();

			pw.println(r(a, b));

			pw.flush();
			sc.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.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	
	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}
	
	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}
	
	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}
	
	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}
	
	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		long l = nextLong();
		long r = nextLong();

		int bit = 63;
		while(bit >= 0 && (hasBit(l, bit) == hasBit(r, bit))) {
			bit--;
		}
		System.out.println((1L<<bit+1)-1);
	}

	private boolean hasBit(long x, int i){
		return (x & (1L<<i)) > 0;
	}
		
	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
 What is the time complexity of the previous code?
targets: logn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.HashMap;

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

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            HashMap<Character, Integer> indexMap = new HashMap<>();
            for (int i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (!indexMap.containsKey(c)) {
                    indexMap.put(c, indexMap.size());
                }
            }
            int[] last = new int[indexMap.size()];
            Arrays.fill(last, -1_000_000);
            int answer = n;
            for (int i = 0; i < n; i++) {
                int index = indexMap.get(s.charAt(i));
                last[index] = i;
                int first = i;
                for (int a : last) first = Math.min(first, a);
                int visits = i - first + 1;
                answer = Math.min(answer, visits);
            }
            out.println(answer);
        }

    }
}

 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.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class CF1141F {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] split = br.readLine().split(" ");
		int[] terms = new int[n];
		int[] sums = new int[n+1];
		for(int i=0; i<n; i++) {
			terms[i] = Integer.parseInt(split[i]);
			sums[i+1] = sums[i]+terms[i];
		}
		ArrayList<Block> blocks = new ArrayList<>();
		for(int i=0; i<n; i++)
			for(int j=i; j<n; j++){
				int s = sums[j+1]-sums[i];
				blocks.add(new Block(i, j, s));
			}
		Collections.sort(blocks);
		ArrayList<Block> best = new ArrayList<>();
		int i = 0;
		while(i<blocks.size()){
			int curSum = blocks.get(i).sum;
			ArrayList<Block> curBlocks = new ArrayList<>();
			while(i<blocks.size() && blocks.get(i).sum==curSum) curBlocks.add(blocks.get(i++));
			int[] memo = new int[curBlocks.size()+1];
			Arrays.fill(memo, -1);
			memo[curBlocks.size()] = 0;
			for(int j=curBlocks.size()-1; j>=0; j--){
				int idx = Collections.binarySearch(curBlocks, new Block(curBlocks.get(j).r+1, curBlocks.get(j).r+1, curBlocks.get(j).sum));
				if(idx<0) idx = -(idx+1);
				memo[j] = Math.max(memo[j+1], 1+memo[idx]);
			}
			if(memo[0]>best.size()){
				best = new ArrayList<>();
				int idx = 0;
				while(memo[idx]>=1){
					if(memo[idx]>memo[idx+1]) best.add(curBlocks.get(idx));
					idx++;
				}
			}
		}
		StringBuilder sb = new StringBuilder();
		sb.append(best.size()).append("\n");
		for(Block b : best){
			sb.append(b.l+1).append(" ").append(b.r+1).append("\n");
		}
		System.out.print(sb);
	}
	
	static class Block implements Comparable<Block>{
		int l, r, sum;
		
		Block(int a, int b, int c){
			l = a;
			r = b;
			sum = c;
		}

		@Override
		public int compareTo(Block o) {
			if(sum==o.sum){
				if(l==o.l) return r-o.r;
				return l-o.l;
			}
			return sum-o.sum;
		}
	}
}
 Complexity:
targets: quadratic
inputs: import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.lang.*;
import static java.lang.Math.*;

public class Main implements Runnable {
    public static void main(String[] args) {
        new Thread(null, new Main(), "Check2", 1 << 28).start();// to increse stack size in java
    }
    static long mod = (long) (1e9 + 7);
    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);


        long  n = in.nextLong();
        long k = in.nextLong();
        long ans= 0;
        for (long i=1;i<=Math.min(100000,n);i++){
            long left = i;
            long right = n-i;
            long sum = left * (left + 1);
            sum /= 2;
            if (sum - right ==k){
                ans = right;
            }
        }
        w.println(ans);

        w.close();
    }
    void debug(Object...args) {
        System.out.println(Arrays.deepToString(args));
    }
    static class pair implements Comparable<pair>{

        int a;
        int b;

        pair(int a,int b){
            this.a = a;
            this.b = b;
        }
        public int compareTo(pair o){
            if(this.b != o.b)return this.b - o.b;
            return this.a - o.a;
        }

    }
    long modinv(long a,long b) {
        long p=power(b,mod-2,mod);

        p=a%mod*p%mod;
        p%=mod;

        return p;

    }
    long power(long x,long y,long mod){
        if(y==0)return 1%mod;
        if(y==1)return x%mod;
        long res=1;
        x=x%mod;
        while(y>0)
        {
            if((y%2)!=0){
                res=(res*x)%mod;
            }
            y=y/2;
            x=(x*x)%mod;
        }
        return res;
    }
    long gcd(long a,long b){

        if(b==0)return a;
        return gcd(b,a%b);
    }
    void sev(int a[],int n){

        for(int i=2;i<=n;i++)a[i]=i;
        for(int i=2;i<=n;i++){

            if(a[i]!=0){
                for(int j=2*i;j<=n;){

                    a[j]=0;
                    j=j+i;
           ... What is the time complexity of the previous code?
targets: logn
inputs: import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.IOException;
import java.util.StringTokenizer;
/*
 * @author Tnascimento 
 */

public class MaeDosDragoes {
	public static PrintWriter saida = new PrintWriter(System.out, false);
	public static class Escanear {
        BufferedReader reader;
        StringTokenizer tokenizer;
		public Escanear() {
            this(new InputStreamReader(System.in));
        }
		public Escanear(Reader in) {
            reader = new BufferedReader(in);
        }
        String proximo() {
            if (tokenizer == null || !tokenizer.hasMoreElements()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(proximo());
        }
    }



    public static void main(String[] args) {
		Escanear fastScanner = new Escanear();
        int proximoInt = fastScanner.nextInt();
        double proximoDouble = fastScanner.nextInt();
        long[] graph = new long[proximoInt];
        for(Integer i = 0; i < proximoInt; i++) {
            for(Integer j =0; j < proximoInt; j++) {
                Integer val = fastScanner.nextInt();
                if (val.equals(1) || i.equals(j)) {
				 graph[i] |= 1L << j;
				}
            }
        }

        int szLeft = proximoInt/2;
        int szRight = proximoInt - szLeft;

        int[] dp = new int[1 << szLeft];
        int maxMask = 1 << szLeft;

        for(int mask = 1; mask <maxMask; mask++) {
            int curMask = mask;

            for(int j = 0; j < szLeft; j++) {
                if (((1 << j) & mask) > 0) {
                    curMask &= graph[j + szRight] >> szRight;
                    dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);
                }
            }
            if... 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.*;
import java.util.*;
import java.util.stream.*;

public class ProblemF {
    private static boolean debug = false;

    private static int N;
    private static int[] A;

    private static void solveProblem(InputStream instr) throws Exception {
        InputReader sc = new InputReader(instr);
        int testCount = 1;
        if (debug) {
            testCount = sc.nextInt();
        }

        for (int t = 1; t <= testCount; t++) {
            printDebug("------ " + t + " ------");
            N = sc.nextInt();
            A = readInts(sc, N);
            Object result = solveTestCase();
            System.out.println(result);
        }
    }

    private static Object solveTestCase() {
        int sum[] = new int[N];
        sum[0] = A[0];
        for (int i = 1; i < N; i++) {
            sum[i] = sum[i - 1] + A[i];
        }
        TreeMap<Integer, List<int[]>> map = new TreeMap<>();
        for (int i = 0; i < N; i++) {
            for (int j = i; j < N; j++) {
                int groupSum = sum[j] - (i == 0 ? 0 : sum[i - 1]);
                map.putIfAbsent(groupSum, new ArrayList<>());
                map.get(groupSum).add(new int[]{i, j});
            }
        }
        int max = -1;
        List<int[]> maxAnswer = null;
        for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {
            List<int[]> values = entry.getValue();
            if (values.size() <= max) {
                continue;
            }
            List<int[]> curr = findMax(values);
            if (curr.size() > max) {
                max = curr.size();
                maxAnswer = curr;

            }
        }
        List<String> answer = new ArrayList<>();
        for (int[] value : maxAnswer) {
            answer.add((value[0] + 1) + " " + (value[1] + 1));
        }
        return max + "\n" + joinValues(answer, "\n");
    }

    private static List<int[]> findMax(List<int[]> values) {
        values.sort(new Comparator<int[]>() {
            @Override
            public int compare(int[] o1,... 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.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 Alex
 */
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);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        int n;
        int startrow;
        int startcol;
        long want;

        boolean check(long time) {
            long max = (long) 2 * time * (time + 1) + 1;
            long highest = startrow - time;
            if(highest < 0) {
                max -= Math.abs(highest) * Math.abs(highest);
            }
            long lowest = startrow + time;
            if(lowest >= n) {
                max -= Math.abs(lowest - n + 1) * Math.abs(lowest - n + 1);
            }
            long leftmost = startcol - time;
            if(leftmost < 0) {
                max -= Math.abs(leftmost) * Math.abs(leftmost);
            }
            long rightmost = startcol + time;
            if(rightmost >= n) {
                max -= Math.abs(rightmost - n + 1) * Math.abs(rightmost - n + 1);
            }
            long upperright = time - (startrow + 1) - (n - startcol);
            if(upperright >= 0) {
                max += (upperright + 1) * (upperright + 2) / 2;
            }
            long lowerright = time - (n - startrow) - (n - startcol);
            if(lowerright >= 0) {
                max += (lowerright + 1) * (lowerright + 2) / 2;
            }
            long upperleft = time - (startrow + 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: import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Solution implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

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

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

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

	double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}
	
	int fu(int[] a, int l) {
		for (int i = l; i < a.length - 1; i++) {
			if (a[i] > a[i + 1]) return i;
		}
		return a.length;
	}
	
	void swap(int[] a, int q, int w) {
		int t = a[q]; a[q] = a[w]; a[w] = t;
	}
	
	void solve() throws Exception {
		int n = nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) a[i] = nextInt();
		int q = fu(a, 0);
		if (q == n) out.println("YES"); else {
			int w = fu(a, q + 1);
			if (w < n) {
				boolean ans = false;
				swap(a, q, w);
				ans |= fu(a, 0) == n;
				swap(a, q, w);
				if (q < n - 1) {
					swap(a, q + 1, w);
					ans |= fu(a, 0) == n;
					swap(a, q + 1, w);
				}
				if (w < n - 1) {
					swap(a, q, w + 1);
					ans |= fu(a, 0) == n;
					swap(a, q, w + 1);
				}
				if (q < n - 1 && w < n - 1) {
					swap(a, q + 1, w + 1);
					ans |= fu(a, 0) == n;
					swap(a, q + 1, w + 1);
				}
				if (ans) out.println("YES"); else out.println("NO");
			} else {
				int j = q + 1;
				while (j < n && a[j] == a[q + 1]) j++;
				j--;
				swap(a, q, j);
				if (fu(a, 0) == n) out.println("YES"); else {
					swap(a, q, j);
					q++;
					j =... What is the time complexity of the previous code?
targets: nlogn
inputs: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class ProblemA {
    public static class Team {
        int solved;
        int penalty;
        Team(int s, int p) {
            solved = s;
            penalty = p;
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        int n =  Integer.valueOf(data[0]);
        int k =  Integer.valueOf(data[1]);

        
        Team[] t = new Team[n];
        for (int i = 0 ; i < n ; i++) {
            String[] line = s.readLine().split(" ");
            t[i] = new Team(Integer.valueOf(line[0]), Integer.valueOf(line[1]));
        }
        Arrays.sort(t, new Comparator<Team>(){
            public int compare(Team arg0, Team arg1) {
                if (arg0.solved != arg1.solved) {
                    return arg1.solved - arg0.solved;
                }
                return arg0.penalty - arg1.penalty;
            }
        });
        
        
        int idx = k - 1;
        int ksol = t[idx].solved;
        int kpen = t[idx].penalty;
        int count = 0;
        for (int i = 0 ; i < n ; i++) {
            if (t[i].solved == ksol && t[i].penalty == kpen) {
                count++;
            }
        }
        System.out.println(count);
    }
} Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?
targets: nlogn
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Map;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.TreeMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

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

class TaskB {
    int n, a, b;
    Map<Integer, Integer> position;
    int[] p;
    int[] group;

    public void solve(int testNumber, FastInputReader in, PrintWriter out) {
        n = in.nextInt();
        a = in.nextInt();
        b = in.nextInt();

        position = new TreeMap<Integer, Integer>();
        p = new int[n];
        group = new int[n];

        for (int i = 0; i < n; i++) {
            p[i] = in.nextInt();
            group[i] = -1;
            position.put(p[i], i);
        }

        for (int i = 0; i < n; i++) {
            if (getMate(i) != -1)
                continue;
            out.println("NO");
            return;
        }

        for (int i = 0; i < n; i++) {
            boolean aMate = position.containsKey(a - p[i]);
            boolean bMate = position.containsKey(b - p[i]);
            if (aMate && bMate)
                continue;
            if (group[i] != -1)
                continue;
            if (!solve(i)) {
                out.println("NO");
                return;
            }
        }

        for (int i = 0; i < n; i++) {
            if (group[i] != -1)
                continue;
            if (!solve(i)) {
                out.println("NO");
                return;
            }
        }

       ... Complexity:
targets: linear
inputs: Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
import java.math.*;

public class Main {        

    void run() throws IOException {
        int n = in.nextInt();
        char[] c = in.next().toCharArray();
        int[][] t = new int[n][n];
        int[][] h = new int[n][n];
        int allt = 0, allh = 0;
        for (int i = 0; i < n; i++) {
            if (c[i] == 'T') {
                allt++;
            } else {
                allh++;
            }
        }
        for (int i = 0; i < n; i++) {
            if (c[i] == 'T') {
                t[i][i] = 1;
                h[i][i] = 0;
            } else {
                t[i][i] = 0;
                h[i][i] = 1;
            }
            for (int j = i + 1; j < n; j++) {
                if (c[j] == 'T') {
                    t[i][j] = t[i][j - 1] + 1;
                    h[i][j] = h[i][j - 1];
                } else {
                    h[i][j] = h[i][j - 1] + 1;
                    t[i][j] = t[i][j - 1];
                }
            }
        }
        for (int i = 1; i < n; i++) {
            t[i][i - 1] = allt;
            h[i][i - 1] = allh;
            for (int j = 0; j < i - 1; j++) {
                t[i][j] = allt - t[j + 1][i - 1];
                h[i][j] = allh - h[j + 1][i - 1];
            }
        }
        int r = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {                
                if (h[i][j] == t[(j + 1) % n][(i - 1 + n) % n]) {
                    r = min(r, h[i][j]);
                }
                if (t[i][j] == h[(j + 1) % n][(i - 1 + n) % n]) {
                    r = min(r, t[i][j]);
                }
            }
        }
        out.println(r);
       /* for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
               out.print(t[i][j] + " ");
            }
            out.println();
        }
        out.println();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j <... Complexity:
targets: linear
inputs: import static java.util.Arrays.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import java.util.*;
import java.math.*;
import java.io.*;

public class A implements Runnable
{
    String file = "input";
    
    void init() throws IOException
    {
        //input = new BufferedReader(new FileReader(file + ".in"));
        input = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedOutputStream(System.out));
    }
    
    void solve() throws IOException
    {
        String s = next();
        int res = 0;
        int L = s.length();
        for(int i = 0; i < L; i++)
            for(int j = i + 1; j <= L; j++)
            {
                String ss = s.substring(i, j);
                int k = s.indexOf(ss);
                //print(ss, k);
                if(k >= 0)
                {
                    if(s.substring(k + 1).indexOf(ss) >= 0) res = max(res, j - i);
                }
            }
        System.out.println(res);
    }
    
    String next() throws IOException
    {
        if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.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());
    }
    
    void print(Object... o)
    {
        System.out.println(deepToString(o));
    }
    
    void gcj(Object o)
    {
        String s = String.valueOf(o);
        out.println("Case #" + test + ": " + s);
        System.out.println("Case #" + test + ": " + s);
    }
    
    BufferedReader input;
    PrintWriter out;
    StringTokenizer st;
    int test;
    
    public static void main(String[] args) throws IOException
    {
        new Thread(null, new A(), "", 1 << 20).start();
    }
    
    public void run()
    {
        try
        {
    ... 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 Juan Sebastian Beltran Rojas
 * @mail jsbeltran.valhalla@gmail.com
 * @veredict
 * @url https://codeforces.com/problemset/problem/1238/E
 * @category dp
 * @date 19/10/2019
 **/

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

import static java.lang.Integer.bitCount;
import static java.lang.Integer.parseInt;

public class CF1238E {
    static long[][] Q;
    static int N;
    static int M;
    static long[] mem;
    static long[] sums;

    public static void main(String args[]) throws Throwable {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        for (String ln; (ln = in.readLine()) != null; ) {
            StringTokenizer st = new StringTokenizer(ln);
            N = parseInt(st.nextToken());
            M = parseInt(st.nextToken());
            char[] S = in.readLine().toCharArray();
            Q = new long[M][M];
            mem = new long[1 << M];
            Arrays.fill(mem, -1);
            for (int i = 1; i < N; i++)
                Q[S[i - 1] - 'a'][S[i] - 'a'] = Q[S[i] - 'a'][S[i - 1] - 'a'] = Q[S[i - 1] - 'a'][S[i] - 'a'] + 1;
            calculateSums();
            for (int i = (1 << M) - 1; i >= 0; i--)
                f(i);
            System.out.println(f(0));
        }
    }

    static void calculateSums() {
        sums = new long[1 << M];
        Arrays.fill(sums, -1);
        for (int u = 0; u < (1 << M); u++) {
            if (sums[u] == -1) {
                sums[u] = 0;
                for (int j = 0; j < M; j++)
                    for (int k = j + 1; k < M; k++)
                        if (((u & (1 << j)) == 0 && (u & (1 << k)) != 0) ||
                                ((u & (1 << j)) != 0 && (u & (1 << k)) == 0))
                            sums[u] += Q[j][k];
                int neg = (~u) & ((1 << M) - 1);
                sums[neg] = sums[u];
            }
        }
    }

    static long f(int u) {
        if (bitCount(u) == M) return 0;
        if... What is the time complexity of the previous code?
targets: np