akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<int,int>> vec[2];
    int open = 0, close = 0;
    for(int i=0;i<n;++i)
    {
        string tmp;
        cin >> tmp;
        int cnt = 0;
        int lowest = 0;
        for(int j=0;j<tmp.length();++j)
        {
            if(tmp[j] == '(')
            {
                cnt++;
                open++;
            }
            else
            {
                cnt--;
                close++;
            }
            if(lowest == 0)
            {
                lowest = cnt;
            }
            lowest = min(lowest, cnt);
        }

        if(cnt > 0)
        {
            vec[0].push_back(MP(lowest, cnt));
        }
        else
        {
            // reverse
            lowest = 0;
            cnt=0;
            for(int i=tmp.length()-1;i>=0;--i){
                if(tmp[i] == ')')
                {
                    cnt++;
                }
                else
                {
                    cnt--;
                }
                if(lowest == 0)
                {
                    lowest = cnt;
                }
                lowest = min(lowest,cnt);
            }
            vec[1].push_back(MP(lowest,cnt));
        }
    }
    
    if(open != close)
    {
        cout << "No" << endl;
        return 0;
    }

    sort(vec[0].rbegin(), vec[0].rend());
    sort(vec[1].begin(), vec[1].end());
    bool ret = true;
    int cum = 0;
    for(int i=0;i<vec[0].size();++i)
    {
        // dump(cum)
        // dump(vec[0][i].first)
        if(cum + vec[0][i].first < 0) ret = false;
        cum += vec[0][i].second;
    }
    cum = 0;
    for(int i=vec[1].size();i>=0;--i)
    {
        // dump(cum)
        // dump(vec[1][i].first)
        if(cum + vec[1][i].first < 0) ret = false;
        cum += vec[1][i].second;
    }

    cout << (ret ? "Yes" : "No") << endl;
}

Measured memory_bytes: 11340
#include <stdio.h>
#define MAX_N 2000001
#define MAX_V 10001

unsigned short A[MAX_N];
unsigned short B[MAX_N];
int C[MAX_V];

void countingSort(int n) {
    int i, j;
    for (i = 0; i < MAX_V; i++) {
        C[i] = 0;
    }

    for (j = 1; j <= n; j++) {
        C[A[j]]++;
    }
    for (i = 1; i < MAX_V; i++) {
        C[i] = C[i] + C[i-1];
    }

    for (j = n; j >= 1; j--) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }
}


int main(void) {
    int i, n;

    scanf("%d", &n);
    for (i = 1; i <= n; i++) {
        scanf("%hd", &A[i]);
    }

    countingSort(n);

    for (i = 1; i <= n; i++) {
        if (i > 1) printf(" ");
        printf("%d", B[i]);
    }
    putchar('\n');
    return 0;
}

Measured memory_bytes: 8460
# D - We Love ABC

S = list(str(input()))
MOD = 10**9 + 7
a = 0
ab = 0
abc = 0
pat = 1
for s in S:
    if s == 'A':
        a = (a + pat) % MOD
    elif s == 'B':
        ab = (ab + a) % MOD
    elif s == 'C':
        abc = (abc + ab) % MOD
    else: # s == '?'
        tmpa = a
        tmpab = ab
        a = (3*a + pat) % MOD
        ab = (3*ab + tmpa) % MOD
        abc = (3*abc + tmpab) % MOD
        pat = (pat*3) % MOD

print(abc)

Measured memory_bytes: 9832
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

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


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

using ll = long long;
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
#define swap(x, y)    \
  {                   \
    auto ___temp = x; \
    x = y;            \
    y = ___temp;      \
  }

const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
using ll = long long;
#define itn int
#define rep(i,n) for(int i = 0;i < n;i++)
#define P pair<int,int>

int mod = 1e9+7;
int dp[200][200];

int main(void){
    int h,w,k;
    cin >> h >> w >> k;
    
    dp[0][0] = 1;
    
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            for(int l = 0;l < (1 << (w-1));l++){
                bool ok = true;
                for(int f = 0;f < w-2;f++){
                    if(((l >> f) & 1) && ((l >> (f + 1)) & 1)){
                        ok = false;
                    }
                }
                if(!ok)continue;
                if(j >= 1 && ((l >> (j - 1)) & 1)){
                    dp[i+1][j-1] += dp[i][j];
                    dp[i+1][j-1] %= mod;
                } else if(j <= w-2 && ((l >> j) & 1)){
                    dp[i+1][j+1] += dp[i][j];
                    dp[i+1][j+1] %= mod;
                } else {
                    dp[i+1][j] += dp[i][j];
                    dp[i+1][j] %= mod;
                }
            }
        }
    }
    cout << dp[h][k-1] << endl;
}

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

char seiseki(int m,int f,int r){
	if(m==-1||f==-1||m+f<30) return 'F';
	if(m+f>=80) return 'A';
	if(m+f>=65) return 'B';
	if(max(m+f,r)>=50) return 'C';
	return 'D';
}

int main(){
	int i,m=0,f=0,r=0;
	char c[10000];
	for(i=0;;i++){
		cin>>m>>f>>r;
		if(m+f+r==-3) break;
		c[i]=seiseki(m,f,r);
	}
	for(int j=0;j<i;j++) cout<<c[j]<<endl;
	return 0;
}



Measured memory_bytes: 3068
#include<cstdio>
#include<algorithm>
#define MAXN 105
using namespace std;

int n,m;
int tot;
int ans[MAXN][MAXN];
int num[MAXN*MAXN];

void solve(){
	int i,j;
	int sle=1;
	for(i=1;i<=n;i++){
		if(i%2==1){
			for(j=1;j<=m;j++){
				num[sle]--;
				ans[i][j]=sle;
				if(num[sle]==0)
					sle++;
			}
		}
		else{
			for(j=m;j;j--){
				num[sle]--;
				ans[i][j]=sle;
				if(num[sle]==0)
					sle++;
			}
		}
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			printf("%d ",ans[i][j]);
		}
		puts("");
	}
}

int main(){
	scanf("%d%d",&n,&m);
	scanf("%d",&tot);
	int i;
	for(i=1;i<=tot;i++)
		scanf("%d",&num[i]);
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    if(n>m){
        swap(n,m);
    }
    for(int i=0;i<m;i++){cout<<n;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // double a,b,c;
    // cin >> a >> b >> c;
    // double x = sqrt(a);
    // double y = sqrt(b);
    // double z = sqrt(c);
    // //cout << x << ' ' << y << ' ' << z << "\n";
    // if((double)(x+y) < (double)z) cout << "Yes";
    // else cout << "No"; 

    long long a, b, c, temp;
    cin >> a >> b >> c;
    temp=c-a-b;
    if(temp > 0) {
    	temp = temp*temp;
    	if(4*a*b  < temp) cout << "Yes";
    	else cout << "No";
    } else {
    	cout << "No";
    }
    cout << "\n";
    return 0;
}



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

int main(){
    int A;
    long long int B  = 0;
    cin >> A;
    vector<long long int> T(A+1);
    vector<int> K(A);
    for(int i = 0; i < A+1; i++){
       cin >> T.at(i);
    }
    for(int i = 0; i < A; i++){
        cin >> K.at(i);
    }
    for(int i = 0; i < A; i++){
       if(T.at(i) - K.at(i) >= 0){ // １体も頃せない
           B += K.at(i);
       }
       else if(T.at(i+1) + (T.at(i) - K.at(i)) <= 0){ // ２たいともころせる
            B += T.at(i) + T.at(i+1);
            T.at(i+1) = 0;
        }
        else { // 1たいしかころせない
           B += K.at(i);
           T.at(i+1) += (T.at(i) - K.at(i));       
        }
    }
    cout << B << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    vector<pair<ll,int>> all;
    for(int i = 0;i < A;i++){
        ll a;cin>>a;
        all.push_back(pair<ll,int>(a,0));
    }
    for(int i = 0;i < B;i++){
        ll a;cin>>a;
        all.push_back(pair<ll,int>(a,1));
    }
    for(int i = 0;i < C;i++){
        ll a;cin>>a;
        all.push_back(pair<ll,int>(a,2));
    }
    sort(all.begin(), all.end(), std::greater<pair<ll,int>>());
    // for(int i = 0;i < all.size();i++){
    //     cout<<all[i].first<<endl;
    // }
    int i = 0;
    int use_trans = 0;
    ll res = 0;
    while(true){
        if(X + Y - use_trans == 0 || i == A+B+C)break;
        bool flag = true;
        switch(all[i].second){
        case 0://r
        if(X > 0)
            X--;
        else
            flag = false;
        break;
        case 1://g
        if(Y > 0)
            Y--;
        else
            flag = false;
        break;
        case 2://t
        use_trans++;
        break;
        }
        // cout<<X<<Y<<use_trans<<endl;
        if(flag)
        res += all[i].first;
        i++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 10604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define ifaxb(a, x, b) if (a < x && x < b)  // 比較は昇順
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int>
#define spair pair<string, string>
#define lpair pair<LL, LL>
#define MP make_pair
#define MM multimap
#define PB push_back
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
    string S;
    cin >> S;
    int max = 0;  // 最大値
    int len = 0;  // 計測中の長さ

    rep(i, S.size()+1) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
            len++;
        } else {
            if (max < len) {
                max = len;
            }
            len = 0;
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
        var x, y int
        fmt.Scan(&x, &y)
        for i := 0; i < x+1; i++ {
                if i*2+(x-i)*4 == y {
                        fmt.Println("Yes")
                        return
                }
        }
        fmt.Println("No")
}

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

int main() {
	int N;cin>>N;
	int K;cin>>K;
	if(N+1 >= 2*K)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#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;

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int infI=1e9+5;
const long long infL=1e16;
const int MOD=1e9+7;
const int MAX=2e5+5;

#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<ii,int>
#define ll long long
#define pll pair<ll,ll>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define popb pop_back()
#define se second
#define fi first
#define test(t) int t;cin>>t;while(t--)
#define debug(x) cerr<<"=>"<<#x<<" = "<<x<<endl

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    if(b==1){
        return a;
    }
    ll temp=power(a,b/2);
    temp=(temp*temp)%MOD;
    if(b%2){
        temp=(temp*a)%MOD;
    }
    return temp;
}

//only use if mod is prime
ll mod_inv(ll a,ll mod){
    a%=mod;
    return power(a,mod-2);
}

void extended_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return;
    }
    ll x1,y1;
    extended_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-((a/b)*y1);
    return;
}

//TLE can also occur if vectors are not passed by reference, debug statements can also cause TLE.
//priority_queue implements max heap by default

bool check(int a[]){
    forn(i,0,21){
        if(a[i]>1){
            return true;
        }
    }
    return false;
}

int main(){
    fastio;
    // think about edge cases like n=1(especially graph questions).
    int n;
    cin>>n;
    int cnt[21]={};
    int a[n][21]={};
    forn(i,0,n){
        int tmp;
        cin>>tmp;
        int ind = 0;
        while(tmp){
            a[i][ind++]=tmp%2;
            tmp/=2;
        }
    }
    ll ans = 0;
    int i = 0,j = 0;
    while(j<n){
        forn(k,0,21){
            cnt[k]+=a[j][k];
        }
        while(check(cnt)){
            forn(k,0,21){
                cnt[k]-=a[i][k];
            }
            ++i;
        }
        ans += (j-i+1);
        ++j;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 20012
n = int(input())
a = list(map(int, input().split()))

money = 1000
stack = 0
up = []
last_high = 0
high = 0
low = a[0]

for i in range(n):
    if i == 0:
        up.append(-1)
    elif a[i] < a[i-1]:
        up.append(-1)
    elif a[i] >= a[i-1]:
        if i == n-1:
            up.append(1)
        elif a[i] > a[i+1]:
            up.append(1)
        else:
            up.append(0)

for i in range(n):
    if up[i] == 1:
        high = a[i]
        for j in range(last_high, i):
            if up[j] == -1:
                low = a[j]
        stack = money // low
        money %= low
        money += stack * high

print(money)


Measured memory_bytes: 9228
# -*- coding: utf-8 -*-
#ABC144A
import sys
import math
import collections
#sys.setrecursionlimit(100000)


n=int(input())

#tmp = input().split()
#a,b = list(map(lambda a: int(a), tmp))

for i in range(9):
	if(n%(9-i)==0)and(n//(9-i)<10):
		print("Yes")
		sys.exit()
print("No")






Measured memory_bytes: 28012
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list>
#include <unordered_set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

int main() {
	vector<vector<ll>>dp(pow(10, 6),vector<ll>(3,-INF));
	ll n;
	cin >> n;
	vector<vector<ll>>a(n,vector<ll>(3));
	rep(i, n)rep(k, 3)cin >> a[i][k];
	rep(i, 3)dp[0][i] = a[0][i];
	for (ll i = 1; i < n; i++) {
		rep(pre, 3) {
			rep(now,3) {
				if (pre == now)continue;
				else {
					chmax(dp[i][now],a[i][now]+dp[i-1][pre]);
				}
			}
		}
	}
	ll maxN = -INF;
	for (ll i = 0; i < 3; i++) {
		maxN = max(maxN,dp[n-1][i]);
	}
	cout << maxN << endl;
}


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

lli minCost(lli n, lli k, lli arr[]){
	lli dp[n + 1] = {0};
	for(lli i = 2; i <= n; i++){
		lli minVal = INT_MAX;
		for(lli j = 1; j <= k; j++){
			if(i - j < 1) break;
			minVal = min(minVal, abs(arr[i - 1] - arr[i - j - 1]) + dp[i - j]);
		}
		dp[i] = minVal;
	}
	return dp[n];
}


void solve(){
	lli n, k;
	cin >> n >> k;
	lli i, arr[n];
	for(i = 0; i < n; i++) cin >> arr[i];

	cout << minCost(n, k, arr);
}

int main(){

	solve();
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>//小数点以下表示
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int n,m;
    cin>>n>>m;
    int data[m][2];
    rep(i,m){
        rep(j,2){
            cin>>data[i][j];
        }
    }
    bool a=true;
    rep(i,m-1){
        for(int j=i+1;j<m;j++){
            if(data[i][0]==data[j][0]){
                if(data[i][1]!=data[j][1]){
                    a=false;
                    break;
                }
            }
        }
        if(!a){
            break;
        }
    }
    if(!a){
        cout<<-1<<endl;
    }
    else{
        int qw[n];
        rep(i,n){
            qw[i]=0;
        }
        rep(i,m){
            if(data[i][0]==1){
                qw[0]=data[i][1];
                if(data[i][1]==0){
                    if(n==1){
                        cout<<0;
                        a=false;
                        break;
                    }
                    else{
                    cout<<-1;
                    a=false;
                    break;
                    }
                }
            }
            else if(data[i][0]==2){
                qw[1]=data[i][1];
            }
            else if(data[i][0]==3){
                qw[2]=data[i][1];
            }
        }
        if(n==1){
            bool cc=false;
            rep(i,m){
                if(data[i][0]==0){
                    cc=true;
                }
            }
            if(cc){
                cout<<0<<endl;
            }
        }
        else if(qw[0]==0){
            qw[0]=1;
        }

        if(a){
            rep(i,n){
            cout<<qw[i];
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(N);
    SCIN(s);SCIN(t);
    for(int a = 0;a < N;a++){
        string w = t.substr(0,N-a);
        string g = s.substr(a,N-a);
       // cout<<w<<" "<<g<<endl;
        if(w == g){
            COUT(N+a);
            return 0;
        }
    }
    COUT(2*N);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
*/

typedef pair<int, int> P;


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

	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h, vector<char>(w));
	vector<pair<int, int>> bpos;
	int bnum = 0;

	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
			if (a[i][j] == '#') {
				bnum++;
				bpos.push_back({ i, j });
			}
		}
	}

	vector<vector<bool>>used(h, vector<bool>(w, false));

	queue<P> que;
	rep(i, bnum) {
		que.push(P((int)bpos[i].first, (int)bpos[i].second));
		used[bpos[i].first][bpos[i].second] = true;
	}

	int ans = 0;

	while (bnum != h * w) {
		bpos.clear();

		while (que.size()) {
			P p = que.front(); que.pop();
			// 移動4方向をループ
			for (int k = 0; k < 4; k++) {
				int nx = p.first + dx[k], ny = p.second + dy[k];

				if (nx >= 0 && nx < h && ny >= 0 && ny < w) {
					if (!used[nx][ny]) {
						if (a[nx][ny] == '.') {
							bnum++;
							bpos.push_back({ nx, ny });
							used[nx][ny] = true;
						}
					}
				}
			}
		}

		ans++;
		rep(i, (int)bpos.size()) {
			que.push(P((int)bpos[i].first, (int)bpos[i].second));
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 17516
import numpy as np
from itertools import combinations_with_replacement
 
n, m, q = map(int, input().split())
 
pt = np.array(list(combinations_with_replacement(range(1,m+1), n)))
score = np.zeros(len(pt))
 
for i in range(q):
    a, b, c, d =map(int, input().split())
    flg = pt[:,b-1] - pt[:,a-1] == c
    score += flg * d
#    print(score)
 
print(int(score.max()))

Measured memory_bytes: 46512
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 101010;
int n , x[N] , m , d[N] , I[N] , P[N];
ll K;
int A[N] , B[N];

void mult(int *a,int *b){
    rep(i,0,n) A[i] = a[i] , B[i] = b[i];
    rep(i,0,n) a[i] = B[A[i]];
}

int main(){
    cin >> n;
    rep(i,0,n) cin >> x[i];
    for(int i=n-1;i>=0;--i) d[i] = x[i] - (i == 0 ? 0 : x[i-1]);
    cin >> m >> K;
    rep(i,0,n) I[i] = P[i] = i;
    rep(i,0,m){
        int xx;cin >> xx;
        swap(P[xx-1] , P[xx]);
    }
    for(ll t=K;t;t>>=1){
        if(t&1) mult(I , P);
        mult(P , P);
    }
    ll Sum = 0;
    rep(i,0,n){
        Sum += d[I[i]];
        cout << Sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;
using namespace std;

typedef vector<vector<int>> vii;


int main(){
    int N;
    cin >> N;
    vector<bitset<10>> fs = vector<bitset<10>> (N, bitset<10> (0));
    vector<vector<int>> ps = vector<vector<int>> (N, vector<int> (10 + 1));
    rep(i, N){
        rep(j, 10){
            int tmp;
            cin >> tmp;
            if(tmp){
                fs[i].set(j);
            }
        }

    }

    rep(i, N){
        rep(j, 10 + 1){
            int tmp;
            cin >> tmp;
            ps[i][j] = tmp;
        }
    }

    int max_p = (1 << 10) - 1;
    ll ans = -1e10;
    for(int i = 1; i <= max_p; i++){
        bitset<10> tmp(i);
        ll  sum = 0;
        rep(j, N){
            int size = (fs[j] & tmp).count();
            //bit_set<size>でsizeが定数なりで型が同じでないとつかえない.
            sum += ps[j][size];
        }
        ans = max(sum, ans);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
map <string, int> mp;
string s;
int n;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; i++) {
        cin >> s;
        sort(s.begin(), s.end());
        if(mp.find(s) != mp.end()) ans += mp[s];
        mp[s]++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 11264
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(0));
    int n,m;
    cin>>n>>m;
    cout<<(n*(n-1))/2+(m*(m-1))/2;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASecurity solver = new ASecurity();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASecurity {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] n = in.next().toCharArray();
            for (int i = 0; i < n.length - 1; i++) {
                if (n[i] == n[i + 1]) {
                    out.print("Bad");
                    return;
                }
            }
            out.print("Good");
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 21204
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
 
/* Coding Space*/

struct Edge{
  int to,cost;
};
int n;
vector<Edge> G[100001];
typedef tuple<int,int> tii;
ll d[100001];
void dijkstra(int s){
  priority_queue<tii,vector<tii>,greater<tii> > q;
  fill_n(d,100001,LLINF);
  d[s] = 0;
  q.push(tii{0,s});
  while(!q.empty()){
    tii p = q.top(); q.pop();
    int t,v;
    tie(t,v) = p;
    if(d[v] < t) continue;
    rep(i,(int)G[v].size()){
      Edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        q.push(tii(d[e.to], e.to));
      }
    }
  }
}


int main(){
  cin >> n;
  rep(i,n-1){
    int a,b,c; cin >> a >> b >> c;a--,b--;
    G[a].pb(Edge{b,c});
    G[b].pb(Edge{a,c});
  }
  int q,k; cin >> q >> k; k--;
  dijkstra(k);
  rep(i,q){
    int a,b; cin >> a >> b;a--,b--;
    cout << d[a] + d[b] << endl;
  }
}

Measured memory_bytes: 8820
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

class union_find
{
	int  _setnum;
	vector<int> par, nume;
public:
	union_find(){
	}
	
	union_find(int x){
		par.resize(x);
		nume.resize(x);
		init();
	}
	
	~union_find(){
		//
		
	}
	
	void clear(){
		_setnum = 0;
		par.clear();
		nume.clear();
	}
	
	void init(){
		_setnum = par.size();
		for(int i = 0; i < par.size(); i++){
			par[i] = i;
			nume[i] = 1;
		}
	}
	
	void resize(int x){
		
		par.resize(x);
		nume.resize(x);
		init();
	}

	int find(int x){
		return par[x] == x ? x : par[x] = find(par[x]);
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
	
		if(x == y)return;
		
		_setnum--;
		
		if(nume[x] > nume[y]) std::swap(x,y);
		
		par[x] = y;
		nume[y] += nume[x];
	}
	
	bool same(int x, int y){
		return find(x) == find(y);
	}
	
	int numel(int x){
		return nume[find(x)];
	}
	
	int size(){
		return par.size();
	}
	
	int setnum(){
		return _setnum;
	}
};

#define x first
#define y second

signed main(){
	cout<<fixed<<setprecision(10);
	
	vector<pair<int,int>> in;
	vector<int> t;
	vector<pair<int,int>> hoge;
	pair<int,int> minimum;
	
	union_find uf;
	int N;
	
	cin>>N;
	
	in.resize(N);
	t.resize(N);
	uf.resize(N);
	
	for(int i = 0; i < N; i++){
		cin>>in[i].x>>in[i].y;
		
		in[i].x--;
		in[i].y--;
		
		t[i] = in[i].x;
	}
	
	sort(in.begin(), in.end());
	
	for(int i = 0; i < N; i++){
		if(hoge.size() == 0) {
			hoge.push_back(in[i]);
			minimum = in[i];
		} else {
			if(hoge.back().y > in[i].y) {
				hoge.push_back(in[i]);
			} else {
				bool flag = true;
				pair<int,int> temp;
				
				while(hoge.size() >= 1){
					if(hoge.back().y < in[i].y) uf.unite(in[i].x, hoge.back().x);
					
					if(hoge.size() == 1) break;
					
					if(hoge[hoge.size()-2].y > in[i].y) break;
					
					uf.unite(hoge[hoge.size()-2].x, hoge.back().x);
					
					if(flag) {
						temp = hoge.back();
						flag = false;
					}
					hoge.pop_back();
				}
				
				if(flag == false && hoge.back() != temp)hoge.push_back(temp);
			}
			
			if(minimum.y > in[i].y) {
				minimum = in[i];
			} else {
				uf.unite(minimum.x, in[i].x);
			}
		}
		
		
	}
	
	for(int i = 0; i < N; i++){
		cout<<uf.numel(t[i])<<endl;
	}
	
	return 0;
}

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

int main(){
  int x;
  cin >> x;
  
  int cnt = 0;
  
  while(x / 500 != 0){
    cnt += 1000;
    x -= 500;
  }
  while(x / 5 != 0){
    cnt += 5;
    x -= 5;
  }
  cout << cnt << endl;
  return 0;
}

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

/*

*/

double eps=1e-8;
ll a,b2;

int main(void){
	double b;
	cin>>a>>b;
	b+=eps;
	b2 = b*100;
	cout<<a*b2/100<<endl;
	return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err(A) cout << #A << " = " << (A) << endl
using namespace std;

const int N=1e5+100,mod=1e9+7;
/*c*/

ll dp[N][3];
ll a[N][3];
int32_t main(){
    ll n,k;
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }

    //memset(dp,69,sifzeof dp);
    for (int i=1;i<=n;i++){
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }
    cout << max(dp[n][1],max(dp[n][0],dp[n][2]));
}


Measured memory_bytes: 4992
N = int(input())

list_W = list(map(int, input().split() ))
#print(list_W)
list_F = [list_W.pop(0)]
#print(list_F)
#print(list_W)
list_B = [list_W.pop(-1)]
#print(list_B)
#print(list_W)

if N >2:
    for i in range(N-2):
        #print(str(i)+"回目")
        if sum(list_F) > sum(list_B):
            list_B.append(list_W.pop(-1))
        else:
            list_F.append(list_W.pop(0))

result = abs(sum(list_F) - sum(list_B))

print(str(result))

Measured memory_bytes: 3064
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
void yesOrNo(bool flg) {
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

void solve(std::string S) {
  bool result = S.at(2) == S.at(3) && S.at(4) == S.at(5);

  yesOrNo(result);
}

int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int gcd(int a, int b) {
  while (b) {
    int c = a;
    a = b;
    b = c % b;
  }
  return a;
}

int main() {
  int n;
  scanf("%d", &n);
  int ret, x;
  scanf("%d", &ret);
  n--;
  while (n--) {
    scanf("%d", &x);
    ret = gcd(ret, x);
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a;
cin >> a;
double  b = M_PI * a*a ;
double c = 2 * M_PI * a;
cout << fixed << setprecision(15) << b << ' ' << fixed << setprecision(15)<< c << endl;
}


Measured memory_bytes: 3288
# Bubble Sort
N = int(input())
A = list(map(int, input().split()))
swapCnt = 0
for i in range(len(A)-1):
    for j in range(len(A)-1, i, -1):
        if A[j] < A[j-1]:
            A[j], A[j - 1] = A[j - 1], A[j]
            swapCnt += 1
print(' '.join(map(str, A)))
print(swapCnt)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    int r=N/R;
    int sum=0;
    for(int i=0;i<r+1;i++){
        int g=(N-i*R)/G;
        for(int j=0;j<g+1 && (N-i*R-j*G)>=0;j++){
            int x=N-i*R-j*G;
            if(x%B==0 && x>=0)sum++;
        }
    }
    cout << sum;


}

/*



 */



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

#define repo(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main(){
    ll X;
    cin >>X;
    ll i = 0;
    ll money = 100; 
    while(money < X){
       money = money + money*0.01;
       
       i++; 
    }
    cout << i << endl;

    return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){
  string t, w;
  cin >> w;
  transform(w.begin(), w.end(), w.begin(), ::toupper);
  
  int ans = 0;
  
  while(1){
    cin >> t;
    if(t == "END_OF_TEXT"){
      break;
    }
    transform(t.begin(), t.end(), t.begin(), ::toupper);
    if(t == w) ans++;
  }
  cout << ans << endl;
    
  return 0;
}  



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define THE using
#define DARK namespace
#define ONE std
#define dbg(x) cout << #x << " = " << x << endl

THE DARK ONE;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    freopen("out.txt", "w", stdout);
//    freopen("input.txt", "r", stdin);
    int d;
    cin >> d;
    switch(d){
        case 25 :{
            cout << "Christmas" << endl;
            break;
        }
        case 24 :{
            cout << "Christmas Eve" << endl;
            break;
        }
        case 23 :{
            cout << "Christmas Eve Eve" << endl;
            break;
        }
        case 22 :{
            cout << "Christmas Eve Eve Eve" << endl;
            break;
        }
    }
    return 0;
}



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

int main(){
    char c;
    cin >> c;
    
    if((c == 'a') || (c == 'i') || (c == 'u') || (c == 'e') || (c == 'o'))
        cout << "vowel" << endl;
    else
        cout << "consonant" << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int a, b;

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

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextInt();
        b = sc.nextInt();
        solve();
    }

    void solve() {
        int sum = a + b;
        if (sum % 2 == 0) {
            System.out.println(sum / 2);
        } else {
            System.out.println(sum / 2 + 1);
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

int check(int x) {
    if (x < 10) return 1;
    int t = x % 10;
    while (x >= 10) {
        x /= 10;
        int t2 = x % 10;
        if (t != t2+1) return -1;
        t = t2;
    }
    return 1;
}

int main(void){
    int n;
    cin >> n;
    int a[1010];
    for (int i = 0; i < n; i++) cin >> a[i];
    
    int ans = -1;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            int x = a[i] * a[j];
            if (check(x) == 1) ans = max(ans, x);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	while(1){
		string s; cin >> s;
		if(s == "#") break;
		int n = s.size();
		vl v;
		rep(i,n){
			if(s[i] == 'n'){
				v.push_back(-1);
				i += 4;
			}else{
				v.push_back(1);
				i += 3;
			}
		}
		reverse(all(v));
		int m = v.size();
		ll now = 0;
		rep(i,m){
			now = now * 2 + (v[i] * 90);
			chmax(now,0);
		}
		ll t = m-1;
		while(now > 0 && now % 2 == 0 && t > 0){
			now /= 2;
			t--;
		}
		if(t == 0 || now == 0) cout << now << "\n";
		else cout << now << "/" << (1LL<<t) << "\n";
	}
}


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

typedef long long ll;
using namespace std;

int main(){
	ll n;
	cin >> n;
	vector<ll>a;
	for(ll i=0; i < n;i++){
		ll temp;
		cin >> temp;
		a.push_back(temp);
	}
	vector <ll> f(n),r(n);

	for(ll i=0; i < n;i++){
		if(i==0){
			f[0] = a[i];
			continue;
		}
		f[i] = __gcd(f[i-1], a[i]);
	}

	for(ll i=n-1; i >= 0;i--){
		if(i == n-1){
			r[i] = a[i];
			continue;
		}
		r[i] = __gcd(r[i+1], a[i]);
	}

	ll res = 0;
	for(ll i=0; i < n;i++){
		if(i==0){
			if(res < r[i+1])
			res = r[i+1];
		}else if(i == n-1){
			if(res < f[i-1])
			res = f[i-1];
		}else{
			ll g = __gcd(f[i-1], r[i+1]); 
			if( g > res){
				res = g; 
			}
		}
	}

	cout << res <<endl;

	return 0;
}

Measured memory_bytes: 2676
s = gets.chomp.split("")
k = gets.to_i
after = []
s.each do |c|
  if c == "a"
    after << c
  elsif c.ord + k >= 123
    after << "a"
    k -= 123 - c.ord
  else
    after << c
  end
end
k %= 26
after[after.size - 1] = (after[after.size - 1].ord + k).chr
puts after.join("")


Measured memory_bytes: 15100