codeparrot/codecomplex huggingface dataset:
// Problem: 1059_B. Forgery
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Solution {
    private static int[] dx = {
            -1, -1, -1,
            0, 0,
            1, 1, 1};
    private static int[] dy = {
            -1, 0, 1,
            -1, 1,
            -1, 0, 1};

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));


        int r = in.nextInt();
        int c = in.nextInt();
        boolean[][] m = new boolean[r + 1][c + 1];
        boolean[][] inp = new boolean[r + 1][c + 1];
        for (int i = 0; i < r; i++) {
            String s = in.next();
            //System.out.println(m[i]);
            for (int j = 0; j < s.length(); j++) {
                if (s.charAt(j) == '#') {
                    m[i][j] = true;
                    inp[i][j] = true;
                }
            }
        }

        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                if (canPress(i, j, r, c, inp)) {

                    // make press
                    for (int k = 0; k < 8; k++) {
                        int xi = i + dx[k];
                        int yi = j + dy[k];
                        m[xi][yi] = false;
                    }

                }
            }
        }
        boolean isLeftAny = false;
        for (int i = 0; i < r && !isLeftAny; i++) {
            for (int j = 0; j < c && !isLeftAny; j++) {
                if (m[i][j]) {
                    isLeftAny = true;
                    break;
                }
            }
        }
        if(isLeftAny){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }
    }

    private static boolean canPress(int x, int y, int r, int c, boolean[][] inp) {
        for (int i = 0; i < 8; i++) {
            int xi = x + dx[i];
            int yi = y + dy[i];
            if (xi < 0 || yi < 0) {
                return false;
            }
            if (xi >= r || yi >= c) {
                return false;
            }
            if(!inp[xi][yi]){
                return false;
            }
        }
        return true;
    }
}
// Problem: 1009_A. Game Shopping
// Time complexity: linear
import java.util.*;
public class Main {

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();
        int[] game=new int[n];
        int[] bill=new int[m];
        for (int i = 0; i <n ; i++) {
            game[i]=scan.nextInt();
        }
        for (int i = 0; i <m ; i++) {
            bill[i]=scan.nextInt();
        }
        int i=0;
        int j=0;
        int ans=0;
        while (i<m){
            boolean f=true;
            for (int k = j; k <n ; k++) {
                if (bill[i]>=game[k]){
                    ans++;
                    i++;
                    j=k+1;
                    f=false;
                    break;
                }
            }
            if (f){
                break;
            }
        }
        System.out.println(ans);
    }
}
// Problem: 976_A. Minimum Binary Number
// Time complexity: linear
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Practice {
	
	   

		public static void main(String []args)
		{
			Scanner sc=new Scanner(System.in);
			int n=sc.nextInt();
			sc.nextLine();
			String s=sc.nextLine();
			//System.out.println(s);
			char c[]=s.toCharArray();
			ArrayList a =new ArrayList();
			
			for(int i=0;i<c.length;i++)
			{
				//System.out.println(c[i]);
				a.add(c[i]);
			}
		
			int x=Collections.frequency(a,'0' );
			int y=Collections.frequency(a,'1');
			
			//System.out.println(x+ "  "+y );
			if(y==0 || y==1)
			{
				System.out.println(s);
			}
			else
			{
				if(y>=2)
				{
					String s1="1";
					for(int i=0;i<x;i++)
					{
						s1=s1+"0";
					}
					System.out.println(s1);
					
				}
			}
			
			
			
			
			
			
	}

}
// Problem: 1190_C. Tokitsukaze and Duel
// Time complexity: linear
import java.util.*;
import java.io.*;
public class C{
    static PrintWriter out;
    static InputReader in;
    public static void main(String args[]){
        out = new PrintWriter(System.out);
        in = new InputReader();
        new C();
        out.flush(); out.close();
    }   
    C(){
       int a = solve();
       out.print(a == 0 ? "tokitsukaze" : a == 1 ? "quailty" : "once again");
    }
    int n, k;
    char ch[]; int a[], c0 = 0, c1 = 0;
    TreeSet<Integer> ts[] = new TreeSet[2];
    boolean check(){
        int min = 0, max = n;
        if(!ts[0].isEmpty()){
            min = ts[0].first(); max = ts[0].last();
            if(max - min + 1 > k)return true;
        }
        if(!ts[1].isEmpty()){
            min = ts[1].first(); max = ts[1].last();
            if(max - min + 1 > k)return true;   
        }
        return false;
    }
    int solve(){
        n  = in.nextInt(); k = in.nextInt();
        ch = in.next().trim().toCharArray(); a = new int[n];
        for(int i = 0; i < n; i++)c1 += a[i] = ch[i] - '0';
        c0 = n - c1;
        for(int i = 0; i < k; i++){
            if(a[i] == 0)c0--; else c1--;
        }
        if(c0 == 0 || c1 == 0)return 0;
        for(int i = k; i < n; i++){
            if(a[i] == 0)c0--; else c1--;
            if(a[i - k] == 0)c0++; else c1++;
            if(c0 == 0 || c1 == 0)return 0;
        }

        for(int i = 0; i < 2; i++)ts[i] = new TreeSet<>();
        for(int i = 0; i < n; i++){
            ts[a[i]].add(i);
        }
        for(int i = 0; i < k; i++){
            ts[a[i]].remove(i);
        }
        if(check())return 2;
        for(int i = k; i < n; i++){
            ts[a[i]].remove(i); ts[a[i - k]].add(i - k);
            if(check())return 2;
        }
        return 1;
    }
    public static class InputReader{
        BufferedReader br;
        StringTokenizer st;
        InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
        public String next(){
            while(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(IOException e){}
            }
            return st.nextToken();
        }
    }
}
// Problem: 1003_C. Intense Heat
// Time complexity: quadratic
import java.util.*;
import java.io.*;
import java.util.Map.Entry;

public class Codeforces {

    static int n;
    static double max;
    static int[] pre;

    public static void findIntensity(int l){
        for(int i = 0, j = i + l; j < n + 1; i++, j++){
            double res = (pre[j] - pre[i]) / (double) l;
            max = Math.max(max, res);
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        int[] heat = new int[n];
        st = new StringTokenizer(br.readLine());
        for(int i = 0; i < n; i++){
            heat[i] = Integer.parseInt(st.nextToken());
        }
        max = 0;
        pre = new int[n + 1];
        pre[0] = 0;
        for(int i = 0; i < n; i++){
            pre[i + 1] = pre[i] + heat[i];
        }
        for(int i = k; i <= n; i++){
            findIntensity(i);
        }
        System.out.println(max);
    }
}
// Problem: 1088_D. Ehab and another another xor problem
// Time complexity: logn
import java.util.*;
import java.io.*;
public class code{
    public static void main(String[] args) throws IOException{
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int ok,ok2;
        int va,vb;
        va = 0;
        vb = 0;
        out.println("? "+va+" "+vb);
        out.flush();
        ok = sc.nextInt();
        for(int i=29;i>=0;i--){
            if(ok==0){
                va += (1<<i);
                out.println("? "+va+" "+vb);
                out.flush();
                ok2 = sc.nextInt();
                if(ok2==1){
                    va -= (1<<i);
                }else{
                    vb += (1<<i);
                }
            }else{
                va += (1<<i);
                vb += (1<<i);
                out.println("? "+va+" "+vb);
                out.flush();
                ok2 = sc.nextInt();
                if(ok==ok2){
                    vb -= (1<<i);
                    out.println("? "+va+" "+vb);
                    out.flush();
                    ok2 = sc.nextInt();
                    if(ok2==1){
                        va -= (1<<i);
                    }else{
                        vb += (1<<i);
                    }
                }else{
                    if(ok==1){
                        vb -= (1<<i);
                        out.println("? "+va+" "+vb);
                        out.flush();
                        ok = sc.nextInt();
                    }
                    else {
                        va -= (1<<i);
                        out.println("? "+va+" "+vb);
                        out.flush();
                        ok = sc.nextInt();
                    }
                }
            }
        }
        out.println("! "+va+" "+vb);
        out.flush();
    }
}
// Problem: 1009_E. Intercity Travelling
// Time complexity: linear
import java.io.*;
import java.util.*;

public class CF1009E {
	static final int MD = 998244353;
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		StringTokenizer st = new StringTokenizer(br.readLine());
		int[] aa = new int[1 + n];
		for (int i = 1, a = 0; i <= n; i++)
			aa[i] = a = (a + Integer.parseInt(st.nextToken())) % MD;
		int[] pp = new int[n];
		pp[0] = 1;
		for (int i = 1, p = 1; i < n; i++) {
			pp[i] = p;
			p = p * 2 % MD;
		}
		int d = 0;
		long ans = 0;
		for (int i = n - 1; i >= 0; i--) {	// rest at i
			d = (d * 2 % MD + aa[n - 1 - i]) % MD;	// rest again before n
			ans = (ans + (long) (d + aa[n - i]) * pp[i]) % MD;
		}
		System.out.println(ans);
	}
}
// Problem: 1027_E. Inverse Coloring
// Time complexity: quadratic
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class E {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni(), K = in.ni();
            long mod = 998244353;
            long[][] dp = new long[n + 1][n + 1];
            for (int lim = 1; lim <= n; lim++) {
                long sum = 1;
                dp[0][lim] = 1;
                for (int i = 1; i <= n; i++) {
                    dp[i][lim] = (dp[i][lim] + sum) % mod;
                    sum = (sum + dp[i][lim]) % mod;
                    if (i >= lim)
                        sum = (sum - dp[i - lim][lim] + mod) % mod;
                }
            }
            long ans = 0;
            for (int k = 1; k < Math.min(K, n + 1); k++) {
                long h = dp[n][k] - dp[n][k - 1];
                int lim = K / k;
                if (K % k == 0)
                    lim--;
                if (lim > n)
                    lim = n;
                ans += dp[n][lim] * h % mod;
            }
            out.println(2 * ans % mod);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}
// Problem: 961_A. Tetris
// Time complexity: quadratic
import java.util.Scanner;

public class A961_Tetris {

	public static void main(String[] args) {
		
		Scanner input = new Scanner(System.in);
		int platforms = input.nextInt();
		int in = input.nextInt();
		int[] cols = new int[platforms];
		int[] squares = new int[in];
		
		for (int i = 0; i < in; i ++) {
			squares[i] = input.nextInt();
		}
		
		boolean hi = false;
		int score = 0;
		
		for (int i = 0; i < in; i ++) {
			cols[squares[i] - 1] ++;
			hi = checkscore(cols);
			if (hi == true) {
				hi = false;
				score ++;
				for (int j = 0; j < cols.length; j ++) {
					cols[j] --;
				}
				
			}
			
		}
		
		System.out.println(score);
		
	}
	
	public static boolean checkscore(int[] cols) {
		for (int i = 0; i < cols.length; i ++) {
			if (cols[i] == 0) {
				return false;
			}
			
		}
		
		return true;
		
	}

}
// Problem: 990_C. Bracket Sequences Concatenation Problem
// Time complexity: linear
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Math.*;

public class Main {

    private FastScanner scanner = new FastScanner();

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


    private void solve() {
        int n = scanner.nextInt();

        Map<Integer, Integer> cnt = new HashMap<>();

        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();

            LinkedList<Character> st = new LinkedList<>();

            for (char c : s.toCharArray()) {
                if (c == ')' && !st.isEmpty() && st.getLast() == '(') {
                    st.pollLast();
                    continue;
                }
                st.addLast(c);
            }

            int t = st.size();
            Set<Character> set = new HashSet<>(st);
            if (set.size() > 1) {
                continue;
            }
            if (set.isEmpty()) {
                cnt.put(0, cnt.getOrDefault(0, 0) + 1);
                continue;
            }

            if (st.getLast() == '(') {
                cnt.put(t, cnt.getOrDefault(t, 0) + 1);
            } else {
                cnt.put(-t, cnt.getOrDefault(-t, 0) + 1);
            }
        }

        long ans = 0;

        for (int next : cnt.keySet()) {
            if (next == 0) {
                ans += (long) cnt.get(next) * (cnt.get(next) - 1) + cnt.get(next);
            } else if (next > 0) {
                int t = next * -1;
                if (cnt.containsKey(t)) {
                    ans += (long) cnt.get(next) * cnt.get(t);
                }
            }
        }

        System.out.print(ans);

    }

    class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        FastScanner() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        Integer[] nextA(int n) {
            Integer a[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = scanner.nextInt();
            }
            return a;
        }

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
// Problem: 965_A. Paper Airplanes
// Time complexity: constant

import java.util.*;
import java.io.*;
import java.math.*;
public class loser
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

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

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

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    static class card{
        long a;
        int i;
        public card(long a,int i)
        {
            this.a=a;
            this.i=i;
        }
    }
    static class sort implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.a!=o2.a)
                return (int)(o1.a-o2.a);
            else
                return (int)(o1.b-o2.b);
        }
    }
    static void shuffle(long a[])
    {
        List<Long> l=new ArrayList<>();
        for(int i=0;i<a.length;i++)
            l.add(a[i]);
        Collections.shuffle(l);
        for(int i=0;i<a.length;i++)
            a[i]=l.get(i);
    }

    /*static long gcd(long a,long b)
    {
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
    }*/
    /*static boolean valid(int i,int j)
    {
    if(i<4 && i>=0 && j<4 && j>=0)
    return true;
    else
    return false;
    }*/
    static class pair{
        int a,b;
        public pair(int a,int b)
        {
            this.a=a;
            this.b=b;
        }
    }
    public  static void main(String[] args) 
    {
        InputReader sc=new InputReader(System.in);
        int k=sc.nextInt();
        int n=sc.nextInt();
        int s=sc.nextInt();
        int p=sc.nextInt();
        long d=(long)Math.ceil((double)n/s);
        if(d==0)
        d=1;
        d=k*d;
        long ans=(long)Math.ceil((double)d/p);
        System.out.println(ans);
    }
}
// Problem: 999_D. Equalize the Remainders
// Time complexity: linear

import java.io.*;
import java.util.*;
public class D999 {
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int req=n/m;
        int arr[]=new int[n+1];
        int size[]=new int[m];
        List<Integer> list[]=new ArrayList[m];
        for(int i=0;i<m;i++)
        {
            list[i]=new ArrayList<>();
        }
        for(int i=1;i<=n;i++)
        {
            arr[i]=sc.nextInt();
            size[arr[i]%m]++;
            list[arr[i]%m].add(i);
        }
        long tot=0;int x=0,y=0;
        List<Integer> idx=new ArrayList<>();
        for(int i=0;i < 2*m;i++)
        {
            //System.out.println(i+" "+size[i%m]);
            if(size[i%m]>req)
            {
                for(int j=0;j<size[i%m]-req;j++)
                {
                    idx.add(list[i%m].get(j));
                    y++;
                    
                }
                size[i%m]=req;
                //System.out.println(i+" "+x+" "+y);
            }
            else if(size[i%m]<req)
            {
                //System.out.println(idx+" "+i);
                while(x!=y && size[i%m]<req)
                {
                    int num=arr[idx.get(x)];
                    int gg=i-num%m;
                    tot+=gg;
                    arr[idx.get(x)]+=gg;
                    x++;
                    size[i%m]++;
                }
            }
        }
        System.out.println(tot);
        for(int i=1;i<=n;i++)
        {
            System.out.print(arr[i]+" ");
        }
    }
}
// Problem: 1000_B. Light It Up
// Time complexity: linear
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class LightItUp {

	public static void main(String[] args) throws IOException {
		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		 StringTokenizer st = new StringTokenizer(br.readLine());
		
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		int previous = 0;
		int array[] = new int[n+1];
		int answer = 0;
		
		StringTokenizer st1 = new StringTokenizer(br.readLine());
		for(int i = 0; i < n; i++){
			array[i] = Integer.parseInt(st1.nextToken());
			if(i % 2 == 0){
				answer += (array[i] - previous);
			}
			previous = array[i];
		}
		
		if(n % 2 == 0){
			answer += (m - previous);
		}
		previous = m;
		int max = Integer.MAX_VALUE;
		
		while(n-- != 0){
			int temp = array[n];
			if(n%2 == 0){
				array[n] = array[n+1] - (previous - array[n]);
			}
			else{
				array[n] = array[n+1] + (previous - array[n]);
			}
			previous = temp;
			max = Math.min(max, array[n]);
		}
		if(max>=-1){
			System.out.println(answer);
		}
		else{
			System.out.println(answer - (max+1));
		}

	}

}
// Problem: 981_A. Antipalindrome
// Time complexity: linear
import java.util.*;
public class A
{
    public static int palin(String str)
    {
        int flag=0;
        int l=str.length();
        for(int i=0;i<l/2;i++)
        {
            if(str.charAt(i)!=str.charAt(l-i-1))
            {
                flag=1;
                break;
            }
        }
        if(flag==1)
        return 0;
        else
        return 1;
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        HashSet<Character> hs=new HashSet<>();
        for(int i=0;i<str.length();i++)
        {
            hs.add(str.charAt(i));
        }
        if(hs.size()==1)
        System.out.println(0);
        else if(palin(str)==0)
        System.out.println(str.length());
        else
        System.out.println(str.length()-1);
    }
}