akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

#include <stdio.h>
#include <string.h>


/********
*	?????????????´¢
*********/	

/*********??¢?????´?????????
*	(1)????????????????????¢??°????????¨
*	(2)????????°?????????????????????????????????0????????????
*********/

int main()
{
	char wordW [10] ={0};
	char sentenceT[1000] ={0};
	const char *end = "END_OF_TEXT";
	int j;		//
	int length_W ;	//W?????????
	int length_T ;	//T?????????
	int count = 0;	//??????W?????°???????????????
	int sa 	  = 0;	//????????¨???????????????0??§????????°????????????

	scanf("%s", wordW);
	length_W = strlen(wordW);
	
	while(1){
		scanf("%s", sentenceT);
		if (strcmp(end,sentenceT) == 0) {
			break;
		}
		else {
			length_T = strlen(sentenceT);
		
		
			if (length_W == length_T){
				//??????W???????????¨??????T????????????????????????????????¨???
				j=0;
				for(int i= 0 ; i<	length_W; i++ ){
					sa = wordW[i] - sentenceT[i];//???????????????????????????
					
					if(32 <= sa && sa <= 59){//??§???????????¨????????????
						 sa = sa-32; 
					}
					if(sa == 0){	
						j ++; 		
						if( j == length_W ){
							count++;
						}
					} else {
					//?????????????????????
					}
				}
			}else {
			//?????????????????????
			}
		}
	}
	cout << count << endl;
	
	return 0;
}
	

Measured memory_bytes: 1156
import numpy as np

d=int(input())
c=np.array(list(map(int,input().split())))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))
lastd=np.zeros(26)

ans=[0]*d
for i in range(d):  
  a=np.argmax(s[i]+c*([i]*26-lastd))
  lastd[a]=i
  ans[i]=a+1

for i in range(d):
  print(ans[i])

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

using namespace std;

#define ll long long




void solve() {

	int a;
	cin >> a;
	cout << a + a * a + a * a * a;

	




	
}

int main() {

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

	return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,t; cin>>n>>t;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  ll r=0;
  map<ll,ll> m;
  rep(l,n){
    while(r<n && a[l]<=a[r]){
      ll sa=a[r]-a[l];
      m[sa]++;
      r++;
    }
    if(r==l) r++;
  }
  ll ans=0;
  ll msa=0;
  for(auto e: m){
    if(chmax(msa,e.first)) ans=e.second;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 7296
#include<cstdio>
using namespace std;
int n,k,ans,p;
int map[12][6]={
    {4,2,0,9,7},
    {1,10,8,6,4},
    {9,7,5,3,1},
    {6,4,2,0,9},
    {3,1,10,8,6},
    {0,9,7,5,3},
    {8,6,4,2,0},
    {5,3,1,10,8},
    {2,0,9,7,5},
    {10,8,6,4,2},
    {7,5,3,1,10}};
int main()
{
    scanf("%d%d",&n,&k);n-=2;
    p=n%11;n/=11;
    ans=n*5;
    for(int i=0;i<p;i++)
     for(int j=0;j<5;j++)
      if(map[i][j]==k)ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int main(void) {
	long long int  m, n;
	int i, j, k;
	cin >> n >> m;
	if (n % 2 == 1) {
		for (i = 0; i < m; i++) {
			cout << i + 1 << " " << n - i - 1 << endl;
		}
	}
	else if(n == 4){
		for (i = 0; i < m; i++) {
			cout << 2 << " " << 3 << endl;
		}
	}
	else {
		for (i = 0; i < m / 2; i++) {
			cout << i + 1 << " " << n / 2 - i << endl;
			cout << n / 2 + 1 + i << " " << n - 1 - i << endl;
		}
		if(m % 2 == 1)cout <<  1 + i << " " << n / 2 - i << endl;
	}
	return 0;
}

Measured memory_bytes: 3664
#include <stdio.h>

int main(void)
{
	int cla[31] = {0};
	int i;
	int ac;
	
	cla[0] = 1;
	
	for(i = 0;i < 28;i++){
		scanf("%d",&ac);
		cla[ac] = 1;
	}
	for(i = 1;i < 31;i++){
		if(cla[i] == 0){
			printf("%d\n",i);
		}
	}
	
	return(0);
}

Measured memory_bytes: 596
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  while(true){
    int n,r;
    cin >> n >> r;
    if(cin.eof())break;
    vector<int> deck;
    for(int i = 0; i < n; ++i){
      deck.push_back( i );
    }
    for(int i = 0; i < r; ++i){
      int c;
      cin >> c;
      vector<int> deckA;
      vector<int> deckB;
      vector<int> deckC;
      
      for(int j = 0; j < n/2; ++j){
	deckB.push_back( deck[j] );
      }
      for(int j = n/2; j < n; ++j){
	deckA.push_back( deck[j] );
      }
      
      while(true){
	if( deckA.size() == 0 && deckB.size() == 0 ) break;
	vector<int>::iterator ite;
	ite = (deckA.size() < c ? deckA.end() : deckA.begin() + c);
	deckC.insert( deckC.end(), deckA.begin(), ite );
	deckA.erase( deckA.begin(), ite );

	/*
	for(int j = 0; j < deckC.size(); ++j){
	  cout << deckC[j] << ' ';
	}
	cout << endl;
	*/

	ite = (deckB.size() < c ? deckB.end() : deckB.begin() + c);
	deckC.insert( deckC.end(), deckB.begin(), ite );
	deckB.erase( deckB.begin(), ite );
	/*
	for(int j = 0; j < deckC.size(); ++j){
	  cout << deckC[j] << ' ';
	}
	cout << endl;
	*/
      }
      
      deck = deckC;
    }
    cout << deck.back() << endl;
  }
      
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int YMday(int y, int m){ //y??´m????????\??°
    if(y%3==0) return 20; //3??§?????????????????´?????§????????????
    else{
        if(m%2!=0) return 20; //??§??????
        else return 19; //?°??????? 
    }
}

int solve(int y, int m, int d){
    int i,ans=0;
    ans = YMday(y,m) - d; // y/m/d??????y/m???????????§?????\??°
    for(i=m+1;i<=10;i++) ans+=YMday(y,i); // y/m+1?????????y??´????????§?????\??°?????????????¨????
    for(i=y+1;i<=999;i++){// 999??´????????§?????\??°????¨????
        if(i%3==0) ans+=200; //3??§?????????????????´?????¨??¨??§??????????????§200??\
        else ans+=195; //3??§????????????????????´???20*5+19*5=195??\
    }
    //???????????§??§y/m/d??????999??´10???????????§?????\??°????±??????£??????
    //?±?????????????1000/1/1????????§????????????1????¶??????????????????????
    return ans+1;
}

int main(void){
    int i,n,y,m,d;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d%d%d", &y, &m, &d);
        printf("%d\n", solve(y,m,d));
    }
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a, b) << " " << max(0, a + b - n) << "\n";
  return 0;
}

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

class MainClass
{
    static void Main()
    {
        var XY = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long X = XY[0];
        long Y = XY[1];

        int ans = 0;
        long num = X;
        while (num <= Y)
        {
            ans++;
            num *= 2;
        }

        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 28196
N, K = [int(i) for i in input().split()]
cnt=0
for i in range(K,N+2):
    minval=(i-1)*(i)//2
    maxval=i*(N+1)-i*(i+1)//2
    cnt+=maxval-minval+1
    #print("i,max,min,cnt={},{},{},{}".format(i,minval,maxval,cnt))
print(cnt%1000000007)

Measured memory_bytes: 9116
s=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(s[k-1])

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<algorithm>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 504
#define MAXCOL 10001
#define INF 1e9+7

using namespace std;

ll n,ar[N],dp[N][N],c=1;
map < ll,ll > compression;

ll solve(ll cur,ll pcol)
{
    if(cur == n)
    {
        return 0;
    }

    if(dp[cur][pcol] != -1)
    {
        return dp[cur][pcol];
    }

    ll res = n;

    rep(i,1,c+1)
    {
        if(i == pcol)
            continue;

        ll val = (ll)(i != compression[ar[cur]]);

     //   cout << cur << " " << i << " " << ar[cur] << " " << compression[ar[cur]] << " " << val << endl;

        res = min(res,solve(cur+1,i) + val);
    }

    return dp[cur][pcol] = res;
}

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

    memset(dp,-1,sizeof dp);

    cin >> n;

    rep(i,0,n)
    {
        cin >> ar[i];

        if(!compression[ar[i]])
        {
            compression[ar[i]] = c;
            c++;
        }
    }

    rep(i,1,3*n+2)
    {
        if(!compression[i])
            compression[i] = c;

        c++;
    }

    cout << solve(0,c-1) << endl;

    return 0;
}




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

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  double ans = 0;
  for (int i = 0; i < n; i++) {
    int foo;
    cin >> foo;
    ans += 1.0 / foo;
  }
  cout << fixed << setprecision(10) << 1.0 / ans << '\n';
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int hoge = 0;
    while(1){
        int a, b; cin >> a >> b;
        if(!a) break;

        if(hoge != 0) cout << endl;
        int cnt = 0;
        for(int x = a; x <= b; x++){
            if(x % 4 != 0) continue;
            if(x % 100 == 0 && x % 400 != 0) continue;
            cout << x << endl;
            cnt++;
        }

        if(cnt == 0) cout << "NA" << endl;
        hoge++;
    }   
    return 0;
}



Measured memory_bytes: 3052
function Main(inp) {
    inp = inp.split("\n");
    var N = +inp[0];
    var H = inp[1].split(" ").map(s => +s);
    var lf = H[0];
    for (var i = 1; i < N; i++) {
        if (lf < H[i]) {
            H[i]--;
        }
        else if (lf > H[i]) {
            console.log("No")
            return;
        }
        lf = H[i]
    }
    console.log("Yes")
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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



int main(){
	string s;
	cin >> s;
	string ta = "CODEFESTIVAL2016";
	int mu = 0;
	for (int i = 0; i < 16; i++) {
		if (s[i] != ta[i])mu++;
	}
	cout << mu << endl;
	return 0;
}

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

int main() {
  int x,y;
  cin >> x >> y;
  vector<int>G(13);
  G={100,0,2,0,1,0,1,0,0,1,0,1,0};
  if(G.at(x)==G.at(y)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

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

    //good luck kittu!
    ll n, a, b; cin>>n>>a>>b;
    ll ans = n/(a+b);
    ans *= a;
    ans += min(n%(a+b), a);
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

long k, n;

void prev(VI &v) {
    if (v.back() == 1) v.pop_back();
    else {
        long l = v.back();
        v.pop_back();
        l--;
        v.push_back(l);
        while (v.size() != n) v.push_back(k);
    }
}

int main() {
    cin >> k >> n;
    
    if (k % 2 == 0) {
        cout << k / 2;
        REP(i,n-1) cout << " " << k;
        cout << endl;
        return 0;
    }
    
    VI v = VI(n, (k + 1) / 2);
    REP(i,n/2) {
        prev(v);
    }
    REP(i,v.size()-1) {
        cout << v[i] << " ";
    }
    cout << v.back() << endl;
}


Measured memory_bytes: 4608
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
//typedef __int128_t lll;
using namespace std;

ll P = 998244353;
int main(int argc, char const *argv[]) {
  ll n, s;std::cin >> n >> s;
  vll a(n);re(i,n) std::cin >> a[i];
  vvl dp = vv(n+1, s+1, 0, ll);

  for(int i=1;i<=n;i++){
    dp[i-1][0]++;
    ll now = a[i-1];
    for(int j=0;j<=s;j++) dp[i][j] = dp[i-1][j];
    for(int j=now;j<=s;j++) dp[i][j] = (dp[i][j] + dp[i-1][j-now])%P;
  }
  /*
  for(int i=1;i<=n;i++){
    for(int j=0;j<=s;j++){
      std::cout << dp[i][j] << " " ;
    }
    std::cout  << '\n';
  }
  */
  ll ans = 0;
  for(int i=1;i<=n;i++) ans = (ans + dp[i][s])%P;
  std::cout << ans << '\n';
  return 0;
}


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

int main(){
  int x,n;
  cin >> x >> n;
  vector<int> p(n);
  for(int i=0;i<n;i++){
    cin >> p.at(i);
  }
  sort(p.begin(),p.end());
  
  if((binary_search(p.begin(),p.end(),x))==0){
    cout << x << endl;
  }
  else{
    int q=1;
    int k=1;
    
    while(q){
      if((binary_search(p.begin(),p.end(),x-k))==0){
        cout << x-k << endl;
        q=0;
      }
      else if((binary_search(p.begin(),p.end(),x+k))==0){
        cout << x+k << endl;
        q=0;
      }
      k++;
    }
  }
}

Measured memory_bytes: 3648
# 2020/01/19

import sys
input=sys.stdin.readline

n=int(input())

xl=[]
for i in range(n):
    x,l=map(int,input().split())
    xl.append((max(0,x-l),x+l))

xl.sort(key=lambda x: x[1])

pre_x=xl[0][1]

cnt=0
for i in range(1,n):
    if xl[i][0]<pre_x:
        cnt+=1
    else:
        pre_x=xl[i][1]
print(n-cnt)

Measured memory_bytes: 18216
#include<iostream>
#include <stdio.h>
#include <vector>
using namespace std;
vector<int> vec;
vector<int>::iterator itr=vec.end();
int main(){int a;
while(cin>>a){
	if(a==0){itr=vec.end();itr--;cout<<*itr<<endl;
		vec.pop_back();
}else{
	vec.push_back(a);}}
	return 0;}


Measured memory_bytes: 1212
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

const long long MOD = 1000000007;

void solve(long long N, std::vector<long long> A){
    ll res = 1;
    vll tmp(N, 0);
    tmp[0]=3;
    REP(i, N){
        if(tmp[A[i]]>0){
            res  = (res* tmp[A[i]]) % MOD;
            tmp[A[i]]--;
            tmp[A[i]+1] ++;
        }
        else{
            res = 0;
            break;
        }
    }
    cout << res <<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: 1792
n,k=map(int,input().split())
ab=[list(map(int,input(). split())) for _ in range(n)]
bk=list(bin(k)[2:])
if '0' not in bk:
  t=k
  ans=0
  for a,b in ab:
    if a<=t:ans+=b
  print(ans)
else:
  ks=[k]
  for i in range(len(bk)):
    if bk[i]=='1':
      if i==0:
        ks.append(int('1'*(len(bk)-1),2))
      else:
        ks.append(int(''.join(bk[:i])+'0'+'1'*(len(bk)-i-1),2))
  ans=[0]*len(ks)
  for a,b in ab:
    for i in range(len(ks)):
      if a&ks[i]==a:ans[i]+=b
  print(max(ans))

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


int main() {
	IOS;
	ll h, n;
	cin >> h >> n;
	vector<ll> a(n);
	ll sum = 0;
	REP(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum >= h) {
		put("Yes");
	} else {
		put("No");
	}
	return 0;
}


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

int main() {
	int N;
	int total=0;
	int k = 0;
	int ten = 0;
	vector<int> points;

	cin >> N;
	points.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> points[i];
		total += points[i];
	}

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

	for (int i = 0; i < N; i++) {
		if (k == 0 && points[i] % 10 != 0) {
			k = points[i];
		}
		if (k == 0 && points[i] % 10 == 0) {
			ten += points[i];
		}
	}

	if (total % 10 == 0) {
		if (ten < k) {
			if (points[0] % 10 == 0) {
				k += points[0];
			}
			total -= k;
		}
		else {
			if (k == 0) {
				total = 0;
			}
			else {
				total -= k;
			}
		}
	}

	cout << total << endl;

	return 0;
}

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


using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

typedef pair<ll, ll> P;

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


int main() {
    string s;
    cin >> s;

    bool rt = s.front() == s.back();
    bool gs = s.size() % 2 == 0;

    if (rt ^ gs) {
        cout << "Second" << endl;
    } else {
        cout << "First" << endl;
    }

}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

A, B = map(int, input().split())

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

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

print(lcm(A, B))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>

using namespace std;

vector <int> s_inds[26];
int s_char_counts[26];
int t_char_counts[26];
int main(){
    string s;
    string t;
    cin >> s;
    cin >> t;

    for(int i = 0; i < s.size(); i++){
        s_char_counts[s[i] - 'a'] ++;
    }
    for(int i = 0; i < t.size(); i++){
        t_char_counts[t[i] - 'a'] ++;
    }

    for(int i = 0; i < 26; i++){
        if(t_char_counts[i] > 0 && s_char_counts[i] <= 0){
            cout << - 1 << endl;
            return 0;
        }
    }
    for(int i = 0; i < s.size(); i++){
        s_inds[s[i] - 'a'].push_back(i);
    }

    long long cur_ind = -1;
    long long ans = 0;
    for(int i = 0; i < t.size(); i++){
        //cout << i << endl;
        auto it = upper_bound(s_inds[t[i] - 'a'].begin(), s_inds[t[i] - 'a'].end(), cur_ind);
        if(it == s_inds[t[i] - 'a'].end()){
            ans += (s.size() - cur_ind);
            ans += s_inds[t[i] - 'a'][0];
            cur_ind = s_inds[t[i] - 'a'][0];
        } else {
            ans += (*it - cur_ind);
            cur_ind = *it;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1216
#include<cstdio>
#include<cstdlib>
#define LL long long

int ans[210];
bool fec[110];

int main()
{
	LL n;
	scanf("%lld",&n);
	LL x=n;
	fec[0]=0;
	int mx=0,id,tot=0;
	for(int i=1;i<=40;i++) fec[i]=0;
	while(x)
	{
		if(x&1) fec[mx]=1;
		x>>=1;
		if(x) mx++;
	}
	id=mx;
	for(int i=0;i<=mx;i++)
	{
		if(i>0) ans[++tot]=i;
		if(fec[i]&&i!=mx) ans[++tot]=++id;
	}
	for(int i=1;i<=mx;i++) ans[++tot]=i;
	ans[++tot]=++id;ans[++tot]=id;
	for(int i=0;i<mx;i++) if(fec[i]) ans[++tot]=--id;
	printf("%d\n",tot);
	for(int i=1;i<=tot;i++) printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 128
def main():
    N, W = map(int, input().split())
    weight = [0] * N
    value = [0] * N
    for i in range(N):
        weight[i], value[i] = map(int, input().split())
    V = sum(value)
    dp = [[float('inf')] * (V + 5) for _ in range(N + 5)]
    dp[0][0] = 0
    for i in range(N):
        for v in range(V+1):
            if v - value[i] >= 0:
                dp[i+1][v] = min(dp[i][v-value[i]] + weight[i], dp[i][v])
            else:
                dp[i+1][v] = dp[i][v]
    ans = 0
    for v in range(V+1):
        if dp[N][v] <= W:
            ans = v
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 334552
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;

int n;
int r[1111];
char str[1111];
int dp[1024][11];

int slv(int now, int key);

int main(){
  
  memset(dp, -1, sizeof(dp));

  scanf(" %d",&n);
  scanf(" %s",str);
  for(int i=0;i<n;i++){
    if(str[i] == 'J'){
      r[i] = 1;
    } else if(str[i] == 'O'){
      r[i] = 2;
    } else {
      r[i] = 4;
    }
  }
   
  printf("%d\n",slv(0,1));
  
  return 0;
} 


int slv(int now, int key){
  if(now == n)return 1;
  if(dp[now][key] != -1)return dp[now][key]; 
  int t = 0;
  for(int i=1;i<=8;i++){
    if((key & i) && (i & r[now])){
      t += slv(now+1, i)%10007;
    }
  }
  
  return dp[now][key] = t%10007;
} 

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

int main() {
  int N, a,b,c,d;
  cin >> N;
  a=N*0.001;
  b=(N-a*1000)*0.01;
  c=(N-a*1000-b*100)*0.1;
  d=(N-a*1000-b*100-c*10);
  if (a == b && b==c || b == c && c == d)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

typedef long long tnum;

#define loop(i, num) for(int i = 0; i < num; i++)

tnum* tnumAlloc(int num);
tnum getNumStdin();
tnum* getNumsStdin(int);
char* getCharsStdin(int maxlength);
string getStringStdin();
void printlnNums(int count, tnum* nums);
void printlnNum(tnum num);
void printString(string str);

#define min(a,b) (a <= b ? a : b)
#define max(a,b) (a >= n ? a : b)

/*void sort(T* start, T* end) (in <algorithm>)
example:
	int a[5] = {2, 1, 3, 5, 4};
	sort(a, a + 5);
	-> a: {1, 2, 3, 4, 5}
*/


int main() {
    char c[10];

    scanf("%s", c);
    if(c[0] == '7' || c[1] == '7' || c[2] == '7'){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

//------------------------------

//have to be free()
tnum* tnumAlloc(int num) {
	return (tnum*)calloc(num,sizeof(tnum));
}

tnum getNumStdin() {
	tnum ret;
	scanf("%lld", &ret);

	return ret;
}

//have to be free()
tnum* getNumsStdin(int num) {
	tnum* buf;
	tnum* tmp;
	buf = tnumAlloc(num);
	for (int i = 0; i < num; i++) {
		scanf("%lld", &buf[i]);
	}

	return buf;
}

//have to be free()
char* getCharsStdin(int maxlength) {
	char* ret = (char*)malloc(maxlength+1);
	scanf("%s", ret);

	return ret;
}

//have to be free()
string getStringStdin() {
	string ret;
	cin >> ret;
	return ret;
}

void printlnNum(tnum num) {
	printf("%lld\n", num);
}

// can be used for debugging
void printlnNums(int count, tnum *nums) {
	loop(i, count) {
		printf("%lld", nums[i]);
		if (i != count - 1) printf(" ");
	}
	printf("\n");
}

void printString(string str) {
	cout << str;
}

Measured memory_bytes: 3788
inf = 10**9
n, m, x = map(int, input().split())
a = [0] * n
c = [0] * n
y = [0] * n
for i in range(n):
    data = list(map(int, input().split()))
    c[i] = data[0]
    a[i] = data[1:]
ans = inf
for i in range(2**n):
    money = 0
    know = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            money += c[j]
            for k in range(m):
                know[k] += a[j][k]
    for z in know:
        if z < x:
            break
    else:
        ans = min(ans, money)

if ans == inf:
    print(-1)
else:
    print(ans)

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

int calc(std::vector<int>&v){

	int cnt = 0;
	std::vector<int>::iterator g, t, p;

	g = std::find(v.begin(), v.end(), 1);
	t = std::find(v.begin(), v.end(), 2);
	p = std::find(v.begin(), v.end(), 3);

	if (g != v.end())cnt++;
	if (t != v.end())cnt++;
	if (p != v.end())cnt++;

	if (cnt == 1 || cnt == 3)return -1;
	else if (cnt == 2){
		if (g == v.end())return 2;
		if (t == v.end())return 3;
		if (p == v.end())return 1;
	}
	return -1;
}

int main(){

	std::vector<int>jan(5);
	while (std::cin >> jan[0], jan[0]){

		std::cin >> jan[1] >> jan[2] >> jan[3] >> jan[4];

		int res = calc(jan);

		if (res == -1){
			for (int i = 0; i < 5; i++){
				std::cout << 3 << std::endl;
			}
		}

		else{
			for (int i = 0; i < 5; i++){
				if (jan[i] == res)std::cout << 1 << std::endl;
				else std::cout << 2 << std::endl;
			}
		}

	}
	return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
using namespace std;

typedef pair<int,int> pi;

const int N=305;
const int MOD=1000000007;

int n,m,f[2][N][N];
vector<pi> vec[N];

void updata(int &x,int y)
{
	x+=y;x-=x>=MOD?MOD:0;
}

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int l,r,x;scanf("%d%d%d",&l,&r,&x);
		vec[r].pb(mp(l,x));
	}
	int now=0;
	f[0][0][0]=3;
	for (int i=1;i<n;i++)
	{
		for (int j=0;j<=i;j++)
			for (int k=0;k<=j;k++)
			{
				if (!f[now][j][k]) continue;
				for (int l=0;l<vec[i].size();l++)
				{
					int x=vec[i][l].first,y=vec[i][l].second;
					if (y==1&&x<=j||y==2&&(x<=k||x>j)||y==3&&x>k) {f[now][j][k]=0;break;}
				}
				if (!f[now][j][k]) continue;
				updata(f[now^1][j][k],f[now][j][k]);
				updata(f[now^1][i][k],f[now][j][k]);
				updata(f[now^1][i][j],f[now][j][k]);
				f[now][j][k]=0;
			}
		now^=1;
	}
	int ans=0;
	for (int i=0;i<=n;i++)
		for (int j=0;j<=i;j++)
		{
			for (int k=0;k<vec[n].size();k++)
			{
				int x=vec[n][k].first,y=vec[n][k].second;
				if (y==1&&x<=i||y==2&&(x<=j||x>i)||y==3&&x>j) {f[now][i][j]=0;break;}
			}
			updata(ans,f[now][i][j]);
		}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    ll cnt[2]={0};
    for(ll i=0,x;i<n;i++)cin>>x,cnt[x%2]++;
    cout<<(cnt[1]&1?"NO":"YES");
}


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

int main(){
    int n; cin >> n;
    cout << n*n*n << endl;
return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
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>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  ll A[N+1];
  RREP(i,N) cin>>A[i];
  
  RREP(i,N){
    while(A[i+1]-A[i]==0 && i<N) ++i;
    if(i==N) {
      co(ans+1);
      return 0;
    }
    if(A[i+1]-A[i]>0){
      while(A[i+1]-A[i]>=0 && i<N) ++i;
      if(i==N) {
        co(ans+1);
        return 0;
      }
      ans++;
    }
    else if(A[i+1]-A[i]<0){
      while(A[i+1]-A[i]<=0 && i<N) ++i;
      if(i==N) {
        co(ans+1);
        return 0;
      }
      ans++;
    }
  }
  
  co(ans);
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#define MAX 100000007
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  double H;
  cin >> N >> H;
  int a[N],b[N];
  for(int i=0;i<N;i++){
    cin >> a[i] >> b[i];
  }
  ll cnt=0;
  sort(a,a+N);
  reverse(a,a+N);
  sort(b,b+N);
  reverse(b,b+N);
  bool flag =true;
  for(int i=0;i<N;i++){
    if(b[i]>=a[0]){
      H-=b[i];
      cnt++;
      if(H<=0){
        cout << cnt << endl;
        return 0;
      }
    }else{
      cnt=cnt+ceil(H/a[0]);
      cout << cnt << endl;
      return 0;
    }
  }
  cnt=cnt+ceil(H/a[0]);
  cout << cnt << endl;
  return 0;
}

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

int main(void){
    // Your code here!
    int N , K , X , Y;
    cin >> N;
    cin >> K;
    cin >> X;
    cin >> Y;
    

    cout << min(K,N) * X + max((N-K),0) * Y << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a[2][110],m=0;
  cin>>n;
  for(int i=0;i<2;i++)
    for(int j=0;j<n;j++)
      cin>>a[i][j];

    for(int j=0;j<n;j++){
        int sum=a[0][j];
        for(int i=0;i<j;i++) sum+=a[0][i];
      for(int k=0;k+j<n;k++){
        sum+=a[1][k+j];
      }
      m=max(m,sum);
    }
    cout<<m;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXN 3010
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

ll n, a[MAXN], dp[MAXN][MAXN];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> n;
    for(int i = 0; i < n; i++){
    	cin >> a[i];
    }
    for(int s = 1; s <= n; s++){
        for(int i = 0; i <= n - s; i++){
            if((s + n) % 2){
                ll t = dp[i][s - 1] - a[i + s - 1];
                t = min(t, dp[i + 1][s - 1] - a[i]);
                dp[i][s] = t;

            } else{ //max
                ll t = dp[i][s - 1] + a[i + s - 1];
                t = max(t, dp[i + 1][s - 1] + a[i]);
                dp[i][s] = t;
            }
        }
    }
    cout << dp[0][n];
}

Measured memory_bytes: 70016
program main
  implicit none
  integer :: n, i, j, d, res
  integer, allocatable :: x(:, :)
  real(8), parameter :: eps = 1e-8
  read (*, *) n, d
  allocate (x(n, d))
  do i = 1, n
    read (*, *) x(i, :)
  end do

  res = 0
  do i = 1, n
    do j = i + 1, n
      if (abs(dist(x(i, :), x(j, :)) - nint(dist(x(i, :), x(j, :)))) < eps) res = res + 1
    end do
  end do

  write (*, "(i0)") res

  contains

  real(8) function dist(x1, x2)
    integer, intent(in) :: x1(d), x2(d)
    dist = sqrt(dble(sum((x1 - x2) ** 2)))
  end function dist
end program main


Measured memory_bytes: 512
n = int(input())
b_l = list(map(int, input().split()))

a_l = [0] * n
a_l[0] = b_l[0]
a_l[-1] = b_l[-1]
for i in range(1, n-1):
    a_l[i] = min(b_l[i],b_l[i-1])
print(sum(a_l))

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

int main(){
  int N;
  cin >> N;
  vector<int> data(N);
  vector<int> num(101);
  for(int i = 0; i < N; i++){
    cin >> data[i];
  }
  for(int i = 0; i < N; i++){
    num[data[i]]++;
  }
  int count = 0;
  for(int i = 0; i <= 101; i++){
    if(num[i] > 0) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        int drowNum1;
        int drowNum2;
        int drowNum3;

        Scanner scanner = new Scanner(System.in);
        String inputData = scanner.nextLine();
        scanner.close();

        String[] editedInputData = inputData.split(" ");
        drowNum1 = Integer.parseInt(editedInputData[0]);
        drowNum2 = Integer.parseInt(editedInputData[1]);
        drowNum3 = Integer.parseInt(editedInputData[2]);

        int sumNum = drowNum1 + drowNum2 + drowNum3;

        if (sumNum >= 22) {
            System.out.println("bust");
        } else {
            System.out.println("win");
        }

    }
}

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

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

int main() {
  int K; cin >> K;
  long long sum = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= K; j++) {
      int tmp = gcd(i, j);
      for (int k = 1; k <= K; k++) {
        sum += gcd(tmp, k);
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;

int main(){

  vector<int> v(3);
  REP(i, 3){
    cin >> v[i];
  }

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

  if(v[2] == v[1] + v[0]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

int main()
{
    ll X;
    cin >> X;

    for (ll A = -200; A <= 200; A++)
    {
        for (ll B = -200; B <= 200; B++){
            if(A*A*A*A*A-B*B*B*B*B==X){
                cout << A << " " << B << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3608
#include<stdio.h>

int main(){
	int k, len=0;
	scanf("%d", &k);
	char word[100];
	scanf("%s", word);
	for(int i=0; word[i] != '\0'; i++){
		len++;
	}
	if(len <= k){
		printf("%s", word);
	}
	else{
		for(int i=k; i<=k+3; i++){
			if(i < k+3){
				word[i]='.';
			}
			else{
				word[i]='\0';
			}
		}
		printf("%s", word);
	}
	return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>

int main(void) {
	int N, X[128];
	int i, j;
	int kugyu = 999999999;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &X[i]) != 1) return 1;
	}
	for (i = 1; i <= 100; i++) {
		int hocchann = 0;
		for (j = 0; j < N; j++) {
			hocchann += (X[j] - i) * (X[j] - i);
		}
		if (hocchann < kugyu) kugyu = hocchann;
	}
	printf("%d\n", kugyu);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
using namespace std;
int n,k,p;
int bit[25];
int f[1<<21][21];
char X[(1<<20)+5];
int main()
{
	scanf("%d%d",&n,&k);
	bit[0]=1;
	for(int i=1;i<=n;++i)
	{
		bit[i]=bit[i-1]<<1;
	}
	for(int len=0;len<=n;++len)
	{
		scanf("%s",X);
		for(int s=0;s<bit[len];++s) if(X[s]=='1')
		{
			f[bit[len]|s][len]=1;
		}
	}
	for(int len=n;len>=0;--len)
	{
		for(int s=0;s<bit[len];++s)
		{
			for(int i=len;i>0;--i) if(f[bit[len]|s][i])
			{
				int a=s>>i;
				for(int j=i;j>0;--j)
				{
					if(s&bit[j-1])
					{
						f[1<<(len-i+j)|(a<<j|(s&(bit[j]-1)))][j-1]+=f[bit[len]|s][i];
						break;
					}
				} 
				for(int j=i;j>0;--j)
				{
					if(~s&bit[j-1])
					{
						f[1<<(len-i+j)|(a<<j|(s&(bit[j]-1)))][j-1]+=f[bit[len]|s][i];
						break;
					}
				}
				f[1<<(len-i)|a][0]+=f[bit[len]|s][i];
			}
			if(f[bit[len]|s][0]>=k)
			{
				for(int i=len-1;~i;--i)
				{
					printf("%d",bool(s&bit[i]));
				}
				printf("\n");
				return 0;
			}
		}
	}
	return 0;
}

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


int main(){
  long long n;
  cin >> n;
  bool ok=false;
  long long i=1;
  while(!ok){
    if(i*i>n){
      cout << (i-1)*(i-1) << endl;
      ok=true;
    }
    i++;
  }
  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    ll N;
    cin >> N;
    
    ll Ans=0;
    OREP(i,N){
        ll num = N/i;
        num = (num)*(num+1)/2;
        num *= i;
        Ans+=num;
        
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int) (v).size()

#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define trav(a, x) for(auto& a : x)

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define shandom_ruffle random_shuffle
#define funoredered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using funordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int INF = 0x3f3f3f3f;
constexpr int NINF = 0xc0c0c0c0;
constexpr double EPS = 1e-8;
constexpr ll MOD = 1000000007LL;

template <typename T>
using ordered_set = 
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll modPow( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

inline int cmp_double( double x, double y, double tol = EPS) {
    return (x <= y + tol) ? ( x + tol < y) ? -1 : 0 : 1;
}

struct Matrix {
    int N;
    vector< vector< long long> > values;

    Matrix( int _N) : N(_N) {
        values.assign(N, vector<long long>(N, 0LL) );
    }

    void read_matrix() { rep(i, 0, N) rep(j, 0, N) cin >> values[i][j]; }

    Matrix mul(Matrix& mulFactor ) const {
        Matrix M( N );
        rep(i, 0, N) {
            rep(k, 0, N) {
                rep(j, 0, N) {
                    M.values[i][j] += ( ( values[i][k] * mulFactor.values[k][j] ) % MOD );
                    M.values[i][j] %= MOD;
                }
            }
        }
        return M;
    }
    
    Matrix fexp( long long exp ) {
        Matrix original(N);
        for(int i = 0; i < N; ++i) original.values[i][i] = 1LL;
        Matrix factor(N);
        factor.values = values;
        while( exp ) {
            if( exp & 1LL ) original = original.mul( factor ); 
            factor = factor.mul(factor); 
            exp /= 2LL;
        }
        return original;
    }
};


int main()
{
    ios::sync_with_stdio(0); cin.tie(NULL);
    int n;
    long long k;
    cin >> n >> k;
    Matrix mat(n);
    mat.read_matrix();
    mat = mat.fexp( k );
    long long C = 0;
    for(const auto& v : mat.values) {
        for(const auto& x : v) {
            C = (C + x) % MOD;
        }
    }
    cout << C << endl;
    return 0;
}



Measured memory_bytes: 512
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long[] h = new long[n];
        for(int i = 0 ; i < n ; i++ ){
            h[i] = sc.nextLong();
        }
        Arrays.sort(h);
        long s = 0;
        for(int i = 0 ; i < n - k ; i++ ){
            s += h[i];
        }
        System.out.println(s);
        sc.close();
    }
}

Measured memory_bytes: 61728
#include <iostream>

int main(void){
  int n, l, r, count = 0, i;
  std::cin >> n;
  for(i = 0; i < n; i++){
    std::cin >> l >> r;
    count += r - l + 1;
  }
  std::cout << count << std::endl;
  return 0;
}

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

using namespace std;

void solve(int N) {
  for (int i = 0; i < 25; i++) {
    for (int j = 0; j < 25; j++) {
      if (4 * i + 7 * j == N) {
        printf("Yes\n");
        return;
      }
    }
  }
  printf("No\n");
}

int main() {
  int N;
  cin >> N;
  solve(N);
  return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Read();
            var N = S.Length + 1;
            var ans = new long[N];
            ans[N - 1] = S[S.Length - 1] == '>' ? 0 : 1;
            for (int i = S.Length - 1; i >= 0; i--) ans[i] = S[i] == '<' ? 0 : ans[i + 1] + 1;
            for (int i = 1; i < S.Length; i++)
            {
                if (S[i] == '<' && S[i - 1] == '<')
                {
                    ans[i] = Math.Max(ans[i - 1] + 1, ans[i]);
                    ans[i + 1] = Math.Max(ans[i] + 1, ans[i + 1]);
                }
            }

            Console.WriteLine(ans.Sum());
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 16864
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>

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

using namespace std;
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

int main()
{
    int n;
    cin >> n;
    vl h(n);
    rep(i, n)
    {
        cin >> h[i];
    }
    bool flag = true;
    rep(i, n)
    {
        if(i == 0){
            h[i]--;
        }else{
            if(h[i - 1] <= h[i] - 1){
                h[i]--;
            }else if(h[i - 1] != h[i])
            {
                flag = false;
                break;
            }
        }
    }
    if(flag)
    {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1024