akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <list>
#include <array>
#include <cstdlib>
#include <stack>
#include <string>
#include <queue>
#include <chrono>
#include <functional>
#include <limits>
#include <cmath>
#include <algorithm>
#include <random>
#include <regex>
#include <tuple>
#include <numeric>
#include <cassert>
#include <utility>
#include <bitset>
#include <complex>
#include <iomanip>
#include <ostream>
#include <sstream>
#include <ctime>
using namespace std;
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define index INDEX
#ifndef ONLINE_JUDGE
#define print(x) PRINT(x, #x)
template<typename T> void PRINT(T VARIABLE, const string& NAME) {
	cerr << NAME << " = " << fixed << VARIABLE << "\n";
}
#else
#define print(x) 0 
#endif
int generate_random() {
	const int MAX_RANDOM = (int)1e6;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	return uniform_int_distribution<int>(0, MAX_RANDOM)(rng);
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll INFLL = 2 * (ll)1e18 + 100;
#define int ll
#ifdef int 
const int INFINT = INFLL;
#else
const int INFINT = 2 * (int)1e9 + 100;
#endif
const double PI = atan(1) * 4;
const double EPS = 1e-6;
const int SEED = (int)1e3 + 7;
const int MOD = (int)1e9 + 7;
const int NMAX = (int)1e6 + 5;

int dp[NMAX][3];

int32_t main() {
#ifndef ONLINE_JUDGE
	double START_PROGRAM = clock();
#endif
	srand(time(NULL));
	cout << setprecision(20) << fixed;
	FASTIO;
    int n;
    cin >> n;
    for1(i, n)
    {
        int a, b, c;
        cin >> a >> b >> c;
        dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a);
        dp[i][1] = max(dp[i - 1][0] + b, dp[i - 1][2] + b);
        dp[i][2] = max(dp[i - 1][1] + c, dp[i - 1][0] + c);
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
    






#ifndef ONLINE_JUDGE
	double END_PROGRAM = clock();
	double ELAPSED_TIME = (END_PROGRAM - START_PROGRAM) / CLOCKS_PER_SEC;
	cerr << "\n\nElapsed Time: " << ELAPSED_TIME * 1000 << "\n";
#endif
	return 0;
}







Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;






void solve(){
    int n, ans = 0;
    cin>>n;
    for(int i = 100; i<n; ){
        i += (i / 100);
        ans++;
    }
    cout<<ans;
}

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  set<string> words;
  int n;
  cin >> n;
  string w;
  string prec;
  cin >> prec;
  words.insert(prec);
  bool pass = true;
  for (int i = 0; i < n-1; i++) {
    cin >> w;
    if (words.count(w) > 0 || prec.at(prec.size()-1) != w.at(0)) {
      pass = false;
      break;
    }
    words.insert(w);
    prec = w;
  }
  if (pass) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2
#define pii pair<int,int>

using namespace std;

int n;
pii a[N];

int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i].ff;
		a[i].ss = i;
	}
	sort(a + 1,a + n + 1);
	for(int i = 1;i <= n;i++)
		cout << a[i].ss << ' ';
}

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

bool islower(char a){
	if(a>='a' && a<='z') return true;
	else return false;
}

int main(){
	string s,ans;
	while(getline(cin,s)){
		int shift=1;
		ans=s;
		while(1){
			if(ans.find("the" ,0)!=string::npos || ans.find("this",0)!=string::npos || ans.find("that",0)!=string::npos) break;
			for(int i=0;i<s.size();++i){
				if(islower(s[i])){
					if(s[i]+shift<='z'){
						ans[i]=s[i]+shift;
					} else {
						ans[i]=s[i]-26+shift;
					}
				}
			}
			shift++;
		}
		cout << ans << endl;
	}
	return 0; 
}

Measured memory_bytes: 1180
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)

	var diff float64 = 1000
	for i := 0; i <= len(s)-3; i++ {
		num, _ := strconv.Atoi(s[i : i+3])
		if diff > math.Abs(float64(753-num)) {
			diff = math.Abs(float64(753 - num))
		}
	}
	fmt.Println(diff)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define deb(x) cout << #x << " => " << x << endl

int main() {

    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

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

    int dp[n];
    memset(dp, 0, sizeof dp);
    dp[0] = 0;
    dp[1] = abs(arr[0] - arr[1]);
    for (int i = 2; i < n; i++) {
        dp[i] = min(abs(arr[i - 2] - arr[i]) + dp[i - 2], abs(arr[i - 1] - arr[i]) + dp[i - 1]);
    }
    cout << dp[n - 1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cctype>
using namespace std;
int main()
{
	bool flag=true;
	int a,b;
	char n[11];
	cin>>a>>b>>n;
	for(int i=0;i<a;i++)
	{
		if(!isdigit(n[i])) flag=false;
	}
	if(n[a]!='-') flag=false;
	for(int i=a+1;i<a+b+1;i++)
	{
        if(!isdigit(n[i])) flag=false;		
	}
	if(flag==true)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
} 

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

int main() {
  int N;
  cin >> N;
  vector<int> a( N );
  for ( int j = 0; j < N; j++ )
    cin >> a.at( j );
  int n = 1, out = 1;
  while ( n < N ) {
    if ( a.at( out - 1 ) != 2 ) {
      out = a.at( out - 1 );
      n++;
    }
    else {
      out = 2;
      cout << n << endl;
      break;
    }
  }
  if ( out != 2 )
    cout << -1 << endl;
}


Measured memory_bytes: 640
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}


fun solve(out: PrintWriter) {
    val n = readInteger()
    if (n == 1) {
        println("Hello World")
    } else {
        val a = readInteger()
        val b = readInteger()
        println(a + b)
    }
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 33688
N, K = map(int, input().split())
S = input()

one_list = []
zero_list = []

cur_char = S[0]
char_num = 0
for i in range(N):
    if S[i] == cur_char:
        char_num += 1
    else:
        if cur_char == '0':
            zero_list.append(char_num)
        else:
            one_list.append(char_num)
        cur_char = S[i]
        char_num = 1
if cur_char == '0':
    zero_list.append(char_num)
else:
    one_list.append(char_num)

len_zero_list = len(zero_list)
len_one_list = len(one_list)
# print(len_one_list)
# print(len_zero_list)

cont_length_list = []

if K >= len(zero_list):
    ans = N
else:
    if S[0] == '1':
        tmp_length = sum(one_list[:K+1])+sum(zero_list[:K])
        cont_length_list.append(tmp_length)
        for i in range(min(len_zero_list,len_one_list)-K):
            if K+1+i<len_one_list:
                tmp_length += one_list[K+1+i]+zero_list[K+i]
            else:
                tmp_length += zero_list[K+i]
            tmp_length -= one_list[i]+zero_list[i]
            cont_length_list.append(tmp_length)
        # print(cont_length_list)
    else:
        tmp_length = sum(one_list[:K])+sum(zero_list[:K])
        cont_length_list.append(tmp_length)
        if K == len_one_list:
            tmp_length+=zero_list[K]
            tmp_length -= zero_list[0]
            cont_length_list.append(tmp_length)
        if K < len_zero_list-1:
            tmp_length += zero_list[K]+one_list[K]
            tmp_length -= zero_list[0]
            cont_length_list.append(tmp_length)
            for i in range(1, len_zero_list-K):
                if K+i<len_one_list and K+i < len_zero_list:
                    tmp_length += one_list[K+i]+zero_list[K+i]
                else:
                    tmp_length += zero_list[K+i]
                tmp_length -= one_list[i-1]+zero_list[i]
                cont_length_list.append(tmp_length)
        # print(cont_length_list)
    # print(cont_length_list)
    ans = max(cont_length_list)

print(ans)


Measured memory_bytes: 5540
from collections import Counter

N = int(input())

li = []

for _ in range(N):
    li.append(input())

a =  Counter(li)
# print(a)

print("AC x " + str(a["AC"]))
print("WA x " + str(a["WA"]))
print("TLE x " + str(a["TLE"]))
print("RE x " + str(a["RE"]))

Measured memory_bytes: 16616
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n;
	cin >> n;
	vector<int> l(n);
	REP(i, n) {
		cin >> l[i];
	}
	sort(all(l));
	ll res = 0;
	REP(i, n) {
		REP(j, i) {
			int lb = abs(l[i] - l[j]) + 1, ub = l[i] + l[j] - 1;
			auto itr1 = lower_bound(all(l), lb) - l.begin();
			auto itr2 = lower_bound(all(l), ub+1) - l.begin();
			int d = itr2 - itr1;
			if (lb <= l[i] && l[i] <= ub) {
				d--;
			}
			if (lb <= l[j] && l[j] <= ub) {
				d--;
			}
			res += d;
		}
	}
	put(res/3);
	return 0;
}


Measured memory_bytes: 256
local function reada(n,m)m=m or 1 r={}for i=1,m do r[i]={}end for i=1,n do for j=1,m do r[j][i]=io.read"*n"end end return unpack(r)end 
N=io.read"*n"
K=io.read"*n"
p=reada(N)
table.sort(p)
s=0
for i=1,K do
s=s+p[i]
end
print(s)

Measured memory_bytes: 2760
#include <bits/stdc++.h>
#define INFTY 2000000100
using namespace std;
int main()
{
    char S[8];
    int value;
    priority_queue<int> t;
    do
    {
        scanf("%s", S);
        if (S[0] == 'i')
        {
            scanf("%d", &value);
            t.push(value);
        }
        else if (S[0] == 'e' && S[1] == 'x')
        {
            printf("%d\n", t.top());
            t.pop();
        }
    } while (!(S[0] == 'e' && S[1] == 'n'));
    // for (int i = 0; i < ans.size(); ++i)
    // {
    //     printf("%d\n", ans[i]);
    // }
}


Measured memory_bytes: 7048
#include<stdio.h>
int main()
{
    int i, n, j, satisfaction = 0;
    scanf("%d",&n);
    int A[n], B[n], C[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&A[i]);
    }
    for(i=0;i<n;i++)
    {
        scanf("%d",&B[i]);
    }
    for(i=0;i<n-1;i++)
    {
        scanf("%d",&C[i]);
    }
    for(i=0;i<n;i++)
    {
        satisfaction += B[A[i]-1];
        if(i>0)
        if(A[i]-A[i-1]==1)
        {
            satisfaction += C[A[i-1]-1];
        }
    }
    printf("%d",satisfaction);
    return 0;
}

Measured memory_bytes: 128
N, W = map(int, input().split())
w_list, v_list = [], []
for _ in range(N):
    w, v = map(int, input().split())
    w_list.append(w)
    v_list.append(v)
sum_v = sum(v_list)+1

dp = [[float('INF')]*(sum_v) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    w, v = w_list[i], v_list[i]
    for j in range(sum_v):
        if v<=j: dp[i+1][j] = min(dp[i][j], dp[i][j-v]+w)
        else: dp[i+1][j] = dp[i][j]
for i in range(sum_v-1, -1, -1):
    if dp[-1][i] <= W:
        print(i)
        break

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

#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() {
  int n;
  cin >> n;

  ll a[n];
  ll v[200001];
  rep(i, n) {
    v[i] = 0;
  }

  rep(i, n) {
    cin >> a[i];
    v[a[i] - 1]++;
  }

  ll total = 0;
  rep(i, n) {
    total += v[i] * (v[i] - 1) / 2;
  }


  rep(i, n) {
    ll tmp = v[a[i] - 1]  - 1;
    cout << total - tmp << endl;;
  }

  return 0;
}

Measured memory_bytes: 5760
N = int(input())
txy = [list(map(int, input().split())) for i in range(N)]
t = [0]
x = [0]
y = [0]
for t_i, x_i, y_i in txy:
    t.append(t_i)
    x.append(x_i)
    y.append(y_i)
can = True
for i in range(N):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if dt < dist:
        can = False
    elif dist % 2 != dt % 2:
        can = False
if can == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 29836
using System;
using System.Collections.Generic;

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var t = new List<int> {0};
            var x = new List<int> {0};
            var y = new List<int> {0};

            for(int i = 0; i < N; ++i) //怒涛の入力
            {
                string[] input = Console.ReadLine().Split(' ');
                t.Add(int.Parse(input[0]));
                x.Add(int.Parse(input[1]));
                y.Add(int.Parse(input[2]));
            }

            bool muri = false; //無理だと分かった瞬間立つやつ

            for (int r = 0; r < N; ++r)
            {
                int dr = Math.Abs(x[r + 1] - x[r]) + Math.Abs(y[r + 1] - y[r]);
                int dt = t[r + 1] - t[r];

                if(dr > dt | dr % 2 != dt % 2)
                {
                    muri = true;
                    break;
                }
            }

            if(muri == false)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 16080
n,s=map(int,input().split())
x=[int(x) for x in input().split()]

l=list()

def lcd(a,b):
  while b:
    a,b=b,a%b
  return a

for i in range(n):
  if x[i]!=s:
    l.append(abs(x[i]-s))

d=l[0]
for i in range(1,len(l)):
  d=lcd(d,l[i])

print(d)


Measured memory_bytes: 14252
n, m = gets.split.map(&:to_i)

@edge = Array.new(n+1) {[]}
m.times do 
    a, b = gets.split.map(&:to_i)
    @edge[a] << b
    @edge[b] << a
end

@all = (1 << n + 1) - 2
@memo = 0

calc =->(now) {
    return 0 if @memo[now] == 1
    
    @memo |= 1 << now
    if @memo == @all
        @memo &= ~(1 << now)
        return 1
    end

    sum = 0
    @edge[now].each {|e| sum += calc.(e)}
    @memo &= ~(1 << now)
    return sum
}

p calc.(1)

Measured memory_bytes: 14332
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

signed main(void)
{
  string s;
  cin >> s;
  if(s[0] == s[2]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	string S=in<string>();
	int sum=0;
	REP(i,1000){
		char str[10];
		sprintf(str,"%03d",i);
		int index=0;
		REP(j,N){
			if(S[j]==str[index]){
				index++;
				if(index==3) break;
			}
		}
		if(index==3) sum++;
	}
	out(sum);
	return 0;
}


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

int main(){
  int a, b, c;
  cin >> a >> b;
  if(a == b){
    c = a;
    for(int i = 0; i < b - 1; i++){
      c = c * 10 + a;
    }
    cout << c << endl;
  }
  else if(a > b){
    c = b;
    for(int i = 0; i < a - 1; i++){
      c = c * 10 + b;
    }
    cout << c << endl;
  }
  else if(a < b){
    c = a;
    for(int i = 0; i < b - 1; i++){
      c = c * 10 + a;
    }
    cout << c << endl;
  }
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

using ll = long long;

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

#define mp make_pair
#define mt make_tuple

/* ----------- debug ---------- */

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p);

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1000000007;
// const ll MOD = 998244353;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
inline T sq(T a) { return a * a; }

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

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

ll pcnt(ll b) {
    return __builtin_popcountll(b);
}

template <typename T>
T iceil(T n, T d) {
    return (n + d - 1) / d;
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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

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

    ll x = 0;
    for (int m = 40; m >= 0; --m) {
        if (x + (1LL << m) > k) continue;

        int cnt = 0;
        for (int i = 0; i < n; ++i) {
            cnt += (a[i] >> m) & 1;
        }

        if (cnt < n - cnt) x += (1LL << m);
    }

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += (a[i] ^ x);
    }

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


Measured memory_bytes: 1024
n, x, y = map(int, input().split())
countn = [0]*(n-1)

for i in range(1, n):
  for j in range(i+1, n+1):
    a = j-i
    b = abs(x-i) + abs(y-j) + 1
    countn[min(a, b)-1] += 1
    
for k in range(n-1):
  print(countn[k])


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  string s;
  cin >> s;
  // dream dreamer erase eraser
  // maerd remaerd esare resare

  reverse(s.begin(), s.end());

  string tmp = "";
  while (s.length() > 0) {
    if (s.substr(0, 5) == "maerd" || s.substr(0, 5) == "esare") {
      s = s.substr(5);
    } else if (s.substr(0, 6) == "resare") {
      s = s.substr(6);
    } else if (s.substr(0, 7) == "remaerd") {
      s = s.substr(7);
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
int main(){
   int N;
   long int x;
   cin >> N >> x;
   long int count = 0;
   vector<long int> a(N);
    long int answer = 0;
   for(int i = 0; i < N; i++){
       cin >> a[i];
   }

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

    for(int i = 0; i < N; i++){
        if(count + a[i] <= x){
        answer += 1;
        count += a[i];
        }else{
            break;
        }
    }

    if(answer == N && x - count > 0) --answer;

    cout << answer;

    return 0;
}

Measured memory_bytes: 256
var a = readLine()!.split(separator: " ").map({Int($0)!})
var b = readLine()!.split(separator: " ").map({Int($0)!})
b.sort{$0 < $1}
var c = 0
for i in 0 ..< a[1] {
    c += b[i]
}
print(c)

Measured memory_bytes: 8424
n = gets.chomp.to_i
b = gets.chomp.split.map(&:to_i)
c = []
cnt = 0
n.times do |i|
  cnt = 0
  (n-i-1).downto(0) do |j|
    if b[j] == j + 1
      c[i] = b[j]
      b.delete_at(j)
      cnt = 1
      break
    end
  end
  if cnt == 0
    break
  end
end
puts cnt == 1 ? c.reverse : -1

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define double long double
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int h,w,cnt=0;char a[55][55];
signed main() {
	cin>>h>>w;
	rep(i,h){rep(j,w)cin>>a[i][j];}
	rep(i,h){
		rep(j,w){
			if(a[i][j]=='.'){
				for(int k=-1;k<2;k++){
					for(int l=-1;l<2;l++){
						if(a[i+k][j+l]=='#'&&i+k>=0&&i+k<h&&j+l>=0&&j+l<w)cnt++;
					}
				}
				a[i][j]=cnt+'0';
			}
			cout<<a[i][j];
			cnt=0;
		}
		cout<<endl;
	}
	cout<<endl;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int a[2];
    cin >> a[0] >> a[1];

    for (int i = 0; i < 2; i++) {
      if (a[i] % 2) {
	if (a[i] > (n / 2 + 1)) a[i] = n - a[i] + 1;
      } else {
	if (a[i] > (n / 2)) a[i] = n - a[i] + 1;
      }
    }
    int res = min(a[0], a[1]);
    
    if (res % 3 == 0) cout << 3 << endl;
    else cout << res % 3 << endl;
  }

  return 0;
}

Measured memory_bytes: 3036
import java.util.*

fun main(args:Array<String>){
    solve()
}

fun solve(){
    val n = readint()
    val a = IntArray(n + 2)
    for(i in 1 .. n){
        for(j in 1 .. n){
            val t = i.toLong() * j.toLong()
            if(t > n) break
            a[t.toInt()]++
        }
    }
    var ans = 0L
    for(i in 1 .. n){
        ans += a[i].toLong() * i.toLong()
    }
    println(ans)
}

fun read() = readLine()!!
fun reads() = readLine()!!.split(" ")
fun readint() = readLine()!!.toInt()
fun readints() = readLine()!!.split(" ").map{it.toInt()}
fun readlong() = readLine()!!.toLong()
fun readlongs() = readLine()!!.split(" ").map{it.toLong()}

Measured memory_bytes: 73996
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		char a = n.charAt(n.length()-1);

		String ans = "hon";
		if(a == '3') {
			ans = "bon";
		}else if(a == '0' || a == '1' || a == '6' || a == '8') {
			ans = "pon";
		}

		System.out.println(ans);


	}

}

Measured memory_bytes: 35612
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;
int main() {
	int p, q, r;
	cin >> p >> q >> r;
	int m;
	m = max(p, q);
	m = max(m, r);
	cout << p + q + r - m << endl;
}


Measured memory_bytes: 256
X = int(input())

score =0
half_x = round(X/2)

answer = 0

if X < 3:
    print(1)

elif X <= 8:
    print(2)

else:
    while 1 < half_x:
        half_x -= 1
        
        for p in range(2, 10):
            
            score = pow(half_x,p)
            if score > X:
                continue
        
            if answer < score:
                answer = score
                
    print(answer)

Measured memory_bytes: 3064
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    //cout << "test" << endl;
    queue<pair<int, int>> que;
    que.push(make_pair(0, 0));
    vector<bool> flg(n, false);
    while(1) {
        if (que.empty()) break;
        pair<int, int> now = que.front();
        que.pop();
        if (flg[now.first]) continue;
        if (now.first == n-1 && now.second <= 2) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
        flg[now.first] = true;
        for (auto v: g[now.first]) {
            if (flg[v]) continue;
            que.push(make_pair(v, now.second+1));
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 15668
using System;
using System.Diagnostics;
using System.IO;

namespace AtCoder {
    class Practice {
        static void Main() => CustomMain();

        static void Solve() {
            var a = ReadIntArray();

            WriteAnswer(a[0] - a[1] + 1);
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }

        static long GCD(long a, long b) {
            return b != 0 ? GCD(b, a % b) : a;
        }
    }
}

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

int main(){
	
//	struct zahyo P1,P2;
	int a,b,c;
	double d,rad,h,S,L;
//	double rangeX,rangeY;
	
	scanf("%d %d %d", &a, &b, &c);
	
	rad = c * M_PI/180.0;
	h = (double)b * sin(rad);
	S = a * h /2;
	d = sqrt( pow(a, 2) + pow(b, 2) - 2*a*b*cos(rad) );
	L = a + b + d;
	
	/*Sを出力*/
	printf("%.15f\n",S);
	/*Lを出力*/
	printf("%.15f\n",L);
	/*hを出力*/
	printf("%.15f\n",h);

//	rangeX = (P1.x-P2.x)*(P1.x-P2.x);
//	rangeY = (P1.y-P2.y)*(P1.y-P2.y);
	
//	printf("%f\n", sqrt( rangeX + rangeY ) );
	
	return 0;
}



Measured memory_bytes: 2104
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<utility>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<string>
#include<cstring>
#include<unordered_map>
#include<cassert>
#include<cmath>

//code by cl3488

#define ri(X) scanf("%d", &(X))
#define rii(X, Y) scanf("%d%d", &(X), &(Y))
#define riii(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define dri(X) int (X); scanf("%d", &X)
#define drii(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define driii(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define pb push_back
#define mp make_pair
#define rep(i, s, t) for ( int i=(s) ; i <(t) ; i++)
#define fill(x, v) memset (x, v, sizeof(x))
#define why(d) cout << (d) << "!\n"
#define whisp(X, Y) cout << (X) << " " << (Y) << "#\n"
#define exclam cout << "!!\n"
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const ll inf = (int)1e9 + 70;
const ll mod = 1e9 + 7;
const int maxn = 1e5 + 1000;

int main(){
	//if (fopen("input.txt", "r")) freopen("input.txt", "r", stdin);
	//dri(n);
	rep(i, 1, 10){
		rep(j, 1, 10){
			cout << i << "x" << j << "=" << i*j << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 3104
import java.util.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    static int dx[]={-1,0,1,0};
    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}


        
//        long L=sc.nextLong();
        int n=sc.nextInt();	
        int W=sc.nextInt();	
        long dp[][]=new long[W+1][n+1];
        long ans=0;
        for (int i = 1; i <= n; i++) {
        	int w=sc.nextInt(),v=sc.nextInt();
        	for (int t = 0; t <= W; t++) {
				if(w<=t)dp[t][i]=max(dp[t][i-1], dp[t-w][i-1]+v);
				else dp[t][i] = dp[t][i-1];
	        	ans = max(ans,dp[t][n]);
			}
		}

        out.println(ans);
        out.flush();
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//    public int compareTo(P p){
//        return d-p.d; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 131284
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

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

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > P(N);
	rep(i, N) cin >> P[i];
	reverse(P.begin(), P.end());
	set< pii > s;
	rep(i, N) {
		auto it = s.lower_bound(pii(P[i], 0));
		if (it != s.end() && (*it).first == P[i] + 1) {
			pii q = *it;
			q.first--;
			q.second++;
			s.erase(it);
			s.insert(q);
		} else {
			s.insert(pii(P[i], 1));
		}
	}
	int ans = N;
	for (auto it = s.begin(); it != s.end(); it++) {
		chmin(ans, N - (*it).second);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14336
n=int(input())
monsters=list(map(int,input().split()))
heroes=list(map(int,input().split()))
ans=0
for i in range(n):
    if heroes[i]>monsters[i]:
        heroes[i]-=monsters[i]
        ans+=monsters[i]
        ans+=min(heroes[i],monsters[i+1])
        monsters[i+1]-=min(heroes[i],monsters[i+1])
    else:
        ans+=heroes[i]
print(ans)

Measured memory_bytes: 24144
import java.util.*; 

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

  		int[][] ci=new int[3][3];
		for(int c=0;c<3;c++){
    		ci[c][0]=sc.nextInt();
          	ci[c][1]=sc.nextInt();
         	ci[c][2]=sc.nextInt();
    	}
    int count=0;
  	for(int b=0;b<2;b++){
     if((ci[b+1][0]-ci[b][0])!=(ci[b+1][1]-ci[b][1])||(ci[b+1][1]-ci[b][1])!=(ci[b+1][2]-ci[b][2])){
     	count=1;
     }
    }
    for(int b=0;b<2;b++){
     if((ci[0][b+1]-ci[0][b])!=(ci[1][b+1]-ci[1][b])||(ci[1][b+1]-ci[1][b])!=(ci[2][b+1]-ci[2][b])){
     	count=1;
     }
    }
 	if(count==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }


    }
}


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

int main() {

	char a[10];
	vector <char> b;

	cin >> a;

	for (int i = 0; i <= 9; i++) {
		if (a[i] == '0') {
			b.push_back('0');
		}
		if (a[i] == '1') {
			b.push_back('1');
		}

		if (a[i] == 'B') {
			if (i > 0 && b.size()> 0) {
				b.pop_back();
			}
		}
	}
	for (int i = 0; i < b.size(); i++) {
		cout << b[i];

	}
	cout << endl;
	
	

	return 0;
}

Measured memory_bytes: 256
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) cerr << #x << " = " << (x) << " " << endl;
#else
const bool test = false;
#define dump(x) 
#define dumpl(x) 
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
 
template<typename T>
T gcd(T a, T b)
{
  T c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}

int pow(int a, int b) {
  int res = 1;
  rep(i, b) res *= a;
  return res;
}
 
class Solver {
public:
  int N;
  int D, X;
  int A[MAX];

  void solve() {
    cin >> N;
    cin >> D >> X;
    rep(i, N) cin >> A[i];

    int res = X;
    dumpl(res);
    rep(i, N) {
      res += 1;
      rep2(d, 1, D + 1) {
        if (d * A[i] + 1 > D) break;
        res += 1;
      }
      dumpl(res);
    }
    cout << res << endl;
  }
};
 
signed main()
{
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {    
  //     auto ptr = new Solver();
  //     ptr->solve();
  //     delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n,q;
string s;
ll a[100010];
ll sum[100010];

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

  cin>>n>>q>>s;
  rep(i,n-1){
    if(s[i]=='A'&&s[i+1]=='C'){
      a[i]=1;
    }
  }
  rep(i,n)sum[i+1]=a[i]+sum[i];

  rep(i,q){
    ll l,r;
    cin>>l>>r;
    l--;
    ll res=sum[r]-sum[l];
    if(a[r-1])res--;
    cout<<res<<endl;
  }

  return 0;
}


Measured memory_bytes: 2640
#include <iostream>

using namespace std;

int n, x;
int cnt;
void dfs(int i, int m, int sum);

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

		if (n == 0 && x == 0)
		{
			break;
		}

		cnt = 0;

		dfs(0, 0, 0);
		cout << cnt << endl;
	}
}

void dfs(int i, int m, int sum)
{
	if (i == 3)
	{
		if (sum == x)
		{
			cnt ++;
		}
		return;
	}
	if (m == n)
	{
		return;
	}

	m ++;
	dfs(i, m, sum);
	dfs(i + 1, m, sum + m);
}


Measured memory_bytes: 3076
#include<iostream>
#include<iomanip>

int main(void) {
    int n;
    std::cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    double outerDen = 0;
    for(int i = 0; i < n; i++) {
        outerDen += 1.0 / a[i];
    }

    std::cout << std::fixed << std::setprecision(6);
    std::cout << (1.0 / outerDen) << std::endl;

    return 0;
}

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

const int mod = 998244353;
struct mint {
    long long x;
    mint(long long 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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

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

    int n, s;
    cin >> n >> s;

    vector<int> a(n);
    REP(i, n) cin >> a[i];

    // dp テーブルは1段ごとに使い捨てる方法を採用
    vector<mint> dp(s + 1, 0);

    dp[0] = 1;

    REP(i, n) {
        // 次の dp を用意してる
        vector<mint> p(s + 1, 0); // p が dp[i] で古い方
        swap(dp, p); // dp が dp[i + 1] で更新される方
        REP(j, s + 1) {
            dp[j] += p[j] + p[j]; // T に選ばれようが U に選ばれようが
            if (j + a[i] <= s) dp[j + a[i]] += p[j];
        }
    }

    cout << dp[s] << '\n';
    return 0;
    return 0;
}


Measured memory_bytes: 3692
from collections import deque
n = int(input())
A = deque(map(int, input().split()))
b = deque([])

if n%2==0:
    for i in range(n):
        if i%2 ==0:
            b.append(A[i])
        else:
            b.appendleft(A[i])
else:
    for i in range(n):
        if i%2 ==0:
            b.appendleft(A[i])
        else:
            b.append(A[i])            
print(*b)

Measured memory_bytes: 31396
#include <iostream>
using namespace std;
int main(){
    int N,x;
    cin>>N>>x;
    if(x==N){
        cout<<"Yes"<<endl;
        for(int i=1;i<2*N;i++) cout<<i<<endl;
    }else if(x==1||x==2*N-1){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
        int minus=x-1, plus=2*N-1-x;
        int m=x-1,p=x+1;
        if(minus==1){
            for(int i=0;i<N-1;i++){
                cout<<p++<<endl;
            }
            cout<<x<<endl;
            cout<<m--<<endl;
            for(int i=0;i<N-2;i++){
                cout<<p++<<endl;
            }
        }else{
            m=x-3,p=x+2;
            for(int i=0;i<N-2;i++){
                if(m>0){
                    cout<<m--<<endl;
                }else{
                    cout<<p++<<endl;
                }
            }
            cout<<x-1<<endl;
            cout<<x<<endl;
            cout<<x+1<<endl;
            cout<<x-2<<endl;
            for(int i=0;i<N-3;i++){
                if(m>0){
                    cout<<m--<<endl;
                }else{
                    cout<<p++<<endl;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1536