akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <limits.h>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;
using P = pair<int,int>;
using ll = long long;
#define int long long
signed main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<k;i++){
        vector<int> b(n);
        for(int j=0;j<n;j++){
            b[max(0ll,j-a[j])]++;
            if(j+a[j]+1<n)b[j+a[j]+1]--;
        }
        for(int i=1;i<n;i++)b[i]=b[i-1]+b[i];
        bool c=true;
        for(int i=0;i<n;i++){
            a[i]=b[i];
            if(a[i]<n)c=false;
        }
        if(c){
            for(int i=0;i<n;i++){
                cout<<a[i]<<" ";
            }
            cout<<endl;
            return 0;
        }
    }
    for(int i=0;i<n;i++){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 6384
def swap(a, j):
    # list aのj番目の要素とj-1番目の要素を交換する関数
    k = a[j]
    a[j] = a[j-1]
    a[j-1] = k


def bubbleSort(a, n):
    sw = 0
    flag = 1
    while flag:
        flag = 0
        for j in range(n-1,0,-1):
            if a[j] < a[j-1]:
                swap(a, j)
                flag = 1
                sw += 1
    print(' '.join(list(map(str, a))))
    print(sw)

    
n = int(input())
a = list(map(int, input().split()))
bubbleSort(a, n)


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

int main(){
   string s,t; cin>>s>>t;
   bool ans=true;
   for(int i=0;i<s.size();i++){
      if(s[i]!=t[i]){
         ans=false;
      }
   }
   if(ans) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0;
}

   


Measured memory_bytes: 3624
#include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    using namespace __gnu_pbds;
    using namespace std;
     
    typedef long long ll;
    typedef pair<int,int> ii;
    typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
     
    const int mod=1e9+7;
     
    int main() {
    	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    	ll n,k; cin>>n>>k;
    	ll l=0, r=n-1;
    	vector<ll> a(n);
    	for (int i=0; i<n; i++)
    		cin>>a[i];
    	sort(a.begin(),a.end());
    	ll ret=1, sgn=1;
    	if(k%2) ret=a[r], r--, k--, sgn=(ret<0 ? -1 : 1);
    	while(k) {
    		ll x=a[l]*a[l+1], y=a[r]*a[r-1];
    		if(x*sgn>y*sgn) ret*=x%mod, ret%=mod, l+=2;
    		else ret*=y%mod, ret%=mod, r-=2;
    		k-=2;
    	}
    	cout<<(ret%mod+mod)%mod<<"\n";
    	return 0;
    }

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

int main() {
  string S_1, S_2;
  cin >> S_1 >> S_2;
  int res = S_1.compare(S_2), len1 = S_1.size(), len2 = S_2.size();
  if (len1 == len2) {
    if (res == 0)
      cout << "EQUAL\n";
    else if (res > 0)
      cout << "GREATER\n";
    else
      cout << "LESS\n";
  } else if (len1 > len2)
    cout << "GREATER\n";
  else
    cout << "LESS\n";
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
SC=[list(map(int,input().split())) for _ in range(m)]
ans=-1
if n==1:
    r=range(10)
elif n==2:
    r=range(10,100)
else:
    r=range(100,1000)
for i in r :
    i=str(i)
    for j ,k in SC:
        if i[j-1]!=str(k):
            break
    else:
        print(i)
        exit()
print(-1)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

ll lol(ll a, ll b, ll c){
	if (a%2==0) return 0;
	return b*c;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll a,b,c;
	cin>>a>>b>>c;
	ll v=1e18+100;
	v=min(v, lol(a, b, c));
	v=min(v, lol(b, a, c));
	v=min(v, lol(c, a, b));
	cout<<v<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string a;
	cin>>a;
	int se[n],sw[n];
	for(int i=0;i<n;++i){
		se[i]=0;
		sw[i]=0;
	}
	if (a[0]=='E')
	se[0]=1;
	else
	sw[0]=1;
	for(int i=0;i<n;i++){
		if(a[i]=='E')
		{
		se[i]=se[i-1]+1;
		sw[i]=sw[i-1];
	}
		else 
		{
			sw[i]=sw[i-1]+1;
			se[i]=se[i-1];	
					}
	}
	int minv=300005;
	for(int i=0;i<n;++i){
		int mmm=0;
		if(i==0)
			mmm=se[n-1]-se[0];
		else if(i==n-1)
			mmm=sw[n-2];
		mmm=sw[i-1]+(se[n-1]-se[i]);
		minv=min(minv,mmm);
	}
	cout<<minv;
	return 0;
}


Measured memory_bytes: 2948
import java.io.*;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = null;
		StringBuilder sb = new StringBuilder();
		final String lb = System.getProperty("line.separator");
		int[] count = new int[26];
		String str = null;
		
		br = new BufferedReader(new InputStreamReader(System.in));
		while((str = br.readLine()) != null){
			for(int i = 0; i < str.length(); i++){
				final char ch = str.charAt(i);
				if('A' <= ch && ch  <= 'Z'){
					count[ch - 'A']++;
				} else if('a' <= ch && ch <= 'z'){
					count[ch - 'a']++;
				} else {}
			}
		}

		for(int i = 0; i < count.length; i++){
			sb.append(String.valueOf((char)('a'+i))).append(" : ").append(count[i]).append(lb);
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 16868
const main = (input: string) => {
    const inputs: string[] = input.split('\n');
    const [N, K] = inputs[0].split(' ').map(x => parseInt(x));
    const fruits = inputs[1].split(' ').map(x => parseInt(x));

    fruits.sort((a, b) => (
        a - b
    ));

    let sum = 0;
    for (let i = 0; i < K; i++) {
        sum += fruits[i];
    }
    console.log(sum);
};
// 標準入力
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

int main(void){
    int n,i;
    double sum,m;
    double a;
    int data[1000];
    scanf("%d",&n);
    while(n){
        a = 0;
        sum = 0;
        for(i=0;i<n;i++){
            scanf("%d",&data[i]);
        }
        for(i = 0;i<n;i++){
            sum += data[i];
        }
        m = sum / n;
        for(i = 0;i<n;i++){
            a += (data[i] - m) * (data[i] - m);
        }
        a /= n;
        printf("%f\n",sqrt(a));
        scanf("%d",&n);
    }
    return 0;
}

Measured memory_bytes: 636
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
using namespace std;
const int inf=2e9;
string s;
int a[3];
int main()
{
	cin>>s;
	if (s.size()==1)
	{
		cout<<"YES";
		return 0;
	}
	for (auto x:s)
	{
		a[x-'a']++;
	}
	sort(a,a+3);
	if (s.size()==2)
	{
		if (a[0]==0 && a[1]==0)
		{
			cout<<"NO";
		}
		else
		{
			cout<<"YES";
		}
		return 0;
	}
	int tmp=a[0];
	for (int i=0;i<3;++i)
	{
		a[i]-=tmp;
	}
	if (a[2]>=2)
	{
		cout<<"NO";
	}
	else
	{
		cout<<"YES";
	}
	return 0;
}

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

int N;

int cmpnum(const void * n1,const void * n2){
    if(*(int *)n1 > *(int *)n2)   // (int *)n1 defines that n1 is operator of int type and the first * is indirection reference operator.
	return -1;
    else if(*(int *)n1 < *(int *)n2)
	return 1;
    else 
	return 0;
}


int main()
{
    int a[100]={0},sum_a=0,sum_b=0;
    scanf("%d",&N);
    for(int i=0;i<N;i++)
	scanf("%d",&a[i]);

    qsort(a,N,sizeof(int),cmpnum);

    for(int i=0;i<N;i++){
	if(i%2==0)
	    sum_a+=a[i];
	else 
	    sum_b+=a[i];
    }
    printf("%d\n",sum_a-sum_b);

    return 0;
}




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

class Dice{
private:
  int d[6];
public:
  Dice();
  void CreateDice(int n1, int n2, int n3, int n4, int n5, int n6);
  void disp();
  int get_sum();
  void  Roll_The_Dice(int top, int front);
  int get_dice_surface(int n);
  bool compare_dice(Dice dice);
};

Dice::Dice(){
  for(int i = 0; i < 6; i++){
    d[i] = 0;
  }
}
void Dice::CreateDice(int n1, int n2, int n3, int n4, int n5, int n6){
  d[0] = n1;
  d[1] = n2;
  d[2] = n3;
  d[3] = n4;
  d[4] = n5;
  d[5] = n6;
}
void Dice::disp(){
  for(int i = 0; i < 6; i++){
    cout << d[i] << " ";
  }
  cout << endl;
}
int Dice::get_sum(){
  return d[0]+d[1]+d[2]+d[3]+d[4]+d[5];
}
void Dice::Roll_The_Dice(int top, int front){

  int tmp;
  int i = 0, count = 0;
  while(true){
    for(i = 0; i < 4; i++){
      if(d[0] == top){
        break;
      }
      tmp  = d[0];
      d[0] = d[4];
      d[4] = d[5];
      d[5] = d[1];
      d[1] = tmp;
    }
    if(d[1] == front && d[0] == top){
      break;
    }
    tmp  = d[3];
    d[3] = d[1];
    d[1] = d[2];
    d[2] = d[4];
    d[4] = tmp;
    i = 0;
    count++;
    if(count >= 3){
      break;
    }
  }
}

int Dice::get_dice_surface(int n){
  return d[n];
}
bool Dice::compare_dice(Dice dice){
  int count = 0;
  for(int i = 0; i < 6; i++){
    if(d[i] == dice.d[i]){
      count++;
    }
  }
  if(count == 6){
    return true;
  } else {
    return false;
  }
}

int main(){
  int n[6],num,h[128];
  bool same = false;
  cin >> num;
  Dice dice[128];

  for(int i = 0; i < num; i++){
    for(int j = 0; j < 6; j++){
      cin >> n[j];
    }
    dice[i].CreateDice(n[0],n[1],n[2],n[3],n[4],n[5]);
  }

  for(int i = 0; i < num-1; i++){
    // if( (dice[0].get_sum() != dice[i+1].get_sum() ) ){
    //   same = false;
    //   cout << "dddddd" << endl;
    //   break;
    // } else {
    //
    // }
    // same = false;
    //cout << "dddddd" << endl;
    for(int j = 0; j < 5; j++){
      h[i] = dice[i].get_dice_surface(j);
      h[i+1] = dice[i].get_dice_surface(j+1);
      if( h[i] != h[i+1] ){
        dice[0].Roll_The_Dice(h[i],h[i+1]);
        dice[i+1].Roll_The_Dice(h[i],h[i+1]);
      }
      if( dice[0].compare_dice(dice[i+1]) ){
        same = true;
      }
    }
  }

  if(same){
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}



Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <set>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <iomanip>
#include <list>
#include <limits>

using namespace std;

const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);

class cDivedeAndConquer
{
	int mn;
	long long m_count;
	vector<int> m_va;
	numeric_limits<int> li;

	void mSort(vector<int> &va, int left, int right);
	void merge(vector<int> &va, int left, int mid, int right);

public:
	cDivedeAndConquer(int n, vector<int>& va)
		:mn(n), m_count(0)
	{
		m_va = va;
		mSort(m_va, 0, m_va.size());
		cout << m_count << endl;
	}
};

void cDivedeAndConquer::mSort(vector<int> &va, int left, int right)
{
	if (left + 1 < right)
	{
		int mid = (left + right) / 2;
		mSort(va, left, mid);
		mSort(va, mid, right);
		merge(va, left, mid, right);
	}
}

void cDivedeAndConquer::merge(vector<int> &va, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	vector<int> vL(n1 + 1), vR(n2 + 1);

	for (int i = 0; i < n1; ++i)
	{
		vL[i] = va[left + i];
	}
	for (int i = 0; i < n2; ++i)
	{
		vR[i] = va[mid + i];
	}
	vL[n1] = li.max();
	vR[n2] = li.max();

	int i = 0;
	int j = 0;

	for (int k = left; k < right; ++k)
	{
		if (vL.at(i) <= vR.at(j))
		{
			va.at(k) = vL.at(i++);
		}
		else
		{
			va.at(k) = vR.at(j++);
			m_count += (right - left) / 2 - i;
		}
	}
}

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

	int n;
	cin >> n;
	cin.ignore();

	int a;
	vector<int> va;
	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		va.push_back(a);
	}

	cDivedeAndConquer cdc(n, va);

	return 0;
}

Measured memory_bytes: 5244
#include <cstdio>
#include <cstring>
using namespace std;

#define A 0
#define B 1

typedef long long ll;

const int MAXN = 1e5+5;
int N, color[MAXN];
char s[MAXN];
int main () {
    bool good = false;
    scanf("%d%s", &N, s);
    for (int i=0; i<N; i++) color[i] = -1;
    for (int i=0; i<2 && !good; i++) {
        for (int j=0; j<2 && !good; j++) {
            color[B] = j;color[A] = i;
            int k = B;
            while (k < N) {
                // si a los lados son iguales
                if ((color[k] == 1 && s[k] == 'x') || 
                        (color[k] == 0 && s[k] == 'o')) {
                    if (k == N-1 && color[k-1] == color[A]) {
                        if ((color[A] == 0 && s[A] == 'o') 
                                || (color[A] == 1 && s[A] == 'x')) {
                            if (good = (color[k] == color[B])) break;
                        }
                        else if ((color[A] == 0 && s[A] == 'x') 
                                || (color[A] == 1 && s[A] == 'o')) {
                            if (good = (color[k] != color[B])) break;
                        }
                    }
                    color[(k+1)%N] = color[k-1];
                }
                // si a los lados son diferentes
                else if  ((color[k] == 0 && s[k] == 'x') || 
                        (color[k] == 1 && s[k] == 'o')){
                    if (k == N-1 && color[k-1] != color[A] ) {
                        if ((color[A] == 0 && s[A] == 'o') 
                                || (color[A] == 1 && s[A] == 'x')) {
                            if (good = (color[k] == color[B])) break;
                        }
                        else if ((color[A] == 0 && s[A] == 'x') 
                                || (color[A] == 1 && s[A] == 'o')) {
                            if (good = (color[k] != color[B])) break;
                        }
                    }
                    color[(k+1)%N] = !color[k-1];
                }

                k++;
            }
        }
    }

    if (!good) {
        printf("-1\n");
    } else {
        for (int i=0; i<N; i++) {
            if (color[i] == 0) printf("S");
            else printf("W");
        }
        printf("\n");
    }
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	const int mod=1e9+7;
	int h,w;
	cin>>h>>w;
	int dp[h+1][w+1];
	for(int i=0;i<=h;i++)
		dp[i][0]=0;
	for(int j=0;j<=w;j++)
		dp[0][j]=0;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			char ch;
			cin>>ch;
			if(ch!='#')
				dp[i][j]=1;
			else
				dp[i][j]=0;
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if((!(i-1)&&!(j-1))||!dp[i][j])
				continue;
			dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
		}
	}
	cout<<dp[h][w];
}

Measured memory_bytes: 4224
#include <iostream>
using namespace std;
int main(void){
    int x,y;
    cin >> x >> y;
    
    x = (x/8)^(x%2) + 2*(!(x-2));
    y = (y/8)^(y%2) + 2*(!(y-2));
    
    if(x==y) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  VL as(N);
  rep(i, N) cin >> as[i];

  ll cur = 1000;

  rep(i, N) {
    if (i + 1 < N && as[i] < as[i + 1]) {
      ll ct = cur / as[i];
      cur += ct * (as[i + 1] - as[i]);
    }
  }

  cout << cur << "\n";
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;
const double pip = 3.141592653589;
int main()
{
    fastIO;
    double v, a, b, ans, x;
    scanf("%lf%lf%lf",&a,&b,&v);
    if(v==a*a*b/2.0){cout<<45.0;return(0);}
    if(v<a*a*b/2.0) {
        x = 2.0 * v / ( a * b ) ;
        double y = (atan2(b, x) * 180.0 / pip);
        printf("%.10lf\n", y);
    } else {
        x = 2.0 * ( b -( v /( a * a)));
        double y = (atan2(x, a) * 180.0 / pip);
        printf("%.10lf\n", y);
    }
}   

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int n, w[]={1,2,4,8,16,32,64,128,256,512};
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            n = sc.nextInt();
            
            int a[]={0,0,0,0,0,0,0,0,0,0,0,0,0};
            int i=10, j=0;
            
            while(0<n&&0<=i){
            	if(w[--i]<=n){
            		a[i]=1;
            		n-=w[i];
            		++j;
            	}
            }
    		for(i=0,--j; i<10&&0<j; ++i)
    			if(1==a[i]){
    				System.out.print(w[i]);
    				System.out.print(" ");
    				--j;
    			}

    		for(; i<10; ++i)
    			if(1==a[i]){
    				System.out.println(w[i]);
    			}
        }
    }
 

}

Measured memory_bytes: 12000
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
  int A, B;
  scanf("%d %d", &A, &B);
  if (A % 2 == 1 && B % 2 == 1) puts("Yes");
  else puts("No");

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define loop(i,a,b) for(int i=a; i<(int)(b); i++)
#define rep(i,n) loop(i,0,n)
#define all(c) (c).begin(), (c).end()

struct team {
    int id, score, rank;
};

int main(){
    int t, n;
    char c;
    vector<team> ts;
    while (cin >> t >> c >> n, t + n){
        ts.push_back({ t, n, 0 });
    }
    sort(all(ts), [](const team&a, const team&b){
        return a.score > b.score;
    });
    ts[0].rank = 1;
    int r = 1;
    loop(i, 1, ts.size()){
        if (ts[i - 1].score != ts[i].score) r++;
        ts[i].rank = r;
    }
    sort(all(ts), [](const team&a, const team&b){
        return a.id<b.id;
    });
    while (cin >> t){
        cout << ts[t - 1].rank << endl;
    }
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;
bool check(vector<pair<int, int>> &p, int n)
{
    vector<int> v;

    do
    {
        v.push_back(n % 10);
        n /= 10;
    } while (n != 0);
    reverse(ALL(v));
    for (auto x : p)
    {
        // cerr << v[x.first] << " " << x.second << endl;
        if (x.first >= v.size() || v[x.first] != x.second)
        {
            return false;
        }
    }
    return true;
}
int main(int argc, char const *argv[])
{
    int n, m;
    cin >> n >> m;
    if (m == 0)
    {
        if (n == 1)
        {
            cout << 0 << endl;
        }
        else
        {
            cout << pow(10, n - 1) << endl;
        }
        return 0;
    }
    vector<pair<int, int>> p;
    rep(i, m)
    {
        int s, c;
        cin >> s >> c;
        s--;
        p.push_back({s, c});
    }
    sort(ALL(p));
    if (n == 1 && check(p, 0))
    {
        cout << 0 << endl;
        return 0;
    }
    rep(i, pow(10, n - 1), pow(10, n))
    {
        if (check(p, i))
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main() {
    cout << fixed << setprecision(10);
    int n;
    string s;
    int q;
    cin >>n>>s>>q;

    vector<set<int>> ps(26);
    REP(i, n) {
        ps[s[i] - 'a'].insert(i);
    }


    REP(i, q) {
        int type;
        cin >> type;
        if (type == 1) {
            int qi;
            char qc;
            cin >> qi >> qc;
            qi--;
            if (s[qi] == qc)continue;
            ps[s[qi]-'a'].erase(qi);
            ps[qc - 'a'].insert(qi);
            s[qi] = qc;
        }
        else {
            int ql, qr;
            cin >> ql >> qr;
            ql--;
            qr--;

            int cnt = 0;
            REP(j, 26) {
                auto itr=ps[j].lower_bound(ql);
                if (itr == ps[j].end())continue;
                if (*itr <= qr) {
                    cnt++;
                }

            }
            cout  << cnt << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 24196
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
S = input()
lis = []
for t in range(len(S)):
    lis.append(S[t])
evencount0 = 0
unevencount0 = 0
evencount1 = 0
unevencount1 = 0
if len(S)%2 == 0:
    for t in range(int(len(S)/2)):
        if S[2*t + 1] == "0":
            evencount0 += 1
    evencount1 = int(len(S)/2) - evencount0
    for t in range(int(len(S)/2)):
        if S[2*t] == "0":
            unevencount0 += 1
    unevencount1 = int(len(S)/2) - unevencount0

else:
    for t in range(int((len(S) - 1)/2)):
        if S[2*t + 1] == "0":
            evencount0 += 1
    evencount1 = int((len(S) - 1)/2) - evencount0        

    for t in range(int((len(S)+1)/2)):
        if S[2*t] == "0":
            unevencount0 += 1
    unevencount1 = int((len(S)+1)/2) - unevencount0

elist = [evencount0 , evencount1 , unevencount0 , unevencount1 ]
if evencount1 + unevencount0 > evencount0 + unevencount1:
    k = evencount0 + unevencount1
else:
    k =evencount1 + unevencount0
print(k)

Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int main()
{	
	string n[100];
	string m[100];
	int N, M;
	cin >> N;
	map <string, int> score;
	for (int i = 0; i < N; i++)
	{
		cin >> n[i];
		score[n[i]]++;
	}
	cin >> M;
	for (int i = 0; i < M; i++)
	{
		cin >> m[i];
		score[m[i]]--;
	}
	int ans = 0;
	for (auto itr = score.begin(); itr != score.end(); ++itr) 
	{
		ans = max(ans, max(0, itr->second));
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    k: usize,
    q: usize,
    mut a: [Usize1; q]
    }
    let mut c = vec![0; n];
    for i in 0..q {
        c[a[i]] += 1;
    }
    for i in 0..n {
        if c[i] + k > q {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


Measured memory_bytes: 4056
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1
struct Node{
	int p,l,r;
}T[MAX];
int n,depth[MAX];
void print(int root){
	cout<<"node "<<root<<": ";
	cout<<"parent = "<<T[root].p<<", ";
	cout<<"depth = "<<depth[root]<<", ";
	if(T[root].p==NIL) cout<<"root, ";
	else if(T[root].l==NIL) cout<<"leaf, ";
	else cout<<"internal node, ";
	cout<<"[";
	for(int i=0,c=T[root].l;c!=NIL;i++,c=T[c].r){
		if(i) cout<<", ";
		cout<<c;
	}
	cout<<"]"<<endl;
}
void rec(int root,int p){
	depth[root]=p;
	if(T[root].r!=NIL) rec(T[root].r,p);
	if(T[root].l!=NIL) rec(T[root].l,p+1);
}
int main(){
	int l;
	cin>>n;
	for(int i=0;i<n;i++){
		T[i].p=T[i].l=T[i].r=NIL;
	}
	for(int i=0;i<n;i++){
		int v,d;
		cin>>v>>d;
		for(int j=0;j<d;j++){
			int node;
			cin>>node;
			if(!j) T[v].l=node;
			else T[l].r=node;
			l=node;
			T[node].p=v;
		}
	}
	int root;
	for(int i=0;i<n;i++){
		if(T[i].p==NIL) root=i;
	}
	rec(root,0);
	for(int i=0;i<n;i++) print(i);
}

Measured memory_bytes: 7732
#include<bits/stdc++.h>
#define int long long
using namespace std;

vector<vector<int> >all;
int n,m;
void rec(vector<int>temp)
{
  int sz=temp.size();
  if(sz==n+1)
    all.push_back(temp);
  else
  {
    int tt=temp.back();
    for(int j=max(1LL,tt);j<=m;j++)
    {
      temp.push_back(j);
      rec(temp);
      temp.pop_back();
    }
  }    
}

struct node
{
  int a,b,c,d;
};

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(0);   
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif

  int q;
  cin>>n>>m>>q;
  vector<int>temp;
  temp.push_back(0);
  rec(temp);
  
  node pp[q+1];
  for(int i=1;i<=q;i++)
  {
    cin>>pp[i].a>>pp[i].b>>pp[i].c>>pp[i].d;    
  }
  int mx=0;
  for(auto i:all)
  {
    int ans=0;
    for(int j=1;j<=q;j++)
    {
      if(i[pp[j].b]-i[pp[j].a]==pp[j].c)
        ans+=pp[j].d;
    }
    mx=max(mx,ans);
  }
  cout<<mx;
}

Measured memory_bytes: 13928
#include <bits/stdc++.h>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define REPR(i, n) for (int i = n-1; i >= 0; --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTG(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<n)
#define bit_check(bit, i) (bit>>i) & 1
#define setpre(n) fixed << setprecision(n)
#define ENDL cout << endl;
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VP = vector<PII>;
using VI = vector<int>;
using VVI = vector<VI>;
using Vll = vector<ll>;
using VVll = vector<Vll>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;

int main(){
  ll N;
  cin >> N;
  ll ans = N * (N + 1) / 2;
  ans -= N;
  cout << ans;

  return 0;
}

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

    #define int long long

    #define REP(i,n) for(int i=0;i<n;i++)
    #define FOR(i,m,n) for(int i=m;i<n;i++)
    #define FORR(i,m,n) for(int i=m;i>=n;i--)
    #define pb(x) push_back(x) 
    #define SORT(x) sort((x).begin(),(x).end())
    #define INF 99999999999

    using namespace std;

    int32_t main(){
        int n;
        cin >> n;
        vector<int> v(n), b(n);
        REP(i, n){
            cin >> v[i];
            b[i] = v[i] - (i+1);
        }
        SORT(b);

        if(n%2){
            int t = b[n/2];
            int ans = 0;
            REP(i, n) ans+=abs(b[i]-t);
            cout << ans << endl;
        }
        else{
            int t = b[n/2-1];
            int ans_1, ans_2 = ans_1 = 0;
            REP(i, n) ans_1+=abs(b[i]-t);

            t = v[n/2];
            REP(i, n) ans_2+=abs(b[i]-t);

            cout << min(ans_1, ans_2) << endl;
        }
    }

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define sq(a)           (a)*(a)
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define rep(i,a,b)      for(i=a;i<=b;i++)
#define Fo(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(x)          x.begin(),x.end()
#define rall(x)         x.rbegin(),x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x,0,sizeof(x))
#define tr(it, a)       for(auto it=a.begin();it!=a.end();it++)
#define pii             pair<int,int>
#define mk(arr,n,type)  type *arr=new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y)/gcd(x,y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x) {cout<<x;}
void __print(float x) {cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x) {cout <<'\''<<x<<'\'';}
void __print(const char *x) {cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f=0;cout<<'{';for(auto &i:x)cout<<(f++?",":""),__print(i);cout<<"}";}void _print(){cout<<"]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base,int exp) {int res=1;base%=mod;while(exp>0){if(exp&1)res=(res*base)%mod;base=(base*base)%mod;exp=exp>>1;}return res;}
int inv(int x) {return power(x,mod-2)%mod;}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N=1e6+6,M=N;
int i,j;

void solve() {
    
    int n,k; cin>>n>>k;
    vi a(n+1);
    fo1(i,n) cin>>a[i];
    
    for(int i=1,j=k+1;i<=(n-k);i++,j++){
        if(a[i]<a[j]) cout<<"Yes\n";
        else cout<<"No\n";
    }
    
    
}




int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}

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

namespace Q3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] firstLine = Console.ReadLine().Split();
            int smallest, secondsmallest;

            int n1 = Convert.ToInt32(firstLine[0]);
            int n2 = Convert.ToInt32(firstLine[1]);
            int n3 = Convert.ToInt32(firstLine[2]);

            smallest = Math.Min(Math.Min(n1,n2),n3);
            if(smallest == n1)
                secondsmallest = Math.Min(n2,n3);
            else if(smallest == n2)
                secondsmallest = Math.Min(n1,n3);
            else
                secondsmallest = Math.Min(n1,n2);

            Console.WriteLine((smallest*secondsmallest)/2);
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  int i = N;
  int sum = 0;
  while (i > 0) {
    sum += i % 10;
    i /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
while True:
  H, W = map(int, input().split())
  if H == W == 0: break
  print(('#.'*(W//2) + '#'*(W%2) + '\n' +'.#'*(W//2) + '.'*(W%2) + '\n')*(H//2) +('#.'*(W//2) + '#'*(W%2) + '\n')*(H%2))

Measured memory_bytes: 7624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
struct UnionFind {
    vector<int> d;
    UnionFind(int n):d(n,-1){}
    int root(int x){
        if(d[x] <0) return x;
        return d[x] = root(d[x]);

    }
    bool unite(int x,int y){
        x = root(x),y = root(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    int size(int x) {return -d[root(x)];}
    bool same(int x,int y){return root(x) == root(y);}
};
vector<int> friends[110000],block[110000];
int main()
{
    int n,m,k;
    cin >> n >> m >> k;

    UnionFind uf(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        friends[a].push_back(b);
        friends[b].push_back(a);
        uf.unite(a,b);
    }
    rep(i,k){
        int c,d;
        cin >> c >> d;
        c--;d--;
        block[c].push_back(d);
        block[d].push_back(c);

    }
    rep(i,n){
        int res = uf.size(i)-1;
        res -= (int)friends[i].size();
        for(auto B:block[i]){
            if(uf.same(B,i))res --;

        }
        cout << res << endl;
    }


    return 0;
}

Measured memory_bytes: 12664
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define pb push_back
using namespace std;
int main(){
  string S,T;
  cin>>S;
  cin>>T;

  for(int i='a';i<='z';i++){
    bool f=false;
    char c;
    for(int j=0;j<=T.size();j++){
      if(T[j]==(char)i){
        if(!f){
          f=true;
          c=S[j];
        }
        else{
          if(S[j]!=c){
            cout<<"No"<<endl;
            return 0;
          }
        }
      }
    }
  }
  string tmp;
  tmp=T;
  T=S;
  S=tmp;
  for(int i='a';i<='z';i++){
    bool f=false;
    char c;
    for(int j=0;j<=T.size();j++){
      if(T[j]==(char)i){
        if(!f){
          f=true;
          c=S[j];
        }
        else{
          if(S[j]!=c){
            cout<<"No"<<endl;
            return 0;
          }
        }
      }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,ans=0;
  cin>>n>>k;
  vector<int> a(n),b(200009);
  for(int i=0;i<200009;i++)b[i]=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[a[i]]++;
  }
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  if(b[k]==0){
    cout<<0<<endl;
    return 0;
  }
  for(int i=k;;i++){
    ans+=b[i];
      if(b[i]==0){
        cout<<ans<<endl;
        return 0;
      }
  }
    
  
  
}


Measured memory_bytes: 4784
N = int(input())
h = [int(x) for x in input().split()]

hmax = max(h)
count = 0
for i in range(hmax):
	flag = 0
	for j in h:
		if i < j:
			if flag == 1:
				continue
			else:
				count += 1
				flag = 1
		else:
			flag = 0
print(count)


Measured memory_bytes: 3064
#include <stdio.h>

int main() {
	int i,b500,b5,ans;
	double a500, a5;
	scanf("%d", &i);
	a500 = i / 500;
	b500 = a500;
	a5 = (i - b500*500) / 5;
	b5 = a5;

	ans = 1000 * b500 + 5 * b5;
	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int64_t K, ans=0;
  cin >> K;
  for (int64_t a=1; a<=K; a++) {
    for (int64_t b=1; b<=K; b++) {
      for (int64_t c=1; c<=K; c++) {
        ans=ans+gcd(a,gcd(b,c));
      }
    }
  }
  cout << ans << endl;
}

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

int main(){
	int n,digit;
	cin >> n;
	digit = n%10;
	if(digit==3) cout << "bon";
	else if (digit==0 || digit==1 || digit== 6 || digit==8) cout << "pon";
	else cout << "hon";
	
}


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

int main(){
  char S[12],T[6]="YAKI";
  int c=1;
  scanf("%s",S);
  int l=strlen(S);
  if(l>=4)
    for(int i=0;i<4;i++){
      if(S[i]!=T[i])
        c=0;
    }
  else c=0;
        
  if(c==1) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 1572
#include "bits/stdc++.h"
using namespace std;



int main() {
	int N; cin >> N;
	vector<int>ps(N);
	for (int i = 0; i < N; ++i)cin >> ps[i];

	int ans = 1e9;
	for (int k = 0; k <= 3; ++k) {
		int nans = k;
		int from = k;
		for (int i = 0; i < N; ++i) {
			int plus = max(0, ps[i] - from);
			nans += (i==N-1?1:2) * max(0,plus);
			from = plus;
		}
		ans = min(ans, nans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3144
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N = iin()
A = iln()

s = set()
for i in range(N):
    if A[i] not in s:
        s.add(A[i])
    else:
        break
else:
    print('YES')
    exit()
print('NO')

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    CIN(N,D,X);
    vi A(N);
    rep(i,N)cin>>A[i];
    int ans=X;
    rep(i,N){
        int day=1;
        while(day<=D){
            ans++;
            day+=A[i];
        }
    }
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	k := getNextInt(scanner)
	s := getNextString(scanner)
	n := len(s)
	var ans mint
	c26 := make([]mint, k+1)
	c25 := make([]mint, k+1)
	c26[0] = 1
	c25[0] = 1
	for i := 0; i < k; i++ {
		c26[i+1] = c26[i].mul(26)
		c25[i+1] = c25[i].mul(25)
	}
	mc := newModcom(n + k + 1)
	for i := 0; i < k+1; i++ {
		ans.addAs(mc.choose(i+n-1, n-1).mul(c26[k-i]).mul(c25[i]))
	}
	fmt.Fprintln(writer, ans)
}

type modcom struct {
	facs, invs []mint
}

func newModcom(n int) modcom {
	facs := make([]mint, n+1)
	invs := make([]mint, n+1)
	facs[0] = 1
	for i := 0; i < n; i++ {
		facs[i+1] = facs[i].mul(mint(i + 1))
	}
	invs[n] = facs[n].inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].mul(mint(i + 1))
	}
	return modcom{
		facs: facs,
		invs: invs,
	}
}
func (mc *modcom) choose(n, k int) mint {
	return mc.facs[n].mul(mc.invs[k]).mul(mc.invs[n-k])
}

type mint int64

func (mt mint) mod() mint {
	m := mint(1e9 + 7)
	mt %= m
	if mt < 0 {
		return mt + m
	}
	return mt
}
func (mt mint) inv() mint {
	return mt.pow(mint(0).sub(2))
}
func (mt mint) pow(n mint) mint {
	p := mint(1)
	for n > 0 {
		if n&1 == 1 {
			p.mulAs(mt)
		}
		mt.mulAs(mt)
		n >>= 1
	}
	return p
}
func (mt mint) add(x mint) mint {
	return (mt + x).mod()
}
func (mt mint) sub(x mint) mint {
	return (mt - x).mod()
}
func (mt mint) mul(x mint) mint {
	return (mt * x).mod()
}
func (mt mint) div(x mint) mint {
	return mt.mul(x.inv())
}
func (mt *mint) addAs(x mint) *mint {
	*mt = mt.add(x)
	return mt
}
func (mt *mint) subAs(x mint) *mint {
	*mt = mt.sub(x)
	return mt
}
func (mt *mint) mulAs(x mint) *mint {
	*mt = mt.mul(x)
	return mt
}
func (mt *mint) divAs(x mint) *mint {
	*mt = mt.div(x)
	return mt
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li a[200100];
map<li, li> cnt;
li n;


int main() {
    cin >> n;
    rin{
        cin >> a[i];
    }
    sort(a, a + n);
    rin{
        cnt[a[i]]++;
    }
    li res = 0;
    for (auto it = cnt.rbegin(); it != cnt.rend(); ++it) {
        li val = it->first;
        li num = it->second;

        //p2(val, res);
        li beki = 1;
        while (beki <= val) {
            beki *= 2;
        }
        li rest = beki - val;
        if (rest > val) {
            continue;
        }
        if (rest == val) {
            res += num / 2;
            it->second = it->second % 2;
            continue;
        }
        auto it2 = cnt.find(rest);
        if (it2 == cnt.end()) {
            continue;
        } else {
            li add_num = min(num, it2->second);
            it->second -= add_num;
            it2->second -= add_num;
            res += add_num;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 14592