akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop_b pop_back
#define pf push_front
#define pop_f pop_front
#define mt make_tuple
#define eb emplace_back
#define sf(x) sizeof(x)
#define len(x) x.length()
#define sz(x) x.size()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld; 
typedef vector<int> vi;
typedef vector<set<ll>> vset;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef deque<ll> dql;
typedef deque<int> dqi;
typedef unsigned long long ull;
typedef tuple<int,int,int> State;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define vmax(type)   std::numeric_limits<type>::max()
#define vmin(type)   std::numeric_limits<type>::min()
#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define cinai(a, n) vi a(n); rep(i, n) { cin>>a[i]; }
#define cinal(a, n) vl a(n); rep(i, n) { cin>>a[i]; }
#define coutai(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define coutal(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define ent cout<<endl;
#define resize_vec(a) a.resize(unique(a.begin(), a.end()) - a.begin());
#define ms(dp, x) memset(dp, x, sf(dp))
#define endl '\n'

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

const ll mod = 1e9 + 7;
const ll N = 1000005;
const ll inf = 1e9;

void solve()
{
	int n;
	cin>>n;
	if(30 <= n)
		cout<<"Yes\n";
	else	
		cout<<"No\n";
}

// #define _DEBUG 
// #define testCases
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	
	int tc = 1;
#ifdef testCases
	cin>>tc;
#endif
	while(tc--)
	{
#ifdef _DEBUG
	int tt = clock();
#endif
		solve();
		
#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	return 0;
}



Measured memory_bytes: 3636
def add(B,a,n):#リストに値を追加する関数
    x = a
    while x <= n:
        B[x] += 1
        x += x&(-x)

def sums(B,a):#a番目までの和
    x = a
    S = 0
    while x != 0:
        S += B[x]
        x -= x&(-x)
    return S


def invnumber(n, S):# #{(i,j)| i<j and S[i]<=S[j]}
    B = [0]*(n*2 + 1)
    invs = 0
    for i in range(n):
        s = S[i] + n
        invs += sums(B, s)
        add(B, s, n*2)
    return invs

N = int( input())
A = list( map( int, input().split()))
R = max(A)+1
L = 0
c = (N*(N+1)//2 + 1)//2
while R - L > 1:
    M = (R+L)//2
    S = [0]*(N+1)
    for i in range(1,N+1):
        if A[i-1] >= M:
            S[i] = S[i-1] + 1
        else:
            S[i] = S[i-1] - 1
    if invnumber(N+1,S) >= c:
        L = M
    else:
        R = M
print(L)


Measured memory_bytes: 118600
n = list(input())
m = len(n)
for i in range(m):
    n[i] = int(n[i])
ans = 0
kuri = 0
for i in range(m-1,-1,-1):
    n[i] += kuri
    kuri = 0
    #print(n[i])
    if n[i] > 5:
        ans += 10 - n[i]
        kuri = 1
    elif n[i] == 5:
        if i > 0:
            if n[i-1] >= 5:
                kuri = 1
                ans += 5
            else:
                kuri = 0
                ans += 5
        else:
            ans += 5
    else:
        ans += n[i]
if kuri == 1:
    ans += 1
print(ans)

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define MAX 1010
#define MOD 10007
using namespace std;

int person[MAX],dp[MAX][(1<<3)];

int main()
{
  int N;
  string line;
  cin >> N;
  cin >> line;

  rep(i,N)person[i+1] = ((line[i]=='J')?0:((line[i]=='O')?1:2));
  rep(i,N)rep(j,(1<<3))dp[i][j] = 0;
  dp[0][1] = 1;

  rep(day,N)
    {
      rep(state,(1<<3))
	{
	  if(dp[day][state] == 0)continue;
	  rep(nstate,(1<<3))
	    {
	      if(!( (nstate>>person[day+1]) & 1 ))continue;
	      bool ok = false;
	      rep(i,3)
		{
		  if(((state>>i) & 1) && ((nstate>>i) & 1))
		    {
		      ok = true;
		      break;
		    }
		}
	      if(!ok)continue;
	      dp[day+1][nstate] = (dp[day+1][nstate] + dp[day][state]) % MOD;
	    }
	}
    }

  int ans = 0;
  rep(i,(1<<3))
    {
      ans = (ans + dp[N][i]) % MOD;
    }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){

while(true){
    int n;      cin >> n;
    if(n == 0)      break;

    vector<bool> is_Prime(2 * n + 1 , true);   //添え字を実際の数とみる
    is_Prime[0] = false;    is_Prime[1] = false;
    for(int i = 2 ; i <= 2 * n ; i++){
        if(is_Prime[i] == true){
            int keep = 2;
            while(i * keep <= 2 * n)
                is_Prime[i * keep++] = false;
            
       }
    }

    int ans = 0;
    for(int i = n + 1 ; i <= 2 * n ; i++)
        if(is_Prime[i] == true)
            ans++;

    cout << ans << endl;
}

    return 0;
}


Measured memory_bytes: 3120
#include <stdio.h>

int lin(int n,int key,int b[]){
  int l;
  for(l=0;l<n;l++){
    if(key==b[l])return 1;
   
  }
   return 2;
}

int main(){

  int n,q,a[10000],b[500],c=0;
  int i,j,l,k;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&b[j]);
  }

  for(k=0;k<q;k++){
    if(lin(n,b[k],a)==1)c++;
      }

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




Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const ll inf = (ll) 1e18;

vector<vector<ll> > warshallFloyd(const vector<set<Pii> > &edge) {
  int n = edge.size();
  vector<vector<ll> > d(n, vector<ll>(n, inf));
  for (int i = 0; i < n; i++) {
    d[i][i] = 0;
    for (Pii x : edge[i]) {
      d[i][x.first] = x.second;
    }
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        //d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        ll dist = d[i][k] + d[k][j];
        if (dist < d[i][j]) d[i][j] = dist;
      }
    }
  }
  return d;
}

vector<ll> dijkstraDistOnly(const vector<set<Pii> > &edge, int start) {
  vector<ll> length(edge.size(), inf);
  vector<bool> visited(edge.size(), false);
  priority_queue<pair<ll, int> > que;
  que.push(pair<ll, int>(0, start)); // negative distance
  length[start] = 0;
  while (!que.empty()) {
    auto now = que.top();
    que.pop();
    if (visited[now.second]) continue;
    visited[now.second] = true;
    for (auto x : edge[now.second]) {
      if (visited[x.first]) continue;
      ll d = -now.first + x.second;
      if (d < length[x.first]) {
        length[x.first] = d;
        que.push(pair<ll, int>(-d, x.first));
      }
    }
  }
  return length;
}

vector<vector<ll> > dijkstraAll(const vector<set<Pii> > &edge) {
  int n = edge.size();
  vector<vector<ll> > d;
  for (int i = 0; i < n; i++) {
    d.push_back(dijkstraDistOnly(edge, i));
  }
  return d;
}

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

  int N, M, R;
  cin >> N >> M >> R;
  vector<int> r;
  for (int i = 0; i < R; i++) {
    int buf;
    cin >> buf;
    r.push_back(buf-1); // zero index
  }
  vector<set<Pii> > edge;
  for (int i = 0; i < N; i++) edge.push_back(set<Pii>());
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    edge[a-1].insert(Pii(b-1, c)); // zero index
    edge[b-1].insert(Pii(a-1, c)); // zero index
  }

  vector<vector<ll> > distanceMatrix = warshallFloyd(edge);
  //vector<vector<ll> > distanceMatrix = dijkstraAll(edge);
  ll shortest = inf;
  stack<vector<int> > st;
  st.push(vector<int>());
  while (!st.empty()) {
    vector<int> now = st.top();
    st.pop();
    if (now.size() == R) {
      ll dist = 0;
      for (int i = 0; i < R-1; i++) dist += distanceMatrix[now[i]][now[i+1]];
      if (dist < shortest) shortest = dist;
      continue;
    }
    set<int> contain;
    for (int x : now) contain.insert(x);
    for (int x : r) {
      auto it = contain.find(x);
      if (it == contain.end()) {
        vector<int> next = now;
        next.push_back(x);
        st.push(next);
      }
    }
  }

  cout << shortest << endl;
  return 0;
}


Measured memory_bytes: 2432
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 300010


int main(){
  int n;
  char s[SIZE];
  
  scanf("%d%s", &n, s);

  int counter = 0;
  
  for(int i=0;i<n;i++){
    counter += 'E' == s[i];
  }

  int ans = INF;
  
  for(int i=0;i<n;i++){
    counter -= 'E' == s[i];
    ans = min(ans, counter);
    counter += 'W' == s[i];
  }

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



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define INF 1000000000000000LL
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl

signed main(){
	IO_STREAM;
	int A,B,C;
	cin>>A>>B>>C;
	DBG("","","","");
	if((A+B+C)==17){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}


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

const int MOD = 1e9 + 7 , INV9 = (MOD + 1) / 9;
int dp[12][1 << 15 | 1] , val[1 << 15 | 1] , val0[1 << 15 | 1] , N , Q , l[20] , r[20];
vector < int > lsh , coef;

int poww(long long a , int b){
	int times = 1;
	while(b){
		if(b & 1) times = times * a % MOD;
		a = a * a % MOD; b >>= 1;
	}
	return times;
}

int main(){
	cin >> N >> Q; int mx = 0 , tms = 1;
	for(int i = 0; i < Q ; ++i){cin >> l[i] >> r[i]; lsh.push_back(--l[i]); lsh.push_back(r[i]); mx = max(mx , r[i]);}
	sort(lsh.begin() , lsh.end()); lsh.resize(unique(lsh.begin() , lsh.end()) - lsh.begin()); coef.resize(lsh.size());
	for(int i = 0 ; i < coef.size() ; ++i){
		int t = (poww(10 , lsh[i] - (i ? lsh[i - 1] : 0)) - 1ll) * INV9 % MOD;
		coef[i] = (t + 1ll) * poww(t , MOD - 2) % MOD; if(t) tms = 1ll * tms * t % MOD;
	}
	for(int i = 0 ; i < Q ; ++i){
		l[i] = lower_bound(lsh.begin() , lsh.end() , l[i]) - lsh.begin();
		r[i] = lower_bound(lsh.begin() , lsh.end() , r[i]) - lsh.begin();
	}
	for(int i = 0 ; i < 1 << Q ; ++i){
		bool vis[40] = {}; val[i] = 1;
		for(int j = 0 ; j < Q ; ++j){vis[l[j]] |= i >> j & 1; vis[r[j]] |= i >> j & 1;}
		for(int j = 0 ; j < Q ; ++j) val[i] &= !(vis[l[j]] ^ vis[r[j]]);
		for(int j = 1 ; j < coef.size() ; ++j)
			if(vis[j] && vis[j - 1]) val[i] = 1ll * val[i] * coef[j] % MOD;
		if(lsh[0] == 0) val0[i] = !vis[0] ? 0 : val[i];
		else val0[i] = !vis[0] ? val[i] : 1ll * val[i] * coef[0] % MOD;
	}
	dp[0][0] = 1;
	for(int i = 0 ; i < 9 ; ++i)
		for(int j = 0 ; j < 1 << Q ; ++j)
			if(dp[i][j]){
				int k = ((1 << Q) - 1) ^ j , s = k;
				while(1){
					dp[i + 1][j | s] = (dp[i + 1][j | s] + 1ll * dp[i][j] * (i ? val[s] : val0[s])) % MOD;
					if(!s) break;
					s = (s - 1) & k;
				}
			}
	int ans = dp[9][(1 << Q) - 1]; tms = 1ll * tms * poww(10 , N - mx) % MOD;
	cout << 1ll * ans * tms % MOD; return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

long long f(long long h) {
	return h == 1 ? 1: f(h / 2) * 2 + 1;
}

int main() {
	long long h;
	cin >> h;

	long long ans = f(h);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int n;
    while (scanf("%d",&n)) {
        if (n==0) break;
        int taro[n], hana[n], t=0, h=0, ut=n, uh=n, turn=1;
        bool usedt[n], usedh[n];
        for (int i=0; i<n; i++) scanf("%d",&taro[i]);
        sort(taro, taro+n);
        fill(usedt, usedt+n, true);
        fill(usedh, usedh+n, true);
        for (int i=1; i<=2*n; i++) {
            if (taro[t]==i) t++;
            else hana[h++]=i;
        }
        // for (int i=0; i<n; i++) printf("%d %d\n",taro[i],hana[i]);
        t=0; h=0;
        while (ut>0&&uh>0) {
            if (turn) {
                bool flag=true; ut--;
                usedt[t]=false;
                // printf("%d\n",taro[t]);
                for (;h<n; h++) if (taro[t]<hana[h]&&usedh[h]) {
                    flag=false;
                    turn=0;
                    break;
                }
                if (flag) {
                    for (t=0; t<n; t++) if (usedt[t]) break;
                    h=0;
                }
            } else {
                bool flag=true; uh--;
                usedh[h]=false;
                // printf("%d\n",hana[h]);
                for (;t<n; t++) if (hana[h]<taro[t]&&usedt[t]) {
                    flag=false;
                    turn=1;
                    break;
                }
                if (flag) {
                    for (h=0; h<n; h++) if (usedh[h]) break;
                    t=0;
                }
            }
        }
        printf("%d\n%d\n",uh,ut);
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> Pii;

const int N_MAX = 500;

 
vector<int> cnt_l(N_MAX*N_MAX+1, 0), cnt_r(N_MAX*N_MAX+2, 0);
vector<Pii> v(N_MAX+1, Pii(0, 0));
 
bool check(int n) {
    for(int i=1;i<=n*n;++i) {
        if(i < cnt_l[i] || n*n-i+1 < cnt_r[i]) {
            return false;
        }
    }
    return true;
}

vector<int> construct(int n) {
    vector<int> ret(n*n+1, 0);
    sort(v.begin(), v.begin()+n+1);
    int i = 1;
    for(int j=1;j<=n;++j) {
        int idx = v[j].first;
        int num = v[j].second;
        ret[idx] = num;
    }
    for(int k=1;k<=n*n;++k) {
        cerr << ret[k] << " ";
    }
    cerr << endl;

    int j = 1;
    int num = v[j].second;
    int num_cnt = num - 1;
    for(int i=1;i<=n*n;++i) {
        if(ret[i]) continue;
        while(j < n && !num_cnt) {
            ++j;
            num = v[j].second;
            num_cnt = num - 1;
        }
        if(j == n && !num_cnt) break;
        ret[i] = num;
        --num_cnt;
    }
    for(int k=1;k<=n*n;++k) {
        cerr << ret[k] << " ";
    }
    cerr << endl;
    
    j = 1;
    num = v[j].second;
    num_cnt = n - num;
    for(int i=1;i<=n*n;++i) {
        if(ret[i]) continue;
        while(j < n && !num_cnt) {
            ++j;
            num = v[j].second;
            num_cnt = n - num;
        }
        if(j == n && !num_cnt) break;
        ret[i] = num;
        --num_cnt;
    }
    for(int k=1;k<=n*n;++k) {
        cerr << ret[k] << " ";
    }
    cerr << endl;
    return ret;
}

int main() {
    int n, x;
    cin >> n;
    for(int i=1;i<=n;++i){
        cin >> x;
        v[i] = {x, i};
        cnt_l[x] += i;
        cnt_r[x] += n-i+1;
    }
    for(int i=1;i<=n*n;++i) cnt_l[i] += cnt_l[i-1];
    for(int i=n*n;i>=1;--i) cnt_r[i] += cnt_r[i+1];

    if(check(n)) {
        cout << "Yes" << endl;
        vector<int> ans = construct(n);
        for(int i=1;i<=n*n;++i) {
            cout << ans[i] << " ";
        }
        cout << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 4096
/*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
int x=0,y=0,z=0,w=0,n=0,d=0;
std::cin >> x>>y;
std::cout << abs(x-y) << '\n';
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
 

int main() {
    int n;
    cin>>n;
    
    string str1,str2,str3;
    
    cin>>str1>>str2;
    
    for(int i=0;i<n;i++){
        str3+=str1.at(i);
        str3+=str2.at(i);
    }
    cout<<str3<<endl;
  

}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> pos(200005);
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        pos[a].push_back(i);
    }
    
    // 1 が存在しないとき
    if(pos[1].size() == 0){
        cout << -1 << endl;
        return 0;
    }
    
    // 現在地 : 1 の中で一番左側の位置
    int now_pos = pos[1][0];
    for(int i = 2; i < 200005; ++i){
        if(pos[i].size() == 0){
	    	cout << n - i + 1 << endl;
         	return 0;
        }
        
        auto it = upper_bound(pos[i].begin(), pos[i].end(), now_pos);
        
        if(it == pos[i].end()){     // 条件を満たすものがない場合
            cout << n - i + 1 << endl;
            return 0;
        }
        
        now_pos = *it;      // 現在地の更新
    }
}


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

using namespace std;
#define ll long long



int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif


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

	int n;
	cin >> n;
	int a = n % 10;
	if (a == 3) {
		cout << "bon\n";
	}
	else if (a == 0 || a == 6 || a == 8 || a == 1) {
		cout << "pon\n";
	}
	else {
		cout << "hon\n";
	}




	return 0;

}

Measured memory_bytes: 3584
N=int(input())
A=list(map(int,input().split()))
tmp=[]
a=10**9
for i in A:
  if a>i:
    a=i
  tmp.append(a)
ans=0
for i in range(len(A)):
  if A[i]<=tmp[i]:
    ans+=1
print(ans)

Measured memory_bytes: 26012
#ifdef ONLINE_JUDGE

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

#define ui unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double

#define all(v) v.begin(), v.end()

#define speed ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ld PI = 3.1415926535897932384626;
ll MOD = 1000000007;
const ld EPS = 1e-9;
const int N = 3e5 + 7;

inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ui setBits(ui v) { ui c; for(c = 0 ; v; ++c) v &= (v - 1); return c; }
inline bool isPowerOfTwo(ui v) { return (v && !(v & (v - 1))); }
ll power(ll base, ull exp, ll mod = MOD) { 
	ll res = 1; base %= mod; 
	while(exp) { 
		if(exp & 1) res = (res * base)%mod; 
		exp >>= 1; base = (base * base)%mod; 
	} 
	return res; 
}
ll modInv(ll a, ll mod = MOD) { 
	if(mod == 1) return 0; 
	ll x = 1, y = 0, m = mod; 
	while(a > 1) { 
		ll q = a/m, t = m; m = a%m; a = t; t = y; y = x - q * y; x = t; 
	} 
	if(x < 0) x += mod; 
	return x; 
}
inline ui iabs(int x) { ui y = x; return (y > 0) ? y : -y; }
inline ll add(ll a, ll b, ll mod = MOD) { ll res = (a%mod + b%mod)%mod; return res; }
inline ll sub(ll a, ll b, ll mod = MOD) { ll res = (a%mod - b%mod + mod)%mod; return res; }
inline ll mult(ll a, ll b, ll mod = MOD) { ll res = (a%mod * b%mod)%mod; return res; }
inline ll div(ll a, ll b, ll mod = MOD) { ll res = (a%mod * modInv(b, mod))%mod; return res; }

#else

#include "custom.h"
using namespace std;

#endif

void openf() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
}

int main() {
	speed;
	openf();
	ll n, sum = 0;
	cin >> n;
	vector<ll> arr(n);

	for(int i = 0 ; i < n ; ++i) {
		cin >> arr[i];
		sum += arr[i];
	}
	ll m;
	cin >> m;
	while(m--) {
		ll p, x;
		cin >> p >> x;
		cout << sum - arr[p - 1] + x << endl;
	}
	return 0;
} 

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>

int main(){
    int a, b;
    cin >> a >> b;

    int ans=0;
    for(int i=a; i<=b; ++i){
        int k = i%10; 
        int l = i/10%10; 
        int m = i/1000%10; 
        int n = i/10000%10; 

        if(k==n && l==m)
            ans++;
    }
    cout << ans;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define inf 1000000009
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	int cnt=0;
	for(int i=0;i<3;i++){
		if(s[i]==t[i])cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n , m , sum = 0 ;
  std::cin >> n >> m;
  for(int i=0; i < m; i++) {
    int a;
    std::cin >> a;
    sum += a;
  } 
  if ( n >=sum ){
	n -= sum ; 
    cout << n << endl ;
  }
  else
    cout << -1 << endl ;
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    for(int i = n - 1;i >= 0;i--)
    {
        cout << a[i];
        if(i != 0)
        {
            cout << " ";
        }
    }
    cout << "\n";
    
    return 0;
}


Measured memory_bytes: 3076
use std::io::stdin;
fn main() {
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let n:f32 = st.trim().parse().unwrap();
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let a:Vec<f32> = st.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let z:f32 = a.iter().sum();
    let ave:f32 = z / n;
    let mut result:Vec<f32> = a.iter().map(|&x| (x-ave).abs()).collect();
    let min = result.iter().fold(0.0/0.0, |m, v| v.min(m));
    let r = result.iter().position(|&x| x == min);
    println!("{:?}", r.unwrap());
}

Measured memory_bytes: 2168
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#define LL long long
LL W, H;
LL SW[100010], SH[100010];
std::vector<LL> PW, PH;
LL ans;
int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cin >> W >> H;
	for (int i = 0; i < W; i++) {
		LL tmp;
		std::cin >> tmp;
		PW.emplace_back(tmp);
	}
	for (int i = 0; i < H; i++) {
		LL tmp;
		std::cin >> tmp;
		PH.push_back(tmp);
	}
	std::sort(PW.begin(), PW.end());
	std::sort(PH.begin(), PH.end());
	for (int i = 1; i <= W; i++) {
		SW[i] += SW[i - 1] + PW[i - 1];
	}
	for (int i = 1; i <= H; i++) {
		SH[i] += SH[i - 1] + PH[i - 1];
	}
	ans += SW[W] + SH[H];
	for (int i = 0; i < W; i++) {
		auto it = std::upper_bound(PH.begin(), PH.end(), PW[i]);
		LL K = it - PH.begin();
		ans += SH[K] + PW[i] * (H - K);
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3572
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  vector<ll> s(N+1);
  rep(i, N) s[i+1] = s[i]+A[i];
  map<ll, int> num;
  rep(i, N+1) num[s[i]]++;
  ll ans = 0;
  for(auto e : num) {
    for(int i=0; i<e.second; i++)
      ans += i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15104
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

//よく使う関数
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; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    cin >> N;

    vll A(N);
    rep(i, N) cin >> A[i];

    ll money = 1000;
    ll stock = 0;

    rep(i, N)
    {
        money += A[i] * stock;
        stock = 0;

        if (i < N - 1 && A[i] < A[i + 1])
        {
            stock += money / A[i];
            money %= A[i];
        }
    }

    cout << money << endl;

    return 0;
}

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

int main()
{
  int k, x;
  cin >> k >> x;

  int minn = max(x - k + 1, -1000000);
  int maxx = min(x + k - 1, 1000000);

  for (int i = minn; i <= maxx; i++)
  {
    if (i == minn)
    {
      cout << i;
      continue;
    }
    cout << " " << i;
  }
  cout << endl;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

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

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

    //cout << fixed << setprecision(15);

    int sum = 0;
    for (int i = 0; i < 5; ++i)
    {
        int a;
        cin >> a;
        if (a < 40)
            sum += 40;
        else
            sum += a;
    }
    cout << sum / 5 << endl;

    return 0;
}



Measured memory_bytes: 3212
#include <iostream>





int main(int argc, const char * argv[]) {
  int x, count;
  while (1) {
    std::cin >> x;
    if (x == 0){
      break;
    } else {
      count ++;
      std::cout << "Case " << count << ": " << x << std::endl;
    }
  }

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n;
  cin>>n;
  set<char> s;
  rep(i,1,n+1)
    {
      char x;
      cin>>x;
      s.insert(x);
    }
  if(sz(s)==3)
    cout<<"Three"<<endl;
  else cout<<"Four"<<endl;
  return 0 ;
}


Measured memory_bytes: 256
### constant

PI2 = Math::PI * 2

### main

loop do
  n, m = gets.split.map(&:to_i)
  break if (n | m) == 0

  pis = []
  while pis.length < n
    pis += gets.split.map(&:to_f)
  end

  ars = n.times.map{n.times.map{nil}}
  
  for i in (0...n)
    for j in (0...n)
      ars[i][j] = 0.5 * Math.sin(PI2 * (pis[j] - pis[i]))
    end
  end
  #p ars

  trs = n.times.map{n.times.map{n.times.map{nil}}}

  for i in (0...n)
    for j in ((i + 1)...n)
      for k in ((j + 1)...n)
        trs[i][j][k] = ars[i][j] + ars[j][k] + ars[k][i]
      end
    end
  end
  #p trs

  maxars = (m + 1).times.map{n.times.map{n.times.map{0.0}}}

  for c in (3..m)
    for i in (0...n)
      for j in ((i + 1)...n)
        for k in ((j + 1)...n)
          ar = maxars[c - 1][i][j] + trs[i][j][k]
          maxars[c][i][k] = ar if maxars[c][i][k] < ar
        end
      end
    end
  end

  puts "%.6f" % maxars[m].flatten.max
end

Measured memory_bytes: 7976
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
   
    result = 0
    for a in range(1, x // 3):
        for b in range(a + 1,  x // 2):
            c = x - a - b
            if b < c <= n:
                result += 1    
    print(result)

Measured memory_bytes: 7704
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 N,S,b = 1e18;
bool check(int64 x) {
    if(N / x >= x) return false;
    int64 k = N / x,r = N % x;
    return k + r == S;
}
void Solve() {
    read(N);read(S);
    if(N == S) b = N + 1;
    if(N > S) {
	for(int64 i = 1 ; i <= (N - S) / i ; ++i) {
	    if((N - S) % i == 0) {
		int64 t = (N - S) / i + 1;
		if(check(t)) b = min(t,b);
		int64 a = (N - S) / i;
		t = (N - S) / a + 1;
		if(check(t)) b = min(t,b);
	    }
	}
    }
    for(int64 i = 2 ; i <= 1000000 ; ++i) {
	int64 x = N,cnt = 0;
	while(x) {
	    cnt += x % i;
	    x /= i;
	}
	if(cnt == S) {b = min(b,i);break;}
    }
    if(b == 1e18) {puts("-1");}
    else {out(b);enter;}
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int f(int x){
  if (x==0) return 0;
  return f(x%__builtin_popcount(x))+1;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int	n;
	cin>>n;
	string s;
	cin>>s;
	vector<int>x(n);
	rep(i,n)x[i]=s[i]-'0';
	int pc=0;
	rep(i,n)pc+=x[i];
	vector<int>ans(n,0);
	rep(b,2){
		int npc=pc;
		if(b==0)
			npc++;
		else
			npc--;
		if(npc<=0)continue;
		int r0=0;
		rep(i,n){
			r0=(r0*2)%npc;
			r0+=x[i];
		}
		int k=1;
		for(int i=n-1;i>=0;i--){
			if(x[i]==b){
				int r=r0;
				if(b==0)
					r=(r+k)%npc;
				else
					r=(r-k+npc)%npc;
				ans[i]=f(r)+1;
			}
			k=(k*2)%npc;
		}
	}
	rep(i,n)cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 5140
A = list(input())
B = list(input())
C = list(input())
turn = A
while True:
    if len(turn) == 0:
        break
    nextturn = turn[0]
    turn.pop(0)
    if nextturn == "a":
        turn = A
    elif nextturn == "b":
        turn = B
    else:
        turn = C
print(nextturn.upper())

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int A,B,C,D,E,F;
const int MAX_F = 3010;

int f(int sugar){
  int left = 0;
  int right = MAX_F;
  while (right - left > 1){
    int med = (right + left) / 2;
    int res = D * med;
    if (res <= sugar){
      left = med;
    }else{
      right = med;
    }
  }
  return left;
}


int main() {
  cin >> A >> B >> C >> D >> E >> F;
  double result = 0;
  int res1,res2;
  res1 = 100 * A;
  res2 = 0;
  for (int i = 0; i < MAX_F; i++){
    if (100 * A * i > F)break;
      for (int j = 0; j < MAX_F; j++){
        if (100 * A * i + 100 * B * j > F)break;
        int water = 100 * A  * i + 100 * B * j;
        if (water == 0)continue;
        for (int k = 0; k < MAX_F; k++){
          int sugar = min(F - water, E * water / 100);
          if (k * C > sugar)break;
          int l = f(sugar - k * C);
          double tmp = (double)100 * (k * C + l * D) / (k * C + l * D + water);
          if (tmp > result){
            result = tmp;
            // cerr << "result = " << result << endl;
            res1 = water + k * C + l * D;
            res2 = k * C + l * D;
          }
        }
    }
  }
  cout << res1 << " " << res2 << endl;
  return 0;
}


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

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; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int N, M;  // 1<=N,M<=200000
ll K;
vll A, B;
// *********************************************************
int main(){

    cin >> N >> M >> K;

    A.emplace_back(0);
    rep(i,N){
        ll ai;
        cin >>ai;
        A.emplace_back(A.at(i)+ai);
    }

    B.emplace_back(0);
    rep(i,M){
        ll bi;
        cin >>bi;
        B.emplace_back(B.at(i)+bi);
    }

    int best = 0;
    int Mstart = M;
    int ans=0;
    rep(i,N+1){
        if(A.at(i)<=K){
            while(B.at(Mstart)>K-A.at(i)){
                --Mstart;
            }
            ans = max(ans, i+Mstart);
        }



    }

    cout << ans<< endl;



    return 0;
}

Measured memory_bytes: 7924
S=input()
Sdash=[]
for i in range(2,len(S)-1):
    Sdash.append(S[i])
a=0
for i in range(len(S)):
    if S[i].islower()==True:
        a+=1
if S[0]=='A' and Sdash.count('C')==1 and a==len(S)-2:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 61876
n = int(input())

ans = 0
t = [3, 5, 7]
while len(t) > 0:
    x = t.pop(0)
    if x * 10 + 3 <= n:
        t.append(x * 10 + 3)
        if x * 10 + 5 <= n:
            t.append(x * 10 + 5)
            if x * 10 + 7 <= n:
                t.append(x * 10 + 7)
    if 357 <= x <= n:
        s = str(x)
        if '3' in s and '5' in s and '7' in s:
            ans += 1
print(ans)


Measured memory_bytes: 3692
W,H,N=gets.split.map &:to_i
c=Array.new(H){[1]*W}
N.times do
  x,y,a=gets.split.map &:to_i
  case a
    when 1
      H.times{|i|x.times{|j|c[i][j]=0}}
    when 2
      H.times{|i|x.upto(W-1){|j|c[i][j]=0}}
    when 3
      y.times{|i|W.times{|j|c[i][j]=0}}
    when 4
      y.upto(H-1){|i|W.times{|j|c[i][j]=0}}
  end
end
p c.map{|a|a.inject :+}.inject :+


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ




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


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  char c ;
  cin >> c ;
  cout << (char)(c+1) <<endl ;
  
  
  
  
  return 0 ;
}

Measured memory_bytes: 256
# import copy
import math

m_num = []  # 各交通機関の運搬上限人数
p_num = int(input())
for i in range (5):
    m_num.append(int(input()))

CITY = 6

pos = [0] * CITY  # 現在、都市にいる人数
pos[0] = p_num

pos_next = [0] * CITY  # 1分経過後の、都市にいる人数
pos_next[0] = p_num
total_time = 0

# 素直に計算する版。時間足りないっぽい。
# while pos[5] != p_num:
#     for p in range(CITY - 1):
#         if pos[p] > 0:
#             if pos[p] > m_num[p]:
#                 pos_next[p] -= m_num[p]
#                 pos_next[p + 1] += m_num[p]
#             else:
#                 pos_next[p] -= pos[p]
#                 pos_next[p + 1] += pos[p]
#     # pos = pos_next  # こうすると同じポインタを指すっぽい
#     pos = copy.deepcopy(pos_next)
#     total_time += 1
#     print(total_time, pos)

# ボトルネックのところで時間が決まる？
min_m = min(m_num)
total_time = math.ceil(p_num / min_m) + 4  # 最低5分かかる
print(total_time)

Measured memory_bytes: 3064
from collections import defaultdict
l=defaultdict(int)
n=int(input())
l1=list(map(int,input().split()))
for i in l1:
  l[i]+=1
b=True
lset=set(l1)
answer=0
for i in lset:
  if l[i]!=i:
    if l[i]<i:
      answer+=l[i]
    else:
      answer+=min(l[i]-i,l[i])
print(answer)

Measured memory_bytes: 20588
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  double x1,x2,x3;
  double y1,y2,y3;
  cin>>x1>>y1;
  cin>>x2>>y2;
  cin>>x3>>y3;

  double a=hypot(abs(x1-x2),abs(y1-y2));
  double b=hypot(abs(x2-x3),abs(y2-y3));
  double c=hypot(abs(x3-x1),abs(y3-y1));
  double len=max(a,max(b,c));

  double s=(a+b+c)/2;
  double area=sqrt(s*(s-a)*(s-b)*(s-c));
  double r=area/s;

  double ok=0,ng=len;
  rep(i,100000){
    double x=(ok+ng)/2;
    if(len*(r-x) >= 2*x*r)ok=x;
    else ng=x;
  }

  cout<<shosu(13)<<ok<<endl;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)

const ll MOD = 1e9 + 7;

const int MAX = 100001;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

int abs(int a) {
    if  (a < 0) return -a;
    return a;
}

int main(void) {
    cin >> n;
    int aa[n];

    for (int i = 0; i < n; ++i) {
        aa[i] = i + 1;
    }
  
    int s1[n], s2[n];

    for (int i = 0; i < n; ++i) 
        cin >> s1[i];
    for (int i = 0; i < n; ++i) 
        cin >> s2[i];

    int a = 0, b = 0;
  
    for (int i = 0; i < n; ++i) {
        a += s1[n - i - 1] * pow(10, i);
        b += s2[n - i - 1] * pow(10, i);
    }
  
    int ac = 0, bc = 0;
    int cnt = 0;

    do {
        k = 0;
        for (int i = 0; i < n; ++i) {
            k += aa[n - i - 1] * pow(10, i);
        }

        if (a == k) ac = cnt;
        if (b == k) bc = cnt;
        cnt++;
    } while(next_permutation(aa, aa + n));

    cout << abs(ac - bc) << endl;

    return 0;
}




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

int main(){
  int n;
  string s;
  cin >> n >> s;

  vector<int> cnt(n, 0);
  for(int i = 1; i < n; i++){
    if(s[i] != 'W') cnt[0]++;
  }

  for(int i = 1; i < n; i++){
    if(s[i] == 'E'){
      cnt[i] = cnt[i-1] - 1;
    }else{
      cnt[i] = cnt[i-1];
    }
  }

  int cnt_w = 0;
  for(int i = 1; i < n; i++){
    if(s[i-1] != 'E'){
      cnt_w++;
    }
    cnt[i] += cnt_w;
  }

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

  cout << cnt[0] << endl;

  return 0;
}

Measured memory_bytes: 1796
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int x;
string s;
int dp[200009][2];
int f(int i,int done) //....####
{
    if (i==x)
        return 0;
    if (dp[i][done]!=-1)
        return dp[i][done];
    int mn=1e9;
    if (!done)
    {
        if (s[i]=='#')
        {
            mn=min(mn,f(i+1,0)+1);
            mn=min(mn,f(i+1,1));
        }
        else
        {
            mn=min(mn,f(i+1,0));
            mn=min(mn,f(i+1,1)+1);
        }
    }
    else
    {
        if (s[i]=='#')
            mn=min(mn,f(i+1,1));
        else
            mn=min(mn,f(i+1,1)+1);
    }
    return dp[i][done]=mn;
}
int main()
{
    FASTINOUT;
    cin>>x>>s;
    memset(dp,-1,sizeof dp);
    cout<<f(0,0);
    return 0;
}


Measured memory_bytes: 14604
n,m,q = map(int,input().split())
abcd = [list(map(int,input().split())) for _ in range(q)]
s = [[1]]
for i in range(1,n):
    s_ = []
    for j in s:
        for k in range(j[-1],m+1):
            s_.append(j+[k])
    s = s_
    
ans = 0
for i in s:
    ans_ = 0
    for j in abcd:
        if i[j[1]-1]-i[j[0]-1]==j[2]:
            ans_ += j[3]
    ans = max(ans, ans_)

print(ans)

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

int main(){
  int N , X ; 
  cin >> N >> X ; 
  vector<int> L(N) ;
  
  for(int i = 0 ; i < N ; i++  ){
    cin >> L.at(i) ; 
    
  }
  
  int cnt =1; 

  for(int i = 0 ; i<N ; i++){
    X = X - L.at(i) ; 
    if( X < 0){
      break ; 
    }
    else {
    cnt++;
    }
  }
  
  cout << cnt << endl ;
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// 自分の得意な言語で
		// Let's チャレンジ！！

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		String u = sc.next();

		if (u.equals(s)) {
			a--;
		} else {
			b--;
		}

		System.out.println(a + " " + b);

	}

}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
 
ll gcd(ll a,ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int main()
{
	ll x,y,z;
	cin>>x>>y>>z;
	ld cnt=0;
	ll volume=x*x*y;
	if(volume/2>z)
	{
		ld f=x*y*y/(2.0*z);
		cnt=atan(f);
	}
	else
	{
		z=volume-z; 
        ld d=2*z/(ld)(x*x*x); 
        cnt=atan(d);
	}
	cnt=cnt*180/3.14159265;
	COUT<<cnt;
}

Measured memory_bytes: 256