akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

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

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

string island[12];
void dfs(int y, int x) {
    island[y][x] = '0';
    rep(k, 4) {
        int ny = y + dy[k];
        int nx = x + dx[k];
        if (!(0 <= ny && ny < 12)) continue;
        if (!(0 <= nx && nx < 12)) continue;
        if (island[ny][nx] == '1') dfs(ny, nx);
    }
}
int main() {
    while (1) {
        rep(i, 12) cin >> island[i];

        int ans = 0;
        rep(i, 12) rep(j, 12) {
            if (island[i][j] == '1') {
                ans++;
                dfs(i, j);
            }
        }
        cout << ans << endl;

        string tmp;
        cin.ignore();
        if (!(getline(cin, tmp))) {
            break;
        }
    }
    return 0;
}

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



int main(){
	string S, T, U;
	int A, B;
	cin >> S >> T >> A >> B >> U;
	if(S==U) cout << A-1 << " " << B << endl;
	if(T==U) cout << A << " " << B-1 << endl;
	return 0;
}


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

using namespace std;


int main() {
	int N;
	cin >> N;
	long long sum = 0;
	for (int i = 1; i <= N; i++) {
		if (i % 3 != 0 && i % 5 != 0) sum += i;
	}

	cout << sum << endl;
	return 0;
}




Measured memory_bytes: 3628
#include<stdio.h>

int main(void){
  int n,k,i,j;
  scanf("%d %d",&n,&k);
  int a[n];
  for (i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n-k;i++){
    if(a[i]<a[k+i]) printf("Yes\n");
    else printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 2436
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, D):
    D = set(map(str, D))
    i = N
    while True:
        n = [c for c in str(N)]
        if all(map(lambda x: x not in D, n)):
            return N
        N += 1



def main():
    N, K = read_int_n()
    D = read_int_n()
    print(slv(N, K, D))


if __name__ == '__main__':
    main()


Measured memory_bytes: 63448
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    int count=0;
    for(int i=A;i<B;i++){
        for(int j=C;j<D;j++){
            if(i==j) count++;
        }
    } 
    cout << count << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,A,B,C;
    cin >> N >> A >> B >> C;
    vl L(N),acc(N+1,0);
    rep(i,N){
        cin >> L[i];
    }
    ll ans=INF;
    ll t=1;
    rep(i,N){
        t*=i+1;
    }
    rep(q,t){
    rep(i,N){
        acc[i+1]=acc[i]+L[i];
    }
    FOR(i,0,N-2){
        ll res=0;
        FOR(j,i+1,N-1){
            FOR(k,j+1,N){
                res=abs(acc[i+1]-A)+abs(acc[j+1]-acc[i+1]-B)+abs(acc[k+1]-acc[j+1]-C)+(k-2)*10;
                chmin(ans,res);
            }
        }
    }
    next_permutation(L.begin(),L.end());
    }
    cout << ans << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3528
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N, M, C;
	cin >> N >> M >> C;
	vector<int> B(M);
	vector<vector<int>> A(N,vector<int>(M));
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}
	int Ans = 0;
	for (int i = 0; i < N; i++) {
		int ans = 0;
		for (int j = 0; j < M; j++) {
			ans += B[j] * A[i][j];
		}
		if (ans + C > 0) {
			Ans++;
		}
	}
	cout << Ans << endl;
 	return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  A
//
//  Created by Hashizo on 2019/07/07.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>

using namespace std;

#undef INT_MAX
#undef INT_MIN

#define INT_MAX	2147483647
#define INT_MIN	(-INT_MAX  -1)

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define REPLACE(s, f, t) regex_replace(s, regex(f), t)

int main(int argc, const char * argv[]) {
	int n,a,b;
	cin >> n >> a >> b;

	if( (a * n) >= b) {
		cout << b << endl;
	}
	else {
		cout << (a * n) << endl;
	}
	return 0;
}


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

int main(){
    ll H,W,K;
    cin >> H >> W >> K;
    vector<vector<char>> S(H,vector<char>(W));

    /*vector<int> SUM(W,0);
    rep(i,W){
        int cnt = 0;
        rep(j,H){
            if(S[j][i] == '1')cnt++;
        }
        SUM[i] = cnt;
    }*/
    /*vector<vector<ll>> DP(H+1, vector<ll>(W+1,0));
    rep(i,H){
        rep(j,W){
            cin >> S[i][j];
            if(S[i][j] == '1'){
                DP[i+1][j+1] = DP[i+1][j] + DP[i][j+1] - DP[i][j] + 1;
                //cout << DP[i+1][j+1]<<endl;
            }else{
                DP[i+1][j+1] = DP[i+1][j] + DP[i][j+1] - DP[i][j];
            }
        }
    }*/
    rep(i,H)rep(j,W){
        cin >> S[i][j];
    }
    
    int m = 1e9+10;
    rep(i,(int(1) << int(H-1))){
        //cout << i << endl;
        vector<int> ID(H,0);
        int g=0;
        rep(j,H){
            ID[j] = g;
            if((i >> j)&1){
                g++;
            }
        }
        vector<vector<int>> c(H+1,vector<int>(W+1, 0));
        rep(j,H)rep(k,W) c[j][k] = 0;
        rep(j,H)rep(k,W) c[ID[j]][k] += int(S[j][k] - '0');
        vector<int> now(g+1,0);
        int cnt= g;
        auto add = [&](int j){
            rep(k,g+1) now[k] += c[k][j];
            rep(k,g+1) if((now[k]>K)){
                return true;
            }
            return false;
        };
        
        rep(j,W){
            //cout << j << endl;
            if(!add(j)){
                continue;
            }else{
                cnt++;
                now = vector<int>(g+1);
                
                if(add(j)){
                    cnt = 1e9+11;
                    break;
                }
            }
        }
        //cout << "dd:"<< cnt <<endl;
        m = min(m,cnt);

    }
    cout << m << endl;
    /*
    vector<vector<ll>> DP(H+1, vector<ll>(W+1,0));
    rep(i,H){
        rep(j,W){
            cin >> S[i][j];
            if(S[i][j] == '1'){
                DP[i+1][j+1] = DP[i+1][j] + DP[i][j+1] - DP[i][j] + 1;
                //cout << DP[i+1][j+1]<<endl;
            }else{
                DP[i+1][j+1] = DP[i+1][j] + DP[i][j+1] - DP[i][j];
            }
        }
    }
    //cout << DP[H][W] << "  sahiofhaofi"<< endl;
    ll ccnt = 0;
    ll tmp = K;
    rep(i,H){
        rep(j,W){
            if(DP[i+1][j+1] >= tmp){
                tmp += K;
                ccnt += 1;
                cout << i+1<<" "<<j+1 << " "<<DP[i+1][j+1] <<endl;
                for(int y=i+1;y<H){
                    rep(x,W-j){

                    }
                }
            }
        }
    }
    int bl = 1;
    int ii = 0;
    while(bl < ccnt){
        bl *=2;
        ii++;
    }

    cout << ii <<endl;
    /*
    rep(i,H){
        if(DP[i+1][W] == K)num_cut++;
    }
    rep(i,W){
        if(DP[H][i+1] == K)num_cut++;
    }*/
}


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

int main() {
  int N;
  cin >>N;
  vector<double> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  
  double answer=a[0];
  for(int i=0;i<N;i++){
    answer=(answer+a[i])/2;
  }
  cout << fixed << setprecision(5);
  cout << answer;
}

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


int main(void){
    // Your code here!
    int A,B,C;
    cin>>A>>B;
    C=A-2*B;
    if(C>0){
        cout<<C<<endl;
    }else{
        cout<<0<<endl;
    }
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll N; cin >> N;
    vector<ll> A(N);
    REP(i,N){
        cin >> A[i];
    }
    sort(ALL(A), greater<ll>());

    ll ans = 0;

    ans += A[0];
    int count = N-2;
    int itr = 1;

    while(count>0){
        if(count == 1){
            ans += A[itr];
            count --;
        }else{
            ans += 2*A[itr];
            itr++;
            count -= 2;
        }   
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4844
from collections import defaultdict
x, n = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
Dict = defaultdict(int)
for i in arr:
    Dict[i] = 1
ans = int(1e9)
val = -1
for i in range(0,200):
    if Dict[i] == 0:
        diff = abs(x - i)
        if diff < ans:
            val = i
            ans = diff
print(val)



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

long long power(long long N, long long expo)
{
	long long ans = 1;
	while(expo)
	{
		if(expo % 2)
			ans = ans * N % MOD;
		N = N * N % MOD;
		expo /= 2;
	}
	return ans;
}

int main()
{
	int n,a;
	cin>>n>>a;
	int b[n];
	for(int i=0; i<n; i++)
		cin>>b[i];
	sort(b,b+n);
	long long dp[51][51][3001];
	memset(dp,0,sizeof(dp));
	dp[1][1][b[0]]=1;
	for(int i=2; i<=n; i++)
	{
		for(int j=1; j<=i; j++)
		{
			for(int k=0; k<3000; k++)
				dp[i][j][k]=dp[i-1][j][k];
			if(j==1) dp[i][j][b[i-1]]=1+dp[i-1][j][b[i-1]];
			else
			{
				for(int k=0; k<3000; k++)
					dp[i][j][k+b[i-1]]+=dp[i-1][j-1][k];
			}
		}
	}
	long long ans=0;
	for(int i=1; i<=n; i++)
		ans+=dp[n][i][a*i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 61184
def spline(func=int, iter_=None):
    if iter_ is None:
        iter_ = input().split()
    return map(func, iter_)


K, S = spline()
count = 0
k = K + 1
for x in range(k):
    for y in range(k):
        z = S - x - y
        if 0 <= z <= K:
            count += 1
print(count)


Measured memory_bytes: 2940
#include<stdio.h>
#include<string.h>
#define N 14
#define M 1000000
char G[M][N];
int getChar(char c){
  if(c=='A')return 1;
  else if(c == 'C')return 2;
  else if(c=='G')return 3;
  else if(c=='T')return 4;
  else return 0;
}

int getdata(char a[]){
  int sum=0;
  int p=1,i;
  for(i=0;i<strlen(a);i++){
    sum += p*(getChar(a[i]));
    p *= 5;
  }
  return sum;
}

int g1(int data){return
  data % M;
}
int g2(int data){
  return 1+(data % (M-1));
}

int finddata(char a[]){
  int key,i,g;
  key = getdata(a);
  i=0;
  while(1){
    g = (g1(key)+ i*g2(key))%M;
    if(strcmp(G[g],a)==0) return 1;
    else if(strlen(G[g])==0) return 0;
    i++;
  }
  return 0;
}

int insert(char a[]){
  int key,i,g;
  key = getdata(a);
  i=0;
  while(1){
    g = (g1(key) + i*g2(key))%M;
    if(strcmp(G[g],a)==0)return 1;
    else if(strlen(G[g])==0){
      strcpy(G[g],a);
      return 0;
    }
    i++;
  }
  return 0;
}

int main(){
  int i,j=0,b,k;
  char a[M][3],c[M],d[M];
  for(i=0;i<M;i++){
    G[i][0] = '\0';
  }
  scanf("%d",&b);
  for(i=0;i<b;i++){
    scanf("%s%s",a[i],c);
  if(a[i][0] == 'i'){
    insert(c);
  }
  else{
    if(finddata(c)){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }
}
return 0;
}

Measured memory_bytes: 17712
x = int(input())

if x <= 6:
    print(1)
    exit()

div, mod = divmod(x, 6 + 5)
# print(f'{div=}, {mod=}')

if mod == 0:
    ans = div * 2
elif mod <= 6:
    ans = div * 2 + 1
else:
    ans = div * 2 + 2
print(ans)


Measured memory_bytes: 9084
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		N = N-1;
		long div = N;
		int mod = 0;
		
		List<Integer> list = new ArrayList<>();
		
		while(true) {
			mod = (int) (div % 26);
			div = div / 26;
			
			list.add(mod);
			
			if(div == 0) {
				break;
			}
			else {
				div = div -1;
			}
		}
		
		Collections.reverse(list);
		
		
		StringBuilder sb = new StringBuilder();
		
		for(int i : list) {
			
			switch(i) {
			case 0 :
				sb.append("a");
				break;
			case 1 :
				sb.append("b");
				break;
			case 2 :
				sb.append("c");
				break;
			case 3 :
				sb.append("d");
				break;
			case 4 :
				sb.append("e");
				break;
			case 5 :
				sb.append("f");
				break;
			case 6 :
				sb.append("g");
				break;
			case 7 :
				sb.append("h");
				break;
			case 8 :
				sb.append("i");
				break;
			case 9 :
				sb.append("j");
				break;
			case 10 :
				sb.append("k");
				break;
			case 11 :
				sb.append("l");
				break;
			case 12 :
				sb.append("m");
				break;
			case 13 :
				sb.append("n");
				break;
			case 14 :
				sb.append("o");
				break;
			case 15 :
				sb.append("p");
				break;
			case 16 :
				sb.append("q");
				break;
			case 17 :
				sb.append("r");
				break;
			case 18 :
				sb.append("s");
				break;
			case 19 :
				sb.append("t");
				break;
			case 20 :
				sb.append("u");
				break;
			case 21 :
				sb.append("v");
				break;
			case 22 :
				sb.append("w");
				break;
			case 23 :
				sb.append("x");
				break;
			case 24 :
				sb.append("y");
				break;
			case 25 :
				sb.append("z");
				break;					
			}
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 27020
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  string S;
  cin >> S;

  int N = S.size();
  string ans = "Yes";
  rep(i,N){
    if ((i % 2 == 0 && S.at(i) == 'L') || (i % 2 == 1 && S.at(i) == 'R')){
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC131D()
{
	int N;
	cin >> N;
	multimap<int, int> work;
	for (int i = 0; i < N; ++i)
	{
		int A, B;
		cin >> A >> B;
		work.insert({ B,A });
	}

	int sum = 0;
	for (const auto& x : work)
	{
		sum += x.second;
		if (sum > x.first)
		{
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}
int main()
{
	ABC131D();
	return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <math.h>
int q_sort(int d[],int left,int right)
{
	if(left >= right) return 0;
	int pipot = d[(left+right)/2],l = left, r = right,tmp;
	while(l < r){
		while(d[l] < pipot) l++;
		while(d[r] > pipot) r--;
		if(l <= r){
			tmp = d[l]; d[l] = d[r]; d[r] = tmp;
			l++; r--;
		}
	}
	q_sort(d,left,r);
	q_sort(d,l,right);
}
int divisor(int num,int d[])
{
	int i,j=0,c[(int)sqrt(num)],k;
	int castle=0;
	//printf("sqrt %d\n",(int)sqrt(num));
	for(i=1;i<=(int)sqrt(num);i++)
	{
		if(num % i == 0)
		{
			d[j] = i;
			castle++;
			if(i != num / i) c[j] = num/i;
			j++;
			castle++;
		}
	}
	k = j;j--;
	for(i = j; i >= 0; i--){
		d[k] = c[i];
		k++;
	}
	return castle;
}




int kate(int ko_ho,int d[],int K,int N)
{
	int i,j,c[N],w = 0;
	for(i = 0; i < N; i++)
	{
		c[i] = d[i]%ko_ho;
		if(c[i] == 0) w++;
	}
	q_sort(c,0,N-1);
	int plas= 0, mainus=0;
	/*printf("%d\n",ko_ho);
	for(i = 0 ; i < N; i++)
	{
		printf("%d ",c[i]);
	}
	printf("\n");
	*/
	for(i = w; i < N; i++)
	{
		plas = 0; mainus = 0;
		for( j = 0; j < i; j++)
		{
			mainus+=c[j];
		}
		for( j = i ; j < N; j++)
		{
			plas += ko_ho - c[j];
		}
		if(plas==mainus) break;
		//printf("i = %d, plas = %d, mainus = %d\n",i,plas,mainus);
	}
	if(plas <= K) return 1;
	else return 0;
}






int main(void)
{
	int N,K;
	scanf("%d %d",&N,&K);
	int A[N],i,sum=0;
	for(i = 0; i < N ; i++)
	{
		scanf("%d",&A[i]);
		sum += A[i];
	}
	
	int kouho[2*(int)sqrt(sum)],c;
	c = divisor(sum,kouho);
	
	/*
	for(i = 0 ; i < 10; i++)
	{
		printf("ap %d ",kouho[i]);
	}
	printf("\n");
	*/
	int e = 0,r;
	for(i = c-1; i >= 0; i--)
	{
		r = kouho[i];
		e = kate(r,A,K,N);
		if(e == 1) break;
	}
	printf("%d",r);
	//*/
	return 0;
}



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

int main(){
  int s,s1,s2;cin >> s;s1 = s/100;s2 = s%100;
  bool flag = true;
  if(s1 <= 12 && s1 > 0)if(s2 == 0 || s2 > 12){cout << "MMYY" << endl;flag=false;}
  if(s2 <= 12 && s2 > 0)if(s1 == 0 || s1 > 12){cout << "YYMM" << endl;flag=false;}
  if(s1 <= 12 && s1 > 0 && s2 <= 12 && s2 > 0){cout << "AMBIGUOUS" << endl;flag=false;}
  if(flag)cout << "NA" << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse=False):
    data.sort(key=lambda x:x[col],reverse=revese)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def mydictvaluesort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[1] )

def mydictkeysort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[0] )

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()
d,x = MI()
a = CI(n)

s = n
for i in range(n):
    s += (d-1)//a[i]
print(s+x)

Measured memory_bytes: 76948
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
    int d = 0;
    cin >> d;
    char S[d] = {0},N[d] = {0};
    cin >> S >> N;
    for(int i = 0;i < d;i++){
        cout << S[i] << N[i];
    }
    return 0;
}


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

int main(void){
    int a;
    char S[4];
    scanf("%s",S);

    if(strcmp(S,"ABC")){ //同じなら0を返すので、「もし"ABC"じゃなければ」printf("ABC\n");を実行する
        printf("ABC\n");
    }else{
        printf("ARC\n");
    }

    return 0;
}


Measured memory_bytes: 1648
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D;
  cin >>A>>B>>C>>D;
  if((A+B)-(C+D)==0){
    cout<<"Balanced"<<endl;
  }
  else if((A+B)-(C+D)>0){
    cout<<"Left"<<endl;
  }
  else{
    cout<<"Right"<<endl;
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define INF 1000000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print(""); 
#define show(x) cerr << #x << " = " << x << "\n";
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

const int mod = 998244353;
class mint {
public:
    ll x;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

ll modpow(ll a, ll n){
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

void Main(){

	ll N, K;
	cin >> N >> K;
	vvl v(K, vl(2));
	rep(i, K) cin >> v[i][0] >> v[i][1];
	
	vector<mint> dp(N + 10);
	vector<mint> acc(N + 10);
	dp[1] = 1;
	acc[1] = 1;
	
	rep2(i, 2, N + 1){
		rep(j, K){
			ll s = v[j][0];
			ll g = v[j][1];
			if(i - s <= 0) continue;
			ll add = acc[i - s].x - acc[max(i - g - 1, 0LL)].x;
			dp[i] += add;
		}
		acc[i] = dp[i] + acc[i - 1];
	}
	mint ans = dp[N];
	print(ans);

}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	Main();
	return 0;
	
}





Measured memory_bytes: 6304
import numpy as np
from collections import Counter

n, k, q = list(map(int, input().split()))
a = [int(input())-1 for i in range(q)]

ans = [k - q for i in range(n)]
cnt = Counter(a)
for k, v in cnt.items():
  ans[k] += v

for ansi in ans:
  print("Yes" if ansi > 0 else "No")
   

Measured memory_bytes: 24528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = Integer.parseInt(sc.next());
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		sc.close();

		if(Math.abs(x - a) < Math.abs(x - b)) {
			System.out.println("A");
		}else {
			System.out.println("B");
		}

	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


ll res(ll h,ll w) {
    ll ans=0;
    vector<ll> s(3);
    if (h%3==1) {
        s[0]=(h/3)*w;
        s[1]=(h-h/3)*(w/2);
        s[2]=(h-h/3)*(w-w/2);
        sort(s.begin(),s.end());
        ans=(s[2]-s[0]<w)?(s[2]-s[0]):w;
    } else if (h%3==2) {
        s[0]=(h/3+1)*w;
        s[1]=(h-h/3-1)*(w/2);
        s[2]=(h-h/3-1)*(w-w/2);
        sort(s.begin(),s.end());
        ans=(s[2]-s[0]<w)?(s[2]-s[0]):w;
    }
    return ans;
}

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

    ll h,w;
    cin >> h >> w;
    ll ans1=res(h,w);
    ll ans2=res(w,h);
    ll ans=(ans1<ans2)?ans1:ans2;
    cout << ans << endl;
    return 0;
}

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

ans = "UNRESTORABLE"

for i in range(len(s)-len(t)+1):

    for j in range(len(t)):
        isRestorable = True
        if not s[j+i] == t[j] and not s[j+i] == "?":
            isRestorable = False
            break

    if isRestorable:
        ans = s[0:i] + t + s[i+len(t):len(s)]
        ans = ans.replace("?", "a")
print(ans)

Measured memory_bytes: 38384
import sys
n=int(input())
h=list(map(int,input().split()))
if h[0]>0:
  h[0]-=1
for i in range(1,n):
  if h[i-1]==h[i]:
    sonomama=1
  elif h[i]>h[i-1]:
    h[i]-=1
  else:
    print("No")
    sys.exit()
print("Yes")
    


Measured memory_bytes: 20720
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long ll;

ll num[100005];
int opt[100005];

int main() {
  int n;
  scanf("%d",&n);
  ll ans=0,sum=0;
  for(int i=1;i<=n;i++) {
  	if (i==1) opt[i]=1;
  	else {
  		char str[5];
  		scanf("%s",str);
  		opt[i]=((str[0]=='+')?1:-1);
	  }
  	scanf("%lld",&num[i]);
	ans+=opt[i]*num[i];
	sum+=num[i];
  }
  for(int i=1;i<=n;i++)
    if (opt[i]==-1) {
    	ll s=sum-2LL*num[i];
    	for(int j=i+1;j<=n&&opt[j]==1;j++) s-=2LL*num[j];
    	ans=max(ans,s);
    	sum-=2LL*num[i];
	}
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef long long ll;

const int    INF = 1000000000;
const int    MOD = 1000000007;
const double EPS = 1e-8;

int main(){
    int N, D;
    cin >> N >> D;
    int p[100][100];

    for(int i = 0; i < N; i++)
    for(int j = 0; j < D; j++)
        cin >> p[i][j];

    int dp[100][100][100] = {};

    for(int i = 0; i <= D; i++)
    for(int j = 0; j <= D; j++)
    for(int k = 0; k < N; k++)
        dp[i][j][k] = INF;

    for(int k = 0; k < N; k++) dp[D][0][k] = 0;

    int back[100][100][100] = {};

    for(int i = D - 1; i >= 0; i--)
    for(int j = 0; j <= D; j++)
    for(int u = 0; u < N; u++)
    for(int v = 0; v < N; v++){
        int bj = j - (u != v ? 1 : 0);
        if(bj < 0) continue;
        int& next = dp[i][j][v];
        int curr = dp[i + 1][bj][u];
        if(next > curr + p[v][i]){
            next = curr + p[v][i];
            back[i][j][v] = u;
        }
    }
    int P = INF, M = INF, s = INF;

    for(int j = 0; j <= D; j++)
    for(int k = 0; k < N; k++)
    if(P > dp[0][j][k]){
        P = dp[0][j][k];
        M = j;
        s = k;
    }

    cout << P << " " << M << endl;
    for(int i = 0; i < D; i++){
        cout << s + 1 << endl;
        int ns = back[i][M][s];
        if(ns != s) M --;
        s = ns;
    }
    return 0;
}

Measured memory_bytes: 9012
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let mut x: i32 = sc.read();
    let mut y: i32 = sc.read();
    x -= 1;
    y -= 1;
    let mut count: Vec<i32> = vec![0; n];
    for i in 0..n {
        for j in i + 1..n {
            let mut d = (j - i) as i32;
            d = std::cmp::min(d, (x - i as i32).abs() + 1 + (y - j as i32).abs());
            d = std::cmp::min(d, (y - i as i32).abs() + 1 + (x - j as i32).abs());
            count[d as usize] += 1;
        }
    }
    for i in 1..n {
        println!("{}", count[i]);
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 4352
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
#include"bits/stdc++.h"
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define ends ' '
#define endl '\n'
#define pb emplace_back
#define x first
#define y second
#define pii pair<int, int>
#define sz(x) (int)(x).size()

int32_t main()
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif
	IOS;

	int cur = 0;

	int n;
	cin >> n;

	for(int i = 1; i <= n; ++i) {
		int x;
		cin >> x;
		if(x == cur+1) {
			cur++;
		}
	}

	int ans = -1;

	if(cur != 0) {
		ans = n-cur;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
//P1T2
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4;
int raw[maxn];
int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)scanf("%d",&raw[i]);
	long long ans;
	for(int i = 1;i <= n;i++)
		for(int j =i;j <= n;j++)
			if(i != j)ans += raw[i]*raw[j];
	printf("%lld",ans);
	return 0;
}

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

#define MAX 10000

int ans[MAX + 1];

void func()
{
    int l = sqrt(MAX + 1) + 1;
    for (int x = 1; x <= l; x++)
    {
        for (int y = 1; y <= l; y++)
        {
            for (int z = 1; z <= l; z++)
            {
                int v = x * x + y * y + z * z + x * y + y * z + z * x;
                if (v < MAX + 1)
                {
                    ans[v] += 1;
                }
            }
        }
    }
}

int main()
{
    int n;
    cin >> n;
    func();
    for (int i = 1; i <= n; i++)
        cout << ans[i] << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
#define MAX_NUM (1000000000 + 7)
 
typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
 
using namespace std;
 
template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}
 
template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}
 
template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}
 
bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}
 
u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}
 
u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
 
  return b ? gcd(b, a % b) : a;
}
typedef struct {
  u32 a;
  u32 b;
  u32 c;
  u32 d;
} CondType;
void Calc(u32 n, u32 m);
vector<u32> A(11);
u32 Res = 0;
u32 N, M, Q;
vector<CondType> Cond(50);
 
int main() {
  cout << setprecision(18);
  cin >> N >> M >> Q;
  for (u32 i = 0; i < Q; ++i) {
    u32 a, b, c, d;
    cin >> a >> b >> c >> d;
    CondType tmp = {a, b, c, d};
    Cond[i] = tmp;
  }
  Calc(0, 1);
  cout << Res << endl;
 
  return 0;
}
 
void Calc(u32 n, u32 m) {
  if (n > N)
    return;
  else if (n == N) {
    A[n] = m;
    u32 res = 0;
    for (u32 i = 0; i < Q; ++i) {
      if (A[Cond[i].b - 1] - A[Cond[i].a - 1] == Cond[i].c) {
        res += Cond[i].d;
      }
    }
    Res = Res > res ? Res : res;
 
  } else {
    for (u32 i = m; i <= M; ++i) {
      A[n] = i;
      Calc(n + 1, i);
    }
  }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
    using namespace std;
     
    typedef long long ll;
    #define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
    #define ALL(v) (v).begin(),(v).end()
    template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
    template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
    template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
    template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}
     
     
    int main2() {
      string str;
      cin >> str;
      int N = (int)str.size();
      ll ans = 1;
      vector<int> cnt(26);
      REP(i, N) cnt[ str[i] - 'a' ]++;
      for (int i = 0; i < N; i++) {
        REP(c, 26) if (str[i] - 'a' != c) ans += cnt[c];
        cnt[str[i] - 'a']--;
      }
      cout << ans << endl;
      return 0;
    }
     
    int main() {
      for (;!cin.eof();cin>>ws) main2();
      return 0;
    }
     

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong

signed main(){
	int n,m;
	cin >> n >> m;
	int syu[MAX] = {};

        REP(i,n){
		int k;
		cin >> k;
		REP(j,k){
			int tmp;
			cin >> tmp;
			syu[tmp]++;
		}
	}
      	int ans = 0;
	REP(i,m+1){
		if(syu[i]==n) ans ++;
	}
	cout << ans << endl;
}

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

int arr[105];

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> arr[i];
  sort(arr, arr + n);
  reverse(arr, arr + n);
  int a = 0, b = 0;
  for (int i = 0; i < n; i++)
    if (i % 2 == 0)
      a += arr[i];
    else
      b += arr[i];
  cout << a - b << endl;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
name = []
time = []
endtime =[]
endname = []
for i in range(n):
    a = input().split()
    name.append(a[0])
    time.append(int(a[1]))
s = 0
while True:
    if time[0]> q:
        time[0] -= q
        time.append(time.pop(0))
        name.append(name.pop(0))
        s += q
    else:
        s += time[0] 
        time.pop(0)
        print(name.pop(0),s)      
    
    if len(name) == 0:
        break
    

Measured memory_bytes: 11408
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


int solve(){


	string s,t;cin>>s>>t;
	int a,b;cin>>a>>b;
	string z;cin>>z;
	if(s==z) a--;
	else if(z==t) b--;
	cout<<a<<" "<<b;

    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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


Measured memory_bytes: 2100
using System;
using System.Collections.Generic;
using System.Linq;

class Program{

  static int n;
  static string ans;

  static int Main() {

    string nyu =  Console.ReadLine();
    n = int.Parse(nyu);

    if (n < 1000) {
      ans = "ABC";
    } else {
      ans = "ABD";
    }

    Console.WriteLine("{0}", ans);

    return 0;
  }

}

Measured memory_bytes: 13140
#include<cstdio>
#include<iostream>
#include<cmath>
#include<string>
#include<set>
#include<queue>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
#define rep2(x,from,to) for(int x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
#define INF 10000000
#define N 5000000 //max of the number of vertex
typedef long long ll;
typedef pair<int ,int> P;
typedef pair<int, P > PP;

int pflag[N];
int p[N];
int pp;
int n;
int nn;
int main()
{
    rep(i,N)
    {
        pflag[i]=1;
    }
    rep2(i,2,N)
    {
        if(pflag[i]==1)
        {
            for(int j=i*2;j<N;j+=i)
            {
                pflag[j]=0;
            }
        }
    }
    rep(i,N)
    {
        if(pflag[i]==1)
        {
            p[pp++]=i;
        }
    }
    cin>>n;
    rep(i,pp)
    {
        if(p[i]%5==2)
        {
            cout<<p[i];
            nn++;
            if(nn==n)
            {
                cout<<endl;
                return 0;
            }
            else cout<<' ';
        }
    }
    return 0;
}

Measured memory_bytes: 22272
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=5e5+10;
ll prea[maxn],preb[maxn];

int main()
{
	ll n,m,k;ll ans=0;
	cin>>n>>m>>k;ll x;
	for(int i=1;i<=n;i++){
		cin>>x;
		if(i==1) prea[i]=x;else prea[i]=prea[i-1]+x;
	}
	for(int i=1;i<=m;i++){
		cin>>x;
		if(i==1) preb[i]=x;else preb[i]=preb[i-1]+x;
	}
	for(int i=0;i<=n;i++){
		x=k-prea[i];if(x<0) break; 
		int j=upper_bound(preb,preb+m,x)-preb;
		if(x>=preb[m]) ans=max(ans,(ll)i+j);
		else ans=max(ans,(ll)i+j-1);
	}
	for(int i=0;i<=m;i++){
		x=k-preb[i];if(x<0) break; 
		int j=upper_bound(prea,prea+n,x)-prea;
		if(x>=prea[n]) ans=max(ans,(ll)i+j);
		ans=max(ans,(ll)i+j-1);
	}
	cout<<ans;
	return 0;	
} 

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

using namespace std;
 
void solve() {
    int n, k;
    cin >> n >> k;

    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    vector<int> dp(n, -1);
    function<int(int)> calc_dp = [&] (int i) {
        if (dp[i] != -1) {
            return dp[i];
        }
        if (i <= 0) {
            return 0;
        } else if (i == 1) {
            dp[i] = abs(v[i] - v[i-1]);
            return dp[i];
        }

        int min_cost = 1e9;
        for (int m = 0; m < k; ++m) {
            if (i-1-m < 0)
                break;
            
            int cost = abs(v[i] - v[i-1-m]) + calc_dp(i-1-m);
            min_cost = min(cost, min_cost);
        }

        dp[i] = min_cost;
        return dp[i];
    };

    cout << calc_dp(n-1) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // cin >> t;

    for (int i = 0; i < t; ++i) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 13492
uses math;
var
	ans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;
	p,m:array[0..400]of Longint;
begin
	read(n,Ma,Mb);
	ans:=10000;
	for i:=1 to 400 do begin
		p[i]:=ans;
		m[i]:=ans;
	end;
	for i:=1 to n do begin
		read(a,b,c);
		x:=Ma*b-Mb*a;
		if x>0 then begin
			for j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);
			mp:=min(mp+x,400);
		end else if x<0 then begin
			for j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);
			mm:=min(mm-x,400);
		end else ans:=min(ans,c);
	end;
	for i:=1 to 400 do ans:=min(ans,p[i]+m[i]);
	if ans<10000 then writeln(ans)else writeln(-1);
end.

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<map>
#include<queue>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
const int inf = 1 << 30;
const int maxn = 1e3;
typedef long long LL;
int main(){
	int a,b;
	cin >> a >> b;
	if(b%2==0||a%2==0) printf("Even\n");
	else printf("Odd\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{   
	int N;
	cin>>N;
	string s;
	cin>>s;
	int cnt=0,ans=0;
	for(int i=0;i<N;i++)
	{
		if(s[i]=='R')cnt++;
	}
	for(int i=0;i<cnt;i++)
	{
		if(s[i]=='W')ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3752
#include<iostream>
#include<cstring>
#include<iomanip>

using namespace std;
using ll=long long;

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

void Main(){
  int n;
  cin>>n;
  ll L[87];
  L[0]=2ll,L[1]=1ll;
  rep(i,2,n+1) L[i]=L[i-2]+L[i-1];
  cout<<L[n]<<endl;
}

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  Main();
}

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

int main(void){
  int ary[1000];
  double ave;
  int num;
  int i;
  double buf;
  double a;
  
  while(1)
    {
      ave=0;
      buf=0;
      
      scanf("%d",&num);
      if(num == 0)
        {
          break;
        }
      for(i=0;i<num;i++)
        {
          scanf("%d",&ary[i]);
          ave += ary[i];
        }
      ave /= num;
      
      for(i=0;i<num;i++)
        {
          buf += pow(((double)ary[i]-ave),2);
        }
      a = sqrt((buf/num));

      printf("%f\n",a);
    }

  
return 0;
}

Measured memory_bytes: 636
n,k,q = map(int, input().split())
l = [k] * n
a = list(int(input()) for _ in range(q))
for i in range(q):
  l[a[i] - 1] += 1
for i in range(n):
  if q - l[i] >= 0:
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 10460
#include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int res=0,k=10,idx=0;
    int a[6];
    for(int i=1;i<=5;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%10<k && a[i]%10!=0)
        {
            k=a[i]%10;
            idx=i;
        }
    }
    for(int i=1;i<=5;i++)
    {
        if(i!=idx)
        {
            if(res%10!=0)
                res+=(10-res%10);
            res+=a[i];
        }
    }
    if(res%10!=0)
        res+=(10-res%10);
    if(idx!=0)
        res+=a[idx];
    printf("%d",res);
    return 0;
}


Measured memory_bytes: 256
int main(){

    int i;
	int num;
	int counter=0;
	scanf("%d",&num);
	int array[num+1];
	for (i=1;i<num;i++){
		scanf("%d ",&array[i]);
	}
	scanf("%d",&array[i]);
	for (i=1;i<num+1;i++){
		if(array[array[i]]==i){
			counter++;
		}
	}
	counter /= 2;
	printf("%d",counter);
	return 0;
}



Measured memory_bytes: 512
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// -----------------------------------------------------------------------------
// main
// -----------------------------------------------------------------------------
fn main(){
    input!{
        a: u64,
        b: u64
    }
    let ans = if a*b%2==0 {"No"} else {"Yes"};
    println!("{}", ans);
}



Measured memory_bytes: 4352