akhauriyash/Code-Regression huggingface dataset:
#include <iostream>                                              
#include <vector>                                                
#include <array>                                                 
#include <set>                                                   
#include <cmath>                                                 
#include <string>                                                
#include <queue>                                                 
#include <list>                                                  
#include <stack>                                                 
#include <unordered_map>                                         
#include <algorithm>                                             
#include <numeric>                                               
#include <functional>                                            
#include <iomanip> // std::std::setprecision(X)                  
#include <limits>  //std::numeric_limits<int>::max(), min()      
                                                                 
typedef long long ll;                                            
                                                                 
int main (void) {                                                
  int A, B; std::cin >> A >> B;                                  
                                                                 
  if ( (A+B)%2 == 0 ) std::cout << (A+B)/2 << std::endl;         
  else std::cout << "IMPOSSIBLE" << std::endl;                   
                                                                 
  return 0;                                                      
}                                                                

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    if((a+b*5+c*10+d*50+e*100+f*500)>=1000){
        cout<<"1"<<endl;
    }else{
        cout<<"0"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main() {
	unsigned int x, y;
	cin>>x>>y;

	//2a+2b=2x;
	//2a+4b=y;
	//求是否有解
	unsigned int a,b;
	b = (y-2*x)/2;
	a = (4*x-y)/2;

	//合法性判断
	if (a+b==x && 2*a+4*b==y) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;
int main()
{
    fastRead;
    string s;
    cin>>s;
    if(s== "ABC") cout<<"ARC\n";
    else cout<<"ABC\n";
    return 0;
}

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

#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));

int main(){
	int n;
	while(cin >> n){
		string s;
		cin>>s;
		int cnt=0;
		int dp[n+5]={};
		int dp2[n+5]={};
		for(int i=0;i<n;i++){
			if(s[i]=='#'){
				cnt++;
			}
			dp[i+1]=cnt;
		}
		cnt=0;
		for(int i=n-1;i>=0;i--){
			if(s[i]=='.')
				cnt++;
			dp2[i+1]=cnt;
		}
		int Min=n;
		for(int i=1;i<=n;i++){
			Min=min(dp[i-1]+dp2[i+1],Min);
		}
		cout<<Min<<endl;
	}

}

Measured memory_bytes: 2180
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e16;
const ll Vmax = 310LL;

vector<vector<ll>> d1(Vmax, vector<ll>(Vmax)), d2(Vmax, vector<ll>(Vmax));

int main() {
    int n, m;
    ll L;
    cin >> n >> m >> L;

    rep(i, n) {
        rep(j, n) {
            if(i != j) {
                d1[i][j] = INF;
                d2[i][j] = INF;
            }
        }
    }

    rep(i, m) {
        int a, b;
        ll cost;
        cin >> a >> b >> cost;
        a--;  b--;
        if(d1[a][b] > cost) {
            d1[a][b] = d1[b][a] = cost;
        }
    }

    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                d1[i][j] = min(d1[i][j], d1[i][k] + d1[k][j]);
            }
        }
    }

    rep(i, n) {
        rep(j, n) {
            if(i != j && d1[i][j] <= L) {
                d2[i][j] = d2[j][i] = 1LL;
            }
        }
    }

    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
            }
        }
    }

    int Q;
    cin >> Q;
    vector<ll> ans(Q);
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        s--;  t--;
        if(d2[s][t] != INF) {
            ans[i] = d2[s][t] - 1;
        }
        else {
            ans[i] = -1;
        }
    }

    rep(i, Q) {
        cout << ans[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 2816
import math

lis = []
for _ in range(5):
    lis.append(int(input()))
    
def roundup(x):
    return int(math.ceil(x/10)) * 10
    

    
minind = 9
tmp2 = 0
for i in range(5):
    tmp = str(lis[i])
    if tmp[-1] != "0":
        minind = min(minind, int(tmp[-1]))
        if minind == int(tmp[-1]):
            tmp2 = lis[i]
   
if tmp2 == 0:
    print(sum(lis))
    exit()

lis.remove(tmp2)

for j in range(4):
    lis[j] = roundup(lis[j])
        
print(sum(lis)+tmp2)

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

const int INF = 1e8;

int main() {
    int n, m, r;
    cin >> n >> m >> r;
    vector<int> R(r);
    for (int i = 0; i < r; i++) {
        int a; cin >> a;
        R[i] = a - 1;
    }
    int M[209][209];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            /*
            if (i == j) {
                M[i][j] = 0;
            } else {
            */
            if (i != j) {
                M[i][j] = INF;
            }
        }
    }

    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        if (M[a][b] > c) {
            M[a][b] = M[b][a] = c;
        }
    }

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

    sort(R.begin(), R.end());

    long long ans = 1e9;
    do {
        long long sum = 0;
        for (int i = 0; i < (r-1); i++) {
            sum += M[ R[i] ][ R[i+1] ];
        }
        ans = min(sum ,ans);
    } while ( next_permutation(R.begin(), R.end()) );

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

    return 0;
}

Measured memory_bytes: 384
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.Read;
            string weather;
            if (s == "Sunny")
            {
                weather = "Cloudy";
            }
            else if (s == "Cloudy")
            {
                weather = "Rainy";
            }
            else
            {
                weather = "Sunny";
            }
            Console.WriteLine(weather);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include <iostream>

using namespace std;

int w[101][101],h[101][101];
bool b[101][101];

int dfs(int x,int y)
{
    
    if(x == -1 || y == -1) return 0;
    if(b[x][y]){
        w[x][y] = -1;
        h[x][y] = -1;
        return 1;
    }
    
    b[x][y] = true;
    
    int rec;
    rec = dfs(w[x][y],h[x][y]);
    b[x][y] = false;
    return rec;
}

int main()
{
    int n,sum;
    
    while(cin >> n,n!=0){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                cin >> w[j][i] >> h[j][i];
            }
        }
    
        int sum = 0;
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                sum += dfs(i,j);
            }
        }
    
        cout << sum << endl;
    }
        
    return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

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

#ifdef LOCAL
#define dbg(x) cerr << #x " = " << x << endl;
#define idbg(x) #x " = " << x
#include "pretty_print.h"
#else
#define dbg(x)
#define idbg(x) ""
#endif

#ifdef _WIN32
#  define LLD "%I64d"
#else
#  define LLD "%lld"
#endif

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

template <typename T> T sqr(T x) { return x * x; }
template <typename T> T abs(T x) { return x < 0? -x : x; }
template <typename T> T gcd(T a, T b) { return b? gcd(b, a % b) : a; }
template <typename T> bool chmin(T &x, const T& y) { if (x > y) { x = y; return true; } return false; }
template <typename T> bool chmax(T &x, const T& y) { if (x < y) { x = y; return true; } return false; }


int main(int /* argc */, char** /* argv */)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef LOCAL
    assert(freopen("inp", "r", stdin));
    assert(freopen("out", "w", stdout));
    #endif
    ld a, b, c;
    while (cin >> a >> b >> c) {
        cout << (a + 2 * sqrt(a) * sqrt(b) + b < c? "Yes" : "No") << endl;
    }

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

# 方針
# S_i!=S_j!=S_kである全ての組み合わせ(i,j,k)からj-i=k-jの組み合わせを引く

r = S.count('R')
g = S.count('G')
b = S.count('B')

total_comb = r*g*b

count = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        # この時点でS_i=S_jであるのでスキップ
        if S[i] == S[j]:
            continue
        # kはiとjを定めれば一意に決まる
        k = 2 * j - i
        # kは単調増加なので、この時点でkがN-1より大きい場合、この(i,j)の組み合わせは計算しない
        if k > N - 1:
            break
        # 文字が同じであればスキップ
        if S[i] == S[k] or S[j] == S[k]:
            continue
        # ここでようやく、S_i != S_j != S_kかつj-i=k-jと判定できる
        count += 1

print(total_comb - count)


Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,x,y,s=0;
    cin>>n>>k>>x>>y;
    if(n>k)
    {
        s=k*x+(n-k)*y;
    }
    else s=n*x;

    cout<<s;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define EXIST 1
#define TODO 1
#define DONE 0
int graph[200][200];
int used[200];
int disc[200];
int fin[200];
int n;
int elapsed;

void dfs(int pos) {
  disc[pos] = ++elapsed;
  used[pos] = DONE;
  for (int i = 0; i < n; i++) {
    if (graph[pos][i] == EXIST && used[i] == TODO) {
      dfs(i);
    }
  }
  fin[pos] = ++elapsed;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int u, k, v; cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v;
      graph[u-1][v-1] = EXIST;
    }
    used[i] = TODO;
  }
  for (int i = 0; i < n; i++) {
    if (used[i] == TODO) {
      dfs(i);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << i+1 << " " << disc[i] << " " << fin[i] << endl; 
  }
}




Measured memory_bytes: 3140
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
	int ans,keta=0,c,i;
	long long N,n;
	scanf("%lld",&N);
	n=N;
	while(n>=1){n/=10;keta++;}
	c = N/(pow(10,keta-1));
	ans = c+9*(keta-1);
	n=0;
	for(i=keta-1;i>=0;i--){
		n*=10;
		if(i==keta-1) n += c;
		else n += 9;
	}
	if(n!=N)ans--;
	
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int d[12] = {1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049};

int dp[13][100001];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < 13; i++) {
		for (int j = 0; j <= n; j++) dp[i][j] = INF;
	}

	dp[0][0] = 0;
	for (int i = 0; i < 12; i++) {
		for (int j = 0; j <= n; j++) {
			if (j - d[i] >= 0) {
				dp[i+1][j] = min(dp[i][j], dp[i+1][j - d[i]] + 1);
			} else {
				dp[i+1][j] = dp[i][j];
			}
		}
	}
	cout << dp[12][n] << endl;
}

Measured memory_bytes: 8652
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

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

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	long N;
	vector<long> As;
	cin>>N;
	REP(i,N){
		long input;
		cin>>input;
		As.push_back(input);
	}

	long kekka = 0;
	for(long i = 0; i < N-1; i++){
		kekka += As[i]/2;
		//As[i] = (As[i] % 2);
		As[i] -= ((int)(As[i]/2)*2);
		if( As[i] <= As[i+1]){
			kekka += As[i];
			As[i+1] -= As[i];
			As[i] = 0;
		}

	}
	
	kekka += (As[N-1]/2);

	cout<<kekka<<endl;
	return 0;
}


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

typedef long long intl;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	intl count=0;
	intl sum=0;
	intl n=s.size();
	for(intl i=n-1;i>=0;i--){
		if(s[i]=='B'){
			count++;
			sum+=(n-i);
		}
	
	}
	cout<<sum-count*(count+1)/2<<endl;
}


Measured memory_bytes: 720
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    long n, a, b;
    long ans = 0;
	cin>>n>>a>>b;
    ans = (n/(a+b))*a;
    if (n%(a+b) - a < 0){
        ans = ans + (n%(a+b));
    }else{
        ans = ans + a;
    }
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
	int a,sum,i;
	sum=0;
	for(i=0;i<5;i++){
		scanf("%d",&a);
		if(a<40){
			a=40;
		}
		sum+=a;
	}
	sum/=5;
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 2716
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

template<class T> struct SegmentTree {
  int n;
  T ie;
  vector<T> data;
  function<T(T,T)> f;

  SegmentTree() {}
  SegmentTree(int len, T ie, function<T(T,T)> f) : ie(ie), f(f) {
    n = 1 << (32 - __builtin_clz(len));
    data.assign(n+n+1, ie);
  }

  void update(int i, T x) {
    i+=n;
    data[i] = x;
    while(i>>=1) data[i] = f(data[i+i+0], data[i+i+1]);
  }

  T query(int l, int r=1e9) {
    r = min(r, n);
    T res = ie;
    for(l+=n, r+=n; l<r; l>>=1, r>>=1) {
      if(l&1) res = f(res, data[l++]);
      if(r&1) res = f(res, data[--r]);
    }
    return res;
  }

  T operator[](int i) { return data[i+n]; }
};

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

  vector<lint> a(N);
  for(auto& elem : a) cin >> elem;

  SegmentTree<lint> seg(N, 0LL, bit_xor<lint>());

  for(int i=0; i<N; i++) {
    seg.update(i, a[i]);
  }

  for(int i=0; i<N; i++) {
    cout << (seg.query(0, i)^seg.query(i+1)) << " \n"[i==N-1];
  }
}

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

int main()
{
  int n;
  
  scanf("%d", &n);
  while (n--){
    int num[8];
    for (int i = 0; i < 8; i++){
      scanf("%1d", &num[i]);
    }

    int num_max = 0, num_min = 0;
    sort(num, num + 8);
    for (int i = 0; i < 8; i++){
      num_min += num[i] * (int)pow(10, 7 - i);
      num_max += num[i] * (int)pow(10, i);
    }

    printf("%d\n", num_max - num_min);
  }

  return (0);
}

Measured memory_bytes: 1248
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	string S;
	scan(N>>S);
	int ans=0;
	rep(i,10){
		rep(j,10){
			rep(k,10){
				int now=0;
				rep(l,N){
					if(now==0&&S[l]-'0'==i) now++;
					else if(now==1&&S[l]-'0'==j) now++;
					else if(now==2&&S[l]-'0'==k) now++;
					if(now==3){
						ans++;
						break;
					}
				}
			}
		}
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int x,y,temp,r;

	scanf("%d %d", &x,&y);
	if(x<y){
		temp = x;
		x = y;
		y = temp;
	}
	r=x%y;
	while(r!=0){
		x=y;
		y=r;
		r=x%y;
	}
	printf("%d\n",y);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

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

    if(a%2!=0 and b%2!=0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
n = int(sys.stdin.readline().rstrip("\n"))
t, a = map(int, sys.stdin.readline().rstrip("\n").split())
h = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
d = abs(t - h[0] * 0.006 - a)
mini = 1
for i in range(1,len(h)) :
    d_ = abs(t - h[i] * 0.006 - a)
    if d_ < d:
        d = d_
        mini = i + 1
print(mini)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    int h,w;
    cin>>h>>w;
    char a[h+2][w+2];
    for(int i=1;i<=h;i++) for(int j = 1;j <= w; j++) cin>>a[i][j];
    
    int dp[h+2][w+2];
    memset(dp,0,sizeof(dp));
    
    dp[1][1] = 1; 
    for(int i=2 ; i<=w; i++) if(a[1][i] == '.') dp[1][i] = dp[1][i-1];
    for(int j=2; j<=h; j++) if(a[j][1] == '.') dp[j][1] = dp[j-1][1];
    
    for(int i=2; i<=h ;i++) {
        for(int j=2; j<=w; j++) {
        	if(a[i][j] == '.')  dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }
    cout<<dp[h][w];
    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const i64 mod = 1e9 + 7;
i64 n, k, dp[101][100001];
vector<i64> a;

int main() {
  cin >> n >> k;
  read_n(a, n, 1);
  fill(&dp[1][0], &dp[100][100000] + 1, -1);
  dp[0][0] = 1;
  for (i64 i = 1; i <= n; ++i) {
    dp[i][0] = 1;
    for (i64 c = 1; c <= k; ++c) {
      dp[i][c] = 
        ( mod
        + dp[i - 1][c] 
        + dp[i][c - 1]
        - (c - a[i] - 1 >= 0 ? dp[i - 1][c - a[i] - 1] : 0)
        ) % mod;
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}


Measured memory_bytes: 78336
// C++ program to count number of factors 
// of an array of integers 
#include <bits/stdc++.h> 
using namespace std; 

const int MAX = 1000001; 

// array to store prime factors 
int factor[MAX] = { 0 }; 


// function to generate all prime factors 
// of numbers from 1 to 10^6 
void generatePrimeFactors() 
{ 
	factor[1] = 1; 

	// Initializes all the positions with their value. 
	for (int i = 2; i < MAX; i++) 
		factor[i] = i; 

	// Initializes all multiples of 2 with 2 
	for (int i = 4; i < MAX; i += 2) 
		factor[i] = 2; 

	// A modified version of Sieve of Eratosthenes to 
	// store the smallest prime factor that divides 
	// every number. 
	for (int i = 3; i * i < MAX; i++) { 
		// check if it has no prime factor. 
		if (factor[i] == i) { 
			// Initializes of j starting from i*i 
			for (int j = i * i; j < MAX; j += i) { 
				// if it has no prime factor before, then 
				// stores the smallest prime divisor 
				if (factor[j] == j) 
					factor[j] = i; 
			} 
		} 
	} 
} 

// function to calculate number of factors 
int calculateNoOFactors(int n) 
{ 
	if (n == 1) 
		return 1; 

	int ans = 1; 

	// stores the smallest prime number 
	// that divides n 
	int dup = factor[n]; 

	// stores the count of number of times 
	// a prime number divides n. 
	int c = 1; 

	// reduces to the next number after prime 
	// factorization of n 
	int j = n / factor[n]; 

	// false when prime factorization is done 
	while (j != 1) { 
		// if the same prime number is dividing n, 
		// then we increase the count 
		if (factor[j] == dup) 
			c += 1; 

		/* if its a new prime factor that is factorizing n, 
		then we again set c=1 and change dup to the new 
		prime factor, and apply the formula explained 
		above. */
		else { 
			dup = factor[j]; 
			ans = ans * (c + 1); 
			c = 1; 
		} 

		// prime factorizes a number 
		j = j / factor[j]; 
	} 

	// for the last prime factor 
	ans = ans * (c + 1); 

	return ans; 
} 

// Driver program to test above function 
int main() 
{ 
	// generate prime factors of number 
	// upto 10^6 
	generatePrimeFactors(); 
    int n;
    cin>>n;
    int sum=0;
	for (int i = 1; i <=n-1; i++) 
	sum+=calculateNoOFactors(i); 
	cout<<sum;

	return 0; 
} 


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


int main() {
    string S;
    cin >> S;
    int min = 999;
    rep(i,S.size()-2) {
        int a = 100*(S[i] - '0') + 10*(S[i + 1] - '0') + (S[i + 2] - '0');
        if (abs(a - 753) < min) {
            min = abs(a - 753);
        }
        
    }
    cout << min << endl;
    
}



Measured memory_bytes: 3584
"use strict"
function Main(input) {
  input = input.trim().split(' ').map(Number);
  const k = input[0];
  const s = input[1];
 
  let ret=0;
  for(let x=0; x<=k; ++x){
    for(let y=0; y<=k; ++y){
      let z = s-x-y;
      if(0<=z&&z<=k) ++ret;
    }
  }
  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

int main()
{
    long long int a,b;
    cin>>a>>b;
    if(a%2==b%2)
    {
        cout<<(a+b)/2<<endl;
    }
    else
    {
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>
#include <unordered_map>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

int main(){
    long long N;
    cin >> N;
    map<long long, long long> problems;
    long long D;
    repeat(i,N) {
        cin >> D;
        // dump(D);
        problems[D] += 1;
    }

    long long M;
    cin >> M;
    long long T;
    repeat(i,M) {
        cin >> T;
        // dump(T);
        problems[T] -= 1;
        if (problems[T] < 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;

typedef long long ll;

int main() {
	cin.sync_with_stdio(false); cin.tie(nullptr);
	int n, m, k; cin >> n >> m >> k;
	vector<ll> a(n), b(m);
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < m; ++i) cin >> b[i];
	vector<ll> ac_a(a), ac_b(b);
	for (int i = 1; i < n; ++i) ac_a[i] += ac_a[i - 1];
	for (int i = 1; i < m; ++i) ac_b[i] += ac_b[i - 1];
	int sol = 0;
	for (int i = 0; i <= n; ++i) { // take up to i-1
		ll sum = (i > 0 ? ac_a[i - 1] : 0);
		if (sum <= k) {
			auto it = upper_bound(ac_b.begin(), ac_b.end(), k - sum);
			int j = distance(ac_b.begin(), it);
			sol = max(sol, i + j);
		}
	}
	cout << sol << endl;
	return 0;
}

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

int ans;
long long N;
int func(long long i,int n3,int n5,int n7){
    if(i>N) return 0;
    if(n3>=1&&n5>=1&&n7>=1)++ans;

    func(10*i+3,n3+1,n5,n7);
    func(10*i+5,n3,n5+1,n7);
    func(10*i+7,n3,n5,n7+1);

    return 0;
}
int main(){
    cin>>N;
    ans=0;
    long long i=0;
    func(i,0,0,0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <bitset>
using namespace std;
using ll = long long;
using ld = long double;

template <typename T>
T gcd(const T a, const T b)
{
    return (b != 0) ? gcd(b, a % b) : a;
}

template <typename T>
vector<T> Moebius(vector<T> f)  // Moebius{f}(Y) = \sum_{X \subseteq Y} (-1)^{|Y\X|} f(X)
{
    for (int i = 0; (1LL << i) < f.size(); i++) {
        for (int j = f.size() - 1; j >= 0; j--) {
            if (j & 1LL << i) {
                f[j] -= f[j ^ 1LL << i];
            }
        }
    }
    return f;
}

int main()
{
    int N;
    cin >> N;
    ll M;
    cin >> M;
    vector<ll> a(N);
    vector<ld> p(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        p[i] /= 100.0;
    }

    const int maximum = 1 << N;
    vector<ld> ex(maximum, 1.0);
    for (int i = 0; i < maximum; i++) {
        for (int j = 0; j < N; j++) {
            if (i & (1 << j)) {
                ex[i] *= p[j];
            }
        }
    }
    ex[0] = 0;
    for (int i = 1; i < maximum; i++) {
        ll LCM = 1LL;
        for (int j = 0; j < N; j++) {
            if (i & (1 << j)) {
                const ll g = gcd(LCM, a[j]);
                const ll b = a[j] / g;
                if (log2(LCM) + log2(b) < 63) {
                    LCM *= b;
                } else {
                    ex[i] = 0;
                    break;
                }
            }
        }
        ex[i] *= (M / LCM);
    }

    const vector<ld> ans = Moebius(ex);
    cout << fixed << setprecision(30) << abs(ans[maximum - 1]) << endl;
    return 0;
}



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

int main(){
    int N, M;  cin >> N >> M;
    priority_queue<int> que;
    for(int i=0; i<N; i++){
        int a;  cin >> a;
        que.push(a);
    }
    for(int i=0; i<M; i++){
        int v = que.top();  que.pop();
        que.push(v/2);
    }

    ll ans = 0;
    while(!que.empty()){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
}

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

int main()
{
    int H, W;
    cin >> H >> W;
 
    char out[1000][1000];
 
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> out[i][j];
        }        
    }
 
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cout << out[i][j];
        } 
        cout << endl;   
        for(int j = 0; j < W; j++){
            cout << out[i][j];
        }       
        cout << endl;   
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s;
  cin >> s;
  int a = stoi(s.substr(0,2));
  int b = stoi(s.substr(2,2));

  auto ism = [](int i){ return 1<=i && i<=12; };
  if(ism(a)&&ism(b)){
    cout << "AMBIGUOUS" << endl;
  }else if(ism(a)){
    cout << "MMYY" << endl;
  }else if(ism(b)){
    cout << "YYMM" << endl;
  }else{
    cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n, c, k;
	cin >> n >> c >> k;
	priority_queue<int, vector<int>, greater<int>> que;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		que.push(x);
	}
	int ans = 0;
	while(que.size()) {
		int x = que.top();
		int cnt = 0;
		while(que.size() && que.top() <= x + k && cnt < c) {
			cnt++;
			que.pop();
		}
		ans++;
	}
	cout << ans << endl; 
	return 0;	
}

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

int nxt[20][100000];

void construct(vector<int> &v, int l, int c[20][100000]){
    int n = v.size();
    for(int i = 0; i+1 < n; i++){
        c[0][i] = upper_bound(v.begin(),v.end(),v[i]+l)-v.begin()-1;
    }
    c[0][n-1] = -1;
    for(int k = 0; k+1 < 20; k++){
        for(int i = 0; i < n; i++){
            if(c[k][i] < 0)  c[k+1][i] = -1;
            else             c[k+1][i] = c[k][c[k][i]];
        }
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    for(int i = 0; i < n; i++)  cin >> x[i];
    vector<int> y(n);
    for(int i = 0; i < n; i++)  y[i] = 1e9-x[n-1-i];
    int l;
    cin >> l;
    construct(x, l, nxt);
    auto f = [&](int a, int b)->int{
        int ret = 0, tmp = a;
        for(int k = 19; k >= 0; k--){
            int to = nxt[k][tmp];
            if(to >= 0 && to < b){
                tmp = to;
                ret += 1<<k;
            }
        }
        return ret+1;
    };
    int q;
    cin >> q;
    while(q--){
        int a, b;
        cin >> a >> b;
        a--, b--;
        if(a > b)   swap(a,b);
        cout << f(a, b) << endl;
    }
    return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}


struct dsu {
        vector<int> par, rk;
        dsu(int n) {
                par.resize(n + 1);
                rk.resize(n + 1);
                for (int i = 1; i <= n; i++) {
                        par[i] = i;
                        rk[i] = 1;
                }
        }

        int find(int x) {
                while (x != par[x]) x = par[x];
                return x;
        }

        void unite(int a, int b) {
                a = find(a), b = find(b);
                if (a != b) {
                        if (rk[a] < rk[b]) swap(a, b);
                        par[b] = a;
                        rk[a] += rk[b];
                }
        }
};


void _main() {
        int n; cin >> n;
        vector<tri> edges;
        vector<pair<int, int>> a, b;
        for (int i = 0; i < n; i++) {
                int x, y; cin >> x >> y;
                a.emplace_back(x, i);
                b.emplace_back(y, i);
        }

        sort(all(a)), sort(all(b));
        for (int i = 1; i < n; i++) {
                int from = a[i].second, to = a[i - 1].second;
                edges.emplace_back(tri{abs(a[i - 1].first - a[i].first), from, to});
                from = b[i].second, to = b[i - 1].second;
                edges.emplace_back(tri{abs(b[i - 1].first - b[i].first), from, to});
        }

        sort(all(edges));
        dsu d(n);
        ll ans = 0;
        for (auto e: edges) {
                if (d.find(e[1]) != d.find(e[2])) {
                        d.unite(e[1], e[2]);
                        ans += e[0];
                }
        }

        cout << ans;
}




signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 8596
M, D = (int(i) for i in input().split())
cnt = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        d1  = d // 10
        d10 = d % 10
        if d1 >= 2 and d10 >= 2 and m == d1 * d10:
            cnt = cnt + 1
print(cnt)

Measured memory_bytes: 3060
// 22
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
const li inf = 1 << 60;

void _main(int tc) {
  li n, W;
  cin >> n >> W;
  vector<int> w(n), v(n);
  rep(i, n) { cin >> w[i] >> v[i]; }

  // ********* Recursive ************
  vector<vector<li>> mem(n, vector<li>(W + 1, -1));
  function<li(int, int)> F = [&](int i, int k) -> li {
    if (i == n) return 0;
    if (mem[i][k] != -1) return mem[i][k];
    if (k - w[i] >= 0)
      mem[i][k] = max(v[i] + F(i + 1, k - w[i]), F(i + 1, k));
    else
      mem[i][k] = F(i + 1, k);
    return mem[i][k];
  };
  cout << F(0, W) << endl;
  // ********* End Recursive ************

  // vector<vector<li>> mem(n + 1, vector<li>(W + 1, 0));
  // rrep(i, n) {
  //   rrep(k, W + 1) {
  //     if (k - w[i] >= 0)
  //       mem[i][k] = max(v[i] + mem[i + 1][k - w[i]], mem[i + 1][k]);
  //     else
  //       mem[i][k] = mem[i + 1][k];
  //   }
  // }
  // cout << mem[0][W] << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0);
  return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 79604
import copy
n = int(input())
a = [int(input()) for i in range(n)]
ans = max(a)
n_a = copy.deepcopy(a)
n_a.remove(ans)
s_ans = max(n_a)
if s_ans == ans:
    for i in a:
        print(ans)
else:
    for i in a:
        if i == ans:
            print(s_ans)
        else:
            print(ans)


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

int main(){
    int n;
    string s, t, u;
    cin >> n >> s >> t;

    rep(i,n){
        u.push_back(s[i]);
        u.push_back(t[i]);
    }
    cout << u << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define wzh(x) cerr<<#x<<' '<<x<<endl
int main() {
  ios::sync_with_stdio(false);
  int n,x,ans=0;cin>>n;
  for(int i=1;i<=n;i++){
  	cin>>x;
  	if((i)&1 && (x&1)){
  		ans++;
  		// cout<<i<<' '<<x<<endl;
  	}
  }
  cout<<ans<<'\n';
 	return 0;
}

Measured memory_bytes: 3652
#１のくらいのみ見れはいい？
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ls=[a,b,c,d,e]
ls_1=[]
for i in range(len(ls)):
    ls_1.append(int(str(ls[i])[-1]))
ls_1=np.array(ls_1)
ls_1_10=10-ls_1
ls_1_10[ls_1_10==10]=0
#ls_1_10=ls_1[ls_1 < 10]#１０を除いたロス
a=np.argmax(ls_1_10)#最大の１の位を探す
ls_non=np.delete(ls_1_10, a, 0)
#ls_non_10=ls_non[ls_non < 10]
ls=np.array(ls)
ans=np.sum(ls) + np.sum(ls_non)
print(ans)

Measured memory_bytes: 12504
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l = sc.nextInt();
    int r = sc.nextInt();
    int d = sc.nextInt();
    int result = 0;
    for (int i = 1; i <= 100; i++) {
      if (l <= d * i && d * i <= r) {
        result++;
      }
    }
    System.out.println(result);
  }
}


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

#define MOD 1000000007

string S;
long long fact[100005];

int main() {
    
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int N;
    cin >> N >> S;

    fact[0] = 1;

    for(int i=1; i<=N; i++)
        fact[i] = fact[i-1] * i % MOD;

    int open = 0;
    long long ans = fact[N];

    for(int i=0; i<S.size(); i++)
    {
        int curr = (S[i] == 'W' ? 0 : 1);

        if(open % 2 != curr)
            open++;
        else
        {
            ans = ans * open % MOD;
            open--;
        }
    }

    if(open != 0)
        ans = 0;

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1360
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N =sc.nextInt();
		int L =0;
		int O =0;
		int P =0;
		P = N;
		
		for(int X=1; X<=9; X++){
			L =N%10;
			O += L;
			N = N/10;
		}
		if(P%O==0){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define MN 100005
int t,r[MN],a,v[MN],x,n,q;
int main(){
	cin>>x>>n;
	for(int i=1;i<=n;++i)scanf("%d",r+i);
	for(int i=1;i<=n;++i)v[i]=r[i]-r[i-1];
	cin>>q;int tl=0,h=x,l=0,hv=x,lv=0;r[n+1]=v[n+1]=1000000008;
	while(q--){
		scanf("%d%d",&t,&a);
		while(r[tl+1]<=t){
			if((++tl)&1){
				if(lv<v[tl])l+=v[tl]-lv;
				hv=max(0,hv-v[tl]);
				lv=max(0,lv-v[tl]);
			}else{
				if(hv+v[tl]>x)h-=v[tl]+hv-x;
				hv=min(x,hv+v[tl]);
				lv=min(x,lv+v[tl]);
			}
			h=max(0,h);l=min(l,x);
		}t-=r[tl];
		if(l>=a)a=lv;else if(h<=a)a=hv;else a+=lv-l;
		if(tl&1)printf("%d\n",min(x,a+t));else printf("%d\n",max(0,a-t));
	}
	return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int n,m;
char s[111111],t[111111];
int nxt[222222][26];

int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	scanf("%s",s);n=strlen(s);
	scanf("%s",t);m=strlen(t);
	memset(nxt,-1,sizeof(nxt));
	for(int i=n-2;i>=0;--i){
		FOR(j,0,26)nxt[i+n][j]=nxt[i+n+1][j];
		nxt[i+n][s[i+1]-'a']=i+1;
	}
	FOR(j,0,26)nxt[n-1][j]=nxt[n][j];
	nxt[n-1][s[0]-'a']=0;
	for(int i=n-2;i>=0;--i){
		FOR(j,0,26)nxt[i][j]=nxt[i+1][j];
		nxt[i][s[i+1]-'a']=i+1;
	}
	int pos=0,cnt=0;
	FOR(i,0,m){
		if(i==0)if(s[0]==t[0])continue;
		int to=nxt[pos][t[i]-'a'];
		if(to<=pos)cnt++;
		pos=to;
		if(to==-1){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<(ll)pos+1ll+cnt*1ll*n<<endl;
	
	return 0;
}


Measured memory_bytes: 23168
using System;

class test
{
    public static void Main()
    {
        int[] x = new int[10000];
        int i;

        for (i = 0; i < 10000; i++)
        {
            x[i] = int.Parse(Console.ReadLine());
            if(x[i] == 0)
            {
                break;
            }
        }
        for (int y = 0; y < i; y++)
        {
            Console.WriteLine("Case " + (y + 1) + ": " + x[y]);
        }
    }
}


Measured memory_bytes: 9252
// ABC077_B
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N;
    cin >> N;
    
    // calculation
    if (N <= 3) {
        cout << 1 << "\n";
    } else {
        ll res = 4;
        for (ll i = 2; i*i <= N; ++i) {
            res = max(res, i*i);
        }
        cout << res << "\n";
    }
    
    return 0;
}


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

int main()
{
    int K, N[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> K;
    cout << N[K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,x,i,j,cards[4][13] = {{0}};
    char ch;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> ch >> x;
        if(ch=='S'){
            cards[0][x-1]=1;
        }else if(ch=='H'){
            cards[1][x-1]=1;
        }else if(ch=='C'){
            cards[2][x-1]=1;
        }else if(ch=='D'){
            cards[3][x-1]=1; 
        }
    }
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(cards[i][j]==0){
                if(i==0){
                    cout << "S"<< " " <<j+1;
                    cout << endl;
                }else if(i==1){
                    cout << "H" << " " << j+1;
                    cout << endl;
                }else if(i==2){
                    cout << "C" << " " << j+1;
                    cout << endl;
                }else if(i==3){
                    cout << "D" << " " << j+1;
                    cout << endl;
                }
            }
        }
    }
}


Measured memory_bytes: 3072