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

#define ll long long
#define vecll vector<long long>
#define vecs vector<string>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
  ll n, l;
  cin >> n >> l;
  string str = "";
  vecs s(n);
  forll(i, 0, n)
	cin >> s[i];
  sort(s.begin(), s.end());
  forll(i, 0, n)
	str += s[i];
  cout << str;
}

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


int main() {
	// your code goes here
	ll n,m;
	cin>>n>>m;
	ll x,sum=0;
	while(m--)
	{
	    cin>>x;
	    sum+=x;
	}
	if(sum>n)
	cout<<-1;
	else
	cout<<n-sum;
	
	
	return 0;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#define rep(i,j,k) for(register int i = j; i <= k; i++) 
#define dow(i,j,k) for(register int i = j; i >= k; i--)
#define fi first
#define se second
//#define P pair<ll,ll>
#define mp(a,b) make_pair(a,b)
#define ll long long
#define ull unsigned long long
using namespace std;

inline int read() { 
	int s = 0, t = 1; char c = getchar();
	while( !isdigit(c) ) { if( c == '-' ) t = -1; c = getchar(); }
	while( isdigit(c) ) s = s * 10 + c - 48, c = getchar();
	return s * t;
}

const int N = 4008, M = 2001, p = 1e9+7;
inline void _(ll &x) { if( x >= p ) x -= p; }
ll ans = 0, f[N][N], g[N][N], fac[N<<1] = {1}, ni[N<<1] = {1,1};
inline ll C(int n,int m) { 
	return fac[n] * ni[m] % p * ni[n-m] % p;
}

int main() {
	int n = read(), x, y, mx = 0, my = 0; 
	rep(i,1,8000) fac[i] = fac[i-1] * i % p;
	rep(i,2,8000) ni[i] = (p - p / i) * ni[p % i] % p;
	rep(i,2,8000) ni[i] = ni[i] * ni[i-1] % p;
	rep(i,1,n) { 
		mx = max(mx,x = read()), my = max(my,y = read());
		f[M-x][M-y]++; 
		g[M+x][M+y]++;
		(ans -= C((x+y)<<1,x<<1)) %= p;
	}
	rep(i,M-mx,M+mx) { 
		rep(j,M-my,M+my) { 
			_(f[i][j]+=f[i-1][j]);
			_(f[i][j]+=f[i][j-1]);
		}
	} 
	rep(i,1+M,mx+M) { 
		rep(j,1+M,my+M) { 
			(ans += (ll)g[i][j] * f[i][j]) %= p;
		}
	}
	cout<<(ans + p) % p * ((p + 1) / 2) % p<<endl;
	return 0;
}

Measured memory_bytes: 189824
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int i, n, sum, p[1001];
  while(1) {
    sum = 0;
    cin >> n;
    if(n==0) break;
    for(i=0; i<n; i++) {
      cin >> p[i];
      sum += p[i];
    }
    sort(p, p+n);
    sum -= p[0] + p[n-1];
    sum /= n-2;
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 1176
#include <iostream>

using namespace std;

int main(void) {
  int N, A, B;
  cin >> N;
  cin >> A;
  cin >> B;
  
  if(N*A > B) {
    cout << B << endl;
  } else {
    cout << N*A << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
  int a, b; cin>>a>>b;
  if(a<=9 && b<=9){
    cout<<a*b<<endl;
  }else{
    cout<<-1<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
  double a,b,c,PI=3.1415926535;
  cin >> a >> b >> c;
  printf("%.5f\n",a*b*sin(c*PI/180)/2);
  printf("%.5f\n",sqrt(a*a+b*b-2*a*b*cos(c*PI/180))+a+b);
  printf("%.5f\n",b*sin(c*PI/180));
  return 0;
}



Measured memory_bytes: 3340
N = int(input())
Info = [list(map(int, input().split())) for i in range(N)]
Info_nonzero = []
highest = 0
for x, y, h in Info:
    if h != 0:
        Info_nonzero.append([x, y, h])

for x, y, h in Info:
    if h == 0:
        highest = max(highest, x + y)

for Cx in range(101):
    for Cy in range(101):
        candidate_set = set()
        for x, y, h in Info_nonzero:
            H = abs(Cx - x) + abs(Cy - y) + h
            candidate_set.add(H)

        ans_H = list(candidate_set)[0]
        if len(candidate_set) == 1:
            for x, y, h in Info:
                H = abs(Cx - x) + abs(Cy - y) + h
                if h == 0:
                    if not H >= ans_H:
                        break

                if h != 0:
                    if not H <= ans_H:
                        break
            else:
                print(Cx, Cy, abs(Cx - Info_nonzero[0][0]) + abs(Cy - Info_nonzero[0][1]) + Info_nonzero[0][2])
                exit()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <array>
#include <numeric>
#include <algorithm>
#include <set>
#include <deque>
using namespace std;
using ll = long long;
constexpr double INF{ 1e9 };
constexpr int MAGIC_PRIME{ 1000000000 + 7 };
constexpr array<int, 4> dy{ -1, 1, 0, 0 };
constexpr array<int, 4> dx{ 0, 0, -1, 1 };
constexpr int div_ru(int a, int b)
{
    return (a - b + 1) / b;
}
ll pow_mod(ll b, ll e, ll m)
{ // https://atcoder.jp/contests/atc002/tasks/atc002_b
    ll r = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            r = (r * b) % m;
        b = (b * b) % m;
    }
    return r;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> s(n);
    int s_sum = 0;
    for (int& x : s) {
        cin >> x;
        s_sum += x;
    }

    int ans;
    if (s_sum % 10 != 0)
        ;
    else {
        sort(s.begin(), s.end());
        for (int& x : s) {
            if (x % 10 != 0) {
                s_sum -= x;
                break;
            }
        }
        if (s_sum % 10 == 0)
            s_sum=0;
    }

    cout << s_sum << endl;


}
// vector<vector<int>> mm(h, vector<int>(w, -1));


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<stack>
using namespace std;
int trace(stack<int> S){
    for(int i=0;i<S.size();i++){
	cout << S.top() << endl;
	S.pop();
    }
}

int main(){
    int a,b;
    string s;
    stack<int> S;

    while(cin >> s){
	if(s[0]=='+'){
	    a=S.top(); S.pop();
	    b=S.top(); S.pop();
	    S.push(a+b);
	}else if(s[0]=='-'){
	    b=S.top(); S.pop();
	    a=S.top(); S.pop();
	    S.push(a-b);
	}else if(s[0]=='*'){
	    a=S.top(); S.pop();
	    b=S.top(); S.pop();
	    S.push(a*b);
	}else {
	    S.push(atoi(s.c_str()));
	}
    }

    cout << S.top() << endl;

    return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
string s;
int main(){
	cin>>s;
	int t1=0,t2=0;
	for (int i=0;i<s.size();i++){
		if (i%2==0){
			if (s[i]=='1') t1++; 
		} else if (s[i]=='0') t1++;
	}
	for (int i=0;i<s.size();i++){
		if (i%2==0){
			if (s[i]=='0') t2++; 
		} else if (s[i]=='1') t2++;
	}
	cout<<min(t1,t2)<<endl;
	return 0;
}



Measured memory_bytes: 512
#include <stdio.h>
 
int main(void) {
	int a,b,c,d,e;
	scanf("%d",&a);
    b=a/3600;
    c=a-b*3600;
    d=c/60;
    e=c-d*60;
    printf("%d:%d:%d\n",b,d,e);
	return 0;
}


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

using namespace std;


#define loop(i,a,n)     for(int i=a;i<n;i++)
#define rloop(i,n,a)    for(int i=n;i>=a;i--)
#define all(v)          v.begin(),v.end()
#define all(v)          v.begin(),v.end()
#define p(a)            cout<<a<<" ";
#define check           cout<<"OOOOOF"<<endl;

int main()
{
    int q,x,y,cnt=0;
    bool f = 0;
    cin >> q;
    while(q--)
    {
        cin >> x >> y;
        if(x==y)cnt++;
        else cnt=0;
        if(cnt==3)f=1;
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main()
{
    long long ullNumA = 0;
    char iOp = 0;
    long long ullNumB = 0;
     
    while (cin >> ullNumA >> iOp >> ullNumB)
    {
        if ('+' == iOp)
        {
            cout << ullNumA + ullNumB << endl;
        }
        else if ('-' == iOp)
        {
            cout << ullNumA - ullNumB << endl;
        }
        else if ('*' == iOp)
        {
            cout << ullNumA * ullNumB << endl;
        }
        else if ('/' == iOp)
        {
            cout << ullNumA / ullNumB << endl;
        }
        else if ('?' == iOp)
        {
            break;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

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

    string s; cin >> s;

    vector<string> v{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    
    rep(i, 7) if(v[i] == s) { cout << 7-i << endl; return 0; }
    
    
    return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define cd complex<double>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-12;
const int N=200000+10,maxn=200000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int a[N],b[N];
int main()
{
    int n;scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        b[i]=a[i];
    }
    sort(b,b+n);
    int mid=b[(n-2)/2],num=0;
    for(int i=0;i<n;i++)
        if(a[i]==mid)
            num++;
    for(int i=0;i<n;i++)
    {
        if(a[i]>mid)printf("%d\n",mid);
        else printf("%d\n",b[(n-2)/2+1]);
    }
    return 0;
}
/***********************

***********************/


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) {  // 発見できたとき
    return 1;
  } else {  // 発見できなかったとき
    return 0;
  }
}
int main() {
  int n, d;
  cin >> n >> d;
  double x, y, f = 0;
  double s;
  double ans;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    // cout << "xy=" << x << " " << y << endl;
    s = x * x + y * y;
    ans = sqrt(s);
    // cout << "ans=" << ans << endl;
    if (ans <= d) {
      // cout << f << endl;
      f++;
    }
  }
  cout << f;
  return 0;
}

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

int main(){
    int n, x;
    cin >> n >> x;

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

    int current = 0;
    for(int i=0; i<n; i++){
        current += l[i];
        if(current > x){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << n+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, m, n) for (int i = m; i < n; ++i)
const int MOD = 1000000007;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int dp[44][404][404];

int main() {
  int N, Ma, Mb;
  cin >> N >> Ma >> Mb;
  vector<int> a(N), b(N), c(N);
  rep(i, 0, N) cin >> a[i] >> b[i] >> c[i];
  rep(i, 0, 44) rep(j, 0, 404) rep(k, 0, 404) dp[i][j][k] = MOD;
  dp[0][0][0] = 0;
  rep(i, 0, N) rep(j, 0, 404) rep(k, 0, 404) {
    if(dp[i][j][k] == MOD) continue;
    chmin(dp[i+1][j][k], dp[i][j][k]);
    chmin(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
  }
  int ans = MOD;
  rep(i, 1, 404) rep(j, 1, 404) {
    if(i * Mb == j * Ma) chmin(ans, dp[N][i][j]);
  }
  if(ans == MOD) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 28288
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    vector<int> b(n);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        a--;

        b[a] = i;
    }

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

    return 0;
}

Measured memory_bytes: 1280
a_list = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b_list = [int(input()) for _ in range(n)]

for y in range(3):
    for b in b_list:
        if b in a_list[y]:
            index = a_list[y].index(b)
            a_list[y][index] = -1

is_bingo = False
for y in range(3):
    if sum(a_list[y]) == -3:
        is_bingo = True
        break

for x in range(3):
    if a_list[0][x]+a_list[1][x]+a_list[2][x] == -3:
        is_bingo = True
        break

if a_list[0][0]+a_list[1][1]+a_list[2][2] == -3:
    is_bingo = True
elif a_list[0][2]+a_list[1][1]+a_list[2][0] == -3:
    is_bingo = True


if is_bingo:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
N, K = map(int, input().split())

if K == 0:
  print(N)
else:
  if N >= K:
    kotae1 = abs(N - ((N // K) * K))
    kotae2 = abs(N -((N // K) + 1) * K)
    if kotae1 > kotae2:
      print(kotae2)
    else:
      print(kotae1)

  else:
    keisan = abs(N - K)
    if keisan > N:
      print(N)
    else:
      print(keisan)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll N;
  cin >>N;
  vl s(N);
  rep(i,N) {
    cin >>s.at(i);
  }
  ll count=0;
  rep(i,N) {
    if(s.at(i)%10==0) {
      count++;
    }
  }
if(count==N) {
cout<<0<<endl;
  return 0;
}
  
  
  else {
    
    ll sum=0;
    rep(i,N) {
      sum +=s.at(i);
    }
    if(sum%10!=0) {
      cout<<sum<<endl;
      return 0;
    }
    
    
    else if(sum%10==0) {
      vector<pl> vect(N);
      rep(i,N) {
        vect.at(i).second=s.at(i);
        vect.at(i).first=s.at(i)%10;
      }
      
      
    sort(all(vect));
      
      ll z=0;
      rep(i,N) {
        if(vect.at(i).first!=0) {
          z=vect.at(i).second;
          break;
        }
      }
      cout<<sum-z<<endl;
      return 0;
    }
    
  }
  
  
}
  


Measured memory_bytes: 256
import sys
for i in sys.stdin:
    try:
        sidelen = [int(j) for j in i.split(" ")]
        if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2 or sidelen[1]**2 == sidelen[0]**2 + sidelen[2]**2 or sidelen[2]**2 == sidelen[0]**2 + sidelen[1]**2):
            print("YES")
        else:
            print("NO")
    except:
        continue

Measured memory_bytes: 7708
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
#define abs(x) ((x) < 0 ? -(x) : (x))
#define LL long long
using namespace std;
int read() {
	int f = 1,x = 0;char s = getchar();
	while(s < '0' || s > '9') {if(s == '-') f = -1;s = getchar();}
	while(s >= '0' && s <= '9') {x = x * 10 + s - '0';s = getchar();}
	return x * f;
}
LL n,m,i,j,s,o,k,d;
LL a[2005];
LL A,B;
LL mod = 1e9 + 7;
int main() {
	n = read();m = read();
	for(int i = 1;i <= n;i ++) {
		a[i] = read();
		for(int j = 1;j < i;j ++) {
			if(a[j] > a[i]) A ++;
			if(a[j] < a[i]) B ++;
		}
	}
	A %= mod;
	B %= mod;
	LL ca = ((m + 1) * m / 2) % mod;
	LL cb = (m * (m - 1) / 2) % mod;
	A = (A * ca) % mod;
	B = (B * cb) % mod;
	printf("%d\n",(A + B) % mod);
	return 0; 
}

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

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> c(H,vector<char>(W));
    vector<int> gyou(H,0);
    vector<int> retsu(W,0);
    int black = 0;
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cin >> c[i][j];
            if (c[i][j]=='#') {
                gyou[i]++;
                retsu[j]++;
                black++;
            }
        }
    }

    int count = 0;

    for (int s=0; s<(1<<H); s++) {
        for (int t=0; t<(1<<W); t++) {

            int N = black;

            for (int i=0; i<H; i++) {
                if ((s>>i)&1==1) {
                    N -= gyou[i];
                    for (int j=0; j<W; j++) {
                        if ((t>>j)&1==1 and c[i][j]=='#') {
                            N++;
                        }
                    }
                }
            }

            for (int j=0; j<W; j++) {
                if ((t>>j)&1==1) {
                    N -= retsu[j];
                }
            }

            if (N==K) {
                count++;
            }

        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3596
n=int(input())
a=list(map(int,input().split()))
mx=max(a)
cnt=[0 for _ in range(mx)]
ans=[0 for _ in range(mx)]
for x in a:
  cnt[x-1]+=1
prm=0
for x in cnt:
  if x>1:
    prm+=x*(x-1)//2
#print(prm)


for x in a:
  z=cnt[x-1]
  if z==1:
    print(prm)
  else:
    print(prm-z+1)



Measured memory_bytes: 25716
#include <iostream>
//#include <array>
#include <vector>

bool judge(std::vector<long> a) {
  for (unsigned int i = 0; i < a.size(); i++) {
    if (a[i] % 2 == 1) {
      return false;
    }
  }
  return true;
}

int main() {
  unsigned int n;
  std::cin >> n;
  std::vector<long> a(n);
  for (unsigned int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  int counter = 0;
  while (true) {
    if (judge(a)) {
      for (unsigned int i = 0; i < n; i++) {
        a[i] = a[i] / 2;
      }
      counter++;
    } else {
      break;
    }
  }
  std::cout << counter << '\n';

  return 0;
}


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

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

	int count = 0;
	for ( int i = 0; i <= a; ++i ) {
		for ( int j = 0; j <= a; ++j ) {
			int data =  b - i - j;
			if ( data >= 0 && data <= a ) {
				count++;
			}
		}
	}
	std::cout << count << std::endl;
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef long long ll;

const int    INF = 1000000000;
const int    MOD = 1000000007;
const double EPS = 1e-8;

int main(){
    int M, N;
    while(cin >> M >> N && M){
        vector<int> T(N);
        REP(i, N) cin >> T[i];
        deque<int> parking[10];
        deque<int> time[10];
        deque<int> wait;
        vector<int> ans;
        for(int t = 0; (int)ans.size() < N; t++){
            //cout << t << ":" << endl;
            //REP(i, M) { printf("parking[%d]:", i); for(auto& pi : parking[i]) cout << pi << " "; cout << endl; }
            //REP(i, M) { printf("time[%d]:", i); for(auto& ti : time[i]) cout << ti << " "; cout << endl; }
            for(int i = 0; i < M; i++){
                while(!time[i].empty() && time[i].back() <= 0){
                    ans.push_back(parking[i].back());
                    parking[i].pop_back();
                    time[i].pop_back();
                }
            }

            if(t % 10 == 0 && t / 10 < N){
                wait.push_back(t / 10);
            }

            while(!wait.empty()){
                int id = wait.front(); wait.pop_front();
                if(any_of(parking, parking + M, [](deque<int>& d){ return d.empty(); })){
                    for(int i = 0; i < M; i++) if(parking[i].empty()){
                        parking[i].push_back(id);
                        time[i].push_back(T[id]);
                        break;
                    }
                }else{
                    vector<pair<int, int>> vp;
                    for(int i = 0; i < M; i++) if(time[i].size() == 1) vp.push_back(make_pair(time[i].front(), i));
                    if(vp.empty()){
                        wait.push_front(id);
                        break;
                    }else{
                        sort(vp.begin(), vp.end());
                        int k = 0;
                        while(k + 1 < (int)vp.size() && vp[k].first < T[id]) k++;
                        int c = vp[k].second;
                        parking[c].push_back(id);
                        time[c].push_back(T[id]);
                    }
                }
            }

            for(int i = 0; i < M; i++)
                for(auto& t : time[i])
                    t--;
        }
        for(int i = 0; i < ans.size(); i++){
            cout << ans[i] + 1;
            if(i == ans.size() - 1) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)



string x;


int main()
{

	cin >>x;

	x.insert(4," ");

	cout << x << endl;





}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){

  int N=0,A=0;
  cin >> N >> A;
  int num1=0, num2=0;
  num1=N/500;
  num1 = N-num1*500;
  if(num1 <= A){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }


}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int MOD = (int) 1e9 + 7;

void add(int &a, int b)
{
	a += b;
	if (a >= MOD)
		a -= MOD;
}
int mul(int a, int b)
{
	return (a * 1LL * b) % MOD;
}

const int N = 305;
int dp[2][N][N];

int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int n, m;
	scanf("%d%d", &n, &m);
	int t = 0, nt = 1;
	dp[t][1][0] = 1;
	
	for (int it = 0; it < m; it++)
	{
		memset(dp[nt], 0, sizeof dp[nt] );
		for (int a = 0; a <= n; a++)
			for (int b = 0; a + b <= n; b++)
			{
				int cur = dp[t][a][b];
				if (cur == 0) continue;
				add(dp[nt][a][b + 1], mul(cur, n - a - b) );
				add(dp[nt][a][b], mul(cur, b) );
				add(dp[nt][a + b][0], mul(cur, a) );
			}
		swap(t, nt);
	}
	printf("%d\n", dp[t][n][0] );


	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    ll n;
  cin >> n;
    if (n % 2 != 0) {
        cout << 0 << endl;
        exit(0);
    }
    ll p = (n % 2 == 0 ? 10 : 5);
    ll ans = 0;
    while (p <= n) {
        ans += n / p;
        p *= 5;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

typedef pair<int,int> pii;

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

    int n,k; cin >> n >> k;

    if(k>(n-1)*(n-2)/2){
        cout << "-1" << endl;
        return 0;
    }

    std::vector<pii> v;
    std::vector<pii> ans;

    rep(i,n) rep(j,n){
        if(i>=j) continue; // i<j
        if(i==0) ans.push_back(make_pair(i,j));
        else v.push_back(make_pair(i,j));
    }

    int current = (n-1)*(n-2)/2, i=0;

    while(current != k){
        ans.push_back(v[i]); i++;
        current--;
    }

    cout << ans.size() << endl;
    rep(i,ans.size()) cout << ans[i].first+1 << " " << ans[i].second+1 << endl;

    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

	    String S = scanner.next();
	    int z = 0;
	    int o = 0;
	    for (int i = 0; i < S.length(); i++) {
	        if (S.charAt(i) == '0') {
	        	z++;
	        } else {
	        	o++;
	        }
	    }
	    
	    int r = Math.min(z, o) * 2;


        System.out.print(r);
	}
}

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

long long INF = 1e18;

int main(){
    char s[10];
    for (int i = 0; i < 6;i++){
        cin >> s[i];
    }
    if(s[2]==s[3]&&s[4]==s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
            return 0;
}

Measured memory_bytes: 256
S = 0; l = []; a = [0]*1001
for i in xrange(1001):
    S += i
    l.append(S)
for i in xrange(1001):
    for j in xrange(i-2,-1,-1):
        if l[i]-l[j]>1000: break
        a[l[i]-l[j]]+=1
while 1:
    n = input()
    if n==0: break
    print a[n]

Measured memory_bytes: 4256
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main implements Runnable
{
    static int dx[]={-1,0,1,0};
    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int m=sc.nextInt();
        if(n==m)ret("Yes");
        
        out.print("No");
     	out.flush();
    }
        
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


class P implements Comparable<P>{
    int x,y;
    P(int x,int y) {
    	this.x=x;
    	this.y=y;
    }

    public int compareTo(P p){
        return y-p.y;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      cin >> A[i][j];
    }
  }
  vector<bool> row_removed(H, true);
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (A[i][j] == '#') {
        row_removed[i] = false;
        break;
      }
    }
  }
  vector<bool> col_removed(H, true);
  for (int j = 0; j < W; ++j) {
    for (int i = 0; i < H; ++i) {
      if (A[i][j] == '#') {
        col_removed[j] = false;
        break;
      }
    }
  }
  for (int i = 0; i < H; ++i) {
    if (row_removed[i]) continue;
    for (int j = 0; j < W; ++j) {
      if (col_removed[j]) continue;
      cout << A[i][j];
    }
    cout << endl;
  }
  return 0;
}


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

int main() {
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  int a=h1*60+m1,b=h2*60+m2;
  if(b-a-k>0){
  cout<<b-a-k<<endl;
}
else{
  cout<<0<<endl;
}
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  bool exist_odd=false;
  int count=0;
  while(!exist_odd){
    for(int i=0;i<N;i++){
      if(A.at(i)%2==1){
        exist_odd=true;
        break;
      }
    }
    if(exist_odd){
      break;
    }
    for(int i=0;i<N;i++){
      A.at(i)/=2;
    }
    count++;
  }
  cout << count << endl;
}

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

using namespace std;

using ll = long long;

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

    int a, b, c;

    cin >> a >> b >> c;
    if (a + b >= c) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


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

using namespace std;

int main()
{
    int n;
    long x;
    cin >> n >> x;
    vector<long> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    long c = 0;
    for (int i = 1; i < n; ++i) {
        long s = a[i-1] + a[i];
        if (s > x) {
            c += s - x;
            a[i] -= min(s - x, a[i]);
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Ford(i,a,b) for(int i=(a);i>=(b);--i)
#define fio(s) freopen(s".inp","r",stdin)
#define foo(s) freopen(s".out","w",stdout)
#define task "test"
using namespace std;
typedef long long LL;
const LL N=200009,OO=1e9+7;
LL a[N],h[N],T[N],ans,n,tmp;
void upd(LL id,LL val){
    while(id<N){
        T[id]=max(T[id],val); id+=id&-id;
    }
}
LL get(LL id){
    LL op=0;
    while(id>0){
        op=max(op,T[id]); id-=id&-id;
    }
    return op;
}
int main(){
    //fio(task); foo(task);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    For(i,1,n) cin>>h[i];
    For(i,1,n) cin>>a[i];
    For(i,1,n){
        tmp=get(h[i])+a[i];
        upd(h[i],tmp);
        ans=max(ans,tmp);
    }
    cout<<ans;
    return 0;
}


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

using namespace std;

int main() {
    int n, m;

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

    vector<int> a(m);

    for(int i = 0; i < m; i++) {
        scanf("%d", &a.at(i));
    }

    for(int d : a) {
        n -= d;
    }

    if(n < 0) {
        printf("-1\n");
    } else {
        printf("%d\n", n);
    }

    return 0;
}

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

int main(){
    string s;
    int len = 0;
    cin >> s;
    len = s.length() -1;
    
    if(s[0] !='A' || (int)s[1] < 97 || (int)s[len] >122){
        cout << "WA" << endl;
        return 0;
    }

    if((int)s[len] < 97 || (int)s[len] >122){
        cout << "WA" << endl;
        return 0;
    }
    bool flg = false;
    for(int i =2; i< len; i++){
        if(s[i] == 'C'){
            if(flg) {
                cout<< "WA" << endl;
                return 0; 
            }
            flg = true;
            
        }else if((int)s[i] < 97 || (int)s[i] >122){
            cout<< "WA" << endl;
            return 0;
        }
        
    }
    
    cout << (flg ? "AC": "WA") << endl;

    return 0;
}


Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
long long a[N];
long long b[N];
long long ans[N];

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        scanf("%lld" , &a[i]);
        b[i] = a[i] + a[i];
    }
    long long totSUM = 0;
    for(int i = 1; i <= n; i++){
        totSUM += b[i];
    }
    totSUM /= 2;
    for(int i = 1; i <= n - 2; i += 2){
        totSUM -= b[i];
    }
    long long e = totSUM;
    ans[n] = e;
    for(int i = n - 1; i >= 1; i--){
        ans[i] = b[i] - ans[i + 1];
    }
    for(int i = 1; i <= n; i++){
        printf("%lld " , ans[i]);
    }

}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,K,A,i,ans=0;cin>>N>>K;
  vector<ll>C(N,0);
  REP(i,N){cin>>A;C.at(A-1)++;}
  sort(ALL(C));
  REP(i,N-K)ans+=C.at(i);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string.h>

#define INC(i, a, b) for(int i = a; i < b; ++i)
#define DEC(i, a, b) for(int i = a; i > b; --i)
#define REP(i, n)    for(uint i = 0; i < n; ++i)

typedef unsigned int uint;
typedef unsigned long ul;
typedef long long  ll;
typedef unsigned long long ull;

using namespace std;

void TFprint(bool b, std::string T, std::string F){
    if(b){
        cout << T << endl;
    }else{
        cout << F << endl;
    }
}

int main(){
   int x[3];
   cin >> x[0] >> x[1] >> x[2];
   int max = 0;
   int index = -1;
    REP(i, 3){
        if(max < x[i]){
            max =x[i];
            index = i;
        }
    }
    int a = max - x[(index + 1) % 3], b = max - x[(index + 2) % 3];
    if(a % 2 == 0 && b % 2 == 0){
        cout << a / 2 + b / 2 << endl;
    }else if(a % 2 == 1 && b % 2 == 1){
        cout << a / 2 + b / 2 + 1 << endl;
    }else{
        cout << a / 2 + b / 2 + 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import itertools
s = list(input())
ans = 0
l = list(itertools.product(["","+"],repeat=len(s)-1))
for d in l:
  f = ""
  for s1,s2 in zip(s,list(d)+[""]):
    f += s1+s2
  ans += eval(f)
print(ans)

  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C ++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()

//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD 998244353
#define INF 0x3f3f3f3f
#define MAXN (int)(2e5+5)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
//DEBUG
#define shout()  {cout << "I'm Here...!!!" << endl;}
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
ll t[4*MAXN];
ll dp[MAXN];
ll querySeg(int v, int tl, int tr, int l, int r){
	if(l>r)
		return 0;
	if(l==tl and r==tr)
		return t[v];
	int tm = (tl + tr)/2;
	return max(querySeg(v*2, tl, tm, l, min(r, tm)),querySeg(v*2+1, tm+1, tr, max(l, tm+1), r));
}
void updateSeg(int v, int tl, int tr, int pos, ll new_val){
	if(tl==tr)
		t[v] = new_val;
	else{
		int tm = (tl+tr)/2;
		if(pos<=tm)
			updateSeg(v*2, tl, tm, pos, new_val);
		else
			updateSeg(v*2+1, tm+1, tr, pos, new_val);
		t[v] = max(t[v*2],t[v*2 + 1]);
	}
}
int main()
{
	fastio;
	int n;cin>>n;
	vll h(n+1),a(n+1);
	for(int i=1;i<=n;i++)cin>>h[i];
	for(int i=1;i<=n;i++)cin>>a[i];
	//dp[i] max total score when last flower picked is of height i
	//note height is unique so height and flower has unique relation

	for(int flower=1;flower<=n;flower++)
	{
		
		dp[h[flower]]=a[flower]+querySeg(1,0,n,0,h[flower]-1);
	//	cout<<h[flower]<<" "<<querySeg(1,0,n,0,h[flower]-1)<<endl;
		updateSeg(1,0,n,h[flower],dp[h[flower]]);		
	}
	ll res=LLONG_MIN;	
	for(int i=1;i<=n;i++)
	{
		res=max(res,dp[i]);
		//cout<<dp[i]<<" ";
	}
	cout<<res<<endl;
}


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

int main(){
    int h, w;
    cin >> h >> w;
    char mat[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> mat[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            char c; cin >> c;
            if(c != mat[i][j])  ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7008
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    ll m = t.size();

    vvl dp(n+1, vl(m+1));  // dp[i][j] : sのi文字目までとtのj文字目までのLCSの長さ
    rep(i, n) {
        rep(j, m) {
            if(s[i] == t[j]) {
                chmax(dp[i+1][j+1], dp[i][j] + 1);
            }
            else {
                chmax(dp[i+1][j+1], max(dp[i+1][j], dp[i][j+1]));
            }
        }
    }

    string ans = "";
    ll i = n-1, j = m-1;
    while(i >= 0 && j >= 0) {
        if(dp[i+1][j+1] == dp[i][j+1]) {
            i--;
        }
        else if(dp[i+1][j+1] == dp[i+1][j]) {
            j--;
        }
        else if(dp[i+1][j+1] == dp[i][j] + 1) {
            ans = s[i] + ans;
            i--;  j--;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 74096
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int odd_flg = 0;
    if(n%2 == 1)
    {
        odd_flg = 1;
    }
    vector<int> vec(n);
    int j = n/2;
    int count = 1;
    if(odd_flg == 1)
    {
         for(int i = 0; i < n; i++)
        {
           cin >> vec[j];
           if(i%2 == 0)
           {
               j = j + count;
           }else{
               j = j - count;
           }
           count++;
       }
    }else{
        for(int i = 0; i < n; i++)
        {
           cin >> vec[j];
           if(i%2 == 0)
           {
               j = j - count;
           }else{
               j = j + count;
           }
           count++;
       }
        
        
        
    }
    
   
    
    for(int i = 0; i < n; i++)
    {
       cout << vec[i] << " ";
    }
   
    
}


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

int main(void) {
    int n,a,b;
    vector<int> v;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end() );
    a = b = 0;
    for (int i=0; i<n-1; i++) {
        if (v[i]==v[i+1]) {
            a++;
        } else {
            if (a%2) {
            } else {
                b++;
            }
            a = 0;
        }
    }
    if (a%2) {
    } else {
        b++;
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 1020
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] s = saori.nextHayami().split("");
		if(s[2].equals(s[3]) && s[4].equals(s[5])){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21460