akhauriyash/Code-Regression huggingface dataset:
#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

long long result, a,b,nee,cou;
string S[101];
char s[100][100] = {};

typedef pair<long long, long long> pl;
vector<pl> re;
vector<pl> bl;
pl buf;



int main() {
	result = 0;
	cin >> a>>b;
	cou = 0;
	if (a == 1) {
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j < 100; j++) {
				s[i][j] = '.';
			}
		}
		nee = b;
		cou = 0;
		for (int i = 99; i > 0; i -= 2) {
			for (int j = 99; j > 0; j -= 2) {
				cou++;
				s[i][j] = '#';
				if (cou >= nee) {
					break;
				}
			}
			if (cou >= nee) {
				break;
			}

		}

	}
	else if (b == 1) {
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j < 100; j++) {
				s[i][j] = '#';
			}
		}
		nee = a;
		cou = 0;
		for (int i = 99; i > 0; i -= 2) {
			for (int j = 99; j > 0; j -= 2) {
				cou++;
				s[i][j] = '.';
				if (cou >= nee) {
					break;
				}
			}
			if (cou >= nee) {
				break;
			}

		}

	}
	else {
		if (a <= b) {
			for (int i = 0; i < 100; i++) {
				for (int j = 0; j < 100; j++) {
					s[i][j] = '.';
				}
			}
			nee = a - 1;
			for (int i = 2; i < 99; i += 4) {
				for (int j = 2; j < 99; j += 4) {
					s[i - 1][j - 1] = '#';
					s[i][j - 1] = '#';
					s[i + 1][j - 1] = '#';
					s[i - 1][j] = '#';
					s[i + 1][j] = '#';
					s[i - 1][j + 1] = '#';
					s[i][j + 1] = '#';
					s[i + 1][j + 1] = '#';
					cou++;
					if (cou >= nee) {
						break;
					}
				}

				if (cou >= nee) {
					break;
				}
			}

			nee = b - a + 1;
			cou = 0;
			for (int i = 99; i > 0; i -= 2) {
				for (int j = 99; j > 0; j -= 2) {
					cou++;
					s[i][j] = '#';
					if (cou >= nee) {
						break;
					}
				}
				if (cou >= nee) {
					break;
				}

			}

		}
		else {
			for (int i = 0; i < 100; i++) {
				for (int j = 0; j < 100; j++) {
					s[i][j] = '#';
				}
			}

			nee = b - 1;
			for (int i = 2; i < 99; i += 4) {
				for (int j = 2; j < 99; j += 4) {
					s[i - 1][j - 1] = '.';
					s[i][j - 1] = '.';
					s[i + 1][j - 1] = '.';
					s[i - 1][j] = '.';
					s[i + 1][j] = '.';
					s[i - 1][j + 1] = '.';
					s[i][j + 1] = '.';
					s[i + 1][j + 1] = '.';
					cou++;
					if (cou >= nee) {
						break;
					}
				}

				if (cou >= nee) {
					break;
				}
			}

			nee = a - b + 1;
			cou = 0;
			for (int i = 99; i > 0; i -= 2) {
				for (int j = 99; j > 0; j -= 2) {
					cou++;
					s[i][j] = '.';
					if (cou >= nee) {
						break;
					}
				}
				if (cou >= nee) {
					break;
				}

			}

		}
	}

	cout << 100<<' ' << 100 << endl;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			S[i] += s[i][j];
		}
		cout << S[i] << endl;
	}



	//cout << result << endl;

return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;


long comb(long n, long r) {
  vector<vector<long>> v(n + 1, vector<long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }

  return v[n][r];
}



int main()
{
  int n, k; //かっている数//最大100

  cin >> n >> k;

  vector<long> h(n);

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

  long ans = 10000000000;
  sort(h.begin(),h.end());


  for (long pos = 0; pos < n-k+1; ++pos){
    long mmax = h[k - 1 + pos];
    long mmin = h[pos];

    cerr << mmax << " : " <<mmin <<endl;

    if (mmax-mmin < ans){
      ans = mmax-mmin;
    }

  }




  cout << ans;

  // cout << (mincost<10000000? to_string(mincost) :"TLE");

  return 0;
}



























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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int32 ch[256] = {}, ch2[256] = {};

int main(void){
	string s, t;
	cin >> s >> t;
	REP(i, s.size()){
		if((ch[t[i]] != 0 && ch[t[i]] != s[i]) || (ch2[s[i]] != 0 && ch2[s[i]] != t[i])){
			cout << "No" << endl;
			return 0;
		}
		ch[t[i]] = s[i];
		ch2[s[i]] = t[i];
	}
	cout << "Yes" << endl;
}


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

 using namespace std;
 typedef long long ll;

 int main() {
   string S;

   cin >> S;
   int N = S.length();
   string K = "keyence";
   string ans = "NO";

   if (S.substr(0, 7) == K) ans = "YES";
   else if (S.substr(N - 7, 7) == K) ans = "YES";
   else {
     for (int i = 1; i <= 6; i++) {
       if (S.substr(0, i) + S.substr(N - 7 + i, 7 - i) == K) {
         ans = "YES";
         break;
       }
     }
   }

   cout << ans << endl;
 }


Measured memory_bytes: 256
package main

import "fmt"
import "strings"

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

	capi := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	//notcapi := "abcdefghijklmnopqrstuvwxyz"

	if strings.Contains(capi, in) {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}
}


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

int main() {
  int N,W;
  cin >> N>>W;
  vector<long long int> w(N+1);
  vector<int> v(N+1);
  long long int dp[N+1][100001]; //価値の最大値
  
  for(int i=0;i<=N;i++){ //N個の品物について
      for(int j=0;j<=100001;j++){
        dp[i][j]=1000000001;
      }
  }
  dp[0][0] = 0;

  for(int i=0;i<N;i++)cin>>w[i]>>v[i];

  for(int i=0;i<N;i++){ //N個の品物について
      for(int j=0;j<=100001;j++){
        
          if(j>=v[i])dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
          else dp[i+1][j]=dp[i][j];
        }
      }
  //重さの合計の最小値dp
  int ans=0; //価値の最大値を入れる
  for(int j=0;j<100001;j++){
    if(dp[N][j]<=W)ans=j; //価値がjのときの重さ
  }
cout<<ans<<endl;
}

Measured memory_bytes: 79104
# include <iostream>

using namespace std;

//https://atcoder.jp/contests/abc074/tasks/abc074_b

int main(){
    int N,K;
    cin >> N >> K;

    int sum = 0;

    for(int i=0;i<N;i++){
        int x;
        cin >> x;

        if( x > K - x && K > x){
            sum += 2 * (K-x);
        }else if( x > K - x && K < x){
            sum += 2 * (x-K);
        } else {
            sum += 2 * x;
        }
    }

    cout << sum << endl;

    return 0;
}


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

using namespace std;

int main() {
    int arr[5];
    int answer = 0;
    for (int i = 0; i < 5; i++) {
        cin >> arr[i];
        if (arr[i] == 0) {
            answer = i+1;
        }
    }
    cout << answer << endl;
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "No" << endl;    
  }else{
    cout << "Yes" << endl;    
  }

  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define MOD 1e9+7
using namespace std;
#define  pp push_back
#define  po pop_back
#define  mp make_pair
#define clr(a) memset(a,0,sizeof(a))
#define neg(a) memset(a,-1,sizeof(a))
#define fas(a) memset(a,false,sizeof(a))
#define debug(x) cout<<#x<<": "<<x<<endl
#define debug1(x) cout<<#x<<": "<<x<<" "
#define rev(x) reverse(x.begin(), x.end())
#define int long long 
#define F first
#define S second
//int a[2000];
void printvector(std::vector<int> v){  for (int i = 0; i < v.size(); ++i){cout<<v[i]<<" ";}cout<<""<<endl;}
void printarray(int a[],int n){for (int i = 0; i < n; ++i){cout<<a[i]<<" ";}cout<<""<<endl;}
 
int count(int g)
{
    int t=0;
    while(g!=0)
    {
       t+=g%2;
       g=g/2;
    }
    return t;
} 

void  solve()
{
 

 int n;cin>>n;
 int A,B;cin>>A>>B;
 int k=count(A^B);
 if(k%2==0)
 {
   cout<<"NO"<<endl;return;
 }
 
 std::vector<int> v;
 v.pp(0);v.pp(1);
 while(v.back()+1!=(1<<k))
 {
   std::vector<int> z;
   int si=v.size();
   for(int i=0;i<si-2;i+=2)
   {
      int x1=v[i]*4,x2=v[i+1]*4;
      z.pp(x1+0);z.pp(x1+1);z.pp(x1+3);z.pp(x1+2);
      z.pp(x2+2);z.pp(x2+3);z.pp(x2+1);z.pp(x2+0);
   }
   int x1=v[si-2]*4;
   int x2=v[si-1]*4;
   z.pp(x1+0);z.pp(x1+1);z.pp(x1+3);z.pp(x1+2);
   z.pp(x2+2);z.pp(x2+0);z.pp(x2+1);z.pp(x2+3);
   v=z;
}


while(v.size()!=1<<n)
{
  std::vector<int> z;
  int si=v.size();
  for(int i=0;i<si;i+=2)
  {
     int x1=v[i]*2,x2=v[i+1]*2;
     z.pp(x1+0);z.pp(x1+1);
     z.pp(x2+1);z.pp(x2+0);
  }
  v=z;
}


std::vector<int> pos_f[2],pos_xorb[2];
for(int i=0;i<n;i++)
{
    int z=v.back();
    if(z&(1<<i))pos_f[1].pp(i);
    else pos_f[0].pp(i);
    z=A^B;
    if(z&(1<<i))pos_xorb[1].pp(i);
    else pos_xorb[0].pp(i);
}


int convert[n];
for(int i=0;i<pos_f[0].size();i++)
{
  convert[pos_f[0][i]]=pos_xorb[0][i];
}
for(int i=0;i<pos_f[1].size();i++)
{
  convert[pos_f[1][i]]=pos_xorb[1][i];
}


std::vector<int> ans;
for(int i=0;i<v.size();i++)
{
   int z=0;    
   for(int j=0;j<n;j++)
   {
      int j1=convert[j];
      if(v[i]&(1<<j))z+=1<<j1;
   }
   ans.pp(z);
}

for(int i=0;i<ans.size();i++)
{
   ans[i]=ans[i]^A;
}

cout<<"YES"<<endl;
printvector(ans);

}




 int32_t main() 
{

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



return 0;

}

Measured memory_bytes: 4168
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<deque>
#include<numeric>
#include<algorithm>
#include<unordered_map>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);

int n;
vector<ll> h;

int main(void) {
	cin >> n;
	for (int i = 0; i < n; i++) {
		ll hi;
		cin >> hi;
		h.push_back(hi);
	}
	int ret = 0;
	int tmp = 0;
	for (int i = 0; i < n-1; i++) {
		if (h[i] >= h[i + 1]) {
			tmp++;
		}
		else {
			ret = max(ret, tmp);
			tmp = 0;
		}
	}
	ret = max(ret, tmp);
	cout << ret << endl;
	return 0;
}

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


int main(){
  int n;
  cin >> n;
  vector<int> w(n);
  int sum=0;
  rep(i, n){
    cin >> w[i];
    sum += w[i];
  }
  
  
  int mini = sum;
  int psum = 0;
  rep(i, n){
      psum += w[i];
      mini = min(mini, abs(psum-(sum-psum)));
  }
  cout << mini << endl;
}

Measured memory_bytes: 256
#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 (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

ll divnum(ll n)
{
    ll ret = 0;
    rep(i, 1, n + 1)
    {
        if (n % i == 0)
        {
            ret++;
        }
    }
    return ret;
}

ll f(ll n)
{
    ll ret = 0;
    rep(i, 1, n + 1)
    {
        ret += i * divnum(i);
    }
    return ret;
}

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    ll sq = (ll)sqrt(n);
    // cerr << sq << endl;
    for (ll m = 1; m <= sq; m++)
    {
        ans += m * (m + (n / m)) * (n / m + 1 - m);
    }
    ans -= sq * (sq + 1) * (2 * sq + 1) / 6;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3728
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int), labs(long int), llabs(llint)

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define ll long long

using namespace std;

int main(void){
    ll int n, k;
    cin >> n >> k;
    ll int rem = n % k;
    cout << min(rem, llabs(rem - k)) << endl;
    return 0;
}

Measured memory_bytes: 3188
#include <stdio.h>
int main(void)
{
	char s[26] = {'\0'};
	int cnt[26] = {0};
	int i;
	scanf("%s", s);
	i = 0;
	while (s[i] != '\0') {
		// printf("%c", s[i]);
		cnt[s[i++] - 'a']++;
	}
	// for (i = 0; i < 26; i++)
	//  	printf("%c : %d\n", 'a' + i, cnt[i]);
	for (i = 0; i < 26; i++) {
		if (cnt[i] > 1) {
			puts("no");
			break;
		}
	}
	if (i == 26) puts("yes");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>

float r3=1.73205080757;

void kohho(int n,std::vector<float> &x,std::vector<float> &y,
  float p_x,float p_y,float q_x,float q_y){
    if(x.empty()||(x[x.size()-1]!=p_x||y[y.size()-1]!=p_y)){
      x.push_back(p_x);
      y.push_back(p_y);
    }
    if(n!=0){
      float s_x=p_x+(q_x-p_x)/3.0,
            s_y=p_y+(q_y-p_y)/3.0,
            t_x=p_x+2*(q_x-p_x)/3.0,
            t_y=p_y+2*(q_y-p_y)/3.0,u_x,u_y;
      if(p_y==q_y){
         u_x=(p_x+q_x)/2.0;
         u_y=(t_x-s_x)*r3/2.0+p_y;
         //std::cout<<"equal"<<std::endl;
      }else if(p_x<q_x&&p_y<q_y){
        u_x=p_x;
        u_y=t_y;
      }else if(p_x<q_x&&p_y>q_y){
        u_x=q_x;
        u_y=s_y;
      }else if(p_x>q_x&&p_y>q_y){
        u_x=p_x;
        u_y=t_y;
      }else if(p_x>q_x&&p_y<q_y){
        u_x=q_x;
        u_y=s_y;
      }else{
        u_x=0;
        u_y=0;
        std::cout<<"error"<<std::endl;
      }
      //std::cout<<"s:"<<s_x<<" "<<s_y<<"n"<<u_x<<" "<<u_y<<"n"<<t_x<<" "<<t_y<<"l"<<"n";
      kohho(n-1,x,y,p_x,p_y,s_x,s_y);
      kohho(n-1,x,y,s_x,s_y,u_x,u_y);
      kohho(n-1,x,y,u_x,u_y,t_x,t_y);
      kohho(n-1,x,y,t_x,t_y,q_x,q_y);
    }
    if(x[x.size()-1]!=q_x||y[y.size()-1]!=q_y){
      x.push_back(q_x);
      y.push_back(q_y);
    }
  }

int main(){
  int n;
  std::cin>>n;
  std::vector<float> x,y;
  kohho(n,x,y,0.0,0.0,100.0,0);
  for(int i=0;i<x.size();i++){
    std::cout<<x[i]<<" "<<y[i]<<std::endl;
  }
}



Measured memory_bytes: 3264
/*
Anki:未済
作成日:
*/

#include <stdio.h>

int main()
{
    int a, b, c;

    scanf( "%d %d %d", &a, &b, &c );
    
    if( a + b == c || b + c == a || c + a == b ) 
        printf( "Yes\n");
    else 
        printf( "No\n");
    return 0;
}

Measured memory_bytes: 128
/*
*abc085C,O(1)
*ひとつWAで落とされている。。
maxk（下に丸める）
-(2/9)t
mink（上に丸める）
max(-(1/4)t, -(1/5)Y)
//負数なので切り捨て方に注意
t
Y-N
x
4k+t
y
-9k-2t
z
N-x-y
*/
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int N, Y, t, x, y, z, mink;
	cin >> N >> Y;
	Y /= 1000;
	t = Y - N;
	mink = max(-(t / 4), -(Y / 5));
	x = 4 * mink + t;
	y = -9 * mink - 2 * t;
	z = N - x - y;
	if (x >= 0 && y >= 0 && z >= 0) {
		cout << x << " " << y << " " << z << endl;
	}
	else {
		cout << "-1 -1 -1" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)

S = list(input())

is_hole = [None for _ in S]
is_s = [None for _ in S]

s_1 = None
for i, s in enumerate(S):
    if s_1 == 'R' and s == 'L':
        is_hole[i - 1] = 'R'
        is_hole[i] = 'L'
    if s_1 == 'L' and s == 'R':
        is_s[i] = 'S'  # 精算する
    s_1 = s

result = [0 for _ in S]
mem_R = 0  # 人数
mem_Rx = 0  # 座標
mem_L = 0

def find_next_mem_R(i):
    while i < len(S):
        if is_hole[i] == 'R':
            return i
        i += 1

mem_Rx = find_next_mem_R(0)

for i, s in enumerate(S):
    if is_s[i] == 'S':
        result[mem_Rx] = mem_R
        result[mem_Rx + 1] = mem_L
        mem_R = 0
        mem_L = 0
        mem_Rx = find_next_mem_R(i)

    if s == 'R':
        x_diff_for_R = mem_Rx - i
        if x_diff_for_R % 2 == 0:
            mem_R += 1
        else:
            mem_L += 1
    else:
        x_diff_for_R = i - mem_Rx
        if x_diff_for_R % 2 == 0:
            mem_R += 1
        else:
            mem_L += 1

result[mem_Rx] = mem_R
result[mem_Rx + 1] = mem_L

result_str = [str(i) for i in result]
print(' '.join(result_str))


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

int main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
    string ans = "";
    vector<vector<char>> s(h, vector<char>(w, '0'));
    if (a==b) {
        int k = 0;
        rep(i, h) {
            rep(j, a) {
                if (k+j >= w) k=-j;
                s[i][k+j] = '1';
            }
            k += a;
        }
    } else if (a==0) {
        rep(i, h) {
            if (i>=b) break;
            rep(j, w) {
                s[i][j] = '1';
            }
        }
    } else if (b==0) {
        rep(i, h) {
            rep(j, w) {
                if (j>=a) break;
                s[i][j] = '1';
            }
        }
    // } else if (w==a*2 || h==b*2) {
    } else {
        rep(i, h) {
            rep(j, w) {
                if ((i<b && j<a) || (i>=b && j>=a)) {
                    s[i][j] = '1';
                }
            }
        }
    } 
    // else {
    //     ans = "No";
    // }

    if (ans == "No") {
        cout << ans << endl;
    } else {
        rep(i, h) {
            ans = "";
            rep(j, w) {
                ans += s[i][j];
            }
            cout << ans << endl;
        }
    }

	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
long long a[100005],b[100005];

int main()
{
    long long t,n,m,i,j,k,x=0,y=0,z=0;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    for(i=1;i<=100000;i++){
        y=b[i]+y;
        if(y==n/2){
            z=0;
            for(j=i+1;j<=100000;j++){
                if(b[j]>0){
                    z++;
                    cout<<z<<endl;return 0;
                }
                else{
                    z++;
                }
            }
        }
    }
    cout<<z<<endl;return 0;


}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int n;cin >> n;
    int d, x;
    cin >> d >> x;
    d--;
    REP(i,n){
        x++;
        int a;
        cin >> a;
        x += d / a;
    }
    int ans=0;
    cout << x << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(H: Int, N: Int, A: IntArray, B: IntArray) {
    // dp[h] = hちょうど減らすために必要な魔力の最小値
    // dp[h] = min(dp[h - A[i]] + B[i])
    val amax = A.max()!!
    val dp = IntArray(H + amax + 1)
    for (h in 1..H + amax) {
        dp[h] = (0 until N).map { dp.getOrElse(h - A[it]) { 0 } + B[it] }.min()!!
    }
    println(dp.slice(H..H + amax).min()!!)
    return
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val H = sc.next().toInt()
    val N = sc.next().toInt()
    val A = IntArray(N.toInt())
    val B = IntArray(N.toInt())
    for (i in 0 until N.toInt()) {
        A[i] = sc.next().toInt()
        B[i] = sc.next().toInt()
    }
    solve(H, N, A, B)
}


Measured memory_bytes: 108492
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REPR(i, n) for(int i = n - 1; 0 <= i; i--)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define FORR(i, s, e) for(int i = s; e <= i; i--)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    int N;
    cin >> N;
    int t, m = 0, sum = 0;

    REP(i, N) {
        cin >> t;
        chmax(m, t);
        sum += t;
    }
    sum -= m / 2;

    cout << sum;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
 
 
def main():
    n, k = map(int, input().split())
 
    div_k = n // k  # 1からnの %k == 0 の個数
 
    # 1からnの %k == k/2 の個数
    if k % 2 == 0:
        div_k_harf = n // (k // 2) - div_k
    else:
        div_k_harf = 0
 
    print(div_k ** 3 + div_k_harf ** 3)
 
 
if __name__ == '__main__':
    main()

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

const int N = 1e5 + 5;
ll x[N], y[N], v[N], f[N], g[N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, c;
    cin >> n >> c;
    for(int i=1;i<=n;i++)
    {
        cin >> x[i] >> v[i];
        y[n - i + 1] = c - x[i];
    }
    ll sum1 = 0, sum2 = 0;
    ll tmp1 = 0, tmp2 = 0;
    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        sum1 = sum1 + v[i];
        sum2 = sum2 + v[n - i + 1];
        tmp1 = max(tmp1, sum1 - x[i]);
        tmp2 = max(tmp2, sum2 - y[i]);
        f[i] = tmp1, g[i] = tmp2;
        ans = max(ans, max(tmp1, tmp2));
    }
    for(int i = 1; i <= n; i++)
    {
        ans = max(f[i] - x[i] + g[n - i], ans);
        ans = max(g[i] - y[i] + f[n - i], ans);
    }
    cout << ans << endl;
    return 0;
}

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

dp=[[0 for j in range(len(t)+1)] for i in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i][j-1],dp[i-1][j])
            
i=len(s)
j=len(t)
ans=""

while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans=s[i-1]+ans
        i-=1
        j-=1
        
print(ans)







Measured memory_bytes: 120924
k,n = gets.chomp.split.map(&:to_i)
as = gets.chomp.split.map(&:to_i).sort
max_dist = k - as[-1] + as[0]
(0..n-2).each do |i|
  dist = as[i+1] - as[i]
  max_dist = [max_dist, dist].max
end
puts k - max_dist

Measured memory_bytes: 22256
#include<bits/stdc++.h>
#define int long long
#define vin vector<int>
#define vcn vector<char>
#define ver pair<int,int>
#define ld long double
#define pb push_back
#define x first
#define y second
#define blush fflush(stdout);fflush(stdin);
#define $(a) (int)a.size()
#define scanf ;
#define printf ;
using namespace std;
void i_love_misaka_mikoto();
int32_t main(){
    #ifdef RNS
        freopen("input.txt","r",stdin);
        #ifndef DBG
        freopen("output.txt","w",stdout);
        #endif
    #else
        ios_base::sync_with_stdio(false);
    #endif
    i_love_misaka_mikoto();
    #ifdef RNS
        cout<<'\n'<<(ld)clock()/CLOCKS_PER_SEC<<" セクンド\n";
    #endif
    return 0;
}

int tran[10]={0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int rz[(int)1e5];
void i_love_misaka_mikoto(){
    int n, m;
    cin>>n>>m;
    vin in(m);
    for(int i=0;i<m;i++)
        cin>>in[i];
    memset(rz, 201, sizeof rz);
    rz[0]=0;
    for(int i=0;i<m;i++){
        int plus=tran[in[i]];
        for(int j=0;j+plus<=n+100;j++){
            if(rz[j]!=-1)
                rz[j+plus]=max(rz[j+plus], rz[j]+1);
        }
    }
    sort(in.rbegin(), in.rend());
    vin ans;
    for(int i=0;i<$(in)&&n;i++){
        int mns=tran[in[i]];
        if(n<mns)
            continue;
        while(rz[n-mns]==rz[n]-1){
            ans.push_back(in[i]);
            n-=mns;
            if(n<mns)break; 
        }
    }
    for(auto i:ans)
        cout<<i;
}

Measured memory_bytes: 1152
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>
#include <algorithm>
#include<iomanip>
#include<map>
#define INF 1000000000
#define LM 55555
#define LL long long
using namespace::std;

long long now,L,R,D, A[2][100],AA[2][100],num, N, K, M, ans,sosu[100000];
string S, T;
bool h;
char cc;


int main() {

	cin >> N;
	for (int i = 1; i < 10; i++) {
		if (N <= i * 111) {
			cout << i * 111 << endl;
			return 0;
		}
	}
	

}

Measured memory_bytes: 384
using System;
using System.Linq;

namespace arc085_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long ret = x[1] * 1900;
            ret += (x[0] - x[1]) * 100;
            for (int i = 0; i < x[1]; i++)
            {
                ret *= 2;
            }
            Console.WriteLine(ret);
        }
    }
}

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

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

    let res = solve(n);
    println!("{}", res);
}

fn solve(n: usize) -> usize {
    const MODN: usize = 1e9 as usize + 7;
    let mut res = vec![0; n + 1];
    res[0] = 1;
    for i in 3..=n {
        res[i] = (res[i - 1] + res[i - 3]) % MODN;
    }
    res[n]
}


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

using namespace std;

struct tsd {
	int t, s, d;
	bool operator<(const tsd& a) const { return t < a.t; }
};

int main() {
	int n, m; 
	while(cin >> n >> m, n) {
		vector<bool> isinfect(n + 1);
		isinfect[1] = true;
		vector<tsd> data(m);
		for (int i = 0; i < m; ++i) cin >> data[i].t >> data[i].s >> data[i].d;
		sort(data.begin(), data.end());
		for (auto a:data)
			if (isinfect[a.s]) isinfect[a.d] = true;
		int ans = 0;
		for (int i = 1; i <= n; ++i) if (isinfect[i]) ans++;
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3248
K = int(input())
A = [int(i) for i in input().split()]
A.reverse()

min_A=2
max_A=3
cnt=True
if A[0]!=2:
  print(-1)
  cnt=False
for i in range(1,K):
  a=(min_A+A[i]-1)//A[i]*A[i]
  b=max_A//A[i]*A[i]
  if a>b and cnt:
    print(-1)
    cnt=False
    break
  else:
    min_A=a
    max_A=b+A[i]-1

if cnt:
  print(min_A,max_A)


Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int l, r, d;
	cin >> l >> r >> d;
	int ans = 0;
	for (int i = l; i <= r; i++) {
		ans += ((i % d) == 0);
	}	
	cout << ans << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

int a[5];

signed main()
{
	int N;
	cin >> N;
	int mn = LLONG_MAX / 3;
	rep(i, 5) chmin(mn, read());

	cout << 4 + (N + mn - 1) / mn << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,m;
  cin>>n>>m;
  if(n==1){
    cout<<m<<endl;
    return 0;
  }
  int ans=1;
  for(int i=1;i<=sqrt(m);i++){
    if(m%i==0){
      if(i<=m/n){
        ans = max(ans,i);
      }
      if(m/i<=m/n){
        ans = max(ans,m/i);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int W,H;
	int i,j;
	
	while(scanf("%d %d",&H,&W)!=EOF)
	{
		if(H==0&&W==0)break;
		else
		{
			for(i=0;i<H;i++)
			{
				for(j=0;j<W;j++)
				{
					printf("#");
				}
				printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 572
n = int(input())

num = -n
ans = []
#num = -n

if n == 0:
    print(0)
    exit()

while num!= 0:
    if num == 1:
        ans.append(11)
        break
    if num == -1:
        ans.append(1)
        break
    if num % (-2) == 0:
       ans.append(0)
    else:
        ans.append(1)
    num //= (-2)
    #print(num)
    
print(*ans[::-1],sep='')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int l=s.size();
	long long xh[l];
	int g[l];
	for(int i=0;i<l;i++)
	{
		g[i]=s[i]-'0';
		xh[i]=0;
	}
	xh[0]=g[l-1];
	for(int i=1;i<l;i++)
	{
		long long c[i+1],z[i+1];
		xh[i]=0;
		for(int j=0;j<i;j++)
		xh[i]+=xh[j];
		z[0]=g[l-i-1];
		for(int j=1;j<=i;j++)
		{
			z[j]=z[j-1]*10;
			z[j]+=g[l-i-1+j];
		}
		for(int j=0;j<=i;j++)
		{
			c[j]=1;
			for(int k=1;k<j;k++)
			c[j]*=2;
		}
		for(int j=0;j<=i;j++)
		xh[i]+=z[j]*c[i-j];
	}
	cout<<xh[l-1];
}

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

int main () {
  int A1 , A2 , A3 ; cin >> A1 >> A2 >> A3 ;
  int ans = max ({ A1 , A2 , A3 }) - min ({ A1 , A2 , A3 });
  cout << ans << endl ;
  return 0;
}

Measured memory_bytes: 256
import numpy as np
max_change = 1000
s = input()
t = input()
list_t = np.array([ _ for _ in t])
if len(s) == len(t):
    list_s = np.array([ _ for _ in s])
    list_tf = list_t == list_s
    n_change = len(list_t) - sum(list_tf)
    if n_change < max_change:
        max_change = n_change
    else:
        pass
else:
    for i in range(1,len(s) - len(t) + 1):
        s_sample = s[i-1:len(t)+i-1]
        list_ss = np.array([ _ for _ in s_sample])
        list_tf = list_t == list_ss
        n_change = len(list_t) - sum(list_tf)
        if n_change < max_change:
            max_change = n_change
        else:
            pass
print(max_change)

Measured memory_bytes: 27144
#include<iostream>
using namespace std;
int main(){
    string s;
    cin >> s;
    bool A = s[0] == 'R';
    bool B = s[1] == 'R';
    bool C = s[2] == 'R';
    if(A && B && C)        cout << 3 << endl;
    else if( (A && B) || (B && C))  cout << 2 << endl;
    else if(A || B || C) cout << 1 << endl;
    else cout << 0;
}

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

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair

int main()
{
    ll N,K;
    cin >> N >> K;

    vector<ll> A;
    for (ll i = 0; i < N; i++)
    {
        ll tmp;
        cin >> tmp;
        A.ADD(tmp);
    }
    
    ll lp;
    vector<ll> step;
    set<ll> stepset;
    step.ADD(1);
    stepset.emplace(1);
    for (ll i = 0; i < N; i++)
    {
        ll next = A[step[step.size() - 1] - 1];
        
        if(stepset.find(next) == stepset.end())
        { //次が未出現
            step.ADD(next);
            stepset.emplace(next);
            continue;
        }
        else
        { //既に出現しているもの；ループの開始点を求めて終了
            lp = distance(step.begin(), find(step.begin(), step.end(), next));
            break;
        }
    }

    ll loopcount = step.size() - lp; //周期

    if(K < lp)
    {
        OUTX(step[K]);
    }
    else
    {
        OUTX(step[((K - lp) % loopcount) + lp]);
    }


    return 0;
}


Measured memory_bytes: 15536
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int i,j,l,n,k,m;
  vector<int> a,b;
  cin >> n >> k;
  for(i=0;i<n;i++){
    int v;
    cin >> v;
    a.push_back(v);
  }
  int ans=0;
  for(i=n-1;i>=0;i--){
    b.push_back(a[i]);
  }
  for(i=0;i<=k;i++){
    for(j=0;j<=i/2;j++){
      int x=i-j;
      if(j>n || x>n || x<j){
        continue;
      }
      for(l=0;l<=x;l++){
        vector<int> y;
        for(m=0;m<l;m++){
          y.push_back(a[m]);
        }
        for(m=0;m<x-l;m++){
          y.push_back(b[m]);
        }
        sort(y.begin(),y.end(),greater<int>());
        for(m=0;m<j;m++){
          y.pop_back();
        }
        int sum=0;
        for(m=0;m<y.size();m++){
          sum+=y[m];
        }
        ans=max(ans,sum);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn dfs(e: &Vec<Vec<usize>>, cur: usize) -> usize {
    let mut ds = vec![];
    for &nd in e[cur].iter() {
        ds.push(dfs(e, nd));
    }
    ds.sort();
    ds.reverse();

    let mut d = 0;
    for i in 0..ds.len() {
        d = max(d, ds[i]+i+1);
    }
    d
}

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      aa: [usize1; n-1],
    }
    let mut e = vec![vec![]; n];
    for i in 0..n-1 {
        let winner = aa[i];
        let loser = i+1;
        e[winner].push(loser);
    }

    let ans = dfs(&e, 0);
    puts!("{}\n", ans);
}


Measured memory_bytes: 32764
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int i;
    int count;
    for(i=0,count=0;i<=2;i++){
      if(s.charAt(i)==t.charAt(i)){
        count = count+1;
      }
    }
    System.out.println(count);
  }
 }

Measured memory_bytes: 21844
package main

import (
	"fmt"
	"strconv"
)

func print(msg string) {
	fmt.Println(msg)
}

func printi(msg int) {
	fmt.Println(msg)
}

func main() {
	var a string
	fmt.Scan(&a)
	var result int
	for i := 0; i < 3; i++ {
		tmp, err := strconv.Atoi(a[i : i+1])
		if err != nil {
			return
		}
		result += tmp
	}
	printi(result)
}


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

int main(){
  string s;
  cin >> s;
  int n=s.size();
  char a;
  int ans=0;
  int num=0;
  int i,j;
  int ans2=100000000;
  for(i=0;i<=25;++i){
    a='a'+i;
    if(s.find(a)==string::npos){
      continue;
    }else{
      for(j=0;j<n;++j){
        if(s[j]!=a){
          num++;
        }else{
          ans=max(ans,num);
          num=0;
        }
      }
      ans=max(ans,num);
      num=0;
      ans2=min(ans2,ans);
      ans=0;
    }
  }
  cout << ans2 << endl;
  return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

void solve(long long N, std::vector<long long> A){
    map<int, int> memo;
    REP(i, N) {
        if(memo.count(A[i]) == 0) {
            memo[A[i]] = 0; 
        }

        memo[A[i]]++;
    }

    VLL beki;
    LL idx = 1;
    while(idx <= 2000000000LL) {
        beki.PB(idx);
        idx *= 2LL;
    }

    sort(ALL(A));
    A.erase(unique(ALL(A)), A.end());
    int ans = 0;
    RREP(i, A.size()-1) {
        REP(j, beki.size()) {
            int idx = beki[j] - A[i];
            if(memo.count(idx) == 1) {
                if(A[i] == idx) {
                    int add_ans = memo[idx] / 2;
                    memo[idx] -= add_ans * 2;
                    ans += add_ans;
                } else {
                    int add_ans = min(memo[idx], memo[A[i]]);
                    memo[idx] -= add_ans;
                    memo[A[i]] -= add_ans;
                    ans += add_ans;
                }
            }
        }
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}



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

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long llint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double pi = 3.14159265358979323846;

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

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

  llint n;
  cin >> n;
  queue<llint> que;
  for (llint i = 1; i < 10; i++) {
    que.push(i);
  }
  if (n < 10) {
    cout << n << endl;
    return 0;
  }

  llint cnt = 9;
  while (cnt < n) {
    llint q = que.front();
    que.pop();
    q = q * 10 + q % 10;
    if (q % 10 != 0) {
      que.push(q - 1);
      // cout << q - 1 << endl;
      cnt++;
      if (cnt == n) break;
    }
    que.push(q);
    // cout << q << endl;
    cnt++;
    if (cnt == n) break;
    if (q % 10 != 9) {
      que.push(q + 1);
      // cout << q + 1 << endl;
      cnt++;
      if (cnt == n) break;
    }
  }
  cout << que.back() << endl;

  return 0;
}

Measured memory_bytes: 768
def bubbleSort(A, N):
    flag = True
    swap_cnt = 0
    while flag:
        flag = False
        for j in range(N-1, 0, -1):
            if A[j] < A[j - 1]:
                A[j], A[j - 1] = A[j - 1], A[j]
                swap_cnt += 1
                flag = True
    return swap_cnt, A

def run():
    n = int(input())
    a = list(map(int, input().split()))
    c, a = bubbleSort(a,n)
    print(' '.join([str(i) for i in a]))
    print(c)

if __name__ == '__main__':
    run()


Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <queue>
#include <stack>
#include <bitset>
#include <set>
#include <chrono>
#include <string>
#include <assert.h>

using namespace std;

#define endl '\n'

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

    double l; cin >> l;

    cout.precision(12);

    cout << fixed << l * l * l / 27 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>
#include <list>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
//#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(void)
{
    COMinit();
    int X, Y; cin >> X >> Y;
    int m = 2 * X - Y, n = 2 * Y - X;
    if (m % 3 == 0 && n % 3 == 0) {
        m /= 3; n /= 3;
        cout << COM(m + n, m) << endl;
    }
    else cout << 0 << endl;
	
	return 0;
}


Measured memory_bytes: 23680
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

const int M=1e5+5;
int d[M];

int main()
{
	int n; scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&d[i]);
	sort(d+1,d+n+1);
	printf("%d\n",d[n/2+1]-d[n/2]);
	return 0;
}

Measured memory_bytes: 640
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1000005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x;
  cin>>x;
  for(int i=1;;i++) {
    if(360 * i % x==0) {
      cout << 360 * i / x << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t,u;
    cin>>s>>t;
    u = t.substr(0, t.size()-1);
    if(s.compare(u)==0){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}


Measured memory_bytes: 3628
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = input()
    if "7" in N:
        print(Yes)
    else:
        print(No)


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9792