akhauriyash/Code-Regression huggingface dataset:
def solve():
    def bfs(k):
        start, goal = file_input.readline().split()
        
        if start == goal:
            return 0
        
        start = map(int, start)
        goal = map(int, goal)
        diff = [(g - s) % 10 for g, s in zip(goal, start)]
        
        q = [diff]
        checked = {tuple(diff): True}
        ans = 0
        
        while q:
            ans += 1
            t_q = []
            for d in q:
                for i, r in enumerate(d):
                    if r != 0:
                        break
                for j in range(i, k):
                    d[j] -= r
                    d[j] %= 10
                    key = tuple(d)
                    if key in checked:
                        continue
                    if sum(d) == 0:
                        return ans
                    checked[key] = True
                    t_q.append(d[:])
                q = t_q

    from sys import stdin
    file_input = stdin
    
    while True:
        k = int(file_input.readline())
        if k == 0:
            break
        print(bfs(k))

solve()


Measured memory_bytes: 7140
import sys
a = 'abcdefghijklmnopqrstuvwxyz'

for s in sys.stdin:
    for n in range(1, 27):
        t = s[:-1].translate(str.maketrans(a, a[n:] + a[:n]))
        if 'the' in t or 'this' in t or 'that' in t: break
    print(t)

Measured memory_bytes: 6724
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

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

    int tap=1;
    int count=0;
    while(true){
        if (tap>=b){
            break;
        }
        else {
            tap += (a-1);
            count ++;
        }
    }
    // cout << tap<<endl;
    cout << count;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int H, W;

int bfs(int x, int y, vector<vector<char>> maze) {
  queue<Pi> que;
  vector<vi> dist(H, vi(W, -1));

  int w[4] = {1, 0, 0, -1};
  int h[4] = {0, 1, -1, 0};

  que.emplace(make_pair(x, y));
  dist.at(x).at(y) = 0;

  while (!que.empty()) {
    Pi now = que.front();
    que.pop();

    REP(i, 4) {
      int nh = now.first + h[i];
      int nw = now.second + w[i];
      if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
      if (maze.at(nh).at(nw) == '#') continue;
      if (dist.at(nh).at(nw) != -1) continue;
      dist.at(nh).at(nw) = dist.at(now.first).at(now.second) + 1;
      que.emplace(make_pair(nh, nw));
    }
  }

  int max_dist = -1;
  REP(i, H) {
    REP(j, W) {
      if (dist.at(i).at(j) > max_dist) {
        max_dist = dist.at(i).at(j);
      }
    }
  }

  /*
for (auto p : dist1) {
  for (auto q : p) cout << q << " ";
  cout << "\n";
}
*/

  return max_dist;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"

  cin >> H >> W;
  vector<vector<char>> maze(H, vector<char>(W, '.'));
  REP(i, H) REP(j, W) cin >> maze.at(i).at(j);

  int max_dist = -1;

  REP(i, H) {
    REP(j, W) {
      if (maze.at(i).at(j) == '#') continue;
      if (max_dist < bfs(i, j, maze)) max_dist = bfs(i, j, maze);
    }
  }

  cout << max_dist << endl;
}


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

#define MAX 500000
#define INF 2000000000

int L[MAX/2 + 2], R[MAX/2 + 2];
int count;

void merge(int A[], int n, int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++) L[i] = A[left + i];
    for(int i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = INF;
    int i = 0, j = 0;
    for(int k = left; k < right; k++){
        count++;
        if(L[i] <= R[j]){
            A[k] = L[i++];
        }else{
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int n, int left, int right){
    if(left + 1 < right){
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main(){
    int A[MAX], n;
    count = 0;
    
    cin >> n;
    for(int i = 0; i < n; i++) cin >> A[i];

    mergeSort(A, n, 0, n);

    for(int i = 0; i < n; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 6916
#include<stdio.h>

#include<string.h>

#include<math.h>

long calc(char*exp){
 long tmp=0,ret=0;
 for(int i=0;i<strlen(exp);i++){
  if(exp[i]!='+'){
   tmp*=10;tmp+=exp[i]-'0';
   }
  else{
   ret+=tmp;tmp=0;
   }
 }
return ret+tmp;
}

int main(){
 char s[11]={};
 scanf("%s",s);
 int len=strlen(s);
 long ans=0;
 char dst[24]={};
 for(int i=0;i<powl(2,len-1);i++){
  int k=0;
  for(int t=0;t<len;t++,k++){
   if(i&(1<<(t-1)))
    dst[k++]='+';
   dst[k]=s[t];
  }
  dst[k]='\0';
  ans+=calc(dst);
 }
 printf("%ld\n",ans);

return 0;}

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


int main() {
	long long dp[4001] = {};
	for(int n = 0; n <= 1000; n++) dp[n] = 1;
	for(int k = 1; k < 4; k++) {
		for(int n = 4000; n > 0; n--) {
			for(int i = 1; i <= 1000; i++) {
				if (n-i >= 0) dp[n] += dp[n-i];
			}
		}
	}
	int n;
	while(cin >> n) {
		cout << dp[n] << endl;
	}
}

Measured memory_bytes: 1196
// https://atcoder.jp/contests/abc123/tasks/abc123_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<int> A(X), B(Y), C(Z);
    for (auto &x : A)
        cin >> x;
    for (auto &x : B)
        cin >> x;
    for (auto &x : C)
        cin >> x;
    sort(ALLR(A));
    sort(ALLR(B));
    sort(ALLR(C));
    vector<int> ans;
    REP(a, X) {
        REP(b, Y) {
            if ((a + 1) * (b + 1) > K) {
                break;
            }
            REP(c, Z) {
                if ((a + 1) * (b + 1) * (c + 1) > K) {
                    break;
                }
                ans.emplace_back(A[a] + B[b] + C[c]);
            }
        }
    }
    sort(ALLR(ans));
    REP(i, K) { cout << ans[i] << "\n"; }

    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
ll const mod = 1e9+7;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<vector<int>> dp(n,vector<int>(n,0));
    dp[0][0] = 1;
    for (int i = 0;i < n-1;++i) {
        if (s[i] == '<') {
            ll sum = dp[i][0];
            for (int j = 1;j < i+2;++j) {
                dp[i+1][j] = sum;
                (sum += dp[i][j]) %= mod;
            }
        } else {
            ll sum = 0;
            for (int j = i;j >= 0;--j) {
                (sum += dp[i][j]) %= mod;
                dp[i+1][j] = sum;
            }
        }
    }
    int ans = 0;
    for (int i = 0;i < n;++i) (ans += dp[n-1][i]) %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
int N,M,P;
typedef vector<int> vec;
int cnt = 0;
char S[200];
map<string,vec> mp;
map<string,string> mmp;
map<vec,string> vp;
void init(){
  cnt = 0;
  mp.clear(); mmp.clear(); vp.clear();
}
 
bool asset(char c){
  if( S[cnt] == c ) {
    cnt++; return true;
  }
  return false;
}
 
vec variable();
vec factor();
vec term();
vec formula();
vec operator*( const vec& a, const vec& b ) {
  if( a.empty() || b.empty() ) return vec();
  vec x = vec( N );
  for(int i=0;i<N;i++) x[i] = a[i] + b[i];
  return x;
}
vec operator/(const vec& a, const vec& b) {
  if( a.empty() || b.empty() ) return vec();
  vec x = vec( N );
  for(int i=0;i<N;i++) x[i] = a[i] - b[i];
  return x;
}
bool check( const vec &a, const vec &b ){
  if( a.empty() || b.empty() ) return false;
  for(int i=0;i<N;i++)
    if( a[i] != b[i] ) return false;
  return true;
}
vec variable(){
  string s = "";
  while( ( 'a' <= S[cnt] && S[cnt] <= 'z' ) ||
         ( 'A' <= S[cnt] && S[cnt] <= 'Z' ) ){
    s += S[cnt];
    asset( S[cnt] );
  }
  return mp[ mmp[s] ];  
}
vec factor(){
  if( asset( '(' ) ){
    vec v = formula();
    asset(')');
    return v;
  } else
    return variable();
}
vec term(){
  vec v = factor();
  while( true ){
    if( asset( '*' ) ){
      vec nv = factor();
      v = v * nv;
    } else if( asset( '/' ) ){
      vec nv = factor();
      v = v / nv;
    } else
      break;
  }
  return v;
}
vec formula(){
  vec v = term();
  while( true ){
    if( asset( '+' ) ) {}
    else if( asset( '-' ) ){}
    else break;
    vec nv = term();
    if( !check( v, nv ) ) return vec();
  }
  return v;
}
 
int main(){
  while( cin >> N >> M >> P && (N|M|P) ){
    init();
    for(int i=0;i<M;i++){
      string a;
      cin >> a;
      vec v = vec( N );
      for(int j=0;j<N;j++){
        int d; cin >> d;
        v[j] = d;
      }
      mp[a] = v;
      vp[v] = a;
    }
    cin >> S;
    for(int i=0;i<P;i++){
      string a,b; cin >> a >> b;
      mmp[a] = b;
    }
    vec v = formula();
 
 
    if( v.empty() ){
      cout << "error" << endl;
    } else if( vp.count( v ) ){
      cout << vp[v] << endl;
    } else {
      cout << "undefined" << endl;
    }
  }  
}

Measured memory_bytes: 3180
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")
rgb = r*g*b

for i in range(n):
  for j in range(i+1, n-1):
    k = 2*j-i
    
    if k >= n or s[i] == s[j] or s[j] == s[k] or s[i] == s[k]:
      continue
      
    rgb -= 1
    
print(rgb)

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

int main(){
  int n; string s; cin>>n>>s;

  int ans=1; char t=s[0];
  for(int i=1; i<n; ++i){
    if(t!=s[i]){t=s[i]; ++ans;}
  }
  cout<<ans<<endl;
}


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

string s1, s2;
int dp[3001][3001];
vector<int> ind;
  
int lcs(int l1, int l2) 
{ 
	if(l1 == s1.size()||l2 == s2.size())
		dp[l1][l2] = 0;

	if(dp[l1][l2] != -1)
		return dp[l1][l2];

	if(s1[l1] == s2[l2])
		dp[l1][l2] = 1 + lcs(l1+1, l2+1);

	else
		dp[l1][l2] = max(lcs(l1+1, l2),lcs(l1, l2+1));

	return dp[l1][l2];
} 

void print_lcs(int l1, int l2)
{
	if(l1 == s1.size()||l2 == s2.size())
		return;

	if(s1[l1] == s2[l2])
	{
		cout << s1[l1];
		print_lcs(l1+1, l2+1);
	}

	else
		(dp[l1+1][l2] > dp[l1][l2+1])?print_lcs(l1+1, l2):print_lcs(l1, l2+1);
}

int main()
{
	cin >> s1;
	cin >> s2;

	for(int i = 0; i < 3001; i++)
		for(int j = 0; j < 3001; j++)
			dp[i][j] = -1;

	lcs(0, 0);
	print_lcs(0, 0);
	cout << endl;
	return 0;
}

Measured memory_bytes: 35712
data = list(map(int, input().split()))
n, yen = data[0], data[1]

diff = yen/1000 - n
for i in range(int(diff/9)+1):
    if i > n:
        break
    for j in range(int(diff/4)+1):
        if i + j > n:
            break
        if i*9+j*4 == diff:
            print(i, j, n-i-j)
            quit()
print("-1 -1 -1")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(){
	int S,h,m,s;
	cin >> S;
	if( S<0 || S>86400 ){
		cout << "error." << endl;
	}
	h=S/(60*60);
	m=(S-(h*60*60))/60;
	s=S-(h*60*60)-(m*60);
	cout <<h<<':'<<m<<':'<<s << endl;
	return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
double rui[55];
int N;
double v[55];
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> v[i];
	}
	rui[0]=1.0;
	for(int i=0;i<N;i++){
		rui[i+1] = rui[i]*0.5;
	}
	sort(v,v+N);
	double ans = 0.0;
	for(int i=0;i<N;i++){
		ans += v[i]*rui[min(N-i,N-1)];
	}
	printf("%.12f\n",ans);
	return 0;
}


Measured memory_bytes: 256
# 37
N,K,Q = map(int,input().split())
n = [ 0 for i in range(N)]
for i in range(Q):
    A = int(input()) -1
    n[A] += 1
    
k = K-Q

for i in range(N):
    n[i] = k + n[i]
    
for i in n:
    if i <= 0:
        print("No")
    else:
        print("Yes")
    
    

Measured memory_bytes: 12920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
int n, m;
int par[100010];
int r(int x){ return (x==par[x])?x:(par[x]=r(par[x])); }
priority_queue<int> pq[100010];
bool join(int a, int b){
	a=r(a); b=r(b);
	if(a==b) return 0;
	par[a]=b;
	if(pq[a].size()>pq[b].size()) swap(pq[a], pq[b]);
	while(pq[a].size()){
		pq[b].push(pq[a].top()); pq[a].pop();
	}
	return 1;
}
int pc[100010];
inline void dame(){ puts("Impossible"); exit(0); }
int main()
{
	read(n, m);
	for(int i=0; i<n; ++i){
		par[i]=i;
		int x; read(x);
		pq[i].push(-x);
	}
	for(int i=1; i<=m; ++i){
		int a, b; read(a, b); join(a, b);
	}
	priority_queue<pp> qb;
	int ones = 0;
	int bigs = 0;
	ll ans = 0;
	for(int i=0; i<n; ++i) if(par[i] == i){
		int s = pq[i].size();
		if(s > 1){
			ans += pq[i].top(); pq[i].pop(); ++pc[i];
			if(pq[i].size()){
				qb.emplace(pq[i].top(), i);
			}
			++bigs;
		} else {
			assert(s == 1);
			ans += pq[i].top(); pq[i].pop(); ++pc[i];
			++ones;
		}
	}
	
	if(ones + bigs == 1){ puts("0"); return 0; }
	
	if(bigs == 0){
		if(ones > 2) dame();
		printf("%lld\n", -ans);
		return 0;
	}
	
	if(ones > (n-ones-2*(bigs-1))) dame();

	for(int i=0; i<bigs-2+ones; ++i){
		if(qb.empty()) dame();
		int a = qb.top().second; qb.pop();
		ans += pq[a].top(); pq[a].pop();
		++pc[a];
		if(pq[a].size()){
			qb.emplace(pq[a].top(), a);
		}
	}
	printf("%lld\n", -ans);
	return 0;
}


Measured memory_bytes: 8188
S = input()
T = input()

R={}
R_={}

for a in zip(S,T):
  if a[0] not in R:
    R[a[0]]=a[1]
  else:
    if R[a[0]]!=a[1]:
      print('No')
      break
      
  if a[1] not in R_:
    R_[a[1]]=a[0]
  else:
    if R_[a[1]]!=a[0]:
      print('No')
      break
      
else:
  print('Yes')

Measured memory_bytes: 3632
using System;

namespace ALDS1_2_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            int[] input = new int[num];

            for (int i=0; i<num; i++)
            {
                input[i] = int.Parse(Console.ReadLine());
            }

            shellsort(input, num);
            output_result(input);

        }

        static void shellsort(int[] a, int n)
        {
            int cnt = 0;
            int m = 0;
            int h = 0;

            for (int h_tmp=0; h_tmp < n; h_tmp = h_tmp * 3 + 1)
            {
                h = h_tmp;
                m++;
            }
            output_m(m);

            int[] g = new int[m];
            int m_tmp = 0;
            for (int h_tmp=h; h_tmp>0; h_tmp /= 3)
            {
                g[m_tmp] = h_tmp;
                m_tmp++;
            }
            output_h(g);


            for (int i=0; i<m; i++)
            {
                cnt += insertionsort(a, n, g[i]);
            }

            output_cnt(cnt);

        }

        static int insertionsort(int[] a, int n, int g)
        {
            int count = 0;
            int tmp = 0;
            for (int i = g; i < n; i++)
            {
                int value = a[i];
                int j = i - g;

                while (j >= 0 && a[j] > value)
                {
                    tmp = a[j + g];
                    a[j + g] = a[j];
                    a[j] = tmp;
                    j = j - g;
                    count++;
                }
            }
            return count;
        }

        static void output_m(int m)
        {
            Console.WriteLine(m);
        }

        static void output_h(int[] g)
        {
            for (int i=0; i<g.Length; i++)
            {
                if (i != g.Length-1)
                {
                    Console.Write("{0} ", g[i]);
                }
                else
                {
                    Console.Write(g[i]);
                    Console.WriteLine();
                }
            }
        }

        static void output_cnt(int cnt)
        {
            Console.WriteLine(cnt);
        }

        static void output_result(int[] result)
        {
            for (int i=0; i<result.Length; i++)
            {
                Console.WriteLine(result[i]);
            }
        }
    }
}

Measured memory_bytes: 16592
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int p[200010];
    rep(i, N) cin >> p[i];
    int sum = 0;
    int cnt = 0;
    int ans = 0;
    rep(i, N) {
        sum += p[i];
        cnt++;
        if (cnt == K) {
            ans = max(sum, ans);
            //cout << sum / 2.0 << endl;
            cnt--;
            sum -= p[i - K + 1];
        }
    }
    cout << fixed << setprecision(12) << (ans + K) / 2.0 << endl;

    return 0;
}


Measured memory_bytes: 1792
import sys
import heapq

class Dijkstra(object):
  # def dijkstra(self, adj, start, goal=None):
  def dijkstra(self, num, path, start, goal=None):
    # num = len(adj)
    dist = [sys.maxint] * num
    prev = [sys.maxint] * num
    dist[start] = 0
    q = []
    heapq.heappush(q, (0, start))

    while len(q) != 0:
      prov_cost, src = heapq.heappop(q)
      if dist[src] < prov_cost: continue
      if src not in path: continue
      for dest,cost in path[src]:
        if dist[dest] > dist[src] + cost:
          dist[dest] = dist[src] + cost
          heapq.heappush(q, (dist[dest], dest))
          prev[dest] = src
      # for dest in range(num):
      #   cost = adj[src][dest]
      #   if cost != sys.maxint and dist[dest] > dist[src] + cost:
      #     dist[dest] = dist[src] + cost
      #     heapq.heappush(q, (dist[dest], dest))
      #     prev[dest] = src
    if goal is not None:
      return self.get_path(goal, prev)
    else:
      return dist

  def get_path(self, goal, prev):
    path = [goal]
    dest = goal
    while prev[dest] != sys.maxint:
      path.append(prev[dest])
      dest = prev[dest]
    return list(reversed(path))

while True:
  N,M,L,K,A,H=map(int,raw_input().split())
  if N==0: break
  # t(n,t) : minimum cost to remain t times and reach town n
  Ls=map(int,raw_input().split())
  # edge=[[sys.maxint]*(N*(M+1)) for _ in xrange(N*(M+1))]
  edge={}
  for l in Ls:
    for i in xrange(M):
      edge[l*(M+1)+i]=[(l*(M+1)+i+1,1)]
  for _ in xrange(K):
    s,g,c=map(int,raw_input().split())
    for i in xrange(c,M+1):
      if s*(M+1)+i not in edge: edge[s*(M+1)+i]=[]
      if g*(M+1)+i not in edge: edge[g*(M+1)+i]=[]
      edge[s*(M+1)+i].append((g*(M+1)+i-c,c))
      edge[g*(M+1)+i].append((s*(M+1)+i-c,c))
  cost=Dijkstra().dijkstra(N*(M+1), edge, A*(M+1)+M)
  minCost=sys.maxint
  for i in xrange(M+1):
    minCost=min(minCost,cost[H*(M+1)+i])
  if minCost==sys.maxint: print "Help!"
  else: print minCost

Measured memory_bytes: 20024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1e9+7
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}
int main(){
  ll N;
  cin>>N;
  
  vector<ll>lim(5);
  
  ll min=0;
  
rep(i,5){
    cin>>lim[i];
  }
  
  sort(all(lim));
  
  min=lim[0];
  
  if(min>=N){
    cout<<5<<endl;
  }
  
  else{
    if(N%min==0){
cout<<4+N/min<<endl;
    }
    
    else{
cout<<5+N/min<<endl;
    }
  }
}
  
  
  

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

int main() {
  int A;
  cin >> A;
  char op;
  cin >> op;
  int B;
  cin >> B;
  
  if (op == '+')
    cout << A+B << endl;
  else if(op == '-')
    cout << A-B << endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
if abs(n-m)>1:ans=0
elif abs(n-m)==1:ans=1
else:ans=2
for i in range(1,n+1):ans=ans*i%1000000007
for i in range(1,m+1):ans=ans*i%1000000007
print(ans)

Measured memory_bytes: 3060
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	int n;
	cin >> n;
	vector<ll> a(n);
	REP(i, n) cin >> a[i];
	ll dp[n];
	REP(i, n) dp[i] = 1000;
	REP(i, n){
		for(int j = i+1; j < n; j ++){
			//cout <<  dp[i] << "->" << dp[i] % a[i] + a[j] * (ll)(dp[i] / a[i] )<< endl;
			dp[j] = max({dp[j], dp[i] % a[i] + a[j] * (ll)(dp[i] / a[i]), dp[j-1]});
		}
		//cout << endl;
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};
const char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int find_idx(Vint &A, int k){
  // A(i) = kなる i を二分探索で求める
  int lb = -1, ub = A.size() - 1;
  while(ub - lb > 1){
    int m = (lb + ub) / 2;
    if(A.at(m) > k) ub = m;
    else if(A.at(m) < k) lb = m;
    else return m;
  }
  return ub;
}

int main(void){
  int n; cin >> n;
  Vint A(n), sorted_A(n);
  REP(i, n){
    cin >> A.at(i);
    sorted_A.at(i) = A.at(i);
  }
  SORT(sorted_A);
  int cnt = 0;
  REP(i, n){
    int idx = find_idx(sorted_A, A.at(i));
    if( ((idx - i) & 1) != 0) cnt++;
  }
  cout << cnt / 2 << BR;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fst first
#define snd second
using namespace std;
typedef long long ll;

ll n, k;
ll ans = 0;
int main(){
	cin >> n >> k;
	for(int b=k+1; b<=n; b++){
	    int last=0, cnt=0;
	    for(int y=b; y<=n; y+=b){
	        ans += b - k;cnt+=b-k;
	        last = y;
	    }
	    int tmp = n-last;
	    tmp = max(0LL,tmp-k+1);cnt+=tmp;
	    ans += tmp;
	    if(k==0)ans--;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
vs data;
map<string,vs>ma;
vs split(string s,char c){
	vs out;
	s+=c;
	string t="";
	rep(i,s.size())if(s[i]==c){
		out.pb(t);
		t="";
	}else t+=s[i];
	return out;
}
bool dfs(string s){
	vs in=ma[s];
	rep(i,in.size()){
		if(in[i][0]=='[')data.pb(in[i].substr(1,in[i].size()-2));
		else if(dfs(in[i])==0)return false;
		if(data.size()>200)return false;
	}
	return true;
}
int dp[52][52][52];
int ndp[52][52][52];
int main(){
	int na,nt,ng,nc;
	cin>>na>>nt>>ng>>nc;
	
	int m;cin>>m;
	string st;
	getline(cin,st);
	rep(i,m){
		string s;
		getline(cin,s);
		vs in=split(s,' ');
		s=in[0].substr(0,in[0].size()-1);
		if(i==0)st=s;
		in.erase(in.begin());
		ma[s]=in;
	}
	if(dfs(st)==0||data.size()!=na+nt+ng+nc){
		cout<<0<<endl;
		return 0;
	}
//	show1d(data);
	
	dp[0][0][0]=1;
	int MOD=1000000007;
	rep(i,data.size()){
		rep(j,52)rep(k,52)rep(l,52)
			ndp[j][k][l]=0;

		rep(j,52)rep(k,52)rep(l,52)rep(q,data[i].size())if(dp[j][k][l]){
			if(data[i][q]=='A'&&j+1<52)(ndp[j+1][k][l]+=dp[j][k][l])%=MOD;
			if(data[i][q]=='G'&&k+1<52)(ndp[j][k+1][l]+=dp[j][k][l])%=MOD;
			if(data[i][q]=='C'&&l+1<52)(ndp[j][k][l+1]+=dp[j][k][l])%=MOD;
			if(data[i][q]=='T')(ndp[j][k][l]+=dp[j][k][l])%=MOD;
		}

		rep(j,52)rep(k,52)rep(l,52)
			dp[j][k][l]=ndp[j][k][l];
	}
	cout<<dp[na][ng][nc]<<endl;
}













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

int main(){
	int src=100000;
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		src=src*105/100;
		if(src%1000)
			src= src-src%1000+1000;
	}
	cout << src << endl;
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  ll n,x,y; cin >> n >> x >> y; ll cnt = 0;
  vl dista(n-1);
  
  for(ll i=1; i <= n; i++){
    for(ll j=1; j <= n; j++){
      if(i < j){
        ll dis = min(abs(j-i),abs(i-x)+1+abs(j-y));
        
        dista[dis-1]++;
      }
    }
  }
  
  rep(i,n-1){
    cout << dista[i] << endl;
  }
  
  
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
int main()
{
   ll n,i,a[100005]={0},x,y,z,high=2000000000,low=0,mid,ans=20000000000;
   cin>>n>>x>>y;
   for(i=0;i<n;i++)
   {
       cin>>a[i];
   }
   while(high>=low)
   {
       mid=(high+low)/2;
       z=0;
       for(i=0;i<n;i++)
       {
           if(mid*y<a[i])
           {
               z+=ceil((1.0*(a[i]-mid*y))/(x-y));
           }
       }
       if(z<=mid)
       {
           ans=min(ans,mid);
           high=mid-1;
       }
       else
       {
           low=mid+1;
       }
   }
   cout<<ans;
 
   return 0;
}

Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,r;
    cin>>n>>r;
    if(n>=10){
        cout<<r<<endl;
    }
    else{
        cout<<r+100*(10-n)<<endl;
    }
    
}

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

int main(void)
{
    int N, T;
    cin >> N >> T;
    vector<int> t(N);
    for (int i = 0; i < N; i++)
    {
        cin >> t[i];
    }


    int begin = 0;
    int last = 0;
    int last_prev = 0;
    int accumulation = 0;
    
    for(int i = 0; i < N; i++){
        begin = t[i];
        last = t[i] + T;
        if(t[i] < last_prev){
            accumulation += last - last_prev;
        } else{
            accumulation += T;
        }
        last_prev = last;
    }
    
    cout << accumulation << endl;

    return 0;
}


Measured memory_bytes: 3908
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	map<int,int> mp;
	rep(i,n){
		int a;
		cin>>a;
		mp[a]++;
	}
	vector<int> a;
	for(auto itr:mp){
		a.push_back(itr.se);
	}
	sort(begin(a),end(a));
	int m=a.size();
	vector<ll> sum(m+1,0);
	rep(i,m){
		sum[i+1]=sum[i]+a[i];
	}
	auto solve=[&](int x,int k){
		int ind=upper_bound(begin(a),end(a),x)-begin(a);
		ll now=sum[ind]+(ll)x*((ll)m-(ll)ind);
		return now>=(ll)k*(ll)x;
	};
	FOR(k,1,n+1){
		int ok=0,ng=INF,mid;
		while(ng-ok>1){
			mid=(ok+ng)/2;
			if(solve(mid,k)) ok=mid;
			else ng=mid;
		}
		cout<<ok<<endl;
	}
}

Measured memory_bytes: 17904
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N,M,X;
  cin>>N>>M>>X;
  vector<int>A(M);
  REP(i,M)cin>>A[i];

  cout<<min(lower_bound(ALL(A),X)-A.begin(),A.end()-upper_bound(ALL(A),X))<<endl;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

//-----------------------ここから-----------


int main(void){
	int m;
	cin >> m;

	cout << 48 - m << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $a, $b, $c);

$array = [$a, $b, $c];
sort($array);

$min = $array[0];
$mid = $array[1];
$max = $array[2];

echo $max - $mid + ceil(($mid - $min)/2) + ($mid-$min)%2, "\n";

Measured memory_bytes: 4728
import java.util.Scanner;

public class Main {	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String x = sc.next();
		String y = sc.next();
		
		if(x.charAt(0) > y.charAt(0)) {
			System.out.println('>');
		}else if(x.charAt(0) < y.charAt(0)) {
			System.out.println('<');
		}else {
			System.out.println('=');
		}
	}
 
}

Measured memory_bytes: 23764
import sys

sys.setrecursionlimit(10 ** 7)
n = int(input())
t = [[] for _ in range(n)]
e = []
for i in range(n - 1):
    a, b = map(int, input().split())
    t[a - 1].append([i, b - 1])
    t[b - 1].append([i, a - 1])
    e.append([a - 1, b - 1])
colors = [len(t[i]) for i in range(n)]
res1 = max(colors)
print(res1)

res = [0 for _ in range(n - 1)]
f = [False for _ in range(n)]


def dfs2(d, c):
    f[d] = True
    nc = 1
    for j in range(len(t[d])):
        if not f[t[d][j][1]]:
            if c == nc:
                nc += 1
            res[t[d][j][0]] = nc
            dfs2(t[d][j][1], nc)
            nc += 1


dfs2(0, 1000000)

print("\n".join(map(str, res)))


Measured memory_bytes: 88596
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

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

	ll a, b, c;

	cin >> a >> b >> c;

	if(b-a == c-b) cout << "YES" << endl;
	else cout << "NO" << endl;

	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();

        String prev = "";
        StringBuilder builder = new StringBuilder();
        int count = 0;
        for (final char aChar : chars) {
            builder.append(aChar);
            if (!builder.toString().equals(prev)) {
                count++;
                prev = builder.toString();
                builder = new StringBuilder();
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 48772
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define all(_v) _v.begin(), _v.end()

int cnt[(int)2e5+10], n;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for(int i = 2; i <= n; ++i) {
        int x;
        cin >> x;
        cnt[x]++;
	}
	for(int i = 1; i <= n; ++i) cout << cnt[i] << '\n';
    return 0;
}


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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end()); 
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
//ffs = lsb, clz = l0's, ctz = r0's, popcount = 1's 
 //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
 //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++

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

signed main(){
	fastio();
    int n, x; cin >> n >> x;
    vector<int> v;
    v.push_back(0);
    int s = 0, ans = 0;
    for(int i = 1; i <= n; ++i){
        int x; cin >> x;
        v.push_back(x);
        s += v[i];
        v[i] = s;
    }
    for(int  i = 0; i < n + 1; ++i){
        if(x >= v[i]){
            ++ans;
        }
    }
    cout << ans << '\n';
	return 0;
}

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

int main(){
     int i, j, k;
     int n;
     cin >> n;
     vector< int > vt(n);
     for(i=0; i<n; ++i) cin >> vt[i];
     int cnt=0;
     for(i=0; i<n; ++i){
          if(i%2==0 && vt[i]%2) cnt++;
     }
     cout << cnt << endl;
}


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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


auto solve() {
    int N;
    cin >> N;

    const int MOD = 1e9 + 7;

    vvi edges(N);
    REP(i, N - 1) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        edges[x].push_back(y);
        edges[y].push_back(x);
    }

    vvll dp(N, vll(2, 0));

    function<void(int, int)> dfs = [&](int v, int p) {
        ll t0 = 1;
        ll t1 = 1;
        for (auto &&e: edges[v]) {
            if (e != p) {
                dfs(e, v);
                t0 *= (dp[e][0] + dp[e][1]) % MOD;
                t1 *= dp[e][0];

                t0 %= MOD;
                t1 %= MOD;
            }
        }

        dp[v][0] = t0 % MOD;
        dp[v][1] = t1 % MOD;
    };

    dfs(0, -1);

    return (dp[0][0] + dp[0][1]) % MOD;
}


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

//    cout << (solve() ? "First" : "Second") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}

Measured memory_bytes: 19584
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    s = S()

    return s[:-8]


print(main())




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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);


int32_t main()
{
    int n;cin >> n;
    int c;
    int ans = 0;
    for(int i = 1;i <= n;i++){
        int c;cin >> c;
        if(i % 2 == 1 and c % 2 == 1)ans++;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3620
n=int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

L=make_divisors(n)

s=float('inf')
for i in L:
      s=min(s,i+(n//i))

print(s-2)

Measured memory_bytes: 3268
#include <stdio.h>

int main(void)
{
    int H = 0, A = 0;
    int attack = 0;
    scanf("%d %d", &H, &A);

    while (0 < H)
    {
        H = H - A;
        attack++;
    }
    printf("%d", attack);
    return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll n, ans[50];
int main() {
	cin >> n;
	REP(i, 50)ans[i] = 49 - i;
	REP(i, 50)ans[i] += n / 50;
	n %= 50;
	REP(i, n)ans[i]++;
	cout << 50 << endl;
	REP(i, 50) {
		if (i != 0)cout << " ";
		cout << ans[i];
	}
	cout << endl;
}


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

using namespace std;

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

Measured memory_bytes: 256