akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

#define MAX_N 100000
int x[MAX_N+1], y[MAX_N+1];

// Kruskal
struct edge {int from, to, cost;};
vector<edge> KSedges;

// Union-Find tree
int UFpar[2*(MAX_N+1)];
int UFrank[2*(MAX_N+1)];
void UFinit(int n);
int UFfind(int x);
void UFunite(int x, int y);
bool UFsame(int x, int y);


int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }
    // argsort for x
    int idxs[N];
    for (int i = 0; i < N; i++) idxs[i] = i;
    sort(idxs, idxs+N, [&](int i, int j) {return x[i] < x[j];});
    for (int i = 0; i < N-1; i++) {
        int u = idxs[i], v = idxs[i+1];
        KSedges.push_back({u, v, abs(x[u]-x[v])});
    }
    // argsort for y
    for (int i = 0; i < N; i++) idxs[i] = i;
    sort(idxs, idxs+N, [&](int i, int j) {return y[i] < y[j];});
    for (int i = 0; i < N-1; i++) {
        int u = idxs[i], v = idxs[i+1];
        KSedges.push_back({u, v, abs(y[u]-y[v])});
    }
    sort(KSedges.begin(), KSedges.end(), [](const edge& e1, const edge& e2) {return e1.cost < e2.cost;});
    UFinit(KSedges.size());
    ll res = 0;
    for (int i = 0; i < KSedges.size(); i++) {
        edge e = KSedges[i];
        if (!UFsame(e.from, e.to)) {
            UFunite(e.from, e.to);
            res += e.cost;
        }
    }
    cout << res << endl;
    return 0;
}


void UFinit(int n) {
    for (int i = 0; i < n; i++) {
        UFpar[i] = i;
        UFrank[i] = 0;
    }
}

// 木の根を求める
int UFfind(int x) {
    if (UFpar[x] == x) {
        return x;
    } else {
        return UFpar[x] = UFfind(UFpar[x]);
    }
}

// xとyの属する集合を併合
void UFunite(int x, int y) {
    x = UFfind(x);
    y = UFfind(y);
    if (x == y) return;

    if (UFrank[x] < UFrank[y]) {
        UFpar[x] = y;
    } else {
        UFpar[y] = x;
        if (UFrank[x] == UFrank[y]) UFrank[x]++;
    }
}

// xとyが同じ集合に属するか否か
bool UFsame(int x, int y) {
    return UFfind(x) == UFfind(y);
}


Measured memory_bytes: 6132
import sys

n = input()
data = input()
nums = data.split(' ')

flag = 0
for number in nums:
    num = int(number)
    if num % 2 == 0:
        if not(num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            flag = 1
            break
if flag == 0:
    print('APPROVED')

Measured memory_bytes: 3060
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
#include <math.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define SZ(x) ((int)(x).size())
typedef long long ll;

using namespace std;

int main(){
  int r;
  cin >> r;
  cout << 3*pow(r,2) << endl;
}


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


using namespace std;

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

    vector<int> d(N+2);
    for(int i = 0; i < N; i++) cin >> d[i+1];
    d[0] = d[N+1] = 0;

    for(int i = 0; i < N+1; i++) d[i] = d[i+1] - d[i];

    long int sum = 0;
    for(auto a : d) sum += abs(a);

    for(int i = 0; i < N; i++){
        auto temp = sum;
        temp -= (abs(d[i]) + abs(d[i+1]));
        temp += abs(d[i] + d[i+1]);
        cout << temp << endl;
    }
    return 0;
}



Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;


//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく

//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

using namespace std;

bool check(string s){
  int n = s.length();
  for(int i = 0; i < n/2; i++){
    if(s[i] != s[n/2+i]) return false;
  }
  return true;
}

int count(string *s){
  int count = 0;
  /*
  REP(i,h){
    REP(j,w){
      if( s[i][j] == '#') count++;
    }
  }*/
  return count;
}

int main(void){
 
  int n;
  cin >> n;
  int a[n];
  REP(i,n){
    cin >> a[i];
  }
  int ans = 0;
  REP(i,n){
    if((i+1)%2 == 1 && a[i]%2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;

int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    for(int i=0;i<tx-sx;i++){
        cout<<"R";
    }
    for(int i=0;i<ty-sy;i++){
        cout<<"U";
    }
    for(int i=0;i<tx-sx;i++){
        cout<<"L";
    }
    for(int i=0;i<ty-sy;i++){
        cout<<"D";
    }
    cout<<"D";
    for(int i=0;i<tx-sx+1;i++){
        cout<<"R";
    }
    for(int i=0;i<ty-sy+1;i++){
        cout<<"U";
    }
    cout<<"LU";
    for(int i=0;i<tx-sx+1;i++){
        cout<<"L";
    }
    for(int i=0;i<ty-sy+1;i++){
        cout<<"D";
    }
    cout<<"R"<<endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
bc = [[int(i) for i in input().split()] for i in range(m)]
a.sort()
bc.sort(key=lambda x:x[1],reverse=True)
d = []
cnt1 = 0
cnt2 = 0
x = 0

for lst in bc:
    cnt2 = 0
    while cnt1 < n and cnt2 < lst[0]:
        d.append(lst[1])
        cnt1 += 1
        cnt2 += 1

for i in range(len(d)):
    if d[i] - a[i] < 0:
        x = i
        break
else:
    x += i+1

print(sum(d[:x]+a[x:]))

Measured memory_bytes: 27836
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

struct pl {
    bool operator()(const pll &a, const pll &b) {
        return a.first * a.second < b.first * b.second;
    }
};

int main(void)
{
    IOS
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n),f(n);
    REP(i,n) cin >> a[i];
    REP(i,n) cin >> f[i];
    sort(ALL(a));
    sort(RALL(f));

    auto isok = [&](const ll &x){
        bool ret = true;
        ll k2 = k;
        REP(i,a.size()) {
            ll c = a[i] * f[i] - x;
            if (c > 0) {
                if (c % f[i] == 0) k2 -= c / f[i];
                else k2 -= c / f[i] + 1;

                if (k2 < 0) {
                    ret = false;
                    break;
                }
            }
        }
        return ret;
    };

    // めぐる式2分探索
    ll ng = -1, ok = a.back() * f.front()+1;
    while(abs(ok-ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (isok(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
        // cerr << ng << " " << ok << endl;
    }
    
    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
using namespace std;
 
int main(){
    int N;
    int ans=0;
    int max =0;
 
    cin >> N;
    int P[N];
    for(int i = 0;i<N;i++){
        cin >> P[i];
        if(max < P[i]){
            max = P[i];
        }    
        ans = ans + P[i];
    }
 
    cout << ans - max/2;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int cnt[110];
int num[110];
int dp[110];
int main()
{
	int N; cin >> N;
	for (int i = 2; i <= N; i++) {
		int temp = i;
		for (int j = 2; j <= N; j++) {
			while (temp % j == 0) {
				cnt[j]++;
				temp /= j;
			}
		}
	}
	int ans = 0;
	for (int i = 2; i <= N; i++) {
		if (cnt[i] >= 74) ans++;
		if (cnt[i] >= 14) {
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 4) ans++;
			}
		}
		if (cnt[i] >= 24) {
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 2) ans++;
			}
		}
		if (cnt[i] >= 4) {
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 14) ans++;
			}
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 4) {
					for (int k = (j + 1); k <= N; k++) {
						if (cnt[k] >= 2) ans++;
					}
				}
			}
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 2) {
					for (int k = (j + 1); k <= N; k++) {
						if (cnt[k] >= 4) ans++;
					}
				}
			}
		}
		if (cnt[i] >= 2) {
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 24) ans++;
			}
			for (int j = (i + 1); j <= N; j++) {
				if (cnt[j] >= 4) {
					for (int k = (j + 1); k <= N; k++) {
						if (cnt[k] >= 4) ans++;
					}
				}
			}
		}
	}
	cout << ans << endl;
}


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

int main() {
    int a[3], b[2];
    rep (i, 3) cin >> a[i];
    rep (i, 2) cin >> b[i];

    cout << min({a[0], a[1], a[2]}) + min(b[0], b[1]) - 50 << endl;

    return 0;
}


Measured memory_bytes: 3120
N, M = map(int,input().split())
l = 10 ** 9 + 7
p = 1
q = 1
if N == M:
    for i in range(1, N + 1):
        p = (p % l) * i
    p = (p ** 2 * 2) % l
    print(p)
elif abs(N - M) == 1:
    for i in range(1, N + 1):
        p = (p % l) * i
    for j in range(1, M + 1):
        q = (q % l) * j
    p = (p * q) % l
    print(p)
else:
    print(0)




Measured memory_bytes: 3064
H,W=map(int,input().split())
L=[list(input()) for _ in range(H)]
N=L.count("#")
for i in range (H):
	for j in range(W):
		if L[i][j]=="#":
			if not((i-1>=0 and L[i-1][j]=="#") or (j-1>=0 and L[i][j-1]=="#") or (i+1<H and L[i+1][j]=="#") or (j+1<W and L[i][j+1]=="#")):
				print("No")
				exit()
print("Yes")

Measured memory_bytes: 3064
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if((a>=0)&&(b>=0)&&(c>=0)&&(a<=100)&&(b<=100)&&(c<=100)){
        if(a<b){
            if(b<c){
                printf("Yes\n");
            }
            else{
                printf("No\n");
            }
        }else{
            printf("No\n");
        }
    }
    return 0;
}

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

#define ll long long

vector<ll> P;

void init(ll N){
    for(ll i = 1; i <= N; ++i) P[i] = i;
}

ll root(ll a){
    if(P[a] == a) return a;
    return (P[a] = root(P[a]));
}

bool is_same_set(int a, int b){
    return root(a) == root(b);
}

void unite(ll a, ll b){
    P[root(a)] = root(b);
}

int main(){
    ll N, M, ans = 1;
    cin >> N >> M;
    P.resize(N+1);
    vector<ll> A(M+1), B(M+1), buf(N+1, 0);
    for(ll i = 1; i <= M; ++i) cin >> A[i] >> B[i];
    init(N);
    for(ll i = 1; i <= M; ++i){
        unite(A[i], B[i]);
    }
    for(ll i = 1; i <= N;  ++i){
        ++buf[root(i)];
    }
    /*
    for(ll i = 1; i <= N;  ++i){
        cout << buf[i] << ", ";
    }
    cout << endl;
    for(ll i = 1; i <= N;  ++i){
        cout << P[i] << ", ";
    }
    cout << endl;
    */
    for(ll i = 1; i <= N;  ++i){
        ans = max(ans, buf[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12656
#pragma region
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define vd vector<double>
#define vs vector<string>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define dump(x) cerr << #x << " = " << x << endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);
int dig(int n){return (int)(log10(n) + 1);}
int abc(char x){return (int)(x)-(int)('a');} // 0~25
char abc(int x){return (char)(x+(int)('a'));} 
int ABC(char x){return (int)(x)-(int)('A');}
char ABC(int x){return (char)(x+(int)('A'));}
void solve();
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}
#pragma endregion

void solve() {
	string S, T; cin >> S >> T;
	int ans = 0;
	rep(i, 3) {
		if (S[i] == T[i]) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int first = sc.nextInt();
        HashMap<Integer,Integer> mapL = new HashMap<Integer,Integer>();
        HashMap<Integer,Integer> mapR = new HashMap<Integer,Integer>();
        mapL.put(first,1);
        long ans = 0;
        for(int i = 1; i < n; i++){
            int v = sc.nextInt();
            int L = i+v;
            int R = i-v;
            if(mapL.containsKey(R)){
                ans += mapL.get(R);
            }
            if(mapL.containsKey(L)){
                mapL.put(L,mapL.get(L)+1);
            }else{
                mapL.put(L,1);
            }
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 62752
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,d1,d2,ans;
  string kn,anskn;
  while(cin>>n){
    if(n==0) break;
    ans = 0;
    for(int i=0;i<n;i++){
	cin >> kn >> d1 >> d2;
	if(ans<d1+d2){
	  ans = d1+d2;
	  anskn = kn;
	}
      }
    cout << anskn << ' ' << ans << endl;
  }
  return 0;
}

    

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define pb push_back
#define mp make_pair
const int mod=1e9+7;
void solve()
{
  int n,q,a,b;
  cin>>n;
  vector<int> V(n);
  ll sum=0;
  unordered_map<int,int> um;
  for(int i=0;i<n;i++)
  {
    cin>>V[i];
    sum+=V[i];
    um[V[i]]++;
  }
  cin>>q;
  while(q--)
  {
    cin>>a>>b;
    if(um.count(a)==0)
    cout<<sum<<endl;
    else
    {
      ll value=b-a;
      value*=um[a];
      sum+=value;
      um[b]+=um[a];
      um[a]=0;
      cout<<sum<<endl;
    }
  }
}

int main()
{
  fastio
  solve();
}


Measured memory_bytes: 7268
#pragma GCC optimize("O2")
#include<bits/stdc++.h>
typedef long long ll ;
#define pll pair<ll , ll >
#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
using namespace std;
const int maxn = 1000*100+5 ;
const ll inf = 9223372036854775807 ;
const ll mod = 1e9 + 7 ;
int n , a[maxn] ; 
pii p[maxn] ; 
int main()
{
	migmig ;
	cin>>n ; 
	for(int i = 1;  i<= n ; i ++ ) 
	{
		cin>>p[i].X >> p[i].Y ; 
		if(p[i].X == p[i].Y) a[i] = 1; 
	}
	for(int i = 1 ; i <= n - 2 ; i ++ )
	{
		if(a[i] + a[i+1] + a[i+2] == 3)
		{
			cout<<"Yes" ; 
			return 0 ;
		}
	}
	cout<<"No" ; 
}








Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <math.h>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
	}
	int num[60] = { 0 };
	for (int i = 0; i < m; i++) {
		num[a[i]]++;
		num[b[i]]++;
	}
	for (int i = 0; i < n; i++) {
		cout << num[i + 1] << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<iterator>
#include<stack>
#include<queue>
#include<utility>
#include<functional>
#include<bitset>
#include<numeric>
#include<cstring>
#include<tuple>
using namespace std;

int d;
long long ans = 0;
vector< int > c( 30 ), t( 400 ), last( 30, 0 );
vector< vector< int > > arr( 400, vector< int >( 30, 0 ) );

int main( void )
{
	ios :: sync_with_stdio( 0 );
	cin.tie( 0 );
	
	cin >> d;
	for( int i = 1; i <= 26; ++i )
	{
		cin >> c[ i ];
	}
	for( int i = 1; i <= d; ++i )
	{
		for( int j = 1; j <= 26; ++j )
		{
			cin >> arr[ i ][ j ];
		}
	}
	for( int i = 1; i <= d; ++i )
	{
		cin >> t[ i ];
	}
	for( int i = 1; i <= d; ++i )
	{
		last[ t[ i ] ] = i;
		ans += arr[ i ][ t[ i ] ];
		for( int j = 1; j <= 26; ++j )
		{
			ans	-= c[ j ] * ( i - last[ j ] );
		}
		cout << ans << "\n";	
	}
	return 0;
}

Measured memory_bytes: 3684
#include<stdio.h>
#define MAX_V 1000000
int prime[MAX_V + 1];
int main(){
  int n, i, k;
  for(i = 2;i <= MAX_V;i++){
    prime[i] = 1;
  }
  for(i=2;i*i<=MAX_V;i++){
    if(prime[i]){
      for(k = 2*i;k <= MAX_V;k += i){
        prime[k] = 0;
      }
    }
  }
  scanf("%d", &n);
  while(n != 0){
    for(i=n;i>0;i--){
      if(prime[i]){
        if(prime[i-2]){
          printf("%d %d\n", i-2, i);
          break;
        }
      }
    }
    scanf("%d", &n);
  }
  return 0;
}

Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>

using namespace std;

pair<int64_t, int64_t> comb[200005];

int main()
{
  int64_t N;
  vector<int64_t> A;

  cin >> N;
  A.resize(N);

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

  auto sorted_A = A;
  int64_t total = 0;

  sort(sorted_A.begin(), sorted_A.end());

  for (int i = 0; i < sorted_A.size(); i++) {
    static int64_t count = 0;

    count++;

    if (i == sorted_A.size() - 1) {
      comb[sorted_A[i]].first = max<int64_t>(0, count * (count - 1) / 2);
      comb[sorted_A[i]].second = max<int64_t>(0, (count - 1) * (count - 2) / 2);
      total += comb[sorted_A[i]].first;
      break;
    }
    else if (sorted_A[i] != sorted_A[i + 1]) {
      comb[sorted_A[i]].first = max<int64_t>(0, count * (count - 1) / 2);
      comb[sorted_A[i]].second = max<int64_t>(0, (count - 1) * (count - 2) / 2);
      total += comb[sorted_A[i]].first;
      count = 0;
    }
  }

  for (auto &&i : A) {
    cout << total - comb[i].first + comb[i].second << endl;
  }

  return 0;
}


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

using namespace std;

int dig(int x) {
  int count = 1;
  while ((x /= 10) > 0) ++count;
  return count;
}

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

  int n;
  cin >> n;
  int res = 0;

  for (int i = 1; i <= n; ++i) {
    if (dig(i) % 2 == 0) 
      i = 10*i-1;
    else
      ++res;
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {

	string S, T;
	cin >> S;
	cin >> T;

	vector<vector<uint>> dp(S.length() + 1, vector<uint>(T.length() + 1));

	for(uint i=0; i<S.length(); i++) {
		for(uint j=0; j<	T.length(); j++) {
			dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
			dp[i+1][j+1] = (S[i]==T[j]) ? max(dp[i+1][j+1], dp[i][j] + 1) : dp[i+1][j+1];
			//cout << dp[i+1][j+1] << " ";
		}
		//cout << endl;
	}

	string ans = "";
	uint s = S.length();
	uint t = T.length();
	while(s > 0 && t > 0) {
		if(dp[s][t] == dp[s-1][t]) {
			s--;
		} else if(dp[s][t] == dp[s][t-1]) {
			t--;
		} else {
			//ans += S[s-1];
			ans = S[s-1] + ans;
			s--;
			t--;
		}
	}

	//reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 35584
#include <stdio.h>
int main( void )
{

	int x, y;
	
	scanf( "%d %d", &x, &y );
	
	while ( 1 ){
		if( x < y ){
			printf( "%d %d\n", x, y );
		}else{
			printf( "%d %d\n", y, x );
		}
		scanf( "%d %d", &x, &y );
		if( x == 0 && y == 0 ){
			break;
		}
	}
	
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string o,e;
  cin >> o >> e;
  rep(i,min(o.size(),e.size())){
    cout << o[i] << e[i] ;
  }
  if(o.size() > e.size()) cout << o.back();
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 256
//In the Name of God
//Ya Ali

#include <bits/stdc++.h>

#define int long long

#define err(A) cout << #A << " = " << (A) << endl

using namespace std;

const int maxn = 100100;

int n;

int s, t;

vector<int> g[maxn];

int d[maxn][2];

int ans;

void dfs(int v, int par, int r)
{
  for (int u: g[v])
    if (u != par)
      {
	d[u][r] = d[v][r] + 1;
	dfs(u, v, r);
      }
}

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

  cin >> n >> t >> s;
  s --, t --;

  for (int i = 0; i < n - 1; i ++)
    {
      int v, u;
      cin >> v >> u;
      v --, u --;
      g[v].push_back(u);
      g[u].push_back(v);
    }

  dfs(s, -1, 0);
  dfs(t, -1, 1);

  for (int i = 0; i < n; i ++)
    if (d[i][0] > d[i][1])
      ans = max(ans, d[i][0] - 1);

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


Measured memory_bytes: 12544
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

ll n;
string ans;

int main(void){
	cin>>n;
	while(n>0){
		n--;
		ans = (char)('a' + n%26) + ans;
		n/=26;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3568
import sys
readline=sys.stdin.readline

A,B,C=map(int,readline().split())
K=int(readline())

cnt = 0
while B <= A:
  B *= 2
  cnt += 1
  
while C <= B:
  C *= 2
  cnt += 1
  
if cnt <= K:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9168
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from functools import cmp_to_key
    n=int(input())
    B=[list(map(int,input().split())) for _ in range(n)]
    def cmp(a,b):
        va=min(a[1],b[1]-a[0])
        vb=min(b[1],a[1]-b[0])
        if(va==vb): return 0
        return -1 if(va>vb) else 1
    B.sort(key=cmp_to_key(cmp))
    maxS=20000
    dp=[-INF]*(maxS+1)
    dp[0]=0
    for i in range(n):
        w,s,v=B[i]
        ndp=dp[:]
        for total in range(maxS+1):
            if(total<=s and total+s<=maxS):
                ndp[total+w]=max(ndp[total+w],dp[total]+v)
        dp=ndp[:]
    print(max(dp))
resolve()

Measured memory_bytes: 135560
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(ll n;cin>>n,n;){
		int res=0;
		for(;n!=1;res++)
			if(n&1)
				n=n*3+1;
			else
				n/=2;
		cout<<res<<endl;
	}
	
	return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    char a[H+2][W+2];
    for (int i=0; i < H; i++){
        for (int j=0; j<W; j++){
            cin >> a[i+1][j+1];
        }
    }
    for (int i=0; i<H+2; i++){
        a[i][W+1] = '#';
        a[i][0] = '#';
    }
    for (int j=0; j<W+2; j++){
        a[0][j] = '#';
        a[H+1][j] = '#';
    }
    for (int i=0; i<H+2; i++){
        for (int j=0; j<W+2; j++){
            cout << a[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
using vll = vector<ll>;
using Graph = vii;
const ll MOD = 1e9 + 7;

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


Measured memory_bytes: 512
S = input()

if S[0] != "A":
    print("WA")
else:
    listC = []
    for i in range(2,len(S)-1):
        if S[i] == "C":
            listC.append(i)
    if len(listC) != 1:
        print("WA")
    else:
        listS = list(S)
        listS.pop(listC[0])
        listS.pop(0)
        S = "".join(listS)
        if S.islower():
            print("AC")
        else:
            print("WA")

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

#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define v(t) vector<t>
#define vv(t) vector<vector<t>>
#define vn(t,n,val) vector<t>(n,val)
#define vvn(t,r,c,val) vector<vector<t>>(r, vector<t>(c,val))
#define vvv(t) vector<vector<vector<t>>>
#define vvvn(t,l,b,h,val) vector<vector<vector<t>>>(l,vector<vector<t>>(b,vector<t>(h)))
void solve(){
	int n, x, y;
	cin>>n>>x>>y;

	vector<int> dist(n,0);
	int d;


	for(int i = 1; i <= n; ++i){
		for(int j = i+1; j <= n; ++j){
			d = min({abs(i-j), abs(i-x) + 1 + abs(y-j), abs(i-y) + 1 + abs(x-j)});
			dist[d]++;
		}
	}

	for(int i = 1; i < n; ++i){
		cout<<dist[i]<<"\n";
	}

}
int main() {
	sp;

	////////////////To Remove//////////////
	// freopen("../../input.txt", "r", stdin);
	// freopen("../../output.txt", "w", stdout);
	///////////////////////////////////////

	// int t;
	// cin>>t;
	// while(t--){
	// 	solve();
	// 	cout<<"/n";
	// }

	solve();

  	return 0;
}

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

using namespace std;
typedef long long int ll;

#define MAX (int)2e5
#define MOD (((ll)1e9) + 7)

int main(void){
  int N;
  ll A[MAX];
  cin >> N;
  for(int i=0;i<N;i++){
    ll tmp;
    cin >> tmp;
    A[i] = tmp;
  }
  ll sum = A[0];
  ll ans = 0;
  for(int i=1;i<N;i++){
    ans = (ans + A[i]*sum)%MOD;
    sum = (sum + A[i])%MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5176
fun main(args: Array<String>) = abc156d()

fun abc156d() {
    val (n, a, b) = readLine()!!.split(' ').map { it.toInt() }

    var answer = Mint(2).modPow(n.toLong())
    answer -= 1
    answer -= comb(n, a)
    answer -= comb(n, b)

    println(answer)
}

private const val MOD = (1e9 + 7).toLong()

private fun modPow(n: Long, p: Long): Long {
    var x = n
    var y = p
    var result = 1L

    x %= MOD
    while (y > 0) {
        if (y % 2 == 1L)
            result = (result * x) % MOD
        y = y shr 1
        x = (x * x) % MOD
    }

    return result
}

// useful for big N, and small K
private fun comb(n: Int, k: Int): Long {
    if (n < k) return 0

    val min = Math.min(k, n - k)
    var value = 1L

    for (i in 1L..min) {
        value *= n - i + 1
        value %= MOD
        value *= modPow(i, MOD - 2)
        value %= MOD
    }
    return value
}

private class Mint(value: Long = 0L) {
    constructor(other: Mint) : this(other.value)

    private val value = if (value < 0) (value % MOD) + MOD else value % MOD
    operator fun unaryPlus() = this
    operator fun unaryMinus() = Mint(MOD - this.value)
    operator fun inc() = this.plus(1)
    operator fun dec() = this.minus(1)
    operator fun plus(other: Long) = Mint(this.value + other)
    operator fun plus(other: Mint) = this.plus(other.value)
    operator fun minus(other: Long) = Mint(this.value - other)
    operator fun minus(other: Mint) = this.plus(-other)
    operator fun times(other: Long) = Mint(this.value * other)
    operator fun times(other: Mint) = this.times(other.value)
    operator fun div(other: Long) = this.times(Mod.modPow(other, MOD - 2, MOD))
    operator fun div(other: Mint) = this.div(other.value)
    fun modPow(other: Long) = Mint(Mod.modPow(this.value, other, MOD))
    override fun toString() = this.value.toString()
    override fun hashCode() = value.hashCode()
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false
        other as Mint
        return value == other.value
    }

    companion object Mod {
        private fun modPow(n: Long, p: Long, m: Long = MOD): Long {
            var x = n
            var y = p
            var result = 1L
            x %= m
            while (y > 0) {
                if (y % 2 == 1L) result = (result * x) % m
                y = y shr 1
                x = (x * x) % m
            }
            return result
        }
    }
}


Measured memory_bytes: 38228
a = gets.to_i
b_array = gets.split(" ")
c_array = []
d_array = []
for zahyo in 1..100 do
  c_array = []
  b_array.each do |banchi|
    banchi = banchi.to_i
    zahyo = zahyo.to_i
    x = 0
    x = (banchi - zahyo) ** 2
    c_array << x
  end
  sum = 0
  sum = c_array.inject(&:+)
  d_array << sum
end
puts d_array.min

Measured memory_bytes: 1916
import fractions
N, X  = map(int, input().split())

city = list(map(int, input().split()))

for i in range(N):
  city[i] -= X
  city[i] = abs(city[i])

#print(city)

ans = city[0]

for i in range(1,N):
  ans = fractions.gcd(ans,city[i])

print(ans)

Measured memory_bytes: 16240
#include<bits/stdc++.h>
#define int long long
#define p pair<int, int>
#define endl '\n'
const int INF = 1000000001;

using namespace std;

vector<int> factor(int n){
    vector<int> ans;
    int sqrt1 = sqrt(n)+1;
    for (int q = 2; q <= sqrt1; q++){
        if (n % q == 0){
            ans.push_back(q);
        }
        while (n % q == 0){
            n /= q;
        }
    }
    if (n != 1){
        ans.push_back(n);
    }
    return ans;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int q = 0; q < n; q++){
        cin >> a[q];
    }
    sort(a.begin(), a.end());
    int q1 = 0;
    while (q1 < n && a[q1] == 1){
        q1++;
    }
    int gcd1 = a[0];
    for (int q: a){
        gcd1 = __gcd(gcd1, q);
    }
    if (gcd1 != 1){
        cout << "not coprime" << endl;
        return 0;
    }
    vector<int> d(a.back()+1, 0);
    bool flag = true;
    while (q1 < n){
        vector<int> fact = factor(a[q1]);
        for (int q: fact){
            d[q]++;
            if (d[q] > 1){
                flag = false;
                break;
            }
        }
        if (!flag){
            break;
        }
        q1++;
    }
    if (flag){
        cout << "pairwise coprime" << endl;
    }else{
        cout << "setwise coprime" << endl;
    }
    return 0;
}


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

int main() {
int a,b,c;
  c=0;
  cin>>a>>b;
  for(int64_t i=0;i<=a;i++){if(b==2*i+4*(a-i)){cout<<"Yes"<<endl;
                                             c=1;
                                            break;}}
  if(c==0){cout<<"No"<<endl;}
}


Measured memory_bytes: 3616
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

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

/**
 *
 * @author nai
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception{
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bit = 0;
        for( int i = 0 ; i < N ; i++){
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
        
        
    }
  }
    



Measured memory_bytes: 21844
f = open(0)
N, M, L = map(int, f.readline().split())
A = [list(map(int, f.readline().split())) for i in range(N)]
B = [list(map(int, f.readline().split())) for i in range(M)]
C = [[0]*L for i in range(N)]
for i in range(N):
    for j in range(L):
        C[i][j] = str(sum(A[i][k]*B[k][j] for k in range(M)))
for line in C:
    print(*line)



Measured memory_bytes: 7272
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1, dtype = np.int64)
for _ in range(N):
    w, v = map(int, input().split())
    np.maximum(dp[w:], dp[:-w] + v, out = dp[w:])
print(dp.max())

Measured memory_bytes: 14572
#include<bits/stdc++.h>
using namespace std;
long long int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
int main()
{

    long long  a,b,r,t;
    cin>>a>>b;
    t=gcd(a,b);
    r=(a*b)/t;
    cout<<r;


}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()

print(n*800-(n//15)*200)

Measured memory_bytes: 65772
import sys
input = sys.stdin.buffer.readline
S = list(input())[: -1]
ls = S * 2
K = int(input())
if len(S) == 1:
  print(K // 2)
  exit(0)
if S.count(S[0]) == len(S):
  print(len(S) * K // 2)
  exit(0)
left = 0
mid = 0
right = 0
last = 0
i = 0
while i < len(S):
  if ls[i] == ls[i + 1]:
    left += 1
    if i == len(S) - 1:
      last = 1
    i += 1
  i += 1
i = 0 + last
while i < len(S):
  if ls[i] == ls[i + 1]:
    mid += 1
    i += 1
  i += 1
i = 0 + last
while i < len(S) - 1:
  if ls[i] == ls[i + 1]:
    right += 1
    i += 1
  i += 1
if K == 1:
  i = 0
  res = 0
  while i < len(S) - 1:
    if ls[i] == ls[i + 1]:
      res += 1
      i += 1
    i += 1
  print(res)
else:
  print(left + mid * max(K - 2, 0) + right)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int sei(int a){
  return a>0 ? a : 0;
}
long int power(int a,int b){
  long int count=1;
  for(int i=0;i<b;i++){
    count *= 2;
  }
  return count;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  long int a,b,count=0;
  scanf("%ld %ld",&a,&b);
  if(a==b){
    printf("%d",1);return 0;
  }
  for(long int i=1;i<b;i++){
    if(a*(long int)power(2,i) > b){
      count = i;break;
    }
    if(a*(long int)power(2,i) >= b){
      count=i+1;break;
    }
  }
  printf("%d",count);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
void trace(int A[], int N){
	int i;
	for(i = 0; i < N; i++){
		if(i > 0){
			printf(" ");
		}
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N){
	int i,j,v;
	for(i = 1; i < N; ++i){
		v = A[i];
		j = i - 1;
		while(j >= 0 && A[j] > v){
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
	
}
int main(int argc, char const *argv[])
{
	int N, i, j;
	int A[100];
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	trace(A, N);
	insertionSort(A, N);	
	return 0;
}

Measured memory_bytes: 2684
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>

#include <inttypes.h>
using namespace std;

int main()
{
	int32_t N;
	scanf("%d", &N);

	int32_t cnt[100001];
	memset(cnt, 0, sizeof(cnt));
	for (int32_t i = 0; i < N; i++) {
		int32_t A;
		scanf("%d", &A);
		cnt[A]++;
	}

	vector<int32_t> B;
	for (int32_t i = 0; i < 100001; i++) {
		if (cnt[i] < 1)
			continue;
		B.push_back(cnt[i] % 2 == 0 ? 2 : 1);
	}

	int32_t left = 0, right = (int32_t)(B.size() - 1);
	while (left < right) {
		if (B[left] == 1 && B[right] == 1) {
			left++;
			right--;
		} else if (B[left] == 1 && B[right] == 2) {
			left++;
		} else if (B[left] == 2 && B[right] == 1) {
			right--;
		} else if (B[left] == 2 && B[right] == 2) {
			B[left] = 1;
			B[right] = 1;
			left++;
			right--;
		}
	}
	int32_t res = B.size();
	for (size_t i = 0; i < B.size(); i++)
		if (B[i] == 2)
			res--;

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

	return 0;
}

Measured memory_bytes: 1276
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back

using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;
int t=1;
vll_t a,b;
int  main(){
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
	// #endif
	int n,x;
	cin>>n>>x;
	vector<int>v(n);
	int mi=INT_MAX,sum=0,count=n;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mi=min(mi,v[i]);
		sum+=v[i];
	}
	x-=sum;
	count+=floor(x/mi);
	cout<<count<<endl;
}

Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

Vec fac, finv;

ll PowMod(ll a, ll n){
	if(n == 1) return a;
	if(n%2 == 0) return PowMod(a*a%MOD, n/2);
	return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
	return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

void init(ll n){
	fac.resize(n+1);
	fac[0] = 1;
	repn(i, n) fac[i] = (fac[i-1]*i)%MOD;
	finv.resize(n+1);
	finv[n] = PowMod(fac[n], MOD-2);
	repr(i, n) finv[i] = (finv[i+1]*(i+1))%MOD;
	finv[0] = 1;
}

int main(void){
	ll r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	init(3e6);
 
	ll ans = 0;
	ans += combi(r2+c2+2, r2+1);
	ans -= combi(r2+c1+1, c1);
	ans -= combi(c2+r1+1, r1);
	ans += combi(r1+c1, r1);
	ans %= MOD;
	if(ans < 0) ans += MOD;
	co(ans);

	return 0;
}


Measured memory_bytes: 47104
import java.util.Scanner;
public class Main{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    boolean flag=true;
    String str=sc.next();
    for(int i=0;i<str.length();i++)
    {
      char ch=str.charAt(i);
      int count = 0;
      for(int j=0;j<str.length();j++)
      {
        if(ch==str.charAt(j))
        {
          count++;
        }
      }
      if(count%2!=0)
        flag=false;
    }
    if(flag)
      System.out.println("Yes");
    else
      System.out.println("No");
  }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<typename U, typename V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
    FAST_IO();    
    int N; cin >> N;
    vector<int> A(N + 1);
    repp(i, 1, N) cin >> A[i];
    int j = 1;
    int ans = 0;
    while(j <= N) {
        if(A[j] == j) {
            ans += 1;
            j += 2;
        } else {
            j += 1;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  string s;cin>>s;
  int n=s.size();
  int l=0,r=0;
  rep(i,n){
    if(s[i]=='A')break;
    l++;
  }
  for(int i=n-1;i>0;i--){
    if(s[i]=='Z')break;
    r++;
  }
  cout<<n-(l+r)<<endl;
}

Measured memory_bytes: 3692
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		boolean flg = true;

		while (flg) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();

			if (a > b) {
				resultList.add(b + " " + a);
			} else if (a < b) {
				resultList.add(a + " " + b);
			} else if (0 == a && 0 == b) {
				flg = false;
				break;
			}else if(a == b){
				resultList.add(a + " " + b);
			}

		}

		for (int i = 0; i < resultList.size(); i++) {
			System.out.println(resultList.get(i));
		}
	}
}

Measured memory_bytes: 27768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
/*int vis[maxn],p[maxn];
int cnt=0;
void prime(){
    memset(vis,0,sizeof vis);
    memset(p,0,sizeof p);
    for(int i=2;i<=maxn;i++){
        if(!vis[i]) p[cnt++]=i;
        for(int j=2*i;j<=maxn;j+=i){
            vis[j]=1;
        }
    }  
}*/
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==3||b==3){
        if(a==3) cout<<a-b;
        else cout<<b-a;
    }
    else cout<<a+b;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        if (A[i + 1] > A[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3100
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<iomanip>

using ll = long long;
using ull = unsigned long long;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main(){
  ll n, m; cin >> n >> m;
  ull na = 1, ma = 1;

  ll diff = 0;
  if(n == m) diff = 2;
  else if (abs(n - m) == 1) diff = 1;

  for(int i = 2; i <= n; i++) na = (na*i) % mod;
  for(int i = 2; i <= m; i++) ma = (ma*i) % mod;

  ull ans = (na*ma*diff) % mod;

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

Measured memory_bytes: 256
#include<stdio.h>
int dp[50];

int fi(int n){
    if(n == 0 || n == 1){
        return dp[n] = 1;
    }
    if(dp[n] != -1){
        return dp[n];
    }
    return dp[n] = fi(n-1)+fi(n-2);
}

int main(){
    int n,i;
    for(i=0;i<50;i++)
    dp[i] = -1;

    scanf("%d",&n);
    printf("%d\n",fi(n));

    return 0;
}


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

typedef long long ll;

const int MOD = 1e9 + 7 ;
const double PI = 2 * acos(0.0);


int main()
{
  ll n, m ;
  cin >> n >> m ;
  if(n == m)  cout << "Yes" << endl ;
  else cout << "No" << endl ;
}


Measured memory_bytes: 256