akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

struct union_find {
	vector<int> rnk, par;
	union_find(int n) {
		rnk.resize(n);
		par.resize(n);
		rep(i, rnk.size()) {
			par[i] = i;
			rnk[i] = 0;
		}
	}
	int find(int x) {
		if (par[x] == x) return x;
		return par[x] = find(par[x]);
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rnk[x] < rnk[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rnk[x] == rnk[y])rnk[x]++;
		}
	}
	bool same(int x, int y) {
		return (find(x) == find(y));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<pll> x(n),y(n);
	rep(i,n){
		cin>>x[i].fs>>y[i].fs;
		x[i].sc=y[i].sc=i;
	}
	sort(all(x));
	sort(all(y));
	vector<tlll> e;
	rep(i,n-1){
		e.push_back(tlll(x[i].sc,x[i+1].sc,x[i+1].fs-x[i].fs));
		e.push_back(tlll(y[i].sc,y[i+1].sc,y[i+1].fs-y[i].fs));
	}
	sort(all(e),[](const tlll &a,const tlll &b){
		return get<2>(a) < get<2>(b);
	});
	ll ans=0;
	union_find u(n);
	rep(i,e.size()){
		ll from,to,cost;
		tie(from,to,cost)=e[i];
		if(!u.same(from,to)){
			ans+=cost;
			u.unite(from,to);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 11632
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,A,B;
LL X[100000];

LL ans = 0;

void solve(){
	for(int i=0;i<=N-2;i++){
		ans += min((X[i+1]-X[i])*A,B);
	}
}

int main(){
    cin >> N >> A >> B;
    for(int i=0;i<N;i++) cin >> X[i];

    solve();

	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int h, w, n, x = 0;
    int a[10010];
    int c[110][110]; // = vector<vector<int>> vi(110, vector<int>(110)); たぶん
    cin >> h >> w >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    int index = 0;
    REP(i, h){
        if(i % 2 == 0){
            REP(j, w){
                if(a[index] == 0) index++;
                c[i][j] = index + 1;
                a[index]--;
            }
        }else{
            for(int j = w - 1; j >= 0; j--){
                if(a[index] == 0) index++;
                c[i][j] = index + 1;
                a[index]--;
            }
        }
    }
    REP(i, h){
        REP(j, w) cout << c[i][j] << " ";
        cout << endl;
    }   
    return 0;
}
// O(HW)

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e18;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};

int main(){
  ll n;
  cin >> n;

  ll ans = 0;
  for (ll a = 1; a < n; a++){
    for (ll b = 1; b < n/a + 1; b++){
      if ((n - a * b) > 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> s(n+1);
  rep(i,n){
    int a;
    cin >> a;
    s[i+1] = s[i] + a;
  }
  ll ans = 1e18L;
  rep(i,n-1) ans = min(ans,abs(s[i+1]-s[n]+s[i+1]));
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;




int main(){
	int N,T,_,L;
	cin>>N>>T>>_>>L;
	int t[100],h[100];
	int idx=0;
	int storage=0;
	for(int i=0;i<N;i++){
		cin>>t[i]>>h[i];
	}
	while(1){
		if(t[idx]){
			t[idx]--;
			storage+=10;
			T++;
			if(L<T)break;
		}else if(h[idx]){
			h[idx]--;
			storage+=100;
		}else{
			break;
		}
		if(90<=storage){
			storage-=90;
			t[idx]+=storage/10;
			T-=storage/10;
			storage=0;
			if(T<0)break;
		}
		idx=(idx+1)%N;
	}
	cout<<idx+1<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    double x=0,y=0;
    int now_t=0,p,t;
    
    while(1){
        scanf(" %d,%d",&p,&t);
        
        if(p==0 && t==0) break;
        
        y+=cos(now_t/180.0*PI)*p;
        x+=sin(now_t/180.0*PI)*p;
        
        now_t+=t;
    }
    
    printf("%d\n%d\n",(int)x,(int)y);
    
    return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s, t;
int q;
int sum_s[100001];
int sum_t[100001];

int main() {
	cin >> s >> t >> q;
	
	inc(i, s.size()) { sum_s[i + 1] = sum_s[i] + (s[i] == 'A' ? 1 : 2); }
	inc(i, t.size()) { sum_t[i + 1] = sum_t[i] + (t[i] == 'A' ? 1 : 2); }
	
	inc(i, q) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		
		cout << (((sum_s[b] - sum_s[a - 1]) - (sum_t[d] - sum_t[c - 1])) % 3 == 0 ? "YES" : "NO") << endl;
	}
	
	return 0;
}


Measured memory_bytes: 1664
n=int(input())
l=[input() for i in range(n)]

l=sorted(l)
ll=[]
k=1
for i in range(n-1):
    if l[i]==l[i+1]:
        ll.append(k)
        k+=1
    else:
        ll.append(k)
        k=1
ll.append(k)
c=max(ll)
lll=[]
for i in range(n):
    if ll[i]==c:
        lll.append(l[i])

lll=sorted(set(lll))
for i in lll:
    print(i)


Measured memory_bytes: 32768
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int A = int.Parse(input[0]);
		int B = int.Parse(input[1]);
      	int T = int.Parse(input[2]);
      
      	var ret1 = int.Parse(Math.Floor(T+0.5).ToString());	
      	int ans = (ret1/ A) * B;
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
#include<iostream>
using namespace std;
void Bubble_Sort(char a[],char b[],int n)  //基于flag的冒泡排序 升序   
{
	char temp;
	bool flag = 1; 	//当一趟扫描不存在逆序数的时候，合理的剪枝。 
	for(int i=1;flag;i++){
		flag=0;
	for(int j=0;j<n-i;j++)
	{
		if(b[j]>b[j+1])
		{
			temp = a[j];
			a[j] = a[j+1];
			a[j+1]= temp;
			temp = b[j];
			b[j] = b[j+1];
			b[j+1]= temp;
			flag=1;
		 } 
	}
}
}

void Selection_Sort(char a[],char b[],int n)	//选择排序 
{
	int minj;
	for(int i=0;i<n;i++)
	{
		minj=i ;
	for(int j=i+1;j<n;j++)
	{
		if(b[j]<b[minj])
		{
			minj = j;
		}
	}
	if(i!=minj) 
	{
		swap(a[i],a[minj]);
		swap(b[i],b[minj]); 
	}
	}
}

int isStable(char a[],char b[],char c[],char d[],int n)
{
	for(int i=0;i<n;i++)
	{
		if(a[i]!=c[i])
		{
			cout<<"Not stable"<<endl;
			return 0;
		}
		else if(b[i]!=d[i])
		{
			cout<<"Not stable"<<endl;
			return 0;
		}
		
	}
	cout<<"Stable"<<endl;
	return 0;
}
 
int main()
{
	char in1[40],in2[40];  //原始数据 
	char out1[40],out2[40];// bubble排序数据 
	char out3[40],out4[40];//select排序数据 
	int n;
	cin>>n;
	for(int i = 0;i<n;i++)
	{
		cin>>in1[i]>>in2[i];
		out1[i]=in1[i];
		out2[i]=in2[i];
		out3[i]=in1[i];
		out4[i]=in2[i];
	}
	Bubble_Sort(out1,out2,n);
	for(int i=0;i<n;i++)
	{
		if(i!=n-1)
		cout<<out1[i]<<out2[i]<<' ';
		else
		cout<<out1[i]<<out2[i]<<endl;
		
	}
	cout<<"Stable"<<endl;
	
	Selection_Sort(out3,out4,n);
	for(int i=0;i<n;i++)
	{
		if(i!=n-1)
		cout<<out3[i]<<out4[i]<<' ';
		else
		cout<<out3[i]<<out4[i]<<endl;		
	}
	 isStable(out1,out2,out3,out4,n);
	return 0;
	
}


Measured memory_bytes: 3100
// Something on it
#include <iostream>
using namespace std;

int main() {
    string S;
    int money = 700;

    cin >> S;
    if (S[0] == 'o') money += 100;
    if (S[1] == 'o') money += 100;
    if (S[2] == 'o') money += 100;

    cout << money << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);

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

    vector<int> left(n), right(n);

    left[0] = a[0];
    for(int i = 1;i < n;i++) left[i] = max(left[i-1], a[i]);
    right[n-1] = a[n-1];
    for(int i = n-2;i > -1;i--) right[i] = max(right[i+1], a[i]);

    int m;
    for(int i = 0;i < n;i++){
        if(i > 0){
            m = left[i-1];
        }
        if(i < n-1){
            m = max(m, right[i+1]); 
        }
        cout << m << endl;
    }

    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n,ac,wa,tle,re;cin >>n;
    ac=wa=tle=re=0;
    for (int i = 0; i < n; ++i) {
        string s;cin >>s;
        if(s=="AC")ac++;
        if(s=="WA")wa++;
        if(s=="TLE")tle++;
        if(s=="RE")re++;
    }
    cout <<"AC x "<<ac<<endl;
    cout <<"WA x "<<wa<<endl;
    cout <<"TLE x "<<tle<<endl;
    cout <<"RE x "<<re<<endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <string>
#include <math.h>
using namespace std;

int main(){
    long long int n,ans=4000000,s=0;
    cin>>n;
    vector<long long int>a(100);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=-100;i<=100;i++){
        for(int j=0;j<n;j++){
            s+=(i-a[j])*(i-a[j]);
        }
        if(ans>s){
            ans=s;
        }
        s=0;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string S, T;
    cin >> S >> T;
    int cnt = 0;
    for(int i = 0; i < 3; i++) {
        if(S[i] == T[i]) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
    string s;
    bool a;
    cin >> s;
    
    if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    
}

Measured memory_bytes: 3644
import Data.List

tab = [("black",    0,  0,  0),
       ("blue",     0,  0,255),
       ("lime",     0,255,  0),
       ("aqua",     0,255,255),
       ("red",    255,  0,  0),
       ("fuchsia",255,  0,255),
       ("yellow", 255,255,  0),
       ("white",  255,255,255)]

h2d x = read ("0x"++x) :: Int

ans x =
  let r = h2d $ take 2 $ drop 1 x
      g = h2d $ take 2 $ drop 3 x
      b = h2d $ take 2 $ drop 5 x
      d = map (\ (c,r1,g1,b1) -> (c, (r1-r)^2+(g1-g)^2+(b1-b)^2 ) ) tab
      s = sortBy (\ (c0,d0) (c1,d1) -> compare d0 d1 ) d
  in
    fst $ head s
      
main = do
  c <- getContents
  let i = takeWhile (/= "0") $ lines c
      o = map ans i
  mapM_ putStrLn o

Measured memory_bytes: 4352
//agc015f
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<map>
#include<set>
#include<algorithm>
#include<queue>
#include<time.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define fe(x) for(int ii=be[x];ii;ii=e[ii].ne)
using namespace std;
const int ft=90,p=1e9+7;
int q,len;
long long n,m,f[100],ans;
struct nod{
	long long a,b;
};
nod g[100][100];
int main(){
	f[1]=1;f[2]=2;fo(i,3,ft) f[i]=f[i-1]+f[i-2];
	g[0][0].a=g[0][0].b=1;
	fo(i,1,ft-1){
		fo(j,0,i-1){
			g[i][j].a=g[i-1][j].a+g[i-1][j].b;
			g[i][j].b=g[i-1][j].a;
		}
		g[i][i].a=f[i+2];g[i][i].b=f[i];
		/*if (i==ft-1){
			printf("------%d----\n",i);
			fo(j,0,i) printf("%I64d %I64d\n",g[i][j].a,g[i][j].b);
		}*/
	}
	scanf("%d",&q);
	while (q--){
		scanf("%lld%lld",&n,&m);
		if (n>m) swap(n,m);
		if (n==1){
			printf("1 %lld\n",m%p);
			continue;
		}
		fd(i,ft-1,1) if (f[i]<=n&&f[i+1]<=m){
			len=i;
			break;
		}
		if (len==1){
			printf("1 %lld\n",(n%p)*(m%p)%p);
			continue;
		}
		ans=0;
		fo(i,0,len-1){//0..len!!!!!
			if (g[len][i].b<=n&&g[len][i].a<=m) ans+=(m-g[len][i].a)/g[len][i].b+1;
			if (g[len][i].a<=n) ans++;
			ans%=p;
		}
		printf("%d %lld\n",len,ans);
	}
	return 0;
}


Measured memory_bytes: 4096
#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;

    ll ans = 0;
    REP(i,N){
        int a; cin >> a;
        while(a%2==0){
            a/=2; ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3612
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

	class Pair implements Comparable<Pair>{
		String s;
		Integer cnt;
		Pair(String s, Integer cnt){
			this.s=s;
			this.cnt=cnt;
		}
		@Override
		public int compareTo(Pair arg0) {
			if(this.cnt==arg0.cnt) {
				return this.s.compareTo(arg0.s);
			}
			return arg0.cnt.compareTo(this.cnt);
		}
	}
	public void run() {
		Scanner sc = new Scanner(System.in);
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		int n=sc.nextInt();
		for(int i=0; i<n; i++) {
			String s = sc.next();
			map.put(s, map.containsKey(s) ? map.get(s)+1 : 1);
		}
		ArrayList<Pair> list = new ArrayList<Pair>();
		for(Map.Entry<String, Integer> e : map.entrySet()) {
			list.add(new Pair(e.getKey(),e.getValue()));
		}
		Collections.sort(list);
		int cnt = list.get(0).cnt;
		System.out.println(list.get(0).s);
		for(int i=1; i<list.size(); i++) {
			if(list.get(i).cnt==cnt) {
				System.out.println(list.get(i).s);
				continue;
			}
			break;
		}
		sc.close();
	}
}


Measured memory_bytes: 93008
def main():
    bingo = []
    for ss in range(3):
        s = list(map(int,input().strip().split()))
        bingo.append(s)
    
    n = int(input())
    nl = []
    for nn in range(n):
        nl.append(int(input()))
    
    for i in range(3):
        for j in range(3):
            for n in nl:
                if bingo[i][j] == n:
                    bingo[i][j] = -1
    
    for i in range(3):
        if bingo[0][i] == bingo[1][i] == bingo[2][i] == -1:
            print("Yes")
            return
        if bingo[i][0] == bingo[i][1] == bingo[i][2] == -1:
            print("Yes")
            return
    
    if bingo[0][0] == bingo[1][1] == bingo[2][2] == -1:
        print("Yes")
        return
    if bingo[0][2] == bingo[1][1] == bingo[2][0] == -1:
        print("Yes")
        return
    
    print("No")
    return

    
main()


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

typedef long long int ll;

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll a,b;
    cin>>a>>b;

    if(a==b){
        cout<<a<<endl;return 0;
    }

    ((a+b)%2) ? cout<<"IMPOSSIBLE" : cout<<(a+b)/2<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i, b, n) for(int i=b;i<(int)n;i++)
#define rep(i, n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it, o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

//ハマったらチェックリスト見ろ!!

int main() {
    string s;
    int w;
    cin >> s >> w;
    for(int i = 0; i<s.length(); i+=w){
        cout << s[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 888
K=int(input())

D=[0]*12
kt=0

def up(i):
    global kt
    u = 1
    while u:
        kt = max(kt, i)
        D[i] += u
        if D[i] >= 10:
            D[i] = 0
            u = 1
        else: u = 0
        i += 1

def down(i,d):
    for j in range(i, -1, -1):
        if d >= 1: d -= 1
        D[j] = d

for i in range(K):
    up(0)
    j = 0
    while j < kt:
        if abs(D[j] - D[j+1]) > 1:
            if D[j+1] < D[j]: up(j+1)
            D[j] = D[j+1] - 1
            if j > 0: down(j-1, D[j])
        j += 1

f = True
for d in reversed(D):
    if f and d==0: continue
    f = False
    print(d, end='')

Measured memory_bytes: 45020
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vi vector<int>
using namespace std;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;



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

    for(int i = 0 ; ; ++i){
        int n1 = x - i ; 
        int n2 = x + i ; 
        if(ma[n1] == 0) {
            cout << n1 ;
            break ; 
        }
        if(ma[n2] == 0)
        {
            cout << n2 ; 
            break ; 
        }
    }


    return 0 ; 
}

Measured memory_bytes: 3640
#include <stdio.h>
int main()
{
  long long int A, B, C, K;
  scanf("%lld %lld %lld %lld", &A, &B, &C, &K);
  if( K%2 == 0)
  {
    printf("%lld\n", A-B);
  }
  else
  {
    printf("%lld\n", B-A);
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int a, b, c, d;
		Scanner scan = new Scanner(System.in);

		a = scan.nextInt();
		b = scan.nextInt();
		c = scan.nextInt();
		d = scan.nextInt();

		int count = 0;
		while(a > 0 && c > 0) {
			count++;
			if(count % 2 != 0) {
				c -= b;
			} else {
				a -= d;
			}
		}

		if(a <= 0) {
			System.out.println("No");
		} else if(c <= 0) {
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 27040
#include <stdio.h>
#include <math.h>

/** Application main entry point. */
int main (
  int argc,
  char *argv[ ]
  )
{
  int x, h;

  scanf ( "%d %d", &x, &h );
  while ( x != 0 || h != 0 )
  {
    printf (
      "%lf\n",
      x * x + 2. * x * sqrt ( x * x / 4. + h * h )
      );

    scanf ( " %d %d", &x, &h );
  }

  return ( 0 );
}

Measured memory_bytes: 0
import numpy as np

n,l = map(int,input().split())
taste = []
taste_diff = []

for i in range(1,n+1):
    taste.append(l+i-1)

#print(taste)
s = sum(taste)

for i in range(len(taste)):
    taste_diff.append(s-taste[i])

#print(taste_diff)

def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

print(getNearestValue(taste_diff, s))



Measured memory_bytes: 27196
#include<iostream>
 #include<string>
 using namespace std;

 int main()
 {
    int y,m,d;
    scanf("%d/%d/%d",&y,&m,&d);
    if(y<2019){
        cout<<"Heisei"<<endl;
    }
    else if(y==2019){
        if(m<4 || (m==4 && d<=30)){ cout << "Heisei"<<endl;}
        else { cout << "TBD" << endl;}
    }
    else { cout << "TBD" << endl;}
    
    return 0;
 }


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, M; cin >> N >> M;
	vi arr (N);
	F0R(i, N) cin >> arr[i];
	map<int, int> occ;
	map<int, int> occMod; 
	map<int, int> pairMod;
	
	for (int x : arr) {
		occ[x]++;
		occMod[x%M]++;
		if (occ[x] % 2 == 0) pairMod[x%M]++;
	}

	int ans = 0;
	for (int i = 1; 2*i < M; ++i) {
		int use = min(occMod[i], occMod[M-i]);
		occMod[i] -= use;
		occMod[M-i] -= use;
		ans += use;
		ans += min(occMod[i]/2,   pairMod[i]);
		ans += min(occMod[M-i]/2, pairMod[M-i]);
	}

	ans += occMod[0] / 2;
	if (M % 2 == 0) ans += occMod[M/2] / 2;
	print(ans);
}

Measured memory_bytes: 17544
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int N; cin >> N;

    cout << 180*(N-2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  random_device rnd;
  mt19937 mt(rnd());
  int D;
  cin >> D;
  vector<int> c(26);
  for (int i = 0; i < 26; i++){
    cin >> c[i];
  }
  vector<vector<int>> s(D, vector<int>(26));
  for (int i = 0; i < D; i++){
    for (int j = 0; j < 26; j++){
      cin >> s[i][j];
    }
  }
  vector<int> last(26, -1);
  for (int i = 0; i < D; i++){
    int t = min(10, D - i);
    vector<vector<int>> L(t, vector<int>(26, 0));
    for (int j = 0; j < t; j++){
      for (int k = 0; k < 26; k++){
        L[j][k] = c[k] * (i + j - last[k]);
      }
    }
    int mx = 0;
    int a = 0;
    for (int j = 0; j < 2000; j++){
      vector<int> next(t, 0);
      for (int k = 0; k < t; k++){
        next[k] = mt() % 26;
      }
      //calculate diff
      int diff = 0;
      for (int k = 0; k < t; k++){
        diff += s[i + k][next[k]];
        for (int l = k; l < t; l++){
          diff += L[l][next[k]] - (l - k) * c[next[k]];
          L[l][next[k]] = (l - k) * c[next[k]];
        }
      }
      if (diff > mx){
        mx = next[0];
      }
    }
    cout << mx + 1 << endl;
    last[mx] = i;
  }
}

Measured memory_bytes: 3692
#define M 10000000
char T[M+1];
main(i,j){
	for(i=2;i<=M;i++)
		if(!T[i])
			for(j=i*2;j<=M;j+=i)T[j]=1;
	for(;scanf("%d",&i),i;printf("%d\n",i))
		for(i-=i%2?0:1;T[i]||T[i-2]||T[i-6]||T[i-8];i-=2);
	exit(0);
}

Measured memory_bytes: 10364
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	int N;
	string S;
	cin >> N >> S;
	int ans=N;
	for(int i=0; i+1<N; ++i){
	    if(S[i]==S[i+1]) --ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    N %= 10;
    int[] a = {2,4,5,7,9};
    int[] b = {0,1,6,8};
    int[] c = {3};
    for (int x:a) {
      if (N == x) System.out.println("hon");
    }
    for (int x:b) {
      if (N == x) System.out.println("pon");
    }
    for (int x:c) {
      if (N == x) System.out.println("bon");
    }
  }
}

Measured memory_bytes: 35756
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

template<class T>
vector<T> divisor(T n) {
    vector<T> ret;
    for (T i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != n / i) ret.push_back(n / i);
        }
    }
    return move(ret);
}

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    vector<int> d = divisor(N);
    for(auto i:d){
        if(i<=9 && N/i<=9){
            cout <<"Yes" << nn;
            return 0;
        }
    }
    cout << "No" << nn;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int[] p = new int[a];
		int[] q = new int[b];
		int[] r = new int[c];
		for (int i = 0; i < a; i++) {
			p[i] = sc.nextInt();
		}
		for (int i = 0; i < b; i++) {
			q[i] = sc.nextInt();
		}
		for (int i = 0; i < c; i++) {
			r[i] = sc.nextInt();
		}
		sc.close();

		Arrays.sort(p);
		Arrays.sort(q);
		Arrays.sort(r);

		int[] apple = new int[x + y + c];

		for (int i = 0; i < x; i++) {
			apple[i] = p[a - 1 - i];
		}
		for (int i = 0; i < y; i++) {
			apple[x + i] = q[b - 1 - i];
		}
		for (int i = 0; i < c; i++) {
			apple[x + y + i] = r[i];
		}

		Arrays.sort(apple);
		long taste = 0;

		for (int i = 0; i < x + y; i++) {
			taste = taste + apple[x + y + c - 1 - i];
		}
		print(taste);

	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}


Measured memory_bytes: 94880
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll dp[3001][3001][3], a[3001][3001];

int main() {
    ll r,c,items, x , y, v, maxi = 0;
    cin >> r >> c >> items;
    while(items--) {
    	cin >> x >> y >> v;
    	x--, y--;
    	dp[x][y][0] = a[x][y] = v;
    }
    for(int i=0;i<r;i++) for(int j=0;j<c;j++) {
        for(int k=0;k<3;k++) {
            if(k > 0) dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1]);
            if(j+1 < c) dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
            if(j+1 < c && k > 0) dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k-1] + a[i][j+1]);
        }
        if(i+1 < r) dp[i+1][j][0] = dp[i+1][j][1] = dp[i+1][j][2] = max({dp[i][j][0], dp[i][j][1], dp[i][j][2]}) + a[i+1][j];
    }
    maxi = dp[r-1][c-1][2];
    cout << maxi;
	return 0;
}

Measured memory_bytes: 284668
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n, m;
    cin >> n >> m;
    struct point {int x; int y;};
    vector<point> s(n), t(m);
    repeat(i, n) cin >> s[i].x >> s[i].y;
    repeat(i, m) cin >> t[i].x >> t[i].y;
    
    auto man_dis = [](const point s, const point t) -> int {
        return abs(s.x - t.x) + abs(s.y - t.y);
    };
    
    repeat(i, n) {
        int goal_pos;
        int min_dis = 1e9;
        repeat(j, m) {
            int dis = man_dis(s[i], t[j]);
            if (dis < min_dis) {
                min_dis = dis;
                goal_pos = j;
            }
        }
        cout << goal_pos + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
    double n,d,raiz;
    int contador=0;
    long long int x,y,var;

    scanf("%lf %lf",&n,&d);

    for(int i =0;i<n;i++){
        scanf("%lld %lld",&x,&y);
        var= x*x + y*y;

        raiz= sqrt(var);

        if(raiz<=d){
            contador++;
        }
    }

    printf("%d\n",contador);







    return 0;
}


Measured memory_bytes: 2184
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H);
    REP(i, 0, H) cin >> S[i];

    vector<vector<int>> L(H, vector<int>(W, 0));
    vector<vector<int>> R(H, vector<int>(W, 0));
    vector<vector<int>> U(H, vector<int>(W, 0));
    vector<vector<int>> D(H, vector<int>(W, 0));

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '.') {
                if (j > 0) {
                    L[i][j] = L[i][j - 1] + 1;
                } else {
                    L[i][j] = 1;
                }
            }
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = W - 1; j >= 0; j--) {
            if (S[i][j] == '.') {
                if (j < W - 1) {
                    R[i][j] = R[i][j + 1] + 1;
                } else {
                    R[i][j] = 1;
                }
            }
        }
    }
    for (int j = 0; j < W; j++) {
        for (int i = 0; i < H; i++) {
            if (S[i][j] == '.') {
                if (i > 0) {
                    D[i][j] = D[i - 1][j] + 1;
                } else {
                    D[i][j] = 1;
                }
            }
        }
    }
    for (int j = 0; j < W; j++) {
        for (int i = H - 1; i >= 0; i--) {
            if (S[i][j] == '.') {
                if (i < H - 1) {
                    U[i][j] = U[i + 1][j] + 1;
                } else {
                    U[i][j] = 1;
                }
            }
        }
    }

    int ans = 0;
    REP(i, 0, H) REP(j, 0, W) ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 67200
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long int
#define LL_MAX 9223372036854775807
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define vl vector<ll>
#define bs(v, x) binary_search(v.begin(), v.end(), x)
#define popf pop_front
#define p() cout << '\n'
#define p0(x) cout << x << " "
#define p1(x) cout << x << '\n'
#define p2(x, y) cout << x << " " << y << '\n'
#define p3(x, y, z) cout << x << " " << y << " " << z << '\n'
#define printv(v)                   \
  for (ll i = 0; i < v.size(); ++i) \
    cout << v[i] << " ";            \
  cout << '\n'
#define pr1(x) cout << fixed << setprecision(15) << x << '\n'
#define mod 1000000007
#define mod1 998244353
#define fio                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define get(n) \
  ll n;        \
  cin >> n
#define getvec(v, n)         \
  vector<ll> v(n);           \
  for (ll i = 0; i < n; i++) \
    cin >> v[i];
#define getstr(s) \
  string s;       \
  cin >> s
#define all(x) x.begin(), x.end()
#define countBits(x) __builtin_popcount(x)
using namespace std;

void mainSolve()
{
  get(n);
  get(k);
  getvec(v, n);
  vl dp(n, 1);
  //printv(v);
  set<pair<ll, ll>> s;
  s.insert({1, 0});
  s.insert({-1, -1});
  ll ans = 1;
  for (int i = 1; i < n; i++)
  {
    auto it = s.rbegin();
    for (auto it = s.rbegin(); it != s.rend(); it++)
    {
      int pos = (*it).second;
      ll len = (*it).first;
      if (len == -1)
        break;
      if (abs(v[pos] - v[i]) <= k)
      {
        dp[i] = max(dp[i], len + 1ll);
        ans = max(ans, dp[i]);
        break;
      }
    }
    s.insert({dp[i], i});
  }
  p1(ans);
}

int main()
{
  fio;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  //get(t);
  ll t = 1;
  while (t--)
  {
    mainSolve();
  }
  return 0;
}


Measured memory_bytes: 26540
#include <bits/stdc++.h>
#include <regex>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(5)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef complex<double> Point;
typedef long long ll;
const int INF = 1145141919;
const int MOD = 100000007;
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator > (const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///


int main()
{
	int w, d;
	while (cin >> w >> d, w)
	{
		vi f(w), s(d);
		REP(i, w) cin >> f[i];
		REP(i, d) cin >> s[i];
		sort(ALL(f)); sort(ALL(s));
		int cnt = 0;
		while (f.size() || s.size())
		{
			if (f.size() > 0 && s.size() > 0)
			{
				if (f.back() == s.back())
				{
					cnt += f.back();
					f.pop_back(); s.pop_back();
				}
				else if (f.back() > s.back())
				{
					cnt += f.back();
					f.pop_back();
				}
				else
				{
					cnt += s.back();
					s.pop_back();
				}
			}
			else if (f.size() == 0)
			{
				cnt += s.back();
				s.pop_back();
			}
			else
			{
				cnt += f.back();
				f.pop_back();
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int k, a, b;
    cin >> k >> a >> b;
    cout << (a%k == 0 || b%k == 0 || a/k != b/k ? "OK" : "NG") << endl;
    return 0;
}


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

using namespace std;

int main(){
int K;cin>>K;
  int X;cin>>X;
  
  long mini = max(-1000000, X-K+1);
  long mx = min(1000000, X+K-1);
  for(long i = mini; i <= mx; i++){
    cout<<i<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
public static void main(String [] args) {
  int total = 0;
  Scanner sc = new Scanner (System.in);
  String line = sc.nextLine();
  for(int I = 0; I < line.length(); I++){
    char c = line.charAt(I);
    if (c == '1') {
    total++;
    }
  }
  System.out.println(total);

}}


Measured memory_bytes: 21716
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

macro_rules! trace {
    ($var:expr) => ({
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    })
}
macro_rules! swap { ($a:expr, $b:expr) => ({ let t = $b; $b = $a; $a = t; }) }

fn eval(s: &Vec<u64>, a: &Vec<usize>) -> u64 {
    let mut r: u64 = 0;
    let mut ac: u64 = s[0];
    let n = s.len();
    for i in 1..n {
        if a[i-1] == 0 {
            ac = ac * 10 + s[i];
        } else {
            r += ac;
            ac = s[i];
        }
    }
    r += ac;
    // trace!((s, a, r));
    return r
}

fn main() {
    let mut sc = Scanner::new();
    let s: String = sc.cin();
    let cs: Vec<u64> = s.chars().map(|c| (c as u64) - ('0' as u64)).collect();
    let n = s.len();
    if n == 1 {
        println!("{}", s);
    } else {
        let mut ans: u64 = 0;
        for a in PowerPermutation::new(2, n - 1) {
            ans += eval(&cs, &a);
        }
        println!("{}", ans);
    }
}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
    fn get_char(&mut self) -> char {
        self.reserve();
        let head = self.buffer[0].chars().nth(0).unwrap();
        let tail = String::from( &self.buffer[0][1..] );
        if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); }
        head
    }
}
struct PowerPermutation { n: usize, m: usize, ar: Vec<usize> }
impl PowerPermutation {
    fn new(n: usize, m: usize) -> PowerPermutation {
        let ar = vec![0; m];
        PowerPermutation { n: n, m: m, ar: ar }
    }
}
impl Iterator for PowerPermutation {
    type Item = Vec<usize>;
    fn next(&mut self) -> Option<Vec<usize>> {
        if self.ar[self.m-1] >= self.n { return None }
        let r = self.ar.clone();
        self.ar[0] += 1;
        for i in 0..self.m-1 {
            if self.ar[i] == self.n {
                self.ar[i] = 0;
                self.ar[i + 1] += 1;
            } else {
                break;
            }
        }
        return Some(r);
    }
}


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int val,n;
cin>>val>>n;
int arr[n];

int sum=0;
for(int i=0;i<n;i++)
{
    cin>>arr[i];
    sum+=arr[i];
}
if(sum>=val)
{
    cout<<"Yes"<<endl;
}
else
    cout<<"No"<<endl;
    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;

int main(){
  int N; cin>>N;
  vector<ll> A(N),B(N),C(N); rep(i,N)cin>>A.at(i)>>B.at(i)>>C.at(i);
  vector<ll> dpa(N,A.at(0)),dpb(N,B.at(0)),dpc(N,C.at(0));
  rep1(i,N-1){
    dpa.at(i) = max(dpb.at(i-1),dpc.at(i-1))+A.at(i);
    dpb.at(i) = max(dpc.at(i-1),dpa.at(i-1))+B.at(i);
    dpc.at(i) = max(dpa.at(i-1),dpb.at(i-1))+C.at(i);
  }
  cout<<max({dpa.at(N-1),dpb.at(N-1),dpc.at(N-1)})<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  vi L(n),R(n);
  rep(i,n) L[i+1] = L[i]+(s[i]=='W');
  reverse(rng(s));
  rep(i,n) R[i+1] = R[i] +(s[i]=='E');

  int mi = 1001001001;
  rep(i,n){
    int numW = L[i];
    int numE = R[n-i-1];
    mins(mi,numW+numE);
  }
  print(mi);
  return 0;
}

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

int main() {
  string s,X="";
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='0'){
      X +='0';
    }
    else if(s.at(i)=='1'){
      X +='1';
    }
    else{
      if(!X.empty()){
      X.pop_back();
      }
    }
  }
      cout << X << endl; 
}

Measured memory_bytes: 256