akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a,b;scanf("%d%d",&a,&b);
	printf("%d\n",(b+a-1)/b);
}

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

using namespace std;

const int N = 22;
const int MOD = 1e9 + 7;
int a[N][N];
int f[1 << N];
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++) cin >> a[i][j];
    f[0] = 1;
    for(int i = 1; i < (1 << n); i++) {
        int cur = __builtin_popcount(i) - 1;
        for(int j = 0; j < n; j++) if (((i >> j) & 1) && a[cur][j])
            f[i] = (f[i] + f[i ^ (1 << j)]) % MOD;
    }
    cout << f[(1 << n) - 1];
}


Measured memory_bytes: 10496
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	string a, b;

	cin >> a >> b;
	
	if (a == b) {
		cout << "H" << endl;

	}
	else {
		cout << "D" << endl;

	}
	
}



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

int main(){
    string red, blue, col;
    int A, B;
    cin >> red >> blue;
    cin >> A >> B;
    cin >> col;
    if (col == red){
        cout << A-1 << " " << B << endl;
    }
    else{
        cout << A << " " << B-1 << endl;
    }
}

Measured memory_bytes: 3524
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  ioso
  #ifndef ONLINE_JUDGE
  ffe
  #endif
  double d, t, s; cin >> d >> t >> s;
  //cout << d/s << endl;
  double x = (d/s);

  if(x <=t) {
    cout << "Yes\n";
  } 
  else {
    cout << "No\n";
  }
} 

Measured memory_bytes: 3704
from itertools import permutations
N,M=map(int, input().split())
G=[[] for _ in range(N)]
for i in range(M):
    a,b=map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

P=list(range(2,N+1))
ans=0
for p in permutations(P):
    que=[1]+list(p)
    #print(que)
    to=que.pop(0)
    route=G[to-1]
    count=1
    while len(que)>0:
        to=que.pop(0)
        if to-1 in route:
            count+=1
            route=G[to-1]
        else:
            #print("ok")
            break
    
    if count==N:
        ans+=1
print(ans)



Measured memory_bytes: 9228
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>

typedef long long ll;
#define MIN(x, y) (x < y ? x : y)
#define MAX(x, y) (x > y ? x : y)

using namespace std;

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

	if(A == B) cout << C << endl;
	else if(A == C) cout << B << endl;
	else if(B == C) cout << A << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007

#define pb push_back
#define pp push
#define pob pop_back()
#define po pop
#define pf push_front
#define pof pop_front()

#define I insert
#define E erase
#define ff first
#define ss second

#define pll pair<ll,ll>
#define pii pair<int ,int>
#define all(a) a.begin(),a.end()

const int dh[] = {-1,0,1,0};
const int dd[] = {0,-1,0,1};
 int mat[21][21];
  int N,M;
 
 int bfs(int n,int m)
 {
  vector<vector<int>> dp(N, vector<int>(M, 1e9));
  dp[n][m]=0;
  queue<pii>q;
  q.pp({n,m});
  while(!q.empty())
  {
      pii t=q.front();
      int h1=t.ff;
      int d1=t.ss;
      
      q.pop();
      for(int i=0;i<4;i++)
      {
          int h2=h1+dh[i];
          int d2=d1+dd[i];
          
          if(h2>=0 && h2<N && d2>=0 && d2<M )
          {  if(mat[h2][d2]==0 &&  dp[h2][d2] > dp[h1][d1] + 1 )
               {dp[h2][d2] = dp[h1][d1] + 1;
               q.pp({h2,d2});}
              
          }
      }
      
  }
      int ans=0;
      for(int i=0;i<N;i++)
      {
          for(int j=0;j<M;j++)
          {
              if(dp[i][j]!=1e9)
              {
                  ans=max(ans,dp[i][j]);
              }
              
          }
          
      }
      
      return ans;
 }
 
int main() {
  
 
  cin>>N>>M;
 
 
  for(int i=0;i<N;i++)
  {
       string s;
          cin>>s;
      for(int j=0;j<M;j++)
      {  
          if(s[j]=='#'){mat[i][j]=1;}
          else{mat[i][j]=0;}
      }
  }
  int ans=0;
     for(int i=0;i<N;i++)
  {
      for(int j=0;j<M;j++)
      {
       if(mat[i][j]!=1)
       {
          ans=max(ans,bfs(i,j));
       }
      }
  }
  cout<<ans;

  
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int md(int a, int b, int c, int d) {
  return abs(a-c) + abs(b-d);
}

int main() {
  int N, M; cin >> N >> M;
  vi a(N), b(N); rep(i,N) cin >> a.at(i) >> b.at(i);
  vi c(M), d(M); rep(i,M) cin >> c.at(i) >> d.at(i);
  
  rep(i,N) {
    vector<pii> p(M);
    rep(j,M) {
      p.at(j) = make_pair(md(a.at(i), b.at(i), c.at(j), d.at(j)), j+1);
    }
    sort(all(p));
    cout << p.at(0).second << endl;
  }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int a=0;
    int N;cin>>N;
    for(int i=1;i*i<=N;i++)a=i*i;
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <set>

#define v_exists(elem, v) find(v.begin(),v.end(),elem)!=v.end()
#define s_exists(elem, s) s.find(elem)!=s.end()

using namespace std;

long gcd(long a, long b) {
    return b == 0 ? a : gcd(b, a % b);
}

long lcm( long m, long n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	return ((m / gcd(m, n)) * n);
}

int main(){

	long a,b;
	int K;

	scanf("%ld %ld %d",&a,&b,&K);

	bool t=true;

	while(K>0){
		K--;

		if(t){
			if(a%2==1){
				a-=1;
			}
			b=b+a/2;
			a=a/2;
			t=false;
		} else{
			if(b%2==1){
				b-=1;
			}
			a=a+b/2;
			b=b/2;
			t=true;
		}
	}
	cout << a << ' ' << b << endl;


}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    long long n;
    cin >> n;
    
    long long ans = 0;
    
    for(int i = 1; i <= n; i++){
        if(i % 3 == 0 && i % 5 == 0) continue;
        else if(i % 3 == 0) continue;
        else if(i % 5 == 0) continue;
        else ans += i;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 3192
s = list(input())
s.reverse()
s = "".join(s)

for _ in range(10**5):
    before_s = s
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)

Measured memory_bytes: 3956
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;

const int N = 12;

int n, m, x;
int val[N][N];
int cost[N];
int acc[N];

int main()
{
  cin >> n >> m >> x;
  for(int i = 0 ; i < n ; i++) {
    cin >> cost[i];
    for(int j = 0 ; j < m ; j++)
      cin >> val[i][j];
  }
  int best = 1e9;
  for(int msk = 1; msk < (1 << n); msk++) {
    for(int i = 0 ; i < m ; i++)
      acc[i] = 0;
    int tot = 0;
    for(int i = 0 ; i < n ; i++)
      if(msk & (1 << i)) {
        tot += cost[i];
        for(int j = 0 ; j < m ; j++) {
          acc[j] += val[i][j];
        }
      }
    bool good = true;
    for(int i = 0 ; i < m ; i++)
      good &= acc[i] >= x;
    if(good)
      best = min(best, tot);
  }
  if(best >= 1e9) best = -1;
  cout << best << endl;
  return 0; 
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7
 
int main(){
  int n;
  string s;
  cin >> n;
  int count = 0;
  int ans = 0;
  bool flag[26];
  cin >> s;
  REP(i, n){
    //print(i);
    REP(i, 26)flag[i] = false;
    count = 0;
    REP(j, i){
      char c = s[j];
      rep(k, i ,n){
        if(s[j] == s[k] && !flag[c - 'a']){
          //print("s["<<j<<"] " << s[j] << " s["<<k<<"] " << s[k]);
          count++;
          flag[s[j] - 'a'] = true;
          break;
        }
      }
    }
    //print("count "<< count);
    ans = max(ans, count);
    //print(" ");
  }
  print(ans);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define int long long 
const int N=2e3+5;
vector<int>v(3);
int32_t main(){
	IOS;
	
	//code
	cin>>v[0]>>v[1]>>v[2];
	sort(v.begin(), v.end());
	if((v[0]==v[1] && v[1]!=v[2]) || (v[0]!=v[1] && v[1]==v[2]))
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	//code
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;

string S,T;


int main(void){

    cin >> S >> T;
    ll ans = 0;
    ll SL = S.length();
    ll TL = T.length();

    char CS[SL];
    char CT[TL];

    for (int i = 0; i < SL; i++){
        CS[i] = S[i]; //chは[0]から始まるので注意！
    }
    for (int i = 0; i < TL; i++){
        CT[i] = T[i]; //chは[0]から始まるので注意！
    }

    ans = TL;
    ll change = 0;

    for (int i = 0; i <= SL-TL; i++){
        for (int j = 0;j < TL;j++){
            if (CS[i + j] != CT[j]) change++; 
        }
        if (ans > change) ans = change;
        change = 0;
    }

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


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

    int count = 1;
    while (count < K * 2)
    {
        if (count + 1 == K * 2)
        {
            cout << X - K + count;
        }
        else
        {
            cout << X - K + count << " ";
        }
        count++;
    }
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  ll x;
  cin>>x;

  for(int i=1;i<=1000000;++i){
    ll mn,mx;
    mn = i*100;
    mx = i*105;
    if(mn<=x && x<=mx){
      cout<< 1 <<endl;
      exit(0);
    }
  }
  cout<< 0 <<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define endl '\n'
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; }
using namespace std;

signed main(void){
    int n,a,b; cin>>n>>a>>b;
    vector<int> h(n);
    rep(i,n)cin>>h.at(i);
    int R=1000000000,L=0;
    while(R-L>1){
        int M=(R+L)/2;
        int cnt=0;
        rep(i,n){
            int tmp=h.at(i)-M*b;
            if(tmp<=0)continue;
            cnt+=(tmp+a-b-1)/(a-b);
        }
        if(cnt>M){
            L=M;
        }else{
            R=M;
        }
    }
    cout<<R<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;

vvll cost_table(vll s,vll t,vll c,ll N){
    vvll ret(N,vll(N,LLMAX));
    
    for(int i=0;i<N;i++) ret[i][i]=0;
    
    for(int i=0;i<t.size();i++){
        ret[s[i]][t[i]]=c[i];
        ret[t[i]][s[i]]=c[i];
    }
    
    return ret;
}

void warshall_floyd(vvll &cost){
    for(int k=0;k<cost.size();k++){
        for(int i=0;i<cost.size();i++){
            for(int j=0;j<cost.size();j++){
                cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
            }
        }
    }
}

void show_table(vvll d){
    if(d.size()==0) return;
    
    printf("  ");
    for(int i=0;i<d[0].size();i++) printf("%d,",i+1);
    printf("\n");
    
    for(int i=0;i<d.size();i++){
        printf("%d:",i+1);
        for(int j=0;j<d[i].size();j++){
            if(d[i][j]>LLMAX*0.9) printf("M|");
            else printf("%lld|",d[i][j]);
        }
        printf("\n");
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,M,L;
    cin>>N>>M>>L;
    vll A(M),B(M),C(M);
    for(int i=0;i<M;i++) {
        cin>>A[i]>>B[i]>>C[i];
        A[i]--;B[i]--;
    }
    
    ll Q;
    cin>>Q;
    vll s(Q),t(Q);
    for(int i=0;i<Q;i++) {
        cin>>s[i]>>t[i];
        s[i]--;t[i]--;
    }
    
    vvll cost=cost_table(A,B,C,N);
    //show_table(cost);
    warshall_floyd(cost);
    //show_table(cost);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i==j) cost[i][j]=0;
            else if(cost[i][j]<=L) cost[i][j]=1;
            else cost[i][j]=LLMAX;
        }
    }
    //show_table(cost);
    warshall_floyd(cost);
    //show_table(cost);
    
    for(int q=0;q<Q;q++){
        if(cost[s[q]][t[q]]>LLMAX*0.9) cout<<-1<<endl;
        else cout<<cost[s[q]][t[q]]-1<<endl;
    }
        
        
    return 0;
}


Measured memory_bytes: 4480
import sys
input = sys.stdin.readline

def main():
	w = 0.006
	n = int(input().strip())
	t, a = map(int, input().strip().split())
	v = list(map(int, input().strip().split()))
	T = 10**9
	ans = 0
	for i in range(n):
		if abs(a - (t-v[i]*w)) < T:
			T = abs(a - (t-v[i]*w))
			ans = i
	print(ans+1)

if __name__ == '__main__':
	main()


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

int main() {
  while(true) {
    int x,y;
    cin >> x >> y;
    if(x==0&&y==0) break;
    if(x > y) swap(x,y);
    cout << x << " " << y << endl;
  }
  return 0;
}


Measured memory_bytes: 3096
#!/usr/bin/env python3
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
best = 10**6
ans = 0
for i in range(n):
    if best > abs((t-h[i]*0.006)-a):
        best = abs((t-h[i]*0.006)-a)
        ans = i+1
print(ans)
    

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            //var length = c2i(RL());
            //var rl = spr(RL()).Select(x=>c2i(x)).ToList();
            var num = c2i(RL())%10;
            var ret=(num==3)?"bon":((num==0||num==1||num==6||num==8)?"pon":"hon");




            Console.WriteLine(ret);
            Console.ReadLine();
        
        }
 
        static string RL() { return Console.ReadLine().Trim(); }
        static IEnumerable<string> spr(string s) { return s.Split(' '); }
        static Int64 c2i(string c) { return Int64.Parse(c); }
        //static double c2d(string c) { return double.Parse(c); }
        static string bool2ret(bool b) { return b ? "Yes" : "No"; }
    }
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  double ans=0;
  for(int i=0;i<N;i++){
    ans+=(double)1/A[i];
  }
  cout << fixed << setprecision(6);
  cout << (double)1/ans << endl;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[105];

int main()
{
    int N;
    cin >> N;
    ll d = 1;
    REP(i, N)
    {
        cin >> A[i];
        if (A[i] % 2 == 0)
            d *= 2;
    }
    cout << pow(3LL, N) - d << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <stdio.h>
#include <vector>
#include <functional>
#include <unordered_set>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

const int N = 2e5 + 10;
long long a[N];
long long pref[N];
long long suff[N];
long long sum[N];



int main()
{
	::ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int q;
	cin >> q;
	while (q--) {
		int k;
		cin >> k;
		int cnt[2] = { 0,0 };
		long long pairs = 0;
		long long ans = 0;
		for (int i = 0; i < k; ++i) {
			if (s[i] == 'D') {
				cnt[0]++;
			} else if (s[i] == 'M') {
				cnt[1]++;
				pairs += cnt[0];
			} else if (s[i] == 'C') {
				ans += pairs;
			}
		}
		for (int i = k; i < n; ++i) {
			if (s[i - k] == 'D') {
				pairs -= cnt[1];
				--cnt[0];
			} else if (s[i - k] == 'M') {
				cnt[1]--;
			}

			if (s[i] == 'D') {
				cnt[0]++;
			}
			else if (s[i] == 'M') {
				cnt[1]++;
				pairs += cnt[0];
			}
			else if (s[i] == 'C') {
				ans += pairs;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}

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

bool pair_compare(pair<pair<string,int>,int> a,pair<pair<string,int>,int> b){
  if(a.first.first != b.first.first) return a.first.first < b.first.first;
  else if(a.first.second != b.first.second) return a.first.second > b.first.second;
  else return true;
}

int main(){
  int N;
  cin >> N;
  vector<pair<pair<string,int>,int>> v;
  for(int i=0;i<N;++i){
    string r;int p;
    cin >> r >> p;
    v.push_back(make_pair(make_pair(r,p),i+1));
  }
  sort(v.begin(),v.end(),pair_compare);
  for(int i=0;i<v.size();++i){
    cout << v[i].second << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
  int n,i,m;
  cin >> n;

  int kazu[n],suzi;

  for(i = 0;i < n;i++){

    cin >> suzi;
    kazu[i] = suzi;
  }

  for(m = n-1;m >= 0;m--){
    if(m == 0){
      cout << kazu[m];
    }
      else{
    cout << kazu[m] << " ";
      }
  }
  cout << "\n";
}

Measured memory_bytes: 1164
#100b
D,N = map(int, input().split())

if D==0:
    if N!=100:
        print(N)
    else:
        print(1*(N+1))
elif D==1:
    if N!=100:
        print(100*N)
    else:
        print(100*(N+1))
elif D==2:
    if N!=100:
        print(10000*N)
    else:
        print(10000*(N+1))

Measured memory_bytes: 3060
#include<stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

void deep(void);
void deepsearch(int);
int n,A[MAX][MAX],s[MAX],e[MAX],c[MAX],time;

int main()
{
int i,j,x,y,z;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)
      A[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&x,&y);
    for(j=0;j<y;j++)
      {scanf("%d",&z);
	A[x-1][z-1]=1;}
  }
deep();

return 0;  
}

void deep()
{
 int i;
 for(i=0;i<n;i++)
   {c[i]=WHITE;
    time=0;    }
for(i=0;i<n;i++){
if(c[i]==WHITE)deepsearch(i);}
for(i=0;i<n;i++)
  printf("%d %d %d\n",i+1,s[i],e[i]);
}

void deepsearch(int x)
{int i;
c[x]=GRAY;
s[x]=++time;
for(i=0;i<n;i++){
if(A[x][i]==0)continue;
if(c[i]==WHITE)deepsearch(i);
  }
c[x]=BLACK;
e[x]=++time;
}



Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 202;
int g[N][N];

int dfs(int w, int b){
    if(g[w][b]>=0) return g[w][b];

    vector<bool> ap(N);
    if(w>0) ap[dfs(w-1,b)] = true;
    for(int i=1; i<=min(w,b); ++i) ap[dfs(w,b-i)] = true;
    if(b>0) ap[dfs(w+1,b-1)] = true;

    int ret = N;
    rep(i,N)if(!ap[i]){
        ret = i;
        break;
    }
    return g[w][b] = ret;
}

int main(){
    memset(g,-1,sizeof(g));

    int n;
    cin >>n;

    int a = 0;
    rep(i,n){
        int w,b;
        cin >>w >>b;
        a ^= dfs(w,b);
    }

    cout << !a << endl;
    return 0;
}



Measured memory_bytes: 3320
A, B, C, K = [int(i) for i in input().split(" ")]
N = [A, B, C]
for i in range(len(N)):
    K -= N[i]
    if K == 0:
        if i == 0:
            N[i+1] = 0
            N[i+2] = 0
        elif i == 1:
            N[i+1] = 0
        break
    elif K < 0:
        if i == 0:
            N[i+1] = 0
            N[i+2] = 0
        elif i == 1:
            N[i+1] = 0
        N[i] += K
        break
print(1 * N[0] -1 * N[2])

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

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

	string s;

	cin >> s;

	if(s=="Sunny")
	{
		cout << "Cloudy" << '\n';
	}
	else if(s=="Cloudy")
	{
		cout << "Rainy" << '\n';
	}
	else
	{
		cout << "Sunny" << '\n';
	}
	
	return 0;	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    }

    private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    }
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll Pow(ll A, ll N){
  if (N == 0) return 1;
  if (N % 2 == 0) return Pow(A*A%MOD2, N/2);
  return A * Pow(A*A%MOD2, N/2) % MOD2;
}

ll N, A, B, K, nCr[int(3e5+5)];

int main(){
  cin >> N >> A >> B >> K;
  nCr[0] = 1;
  for (ll i = 1; i <= N; i++){
    nCr[i] = nCr[i-1] * (N+1-i) % MOD2;
    nCr[i] *= Pow(i, MOD2-2); nCr[i] %= MOD2;
  }

  ll ans = 0;
  for (ll i = 0; i <= N; i++){
    ll rest = K - A * i;
    if (rest % B != 0) continue;
    rest /= B;
    if (rest > N || rest < 0) continue;

    ll now = nCr[i] * nCr[rest] % MOD2;
    ans += now; ans %= MOD2;
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
int gcd(int a, int b){ return (a%b ? gcd(b,a%b) : b); }

int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> store(n);

    rep(i,n){
        int a,b;
        cin >> a >> b;
        store[i] = make_pair(a,b);
    }
    sort(store.begin(),store.end());

    long long money = 0;
    long long count = 0;
    rep(i,n){
        rep(j,store[i].second){
            money += store[i].first;
            count++;
            if(count >= m){
                cout << money << endl;
                return 0;
            }
        }
    }
    cout << money << endl;

    return 0;
}

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

int main(){
  int a,b;
  cin>>a>>b;
  if((a+b)%3==0||a%3==0||b%3==0){
    cout <<"Possible"<<endl;
  }else {cout <<"Impossible"<<endl;}
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
def ffo(x)
  a = x%10
  b = 0
  while x != 0
    b = x
    x /= 10
  end
  return b , a
end

mp = Hash.new(0)
1.upto(n) do |i|
  mp[ffo(i)] += 1
end
ans = 0
1.upto(n) do |i|
  pp = ffo(i)
  qq = [pp[1], pp[0]]
  ans += mp[qq]
end
p ans

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

int main(){
    int n, k, ans = 0;
    cin >> n >> k;
    vector<int> l(n);
    for(int i = 0; i < n; i++)cin >> l[i];
    sort(l.rbegin(), l.rend());
    for(int i = 0; i < k; i++)ans += l[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
N,M = list(map(int,input().split()))
MAX = float('-inf')
MIN = float('inf')
for i in range(M):
    L,R = list(map(int,input().split()))
    MAX = max(MAX, L)
    MIN = min(MIN, R)
count = MIN - MAX + 1
if count > 0:
    print(count)
else:
    print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;


void solve(){
  int a, p; cin >> a >> p;
  cout << (3 * a + p) / 2 << endl;

  return;
}

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


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)        (abs((a)-(b)) < EPS)
#define CILING(a, b)    (((a)+(b)-1LL)/(b))

template<class T>
using PIT = pair<int, T>;
template<class T>
using PTI = pair<T, int>;
using PII = pair<int, int>;
using PDI = pair<double, int>;
using LL  = long long;
using ULL = unsigned long long;
// }}}

int main() {
    int n;cin >> n;
    cout << (n/100 == n%10 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

int main()
{
    string S;
    cin >> S;

    int ans;
    for(int i = 2; i < S.size(); i+=2)
    {
        string copy = S;
        for(int j = 0; j < i; j++)
        {
            copy.pop_back();
        }

        string half1, half2;
        for(int j = 0; j < copy.size(); j++)
        {
            if (j < copy.size()/2)
                half1.push_back(copy[j]);
            else
                half2.push_back(copy[j]);
        }
        if (half1 == half2)
        {
            ans = copy.size();
            break;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>

void count (const char *str, int n[]) {
	int c[26];
	for (int i=0; i<26; i++)
		c[i] = 0;
	int idx=0;
	while (str[idx]!='\0')
		c[(int)(str[idx++]-'a')] ++;

	for (int i=0; i<26; i++)
		if (c[i] < n[i]) n[i] = c[i];
}

int main () {
	int n;
	int aln[26];
	for (int i=0; i<26; i++)
		aln[i] = 100;
	char S[50][51];
	scanf ("%d", &n);
	for (int i=0; i<n; i++) {
		scanf ("%s", S[i]);
		count (S[i], aln);
	}
	for (int i=0; i<26; i++)
		while ((aln[i]--)>0)
			putchar (i+'a');
	putchar ('\n');
	return 0;
}

Measured memory_bytes: 128
const input = require("fs").readFileSync("/dev/stdin", "utf8").trim();
const array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
const K = +input.split('\n')[0];
console.log(array[K - 1]);

Measured memory_bytes: 21064
import java.util.*;

public class Main {

    static Scanner in = new Scanner(System.in);
    void solve() {
        String s = in.nextLine(), t = in.nextLine();
        if(s.charAt(0) == t.charAt(2) && s.charAt(1) == t.charAt(1) && s.charAt(2) == t.charAt(0)){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}

Measured memory_bytes: 21588
use text_io::*;
use itertools::Itertools;

fn main() {
    let a: usize = read!();
    let mut sum: usize = 0;
    let b: Vec<usize> = a.to_string().chars().map(|a|a.to_digit(10).unwrap() as usize).collect_vec();
    for i in 0..b.len() {
        sum+=b[i];
    }
    println!("{}",if a%sum==0 {"Yes"}else{"No"})
}

Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int in(){int x; scanf("%d",&x); return x;}
static const int MAX = 100;


int main(){
  int N = in(), d[MAX], sum = 0;
  rep(i, N) d[i] = in();

  rep(i, N){
    for(int j = i+1; j < N; j++){
      sum += d[i]*d[j];
    }
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
   
#define MAX 1000000000
#define MIN 1
#define IS_ERR(n) (n < MIN || n > MAX)
   
int main(void)
{
    int a, b, d, r;
    double f;
   
    scanf("%d %d", &a, &b);
   
    if(IS_ERR(a) || IS_ERR(b)) return -1;
   
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
   
    printf("%d %d %lf\n", d, r, f);
   
    return 0;
}


Measured memory_bytes: 2060
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int64_t dp[128][512] = {};
// dp[i][j] := i 個使用して重さの総和が j + w_0 * i となるときの価値の最大値

int main() {
    int N; int64_t W; cin >> N >> W;
    vector<pair<int64_t, int64_t>> goods(N);
    rep(i, N) {
        int64_t w, v; cin >> w >> v;
        goods[i] = {w, v};
    }

    int64_t sum = 0;
    rep(i, N) {
        int64_t ww = goods[i].first - goods[0].first;
        // 荷物iを複数回使わないように逆に回す
        for (int j = i; j >= 0; --j) { // 荷物iを含まないでj個
            for (int k = sum; k >= 0; --k) { // 荷物iを含まない時の重さがk
                dp[j + 1][k + ww] =
                    max(dp[j + 1][k + ww],
                        dp[j][k] + goods[i].second);
            }
        }
        sum += ww;
    }
    int64_t ans = 0;
    rep(i, N + 1) {
        rep(j, sum + 1) {
//            debug(goods[0].first * i + j);
            if (goods[0].first * i + j > W) continue;

            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1272
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,a[50],b[50];
  cin >> n;
  int k;
  int t=0;
  string s="0000000000000000000000000000000000000000000000000";
  bool f= false;
  a[0]=1;
  a[1]=-2;
  b[0]=1;
  for(int i=1;i<50;i++){
    b[i]=b[i-1]*(-2);
  }
  for(int i=2;i<50;i=i+2){
    a[i]=a[i-1]*(-2)+1;
    a[i+1]=a[i]*(-2);
  }
  if(n==0){
    cout << '0' << endl;
  }
  if(n<0){
    k=1;
    while(n<a[k]){
      k=k+2;
    }
  }else{
    k=0;
    while(n>a[k]){
      k=k+2;
    }
  }


  while(k>-1){
    if(k==0){
      t = 1;
    }
    if(n==0){
      s[0]='0';
      break;
    }
    n=n - b[k];
    s[k]='1';
    if(t==1){
      break;
    }
    if(n<0){
      k=1;
      while(n<a[k]){
        k=k+2;
      }
    }else{
      k=0;
      while(n>a[k]){
        k=k+2;
      }
    }

  }
  for(int i=48;i>=0;i--){
    if(s[i]=='1'){
      f=true;
    }
    if(f){
      cout << s[i];
    }
  }

}


Measured memory_bytes: 256
'use strict'

function main(input) {
    let a = Number(input.split('\n')[0].split(' ')[0]); // 赤
    let b = Number(input.split('\n')[0].split(' ')[1]); // 緑
    let c = Number(input.split('\n')[0].split(' ')[2]); // 青
    let k = Number(input.split('\n')[1].split(' ')[0]); // 操作回数
    let ans;
    for (let i = 0; i <= k; i++) {
        if ((c * 2**(k-i) > b * 2**i) && (b * 2**i > a)) {
            ans = 'Yes';
            break;
        } else {
            ans = 'No';
        }
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29648
#include <stdio.h>
#include <string.h>
int xmax(int a,int b){
	if(a>b){
		return a;
	}
	else{
		return b;
	}
}
int main(void){
char str[3];
scanf("%s",str);
int raindays=0,curr=0;
int i =0;
		for(i=0;i<3;i++){
			if(str[i]=='R'){
				curr++;
				raindays = xmax(raindays,curr);
			}
			else{
				curr=0;
			}
		}
		printf("%d\n",raindays);
	}





Measured memory_bytes: 1732
#include<stdio.h>
int main(){
  int a[100],c=0,n,j,i,s;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(a[j]<a[j-1]){
	s=a[j];
	a[j]=a[j-1];
	a[j-1]=s;
	c++;
      }
    }
  }
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n%d\n",a[n-1],c);
       return 0;
       }

Measured memory_bytes: 600
#include<stdio.h>
#include<string.h>

int main(){

  int count,i,slen,n;
  char str[101];
  count=0;
  while(scanf("%s",str)!=EOF){
    slen=strlen(str);
    n=slen/2;
    for(i=0;i<n;i++)
      if(str[i]!=str[slen-i-1]) break;	     
    if(i==n) count++;      
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int ac=0, wa=0, tle=0, re=0;
	int n;
	cin >> n;
	while(n--){
		string s;
		cin >> s;
		if(s=="AC") ac++;
		if(s=="WA") wa++;
		if(s=="TLE") tle++;
		if(s=="RE") re++;
	}

	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	// cin >> t;

	while(t--) test_case();
	
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i,a,b) for(int i=a;i<=b;i++)
int n,sum;
int main()
{
	int t;
	cin>>n;
	rep(i,1,n)
	{
		cin>>t;
		sum+=t;
	}
	cout<<sum-n;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, l;
    cin >> n >> l;

    vs32 a(n + 1);
    rep(i, n) cin >> a[i];
    a[n] = (int)1e9;

    int idx;
    for (idx = 0; idx < n && a[idx] + a[idx + 1] < l; ++idx);

    if (idx == n - 1)
    {
        cout << "Impossible\n";
    }
    else
    {
        cout << "Possible\n";
        for (int i = 1; i <= idx; ++i)
        {
            cout << i << "\n";
        }
        for (int i = n - 1; i > idx; --i)
        {
            cout << i << "\n";
        }
    }

    return 0;
}



Measured memory_bytes: 1280
<?php

list($n, $k) = explode(' ', trim(fgets(STDIN)));
$h = explode(' ', trim(fgets(STDIN)));

rsort($h, SORT_NUMERIC);

for ($i = 0; $i < (int) $k; $i++) {
    unset($h[$i]);
}

echo array_sum($h) . PHP_EOL;


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vi64 a(x), b(y), c(z);
  cin >> a >> b >> c;
  vi64 ab(x * y);
  rep(i, x) rep(j, y) ab[i * y + j] = a[i] + b[j];
  sort(all(ab));
  reverse(all(ab));
  if (ab.size() > k) ab.resize(k);
  vi64 abc(ab.size() * z);
  rep(i, ab.size()) rep(j, z) abc[i * z + j] = ab[i] + c[j];
  sort(all(abc));
  reverse(all(abc));
  rep(i, k) cout << abc[i] << endl;
}


Measured memory_bytes: 31616
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <set>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <iomanip>
#include <list>
#include <limits>

using namespace std;

class cPartition
{
	int mn;
	int mpi;
	vector<int> m_va;

public:
	cPartition(int n, vector<int> &va)
		: mn(n)
	{
		m_va = va;
	}

	void partition(); 
	void output();
};

void cPartition::partition()
{
	int p = 0;
	int r = m_va.size() - 1;
	int x = m_va[r];
	int i = p - 1;
	for (int j = p; j <= r - 1; ++j)
	{
		if (m_va[j] <= x)
		{
			++i;
			swap(m_va[i], m_va[j]);
		}
	}
	swap(m_va[i + 1], m_va[r]);
	mpi = i + 1;
}

void cPartition::output()
{
	for (int i = 0; i < mn - 1; ++i)
	{
		if (i == mpi)
		{
			cout << "[" << m_va[i] << "]" << " ";
		}
		else
		{
			cout << m_va[i] << " ";
		}
	}
	cout << m_va[mn - 1] << endl;
}

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

	int n;
	cin >> n;
	cin.ignore();

	int a;
	vector<int> va;
	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		va.push_back(a);
	}

	cPartition cp(n, va);
	cp.partition();
	cp.output();

	return 0;
}

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
using ll = long long;

map<int,int>mp;

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  rep(i,n)mp[a[i]]++;
  ll sum=0;
  for(auto x:mp){
    ll y=x.se;
    sum+=y*(y-1)/2;
  }
  rep(i,n){
    ll temp=sum;
    ll x=mp[a[i]];
    temp-=x*(x-1)/2;
    x--;
    temp+=x*(x-1)/2;
    cout<<temp<<endl;
  }
  return(0);
}



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

struct Info {
    int value, weight;
    long date;
    char type;
    string name;

    Info(int v, int w, char t, long d, string n) {
        value = v;
        weight = w;
        type = t;
        date = d;
        name = n;
    }
    bool operator<(const Info& obj) {
        if (value != obj.value) {
            return value < obj.value;
        } else if (weight != obj.weight) {
            return weight < obj.weight;
        } else if (type != obj.type) {
            return type < obj.type;
        } else if (date != obj.date) {
            return date < obj.date;
        } else {
            return name <= obj.name;
        }
    }
    void print() {
        printf("%d %d %c %ld ", value, weight, type, date);
        cout << name << endl;
    }
};

int main(void) {
    vector<Info> vec;
    int n;
    cin >> n;
    int v, w;
    char t;
    long d;
    string s;
    for (int i = 0; i < n; i++) {
        cin >> v >> w >> t >> d >> s;
        vec.push_back(Info(v, w, t, d, s));
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < vec.size(); i++) {
        vec[i].print();
    }
}


Measured memory_bytes: 12276
import bisect
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()

data = [None] * m
for i in range(m):
    data[i] = list(map(int, input().split()))
data.sort(key = lambda x : x[1])
data.reverse()


ans = 0
count = 0
pre_index = 0
#print(data)
#print(a)
#data[][1] = value, data[][0] = card_num
for i in range(m):
    insert_index = bisect.bisect_left(a, data[i][1])
    count = min(data[i][0], insert_index - pre_index)
    for j in range(pre_index, pre_index + count):
        if j >= n:
            break
        a[j] = 0
    ans += count * data[i][1]
    pre_index = pre_index + count
print(ans + sum(a))


Measured memory_bytes: 32988
while True:
	try:
		n = input()
		num = format(n, 'b').zfill(10)
		num = list(str(num))
		num.reverse()
		ans = []
		for i in range(10):
			if num[i] == '1':
				ans.append(2**i)
		print " ".join(map(str, ans))
	except:
		break

Measured memory_bytes: 4216