akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
 
int main() {
  string S;
  cin >> S;
  REP(i, S.size())
    S.at(i) = 'x';
  cout << S << endl;
}

Measured memory_bytes: 3556
#include <stdio.h>
#include <string.h>

#define THREE 3

int main(void) {
    int i;
    char str[1001];
    scanf("%s",str);
    for (i=0; i<strlen(str); i++) {
        if (str[i]-THREE%26>='A') {
            printf("%c",str[i]-THREE%26);
        } else {
            printf("%c",str[i]-THREE%26+26);
        }
    }
    printf("\n");
    return 0;
}

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

class UnionFind{
  vi p,r,w;
public:
  UnionFind(int n):p(n,-1),r(n,0),w(n,1){ }
  int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); }
  bool same(int x,int y){return find(x)==find(y);}
  int size(int x){return w[find(x)];}
  void unite(int x,int y){
    x = find(x); y = find(y);
    if(x==y)return;

    if(r[x] < r[y]){
      p[x] = y; w[y] += w[x];
    }else{
      p[y] = x; w[x] += w[y];
      if(r[x] == r[y])r[x]++;
    }
  }
};

int main(){
  int n;
  scanf("%d",&n);
  UnionFind uf(n);

  n--;
  vector<vi> e(n,vi(3));
  rep(i,n)rep(j,3)scanf("%d",&e[i][2-j]);
  sort(e.begin(),e.end());
  
  ll res = 0;
  for(vi p : e){
    res += (ll)p[0] * uf.size(p[1]) * uf.size(p[2]);
    uf.unite(p[1],p[2]);
  }
  cout << res << endl;
}

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

int main() {
	string a;
	cin >> a;
	cout << min({ count(a.begin(), a.end(), 'C'), count(a.begin(), a.end(), 'K'), count(a.begin(), a.end(), 'P'), count(a.begin(), a.end(), 'U') }) << endl;
}


Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  ll ans=0;
  rep(i,N) ans+=A[i];
  rep(i,N) ans-=(i+1);
  cout<<ans<<endl;

  return 0;
}



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

 using namespace std;
 typedef long long ll;

 int main() {
   int N;

   cin >> N;
   vector<ll> A(N + 1);
   vector<ll> S(N + 1);
   map<ll, int> counter;

   S.at(0) = 0;
   counter[0]++;
   for (int i = 1; i <= N; i++) {
     cin >> A.at(i);
     S.at(i) = S.at(i - 1) + A.at(i);
     counter[S.at(i)]++;
   }

   ll ans = 0;
   for (auto p: counter) {
     ll v = p.second;
     if (v != 0) ans += v * (v - 1) / 2;
   }

   cout << ans << endl;
}


Measured memory_bytes: 15872
from math import ceil
def combination(n,r,mod=10**9+7):
    if r > n:
        return 0

    n1 = n+1
    r = min(r,n-r)
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom,mod-2,mod) % mod

N,K = map(int,input().split())

m = int(ceil(N/2))
mod = int(1e9+7)
for i in range(1,K+1):

    if i > m:
        print(0)
        continue

    print(combination(K-1,i-1)*combination(N-K+1,i)%mod)

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include <string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>

#define ok printf("ok\n");
#define MAX 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define pb push_back

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

int main()
{
	int n,z,ans=0;
	string s;
	cin >> s;
	vi v(s.size());
	rep(i,s.size())
	{
		v[i] = s[i] - '0';	
		//cout << v[i] << endl;
	}
	repr(i,s.size())
	{
		if(v[i] != 9 && i != 0)
		{
			v[i] = 9;
			rep(j,s.size())
			{
				if(v[i-1-j] != 0)
				{
					v[i-1-j]--;
					break;
				}
				else
					v[i-1-j] = 9;
			}

		}
		else
			continue;
	}
	rep(i,s.size())
		ans += v[i];
	cout << ans << endl;
	return 0;
}

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

int main() {
  long long n;
  string s;
  cin >> n >> s;
  long long r=0, g=0, b=0;
  for (long long i=0; i<n; i++) {
    if (s[i]=='R') r++;
    else if (s[i]=='G') g++;
    else if (s[i]=='B') b++;
  }
  long long ans=r*g*b;
  for (long long i=0; i<=n; i++) {
    for (long long d=0; d<n; d++) {
      long long j=i+d, k=j+d;
      if (k>=n) break;
      if (s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i]) ans--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <cstring>
#include <iostream>

using namespace std;

class Dice {
public:
    void setPips(int pips[]) {
        for (int i = 0; i < 6; i++) {
            this->pips[i] = pips[i];
        }
    }

    int getTopPip() {
        return pips[0];
    }

    void roll(char direction) {
        memcpy(tmpPips, pips, sizeof(int) * 6);
        if (direction == 'E') {
            pips[0] = tmpPips[3];
            pips[2] = tmpPips[0];
            pips[3] = tmpPips[5];
            pips[5] = tmpPips[2];
        } else if (direction == 'N') {
            pips[0] = tmpPips[1];
            pips[1] = tmpPips[5];
            pips[4] = tmpPips[0];
            pips[5] = tmpPips[4];
        } else if (direction == 'W') {
            pips[0] = tmpPips[2];
            pips[2] = tmpPips[5];
            pips[3] = tmpPips[0];
            pips[5] = tmpPips[3];
        } else {
            pips[0] = tmpPips[4];
            pips[1] = tmpPips[0];
            pips[4] = tmpPips[5];
            pips[5] = tmpPips[1];
        }
    }

    int getRightPip(int top, int front) {
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 4; j++) {
                if (pips[check[i][j]] == top &&
                    pips[check[i][j + 1]] == front) {
                        return pips[i];
                    }
            }
        }
    }

    bool isSameAs(Dice dice) {
        string rollPolicy = "NNNNENNNENNNWNNNWNNNENNN";
        int *ptr = dice.getPipsPtr();
        for (int i = 0; i < rollPolicy.size(); i++) {
            roll(rollPolicy[i]);
            if (memcmp(pips, ptr, 6 * sizeof(int)) == 0) {
                return true;
            }
        }
        return false;
    }

    int* getPipsPtr() {
        return pips;
    }

private:
    int pips[6];
    int tmpPips[6];
    // top, frontの順番でラベルがマッチした時、外側のindexがrightのラベル
    int check[6][5] = {
        {3, 1, 2, 4, 3}, {5, 2, 0, 3, 5},
        {0, 1, 5, 4, 0}, {4, 5, 1, 0, 4},
        {3, 0, 2, 5, 3}, {4, 2, 1, 3, 4}};
};

int main() {
    int pips[6], num;
    string directions;

    cin >> num;
    Dice dices[num];

    for (int i = 0; i < num; i++) {
        for (int j = 0; j < 6; j++) {
            cin >> pips[j];
        }
        dices[i].setPips(pips);
    }

    for (int i = 0; i < num - 1; i++) {
        for (int j = i + 1; j < num; j++) {
            if (dices[i].isSameAs(dices[j])) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3172
#include <stdio.h>

int main(void) {
	int m, f, r;
	int score;
	char grade;

	while (1) {
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1)break;

		score = m + f;

		if (score >= 80)grade = 'A';
		else if (score >= 65)grade = 'B';
		else if (score >= 50)grade = 'C';
		else if (score >= 30)grade = 'D';
		else grade = 'F';

		if (grade == 'D'&&r >= 50)grade = 'C';
		if (m == -1 || f == -1)grade = 'F';
		printf("%c\n", grade);
	}
	return 0;
}


Measured memory_bytes: 2680
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int l =scanner.nextInt();
		int r =scanner.nextInt();
		int d =scanner.nextInt();
		int count=0;

		for(int i=l ; i<=r ; i++) {
			if(i%d == 0) {
				count++;
			}
		}

		System.out.println(count);
		scanner.close();

	}

}


Measured memory_bytes: 35692
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int H, W;
char s[123][123];
int c[123][123];

int main() {

	rep(i, 123) rep(j, 123) c[i][j] = 1123456789;
	cin >> H >> W;
	rep(i, H) rep(j, W) cin >> s[i][j];

	priority_queue<pair<int, pair<int, int>>> pq;
	if (s[0][0] == '#') c[0][0] = 1;
	else c[0][0] = 0;
	pq.push({ -c[0][0],{ 0, 0 } });
	int dx[] = { 1, 0 }, dy[] = { 0, 1 }, dn = 2;
	for (;;) {
		auto cur = pq.top();
		if (cur.second.first == H - 1 && cur.second.second == W - 1) {
			cout << -cur.first << endl;
			return 0;
		}
		pq.pop();
		rep(d, dn) {
			if (cur.second.first + dy[d] < H && cur.second.second + dx[d] < W) {
				if (s[cur.second.first + dy[d]][cur.second.second + dx[d]] == '.' || s[cur.second.first][cur.second.second] == '#') {
					if (c[cur.second.first + dy[d]][cur.second.second + dx[d]] > -cur.first) {
						c[cur.second.first + dy[d]][cur.second.second + dx[d]] = -cur.first;
						pq.push({ -c[cur.second.first + dy[d]][cur.second.second + dx[d]],{ cur.second.first + dy[d], cur.second.second + dx[d] } });
					}
				}
				else {
					if (c[cur.second.first + dy[d]][cur.second.second + dx[d]] > -cur.first + 1) {
						c[cur.second.first + dy[d]][cur.second.second + dx[d]] = -cur.first + 1;
						pq.push({ -c[cur.second.first + dy[d]][cur.second.second + dx[d]],{ cur.second.first + dy[d], cur.second.second + dx[d] } });
					}
				}
			}
		}
	}

	return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll a,b,x;
    cin>>a>>b>>x;
    if(a==0)
    {
        cout<< b/x+1 << endl;
    }
    else
    {
        cout << b/x - (a-1)/x <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b,c;
    cin >> a >> b >> c;

    cout << max(c-a+b,0);


    return 0;
}

Measured memory_bytes: 3536
#include<stdio.h>

int main()
{
   int N, n, i, count, a;

   if(scanf("%d", &N)!=1) return 0;
   if(N<1||N>200) return 0;
   
   for(n=1;n<=N;n+=2){
      count=0;
      for(i=1;i<=n;++i){
         if(n%i==0) ++count;
      }
      if(count==8) ++a;
   }
   printf("%d", a);

   return 0;
}


Measured memory_bytes: 128
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  int n, q; cin >> n >> q;
  vector<int> v[1010];
  for (int i = 0; i < q; ++i) {
    int op, t; cin >> op >> t;
    if (op == 0) {
      int x; cin >> x;
      v[t].emplace_back(x);
    } else if (op == 1) {
      if (v[t].empty()) {
        cout << '\n';
      } else {
        for (size_t j = 0, m = v[t].size(); j < m; ++j) {
          cout << v[t][j];
          if (j != m - 1) cout << " ";
        }
        cout << '\n';
      }
    } else if (op == 2) {
      v[t].clear(); v[t].shrink_to_fit();
    }
  }

  return 0;
}


Measured memory_bytes: 5984
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pllint a, pllint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	string a, b;
	cin >> a >> b;
	cout << b + a << endl;
	return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int main()
{   string string1;
    cin >> string1;
    int ok = 1;
    int v[27];
    memset(v, 0, 27 * 4);
    int length = string1.length();
    for (int i = 0; i < length; i++)
    {
        v[string1[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++)
    {
        if (v[i] % 2 == 1)
        {
            ok = 0;
        }
    }
    if (ok == 0)
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
    return 0;
}

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

int main(){
  long int N;
  cin >> N;
  vector<int> a={3,5,7};
  vector<int> b={1};
  for (int i=0; i<26500; ++i){
    if((a.at(i)*10+3)<=N) a.push_back(a.at(i)*10+3);
    if((a.at(i)*10+5)<=N) a.push_back(a.at(i)*10+5);
    if((a.at(i)*10+7)<=N) a.push_back(a.at(i)*10+7);
    if((a.at(i)*10+3)>N) break;
  }
  for (int i=0; i<a.size(); ++i){
    int X=0;
    int Y=0;
    int Z=0;
    if(a.at(i)%10==3) X += 1;
    if(a.at(i)%10==5) Y += 1;
    if(a.at(i)%10==7) Z += 1;
    if(a.at(i)%100/10==3) X += 1;
    if(a.at(i)%100/10==5) Y += 1;
    if(a.at(i)%100/10==7) Z += 1;
    if(a.at(i)%1000/100==3) X += 1;
    if(a.at(i)%1000/100==5) Y += 1;
    if(a.at(i)%1000/100==7) Z += 1;
    if(a.at(i)%10000/1000==3) X += 1;
    if(a.at(i)%10000/1000==5) Y += 1;
    if(a.at(i)%10000/1000==7) Z += 1;
    if(a.at(i)%100000/10000==3) X += 1;
    if(a.at(i)%100000/10000==5) Y += 1;
    if(a.at(i)%100000/10000==7) Z += 1;
    if(a.at(i)%1000000/100000==3) X += 1;
    if(a.at(i)%1000000/100000==5) Y += 1;
    if(a.at(i)%1000000/100000==7) Z += 1;
    if(a.at(i)%10000000/1000000==3) X += 1;
    if(a.at(i)%10000000/1000000==5) Y += 1;
    if(a.at(i)%10000000/1000000==7) Z += 1;
    if(a.at(i)%100000000/10000000==3) X += 1;
    if(a.at(i)%100000000/10000000==5) Y += 1;
    if(a.at(i)%100000000/10000000==7) Z += 1;
    if(a.at(i)%1000000000/100000000==3) X += 1;
    if(a.at(i)%1000000000/100000000==5) Y += 1;
    if(a.at(i)%1000000000/100000000==7) Z += 1;
    if(X>=1 && Y>=1 && Z>=1) b.push_back(a.at(i));
  }
  
  cout << b.size()-1 << endl;
 
}


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

int main(){
  int a,b,m;
  cin >> a >> b >> m;
  vector<int> veca(a),vecb(b);
  for(int i=0; i<a; i++){
    int x;
    cin >> x;
    veca.at(i)=x;
  }
  for(int i=0; i<b; i++){
    int x;
    cin >> x;
    vecb.at(i)=x;
  }
  vector<int> vecm(m);
  for(int i=0; i<m; i++){
    int ma,mb,mx;
    cin >> ma >> mb >> mx;
    vecm.at(i)=veca.at(ma-1)+vecb.at(mb-1)-mx;
  }
  sort(vecm.begin(),vecm.end());
  int saiyasune =vecm.at(0);
  sort(veca.begin(),veca.end());
  sort(vecb.begin(),vecb.end());
  int saiyasune2 =veca.at(0)+vecb.at(0);
  if(saiyasune >= saiyasune2) cout << saiyasune2 << endl;
  else cout << saiyasune << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string S; cin >> S;

    bool check;

    string tmp;
    for(int i = 0; i < S.size(); i++){
        tmp += S[i];

        if(tmp == "dream"){
            if(S[i+1] == 'e' && S[i+2] == 'r' && S[i+3] != 'a'){
                i += 2;
            }
            tmp = "";
        }else if(tmp == "erase"){
            if(S[i+1] == 'r'){
                i += 1;
            }
            tmp = "";
        }
    }
    check = tmp.empty();

    if(check){ cout << "YES" << endl; }
    else{ cout << "NO" << endl; }

    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#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>
#include <list>

using namespace std;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;



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

    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    rep (i, N) {
        string s;
        cin >> s;

        if (s == "AC") ac++;
        else if (s == "WA") wa++;
        else if (s == "TLE") tle++;
        else if (s == "RE") re++;
    }

    cout << "AC x " + to_string(ac) << endl;
    cout << "WA x " + to_string(wa) << endl;
    cout << "TLE x " + to_string(tle) << endl;
    cout << "RE x " + to_string(re) << endl;
}


Measured memory_bytes: 3692
#172C
#Tsundoku

N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]

for i in range(N):
    a.append(a[i]+A[i])
for j in range(M):
    b.append(b[j]+B[j])

ans=0
j=M

for i in range(N+1):
    if a[i]>K:
        break
    while a[i]+b[j]>K:
        j-=1
    ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 47444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double lb;
const ll MOD=1;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
void IOS(){	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);return ;}

ll dp[100005],n,u[100205],k;

ll f(int w){
	if(w>=n)return 0;
	if(dp[w]!=-1)return dp[w];
	ll tmp=1e10;
	for(int i=1;i<=k;i++){
		tmp=min(tmp,abs(u[w]-u[w+i])+f(w+i));
	}
	return dp[w]=tmp;
}

int main(){
	IOS();
	memset(dp,-1,sizeof(dp));
	cin>>n>>k;
	REP(i,n)cin>>u[i];
	for(int i=n;i<=n+k;i++){u[i]=u[n-1];}
	cout<<f(0);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int i=0,j=0,k=0,l=0;
  
  for (int a=0;a<N;a++){
    string C;
    cin >> C;
    if (C=="P") i=1;
    else if (C=="W") j=1;
    else if (C=="G") k=1;
    else if (C=="Y") l=1;
  }
  if (i+j+k+l == 3) cout << "Three" << endl;
  if (i+j+k+l == 4) cout << "Four" << endl;
}


Measured memory_bytes: 256
/*************************************************************************
    > File Name: d.cpp
    > Author: Amano Sei
    > Mail: amano_sei@outlook.com 
    > Created Time: 2019年12月22日 星期日 21时15分29秒
 ************************************************************************/

#include <cstdio>

int main(){
    int ca = 1, n, ta;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &ta);
        if(ta == ca)
            ca++;
    }
    if(ca == 1)
        puts("-1");
    else
        printf("%d\n", n-ca+1);
    return 0;
}



Measured memory_bytes: 128
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
using pp=pair<ll,P>;
int main(){
	int n,q;
	cin>>n>>q;
	V<pp> tmp;
	for(int i=0;i<n;i++){
		ll a,b,c;
		cin>>a>>b>>c;
		tmp.push_back(pp(c-a+1,P(1,c)));
		tmp.push_back(pp(c-b+1,P(-1,c)));
	}
	V<ll> d(q);
	for(int i=0;i<q;i++){
		cin>>d[i];
		d[i]=-d[i];
	}
	V<ll> ans(q);
	sort(all(tmp));
	multiset<ll> res;
	int id=0;
	sort(all(d));
	for(int i=0;i<q;i++){
		while(id<tmp.size()&&d[i]>=tmp[id].fi){
		//	cout<<d[i]<<" "<<tmp[id].fi<<" "<<tmp[id].se.se<<"\n";
			if(tmp[id].se.fi==-1)res.insert(tmp[id].se.se);
			else res.erase(res.find(tmp[id].se.se));
			id++;
		}
		if(res.size()==0)ans[i]=-1;
		else ans[i]=*res.begin();
	}
	reverse(all(ans));
	for(int i=0;i<q;i++)cout<<ans[i]<<"\n";

}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
#define INF 100000000000

vector<vector<int>> remove(int M, pair<int, int> edge, vector<vector<int>> connection_list)
{
  vector<vector<int>> new_connection_list(M, vector<int>(0));
  for (int i = 0; i < M; ++i)
  {
    for (int j = 0; j < connection_list.at(i).size(); ++j)
    {
      if (connection_list.at(i).at(j) == edge.first && i == edge.second)
      {
        continue;
      }
      else if (connection_list.at(i).at(j) == edge.second && i == edge.first)
      {
        continue;
      }
      new_connection_list.at(i).push_back(connection_list.at(i).at(j));
    }
  }
  return new_connection_list;
}

bool dfs(int N, vector<vector<int>> connection_list)
{
  vector<int> already_went(N, 0);
  already_went.at(0) = 1;
  stack<int> a;
  a.push(0);
  while (!a.empty())
  {
    int point = a.top();
    a.pop();
    for (int k = 0; k < connection_list.at(point).size(); ++k)
    {
      if (already_went.at(connection_list.at(point).at(k)) == 0)
      {
        already_went.at(connection_list.at(point).at(k)) = 1;
        a.push(connection_list.at(point).at(k));
      }
    }
  }
  for (int i = 0; i < N; ++i)
  {
    if (already_went.at(i) == 0)
    {
      return true;
    }
  }
  return false;
}


int main()
{
  int N, M;
  cin >> N >> M;
  int a, b;
  vector<pair<int, int>> edge_list(M);
  vector<vector<int>> connection_list(N, vector<int>(0));
  for (int i = 0; i < M; ++i)
  {
    cin >> a >> b;
    connection_list.at(a - 1).push_back(b - 1);
    connection_list.at(b - 1).push_back(a - 1);
    edge_list.at(i).first = a - 1;
    edge_list.at(i).second = b - 1;
  }
  int ans = 0;
  for (int i = 0; i < M; ++i)
  {
    vector<vector<int>> new_connection_list = remove(N, edge_list.at(i), connection_list);
    if (dfs(N, new_connection_list))
    {
      ans += 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
 
#define deb(var) "[" << (#var) << " : " << var <<"]" << " "
#define debv(v) "[" << (#v) << " : {";for(int i = 0; i < v.size() - 1; ++i)\
					cout << v[i] <<", ";cout << v.back() << "}] "
#define deba(a,n) "[" << (#a) << " : {";for(int i = 0; i < n - 1; ++i)\
					cout << a[i] << ", ";cout << a[n - 1] << "}] "
#define debp(p) "[" << (#p) << " : {" << p.first << ", " << p.second << "}] "
#define debs(s) "[" << (#s) << " : {";auto _itr = s.begin();\
					for(int k = s.size(); k > 1; --k) {cout << *_itr << ", "; ++_itr;} cout << *_itr << "}] "
#define debt(t) "[" << (#t) << " : " << "{" << get<0>(t) << ", " <<get<1>(t) << ", " << get<2>(t) << "}]"
 
typedef long long ll;
 
/*LETS BEGIN WITH THE NAME OF LORD MAHADEV*/

int main(){
	string s, t;
	cin >> s >> t;
	int answer = 0;
	for(int i = 0; i < (int) s.size(); ++i){
		if(s[i] ^ t[i])
			++answer;
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 3860
import java.util.*;
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int k = sc.nextInt();
    long h[] = new long[n];
    long count = 0;
    long sum = 0;

    for (int i = 0;i<n ;i++ ) {
      h[i] = sc.nextInt();
    }

    Arrays.sort(h);

    if (n<=k) {
      System.out.println(0);
      System.exit(0);
    }

    for (int i = 0;i<k;i++) {
      h[n-i-1]=0;
    }
    for (int i = 0;i<n ;i++ ) {
      sum += h[i];
    }

    System.out.println(sum);
  }
}


Measured memory_bytes: 65284
X = gets.to_i

a = case X
when 400..599
  8
when 600..799
  7
when 800..999
  6
when 1000..1199
  5
when 1200..1399
  4
when 1400..1599
  3
when 1600..1799
  2
when 1800..1999
  1
end

puts a.to_s


Measured memory_bytes: 14376
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long double ld;									// .
#define int long long
#define PB push_back
#define all(x) (x).begin(),(x).end()
#define ii pair <int,int>
#define mii map <int,int>
#define vi vector<int>
#define vii vector< ii >
#define F first
#define S second
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a; i>=b; --i)
#define sz(x) (int)((x).size())
#define mem(a,x) memset(a,x,sizeof(a))
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // order_of_key // find_by_order()  

inline void io(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

//const int mod = 998244353;
const int mod = 1e9+7;
const int inf = 1e18;
const int maxn = 1e6+5;

vector<int> fact(maxn);
int power(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
void pre() {
    fact[0] = 1;
    for(int i = 1; i < maxn; i++) {
        fact[i] = fact[i - 1] * i % mod;
    }
}
int ncr(int n, int r) {
    if(n < r) return 0;
    int p = fact[n];
    int q = fact[r] * fact[n - r] % mod;
    p = p * power(q, mod - 2) % mod;
    return p;
} 
int add(int a, int b){
    return((a % mod + b % mod) % mod);
}
int subs(int a, int b){
    return((a % mod - b % mod + mod) % mod);
}
int mul(int a, int b){
    return(((a % mod) * (b % mod)) % mod);
}
int divi(int a, int b){
    return(mul(a, power(b, mod - 2)) % mod);
}
void solve(){
	int n; cin>>n;
	if(n == 1){
		cout<<0; return;
	}
	int ans = subs(power(10, n), mul(2, power(9, n)));
	ans = add(ans, power(8, n));
	cout<<ans;
}
signed main() 
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);// io();
    //cout<<setprecision(100);
    //pre();
    int tc=1; //cin>>tc;
    while(tc--){
        solve();cout<<'\n';
    }
    return 0;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define F first
#define S second

typedef long long ll;
typedef pair <int, int> pii;

#define fo(i,n) for(int (i) = 1; i <= (int)n; ++(i))


const int N = 400000;
const int mod = 1e9 + 7;

int l[N], r[N];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	string s;
	cin>>s;
	int n=s.length();
	s='#'+s;
	fo(i,n)
		l[i]=i-1,r[i]=i+1;
	int ans=n;
	fo(i,n)
	{
		if(s[i]=='T')
		{
			int x=l[i];
			if(s[x]=='S')
			{
				l[r[i]]=l[x];
				r[l[x]]=r[i];
				ans-=2;
			}
		}
	}
	cout<<ans;
	return 0;
}

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


int main()
{
	int n,ans;
	int L[200];
	cin >> n;
	for (int i = 0; i < 2 * n; i++) {
		cin >> L[i];
	}
	sort(L, L + 2 * n);
	ans = 0;
	for (int i = 0; i < 2 *  n; i++) {
		if (i % 2 == 0) {
			ans += L[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#define dump(x) cout << #x << " = " << x << endl

using namespace std;

int card[50];
int n, r;

void disp(){
	rep(i,0,n) cout << card[i] << " ";
	cout << endl;
	return ;
}

int main(){

	while(1){
		cin >> n >> r;
		if(n==0) break;

		rep(i,0,n) card[i] = n - i;
		// disp();

		rep(i,0,r){
			int p, c;
			cin >> p >> c;
			int temp[p];

			rep(i,0,p-1) temp[i] = card[i];
			rep(i,0,c) card[i] = card[p-1+i];
			rep(i,0,p-1) card[c+i] = temp[i];

			// disp();

		}

		cout << card[0] << endl;

	}
	return 0;
}

Measured memory_bytes: 1160
import sys

s = input()
k = int(input())
target = '1'

s2 = s[:k]

if all(c == '1' for c in s2):
    print(1)
    sys.exit()

# if len(s) >= k and all(s[i] == '1' for i in range(k-1)):
#     print(1)
#     sys.exit()

for c in s:
    if c != '1':
        target = c
        break

print(target)

Measured memory_bytes: 38256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    char c;
    cin >> c;
    if (c >= 'A' && c <= 'Z') cout << 'A';
    else cout << 'a';
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;

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

    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0])
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int MAX_N = 1e5;
const int SQRT_N = 317;
const int BUCKET_SIZE = 1 + (MAX_N - 1) / SQRT_N;
int dat[MAX_N] = {};
int lazy_bucket[SQRT_N] = {};
bool lazy_flag[SQRT_N] = {};

void init(int n) {
	rep(i, 0, n) {
		dat[i] = INT_MAX;
	}
}

int get(int x) {
	int k = x / SQRT_N;
	return lazy_flag[k] ? lazy_bucket[k] : dat[x];
}

void update(int l, int r, int val) {
	for (int k = 0; k < BUCKET_SIZE; k++) {
		int bl = k * SQRT_N, br = (k + 1) * SQRT_N;
		if (r <= bl || br <= l)
			continue;
		if (l <= bl && br <= r) {
			lazy_bucket[k] = val;
			lazy_flag[k] = true;
		}
		else {
			if (lazy_flag[k]) {
				for (int i = bl; i < br; i++) {
					dat[i] = lazy_bucket[k];
				}
				lazy_flag[k] = false;
			}
			for (int i = max(l, bl); i < min(r, br); i++) {
				dat[i] = val;
			}
		}
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;
	init(n);
	rep(i, 0, q) {
		int c; cin >> c;
		if (c == 0) {
			int s, t, x; cin >> s >> t >> x;
			update(s, t + 1, x);
		}
		else {
			int i; cin >> i;
			cout << get(i) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3516
#include <stdio.h>
#include <stdlib.h>

void insertionSort(int* list, int size, int* count);

int main() {
	int n, * a, count = 0;
	scanf("%d", &n);
	a = malloc(n * sizeof(int));
	for (int i = 0; i < n; i++)
		scanf("%d", a + i);

	insertionSort(a, n, &count);

	return 0;
}

void insertionSort(int* list, int size, int* count) {
	for (int k = 0; k < size; k++)
		printf("%d%c", list[k], k != size - 1 ? ' ' : '\n');
	for (int i = 1; i < size; i++) {
		int key = list[i], j = i - 1;
		while (j > -1 && key < list[j])
			list[j + 1] = list[j--], * count += 1;
		list[j + 1] = key;
		for (int k = 0; k < size; k++)
			printf("%d%c", list[k], k != size - 1 ? ' ' : '\n');
	}
}


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

bool sosu(int x){
    for(int i=2;i<sqrt(x);i++){
        if(x%i==0) return false;
    }
    return true;
}
int main(){
    int X;
    cin >> X;
    if(X!=2 && X%2==0){
        X++;
    }
    while(!sosu(X)){
        X+=2;
    }
    cout << X << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let k: usize = sc.cin();
    let a: usize = sc.cin();
    let b: usize = sc.cin();
    put!(if(a..=b).any(|x|x%k==0){"OK"}else{"NG"});
    // put!(if a%k==0||b%k==0||b-a>=k { "OK" } else { "NG" });
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


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

class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] nums = new long[n+1];
    nums[0] = 2;
    nums[1] = 1;
    for(int i = 2; i <= n; i++) {
      nums[i] = nums[i-2] + nums[i-1];
    }
    System.out.println(nums[n]);
  }
}


Measured memory_bytes: 22736
#include <iostream>
#include <vector>
#include <list>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <iomanip>
#include <queue>
#include <map>
#include <unordered_map>
typedef long long ll;
using namespace std;

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

	std::vector<double> v(N);

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

//	std::sort(v.begin(),v.end()); //vector<string>全体のソート 昇順
	std::sort(v.begin(),v.end(),std::greater<double>()); //vector<string>全体のソート 順

//		cout << v.size() << endl;//1オリジン

	for(int i=0; i<N-1; i++){
		v[v.size()-2] = ( v[v.size()-2] + v[v.size()-1] ) / 2;
//		cout << v[v.size()-2] << endl;
		v.pop_back();
	}

	cout << std::setprecision(9) << v[0] << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
ans=sum(A)
x=[0 for i in range(10**5)]
for i in range(N):
  x[A[i]-1]+=1
#print(x)
for i in range(Q):
  b,c=map(int,input().split())
  j=x[b-1]
  x[c-1]+=x[b-1]
  x[b-1]=0
  ans+=c*j-b*j
  print(ans)
  #print(x)

Measured memory_bytes: 20884
h,w = map(int, input().split())
list_prob = []
for i in range (0,h):
    list_prob.append(list("#"+str(input())+"#"))
list_ans = []
list_ans.append(list("#"*(w+2)))
for i in range(0,h):
    list_ans.append(list_prob[i])
list_ans.append(list("#"*(w+2)))
for i in range(0,h+2):
    print("".join(list_ans[i]))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int mod=1000000007;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  int x,y;
  cin>>x>>y;
  if(y%2==1){cout<<"No";}
  else{
    y=y/2;
    if(y-x<0){cout<<"No";}
    else{
        if(2*x-y>=0){cout<<"Yes";}
        else{cout<<"No";}
    }
  }
    return 0;
}

Measured memory_bytes: 3648
N,K = map(int,input().split())
ans_list = list()
for i in range(1, N+1):
  index = 0
  count = 0
  while i*(2**index) < K:
    index += 1
    count += 1
  ans_list.append(count)

ans = list(map(lambda x:0.5**x,ans_list))


print(sum(ans)/N)

Measured memory_bytes: 7064
import java.util.Scanner;

public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
}

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

using namespace std;
int main(void){
    int a,b,c,d, ans;
    cin >>a >>b >>c >>d;
    ans = min(b,d) -max(a,c);
    if (ans>0){
        cout << ans << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int N;
    cin >> N;
    ll ans = 0;
    vector<ll> A(N);
    cin >> A;
    ll before = A[0];
    for (int i = 1; i < N; i++) {
        if (before <= A[i]) {
            chmax(before, A[i]);
            continue;
        }
        ans += before - A[i];
    }
    cout << ans << endl;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> v(n + 1);
    for(int i = 1; i <= n; i++){
        int a; cin >> a;
        v[i] = a;
    }
    int s = v[1];
    int ans = 0;
    while(1){
        ans++;
        if(n < ans) break;
        if(s != 2){
            s = v[s];
        }else{
            cout << ans << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 640
# coding: utf-8
N = int(input())
A = []
for _ in range(2):
    A.append(list(map(int, input().split())))
dp = [[0 for _ in range(N)] for _ in range(2)]
# dp = np.array(dp)
dp[0][0] = A[0][0]
dp[1][0] = A[0][0] + A[1][0]
for i in range(1, N):
    dp[0][i] = dp[0][i-1] + A[0][i]
    dp[1][i] = max(dp[0][i], dp[1][i-1]) + A[1][i]
print(dp[1][N-1])

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

using std::max; using std::swap; using std::abs; using std::priority_queue; using std::queue; using std::bitset; using std::make_tuple; 
using std::istream; using std::ostream; using std::fixed; using std::greater; using std::tuple; using std::tie; using std::make_pair;
using std::cout; using std::cerr; using std::endl; using std::lower_bound; using std::upper_bound; using std::deque; using std::min; 
using std::map; using std::string; using std::fill; using std::copy; using std::sort; using std::unique; using std::unordered_set; 
using std::multiset; using std::nth_element; using std::min_element; using std::max_element; using std::vector; using std::set; 
using std::unordered_map; using std::pair; using std::next_permutation; using std::reverse; using std::rotate; using std::cin; 
using std::iota; using std::function; using std::shuffle; using std::iter_swap;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

int const INF = 100 + (int) 1e9;
ll const INFL = 100 + (ll) 1e18;
ld const PI = 3.141592653589793238462643L;
std::mt19937 mt19937(960172);

ll rnd(ll x, ll y) { static auto gen = std::bind(std::uniform_int_distribution<ll>(), mt19937); return gen() % (y - x + 1) + x; }
bool is_prime(ll x) { if (x <= 1) return 0; for (ll y = 2; y * y <= x; ++y) if (x % y == 0) return 0; return 1; }
ll sqr(int a) { return (ll) a * a; } ld sqr(ld a) { return a * a; } ll sqr(ll a) { return a * a; }
ll gcd(ll a, ll b) { while (b > 0) { ll t = a % b; a = b; b = t; } return a; }




void solve() {
    
    ll n, k;
    cin >> n >> k;
    
    ll ans = k;
    while (--n) ans *= k - 1;
    cout << ans << '\n';
}



int main() {
    
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    
    cout.precision(15);
    cout << fixed;
    cerr.precision(6);
    cerr << fixed;
    
    int tcn = 1;
    for (int tn = 1; tn <= tcn; ++tn)
        solve();
    
#ifdef LOCAL
    cerr << "time: " << (ll) clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define dump(x) cout << #x << " = " << (x) << endl
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    ll b[105];
    for(int i = 0; i < n - 1; i++) {
        cin >> b[i];
    }

    ll ans = 0;
    for(int i = 0; i < n - 1; i++) {
        if(i == 0) {
            ans += b[i];
        } else {
            ans += min(b[i], b[i - 1]);
        }
    }
    ans += b[n - 2];
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;

int n;
ll a[205];
string s;

void meow(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    cin>>s;
    vector<ll> t;
    for(int i=n-1;i>=0;i--){
        ll c=a[i];
        for(ll &x:t){
            c=min(c,c^x);
        }
        if(c){
            if(s[i]=='1'){
                cout<<"1\n";
                return;
            }
            t.push_back(c);
        }
    }
    cout<<"0\n";
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T;
    cin>>T;
    while(T--){
        meow();
    }

    return 0;
}

Measured memory_bytes: 3516