akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

#define max(a,b) ((a)>(b))?(a):(b)
#define min(a,b) ((a)>(b))?(b):(a)

typedef long long ll;
typedef unsigned long long ull;

int main(void)
{
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%d", a > b * 2 ? a - 2 * b : 0);
}


Measured memory_bytes: 128
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [s, t] = stdin.trim().split('\n')

const ans = _ => {
  let sArr = s.split('')
  for (let i = 0; i < sArr.length; i++) {
    const last = sArr[sArr.length - 1]
    sArr = [last, ...sArr]
    sArr.pop()

    const str = sArr.join('')

    if (str === t) return 'Yes'
  }
  return 'No'
}

console.log(ans())


Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
using namespace std;
using llong = long long;

int main() {
  llong a, b, c;
  llong ans = 1ll << 50ll;
  cin >> a >> b >> c;

  for (llong t = 0; t < 1000; t++) {
    llong valid = 1ll << 50ll;
    llong invalid = -1;

    while (valid - invalid > 1) {
      llong mid = (valid + invalid) / 2;
      if (60*t + c <= mid*(a+b) + a) valid = mid;
      else invalid = mid;
    }

    if (valid*(a+b) <= 60*t + c && 60*t + c <= valid*(a+b) + a) ans = min(ans, 60*t + c);
  }

  if (ans == (1ll << 50ll)) cout << -1 << endl;
  else cout << ans << endl;
}



Measured memory_bytes: 3088
n = gets.to_i
as = gets.split.map(&:to_i)

as.each do |a|
  if a % 2 == 0
    if a % 3 == 0 || a % 5 == 0
      # ok
    else
      puts 'DENIED'
      exit
    end
  end
end

puts 'APPROVED'


Measured memory_bytes: 1788
import java.util.Scanner;

class Main {
    
    public static void main(String[] args){
	Scanner stdin = new Scanner(System.in);

	while(stdin.hasNextInt()){
	    int i = stdin.nextInt() + stdin.nextInt();
	    int count = 0;
	    while(i != 0){
		count++;
		i /= 10;
	    }
	    System.out.println(count);
	}
    }
}
	    
    

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0; i<(n); i++)
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using P  = pair<int,int>;//(cost,to)
using vP = vector<P>;
using vvP= vector<vP>;

const ll INF = 1001001001;
const int MOD = 1000000007;

int main(){
    ll n,k;cin>>n>>k;
    
    vector<pair<ll, ll>> a(n);
    
    ll scount=0;
    rep(i,n){
        cin>>a[i].first;
        if(a[i].first<0){
            a[i].first = -a[i].first;
            a[i].second = 1;
            scount++;
        }
    }
    
    if(scount==n && k%2==1){//マイナス確定
        sort(a.begin(), a.end());
        ll ans = 1;
        rep(i,k){
            ans *= a[i].first;
            ans %= MOD;
        }
        cout << MOD-ans << endl;
        return 0;
    }
    
    sort(a.rbegin(), a.rend());
    scount = 0;
    ll last_m=INF, last_p=INF;
    ll next_m=INF, next_p=INF;
    
    
    rep(i,k){
        scount += a[i].second;
        if(a[i].second)last_m = i;
        else           last_p = i;
    }
    
    if(scount%2==0 || a[k-1].first==0 || last_m==INF){
        ll ans = 1;
        rep(i,k){
            ans *= a[i].first;
            ans %= MOD;
        }
        cout << ans << endl;
        return 0;
    }
    
    //上からk個の中に負が存在し奇数個含まれるとき
    for(ll i=n-1; i>=k; i--){
        if(a[i].second){
            next_m = i;
        }else
            next_p = i;
    }
    
    if(next_m==INF){
        if(next_p==INF){
            ll ans = 1;
            rep(i,k){
                ans *= a[i].first;
                ans %= MOD;
            }
            if(scount%2==0)
                cout << ans << endl;
            else{
                if(ans==0)
                    cout << ans << endl;
                else cout << MOD-ans << endl;
            }
        }
        else{
            swap(a[last_m], a[next_p]);
            ll ans = 1;
            rep(i,k){
                ans *= a[i].first;
                ans %= MOD;
            }
            cout << ans << endl;
        }
    }else{
        if(next_p==INF){
            swap(a[last_p], a[next_m]);//last_p==INFは最初にはらった
            ll ans = 1;
            rep(i,k){
                ans *= a[i].first;
                ans %= MOD;
            }
            cout << ans << endl;
        }
        else{
            ll prd_m = a[next_m].first * a[last_m].first;
            ll prd_p;
            if(last_p==INF)
                prd_p = INF*INF;
            else
                prd_p = a[next_p].first * a[last_p].first;
            
            if(prd_m>prd_p){
                if(last_p==INF)
                    swap(a[k-1], a[next_m]);
                else swap(a[last_p], a[next_m]);
            }else{
                swap(a[last_m], a[next_p]);
            }
            ll ans = 1;
            rep(i,k){
                ans *= a[i].first;
                ans %= MOD;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 6440
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N = lread();
    auto ans = new long[](25_000_000);
    foreach (x; 1 .. 200)
        foreach (y; 1 .. 200)
            foreach (z; 1 .. 200)
            {
                ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
            }
    foreach (i; 1 .. N + 1)
    {
        writeln(ans[i]);
    }
}


Measured memory_bytes: 198952
#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int k, s;
    cin >> k >> s;

    int ans = 0;
    for(int x = 0; x <= k; x++){
        for(int y = 0; y <= k; y++){
            int z = s - x - y;
            if(z < 0 or k < z){
                continue;
            }else{
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
 
P reflect(P a,P b,P c){
  b-=a;c-=a;
  return a+conj(c/b)*b;
}
 
int main(){
  int n;
  double ax,ay,bx,by,cx,cy;
  scanf("%lf %lf %lf %lf %d",&ax,&ay,&bx,&by,&n);
  while(n--){
    scanf("%lf %lf",&cx,&cy);
    P p=reflect(P(ax,ay),P(bx,by),P(cx,cy));    
    printf("%.8f %.8f\n",p.real(),p.imag());
  }
  return 0;
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;

int n;
long long a[100010];

bool isOK(int idx){
    long long aa = a[idx];

    for(int i = 0;i < n;i++){
        if(i != idx){
            if(a[i] <= aa*2){
                aa += a[i];
            }else{
                return false;
            }
        }
    }

    return true;
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }

    sort(a, a+n);

    int l = -1, r = n;

    while(r-l > 1){
        int mid = (r+l)/2;
        if(isOK(mid)) r = mid;
        else l = mid;
    }

    cout << n-r << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)




int main() {
  ll N;
  cin >> N;
  string S;
  cin >> S;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));

  ll num_r = 0;
  ll num_w = 0;
  ll ans = 0;

  rep(i, S.size()){
    if(S.at(i) == 'R')num_r++;
    else num_w++;
  }
  
  rep(i, num_r){
    if(S.at(i) == 'W')ans++;
  }


  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3752
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
void solve()
{
ll n;
ll d,t,s;
cin>>d>>t>>s;
if(d/s<t)
    cout<<"Yes\n";
else if(d/s==t&&d%s==0)
     cout<<"Yes\n";
else
    cout<<"No\n";

}
int main()
{
    ios::sync_with_stdio(true);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(c,b/a)<<endl;
}


Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
N=S.size
dp=array(S.size,0)
dp[0]=1
if S[0]==S[1]
    dp[1]=1
else
    dp[1]=2
end

if S[0]!=S[1] and S[1]!=S[2]
    dp[2]=3
else
    dp[2]=2
end
3.upto(N-1) do|i|
  if S[i-1]==S[i]
    dp[i]=dp[i-3]+2
  else
      dp[i]=dp[i-1]+1
  end
end
puts dp[N-1]

Measured memory_bytes: 16508
#include <iostream>

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;

    if (a == b && b == c) {
        std::cout << 1 << std::endl;
    } else if (a == b || b == c || c == a) {
        std::cout << 2 << std::endl;
    } else {
        std::cout << 3 << std::endl;
    }
}


Measured memory_bytes: 256
N, M = map(int, input().split())
matrix=[[0]*N for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    matrix[a-1][b-1]=1
    matrix[b-1][a-1]=1
import itertools 
count=0
for i in itertools.permutations(range(N)):
    if i[0]==0:
        result=1
        for j in range(N-1):
            result*=matrix[i[j]][i[j+1]]
        if result==1:
            count+=1
    else:
        break
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n;
    cin >> n;
    int A[n];
    int all = 0,ki = 0;

    REP(i,n){
        cin >> A[i];
        all += A[i];
        if(i %2 == 0) ki += A[i];
    }
    all /= 2;
    int ans[n];
    ans[0] = ki - all;
    FOR(i,1,n){
        ans[i] = A[i-1] - ans[i-1]; 
    }

    REP(i,n){
        cout << 2 * ans[i] << " ";
    }
    cout << endl;

    
    

}

Measured memory_bytes: 2816
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,n = map(int,input().split())
if b-1 <= n:
  x = b-1
else:
  x = n
print((a*x//b)-(a*(x//b)))

Measured memory_bytes: 9476
import java.io.*;
import java.util.*;

public class Main {

	static ArrayList<Integer>[] adj;
	static int timer, par[], tin[], tout[];

	static int lca(int u, int v) {
		while (true) {
			if (tin[v] >= tin[u] && tin[v] <= tout[u])
				break;
			u = par[u];
		}
		return u;
	}

	static int[] prefix;

	static void update(int u, int lca) {
		prefix[u]++;
		prefix[lca]--;
	}

	static int dfs(int u, int p) {
		par[u] = p;
		tin[u] = timer++;
		int ans = 0;
		for (int v : adj[u])
			if (v != p) {
				ans += dfs(v, u);
				prefix[u] += prefix[v];
			}
		if (prefix[u] > 0)
			ans++;
		tout[u] = timer - 1;
		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		adj = new ArrayList[n];
		par = new int[n];
		tin = new int[n];
		prefix = new int[n];

		tout = new int[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList();
		}
		for (int i = 1; i < n; i++) {
			int u = sc.nextInt() - 1, v = sc.nextInt() - 1;
			adj[u].add(v);
			adj[v].add(u);
		}
		dfs(0, 0);
		int[][] lca = new int[n][n];
		int m = sc.nextInt();
		int[] a = new int[m], b = new int[m];
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			lca[a[i]][b[i]] = lca(a[i], b[i]);
		}
		long ans = 0;
		for (int msk = 0; msk < 1 << m; msk++) {
			Arrays.fill(prefix, 0);
			for (int i = 0; i < m; i++) {
				if ((msk & 1 << i) == 0)
					continue;
				update(a[i], lca[a[i]][b[i]]);
				update(b[i], lca[a[i]][b[i]]);

			}
			int c = dfs(0, 0);

			ans += (1L << (n - 1 - c)) * (Integer.bitCount(msk) % 2 == 0 ? 1 : -1);
		}
		out.println(ans);
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

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

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

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

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

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

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

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

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}

Measured memory_bytes: 341924
#include <stdio.h>

int main(void)
{

        int a,b,c,d;

        scanf("%d%d%d%d",&a,&b,&c,&d);

        if (a+b==c+d)
                printf("Balanced\n");
        else if (a+b<c+d)
                printf("Right\n");
        else
                printf("Left\n");

        return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
using namespace std;
typedef long long ll;
ll N;

// cur = 現在 use = 753のどれを使ったか
// フラグをintで実装するのは無理、バイナリを駆使しよう
void dfs(ll cur, ll use, long long &ans) {
  if(cur > N) return;
  if(use == 0b111) ans++;

  dfs(cur * 10 + 7, use | 0b001, ans);
  dfs(cur * 10 + 5, use | 0b010, ans);
  dfs(cur * 10 + 3, use | 0b100, ans);

}

int main() {
  cin >> N;
  ll res = 0;
  dfs(0, 0, res);
  cout << res << endl;
}

Measured memory_bytes: 256
import heapq
n = int(input())
A = list(map(lambda x: int(x)*(-1),input().split()))
heapq.heapify(A)
# even if you heapfied your list the type is still list
#print(type(A))
al = []
bo = []
for i in range(n):
  if i % 2 == 0:
    al.append(heapq.heappop(A)*(-1))
  else:
    bo.append(heapq.heappop(A)*(-1))
print(sum(al)-sum(bo))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<queue>
using namespace std;
#define rep(i, n) for (int i=0; i<(int) (n);i++)
using ll = long long;
using P = pair<int,int>;

void solve_8(){//7m
    string a, b;
    cin >> a >> b;
    string tmp =  a+b;
    int c = atoi(tmp.c_str());
    //cout << c << endl;
    int c_square = sqrt(c);
    cout << (c_square * c_square == c? "Yes": "No") << endl;
    
}

void solve_8re(){
    string a, b;
    cin >> a >> b;
    //stoi -> int
    //stol -> long
    //stof -> float
    int c = stoi(a+b);
    int c_square = sqrt(c);
    cout << (c_square * c_square == c? "Yes": "No")<< endl;
}

void solve_9(){//12m
    int n,k;
    cin >> n >> k;
    int sum_distance = 0;
    rep(i, n){
        int x;
        cin >> x;
        sum_distance += 2 * min(x, k-x);
    }
    cout << sum_distance;
}

void solve_10(){//7m
    int n;
    cin >> n;
    priority_queue<int> pq;
    int a;
    rep(i, n){
        cin >> a;
        pq.push(a);
    }
    int alice = 0, bob = 0;
    int turn = 0;
    while(!pq.empty()){
        a = pq.top();
        pq.pop();
        if (turn % 2 == 0){
            alice += a;
        }
        else{
            bob += a;
        }
        turn += 1;
    }
    cout << alice - bob;
    
}
#include<algorithm>
void solve_10re(){
    int n;
    cin >> n;
    vector<int> a;
    int a_;
    rep(i, n){
        cin >> a_;
        a.push_back(a_);
    }
    sort(a.begin(), a.end(), greater<int>());
    int total = 0;
    rep(i, n){
        total += (i%2==0?a[i]:-a[i]);
    }
    cout << total;
}

void solve_11(){//7m
    int n;
    cin >> n;
    int score;
    rep(i,7){
        if (n >= pow(2, i))
        {
            score = pow(2,i);
        }
    }
    cout << score;
}

void solve_12(){
    int a, b, c;
    cin >> a >> b >> c;
    int count = 0;
    int tmp_a, tmp_b, tmp_c;
    while(a%2==0 && b%2==0 && c%2==0){
        if (a==b && b == c && c == a)
        {
            count = -1;
            break;
        }
        
        tmp_a = b/2 + c/2;
        tmp_b = a/2 + c/2;
        tmp_c = a/2 + b/2;
        a = tmp_a;
        b = tmp_b;
        c = tmp_c;
        count++;
    }
    cout << count << endl;

}

void solve_F(){
    
}

int main(){
    //solve_8re();
    //solve_9();
    //solve_10re();
    solve_12();
    //solve_E();
    //solve_F();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    string s;
    cin >> s;
    int a = (s[0]-'0')*10 + (s[1]-'0');
    int b = (s[2]-'0')*10 + (s[3]-'0');
    if( a <= 12 && a >= 1 && b <= 12 && b >= 1 ){
        cout << "AMBIGUOUS\n";
    }else if( a >= 1 && a <= 12  ){
        cout << "MMYY\n";
    }else if( b >= 1 && b <= 12 ){
        cout << "YYMM\n";
    }else{
        cout << "NA\n";
    }
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;
const int mod2 = 998244353;

int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};

int main() {
  std::cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::setprecision(20) << std::fixed;

  long long x;
  cin >> x;

  vector<pair<long long, long long>> factor;
  factor.push_back(make_pair(0, 0));

  long long a = 1;
  const long long limit = 1e12;
  while (a * a * a * a * a < limit) {
    factor.push_back(make_pair(a, a * a * a * a * a));
    factor.push_back(make_pair(-a, -a * a * a * a * a));
    a++;
  }

  int n = (int)factor.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (factor[i].second - factor[j].second == x) {
        cout << factor[i].first << " " << factor[j].first << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3624
//
//  main.cpp
//  ABC155C
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(int argc, const char * argv[]) {
    int N;
    cin>>N;
    string S;
    map<string,int>poll;
    int great=0;
    for (int i=0; i<N; i++) {
        cin>>S;
        if (poll.count(S)==0) { // 初出
            poll[S]=1;
        }else{
            poll[S]++; // 既出
        }
        great=max(poll[S],great); // 出現回数の最大値 great
    }
    vector<string>ans; // 出現回数が最大値のものをリストアップする
    for (auto itr=poll.begin(); itr!=poll.end(); ++itr) {
        if(itr->second==great){
            ans.push_back(itr->first);
        }
    }
    // sort(ans.begin(),ans.end()); // 昇順（辞書順）にソート
    // mapは自動的に昇順（辞書順）にソートされているので不要だった。
    unsigned long length=ans.size();
    for (long i=0; i<length; i++) {
        cout<<ans.at(i)<<endl;
    }
    return 0;
}


Measured memory_bytes: 26868
n, m = map(int, input().split())
ab = [[int(_) for _ in input().split()] for i in range(n)]

ab.sort()
t = m
a = 0
for i in ab:
    if(i[1] <=t):
        t = t - i[1]
        a = a + i[0] * i[1]
    else:
        a = a + i[0] * (t)
        t = 0

    if(t <= 0):
        break
print(a)

Measured memory_bytes: 21604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    int k; cin>>n>>k;
    vi v;
    rep(i,1,k){
        int t; cin>>t;
        v.pb(t);
    }
    v.pb(n+v[0]);
    vi v1;
    rep(i,1,sz(v)-1){
        int t=v[i]-v[i-1];
        ans+=t;
        v1.pb(t);
    }
    sort(all(v1));
    cout<<ans-v1[sz(v1)-1];
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 6000
#include<bits/stdc++.h>
using namespace std;

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  string s,t;cin>>s>>t;
  if(s.size()==t.size()){
    if(s==t)cout<<"EQUAL"<<endl;
    else if(s>t)cout<<"GREATER"<<endl;
    else cout<<"LESS"<<endl;
  }
  else if(s.size()>t.size()){
    cout<<"GREATER"<<endl;
  }
  else cout<<"LESS"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int count(int x) {
    int rel = 0;
    while(x % 2 == 0 && rel < 2) {
        rel++;
        x /= 2;
    }
    return rel;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    int a = 0, b = 0, c = 0;
    rep(i, N) {
        int x; cin >> x;
        if(count(x) == 0) a++;
        else if(count(x) == 1) b++;
        else c++;
    }
    string ans;
    if(b == 0) {
        if(a <= c + 1) ans = "Yes";
        else ans = "No";
    } else {
        if(a <= c) ans = "Yes";
        else ans = "No";
    }
    COUT(ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>
#include<random>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
int d;
int c[30]={};
int s[370][30];
int num=150000;
int calc(vector<int>const& t,vector<vector<int>>& last_list){
  int res=0;
  vector<int> last(30,0);
  rep1(i,d){
    res+=s[i][t[i]];
    last[t[i]]=i;
    last_list[i]=last;
    int buf=0;
    rep1(j,26){
      buf+=c[j]*(i-last[j]);
    }
    res-=buf;
    //cout<<res<<"\n";
  }
  return res;
}
int change(int nd,int nq,int& res,vector<int>& t,vector<vector<int>>& last_list){
  int flag_t=false;
  int flag_q=false;
  int x=t[nd];
  t[nd]=0;
  res+=s[nd][nq];res-=s[nd][x];
  for(int i=nd;i<=d;++i){
    if(flag_t&&flag_q)break;
    if(t[i]==x||flag_t)flag_t=true;
    else{
      res+=c[x]*(i-last_list[i][x]);
      last_list[i][x]=last_list[i-1][x];
      res-=c[x]*(i-last_list[i][x]);
    }
    if(t[i]==nq||flag_q)flag_q=true;
    else{
      res+=c[nq]*(i-last_list[i][nq]);
      last_list[i][nq]=nd;
      res-=c[nq]*(i-last_list[i][nq]);
    }
  }
  t[nd]=nq;
  return res;
}
vector<int> greedy(int d){
  vector<int> res(d+1,0);
  vector<int> last(30,0);
  rep1(i,d){
    int mx=-inf;
    int mx_ind=0;
    rep1(j,26){
      int tmp=s[i][j];
      rep1(k,26){
        if(k==j)continue;
        tmp-=c[k]*(i-last[k]);
      }
      if(mx<tmp){
        mx=tmp;
        mx_ind=j;
      }
    }
    last[mx_ind]=i;
    res[i]=mx_ind;
  }
  return res;
}
signed main(){
  cin>>d;
  rep1(i,26)cin>>c[i];
  rep1(i,d){
    rep1(j,26)cin>>s[i][j];
  }
  vector<int> t=greedy(d);
  vector<vector<int>> last_list(d+1,vector<int>(30,0));
  int res=calc(t,last_list);
  //cout<<res<<"\n";
  rep(xx,num){
    random_device rnd;
    mt19937 mt(rnd());
    int nd=mt()%d+1;
    int nq=mt()%26+1;
    int bq=t[nd];
    int bval=res;
    int hoge=change(nd,nq,res,t,last_list);
    if(hoge<bval){
      change(nd,bq,res,t,last_list);
    }
  }
  rep1(i,d){
    cout<<t[i]<<"\n";
  }
  //cout<<res<<"\n";
  return 0;
}
/*
int m;cin>>m;
  vector<int> bres(m);
  rep(i,m){
    int d,q;cin>>d>>q;
    bres[i]=change(d,q,res,t,last_list);
  }
  rep(i,m){
    cout<<bres[i]<<"\n";
  }
  */

Measured memory_bytes: 3796
#include<iostream>
#include<cstdio>
using namespace std;

int main(){

  int data[9][9][11] = {}; //[b][f][r]
  int b, f, r;
  int v;
  int n;

  cin >> n;
  while(n--){
    cin >> b >> f >> r >> v;
    data[b][f][r] += v;
  }

  for(int i=1;i<5;i++){
    for(int j=1;j<4;j++){
      for(int k=1;k<11;k++) printf(" %d", data[i][j][k]);
      cout << endl;
    }

    if(i != 4){
      for(int j=20;j--;) cout << "#";
      cout << endl;
    }
  }

}

Measured memory_bytes: 1188
#include<stdio.h>

int main () 
{
  int m,n,i,score,check;
  int a[1001];
  
  scanf("%d %d",&n,&m);
  
  score=0;
  
  for (i=1;i<=n;i++)
  {
  scanf("%d",&a[i]);
  score+=a[i];   
  }
  
  check=0;
  for (i=1;i<=n;i++)
  {
	//printf("%f\n",(double) score / (4*m));
    if (a[i] >= (double) score / (4*m))
     {
       check+=1;
       
     }
  }
  
  if (check >= m )
  {
  printf("Yes");
    return 0;
  }
 
  printf("No");
  return 0;
}

Measured memory_bytes: 2148
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int H, W; cin >> H >> W;
	vector<string> vec(H);
	rep(i, 0, H - 1)cin >> vec[i];
	vector<vector<int>> grid(H, vector<int>(W, 0));
	grid[0][0] = 1;
	queue<pair<int, int>> q;
	q.push({ 0,0 });
	int d[] = { 1,0,-1,0 };
	while (!q.empty())
	{
		int x = q.front().second;
		int y = q.front().first;
		q.pop();
		rep(i, 0, 3)
		{
			int nx = x + d[i];
			int ny = y + d[i ^ 1];
			if (0 <= nx && nx < W && 0 <= ny && ny < H && vec[ny][nx] == '.' && grid[ny][nx] == 0)
			{
				grid[ny][nx] = grid[y][x] + 1;
				q.push({ ny,nx });
			}
		}
	}
	int cnt = 0;
	rep(i, 0, H - 1)rep(j, 0, W - 1)
	{
		if (vec[i][j] == '.')++cnt;
	}
	if (grid[H - 1][W - 1] == 0)cout << -1 << endl;
	else cout << cnt - grid[H - 1][W - 1] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=v;
        }
        for(int k=0;k<n;k++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    }
}


Measured memory_bytes: 34092
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back


int main()
{
    ll H, W;
    cin >> H >> W;
    ll Ch, Cw, Dh, Dw;
    cin >> Ch >> Cw >> Dh >> Dw;
    vector<string> S(H+4);
    REP(i,2,H+2) {
        string s;
        cin >> s;
        S[i] = "##" + s + "##";
    }
    REP(i,0,W+4) {
        S[0] += '#';
        S[1] += '#';
        S[H+2] += '#';
        S[H+3] += '#';
    }
    Ch += 1;
    Cw += 1;
    Dh += 1;
    Dw += 1;

    mat D(H+4, vec(W+4, INF));
    queue<pll> Q, R;
    ll cnt = 0;
    Q.push({Ch, Cw});
    D[Ch][Cw] = 0;
    while(!Q.empty()) {
        while(!Q.empty()) {
            pll v = Q.front(); Q.pop();
            ll i = v.first, j = v.second;
            R.push(v);
            if(S[i-1][j] == '.' && D[i-1][j] == INF) {Q.push({i-1, j}); D[i-1][j] = cnt;}
            if(S[i+1][j] == '.' && D[i+1][j] == INF) {Q.push({i+1, j}); D[i+1][j] = cnt;}
            if(S[i][j-1] == '.' && D[i][j-1] == INF) {Q.push({i, j-1}); D[i][j-1] = cnt;}
            if(S[i][j+1] == '.' && D[i][j+1] == INF) {Q.push({i, j+1}); D[i][j+1] = cnt;}
        }
        
        ++cnt;
        
        while(!R.empty()) {
            pll v = R.front(); R.pop();
            ll i = v.first, j = v.second;
            REP(k,-2,3) {
                REP(l,-2,3) {
                    if(S[i+k][j+l] == '.' && D[i+k][j+l] > cnt) {
                        Q.push({i+k, j+l});
                        D[i+k][j+l] = cnt;
                    }
                }
            }
        }
    }

    ll ans = (D[Dh][Dw] == INF) ? -1 : D[Dh][Dw];
    PR(ans);

    return 0;
}

/*



*/

Measured memory_bytes: 13548
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var X = sc.ReadInt();
        var Y = sc.ReadInt();
        var ans = X + Y / 2;
        Console.WriteLine(ans);
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
int main(void)
{
	int x;
	int h;
	int m;
	int s;
	scanf("%d",&x);
	h=x/3600;
	m=x%3600/60;
	s=x%3600%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;

int main() {
	
	int64_t n, k; cin >> n;
	for(int64_t i=1; i*i<=n; i++){
		if(n%i==0) k = i;
	}
	cout << k-1+n/k-1<<endl;
}

Measured memory_bytes: 256
//Dream your Code, Code your Dream [Siriuslight -Subham Pal]
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;    typedef long long ll;    typedef long double ld;
const ll inf = 1e9, N = 1e5+5;
const ll INF = 1e18, MOD = 1e9+7;
ll power(ll a,ll b,ll m=MOD){ll r=1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
ll gcd(ll a,ll b){if(b>a)swap(a,b);if(!b)return a;return gcd(b,a%b);}
 
 
int main(){
    FIO;
    cout << setprecision(10) << fixed;
    int d, n, ctr = 0;
    cin >> d >> n;
    if(n == 100)
        cout << 101;
    else
        cout << n;
    for(int i = 0; i < d; ++i){
        cout << "00";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod =1'000'000'007;

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i,n){
        int x;
        cin >> x;
        mp[x]++;
    }
    for (auto ele : mp){
        if (ele.second > 1){
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 12960
import java.util.*;

public class Main {


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int ans = 0;
        for(int i= 0; i<S.length();i++){
            if(!(S.charAt(i) ==T.charAt(i))){
                ans++;
            }
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 41144
#include <iostream>
#include <string>

using namespace std;

int main() {
	char c;
	string abc = "aiueo";
	cin >> c;
	bool h = false;
	for (int i = 0; i < abc.size(); i++) {
		if (abc[i] == c) {
			h = true;
			break;
		}
	}
	if (h) {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;

int main() {
  int n;
  int count = 0;
  priority_queue<int> que;
  while (cin >> n) {
    que.push(n);
    count++;
  }
  cout << que.top(); que.pop();
  for (int i = 0; i < count-1; i++) {
    cout << " " << que.top(); que.pop();
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>

using namespace std;

const int N=110;

int a[N];

int main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	sort(a,a+n);
	for(int i=0;i<n;i++)
	    for(int j=i+1;j<n;j++)
	        for(int k=j+1;k<n;k++)
	            if(a[i]+a[j]>a[k] && a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k]) ans++;
	cout<< ans <<endl; 
	return 0;
}

Measured memory_bytes: 3764
// AUTHOR : Kishan Srivastav
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main() {
	ios
#ifndef ONLINE_JUDGE
	in;
	out;
#endif
	int n;
	cin>>n;
	map<string, int> m;
	string s;
	for(int i = 0; i < n; i++) {
		cin>>s;
		m[s] += 1;
	}
 
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;
 

}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)

int main(){
    int N;
    cin >> N;
    vector<int> A(N),B(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    long long a = 0,b = 0;
    rep(i,N){
        a += max(0,A[i]-B[i]);
        b += max(0,(B[i]-A[i])/2);
    }
    cout << (b >= a ? "Yes" : "No") << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N; cin >> N;
    map<long long, int> A;
    rep (i, 0, N) {
        long long a; cin >> a;
        if (A.find(a) != A.end()) {
            if (A[a] == 0) ++A[a];
            else --A[a];
        }
        else ++A[a];
    }

    long long ans = 0;
    for (auto a : A) ans += a.second;
    cout << ans << endl;
}

Measured memory_bytes: 6528
#include <stdio.h>

int main(){
	int N,M,K,i,j,Number;
  int count =0;
  	int Ans[50]={0};
  
  scanf("%d %d",&N,&M);
  for(i=0;i<N;i++){
    scanf("%d",&K);
  	for(j=0;j<K;j++){
    	scanf("%d",&Number);
      Ans[Number]++;
    }
  }
    for(i=0;i<=M;i++){
    	if(Ans[i]==N) count++;
    }
  printf("%d",count);
    return 0;
  }

Measured memory_bytes: 128
from collections import deque


def calc_dist(head, my_dict, dist_a):
    deq = deque()
    deq.append((head, 0))
    visited = set()
    visited.add(head)

    while deq:
        ptr, length = deq.pop()
        dist_a[ptr] = length
        for item in my_dict[ptr]:
            if item not in visited:
                visited.add(item)
                deq.append((item, length+1))


n, u, v = map(int, input().split())
my_dict = dict()

for i in range(n-1):
    a, b = map(int, input().split())
    if a in my_dict:
        my_dict[a].append(b)
    else:
        my_dict[a] = [b]
    if b in my_dict:
        my_dict[b].append(a)
    else:
        my_dict[b] = [a]

dist_a = dict()
dist_b = dict()

calc_dist(u, my_dict, dist_a)
calc_dist(v, my_dict, dist_b)
ret = 0

for i in range(1, n+1):
    if dist_a[i] > dist_b[i]:
        continue
    else:
        ret = max(ret, dist_b[i] - 1)

print(ret)


Measured memory_bytes: 58984
#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int ans=0;
     for (int i = 0; i <= a; i++) {
        for(int j = 0;j <= b ;j++){
            int nokori =(x-500*i-100*j);
            if(nokori >= 0 && nokori%50==0 && nokori / 50 <= c){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans = 0;
	ans += min(a,k); k -= a;
	if(k<=0){cout<<ans<<endl; return 0;}
	ans += 0*min(b,k); k -= b;
	if(k<=0){cout<<ans<<endl; return 0;}
	ans -= min(c,k); k -= c;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
main :: IO()
main = do
    [a,b,x] <- map read . words <$> getLine
    putStrLn $ if (getsolve a b x) then "YES" else "NO"
    
getsolve :: Int -> Int -> Int -> Bool
getsolve a b x
    | x < a			= False
    | x-a <= b		= True
    | otherwise		= False

Measured memory_bytes: 508
#include<bits/stdc++.h>

using namespace std;
vector<int> a;
int n;
const int inf = INT_MAX;
vector<int> dp;
int go(int i) {
    if (i == n-1) {
        return 0;
    }

    int ans = dp[i];
    if (ans != -1) {
        return ans;
    }

    int x = inf, y = inf;
    if (i+1 < n)
        x = go(i+1) + abs(a[i] - a[i+1]);
    if (i+2 < n)
        y = go(i+2) + abs(a[i] - a[i+2]);
    ans = min(x, y);
    dp[i] = ans;
    return ans;
}

int main() {

    cin >> n;
    a.resize(n);
    dp.resize(n+1, -1);
    for (int i = 0 ; i < n ; ++i) {
        cin >> a[i];
    }

    cout  << go(0) << endl;
    return 0;
}


Measured memory_bytes: 5760
n,w = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
#l[i][0]が重さ、l[i][1]が価値
#print(n,w,l)

ans = [[0]*(w+1) for i in range(n)]
#print(ans)

for i in range(n):
  for j in range(0,w+1):
    if i == 0 and j >= l[0][0]:
      ans[0][j] = l[0][1]
    elif i > 0:
      new_w = j + l[i][0]
      if new_w <= w:
        ans[i][new_w] = max(ans[i-1][new_w], ans[i-1][j] + l[i][1])
    if ans[i][j] < ans[i-1][j]:
      ans[i][j] = ans[i-1][j]
        
#print(ans)
print(ans[n-1][w])

Measured memory_bytes: 120684
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  string ans;
  if(n <= 999) ans = "ABC";
  else ans = "ABD";
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

void solve()
{
	int n, m, k;
	cin >> n >> m >> k;
	int a[n], b[m];
	int x = inf, y = inf;
	for(int i = 1; i <= n; ++i){
		cin >> a[i];
		x = min(x, a[i]);
	}
	for(int i = 1; i <= m; ++i){
		cin >> b[i];
		y = min(y, b[i]);
	}
	x += y;
	for(int i = 1; i <= k; ++i){
		int xx, yy, zz;
		cin >> xx >> yy >> zz;
		x = min(a[xx] + b[yy] - zz, x);
	}
	cout << x << endl;
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 1024
<?php

$isPrime = new SplFixedArray(1000000);
$cntPrime = new SplFixedArray(1000000);
for ($i = 0; $i < 1000000; $i++) {
    $isPrime[$i] = true;
}
$isPrime[0] = $isPrime[1] = false;
for ($i = 2; $i < 1000 + 1; $i++) {
    if ($isPrime[$i]) {
        for ($j = $i * $i; $j < 1000000; $j += $i) {
            $isPrime[$j] = false;
        }
    }
}
$cnt = 0;
for ($i = 1; $i < 1000000; $i++) {
    if ($isPrime[$i]) {
        $cnt++;
    }
    $cntPrime[$i] = $cnt;
}

while ($n = (int)trim(fgets(STDIN))) {
    echo $cntPrime[$n] . "\n";
}



Measured memory_bytes: 76036