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

int h, w;
char map[100][100];
int ans;

bool safe(int x, int y){
    return (0 <= x && 0 <= y && x < h && y < w);
}

void solve(char c, int x, int y){
    map[x][y] = '?';
    if (map[x+1][y] == c && safe(x+1, y)) solve(c, x+1, y);
    if (map[x-1][y] == c && safe(x-1, y)) solve(c, x-1, y);
    if (map[x][y+1] == c && safe(x, y+1)) solve(c, x, y+1);
    if (map[x][y-1] == c && safe(x, y-1)) solve(c, x, y-1);
    return;
}

int main(){
    while (1){
	cin >> h >> w;
	if (h == 0 && w == 0) break;

	ans = 0;
	for (int i = 0; i < h; i++){
	    for (int j = 0; j < w; j++){
		cin >> map[i][j];
	    }
	}
	
	for (int i = 0; i < h; i++){
	    for (int j = 0; j < w; j++){
		if (map[i][j] != '?'){
		    ans++;
		    solve(map[i][j], i, j);
		}
	    }
	}

	cout << ans << endl;
    }
}

Measured memory_bytes: 0
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Name        : Codeforces.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define SZ(c) int(c.size())
#define ff first
#define ss second
#define INF INT32_MAX
#define _INF INT32_MIN
#define PQ priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
LL gcd(LL a,LL b)
{
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	El3zba;
	int n;
	cin>>n;
	vector<int>a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	vector<int>right(n+1,0),left(n+1,0);
	for(int i=0;i<n;i++)
	{
		left[i+1]=gcd(left[i],a[i]);
	}
	for(int i=n-1;i>=0;i--)
		right[i]=gcd(right[i+1],a[i]);
	LL ans=0;
	for(int i=0;i<n;i++)
	{
		int l=left[i];
		int r=right[i+1];
		ans=max((int)ans,(int)gcd(l,r));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1408
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  ll x,y;
  set<ll> st;
  cin >> x >> y;
  if(x==2||y==2){
    cout << "No\n";
  }else{
    st.insert(4);
    st.insert(6);
    st.insert(9);
    st.insert(11);
    bool b0 = st.find(x) == st.end();
    bool b1 = st.find(y) == st.end();
    if(!(b0^b1)) cout <<"Yes\n";
    else cout <<"No\n";
  }
}


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

int main(){
	int n, ans;
	char c;

	cin >> ans;
	while(1){
		cin >> c;
		if(c == '=') break;
		cin >> n;
		if(c == '+') ans += n;
		else if(c == '-') ans -= n;
		else if(c == '*') ans *= n;
		else if(c == '/') ans /= n;
	}

	cout << ans << endl;
}

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

// definitions
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#define mod1 998244353
#define mod 1000000007
#define MAX_CHAR 256
#define pi 3.1415926535897932384

using namespace std;
typedef vector<long long> vl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll INF=1e18;
// prevent collisions in unordered_map
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
typedef unordered_map <long long, long long, custom_hash> umap;

// cin and cout overloaded for vectors and sets
template <typename T> 
ostream& operator<<(ostream& os, vector<T>& v) 
{ 
    for (auto i:v) os << i << " "; 
    return os; 
} 
template <typename T>
istream &operator>>(istream &is, vector<T> &v) 
{
    ll n=v.size();
    rep(i,0,n){ ll a; cin >>a; v[i]=a;}
    return is;            
}
template <typename T> 
ostream& operator<<(ostream& os, set<T>& s) 
{ 
    for (auto i:s) os << i << " "; 
    return os; 
}

// standard functions
ll mystoi(string str)
{
    stringstream ss(str);
    ll ans=0;
    ss >> ans;

    return ans;
}

ll exp(ll x, ll ex) 
{
    ll ans = 1ll;
    while (ex > 0) 
    {
        if (ex & 1ll) ans = (ans * x);
        ex >>= 1ll;
        x = (x * x);
    }
    return ans;
}

bool sort_cond(const pair<ll,ll> &a, const pair <ll,ll> &b)
{
    return a.first < b.first;
}

// code beigns in main
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    ll lol;
    while(t--)
    {
        ld a,b,v,w;
        cin >> a >>v;
        cin >>b >>w;
        ld t;
        cin >> t;

        ld val;
        if(a>b)
        {
            val=(a-b)/(v-w);
        }
        else val=(b-a)/(v-w);

        if(val>0 && t>=val) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


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

int main(){
    int a, b, c, cnt = 0;
    cin >> a >> b >> c;
    for (int i=a; i<=b; i++) {
        if (c % i == 0) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
#define dpair pair<double,double>

template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}
template <typename Val>
void show_vec(vector<Val> *v){
  cout<<endl;
  rep(i,v->size()){
    cout<<v->at(i)<<" ";
  }
  cout<<endl;
}

template <typename Val,typename Number>
void count_vector(vector<Val>* A,vector<pair<Number,Val>>*R){
  sort(A->begin(),A->end());
  int count = 1;
  rep(i,A->size()){
    if(i<A->size()-1){
      if(A->at(i)==A->at(i+1))count++;
      else{
        R->emplace_back(count,A->at(i));
        count = 1;
      }
    }else{
      R->emplace_back(count,A->at(i));
    }
  }
}


struct Point{
  int x;
  int y;
};


//---------------------------------------------------------------
int main(){
  ll N;
  cin>>N;
  for(int A =-120;A<201;A++){
    for(int B =-120;B<201;B++){
      ll num = A*A*A*A*A-B*B*B*B*B;
      if(num==N){
        cout<<A<<" "<<B<<endl;
        return 0;
      }

    }
  }



}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,m,i,j,l[1000005],r[1000005],ans[1000005],p1,p2,a[1000005],sum,top,flag;
struct nyh{
	int x,y,z,id;
}o[5000005];
bool cmp(nyh u,nyh v){
	return u.x<v.x||u.x==v.x&&u.id<v.id;
}
void xtree(int u,int v,int w){
	int mid=(u+v>>1);
	if(u==v){
		a[w]+=p2;
		return;
	}
	if(p1<=mid){
		a[(w<<1)|1]+=p2;
		xtree(u,mid,w<<1);
	}
	else
		xtree(mid+1,v,(w<<1)|1);
}
void ytree(int u,int v,int w){
	int mid=(u+v>>1);
	sum+=a[w];
	if(u==v)
		return;
	if(p1<=mid) ytree(u,mid,w<<1);
	else ytree(mid+1,v,(w<<1)|1);
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	n=read();m=read();
	for(i=1;i<=n;i++){
		l[i]=read();r[i]=read();
		top++;
		o[top].x=1;
		o[top].y=r[i];
		o[top].z=1;
		top++;
		o[top].x=l[i]+1;
		o[top].y=r[i];
		o[top].z=-1;
	}
	
	for(i=1;i<=m;i++)
		ans[i]=n;
	flag=min(100,(int)sqrt(m));
	for(i=2;i<=flag;i++)
		for(j=1;j<=n;j++)
			if(r[j]/i==(l[j]-1)/i)
				ans[i]--;
	for(i=flag+1;i<=m;i++)
		for(j=0;j<m;j+=i){
			top++;
			o[top].x=j+1;
			o[top].id=i;
			if(j+i-1<=m)
				o[top].y=j+i-1;
			else{
				o[top].y=m;
				break;
			}
		}		
	sort(o+1,o+top+1,cmp);
	for(i=1;i<=top;i++){	
		if(o[i].z!=0){
			p1=o[i].y;
			p2=o[i].z;
			xtree(1,m,1);
		}
		else{
			p1=o[i].y;sum=0;
			ytree(1,m,1);
			ans[o[i].id]-=sum;
		}
	
	}
	for(i=1;i<=m;i++)
		pus(ans[i],2);
	return 0;
}

Measured memory_bytes: 35712
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from functools import lru_cache

L,A,B,MOD = map(int,read().split())

@lru_cache(None)
def F(r,n,MOD):
    # 1+r+...+r^{n-1} をダブリングで求める
    if n == 0:
        return 0
    q = n//2
    x = F(r,q,MOD)
    # 1+r^qをかける
    x *= 1 + pow(r,q,MOD); x %= MOD
    if n&1:
        x *= r; x += 1; x %= MOD
    return x

@lru_cache(None)
def G(r,n,MOD):
    # sum ir^i をダブリングで求める
    if n == 0:
        return 0
    q = n//2
    x = G(r,q,MOD)
    # 1+r^qをかける
    x *= 1 + pow(r,q,MOD); x %= MOD
    # q(r^q+...+r^{2q-1})を加える
    x += F(r,q,MOD) * pow(r,q,MOD) * q % MOD
    if n&1:
        x *= r; x += F(r,n,MOD); x -= 1; x %= MOD
    return x

S = 0
for d in range(1,20):
    # d桁の最初、最後、項数
    lower = 10**(d-1)
    upper = 10**d-1
    # lower <= A+nB <= upper
    nlower = (lower-A+B-1)//B
    nupper = (upper-A)//B
    if nlower < 0:
        nlower = 0
    if nupper >=L:
        nupper = L-1
    if nlower > nupper:
        continue
    items = nupper - nlower + 1
    r = (10**d) % MOD
    last = A+B*nupper
    x = last * F(r,items,MOD)
    x -= B * G(r,items,MOD)
    length = d*items
    S *= pow(10,length,MOD); S += x
    S %= MOD

print(S)



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  vector<int> l(n);

  rep(i, n) cin >> l[i];
  sort(l.rbegin(), l.rend());

  for (int i = 0; i < k; ++i) ans += l[i];

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
  int N;
  cin >> N;
  vector<int> a(N + 1);
  a[0] = 0;
  REP(i, N) cin >> a[i + 1];
  vector<int> B(N + 1);
  ll id = N + 1;
  ll num = 0;
  vector<int> hako(0);
  for (ll i = N; i / 2 > N; i--) {
    B[i] = a[i];
    id = i;
    num += B[i];
    if (B[i] == 1) hako.push_back(i);
  }
  for (ll i = id - 1; i >= 1; i--) {
    ll tmp = 0;
    for (ll j = 2; i * j <= N; j++) {
      tmp += B[i * j];
    }
    if (tmp % 2 == a[i]) {
      B[i] = 0;
    } else {
      B[i] = 1;
    }
    num += B[i];
    if (B[i] == 1) hako.push_back(i);
  }
  cout << num << endl;
  REP(i, hako.size()) {
    cout << hako[i] << " ";
    if (i == hako.size() - 1) cout << "\n";
  }
}

Measured memory_bytes: 5376
#include <algorithm>
#include <iostream>
#include <utility>
#include <unordered_map>
#include <vector>

using namespace std;

constexpr static int MOD = 1e9 + 7;
constexpr static int MAXN = 3e5;

int n, x, y;
int c[MAXN], w[MAXN];

vector <pair <int, int>> vals[MAXN];
vector <int> adj[MAXN];
int vis[MAXN];

int64_t inv[MAXN];

void add_edge(int u, int v) {
    adj[u].push_back(v);
    adj[v].push_back(u);
}

void dfs(int u, int c) {
    vis[u] = c;
    for (int v : adj[u])
        if (vis[v] == -1)
            dfs(v, c);
}

int main() {
    cin >> n >> x >> y;
    for (int i = 0; i < n; i++) {
        cin >> c[i] >> w[i];
        c[i]--;
        vals[c[i]].push_back({w[i], i});
    }
    // swap => same connected component
    vector <pair <int, int>> group_mins;
    for (int i = 0; i < n; i++) {
        sort(vals[i].begin(), vals[i].end());
        // edges within each color group
        for (int j = 1; j < vals[i].size(); j++)
            if (vals[i][0].first + vals[i][j].first <= x)
                add_edge(vals[i][0].second, vals[i][j].second);
        if (vals[i].size() > 0)
            group_mins.push_back(vals[i][0]);
    }
    sort(group_mins.begin(), group_mins.end());
    for (int i = 0; i < n; i++) {
        // edges across color groups
        if (c[group_mins[0].second] == c[i]) {
            if (group_mins.size() > 1 && group_mins[1].first + w[i] <= y)
                add_edge(group_mins[1].second, i);
        }
        else {
            if (group_mins[0].first + w[i] <= y)
                add_edge(group_mins[0].second, i);
        }
    }

    int ngroups = 0;
    for (int i = 0; i < n; i++)
        vis[i] = -1;
    for (int i = 0; i < n; i++)
        if (vis[i] == -1)
            dfs(i, ngroups++);

    // MOD = i*q+r, i*q = -r, -q*r^{-1} = i^{-1}
    inv[1] = 1;
    for (int i = 2; i <= n; i++)
        inv[i] = (MOD - MOD / i * inv[MOD % i] % MOD) % MOD;

    unordered_map <int64_t, int> cnt;
    vector <int> group_cnt(ngroups);
    int64_t res = 1;
    for (int i = 0; i < n; i++) {
        res = res * ++group_cnt[vis[i]] % MOD;
        int64_t key = (1LL << 30) * vis[i] + c[i];
        res = res * inv[++cnt[key]] % MOD;
    }
    cout << res << endl;
}


Measured memory_bytes: 37492
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000000

int main() {
    int N, T, A; cin >> N >> T >> A;
    int ans = 0, min;
    int temp;
    vector<int> high(N);
    for (int i = 0; i < N; i++) {
        cin >> high.at(i);
        temp = 1000 * T - high.at(i) * 6;
        if (i == 0) min = abs(temp - 1000*A);
        else if (abs(temp - 1000*A) < min) {;
            min = abs(temp - 1000*A);
            ans = i;
        }
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
 template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  int n,ans=10000000,x=0;
  cin>>n;
  int num[n];
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  sort(num,num+n);
  for(int i=num[0];i<=num[n-1];i++){
    for(int j=0;j<n;j++){
      x+=pow(abs(i-num[j]),2);
    }
    ans=min(ans,x);
    x=0;
  }
  cout<<ans<<endl;
}

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

int main() {
    unsigned long N, K;
    string S;
    cin >> N >> S >> K;
    auto c = S[K - 1];
    string T;
    transform(S.begin(), S.end(), back_inserter(T), [&c](auto a){return a == c ? c : '*';});
    cout << T << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;

int main(void){

    int N,M; cin>>N>>M;
    vector<int> A(N,0);
    int sum=0;
    for (int i = 0; i < N; ++i) {
        cin>>A[i];
        sum+=A[i];
    }
    int cnt=0;
    for (int i = 0; i < N; ++i) {
        if(A[i]*4*M < sum){
        }else {
            cnt++;
        }
    }

    if(cnt>=M) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

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

#define Int long long int
#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()

    int a[3],b[3];
    int c[3][3];

int main(){
    REP(i,3)REP(j,3){
        cin >> c[i][j];
    }

    REP(i,3)b[i]=c[0][i];

    a[1]=c[1][0]-b[0];
    a[2]=c[2][0]-b[0];

    bool flg=true;
    REP(i,3)REP(j,3){
        if(a[i]+b[j]!=c[i][j])flg=false;
    }
    if(flg)YES;
    else NO;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

long long GCD(long long x, long long y) {
    if (x % y == 0) return y;
    else return GCD(y, x % y);
}

int main() {
    long long A, B;
    cin >> A >> B;
    
    long long G = GCD(A, B);
    set<long long> prime;
    long long i = 2;
    while (i * i <= G) {
        if (G % i == 0) {
            G /= i;
            prime.insert(i);
        } else {
            ++i;
        }
    }
    if (G != 1) prime.insert(G);
    
    cout << prime.size() + 1 << endl;
    return 0;
}


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


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

#define INF bit(60)

#define DBGP 1


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

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

typedef pair<li, li> PI;

li n, m, k;
li a[200200];
li b[200200];

li sb[200200];

int main() {
    cin >> n >> m >> k;
    rin{
        cin >> a[i];
    }
    rep(i, m) {
        cin >> b[i];
    }
    li res = 0;
    sb[0] = 0;
    rep(i, m) {
        sb[i + 1] = sb[i] + b[i];
    }

    li sa = 0;
    rep(i, n + 1) {
        li rest = k - sa;
        if (rest < 0) {
            break;
        }
        auto it = upper_bound(sb, sb + m + 1, rest);
        li nb = max(0ll, (li)(it - sb) - 1);
        res = max(res, i + nb);

        sa += a[i];
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 8308
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

use std::collections::HashSet;
fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>();
    if a.iter().all(|&i| i == 0) {
        yn(true);
        return;
    }

    let hs = a.iter().map(|i| *i).collect::<HashSet<i64>>();
    let count = hs.len();
    if !(count == 2 || count == 3) {
        yn(false);
        return;
    }
    if count == 3 {
        let v = hs.iter().map(|i| *i).collect::<Vec<i64>>();
        if v[0] ^ v[1] != v[2] || v[1] ^ v[2] != v[0] || v[2] ^ v[0] != v[1] {
            yn(false);
            return;
        }
        let mut vc = [0u32; 3];
        for i in 0..n {
            if a[i] == v[0] {
                vc[0] += 1;
            } else if a[i] == v[1] {
                vc[1] += 1;
            } else {
                vc[2] += 1;
            }
        }
        if vc[0] == vc[1] && vc[1] == vc[2] {
            yn(true);
            return;
        } else {
            yn(false);
            return;
        }
    } else {
        let mut v = hs.iter().map(|i| *i).collect::<Vec<i64>>();
        v.sort();
        if v[0] != 0 {
            yn(false);
            return;
        }
        let mut vc = [0u32; 2];
        for i in 0..n {
            if a[i] == v[0] {
                vc[0] += 1;
            } else {
                vc[1] += 1;
            }
        }
        if vc[0] * 2 == vc[1] {
            yn(true);
            return;
        } else {
            yn(false);
            return;
        }
    }
}


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


//      DEEP


using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fwd(i,a,n) for(int i=a;i<=n;i++)
#define bak(i,a,n) for(int i=a;i>=n;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define lop '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll mod1=998244353;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ull gcd(ull x,ull y){
   if(y==0)return x;
   return gcd(y,x%y);
}
//                                         EXTENDED_EUCLID
vector<ll>extended_Euclid(ll a,ll b){
    vector<ll>v(3);
    if(b==0){
        v[0]=a;v[1]=1;v[2]=0;
        return v;
    }
    else{
         vector<ll>v1 = extended_Euclid(b,a%b);    //recursive call
         v[0]=v1[0];
         v[1]=v1[2];
         v[2]=v1[1]-(a/b)*v1[2];
         return v;
    }
}
                                          // DFS ( number of connected components  )
//vector<vector<ll> >adj(200001);
//bool visited[200001];
/*ll dfs(int x,int c){                         // x - > node      c - > number of edges in the component
    if(visited[x])return c;
    else{
        visited[x]=true;
        int y=c;
        for(int i=0;i<adj[x].size();i++){
            if(!visited[adj[x][i]]){
                c+=1;
                int d=dfs(adj[x][i],y);
                c+=d;
            }
        }
        return c;
    }
}
*/
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/
                               // Binary Search
/*
ll bin_search(ll y){
  while(lo<hi){
    x=lo+(hi-lo)/2;
    if(condition){
            .....
    }
    else{
                  // increase lo or decrease hi suitably
            }
   }
}
*/

int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        ll n;
    cin>>n;
    cout<<n*n<<endl;
    }
    
}
/* Be careful about integer ranges;
   Check the corner cases before submitting.
*/





Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod=998244353;
const int N=3e5+5;
const int inf=1e9+7;
int da[N];

int main()
{
    /*
    int n,p,q,s,x;
    scanf("%d%d%d%d",&n,&p,&q,&s);
    for(int i=0; i<p; i++)
        scanf("%d",&da[i]);
        */
        int n,m;
        cin>>n>>m;
        cout<<n*(n-1)/2+m*(m-1)/2;

    return 0;
}


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

using namespace std;
#define int long long
const int N = 1e5 + 5, M = 3, inf = 1e15;
int dp[N][M], a[N];
char op[N];

int Sign(int x) {
    if (x % 2) return -1;
    return 1;
}

int32_t main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.tie(0);
    for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) dp[i][j] = -inf;
    int n; cin >> n >> a[0];
    for (int i = 1; i < n; i++) cin >> op[i] >> a[i];
    dp[0][0] = a[0];
    for (int i = 1; i < n; i++) for (int j = M - 1; j >= 0; j--) {
        if (op[i] == '+') dp[i][j] = dp[i - 1][j] + a[i] * Sign(j);
        else if (j) dp[i][j] = dp[i - 1][j - 1] + a[i] * Sign(j);
        if (j + 1 < M) dp[i][j] = max(dp[i][j], dp[i][j + 1]);
    }
    cout << dp[n-1][0] << "\n";
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

typedef
tree<
	pair<int, int>,
	null_type,
	less<pair<int, int>>,
	rb_tree_tag,
	tree_order_statistics_node_update>
ordered_set;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

struct tr{
    tr* nxt[26];
    ll c=0;
};

ll n,k;
        
void insert(tr* p, string s)
{
    tr *cur=p;
    repf(i,0,s.length())
    {
        if(!cur->nxt[s[i]-'A']) 
        {
            cur->nxt[s[i]-'A']=new tr();
        }
        cur=cur->nxt[s[i]-'A'];
        cur->c++;
    }
}

ll f(tr *p)
{
    if(!p) return 0;
    ll ans=p->c/k;
    repf(i,0,26)
    {
        if(p->nxt[i]) ans+=f(p->nxt[i]);
    }
    return ans;
}

bool ispalin(string s)
{
    repf(i,0,s.length()/2)
    {
        if(s[i]!=s[s.length()-i-1]) return false;
    }
    return true;
}

int main()
{
    IOS;
    ld l;
    cin>>l;
    l/=3;
    ld ans=l*l*l;
    cout<<fixed<<setprecision(10)<<ans<<endl;
}   

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

import           Control.Monad
import           Control.Monad.Trans.State
import qualified Data.ByteString.Unsafe    as B
import qualified Data.ByteString.Char8     as C8
import           Data.Bits
import           Data.Char
import           Data.List
import           Data.Maybe

main :: IO ()
main = do
  [n] <- readInts
  putStrLn $ solve n

solve :: Int -> String
solve = pretty . cmp . show

cmp :: String -> Bool
cmp cs = (cs !! 0) == cs !! 2

pretty :: Bool -> String
pretty b = if b then "Yes" else "No"

-- utils
type Pair = (Int, Int)

readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

readPair :: IO Pair
readPair = head . unfoldr readT <$> C8.getLine
  where
    readT = runStateT $
      (,) <$> StateT (C8.readInt . C8.dropWhile isSpace)
          <*> StateT (C8.readInt . B.unsafeTail)

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a,b,c,d,n,m,x[100001],y[100001],z,h,w,k,sum,mi=inf,ma=-inf,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;


int main(void){
    cin>>n;
    VL a(n),b(n),c(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)cin>>c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));
    rep(i,n){
        l=lower_bound(all(a), b[i])-a.begin();
        r=c.end()-lower_bound(all(c), b[i]+1);
        //d(i)d(l)d(r)
        ans+=l*r;
    }
    p(ans);
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
char s[100];
int main(){
	int ans=0;scanf("%*d%s",s);
	for(int i=0;s[i];i++)if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
	printf("%d",ans);
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll A,B;
vector<ll> V;
ll mat[10][10];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	V.push_back(0);
	V.push_back(A);
	V.push_back(-A);
	V.push_back(B);
	V.push_back(-B);
	sort(ALL(V));
	
	FOR(i,5) FOR(j,5) mat[i][j]=(i!=j)*1LL<<60;
	FOR(y,5) FOR(x,5) {
		if(V[y]>V[x]) mat[x][y]=min(mat[x][y],V[y]-V[x]);
		if(V[y]==-V[x]) mat[x][y]=min(mat[x][y],1LL);
	}
	
	FOR(k,5) FOR(i,5) FOR(j,5) mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j]);
	
	FOR(i,5) FOR(j,5) if(V[i]==A && V[j]==B) {
		cout<<mat[i][j]<<endl;
		return;
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main { //atcoder ABC128D -

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int H = Integer.parseInt(st.nextToken());
		int W = Integer.parseInt(st.nextToken());
		char[][] map = new char[H][W];
		for(int i = 0; i < H; i++){
			map[i] = br.readLine().toCharArray();
		}
		int[][] vals = new int[H][W];
		for(int i = 0; i < H; i++){
			int last = -1, tot = 0;
			for(int j = 0; j < W; j++){
				if(map[i][j] == '#'){
					for(int k = last+1; k < j; k++){
						vals[i][k] = tot;
					}
					last = j; tot = 0;
				}
				else{
					tot++;
				}
			}
			for(int k = last+1; k < W; k++){
				vals[i][k] = tot;
			}
		}
		for(int j = 0; j < W; j++){
			int last = -1, tot = 0;
			for(int i = 0; i < H; i++){
				if(map[i][j] == '#'){
					for(int k = last+1; k < i; k++){
						vals[k][j] += tot;
					}
					last = i; tot = 0;
				}
				else{
					tot++;
				}
			}
			for(int k = last+1; k < H; k++){
				vals[k][j] += tot;
			}
		}
		int max = 0;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				max = Integer.max(max, vals[i][j]-1);
			}
		}
		System.out.println(max);
	}
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int di2[] = {1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1};
const int dj2[] = {1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

int main(){
  int n;
  ll h;
  cin >> n >> h;
  vector<ll> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  ll max_a = *max_element(ALL(a));

  sort(RALL(b));

  ll ans = 0;
  rep(i, n) {
    if(b[i] > max_a) {
      ++ans;
      h -= b[i];
    }
    if(h <= 0) {
      cout << ans << endl;
      return 0;
    }
  }

  ans += h/max_a;
  if(h%max_a != 0) ++ans;
  cout << ans << endl;
}

Measured memory_bytes: 4776
#!/usr/bin/env python3
import sys
from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
from collections import defaultdict          # subclass of dict. defaultdict(facroty)
from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
from heapq import heapify, heappush, heappop # heapify(L) changes list in-place in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(nlgk)=O(n).
from itertools import accumulate             # accumulate(iter[, f])
from functools import reduce                 # reduce(f, iter[, init])
from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
from fractions import gcd                    # for Python3.4.3


def main():
    input = sys.stdin.readline    # 改行文字が残ることに注意
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())
    
    
    a, b = mi()
    a, b = max(a, b), min(a, b)
    print("Yay!") if 2*a <= 16 else print(":(")

if __name__ == "__main__":
    main()

Measured memory_bytes: 5132
#include<bits/stdc++.h>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define MOD 1000000007
using namespace std;
vector<int> adj[200005];
bool visited[200005];
typedef long long ll;
vector<int> q;
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int gcd(int a, int b){
	if(b==0)
		return a;
	a=a%b;
	gcd(b,a);
}
void dfs(int i){
   visited[i]=true;
 //cerr<<i<<" ";
q.push_back(i);
   for(auto v:adj[i]){
   	 if(!visited[v])
   	 	dfs(v);
   }


}

int main()
{  
  FAST();
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

ll n,m,a,b; cin>>n>>m;
int  ans=0;
memset(visited,false,sizeof(visited));  //REP(i,1,n+1) cout<<visited[i]<<" ";
while(m--){
	cin>>a>>b;
	adj[a].push_back(b);
	adj[b].push_back(a);
}

REP(i,1,n+1){
if(!visited[i]){
  q.clear();
  dfs(i);	
  if(q.size()>0){
      int t=q.size();
       ans=max(ans,t);}
}
}

cout<<ans;
	return 0;

}

Measured memory_bytes: 24624
def create_mapper():
	# 1 -> [0,1,2]
	# 2 -> [1,2,3]
	# 3 -> [2,3,4]
	# 4 -> [3,4,5]
	# ...
	# 8 -> [7,8,9]
	# 9 -> [8,9]
	# 0 -> [0,1]
	res = [[]]*10
	for i in range(0, 10):
		if 1 <= i <= 8:
			res[i] = [i-1, i, i+1]
		elif i == 9:
			res[i] = [8, 9]
		elif i == 0:
			res[i] = [0, 1]
	return res
mapper = create_mapper()

def map_list(lst, level):
	res = lst[::1]
	while not all([len(elem) == level for elem in res]):
		new_res = []
		for elem in res:
			if len(elem) < level:
				tmp = []
				for digit in mapper[int(elem[-1])]:
					tmp.append(elem + str(digit))
				new_res += tmp
				# print(tmp)
		res = new_res[::1]
		# print(res)
		# break
	return res

def create_lun():
	res = [i for i in range(1, 10)]
	# max_num = lunlun digit 100000 == 3234566667 <- constraint
	for depth in range(2, 11): # 2 digit to 10 digit
		tmp = [str(i) for i in range(1, 10)] # start with depth = 2
		tmp = map_list(tmp, depth)
		tmp = sorted(list(map(int, tmp)))
		res += tmp
		# print(tmp)
	# print(res[100000-1] == 3234566667)
	return res
table = create_lun()
k = int(input())
print(table[k-1])

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

using namespace std;

const int MAX_N = 200000;
int n, m;
string s;

vector<int> g[2*MAX_N];
bool vis[2*MAX_N];
bool path[2*MAX_N];

int main()
{
  cin >> n >> m >> s;
  int u, v;
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    if (s[u-1] == s[v-1]) {
      g[u-1].push_back(n+v-1);
      if (u != v)
        g[v-1].push_back(n+u-1);
    }
    if (s[u-1] != s[v-1]) {
      g[n+u-1].push_back(v-1);
      g[n+v-1].push_back(u-1);
    }
  }

  fill_n(vis, 2*n, false);
  for (int i = 0; i < 2*n; i++) {
    if (vis[i]) continue;
    stack<pair<int,int> > st;
    st.push(make_pair(i,0));
    vis[i] = true;
    path[i] = true;
    while (!st.empty()) {
      auto p = st.top(); st.pop();
      if (p.second < g[p.first].size()) {
        int c = g[p.first][p.second];
        st.push(make_pair(p.first, p.second+1));
        if (path[c]) {
          cout << "Yes" << endl;
          return 0;
        }
        if (vis[c]) continue;
        vis[c] = true;
        path[c] = true;
        st.push(make_pair(c,0));
      } else {
        path[p.first] = false;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 20716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string S;
  cin >> S;
  ll K;
  cin >> K;
  ll N[S.size()];
  for (int i = 0; i < S.size(); i++) {
    N[i] = (123 - S[i]) % 26;
  }
  for (int i = 0; i < S.size(); i++) {
    if (N[i] <= K) {
      S[i] = 'a';
      K -= N[i];
    }
  }
  K = K % 26;
  S[S.size() - 1] += K;
  cout << S << endl;
  return 0;
}

Measured memory_bytes: 1408
fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = longList().sorted()
    val s = a.last()

    var max = 0L
    var index = 0
    a.forEachIndexed { i, r ->
        val nr = s - r
        if (max < r * nr) {
            index = i
            max = r * nr
        }
    }
    println("$s ${a[index]}")
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	int sum = 0;
	cin >> N;
	vector<int> A(N);

	rep(i, 0, N)
	{
		cin >> A[i];
		sum ^= A[i];
	}

	rep(i, 0, N)
	{
		cout << (A[i] ^ sum) << endl;
	}

	return 0;
}

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

using namespace std;

int main(){
  int n, m;
  while(cin >> n >> m, n){
    vector< pair<int, int> > vp(m);
    for(int i=0;i<m;i++) vp[i] = make_pair(0, i+1);
    for(int i=0;i<n;i++){
       for(int j=0;j<m;j++){
         int t; cin >> t;
         vp[j].first -= t;
       }
    }
    sort(vp.begin(), vp.end());
    cout << vp[0].second;
    for(int i=1;i<m;i++) cout << " " << vp[i].second;
    cout << endl;
  }
}

Measured memory_bytes: 908
s=list(map(int,input().split()))
ans=0
ad=1
mod=10**9+7
def comb(x):
  a=b=1
  for i in range(x):
    a=a*(s[0]-i)%mod
    b=b*(i+1)%mod
  return a*pow(b,mod-2,mod)%mod
ans=pow(2,s[0],mod)
print((ans-1-comb(s[1])-comb(s[2]))%mod)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,K;
	cin >> N >> K;
	for(int i=1;i<=N;i+=2){
		K--;
	}
	if(K<=0){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
package main

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

func mul(x int) int {
	ans := 1
	for i := 1; i <= 2; i++ {
		ans *= i
	}
	return ans
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	N, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	scanner.Scan()
	M, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	// 組み合わせ問題 Nの中から2つのパターンとMの中から2つのパターン
	answer := ((N * (N - 1)) / mul(N)) + ((M * (M - 1)) / mul(M))

	fmt.Println(answer)
}


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

using namespace std;

int main() {
	string s;
	cin >> s;
	long even_0 = 0;
	long odd_0 = 0;
	for (size_t idx = 0; idx < s.size(); ++idx) {
		if (idx % 2 == 0 and s[idx] == '0') {
			++even_0;
		} else if (idx % 2 != 0 and s[idx] == '0') {
			++odd_0;
		}
	}
	long sum = 0;
	if (even_0 > odd_0) {
		for (size_t idx = 0; idx < s.size(); ++idx) {
			if (idx % 2 == 0 and s[idx] == '1') {
				++sum;
			} else if (idx % 2 != 0 and s[idx] == '0') {
				++sum;
			}
		}
	} else {
		for (size_t idx = 0; idx < s.size(); ++idx) {
			if (idx % 2 == 0 and s[idx] == '0') {
				++sum;
			} else if (idx % 2 != 0 and s[idx] == '1') {
				++sum;
			}
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 512
import sys
N=int(input())
a=[]

for i in range(N):
    a.append(int(input()))

a.sort()
ans=0
ans2=0
if N%2==0:
    ans=2*sum(a[N//2:N])-a[N//2]-2*sum(a[0:N//2])+a[N//2-1]
    print(ans)
else:
    ans=2*sum(a[N//2+1:N])-2*sum(a[0:N//2+1])+a[N//2]+a[N//2-1]
    ans2=2*sum(a[N//2:N])-a[N//2]-a[N//2+1]-2*sum(a[0:N//2])
    print(max(ans,ans2))

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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

ll N, Q;
string S;
vector<ll> acc;

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> N >> Q >> S;
  acc.resize(N);
  acc.at(0) = 0;
  ll cnt = 0;
  for (ll i = 0; i < N - 1; i++) {
    if (S.at(i) == 'A' && S.at(i+1) == 'C') {
      cnt++;
    }
    acc.at(i+1) = cnt;
  }
  for (ll i = 0; i < Q; i++) {
    ll l, r;
    cin >> l;
    cin >> r;
    cout << acc.at(r-1) - acc.at(l-1) << "\n";
  }
  return 0;
}


Measured memory_bytes: 1872
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

ll n,a,b;
vector<ll> h;

bool ch(ll x){
  ll cnt = 0;
  rep(i,n){
    ll at = h[i] - b * x;
    if(at > 0) cnt += (at + a - 1) / a;
    if(cnt > x) return false;
  }
  return true;
}

int main(){
  cin >> n >> a >> b;
  a -= b;
  
  rep(i,n){
    ll tmp; cin >> tmp;
    h.push_back(tmp);
  }
  
  sort(h.begin(),h.end(),greater<ll>());
  
  ll l = 0, r = 1000000005, now = 0;
  while(r > l){
    now = (r + l) / 2;
    if(r - l <= 1){
      if(ch(l)) now = l;
      else if(ch(r)) now = r;
      else now = r + 1;
      break;
    }
    if(ch(now)) r = now;
    else l = now;
  }
  
  cout << now << endl;
    
  return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int n,d,x;
    cin>>n>>d>>x;
    int b=0;
    vector<int> a(n);
    REP(i,n){
        cin>>a[i];
    }
    REP(i,n){
     b+=(d-1)/a[i]+1;
    }
    cout<<b+x;
    return 0;
}


Measured memory_bytes: 256