akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;typedef pair<int,int> pii;const int mod=1000000007;
pii a[200005];int minn[200005],maxx[200005],dp[200005],sum[200005];
int main() {int n,pos=0;
	scanf("%d",&n);for (register int i=1;i<=n;++i) scanf("%d%d",&a[i].first,&a[i].second);
	sort(a+1,a+n+1,[](pii u,pii v)->bool{return u.first<v.first||u.first==v.first&&u.second>v.second;});
    maxx[1]=a[1].second,minn[n]=a[n].second;
    for (register int i=2;i<=n;++i) maxx[i]=max(maxx[i-1],a[i].second);for (register int i=n-1;i;--i) minn[i]=min(minn[i+1],a[i].second);
    for (register int i=1;i<=n;++i) a[i]=make_pair(lower_bound(maxx+1,maxx+n+1,a[i].second)-maxx,upper_bound(minn+1,minn+n+1,a[i].second)-minn-1);
    sort(a+1,a+n+1,[](pii u,pii v)->bool{return u.first<v.first||u.first==v.first&&u.second>v.second;});
    for (register int i=1;i<=n;++i) {while (pos&&a[pos].second>=a[i].second) --pos;a[++pos]=a[i];}
    for (register int i=*dp=*sum=1,j=0;i<=n;++i) {if (j<=pos&&i>a[j].second) ++j;
        dp[i]=(sum[i-1]-(a[j-1].first?sum[a[j-1].first-1]:0)+mod)%mod,sum[i]=(sum[i-1]+dp[i])%mod;
    }printf("%d",(sum[n]-sum[a[pos].first-1]+mod)%mod);return 0;
}

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

typedef long long ll;

const int N = 3005, Mod = 1e9 + 7;
int n, a[N];

int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x = i;
    for (int j = 2; j * j <= x; ++j)
      while (x % j == 0) {
	++a[j];
	x /= j;
      }
    if (x)
      ++a[x];
  }
  ll ans = 1;
  for (int i = 2; i <= n; ++i)
    ans = ans * (a[i] + 1) % Mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
from fractions import gcd

def input():
	return sys.stdin.readline()

N = int(input())
A = [int(_) for _ in input().split()]
p1 = [0] * N
p2 = [0] * N

p1[0] = A[0]
p2[-1] = A[-1]

for i in range(1, N):
	p1[i] = gcd(p1[i-1], A[i])
	p2[-(i+1)] = gcd(p2[-i], A[-(i+1)])

m = max(p1[-2], p2[1])

if N > 2:
	for i in range(1, N-1):
		m = max(m, gcd(p1[i-1], p2[i+1]))

print(m)

Measured memory_bytes: 85228
#include <bits/stdc++.h>
using namespace std;
 
#define IOS  cin.tie(0),cout.tie(0); ios::sync_with_stdio(false);
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
 
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    IOS
	int n;
    cin >> n;
    vector<string> tmp(n);
    for (int i = 0; i < n; i++) cin >> tmp[i];
    map<string, int> papers;
    for (string s : tmp) papers[s]++;
    int mx = 0;
    for (auto p : papers) {
        mx = max(mx, p.second);
    }
    for (auto p : papers) {
        if (p.second == mx) {
            cout << p.first << "\n";
        }
    }

    return 0;
}



Measured memory_bytes: 25472
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        if ((a - b) % 2 == 0) {
            System.out.println(Math.abs(a - b) / 2);
        } else {
            long min = Math.min(a, b);
            long max = Math.max(a, b);
            long zAns = min;
            max -= min + 1;
            zAns += max / 2;
            max = Math.max(a, b);
            long nAns = n - max + 1;
            min += nAns;
            nAns += (n - min) / 2;
            System.out.println(Math.min(zAns, nAns));
        }
    }
}

Measured memory_bytes: 22612
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#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-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll N;
	cin>>N;
	cout<<N*N;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int n,m;
    scanf("%d %d\n",&n,&m);
    int a[n][m];
    int b[m][1];
    int c[n][1];
    int i,j;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            if(j==m-1){
                scanf("%d\n",&a[i][j]);
            }else{
                scanf("%d ",&a[i][j]);
            }
        }
    }
    int k;
    for(k=0;k<m;k++){
        scanf("%d\n",&b[k][0]);
    }
    int l;
    for(l=0;l<n;l++){
        int x;
        c[l][0] = 0;
        for(x=0;x<m;x++){
            c[l][0] = c[l][0] + (a[l][x]*b[x][0]);
        }
    }
    int y;
    for(y=0;y<n;y++){
        printf("%d\n",c[y][0]);
    }
    return 0;
}

Measured memory_bytes: 644
#include <iostream>

using namespace std;

int main(void) {

	int n;

	cin >> n;

	int *h = (int *)malloc(sizeof(int) * n);

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

	int count = 1;

	for (int i = 1; i < n; i++) {
		int max_h = 0;
		for (int j = 0; j < i; j++) {
			max_h = max_h <= h[j] ? h[j] : max_h;
		}
		if (max_h <= h[i]) {
			count++;
		}
	}

	cout << count << endl;

	free(h);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    rep(i, 0, S.size()) {
        cout << 'x';
    }
    cout << endl;
    return 0;
}

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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    ll x;
//    x=1ll << 59;
//    ll y=(1ll << 59) - 1ll;
//    cout<<((double)(x)==(double)(x-1))<<endl;
    string s,s2,s3;ll n=0,x,y=1;
    cin>>s;
    cin>>s2;
    s3=s+s2;x=s3.size();//cout<<s3<<endl;
    for(int i=x-1;i>=0;i--){
        if((x-i-1)==0)y*=1;
        else y*=10;
        n+=(ll)((s3[i]-'0')*y);
    }//cout<<sqrt(n+0.0)<<endl;
    if((ll)((ll)sqrt(n+0.0)*(ll)sqrt(n+0.0))==n)cout<<"Yes";
    else cout<<"No";
}


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

int main()
{
  int n, ans=0;
  cin >> n;
  ans += 1000 * (n / 500);
  int tmp = n % 500;
  ans += 5 * (tmp / 5);
  cout << ans << endl;
  return 0;
}

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

  int ans = 0;

  while(true) {
    if((pow(2,ans) <= n) && (n < pow(2, ans + 1))) break;
    ans++;
  }  

  cout << pow(2,ans) << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 1e5+7;
long long a[N];
int main(){
	int n,i;
	long long w=-1,d=-1;
	scanf("%d",&n);
	for(i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	for(i=n;i>1;i--){
		if(a[i]==a[i-1]){
			if(w==-1) {w=a[i];i--;}
			else if(d==-1)	{d=a[i];i--;}
		}
	}
	if(w==-1||d==-1) printf("0");
	else printf("%lld",w*d);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18+100;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    vint p(n), c(n);
    rep(i,n) {
        int x; cin >> x;
        x--;
        p[i] = x;
    }
    rep(i,n) cin >> c[i];
    vll v(n);
    vint ct(n);
    rep(i,n) {
        for (int j = p[i]; ; j = p[j]) {
            v[i] += c[j];
            ct[i]++;
            if (j == i) break;
        }
    }
    ll ans = -inf_l;
    rep(i,n) {
        if (v[i] > 0) {
            int n_loop, rem;
            if (k % ct[i] == 0) {
                n_loop = k / ct[i] - 1;
                rem = ct[i];
            } else {
                n_loop = k / ct[i];
                rem = k % ct[i];
            }
            ll sum = v[i] * n_loop;
            ans = max(ans,sum);
            int cur = i;
            while (rem--) {
                cur = p[cur];
                sum += c[cur];
                ans = max(ans,sum);
            }
        } else {
            ll sum = 0;
            int rem = min(k,ct[i]);
            int cur = i;
            while (rem--) {
                cur = p[cur];
                sum += c[cur];
                ans = max(ans,sum);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <math.h>
#include <algorithm>
#include <queue>

using namespace std;
int main()
{
    int N;

    cin >> N;
    vector<int> joulist( N, 0 );
    vector<int> bukalist( N, 0 );

    for (auto i = 1; i < N; i++) {
        cin >> joulist[i];
        bukalist[joulist[i] - 1]++;
    }

    for (auto i = 0; i < N; i++) {
        cout << bukalist[i] << endl;
    }



    return 0;
}


Measured memory_bytes: 4780
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

const int INF = 1000000000;

typedef vector< vector<int> > graph;

graph g;
vector<int> match;
vector<bool> visit;

bool search(int u){
	if(u<0) return true;
	for(int i=0;i<g[u].size();i++){
		int next = g[u][i];
		if(visit[next]) continue;
		visit[next] = true;
		if(search(match[next])){
			match[u] = next, match[next] = u;
			return true;
		}
	}
	return false;
}

// L : ¶¤Ìm[hCR : E¤Ìm[h
int maximumMatch(int L, int R){
	int res = 0;
	match.assign(L+R, -1);
	for(int i=0;i<L;i++){
		visit.assign(L+R, false);
		res += search(i);
	}
	return res;
}

int main(){
	int N, M, L;
	static int dist[100][100];
	while(cin >> N >> M >> L, N){
		for(int i=0;i<N;i++)
			for(int j=0;j<N;j++)
				dist[i][j] = (i==j ? 0 : INF);
		for(int i=0;i<M;i++){
			int a, b, c; cin >> a >> b >> c;
			dist[a][b] = dist[b][a] = min(dist[a][b], c);
		}
		for(int k=0;k<N;k++)
			for(int i=0;i<N;i++)
				for(int j=0;j<N;j++)
					dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
		g.assign(2*L, vector<int>());
		vector< pair<int, int> > vp(L);
		for(int i=0;i<L;i++)
			cin >> vp[i].second >> vp[i].first;
		sort(vp.begin(), vp.end());
		for(int i=0;i<L;i++){
			for(int j=i+1;j<L;j++){
				if(vp[i].first + dist[vp[i].second][vp[j].second] <= vp[j].first){
					g[i].push_back(L+j);
					g[L+j].push_back(i);
				}
			}
		}
		cout << L - maximumMatch(L, L) << endl;
	}
}

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

int main() {
  int A,B;
  string op;
  cin >> A >> op >> B;
  
  if ( op == "+" ) {
    cout << A + B  << endl;
  }
  if ( op == "-" ) {
    cout << A - B << endl;
  }
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define rep(i, n) for(int i=0; i<n; i++)
#define pb push_back
using namespace std;
typedef pair<int, int> P;
int n, m, x[MAX_N];

signed main(){
    cin >> n >> m;
    rep(i, m) cin >> x[i];
    if(n >= m){
        cout << 0 << endl;
        return 0;
    }
    sort(x, x+m);
    int dist[MAX_N], sod = m - 1;
    rep(i, sod) dist[i] = x[i+1] - x[i];
    sort(dist, dist+sod);
    int ret = 0;
    rep(i, m-n){
        ret += dist[i];
        // cout << dist[i] << " ";
    }
    // cout << endl;
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int a[100005];
int main()
{
	long long n,x,sum=0;
	cin>>n>>x;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	if(a[1]>=x) 
	{
		sum+=a[1]-x;
		a[1]=x;
	}
	for(int i=1;i<n;i++)
	{
		int t=a[i]+a[i+1]-x;
		if(t<=0) continue;
		if(a[i]>=x)
		{
			sum+=t;
			a[i+1]=0;
			 
		 }
		 else
		 {
		 	sum+=t;
			a[i+1]=x-a[i];
		 } 
 	}
 	cout<<sum<<endl;
 } 

Measured memory_bytes: 640
/**************************************************************
>>> Author: dahetao
>>> Create Time: 2019/12/20 2:14:07
**
 *                    .::::.
 *                  .::::::::.
 *                 :::::::::::  I && YOU
 *             ..:::::::::::'
 *           '::::::::::::'
 *             .::::::::::
 *        '::::::::::::::..
 *             ..::::::::::::.
 *           ``::::::::::::::::
 *            ::::``:::::::::'        .:::.
 *           ::::'   ':::::'       .::::::::.
 *         .::::'      ::::     .:::::::'::::.
 *        .:::'       :::::  .:::::::::' ':::::.
 *       .::'        :::::.:::::::::'      ':::::.
 *      .::'         ::::::::::::::'         ``::::.
 *  ...:::           ::::::::::::'              ``::.
 * ````':.          ':::::::::'                  ::::..
 *                    '.:::::'                    ':'````..
 *
**************************************************************/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int main()
{
	//freopen("30.in","r",stdin);//设置 cin scanf 这些输入流都从 test.in中读取
    //freopen("30.out","w",stdout);//设置 cout printf 这些输出流都输出到 test.out里面去
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	string s;
	cin>>s;
	int sum=0,r=s.length()-1;
	for(int l=0;l<(s.length()|1)/2;l++)
	{
		if(s[l]!=s[r]) sum++;
		r--;
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
local mfl = math.floor
local a, b = io.read("*n", "*n")
local t = {}
for i = 1, 5000 do t[i] = false end
for i = 5001, 10000 do t[i] = true end
for i = 1, a - 1 do
  local row = (mfl(i / 25) + 1) * 2
  local col = (i % 25 + 1) * 2
  t[(row - 1) * 100 + col] = true
end
for i = 1, b - 1 do
  local row = 50 + (mfl(i / 25) + 1) * 2
  local col = (i % 25 + 1) * 2
  t[(row - 1) * 100 + col] = false
end
print("100 100")
for row = 1, 100 do
  for col = 1, 100 do
    local idx = (row - 1) * 100 + col
    io.write(t[idx] and "." or "#")
  end
  io.write("\n")
end


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
int m, n;
int po[13] = {};

void init(){
    po[0] = 1;
    for(int i = 1; i < 13; i++) po[i] = po[i - 1] * 3;
}

int dfs(vector<string> &data, vector<int> &dp, int S){
    
    int ret = dp[S];
    if(ret != MOD) return ret;
    string state = "";
    int temp_S = S;
    for(int i = 0; i < m; i++){
        string add = "";
        if(S % 3 == 0) add = "0";
        else if(S % 3 == 1) add = "1";
        else add = "2";
        
        state = add + state;
        S /= 3;
    }

    //cout << "state is " << state << endl;
    //残っている data の数
    int cnt = 0;
    
    for(int i = 0; i < n; i++){
        bool ok = true;
        for(int j = 0; j < m; j++){
            if(state[j] == '2') continue;
            if(data[i][j] != state[j]) ok = false;
        }
        cnt += ok;
    }

    if(cnt <= 1){
        ret = 0;
        dp[S] = ret;
        //cout << "dp[" + state + "] = " << dp[S] << endl;        
        return ret;
    }

    // 未決定 (2) のところを 0 or 1 に変更して遷移する
    S = temp_S;
    
    for(int i = 0; i < m; i++){
        if(state[i] == '2'){
            int T1 = S + po[m - i - 1] * (0 - 2);
            int T2 = S + po[m - i - 1] * (1 - 2);
            //cout << S << " " << state << " " << T1 << " " << T2 << endl;
            int temp = max(dfs(data, dp, T1), dfs(data, dp, T2)) + 1;
            ret = min(ret, temp);
        }
    }

    dp[S] = ret;
    //cout << "dp[" + state + "] = " << dp[S] << endl;            
    return ret;
}

signed main(){

    init();

    while(1){
        cin >> m >> n;
        if(n == 0) break;
        vector<string> data(n);
        for(int i = 0; i < n; i++) cin >> data[i];

        int S = (int)po[m] - 1;

        // 状態 S を特定するために必要な最大の質問回数
        vector<int> dp(S + 1, MOD);
        cout << dfs(data, dp, S) << endl;
    }

    return 0;
}


Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long Int;
typedef vector<int> VI;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000;
const Int LINF = INF * (Int) INF;
const int MAX = 1007;
const int MOD = 1000000007;

mt19937 rng;

int gcd(int a, int b) {
    if (!b) return a;
    return gcd(b, a % b);
}

int main(int argc, char* argv[])
{
	//ios::sync_with_stdio(false); cin.tie(0);
    rng = mt19937(chrono::steady_clock::now().time_since_epoch().count());

    
    int x;
    cin >> x;
    // x = 180 - x;
    int g = gcd(x, 360);
    cout << 360 / g << endl;
    
    cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 3792
# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math 
# import collections
# import string
# ===================================
def s(n):
	ans = 0
	for x in str(n):
		ans += int(x)
	return ans

n = int(input())
print("Yes" if n%s(n) == 0 else "No")




Measured memory_bytes: 2940
#include <iostream>
using namespace std;
#define MAXN 25
#define NIL -1

struct Node {int parent, left, right; };

struct Node T[MAXN];

void preorder(int root){
    cout << " " << root;
    if (T[root].left != NIL){
        //cout << " " << T[root].left;
        preorder(T[root].left);
    }
    if (T[root].right != NIL){
        //cout << " " << T[root].right;
        preorder(T[root].right);
    }
}

void inorder(int root){
    if (T[root].left != NIL){
        //cout << " " << T[root].left;
        inorder(T[root].left);
    }
    cout << " " << root;
    if (T[root].right != NIL){
        //cout << " " << T[root].right;
        inorder(T[root].right);
    }
}

void postorder(int root){
    if (T[root].left != NIL){
        //cout << " " << T[root].left;
        postorder(T[root].left);
    }
    if (T[root].right != NIL){
        //cout << " " << T[root].right;
        postorder(T[root].right);
    }
    cout << " " << root;
}

int main(){
    int n; cin>>n;
    for(int i=0; i<n; ++i){
        T[i].parent = NIL;
        T[i].left = NIL;
        T[i].right = NIL;
    }
    for(int i=0; i<n; ++i){
        int node, left, right; cin>>node>>left>>right;
        T[node].left = left;
        T[node].right = right;
        if (left!=NIL) T[left].parent = node;
        if (right!=NIL) T[right].parent = node;
    }
    
    int root = 0;
    for(int i=0; i<n; ++i){
        if (T[i].parent == NIL) root = i;
    }
    
    cout << "Preorder" << endl;
    preorder(root);
    cout << endl;
    cout << "Inorder" << endl;
    inorder(root);
    cout << endl;
    cout << "Postorder" << endl;
    postorder(root);
    cout << endl;
}

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

int main() {
	int n,p,d1,d2,mn,md;
	while(cin >> n && n!=0) {
		md=-1;
		for (;n>0;n--) {
			cin >> p >> d1 >> d2;
			if (md<d1+d2) { mn=p; md=d1+d2;}
		}
		cout << mn << ' ' << md << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
string s, t;

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

  cin >> s >> t;
  vector<int> S(s.size());
  vector<int> T(t.size());
  rep(i, s.size()){
    S[i] = s[i] - '0';
  }

  rep(i, t.size()){
    T[i] = t[i] - '0';
  }

  sort(ALL(S));
  sort(ALL(T), greater<int>());
  rep(i, S.size()){
    if (T.size()<=i){
      cout << "No" << "\n";
      return 0;
    }
    if (S[i]< T[i]){
      cout << "Yes" << "\n";
      return 0;
    }
    if (S[i] > T[i]){
      cout << "No" << "\n";
      return 0;
    }
  }
  
  cout << ((S.size() == T.size()) ? "No" : "Yes") << "\n";
  return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

flag = True
for i in range(N+1):
    x = i
    N_ = N - x
    if not(flag):
        break
    for j in range(N_+1):
        y = j
        z = N_ - j
        if 10000*x + 5000*y + 1000*z == Y:
            print(x,y,z)
            flag = False
            break
if flag:
    print(-1,-1,-1)

Measured memory_bytes: 3064
num = input()
n = len(num) - 1

for i in range(2 ** n):
    calc = ["-"] * n
    for j in range(n):
        if ((i >> j) & 1):
            calc[- 1 - j] = "+"
    formula = ""
    for number, c in zip(num, calc):
        formula += number+c
    formula += num[-1]
    if eval(formula) == 7:
        formula += "=7"
        break

print(formula)


Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#include <bitset>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
//#define double long double
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch-'0'), ch=getchar();
    return s*w;
}
void print(int x) { if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int n,a[N],res;
signed main()
{
    n=read();
    for(ri int i=1;i<=n;i++)
    {
        int x=read();
        a[x]++;
    }
    for(ri int i=1;i<=100000;i++) res+=a[i]*i;
    for(ri int q=read();q;q--)
    {
        int b,c;
        b=read(), c=read();
        res+=(c-b)*a[b];
        a[c]+=a[b], a[b]=0;
        printf("%lld\n",res);
    }
    return 0;
}

Measured memory_bytes: 4476
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>

using namespace std;

int main(){
  int a,b,c;
  int n;

  while(1){
    //a,b,cの入力
    /*    char line[100];
    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d %d",&a,&b,&c);
    */

    scanf("%d %d %d",&a,&b,&c);
    //a=b=c=0 なら終了
    if(a==0&&b==0&&c==0){
      break;
    }

    //対角線の半分を求め、その最大値を求める
    double d[3];
    d[0]=sqrt(a*a+b*b)/2;
    d[1]=sqrt(b*b+c*c)/2;
    d[2]=sqrt(c*c+a*a)/2;
    double mind=d[0];
    for(int i=0;i<2;i++){
      if(mind>d[i]) mind=d[i];
    }

    //nの入力
    cin>>n;

    //rの入力、判定
    for(int i=0;i<n;i++){
      double r=0;
      cin>>r;
      if(mind<r){
	cout<<"OK\n";
      }
      else{
	cout<<"NA\n";
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST freopen("in.txt","r",stdin);
#define ab(a) ((a < 0) ? (-(a)) : (a))
#define all(a) a.begin(), a.end()
#define ones(a) __builtin_popcount(a)

const int N = (int)2e5 + 9;

struct Union{
  int siz[N];
  int nex[N];
  Union(){
    for(int i = 0;i < N; i ++ )
      siz[i] = 1, nex[i] = i;
  }
  int move(int a){
    while(nex[a] != a)
      a = nex[a];
    return a;
  }
  void unite(int a, int b){
    a = move(a);
    b = move(b);
    if(a == b)  
      return;
    if(a > b)
      swap(a, b);
    nex[a] = b;
    siz[b] += siz[a];
  }
};

map<pii, int> cnt;

int main(){
  fastIO;
  Union *road = new Union();
  Union *rail = new Union();
  int n,k,l;
  cin >> n >> k >> l;
  int u, v;
  for(int i = 0;i < k;i ++ ){
    cin >> u >> v;
    road->unite(u, v);
  }
  for(int i = 0;i < l;i ++ ){
    cin >> u >> v;
    rail->unite(u, v);
  }
  int Road[n + 1], Rail[n + 1];
  for(int i = 1; i <= n;i ++ ){
    Road[i] = road->move(i);
    Rail[i] = rail->move(i);
    cnt[mp(Road[i], Rail[i])] ++ ;
  }
  for(int i = 1;i <= n; i ++ ){
    cout << cnt[mp(Road[i], Rail[i])] << " ";
  }
  return 0;
}


Measured memory_bytes: 16768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;



int main() {
  int N; cin >> N;
  vector<ll> a(N),b(N),c(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) cin >> b[i];
  
  bool can = true;
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    c[i] = b[i]-a[i];
    sum += c[i];
  }
  if (sum < 0) can = false;
  sort(c.begin(),c.end());
  
  int k = lower_bound(c.begin(),c.end(),0) - c.begin();
  ll p = 0;
  for (int i = k; i < N; i++) p += ((c[i] + 1) / 2);
  
  if(p > sum) can = false;

  if (can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

const int M=2e5+9;
const int MOD=1e9+7;
const long long MOD2=10000004873;
const long long N=1e12+7;

using namespace std;

long long pwr(long long b,int p){
    if(p<=0)return 1;
    long long sq=pwr(b,p>>1);
    sq=(((sq%MOD)*(sq%MOD))%MOD);
    if(p&1)
        sq=(((sq%MOD)*(b%MOD))%MOD);
    return sq;
}

int n,m,x,s;
int main(){
    scanf("%d %d",&n,&m);
    while(m--){
        scanf("%d",&x);
        s+=x;
    }
    if(s>n)printf("%d",-1);
    else printf("%d",n-s);
    return 0;
}


Measured memory_bytes: 3820
// 0174
#include <iostream>
#include <string>
using namespace std;

int main(){

	while(1){
		string str[3];
		int a[3] = {0}, b[3] = {0};

		cin>>str[0];
		if(str[0] == "0")
			break;

		cin>>str[1];
		cin>>str[2];

		for(int i=0;i<3;i++){
			for(int j=1;j<str[i].length();j++)
				if(str[i][j] == 'A')
					a[i]++;
				else if(str[i][j] == 'B')
					b[i]++;

			if(i != 2){
				if(str[i+1][0] == 'A')
					a[i]++;
				else if(str[i+1][0] == 'B')
					b[i]++;
			}else{
				if(a[i] > b[i])
					a[i]++;
				else
					b[i]++;
			}
		}

		for(int i=0;i<3;i++)
			cout<<a[i]<<" "<<b[i]<<endl;
	}

	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<pair<int,int> > vec(n);
	for(int i = 0; i < n; ++i){
		int a;
		cin>>a;
		vec[i] = make_pair(a, i + 1);
	}
	sort(vec.begin(), vec.end());
	for(auto x : vec)cout<<x.second<<" ";
	cout<<endl;	
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
using namespace std;
#define MAX 200
int main(){
    int n,a[MAX],ans=0,flag=0;
    
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    while(flag==0){
        for(int i=0;i<n;i++){
            if(a[i]%2==0)
                a[i]/=2;
            else{
                flag=1;
                break;
            }
        }
        if(flag==0)
            ans++;
    }
    
    cout<<ans<<endl;
}


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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
#define forn(i, n) for(int i = 1; i <= n; i++)
#define rep(i, x, y) for(int i = x; i <= y; i++)
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define ll long long
#define ull unsigned long long
#define ld long double
#define mii map<int, int>
#define all(x) x.begin(), x.end()
#define N 100001

using namespace std;

const int maxn = 1e9;
const int mod = 1e9 + 7;

void solve() {
    int n;
    cin >> n;

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

    v[0]--;
    for(int i = 1; i < n; i++) {
        if(v[i] > v[i - 1]) v[i]--;
        else if(v[i] < v[i - 1]) cout << "No", exit(0);
    }

    cout << "Yes";

}

int main() {
	int tt = 1;

	while(tt--) {
		solve();
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)
 
using ll  = long long;
using ull = unsigned long long;

int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

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

    int M;
    std::cin >> M;

    std::vector<int> P(M), X(M);
    for (int i = 0; i < M; i++) {
        std::cin >> P[i] >> X[i];
    }

    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += T[i];
    }

    for (int i = 0; i < M; i++) {
        int temp = sum;
        temp -= T[P[i]-1];
        temp += X[i];
        std::cout << temp << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0]*N

for i in range(1, N):
  dp[i] = dp[i-1]+abs(h[i]-h[i-1])
  L = min(K, i)
  for j in range(2, L+1):
    dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]))

print(dp[N-1])

Measured memory_bytes: 52448
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string as = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string ab = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------

int main() {

  int a, sum = 0;

  rep(i, 3) {
    cin >> a;
    sum += a;
  }

  if(sum>=22) cout << "bust" << endl;
  else cout << "win" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;
int n,m;
vector<int>adj[N];
bool visi[N];
int dist[N];
int pa[N];
queue<int>q;
void bfs(int x){
    visi[x]=true;
    pa[x] = -1;      
    dist[x]=0;
    q.push(x);
    while(!q.empty()){
        int s=q.front();
        q.pop(); 
        for(auto u : adj[s]){
            if(visi[u])
                continue;
            visi[u]=true;
            dist[u]=s;
            pa[u] = s;
            q.push(u);
        }

    }
    f(i,1,n+1){
        if(!visi[i]){
            cout << "No\n";
            exit(0);
        }
    }
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    int i,x,y;
    f(i,0,m){
        cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);  
    }
    bfs(1);
    cout << "Yes\n";
    f(i,2,n+1){
        cout << dist[i] << "\n";
    }
    
    
    return 0;
}
 


Measured memory_bytes: 23272
#include <bits/stdc++.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
using namespace std;

int main(){
    int n;
    string s;
    int bc = 0;
    cin >> n >> s;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '#') bc++;
    }
    int lb = 0, rw = n - bc;
    int mi = lb + rw;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '#')
            lb++;
        else
            rw--;
        mi = MIN(mi, lb + rw);
    }
    cout << mi << endl;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    string S; cin >> S;
    for (int i = 0; i < S.length()-1; i++) {
        if (S[i] == S[i+1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	c := 0
	for _, b := range s {
		if b == 'o' {
			c++
		}
	}
	l := len(s)
	if 15-l+c >= 8 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
n,m = map(int,input().split())
a = [0]*n
AC,WA=0,0
for i in range(m):
    x,y = input().split()
    x = int(x)
    if a[x-1]!=-1 and y=="WA":
        a[x-1]+=1
    if a[x-1]!=-1 and y=="AC":
        WA+=a[x-1]
        AC+=1
        a[x-1]=-1
print(AC,WA)

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

int main() {
	string s;
	cin>>s;
	bool A[26]={0};
	for(const char& c:s){
		A[c-'a']=true;
	}
	for(int i=0;i<26;i++){
		if(!A[i]){
			cout<<char(i+'a');
			return 0;
		};
	}
	cout<<"None";
	return 0;
}

Measured memory_bytes: 512
N, M = map(int, input().split())

if N & 1:
    for m in range(1, M+1):
        print(m, N-m)

    exit()

n1, n2 = N//2, N//2
cnt = 0
for n in range(N//2):
    if n+1 >= N//2-n:
        break
    print(n+1, N//2-n)
    cnt += 1
    if cnt == M:
        exit()

for n in range(N//2):
    if n+1 >= N//2-n-1:
        break
    print(n+1+N//2, N-n-1)
    cnt += 1
    if cnt == M:
        exit()


Measured memory_bytes: 9260
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000001;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  int tv = 0;
  int fv = INF;
  while (fv - tv > 1){
    int mid = (tv + fv) / 2;
    vector<int> b(N);
    for (int i = 0; i < N; i++){
      if (a[i] < mid){
        b[i] = 1;
      } else {
        b[i] = -1;
      }
    }
    vector<int> S(N + 1, 0);
    for (int i = 0; i < N; i++){
      S[i + 1] = S[i] + b[i];
    }
    vector<int> S2 = S;
    sort(S2.begin(), S2.end());
    S2.erase(unique(S2.begin(), S2.end()), S2.end());
    int cnt = S2.size();
    map<int, int> mp;
    for (int i = 0; i < cnt; i++){
      mp[S2[i]] = i;
    }
    for (int i = 0; i <= N; i++){
      S[i] = mp[S[i]];
    }
    vector<int> BIT(cnt + 1, 0);
    long long ans = 0;
    for (int i = 0; i <= N; i++){
      int j;
      j = S[i];
      while (j > 0){
        ans += BIT[j];
        j -= j & -j;
      }
      j = S[i] + 1;
      while (j <= cnt){
        BIT[j]++;
        j += j & -j;
      }
    }
    if (ans <= (long long) N * (N + 1) / 4){
      tv = mid;
    } else {
      fv = mid;
    }
  }
  cout << tv << endl;
}

Measured memory_bytes: 9868
#include<iostream>
#include<stdio.h>

int main(){
	int w,n,i,a,b,d,f,e[31];
	char c;

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

	for(i=1;i<=w;i++){
	e[i]=i;
	}
	for(i=0;i<n;i++){
		std::cin>>a>>c>>b;
		d=e[a];
		e[a]=e[b];
		e[b]=d;
	}

	for(i=1;i<=w;i++){
		std::cout<<e[i]<<std::endl;
	}
	return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

int main() {

// 普通に実装
// (i + j) % 3 = 0の色が0 ~ c

    int n, c;
    cin >> n >> c;


    vector<vector<int>> colors(n + 1, vector<int>(n + 1, 0));
    vector<vector<int>> iwakans(c, vector<int>(c, 0));

    rep(i, c) rep(j, c) {
            int d;
            cin >> d;
            iwakans[i][j] = d;
        }

    rep(x, n)rep(y, n) {
            int cc;
            cin >> cc;
            cc--;
            colors[x + 1][y + 1] = cc;
        }

    vector<vector<int>> ori(3, vector<int>(c, 0)); // %3=iのところにいるcolorの数
    for (int x = 1; x <= n; x++) {
        for (int y = 1; y <= n; y++) {
            int m = (x + y) % 3;
            int color = colors[x][y];
            ori[m][color]++;
        }
    }


    ll ans = INF;
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            if (i == j) continue;

            for (int k = 0; k < c; k++) {
                if (i == k || j == k) continue;

//                printf("%d %d %d\n", i, j, k);

                ll now = 0;

                for (int color = 0; color < c; color++) {
                    {
                        int masu_su = ori[0][color];
                        int cost = iwakans[color][i];
                        now += masu_su * cost;
                    }
                    {
                        int masu_su = ori[1][color];
                        int cost = iwakans[color][j];
                        now += masu_su * cost;
                    }
                    {
                        int masu_su = ori[2][color];
                        int cost = iwakans[color][k];
                        now += masu_su * cost;
                    }
                }

                mins(ans, now);
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();

        int N = sc.nextInt();
        String str = sc.nextToken();
        int len = str.length();
        String ans = "";

        String[] strArray = str.split("");
        String[] ansArray = new String[len];

        for (int i = 0; i < len; i++) {
            ansArray[i] = proceed(N, strArray[i]);
        }

        StringBuffer sb = new StringBuffer("");
        for (int i=0; i<len; i++) {
            sb.append(ansArray[i]);
        }
        ans = sb.toString();
        out.println(ans);
        out.flush();
    }

    public static String [] alps = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
    public static String proceed(int cnt, String x){

      for (int i=0; i<26; i++){
        if (x.equals(alps[i])){
            return alps[(i+cnt)%26];
        }



      }
      return null;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

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

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

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

        int[] nextIntArray(int N) {
            int a[] = new int[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextInt();
            }

            return a;
        }

        long[] nextLongArray(int N) {
            long a[] = new long[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextLong();
            }

            return a;
        }

        double[] nextDoubleArray(int N) {
            double a[] = new double[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextDouble();
            }

            return a;
        }

        String[] nextTokenArray(int N) {
            String a[] = new String[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextToken();
            }

            return a;
        }
    }
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define VFOR(x,begin,num) for(int x=(begin);x<((begin)+(num));x++)
#define INF__ ((long long)1 << 60)
vector<int> Fr[100010], Bl[100010];int group[100010];int grsize[100010];
void grouping(int gr, int mem);
int main(){
    int N, M, K;
    cin >> N >> M >> K;
    VFOR(i,0,M){
        int a, b; cin >> a >> b;
        Fr[a].push_back(b);
        Fr[b].push_back(a);
    }
    VFOR(i,0,K){
        int a, b; cin >> a >> b;
        Bl[a].push_back(b);
        Bl[b].push_back(a);
    }
    int gr = 1;
    VFOR(i,1,N){
        if(group[i]==0) {group[i]=gr;grsize[gr]++;grouping(gr,i);gr++;}
    }
    VFOR(i,1,N){
        int ans = grsize[group[i]] - 1;
        for(auto j : Bl[i]){
            if(group[i]==group[j]) ans--;
        }
        ans -= Fr[i].size();
        printf("%d ",ans);//cout << ans << " ";
    }
    cout << endl;
    //VFOR(i,1,N) cout << grouping[i] << " ";
    return 0;
}
void grouping(int gr, int mem){
    for(auto x : Fr[mem]){
        if(group[x]==0) {group[x] = gr;grsize[gr]++;grouping(gr,x);}
    }
}

Measured memory_bytes: 12672
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int ans = 0;
	int d;
	for(int i = 0; i < n; i++){
		scanf("%d",&d);
		if(d >= m)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;



 int main(){

 string s,finds;
 cin>>s;

 finds = "CODEFESTIVAL2016";

 if(finds == s)
    cout<<"0"<<endl;
 else{
         int cnt=0;


     if(s[0] != 'C' )
     cnt++;

     if(s[1] != 'O' )
     cnt++;

        if(s[2] != 'D' )
     cnt++;

    if(s[3] != 'E')
     cnt++;
   if(s[4] != 'F' )
     cnt++;
     if(s[5] != 'E')
     cnt++;
    if(s[6] != 'S')
     cnt++;
   if(s[7] != 'T')
     cnt++;

       if(s[8] != 'I')
     cnt++;

     if(s[9] != 'V')
     cnt++;

        if(s[10] != 'A' )
     cnt++;
    if(s[11] != 'L')
     cnt++;
     if(s[12] != '2' )
     cnt++;
     if(s[13] != '0')
     cnt++;
     if(s[14] != '1')
     cnt++;
   if(s[15] != '6')
     cnt++;


    cout<<cnt<<endl;
 }

  return 0;
 }





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vll flag, D; vll path;
//***********//
int main() {
    ll r, c;
    cin >> H >> W >> N >> r >> c;
    string s, t;
    cin >> s >> t;
    ans = 1;
    ll now = r;
    for (i = 0; i < N; i++) {
        if (s[i] == 'U') now--;
        if (now == 0) ans = 0;
        if (t[i] == 'D' && now < H) now++;
    }
    now = r;
    for (i = 0; i < N; i++) {
        if (s[i] == 'D') now++;
        if (now == H + 1) ans = 0;
        if (t[i] == 'U' && now > 1) now--;
    }
    now = c;
    for (i = 0; i < N; i++) {
        if (s[i] == 'L') now--;
        if (now == 0) ans = 0;
        if (t[i] == 'R' && now < W) now++;
    }
    now = c;
    for (i = 0; i < N; i++) {
        if (s[i] == 'R') now++;
        if (now == W + 1) ans = 0;
        if (t[i] == 'L' && now > 1) now--;
    }
    cout << (ans ? "YES" : "NO") << endl;

}

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

int memberNumberToIndex(int memberNumber)
{ return memberNumber - 1; }

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

	vector<int> bossNumbers(memberCount - 1);
	for (auto index = 0; index < memberCount - 1; ++index) {
		cin >> bossNumbers.at(index);
	}

	vector<int> subordinateCounts(memberCount);
	for (auto index = 0; index < memberCount - 1; ++index) {
		++(subordinateCounts.at(memberNumberToIndex(bossNumbers.at(index))));
	}

	for (auto count : subordinateCounts) {
		cout << count << " ";
	}

	return 0;
}


Measured memory_bytes: 4844