akhauriyash/Code-Regression huggingface dataset:
import collections
s = input()
u = collections.deque([0])
for i in range(len(s)):
    u.append((u[i]+int(s[-i-1])*10**(i%224))%2019)
u2 = collections.Counter(u)
sum = 0
for i in u2.values():
    sum += i*(i-1)/2
print(int(sum))

Measured memory_bytes: 85380
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T>
struct BIT{
    int n;
    vector<T> d;
    BIT(int n = 0):n(n), d(n+1){}
    void add(int i, T x = 1){
        for(i++; i <= n; i += i&-i){
            d[i] += x;
        }
    }
    T sum(int i){
        T x = 0;
        for(i++; i; i -= i&-i){
            x += d[i];
        }
        return x;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<P> p;
    rep(i,n){
        ll x, h;
        cin >> x >> h;
        p.emplace_back(x, h);
    }
    sort(p.begin(), p.end());
    BIT<ll> bit(n+1);
    ll ans = 0;
    rep(i,n){
        ll x = p[i].first;
        ll h = p[i].second;
        h -= bit.sum(i);
        if(h <= 0) continue;
        ll num = (h + a - 1) / a;
        ans += num;
        ll damage = num * a;
        bit.add(i, damage);
        int rx = min(x+d*2, 1000000007LL);
        int range = upper_bound(p.begin(), p.end(), P(rx+1, -1)) - p.begin();
        bit.add(range, -damage);   
    }
    cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
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;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

template<class T> void dprint(T s){
  if(DEBUG){ cout << s << "\n"; }
}


int main(int argc,char* argv[]){
  if(argc>1 && argv[1][0]=='D'){ DEBUG=1;}
  dprint("start");

  // 4hnw = (nw+hw+hn)N
  // 4hn w = (n+h)N w + hnN
  // (4hn - (n+H)N ) w = hnN
  // w = hnN / ( 4hn - (n+H)N )

  ll N; cin>>N;
  for(ll h=1;h<=3500;++h){
    for(ll n=1;n<=3500;++n){
      ll y = h*n*N;
      ll x = 4*h*n-(n+h)*N;
      if(x>0 && y%x==0){
        ll w = y/x;
        if(w>3500){continue;}
        printf("%d %d %d\n",h,n,w);
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb(n) push_back(n)
const int N=1e5+5;
const ll M=1e9+7;
const ll inf=1e18;

vector<int> g[N];
ll val[N][2]; // 0 for white and 1 for black

void dfs(int node,int par)
{
	ll ujjar = 1,kariya=1;
	for(int it:g[node])
	{

		if(it!=par)
		{
			dfs(it,node);			

			kariya = (kariya*val[it][0])%M;

			ujjar = (ujjar*(val[it][0]+val[it][1]))%M;
		}
	}
	
	val[node][1]=kariya;
	val[node][0]=ujjar;



}
int main()
{
	var(n);
	for(int i=1;i<n;i++)
	{
		var(x);var(y);
		g[x].pb(y);
		g[y].pb(x);
	}
	dfs(1,0);
	
	lpri((val[1][0]+val[1][1])%M);
}

Measured memory_bytes: 14208
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define maxn 200005
const ll inf=1e9+7;
#define pb push_back
#define PI 3.14159265
#define watch(x) cerr << (#x) << " is " << (x) << endl;
void solve();
void sieve();
int main()
{
	//sieve();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<fixed;
	cout<<setprecision(10);
	
	ll t=1;
	//cin>>t;
	
	while(t--)
	solve();
	return 0;
}
ll pr[1001];
vector<ll> prime;
void sieve()
{
	pr[0]=-1;
	pr[1]=-1;
	ll i,j;
	for(i=2;i<1001;i++)
	{
		if(pr[i]!=-1)
		{
			pr[i]=1;
			for(j=2;j<1001/i+1;j++)
			{
				if(i*j<1001)
				pr[i*j]=-1;
			}
		}
	}
	for(i=2;i<1001;i++)
	{
		if(pr[i]==1)
		prime.pb(i);
	}
}
		
bool pal(string s)
{
	string t=s;
	reverse(s.begin(),s.end());
	return (t==s);
}
ll countdig(ll x)
{
	ll c=0;
	if(x==0)
	return 1;
	
	while(x!=0)
	{
		c++;
		x/=10;
	}
	return c;
}
bool isprime(ll x)
{
	bool flag=true;
	for(ll i=2;i<=sqrt(x)+1;i++)
	{
		if(x%i==0)
		{
			flag=false;
			break;
		}
	}
	if(x==1)
	flag=false;
	
	return flag;
}
void swap(ll& a,ll& b)
{
	ll t=a;
	a=b;
	b=t;
}
class matrix 
{
	public:
	vector<vector<ll>> v;
	ll row;
	ll col;
	matrix(vector<vector<ll>> mat)
	{
		v.assign(mat.begin(),mat.end());
		row=mat.size();
		col=mat[0].size();
	}
	vector<vector<ll>> I(ll n)
	{
		vector<vector<ll>> mat(n,vector<ll>(n,0));
		for(ll i=0;i<n;i++)
		mat[i][i]=1;
		return mat;
	}
	matrix operator * (matrix& u)
	{
		ll r=this->row;
		ll c=u.col;
		assert(this->col==u.row);
		vector<vector<ll>> res(r,vector<ll>(c,0));
		for(ll i=0;i<r;i++)
		{
			for(ll j=0;j<c;j++)
			{
				for(ll k=0;k<this->col;k++)
				res[i][j]+=v[i][k]*u.v[k][j];
			}
		}
		return matrix(res);
	}
	matrix fastexpo(matrix m,ll p)
	{
		assert(m.row==m.col);
		matrix res(I(m.row));
		
		while(p)
		{
			if(p&1)
			res=res*m;
			m=m*m;
			p=p>>1;
		}
		return res;
	}
};
bool comp(ll a,ll b)
{
	return a>b;
}
struct route
{
	ll fir;
	ll tim;
};
void solve()
{
	string s,t;
	cin>>s>>t;
	ll diff=0;
	ll n=s.length();
	
	for(ll i=0;i<n;i++)
	{
		if(s[i]!=t[i])
		diff++;
	}
	cout<<diff;
}
		

	
	
	
	
	
	


Measured memory_bytes: 3884
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

const ll mod = 998244353LL;
ll red[4005], blue[4005], dp[4005][4005];

int main() {
    string s;
    cin >> s;
    int len = s.size();
    for (int i = 0; i < len; i++) {
        red[i+1] = red[i] + 2 - (s[i] - '0');
        blue[i+1] = blue[i] + (s[i] - '0');
    }

    dp[0][0] = 1;
    for (int i = 1; i <= 2 * len; i++) {
        dp[i][0] = dp[i-1][0] * (blue[min(len, i)] >= i);
        for (int j = 1; j <= i; j++) {
            // 合計i個並べたときに、赤をj個を使っている場合の数
            dp[i][j] = (dp[i-1][j] * (blue[min(len, i)] >= i-j) + dp[i-1][j-1] * (red[min(len, i)] >= j)) % mod;
        }
    }

    cout << dp[2*len][red[len]] << "\n";
    return 0;
}

Measured memory_bytes: 123776
#include<bits/stdc++.h>
#define LiangJiaJun main
using namespace std;
long long L[104];
int n;
int LiangJiaJun(){
    scanf("%d",&n);
    L[0]=2;L[1]=1;
    for(int i=2;i<=n;i++)L[i]=L[i-1]+L[i-2];
    cout<<L[n]<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e8;
ll mod=1e9+7;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pi acos(-1)
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SIZE 5000 + 1

ll expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}

void solve()
{
  ll n,m;
  cin>>n>>m;
  vector<ll> a(n);
  ll sum=0,co=0;
  for(int i=0;i<n;i++){cin>>a[i];sum+=a[i];}
  for(int i=0;i<n;i++)
  {

      if(sum<=(a[i]*4*m))
      {
          co++;
      }
  }
  if(co>=m)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

}

int main()
{
  boost;
  ll t=1;
  //cin>>t;
  //sieve();
  //int ca=0;
  while(t--)
  {
     // ca++;
     // cout<<"Case #"<<ca<<":"<<" ";
      solve();
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#define NMAX 3005
#define MMAX 3005
#define mod 1000000007
#define PIE 3.14159265358979
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
typedef long long int LL;

int N,M;
string S;
int l_[MMAX],r_[MMAX];
vector<int> sum;

LL mpow(LL a,LL n){
    LL ans = 1;
    while(n>0){
        if(n&1){ans=(ans*a)%mod;}
        a=(a*a)%mod;
        n>>=1;
    }
    return ans;
}

LL fact[NMAX+1];
LL factinv[NMAX+1];

LL comb(LL a,LL b){
    LL ret = (fact[a]*factinv[b])%mod;
    ret = (ret*factinv[a-b])%mod;
    return ret;
}

LL dfs_[MMAX][NMAX];

void init(){
    fact[0]=1;
    rep(i,NMAX){
        fact[i+1]=fact[i]*(i+1);
        fact[i+1]%=mod;
    }
    rep(i,NMAX+1){
        factinv[i]=mpow(fact[i],mod-2);
    }
    rep(i,M+1){
        rep(j,N+1){
            dfs_[i][j]=-1;
        }
    }
}

LL dfs(int step,int czero_){
    int czero=czero_;
    if(dfs_[step][czero_]>=0)return dfs_[step][czero_];
    if(step==M){
        dfs_[M][czero_]=1;
        return dfs_[M][czero_];
    }
    int rp=0,ln=N+1;
    int l=l_[step];
    int r=r_[step];
    if(step>0){
        rp=r_[step-1];
    }
    if(step<M-1){
        ln=l_[step+1];
    }
    czero+=sum[r]-sum[max(l,rp)];
    if(ln>=r){
        dfs_[step][czero_]=(comb(r-l,czero)*dfs(step+1,0))%mod;
        return dfs_[step][czero_];
    }
    LL ans = 0;
    int nczeromax=min(r-ln,czero);
    for(int nczero = max(0,czero-(ln-l));nczero<=nczeromax;nczero++){
        ans += comb(ln-l,czero-nczero)*dfs(step+1,nczero);
        ans %= mod;
    }
    dfs_[step][czero_]=ans;
    return ans;
}

int main(){
    cin>>N>>M;
    cin>>S;
    sum.push_back(0);
    rep(i,N){
        sum.push_back(sum[i]+('1'-S[i]));
    }
    init();
    int now = 0;
    int M_=M;
    rep(i,M_){
        cin>>l_[now]>>r_[now];
        l_[now]--;
        if(i==0){now++;}
        else if(l_[now]==l_[now-1]){
            M--;
            r_[now-1]=max(r_[now],r_[now-1]);
        }else if(r_[now]<=r_[now-1]){
            M--;
        }else{now++;}
    }
    cout<<dfs(0,0)<<endl;
//    rep(i,M+1){
//        rep(j,N+1){
//            printf("%4lld",dfs_[i][j]);
//        }
//        cout<<endl;
//    }
}

    


Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

// d[u][v]は辺e = (u, v)のコスト（存在しない場合はINF、ただしd[i][i] = 0とする。）
// Vは頂点数
void warshall_floyd(vector<vector<int>> &d, int V)
{
    for (int k = 0; k < V; k++)
    {
        for (int i = 0; i < V; i++)
        {
            for (int j = 0; j < V; j++)
            {
                chmin(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<vector<int>> c(10, vector<int>(10, INF));
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cin >> c[i][j];
        }
    }
    warshall_floyd(c, 10);
    int ans = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            int a;
            cin >> a;
            if (a == -1)
            {
                continue;
            }
            ans += c[a][1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;
bool sortBYsec(pii &a,pii &b){
    return a.s>b.s;
}
void solve(){
    string s;
    cin>>s;
    loop(sz(s),i,0){
        if(s[i]=='1')
            s[i]='9';
        else if(s[i]=='9')
            s[i]='1';
    }
    cout<<s<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3588
import numpy as np
N, M = map(int, input().split())
l = np.zeros((N, 2), dtype = int)
for i in range(M):
    p, S = map(str, input().split())
    if S == 'AC':
        l[int(p) - 1, 0] = 1
    elif S =='WA' and l[int(p) - 1, 0] == 1:
        continue
    else:
        l[int(p) - 1, 1] += 1
print(np.sum(l[:, 0]), np.sum(l[l[:, 0] == 1, 1]))

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;	
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

const ll INF = 1e15;
vector<ll> scores[3];
ll n;
vector<int> input;
ll th[3];

int process(int i, int id1, int id2) {
	ll dist1 = std::lower_bound(scores[id1].begin() + i, scores[id1].end(), th[id1]) - (scores[id1].begin() + i);
	ll dist2 = std::lower_bound(scores[id2].begin() + i, scores[id2].end(), th[id2]) - (scores[id2].begin() + i);
	if (dist1 <= 0 && dist2 <= 0) {
		return -1;
	}
	if (dist1 < dist2) {
		th[id1] += 2;
		return id1;
	}
	else {
		th[id2] += 2;
		return id2;
	}
}

int main() {
	ll init[3];
	cin >> n >> init[0] >> init[1] >> init[2];
	input.resize(n);
	rep(i, 3) {
		scores[i].resize(n + 1);
		scores[i][0] = -init[i];
	}
	rep(i, n) {
		string s;
		cin >> s;
		if (s == "AB") {
			scores[0][i + 1] = scores[0][i] + 1;
			scores[1][i + 1] = scores[1][i] + 1;
			scores[2][i + 1] = scores[2][i];
			input[i] = 0;
		}
		if (s == "BC") {
			scores[0][i + 1] = scores[0][i];
			scores[1][i + 1] = scores[1][i] + 1;
			scores[2][i + 1] = scores[2][i] + 1;
			input[i] = 1;
		}
		if (s == "AC") {
			scores[0][i + 1] = scores[0][i] + 1;
			scores[1][i + 1] = scores[1][i];
			scores[2][i + 1] = scores[2][i] + 1;
			input[i] = 2;
		}
	}
	vector<string> ans;
	th[0] = th[1] = th[2] = 1;
	for (int i = 0; i < n;i++) {
		if (input[i] == 0) {
			auto p = process(i+1, 0, 1);
			if(p < 0){
				cout << "No" << endl;
				return 0;
			}
			if (p == 0) {
				ans.push_back("A");
			}
			else {
				ans.push_back("B");
			}
		}
		else if (input[i] == 1){
			auto p = process(i + 1, 1, 2);
			if (p < 0) {
				cout << "No" << endl;
				return 0;
			}
			if (p == 1) {
				ans.push_back("B");
			}
			else {
				ans.push_back("C");
			}
		}
		else {
			auto p = process(i + 1, 0, 2);
			if (p < 0) {
				cout << "No" << endl;
				return 0;
			}
			if (p == 0) {
				ans.push_back("A");
			}
			else {
				ans.push_back("C");
			}

		}
	}
	cout << "Yes" << endl;
	for (string c : ans) {
		cout << c << endl;
	}
	return 0;
}


Measured memory_bytes: 10208
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
//#include <unordered_map>

using namespace std;

template<typename T> void uin(T &a, T b) {if (b < a) a = b;}
template<typename T> void uax(T &a, T b) {if (b > a) a = b;}


#define int long long
#define double long double
#define right right228
#define mp make_pair
#define all(v) v.begin(), v.end()

const int N = 100 * 1000 + 228;

int a[N], v[N], suff[N];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i <= n; ++i) {
		cin >> a[i];
	}
	for (int i = n; i >= 0; --i) {
		suff[i] = suff[i + 1] + a[i];
	}
	v[0] = 1;
	if (a[0] > 1) {
		cout << -1 << '\n';
		return 0;
	}
	for (int i = 1; i <= n; ++i) {
		v[i] = min( (v[i - 1] - a[i - 1]) * 2LL , suff[i] );

		if (v[i] < a[i]) {
			cout << -1 << '\n';
			return 0;
		}
	}

	int sum_vert = 0;
	for (int i = 0; i <= n; ++i) {
		sum_vert += v[i];
	}
	cout << sum_vert << '\n';
	return 0;
}

/*

1
3 2 2
1 2 3 1 
2 3 1 0
1
1 3

01.a
3 3 4
...
.#.
...
1 1 1 3 8 
1 3 1 3 64
2 1 1 3 24
2 1 3 3 40

3 4 3
1 2
2 2
2 4
3
1 1 1 4
2 2 3 3
3 2 2 4

*/


Measured memory_bytes: 5960
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    int n,m,i;
    priority_queue <ll, vector<ll>, greater<ll> > pq;
  cin>>n>>m;
  ll a[n];
  ll ans=0;
  for(i=0;i<n;i++)
    {cin>>a[i];
    pq.push(a[i]);
    }
    vector<pair<ll,ll> > v(m);
  for(i=0;i<m;i++)
  {
      cin>>v[i].ss>>v[i].ff;
  }
  sort(v.rbegin(),v.rend());
  for(i=0;i<m;i++)
  {
      while(v[i].ss>0&&pq.size()>0)
      {
          if(pq.top()<v[i].ff)
          {
              ans+=v[i].ff;
              pq.pop();
              v[i].ss--;
          }
          else
          {
              ans+=pq.top();
              pq.pop();
          }
      }
  }
  while(pq.size()>0)
  {
      ans+=pq.top();
      pq.pop();
  }
  cout<<ans<<e;
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int a[5];
  int k;
  cin >>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;
  rep(i,4){
    rep2(j,i+1,5){
      //cout<<a[j]<<" "<<a[i]<<" "<<abs(a[j]-a[i])<<endl;
      if(abs(a[j]-a[i])>k){
        cout<<":("<<endl;
        return 0;
      }
    }
  }  
  cout <<"Yay!"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#ifndef ONLINE_JUDGE
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define deb_arr(a,n) {cout<<#a<<":";for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';}
#define deb_mat(dist,n,m) {cout<<#dist<<"\n";for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}}
#else
#define deb(x) ;
#define debug(x,y) ;
#define deb_arr(a,n) ;
#define deb_mat(dist,n,m) ;
#endif
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 200001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
template< class T > bool odd(T a) { return a&1; }
template< class T > bool even(T a) { return !(a&1); }
int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("../ip.txt", "r", stdin);
//    freopen("../op.txt", "w", stdout);
//#endif
    AKASH_PATEL;
    SVNIT_SURAT;
    int t=1;
//    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        double a[n];
        take_arr(a,n)
        int sum=accumulate(a,a+n,0);
        int cnt=0;
        fpr(i,0,n)
        {
            double v=4;
            v*=(m*a[i])/sum;
            if(v>=1)
            {
                cnt++;
            }
        }
        if(cnt<m)
        {
            print("No")
        }
        else print("Yes")

    }
    return 0;
}





Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int n, x, ans;
    ans = 0;
    while(1){
        cin >> n >> x;
        if (n == 0 && x == 0) {
            return 0;
        }
        for (int i = 1; i < n + 1; i++) {
            for (int j = 1; j < n + 1; j++) {
                for (int k = 1; k < n + 1; k++) {
                    if (i + j + k == x) { 
                        if (i !=j&&i != k&&j != k) {
                            ans++;
                        }
                    }
                }
            }
        }
        cout << ans / 6 << endl;
        ans = 0;
    }
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;

void OUTPUT(int x, int value){
  while(x > value){
    cout << 0;
    x /= 10;
  }
  cout << value;
  return;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    int a[m + 5], b[m + 5];
    vector<int> copy[100005];
    rep(i,m){
      cin >> a[i] >> b[i];
      copy[a[i]].pu(b[i]);
    }
    reps(i,n){
      sort(all(copy[i]));
      copy[i].erase(unique(all(copy[i])), copy[i].end());
    }
    rep(i,m){
      int ID = lower_bound(all(copy[a[i]]), b[i]) - copy[a[i]].begin();
      // cout << ID << " ";
      OUTPUT(100000,a[i]);
      OUTPUT(100000,ID + 1);
      cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 7808
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        input.readLine();
        String word = input.readLine();
        int value = 0;
        int max = 0;
        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'I'){
                value++;
            }else{
                value--;
            }
            max = Math.max(max, value);
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 22484
#include <algorithm>
#include <iostream>

#include <cmath>
#include <iomanip>
#include <vector>
#include <string>

using namespace std;
#define int ll
#define ll long long

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define REP(i, n) for (int i = 0; i < (int)n; ++i)

string s;
int now=0;

int solve(){
  now++;
  if(isdigit(s[now])){
    int t=0;
    while(isdigit(s[now])){
      t = t*10+(s[now]-'0');
      now++;
    }
    return (t+1)/2;
  }
  vector<int>tmp;
  while(now<s.size()&&s[now]!=']'){
    if(s[now]=='[')tmp.push_back(solve());
    now++;
  }
  //now++;
  sort(ALL(tmp));
  //cout<<"//"<<endl;
  //REP(i,tmp.size())cout<<tmp[i]<<endl;
  //cout<<"end"<<endl;
  int ret = 0;
  REP(i,(tmp.size()+1)/2)ret += tmp[i];
  return ret;
}

signed main() {
  int N;
  cin>>N;
  vector<int> ans;
  REP(i,N){
    cin>>s;
    now = 0;
    ans.push_back(solve());
  }
  for(auto e:ans)cout<<e<<endl;
  return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

int n, a, c;
si s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> a;
    if(a >= 3200){
      c++;
    }else{
      s.insert(a/400);
    }
  }
  cout << max(sz(s), 1) << " " << sz(s)+c << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	var n int
	s := wordScanner()
	scanInts(s, &n)

	l := make([]int, n)
	for i := 0; i < n; i++ {
		scanInts(s, &l[i])
	}

	sort.Ints(l)
	fmt.Println(l[n/2] - l[n/2-1])
}

func wordScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func scanInts(s *bufio.Scanner, vals ...*int) {
	for i := range vals {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		*vals[i] = n
	}
}


Measured memory_bytes: 2048
h, w = map(int, input().split())
s = [["a"]*(w+2)] + [["a"] + list(input()) + ["a"] for i in range(h)] + [["a"]*(w+2)]

for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j] != "#":
      c = [s[i-1][j-1], s[i-1][j], s[i-1][j+1], s[i][j-1], s[i][j+1], s[i+1][j-1], s[i+1][j], s[i+1][j+1]]
      s[i][j] = str(c.count("#"))
      
for i in range(1,h+1):
  print("".join(s[i][1:-1]))

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,M;
//x y z

vint xs[500],ys[500];
bool f[500][500];

int sx[500],sy[500];

signed main(){
    while(cin>>N>>M,N||M){
        memset(f,0,sizeof(f));
        rep(i,N){
            xs[i].clear();
            ys[i].clear();
            sx[i]=sy[i]=0;
        }
        vpint hoge;
        rep(i,M){
            string s;
            int a,b;
            cin>>s>>a>>b;
            a--;b--;
            if(s=="xy"){
                f[a][b]=1;
                sx[a]++;sy[b]++;
                hoge.pb(pint(a,b));
            }
            else if(s=="xz"){
                xs[b].pb(a);
            }
            else{
                ys[b].pb(a);
            }
        }
        sort(all(hoge));hoge.erase(unique(all(hoge)),hoge.end());
        int sum=0;
        rep(z,N){
            sort(all(xs[z]));sort(all(ys[z]));
            xs[z].erase(unique(all(xs[z])),xs[z].end());
            ys[z].erase(unique(all(ys[z])),ys[z].end());

            for(auto& x:xs[z]){
                sum+=N-sx[x];
            }
            for(auto& y:ys[z]){
                sum+=N-sy[y];
            }
            sum-=(int)xs[z].size()*ys[z].size();
            for(auto &x:xs[z]){
                for(auto &y:ys[z]){
                    if(f[x][y])sum++;
                }
            }
        }
        sum+=hoge.size()*N;
        cout<<N*N*N-sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 3324
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <cmath>

using namespace std;

int64_t INF = 1'000'000'000'000'000'000;

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

    vector<int64_t> X(N);
    for(int i=0;i<N;i++)    cin >> X[i];

    int64_t ans = INF;
    for(int left=0;left<=N-K;left++){
        int right = left + K - 1;
        int64_t res = min(abs(X[left]), abs(X[right]));
        res += X[right] - X[left];
        ans = min(ans, res);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int s = 86400;
  int n;
  scanf("%d", &n);
  vi a(n);
  vi b(n);
  rep (i, n) {
    scanf("%d%d", &a[i], &b[i]);
  }
  int current = 0;
  vi wakeup(s, 0);
  current = (current + a[0]) % s;
  wakeup[current] += 1;
  rep (i, n-1) {
    current = (current + b[i] + a[i+1]) % s;
    wakeup[current] += 1;
  }

  int p = 10800;
  vi early(s, 0);
  rep (i, p+1) {
    early[0] += wakeup[i];
  }
  int maxi = early[0];

  FOR (i, 1, s) {
    early[i] = early[i-1] - wakeup[i-1] + wakeup[(i+p)%s];
    maxi = max(maxi, early[i]);
  }
  printf("%d\n", maxi);

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100001;
const ll mod = 1e9+7;
int n, tot;
struct coo
{
    int x, y;
    int id;
}c[maxn];
bool cmp1(coo a, coo b){
  return a.x < b.x;
}
bool cmp2(coo a, coo b){
  return a.y < b.y;
}
int dx[maxn],dy[maxn];
struct Edge{
  int u, v;
  int cost;
}e[maxn];
bool cmp(Edge a, Edge b){
  return a.cost < b.cost;
}
int p[maxn];
int find(int x){return p[x] == x ? x : p[x] = find(p[x]);}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);
  scanf("%d", &n);
  for(int i = 0; i <= n; i++) p[i] = i;
  for(int i = 1; i <= n; i++){
    scanf("%d%d", &dx[i], &dy[i]);
  }
  for(int i = 1; i <= n; i++)
  {
    c[i].x = dx[i]; c[i].y = dy[i];c[i].id = i;
  }
  sort(c+1,c+1+n,cmp1);
  for(int i = 1; i < n; i++){
    e[tot].u = c[i].id;
    e[tot].v = c[i+1].id;
    e[tot].cost = c[i+1].x - c[i].x;
    tot++;
  }
  sort(c+1,c+1+n,cmp2);
  for(int i = 1; i < n; i++){
    e[tot].u = c[i].id;
    e[tot].v = c[i+1].id;
    e[tot].cost = c[i+1].y - c[i].y;
    tot++;
  }
  sort(e,e+tot,cmp);
  ll ans = 0;
  int cnt = 0;
  for(int i = 0; i < tot; i++){
    int f = find(e[i].u);
    int t = find(e[i].v);
    if(f!=t){ans+=e[i].cost;p[f] = t;cnt++;}
    if(cnt == n-1)break;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int N; cin >> N;
    cout << N*N*N << endl;


    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
L = [1] * M 
R = [N] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())


if min(R) - max(L) + 1 < 0:
    print(0)
    exit()

print(min(R) - max(L) + 1)

Measured memory_bytes: 10868
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
int ans;
int a,b,c;
int main(void){
    cin>>a>>b>>c;
    cout<<min(min(min(abs(a-b)+abs(b-c),abs(a-c)+abs(c-b)),min(abs(b-a)+abs(a-c),abs(b-c)+abs(c-a))),min(abs(c-a)+abs(a-b),abs(c-b)+abs(b-a)))<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main() {
	ll x;
	cin>>x;
	ll c=0;
	while(x>=5)
	{
		if(x>=500)
		{
			x=x-500;
			c=c+1000;
		}
		else if(x>=5)
		{
			x=x-5;
			c=c+5;
		}
	}
	cout<<c<<"\n";

}


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;

int main() {
  int N,K;
  cin >> N >> K;
  set<int> S;
  rep(i,K){
    int d;
    cin >> d;
    rep(j,d){
      int a;
      cin >> a;
      S.insert(a);
    }
  }
  cout << N - S.size() << endl;
}

Measured memory_bytes: 3636
a = [int(input()) for i in range(4)]
yen500 = a[0]
yen100 = a[1]
yen50 = a[2]
target = a[3]

count = 0
for i1 in range(yen500+1):
  for i2 in range(yen100+1):
    for i3 in range(yen50+1):
      if i1*500 + i2*100 + i3*50 == target:
        count += 1
print(count)

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

int main(){
	string S;
	cin >> S;
	int ans;
	int tmp=0;
	for(int i=0;i<S.size();i++){
		if(S[i]!=('0'+i%2))tmp++;
	}
	ans=tmp;
	tmp=0;
	for(int i=0;i<S.size();i++){
		if(S[i]!=('0'+(i+1)%2))tmp++;
	}
	ans=min(ans,tmp);
	cout << ans << endl;
	return 0;
}

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

int main(){
  string N;
  cin >> N;
  int x = N.size();
  bool sev = false;
  for(int i = 0; i < x; i++){
    if(N.at(i) == '7')sev = true;
  }
  if(sev)cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

typedef long long ll;

#define MOD 1000000007
#define INF LLONG_MAX
#define decimDigits(n) fixed << setprecision(n)
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(it, arr) for(auto it = begin(arr); it != end(arr); it++)

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

ll l_pow(ll a, ll n){
    if(n)
        return a * l_pow(a, n - 1);
    else
        return 1;
}

int main(){

    ll N, K;

    cin >> N >> K;

    cout << K * l_pow(K - 1, N - 1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
while true do
  a, b = gets.split.map(&:to_i)
  break if (a|b) == 0

  mass = Array.new(a+1, 0).map{ Array.new(b+1, 0) }
  mass[1][0] = 1

  n = gets.to_i
  n.times do
    x, y = gets.split.map(&:to_i)
    mass[x][y] = nil
  end

  for i in 1..a
    for j in 1..b
      if mass[i][j] == nil
        mass[i][j] = 0
      else
        mass[i][j] = mass[i-1][j] + mass[i][j-1]
      end
    end
  end
  puts mass[a][b]
end

Measured memory_bytes: 6112
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

struct Point{
    double x,y;
    Point(){}
    Point(double a,double b) : x(a),y(b){}
    Point operator + (Point p){
        return Point(x+p.x,y+p.y);
    }
    Point operator - (Point p){
        return Point(x-p.x,y-p.y);
    }
    Point operator * (double k){
        return Point(x*k,y*k);
    }
};

pair<double,double> Circumcenters(Point p1,Point p2,Point p3){
    double t = ( ((p3.x-p2.x)*(p2.x-p1.x)-(p3.y-p2.y)*(p1.y-p2.y)) / ((p2.x-p1.x)*(p3.y-p1.y)-(p1.x-p3.x)*(p1.y-p2.y)) ) / 2.0;

    double x = (p1.x+p3.x)/2.0 + t * (p1.y-p3.y);
    double y = (p1.y+p3.y)/2.0 + t * (p3.x-p1.x);
    return make_pair(x,y);
}

int main(){
    int n;cin>>n;
    rep(i,n){
        double x1,y1,x2,y2,x3,y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        double x,y;
        tie(x,y) = Circumcenters(Point(x1,y1),Point(x2,y2),Point(x3,y3));
        double d = sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
        printf("%.3f %.3f %.3f\n",x,y,d);
    }
}

Measured memory_bytes: 3212
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        
        int b = sc.nextInt();
        
        if(a < b){
            System.out.println("a < b");
        }
        else if(a > b){
            System.out.println("a > b");
        }
        else if(a == b){
             System.out.println("a == b");

        }

        
    }
    
}




Measured memory_bytes: 26316
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n, l = map(int, input().split())

    flavors = [ l + i - 1 for i in range(1, n+1)]
    flavor_abs = [ abs(l + i - 1) for i in range(1, n+1)]
    eat = min(flavor_abs)
    del flavors[flavor_abs.index(eat)]

    print(sum(flavors))


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

ll mod=1e9+7;
ll mod_pow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1)res=res*x%13;
        x=x*x%13;
        n>>=1;
    }
    return res;
}

int main() {
    string s;
    cin>>s;
    vector<vector<ll>> dp(s.size(),vector<ll>(13,0));
    if(s[s.size()-1]=='?'){
        rep(i,10){
            dp[s.size()-1][i]=1;
        }
    }else{
        dp[s.size()-1][s[s.size()-1]-'0']=1;
    }
    ll keta=1;
    for(ll i=s.size()-2;i>=0;i--){
        if(s[i]=='?'){
            rep(j,10){
                ll res=mod_pow(10,keta)*j;
                rep(k,13){
                    ll r=(res+k)%13;
                    dp[i][r]+=dp[i+1][k];
                    dp[i][r]=(dp[i][r]+mod)%mod;
                }
            }
        }else{
            ll res=mod_pow(10,keta)*(s[i]-'0');
            rep(k,13){
                ll r=(res+k)%13;
                dp[i][r]+=dp[i+1][k];
                dp[i][r]=(dp[i][r]+mod)%mod;
            }
        }
        keta++;
    }
    cout<<dp[0][5]<<endl;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int StartTime = max(A, C);
  int EndTime   = min(B, D);

  cout << max(0, EndTime - StartTime) << endl;
}


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

bool isprime(int x){
	if(x==2){
		return true;
	}
	if(x<2 || x%2==0){
		return false;
	}
	int i=3;
	while(i<=sqrt(x)){
		if(x%i==0){
			return false;
		}
		i=i+2;
	}
	return true;
}

int main(){
	int n;
	int result=0;
	std::cin>>n;
	int A[n];
	for(int i=0;i<n;i++){
		std::cin>>A[i];
	}
	for(int j=0;j<n;j++){
			if(isprime(A[j])==true){
				result++;
			}
	}
	std::cout<<result<<std::endl;
	return 0;
}


Measured memory_bytes: 3120