akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
 
const int MAXN = 1e5 + 10;
vector<pair<int, int> > Mat[MAXN];
bool cl[MAXN];
int n;
 
void dfs(int v, int p, int s) {
	cl[v] = s % 2;
	for (int i = 0; i < Mat[v].size(); i++)
		if (Mat[v][i].first != p)
			dfs(Mat[v][i].first, v, s + Mat[v][i].second);
}
 
int main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int a, b, w;
		cin >> a >> b >> w;
		Mat[a].push_back({b, w % 2});
		Mat[b].push_back({a, w % 2});
	}
	dfs(1, 1, 0);
	for (int i = 1; i <= n; i++)
		cout << cl[i] << '\n';
}

Measured memory_bytes: 8832
/*

Author : AllKilled
Date   : 201911166

Contest: AtCoder Beginner Contest 145.
Problem: Task E.
Result :

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

typedef long long LL;

const LL MAXN = 6e3+7;

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

LL n, t, a, b, ans;
LL dp[MAXN];
vector<pair<LL,LL> > f;

int main()
{
    cin >> n >> t;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        f.push_back({a, b});
    }
    sort(f.begin(), f.end()
        //, [](pair<LL,LL> x, pair<LL,LL> y){
        //LL l = x.second * y.first, r = y.second * x.first;
        //return l > r || (l == r && x.first < y.first);}
    );
    //for (auto x : f) cout << x.first << " " << x.second << endl;
    for (int i = 0; i < n; ++i) {
        a = f[i].first;
        b = f[i].second;
        for (int j = t - 1; j >= 0; --j)
            dp[j + a] = max(dp[j + a], dp[j] + b);
    }
    for (int i = 0; i < MAXN; ++i) ans = max(ans, dp[i]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF (1<<29)
 
int main()
{
    int N, M, K;
    cin >> N >> M >> K;
     
    vector<int> D(M), dm(N, -1);
    for (int i = 0; i < M; i++) {
        cin >> D[i]; D[i]--;
        dm[D[i]] = 1<<i;
    }
     
    vector<vector<int>> v(N, vector<int>(K));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < K; j++) {
            cin >> v[i][j];
            v[i][j]--;
        }
    }
     
    int dp[1<<16];
    fill(dp, dp + (1<<16), INF);
    dp[(1<<M)-1] = 0;
 
    queue<int> Q;
    Q.push((1<<M)-1);
 
    while (!Q.empty()) {
        int S = Q.front(); Q.pop();
        if (dp[S] == INF) continue;
        for (int i = 0; i < K; i++) {
            int nS = 0;
            for (int j = 0; j < M; j++) {
                if (!(S >> j & 1)) continue;
                int nj = v[D[j]][i];
                if (dm[nj] >= 0) {
                    nS |= dm[nj];
                }                
            }
            if (dp[S] + 1 < dp[nS]) {
                dp[nS] = dp[S] + 1;
                Q.push(nS);
            }           
        }
    }
    cout << dp[0] << endl;
    return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
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;}
constexpr int INF=1000000000000000000;
constexpr int mod=998244353;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
struct BIT{
    int n;
    vector<int>bit;
    BIT(int x){
        n=x;
        bit.resize(n+1,0);
    }
    void add(int i,int x){
        while(i<=n){
            bit[i]+=x;
            i+=i&-i;
        }
    }
    int sum(int i){
        int res=0;
        while(i>0){
            res+=bit[i];
            i-=i&-i;
        }
        return res;
    }
    int sum(int l,int r){
        //[l,r)
        return sum(r-1)-sum(l-1);
    }
};
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,q;
    cin>>n>>q;
    BIT bit(n);
    rep(i,n){
        int a;
        cin>>a;
        bit.add(i+1,a);
    }
    rep(i,q){
        int t,a,b;
        cin>>t>>a>>b;
        if(t==0){
            bit.add(a+1,b);
        }
        else{
            cout<<bit.sum(a+1,b+1)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 8244
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
//ll INF = 1LL<<40;
int INF = 1LL<<15;

int H, W;

int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

queue<TP> q,q2;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, M;
    cin >> N >> M;
    vector<vector<int>> mp(N);
    REP(i, M){
        int a, b;
        cin >> a >> b;
        a--;b--;
        mp[a].push_back(b);
        mp[b].push_back(a);
    }
    queue<pair<int, vector<bool>>> q;
    vector<bool> used(N, false);
    used[0] = true;
    q.push(make_pair(0, used));
    int cnt = 0;
    while(!q.empty()){
        int i;
        tie(i, used) = q.front(); q.pop();
        for(auto e: mp[i]){
            //cout << e << endl;
            if(used[e] == false){
                used[e] = true;
                bool check = true;
                REP(i, N){
                    check &= used[i];
                }
                if(check){
                    cnt++;
                }else{
                    q.push(make_pair(e,used));
                }
                used[e] = false;
            }
        }
        
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

int _add(int a, int b) {
    return a+b;
}
int _mul(int a, int b){
    return a*b;
}
int _sub(int a, int b){
    return a-b;
}

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

    string s;
    cin >> s;
    int a = s[0] - '0', b = s[1] - '0', c = s[2] - '0', d = s[3] - '0';
    string symbol = "+*-";
    REP(i, 3) REP(j, 3) REP(k, 3){
        int sum = a;
        if(i == 0) sum = _add(sum, b);
        else if(i == 1) sum = _mul(sum, b);
        else if(i == 2) sum = _sub(sum, b);

        if(j == 0) sum = _add(sum, c);
        else if(j == 1) sum = _mul(sum, c);
        else if(j == 2) sum = _sub(sum, c);

        if(k == 0) sum = _add(sum, d);
        else if(k == 1) sum = _mul(sum, d);
        else if(k == 2) sum = _sub(sum, d);

        if(sum == 7){
            cout << a << symbol[i] << b << symbol[j] << c << symbol[k] << d << "=7" << endl;
            return 0;
        }
    }

}


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

int main(int argc, char const* argv[])
{
	int n, q, answer = 0;
	cin >> n;
	int S[n];
	for (int i=0; i<n; i++) {
		cin >> S[i];
	}

	cin >> q;
	for (int i=0; i<q; i++) {
		int T;
		cin >> T;
		int *p = std::find (S, S+n, T);
		if (p != S+n){
			answer++;
		}
	}
	cout << answer << "\n";

	return 0;
}


Measured memory_bytes: 1552
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>

using namespace std;

#define int long long
#define  B  (unsigned int)(1e9+7)

signed main(){
	unsigned int ans = 0;
	vector<unsigned int> hoge(30);
	string s, t;
	vector<unsigned int> ss, ss2;
	
	
	hoge[0] = B;
	for(unsigned int i = 1; i < hoge.size(); i++){
		hoge[i] = hoge[i-1] * B;
	}
	
	cin>>s>>t;
	
	ss.reserve(s.size() * s.size());
	ss2.reserve(s.size() * s.size());
	
	for(unsigned int i = 0; i < s.size(); i++){
		unsigned int con = 0;
		
		for(unsigned int j = i; j < s.size(); j++){
			con += (unsigned int)s[j] * hoge[s[j] - 'a'];
			ss.push_back(con);
		}
	}
	
	sort(ss.begin(), ss.end());
	
	for(unsigned int i = 0; i < t.size(); i++){
		unsigned int con = 0;
		
		for(unsigned int j = i; j < t.size(); j++){
			con += (unsigned int)t[j] * hoge[t[j] - 'a'];
			if(binary_search(ss.begin(), ss.end(), con) ) {
				ans = max(ans, j - i + 1);
			}
		}
	}
	
	cout<<ans<<endl;
}

//3997


Measured memory_bytes: 65560
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 100010;
static const ll INFTY = 1e12;

class UnionFind {
  public:

  vector<ll> Parent;
  vector<ll> Size;

  //Constructor
  UnionFind( ll InitSize ) : Parent( InitSize ), Size( InitSize, 1LL ) {
    for( ll i = 0; i < InitSize; i++ ) Parent[i] = i; //myself
  } 

  void Init( ll InitSize ){
    Parent.resize( InitSize );
    Size.assign( InitSize, 1LL );
    for( ll i = 0; i < InitSize; i++ ) Parent[i] = i; //myself   
  }

  //Member Function
  //FindRoot
  ll FindRoot( ll x ){
    while( Parent[x] != x ){
      x = Parent[x] = Parent[Parent[x]];
    }
    return x;
  }

  //Merge
  void Merge( ll x, ll y ){
    x = FindRoot(x);
    y = FindRoot(y);
    if (x == y) return;
    if (Size[x] < Size[y]) swap(x, y);
    Size[x] += Size[y];
    Parent[y] = x;
    return;
  }

  bool IsSame(ll x, ll y) { 
      return FindRoot(x) == FindRoot(y);
  }

  ll CalcSize(ll x) { 
      return Size[FindRoot(x)];
  }
};

int main(){

  ll N, M, a, b;
  vector< pair<ll, ll> > Bridge(MAX);

  cin >> N >> M;

  REP(i, M) {
        cin >> a >> b; --a, --b;
        Bridge[i].first = a;
        Bridge[i].second = b;
  }

  vector<ll> ans(M);
  ll node1, node2;
  UnionFind UF(N);
  ans[M-1] = ( N * ( N - 1 ) ) / 2;

  for( ll i = M-1; i >= 1; i-- ){
    node1 = Bridge[i].first, node2 = Bridge[i].second;
    if( UF.IsSame( node1, node2 ) ){
      ans[i-1] = ans[i];
    } else{
      ans[i-1] = ans[i] - ( UF.CalcSize(node1) * UF.CalcSize(node2) );
      UF.Merge( node1, node2 );
    }
  }

  REP(i, M) {
        cout << ans[i] << "\n";
  }

  return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 5248
#include <iostream>
using namespace std;
 
int main() {
	string s;
    cin>>s;
    for(int i=0;i<s.length();i=i+1){
    	if(s[i]=='1')
    		cout<<9;
      	if(s[i]=='9') 
      		cout<<1;
    }
    return 0;
}

Measured memory_bytes: 3548
n = int(input())
s = list(input())

left = [0]
for c in s[:-1]:
  if c == 'W':
    left.append(left[-1] + 1)
  else:
    left.append(left[-1])

right = [0]
for c in s[:0:-1]:
  if c == 'E':
    right.append(right[-1] + 1)
  else:
    right.append(right[-1])
right = right[::-1]

sums = [i + j for i, j in zip(left, right)]
mini = min(sums)
print(mini)


Measured memory_bytes: 34212
# AOJ 0279: A Pair of Prizes
# Python3 2018.6.25 bal4u

while True:
	n = int(input())
	if n == 0: break
	k = list(map(int, input().split()))
	one, many = 0, 0
	for i in k:
		if i == 1: one += 1
		elif i > 1: many += 1
	print(one+many+1 if many > 0 else "NA")


Measured memory_bytes: 7208
// !Start && !End 
//  0 se divide
//https: //www.youtube.com/watch?v=6Nb-prB-4P0&list=RD6Nb-prB-4P0&start_radio=1

// https: //www.youtube.com/watch?v=eYDI8b5Nn5s
// Electrify my OOOoooooOOOoooOOOOOoooooOOOooo!
#pragma optimise GCC(-O2)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define ve(x) vector<x>
#define f(a,b,c) for(int a=b;a<c;a++)
#define foto(x,v) for(auto x:v)
#define read(t) ll t; cin>>t;
#define reads(t) string t; cin>>t;
#define readarr(arr,n) ll arr[n]; f(i,0,n) cin>>arr[i];
#define forstl(i,v) for(auto &i: v)
#define ln endl
#define Endl endl
#define dbg(x) cout<<#x<<" = "<<x<<ln;
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<ln;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    Term "<< ++c <<" = "<<it<<ln;} cout<<ln;
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cout<<ln;
#define dbgarr(v,s,e) cout<<#v<<" = "; f(i,s,e) cout<<v[i]<<", "; cout<<ln;
#define addEdge(tr,k) f(i,0,k) { ll x,y; cin>>x>>y, tr[x].push_back(y), tr[y].push_back(x);}
#define all(v) v.begin(),v.end()

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); }

//														GLOBAL VARS
ll INF =LLONG_MAX;
const ll M= 1000000007;

//														USEFUL FUNCTIONS
ll powm(ll ,ll);

ll dp[2005][2005];

// 														MAIN
int main()
{ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    //It gets easier day by day, but the hard part is to........
    read(n) readarr(a,n)
    memset(dp,0,sizeof(dp));
    dp[0][0] = 0;
    ve(pii) chiis;
    f(i,0,n) chiis.push_back({a[i],i+1});
    sort(all(chiis));
    reverse(all(chiis));
    f(i,0,n)
    {
        ll su = i;
        f(x,0,su+1)
        {
            ll y = su - x;
            dp[x+1][y] = max(dp[x+1][y] , dp[x][y] + chiis[i].first * (chiis[i].second - x - 1));
            dp[x][y+1] = max(dp[x][y+1] , dp[x][y] + chiis[i].first * (n - y -chiis[i].second  ));
        }
    }
    ll ans = 0;
    f(x,0,n+1) ans = max(ans, dp[x][n-x]);
    cout<<ans;
}










//													FUNCTIONS DECLARATIONS
ll powm(ll a, ll b) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%M;
		a=(a*a)%M;
		b>>=1;
	}
	return res;
}

Measured memory_bytes: 35148
#include<iostream>
char s[4];
double d,e,n;
using namespace std;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d >> s;
		e += (s[0] == 'J') ? d : d * 380000.0;
	}
	cout << e;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int N;
	int i;
	scanf("%d", &N);

	int A[N];
	long samA = 0;
	for (i = 0;i < N;i++) {
		scanf("%d", &A[i]);
		samA += A[i];
	}

	samA /= 2;
	i = N - 2;
	while (i >= 1) {
		samA -= A[i];
		i -= 2;
	}

	int w1 = samA;

	printf("%d ", w1 * 2);
	for (i = 0;i < N - 1;i++) {
		w1 = A[i] - w1;
		printf("%d ", w1 * 2);
	}

	return 0;
	
}

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

const int N = 1005;
const int mod = 1e9 + 7;

void add(int &x,int y) {
	x += y; if (x >= mod) x -= mod;
}

int n, m;
int f[N][N];
char s[N][N];

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; ++i) {
		scanf("%s", s[i] + 1);
	}
	f[1][1] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			if (s[i][j] == '#') {
				f[i][j] = 0;
			}
			add(f[i + 1][j], f[i][j]);
			add(f[i][j + 1], f[i][j]);
		}
	}
	printf("%d\n", f[n][m]);
}

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

int main(){
  int N; cin>>N;
  set<string> st;
  string s;
  
  rep(i,N) {
  cin>>s;
  st.insert(s);
  }
  
  cout << st.size() << endl;

}

Measured memory_bytes: 19128
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }

void main()
{
	auto H = RD;

	long ans, cnt = 1;
	while (H != 0)
	{
		ans += cnt;
		H /= 2;
		cnt *= 2;
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 256
import numpy as np

n = int(input())
b = np.array(list(map(int,input().split())))
b = b[::-1]
a = np.array([])

a = np.append(a,b[0])

for index in range(len(b)-1):
  if b[index+1]<b[index]:
    a = np.append(a,b[index+1])
  else:
    a = np.append(a,b[index])

a = np.append(a,b[n-2])

print(int(np.sum(a)))

Measured memory_bytes: 12392
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
const int inf = 1 << 30;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}
int N, X, Y;
int ans[2010];
int main(){
    cin >> N >> X >> Y;
    for(int i = 1; i < N; i++){
        for(int j = i + 1; j <= N; j++){
            int res = j - i;
            chmin(res, abs(X - i) + abs(Y - j) + 1);
            ans[res]++;
        }
    }
    for(int i = 1; i < N; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n ;
	cin >> n; 
	string ans ;
	while(n){
		n--;
		ans.pb(n%26+'a');
		n/=26;
	}
	reverse(all(ans));  
	cout << ans << endl;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

template <typename T1, typename T2>
inline bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ll dp[2][100010];

void solve() {
    ll N, W;
    cin >> N >> W;
    Vl ws(N), vs(N);
    for (ll i = 0; i < N; i++) {
        cin >> ws[i] >> vs[i];
    }

    for (ll i = 0; i < N; i++) {
        swap(dp[0], dp[1]);
        memset(dp[1], 0, sizeof(ll) * W);
        for (ll j = 0; j <= W; j++) {
            dp[1][j] = dp[0][j];
            if (j - ws[i] >= 0)
                chmax(dp[1][j], dp[0][j - ws[i]] + vs[i]);
        }
    }

    prints()(dp[1][W]);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(nullptr), cout.tie(nullptr);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 5232
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<int>num(n,0);
  for(int i=0;i<n;i++){
    cin >> num[i];
  }
  
  int ans = 0;
  
  for(int i=1;i<n-1;i++){
    if(num[i] < num[i - 1] && num[i] > num[i + 1])
      ans++;
    else if(num[i] > num[i - 1] && num[i] < num[i + 1])
      ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();

        int n = Integer.parseInt(str);
        int ans = 1;
        int min = 0;

        str = scan.nextLine();
        String[] substr = str.split(" ", 0);

        int[] array = new int[200000];
        for (int i=0; i<n; i++) {
        	array[i] = Integer.parseInt(substr[i]);
        }
        if (array[1] ==0) {
            System.out.println(ans);
            return;
        }

        if (array[1] <= array[0]) {
			min = array[1];
        	ans++;
		} else {
			min = array[0];
		}


        for (int i=2; i<n; i++) {
        	if (min >= array[i]) {
        		min = array[i];
            	ans++;
        	}
        }
        System.out.println(ans);
        scan.close();
        return;
    }

}


Measured memory_bytes: 56980
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

// 5 2
//
// 2 3 4 5 6
// (2+6)*5/2

int main() {
  int n, l;
  scanf("%d %d", &n, &l);

  int end = l + n - 1;
  int sum = (l + end) * n / 2;

  // 0が含まれる場合
  //
  //
  int a;
  if (l <= 0 && (end >= 0)) {
    a = sum;
  } else if (l < 0) {
    a = sum - end;
  } else if (l > 0) {
    a = sum - l;
  }

  cout << a << endl;
}


Measured memory_bytes: 256
#abc10d

a0,a1,a2,a3,a4,a5,a6,a7=[],[],[],[],[],[],[],[]
n,m=map(int,raw_input().split())
for i in xrange(n):
 x,y,z=map(int,raw_input().split())
 a0.append(x+y+z)
 a1.append(x-y+z)
 a2.append(x-y-z)
 a3.append(x+y-z)
 a4.append(-x+y+z)
 a5.append(-x-y+z)
 a6.append(-x-y-z)
 a7.append(-x+y-z)
 

b0=sorted(a0,reverse=True)
b1=sorted(a1,reverse=True)
b2=sorted(a2,reverse=True)
b3=sorted(a3,reverse=True)
b4=sorted(a4,reverse=True)
b5=sorted(a5,reverse=True)
b6=sorted(a6,reverse=True)
b7=sorted(a7,reverse=True)

res=max(sum(b0[:m]),sum(b1[:m]),sum(b2[:m]),sum(b3[:m]),sum(b4[:m]),sum(b5[:m]),sum(b6[:m]),sum(b7[:m]))
print res


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

int a[26] = {0};

int main(void)
{
    string str;
    cin >> str;

    for(int i = 0; i < str.size(); i++)
    {
        int x = (int)(str.at(i) - 'a');
        a[x]++;
    }

    for(int i = 0; i < 26; i++)
    {
        if(a[i] == 0)
        {
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;
    int ans = 0;
    for (int i = A; i <= B; i++)
    {
        string tmp = to_string(i);
        bool flag = true;
        for (int j = 0; j < tmp.size() / 2; j++)
        {
            if (tmp[j] != tmp[(tmp.size() - 1) - j])
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007;
#define pi 3.14159265358979323846
#define Endl endl
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	string st;
	cin>>st;
	int n = st.size();
	for(int i=0;i<st.size();i++){
		if( st[i] != st[n-1-i] ){
			cout<<"No"<<endl;
			return 0;
		}
		if( i < (n-1)/2 && st[i] != st[(n-1)/2 - 1 - i] ){
			cout<<"No"<<endl;
			return 0;
		}
		if( i > (n-1)/2 && st[i] != st[ n-1-(i-(n+1)/2) ]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  for(int i=0; i<w+2; i++)cout << '#';
  cout << endl;
  for(int i=0; i<h; i++){
    cout << '#';
    for(int j=0; j<w; j++){
      char a;
      cin >> a;
      cout << a;
    }
    cout << '#' << endl;
  }
  for(int i=0; i<w+2; i++)cout << '#';
  return 0;
}


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

int fun(int pos, int n, vector<int>&weight, vector<int>&value, int req, vector<vector<int>>&memo) {
    if(pos == n)
        return 0;
    
    if(memo[pos][req] != -1)
        return memo[pos][req];
        
    int exclude = fun(pos + 1, n, weight, value, req, memo);
    int include = 0;
    if(weight[pos] <= req)
        include  = max(include, fun(pos + 1, n, weight, value, req - weight[pos], memo) + value[pos]);
    
    return memo[pos][req] = max(include, exclude);
}

int32_t main() {
    int n, w;
    cin >> n >> w;
    
    vector<int> weight(n), value(n);
    
    for(int i = 0; i < n; i++)
        cin >> weight[i] >> value[i];
    
    vector<vector<int> > memo(n + 1, vector<int>(w + 1, -1));
    
    cout << fun(0, n, weight, value, w, memo);
    return 0;
}

Measured memory_bytes: 83120
#include <iostream>
    #include <stdio.h>
    #include <math.h> 
    #include <algorithm>
    #include <numeric>
    #include <functional>
    #include <vector>
    #include <string>
    #include <numeric>
     
    using namespace std;
     
    string a;
    string b;
     
    int main() {
     
    	cin >> a >> b;
     
    	if (a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0)) {
    		cout << "YES" << endl;
    	}
    	else {
    		cout << "NO" << endl;
    	}
     
     
    	return 0;
    }

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

int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
int a[1010],N;
int main(){
    for(int i=1;i<=1000;i++){
        int t=0;
        for(int j=i;t<=1000;j++){
            a[t]++;
            t+=j;
        }
    }
    while(scanf("%d",&N),N){
        printf("%d\n",a[N]-1);
    }
    return 0;
}

Measured memory_bytes: 1032
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int n, p;
	while (cin >> n >> p, n) {
		int wan = p;
		int step = 0;
		int have[n] = {};
		int ans;
		while (1) {
			rep (i, n) {
				if (wan != 0) {
					wan--;
					have[i]++;
					if (!wan) {
						bool flag = true;
						rep (j, n) {
							if (j == i) continue;
							if (have[j]) {
								flag = false;
							}
						}
						if (flag) {
							cout << i << endl;
							goto end;
						}
					}
				} else {
					wan += have[i];
					have[i] = 0;
				}
			}
			step++;
		}
	end:;
	}
	return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <string>

static int e = 0;

void quickSort(std::string c, int start, int size){
  int i=start,j=start+size-1;
  while(i<j){
    if(c[i] == 'W' && c[j] == 'R'){
      c[i] = 'R';
      c[j] = 'W';
      e++;
    }else{
      if(c[i] != 'W') i++;
      if(c[j] != 'R') j--;
    }
  }
}

int main(){
  int n;
  std::string c;
  std::cin >> n;
  std::cin >> c;
  
  quickSort(c, 0, n);
  std::cout << e << std::endl;
}




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

inline int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); }
	return x * f;
}

int main() {
    int r = read(), g = read(), b = read(), n = read();
    ll ans = 0;
    for (int i = 0; i <= n / r + 1; i++) {
        for (int j = 0; j <= n / g + 1; j++) {
            int temp = i * r + j * g;
            if (n < temp) break;
            if ((n - temp) % b == 0) ans++;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		double[] x = new double [n];
		String[] u = new String [n];
		for(int i = 0; i < n; i++){
			String[] str = br.readLine().split(" ");
			x[i] = Double.parseDouble(str[0]);
			u[i] = str[1];
		}
		double cnt = 0;
		for(int i = 0; i < n; i++){
			if("JPY".equals(u[i])){
				cnt += 1.0*x[i];
			}else{
				cnt += 380000.0*x[i];
			}
		}
		System.out.println(cnt);

	}
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

#define INF 1e9

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    vector<vi> dp(n,vi(n,INF));
    rep(i,n) dp[i][i] = 0;
    using edge = tuple<int,int,int>;
    vector<edge> es(m);
    rep(i,m){
        int a,b,c; cin>>a>>b>>c; a--; b--;
        dp[a][b] = c;
        dp[b][a] = c;
        es[i] = tie(a,b,c);
    }
    rep(k,n)rep(i,n)rep(j,n)
        chmin(dp[i][j],dp[i][k]+dp[k][j]);
    int ans=0;
    rep(i,m){
        int a,b,c;
        tie(a,b,c) = es[i];
        if (c>dp[a][b]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int x, a, b;
int main(void) {
    cin >> x >> a >> b;
    if (b - a <= 0) cout << "delicious" << endl;
    else if (b - a <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;
}

Measured memory_bytes: 3540
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  }
}

Measured memory_bytes: 32560
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long long int L[87];
    L[0] = 2;
    L[1] = 1;
    for(int i = 2; i < 87; i++)
    {
        L[i] = L[i-1] + L[i-2];
    }
    
    cout << L[n] << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;



class Disjoint_set {
public:
	std::vector<int32> tree;
	Disjoint_set(size_t size) :tree(size, -1) {}
	int32 find(int32 x) {
		if (tree[x] < 0) return x;
		return tree[x] = find(tree[x]);
	}
	void unite(int32 x, int32 y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (tree[x] > tree[y]) {
			tree[y] += tree[x];
			tree[x] = y;
		}
		else {
			tree[x] += tree[y];
			tree[y] = x;
		}
		return;
	}
	size_t size(int32 x) {
		return -tree[find(x)];
	}
	bool same(int32 x, int32 y) {
		return find(x) == find(y);
	}
};

int main(void) {
	std::ios::sync_with_stdio(false);
	uint32 n, m;
	std::cin >> n >> m;
#define SIZ 100001
	std::priority_queue<uint32, std::vector<uint32>, std::greater<uint32>> Q[SIZ], P;
	std::vector<uint32> r(n, 0), c(n);
	Disjoint_set U(n);
	for (uint32 i = 0;i < n;++i) {
		std::cin >> c[i];
	}
	uint32 x, y;
	for (uint32 i = 0;i < m;++i) {
		std::cin >> x >> y;
		U.unite(x, y);
	}
	for (uint32 i = 0;i < n;++i) {
		Q[U.find(i)].push(c[i]);
	}
	uint64 cost = 0, node = 0;
	for (uint32 i = 0;i < n;++i) {
		if (r[U.find(i)]) continue;
		r[U.find(i)] = 1;
		++node;
		cost += Q[U.find(i)].top();
		Q[U.find(i)].pop();
		while (!Q[U.find(i)].empty()) {
			P.push(Q[U.find(i)].top());
			Q[U.find(i)].pop();
		}
	}
	if (node == 1) {
		std::cout << "0\n";
		return 0;
	}
	if (P.size() + 2 < node) {
		std::cout << "Impossible\n";
		return 0;
	}
	for (uint32 i = 2;i < node;++i) {
		cost += P.top();
		P.pop();
	}
	std::cout << cost << "\n";
	return 0;
}

Measured memory_bytes: 8832
N = int(input())
A, B = [], []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

AB = sorted([s+t for s,t in zip(A,B)], reverse=True)
su = sum(AB[::2])
print(su-sum(B))

Measured memory_bytes: 22080
#include<iostream>
using namespace std;
int main(){
char a[4],b[26];
int c[26]={0};
for(int i=0;i<26;i++)b[i]=i+'A';
for(int i=0;i<4;i++){
	a[i]=getchar();
	for(int j=0;j<26;j++){
		if(a[i]==b[j])c[j]++;
	}
}
int d=0;
for(int i=0;i<26;i++){
if(c[i]==2)d++;
}
if(d==2)cout<<"Yes\n";
else cout<<"No\n";
getchar();
} 

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

int main () {
  int N, M;
  cin >> N >> M;
  vector <int> day(M);
  int total = 0;
  for (int i = 0; i < M; i++){
    cin >> day.at(i);
    total += day.at(i);
  }
  if (total > N) cout << "-1" << endl;
  else cout << N-total << endl;
}


Measured memory_bytes: 3672
import java.util.*;
public class Main {
	public static void main(String... args) {
    	Scanner input = new Scanner(System.in);
        
        String str = input.next();
        
        int ans = 0;
        if (str.contains("RRR")) {
        	ans = 3;
        } else if (str.contains("RR")) {
        	ans = 2;
        } else if (str.contains("R")) {
        	ans = 1;
		}
        
        System.out.println(ans);
	}
}

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

void show(int A[],int N){
    for(int i = 0; i < N;i++){
        if(i > 0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

int main(){
    int N;
    cin >> N;
    int str[N];
    for(int i = 0; i < N; i++){
        cin >> str[i];
    }
    show(str,N);

    for(int i = 1; i < N; i++){
        int key = str[i];
        int j = i-1;
        while(j >= 0 && str[j] > key){
            str[j+1] = str[j];
            j--;
        }
        str[j+1] = key;
        show(str,N);
    }

        
        
}


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

using namespace std;

#define INF 1e+9
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#define se second
#define i64 long long
#define li long long
#define lint long long
#define pii pair<int, int>
#define vi vector<int>

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    //freopen("outp", "w", stdout);
#else
    // freopen(TASKNAME ".in", "r", stdin);
    // freopen(TASKNAME ".out", "w", stdout);
#endif
    int n;
    scanf("%d", &n);
    map<int, int> M;
    forn(i, n) {
        int x;
        scanf("%d", &x);
        M[x]++;
    }
    int m;
    scanf("%d", &m);
    forn(i, m) {
        int x;
        scanf("%d", &x);
        if (M[x] == 0) {
            printf("NO");
            exit(0);
        }
        M[x]--;
    }
    printf("YES");
}



Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>

using namespace std;

bool is_Prime(int p)
{
    if (p == 0 || p == 1)
        return false;
    else if (p == 2)
        return true;
    else if (p % 2 == 0)
        return false;
    for (int i = 3; i * i <= p; i += 2)
    {
        if (p % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int q;
    cin >> q;
    vector<int> l(q), r(q);
    for (int i = 0; i < q; i++)
    {
        cin >> l[i] >> r[i];
    }
    vector<int> car(1e5, 0);
    int num = 0;
    for (int i = 3; i < 1e5; i += 2)
    {
        if (is_Prime(i) && is_Prime((i + 1) / 2))
        {
            num++;
        }
        car[i] = num;
    }
    for (int i = 0; i < q; i++)
    {
        if(is_Prime(l[i]) && is_Prime((l[i]+1)/2)){
            cout << car[r[i]] - car[l[i]] + 1 << endl;
        }else{
            cout << car[r[i]] - car[l[i]] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll loe[10],ano[10],ple[10],d,n=1,o;
unsigned long long ans;
ll iabs(ll x)
{
	return x<0?-x:x;
}
ll dfs(ll use,ll rest)
{
	ll k=ple[(rest%10+10)%10];
	if(use<=0)
	{
		if(rest)
			return 0;
		else
			return 1+(o&1)*9;
	}
	if(abs(rest)/abs(use)>9)
		return 0;
	if(k)
		return ano[k]*dfs(use/100,(rest-k*use)/10)+ano[10-k]*dfs(use/100,(rest+(10-k)*use)/10);
	else
		return ano[0]*dfs(use/100,rest/10);
}
ll logi(ll use,ll rest)
{
	ll k=ple[(rest%10+10)%10];
	if(use<=0)
	{
		if(rest)
			return 0;
		else
			return 1+(o&1)*9;
	}
	//if(abs(rest)/abs(use)>9)
	//	return 0;
	if(k)
		return loe[k]*dfs(use/100,(rest-k*use)/10)+loe[10-k]*dfs(use/100,(rest+(10-k)*use)/10);
	else
		return loe[0]*dfs(use/100,rest/10);
}
int main(void)
{
	//freopen("data4.in","r",stdin);
	//freopen("data.out","w",stdout);
	ll t=1;
	//scanf("%lld",&t);
	for(ll i=0; i<9; i++)
		loe[i]=9-iabs(i);
	for(ll i=0; i<10; i++)
		ano[i]=10-iabs(i);
	for(ll i=0; i<10; i++)
		ple[i*9%10]=i;
	for(t=1;t<=1;t++)
	{
		o=0;
		ans=0;
		n=1;
		//if(t%2000000==0)
		//	cout<<t<<endl;
		//scanf("%lld",&d);
		scanf("%lld",&d);
		for(ll i=1; i<=18; i++)
		{
			o++;
			ans+=logi(n-1,d);
			n*=10;
		}
		//cout<<ans<<endl;
		//ans*=19260817;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int cnt[5];

int calc(int x,int num){
    int y=min(num,cnt[x])/x;
    cnt[x]-=y*x;
    return y*x;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H,W;
    cin>>H>>W;
    
    if(H%2&&W%2){
        cnt[2]+=W+H-2;
        cnt[1]+=1;
    }else if(H%2) cnt[2]+=W;
    else if(W%2) cnt[2]+=H;
    cnt[4]=H*W-cnt[2]-cnt[1];
    
    map<char,int> dic;
    rep(i,H)rep(j,W){
        char c; cin>>c;
        dic[c]++;
    }
    
    for(auto p:dic){
        int n=p.second;
        if(cnt[4]) n-=calc(4,n);
        if(cnt[2]) n-=calc(2,n);
        if(cnt[1]) n-=calc(1,n);
        if(n){
            cout1("No");
            return 0;
        }
    }
    cout1("Yes");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
  VAR(int, n, a, b);
	VEC(int, h, n);

	int diff = a - b;
	auto check = [=](int mid) {
		int left = mid;
		REP(i, n) {
			if (h[i] > mid * b) {
				int tmp = h[i] - mid * b;
				left -= (tmp + diff - 1) / diff;
			}
		}
		return left >= 0;
	};
	
	int ng = 0, ok = INF;
	while (ok - ng > 1) {
		int mid = (ng + ok) / 2;
		if (check(mid)) ok = mid;
		else ng = mid;
	}
	
	OUT(ok)BR;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char s[101],t[101];
cin >> s >> t;
int num = strlen(s);
int flg = -1;
char ss[202];
REP(i,num) {
  ss[i] = s[i];
  ss[i+num] = s[i];
}
int temp;
REP(i,num) {
  temp=0;
  REP(j,num) {
    if(ss[i+j]==t[j]) temp++;
  }
  if(temp==num) flg++;
}
if(flg==-1) {
  cout << "No" << endl;
} else {
  cout << "Yes" << endl;
}
return 0;
}


Measured memory_bytes: 256