akhauriyash/Code-Regression huggingface dataset:
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

char stribuf[300100];
uint32_t stribufl;

#define getchar_unlocked() stribuf[stribufl++]
uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }

int main(void){
	read(0, stribuf, sizeof(stribuf));
	uint32_t n=nextpint();
	uint32_t a=nextpint();
	uint32_t b=nextpint();
	uint32_t c=nextpint();
	char (*s)[3]=(void*)stribuf+stribufl;
	if((uint64_t)a+b+c==0){
		puts("No");
	}else if((uint64_t)a+b+c==1){
		int8_t m[3]={a,b,c};
		for(uint32_t i=0; i<n; i++){
			char a=s[i][0]-'A', b=s[i][1]-'A';
			if(0){
			}else if(m[a]!=0){
				m[a]--;
				m[b]++;
				s[i][0]=s[i][1];
			}else if(m[b]!=0){
				m[b]--;
				m[a]++;
				s[i][0]=s[i][0];
			}else{
				puts("No");
				return 0;
			}
		}
		puts("Yes");
		for(uint32_t i=0; i<n; i++){
			putchar_unlocked(s[i][0]);
			putchar_unlocked(10);
		}
	}else{
		uint32_t m[3]={a,b,c};
		if(m[s[0][0]-'A']==0 && m[s[0][1]-'A']==0){
			puts("No");
		}else{
			puts("Yes");
			for(uint32_t i=0; i<n; i++){
				char a=s[i][0]-'A', b=s[i][1]-'A';
				char c=3-a-b;
				if(m[a]==0){
					m[a]++;
					m[b]--;
					putchar_unlocked(s[i][0]); putchar_unlocked(10);
				}else if(m[b]==0){
					m[b]++;
					m[a]--;
					putchar_unlocked(s[i][1]); putchar_unlocked(10);
				}else if(m[c]==0){
					if(m[a]==1 && m[b]==1 && i+1<n){
						if(s[i][0]=='A'){
							if(s[i+1][0]==s[i][0]){
								m[a]++;
								m[b]--;
								putchar_unlocked(s[i][0]); putchar_unlocked(10);
							}else{
								m[b]++;
								m[a]--;
								putchar_unlocked(s[i][1]); putchar_unlocked(10);
							}
						}else{
							if(s[i+1][1]==s[i][1]){
								m[b]++;
								m[a]--;
								putchar_unlocked(s[i][1]); putchar_unlocked(10);
							}else{
								m[a]++;
								m[b]--;
								putchar_unlocked(s[i][0]); putchar_unlocked(10);
							}
						}
					}else if(m[a]==1){
						m[a]++;
						m[b]--;
						putchar_unlocked(s[i][0]); putchar_unlocked(10);
					}else{
						m[b]++;
						m[a]--;
						putchar_unlocked(s[i][1]); putchar_unlocked(10);
					}
				}else{
					m[b]++;
					m[a]--;
					putchar_unlocked(s[i][1]); putchar_unlocked(10);
				}
			}
		}
	}
}


Measured memory_bytes: 1784
import java.util.*;
import java.io.PrintWriter;
import java.math.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		for(int i=0; i<n;i++){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		if(n%2==0){
			System.out.println(b[n/2-1]+b[n/2]-(a[n/2-1]+a[n/2])+1);
		}else{
			System.out.println(b[n/2]-a[n/2]+1);
		}
	}
}


Measured memory_bytes: 61440
#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;

    ll N,t[200010],T;
    ll ans,ns;
    double a,b,c,d,e,f,sum=0;
    bool fir=true;

int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>T;
    REP(i,N)cin>>t[i];
    REP(i,N){
        if(i==N-1)ans+=T;
        else{
            ans+=min(t[i+1]-t[i],T);
        }
    }

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		int ans = Math.min(b, d) - Math.max(a, c);
		System.out.println(ans > 0 ? ans : 0);
		sc.close();
	}
}

Measured memory_bytes: 21588
#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(){
    string s;
    cin >> s;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) cout << "Bad" << endl;
    else cout << "Good" << endl;
    return 0;
}

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

int main(){
    double N,T,A,MIN=999999999;
    double t;
    int H;
    int ans;

    cin >>N>>T>>A;
    for (int i = 0; i < N; i++){
        cin >> H;

        t=T-(double)(H*0.006);
        
        if(fabs(t-A)<MIN){
            MIN=fabs(t-A);
            ans=i+1;
        }
    
    }
    
    
    //cout << ans <<endl;
    cout << ans <<endl;
    
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
sc = [tuple(map(int, input().split())) for _ in range(M)]
f = [0] * N
ans = ['0'] * N
for s, c in sc:
  if (f[s - 1] and ans[s - 1] != str(c)) or (N != 1 and s == 1 and c == 0):
    print(-1)
    exit()
  else:
    ans[s - 1] = str(c)
    f[s - 1] = 1
    
if N != 1 and ans[0] == '0':
  ans[0] = '1'
print(''.join(ans))

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

int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

int main(void){

  long n,x;
  scanf("%ld %ld", &n, &x);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  qsort(a, n, sizeof(long), cmpnum);
  long sum = 0;
  long child = 0;
  for (long i = 0; i < n-1; i++) {
    sum += a[i];
    if (sum > x) {
      break;
    }
    child++;
  }
  if (sum+a[n-1] == x) {
    child++;
  }
  printf("%ld\n", child);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#define endl "\n"
typedef long long ll;

using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

int  frq[200];
int main(){
	Lancer();
	//cout << fixed << setprecision(12);

	ll n;
	bool ch = false;
	cin >> n;
	while (n)
	{
		if (n % 10 == 7)
			ch = true;
		n /= 10;
	}
	cout << (ch == true ? "Yes" : "No");
	cout << endl;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;

int ctoi(char c) {
	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

int main(){

    int count;
    long n;
    int amari;
    int length;

    char str[1000];
    
    while(1){
        //scanf("%ld", &n);
        scanf("%s", str);
        //printf("%s\n", str);
        length = strlen(str);
        //printf("length : %d\n", length);
        count = 0;
        amari = 0;
        //printf("n : %ld\n", n);
        if(str[0] == '0'){
            break;
        }
        else{
            for(int i = 0; i < length; i++){
                int kazu = ctoi(str[i]);
                count = count + kazu;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}


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

const ll MOD = 1000000007;
int n;
ll a[10101];
map<ll, int> pmf;

map<long long int, int > prime_factor(long long int n) {
    map<long long int , int > ret;
    for(long long int i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

long long modinv(long long a) {
  long long b = MOD, u = 1, v = 0;
  while(b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= MOD;
  if (u < 0) u += MOD;
  return u;
}

int main()
{
    cin >> n;
    rep(i, n)
    {
        cin >> a[i];
        for(auto x : prime_factor(a[i]))
        {
            pmf[x.first] = max(pmf[x.first], x.second);
        }
    }

    ll l = 1;
    for(auto x : pmf)
    {
        rep(i, x.second)
        {
            l *= x.first;
            l %= MOD;
        }
    }
    
    ll res = 0;
    rep(i, n)
    {
        res += (l * modinv(a[i])) % MOD;
        res %= MOD;
    }
    cout << res << endl;

    
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int N;
	unsigned long long MOD = 1000000007;
	int DP[1000];
	unsigned long long div=1;
	int d;
	for(int i=0;i<1000;i++)
	{
		DP[i]=0;
	}
	cin >> N;
	for(int i=2;i<N+1;i++)
	{
		d = i;
		for(int j=2;j<1000;j++)
		{
			while(d%j==0)
			{
				DP[j]++;
				d = d/j;
			}
			if(d==1)
			{
				break;
			}
		}
	}

	for(int i=0;i<1000;i++)
	{
		div *= (unsigned long long)(DP[i]+1);
		div = div % MOD;
	}
	
	/*for(int i=0;i<992;i++)
	{
		cerr << DP[i] << " ";
	}*/
	cout << div << endl;
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

template<typename T>
bool is_prime(T x)
{
    if (x <= 1)
        return false;
    for (T i = 2; i*i <= x; i++) {
        if (x%i == 0) return false;
    }
    return true;
}

int main()
{
    long long X; cin >> X;
    while (true) {
        if (is_prime(X)) {
            cout << X << endl;
            return 0;
        }
        ++X;
    }
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vll v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  int m;
  ll k;
  cin >> m >> k;
  vll a(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    a[i]--;
  }
  vll A(n - 1);
  for (int i = 0; i < n - 1; i++)
    A[i] = i;
  for (int i = 0; i < m; i++)
    swap(A[a[i] - 1], A[a[i]]);
  vll C(n - 1), B(n - 1);
  for (int i = 0; i < n - 1; i++)
    C[i] = B[i] = i;
  while (k) {
    if (k & 1) {
      C = B;
      for (int i = 0; i < n - 1; i++)
        B[i] = A[C[i]];
    }
    for (int i = 0; i < n - 1; i++)
      C[i] = A[A[i]];
    A = C;
    k >>= 1;
  }
  vll diff(n - 1);
  for (int i = 0; i < n - 1; i++)
    diff[i] = v[i + 1] - v[i];
  vll ans(n);
  ans[0] = v[0];
  for (int i = 0; i < n - 1; i++) {
    ans[i + 1] = ans[i] + diff[B[i]];
  }
  for (int i = 0; i < n; i++)
    cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll N, E;
ll dist[15][15];
ll dp[1<<15][15];

ll rec(ll s, ll v) {
    if (dp[s][v] != -1) return dp[s][v];
    if (s == (1<<N)-1 && v == 0) return dp[s][v];

    ll res = INF;
    rep(u, N) {
        if (!(s>>u&1) && dist[v][u] != -1) chmin(res, rec(s | 1<<u , u) + dist[v][u]);
    }
    return dp[s][v] = res;
}

int main() {
    memset(dist, -1, sizeof(dist));
    memset(dp, -1, sizeof(dp));

    cin >> N >> E;
    rep(i, E) {
        ll s, t, d;
        cin >> s >> t >> d;
        dist[s][t] = d;
    }

    dp[(1<<N)-1][0] = 0;
    ll ans = rec(0, 0);
    if (ans >= INF) cout << -1 << endl;
    else cout << ans << endl;
}



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

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

using namespace std;

int main() {
  int a, b;
  while(scanf("%d%d", &a, &b) != EOF) {
    cout << (a+b) << endl;
  }
  return 0;
}

Measured memory_bytes: 3104
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y


S = input()
arr = ['SUN','MON','TUE','WED','THU','FRI','SAT']
idx=arr.index(S)
print(7 - idx)


Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define MAX 1000000
#define mo 1000000007 
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

bool prime[MAX + 1]; 
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
  
    prime[1] = false; 
  
    for (int p = 2; p * p <= MAX; p++) { 
  
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) { 
  
            // Set all multiples of p to non-prime 
            for (int i = p * 2; i <= MAX; i += p) 
                prime[i] = false; 
        } 
    } 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll modexp(ll x, ll y, ll p)
{
ll res = 1;   
x = x % p;  
    while (y > 0)
    {
        if (y & 1)    
            res = (res*x) % p;
        y = y>>1;     
        x = (x*x) % p; 
    }
    return res;
}
class gfg 
{ 
 public : ll gcd(ll a, ll b)  
 {  
    // Everything divides 0  
    if (a == 0 || b == 0)  
        return 0;  
   
    // Base case     
    if (a == b)  
        return a;  
   
    // a is greater  
    if (a > b)  
        return gcd(a-b, b);  
    return gcd(a, b-a);  
 } 
  
   
// Function to return LCM of two numbers  
  ll lcm(ll a, ll b)  
 {  
    return (a*b)/gcd(a, b);  
 }  
} ;
ll mypow(ll b, ll e) {
    ll ans=1; for(;e;b=b*b%mo,e/=2) if(e&1) ans=ans*b%mo; return ans;}
ll power2(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y % 2 == 0) 
        return power2(x, y / 2) * power2(x, y / 2); 
    else
        return x * power2(x, y / 2) * power2(x, y / 2); 
} 
ll mod=100000000;
#define MAXN 100001
ll spf[MAXN]; 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s,c;
	cin>>s;
	cin>>c;
	ll l1=s.length();ll l2=c.length();
	ll dp[l1+1][l2+1];
	rep(i,l1+1)
	{
		rep(j,l2+1)
		{
			if(i==0 || j==0)
			dp[i][j]=0;
			else if(s[i-1]==c[j-1])
			dp[i][j]=dp[i-1][j-1]+1;
			else
			{
				if(dp[i-1][j]>=dp[i][j-1])
				dp[i][j]=dp[i-1][j];
				else
				dp[i][j]=dp[i][j-1];
			}
		}
	}
	string ans="";
	ll i=l1;ll j=l2;
	while(i!=0 && j!=0)
	{
		if(s[i-1]==c[j-1])
		{
			ans=s[i-1]+ans;
			i--;
			j--;
		}
		else if(dp[i-1][j]>=dp[i][j-1])
		i--;
		else
		j--;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 70784
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    char c;
    cin >> c;
    if ( c>='A' and c<='Z' ){
        printf("A");
    }
    else{
        printf("a");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3616
h,w = map(int, input().split())
sl = [list(input()) for _ in range(h)]

dp = [[0]*w for _ in range(h)]

for hi in range(h):
    for wi in range(w):
        if hi==0 and wi==0:
            continue
        dh = 10**9
        if hi-1>=0:
            if sl[hi][wi]=="#" and sl[hi-1][wi]==".":
                dh = dp[hi-1][wi] + 1
            else:
                dh = dp[hi-1][wi]
        dw = 10**9
        if wi-1>=0:
            if sl[hi][wi]=="#" and sl[hi][wi-1]==".":
                dw = dp[hi][wi-1] + 1
            else:
                dw = dp[hi][wi-1]

        dp[hi][wi] = min(dh,dw)

res = dp[h-1][w-1]
if sl[0][0]=="#":
    res += 1
print(res)

Measured memory_bytes: 3188
def main():
    C = []
    for _ in range(2):
        C.append(list(input()))

    S = []
    hoge = []
    for x in reversed(range(3)):
        hoge.append(C[1][x])
    S.append(hoge)
    hoge = []
    for x in reversed(range(3)):
        hoge.append(C[0][x])
    S.append(hoge)

    if S == C:
        print("YES")
    else:
        print("NO")
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import sys
import random
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 文字列アルゴリズム
# RollingHash
# ローリングハッシュ

# 64bit 溢れないように
class RollingHash:
    MASK30 = (1 << 30) - 1
    MASK31 = (1 << 31) - 1
    MOD = (1 << 61) - 1
    POSITVIZER = MOD * ((1 << 3) - 1)

    def __init__(self, S):
        # 事前計算
        Base = random.randrange(129, (1 << 61) - 1)
        self.Base = Base

        L = len(S)
        powMemo = [0] * (L + 1)
        rhash = [0] * (L + 1)

        powMemo[0] = 1
        for i in range(1, L + 1):
            powMemo[i] = self.calcMod(self.Mul(powMemo[i - 1], Base))

        for i in range(L):
            rhash[i + 1] = self.calcMod(self.Mul(rhash[i], Base) + ord(S[i]))

        self.powMemo = powMemo
        self.rhash = rhash

    def getHash(self, begin, length):
        r = self.calcMod(
            self.rhash[begin + length]
            + self.POSITVIZER
            - self.Mul(self.rhash[begin], self.powMemo[length])
        )

        return r

    def Mul(self, l, r):
        lu = l >> 31
        ld = l & self.MASK31
        ru = r >> 31
        rd = r & self.MASK31
        middle = ld * ru + lu * rd

        return (
            ((lu * ru) << 1) + ld * rd + ((middle & self.MASK30) << 31) + (middle >> 30)
        )

    def calcMod(self, val):
        val = (val & self.MOD) + (val >> 61)
        if self.MOD <= val:
            val -= self.MOD
        return val


N = int(input())
S = input()

RH = RollingHash(S)


def check(n, RH):
    ret = False
    cnt = defaultdict(int)
    for i in range(0, N - n + 1):
        h = RH.getHash(i, n)

        if not cnt[h]:
            cnt[h] = i + 1
        else:
            f = cnt[h]
            if f + n <= i + 1:
                ret = True
                break

    return ret


l = 0  # OK
r = (N // 2) + 1  # NG

while (r - l) != 1:
    mid = (l + r) // 2
    if check(mid, RH):
        l = mid
    else:
        r = mid

print(l)


Measured memory_bytes: 46936
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<62;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,k;

int main(){
	cin>>n>>k;
	int res=1;
	for(int i=0;i<n;i++) res=min(res*2,res+k);
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}else if(a>b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2136
use proconio::{input, fastout};
use proconio::marker::{Chars};

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        h: usize,
        w: usize,
        // s: [Chars;h],
    }

    let mut s: Vec<Vec<char>> = vec![vec!['d';w+5];1];
    for i in 0..h {
        let mut add: Vec<char> = vec!['d';1];
        input!{
            s_tmp: Chars,
        }
        add.extend(s_tmp);
        add.push('d');
        debug!(add);
        s.push(add);
    }
    s.push(vec!['d';w+5]);
    for i in 0..h+2 {
        for j in 0..w+2 {
            if s[i][j]=='#' && s[i-1][j]=='.' && s[i][j-1]=='.' 
            && s[i][j+1]=='.' && s[i+1][j]=='.' {
                println!("No");
                debug!(i);
                debug!(j);
                return;
            }
        }
    }

    println!("Yes");
    
}


Measured memory_bytes: 2184
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n, k; cin >> n >> k;
	vector<ll> a(n), b(n);
	rep(i, n)cin >> a[i] >> b[i];
	ll res = 0;
	ll tmp = 0;
	rep(i, n)
	{
		if ((k | a[i]) == k)
		{
			tmp += b[i];
		}
	}
	res = tmp;
	rep(i, 31)
	{
		if (k < 1 << i)break;
		if (!(k&(1 << i)))continue;
		int mask = 0;
		rep(j, i)mask += 1 << j;
		int c = 0;
		rep(j, 31)if (i != j) c += 1 << j;
		c &= k;
		c |= mask;
		tmp = 0;
		rep(i, n)if ((c | a[i]) == c)tmp += b[i];
		res = max(res, tmp);
	}
	cout << res << endl;
}

Measured memory_bytes: 1920
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	int a,b;
	cin>>a>>b;
	cout<<6-a-b<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int s=n%10;
    if(s==2||s==4||s==5||s==7||s==9)
        cout<<"hon"<<endl;
    else if(s==0||s==1||s==6||s==8)
        cout<<"pon"<<endl;
    else if(s==3)
        cout<<"bon"<<endl;
    return 0;
}


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

using ll = long long;

int main() {
  int N;
  cin >> N;
  ll a[N], b[N];
  for (int i = 0; i < N; i++) scanf("%lld %lld", a + i, b + i);

  ll ans = 0;
  for (int i = N - 1; i >= 0; i--) {
    a[i] += ans;
    if (a[i] == 0) continue;
    if (a[i] < b[i]) {
      ans += b[i] - a[i];
    } else {
      if (a[i] % b[i] != 0) ans += (a[i] / b[i] + 1) * b[i] - a[i];
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;
ll INF = 1e10;

int main()
{
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(ALL(a));
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	return 0;
}



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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1<<12;
int dp[1005][mxn];
bitset<12>bs[1005];
int cost[1005],sz[1005];

void mins(int &a, int b){
	a = min(a,b);
	return;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n,m; cin >> n >> m;
	for(int i=1; i<=m; i++){
		int x;
		cin >> cost[i] >> sz[i];
		for(int j=0; j<sz[i]; j++){
			cin >> x; x--;
			bs[i][x]=1;
		}
	}
	for(int i=0; i<=m; i++)
		for(int j=0; j<(1<<n); j++)
			dp[i][j]=1e9;
	dp[0][0]=0;
	for(int i=1; i<=m; i++){
		ll now = bs[i].to_ulong();
		for(int j=0; j<(1<<n); j++){
			mins(dp[i][j],dp[i-1][j]);
			if(dp[i-1][j]!=1e9){
				ll cur = now|j;
				mins(dp[i][int(cur)],dp[i-1][j]+cost[i]);
			}
		}
	}
	if(dp[m][int(1<<n)-1]==1e9)dp[m][int(1<<n)-1]=-1;
	cout << dp[m][int(1<<n)-1] << '\n';
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 19608
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}
#define ll long long
ll gcd (ll a, ll b) {
    while (b > 0) {
        ll t = a % b;
        a = b, b = t;
    }
    return a;
}

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

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string t;
    cin >> t;
    int n = 0, s = 0, e = 0, w = 0;
    for (char c : t) {
        if (c == 'N') n = 1;
        if (c == 'S') s = 1;
        if (c == 'E') e = 1;
        if (c == 'W') w = 1;
    }
    if (n + s == 1 || e + w == 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}


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

L = []
R = []
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

ans = 0
l = max(L)
r = min(R)
for i in range(N):
    if i+1 >= l and i+1 <= r:
        ans += 1

print(ans)

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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}

int main()
{
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (a >= k)
    {
        cout << k << endl;
        return 0;
    }
    int a1 = k - a;
    if (a1 <= b)
    {
        cout << a << endl;
        return 0;
    }
    a1 = k - a - b;
    if (a1 >= c)
    {
        cout << a - c << endl;
        return 0;
    }
    else
        cout << a - (k - a - b) << endl;

    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 3792
#include <stdio.h>

int main(void){
  int n,i;
  scanf("%d",&n);
  for(i = 1; i <= n; i++){
    if(i % 10 == 3){
      printf(" %d",i);
    }
    else if(i % 3 == 0){
      printf(" %d",i);
    }
    else if(30 <= i % 100 && i % 100 <= 39){
      printf(" %d",i);
    }
    else if(300 <= i % 1000 && i % 1000 <= 399){
      printf(" %d",i);
    }
    else if(3000 <= i % 10000 && i % 10000 <= 3999){
      printf(" %d",i);
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2044
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		shellSort(a, n);
		printArrays(a, n);
	}

	public static int insertionSort(int a[], int n, int g) {
		int v, j = 0, cnt = 0;
		for (int i = g; i < n; i++) {
			v = a[i];
			j = i - g;
			while (j >= 0 && a[j] > v) {
				a[j + g] = a[j];
				j = j - g;
				cnt++;
			}
			a[j + g] = v;
		}
		return cnt;
	}

	public static void shellSort(int a[], int n) {
		int cnt = 0;
		ArrayList<Integer> b = new ArrayList<>();
		for (int h = 1;;) {
			if (h > n)
				break;
			b.add(h);
			h = 3 * h + 1;
		}
		int m = b.size();
		System.out.println(m);
		for (int i = m-1; i >0; i--) {
			System.out.print(b.get(i) + " ");
		}
		System.out.println(b.get(0));

		for (int i = m - 1; i >= 0; i--) {
			cnt += insertionSort(a, n, b.get(i));
		}
		System.out.println(cnt);
	}

	public static void printArrays(int a[], int n) {
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
}


Measured memory_bytes: 299648
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using i8  = std::int8_t;using i16 = std::int16_t;using i32 = std::int32_t;using i64 = std::int64_t;using u8  = std::uint8_t;using u16 = std::uint16_t;using u32 = std::uint32_t;using u64 = std::uint64_t;using f32 = float;using f64 = double;using vi32  = std::vector<i32>;using vu32 = std::vector<u32>;using vi64 = std::vector<i64>;using vu64 = std::vector<u64>;using vvi32 = std::vector<vi32>;using vvu32 = std::vector<vu32>;using vvi64 = std::vector<vi64>;using vvu64 = std::vector<vu64>;using pi32 = std::pair<i32,i32>;using pi64 = std::pair<i64,i64>;
#define FOR(i,a,b) for(i64 i=(a), i##_len=(b); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) for(i64 i=1LL; i<=static_cast<i64>(n); ++i)
#define RFOR(i,a,b) for(i64 i=(a), i##_len=(b); i>i##_len; --i)
#define RFORS(i,n) RFOR(i,n,0)

#define ALL(obj) (obj).begin(),(obj).end()
#define CLR(ar,val) memset(ar, val, sizeof(ar))
#define SZ(obj) (static_cast<i32>(obj.size()))
#define cauto const auto&
#define pb push_back
#define mp make_pair

const i32 dx[4]={1,0,-1,0};
const i32 dy[4]={0,1,0,-1};
const i32 INF32 = 0x3F3F3F3F;
const i64 INF64 = 0x3F3F3F3F3F3F3F3F;

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct IoSetup {
    IoSetup() {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
        std::cout << std::fixed << std::setprecision(10);
        std::cerr << std::fixed << std::setprecision(10);
    }
}iosetup;

template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first >> p.second;return is; }
template<typename A, typename B> std::ostream &operator<<(std::ostream &os, const std::pair<A, B>& p) { os << p.first << ' ' << p.second;return os; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for(T& in : v) is >> in; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) { for(i32 i = 0; i < SZ(v); i++) os << v[i] << (i+1 != SZ(v) ? " " : ""); return os; }

// input
i32 N;
i32 h[100010];
// dp table
i32 dp[100010];

void run() {
    using namespace std;
    // your code here
    cin >> N;
    REP(i,N) cin >> h[i];
    REP(i,100010) dp[i] = INF32;
    dp[0] = 0;
    for(int i = 1; i < N; i++) {
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if (i != 1) {
            chmin(dp[i], dp[i-2]+abs(h[i] - h[i-2]));
        }
    }
    cout << dp[N-1] << endl;
}

int main() {
    run();
}

Measured memory_bytes: 4428
#include<stdio.h>

int main()
{
	int N,i,j,res,t;
	for(;scanf("%d",&N),N;)
	{
		for(i=1,res=0;i<N;i++)
		{
			for(j=i,t=0;t<N;j++)
				t+=j;
			if(t==N)
				res++;
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 600
N,M=map(int,input().split())
data = [input().split() for i in range(N)] 
result=[]
for j in range(N):
    result=result+data[j][1:]
result=[int(s) for s in result]
ans=[x for x in result if result.count(x) == N]
print(int(len(ans)/N))


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int len = s.size();
    int cnt0=0,cnt1=0;
    for(int i=0;i<len;i++){
        if(s[i]=='0')cnt0++;
        else if(s[i]=='1')cnt1++;
    }
    cout <<min(cnt0,cnt1)*2<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

int main() {
  int n, m, a, b;
  cin >> n >> m;
  vector<vector<int>> g(n);
  rep(i, 0, m) {
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> ans(n);
  queue<int> q;
  q.push(0);
  while (q.size()) {
    int v = q.front();
    q.pop();
    for (int nv : g[v]) {
      if (ans[nv] == 0) {
        ans[nv] = v + 1;
        q.push(nv);
      }
    }
  }
  cout << "Yes" << '\n';
  rep(i, 1, n) cout << ans[i] << '\n';
  return 0;
}


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


ans = N
for i in range(N+1):
    cc = 0
    t = i
    while t > 0:
        cc += t % 6
        t //= 6

    t = N-i
    while t > 0:
        cc += t % 9
        t //= 9

    if ans > cc:
        ans = cc

print(ans)

Measured memory_bytes: 3060
from math import gcd
import sys
si = sys.stdin.readline

# def gcd(u, v):
#     if v:
#         return gcd(v, u % v)
#     else:
#         return u


def main():
    k = int(si())
    cnt = 0
    for p in range(1, k+1):
        for q in range(1, k+1):
            for r in range(1, k+1):
                cnt += gcd(p, gcd(q, r))
    print(cnt)


if __name__ == '__main__':
    main()


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

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

int main(){
  int n, x;
  cin >> n >> x;
  int ans;
  for(int i=0; i<n; ++i){
    int nx;
    cin >> nx;
    nx = abs(nx - x);
    if(i==0) ans = nx;
    else ans = gcd(ans, nx);
  }
  cout << ans << endl;
}

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

namespace AtCoder.Contest.A
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			var cin = new Scanner();

			string s = cin.Next();
            if (int.Parse(s.Substring(5, 2)) > 4) Console.WriteLine("TBD");
            else Console.WriteLine("Heisei");

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 11092
fn main() {
    let (n, w): (usize, usize) = (read::<usize>(), read::<usize>());
    let mut ww: Vec<usize> = vec![];
    let mut vv: Vec<usize> = vec![];
    for i in 0..n {
        ww.push(read());
        vv.push(read());
    }
    // [そこまでの個数][キャパ残り]
    let mut dp: Vec<Vec<usize>> = vec![vec![0; w + 1]; n + 1];
    for i in 1..n + 1 {
        //　i-1を入れる入れない
        // jは重さ
        for j in 0..w + 1 {
            // 入らない
            if j + ww[i - 1] > w {
                dp[i][j] = max(dp[i - 1][j], dp[i][j]);
            } else {
                // 入れる
                dp[i][j + ww[i - 1]] = max(dp[i - 1][j] + vv[i - 1], dp[i][j + ww[i - 1]]);
                // いれない
                dp[i][j] = max(dp[i - 1][j], dp[i][j]);
            }
        }
    }
    let mut ans = 0;
    for i in 0..w + 1 {
        ans = max(dp[n][i], ans);
    }
    println!("{}", ans);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: isize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 106748
use std::io;
use std::collections::VecDeque;

fn main() {
    if true {
        let mut input = Input::new();
        let H: usize = input.next();
        let W: usize = input.next();
        let h: usize = input.next();
        let w: usize = input.next();
        let (ok, b) = solve(H, W, h, w);
        if ok {
            println!("Yes");
            for i in 0..H {
                for j in 0..W {
                    print!(" {}", b[i][j]);
                }
                println!("");
            }
        } else {
            println!("No");
        }
    } else {
        for H in 1..10 {
            for W in 1..10 {
                for h in 1..H {
                    for w in 1..W {
                        let (ok, _) = solve(H, W, h, w);
                        println!("{} {} {} {} {}", H, W, h, w, ok);
                    }
                }
            }
        }
    }
}

fn solve(H: usize, W: usize, h: usize, w: usize) -> (bool, Vec<Vec<i32>>) {
    let mut b = vec![vec![1000 as i32; W]; H];
    for i in 1..H / h + 1 {
        for j in 1..W / w + 1 {
            b[i * h - 1][j * w - 1] = (h as i32 * w as i32 - 1) * -1000 - 1;
        }
    }
    let mut sum = 0;
    for i in 0..H {
        for j in 0..W {
            sum += b[i][j];
        }
    }
    return (sum >= 0, b);
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



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

#define rep(i, n) for (int i = 0; i < n; i = i + 1)
#define MAX 10010
#define MAX_INT 9223372036854775807
#define array(N, t) (t*)calloc(N, sizeof(t))

int main() {
  int N;
  scanf("%d", &N);

  int * A = array(N, int);
  rep(i, N) {
    scanf("%d", A + i);
  }

  long long amount = 1000;

  rep(i, N - 1) {
    int stock_price_on_that_day = A[i];
    int stock_price_on_the_next_day = A[i + 1];

    if (stock_price_on_that_day < stock_price_on_the_next_day) {
      // quotient
      long long number_of_shares = amount / stock_price_on_that_day;
      // mod
      amount %= stock_price_on_that_day; // The amount of money left over from the sale.
      long long next_day_earnings = number_of_shares * stock_price_on_the_next_day;
      amount += next_day_earnings;
    }
  }

  printf("%lld\n", amount);

  free(A);
  return 0;
}


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

using namespace std;

const int NMAX = 100000;

typedef long long I64;

int main()
{
    I64 A,B,C,X,Y;
    cin >> A >>B >> C >> X >> Y;
    I64 best = (1LL << 61);
    for( int comb = 0;  comb <= 200000;  comb += 2 ) {
        int x = X - comb / 2;
        int y = Y - comb / 2;
        x = max(x, 0);
        y = max(y, 0);
        I64 cost = 1LL * comb * C + 1LL * A * x + 1LL * B * y;
        best = min(best, cost);
    }
    cout << best << '\n';
    return 0;
}


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

int main() {
	int n, w; cin >> n >> w;
	vector<int>wg(n), v(n);
	for (int i = 0; i < n; i++)cin >> wg[i] >> v[i];
	long long x = wg[0];
	for (auto&& xx : wg)xx -= x;
	vector<vector<vector<long long >>>dp(n + 1, vector<vector<long long>>(200, vector<long long>(n + 1, 0)));
	for (int i = 0; i < n; i++)for (int j = 0; j < 200; j++)for (int k = 0; k < i + 1; k++) {
		dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
		if (j >= wg[i])dp[i + 1][j][k + 1] = max(dp[i + 1][j][k + 1], dp[i][j - wg[i]][k] + v[i]);
	}
	long long ans = 0;
	for (int i = 0; i < 200; i++)for (int j = 0; j < n + 1; j++) {
		if (i + j * x <= w)ans = max(ans, dp[n][i][j]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
using namespace std;
 
#define rint register int
inline int read(){int r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;}
bool g[705][705], book[705], bel[705]; vector<int> A, B; int c[2], n, m, Ans = 0x3f3f3f3f; bool f[705][705];
void DFS(int p, int f){++c[f]; bel[p] = f; book[p] = true; for(int i = 1; i <= n; i++) if(g[p][i]){if(!book[i])DFS(i,f^1);else if(bel[i]==f){puts("-1");exit(0);}}}
int main()
{
	n = read(); m = read(); for(rint i = 1, a, b; i <= m; a = read(), b = read(), g[a][b] = g[b][a] = 1, i++); for(rint i = 1, j; i <= n; i++) for(j = 1; j <= n; i^j?g[i][j]^=1:0, j++);
	A.push_back(0); B.push_back(0); for(rint i = 1; i <= n; i++) if(!book[i]){c[0] = c[1] = 0; DFS(i,0); A.push_back(c[0]); B.push_back(c[1]);} f[0][0] = 1;
	for(rint i = 1, j; i < A.size(); i++) for(j = 0; j <= n; f[i][j] = (j>=A[i]?f[i-1][j-A[i]]:0)||(j>=B[i]?f[i-1][j-B[i]]:0), j++);
	for(rint i = 0; i <= n; i++) if(f[A.size()-1][i]) Ans = min(Ans,(i*~-i>>1)+((n-i)*(n-i-1)>>1)); return !printf("%d\n",Ans);
}

Measured memory_bytes: 1280