akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

bool isRunRun(string S) {
    bool ok = true;
    for (int i = 0; i < S.size() - 1; i++) {
        char c1 = S[i], c2 = S[i + 1];
        int d1 = c1 - '0', d2 = c2 - '0';
        // dd(d1, d2);
        if (abs(d1 - d2) > 1) { ok = false; }
    }
    return ok;
}

void dfs(string pfx) {

    for (int nxt = 0; nxt < 10; nxt++) {
        int prev;
        if (pfx == "") {
            prev = nxt;
        } else {
            prev = pfx[pfx.size() - 1] - '0';
        }

        if (abs(nxt - prev) > 1) {
            return;
        } else {
            char nxtt = '0' + nxt;
            string S  = pfx + nxtt;
            dfs(S);
        }
    }
}

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

    int index = 0;
    queue<string> q;
    q.push("");
    while (!q.empty()) {
        string pfx = q.front();
        q.pop();

        for (int nxt = 0; nxt < 10; nxt++) {
            int prev;
            if (pfx == "") {
                if (nxt == 0) continue;
                prev = nxt;
            } else {
                prev = pfx[pfx.size() - 1] - '0';
            }

            if (abs(nxt - prev) > 1) {
                continue;
            } else {
                index++;
                char nxtt = '0' + nxt;
                string S  = pfx + nxtt;
                if (index == K) {
                    cout << S << endl;
                    return 0;
                }
                q.push(S);
            }
        }
    }

    dfs("");
    return 0;
}

Measured memory_bytes: 4864
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(int i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")


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

ll gcdext(ll a, ll b, ll& x, ll& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	ll g = gcdext(b, a % b, y, x);
	y -= a / b * x;
	return g;
}

long long modinv(long long a, long long mod) {
	long long x, y;
	gcdext(a, mod, x, y);
	x = ((x % mod) + mod) % mod;
	return x;
}

const int MAX = 510000;
const long long 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() {
	int N, K;
	cin >> N >> K;
	COMinit();
	
	ll sum = 0;
	REP(i, 0, min(K, N - 1) + 1) {
		sum += COM(N, i) * COM(N-1, i);
		sum %= MOD;
	}
	PRI(sum);
	return 0;
}




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



void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


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

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

int main(void){
  char s[100010];
  scanf("%s",s);
  int l=strlen(s);
  int bcount=0,wcount=0;
  char b,w;
  for(int i=0;i<l;i++){
    if(i%2==0){
      if(s[i]!='0'){
        bcount++;
      }
      if(s[i]!='1'){
        wcount++;
      }
    }else{
      if(s[i]!='1'){
        bcount++;
      }
      if(s[i]!='0'){
        wcount++;
      }
    }
  }
  int ans=1000000;
  chmin(&ans,bcount);
  chmin(&ans,wcount);
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1828
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	double P,T,V;
};

int calc(int x,int y){
	if(y == 0){
		return x;
	}else{
		return calc(y,x%y);
	}
}

int main(){

	int N,M;
	double L;

	scanf("%d %d %lf",&N,&M,&L);


	int mCk[M+1][M+1];
	for(int i = 0; i <= M; i++){
		for(int k = 0; k <= M; k++)mCk[i][k] = 1;
	}

	int bunshi[51],bunbo[51],common;

	for(int k = 0; k <= M; k++){

		for(int a = 0; a < k; a++)bunshi[a] = (M-a);
		for(int a = 0; a < k; a++)bunbo[a] = (k-a);

		for(int shita = 0; shita < k; shita++){
			for(int ue = 0; ue < k; ue++){

				if(bunshi[ue] >= bunbo[shita]){
					common = calc(bunshi[ue],bunbo[shita]);
				}else{
					common = calc(bunbo[shita],bunshi[ue]);
				}
				bunshi[ue] /= common;
				bunbo[shita] /= common;
			}
		}

		for(int a = 0; a < k; a++)mCk[k][a] = bunshi[a];
	}

	Info info[N];

	for(int i = 0; i < N; i++){
		scanf("%lf %lf %lf",&info[i].P,&info[i].T,&info[i].V);
		info[i].P /= 100.0;
	}

	double time[N][M+1];

	for(int i = 0; i < N; i++){
		for(int k = 0; k <= M; k++){
			time[i][k] = L/info[i].V + k*info[i].T;
		}
	}

	double table[N][M+1],base;

	for(int i = 0; i < N; i++){
		for(int k = 0; k <= M; k++){
			base = 1.0;
			for(int a = 0; a < k; a++){
				base *= info[i].P;
			}
			for(int a = 0; a < M-k; a++){
				base *= (1.0-info[i].P);
			}
			for(int a = 0; a < k; a++){
				base *= mCk[k][a];
			}
			table[i][k] = base;
		}
	}


	double win,base_time,tmp,tmp2;
	bool FLG;

	for(int i = 0; i < N; i++){
		win = 0.0;

		FLG = true;
		for(int k = 0; k <= M; k++){

			base_time = time[i][k];
			tmp = 1.0;
			for(int enemy = 0; enemy < N; enemy++){
				if(enemy == i)continue;

				FLG = false;
				tmp2 = 0.0;
				for(int a = 0; a <= M; a++){
					if(time[enemy][a] > base_time){
						tmp2 += table[enemy][a];
						FLG = true;
					}
				}
				if(!FLG)break;
				tmp *= tmp2;
			}
			if(!FLG){
				break;
			}else{
				win += table[i][k]*tmp;
			}
		}
		printf("%.8lf\n",win);
	}

	return 0;
}

Measured memory_bytes: 3320
#pragma GCC optimize "trapv"
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,a,n) for(int i=a;i<n;i++)
#define all(v) v.begin(),v.end()
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
int main()
{
    fio;
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll a[n];
        rep(i,n)
        cin>>a[i];
        ll l=1,r=(ll)1e9,mid=0;
        ll res=INT_MAX;
        while(l<=r)
        {
            mid=l+(r-l)/2;
            int trials=0;
            rep(i,n)
            {
                //if(a[i]>mid){
                trials+=((a[i]+mid-1)/mid)-1;
                //}
            }
            if(trials>k)
            l=mid+1;
            else
            {
                r=mid-1;
                res=min(res,mid);
            }
        }
        cout<<res<<endl;
    }
}

Measured memory_bytes: 5208
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int N;
bool check(int x){
    if(x==0)return 1;
    int t=0;
    while(x){
        ++t;x/=10;
    }
    return (t%2==1);
}
int main(){
    cin>>N;
    int ans=0;
    for(int i=N;i>=1;i--){
        if(check(i))++ans;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
  int A, B, n = 0;
  cin >> A >> B;
  
  for (int i = A; i <= B; i++){
    int a_1 = i % 10;
    int a_2 = (i / 10) % 10;
    int a_4 = (i / 1000) % 10;
    int a_5 = i / 10000;
    
    if (a_1 == a_5 && a_2 == a_4)
      n++;
  }
  cout << n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

int main(){
	int n;
	cin >> n;
	vi a(n), b(n);
	trav(x, a) cin >> x;
	trav(x, b) cin >> x;
	vector<bool> allowed(55, false);
	auto works = [&](){
		vi ls;
		rrep(i,0,55) if(allowed[i]) ls.push_back(i);
		rep(i,0,n){
			vector<bool> possible(51, false);
			possible[a[i]] = true;
			trav(k, ls){
				rep(j,0,51) if(possible[j])
					possible[j%k] = true;
			}
			if(!possible[b[i]]){
				return false;
			}
		}
		return true;
	};
	rep(k,1,55){
		if(k>1) allowed[k-1] = true;
		if(works()){
			rrep(i,0,k){
				allowed[i] = false;
				if(!works()) allowed[i] = true;
			}
			ll ans = 0;
			rep(i,0,55) if(allowed[i]) ans += 1LL<<i;
			cout << ans << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MAX_P 1*1000+5*1000+10*1000+50*1000+100*1000+500*1000

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int P, N[6], p[6] = {1, 5, 10, 50, 100, 500};

int change(int m){
  int c = m-P, res = 0, use;
  for(int i = 5; i >= 0; i--){
    if(c/p[i]){
      use = c/p[i];
      res += use;
      c -= use*p[i];
    }
  }
  return res;
}

int pay(int m){
  int res = 0, use;
  for(int i = 5; i >= 0; i--){
    if(m/p[i]){
      use = min(m/p[i], N[i]);
      res += use;
      m -= use*p[i];
    }
  }
  /*  if(m/500){ use = min(m/500, N[5]); res += use; m -= use*500;}
  //  printf("%d\n", res);
  if(m/100){ use = min(m/100, N[4]); res += use; m -= use*100;}
  //  printf("%d\n", res);
  if(m/50){ use = min(m/50, N[3]); res += use; m -= use*50;}
  //  printf("%d\n", res);
  if(m/10){ use = min(m/10, N[2]); res += use; m -= use*10;}
  //  printf("%d\n", res);
  if(m/5){ use = min(m/5, N[1]); res += use; m -= use*5;}
  //  printf("%d\n", res);
  if(m){ use = min(m, N[0]); res += use; m -= use;}*/
  if(m) return INF;
  else return res;
}

int main(){
  while(scanf("%d%d%d%d%d%d%d", &P, &N[0], &N[1], &N[2], &N[3], &N[4], &N[5]) && P){
    int res = INF, sum = N[0]*p[0]+N[1]*p[1]+N[2]*p[2]+N[3]*p[3]+N[4]*p[4]+N[5]*p[5];
    //    printf("%d %d\n", P, sum);
    REP(i, P, sum+1){
      //            printf("%d %d %d\n", i, change(i), pay(i));
      res = min(res, change(i)+pay(i));
    }

    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<algorithm>
#include<numeric>

int const num[9] = {1, 7, 4, 5, 3, 2, 9, 6, 8};
int const cnt[9] = {2, 3, 4, 5, 5, 5, 6, 6, 7};
int const MAXN = 10000;

int n[6], c[6], M, N;
bool use[6];
int count[6], ctmp[6], ix[6], maxv;

void search(int nn, int m) {
  if(m == M && nn > 0) return;
  if(nn > 0) {
    for(int i = 0; i*c[m] <= nn; ++i) {
      ctmp[m] = i;
      search(nn - i*c[m], m+1);
    }
    return;
  }
  int res = 0;
  for(int i = 0; i < M; ++i) for(int j = 0; j < ctmp[ix[i]]; ++j) {
    res = res*10 + n[ix[i]];
  }
  if(res > maxv) {
    maxv = res;
    std::copy(ctmp, ctmp+M, count);
  }
}

// try all cases for N <= 35
void calc() { maxv = 0; search(N, 0); }

int main() {
  std::cin >> N >> M;
  std::fill(use, use+6, false);
  std::fill(n, n+6, 0);
  for(int i = 0; i < M; ++i) {
   int a;
   std::cin >> a;
   switch(a) {
     case 1:
       use[0] = true; n[0] = a; break;
     case 7:
       use[1] = true; n[1] = a; break;
     case 4:
       use[2] = true; n[2] = a; break;
     case 2: case 3: case 5:
       use[3] = true; n[3] = std::max(n[3], a); break;
     case 6: case 9:
       use[4] = true; n[4] = std::max(n[4], a); break;
     case 8:
       use[5] = true; n[5] = a;
   }
  }
  // compact n[], c[]
  M = 0;
  for(int i = 0; i < 6; ++i) if(use[i]) {
    n[M] = n[i];
    c[M] = i+2;
    ++M;
  }
  // reminder shoud be LE 6 digits
  int k = 0;
  if(N > (c[0]-1)*6) {
    k = (N - (c[0]-1)*6)/c[0];
    N -= k*c[0];
  }
  std::iota(ix, ix+M, 0);
  std::sort(ix, ix+M, [](int l, int r){ return n[l] > n[r]; });
  calc();
  count[0] += k;
  for(int i = 0; i < M; ++i) {
    char ch = '0' + n[ix[i]];
    for(int j = 0; j < count[ix[i]]; ++j) std::cout << ch;
  }
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	map<int, int> darkroom;
	int d[16];
	for(int i = 0; i < m; i++){
		cin >> d[i];
		d[i]--;
		darkroom[d[i]] = i;
	}
	vector<vector<int> > path(101);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < k; j++){
			int v;
			cin >> v;
			v--;
			path[i].push_back(v);
		}
	}
	vector<int> result((1 << m), mod);
	result[(1 << m) - 1] = 0;
	// 1????????£???????????¨??????????????????????????¨??????????????????????????????????????¨?±?
	queue<int> qu;
	qu.push((1 << m) - 1);
	while(!qu.empty()){
		int i = qu.front();
		qu.pop();
		for(int j = 0; j < k; j++){
			// ?¬????j????????????????????¶??¨??????
			int next = 0;
			for(int l = 0; l < m; l++){
				int roomnum = d[l];
				if((i & (1 << l)) != 0 && darkroom.find(path[roomnum][j]) != darkroom.end()){
					next = (next | (1 << darkroom[path[roomnum][j]]));
				}
			}
			// cout << i << " " << result[i] << " " << j << " " << next << endl;
			if(result[next] > result[i] + 1){
				result[next] = result[i] + 1;
				qu.push(next);
			}
		}
	}
	cout << result[0] << endl;
	return 0;
}

Measured memory_bytes: 3428
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	int i,x,n,p,q,aa,b,ans;
	cin>>x>>n;
	if(n==0) {cout<<x; return 0;}
	vi a(n);
	for0(i,n) cin>>a[i];
	sort(a.begin(),a.end());
	for(i=x ; ; i++){
		if(binary_search(a.begin(),a.end(),i) == 0){
			p=i;
			break;
			}
		}
	for(i=x ; ; i--){
		if(binary_search(a.begin(),a.end(),i) == 0){
			q=i;
			break;
			}
		}
	aa = abs(x-p);
	b = abs(x-q);
	if(aa==b) ans = min(p,q);
	else if(aa<b) ans = p;
	else ans = q;
	
	cout<<ans<<nw;
	
	return 0;
}

Measured memory_bytes: 3592
#include<iostream>

const int MAXN = 100000;

int find(int i);
bool merge(int L, int R, int D);

int *id;
int *distance;

int main(void){
  int N,M;

  std::cin >> N >> M;

  id = (int*)malloc(sizeof(int) * N);
  distance = (int*)malloc(sizeof(int) * N);

  for (int i = 1; i <= N; i++) {
    id[i] = i;
    distance[i] = 0;
  }

  for (int i = 1; i <= M; i++) {
    int L, R, D;
    std::cin >> L >> R >> D;

    if (!merge(L, R, D)) {
      std::cout << "No";
      return 0;
    }
  }
  std::cout << "Yes";
  return 0;
}

bool merge(int L, int R, int D) {
  int originL = find(L);
    int originR = find(R);
    if (originL == originR) {
      return (distance[L] + D) == distance[R];
    } else {
      distance[originR] = distance[L] + D - distance[R];
      id[originR] = originL;
      return true;
    }
}

int find(int i) {
  int tmp = i;
  while(id[i] != i) {
    i = id[i];
    distance[tmp] += distance[i];
  }
  id[tmp] = i;
  return i;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
using namespace std;

const int INF = 1e9;
typedef long long ll;

int p[31];

int main(void){
  int n;
  for(int i = 0; i < 28; i++) {cin >> n; p[n]++;}
  for(int i = 1; i <= 30; i++){
    if(p[i] == 0) cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ld a, b, x;
	cin >> a >> b >> x;
	if (x <= a * a * b / 2) {
		ld d = x * 2 / a / b;
		cout << 90 - atan2(d, b) * 180 / PI << '\n';
	}
	else {
		ld d = (a*a*b - x) * 2 / a / a;
		cout << 90 - atan2(a, d) * 180 / PI << '\n';
	}
}

Measured memory_bytes: 256
N,M = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(N)]
c = [list(map(int,input().split())) for i in range(M)]

for i in range(N):
  d = []
  for j in range(M):
    d.append(abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1]))
  print(d.index(min(d))+1)

Measured memory_bytes: 3064
N, M, C = map(int, input().split())
B = list(map(int, input().split())) # M個の要素
A = [list(map(int, input().split())) for _ in range(N)] # サイズ(M,N)の2次元配列

ans = 0

for i in range(N):
    number = C
    for j in range(M):
        number += A[i][j]*B[j]
    if number > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] a = new int[h][w];
	    for(int i = 0; i < h; i++){
	        for(int j = 0; j < w; j++){
	            a[i][j] = sc.nextInt()%2;
	        }
	    }
	    
		// 計算
		int result = 0;
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < h; i++){
	        for(int j = 0; j < w-1; j++){
	            if(a[i][j] == 1){
	                sb.append(i+1).append(" ").append(j+1).append(" ").append(i+1).append(" ").append(j+2).append("\n");
	                a[i][j+1] += a[i][j];
	                result++;
	            }
	        }
	    }
	    for(int i = 0; i < h-1; i++){
	        if(a[i][w-1]%2 == 1){
	            sb.append(i+1).append(" ").append(w).append(" ").append(i+2).append(" ").append(w).append("\n");
	            a[i+1][w-1] += a[i][w-1];
	            result++;
	        }
	    }
		
		// 出力
		System.out.println(result);
		System.out.println(sb);
	}
}


Measured memory_bytes: 95592
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]
count = 0

for i in range(1,N+1):
  D.append(D[i-1]+L[i-1])
  
for j in range(len(D)):
  if D[j] <= X:
    count += 1
  else:
    break
print(count)


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================

	int H, W;
	cin >> H >> W;

	int s_x = 0;
	int s_y = 0;
	int g_x = W - 1;
	int g_y = H - 1;

	vstring C(H);
	for (int i = 0; i < H; i++)
	{
		cin >> C[i];
	}


	vvint ans(H);
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			ans[i].emplace_back(INF);
		}
	}


	ans[s_y][s_x] = 0;

	queue<vint> Q;
	Q.push({ s_y, s_x});

	while (!Q.empty())
	{
		int now_y = Q.front()[0];
		int now_x = Q.front()[1];		
		Q.pop();

		for (int d_i = 0; d_i < 4; d_i++)
		{

			int next_x = now_x + DX[d_i];
			int next_y = now_y + DY[d_i];

			if (next_x >= 0 && next_x < W && next_y >= 0 && next_y < H)
			{
				if (C[next_y][next_x] != '#' && ans[now_y][now_x] + 1 < ans[next_y][next_x])
				{
					ans[next_y][next_x] = ans[now_y][now_x] + 1;
					Q.push({ next_y, next_x });
				}
			}
		}

		/*for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cout << ans[i][j] << " ";
			}
			cout << endl;
		}
		cout << endl;*/


	}

	/*for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;*/

	int n_white = 0;
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (C[i][j] == '.')
			{
				n_white++;
			}
		}
	}

	if (n_white-1 >= ans[g_y][g_x])
	{
		cout << n_white - ans[g_y][g_x]-1 << endl;
	}
	else {
		cout << -1 << endl;
	}



}



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


int main()
{
	int n, q;
	int A[20], m[200];
	int *dp;
	int num, sum;
	int maxi, maxv;
	int i, j, k;


	scanf("%d", &n);
	sum = 0;
	for(i = 0; i < n; i++){
		scanf("%d", &num);
		sum += A[i] = num;
	}

	scanf("%d", &q);
	maxv = 0;
	for(i = 0; i < q; i++){
		scanf("%d", &num);
		m[i] = num;
		if(num > maxv)
			maxv = num;
	}


	// 動的計画法で求める
	dp = (int *)malloc(sizeof(int) * maxv + 1);

	dp[0] = 0;
	for(j = 1; j <= maxv; j++)
		dp[j] = -1;

	maxi = 0;
	for(j = 0; j < n; j++){
		if(A[j] + maxi > maxv)
			k = maxv;
		else
			 k = maxi + A[j];
		for(; k >= A[j]; k--){
			if(dp[k] == -1 && dp[k - A[j]] != -1){
				dp[k] = j;
				if(k > maxi)
					maxi = k;
			}
		}
	}

	for(i = 0; i < q; i++){
		if(dp[m[i]] == -1)
			printf("no\n");
		else
			printf("yes\n");
	}

	return 0;
}


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

int main()
{
    ll sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    ll yokoReverse = 0;
    ll tateReverse = 0;

    for(ll i = 0; i < abs(tx - sx); i++)
    {
        if(tx - sx > 0)cout << 'R';
        else cout << 'L';
    }
    for(ll i = 0; i < abs(ty - sy); i++)
    {
        if(ty - sy > 0)cout << 'U';
        else cout << 'D';
    }

    for(ll i = 0; i < abs(tx - sx); i++)
    {
        if(tx - sx > 0)cout << 'L';
        else cout << 'R';
    }
    for(ll i = 0; i < abs(ty - sy); i++)
    {
        if(ty - sy > 0)cout << 'D';
        else cout << 'U';
    }

    
    if(tx - sx > 0)cout << 'L';
    else cout << 'R';
    for(ll i = 0; i < abs(ty - sy)+1; i++)
    {
        if(ty - sy > 0)cout << 'U';
        else cout << 'D';
    }
    for(ll i = 0; i < abs(tx - sx)+1; i++)
    {
        if(tx - sx > 0)cout << 'R';
        else cout << 'L';
    }
    if(ty-sy > 0)cout << 'D';
    else cout << 'U';

    if(tx - sx > 0)cout << 'R';
    else cout << 'L';
    for(ll i = 0; i < abs(ty - sy)+1; i++)
    {
        if(ty - sy > 0)cout << 'D';
        else cout << 'U';
    }
    for(ll i = 0; i < abs(tx - sx)+1; i++)
    {
        if(tx - sx > 0)cout << 'L';
        else cout << 'R';
    }
    if(ty-sy > 0)cout << 'U';
    else cout << 'D';

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	int i,n,m=0;
	cin>>n;
	vi a(n);
	for0(i,n){
		cin>>a[i];
		m = max(m,a[i]);
		}
	sort(a.begin(),a.end());
	vi dp(m+2,0);
	for(auto x:a){
		for(i=x ; i<=m ; i+=x){
			dp[i]++;
			}
		}
	ll c=0;
	for(auto x:a){
		if(dp[x]==1) c++;
		}
	cout<<c<<nw;
	return 0;
}

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

int main(){
	ll N, K;
	cin >> N >> K;
	ll A[N];
	for(int i=0; i<N; i++){
		cin >> A[i];
	}
	ll ans = 0, x = -1;
	for(int i=41; i>=0; i--){
		int cnt = 0;
		if(K & (1ll<<i)){
			if(x < i){
				x = i;
			}
		}
		for(int j=0; j<N; j++){
			if(A[j] & (1ll<<i)){
				cnt++;
			}
		}
		if(cnt < N - cnt){
			ll p = ans;
			p |= (1ll<<i);
			if(p <= K){
				ans |= (1ll<<i);
			}
		}
	}
	ll ans2 = 0;
	for(int i=x-1; i>=0; i--){
		int cnt = 0;
		for(int j=0; j<N; j++){
			if(A[j] & (1ll<<i)){
				cnt++;
			}
		}
		if(cnt < N - cnt){
			ans2 |= (1ll<<i);
		}
	}
	ll ANS = 0, ANS2 = 0;
	for(int i=0; i<N; i++){
		ANS += ans^A[i];
	}
	for(int i=0; i<N; i++){
		ANS2 += ans2^A[i];
	}
	cout << max(ANS, ANS2) << endl;
	return 0;
}


Measured memory_bytes: 1024
D = int(input())
Cs = list(map(int,input().split()))
Ss = [list(map(int,input().split())) for i in range(D)]
ts = []
for i in range(D):
    ts.append(int(input()))

last = [0]*26
satisfy = 0

for day,t in enumerate(ts):
    day += 1
    last[t-1] = day
    satisfy += Ss[day-1][t-1]
    for i in range(26):
        satisfy -= Cs[i]*(day-last[i])
    print(satisfy)

Measured memory_bytes: 68288
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define lint long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807

bool prime_check(int A)
{
  if( A < 2) return 0;
  for (int i = 2; i <= sqrt(A); i++)
  {
    if(A%i == 0)return 0;
  }
  return 1;
}
void solve()
{
  int N;
  cin>>N;
  vector<int> vec(N,0);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  int count = 0;
  int min_v;
  
  for (int i = 0; i < N; i++)
  {
    min_v = i;
    for (int j = i ; j <N ; j++)
    {
      if(vec[min_v] > vec[j]) min_v = j;
    }
    if(min_v != i) 
    {swap(vec[i],vec[min_v]);
    count++;
    }
  }

  for (int i = 0; i < N; i++)
  {
    cout<<vec[i];
    if(i != N -1) cout<<" ";
  }

  cout<<endl<<count<<endl;
  
  
  return;
}

int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



Measured memory_bytes: 3088
n, m = gets.to_s.split.map{|i| i.to_i }

bits = Array.new(n){|i| 2**i }
# p bits = Array.new(12){|i| 2**i } #=> [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]

h = { 0 => 0 }
m.times do |i|
  
  a, b = gets.to_s.split.map{|i| i.to_i     }
  c    = gets.to_s.split.map{|i| i.to_i - 1 }
  
  bit = c.map{|t| bits[t] }.reduce(0){|s,t|s+t}
  
  h.keys.each do |k|
    
    new = k | bit
    h[new] = h[k] + a if ( !h.has_key?(new) ||  h[new] > h[k] + a )
    
  end
  
end

puts h[ (1 << n) - 1] || -1

Measured memory_bytes: 10492
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a;
	int n,x=0;
	cin>>a>>n;
	int m[10000]={0},o=0;
	while(a!=0){
		m[o]+=a%n;
		a/=n;
		o++;
 	}
	for(int i=o-1;i>=0;i--)
		x++;
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		ArrayList<Integer> x = new ArrayList<Integer>();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int i = 0;
		while(true) {
			x.add(Integer.parseInt(br.readLine()));
			if(x.get(i) == 0) {
				break;
			}
			i++;
		}
		for(int j = 0; j < x.size() - 1; j++) {
			System.out.println("Case " + (j+1) + ": " + x.get(j));
		}
	}
}

Measured memory_bytes: 32788
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1, 0);
    rep(i,n-1){
        if(s[i] == 'A' && s[i+1] == 'C') sum[i+2]++;
    }
    for(int i = 1; i <= n; i++){
        sum[i] += sum[i-1];
    }
    int l, r;
    rep(i,q){
        cin >> l >> r;
        int ans = sum[r] - sum[l];
        cout << ans << endl;
    }
    return 0;
}


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

namespace CSharpSample01
{
    
    class Program
    {
        
        static void Main(string[] args)
        {
            int num_Mt = int.Parse(Console.ReadLine());
            int[] hight = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int max_hight = hight[0];
            int num_seesea = 1;

            for(int i = 1; i < num_Mt; i++)
            {
                if(hight[i] >= max_hight)
                {
                    num_seesea++;
                    max_hight = hight[i];
                }
            }

            Console.WriteLine(num_seesea);
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>

int main( void ) {
	int i, n, p, now, have[ 50 ], rest;

	for ( ; scanf( "%d %d", &n, &p ), rest = p; printf( "%d\n", now ) ) {
		for ( i = 0; i < 50; i++ )
			have[ i ] = 0;

		for ( now = 0; ; now = ( now + 1 ) % n ) {
			if ( rest == 1 && have[ now ] == p - 1 )
				break;

			if ( rest == 0 ) {
				rest = have[ now ];
				have[ now ] = 0;
			} else {
				rest--;
				have[ now ]++;
			}
		}
	}

	return 0;
}

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

int main(){
  int64_t N;
  cin >> N;
  vector<int64_t> vec(5);
  for(int i=0; i<5; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  if(N %vec.at(0) != 0){
    cout << 5 + N /vec.at(0) << endl;
  }
  else{
    cout << 4 + N /vec.at(0) << endl;
  }
}

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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1;i <= 100;++i) {
		if (A % B * i % B == C) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long as[] = new long[n+1];
      	long lstack;
      	int count;
      	int num = 0;
      
      	for(int i = 0;i < n;i++) as[i] = sc.nextLong();
      	as[n] = 0;
      	Arrays.sort(as);
	     
  		lstack = as[n];
      	count = 1;
      
      	for(int i = n-1;i > -1;i--) {
        	if(lstack == as[i]) count++;
          	else {
              if(count % 2 == 1) num++;
              lstack = as[i];
              count=1;            
            }
        }
        System.out.println(num);
      
	}
}

Measured memory_bytes: 59744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S>
void print(vector<S> &v){
	for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

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

int main(){
	string s; cin >> s;
	int n = s.size();
	mint ans = mint(3).pow(n-1);
	mint base(2);
	for(int i=1; i<n; i++){
		if(s[i] == '1'){
			ans += base * mint(3).pow(n-1-i);
			base *= mint(2);
		}
	}
	ans += base;
	cout << ans << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void){
    int n,i,count=0;
    scanf("%d",&n);
    for(i=1;i<10;i++){
        if(n/i<10 && n%i==0)
            count = count + 1;
    }
    if(count == 0)
        printf("No");
    else
        printf("Yes");
    return 0;
}

Measured memory_bytes: 128
n=int(input())
s=input()
def f(x,n):
  return chr(ord(x)+n) if ord(x)+n <= ord('Z') else chr(ord(x)+n-26)
S=f(s[0],n)
for i in range(len(s)-1):
  S=S+f(s[i+1],n)
print(S)

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

int N,M;
int T[110];
int sum;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)scanf("%d",T + i),sum += T[i];
    scanf("%d",&M);
    for(int i = 0; i < M; i++)
    {
        int p,x;
        scanf("%d%d",&p,&x);
        printf("%d\n",sum - (T[p - 1] - x));
    }
    return 0;
}


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

using namespace std;

long long int a[100001];

int main(){

    
    long long int n,q,b,c;
     cin >> n;

         long long int ans = 0;

    for(long long int i=0;i<n;i++){
        long long int x;
        cin >>  x; a[x]++;
        ans+=x;
    }

    cin >> q;

    for(long long int i=0;i<q;i++){
        cin >> b >> c;
        ans -= a[b] * b;
        ans += a[b] * c;
        a[c]+=a[b];
        a[b]=0;
        cout << ans << endl;
    }
    

    return 0;

    
    
    return 0;
}

Measured memory_bytes: 4376
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  int x = 0;
  while (x * (x + 1) / 2 < n) x++;
  int e = x * (x + 1) / 2 - n;
  vi v;
  loop(i, 1, x + 1) if (i != e) cout << i << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        if(a > 499){
            System.out.println("Yes");
        }else if(n%500<=a){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;
const int MAX_N = int(1e5) + 10;
const int INF = 1e9;

int K,N;
int h[MAX_N];

int main()
{
  cin >> N >> K;
  REP(i,0,N) cin >> h[i];

  sort(h, h+N);

  int res = INF;
  REP(i,0,N) {
    if (i+K-1 >= N) break;
    chmin(res, h[i+K-1] - h[i]);
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 640
H, W, A, B = map(int, input().split())
mod = 10**9 + 7
U = 2 * 10**5

factorial = [1 for _ in range(U + 1)]
for i in range(1, U + 1):
    factorial[i] = (factorial[i - 1] * i) % mod

inverse = [1 for _ in range(U + 1)]
inverse[U] = pow(factorial[U], mod - 2, mod)
for i in range(U, 0, -1):
    inverse[i - 1] = (inverse[i] * i) % mod


def comb(n, k):
    if k < 0 or k > n:
        return 0
    x = factorial[n]
    x *= inverse[k]
    x %= mod
    x *= inverse[n - k]
    x %= mod
    return x
  
  
ans = 0
for i in range(H - A):
    x = comb(B - 1 + i, i)
    a = H - 1 - i
    b = W - 1 - B
    x *= comb(a + b, a)
    x %= mod
    ans += x
ans %= mod
print(ans)


Measured memory_bytes: 18968
S=input()
N=len(S)
if S=="keyence":
    print("YES")
    exit()
for i in range(N):
    for j in range(i,N):
        tmp=""
        for k in range(N):
            if i<=k and k<=j:
                continue
            tmp=tmp+S[k]
        if tmp=="keyence":
            print("YES")
            exit()

print("NO")

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

int main() {
  long int x, y;
  cin >> x;
  
  y = x/11;
  
  if ( x%11 == 0 ) {
   cout << y*2 << endl;
  }
  else if ( x%11 == 1 || x%11 == 2 || x%11 == 3 || x%11 == 4 || x%11 == 5 || x%11 == 6 ) {
    cout << y*2 + 1 << endl;
  }
  else {
    cout << y*2 + 2 << endl;
  }
     
}


Measured memory_bytes: 256
package main

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

var sc  = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func devideGroup() (map[int]int) {
	return map[int]int{1:1,2:3,3:1,4:2,5:1,7:1,8:1,10:1,12:1,6:2,9:2,11:2}
}

func main() {
	sc.Split(bufio.ScanWords)
	x := nextInt()
	y := nextInt()
	m := devideGroup()
	if m[x] == m[y] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define maxn 60

using namespace std;

int n,a[maxn],k;
int s,t;
ll sum[maxn],c[maxn][maxn];

int main() {
   // freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin>>n>>k>>s>>t;
    for (int i=1;i<=n;i++) cin>>a[i];

    for (int j=0;j<maxn;j++) {
        c[0][j] = 1;
        for (int i=1;i<=j;i++) c[i][j] = c[i-1][j-1] + c[i][j-1];
    }

    for (int i=1;i<=n;i++)
        for (int j=1;j<=min(i,k);j++) sum[i]+=c[j][i];

    ll ans = 0;
    for (int tt=0;tt<(1<<18);tt++)
        if ((tt&(s^t)) == tt) {
            //cout<<tt<<endl;
            int obit = 0;
            for (int i=0;i<18;i++) obit += (tt>>i)&1;

            vector<int> q;
            for (int i=1;i<=n;i++)
                if (((a[i]&s)==s) && ((a[i]|t)==t)) q.push_back(a[i]&tt);
            //cout<<q.size()<<endl;
            sort(q.begin(),q.end());
            int b=0,e=0;
            while (b<(int)q.size()) {
                e = b;
                while (e+1<(int)q.size() && q[e]==q[e+1]) e++;
                ans += (obit%2==0 ? 1 : -1) * sum[e-b+1];
                b = e+1;
            }
        }
    cout<<ans<<endl;
}


Measured memory_bytes: 3664
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, m, a;
P b[100010];
signed main() {
	cin >> n >> m;
	prique<int, vector<int>, greater<int>> que;
	rep(i, n) {
		cin >> a;
		que.push(a);
	}
	rep(i, m)cin >> b[i].second >> b[i].first;
	sort(b, b + m, greater<P>());
	rep(i, m) {
		bool f = false;
		while (b[i].second) {
			int t = que.top();
			if (t >= b[i].first) {
				f = true;
				break;
			}
			que.pop();
			que.push(b[i].first);
			b[i].second--;
		}
		if (f)break;
	}
	int ans = 0;
	while (!que.empty()) {
		int t = que.top();
		que.pop();
		ans += t;
	}
	cout << ans << endl;
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second

using namespace std;

int solve();

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // DEBUG
    solve();
    return 0;
}

int solve()
{
    int n;
    cin >> n;
    bool f = false;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if (x % 2 == 1)
            f = true;
    }
    if (f)
        cout << "first" << endl;
    else
        cout << "second" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

int main()
{
    int n , k = 0;
    cin >> n ;
    string s ;
    cin >> s ;
    k = s.size() ;
    if(k <= n)
    {
        cout << s << endl ;
    }
    else
    {
        for(int i = 0 ; i < n ; i++ )
        {
            cout << s[i];
        }
        cout <<"...\n" ;
    }
}
    

Measured memory_bytes: 3628
#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 ll=long long;
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;}

const int mod = 1e9 + 7;

int counter[26];
string march = "MARCH";

signed main()
{
	int N; cin >> N;
	vector<string> names;
	rep(i, N) {
		string S; cin >> S;
		rep(j, 5) {
			if (S[0] == march[j]) {
				counter[S[0] - 'A']++;
			}
		}
	}

	vi arr;

	rep(i, 5) if (counter[march[i] - 'A'] > 0) arr.PB(counter[march[i] - 'A']);

	int ans = 0;

	rep(i, arr.size()) rep(j, i) rep(k, j) {
		ans += arr[i] * arr[j] * arr[k];
	}

	cout << ans << endl;
}



Measured memory_bytes: 256