codeparrot/codecomplex huggingface dataset:
// Problem: 468_B. Two Sets
// Time complexity: linear

import java.util.*;
import java.util.Map.Entry;
import java.io.*;

public class A{

    public static void main(String args[]){
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        boolean change = false;
        if(a > b){
            int t = a;
            a = b;
            b = t;
            change = true;
        }
        boolean[] inb = new boolean[n];
        int[] numbers = new int[n];
        TreeMap<Integer, Integer> num = new TreeMap<Integer, Integer>();
        for(int i = 0; i < n; i++){
            num.put(in.nextInt(), i);
        }
        boolean hasAns = true;
        while(!num.isEmpty()){
            Entry<Integer, Integer> last = num.lastEntry();
            int key = last.getKey();
            if(num.containsKey(a - key)){
                num.remove(key);
                num.remove(a - key);
            } else if(num.containsKey(b - key)){
                inb[num.get(key)] = true;
                inb[num.get(b - key)] = true;
                num.remove(key);
                num.remove(b - key);
            } else{
                hasAns = false;
                break;
            }
        }
        if(hasAns){
            out.println("YES");
            for(int i = 0; i < n && !change; i++){
                if(inb[i]){
                    out.print("1");
                } else{
                    out.print("0");
                }
                if(i != n - 1){
                    out.print(" ");
                }
            }
            for(int i = 0; i < n && change; i++){
                if(inb[i]){
                    out.print("0");
                } else{
                    out.print("1");
                }
                if(i != n - 1){
                    out.print(" ");
                }
            }
        } else{
            out.println("NO");
        }
        out.close();
    }

    static class FastScanner{
        private BufferedReader reader;

        private StringTokenizer tokenizer;

        public FastScanner(InputStream stream){
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

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

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

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

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

        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	int work(int x){
		if(x%2==0)return x+1;
		else return x-1;
	}
	static int N = 200050;
	class Node implements Comparable <Node>{
		int x, id;
		Node(int x, int id){
			this.x = x; this.id = id;
		}
		public int compareTo(Node o){
			return Integer.compare(x, o.x);
		}
		public String toString(){
			return id + "=" + x;
		}
	}
	class Edge{
		int from, to, nex;
		Edge (int from, int to, int nex){
			this.from = from;
			this.to = to;
			this.nex = nex;
		}
	}
	Edge[] edge = new Edge[N*10];
	int[] head = new int[N];
	int edgenum;  
	void addedge(int u, int v){  
	    Edge E = new Edge(u, v, head[u]);  
	    edge[edgenum] = E;  
	    head[u] = edgenum ++;  
	}  
	
	int n;
	int[] p = new int[N], ans = new int[N];
	int a, b, max;
    Map<Integer, Integer> map = new HashMap();
    boolean match(int x, int y, int col){
    	int P = map.get(x);
    	if(map.containsKey(y-x) == false)
    		return false;
    	int Q = map.get(y - x);
    	if(ans[Q] == -1 || x * 2 == y){
    		ans[Q] = ans[P] = col;
    	}
    	else {
    		if(match(a+b-2*y+x, y, col))
    			ans[Q] = ans[P] = col; 		
    		else return false;
    	}
    	return true;
    }
    boolean solve(){
    	if(max >= a && max >= b)return false;
    	for(int i = 1; i <= n; i++)
    		if(ans[i] == -1)
    		{
    			if(match(p[i], a, 0)==false && match(p[i], b, 1) == false)
    				return false;
    		}    	
    	return true;
    }
	void init(){
		n = cin.nextInt();
		a = cin.nextInt(); b = cin.nextInt();
		max = 0;
		for(int i = 1; i <= n; i++){
			ans[i] = -1;
			p[i] = cin.nextInt();
			map.put(p[i], i);
			if(p[i] > max) max = p[i];
		}
	}
	public void work(){
		init();
		if(solve()){
			out.println("YES");
			for(int i = 1; i <= n; i++)out.print(ans[i]+" "); out.println();
		}
		else 
			out.println("NO");
	}
	Main() {
        cin = new Scanner(System.in);  
        out = new PrintWriter(System.out);
    }  
    public static void main(String[] args) {
        Main e = new Main();  
        e.work();
        out.close();
    }
    public Scanner cin;
    public static PrintWriter out;
}
/*
http://blog.csdn.net/keshuai19940722/article/details/39528801

*/
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.*;
import java.util.*;

public class Main {
  // main
  public static void main(String [] args) throws IOException {
    // makes the reader and writer
    BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    
    // read in n,a,b,ints
    StringTokenizer st = new StringTokenizer(f.readLine());
    int n = Integer.parseInt(st.nextToken());
    int a = Integer.parseInt(st.nextToken());
    int b = Integer.parseInt(st.nextToken());
    st = new StringTokenizer(f.readLine());
    HashMap<Integer,Integer> in = new HashMap<Integer,Integer>();
    int[][] locs = new int[n][2];
    for (int i=0;i<n;i++) {
      int num = Integer.parseInt(st.nextToken());
      locs[i] = new int[]{num,i};
      in.put(num,i);
    }
    
    // use greedy
    boolean ok = true;
    int swap = 0;
    if (a>b) {swap = 1;
      int t = a;
      a = b;
      b = t;
    }
    Arrays.sort(locs,new Comparator<int[]>() {
      public int compare(int[] a, int[] b) {
        return (new Integer(a[0])).compareTo(b[0]);
      }
    });
    int[] inB = new int[n];
    for (int[] i: locs) {
      if (in.containsKey(b-i[0])) {
        inB[i[1]] = 1-swap;
        in.remove(b-i[0]);
      } else if (in.containsKey(a-i[0])) {
        inB[i[1]] = swap;
        in.remove(a-i[0]);
      } else ok = false;
    }

    // write to out
    StringBuffer p = new StringBuffer();
    for (int i=0;i<n-1;i++) {
      p.append(inB[i]);
      p.append(" ");
    }
    p.append(inB[n-1]);
    if (ok) {
      out.println("YES");
      out.println(p.toString());
    } else {
      out.println("NO");
    }
    
    // cleanup
    out.close();
    System.exit(0);
  }
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
 
public class temp
{
	
	void solve()
	{
		FastReader sc =new FastReader();
		int n = sc.nextInt();
		
		ArrayList<String> a[] = new ArrayList[5];
		
		for(int i=0;i<=4;i++)
			a[i] = new ArrayList<>();
		
		for(int i=0;i<n;i++)
		{
			String s = sc.next();
			a[s.length()].add(s);
		}
		
		int ans = 0;
		
		for(int i=0;i<n;i++)
		{
			String s = sc.next();
			if(a[s.length()].contains(s))
				a[s.length()].remove(new String(s));
		}
		
		for(int i=1;i<=4;i++)
			ans+=a[i].size();
		
		System.out.println(ans);
	}
 
    public static void main(String[] args)
    {
        new temp().solve();
    }
	
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            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;
        }
    }
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class ACodehorsesTShirts {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            Map<String, Integer> map = new HashMap<>();
            for (int i = 0; i < n; i++) {
                String ch = in.next();
                if (map.containsKey(ch)) {
                    map.put(ch, map.get(ch) + 1);
                } else {
                    map.put(ch, 1);
                }
            }
            int s = n;
            for (int i = 0; i < n; i++) {
                String ch = in.next();
                if (map.containsKey(ch)) {
                    if (map.get(ch) == 1) {
                        map.remove(ch);
                    } else {
                        map.put(ch, map.get(ch) - 1);
                    }
                    s--;
                }
            }
            out.println(s);
        }

    }

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

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

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

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

    }
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {
        int n = nextInt();
        int a[] = new int[9];
        int b[] = new int[9];
        for(int i=0;i<n;i++){
            String s = next();
            if(s.equals("M")){
                a[0]++;
            }else if (s.equals("L")){
                a[1]++;
            }
            else if (s.equals("XL")){
                a[2]++;
            }
            else if (s.equals("XXL")){
                a[3]++;
            }
            else if (s.equals("XXXL")){
                a[4]++;
            }
            else if (s.equals("S")){
                a[5]++;
            }
            else if (s.equals("XS")){
                a[6]++;
            }
            else if (s.equals("XXS")){
                a[7]++;
            }
            else if (s.equals("XXXS")){
                a[8]++;
            }
        }
        for(int i=0;i<n;i++){
            String s = next();
            if(s.equals("M")){
                b[0]++;
            }else if (s.equals("L")){
                b[1]++;
            }
            else if (s.equals("XL")){
                b[2]++;
            }
            else if (s.equals("XXL")){
                b[3]++;
            }
            else if (s.equals("XXXL")){
                b[4]++;
            }
            else if (s.equals("S")){
                b[5]++;
            }
            else if (s.equals("XS")){
                b[6]++;
            }
            else if (s.equals("XXS")){
                b[7]++;
            }
            else if (s.equals("XXXS")){
                b[8]++;
            }
        }

        int ans = 0;
        ans+=Math.abs(a[2]-b[2]);
        ans+=Math.abs(a[3]-b[3]);
        ans+=Math.abs(a[4]-b[4]);
        int max = Math.abs(a[0]-b[0]);
        max = max(max,Math.abs(a[1]-b[1]));
        max = max(max,Math.abs(a[5]-b[5]));
        ans+=max;
        out.print(ans);
        out.flush();
    }
    public static int max(int a,int b){
        return a>b?a:b;
    }
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear

import java.util.*;
public class hackerearth {

    public  static  void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();

        HashMap<String,Integer> map=new HashMap<>();
        HashMap<String,Integer> map2=new HashMap<>();
        for(int i=0;i<n;i++)
        {
            String s=sc.next();
            if(map.containsKey(s))
                map.put(s,map.get(s)+1);
            else
                map.put(s,1);
        }
        for(int i=0;i<n;i++)
        {
            String s=sc.next();
            if(map2.containsKey(s))
                map2.put(s,map2.get(s)+1);
            else
                map2.put(s,1);

            if(map.containsKey(s)) {
                int feq = map.get(s);
                feq--;
                if (feq <= 0)
                    map.remove(s);
                else
                    map.put(s, feq);
            }

        }


        int ans=0;
        for(Map.Entry<String,Integer> entry:map.entrySet())
        {
            ans+=entry.getValue();
        }
        System.out.println(ans);


    }



}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.InputMismatchException;

public class E46A
{
	public static void main(String[] args)
	{
		FastScanner in = new FastScanner(System.in);
		String[] sizes = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"};
		int n = in.nextInt();
		HashMap<String, Integer> a = new HashMap<>();
		HashMap<String, Integer> b = new HashMap<>();
		for (String s : sizes) {
			a.put(s, 0);
			b.put(s, 0);
		}
		for (int i = 0; i < n; i++) {
			String s = in.next();
			a.put(s, a.get(s) + 1);
		}
		for (int i = 0; i < n; i++) {
			String s = in.next();
			b.put(s, b.get(s) + 1);
		}
		for (String s : sizes) {
			int cut = Math.min(a.get(s), b.get(s));
			a.put(s, a.get(s) - cut);
			b.put(s, b.get(s) - cut);
		}
		int changes = 0;
		for (String s : sizes)
			changes += a.get(s);
		System.out.println(changes);
	}
	
	/**
	 * Source: Matt Fontaine
	 */
	public static class FastScanner
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

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

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

		boolean isSpaceChar(int c)
		{
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

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

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

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

		public String next()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear
import java.util.ArrayList;
import java.util.Scanner;
import java.lang.StringBuilder;
import java.util.Arrays;
import java.util.Stack;
import java.util.TreeMap;
public class Test11   {  
    public static void main(String[] Args)   {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s0 = sc.nextLine();
        int s = 0; // S
        int m = 0;
        int l = 0;
        int s1 = 0;
        int l1 = 0;
        int s2 = 0;
        int l2 = 0;
        int s3 = 0;
        int l3 = 0;
        for (int i = 0; i < n; i++)  {
            s0 = sc.nextLine();
            if (s0.charAt(0) == 'S') s++;
            if (s0.charAt(0) == 'M') m++;
            if (s0.charAt(0) == 'L') l++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') s1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') s2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') s3++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') l1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') l2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') l3++;
        }    
        int rs = 0; // S
        int rm = 0;
        int rl = 0;
        int rs1 = 0;
        int rl1 = 0;
        int rs2 = 0;
        int rl2 = 0;
        int rs3 = 0;
        int rl3 = 0;
        for (int i = 0; i < n; i++)  {
            s0 = sc.nextLine();
            if (s0.charAt(0) == 'S') rs++;
            if (s0.charAt(0) == 'M') rm++;
            if (s0.charAt(0) == 'L') rl++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') rs1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') rs2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') rs3++;
            if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') rl1++;
            if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') rl2++;
            if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') rl3++;
        }     
        int ans = Math.abs(s1 - rs1) + Math.abs(s2 - rs2) + Math.abs(s3 - rs3) + (Math.abs(s - rs) + Math.abs(l - rl) + Math.abs(m - rm))/2;
        System.out.println(ans);
            
   }
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Edu_46A {

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int nE = Integer.parseInt(reader.readLine());

		int[][] cnt = new int[][] { { 0, 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };

		for (int i = 0; i < nE; i++) {
			String nxt = reader.readLine();
			if (nxt.equals("S")) {
				cnt[0][0]++;
			}
			if (nxt.equals("M")) {
				cnt[0][1]++;
			}
			if (nxt.equals("L")) {
				cnt[0][2]++;
			}
			if (nxt.equals("XS")) {
				cnt[1][0]++;
			}
			if (nxt.equals("XL")) {
				cnt[1][1]++;
			}
			if (nxt.equals("XXS")) {
				cnt[2][0]++;
			}
			if (nxt.equals("XXL")) {
				cnt[2][1]++;
			}
			if (nxt.equals("XXXS")) {
				cnt[3][0]++;
			}
			if (nxt.equals("XXXL")) {
				cnt[3][1]++;
			}
		}

		for (int i = 0; i < nE; i++) {
			String nxt = reader.readLine();
			if (nxt.equals("S")) {
				cnt[0][0]--;
			}
			if (nxt.equals("M")) {
				cnt[0][1]--;
			}
			if (nxt.equals("L")) {
				cnt[0][2]--;
			}
			if (nxt.equals("XS")) {
				cnt[1][0]--;
			}
			if (nxt.equals("XL")) {
				cnt[1][1]--;
			}
			if (nxt.equals("XXS")) {
				cnt[2][0]--;
			}
			if (nxt.equals("XXL")) {
				cnt[2][1]--;
			}
			if (nxt.equals("XXXS")) {
				cnt[3][0]--;
			}
			if (nxt.equals("XXXL")) {
				cnt[3][1]--;
			}
		}

		int ans = 0;
		for (int i = 1; i <= 3; i++) {
			ans += Math.abs(cnt[i][0]);
		}

		int max = 0;
		for (int i = 0; i < 3; i++) {
			max = Math.max(max, Math.abs(cnt[0][i]));
		}
		ans += max;
		printer.println(ans);
		printer.close();
	}
}
// Problem: 1000_A. Codehorses T-shirts
// Time complexity: linear

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

public class CodehorsesT_shirts {

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(reader.readLine());
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        String input;
        for (int i = 0; i < n; i++) {
            input = reader.readLine();
            if (map.containsKey(input)) {
                map.put(input, map.get(input) + 1);
            } else {
                map.put(input, 1);
            }
        }
        int change = 0;
        for (int i = 0; i < n; i++) {
            input = reader.readLine();
            if (map.containsKey(input)) {
                map.put(input, map.get(input) - 1);
            } else {
                map.put(input, -1);
            }
        }
        for (int x : map.values()) {
            change += Math.abs(x);
        }
        System.out.println(change/2);
    }

}