akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int H,W,A,B;
cin >> H >> W >> A >> B;

vvi fi(H,vi(W,0));
rep(h,H) {
    rep(w,W) {
        if((h < B && w < A) || (h >= B && w >= A)) fi[h][w] = 1;
        cout << fi[h][w];
    }
    cout << endl;
}

return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    int n;
    cin >> n;
    map<int, int> m;
    rep(i, n)
    {
        int a;
        cin >> a;
        m[a]++;
        m[a] = m[a] % 2;
    }
    int ans = 0;
    for (auto &i : m)
    {
        ans += i.second;
    }
    cout << ans << endl;

    return 0;
}

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

int main()
{    
   int k,x;
   cin >> k >> x;

   if(500 * k >= x) cout << "Yes" << endl;
   else  cout << "No" << endl;
}

Measured memory_bytes: 256
x, n = gets.split.map(&:to_i)
N = gets.split.map(&:to_i)
flag = true
count = 0
answer = x
while flag do
    x_down = x - count
    x_up = x + count
    if !N.include?(x_down)
        answer = x_down
        flag = false
    elsif !N.include?(x_up)
        answer = x_up
        flag = false
    end
    count += 1
end
puts answer

Measured memory_bytes: 14392
import bisect
n = int(input())
d = list(map(int,input().split()))
d.sort()
l = [0,24]
for i in range(n):
    if i % 2 == 0:
        l.append(24-d[i])
    else:
        l.append(d[i])
l.sort()
ans = l[1]-l[0]
for i in range(n+1):
    if l[i+1] - l[i] < ans:
        ans = l[i+1] - l[i]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;

int main(){

    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];

    sort(A.begin(), A.end(), greater<int>());

    cout << 10*A[0] + A[1] + A[2] << endl;

}

Measured memory_bytes: 888
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
dij = [(1, 0), (-1, 0), (0, 1), (0, -1)]

def LcpByZ(target):
    len_t = len(target)
    lcp = [-1] * len_t
    top = 1  # 右の箱において、左の箱の0に対応する点
    left = 0  # 左の箱の左端(本当はここでので宣言は不要だけど理解の為)
    right = 0  # 左の箱の右端
    lcp[0] = 0
    while top < len_t:
        # 箱を右に広げていく
        while top + right < len_t and target[right] == target[top + right]:
            right += 1
        # 右の箱左端のlcpを記録
        lcp[top] = right
        left = 1
        # 箱の幅が0だったらtopを動かして、このターン終了
        if right == 0:
            top += 1
            continue
        # lcpを記録しながら箱を左に縮めていく（最初の条件重要）
        while left + lcp[left] < right and left < right:
            lcp[top + left] = lcp[left]
            left += 1
        # topを右の箱の左端にして、左の箱を0まで戻す
        top += left
        right -= left
        left = 0  # これも本当は不要
    return lcp

def main():
    n=II()
    s=SI()
    ans=0
    for i in range(n):
        lcp=LcpByZ(s[i:])
        for j in range(len(lcp)):
            if lcp[j]>ans and j>=lcp[j]:ans=lcp[j]
    print(ans)

main()


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

int main() {
    string s;
    while (cin >> s, s != "0") {
        int a = 0, b = 0;
        for (int i=1; i<(int)s.size(); ++i) {
            if (s[i] == 'A') a ++;
            else b ++;
        }
        if (b < a) a ++;
        else b ++;
        cout << a << " " << b << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

const int MAXN = 100005;

int n, q, a[MAXN];

ll pre2[MAXN], suf[MAXN];

int main () {
    scanf("%d%d", &n, &q);
    fto(i, 1, n) scanf("%d", &a[i]);

    pre2[1] = a[1];
    fto(i, 2, n)
        pre2[i] = pre2[i-2] + a[i];

    fdto(i, n, 1)
        suf[i] = suf[i+1] + a[i];

    fto(i, 1, q) {
        int x; scanf("%d", &x);

        ll lo = 0, hi = 2000000000;
        int resL = n+1, resR = n;
        while (lo <= hi) {
            ll mid = (lo + hi)/2;

            int l = x - (mid+1)/2, r = x + mid/2;
            int posL = lower_bound(a+1, a+n+1, l) - a;
            int posR = upper_bound(a+1, a+n+1, r) - a - 1;
            int k = posR - posL + 1;

            if (n - k >= posR) {
                lo = mid + 1;
                resL = posL;
                resR = posR;
            } else
                hi = mid - 1;
        }

        ll ans = suf[resR + 1];

        int k = resR - resL + 1;
        if (n - k == resR)
            ans += pre2[resL-1];
        else if (resL > 1)
            ans += pre2[resL-2];

        printf("%lld\n", ans);
    }

    return 0;
}


Measured memory_bytes: 3712
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

i = 0
point = 0
while i < len(A):
    point += B[A[i]-1]
    if i != 0 and A[i-1] + 1 == A[i]:
        point += C[A[i-1]-1]
    i += 1
print(point)


Measured memory_bytes: 3064
#include <bits/stdc++.h> 
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(long long int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
using namespace std;
signed main() 
{
    fast
    ll t=1;
    //cin>>t;
    while(t--)
    {
           string s;
           cin>>s;
           ll c[4]; c[0]=0;
           for(ll i=0;i<3;i++)
           {
               if(s[i]=='R') c[i+1]=c[i]+1;
               else c[i+1]=0;
           }
           cout<<max(c[2],max(c[1],c[3]))<<"\n";
    }
}

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

int main(){
    int n, d, x;
    cin >> n >> d >> x;

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

    int ans = 0;
    for(int i=0;i<n;i++){
        ans += d/a[i];
        if(d%a[i] != 0)ans++;
    }
    ans += x;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

int main() {
    int D, G;
    cin >> D >> G;
    G /= 100;
    vector<int> p(D), c(D);
    rep(i, D) {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }
    int ans = 1000;
    rep(i, 1 << D) {
        int s = 0, t = 0;
        rep(j, D) {
            if ((i >> j) & 1) {
                s += (j + 1) * p[j] + c[j];
                t += p[j];
            }
        }
        if (s >= G) {
            ans = min(ans, t);
            //cout << "i=" << i << " ans=" << ans << endl;
        } else {
            rep(j, D) {
                int k = D - 1 - j;
                if ((i >> k) & 1) continue;
                int a = min(p[k], (G - s + k) / (k + 1));
                s += (k + 1) * a;
                t += a;
                if (s >= G) {
                    ans = min(ans, t);
                    //cout << "i=" << i << " j=" << j << " ans=" << ans << endl;
                }
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
int main () {
    int n ;
    string s;
    cin >> n ;
    cin >> s ;
    int ans = 0;
    rep(i,n - 2){
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C'){
            ans++ ;
        }
    }
    cout << ans << endl;
}



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

int main(){
	int n, m;
	int field[1001];
	int dice[1001];
	int location;
	int times;

	while(cin >> n >> m, n || m){
		location = 1;
		times = 0;
		for(int i=1; i <= n; i++) cin >> field[i];
		for(int i=1; i <= m; i++) cin >> dice[i];

		while(location < n){
			times++;
			location += dice[times];
			if(n <= location) break;
			location += field[location];
		}
		cout << times << endl;
	}
}

Measured memory_bytes: 1164
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
using namespace std;

int INF = 1e9 + 7;

typedef long long ll;
typedef pair<int, int> P;

int main() {
	double a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;

	double MAX = 0;
	int ans1 = 100*a, ans2 = 0;
	for (int i = 0; i*a*100 <= f; i++) {
		for (int j = 0; i*a*100 + j*b*100 <= f; j++) {
			for (int k = 0; i*a*100 + j*b*100 + k*c <= f; k++) {
				for (int l = 0; i*a*100 + j*b*100 + k*c + l*d <= f; l++) {
					if ((a*i + b*j)*e < k*c + l*d) continue;
					if ((k*c + l*d) / (i*a*100 + j*b*100 + k*c + l*d) >= MAX) {
						MAX = (k*c + l*d) / (i*a*100 + j*b*100 + k*c + l*d);
						ans1 = i*a*100 + j*b*100 + k*c + l*d, ans2 = k*c + l*d;
					}
				}
			}
		}
	}
	cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
long long c[100005];
int main()
{
	long long k;
	long long n,i,a,b;
	cin >> n >> k;
	for(i=0; i<n; i++)
	{
		cin >> a >> b;
		c[a]+=b;
	}
	for(i=1; i<=100000; i++)
	{
		k-=c[i];
		if(k<=0)
		{
			cout << i;
			break;
		}
	}
}



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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

bool is_kaibun(string s) {
  int n = s.size();
  REP(i, n / 2) {
    if (s[i] == s[n - 1 - i]) {
      continue;
    } else {
      return false;
    }
  }
  return true;
}

bool is_strong_kaibun(string s) {
  int n = s.size();
  bool flag1 = is_kaibun(s);
  if (!flag1) {
    return false;
  }
  bool flag2 = is_kaibun(s.substr(0, n / 2));
  bool flag3 = is_kaibun(s.substr(n / 2 + 1));

  return flag2 && flag3;
}

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

  if (is_strong_kaibun(s)) {
    ANS("Yes");
  } else {
    ANS("No");
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int n;
    cin>>n;
    int b=1;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    for(int i=1;i<100002;i++){
    b=a[b-1];
    if(b==2){
        cout<<i;
        return 0;
    }
    }
    cout<<-1;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const long long INF=2E10;

int nino(int a){
    int ret =0;
    while(a%2==0 && a!=0){
        ret++;
        a/=2;
    }

    return ret;
}

int main(){
   int N;
   cin >> N;
   int ans=0;
   int A;
   for(int i=0;i<N;i++){
       cin >> A;
       ans+=nino(A);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll q,h,s,d;cin>>q>>h>>s>>d;
    ll n;cin>>n;
    ll one=min(q*4,min(h*2,s));
    if(one*2<d){
        ll res=one*n;
        cout<<res<<endl;
    }else{
        ll res=(n/2)*d+one*(n%2);
        cout<<res<<endl;
    }
}

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

int main(){
  vector<vector<int>> c(3, vector<int>(3, 0));
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c.at(i).at(j);
    }
  }
  vector<int> a(3), b(3);
  a.at(0) = 0;
  b.at(0) = c.at(0).at(0);
  b.at(1) = c.at(0).at(1);
  b.at(2) = c.at(0).at(2);
  a.at(1) = c.at(1).at(0) - b.at(0);
  a.at(2) = c.at(2).at(0) - b.at(0);
  vector<vector<int>> c2(3, vector<int>(3, 0));
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      c2.at(i).at(j) = a.at(i) + b.at(j);
    }
  }
  if(c == c2) cout << "Yes" << endl;
  else cout  << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]

from collections import Counter
words = []
counter = Counter(s)

items = list(counter.items())
max_count = max(counter.values())

for i in range(len(items)):
    if items[i][1] != max_count:
        continue
    else:
        words.append(items[i][0])

words.sort()

for word in words:
    print(word)

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


int main (){
  string s;
  cin >> s;
  int ans = 0;
  if(s[0]== 'R' || s[1]=='R' || s[2]=='R') ans++;
  if(s[0]== 'R' && s[1]=='R') ans++;
  if(s[1]== 'R' && s[2]=='R') ans++;
    
  cout << ans << endl; 
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

#define LOOP(x) for( int i = 0; i < x; ++i )
#define LOOP2(x) for( int j = 0; j < x; ++j )

using namespace std;

int main(int argc, const char * argv[]) {

    int N, Y;
    cin >> N >> Y;
    
    int bill_10000, bill_5000, bill_1000;
    bill_10000 = bill_5000 = bill_1000 = -1;
    
    LOOP(N+1) {
        LOOP2(N-i+1) {
            if( 10000 * i + 5000 * j + 1000 * (N - i - j) == Y ) {
                bill_10000 = i;
                bill_5000 = j;
                bill_1000 = N - i - j;
                break;
            }
        }
    }
    
    cout << bill_10000 << " " << bill_5000 << " " << bill_1000 << endl;
    
    return 0;
}

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

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

  ll sum = 0, square = 0;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum = (sum + a[i]) % mod;
    square = (square + a[i] * a[i]) % mod;
  }

  ll ans = ((sum * sum) % mod - square + mod) % mod;
  if (ans < 0) ans += mod;

  ll inv_2 = modinv(2, mod);

  cout << (ans * inv_2) % mod << endl;
}


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

struct data{int s,d;};

int main()
{
  map<int,data> m;
  map<int,data>::iterator it;
  vector<int> v;
  int N,M,t,s,d;
  int i,cnt;
  data p;
  while(cin>>N>>M,N|M){
    m.clear();
    for(i=0;i<M;i++){
      cin>>t>>s>>d;
      p.s=s;
      p.d=d;
      m[t]=p;
    }
    v.clear();
    v.resize(N+1);
    v[1]=1;
    cnt=1;
    for(it=m.begin();it!=m.end();it++){
      if(v[((*it).second).s]){
	if(!v[((*it).second).d])cnt++;
	v[((*it).second).d]=1;
      }
    }
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 1792
def insertion_sort(array):
    '''?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????
    1. ??????????????¨??????????????????????´?????????????????????? v ????¨?????????????
    2. ????????????????????¨??????????????????v ????????§??????????´??????????????????????????§?????????????
    3. ?????????????????????????????????????????????????´? v???????????\?????????'''

    for i in range(len(array)):
        v = array[i]
        j = i - 1

        while(j>=0 and array[j] > v):
            array[j+1] = array[j]
            j = j - 1

        array[j+1] = v
        print(' '.join(map(str, array)))

def test():
    '''??? input =
    6
    5 2 4 6 1 3
    ->
    5 2 4 6 1 3
    2 5 4 6 1 3
    2 4 5 6 1 3
    2 4 5 6 1 3
    1 2 4 5 6 3
    1 2 3 4 5 6'''
    
    element_number = int(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array)

if __name__ == '__main__':
    test()

Measured memory_bytes: 7672
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        
        int[] sArray = new int[n + 20000];
        int j = 0;
        int nowNum = 1;
        int count = 0;
        
        for (int i = 0; i < n; i++) {
            int num = Integer.valueOf(String.valueOf(s.charAt(i)));
            if (num == nowNum) {
                count++;
                continue;
            } else {
                sArray[j] = count;
                j++;
                count = 1;
                if (nowNum == 0) {
                    nowNum = 1;
                } else {
                    nowNum = 0;
                }
            }
        }
        sArray[j] = count;
        if (j % 2 == 1) {
            j++;
            sArray[j] = 0;
        }
        
        if (k > (j + 1) / 2) {
            System.out.println(n);
            return;
        }
        
        int[] tArray = new int[sArray.length + 20000];
        for (int i = 0; i < sArray.length; i += 2) {
            int cnt = 0;
            for (int l = i; l <= i + k * 2; l++) {
                cnt += sArray[l];
            }
            
            tArray[i] = cnt;
            if (j == i + k * 2) break;
        }
        
        Arrays.sort(tArray);
        System.out.println(tArray[tArray.length - 1]);
    }
}

Measured memory_bytes: 31200
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef pair<string, int> Psi;
typedef pair<ll, ll> Pll;
int main(){
	string str;
	cin >> str;
	int K;
	cin >> K;
	int srt = 0;
	rep(i,str.size()){
		int s = 'z' - str[i] + 1;
		if(s == 26){
			s = 0;
		}
		if(K >= s){
			K -= s;
			str[i] = 'a';
		}
	}
	if(K >= 26){
		while(K >= 26){
			K -= 26;
		}
	}
	str[str.size()-1] += K;
	cout << str << endl;
	return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	string S;
	cin>>S;
	int ans=700;
	for(int i=0;i<S.length();i++)
		ans+=100*(S[i]=='o');
	cout<<ans<<endl;
	return 0;
}

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

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

  vector<int> label(n, -1);
  vector<int> size;
  int l = 0;
  rep(i, n) {
    if (label[i] != -1) continue;

    int cnt = 0;
    queue<int> q;
    label[i] = l;
    q.push(i);
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      for (int b : fl[a]) {
        if (label[b] == -1) {
          label[b] = l;
          q.push(b);
        }
      }
      cnt++;
    }
    size.push_back(cnt);
    l++;
  }

  vector<vector<int>> bl(n);
  rep(i, k) {
    int c, d;
    cin >> c >> d;
    c--;
    d--;
    bl[c].push_back(d);
    bl[d].push_back(c);
  }

  rep(i, n) {
    int l = label[i];
    int s = size[l];
    int ans = s - fl[i].size() - 1;
    for (int b : bl[i]) {
      if (label[b] == l) ans--;
    }
    printf("%d%c", ans, i == n - 1 ? '\n' : ' ');
  }

  return 0;
}

Measured memory_bytes: 12152
t = gets.to_s.to_i

t.times do

  n = gets.to_s.to_i
  a = gets.to_s.split.map{|t| t.to_i }
  s = gets.to_s.chomp
  
  f = false
  bases = [0] * n
  (0...n).reverse_each do |i|
    bases.each do |base|
      a[i] = a[i] ^ base if a[i] > a[i] ^ base
    end
    if a[i] != 0
      if s[i] == '0'
        bases.push a[i]
      else
        f =  true
        break
      end
    end
  end
  
  puts f ? 1 : 0
end

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

void fastio()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
}

# define MOD 1000000007

int main()
{
	fastio();
	int height,temp=0,ans=0,n,i;
	cin >> n;
	
	for(i=0;i<n;i++)
	{
		cin >> height;
		if (height > temp)
			ans += (height-temp);
			
		temp = height;
	}
	cout<<ans<<endl;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int n;cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	long long ans=0;
	int flag=0;
	for(int i=n-1;i>0;i--){
		if(a[i]==a[i-1]){
			a[i-1]=0;
			if(ans){
				ans*=a[i];
				flag=1;
				break;
			}else{
				ans=a[i];
			}
		}
	}
	if(flag){
		cout<<ans<<endl;
	}else{
		cout<<'0'<<endl;
	}

	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
  char W[11], T[1001];
  int i, count = 0;

  scanf("%s", W);

  while (1) {
    scanf("%s", T);
    if (strcmp(T, "END_OF_TEXT") == 0) break;

    for (i = 0; i < sizeof(T - 1); i++) T[i] = tolower(T[i]);
    if (strcmp(T, W) == 0) count++;
  }

  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main()
{
	string s, t;
	cin >> s >> t;
	bool ans = false;
	for(auto i = (int)s.size() - (int)t.size(); i >= 0; --i){
		bool match = true;
		for(auto j = 0; j < (int)t.size(); ++j){
			if(s[i + j] == '?') continue;
			if(s[i + j] != t[j]){
				match = false;
				break;
			}
		}
		if(match){
			for(auto j = 0; j < (int)t.size(); ++j){
				s[i + j] = t[j];
			}
			ans = true;
			break;
		}
	}
	if(ans){
		for(auto i = 0; i < (int)s.size(); ++i){
			cout << (s[i] == '?' ? 'a' : s[i]);
		}
		cout << endl;
	}else{
		cout << "UNRESTORABLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int N;
cin>>N;
for(int a=1;a<=9;a++){
    for(int b=1;b<=9;b++){
      if(N==a*b){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
}
cout<<"No"<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)


mod = 10**9 + 7
stering = [[-1]*1001 for _ in range(1001)]
for i in range(1001):
    stering[i][0] = 0
    stering[i][1] = 1
    stering[i][i] = 1

def roop(n, k):
    if n < k:
        return 0
    else:
        if stering[n][k] != -1:
            return stering[n][k]
        else:
            stering[n][k] = (roop(n-1, k-1) + k * roop(n-1, k)) % mod
            return stering[n][k]

n, k = [int(s) for s in input().split()]
ans = 0
for i in range(k+1):
    ans += roop(n, i)

print(ans % mod)


Measured memory_bytes: 29776
import math
n,k = map(int,input().split())
l = list(map(int,input().split()))
if max(l) < k:
    print("IMPOSSIBLE")
    exit()

x = l[0]
for i in l:
    x = math.gcd(x,i)

if k%x:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")



Measured memory_bytes: 20304
s = input()
t = input()

ans = 'Yes'
s_pairs = {}
t_pairs = {}
for i in range(len(s)):
    if s[i] in s_pairs:
        if s_pairs[s[i]] != t[i]:
            ans = 'No'
            break
    elif t[i] in t_pairs:
        if t_pairs[t[i]] != s[i]:
            ans = 'No'
            break
    else:
        s_pairs[s[i]] = t[i]
        t_pairs[t[i]] = s[i]

print(ans)

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int gcd(int x, int y){
    int r;
    if (x<y){
        swap(x, y);
    }
    while (y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}

int main(){
    int x,y;
    cin >>x >>y;
    cout <<gcd(x,y)<<endl;
    return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod (ll)1e9+7
/*ll binpow(ll a, ll b) {
    a %= mod;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}*/
int main() {
    int t=1;
    //cin>>t;
    while(t--)
    {
        int i;
        int x,y;
        cin>>x>>y;
        if(y%2==0)
        {
            if(y/2>=x && 2*x >= y/2) cout<<"Yes";
            else cout<<"No";
        }
        else cout<<"No";
    }
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
int main()
{
    int n,cnt=0;
    ll x;
    cin>>n;
    int a[n+1]={0};
    ll v[n+1];
    for(int i=0; i<n; i++)
        cin>>v[i];
    for(int i=1; i<n; i++){
        if(v[i]<=v[i-1])
            a[cnt]++;
        else
            cnt++;
    }
    cnt++;
    int result = *max_element(a,a+cnt);
    cout<<result;

    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
using namespace std;
int n;
const int MAXN=100100;
int a[MAXN];
long long p[MAXN];
long long sum,po;
int m[MAXN];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		p[i]=2*a[i];
		sum+=p[i];
		if((i&1) && i!=n)  po+=p[i];
	}
	sum/=2;
	m[n]=sum-po;
	for(int i=n-1;i>=1;i--)
	{
		m[i]=p[i]-m[i+1];
	}
	for(int i=1;i<=n;i++)
	{
		cout<<m[i]<<" ";
	}
	return 0;
}

Measured memory_bytes: 5148
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

using ll = long long;
using Vec = vector<ll>;
using P = pair<ll, ll>;
using VecP = vector<P>;
#define rep(i, n) for(ll i=0;i<(n);i++)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//static const ll MOD = 1000000007;
//static const ll INF = 1000000000000000000;
//#define PI 3.14159265359

VecP prime_factorize(ll N) {
    VecP res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0;

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

ll a(ll ex) {
    ll ans;
    for (ll i = 1; i <= ex; ++i) {
        ex -= i;
        ans = i;
    }
    return ans;
}

int main() {
    // input
    ll N;
    cin >> N;

    //process
    ll ans = 0;
    VecP res = prime_factorize(N);
    for (auto p : res) {
        ans += a(p.second);
    }

    cout << ans;

    return 0;
}


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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=4005;
struct EDGE{int nxt,to;}edge[MAXN];
int n,m,mm,head[MAXN],tot,ans,fa[MAXN],dep[MAXN],id1[MAXN],id2[MAXN];
inline void add_edge(int u,int v){edge[++tot].nxt=head[u];edge[tot].to=v;head[u]=tot;}
void dfs1(int u){dep[u]=dep[fa[u]]+1;for(int i=head[u];i;i=edge[i].nxt)if(edge[i].to!=fa[u])fa[edge[i].to]=u,dfs1(edge[i].to);}
pii p[MAXN],tp[MAXN];
bool used[MAXN],fl[MAXN],res[MAXN];
void del(int a,int b,int c,int d){
	static int cnt[MAXN];memset(cnt,0,sizeof(int)*(n+5));
	while(a!=b){if(dep[a]<dep[b])swap(a,b);cnt[a]++;a=fa[a];}
	while(c!=d){if(dep[c]<dep[d])swap(c,d);cnt[c]++;c=fa[c];}
	for(int i=1;i<=n;++i)if(cnt[i]>=2)fl[i]=1;
}
void dfs2(int u){
	for(int i=head[u];i;i=edge[i].nxt)if(edge[i].to!=fa[u])dfs2(edge[i].to);
	if(fa[u]){
		vector<int>vec;
		for(int i=1;i<=mm;++i)if(!used[i]&&((tp[i].fst==u)^(tp[i].scd==u))){vec.pb(i);if((int)vec.size()==2)break;}
		ans+=min(max((int)vec.size(),2*fl[u]),2);
		if((int)vec.size()<2||fl[u]){
			for(int i=1;i<=mm;++i)if(!used[i]){
				if(tp[i].fst==u)tp[i].fst=fa[u];
				if(tp[i].scd==u)tp[i].scd=fa[u];
			}
			return;
		}
		int a=vec[0],b=vec[1];
		del(tp[a].fst,tp[a].scd,tp[b].fst,tp[b].scd);
		used[a]=used[b]=1;
		++mm;
		if(tp[a].fst==u)tp[mm].fst=tp[a].scd,p[mm].fst=p[a].scd;
		else tp[mm].fst=tp[a].fst,p[mm].fst=p[a].fst;
		if(tp[b].fst==u)tp[mm].scd=tp[b].scd,p[mm].scd=p[b].scd;
		else tp[mm].scd=tp[b].fst,p[mm].scd=p[b].fst;
		id1[mm]=a;id2[mm]=b;
		for(int i=1;i<=mm;++i)if(!used[i]){
			if(tp[i].fst==u)tp[i].fst=fa[u];
			if(tp[i].scd==u)tp[i].scd=fa[u];
		}
	}
}
int main() {
	n=read();m=mm=read();
	for(int i=1,u,v;i<n;++i)u=read(),v=read(),add_edge(u,v),add_edge(v,u);
	for(int i=1;i<=m;++i)p[i].fst=tp[i].fst=read(),p[i].scd=tp[i].scd=read();
	dfs1(1);dfs2(1);
	printf("%d\n",ans);
	for(int i=mm;i>=1;--i){
		if(!used[i])res[i]=0;
		if(i>m){
			if(!res[i])res[id1[i]]=(p[i].fst!=p[id1[i]].fst),res[id2[i]]=(p[i].scd!=p[id2[i]].scd);
			else res[id1[i]]=(p[i].fst==p[id1[i]].fst),res[id2[i]]=(p[i].scd==p[id2[i]].scd);
		}
	}
	for(int i=1;i<=m;++i)if(!res[i])printf("%d %d\n",p[i].fst,p[i].scd);else printf("%d %d\n",p[i].scd,p[i].fst);
	return 0;
}

Measured memory_bytes: 640
dat = raw_input()
(N,T) = dat.split(" ")

N = int(N)
T = int(T)

dat = raw_input()
A = map(int,dat.split(" "))

diffno = 0

mind = A[0]
maxd = 0

for x in range(1,len(A)):
  if maxd < (A[x] - mind):
    maxd = A[x] - mind
    diffno = 1
  elif maxd == (A[x] - mind):
    diffno += 1

  if mind > A[x]:
    mind = A[x]

print diffno


Measured memory_bytes: 12264
from sys import stdin
import heapq
import math

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [-int(x) for x in stdin.readline().rstrip().split()]

heapq.heapify(A)

while M > 0:
    h = heapq.heappop(A)
    h = math.ceil(h / 2)
    heapq.heappush(A, h)
    M -= 1

print(-sum(A))


Measured memory_bytes: 94848
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll a,b,c;
    cin >> a >> b >> c;

    cout << min(a+b,min(b+c,a+c)) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int temp;
        if(c<b) {
            temp = c;
            c = b;
            b = temp;
        }

        if(b<a) {
            temp = a;
            a = b;
            b = temp;
        }

        if(c<b){
            temp = c;
            c = b;
            b = temp;
        }

        System.out.println(a + " " + b + " " + c);
    }
}


Measured memory_bytes: 26368
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

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

  int min = 1000;
  int max = 0;
  if (A+B < N) {
    min = 0;
  } else {
    min = A+B-N;
  }

  max = std::min(A, B);
  printf("%d %d\n", max, min);
}


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

int main(){
  int N,sum;
  cin>>N;//n=10^8A+10^7B…10^2G+10^1H
  int A=N;
  for(int i=1;i<=A;){
    sum+=A%(i*10);
    A=A/(i*10);
  }
  if(N%sum==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

    

Measured memory_bytes: 256
n,m=map(int, input().split())
ab=sorted([list(map(int,input().split())) for _ in range(n)])

sum=0
honsu=0
for i in range(n):
    cost=ab[i][0]
    maxhonsu=ab[i][1]
    for _ in range(maxhonsu):
        if honsu==m:
            break
        sum+=cost
        honsu+=1

    if honsu==m:
        break

print(sum)

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int b = 0;
  long ans = 0;
  for(int i=0; i<n; i++) {
    if(s.at(i) == 'W') {
      ans += b;
    } else {
      b++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int solve(string k,int dp[][100][2],int D,int pos,int d,int tight){
    if(dp[pos][d][tight]!=-1){
        return dp[pos][d][tight];
    }
    int ub;
    if(tight){
        ub=k[pos]-'0';
    }
    else{
        ub=9;
    }
    //base case
    if(pos==k.length()-1){
        int ans=0;
        for(int x=0;x<=ub;x++){
            if(x%D==d){
                ans++;
            }
        }
        return ans;
    }
    //recursive call
    int ans=0;
    for(int x=0;x<=ub;x++){
        ans=(ans+solve(k,dp,D,pos+1,(d-x%D+D)%D,tight&(x==ub)))%mod;
    }
    return dp[pos][d][tight]=ans;
}
int32_t main(){
    string k;
    cin>>k;
    int D;
    cin>>D;
    int n=k.length();
    int dp[n][100][2];
    for(int i=0;i<n;i++){
        for(int j=0;j<100;j++){
            for(int k=0;k<2;k++){
                dp[i][j][k]=-1;
            }
        }
    }
    //excluding 0 because we have to count number between 1 to K
    cout<<(solve(k,dp,D,0,0,1)-1+mod)%mod;
    return 0;
}


Measured memory_bytes: 115456
/*
				C++
				encoding: UTF-8
				Last Modified: 29/Aug/20 05:54:43 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

#define int int64_t

template < typename T > void print (const T& t) {
	cout << t << '\n';
}

template < typename T, typename U, typename... ARGS >
void print (const T& t, const U& u, const ARGS&... args) {
	cout << t << " ";
	print (u, args...);
}

int n, m;
const int N = 2e5 + 5;
vector< int > graph[N];
int vis[N];

int dfs (int node) {
	vis[node] = 1;
	int ans = 1;
	for (auto& to : graph[node]) {
		if (!vis[to]) {
			ans += dfs (to);
		}
	}
	return ans;
}

signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	cin >> n >> m;
	set< pair< int, int > > edges;
	for (int i = 0; i < m; ++i) {
		int u, v;
		cin >> u >> v;
		if (u > v) swap (u, v);
		if (edges.find ({u, v}) == edges.end ()) {
			graph[u].push_back (v);
			graph[v].push_back (u);
		}
	}

	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		if (!vis[i]) {
			ans = max (ans, dfs (i));
		}
	}
	print (ans);
	return 0;
}

Measured memory_bytes: 25488
line=input().split()
N=int(line[0])
K=int(line[1])
D=input().rstrip().split()

for i in range(N,10*N+1):
 s=str(i)
 flag=True
 for x in D:
  if x in s:
   flag=False
   break

 if flag:
  print(s)
  break
 else:
  continue

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << min(A, B) + min(C, D) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <istream>
#include <vector>
#include <string>

using namespace std;

int main() {
	vector<int> v;

	string s;
	cin >> s;
	stringstream ss{s};
	string buf;
	while (std::getline(ss, buf, '/')) {
		v.push_back(stoi(buf));
	}
	string out;
	if (v[1] > 4) {
		out = "TBD";
	} else {
		out = "Heisei";
	}

	cout << out << endl; 
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int H=sc.nextInt();
	int N=sc.nextInt();
	int A[]=new int[N];
	int sum=0;
	for(int i=0;i<N;i++) {
		A[i]=sc.nextInt();
		sum+=A[i];
	}
	if(sum>=H) {
		System.out.println("Yes");
	}else {
		System.out.println("No");
	}


}
}

Measured memory_bytes: 48772
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)

int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   int n , k;
   cin >> n >> k;
   vector<double> a(n);
   for(int i = 0 ; i < n ; ++i){
      int x;
      cin >> x;
      a[i] = (1.0 / x) * ((x * (x + 1)) / 2.0);
   }

   partial_sum(a.begin() , a.end() , a.begin());
   double ans = a[k - 1];
   for(int i = 1 ; i + k - 1 < n ; ++i){
      ans = max(ans , a[i + k - 1] - a[i - 1]);
   }
   cout << fixed << setprecision(10) << ans << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;	}


//Variables Declaration


int main() {
	ll tab[100005],current;
	int count=0;
	queue<ll> ajou;
	for(int i=1 ; i<10 ;++i){
		ajou.push(i);
		tab[count++]=i;
	}
	while(count<100004){
		ll toto;
		current=ajou.front();
		if(current%10 - 1>=0){
			toto=(current*10)+(current%10)-1;
			tab[count++]=toto;
			ajou.push(toto);
		}
		toto=(current*10)+(current%10);
		tab[count++]=toto;
		ajou.push(toto);
		if(((current%10)+1)%10){
			toto=(current*10)+((current%10)+1)%10;
			tab[count++]=(current*10)+((current%10)+1)%10;
			ajou.push(toto);
		}
		ajou.pop();
	}
	int n;
	cin>>n;
	cout<<tab[n-1];

	return 0;
}


Measured memory_bytes: 1536
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize, d: f64,
        xy: [(f64, f64); n],
    }

    let ans = xy.into_iter().filter(|&(x, y)| x.hypot(y) <= d).count();
    println!("{}", ans);
}


Measured memory_bytes: 8184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

int main(){
  int D;
  ll G;
  cin >> D >> G;
  vector<ll> p(D), c(D);
  for(int i = 0; i < D; i++) cin >> p[i] >> c[i];

  int ans = 1<<30;
  for(int bit = 0; bit < (1<<D); bit++){
    ll temp = 0;
    int cnt = 0;
    for(int i = 0; i < D; i++){
      if(bit & (1<<i)){
        temp += 100 * (i+1) * p[i] + c[i];
        cnt += p[i];
      }
    }
    if(temp >= G) ans = min(ans, cnt);
    else{
      for(int i = D-1; i >= 0; i--){
        if(bit & (1<<i)) continue;
        for(int j = 0; j < p[i]; j++){
          temp += 100 * (i+1);
          cnt++;
          if(temp >= G) break;
        }
        if(temp >= G) break;
      }
      ans = min(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
from math import factorial
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


N = int(input())

if N % 2:
    print(0)
    sys.exit()


div = 10
count = 0
while N // div:
    count += N // div
    div *= 5


print(count)





Measured memory_bytes: 9112
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back

int main(){
	boost ;
	int a,b;
	cin>>a>>b;
	for (int i = max(-1000000,b-a+1); i <=min(1000000,a+b-1) ; ++i)
		cout<<i<<" ";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n); for (int i = 0; i <= (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int n;
  cin >> n;
  rep(i,n/4){
    rep(j,n/7){
      if(i*4+j*7==n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int N,K;
int h[100001];
int cost[100001];

void jump(int);

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

    int i;
    for(i=1;i<N+1;i++){
        scanf("%d",&h[i]);
        cost[i]=-1;
    }
    cost[1]=0;

    for(i=1;i<N;i++){
        jump(i);
    }

    printf("%d",cost[N]);

    return 0;

}

void jump(int i){
    int j;

    for(j=1;j<=K;j++){
        int sa;
        if(h[i+j]-h[i]>0){
            sa=h[i+j]-h[i];
        }else{
            sa=h[i]-h[i+j];
        }
        if(cost[i+j]==-1||cost[i+j]>sa+cost[i]){
            cost[i+j]=sa+cost[i];
        }
    }

    return;
}

Measured memory_bytes: 896