akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
ll ans = 1e9;

ll search2(ll a,ll b,ll c){
  ll mi = min(a,min(b,c));
  ll ma = max(a,max(b,c));
  return ma-mi;
}

void search1(ll h,ll w){
  for(ll i=1;i<h;i++){
    ll s1 = i*w;
    ll s2,s3;
    s2 = w*((h-i)/2);
    s3 = h*w-s1-s2;
    if(s3!=0)ans = min(ans,search2(s1,s2,s3));
    s2 = (w/2)*(h-i);
    s3 = h*w-s1-s2;
    if(s3!=0)ans = min(ans,search2(s1,s2,s3));
  }
}

int main(){
  ll h,w;
  cin>>h>>w;

  search1(h,w);
  search1(w,h);

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll N;
  cin >> N;
  string t = "MARCH";
  vector<ll> cnt(5, 0);
  REP(i, 0, N) {
    string S;
    cin >> S;
    REP(j, 0, 5) if(S[0] == t[j]) cnt[j]++;
  }

  ll ans = 0;
  REP(i, 0, 5) REP(j, i + 1, 5) REP(k, j + 1, 5) {
    ans += cnt[i] * cnt[j] * cnt[k];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
void GoodInteger() {
	int n;
	cin >> n ;
	int d = 111;
	for (size_t i = 0; i <= 9; i++)
	{
		int s = d * i;
		int p = n - s;
		if (p % 1000 == 0) {
			cout << "Yes" << endl;
			return;
		}
		int p2 = n - s * 10;
		if (p2 >= 0 && p2 < 10) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}
int main() {

	GoodInteger();
	return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[0]*(6*(10**4))
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            l[(x*x+y*y+z*z+x*y+y*z+z*x)-1]+=1
for i in range(n):
    print(l[i])


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

int main() {
  int n,c=0; cin>>n;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(i*j==n){
        c=1;
      }
    }
  }
  cout<<(c==1 ? "Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N, K;
string S;

void solve() {

	cin >> N >> K >> S;

	S[K - 1] = S[K -1] - 'A' + 'a';

	cout << S << endl;

	return;

}

int main() {

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

	solve();

	return 0;

}

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

int min(int x, int y) {return x > y ? y : x;}

int main() {
	int a, b, c, x, y;
	int sum = 0;
	cin >> a >> b >> c >> x >> y;
	int z = min(x, y);
	sum += min(a+b, 2*c) * z;
	x -= z;
	y -= z;
	if(x > 0) {
		sum += x * min(a, 2*c);
	}
	if(y > 0) {
		sum += y * min(b, 2*c);
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <functional>
#include <iterator>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#ifdef _MSC_VER
using ll = __int64;
using ull = unsigned __int64;
#else
using ll = long long int;
using ull = unsigned long long int;
#endif

// 二乗を計算する。
ll sq(ll x) { return x * x; }

// 領域内にいるか。
bool within(ll x, ll min, ll max) {
	return min <= x && x <= max;
}

// container の中から key より小さい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator less_than(T& container, typename T::key_type& key) {
	typename T::iterator prev = container.lower_bound(key);
	if (prev == container.begin()) prev = container.end();
	else prev--;
	return prev;
}

// container の中から key より大きい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator greater_than(T& container, typename T::key_type& key) {
	return container.upper_bound(key);
}

// b^e (mod m) を求める
ll modpow(ll b, ll e, ll m) {
	ll result = 1;
	while (e > 0) {
		if ((e & 1) == 1) result = (result * b) % m;
		e >>= 1;
		b = (b * b) % m;
	}
	return result;
}


// ここから解法


int main(void) {
	std::ios_base::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<int> W;
	W.resize(N);
	for (int i = 0; i < N; ++i) cin >> W[i];
	vector<int> S(N + 1, 0);
	for (int i = 1; i <= N; ++i) S[i] = S[i - 1] + W[i - 1];
	int m = 100 * 100 + 100;
	for (int i = 1; i <= N; ++i) {
		m = min(m, abs((S[i] - S[0]) - (S[N] - S[i])));
	}
	cout << m << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//const ll mx=1e5;
//bool prime[100009];
//void seive()
//{
//    prime[1]=true;
//    for(int i=2;i*i<=mx;i++){
//        if(prime[i]==false){
//            for(int j=i*i;j<=mx;j+=i) prime[j]=true;
//        }
//    }
//}
int main(){
	ll n,k;
	cin>>n>>k;
	cout<<n-k+1<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {

    int berapaKali;
    long long a1[100001];
    long long a2 = 1;
    long long max = 1000000000000000000;

    scanf("%d", &berapaKali);

    for(int j=0;j<berapaKali;j++){
        scanf("%lld", &a1[j]);
        if(a1[j]==0){
            printf("0");
            return 0;
        }
    }

    for (int i = 0; i < berapaKali; i++) {
        if (a1[i] > max) {
            printf("-1");
            return 0;
        }
        a2 *= a1[i];
        max /= a1[i];
    }

    printf("%lld", a2);

    return 0;

}

Measured memory_bytes: 2492
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string alphabet;
  alphabet = "abcdefghijklmnopqrstuvwxyz";
  
  char C;
  cin >> C;
  
  for (int i = 0; i < alphabet.size(); i++){
    
    if (alphabet.at(i) == C){
      cout << alphabet.at(i+1) << endl;
      break;
    }
    
  }
  
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main() {
    int n=0, m=0, x=0, y=0;
    scanf("%d %d %d %d\n", &n, &m, &x, &y);
    int x_max = -1000, y_min = 1000;
    for (int i=0; i<n; i++) {
        int buf = 0;
        scanf("%d", &buf);
        if (buf > x_max) x_max = buf;
    }
    for (int i=0; i<m; i++) {
        int buf = 0;
        scanf("%d", &buf);
        if (buf < y_min) y_min = buf;
    }
    for (int i=x+1; i<=y; i++) {
        if (i>x_max && i<=y_min) {
            printf("No War\n");
            return 0;
        }
    }
    printf("War\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n,m; cin >> n >> m;

  int ans = (n*(n-1))/2 + (m*(m-1))/2;
  cout << ans << '\n';

    

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
int n;
struct stu
{
	int k;
	int num;
	bool operator<(const stu &a)const
    {
        return num < a.num;
    }

}a[100010];
int main()
{	
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	a[i].k = i;
    	cin>>a[i].num;
	}
	sort(a+1, a+n+1);
	for(int i=1;i<=n;i++)
	{
		cout<<a[i].k;
		if(i!=n)	cout<<' ';
		else	cout<<endl;
	}
    return 0;
}


Measured memory_bytes: 1536
import bisect
s=input()
t=input()
dic={}
for i in range(len(t)):
  if t[i] in dic:
    continue
  if t[i] not in dic:
    dic[t[i]]=[]
for i in range(len(s)):
  if s[i] in dic:
    dic[s[i]].append(i)
for k,v in dic.items():
  if v==[]:
    print(-1)
    exit()
n=-1
k=0

for i in range(len(t)):
  l=bisect.bisect_right(dic[t[i]],n)
  if l<len(dic[t[i]]):
    n=dic[t[i]][l]
  else:
    n=dic[t[i]][0]
    k+=1
print(len(s)*k+n+1)

Measured memory_bytes: 13468
from collections import deque
K=int(input())
queue=deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
    k=queue.popleft()
    if k%10!=0:
        queue.append(10*k+(k%10)-1)
    queue.append(10*k+(k%10))
    if k%10!=9:
        queue.append(10*k+(k%10)+1)
print(k)

Measured memory_bytes: 18708
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) (x).begin(),x.end()
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

int main(){
  int n;
  cin>>n;
  cout<<n*800-n/15*200<<endl;
  return 0;
}


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


#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

const int cons = 1e9 + 7;

//B
int main(void) {
	ll r, g, b, n;
	cin >> r >> g >> b >> n;
	ll ans = 0;
	for (int i = 0; i*r <= n; i++) {
		for (int j = 0; j*g <= n - i*r; j++) {
			if (n - i*r - j*g >= 0 && (n - i*r - j*g) % b == 0) ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())
 
int main()
{
    int s,w;
    cin >> s >> w;

    if(w>=s) cout << "unsafe"<< endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ


int main()
{
    ll n;
    cin >> n;
    ll time;
    cin >> time;

    vector<ll> c(n);
    vector<ll> t(n);

    rep(cnt,0,n) {

        cin >> c[cnt];
        cin >> t[cnt];
    }

    ll min=3000;

    rep(cnt, 0, n) {
        if (t[cnt] <= time) {
            if (c[cnt] < min) {
                min = c[cnt];
            }
        }

    }
    if (min > 1000) {
        cout << "TLE" << endl;
    }
    else {
        cout << min << endl;
    }
 


    return 0;
}

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

string s;
int k;

set <string> st ;

int main(){
    cin >> s >> k;
    for (int i = 1; i <= k; i++){
        for (int j = 0; j + i - 1 < s.size(); j++){
            st.insert(s.substr(j, i));
        }
    }
    int c = 0;
    set<string>::iterator it;
    for (it = st.begin(); it != st.end(); it++){
        c++;
        if (c == k){
            cout << *it;
            break;
        }
    }
}

Measured memory_bytes: 1664
//007naruto
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define forn(i,n) for(int i=0;i<n;i++)
 
 int main()
 {
   ll a,b,c;
   cin>>a>>b>>c;
   cout<<(c/a)*b;
 }


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

using namespace std;

using ll = long long;

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

    int h, w;
    cin >> h >> w;

    const int n = 10;
    vector<vector<int>> d(n, vector<int>(n));
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            cin >> d[i][j];

    for (int k = 0; k < n; ++k)
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

    ll sum = 0, a;
    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j) {
            cin >> a;
            if (a != -1) sum += d[a][1];
        }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
const int maxn  = 15;
std::vector<int> vec[maxn];
int main(){
    int n,d;
    std::cin >> n >> d;
    for(int i = 1; i <= n; ++ i){
        int tm;
        for(int j = 1; j <= d; ++ j){
            std::cin >> tm;
            vec[i].push_back(tm);
        }
    }
    long long ret = 0;
    for(int i = 1; i <= n; ++ i){
        for(int j = i + 1; j <= n; ++ j){
          //  std::cout << j << std::endl;
            long long tm = 0;
            for(int k = 0; k < d; ++ k){
                tm += (vec[i][k] - vec[j][k]) * (vec[i][k] - vec[j][k]);
            }
            long long tu = (int)(sqrt(tm) + 0.5);
            if (tu *  tu == tm){
                ret ++;
          //      std::cout << i << " " << j << std::endl;
            }
        }
    }
    std::cout << ret << std::endl;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

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

typedef long long ll;

int main()
{
	vector<int> H(5);
		while(~scanf("%d,%d,%d,%d,%d", &H[0] ,&H[1] ,&H[2] ,&H[3] ,&H[4]))
		{
			vector<int> L(32, 0);
			int kind = 0;
			for(int i = 0; i < 5; i++)
			{
				if(L[H[i]-1] == 0)
				{
					kind++;
				}
				L[H[i]-1]++;
			}

			if(kind == 2)
			{
				int mx = *max_element(L.begin(), L.end());
				if(mx == 4)
				{
					cout << "four card" << endl;
					continue;
				}
				else if(mx == 3)
				{
					cout << "full house" << endl;
					continue;
				}
				cout << "error 1" << endl;
			}
			else if(kind == 5)
			{
				bool straight = false;
				for(int i = 0; i <= 10; i++)
				{
					L[13] = L[0];
					if(L[i] && L[i+1] && L[i+2] && L[i+3] && L[i+4])
					{
						straight = true;
					}
				}
				if(straight)
				{
					cout << "straight" << endl;
					continue;
				}
				else
				{
					cout << "null" << endl;
					continue;
				}
			}
			else if(kind == 3)
			{
				int mx = *max_element(L.begin(), L.end());
				if(mx == 3)
				{
					cout << "three card" << endl;
					continue;
				}
				else if(mx == 2)
				{
					cout << "two pair" << endl;
					continue;
				}
			}
			else if(kind == 4)
			{
				cout << "one pair" << endl;
				continue;
			}
		}
}

Measured memory_bytes: 1208
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll n;
  cin >> n;
  vector<ll>a(n);
  rep(i,n) cin >> a.at(i);
  ll count = 1;
  sort(a.begin(),a.end());
  long double check = 1000000000000000000;
  int flag=0;
  
  rep(i,n){
    if(a.at(i) == 0 ){
      cout << 0 << endl;
      return 0;
    }
  }
  ll prod = 1;
  rep(i,n){
    if(a.at(i) <= 1000000000000000000/prod){
      prod *= a.at(i);
    }
    else{
      cout << -1 << endl;
      return 0;
    }
  }
  cout << prod << endl;
}
       

Measured memory_bytes: 3976
#include<stdio.h>
int main()
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	if( a == b ){
		printf("a == b\n");
		}else if(a > b){
			printf("a > b\n");
		}else if( a < b){
		 	printf("a < b\n");
		}
	return 0;
}

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

int main()
{
  int a, b, c;
  int x = 0, y = 0, z = 0, w = 0;
  while (true)
  {
    cin >> a >> b >> c;
    int len = a + b + c;
    int nmax = max(a, max(b, c));
    int nmin = min(a, min(b, c));
    int nmid = len - nmax - nmin;
    if (nmax < nmin + nmid)
    {
      x++;
      if (nmin * nmin + nmid * nmid == nmax * nmax)
        y++;
      else if (nmin * nmin + nmid * nmid > nmax * nmax)
        z++;
      else
        w++;
    }
    else
      break;
  }

  cout << x << ' ' << y << ' ' << z << ' ' << w << endl;

  return 0;
}



Measured memory_bytes: 3120
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=100005,INF=1000000000;
bool jdg;
int n,m,x,c[N],h[N],L[N],R[N],siz[N],cnt;
struct edge{int v,n;} e[N<<1];

int getint()
{
	char ch;
	while(!isdigit(ch=getchar()));
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x;
}

void addedge(int u,int v)
{
	e[cnt]=(edge){v,h[u]},h[u]=cnt++;
	e[cnt]=(edge){u,h[v]},h[v]=cnt++;
}

void get_siz(int x,int fa)
{
	siz[x]=c[x]>-1;
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa)
			get_siz(e[i].v,x),siz[x]+=siz[e[i].v];
}

void dfs2(int x,int fa)
{
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa) c[e[i].v]=c[x]+1,dfs2(e[i].v,x);
}

void dfs1(int x,int fa)
{
	if(siz[x]==0) {L[x]=-INF,R[x]=INF; return;}
	if(siz[x]==1 && c[x]>-1) {L[x]=R[x]=c[x],dfs2(x,fa); return;}
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa)
		{
			dfs1(e[i].v,x);
			if(!siz[e[i].v]) continue;
			if(L[x]==-INF) L[x]=L[e[i].v]-1;
			else if((L[x]&1)^(L[e[i].v]&1)) L[x]=max(L[x],L[e[i].v]-1);
			else jdg=1;
			if(R[x]==-INF) R[x]=R[e[i].v]+1;
			else if((R[x]&1)^(R[e[i].v]&1)) R[x]=min(R[x],R[e[i].v]+1);
			else jdg=1;
			if(L[x]>R[x]) jdg=1;
		}
	if(c[x]>-1)
	{
		if(c[x]>R[x] || c[x]<L[x] || (c[x]&1)^(L[x]&1)) jdg=1;
		L[x]=R[x]=c[x];
	}
}

void dfs3(int x,int fa)
{
	if(siz[x]==1 && c[x]>-1) return;
	if(c[x]==-1)
	{
		if(!fa) c[x]=L[x];
		else if(L[x]<=c[fa]+1 && c[fa]+1<=R[x]) c[x]=c[fa]+1;
		else c[x]=c[fa]-1;
	}
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa)
			dfs3(e[i].v,x);
}

int main()
{
	n=getint();
	memset(h,-1,sizeof(h));
	memset(c,-1,sizeof(c));
	rep(i,1,n) L[i]=R[i]=-INF;
	rep(i,1,n-1) addedge(getint(),getint());
	m=getint();
	rep(i,1,m) x=getint(),c[x]=getint();
	get_siz(1,0),dfs1(1,0),dfs3(1,0);
	if(jdg) puts("No");
	else
	{
		puts("Yes");
		rep(i,1,n) printf("%d\n",c[i]);
	}
	return 0;
}

Measured memory_bytes: 9088
# -*- coding: utf-8 -*-
"""
IOIOI
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0538

"""
import sys
import re

def solve(n, s):
    ans = 0
    p = '(I(?:OI){' + str(n) + ',})'
    for f in re.findall(p, s):
        repeat = len(f) // 2
        if repeat >= n:
            ans += (repeat - n + 1)
    return ans


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break
        _ = input()
        s = input()
        ans = solve(n, s)
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 9104
#include <stdio.h>

int main()
{
	int stack[10];
	int train;
	int pointer=0;

	while(scanf("%d", &train)!=EOF){
		if(train==0){
			printf("%d\n", stack[pointer-1]);
			pointer--; continue;
		}
		stack[pointer]=train;
		pointer++;
	}

	return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using ll = long long;
using namespace std;
int main(){
  ll n,x,ii;
  vector<ll> l;
  cin >> n >> x;
  l.resize(n);
  for(ii=0;ii<n;ii++){
    cin >> l[ii];
  }
  ll sum = 0,num=1;

  while(true){
    sum += l[num-1];
    if(sum > x){
      break;
    }
    num++;
    if(num>=n+1){
      break;
    }
  }
  

  cout << (num) << endl;
  return 0;
}


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

typedef long long ll;

using namespace std;

int main(){
    ll ans=0,sum=0;
    int n,l=0,r=1;
    
    scanf("%d",&n);
    
    vector<ll> a(2*n+1,0);
    
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        sum+=a[i];
        a[i]=sum;
    }
    
    for(int i=1;i<=n;i++){
        a[i+n]=sum+a[i];
    }
    
    while(1){
        
        if((a[r]-a[l])*3<sum){
            r++;
        }else{
            l++;
            if(l==n+1) break;
        }
        
        if((a[r]-a[l])*3<sum)
            continue;
        
        vector<ll>::iterator itl=lower_bound(a.begin(),a.end(),(sum-a[r]+a[l]+1)/2+a[r]);
        
        if(itl!=a.end()){
            ans=max(ans,sum-(*itl)+a[l]);
            ans=max(ans,*(itl-1)-a[r]);
        }
        
       // cout << l << "-" << r << ":" << a[r]-a[l] << " " << sum-(*itl)+a[l] << ":" << *(itl-1)-a[r] << endl;
        
    }
    
    printf("%lld\n",ans);
    
    return 0;
}

Measured memory_bytes: 2588
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    unordered_map<string, int> um;
    string s;
    for (int i = 0; i < N; i++) {
        cin >> s;
        um[s]++;
    }
    vector<string> ans;
    int max_value = (*max_element(um.begin(), um.end(), [](const auto& p, const auto& q) {
        return p.second < q.second;
    })).second;
    for (const auto& p : um) {
        if (p.second == max_value) ans.push_back(p.first);
    }
    sort(ans.begin(), ans.end());
    for (const auto& i : ans) cout << i << endl;
}

Measured memory_bytes: 26692
# -*- coding: utf-8 -*-

x, y = map(int, input().split())

g= {1:'g1', 2:'g3', 3:'g1', 4:'g2', 5:'g1', 6:'g2', 7:'g1', 8:'g1', 9:'g2', 10:'g1', 11:'g2', 12:'g1'}

if g[x] == g[y]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 8872
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;



int main() {
	int h, w, k;
	cin >> h >> w >> k;
	pair<int, int> st, go;
	cin >> st.first >> st.second >> go.first >> go.second;
	vector<vector<int>> grid, pushed;
	grid.resize(h);
	pushed.resize(h);
	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		grid[i].resize(w);
		pushed[i].resize(w);
		for (int j = 0; j < w; j++) {
			if (s[j] == '@') {
				grid[i][j] = INT32_MIN;
			}
			else {
				grid[i][j] = INT32_MAX;
			}
			
		}
	}

	queue <pair<int, int>> Q;
	st.first--;
	st.second--;
	Q.push(st);
	grid[st.first][st.second] = 0;
	pushed[st.first][st.second] = true;
	while (!Q.empty()) {
		pair<int, int> now = Q.front();
		Q.pop();
		int nowDis = grid[now.first][now.second];
		if (now.first == go.first - 1 && now.second == go.second - 1) {
			break;
		}
		pair<int, int> newPoint;

		newPoint = now;
		int xp = 1;
		while (xp <= k) {
			newPoint.first++;
			if (newPoint.first >= h) {
				break;
			}
			if (grid[newPoint.first][newPoint.second] <= nowDis) {
				break;
			}
			grid[newPoint.first][newPoint.second] = nowDis + 1;
			if (pushed[newPoint.first][newPoint.second] == false) {
				Q.push(newPoint);
				pushed[newPoint.first][newPoint.second] = true;
			}
			xp++;
		}
		newPoint = now;
		int xm = 1;
		while (xm <= k) {
			newPoint.first--;
			if (newPoint.first < 0) {
				break;
			}
			if (grid[newPoint.first][newPoint.second] <= nowDis) {
				break;
			}
			grid[newPoint.first][newPoint.second] = nowDis + 1;
			if (pushed[newPoint.first][newPoint.second] == false) {
				Q.push(newPoint);
				pushed[newPoint.first][newPoint.second] = true;
			}

			xm++;
		
		}
		newPoint = now;
		int yp = 1;
		while (yp <= k) {
			newPoint.second++;
			if (newPoint.second >= w) {
				break;
			}
			if (grid[newPoint.first][newPoint.second] <= nowDis) {
				break;
			}
			grid[newPoint.first][newPoint.second] = nowDis + 1;
			if (pushed[newPoint.first][newPoint.second] == false) {
				Q.push(newPoint);
				pushed[newPoint.first][newPoint.second] = true;
			}

			yp++;
		}
		newPoint = now;
		int ym = 1;
		while (ym <= k) {
			newPoint.second--;
			if (newPoint.second < 0) {
				break;
			}
			if (grid[newPoint.first][newPoint.second] <= nowDis) {
				break;
			}
			grid[newPoint.first][newPoint.second] = nowDis + 1;
			if (pushed[newPoint.first][newPoint.second] == false) {
				Q.push(newPoint);
				pushed[newPoint.first][newPoint.second] = true;
			}

			ym++;
		}
	}
	if (grid[go.first-1][go.second-1] == INT32_MAX) {
		cout << -1 << endl;
	}
	else {
		cout << grid[go.first-1][go.second-1] << endl;
	}

}


Measured memory_bytes: 12016
#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <cmath>
#include <ctime>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<ll> vl;
typedef vector< vector<ll> > vvl;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back

int n, k;
vi a;
vvi g;
vi used;
vi dist;

void dfs(int v) {
    for (int u : g[v]) {
        if (!used[u]) {
            used[u] = true;
            dist[u] = dist[v] + 1;
            dfs(u);
        }
    }
}

int main() {
#ifdef NEREVAR_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n >> k;
    g = vvi(n);
    a = vi(n);
    forn(i, n) {
        scanf("%d", &a[i]);
        a[i]--;
        g[a[i]].pb(i);
    }
    if (k == 1) {
        int ans = 0;
        forn(i, n) if (a[i]) ans++;
        cout << ans << endl;
        return 0;
    }
    int v = 0;
    used = vi(n);
    vi c;
    do {
        c.pb(v);
        used[v] = true;
        v = a[v];
    } while(v);
    int ans = 0;
    if (a[0] != 0) ans++;
    dist = vi(n);
    forv(i, c) {
        dist[c[i]] = (c.size() - i) % c.size();
    }

    forv(i, c) {
        dfs(c[i]);
    }
    
    vector<pii> byDist(n);
    forn(i, n) byDist[i] = mp(dist[i], i);
    sort(all(byDist), greater<pii>());
    
    forv(i, byDist) {
        int v = byDist[i].second;
        if (dist[v] <= k) continue;
        int u = v;
        vi p;
        for (int st = 1; st < k; st++) {
            u = a[u];
            if (dist[u] + st <= k) {
                dist[v] = dist[u] + st;
                break;
            }
            p.pb(u);
        }
        if (dist[v] > k) {
            dist[u] = 1;
            ans++;
            dist[v] = k;
        }
        forv(j, p) {
            dist[p[j]] = dist[v] - j - 1;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


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

#define PI 3.14159265359

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  int64_t sum = 0;
  for (int i = 0; i < N; i++){
    cin >> A[i];
    sum = (sum + A[i]) % 1000000007;
  }
  int64_t ans = 0;
  for (int i = 0; i < N; i++){
    if (sum - A[i] > 0) sum = sum - A[i];
    else sum = 1000000007 + sum - A[i];
    ans = (ans + sum * A[i]) % 1000000007;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3896
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        ans += max(V[i]-C[i], 0)
    print(ans)
if __name__ == '__main__':
    main()


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

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

	int b, f, r, v;
	int x = 4, y = 3, z = 10;
	int count[4][3][10];

	for (int i = 0; i < x; ++i)
		for (int j = 0; j < y; ++j)
			for (int k = 0; k < z; ++k)
				count[i][j][k] = 0;

	for (int i = 0; i < n; ++i)
	{
		cin >> b >> f >> r >> v;
		count[b-1][f-1][r-1] += v;
	}

	for (int i = 0; i < x; ++i)
	{
		for (int j = 0; j < y; ++j)
		{
			for (int k = 0; k < z; ++k)
				cout << " " << count[i][j][k];
			cout << endl;
		}
		if(i != x-1) cout << string(20, '#') << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
program ABC063B
    implicit none
    integer(8)::i
    integer(8)::flg=0
    integer(8),dimension(26)::L
    character(26)::S
    read(5,*)S
    L=0
    do i=1,len_trim(S)
        L(ichar(S(i:i))-96)=L(ichar(S(i:i))-96)+1
        if(L(ichar(S(i:i))-96)>1)then
            flg=1
            exit
        end if
    end do

    if(flg==1)then
        print'(A)',"no"
    else
        print'(A)',"yes"
    end if
end program ABC063B

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

    

int main(void){
    int N,W; int w[101]; int v[101];
    scanf("%d %d", &N, &W);
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &w[i], &v[i]);
    }
    long *dp[110]; 
    for (int i = 0; i < 110; i++) {
        dp[i] = (long *)malloc(500010 * sizeof(long));
    } 
    for (int i = 0; i < 110; i++) {
        for (int j = 0; j < 500010; j++) {
            dp[i][j] = 100000000000 ;
        }
    }
    for (int i = 0; i < N; i++) {
        dp[i][0] = 0l;
    }
    long ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= N * 1000; j++) {
            dp[i + 1][j + v[i]] = MIN(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
            dp[i + 1][j] = MIN(dp[i+1][j], dp[i][j]);
        }
    }
    for (int i = 0; i <= N * 1000; i++) {
        if (dp[N][i] <= W) {
            ans = MAX(ans, i);
        }
    }
    printf("%ld\n",ans);
    return 0;
}


Measured memory_bytes: 430080
#include <iostream>
#include <bits/stdc++.h>
#define mod 1000000007
typedef long long ll;

using namespace std;

void Fastio(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

ll fact[1000006], inv[1000006];

ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void calcFacAndInv(ll n)
{
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) ;
        inv[i] = fp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}

long double  NCR(int n, int m){
    long double res = 1;
    m = min(m, n - m);
    for(int i = 0; i < m; i++){
        res = res * ( n - i) / (i + 1);
 }
    return res;
}
ll tol(string a){
    ll res=0;
    while(a[0]=='0'){
        a.erase(a.begin());
    }
    if(a=="")a="0";
    for(int i=0; i<a.size(); i++){
        res*=10; res+=a[i]-'0';
    }
    return res;
}
int check(string a, string b){
    for(int i=0; i<a.size(); i++){
        if(a[i]>b[i])return 1;
        if(b[i]>a[i])return -1;
    }
    return 0;
}
class data{
public:
    ll v,d,p;
    data(){}
    data(ll vv, ll dd, ll pp){
        v=vv;  d=dd; p=pp;
    }
};

int primeFactors(int n)
{
    ll c=0;
    while (n % 2 == 0)
    {
        c++;
        n = n/2;
    }
    for (int i = 3; i*i <= n; i = i + 2)
    {
        while (n % i == 0)
        {
            c++;
            n = n/i;
        }
    }
    if (n > 2)
        c++;
    return c;
}

int main()
{
    Fastio();
    int n,m; cin>>n>>m;
    char arr[n+2][m+2];
    for(int i=1; i<=n; i++){
        for(int y=1; y<=m; y++){cin>>arr[i][y];}
    }
    ll dp[n+2][m+2]={0}; dp[1][1]=1;
    for(int i=1; i<=n; i++){
        for(int y=1; y<=m; y++){
            if(arr[i-1][y]=='.')dp[i][y]+=dp[i-1][y];
            if(arr[i][y-1]=='.')dp[i][y]+=dp[i][y-1];
            dp[i][y]%=mod;
        }
    }
    cout<<dp[n][m]<<'\n';


    return 0;
}


Measured memory_bytes: 9088
import copy
import time

t1 = time.time()

def calc(T):
    res = 0
    L = [0]*26
    for i in range(D):
        res += S[i][T[i]-1]
        L[T[i]-1] = i+1
        for j in range(26):
            res -= C[j]*(i+1-L[j])
    return res
    
D = int(input())
C = [int(c) for c in input().split()]
S = [[int(s) for s in input().split()] for _ in range(D)]

T = [0]*D
for i in range(D):
    temp = -1
    for j in range(26):
        if temp < S[i][j]:
            temp = S[i][j]
            idx = j+1
    T[i] = idx

T2 = [0]*D
for i in range(D):
    T2[i] = i%26+1
    
p1 = calc(T)
p2 = calc(T2)
if p2 > p1:
    T = copy.deepcopy(T2)
    p = p2
else:
    p = p1

i = D-1
next = -1
while time.time()-t1 < 1.9:
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp
    i += next
    if i == -1:
        i = 1
        next = 1
    elif i == D:
        i = D-2
        next = -1

for t in T:
    print(t)

Measured memory_bytes: 76972
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
signed main(){
    int a,b,k;
    cin>>a>>b>>k;
    if(k>=a){
        k-=a;
        a=0;
        if(k>=b){
            b=0;
            cout<<a<<" "<<b<<endl;
        }
        else{
            b-=k;
            cout<<a<<" "<<b<<endl;
        }
    }
    else{
        a-=k;
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}


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

using namespace std;

static int MAX = 1000;

signed main(){
  int N, A[MAX];
  
  cin >> N;
  for (int i=0;i<N;i++) {
    cin >> A[i];
  }

  for (int i=1;i<N;i++) {
    for (int k=0;k<N-1;k++) {
      cout << A[k] << " ";
    }
    cout << A[N-1] << endl;

    int v = A[i];
    int j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j + 1] = A[j];
      j--;
      A[j+1] = v;
    }
  }

  for (int k=0;k<N-1;k++) {
    cout << A[k] << " ";
  }
  cout << A[N-1] << endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int mp[3][105];
int main() {
  int n;
  cin >> n;
  int a;
  for(int i = 0; i < 2; ++i) {
    for(int j = 0; j < n; ++j) {
      cin >> a;
      if(i == 0 && j == 0) mp[i][j] = a;
      else if(i == 0) mp[i][j] = mp[i][j-1] + a;
      else if(j == 0) mp[i][j] = mp[i-1][j] + a;
      else mp[i][j] = max(mp[i-1][j], mp[i][j-1]) + a;
    }
  }
  cout << mp[1][n-1] << endl;
  return 0;
}


Measured memory_bytes: 256
def hantei(dominoes)
  return "Yes" if dominoes.size == 1

  parity = []
  domino_exists = []
  same_domino_exists = []
  7.times do
    parity << 0
    domino_exists << false
    same_domino_exists << false
  end

  dominoes.each do |domino|
    if domino[0] == domino[1]
      same_domino_exists[domino[0].to_i] = true
      next
    end

    domino.each_char do |num|
      parity[num.to_i] ^= 1
      domino_exists[num.to_i] = true
    end
  end

  7.times do |i|
    if same_domino_exists[i] && !domino_exists[i]
      return "No"
    end
  end

  odd_numbers = parity.select { |p| p == 1 }.size
  if [0, 2].include? odd_numbers
    return "Yes"
  else
    return "No"
  end
end

loop do
  STDIN.readline rescue break

  dominoes = STDIN.readline.chomp.split(" ")
  puts hantei(dominoes)
end

Measured memory_bytes: 6104
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define int long long
using namespace std;
const int N_MAX=100000;
int N;
vector<tuple<int,int,int>> happy;
int dp[N_MAX+1][3];

signed main(){
    cin>>N;
    REP(i,N){
        int a,b,c;
        cin>>a>>b>>c;
        happy.emplace_back(a,b,c);
    }
    REP(i,N){
        int a[3];
        tie(a[0],a[1],a[2])=happy[i];
        REP(j,3) REP(k,3){
            if(j==k) continue;
            dp[i+1][j]=max(dp[i+1][j],dp[i][k]+a[k]);
        }
    }
    cout<<max({dp[N][0],dp[N][1],dp[N][2]})<<endl;
}

Measured memory_bytes: 5616
// B - Break Number
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	int maxN = 0;
	rp(i, 1, N+1){
		int num = 1;
		for(int n=i; n%2==0; n/=2) num <<= 1;
		maxN = max(maxN, num);
	}
	cout<< maxN <<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		if(n>=3200)
			System.out.println(s);
		else
			System.out.println("red");

	}

}

Measured memory_bytes: 22868
# -*- coding: utf-8 -*-
"""
A - AKIBA
https://atcoder.jp/contests/cf17-final/tasks/cf17_final_a

"""
import sys


def solve(S):
    if 'AA' in S or 'KA' in S or 'IA' in S:
        return 'NO'
    if S.replace('A', '') == 'KIHBR':
        return 'YES'
    return 'NO'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3060
n, m = gets.split.map(&:to_i)
a = []
1.upto(m) do |i|
  a[i] = gets.to_i
end
a[0] = -1
a.push(n + 1)
b = []
1.upto(m + 1) do |i|
  if a[i] - a[i - 1] == 1
    puts "0"
    exit
  end
  b.push(a[i] - a[i - 1] - 1)
end
memo = []
memo[1] = 1
memo[2] = 1
3.upto(n + 1) do |i|
  memo[i] = memo[i - 1] + memo[i - 2]
  memo[i] %= 1_000_000_007
end
ans = 1
0.upto(b.size - 1) do |i|
  ans *= memo[b[i]]
  ans %= 1_000_000_007
end
puts ans

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    string s;
    cin >> n >> s;
    rep(i, s.size()) {
        s[i] += n;
        if(s[i] > 'Z') s[i] -= 26;
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3640
Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let rec loop i acc =
        if i = n then "yes" else
            let c = int_of_char s.[i] - 97 in
            let m = 1 lsl c in
            if m land acc = 0 then loop (i + 1) (acc lor m)
            else "no"
    in
    loop 0 0 |> print_endline
)

Measured memory_bytes: 2432
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int a[n][3];
    int b[n][3];
    scanf("%d %d %d", &a[0][0], &a[0][1], &a[0][2]);
    b[0][0] = a[0][0]; b[0][1] = a[0][1]; b[0][2] = a[0][2];
    for(int i = 1; i < n; i++){
        scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
        b[i][0] = max(b[i-1][1], b[i-1][2]) + a[i][0];
        b[i][1] = max(b[i-1][0], b[i-1][2]) + a[i][1];
        b[i][2] = max(b[i-1][0], b[i-1][1]) + a[i][2];
    }
    printf("%d", max(b[n-1][0], max(b[n-1][1], b[n-1][2])));
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;




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

    rep(i, 3) {
        if (n[i] == '1') cout << '9';
        else if (n[i] == '9') cout << '1';
    }
    cout << endl;

    return 0;

}


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int h, n;
	cin >> h >> n;
	vector<pair<int, int>> a(n);
	for (auto &i : a) cin >> i.F >> i.S;

	const int inf = 1<<30;
	vector<int> dp(h+20000, inf);

	dp[0] = 0;
	for (int i = 0; i <= h; ++i)
		for (auto j : a)
			if (dp[i] != inf)
				dp[i+j.F] = min(dp[i+j.F], dp[i] + j.S);

	cout << *min_element(dp.begin()+h, dp.end()) << "\n";

	return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-

N = int(input().strip())
AB_list = [list(map(int, input().rstrip().split())) for i in range(N)]
#-----

A_list,B_list = list(map(list, zip(*AB_list)))

A_list.sort()
B_list.sort()


if N%2 == 0:
    Med_A = A_list[ (N-1)//2 ] + A_list[ (N-1)//2 + 1 ]
    Med_B = B_list[ (N-1)//2 ] + B_list[ (N-1)//2 + 1 ]
    
else:
    Med_A = A_list[ (N-1)//2 ]
    Med_B = B_list[ (N-1)//2 ]


Med_range = Med_B - Med_A + 1
print(Med_range)


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

using namespace std;
using ll = long long int;

void chmax(ll &A, ll B) { A = max(A, B); }

struct Edge {
    Edge() {}
    Edge(int to_, int tm_, int lim_, int cost_) : to(to_), tm(tm_), lim(lim_), cost(cost_) {}
    int to, tm, lim, cost;
};
using Graph = vector< vector<Edge> >;

ll N, T, dp[650][10010];
int euler[650], dir[650];
Edge euler_edge[650];
int idx = 0;

void dfs(Graph &G, int cur, int par=-1) {
    euler[idx++] = cur;
    for(auto e : G[cur]) {
        int to = e.to;
        if(to == par) continue;
        euler_edge[idx] = e;
        dir[idx] = 0;
        dfs(G, to, cur);
        euler_edge[idx] = e;
        dir[idx] = 1;
        euler[idx++] = cur;
    }
}

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

    Graph G(N);
    for(int i=0; i<N-1; i++) {
        int a, b, t, m, v; cin >> a >> b >> t >> m >> v;
        a--; b--;
        G[a].push_back(Edge{b, t, m, v});
        G[b].push_back(Edge{a, t, m, v});
    }
    dfs(G, 0);

    /*
    for(int i=0; i<idx; i++) {
        printf("%d (%d), ", euler[i], euler_edge[i].cost);
    }
    cout << endl;
    */

    vector<int> pre(N, -1);
    fill(dp[0], dp[650], -(1LL << 60));
    // for(int i=0; i<idx; i++) dp[i][0] = 0;
    dp[0][0] = pre[0] = 0;
    for(int i=1; i<idx; i++) {
        int prev_idx = pre[ euler[i] ];

        int tm = euler_edge[i].tm;
        int lim = euler_edge[i].lim;
        int cost = euler_edge[i].cost;

        for(int t=0; t<=T; t++) {
            if(prev_idx >= 0) chmax(dp[i][t], dp[prev_idx][t]);
        }

        if(dir[i] == 1) {
            // 帰り
            for(int t=0; t<=T; t++) {
                chmax(dp[i][t], dp[i-1][t]);
            }
        }
        else {
            // 行き
            if(lim % 2 == 1) {
                ll take_tm = (lim + 1) * tm, take_cost = lim * cost;
                for(int t=take_tm; t<=T; t++) {
                    chmax(dp[i][t], dp[i-1][t - take_tm] + take_cost);
                }
                lim--;
            }

            if(lim == 0) {
                ll take_tm = 2 * tm;
                for(int t=take_tm; t<=T; t++) {
                    chmax(dp[i][t], dp[i-1][t - take_tm]);
                }
            }
            else {
                lim -= 2;
                for(int m=2; lim>0; m*=2) {
                    ll x = min(lim, m); lim -= x;
                    ll take_tm = x * tm, take_cost = x * cost;
                    for(int t=T; t>=take_tm; t--) {
                        chmax(dp[i-1][t], dp[i-1][t - take_tm] + take_cost);
                    }
                }

                ll take_tm = 2 * tm, take_cost = 2 * cost;
                for(int t=take_tm; t<=T; t++) {
                    chmax(dp[i][t], dp[i-1][t - take_tm] + take_cost);
                }
            }
        }

        /*
        for(int t=0; t<=T; t++) {
            if(dp[i][t] < 0) cout << "-INF" << " ";
            else cout << dp[i][t] << " ";
        }
        cout << endl;
        */
        
        pre[ euler[i] ] = i;
    }
    cout << *max_element(dp[idx-1], dp[idx-1] + T + 1) << endl;
    return 0;
}


Measured memory_bytes: 53980
N,A,B = input().split()

if int(A) == 0:
    print('0')
else:
    k = (int(N)//(int(A)+int(B))) * int(A) 
    if int(N)%(int(A) + int(B)) >= int(A):
        k = k + int(A)
    else:
        k = k + int(N)%(int(A) + int(B))
    print(str(k))

Measured memory_bytes: 3060
N,K = map(int,input().split())
a = list(map(int, input().split()))

import itertools
import sys
list_n = itertools.combinations(range(N),K)
ans = 1000000000000000
for i_list in list_n:#i_list は見ることのできるようにする建物のインデックスのリスト
    a_i = a.copy()
    cost = 0
    for index in i_list:
        if not index == 0:
            m_index = max(a_i[:index])
        else:
            m_index = 0
        if m_index >= a_i[index]:
            cost += m_index - a_i[index] + 1
            #print(m_index - a_i[index] + 1)
            a_i[index] = a_i[index] + m_index - a_i[index] + 1   
    ans = min(ans, cost)
    
print(ans)

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

int main(){
    int a, b;
    cin >> a >> b;
    int s = a - 1;
    int t = b - 1;
    int ans = (t + s - 1)/s;
    cout << ans << endl;
   return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include <sstream> // std::stringstream
#include <istream> // std::getline

using namespace std;


int main(){
  string s;
  cin >> s;
  vector<string> v;

stringstream ss{s};

string buf;
string answer;
int a;
  while (getline(ss, buf, '/')) {
    v.push_back(buf);
    //cout << buf << endl;
    
  }
  for(int i = 0; i < v.size(); ++i){
    answer += v[i];
    //cout << v[i] << endl;
  }
  a = atoi(answer.c_str());
  
  if(a <= 20190430){
    cout << "Heisei" << endl;
    
  }else{
    cout << "TBD" << endl;
    
    
  }
}

Measured memory_bytes: 888