akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+123;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ a%=MOD;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=MOD;--b;}a*=a;a%=MOD;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    char c;
    cin>>c;
    c++;
    cout<<c el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


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

int main() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0;i < n;++i)cin >> a[i];
	long long sum = 0, ans[2] = {};
	for (int j = 0;j < 2;++j) {
		sum = 0;
		for (int i = 0;i < n;++i) {
			if (i % 2 == j) {//+
				sum += a[i];
				if (sum <= 0) {
					ans[j] += 1 - sum;
					sum = 1;
				}
			}
			else {//-
				sum += a[i];
				if (sum >= 0) {
					ans[j] += 1 + sum;
					sum = -1;
				}
			}
		}
	}
	cout << min(ans[0],ans[1]) << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
using namespace std;
int f[4][4];
int main() {
    cin >> f[1][1] >> f[1][2] >> f[2][2];
    int s = f[2][2] * 3;
    f[1][3] = s - f[1][1] - f[1][2];
    f[3][2] = s - f[1][2] - f[2][2];
    f[3][3] = s - f[1][1] - f[2][2];
    f[3][1] = s - f[1][3] - f[2][2];
    f[2][1] = s - f[1][1] - f[3][1];
    f[2][3] = s - f[1][3] - f[3][3];
    for (int i = 1; i <= 3; ++i) {
        for (int j = 1; j <= 3; ++j)
            cout << f[i][j] << " ";
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)998244353, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    int n, k, i, a[1003], ans;

    scanf("%d%d", &n, &k);
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    
    sort(a, a + n);

    ans = 0;
    for (i = 0; i < k; i++) {
        ans += a[i];
    }

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

    return 0;
}

Measured memory_bytes: 3764
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

char input[maxn];
stack <int> s;

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    scanf("%s", input + 1);

    int answer = 0;
    int n = strlen(input + 1);
    for(int i = 1; i <= n; i++)
    {
        if(s.empty())
        {
            s.push(input[i] - '0');
            continue;
        }
        int last = s.top();
        int cur = input[i] - '0';
        if(cur + last == 1)
        {
            s.pop();
            answer += 2;
            continue;
        }
        s.push(cur);
    }
    printf("%d\n", answer);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


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

using namespace std;

int main() {

	long n;
	long total;

	cin >> n;

	total = 0;
	for (long i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			total += i;
		}
	}

	cout << total << endl;

	return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
    int a, b;
    char op;
    while(scanf("%d %c %d", &a, &op, &b) && op != '?'){
        switch(op){
            case '+': cout << a + b << endl; break;
            case '-': cout << a - b << endl; break;
            case '*': cout << a * b << endl; break;
            case '/': cout << a / b << endl; break;
            default:break;
        }
    }
    return 0;
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> rs(n),as(n),ws(n),ts(n);
  for(Int i=0;i<n;i++) cin>>rs[i]>>as[i]>>ws[i]>>ts[i];

  Int ans=0;
  for(Int uku=0;uku<8;uku++){
    using T = tuple<Int, Int, Int, Int>;
    using P = pair<Int, T>;
    vector<P> vp;
    for(Int i=0;i<n;i++){
      Int val=0;
      if(uku%4==0) val=rs[i]+ts[i];
      if(uku%4==1) val=rs[i]-ts[i];
      if(uku%4==2) val=rs[i];
      if(uku%4==3) val=ts[i];
      if(uku>=4) val*=-1;
      vp.emplace_back(val,T(rs[i],as[i],ws[i],ts[i]));
    }

    sort(vp.begin(),vp.end());
    for(Int i=0;i<n;i++)
      tie(rs[i],as[i],ws[i],ts[i])=vp[i].second;

    const Int MAX = 2020;
    const Int INF = 1e9;
    vector<Int> dp(MAX,-INF);
    for(Int i=0;i<n;i++){
      vector<Int> nx0(MAX,-INF),nx1(MAX,-INF);
      chmax(nx1[ts[i]],as[i]);
      for(Int j=MAX-1;j>=0;j--){
        chmax(nx0[j],dp[j]);
        if(j<rs[i]) continue;
        chmax(nx1[min(j-rs[i],ts[i])],dp[j]+as[i]);
        chmax(nx1[j-rs[i]],nx1[j]+ws[i]);
      }
      for(Int j=0;j<MAX;j++) chmax(dp[j],nx0[j]);
      for(Int j=0;j<MAX;j++) chmax(dp[j],nx1[j]);
    }
    for(Int j=1;j<MAX;j++) chmax(ans,dp[j]);
  }
  cout<<ans<<endl;
  return 0;
}



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

int main()
{
    long long int n,i,j,a,move;
    scanf("%lld",&n);
    for(a=sqrt(n);a>=1;a--){
        if(n%a==0){
            j=n/a;
            i=a;
            break;
        }
    }
    move=j+i-2;
    printf("%lld",move);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdio.h>
#include <set>
#include <vector>
using namespace std;


int main(){
    int n;
    cin>>n;
    int max = 0, i;
    int tmp = 0;
    int tmp2 = 0;
    int ans;
    for(i=1; i<=n; i++){
        tmp2 = i;
        tmp = 0;
        while(1){
            if(tmp2%2==0){
                tmp2 = tmp2/2;
                tmp++;
            }
            else{
                if(max<=tmp){
                    max = tmp;
                    ans = i;
                }
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<fstream>
#include<algorithm>
#include<utility>
using namespace std;
using ll = long long;

int main(){
  int a, b;
  cin >> a >> b;
  vector<int> v1,v2;
  for(int i=1;i<=2010;i++){
    int e = i*0.08;
    int t = i*0.1;
    if(e==a) v1.push_back(i);
    if(t==b) v2.push_back(i);
  }
  for(int i=0;i<v1.size();i++){
    for(int j=0;j<v2.size();j++){
      if(v1[i]==v2[j]){
        cout << v1[i] << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
# Problem B - Crane and Turtle

# input
X, Y = map(int, input().split())

# initialization
is_ok = False

# count
for a in range(X+1):
    b = X - a
    if (2*a + 4*b)==Y:
        is_ok = True

# output
if is_ok:
    print("Yes")
else:
    print("No")


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

llong n;
llong a[200005];
bool exists[1000001];

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

    sort(a, a + n);
    llong ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == a[i + 1]) {
            exists[a[i]] = true;
            continue;
        }

        if ([&]() {
            for (llong j = 1; j * j <= a[i]; j++) {
                if (a[i] % j == 0) {
                    if (exists[j] || exists[a[i] / j]) return false;
                }
            }
            return true;
        }()) {
            ans++;
        }
        exists[a[i]] = true;
    }

    cout << ans << endl;
}

Measured memory_bytes: 6124
n = int(input())
dat = list(map(int, input().split()))
minval = maxval = dat[0]
kabu = 0
okane = 1000
prevval = dat[0]
for i in range(n):
    curval = dat[i]
    #print(">cur", curval)
    if curval == prevval:
        prevval = curval
        continue
    if curval > prevval:
        prevval = curval
        continue
    # curval のほうが小さい
    kabu = okane // minval
    okane -= (minval * kabu)
    #print(" buy ", kabu , "kabu by", (minval * kabu))
    okane += (prevval * kabu)
    #print(" sell ", kabu , "get", (prevval * kabu), "now okane", okane)
    minval = curval
    maxval = prevval
    prevval = curval
# 最後
#print("end")
curval = dat[n-1]
#print("minval", minval)
#print("curval", curval)
if curval > minval:
    kabu = okane // minval
    okane -= (minval * kabu)
    #print(" buy ", kabu , "kabu by", (minval * kabu))
    okane += (curval * kabu)
    #print(" sell ", kabu , "get", (curval * kabu))

print(okane)


Measured memory_bytes: 61980
#include<bits/stdc++.h>
using namespace std;
long long n;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	long long res=n-1;
	for(long long i=1;i*i<=n;i++){
		if(n%i==0){
			res=i+n/i-2;
		}
	}
	cout<<res<<endl; 
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
long long dp[100010];
int x[100010];
int n,e;
long long t;
int st;
multiset<long long>s1,s2;
int main()
{
	scanf("%d%d%lld",&n,&e,&t);
	for(int i=1;i<=n;i++)scanf("%d",x+i);
	s2.insert(t);
	for(int i=1;i<=n;i++)
	{
		while(st+1<i && 2*(x[i]-x[st+1])>=t)
		{
			s2.erase(s2.find(dp[st]-x[st]+t));
			s1.insert(dp[st]-x[st]-2LL*x[st+1]);
			st++;
		}
		dp[i]=4e18;
		if(s1.size())dp[i]=min(dp[i],(*s1.begin())+3LL*x[i]);
		if(s2.size())dp[i]=min(dp[i],x[i]+(*s2.begin())),
		s2.insert(dp[i]-x[i]+t);
	}
	printf("%lld",dp[n]+e-x[n]);
	return 0;
} 

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

const int INF = 1 << 25;
int cost[11][11][11][11][55];// depth, pos, l, r, oxy


struct S {
	int depth, pos, l, r, oxy, sum;
	bool operator <(const S& x) const {
		return sum > x.sum;
	}
};
void save(S s, int c) {
	cost[s.depth][s.pos][s.l][s.r][s.oxy] = c;
}
int ret(S s) {
	return cost[s.depth][s.pos][s.l][s.r][s.oxy];
}

int c[10][10];

int main() {
	int W, H, f, M, O;
	while(cin >> W >> H, W + H) {
		cin >> f >> M >> O;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				cin >> c[i][j];
			}
		}

		if(O <= 1) {
			cout << "NA" << endl;
			continue;
		}

		priority_queue<S> q;
		fill((int*)begin(cost), (int*)end(cost), INF);
		for(int j = 0; j < W; j++) {
			S ns = { 0, j, j, j, O - 1, 0 };
			if(c[0][j] < 0) ns.sum = -c[0][j];
			else ns.oxy = min(ns.oxy + c[0][j], M);
			save(ns, ns.sum);
			q.push(ns);
		}

		int ans = INF;
		while(q.size()) {
			S s = q.top();
			q.pop();
			if(s.depth == H - 1) {
				ans = min(ans, s.sum);
				break;
			}
			if(ret(s) < s.sum || s.oxy <= 1) continue;

			for(int i = 0; i < 3; i++) {
				S ns = { s.depth, s.pos, s.pos, s.pos, s.oxy - 1, s.sum };

				if(i == 0) {
					ns.depth++;
					ns.l = ns.r = ns.pos;
				}
				if(i == 1 && s.pos != 0) {
					ns.pos--;
					if(s.pos == s.l) ns.l--;
				}
				if(i == 2 && s.pos != W - 1) {
					ns.pos++;
					if(s.pos == s.r) ns.r++;
				}

				int x = c[ns.depth][ns.pos];
				if(x < 0) ns.sum -= x;
				else ns.oxy = min(ns.oxy + x, M);

				if(ret(ns) > ns.sum) {
					save(ns, ns.sum);
					q.push(ns);
				}
			}
			//// down
			//{
			//	S ns = { s.depth + 1, s.pos, s.pos, s.pos, s.oxy - 1, s.sum };
			//	int x = c[ns.depth][ns.pos];
			//	if(x < 0) ns.sum -= x;
			//	else ns.oxy = min(ns.oxy + x, M);
			//	if(ret(ns) > ns.sum) {
			//		save(ns, ns.sum);
			//		q.push(ns);
			//	}
			//}
			//// left
			//if(s.pos != 0) {
			//	S ns = { s.depth, s.pos - 1, s.pos, s.pos, s.oxy - 1, s.sum };
			//	if(s.pos == s.l) {
			//		ns.l--;
			//		int x = c[ns.depth][ns.pos];
			//		if(x < 0) ns.sum -= x;
			//		else ns.oxy = min(ns.oxy + x, M);
			//	}
			//	if(ret(ns) > ns.sum) {
			//		save(ns, ns.sum);
			//		q.push(ns);
			//	}
			//}
			//// right
			//if(s.pos != W - 1) {
			//	S ns = { s.depth, s.pos + 1, s.pos, s.pos, s.oxy - 1, s.sum };
			//	if(s.pos == s.r) {
			//		ns.r++;
			//		int x = c[ns.depth][ns.pos];
			//		if(x < 0) ns.sum -= x;
			//		else ns.oxy = min(ns.oxy + x, M);
			//	}
			//	if(ret(ns) > ns.sum) {
			//		save(ns, ns.sum);
			//		q.push(ns);
			//	}
			//}
		}

		if(ans > f) {
			cout << "NA" << endl;
		}
		else {
			cout << ans << endl;
		}
	}
}

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

int main(){
	int a,b,c;
  	cin >> a >> b >> c;
  	if (a==b && b==c) cout << 1 << endl;
  	else if (a==b || a==c || b==c) cout << 2 << endl;
  	else cout << 3 << endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;

int main()
{
    double pi = 3.14159265358979323846, r;
    cin >> r;
    cout << fixed << setprecision(5) << r * r * pi << " ";
    cout << fixed << setprecision(5) << 2 * r * pi << endl;

    return 0;
}


Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll mod = 1e9+7;

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

	ll minn = INT_MAX;

	for(int i = 0; i <= 100; i++){
		ll sum = 0;
		for(int j = 0; j < n; j++){
			sum += (a[j]-i)*(a[j]-i);
		}

		minn = min(minn, sum);
	}

	cout<<minn<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define ll long long
#define rep(i,n) for (int i=0; i<(int)(n); i++)
using namespace std;
int main() {
	int r, d, s;
	cin >> r >> d >> s;
	int x[11];
	x[0] = s;
	rep(i, 11) {
		x[i + 1] = r * x[i] - d;
	}
	for (int i = 1; i < 11; i++) {
		cout << x[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=998244353;
const int MAX=1000010;

signed main(){
    string s;cin>>s;
    s+='a';
    ll ma=0;
    ll cnt=0;
    rep(i,4){
        if(s[i]=='R')cnt++;
        else{
            ma=max(ma,cnt);
            cnt=0;
        }
    }
    cout<<ma<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=201000;
int n,a[N];
int main() {
	scanf("%d",&n);
	rep(i,0,n) scanf("%d",a+i);
	if (n%2==1) {
		int s=0;
		rep(i,0,n) s^=a[i];
		if (s%2==0) puts("Second");
		else puts("First");
	} else {
		int s=*min_element(a,a+n);
		if (s%2==1) {
			puts("First");
		} else {
			s=0;
			rep(i,0,n) s^=a[i];
			if (s%2==0) puts("Second");
			else puts("First");
		}
	}
}



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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


signed main(){
    int N;
    string S, T;
    cin >> N >> S >> T;
    string U = "";
    REP(i, N){
        U = U + S[i];
        U = U + T[i];
    }
    PRINT(U);
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var a = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var r = 0;
            for (int i = 0; i < a.Length; i += 2)
            {
                if (a[i] % 2 == 1)
                {
                    r++;
                }

            }
            Console.WriteLine(r);
        }
    }
}


Measured memory_bytes: 28248
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<numeric>
#include<climits>
#include<queue>
 
using namespace std;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<long long> a(3 * n);
	long long e;
	long long presum = 0;
	long long postsum = 0;
	priority_queue<long long,vector<long long>,greater<long long>> preque;
	priority_queue<long long> postque;
	for (int i = 0; i < 3 * n; i++) {
		cin >> a[i];
		if (i < n) {
			presum += a[i];
			preque.push(a[i]);
		}
		else if (2 * n <= i) {
			postsum += a[i];
			postque.push(a[i]);
		}
	}
	vector<long long> premax(1, presum);
	long long tmp;
	for (int i = 0; i <  n; i++) {
		if (preque.top() < a[n + i]) {
			presum -= preque.top();
			presum += a[n + i];
			preque.pop();
			preque.push(a[n + i]);
		}
		premax.push_back(presum);
	}
	long long ans = presum - postsum;
	for (int i = n-1; i >= 0; i--) {
		if (postque.top() > a[n+i]) {
			postsum -= postque.top();
			postsum += a[n + i];
			postque.pop();
			postque.push(a[n + i]);
		}
		ans = max(ans, premax[i] - postsum);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5748
#include <functional>  
#include <algorithm>  
#include <iostream>  
#include <fstream>  
#include <sstream>  
#include <iomanip>  
#include <numeric>  
#include <cstring>  
#include <cassert>  
#include <cstdio>  
#include <string>  
#include <vector>  
#include <bitset>  
#include <queue>  
#include <stack>  
#include <cmath>  
#include <ctime>  
#include <list>  
#include <set>  
#include <map>  
#include <climits>

using namespace std;

#define PB push_back  
#define MP(A, B) make_pair(A, B)  
#define fi first  
#define se second  

#define gcd(a,b) __gcd(a,b)
#define pi acos(-1.0)
#define pii pair<int,int>
#define ll long long  
#define typec long long   
#define MAX 1000005  
#define MOD 1000000007  
#define INF 0x3f3f3f3f  
#define EXP 1e-8  
#define lowbit(x) (x&-x)  
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

typec extendGCD(typec a, typec b, typec& x, typec& y)  
{  
    if(!b) return x = 1, y = 0, a;  
    typec res = extendGCD(b, a % b, x, y), tmp = x;  
    x = y, y = tmp - (a / b) * y;  
    return res;  
}  

typec combinationModP(typec n, typec k, typec p)  
{  
    if(k > n) return 0;  
    if(n - k < k) k = n - k;  
    typec a = 1, b = 1, x, y;  
    int pcnt = 0;  
    for(int i = 1; i <= k; i++)  
    {  
        x = n - i + 1, y = i;  
        while(x % p == 0) x /= p, pcnt++;  
        while(y % p == 0) y /= p, pcnt--;  
        x %= p, y %= p, a *= x, b *= y;  
        b %= p, a %= p;  
    }  
    if(pcnt) return 0;  
    extendGCD(b, p, x, y);  
    if(x < 0) x += p;  
    a *= x, a %= p;  
    return a;  
}  

int n, m, q;
ll ans = LONG_MIN;
int r[55][4] = {0}, a[12] = {0};
vector<int> e[12];

void dfs(int idx, int st, ll now) {
    if (idx == n+1) {
        ans = max(ans, now);
        return ;
    }
    for (int i = st; i <= m; ++i) {
        ll tnow = now;
        a[idx] = i;
        for (auto &k : e[idx]) if (a[idx] - a[r[k][0]] == r[k][2]) tnow += r[k][3]; 
        dfs(idx+1, i, tnow);
    }
}

int main() {
     cin >> n >> m >> q;
    for (int i = 0; i < q; ++i) {
        for (int j = 0; j < 4; ++j) {
            cin >> r[i][j];
        }
        e[r[i][1]].push_back(i);
    }
    dfs(1, 1, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;

ll N;
vector<ll> A;
unordered_map<ll, ll> mp;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  A.resize(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
    mp[A[i]]++;
  }
  sort(A.begin(), A.end());

  ll ans = 0;
  for (ll i = N - 1; i >= 1; i--) {
    if (mp[A[i]] == 0) {
      continue;
    }
    mp[A[i]]--;

    ll t = 0;
    ll a_tmp = A[i];
    while (a_tmp >= 1) {
      t++;
      a_tmp /= 2;
    }
    ll target = pow(2LL, t) - A[i];
    if (mp[target] > 0) {
      ans++;
      mp[target]--;
    }
  }

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

Measured memory_bytes: 18420
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;

struct node{
	int num;
	int count;
};

bool comp(const node LHS,const node RHS){
	return LHS.count > RHS.count;
}

int main()
{
	int n;
	cin>>n;
	vector<node> evenVec(100001);
	vector<node> oddVec(100001);
	for(int i = 0 ; i < 100001; i++){
		evenVec[i].count = 0;
		evenVec[i].num = i;

		oddVec[i].count = 0;
		oddVec[i].num = i;
	}
	for(int i = 0; i < n; i++){
		int num;
		cin>>num;
		if( i % 2 == 0){
			evenVec[num].count++;
		}else{
			oddVec[num].count++;
		}
	}
	sort(evenVec.begin(),evenVec.end(),comp);
	sort(oddVec.begin(),oddVec.end(),comp);
	ll ans = 0;
	if( evenVec[0].num != oddVec[0].num){
		ans = n - (evenVec[0].count + oddVec[0].count);
	}else{
		int pattern1 = n - (evenVec[0].count + oddVec[1].count);
		int pattern2 = n - (evenVec[1].count + oddVec[0].count);
		ans = min(pattern1,pattern2);
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 4384
import numpy as np

n, d = map(int,input().split())

x = [list(map(int, input().split())) for i in range(n)]

cnt = 0

for i in range(n-1):
    for j in range(i+1,n):
        total = 0
        # print('xi',x[i])
        # print('xj',x[j])
        for k in range(d):
            dis = (x[i][k] - x[j][k]) ** 2
            total += dis
        tdis = np.sqrt(total)
        idis = int(np.sqrt(total))
        if tdis == idis:
        # print(type(tdis),tdis)
        # if 'int' == type(tdis):
            cnt += 1

print(cnt)

Measured memory_bytes: 12504
from math import factorial as f
n,p=map(int,input().split())
a=[i%2 for i in list(map(int,input().split()))]
e=a.count(0);o=a.count(1)
def c(x,y):
    return f(x)//(f(x-y)*f(y))
v=0
for i in range(e+1):
  v+=c(e,i)
w=0
t=0 if p==0 else 1
for i in range(t,o+1,2):
  w+=c(o,i)
print(v*w)

Measured memory_bytes: 3188
PROGRAM piyo
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 16
      integer(p) :: n,d,x,y,i, ans=0
      
      read*,n,d
      do i = 1,n
        read*,x,y
        if( x**2+y**2<=d**2 )then
          ans = ans + 1
        end if
      end do
      
      print*,ans
      
      
      stop
      !debugg
      
      
      
      END PROGRAM

Measured memory_bytes: 2908
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <complex>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include "fstream"
using namespace std;
#define PI acos(-1)
#define MOD 1000000007
#define pii pair<long long ,long long >
#define ll  long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define loop2(i,n) for(ll i = 1;i<=n;i+=1)
#define pb push_back
#define EPS 1e-8
inline ll gcd(ll a, ll b){ ll t; while (b){ a = a%b; t = a; a = b; b = t; }return a; }
using namespace std;





int main()
{
//    freopen("/Users/ashish/Desktop/manic_moving.txt", "r", stdin);
//    freopen("/Users/ashish/Desktop/A-large-practice.out.txt", "w", stdout);
    ll n,a,b;
    cin>>n>>a>>b;
    ll arr[n];
    loop(i,n)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    ll ans  =0 ;
    loop(i,n-1)
    {
        if(a*(arr[i+1]-arr[i])>b)
        {
            ans+=b;
        }
        else{
            ans+=a*(arr[i+1]-arr[i]);
        }
    }
    
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
/*2019/09/13 */
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){return *(int*)a-*(int*)b;}
int desc(const void *a,const void *b){return *(int*)b-*(int*)a;}
int llasc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
int lldesc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
/*
int asc_t(const void *a,const void *b){return ((struct_t*)a)->member - ((struct_t*)b)->member;}
int desc_t(const void *a,const void *b){return ((struct_t*)b)->member - ((struct_t*)a)->member;}
*/

int main(){
    ll x;
    
    scanf("%lld",&x);
    ll ans,r,alpha;
    ans=x/11;
    r=x%11;
    if(1<=r&&r<=6){
        alpha=1;
    }else if(r>6){
        alpha=2;
    }else{
        alpha=0;
    }
    printf("%lld\n",ans*2+alpha);
    return 0;

}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

long long P = 1000000007;

class C {
public:
  int n;
  vector<long long> fac, inv, facInv;

  long long power(long long e, long long x) {
    if (x == 0)
      return 1;
    if (x == 1)
      return e;
    if (x % 2 == 0)
      return power((e * e) % P, x / 2);
    return (e * power(e, x - 1)) % P;
  }

  C(int n_) {
    n = n_;
    fac.resize(n + 1);
    inv.resize(n + 1);
    facInv.resize(n + 1);
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= n; i++)
      fac[i] = (i * fac[i - 1]) % P;
    inv[0] = inv[1] = 1;
    for (int i = 2; i <= n; i++)
      inv[i] = power(i, P - 2);
    facInv[0] = facInv[1] = 1;
    for (int i = 2; i <= n; i++)
      facInv[i] = (inv[i] * facInv[i - 1]) % P;
  }

  long long comb(int N, int K) {
    if (N < K || K < 0 || N < 0)
      return 0;
    if (N == 0 || K == 0 || K == N)
      return 1;
    return ((fac[N] * facInv[K]) % P * facInv[N - K]) % P;
  }

  long long hcomb(int N, int K) {
    if (N == 0 && K == 0)
      return 1;
    return comb(N + K - 1, K);
  }

  long long mul(long long a, long long b) { return (a * b) % P; }

  long long add(long long a, long long b) { return (a + b) % P; }

  // find c
  // where a^c = b (mod P)
  long long dlp(long long a, long long b) {
    long long m = ceil(sqrt(P));
    map<long long, long long> mp;
    for (int i = 0; i < m; i++)
      mp[power(a, i)] = i;
    long long ainvm = power(power(a, m), P - 2);
    cout << m << endl;
    for (int i = 0; i < m; i++) {
      if (mp.find(b) != mp.end()) {
        return i * m + mp[b];
      }
      b = mul(b, ainvm);
    }
    return -1;
  }
};

C cmb(201010);

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int w, h, a, b;
  cin >> h >> w >> a >> b;
  w--;
  h--;
  ll ans = 0;
  int j = b;
  for (int i = h - a; i >= 0 && j <= w; i--, j++) {
    ll tmp = ((cmb.fac[i + j] * cmb.facInv[i]) % P * cmb.facInv[j]) % P;
    int y = h - i, x = w - j;
    tmp *= ((cmb.fac[x + y] * cmb.facInv[x]) % P * cmb.facInv[y]) % P;
    tmp %= P;

    ans += tmp;
    ans %= P;
  }

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


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)
#define INF 999999999

class E{
public:
	int from,to,cost;

	E(int _from,int _to,int _cost){
		from = _from;
		to = _to;
		cost = _cost;
	}

	bool operator<(const E &e)const{
		return cost < e.cost;
	}

	void show(void){
		cout<<"["<<from<<"->"<<to<<" : "<<cost<<"]"<<endl;
	}
};

int n,m;
vector<E> es;

int par[102];
int rank[102];

void init(void){
	rep(i,102){
		par[i] = i;
		rank[i] = 0;
	}
}

int find(int x){
	if(par[x] == x){
		return x;
	} else{
		return par[x] = find(par[x]);
	}
}

void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(rank[x] < rank[y]){
		par[x] = y;
	} else{
		par[y] = x;
		if(rank[x] == rank[y]) rank[x]++;
	}
}

bool same(int x,int y){
	return find(x) == find(y);
}

int kruskal(void){
	init();
	int last = -1;
	int cnt = 0;

	rep(i,es.size()){
		E e = es[i];

		if(!same(e.from,e.to)){
			unite(e.from,e.to);
			last = i;
			cnt++;
		}
	}
	return cnt!=n-1 ? INF : es[last].cost - es[0].cost;
}

int main(void){
	while(cin>>n>>m,n){
		es.clear();
		rep(i,m){
			int a,b,cost;
			cin>>a>>b>>cost;
			es.push_back(E(a,b,cost));
		}

		int ans = INF;
		sort(es.begin(),es.end());
		while(es.size() >= n-1){
			int res = kruskal();
			if(res == INF) break;
			if(ans > res) ans = res;
			es.erase(es.begin());
		}

		cout<<(ans==INF ? -1 : ans)<<endl;
	}

	return 0;
}

Measured memory_bytes: 1068
package main

import (
	"fmt"
	"sort"
)

func sum(xs []int) int {
	var s int
	for _, x := range xs {
		s += x
	}
	return s
}

func main() {
	var n, m int
	fmt.Scan(&n)
	fmt.Scan(&m)
	var a = make([]int, n)
	var t int
	for i := 0; i < n; i++ {
		fmt.Scan(&t)
		a[i] = t
	}
	s := sum(a)
	sort.Ints(a)
	for i := 0; i < m; i++ {
		if float64(a[n-i-1]) < float64(s)/float64(4*m) {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;
int exp(int a,int x){
      if(x==0)return 1;
      if(x%2)return a*exp(a,x-1)%modulo;
      int t=exp(a,x/2);
      return t*t%modulo;
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin>>n;
      vector<int>arr(n);
      for(int i=0;i<n;i++)cin>>arr[i];
      int p=0,ans=0;
      for(int i=1;i<n;i++){
            p=(p+exp(i,modulo-2))%modulo;
            ans=(ans+p*(arr[i]-arr[i-1]))%modulo;
      }
      for(int i=1;i<=n-1;i++)ans=ans*i%modulo;
      cout<<ans;
}


Measured memory_bytes: 1024
# Q.1                                                                                                                                                                                                             
tmp=readline()
#println("Input: ",split(tmp))                                                                                                                                                                                    

#println(parse.(Int64,split(tmp)))                                                                                                                                                                                

H1,M1,H2,M2,K = parse.(Int64,split(tmp))


#println("Input: $H1,$M1,$H2,$M2,$K")                                                                                                                                                                             
#println("typeof each args... ",typeof(H1))                                                                                                                                                                       

#println((H2*60+M2)-(H1*60+M1)," minutes remain")                                                                                                                                                                 
#remain = (H2*60+M2)-(H1*60+M1) # [min]                                                                                                                                                                           

EH = div((H2*60+M2)-K,60) # H2:M2 - K [min] ->  EH:EM                                                                                                                                                             
EM = (H2*60+M2)-K - EH*60
#println("The latest time to start studying --> $EH:$EM")                                                                                                                                                         

ans = (EH*60+EM)-(H1*60+M1) # [min]                                                                                                                                                                               

#println("Answer: $ans [min]")                                                                                                                                                                                    
println(ans)

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

using namespace std;
const int N = 1e6+100;
typedef long long ll;
vector<ll> fac;
int main(){
	ll n;
	cin>>n;
	if(n==1){
		puts("0");
		return 0;
	}
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			if(i*i==n) fac.push_back(i);
			else{
				fac.push_back(i);
				fac.push_back(n/i);
			}
		}
	}
	fac.push_back(n); 
	ll ans=0;
	for(auto x:fac){
		if(n/(x)==(ll)(n/(x-1))) ans+=(x-1);
	}
	cout<<ans<<endl;
	return 0;
}


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

#define int long long
#define REP(i, n) for (int i=0; i<(n); ++i)

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> t) {
    return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> t) {
    return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ", " + to_string(get<3>(t)) + ")";
}

template <typename A>
string to_string(vector<A> v) {
    bool first = true;
    string result = "[";
    for (A i : v) {
        if (!first) result += ", ";
        first = false;
        result += to_string(i); 
    }
    return result + "]";
}

template <typename A>
string to_string(A x[], signed n) {
    string result = "{";
    for (signed i=0; i<n; ++i) {
        if (i!=0) result += ", ";
        result += to_string(x[i]); 
    }
    return result + "}";
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int n;
    cin >> n;
    int x[n+1] = {};

    vector<int> occ[300];

    for (int d=2; d<=n; ++d) {
        if (x[d]) continue;
        for (int i=d; i<=n; i*=d) x[d] += n/i;
        REP(i, x[d]+1) occ[i].push_back(d);
        for (int u=2*d; u<=n; u+=d) x[u] = -1;
    }

    int res = 0;
    vector<int> nice = {2, 4, 14, 24};
    for (int i : occ[24]) for (int j : occ[2]) if (i != j) res += 2;
    for (int i : occ[14]) for (int j : occ[4]) if (i != j) res += 2;
    for (int i : occ[2]) for (int j : occ[4]) for (int k : occ[4]) if (i != j && j != k && i != k) ++res;
    cout << res/2 + occ[74].size();
}

Measured memory_bytes: 256
import sys
from collections import deque

def main():
  h, w = map(int, input().split())
  area = [[s for s in sys.stdin.readline().strip()] for _ in range(h)]
  start_point = {0:set(), 1:set(), 2:set(), 3:set(), 4:set()}
  min_neighbor = 4
  for i in range(h):
    for j in range(w):
      if area[i][j] == '#':
        continue
      roads = 0
      if i > 0 and area[i - 1][j] == '.':
        roads += 1
      if i < h - 1 and area[i + 1][j] == '.':
        roads += 1
      if j > 0 and area[i][j - 1] == '.':
        roads += 1
      if j < w - 1 and area[i][j + 1] == '.':
        roads += 1
      min_neighbor = min(min_neighbor, roads)
      start_point[roads].add((i, j))
  max_cost = 0
  for start in start_point[min_neighbor]:
    queue = deque()
    queue.append(start)
    cost = 0
    visited = set()
    while len(queue) > 0:
      roads = len(queue)
      found = False
      for i in range(roads):
        s = queue.popleft()
        if s in visited:
          continue
        found = True
        visited.add(s)
        i = s[0]
        j = s[1]
        if i > 0 and area[i - 1][j] == '.':
          queue.append((i - 1, j))
        if i < h - 1 and area[i + 1][j] == '.':
          queue.append((i + 1, j))
        if j > 0 and area[i][j - 1] == '.':
          queue.append((i, j - 1))
        if j < w - 1 and area[i][j + 1] == '.':
          queue.append((i, j + 1))
      if not found:
        cost -= 1
      max_cost = max(cost, max_cost)
      if found:
        cost += 1
  print(max_cost)

if __name__ == '__main__':
  main()

Measured memory_bytes: 9548
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    string a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;

    ll ans = 0;
    rep(i,n){
        int count = 0;
        if(a[i] != b[i]){
            count ++;
        }
        if(b[i] != c[i]){
            count ++;
        }
        if(c[i] != a[i]){
            count ++;  
        }

        if(count == 3){
            ans += 2;
        }
        if(count == 2){
            ans += 1;
        }
    }

    cout << ans << endl;



}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = list(input().strip())
A = [int(S[i]) for i in range(N)]

k1 = [-1]*10
for i in range(N-2):
    if k1[A[i]] == -1:
        k1[A[i]] = i

k2 = [[-1]*10 for i in range(10)]
for i in range(10):
    if k1[i] == -1:
        continue
    else:
        for j in range(k1[i]+1, N-1):
            if k2[i][A[j]] == -1:
                k2[i][A[j]] = j

ans = 0
for i in range(10):
    for j in range(10):
        if k2[i][j] == -1:
            continue
        
        L = [0]*10
        for l in range(k2[i][j]+1 , N):
            if L[A[l]] == 0:
                ans += 1
                L[A[l]] = 1

print(ans)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <fstream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define ll unsigned long long

const ll MOD = 1000000000000000000;

int main() {
	//入力
	int n;
	cin >> n;
	vector<string> s;
	rep(i, n) {
		string s1;
		cin >> s1;
		s.push_back(s1);
	}

	//処理
	vector<ll> a(5);
	rep(i, n) {
		string s1 = s[i].substr(0, 1);
		if (s1 == "M")
			++a[0];
		else if (s1 == "A")
			++a[1];
		else if (s1 == "R")
			++a[2];
		else if (s1 == "C")
			++a[3];
		else if (s1 == "H")
			++a[4];
	}

	//出力
	ll ans = 0;
	ans += a[0] * a[1] * a[2];
	ans += a[0] * a[1] * a[3];
	ans += a[0] * a[1] * a[4];
	ans += a[0] * a[2] * a[3];
	ans += a[0] * a[2] * a[4];
	ans += a[0] * a[3] * a[4];
	ans += a[1] * a[2] * a[3];
	ans += a[1] * a[2] * a[4];
	ans += a[1] * a[3] * a[4];
	ans += a[2] * a[3] * a[4];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 7444
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 64;
const int N = (int)2e5 + 7;
const int MAXN = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e18;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////

void solve() {
	int n; cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		ans += x % 2 && i % 2 == 0;
	}
	cout << ans;
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif

	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

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

using namespace std;

int main(void){

    set<int> sets;
    int n;
    cin >> n;
    for(int i=0; i<n; i++) {
        int temp;
        cin >> temp;
        if(sets.find(temp) == sets.end()) {
            sets.insert(temp);
        }
        else {
            sets.erase(temp);
        }
    }

    cout << sets.size() << endl;

    return 0;
    
}


Measured memory_bytes: 4864
import sys
input = sys.stdin.readline
from collections import deque

N, D, A = map(int, input().split())
X = []
for _ in range(N):
    x, h = map(int, input().split())
    X.append((x, h))
X = sorted(X, key = lambda x: x[0])[::-1]
Q = deque([])

ans = 0
k = 0
while X:
    if len(Q) == 0 or X[-1][0] <= Q[0][0]:
        x, h = X.pop()
        h = max(h - k * A, 0)
        a = (h + A - 1) // A
        ans += a
        k += a
        deque.append(Q, (x + 2 * D, a))
    else:
        x, a = deque.popleft(Q)
        k -= a

print(ans)

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

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	
	sort(a, a+3);
	
	/* make pair of the biggest num and the second biggest one, and plus the smallest one*/
	
	int result = a[2]*10+a[1]+a[0];
	
	cout << result<< endl;
	
	return 0;
}

Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: usize,
        s: [String;n],
    }
    let mut a=std::collections::BTreeMap::new();
    for s in s {
        *a.entry(s).or_insert(0)+=1;
    }
    for r in &["AC","WA","TLE","RE"] {
        println!("{} x {}",r,a.get(&r.to_string()).unwrap_or(&0));
    }
}

Measured memory_bytes: 7872