akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
vector<int> G[500];
int main() {
	int n, m, Q;
	cin >> n >> m >> Q;
	rep(i, m) {
		int l, r; cin >> l >> r; l--; r--;
		G[l].push_back(r);
	}
	rep(i, n) {
		sort(G[i].begin(), G[i].end());
	}
	rep(i, Q) {
		int p, q; cin >> p >> q; p--; q--;
		int out = 0;
		Rep1(j, p, q) {
			int num = upper_bound(G[j].begin(), G[j].end(), q) - G[j].begin();
			out += num;
		}
		cout << out << endl;
	}
	return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>
#include<cmath>
#include<utility>
#include<cstdlib>
#include<bitset>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;                       

#define ll long long
#define pb push_back
#define mp make_pair

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const ll M = 1e9 + 7;

ll fastpo(ll a, ll x){
    if(x == 0) return 1ll;
    if(x == 1) return a;
    ll y = fastpo(a, x/2);
    if(x%2 == 0){
        return y*y;
    }
    return y*y*a;
}

ll inv(ll a, ll M){
    return fastpo(a, M-2);
}

ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}

ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1) 
        return -1; 
    else
    { 
        ll res = (x%m + m) % m; 
        return res;
    } 
}


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

ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}

int main(){
//    clock_t time_req;
//     time_req = clock();
    int n;
    cin>>n;
    vector<int> a(n);
    int f = 0;
    for(int i=0; i<n; i++){
        cin>>a[i];
        f = f ^ a[i];
    }
    for(int i=0; i<n; i++){
        int b = f ^ a[i];
        cout<<b<<" ";
    }
    cout<<endl;
    // time_req = clock()-time_req;
    // cout<<"Time taken: "<<(float)time_req/CLOCKS_PER_SEC<<"s"<<endl;
    return 0;
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;

vector<int> adj[200005];
vector<pair<int, int>> a;
map<int, pair<int, int>> mp;
void dfs(int u, int p) {
    a.emplace_back(0, u);
    mp[u] = {(int)a.size() - 1, 0};
    for (auto& x : adj[u]) if (x != p){
        dfs(x, u);
        a.emplace_back(0, u);
        mp[u].S = (int)a.size() - 1;
    }
    if (adj[u].size() == 1) {
        a.emplace_back(0, u);
        mp[u].S = (int)a.size() - 1;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n - 1; ++ i) {
        int u, v;
        cin >> u >> v;
        adj[u].emplace_back(v);
        adj[v].emplace_back(u);
    }
    dfs(1, 0);
    while (q --) {
        int p, x;
        cin >> p >> x;
        a[mp[p].F].F += x;
        a[mp[p].S].F -= x;
    }
    vector<int> ans(n + 1, -1);
    for (int i = 0; i < a.size(); ++ i) {
        if (i) a[i].F += a[i - 1].F;
        if (ans[a[i].S] == -1) ans[a[i].S] = a[i].F;
    }
    ans.erase(ans.begin());
    for (auto& x : ans) cout << x << " ";
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if ((c-a-b) < 0) {
    cout << "No" << endl;
  } else if (4*a*b >= (c-a-b) * (c-a-b)){
    cout << "No" << endl;
  } else{
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
from copy import deepcopy
from decimal import Decimal
n = int(input())
a = [int(Decimal(input()) * (pow(10, 9))) for i in range(n)]
l = [[0] * 19 for i in range(19)]
ans = 0
for i in a:
    cnt2 = 0
    i2 = deepcopy(i)
    while i2 % 2 == 0 and cnt2 < 18:
        i2 //= 2
        cnt2 += 1
    cnt5 = 0
    i5 = deepcopy(i)
    while i5 % 5 == 0 and cnt5 < 18:
        i5 //= 5
        cnt5 += 1
    ans += l[19 - cnt2 - 1][19 - cnt5 - 1]
    for i in range(cnt2 + 1):
        for j in range(cnt5 + 1):
            l[i][j] += 1
print(ans)

Measured memory_bytes: 275576
N = int(input())

vacation = []

for i in range(N):
    a,b,c = map(int, input().split())

    vacation.append([a,b,c])

dp = []*N

for i in range(N):
    dp.append([0, 0, 0])

dp[0][0]=vacation[0][0]
dp[0][1]=vacation[0][1]
dp[0][2]=vacation[0][2]

for i in range(0, N-1, 1):

    for j in range(3):
        for k in range(3):
            if j==k:
                continue
            dp[i+1][j] = max(dp[i+1][j], dp[i][k]+vacation[i+1][j])

print(max(dp[N-1]))

Measured memory_bytes: 42532
package main

import "fmt"

const (
	maxBufferSize     = 2000000 // check
	initialBufferSize = 20000
)

func Ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func solve() {
	var n, d int
	fmt.Scan(&n, &d)

	ans := Ceil(n, 2*d+1)

	fmt.Println(ans)
}

func main() {
	solve()
}


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

int main()
{
	int n;
    cin>> n ;
   	vector<int> dp(3,0);
    for(int i=0;i<n;i++){
        int arr[3];
        vector<int> curr(3,0);
        cin>> arr[0] >> arr[1]>> arr[2];
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j!=k){
                    curr[k]=max(curr[k],dp[j]+arr[k]);
                }
            }
        }
        dp=curr;
    }
    cout<<max(dp[0],max(dp[1],dp[2]));
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<unordered_set>
using namespace std;

int main()
{
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		unordered_set<string>U;
		string W[73], X[73], Y[73], Z[73],w,x,y,z;
		string c;
		cin >> c;
		for (int d = 0; d < c.length(); d++) {
			w += c[d]; x = c[d] + x;
			W[d + 1] = w; X[d + 1] = x;
		}
		for (int e = c.length() - 1; e != -1; e--) {
			y += c[e]; z = c[e] + z;
			Y[e] = y; Z[e] = z;
		}
		for (int i = 0; i <= c.length(); i++) {
			U.insert(W[i] + Y[i]);
			U.insert(W[i] + Z[i]);
			U.insert(X[i] + Y[i]);
			U.insert(X[i] + Z[i]);
			U.insert(Y[i] + W[i]);
			U.insert(Z[i] + W[i]);
			U.insert(Y[i] + X[i]);
			U.insert(Z[i] + X[i]);
		}
		cout << U.size() << endl;
	}
}

Measured memory_bytes: 3280
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector>
#include <string.h>
#include <iomanip>
#include <sstream>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());
#define usort(a) sort(a.rbegin(),a.rend());

using namespace::std;



ll int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}

int main(){
  int a;
  cin>>a;
  cout<<a+jo(a,2)+jo(a,3);
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int N,Q;
  string S;
  cin>>N>>Q;
  cin>>S;
  
  vector<vector<int>> quiz(Q);
  for (int i=0;i<Q;i++){
    int l,r;
    cin>>l>>r;
    quiz.at(i).push_back(l);
    quiz.at(i).push_back(r);
  }
  
  vector<int> data;
  int x=0;
  
  data.push_back(0);
  
  for(int i=0;i<N-1;i++){
    if (S.at(i)=='A' && S.at(i+1)=='C') x++;
    data.push_back(x);
  }
  
  for (int i=0;i<Q;i++){
    int ans;
    ans=data.at(quiz.at(i).at(1)-1)-data.at(quiz.at(i).at(0)-1);
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 6904
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define ll long long
#define EPS 0.000000001
#define ld long double
#define inf 5e18
#define N 1000001

int a[N];
 
 
 
int32_t main()
{
    IOS;

    int n;
    cin >> n;
    int tc = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
        tc += (a[i] == 0);
    }
    // cerr << tc << endl;
    if(tc > 3)
    {
        cout << 0;
        return 0;
    }
    if(a[0] != 0)
    {
        cout << 0;
        return 0;
    }
    int x = 0,y = 0,z = 0;
    int ans = 1;
    for(int i = 0;i < n;i++)
    {
        int chance = 0;
        if(tc >= 1)
            chance += (x == a[i]);
        if(tc >= 2)
            chance += (y == a[i]);
        if(tc >= 3)
            chance += (z == a[i]);
        chance = min(chance,tc);
        if(chance == 0)
        {
            cout << 0 ;
            return 0;
        }
        ans = (ans * chance) % mod;
        if(x == a[i])
            x++;
        else
            if(y == a[i])
                y++;
            else
                if(z == a[i])
                    z++;
    }
    if(tc == 3)
        ans = (ans * 1)%mod;
    else
        if(tc == 2)
            ans = (ans * 3)  % mod;
        else
            ans = (ans * 3)% mod;
    cout << ans;
    return 0;
 
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265



void f(int n,int m){
  bool b[8000000]={};
  int c=0;

  FOR(i,n,8000000){
    if(b[i]) continue;
    if(c==m){
      cout<<i<<endl;
      break;
    }
    for(int j=i;j<8000000;j+=i){
      b[j]=true;
    }
    c++;
  }

}



int main(){
  int n,m;
  while(1){
    cin>>n>>m;
    if(n==0) break;
    f(n,m);
  }

  return 0;
}


Measured memory_bytes: 10880
// Last Change: 06/01/2019 21:04:52.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  string S;
  int k;
  cin >> S;
  k = S.size();

  int cnt = 0;
  for (int i = 0; i < k; ++i) {
    if (S[i] == 'o') {
      ++cnt;
    }
  }

  if (cnt + 15 - k >= 8) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 2020, M = 403000, inf = 0x3f3f3f3f;
int n,m,head[N],nxt[M],to[M],edgenum,a[M],b[M],d[N],mx[N],res[M];Vi e[N];
void add(int u, int v){
	to[++edgenum]=v;nxt[edgenum]=head[u];head[u]=edgenum;
}
Vi g[N];
int tot;
inline void dfs(int u, int *d){
	rep(i,0,SZ(g[u])-1)if(d[g[u][i]]==inf)d[g[u][i]]=d[u],dfs(g[u][i],d);
//	L(i,u)
//	for(int i=head[u];i;i=nxt[i])
//	{tot++;if(d[to[i]]==inf)d[to[i]]=d[u],dfs(to[i],d);}
}
int main() {//freopen("1.in","r",stdin);
	read(n);read(m);rep(i,1,m)read(a[i]),read(b[i]),add(a[i],b[i]),e[b[i]].pb(i);
	rep(i,1,m)g[a[i]].pb(b[i]);
	rep(u,1,n){
	//	printf("u = %d %d\n",u,tot);
	//	int f=1,r=1;
		memset(d,inf,4*(n+2));memset(mx,inf,4*(n+2));
	//	L(i,u)q[r++]=to[i];
		d[u]=mx[u]=0;
		/*while(f!=r){
			int u=q[f++];
			L(i,u)if(d[to[i]]>d[u]||mx[to[i]]<mx[u])
				mx[to[i]]=mx[u],d[to[i]]=d[u],q[r++]=to[i];
		}*/
		static int s[N];int len=0;L(i,u)s[++len]=to[i];
		rep(i,1,len)if(d[s[i]]==inf)d[s[i]]=s[i],dfs(s[i],d);
		per(i,len,1)if(mx[s[i]]==inf)mx[s[i]]=s[i],dfs(s[i],mx);
		L(i,u)res[i]^=d[to[i]]!=to[i]||mx[to[i]]!=to[i];
		per(i,SZ(e[u])-1,0)res[e[u][i]]^=d[a[e[u][i]]]<inf;
	}
	rep(i,1,m)printf("%s\n",res[i]?"diff":"same");
	return 0;
}


Measured memory_bytes: 10368
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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




// ***************************************


int main(){

    ll X, N;
    cin >> X >> N;

    set<ll> P;
    REP(i, N){
        ll x;
        cin >> x;
        P.insert(x);
    }

    ll ans = 1e5;
    ll num;
    FOR(a, -100, 102){
        if (P.find(a) != P.end()) continue;

        if (abs(X - a) < ans){
            ans = abs(X - a);
            num = a;
        }
    }

    cout << num << endl;

    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int n, m;
	cin >> n >> m;

	vvl info(3);
	ll res = 0;
	rep(i, n) {
		rep(j, 3) {
			ll num; cin >> num;
			info[j].push_back(num);
		}
	}

	for (int bit = 0; bit < (1 << 3); ++bit) {
		vl all(n);
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < 3; ++j) {
				if (bit & (1 << j)) all[i] += info[j][i];
				else all[i] -= info[j][i];
			}
		}
		sort(DESC(all));
		ll ans = 0;
		rep(i, m) ans += all[i];
		res = max(res, ans);
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int N;

bool isPrime(int x) {
     for(int i=2; i*i<=x; i++) {
        if( x%i==0 ) return false;
     }
     return true;
}

int main () {
    cin >> N;
    long long int ans = 1;
    for(int i=2; i<= N; i++) {
        long long int r = 1;
        if(isPrime(i)) {
            for(int j=N; j/=i; r+=j);
            ans = ans * r % 1000000007;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;

  if (s[0] == '7' || s[1] == '7' || s[2] == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

int main(){
  string S;
  cin >> S;
  if((S.at(0)==S.at(1) && S.at(1)==S.at(2))||(S.at(1)==S.at(2) && S.at(2)==S.at(3))){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 384
// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)>
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"

/*##################################################################################*/

/*
int prime[1000000] = {0} ;
vector < vector < int >  > fact(1000001);
void calculateprime()
{
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; i <= 1000000 ; i++)
    {
        if(prime[i] == 0)
        {
            for(ll j = i*2 ; j <= 1000000 ; j += i )
            {
                fact[j].pb(i);
            }
        }
    }
}
*/

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool isprime(ll n)
{
    for(ll i = 2 ; (ll) i*i <= n ; i++)
    {
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

ll fib(int n)
{
  ll a = 0, b = 1, c, i;
  if( n == 0)
    return a;
  for (i = 2; i <= n; i++)
  {
    c = (a + b);
    a = b;
    b = c;
  }
  return b;
}


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

ll extendedgcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extendedgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

ll findgrouplcm(vector<int> &arr, int n)
{
    ll ans = arr[0];

    for (ll i = 1; i < n; i++)
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));

    return ans;
}


ll powerwithmod(ll x, unsigned ll y, ll p)
{
    ll res = 1;

    x = x % p;

    if (x == 0) return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


bool comp(const pair<int,int> &a , const pair<int,int> &b){
    return a.first < b.first;
    if(a.first == b.first)  return a.second < b.second;
}

int arr[100005];

void solve(){
    ll n ;
    in(n);
    char ch = 'a';
    char arr[26];
    arr[0] = ch++;
    mfor(i,1,26,1)  arr[i] = ch++;
    string str = "";
    while(n > 0 ){
        n -= 1 ;
        int temp = n % 26 ;
        str += arr[ temp ];
        n /= 26 ;
    }
    reverse( str.begin() , str.end());
    cout<<str;
}
int main() {
    fast();
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
//#include <windows.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VVC = vector<VC>;
using VS = vector<string>;
using VVS = vector<VS>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
const int INF = 2e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL n, k;
  cin >> n >> k;
  if (n >= k) n %= k;
  LL ans = n;
  n = abs(n-k);
  chmin(ans, n);
  n = abs(n-k);
  chmin(ans, n);
  cout << ans;

  return 0;
}

Measured memory_bytes: 256
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define mp make_pair 
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/

void solve()
{
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	{
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
		solve();
	return 0;
}




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

#define fs first
#define sc second

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


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    bool a = 1;
    for (auto e : v) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "]";
    return os;
}

// std::deque Debug
template<typename T>
ostream& operator<<(ostream& os, const deque<T>& d) {
    os << "[";
    bool a = 1;
    for (auto e : d) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "]";
    return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << " " << p.second << ")";
    return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
    os << "{";
    bool a = 1;
    for (auto e : st) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "}";
    return os;
}

// std::multiset Debug
template<typename T>
ostream& operator<<(ostream& os, const multiset<T>& st) {
    os << "{";
    bool a = 1;
    for (auto e : st) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "}";
    return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
    os << "{";
    bool a = 1;
    for (auto e : mp) {
        os << (a ? "" : " ");
        os << e.first << ":" << e.second;
        a = 0;
    }
    os << "}";
    return os;
}

// std::tuple Debug
template<int N, class Tuple>
void out(ostream& os, const Tuple& t){}
template<int N, class Tuple, class H, class ...Ts>
void out(ostream& os, const Tuple& t) {
    if (N) os << " ";
    os << get<N>(t);
    out<N+1,Tuple,Ts...>(os, t);
}
template<class ...Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
    os << "(";
    out<0,tuple<Ts...>,Ts...>(os, t);
    os << ")";
    return os;
}

// Debug
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl


struct edge { int to, cost; };
ostream& operator<<(ostream& os, const edge& e) {
    os << "(" << e.to << ", " << e.cost << ")";
    return os;
}

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

int main()
{
    LL n; cin >> n;

    cout << n*(n-1)/2 << endl;

    return 0;
}


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

using namespace std;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define INF LLONG_MAX
#define EPS 1e-9
#define all(v) (v).begin(),(v).end()
#define sq(x) ((x)*(x))
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)


#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
 
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
 
typedef long double dbl;
bool codejam = 0;

const int MOD = 1000*1000*1000 + 7;
const int NMAX = 1000*1000 + 11;

int h[NMAX];
int n,m,p,q,k,a,b,c,ans;
string s,str;
char ch;
vector<int> v;
int good[100011];

void solve()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        good[i] = 1;
        cin>>h[i];
    }
    int x,y;
    for(int i=1;i<=m;i++){
        cin>>x>>y;
        if(h[x] > h[y]){
            good[y] = 0;
        }else if (h[x] < h[y]){
            good[x] = 0;
        }else{
            good[x] = 0;
            good[y] = 0;
        }
    }
    int cnt = 0;
    for(int i=1;i<=n;i++){
        if(good[i]) cnt++;
    }
    cout<<cnt<<"\n";
}

int32_t main(){ fio;
    int t = 1;
    int cs = 1;
    // cin>>t;
    while(t--){
        if(codejam){
            cout<<"Case #"<<cs<<": ";
        }
        cs++;
        solve();
        cout<<"\n";
    }
}

Measured memory_bytes: 5220
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
using namespace std;

long long keta;
string ans;

// 整数の入力
int getDigit(vector<int> digits){
    int digitLow = -1;
    if (digits.size()== 0){
        digitLow = 0;
    }
    int digitHigh = 9;
    int j;
    while (digitLow +1 != digitHigh) {
        cout << "? ";
        for (j= 0;j<digits.size();j++){
                cout << digits[j];
        }
        cout << (digitLow + digitHigh)/2;
        for (j= 0;j< keta - digits.size() + 1;j++){
            cout << 9;
        }
        cout << endl <<flush;

        cin >> ans;
        if (ans == "Y"){
            digitHigh = (digitLow + digitHigh)/2;
        }else{
            digitLow = (digitLow + digitHigh)/2;
        }
    }
    return digitHigh;
}
int main()
{
    int i;
    string ans2;
    long long ketaLow1 = 0;
    long long ketaHigh1 = 11;
    long long ketaLow2 = 0;
    long long ketaHigh2 = 11;

    while (ketaLow1 +1 != ketaHigh1) {
        cout << dec << "? ";
        for (i= 0;i< (ketaLow1 + ketaHigh1)/2;i++){
            cout << 9;
        }
        cout << endl << flush;
        cin >> ans;
        if (ans == "Y"){
            ketaHigh1 = (ketaLow1 + ketaHigh1)/2;
        }else{
            ketaLow1 = (ketaLow1 + ketaHigh1)/2;
        }
    }

    while (ketaLow2 +1 != ketaHigh2) {
        cout << dec << "? " << (long long)(pow(10,(ketaLow2 + ketaHigh2)/2)) << endl <<flush;
        cin >> ans;
        if (ans == "N"){
            ketaHigh2 = (ketaLow2 + ketaHigh2)/2;
        }else{
            ketaLow2 = (ketaLow2 + ketaHigh2)/2;
        }
    }

    if (ketaLow1 != ketaLow2){
        if (ketaLow2 == 10){
            keta = ketaLow1;
        }else{
            keta = ketaLow2;
        }
    }else{
        keta = ketaLow1;
    }

    vector<int> digits;
    for (i = keta;i >= 0;i--){
        digits.push_back(getDigit(digits));
    }

    cout << "! ";
    for (i=0;i<=keta;i++){
        cout << digits[i];
    }
    cout << endl <<flush;

    return 0;
}

Measured memory_bytes: 596
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static final int INF = Integer.MAX_VALUE;
	static int N = Integer.parseInt(sc.next());
	static int W = Integer.parseInt(sc.next());
	static final int V = 1000 * (N+1);
	static int[] w = new int[N];
	static int[] v = new int[N];
	static long[][] dp = new long[N+1][V+1]; // 価値に対する最小の重さ
	static {
		Arrays.stream(dp).parallel().forEach(i -> Arrays.fill(i, INF));
//		Arrays.fill(dp[0], INF);
		dp[0][0] = 0;
	}
	public static void main(String[] args) {
		for (int i = 0; i < N; i++) {
			w[i] = Integer.parseInt(sc.next());
			v[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < V+1; j++) {
				if (j - v[i] >= 0) {
					dp[i+1][j] = Math.min(dp[i][j], dp[i][j-v[i]] + w[i]);
				} else {
					dp[i+1][j] = dp[i][j];
				}
			}
		}
//		Arrays.stream(dp).forEach(i -> System.out.println(Arrays.toString(i)));
		int ans = -1;
		for (int i = 0; i < V+1; i++) {
			if (dp[N][i] <= W) {
				ans = i;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 132432
#include <iostream>

using namespace std;

int main(){

  int r, g, b;

  cin >> r >> g >> b;

  int x = (100*r)+(10*g)+b;

  if(x%4==0){
    cout << "YES" << endl;
  }

  else {
    cout << "NO" << endl;
  }

  return 0;

}

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

ll g(ll n, ll b)
{
	ll r = 0;
   while (n)
   {
      r += n % b;
      n /= b;
   }
	return r;
}

ll f(ll n, ll s)
{
	ll i;
	if (n == s)
      return n + 1;
	if (n < s)
      return -1;
	for (i = 2; i * i <= n; i++)
      if (g(n, i) == s)
         return i;
	n -= s;
	for (; i > 0; i--)
      if (n % i == 0 && g(n + s, n / i + 1) == s)
         return n / i + 1;
	return -1;
}

int main()
{
	ll n, s;
	cin >> n >> s;
	cout << f(n, s);
	return 0;
}


Measured memory_bytes: 256
import sys

#+++++
		
def main():
	n, k = map(int, input().split())
	al=list(map(int, input().split()))
	ans=len([v for v in al if v >= k])
	print(ans)

	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 11896
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;
char c[10][10];
int h,w,k;


int main(){
    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>c[i][j];
        }
    }
    int ans=0;
    for(int p=0;p<(1<<h);p++){
        for(int q=0;q<(1<<w);q++){
            int cc=0;
            for(int i=0;i<h;i++){
                for(int j=0;j<w;j++){
                    if(c[i][j]=='#' && !(1&p>>(h-i-1)) && !(1&q>>(w-j-1))) cc++;
                }
            }
            //cout<<cc<<endl;
            if(cc==k) ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
S = list(map(int, input().split()))
H = S[0]
W = S[1]
A = S[2]
B = S[3]

s1 = ''
s2 = ''
for i in range(W):
	if i < A:
		s1 += '0'
		s2 += '1'
	else:
		s1 += '1'
		s2 += '0'
for _ in range(B):
	print(s1)
for _ in range(H-B):
	print(s2)

Measured memory_bytes: 3956
N = int(input())
A = list(map(int, input().split()))
 
ans=[]
cnt=0
B = [0 for i in range(N)]
import math
for i in range(math.floor(N/2),N):
    B[i]=A[i]
    if(A[i]==1):
        cnt+=1
        ans.append(i+1)
        
from functools import reduce
for i in range(math.floor(N/2)-1,-1,-1):
    R=[B[(i+1)*j-1] for j in range(2,(N//(i+1))+1)]
    r=sum(R)%2
    l = int(not (r)) if A[i]==1 else int(r)
    B[i]=l
    if l==1:
        cnt+=1
        ans.append(i+1)
print(cnt)
if cnt>0:
    print(" ".join(map(str, ans)))

Measured memory_bytes: 22584
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long
				
int32_t main() {
	fast_cin();  

	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<int> a, b, c;
	priority_queue<int> comb, cc;
	for (int i = 0; i < A; i++) {
		int temp; cin >> temp;
		a.push_back(temp);
	}
	for (int i = 0; i < B; i++) {
		int temp; cin >> temp;
		b.push_back(temp);
	}
	for (int i = 0; i < C; i++) {
		int temp; cin >> temp;
		c.push_back(temp);
		cc.push(temp);
	}
	int cnt = X + Y;
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	
	for (int i = A - 1; i >= A - X; i--) {
		comb.push(a[i]);
	}
	for (int i = B - 1; i >= B - Y; i--) {
		comb.push(b[i]);
	}
	int ans = 0;
	while (cnt) {
		int val1 = 0, val2 = 0;
		if (!comb.empty()) val1 = comb.top();
		if (!cc.empty()) val2 = cc.top();
		if (val2 > val1) {
			ans += val2;
			cnt--;
			cc.pop();
		} else {
			ans += val1;
			cnt--;
			comb.pop();
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5532
import java.io.*;
import java.util.*;
import static java.lang.Math.min;
import static java.lang.Math.max;
public class Main {

    private static void solver(InputReader sc, PrintWriter out) throws Exception {
            int n = sc.nextInt();
            long arr[] = new long[n];
            Map<Long,Long> hm = new HashMap<>();
            long sum=0;
            for(int i=0; i<n; i++){
                long x = sc.nextInt(); arr[i] = x;
                if(hm.containsKey(x)) hm.put(x,1+hm.get(x));
                else hm.put(x,1L);
                sum += x;
            }
            int q = sc.nextInt();
            for(int i=0; i<q; i++){
                long x = sc.nextLong();
                long y = sc.nextLong();
                if(hm.containsKey(x)){
                    long count = hm.get(x);
                    sum -= (count * x);
                    sum += (count * y);
                    hm.put(x,0L);
                    if(hm.containsKey(y)){
                        hm.put(y,count+hm.get(y));
                    }else hm.put(y,count);
                }
                out.println(sum);
            }
    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}
class Pair implements Comparable<Pair>{
    int x,y;
    Pair(int x, int y){
        this.x = x;
        this.y = y;
    }
    public int compareTo(Pair p){
        return (int)(this.x - p.x);
    }
}
class Tuple{
    String s;
    int x, y;

    public Tuple(String s, int x, int y) {
        this.s = s;
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuple tuple = (Tuple) o;
        return x == tuple.x &&
                y == tuple.y &&
                s.equals(tuple.s);
    }

    @Override
    public int hashCode() {
        return Objects.hash(s, x, y);
    }
}

Measured memory_bytes: 60172
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, d;
  cin >> n >> m >> d;
  cout << setprecision(16);
  if (d == 0LL) {
	  cout << ((double) m - 1) / n << endl;
	} else {
	  cout << 2.0 * (m - 1) * max(0LL, n - d) / (n * n) << endl;
	}
  return 0;
}


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

typedef long long ll;

ll k,x;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>k;
    queue<ll> q;
    for(int i=1;i<10;i++)q.push(i);
    while(k--){
        x=q.front();
        q.pop();
        if(x%10)q.push(x*10+x%10-1);
        q.push(x*10+x%10);
        if(x%10<9)q.push(x*10+x%10+1);
    }
    cout<<x<<endl;

    return 0;
}

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

#define N_MAX (246912)

std::vector<int> primes;

void get_primes(void) {
  std::vector<bool> v(N_MAX + 1);
  for (int i = 0; i <= N_MAX; ++i) {
    v[i] = true;
  }
  v[0] = false; v[1] = false;
  for (int i = 2; i < N_MAX; ++i) {
    if (v[i]) {
      primes.push_back(i);
      for (int j = i * 2; j < N_MAX; j += i) {
        v[j] = false;
      }
    }
  }
}

int main(int argc, char const* argv[])
{
  get_primes();
  int n_primes = primes.size();
  while (true) {
    int n;
    std::cin >> n;
    if (n == 0)
      break;
    if (n == 1) {
      std::cout << 1 << std::endl;
      continue;
    }
    int cnt = 0;
    for (int i = 0; i < n_primes; ++i) {
      if (n < primes[i] && primes[i] <= (2 * n))
        ++cnt;
    }
    std::cout << cnt << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1348
#include "bits/stdc++.h"
    using namespace std;
    using ll=long long;
    #define rep(i,a,n) for(int i=a;i<n;i++)
    #define P pair<ll,ll>
    #define print(n) cout<<n<<endl
     
    #define x first
    #define y second
    int k, x, y, t;
    P a[200020];//a[0]={x,y}をスタートしてゴール{x,y}に向かっていく
    P cal(int x, int y) {
    	if (x > y) {//y座標のほうが大きくなるようにする
    		P t = cal(y, x);
    		return {t.y, t.x};
    	}
    	if (x < 0) {//xを正の数にする
    		P t = cal(-x, y);
    		return { -t.x, t.y};
    	}
    	if (x + y >= 2 * k) return {x, y - k};//y>kのとき
     
    	if (x + y == k) return {0, 0};//到達できた
    	return  { -k + (x + y) / 2, x + y - (x + y) / 2};//移動する
    }
    int main() {
    	cin>>k>>x>>y;
    	if (!(k & 1) && (x + y) & 1) return puts("-1"), 0;//kが偶数でX+Yが奇数の時到達できない
    	a[0] = {x, y};
    	for (; a[t].x || a[t].y; t++) a[t + 1] = cal(a[t].x, a[t].y);
    	print(t);//手数を出力する
    	for (; t--;) print(a[t].x<<" "<<a[t].y);
    }

Measured memory_bytes: 5632
a = [[0 for j in range(10)] for i in range(3)]
b = [[0 for j in range(10)] for i in range(3)]
c = [[0 for j in range(10)] for i in range(3)]
d = [[0 for j in range(10)] for i in range(3)]
building = [a, b, c, d]
N = int(input())
for i in range(N):
    b, f, r, v = map(int, input().split())
    building[b - 1][f - 1][r - 1] += v
for j in range(4):
    for i in range(3):
        print(" " + " ".join(map(str, building[j][i])))

    if j != 3:
        print("#" * 20)



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

using namespace std;

int main()
{
  int p, q;
  while(cin >> p >> q){
    static int used[1000010];
    memset(used, -1, sizeof(used));
    string ans = "";
    string hat = "";
    int prevr = -1;
    for(int i = 0; ; i++){
      int r = p / q;
      int l = p % q;
      if(l == 0){
	ans += to_string(r);
	break;
      }
      /*
      else if(prevr == r && used[l] != -1) {
	for(int j = 0; j < i; j++){
	  if(j < used[l]) hat += " ";
	  else hat += "^";
	}
	break;
      }
      */
      else if(used[l] != -1){
	ans += to_string(r);
	for(int j = 0; j <= i; j++){
	  if(j <= used[l]) hat += " ";
	  else hat += "^";
	}
	break;
      } else {
	ans += to_string(r);
	p = l;
	prevr = r;
	used[l] = i;
      }
      p *= 10;
    }
    cout << ans.substr(1) << endl;
    if(hat.size()) cout << hat.substr(1) << endl;
  }
  return 0;
}

Measured memory_bytes: 7156
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (u32, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = K * (K - 1).pow(N - 1);

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

const static int MAX = 100;
int a, b, k, ans, tmp;

int GreatestCommonDivisor(int x, int y) {
    int r = x;
    
    if ( x < y ) {
        x = y;
        y = r; 
    }
    
    while ( r > 0 ) {
        r = x % y;
        x = y;
        y = r;
    }

    return x;
}

int main() {
    scanf("%d %d %d", &a, &b, &k);
    ans = GreatestCommonDivisor(a, b);
    tmp = 1;
    
    while ( true ) {
        if ( tmp == k ) {
            break;
        }
        
        ans--;

        if ( a % ans == 0 and b % ans == 0 ) {
            tmp++;
        }
    }

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


Measured memory_bytes: 256
// Problem : 
// 			B - Making Triangle
// 			
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
	“Whether you think you can, or you think you can’t – you’re right” - Henry Ford 
*/

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define pb push_back
#define pl pair<ll, ll>
#define vl vector<ll>
#define vi vector<int>
#define endl '\n'

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

template <typename T, typename TT>
ostream &operator<<(ostream &os, const pair<T, TT> &t) {
    return os << t.first << " " << t.second;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &t) {
    for (auto &i : t) os << i << " ";
    return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &t : v) is >> t;
    return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, vector<pair<T1, T2>> &v) {
    for (pair<T1, T2> &t : v) is >> t.first >> t.second;
    return is;
}

const ll mod = 1e9 + 7;

void solve() {
	ll n; cin >> n;
	vl v(n); cin >> v;
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = i + 1; j < n; j++) {
			for(int k = j + 1; k < n; k++) {
				vl tmp = {v[i], v[j], v[k]};
				sort(all(tmp));
				set<ll> s(all(tmp));
				if(tmp[0] + tmp[1] > tmp[2] and s.size() == 3) {
					ans++;
					debug(i, j , k);
				}
			}
		}
	}
	cout << ans << endl;
}

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


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

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

Measured memory_bytes: 256