akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <map>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

namespace Tarjan {
  const int MAXN = 200020;

  stack<int> S;
  vector<int> E[MAXN];
  int disc[MAXN];
  int comp_id[MAXN];
  bool stk[MAXN];
  int tick;

  int dfs(int x) {
    int lowlink = disc[x] = tick++;
    stk[x] = true;
    S.push(x);
    for (int y: E[x])
      if (!disc[y]) lowlink = min(lowlink, dfs(y)); else
        if (stk[y]) lowlink = min(lowlink, disc[y]);
    
    if (lowlink == disc[x]) {
      while (stk[x]) {
        comp_id[S.top()] = x;
        stk[S.top()] = false;
        S.pop();
      }
    }
    return lowlink;
  }
  
  void run(int n) {
    tick = 1;
    REP(i, n) disc[i] = 0;
    REP(i, n) if (!disc[i]) dfs(i);
  }
};

map<int, vector<int>> in, out;

int deg(int x) {
  return (int)in[x].size() - (int)out[x].size();
}

void done(int x) {
  printf("%d\n", x);
  exit(0);
}
  
int main(void) {
  int n;
  scanf("%d", &n);

  vector<int> a(n), b(n);
  REP(i, n) scanf("%d", &a[i]);
  REP(i, n) scanf("%d", &b[i]);

  int x = 0;
  REP(i, n) x ^= a[i];

  REP(i, n) {
    if (a[i] != b[i]) {
      out[b[i]].push_back(a[i]);
      in[a[i]].push_back(b[i]);
    }
  }

  vector<int> all;
  REP(i, n) for (int x: {a[i], b[i]}) {
    if (in[x].size() || out[x].size()) {
      all.push_back(x);
    }
  }

  int ret = 0;
  if (deg(x) == -1) {
    int y = -1;
    for (int i: all) {
      if (deg(i) == +1) {
        y = i;
        break;
      }
    }

    if (y == -1) done(-1);
    for (int i: all) {
      if (x != i && y != i && deg(i) != 0) done(-1);
    }

    out[y].push_back(x);
    ret -= 2;
  } else {
    if (out[x].size()) {
      ret--;
    }
    for (int i: all) {
      if (deg(i) != 0) done(-1);
    }
  }
  
  sort(all.begin(), all.end());
  all.erase(unique(all.begin(), all.end()), all.end());

  map<int, int> ind;
  int N = all.size();
  REP(i, N) ind[all[i]] = i;

  REP(i, N) {
    int x = all[i];
    for (int y: out[x]) {
      Tarjan::E[i].push_back(ind[y]);
    }
  }

  
  Tarjan::run(N);

  set<int> comp_ids;
  REP(i, N) {
    comp_ids.insert(Tarjan::comp_id[i]);
  }


  REP(i, N) {
    int x = all[i];
    for (int y: out[x]) {
      if (Tarjan::comp_id[i] != Tarjan::comp_id[ind[y]]) {
        done(-1);
      }
    }
  }

  
  ret += comp_ids.size();
  REP(i, N) ret += out[all[i]].size();
  done(ret);
  return 0;
}


Measured memory_bytes: 42228
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

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

/*
* Binary Indexed Tree & counting inversion
* last checked : 2020/4/10
*/
template<class T> struct BIT{
    static const int MAX_N = 500050;
    T dat[MAX_N + 1];
    int n;
    //////////////////////////////////////
    //[1,n] : 1-indexedに注意！
    T sum(int i){
        T res = 0;
        while(i > 0){
            res += dat[i];
            i -= i & -i;
        }
        return res;
    }
    void add(int i,T x){
        while(i <= MAX_N){
            dat[i] += x;
            i += i & -i;
        }
    }
};
template<class T> long long inversion(vector<T>& a){
    BIT<T> bit;
    long long res = 0;
    int n = a.size();
    for(int i = 0;i < n;i++){
        // a[i]を追加する前にBITにはi個の要素が存在する
        res += i - bit.sum(a[i]);//[1,a[i]]にある1の個数は転倒数に寄与しない
        bit.add(a[i],1);
    }
    return res;
}

template<class T> void output(vector<T>& ans){
    int sz = ans.size();
    for(int i = 0;i < sz;i++)cout << ans[i] << (i < sz - 1 ? ' ' : '\n');
}

int n;
string s;
int query;
BIT<int> bit[26];
void main2(void){
    cin >> n >> s >> query;
    for (int i = 0; i < n; ++i)
    {
        bit[s[i] - 'a'].add(i+1,1);
    }
    rep(_,query){
        int c;cin >> c; 
        if(c == 1){
            int id;cin >> id;
            char x;cin >> x;
            bit[s[id - 1] - 'a'].add(id,-1);
            s[id - 1] = x;
            bit[s[id - 1] - 'a'].add(id,1);
        }else{
            int l,r;cin >> l >> r;
            int ans = 0;
            for (int j = 0; j < 26; ++j)
            {
                ans += (bit[j].sum(r) - bit[j].sum(l-1) > 0);
            }
            cout << ans << '\n';
        }
    } 
}
/*
 * シングルテストケースの時はcin >> testをコメントアウト忘れない！！
 * */
int main(void){
    cin.tie(0);ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int test = 1;
//    cin >> test;
    for(int i = 0;i < test;i++){
        main2();
    }
}



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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;

  // fグラム以下の水の組み合わせを全列挙する
  set<int> water;
  for (int i = 0; a * i * 100 <= f; i++)
    for (int j = 0; b * j * 100 <= f; j++)
      if (i + j != 0 && 100 * (a * i + b * j) <= f)
        water.insert(100 * (a * i + b * j));

  pair<int, int> ans = {100, -1};
  for (auto w : water) {
    int limit = w / 100 * e;
    int res = 0;
    // 砂糖の入れ方を模索する
    for (int i = 0; w + c * i <= f; i++)
      for (int j = 0; w + d * j <= f; j++)
        if (c * i + d * j <= limit && w + c * i + d * j <= f)
          res = max(res, c * i + d * j);

    if ((double)ans.second / ans.first < (double)res / w)
      ans = {w, res};
  }
  cout << ans.first + ans.second << " " << ans.second << endl;
}


Measured memory_bytes: 256
i=1
while i<5:
     t_i,n_i=map(int,input().split())
     if t_i==1:a=n_i*6000
     if t_i==2:a=n_i*4000
     if t_i==3:a=n_i*3000
     if t_i==4:a=n_i*2000
     print(a)
     i=i+1


Measured memory_bytes: 5596
/*************************************************************************

**  **  **  ****   ****    ******   **    **  **     **   **   **   **              
** **   **  ** ** ** **   **     *  **    **  **   *    *    *    *    *
****    **  **   *   **   **        ********  **   *         *         *
****    **  **       **   **        ********  **     *     *   *     *
** **   **  **       **   **     *  **    **  **        *         *
**  **  **  **       **    ******   **    **  **  ***********************      

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

#include<bits/stdc++.h>

using namespace std;

typedef pair <long,long> ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    map <int,int> her;
    int s, i = 2;
    cin >> s;
    long Chi[234567];
    Chi[1] = s;
    her[Chi[1]]= 1;
    while (true){
        long x = Chi[i-1];
        Chi[i] = (x % 2 == 0) ? (x/2):(3*x+1);
        ++her[Chi[i]];
        if (her[Chi[i]] == 2) {cout << i; break;}
        ++i;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>

char c,a[5]={'a','e','i','o','u'};

int main(void){
	register int i;
	c=getchar();
	for(i=0;i<5;++i)
		if(c==a[i])
			return puts("vowel"),0;
	puts("consonant");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define sz(v) (ll)v.size()
#define inf 100000000000000
#define vll vector<ll>
#define pll pair<ll,ll>nnnn
using namespace std;
const int N=200004;

void solve()
{
	ll k,a,b,ans;
	cin>>k>>a>>b;
	if(b-a<=2)
	{
		cout<<1+k;
		return;
	}
	if(k<a-1)
	{
		cout<<k+1;
		return;
	}
	k-=(a-1);
	ans=a;
	ans+=(k/2)*(b-a);
	ans+=k%2;
	cout<<ans;

}
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
#define ms(a, x) memset(a, x, sizeof(a))
#define fore(i, a, n) for (long long i = a; i < n; i++)
#define ford(i, a, n) for (long long i = n - 1; i >= a; i--)
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define debug(a) cout << a << endl
#define endl '\n'
#define pi acos(-1.0)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define IO ios::sync_with_stdio(false), cin.tie(0)
const double eps = 1e-8;
inline int sgn(const double &x) { return x < -eps ? -1 : x > eps; }
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn=100005;

//=================================================
int n,W;
int w[maxn];
ll dp[maxn];
int v[maxn];
void init() {
    for(int i=0;i<=n;i++){
        w[i]=0;
        v[i]=0;
        dp[i]=0;
    }
}
int main() {
    IO;
    cin>>n>>W;
    init();
    for(int i=1;i<=n;i++){
        cin>>w[i]>>v[i];
    }
    for(int i=1;i<=n;i++) {
        for(int j=W;j>=w[i];j--) {
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
        }
    }
    cout<<dp[W]<<endl;

    return 0;
}

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

using namespace std;

int solve(int h, int n, vector<int> &a, vector<int> &b, vector<int> &f) {
    if (h <= 0) return 0;
    if (f[h] != -1) return f[h];
    int res = 1e9;
    for (int i = 0; i < n; ++i) {
        res = min(res, solve(h - a[i], n, a, b, f) + b[i]);
    }
    f[h] = res;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h, n;
    cin >> h >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
    vector<int> f(h + 1, -1);
    cout << solve(h, n, a, b, f) << endl;
    return 0;
}



Measured memory_bytes: 1280
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int b[30],c[15];

int main(void){

	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int N,i,j;
	string s;
	cin >> N >> s;
	for(i=0;i<N;i++){
		if(s[i]=='+') continue;
		b[s[i]-'a']++;
	}

	if(N==1){
		cout << 1 << endl;
		return 0;
	}

	for(i=1;i<=9;i++){
		for(j=0;j<26;j++){
			if(b[j]==i) c[i]++;
		}
	}

	int ans=0,p=-1;
	for(i=1;i<=9;i++){
		if(c[i]==0) continue;
		if(i==1){
			ans+=2*c[i];
		}
		else{
			p++;
			if(c[i]==1) ans+=3;
			else ans+=2*c[i]+3;
		}
	}

	ans+=p;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1212
while True:
	n = int(raw_input())
	if n == 0:
		break
	a = [map(int, raw_input().split()) for i in xrange(n)]
	a = [l + [sum(l)] for l in a]
	a.append([sum([l[i] for l in a]) for i in xrange(len(a[0]))])
	print "\n".join(["".join([str(i).rjust(5) for i in l]) for l in a])

Measured memory_bytes: 4224
/**
*    author:  souzai32
*    created: 07.08.2020 18:29:54
**/

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

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(),a.end());
    bool ans=false;

    if(a.at(n-1)==0) ans=true;
    if(n%3==0){
        if(a.at(0)==a.at(n/3-1) && a.at(n/3)==a.at(2*n/3-1) && a.at(2*n/3)==a.at(n-1)){
            int x=a.at(0),y=a.at(n/3),z=a.at(2*n/3);
            ans=true;
            while(x>0||y>0||z>0){
                if((x%2+y%2+z%2)%2){
                    ans=false;
                    break;
                }
                else{
                    x/=2;
                    y/=2;
                    z/=2;
                }
            }
        }
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
int main(void){
   string S;
   cin >> S;
   std::string str = S;
   int N = str.size();
   int an = 0;
   for (int i = 0; i < N / 2; i++){
       if (str[i] != str[N - i -1]){
           an = 1;
           break;
       }
   }
   int M = N / 2;
   for (int i = 0; i < M / 2; i++){
       if (str[i] != str[M - i - 1]){
           an = 1;
           break;
       }
   }
   for (int i = M + 1; i < N - M; i++){
       if (str[i] != str[N - i]){
           an = 1;
           break;
       }
   }
   
   if (an == 1){
       cout << "No" << endl;
   }else{
       cout << "Yes" << endl;
   }
}


Measured memory_bytes: 256
#include <algorithm> 
#include <iostream> 
using namespace std; 
int main(){
int x,y,z;
cin>>x>>y>>z;
int a,b;
a=x-y;
b=x-z;
if(a<0){
a=a*-1;
}
if(b<0){
b=b*-1;
}
if(a>b){
cout<<"B"<<endl;
}else{
cout<<"A"<<endl;
}
}

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

int main(){
int n;
  cin >> n;
  vector<long long int>A(999991,0);
  long long int ans = 0;
  for(int i = 0; i < n; i++){
   int a;
    cin >> a;
    A[a]+=1;
    ans+=a;
  }
  int q;
  cin >> q;
  for(int i = 0; i < q; i++){
   int  b,c;
    cin >> b >> c;
   	ans -= b*A[b];
    ans += c*A[b];
    A[c] += A[b];
    A[b] = 0;
    cout << ans << endl;
  }
}

Measured memory_bytes: 11176
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> x(n, 0);
    rep(i, n) cin >> x[i];
    
    int ans = 1<<30;
    repr(i, 1, 101) {
        int tmp = 0;
        rep(j, n) tmp += (x[j] - i) * (x[j] - i);
        chmin(ans, tmp);
    }
    cout << ans << endl;
    
    return 0;
}

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

int main(){
	int a, b;
	cin >> a >> b;
	cout << max(a+b, max(a-b, a*b)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == ','){
            s[i] = ' ';
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../trace.h"
#else
#define trace(args...)
#endif

int add(int a, int b) {int res = a + b;if (res >= MOD)return res - MOD;return res;}
int mul(int a, int b) {long long res = a;res *= b;if (res >= MOD)return res % MOD;return res;}
int sub(int a, int b) {int res = a - b;if(res < 0)return res + MOD;return res;}
int modpow(ll a, ll b) {a %= MOD; int res = 1; while (b) {if (b & 1)res = mul(res, a); a = mul(a, a); b >>= 1;} return res;}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
int modinv(ll a) {return modpow(a, MOD - 2);}

pll simplify(ll a, ll b){
	ll g = __gcd(a, b);
	if(b > 0 && g < 0) g *= -1;
	if(b < 0 && g > 0) g *= -1;
	a /= g;
	b /= g;
	pll ret = {a, b};
	return ret;
}
void solve() {
	int n;
	cin >> n;
	ll a, b;
	map<pll,int> cnt;
	int ans = 1, x1 = 0, x2 = 0, zeros = 0;
	forn(i, n){
		cin >> a >> b;
		if(a == 0 && b == 0){
			zeros++;
		}else if(a == 0){
			x1++;
		}else if(b == 0){
			x2++;
		}else{
			cnt[simplify(a, b)]++;
		}
	}
	int tik = 0;
	tik = sub(add(modpow(2, x1), modpow(2, x2)), 1);
	ans = mul(ans, tik);
	trav(elem, cnt){
		x1 = elem.S;
		x2 = cnt[simplify(-elem.F.S, elem.F.F)];
		tik = sub(add(modpow(2, x1), modpow(2, x2)), 1);
		ans = mul(ans, tik);
		cnt.erase(simplify(-elem.F.S, elem.F.F));
	}
	ans = add(ans, zeros);
	ans = sub(ans, 1);
	cout << ans;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


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

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  
  int x3, y3, x4, y4;
  if(y1<y2) x3 = x2-abs(y1-y2);
  else x3 = x2+abs(y1-y2);
  if(x1<x2) y3 = y2+abs(x1-x2);
  else y3 = y2-abs(x1-x2);
  if(x1<x2) x4 = x3-abs(x1-x2);
  else x4 = x3+abs(x1-x2);
  if(y1<y2) y4 = y3-abs(y1-y2);
  else y4 = y3+abs(y1-y2);
  
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
 }

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();

            if (H == 0 && W == 0) {
                break;
            }

            if (W != 1) {
                for (int i = 0; i < H; i++) {
                    System.out.print("#");

                    for (int j = 0; j < W - 2; j++) {
                        if (i == 0 || i == H - 1) {
                            System.out.print("#");
                        } else {
                            System.out.print(".");
                        }
                    }

                    System.out.print("#\n");
                }

                System.out.print("\n");
            } else {
                for(int i = 0; i < H; i++) {
                    System.out.print("#\n");
                }

                System.out.print("\n");
            }
        }
    }
}


Measured memory_bytes: 36108
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdio.h>
#include <set>
#include <vector>
using namespace std;

int main(){
    string w;
    cin>>w;
    int str[26];
    int i;
    for(i=0; i<26; i++){
        str[i] = 0;
    }
    for(auto j:w){
        str[j-'a']++;
    }
    int ans = 0;
    for(i=0; i<26; i++){
        if(str[i]%2==1){
            ans++;
        }
    }
    if(ans>0){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)
a = [0] * n
p,q,span = 0,0,0

for i in range(n):
    if s[i] == "R":
        span += 1
        if s[i+1] == "R":
            a[i] = 0
            if span % 2 == 1:
                p += 1
            else:
                q += 1
        else:
            if span % 2 == 1:
                a[i] += p+1
                a[i+1] += q
            else:
                a[i] += q+1
                a[i+1] += p
            p = 0
            q = 0
            span = 0
    else:
        p = 0
        q = 0
        span = 0

for i in range(n-1, -1, -1):
    if s[i] == "L":
        span += 1
        if s[i-1] == "L":
            a[i] = 0
            if span % 2 == 1:
                p += 1
            else:
                q += 1
        else:
            if span % 2 == 1:
                a[i-1] += q
                a[i] += p+1
            else:
                a[i-1] += p
                a[i] += q+1
            p = 0
            q = 0
            span = 0
    else:
        p = 0
        q = 0
        span = 0

for i in range(n):
    if i < n-1:
        print(a[i], end=' ')
    if i == n-1:
        print(a[i])

Measured memory_bytes: 4984
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

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

void test() {
    int x;
    cin >> x;
    cout << (x ^ 1) << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef HOME
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        test();
    }
    return 0;
}


Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(10**7)
def dfs(i):
    w=b=1
    for j in e[i]:
        if j in d:continue
        d.add(j)
        x,y=dfs(j)
        w*=x+y
        b*=x
    return w%M,b%M
M=10**9+7
n,*t=map(int,open(0).read().split())
e=[[]for _ in range(n)]
for x,y in zip(*[iter(t)]*2):
    e[x-1]+=y-1,
    e[y-1]+=x-1,
d={0}
print(sum(dfs(0))%M)

Measured memory_bytes: 215824
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    iterator.next().unwrap().replace("2017", "2018")
}


Measured memory_bytes: 2116
#pragma GCC optimize("Ofast")
#include<stdio.h>
int x;
char c;
inline int read()
{
	x=0; c=getchar();
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return x;
}
int main(void)
{
	long n = read() + 1, ans = n - 1;
	for (int i = 2; i < n; ++i)
	{
        int u = read(), v = read();
        switch(u > v)
        {
            case true: ans += i * (n - i) - v * (n - u); break;
            default: ans += i * (n - i) - u * (n - v);
        }
        
	}
	printf("%ld", ans);
  
    return 0;
}


Measured memory_bytes: 1588
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

bool check(const vector<ll> &a) {
    int n = a.size();
    vector<bool> b(n);
    if (a[0]==0) b[0] = true;
    else b[0] = false;
    rep(i,n-1) {
        if (a[i] == a[i+1]-1) b[i+1] = b[i];
        else b[i+1] = false;
    }

    bool ret = true;
    bool sm = true;
    for (int i = n-1; i >= 1; --i) {
        if (a[i] <= a[i-1]) sm = false;
        else sm = true;
        if (sm) if (a[i]-1!=a[i-1]) ret = false;
    }

    for (int i = n-1; i >= 0; --i) {
        if (i-a[i] > 0) continue;
        else if (i-a[i] < 0) ret = false;
        else {
            if (!b[i]) ret = false;
        }
    }

    return ret;
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];

    if (!check(a)) {
        cout << -1 << endl;
        return 0;
    }

    ll ans = 0;
    ll ma = a[n-1];
    for (int i = n-1; i >= 1; --i) {
        if (a[i] <= a[i-1]) {
            ans += ma;
            ma = a[i-1];
        }
    }

    ans += ma;

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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 main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  // ll n, m;
  // cin >> n >> m;
  ll n, m, k;
  cin >> n >> m >> k;
  if(k == 0) {
    cout << "Yes\n";
    return 0;
  }
  fi(0, n)
    fj(0, m) {
      if(i * j + (n - i) * (m - j) == k) {
        cout << "Yes\n";
        return 0;
      }
    }
  cout << "No\n";
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#D
from fractions import gcd

n,m = [int(i) for i in input().split()]
a   = [int(i) for i in input().split()]

ans = 0
#if some element in a is odd, it cannot be divided by 2
for v in a:
    if v%2 != 0:
        break
else:
    a = [i//2 for i in a]
    
    #check whether each element has the same power of 2
    elem = 0
    v = a[0]
    while(v%2==0):
        v //= 2
        elem += 1
    for v in a[1:]:
        now=0
        while(v%2==0):
            v //= 2
            now += 1
        if(elem != now):
            ans = 0
            break
    else:
        #calculate its lcm by using gcd
        lcm = 1
        for v in a:
            lcm = (lcm * v)//gcd(lcm, v)
        
        q = m //lcm
        ans = (q+1)//2

print(ans)
    

Measured memory_bytes: 16320
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef struct {
	int m[6];
} Dice;

Dice d[2];
int q, up, fr;
string s = "NNENN", w = "HHHH";

void roll(char c, Dice *d) {
	switch (c) {
	case 'N':
		swap(d->m[0], d->m[1]);
		swap(d->m[1], d->m[5]);
		swap(d->m[5], d->m[4]);
		break;
	case 'S':
		swap(d->m[0], d->m[4]);
		swap(d->m[4], d->m[5]);
		swap(d->m[5], d->m[1]);
		break;
	case 'E':
		swap(d->m[0], d->m[3]);
		swap(d->m[3], d->m[5]);
		swap(d->m[5], d->m[2]);
		break;
	case 'W':
		swap(d->m[0], d->m[2]);
		swap(d->m[2], d->m[5]);
		swap(d->m[5], d->m[3]);
		break;
	case 'H':
		swap(d->m[1], d->m[2]);
		swap(d->m[2], d->m[4]);
		swap(d->m[4], d->m[3]);
		break;
	}
}
void find(Dice *d) {
	for (unsigned i = 0; i < s.size() + 1; i++) {
		for (unsigned j = 0; j < w.size(); j++) {
			if (d->m[0] == up && d->m[1] == fr) return;
			roll(w[j], d);
		}
		if(i < s.size()) roll(s[i], d);
	}
}
int main() {
	for (int i = 0; i < 2; i++) for (int j = 0; j < 6; j++) cin >> d[i].m[j];
	up = d[1].m[0], fr = d[1].m[1];
	find(&d[0]);
	for (int i = 0; i < 6; i++)
		if (d[0].m[i] != d[1].m[i]) {
			cout << "No" << endl;
			return 0;
		}
	cout << "Yes" << endl;
}


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

const int N = 200005;
const int A = 1000005;

const int MOD = 998244353;

int n;

long long sum[A];
long long sum2[A];
long long inv[A];
vector<int> divisors[A];

int power(int x, int y) {
  int ret = 1;
  for (; y; y >>= 1) {
    if (y & 1) ret = 1LL * ret * x % MOD;
    x = 1LL * x * x % MOD;
  }

  return ret;
}

int main() {
  clock_t t = clock();
  for (int i = 2; i < A; ++i) {
    for (int j = i; j < A; j += i) {
      divisors[j].push_back(i);
    }
  }
  // cerr << (clock() - t) / CLOCKS_PER_SEC << endl;

  inv[1] = 1;
  for (int i = 2; i < A; ++i)
    inv[i] = MOD - (MOD/i) * inv[MOD%i] % MOD;
  
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    for (int d: divisors[a]) {
      sum2[d] = (sum[d] * a + sum2[d]) % MOD;
      (sum[d] += a) %= MOD;
    }
    sum2[1] = (sum[1] * a + sum2[1]) % MOD;
    (sum[1] += a) %= MOD;
  }

  int ans = 0;
  for (int i = A-1; i > 0; --i) {
    for (int j = i*2; j < A; j += i) {
      sum2[i] -= sum2[j];
      if (sum2[i] < 0) sum2[i] += MOD;
    }

    ans = (sum2[i] * inv[i] + ans) % MOD;
  }

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

Measured memory_bytes: 134272
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X,Y,Z;cin>>X>>Y>>Z;
  cout << (X-Z)/(Y+Z)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct edge{
    vector<int> to;
    int c;
};

int main() {
    int n, m; cin >> n >> m;
    vector<edge> ar(n);
    rep(i,m){
        int a, b; cin >> a >> b;
        ar[a-1].to.emplace_back(b-1);
        ar[b-1].to.emplace_back(a-1);
    }
    rep(i,n) ar[i].c = -1;
    ar[0].c = 1;
    queue<int> q;
    q.push(0);
    while (!q.empty()){
        int x = q.front(); q.pop();
        rep(i,ar[x].to.size()){
            if (ar[ar[x].to[i]].c == -1){
                ar[ar[x].to[i]].c = x;
                q.push(ar[x].to[i]);
            }
        }
    }
    cout << "Yes" << endl;
    repp(i,n,1) cout << ar[i].c +1 << endl;
}

Measured memory_bytes: 10548
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int n;

vector<LL> a;

int main() {
    GI(n);

    a.resize(n);

    FORN(i, n) {
        GLL(a[i]);
    }

    sort(a.begin(), a.end());

    LL best = 0;
    LL bestval = 0;

    for (int i = 0; i < n-1; i++) {
        if (a[i] * (a[n-1] - a[i]) > best) {
            best = a[i] * (a[n-1] - a[i]);
            bestval = a[i];
        }
    }

    printf("%lld %lld\n", a[n-1], bestval);

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int K = sc.nextInt();
        int Q = sc.nextInt();
        int[] A = new int[Q];
        int[] cnt = new int[N];
        for(int i = 0; i < Q; i++){
            A[i] = sc.nextInt();
            cnt[A[i]-1]++;
        }
        sc.close();

        for(int i = 0; i < N; i++){
            if(K-(Q-cnt[i]) > 0)
                System.out.println("Yes");
            else
                System.out.println("No");
        }


    }
}

Measured memory_bytes: 59776
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};

typedef struct node  *Node;

Node root;

Node treeMinimum(Node x){

}

Node treeMaximum(Node x){

}

Node treeSearch(Node u, int k){}

Node treeSuccessor(Node x){}

void treeDelete(Node z){
  Node y;
  Node x;
}

void insert(int k){
  Node y=NIL;
  Node x=root;
  Node z;

  z=malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key) x=x->left;
    else if(z->key > x->key) x=x->right;
    else break;
  }
  z->parent=y;
  if(y==NIL) root=z;
  else{
    if(z->key < y->key) y->left=z;
    else if(z->key > y->key) y->right=z;
  }
}

void inorder(Node u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char com[20];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='f'){
      scanf("%d",&x);
      Node t=treeSearch(root,x);
      if(t!=NIL) printf("yes\n");
      else printf("no\n");
    }
     else if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    } else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(com[0]=='d'){
      scanf("%d",&x);
      treeDelete(treeSearch(root,x));
        }

  }

  return 0;
}



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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define MOD (long)(1e9 + 7)

long long modPow(int x, int n){
  if(n == 0) return 1;
  if(n % 2 == 0) {
    long long sqrtX = modPow(x,n/2);
    return sqrtX * sqrtX % MOD ;
  }else{
    return x * modPow(x,n-1) % MOD;
  }
}

long long kaizyou(long long x){
  long long res = 1;
  for(int i = 1; i <= x; i++){
    res = (res * i) % MOD;
  }
  return res;
}

long long modCombi(long long a, long long b){
  if(b > a/2) return modCombi(a,a-b);
  return ((kaizyou(a) * modPow(kaizyou(b),MOD - 2)) % MOD)* modPow(kaizyou(a-b),MOD - 2) % MOD;
}
ll H(ll n, ll r){
  return modCombi(n+r-1,r);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin >> n >> k;
  FOR(i,1,k+1){
    ll ans = 0;
    ll kugiri = i - 1;
    ll aka = n - k;
    if(aka >= kugiri){
      ans  =  H(i,k-i);
      ans *=  H(kugiri+2,aka-kugiri);
      ans %= MOD;
    }else{
      ans = 0;
    }

    //cout << (i,kugiri-1) << " " << H(aka,2+kugiri) << endl;
    //cout << "                      " <<  modPow(i,k-i) << " * " << modCombi(2+kugiri,aka) << endl;
    cout << ans << endl;
  }

  return 0;
}


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

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

        String str = scan.next();

        long num = Long.parseLong(str);
        num--;

        ArrayList<Long> list = new ArrayList<>();

        while (true) {
            list.add(0, num % 26);
            if (num / 26 == 0) break;
            else {
                num /= 26;
                num--;
            }
        }

        for (long i : list) {
            System.out.print((char)(i + 'a'));
        }
        System.out.println();
    }
}


Measured memory_bytes: 35520
package main

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

func main() {
	n := readInt()
	x := readInt()
	d := 0
	ans := 1
	for i := 0; i < n; i++ {
		l := readInt()
		d += l
		if d > x {
			break
		}
		ans++
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
n,k,t,u,v,l,*d=map(int,open(0).read().split())
ans = d[0]/u
fin = d[0]
fastend = d[0] + v*t
stack = 0
for now in d[1:]:
    while stack and fastend < now:
        ans += (fastend - fin)/v
        fin = fastend
        fastend += v*t
        stack -=1
    if fastend < now:
        ans += (fastend - fin)/v + (now - fastend)/u
        fin = now
        fastend = now + v*t
    elif fastend == now:
        ans += (fastend - fin)/v
        fin = now
        fastend = now + v*t
    elif stack == k:
        ans += (now - fin)/v
        fin = now
        fastend = now + v*t
    else:
        stack += 1
while stack and fastend <= l:
    ans += (fastend - fin)/v
    fin = fastend
    fastend += v*t
    stack -= 1
if fastend > l:
    print(ans + (l - fin)/v)
else:
    ans += (fastend - fin)/v
    fin = fastend
    print(ans + (l - fin)/u)


Measured memory_bytes: 5620
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Kenji
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC091A solver = new ABC091A();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC091A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();
            if (A + B >= C) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }
}



Measured memory_bytes: 23636
#include<iostream>
#include<string>
using namespace std;
int main()
{
	
	string in;
	while(cin>>in)
	{
		int num[10];
		for(int i = 0; i < 10; ++i)
		{
			num[i]=in[i]-'0';
		}

		for(int i = 9; 0 <= i; --i)
		{
			for(int j = 0; j < i; ++j)
			{
				num[j]=(num[j]+num[j+1])%10;
			}
		}
		cout<<num[0]<<endl;
	}
  return 0;
}

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

const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int l[20],r[20];
ll dp[300000],sdp[300000];

int main(){
	int n,K;cin>>n>>K;
	rep(i,K){
		scanf("%d%d",&l[i],&r[i]);
	}
	dp[0]=1;sdp[1]=1;
	for(int i=1;i<n;i++){
		rep(j,K){
			(dp[i]+=(sdp[max(0,i-l[j]+1)]+MOD-sdp[max(0,i-r[j])]))%=MOD;
		}
		//~ cout<<i<<' '<<dp[i]<<endl;
		sdp[i+1]=(sdp[i]+dp[i])%MOD;
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 6792
import math

N, M = map(int, input().split())

if N > 1:
	cN = math.factorial(N) // (2 * math.factorial(N - 2))
else:
	cN = 0

if M > 1:
	cM = math.factorial(M) // (2 * math.factorial(M - 2))
else:
	cM = 0

print(cN + cM)

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

bool Solve(int a){
  if(a==2) return true;
  for(int i=2;i<a;i++){
    if(a%i==0) return false;
  }
  return true;
}

int main(){
  int X;
  cin>>X;
  while(!Solve(X)){
    X++;
  }
  cout<<X<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

int main() {
    int N, M; cin >> N >> M;
    vi A(M), B(M); rep(i, M) { cin >> A[i] >> B[i]; A[i]--; B[i]--; }

    vector<vi> G(N);
    rep(i, M) {
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    queue<int> q;
    vi dist(N, INF);
    vi pre(N, -1);

    dist[0] = 0;
    q.push(0);

    while (!q.empty()) {
        int p = q.front(); q.pop();
        rep(i, G[p].size()) {
            int a = G[p][i];
            if (dist[a] != INF) continue;
            q.push(a);
            dist[a] = dist[p] + 1;
            pre[a] = p;
        }
    }

    cout << "Yes" << endl;
    for (int i = 1; i < N; i++) {
        cout << (pre[i] + 1) << endl;
    }
}


Measured memory_bytes: 12244
///
// File:  alds1_4_b.cpp
// Author: ymiyamoto
//
// Created on Sat Oct  7 19:10:25 2017
//

#include <cstdint>
#include <iostream>
#include <vector>
using namespace std;

static vector<int64_t> S;

bool binary_search(int64_t val)
{
  uint64_t left = 0;
  uint64_t right = S.size();
  while (left + 1 <= right) {
    uint64_t mid = (left + right) / 2;
    if (S[mid] == val) {
      return true;
    } else if (val < S[mid]) {
      right = mid;
    } else {
      left = mid + 1;
    }
  }

  return false;
}

int32_t main()
{
  uint32_t n, q;
  cin >> n;

  for (uint32_t i = 0; i < n; i++) {
    int64_t val;
    cin >> val;
    S.push_back(val);
  }

  uint64_t count = 0;
  cin >> q;
  for (uint32_t i = 0; i < q; i++) {
    int64_t val;
    cin >> val;
    if (binary_search(val)) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
void s(){
  int N;
  cin>>N;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin>>a[i];
  }

  int check = 1;
  int keep = 0;
  for(int i=0; i<N; i++){
    if(a[i] == check){
      keep++;
      check++;
    }
  }

  cout<<N-keep<<endl;
}

void t(){
  int N, a;
  cin>>N;
  int check = 1;
  int keep = 0;
  for(int i=0; i<N; i++){
    cin>>a;
    if(a == check){
      keep++;
      check++;
    }
  }
  if(keep==0)keep=N+1;
  cout<<N-keep<<endl;
}

int main(){
  t();
  return 0;
}

Measured memory_bytes: 256