akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;
int a[11000];
int b[110][110];
int c[11000];
int temp=0;
int main()
{
    int h,w,n;
    cin>>h>>w>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<a[i];j++)
        {
            c[temp++]=i+1;
        }
    }
    int num=0;
    for(int i=1;i<=h;i++)
    {
        if(i%2==1)
        {
            for(int j=1;j<=w;j++)
            {
                b[i][j]=c[num++];
            }
        }
        else
        {
            for(int j=w;j>=1;j--)
            {
                b[i][j]=c[num++];
            }
        }
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j==1)
                cout<<b[i][j];
            else cout<<' '<<b[i][j];
        }
        cout<<endl;
    }
    return 0;
}


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

    int i,t,l;
    cin>>t;
    string a;
    cin>>a;
    l=a.size();
    if(t>=l){
                  cout<<a<<endl;
    return 0;
    }
    else{
    for(i=0;i<t;i++){

     cout<<a[i];
     }
   cout<<"..."<<endl;
    }

}




Measured memory_bytes: 3564
#include <string>
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(){
    string S;
    cin >> S;
    if(S.length()==2) cout << S << endl;
    else{
    std::reverse(S.begin(), S.end());
    cout << S << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    ll a,b;
    cin>>a>>b;
    for(int i=1;i<=3;i++){
	if( a != i && b!= i ){
	    cout<<i<<endl;
	    return 0;
	}
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mod 1000000007
#define pb emplace_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double  ld;
#define pii pair<ll,ll> 
#define vi vector< ll > 
#define vvi vector< vi > 
#define vpi vector< pii > 
#define vvpi vector< vpi > 
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define test(t) ll t;cin>>t;while(t--)
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
#define fr(i,n) for(ll i=0;i<(n);++i)
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#ifndef ONLINE_JUDGE
#define debarr(a,n)cerr<<#a<<":";for(int i=0;i<n;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S,class T>ostream &operator<<(ostream &os,const pair<S,T> &p){return os<<"("<<p.first<<","<<p.second<<")";}
template<class T>ostream &operator<<(ostream &os,const vector<T> &p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const set<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const multiset<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class S,class T>ostream &operator<<(ostream &os,const map<S,T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>void dbs(string str,T t){cerr<<str<<":"<<t<<"\n";}
template<class T,class...S>void dbs(string str,T t,S... s){int idx=str.find(',');cerr<<str.substr(0,idx)<<":"<<t<<",";dbs(str.substr(idx+1),s...);}
#else
#define pr(...){}
#define debarr(a,n){}
#define debmat(mat,row,col){}
#endif
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
signed main()
{
    fast;
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans = 0;
    for(ll i=2;i<n;i++)
    {
        if(s[i]=='C' and s[i-1]=='B' and s[i-2]=='A')
            ans++;
    }
    cout<<ans;
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int n, m, c[1009], s[1000009];
int main() {
	while (scanf("%d%d", &n, &m), n) {
		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
		sort(c, c + n);
		int b = 0;
		for (int i = 0; i <= n; i++) {
			for (int j = i; j <= n && c[i] + c[j] <= m; j++) {
				s[b++] = c[i] + c[j];
			}
		}
		sort(s, s + b);
		int r = b - 1, ret = 0;
		for (int i = 0; i < b && i <= r; i++) {
			while (r > 0 && s[i] + s[r] > m) r--;
			ret = max(ret, s[i] + s[r]);
		}
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 4564
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionF
    {
        /// <summary>
        /// B - Homework
        /// https://atcoder.jp/contests/abc163/tasks/abc163_b
        /// </summary>
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var num_NM = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();  //num_NM[0]：N 日数　num_NM[1]：M 宿題数

            // 整数配列の入力
            var num_A = Console.ReadLine().Split(' ').Select(i => int.Parse(i)); //.ToArray();  //各宿題にかかる日数

            int num_Sumday = num_A.Sum();

            int num_Remain = num_NM[0] - num_Sumday;

            if (num_Remain >=0)
            {
                Console.WriteLine(num_Remain);
            }
            else if (num_Remain < 0)
            {
                Console.WriteLine("-1");
            }

            Console.Out.Flush();
        }
    }
}


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

#define mod 1000000007
#define all(x) (x).begin(), (x).end()

const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main(){
    ll a, b;
    cin >> a >> b;
    string as, bs;
    as = to_string(a);
    bs = to_string(b);
    string s, t;
    for(int i = 0; i < b; i++) s += as;
    for(int i = 0; i < a; i++) t += bs;

    if(s <= t) cout << s << endl;
    else cout << t << endl; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>

#define ll long long
using namespace std;

int main()
{
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	vector<int> l(n);
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	static vector<int> m(n, 4);
	static vector<vector<int>> x;
	struct innerClass {
		static void saiki(int _d) {
			static int cnt = 0;
			static vector<int> ans(m.size());
			int d = _d - 1;
			for (int i = 0; i < m[d]; i++) {
				ans[d] = i;
				if (d < 1) {
					x.push_back(ans);
				}
				else {
					saiki(d);
				}
			}
			cnt++;
		}
	};

	innerClass::saiki(m.size());
	int pat = x.size();
	vector<int> cost(pat, -30);
	vector<int> al(pat, 0);
	vector<int> bl(pat, 0);
	vector<int> cl(pat, 0);
	
	for (int i = 0; i < pat; i++) {
		for (int j = 0; j < n; j++) {
			if (x[i][j] == 1) {
				al[i] += l[j];
				cost[i] += 10;
			}
			if (x[i][j] == 2) {
				bl[i] += l[j];
				cost[i] += 10;
			}
			if (x[i][j] == 3) {
				cl[i] += l[j];
				cost[i] += 10;
			}
		}
	}
	for (int i = 0; i < pat; i++) {
		if (al[i] != 0 && bl[i] != 0 && cl[i] != 0) {
			cost[i] += abs(al[i] - a);
			cost[i] += abs(bl[i] - b);
			cost[i] += abs(cl[i] - c);
		}
		else {
			cost[i] = 1e9;
		}
	}
	int min = *min_element(cost.begin(), cost.end());
	cout << min;

	return 0;
}

Measured memory_bytes: 5940
#include<bits/stdc++.h>
#define vi vector<int>
using namespace std;

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<vi> v(n, vector<int>(m + 1));
    for (int i = 0; i < n; i++) {
        cin >> v[i][0];
        for (int j = 1; j <= m; j++) {
            cin >> v[i][j];
        }
    }
    int ans = INT_MAX;
    for (int mask = 1; mask < (1<<n); mask++) {
        stack<int> pos;
        for (int i = 0; i < n; i++) {
            if (mask & (1<<i)) pos.push(i);
        }
        vi tmp_ans(m + 1);
        while (!pos.empty()) {
            int id = pos.top();
            pos.pop();
            for (int i = 0; i <= m; i++) {
                tmp_ans[i] += v[id][i];
            }
        }
        bool ok = true;
        for (int i = 1; i <= m; i++) {
            if (tmp_ans[i] < x) {
                ok = false;
                break;
            }
        }
        if (ok) ans = min(ans, tmp_ans[0]);
    }
    if (ans == INT_MAX) puts("-1");
    else cout << ans << "\n";
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;


ll xs, ys, xt, yt;
ll N;
double x[1100], y[1100], r[1100];

const int MAX_N = 2000010;
vector<pair<int, double> > G[MAX_N];
vector<double> dijkstra(int start){
	vector<double> dist(MAX_N, INFF);
	dist[start] = 0;//dist[i] :=　start->iまでの最短距離
	priority_queue<pair<double, int>, vector<pair<double, int> >, greater<pair<double, int> > >  que;
	que.push(make_pair(0, start));
	while(!que.empty()){
		double cost; int u;//今までにかかった時間 現在の頂点
		cost = que.top().first, u = que.top().second;
		que.pop();
		if(dist[u] < cost) continue;
		for (auto tmp : G[u]){
			int v = tmp.first; double time = tmp.second;//隣接する頂点 その頂点まで行く時間
			if(dist[v] > dist[u] + time){//u->v
				dist[v] = dist[u] + time;
				que.push(make_pair(dist[v], v));
			}
		}
	}
	return dist;
}


int main(void) {
	cin >> xs >> ys >> xt >> yt;
	cin >> N;
	x[0] = xs, y[0] = ys, x[N + 1] = xt, y[N + 1] = yt;
	reps(i, 1, N + 1) cin >> x[i] >> y[i] >> r[i];
	rep(i, N + 2)reps(j, i + 1, N + 2){
		double di = max((double)0, sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)) - (r[i] + r[j]));
		G[i].pb(mp(j, di)), G[j].pb(mp(i, di));
	}
	auto ret = dijkstra(0);
	printf("%.9f\n", ret[N + 1]);
	return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, m;
vector<int> v[100000];
int f[100000];

bool dfs(int node, int s) {
	if(f[node]) { return (f[node] == s); }
	
	f[node] = s;
	inc(i, v[node].size()) {
		if(! dfs(v[node][i], -s)) { return false; }
	}
	return true;
}

int main() {
	cin >> n >> m;
	inc(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		v[a].PB(b);
		v[b].PB(a);
	}
	
	LL ans = 0;
	if(dfs(0, +1)) {
		LL x = 0, y = 0;
		inc(i, n) { (f[i] == 1 ? x : y) += 1; }
		ans = x * y - m;
	} else {
		ans = n * (n - 1) / 2 - m;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 6528
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_str():
    return readline().strip()


def slv(N, X):
    C = X.count('1')
    cmr = 0
    cpr = 0
    for b in X:
        b = int(b)
        cpr = ((cpr * 2) + b) % (C+1)
        if C-1 != 0:
            cmr = ((cmr * 2) + b) % (C-1)

    ans = []
    for i in range(N):
        t = 1
        if X[i] == '0':
            x = (cpr + pow(2, N-i-1, C+1)) % (C+1)
        elif X[i] == '1' and C-1 != 0:
            x = (cmr - pow(2, N-i-1, C-1)) % (C-1)
        else:
            x = 0
            t = 0

        while x != 0:
            x %= bin(x).count('1')
            t += 1

        ans.append(t)

    return ans


def main():
    N = read_int()
    X = read_str()
    print(*slv(N, X), sep='\n')


if __name__ == '__main__':
    main()


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

int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    int xmin = r;
    int xmax = w - r;
    int ymin = r;
    int ymax = h - r;
    string result = "No";
    if (xmin <= x && x <= xmax && ymin <= y && y <= ymax)
        result = "Yes";
    cout << result << endl;
    return 0;
}



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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  int N;
  string s;
  cin>>N>>s;
  ll cntr(0),cntg(0),cntb(0);
  for(int i(0);i<N;i++){
    if(s[i] == 'R') cntr++;
    if(s[i] == 'G') cntg++;
    if(s[i] == 'B') cntb++;
  }
  ll ans = cntr*cntg*cntb;
  for(int i(0);i<N;i++){
    for(int j(i+1);j<N;j++){
      int sa = j - i;
      if(j+sa < N && s[j+sa] != s[i] && s[j+sa] != s[j] && s[i] != s[j]) ans--;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3584
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{
    ll x;
    cin >> x;

    int ans = (x / 500) * 1000;
    x %= 500;
    ans += (x / 5)*5;
   
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3604
from itertools import combinations, permutations, chain

N, C = map(int, input().split())
D = [[0] * (C + 1)]
for _ in range(C):
    a = [0]
    a.extend(list(map(int, input().split())))
    D.append(a)
c = [list(map(int, input().split())) for _ in range(N)]

# color[g][c] := グループgのうち、色cであるグリッドの数
color = [[0 for _ in range(C + 1)] for _ in range(3)]
for row in range(1, len(c) + 1):
    for col in range(1, len(c[row - 1]) + 1):
        g = (row + col) % 3
        color[g][c[row - 1][col - 1]] += 1


def count():
    for x, y, z in combinations(range(C), 3):
        for a, b, c in permutations([x + 1, y + 1, z + 1]):
            yield a, b, c


ans = float('inf')
for c1, c2, c3 in count():
    cost = 0
    for i in range(1, C + 1):
        cost += color[0][i] * D[i][c1]
    for i in range(1, C + 1):
        cost += color[1][i] * D[i][c2]
    for i in range(1, C + 1):
        cost += color[2][i] * D[i][c3]
    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 5620
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static long[] prime;
        static List<long> ans = new List<long>();
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            var sqrt = (int)Math.Ceiling(Math.Sqrt(N));

            var min = long.MaxValue;
            for (var i = 1; i <= sqrt; i++)
            {
                if (N % i == 0) min = Math.Min(min, i + N / i - 2);
            }

            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 11220
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val x = sc.nextInt()
    val m = (1..n).map { sc.nextInt() }
    val sum = m.sum()
    val min = m.min()!!
    println((x - sum) / min + n)
}

Measured memory_bytes: 31528
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,count=0;
	cin>>a>>b>>c;
	if(a!=b)
		count++;
	if(b!=c)
		count++;
	if(c!=a)
		count++;
	if(a==b && b==c)
		count++;
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

int inv(vi &a){
    int n=a.size();
    if(n<=1)return 0;
    vi b(a.begin(),a.begin()+n/2),c(a.begin()+n/2,a.end());
    int cnt=inv(b)+inv(c);
    int i=0,j=0,k=0;
    while(i<n){
        if(j<b.size()&&(k==c.size()||b[j]<c[k]))a[i++]=b[j++];
        else{
            cnt+=n/2-j;
            a[i++]=c[k++];
        }
    }
    return cnt;
}

void run(){
    int n;
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];
    cout<<inv(a)<<endl;
}



Measured memory_bytes: 7808
from collections import deque

n, m = list(map(int, input().split()))
paths = {}
for i in range(m):
    l, r, d = list(map(int, input().split()))
    if not l in paths.keys():
        paths[l] = [(r, d)]
    else:
        paths[l].append((r, d))
    if not r in paths.keys():
        paths[r] = [(l, -d)]
    else:
        paths[r].append((l, -d))
      
x = [None]*(n+1)
for i in range(1, n+1):
    if x[i] is None:
        x[i] = 0
        que = deque([i])
        while len(que) > 0:
            j = que.popleft()
            if not j in paths.keys():
                continue
            for k, d in paths[j]:
                if x[k] is None:
                    x[k] = x[j] + d
                    que.append(k)
                elif x[k] != x[j] + d:
                    print('No')
                    exit()
# print(x)
print('Yes')

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

roads=[[str(s) for s in input().split()] for m in range(M)]

ans={}

for m in range(M):
  for road in roads[m]:
    if road in ans:
      ans[road]+=1
    else:
      ans[road]=1

for n in range(N):
  if str(n+1) in ans:
    print(ans[str(n+1)])
  else:
    print(0)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int main() {
	int n, m; read(n), read(m);
	return printf("%d\n", (n-2)/(m-1)+1), 0;
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List

pow b n = takeWhile (<=n) $ map (b^) [2..]

main = do
    x <- readLn
    if x <= 3
        then print x
        else do
            let x_2 = truncate $ sqrt $ fromIntegral x
            print $ maximum $ concat [ pow b x | b <- [2..x_2]]


Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <vector>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (n); i++)

using namespace std;

typedef struct {
	int a, b, c, d;
}qs;

bool operator<(qs v1, qs v2){
	if (v1.a < v2.a) return true;
	if(v1.a == v2.a)
		if (v1.b < v2.b) return true;
	return false;
}

qs qq[60]; int q;
int solve(int i, int* a, int n, int m) {
	int maxscore = 0; 
	int score = 0;
	for (int j = 1; j < i; j++) {
		for (int qi = 0; qi < q; qi++) {
			if (qq[qi].a == j && qq[qi].b == i && a[i] - a[j] == qq[qi].c)
				score += qq[qi].d;
		}
	}
	if (i == n)return score;

	for (int a_i = a[i]; a_i <= m; a_i++) {
		a[i + 1] = a_i;
		maxscore = max(maxscore, solve(i + 1, a, n, m));
	}
	return maxscore + score;
}

int main()
{
	int n, m;
	cin >> n >> m >> q;
	REP(i, q)cin >> qq[i].a >> qq[i].b >> qq[i].c >> qq[i].d;
	int a[11] = {0, 1};
	cout << solve(1, a, n, m) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
 #define rep(i,a,b) for (int i=a;i<b;i++)
 #define rep2(i,a,b) for (int i=a;i>=b;i--)
 #define mod 1000000007
 #define INF  1e9+5
 #define f first
 #define se second
 #define endl '\n'
 #define ll long long
 #define ii pair <int,int>
 #define pll pair <ll,ll>
 #define vi vector <int>
 #define vl vector <ll>
 #define vvi vector < vi >
 #define vii vector < ii >
 #define vvii vector < vii >
 #define vll vector < ll >
 #define mi map<int,int>
 #define mll map<ll,ll>
 #define mci map<char,int>
 #define msi map<string,int>
 #define vb  vector <bool>
 #define pb push_back
 #define mk make_pair
 #define sz(a) a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define int long long int
 #define Anurag_Gupta ios_base::sync_with_stdio(false);
#define IIIT_ALLD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
vi fact(1000007);
inline int mdpower(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res%mod*a%mod)%mod;
        b/=2;
        a = (a%mod*a%mod)%mod;
    }
    return res;
}
inline int power(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res*a);
        b/=2;
        a = a*a;
    }
    return res;
}

inline void factorial()
{
    fact[0]=1;
    for(int i=1;i<1000007;i++)
        fact[i] = (fact[i-1]%mod*i%mod)%mod;
}

inline int inverse(int a)
{
    return mdpower(a,mod-2);
}

int  computeXOR(const int n) 
{ 
    // Modulus operator are expensive on most of the  
    // computers. n & 3 will be equivalent to n % 4.    
  
    switch(n & 3) // n % 4  
    { 
    case 0: return n;     // if n is multiple of 4 
    case 1: return 1;     // If n % 4 gives remainder 1   
    case 2: return n + 1; // If n % 4 gives remainder 2     
    case 3: return 0;     // If n % 4 gives remainder 3   
    } 
}
 signed main()
 {
     Anurag_Gupta
     IIIT_ALLD
     
   /*  #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
     #endif*/
     int a,b;
     cin>>a>>b;

     int x1  = computeXOR(b);
     int x2  = computeXOR(a-1);
     cout<<(x1^x2)<<"\n";



 }


Measured memory_bytes: 8064
using System;

public class Hello
{
    public static void Main()
    {
        var a = new int[5];
        for (int i = 0; i < 5; i++) a[i] =  int.Parse(Console.ReadLine().Trim());
        var k = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i <4; i++)
        {

            for (int j = i+ 1 ; j < 5; j++)
            {
                if (a[j] - a[i] > k) { Console.WriteLine(":("); goto next; }
            }
        }
        Console.WriteLine("Yay!");
        next:;
    }
}

Measured memory_bytes: 13140
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    X = map(int, readline().split())

    if len(set(X)) == 2:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61824
#include <iostream>
using namespace std;
char mp[21][21];
int alred[21][21];
int hai = 0;
void init(){
  for(int i = 0; 20 > i; i++){
    for(int j = 0; 20 > j; j++){
      mp[i][j] = ' ';
      alred[i][j] = 0;
    }
  }
  hai = 0;
}
int tansa(int w, int h, int sw, int sh,int ret){
  if(mp[sw][sh] == '.')ret++,alred[sw][sh] = 1;
  if(((sw+1)!=w) && (mp[sw+1][sh] == '.' && alred[sw+1][sh] == 0))ret+=tansa(w,h,sw+1,sh,0);
  if((sw!=0) &&(mp[sw-1][sh] == '.' && alred[sw-1][sh] == 0))ret+=tansa(w,h,sw-1,sh,0);
  if(((sh+1)!=h) && (mp[sw][sh+1] == '.' && alred[sw][sh+1] == 0))ret+=tansa(w,h,sw,sh+1,0);
  if((sh!=0) && (mp[sw][sh-1] == '.' && alred[sw][sh-1] == 0))ret+=tansa(w,h,sw,sh-1,0);
  return ret;
}
int main(){
  while(true){
    int w,h;cin>>w>>h;
    init();
    int sw,sh;
    if(w == 0)break;
    for(int i = 0; h > i; i++){
      for(int j = 0; w > j; j++){
        cin >> mp[i][j];
        if(mp[i][j] == '@'){
          sw = i;
          sh = j;
        }
      }
    }
    cout << tansa(h,w,sw,sh,0)+1 << endl;
  }
}


Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>
#include <map>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;


int main(){
int n;cin>>n;
vi a(n);
vi suu(100000);
ll ans=0;
rep(i,n){
    cin>>a.at(i);
    
        suu.at(a.at(i)-1)+=1;
        
    
    ans+=a.at(i);
}

/*rep(i,n){
    rep(j,100000){
        if(a.at(i)==j+1){
        suu.at(j)+=1;
        }
    }
    ans+=a.at(i);
}*/
//cout<<ans<<endl;

int q;cin>>q;

rep(i,q){
    int b,c;
    cin>>b>>c;
    int h=c-b;
    ans=ans+(suu.at(b-1)*h);
    
    suu.at(c-1)+=suu.at(b-1);
suu.at(b-1)=0;
    cout<<ans<<endl;

}


}

Measured memory_bytes: 4060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x  = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < m ; i++) {
            a[i] = sc.nextInt();
        }
        int l = 0;
        int r = 0;
        for (int i = 0 ; i < m ; i++) {
            if (a[i] < x) {
                l++;
            } else {
                r++;
            }
        }
        System.out.println(Math.min(l, r));
    }

}

Measured memory_bytes: 21844
import java.util.*;
public class Main{
public static void main(String[]args){
  Scanner sc=new Scanner(System.in);
  int h=sc.nextInt();
  int w=sc.nextInt();
  int po[][]=new int[h+2][w+2];
  for(int i=0;i<h;i++){
  String p=sc.next();
    String[]s=p.split("",0);
    for(int j=0;j<w;j++)po[i+1][j+1]=(s[j].equals("#"))?1:0;
  }
  int ans[][]=new int[h][w];
  for(int i=0;i<h;i++){
  for(int j=0;j<w;j++){
    System.out.print((po[i+1][j+1]==1)?"#":po[i][j]+po[i+1][j]+po[i+2][j]+po[i][j+1]+po[i+2][j+1]+po[i][j+2]+po[i+1][j+2]+po[i+2][j+2]);
  }
  System.out.println();
  }
}

}


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

long long n;
long long memo[] = {3, 5, 7};
long long ch[3] = {0};
long long solve(int x, long long now);

int main() {
  cin >> n;
  cout << solve(0, 0) << endl;
  return 0;
}

long long solve(int x, long long now) {
  long long ans = 0;
  if(ch[0] * ch[1] * ch[2] > 0 && now <= n) ++ans;
  if(x == 10) return 0;
  now *= 10;
  for(int i = 0; i < 3; ++i) {
    ++ch[i];
    ans += solve(x + 1, now + memo[i]);
    --ch[i];
  }
  return ans;
}

Measured memory_bytes: 256
//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    string S;
    ll Q;
    cin >> S;
    cin >> Q;
    string head = "";
    string tail = "";
    bool isInv = false;
    for (ll i = 0; i < Q; i++)
    {
        ll T;
        cin >> T;
        if (T == 1)
        {
            isInv = !isInv;
        }
        else
        {
            ll F;
            string C;
            cin >> F;
            cin >> C;
            if (F == 1)
            {
                if (isInv)
                {
                    tail = tail + C;
                }
                else
                {
                    head = C + head;
                }
            }
            else
            {
                if (isInv)
                {
                    head = C + head;
                }
                else
                {
                    tail = tail + C;
                }
            }
        }
    }

    if (isInv)
    {
        reverse(S.begin(), S.end());
        reverse(head.begin(), head.end());
        reverse(tail.begin(), tail.end());
        cout << tail + S + head << endl;
    }
    else
    {
        cout << head + S + tail << endl;
    }

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 1512
#include <iostream>

int main(){
    char S[3];
    for(int i=0;i<3;i++){
        std::cin>>S[i];
    }

    if(S[0]==S[1]&&S[1]==S[2]){
        std::cout<<"No";
    }else{
        std::cout<<"Yes";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define M 1000000007
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define f first
#define s second
#define b begin
#define e end
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define itfr(it,x) for(it=x.begin();it!=x.end();it++)
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int main()
{
    flash;
    //sieve();
    ll T=1,t,n,m,q,k,i,j;
    // cin>>T;
    while(T--)
    {
        cin>>n;
        cout<<n*(n+1)/2<<endl;
        
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    cout << s << "\n";
}


Measured memory_bytes: 3132
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int l;
	cin>>l;
	LL g[22][22],ex[22][22]={};
	queue<pair<pair<int,int>,int>> q;
	int c=0,mx=0,nowmax=1;
	LL t=l;
	FOR(i,1,23){
		t/=2;
		if(t!=0){
			c++;
			q.push(MP(MP(i,i+1),1<<(i-1)));
			q.push(MP(MP(i,i+1),0));
			mx=max(mx,i+1);
		}
	}
	FOR(i,1,mx){
		nowmax*=2;
	}
	int f=0,bfr=-1;
	FORD(i,25,0){
		if(l&(1<<i)){
			if(f==0){
				f=1;
				continue;
			}else if(f==1){
				f=2;
				q.push(MP(MP(i+1,mx),nowmax));
				nowmax+=1<<i;
				continue;
			}
			int d=i+1;
			q.push(MP(MP(i+1,mx),nowmax));
			nowmax+=1<<i;
		}
	}

	cout<<mx<<" "<<q.size()<<endl;
	while(q.size()){
		pair<pair<int,int>,int> tpl=q.front();
		q.pop();
		cout<<tpl.ST.ST<<" "<<tpl.ST.ND<<" "<<tpl.ND<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

using Pii = pair<int, int>;

constexpr int INF = 1000;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> d(n, m);
    {
        int dd;
        for(int i=0;i<m;++i){
            cin >> dd;
            --dd;
            d[dd] = i;
        }
    }

    int pre_graph[m][k];
    int room;
    for(int i=0;i<n;++i){
        for(int j=0;j<k;++j) {
            cin >> room;
            if(d[i] == m) continue;
            --room;
            pre_graph[d[i]][j] = d[room];
        }
    }

    vector<int> graph[1<<m];
    for(int i=1;i<(1<<m);++i) {
        for(int path_i=0;path_i<k;++path_i) {
            int next_state = 0;
            for(int j=0;j<m;++j) {
                if(!(i & (1<<j))) continue;
                if(pre_graph[j][path_i] != m) next_state |= (1 << pre_graph[j][path_i]);
            }
            graph[i].push_back(next_state);
        }
    }

    vector<int> dists(1<<m, INF);
    dists[(1<<m)-1] = 0;
    priority_queue<Pii, vector<Pii>, greater<Pii>> que;
    que.emplace(0, (1<<m)-1);
    int current_state, current_dist;
    while(!que.empty()) {
        tie(current_dist, current_state)= que.top(); que.pop();
        if(dists[current_state] < current_dist) continue;
        for(int next_state: graph[current_state]) {
            if(dists[next_state] > current_dist + 1) {
                dists[next_state] = current_dist + 1;
                que.emplace(current_dist + 1, next_state);
            }
        }
    }
    

    cout << dists[0] << endl;
}


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

ll mod = 1000000007;

ll a[105];
ll dp[105][100005];
ll prdp[105][100005];

int main()
{
    int n, K;
    cin >> n >> K;
    for (int i = 1; i <= n; i++)
        cin >> a[i];

    for (int i = 0; i <= n; i++)
    {
        dp[i][0] = 1;
        prdp[i][0] = dp[i][0];
        for (int k = 1; k <= K; k++)
        {
            if (i == 0)
            {
                prdp[i][k] = prdp[i][k-1];
                continue;
            }
            int l = max(0, k - (int)a[i]);
            dp[i][k] = prdp[i-1][k] - (l > 0 ? prdp[i-1][l-1] : 0);
            dp[i][k] += mod;
            dp[i][k] %= mod;
            prdp[i][k] = prdp[i][k-1] + dp[i][k];
            prdp[i][k] %= mod;
        }
    }

    cout << dp[n][K];
    return 0;
}


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

int compare(const void *a,const void *b)
{
  return *(int*)b-*(int*)a;
} 
  
int main()
{
  int x , a;
  int y , b;
  int c;
  
  scanf("%d %d %d %d %d",&x,&y,&a,&b,&c);
  
  int p[a];
  int q[b];
  int r[c];
  
  int i;
  
  for(i=0;i<a;i++)
  {
    scanf("%d",&p[i]);
  }
   for(i=0;i<b;i++)
  {
    scanf("%d",&q[i]);
  }
   for(i=0;i<c;i++)
  {
    scanf("%d",&r[i]);
  }
  
  qsort(p,sizeof(p)/sizeof(p[0]),sizeof(int),compare);
  qsort(q,sizeof(q)/sizeof(q[0]),sizeof(int),compare);
  
  int d[x+y+c];
  int j=0;
  
  for(i=0;i<x;i++)
  {
    d[i]=p[i];
  }
  for(i=x;i<x+y;i++)
  {
    d[i]=q[j];
    j++;
  }
  j=0;
  for(i=x+y;i<x+y+c;i++)
  {
    d[i]=r[j];
    j++;
  }
  
  qsort(d,sizeof(d)/sizeof(d[0]),sizeof(int),compare);
  
  long long ans=0;
  for(i=0;i<x+y;i++)
  {
    ans+=d[i];
  }
  
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 3956
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let s = read_line();
    let s = s.trim().as_bytes();
    let k:u64 = read_line().trim().parse().unwrap();

    let mut ans:usize  = 0;

    while (ans as u64) < k && ans < s.len() && (s[ans] == '0' as u8 || s[ans] == '1' as u8) {
        ans += 1;
    }
    
    if (ans as u64) >= k || ans >= s.len() {
        ans -= 1;
    }
    
    println!("{}", s[ans] as char);
}


Measured memory_bytes: 4352
#include <stdio.h>
#define nil -1
#define INF 100000
#define WHITE 0
#define BLACK 2
#define GRAY 1

int prim(int ,int[101][101]);

int main (){

  int i,j,k,n,T,mincost,weight;
  int A[101][101];
  int B[101];
  

  scanf("%d",&n);

  for(i=0;i<=101;++i) B[i] = nil;

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

  weight = prim(n,A);
  
  printf("%d\n",weight);

  return 0;
}

int prim (int n,int A[101][101]){
  int u,i,minv,sum =0;
  int d[101],p[101],color[101];

  for(i=0;i<=n;++i){
    d[i] = INF;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[1] = 0;
  
  while(1){
    minv = INF;
    u = nil;

    for(i=1;i<=n;++i){
      if(minv > d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }

    if(u == nil)break;

    color[u] = BLACK;

    for(i=1;i<=n;++i){
      if(color[i] != BLACK && A[u][i] != INF){
	if(d[i] > A[u][i]){
	  d[i] = A[u][i];
	  p[i] = u;
	  color[i] = GRAY;
	}
      }
    }
  }

  for(i=1;i<=n;++i){
    if(p[i] != nil) sum += A[i][p[i]];
  }

  return sum;
}



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

int main(){
   ll n,a,b;
   cin>>n>>a>>b;
   if(a+b>=n) cout<<min(a,n);
   else cout<<(n/(a+b))*a+min(a,n%(a+b));
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){

	int sosuu[1000000],kazu,n,i,j;

	while(scanf("%d",&n)!=EOF){

		kazu=n-1;

		for(i=2;i<=n;i++){
			sosuu[i]=1;
		}
		sosuu[0]=0;sosuu[1]=0;

		for(i=2;i<=n;i++){
			if(sosuu[i]==1){
				for(j=i*2;j<=n;j+=i){
					if(sosuu[j]==1){
						kazu--;
						sosuu[j]=0;
					}
				}
			}
		}

		printf("%d\n",kazu);
		
	}

	return 0;
}

Measured memory_bytes: 4932
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    double T = sc.nextDouble();
    int A = sc.nextInt();
    int ans = 0;//平均気温がA度に最も近い地点
    double min = Double.MAX_VALUE;// ↑の値

    for (int i = 0; i < N; i++) {
      double tmp = T - sc.nextDouble() * 0.006;
      double t = Math.abs(A - tmp);
      if(t < min) {
        ans = i+1;
        min = t;
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 29484
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	x := []string{"KIHBR", "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA",
		"AKIHABR", "AKIHBAR", "AKIHBRA", "KIHABAR", "KIHABRA", "KIHBARA",
		"AKIHABAR", "AKIHABRA", "AKIHBARA", "KIHABARA", "AKIHABARA"}
	ans := "NO"
	for _, v := range x {
		if s == v {
			ans = "YES"
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1772
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
  
int main(){
 int A,B;
 cin>>A>>B;
 if(A<9&&B<9){
     cout<<"Yay!"<<endl;
 }
 else{
     cout<<":("<<endl;
 }
}

Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const inputs = input.trim().split('\n');
const n = Number(inputs.shift());
const adj = inputs.map((s) => s.split(' ').map(Number));

class Node {
  constructor(id) {
    this.id = id;
    this.parentId = -1;
    this.children = [];
  }
  add(node) {
    node.parentId = this.id;
    this.children.push(node);
  }
  isRoot() {
    return this.parentId === -1;
  }
  getType() {
    return this.isRoot() ? 'root' : this.children.length ? 'internal node' : 'leaf';
  }
  calc(depth) {
    this.depth = depth++;
    this.children.forEach(child => child.calc(depth));
  }
  toString() {
    return 'node ' + this.id + ': ' + [
      'parent = ' + this.parentId,
      'depth = ' + this.depth,
      this.getType(),
      '[' + this.children.map(child => child.id).join(', ') + ']',
    ].join(', ');
  }
}

class Tree {
  constructor() {
    this.map = new Map();
  }
  getNode(id) {
    this.map.has(id) || this.map.set(id, new Node(id));
    return this.map.get(id);
  }
  getRoot() {
    for (let i = 0; i < this.map.size; i++) {
      const node = this.map.get(i);
      if (node.isRoot()) {
        return node;
      }
    }
  }
  calc() {
    const root = this.getRoot();
    root.calc(0);
  }
  print() {
    for (let i = 0; i < this.map.size; i++) {
      const node = this.map.get(i);
      console.log(node.toString());
    }
  }
}

const tree = new Tree();
adj.forEach(([u, k, ...vk]) => {
  const parent = tree.getNode(u);
  vk.forEach(v => {
    const node = tree.getNode(v);
    parent.add(node);
  });
});

tree.calc();
tree.print();



Measured memory_bytes: 111572
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << endl;
using LL=long long;
using VI=vector<int>;
using VL=vector<long long>;
using VS=vector<string>;
using VVI=vector<vector<int>>;
using PII=pair<int, int>;
const int inf = (int)1e9;
const LL mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(T & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(T& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(T& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(T& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>auto Max(T a) { return *max_element(a.begin(), a.end()); }
template <class T>auto Min(T a) { return *min_element(a.begin(), a.end()); }
template <class T, class U>int Count(T a, U c) { return count(a.begin(), a.end(), c); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define IN(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); for(auto &i : name)cin>>i;
#define VIn(T,name,n) vector<T> name(n); for(auto &i : name)cin>>i;
#define VIn2(T,name,name2,n) vector<T> name(n),name2(n); rep(i,n)cin>>name[i]>>name2[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void Yay(bool f) { puts(f ? "Yay!" : ":("); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	Vin(int, a, n);
	out(Max(a) - Min(a));
}

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

long long int rs(int n,vector<long long int> v){
  long long int a;
  if(n == 0){
    a=2;
  }
  else if(n==1){
    a=1;
  }
  else{
    a=v.at(n-1)+v.at(n-2);
  }
  
  return a;
}

main(){
  int N;
  cin>>N;
  vector<long long int> vec(87);
  for(int i=0;i<87;i++){
    vec.at(i)=rs(i,vec);
  }
  cout<<vec.at(N)<<endl;
}

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

typedef long long ll;

int main(){
   ll K;
   std::cin >> K;
   
   ll x, y;
   std::queue<ll> que;
   for(int i=1; i<=9; ++i) que.push(i);
   for(int i=0; i<K-1; ++i){
      x = que.front();
      que.pop();
      
      y = x % 10;
      if(y != 0) que.push(10*x + y - 1);
      que.push(10*x + y);
      if(y != 9) que.push(10*x + y + 1);
   }
   std::cout << que.front() << std::endl;
   return 0;
}


Measured memory_bytes: 5152
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AProgrammingEducation {
public:
	void solve(istream& in, ostream& out) {
        int n; in >> n;
        if(n == 1) out << "Hello World" << endl;
        else{
            int a,b; in >> a >> b;
            out << a + b << endl;

        }
	}
};

int main() {
	AProgrammingEducation solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
  int n;
  cin >> n;
 
  int a[4][13];

  for(int i = 0; i < 4; i++)
  { 
    for(int j = 0; j < 13; j++)
    {
      a[i][j] = 0;
    }
  }

  for(int i = 0; i < n; i++)
  {
    char ch;
    int x, y;
    cin >> ch >> y;
    switch(ch)
    {
      case 'S':
        x = 0;
      break;
 
      case 'H':
        x = 1;
      break;
 
      case 'C':
        x = 2;
      break;
 
      case 'D':
        x = 3;
      break;
    }    
    a[x][y-1] = 1;
  }

  for(int i = 0; i < 4; i++)
  { 
    for(int j = 0; j < 13; j++)
    {
      if(a[i][j] == 0)
      {
        switch(i)
        {
          case 0:
            cout << "S";
          break;
 
          case 1:
            cout << "H";
          break;
 
          case 2:
            cout << "C";
          break;
 
          case 3:
            cout << "D";
          break;
        }
        cout << " " << j+1 << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3044