akhauriyash/Code-Regression huggingface dataset:
#include<bitset>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, K;
string S[2011];
char buf[100111];

using Bits = bitset<10011>;
Bits vis;
Bits dp[2011];

const int INF = 1<<29;
int mi[10011];
string ans;

void MAIN() {
    scanf("%d%d", &N, &K);
    REP (i, N) {
	scanf("%s", buf);
	S[i] = buf;
    }

    vis.set(K);
    for (int i=N; i--;) {
	REP (j, K-(int)S[i].size()+1) if (vis.test(j+S[i].size())) {
	    vis.set(j);
	    dp[i].set(j);
	}
    }

    REP (k, K+1) mi[k] = INF;
    mi[0] = 0;

    ans = string(K, '~');

    REP (k, K) {
	for (int i=mi[k]; i<N; i++) if (dp[i].test(k)) {
	    int p = -1;
	    REP (j, S[i].size()) {
		if (S[i][j] != ans[k+j]) {
		    p = j;
		    break;
		}
	    }
	    if (p != -1) {
		if (S[i][p] < ans[k+p]) {
		    for (int j=k+p; j<K; j++) {

			if (j-k < (int)S[i].size()) {
			    ans[j] = S[i][j-k];
			} else {
			    if (ans[j] == '~') break;
			    ans[j] = '~';
			}
			mi[j+1] = INF;
		    }
		} else {
		    continue;
		}
	    }

	    amin(mi[k+(int)S[i].size()], i+1);
	}
    }

    puts(ans.c_str());
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3840
#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 INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>ar[i];
		arr[ar[i]]++;
	}
	ll cx = 0;
	for(int i=1;i<MV;i++)
	{
		if(arr[i] < 2)
		continue;
		else cx += (((arr[i]-1) * arr[i])>>1LL);	
	}
	// cout<<cx<<"\n";
	for(int i=0;i<n;i++)
	{
		if(arr[ar[i]] < 2)
		cout<<cx<<"\n";
		else
		{
			cx -= (((arr[ar[i]]-1) * arr[ar[i]])>>1LL);
			arr[ar[i]]--;
			if(arr[ar[i]] >= 2)
			cx += (((arr[ar[i]]-1) * arr[ar[i]])>>1LL);
			cout<<cx<<"\n";
			if(arr[ar[i]] >= 2)
			cx -= (((arr[ar[i]]-1) * arr[ar[i]])>>1LL);
			arr[ar[i]]++;
			cx += (((arr[ar[i]]-1) * arr[ar[i]])>>1LL);	
		}	
	}
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

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

long long gcd(long long N, long long M){
    return M?gcd(M,N%M):N;
}

long long lcm(long long N,long long M){
    return N*M / gcd(N,M);
}

int main(){
    long long a,b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}


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

int main() {
  int a[3];
  rep(i, 3) cin >> a[i];
  sort(a, a + 3);
  int b = a[2] - a[0], c = a[2] - a[1];
  int ans = 0;
  if (b % 2 == 0 && c % 2 == 0) ans = b / 2 + c / 2;
  if (b % 2 == 0 && c % 2 == 1) ans = b / 2 + (c+1) / 2 + 1;
  if (b % 2 == 1 && c % 2 == 0) ans = (b+1) / 2 + c / 2 + 1;
  if (b % 2 == 1 && c % 2 == 1) ans = (b-1) / 2 + (c-1) / 2 + 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

ll a[212345];
multiset<pair<ll, ll>, greater<pair<ll, ll>>> st;

int main(){
	int n; scanf("%d", &n);
	REP(i, n) scanf("%lld", a+i);
	sort(a, a+n, greater<ll>());
	st.emplace(a[0], a[0]);
	ll ans = 0;
	FOR(i, 1, n){
		ll b = a[i];
		auto it = st.begin();
		auto [c, d] = *it;
		st.erase(it);
		ans += c;
		st.emplace(min(b, c), max(b, c));
		st.emplace(min(b, d), max(b, d));
		// for(auto [e, f] : st) DEBUG("(%lld, %lld) ", e, f); DEBUG("\n");
	}
	printf("%lld\n", ans);
}




Measured memory_bytes: 17872
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
int main() {
    int N;
    cin >> N;
    
    vector<int>A(N);
    rep(i, 0, N){
        cin >> A[i];
    }
    ll sum = 0;
    rep(i, 0, N) sum ^= A[i];
    rep(i, 0, N) A[i] ^= sum;
    rep(i, 0, N){
        cout << A[i] << " ";
    }
    return 0;
}


Measured memory_bytes: 3984
#include <iostream>
using namespace std;
void ABC140(void);
void ABC141(void);
void ABC142(void);
void ABC143(void);
void ABC144(void);
void ABC145(void);
void ABC146(void);
void ABC147(void);
void ABC148(void);
void ABC149(void);

int main(void){
    ABC146();
}

void ABC146(){
    string s;
    cin>>s;
    int ans;
    if(s=="SUN")ans=7;
    if(s=="MON")ans=6;
    if(s=="TUE")ans=5;
    if(s=="WED")ans=4;
    if(s=="THU")ans=3;
    if(s=="FRI")ans=2;
    if(s=="SAT")ans=1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
const int N=405;
const int mod=998244353;
int n,a[N],b[N],jc[N],inv[N],sum[N],f[N][N][N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
int kuai(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=res*a%mod;
		a=a*a%mod;
		b=b/2;
	}
	return res;
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),b[i]=read();
	jc[0]=jc[1]=inv[0]=inv[1]=1;
	for(int i=2;i<=400;i++)jc[i]=jc[i-1]*i%mod;
	for(int i=2;i<=400;i++)inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	for(int i=2;i<=400;i++)inv[i]=inv[i]*inv[i-1]%mod;
	int s1=0,s2=0;
	f[0][0][0]=mod-1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=s1;j++)
			for(int k=0;k<=s2;k++)
				f[i][j][k]=f[i-1][j][k];
		sum[0]=1;
		for(int j=1;j<b[i];j++)sum[j]=sum[j-1]*a[i]%mod;
		for(int j=0;j<b[i];j++)sum[j]=sum[j]*inv[j]%mod;
		for(int j=0;j<=s1;j++)
			for(int k=0;k<=s2;k++)
				for(int p=0;p<b[i];p++)
					f[i][j+p][k+a[i]]=(f[i][j+p][k+a[i]]-f[i-1][j][k]*sum[p]%mod+mod)%mod;
		s1+=b[i]-1;s2+=a[i];
	}
	int ans=0;
	for(int i=0;i<=s1;i++)
		for(int j=1;j<=s2;j++)
		{
			int x=f[n][i][j]*jc[i]%mod;
			x=x*kuai(kuai(j,mod-2),i)%mod;
			ans=(ans+x*s2%mod*kuai(j,mod-2)%mod)%mod;
		}
	cout<<ans;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  
  if(A>=13){
    cout << B << endl;
  }
  else if(6<=A && A<=12){
    cout << B/2 << endl;
  }
  else{
    cout << 0 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
#define DBG(str) cerr<<(str)<<endl;
int main() {
	ll d, n;
	cin >> d >> n;
	ll k = 1;
	if (d == 0)k = 1;
	for (ll i = 0; i < d; i++)k *= 100;
	if(n!=100) cout << k*n << endl;
	else cout << k*n + k;

	return 0;
}





Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int x1[50],y1[50],x2[50],y2[50];
long long M[105][105];
vector<int> vx,vy;

int get(vector<int> v, int x){
    for(int i = v.size() - 1;i >= 0;--i)
        if(v[i] == x) return i;
    return -1;
}

int dr[] = {-1,1,0,0},dc[] = {0,0,-1,1};
int nx,ny;

void dfs(int r, int c, long long cur){
    M[r][c] = -1;
    
    for(int k = 0;k < 4;++k){
        int r2 = r + dr[k],c2 = c + dc[k];
        
        if(r2 >= 0 && r2 < nx && c2 >= 0 && c2 < ny && M[r2][c2] == cur)
            dfs(r2,c2,cur);
    }
}

int main(){
    int n;
    
    while(true){
        scanf("%d",&n);
        if(n == 0) break;
        
        vx.clear(); vy.clear();
        vx.push_back(-1);
        vy.push_back(-1);
        
        for(int i = 0;i < n;++i){
            scanf("%d %d %d %d",&x1[i],&y1[i],&x2[i],&y2[i]);
            vx.push_back(x1[i]);
            vx.push_back(x2[i]);
            vy.push_back(y1[i]);
            vy.push_back(y2[i]);
        }
        
        sort(vx.begin(),vx.end());
        sort(vy.begin(),vy.end());
        vx.erase(unique(vx.begin(),vx.end()),vx.end());
        vy.erase(unique(vy.begin(),vy.end()),vy.end());
        nx = vx.size(); ny = vy.size();
        
        memset(M,0,sizeof M);
        
        for(int i = 0;i < n;++i){
            x1[i] = get(vx,x1[i]);
            x2[i] = get(vx,x2[i]);
            y1[i] = get(vy,y1[i]);
            y2[i] = get(vy,y2[i]);
            
            for(int j = x1[i];j < x2[i];++j)
                for(int k = y2[i];k < y1[i];++k)
                    M[j][k] |= (1LL << i);
        }
        
        int ans = 0;
        
        for(int i = 0;i < nx;++i)
            for(int j = 0;j < ny;++j)
                if(M[i][j] >= 0){
                    dfs(i,j,M[i][j]);
                    ++ans;
                }
        
        printf("%d\n",ans);
    }
    
    return 0;
}

Measured memory_bytes: 1500
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<int,int> pii;
    #define endl '\n'
    #define mod 1000000007
    #define modd 998244353
    #define PI 3.1415926535897932384626
    #define all(x) x.begin(),x.end()
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
     
    void io() {
    	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
    	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
    	#endif
    }
     
    const int MAX=1e6+1;
    int cnt[MAX];
    bool vis[MAX];
     
    int main() {
    	io();
    	
    	int n;
    	cin>>n;
    	for(int i=0;i<n;i++) {
    		int a; cin>>a;
    		cnt[a]++;
    	}
    	int ans=0;
    	for(int i=1;i<=MAX;i++) {
    		if(vis[i] || cnt[i]==0) continue;
    		if(cnt[i]==1) ans++;
    		for(int j=i;j<=MAX;j+=i)
    			vis[j]=true;
    	}
    	cout<<ans;
    	return 0;
    }

Measured memory_bytes: 8528
package main
import "fmt"

var (
	n int
  	arr  [100000]int
)


func main(){
  m := map[int]int{}
  fmt.Scan(&n)
  for i:=0;i<n;i++{
    fmt.Scan(&arr[i])
    if _,ok := m[arr[i]];!ok{
    	m[arr[i]] = 0
    }
    
    m[arr[i]] += 1
  }
  k := n - 1
  isable := true
  for ;k>=0;k -=2 {
    if k == 0 {
      if m[k] != 1{
      	isable = false
        break
      }
    }else{
        if m[k] != 2{
        	isable = false
          break
        }
   }
      
}
    if isable{
      q := modpow(2,n/2,1000000007)
      fmt.Println(q)
    }else{
      fmt.Println(0)
    }
  }


func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

Measured memory_bytes: 8704
def getint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

wide,high,x,y = getint()
a,b = 0,0
if wide == 2*x and high == 2*y:
    b = 1
a = wide*high/2
print(a,b)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
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;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    string S,T;cin>>S>>T;
    bool ok=false;
    for(char c='a';c<='z';c++){
        if(S+c==T)ok=true;
    }
    cout<<(ok?"Yes":"No")<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<iomanip>

using namespace std;
int main(void) {
	int a, b, c, d, e;
	int k;
	
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> k;
	
	if ((k>=b-a)&&(k>=c-a)&&(k>=d-a)&&(k>=e-a)&&(k>=c-b)&&(k>=d-b)&&(k>=e-b)&&(k>=d-c)&&(k>=e-c)&&(k>=e-d))
		cout << "Yay!";
	else
		cout<<":(";


	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
 
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cout << #x << " = " << x << endl;
 
template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}
 
template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();    
    return 0;
}
 
const int MOD = 998244353, MAXN = 2e5 + 10, INF = 1e18 + 10, BASE = 37; 

void solve() {
   	string s;
   	cin >> s;
   	cout << s.substr(0, 3) << endl;
}	

Measured memory_bytes: 3604
N, M = map(int, input().split())
X = sorted([int(x) for x in input().split()])
if N >= M:
    print(0)
    exit()
diff = []
for i, x in enumerate(X):
    if i == 0:
        diff.append((0, 0))
        continue
    diff.append((i, X[i] - X[i - 1]))
diff.sort(key=lambda x: x[1], reverse=True)
indices = sorted([e[0] for e in diff[:N-1]])
start = 0
step = 0
for end in indices:
    step += X[end - 1] - X[start]
    start = end
step += X[-1] - X[start]
print(step)


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

int main() {
  string c;
  cin >> c;
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u")
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 2000000000;
const long long biggest = 1000000000000000000LL;
const double eps = .0000000001; 


int main ()
{
  prep();
  int n;
  cin >> n;
  set<string> st;
  for (int i=0; i<n; i++){
      string s;
      cin >> s;
      st.insert(s);
  }
  cout << st.size();
  return 0;
}


Measured memory_bytes: 19244
#include<iostream>
int main(){
	int n;
	while(1){
		std::cin>>n;
		if(std::cin.eof())break;
		int e=0;
		for(int a=0;a<=9;a++){
			for(int b=0;b<=9;b++){
				for(int c=0;c<=9;c++){
					for(int d=0;d<=9;d++){
						if(a+b+c+d==n)e++;
					}
				}
			}
		}
		std::cout<<e<<std::endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef vector<pll> vll;
typedef vector<vl> vvl;

#define fori(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i >= 0; i--)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define trav(x, a) for (auto &x : a)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define sz(a) (int)(a).size()
#define fi first
#define se second

clock_t time_p = clock();
void time_taken()
{
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}

const ll mod = 1e9 + 7;
const ll INF = 1e18;

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

    ll n;
    cin >> n;
    ll d;
    cin >> d;
    ll ans = 0;
    fori(i, n)
    {
        ll x, y;
        cin >> x >> y;
        ll r = x * x + y * y;
        if(r <= d*d){
            ans++;
        }
    }
    cout << ans << endl;
    time_taken();
    return 0;
}

Measured memory_bytes: 3804
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n"),t=Number(r[0]),n=r[1].split(" ").map(function(e){return Number(e)}),o=new Array(t).fill(0),u=t-1;u>0;u--)n[u]<=n[u-1]?o[u-1]=o[u]+1:o[u-1]=0;var i=Math.max(...o);console.log(i)}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 30464
import java.util.*; 
public class Main {

  public static void main(String[] args) {
  
  Scanner sc=new Scanner(System.in);
  String s=sc.next();
  int ans=0;
  for(int i=0;i<4;i++){
    if(s.charAt(i)=='+'){
      ans++;
    }
    else{
      ans--;
    }
  }
  System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	int d[N];
	for(int i = 0; i < N; i++) cin >> d[i];

	ll ans = 0;
	for(int i = 0; i < N - 1; i++) {
		for(int j = i + 1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
char a[200000];
int main()
{
    int i,n,m,j,k,l;
    scanf("%s",a);
    for(i=0;i<strlen(a);i++)
    {
        if((i+1)%2==1)
        {
            printf("%c",a[i]);
        }
    }
    return 0;
}


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

// from http://drken1215.hatenablog.com/entry/2018/08/05/224100

int main(void) {
    int d,g;
    cin >> d >> g;
    vector<int> p(d),c(d);

    for(int i = 0; i < d; ++i) {
        cin >> p[i] >> c[i];
    }

    // solve
    int res = INT16_MAX;
    for(int bit = 0; bit < (1<<d); ++bit) {

        int sum = 0;
        int num = 0;

        for(int i= 0; i < d; ++i) {
            if (bit & (1<<i)) {
                sum += c[i] + p[i] * (i+1) * 100;
                num += p[i];
            }
        }

        if (sum >= g) {
            res = min(res, num);
        } else {
            for(int i= d-1; i>=0; --i) {
                if(bit & (1<<i)) {
                    continue;
                }
                for(int j = 0; j < p[i]; ++j) {
                    if(sum >= g) {
                        break;
                    }
                    sum += 100 * (i+1);
                    num++;
                }
            }
            res = min(res, num);
        }

    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

using namespace std;

int main()
{
    int n,x;
    cin >> n >> x;
    int l[n];
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    int d[n+1];
    d[0]=0;
    for(int i=1;i<=n;i++){
        d[i]=d[i-1]+l[i-1];
    }
    int ans=0;
    for(int i=0;i<=n;i++){
        if(x>=d[i])ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/all/GRL_6_A
#include <iostream>
#include <queue>
#include <limits>
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 16; }
#include <vector>
using ll = long long;
template <typename T>
struct Flow
{
    Flow(const std::size_t v) : V(v), edge(v) {}
    void addEdge(const std::size_t from, const std::size_t to, const T cap) { edge[from].push_back({to, edge[to].size(), cap}), edge[to].push_back({from, edge[from].size() - 1, (T)0}); }
    struct Edge
    {
        std::size_t to, rev;
        T cap;
    };
    const std::size_t V;
    std::vector<std::vector<Edge>> edge;
};
template <typename T>
ll Dinic(Flow<T>& flow, const std::size_t s, const std::size_t t)
{
    const std::size_t V = flow.V;
    std::vector<std::size_t> level(V, V), iter(V, 0);
    auto bfs = [&, V]() {
        std::fill(level.begin(), level.end(), V);
        std::queue<std::size_t> Q;
        Q.push(s), level[s] = 0;
        while (not Q.empty()) {
            const std::size_t s = Q.front();
            Q.pop();
            for (const auto& e : flow.edge[s]) {
                if (e.cap == 0 or level[e.to] != V) { continue; }
                level[e.to] = level[s] + 1, Q.push(e.to);
            }
        }
    };
    auto dfs = [&, V](auto&& self, const std::size_t s, const T f) -> T {
        if (s == t) { return f; }
        for (std::size_t& i = iter[s]; i < flow.edge[s].size(); i++) {
            auto& e = flow.edge[s][i];
            if (e.cap == 0 or level[e.to] == V or level[s] >= level[e.to]) { continue; }
            const T d = self(self, e.to, std::min(f, e.cap));
            if (d == 0) { continue; }
            e.cap -= d, flow.edge[e.to][e.rev].cap += d;
            return d;
        }
        return 0;
    };
    T f = 0;
    while (true) {
        bfs();
        if (level[t] == V) { return f; }
        std::fill(iter.begin(), iter.end(), 0);
        const T df = dfs(dfs, s, INF<T>());
        if (df == 0) { break; }
        f += df;
    }
    return f;
}
int main()
{
    std::size_t V, E;
    std::cin >> V >> E;
    Flow<std::size_t> F(V);
    for (std::size_t i = 0; i < E; i++) {
        std::size_t u, v, c;
        std::cin >> u >> v >> c;
        F.addEdge(u, v, c);
    }
    std::cout << Dinic(F, 0, V - 1) << std::endl;
}


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


int main(){
  ll n,k;
  cin>>n>>k;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  rep(i,n-k){
    if(a[i+k]-a[i]<=0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 3996
#include<bits/stdc++.h>
using namespace std;
#define dd double
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ll long long
#define ull unsigned long long
#define ld long double
#define mx 1000005
#define mod 1000000007
#define fr first
#define se second
#define End cout<<"\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define memo(Array,val) memset(Array, val, sizeof Array)
#define PI acos(-1)
bool check(ll n, ll pos){ return (n&(1<<pos)); }
bool Set(ll n, ll pos) {  return (n | (1<<pos)); }
ld LOG(ld b, ld e){ return log(b)/log(e); }

int tc=1;

void solve(int kk)
{
    ld r;
    cin >> r;
    cout << setprecision(14) << 2*PI*r << "\n";
}

int main()
{
   //freopen("text.txt", "r", stdin);
   //freopen("text2.txt", "w", stdout);
   fast;
   int kk=0;
   //cin >> tc;
   //scanf("%d", &tc);
   while(++kk<=tc) solve(kk);

   return 0;
}


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

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

int main(){
  int m, f, b; cin >> m >> f >> b;

  if( m >= b ) cout << 0 << endl;
  else if( ( m + f ) >= b ){
    cout << b - m << endl;
  }else{
    cout << "NA" << endl;
  }
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[4][4],c;
	int i,j;
	for(i=0;i<3;i++)
	{
		scanf("%s",a[i]);
	}
	printf("%c%c%c",a[0][0],a[1][1],a[2][2]);
	return 0;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]

C = [[0] * l for i in range(n)]

for i in range(n):
    for j in range(l):
        C[i][j] = str(sum(A[i][k] * B[k][j] for k in range(m)))

for i in range(n):
    print(' '.join(C[i]))

Measured memory_bytes: 8544
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int w,h;
	cin>>w>>h;
	char g[w][h];
	for(int i=0;i<w;i++)
		for(int j=0;j<h;j++)
				cin>>g[i][j];
	int row_present[w]={0};
	int col_present[h]={0};

	for(int i=0;i<w;i++)
	{
		int c=0;
		for(int j=0;j<h;j++)
		{
			if(g[i][j]=='.')
				c++;
		}
		if(c==h) row_present[i]++;
	}
	for(int i=0;i<h;i++)
	{
		int c=0;
		for(int j=0;j<w;j++)
		{
			if(g[j][i]=='.')
				c++;
		}
		if(c==w) col_present[i]++;
	}
	for(int i=0;i<w;i++)
	{
		if(row_present[i]==0)
		{
			for(int j=0;j<h;j++)
			{	
				if(col_present[j]==0)
					cout<<g[i][j];
			}
			cout<<endl;
		}
		
	}
	return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<int> rule(N+1);
  vector<int> res(1,1);
  for(int i=1;i<=N;i++){
    cin>>rule.at(i);
  }
  
 
  for(int i=0;i<N;i++){
    res.push_back(rule.at(res.at(i)));
  }
  
 
  int j=1;
  while(j<N+1){
    if(res.at(j)==2){cout<<j<<endl;break;}
    j++;
  }
  if (j==N+1){cout<<-1<<endl;}
}

Measured memory_bytes: 1276
from collections import defaultdict
import copy

N,A=map(int,input().split())
C=list(map(int,input().split()))
CA=[C[i]-A for i in range(N)]

CAMINUS=[]
CAPLUS=[]
ZERO=0
for c in CA:
    if c>0:
        CAPLUS.append(c)
    elif c<0:
        CAMINUS.append(c)
    else:
        ZERO+=1


MINDP=defaultdict(int)
PLUDP=defaultdict(int)

for c in CAMINUS:
    NDP=copy.copy(MINDP)
    for m in MINDP:
        NDP[m+c]+=MINDP[m]

    NDP[c]+=1

    MINDP=NDP

for c in CAPLUS:
    NDP=copy.copy(PLUDP)
    for m in PLUDP:
        NDP[m+c]+=PLUDP[m]

    NDP[c]+=1

    PLUDP=NDP


ANS=2**ZERO-1

for m in MINDP:
    ANS+=MINDP[m]*PLUDP[-m]*2**ZERO

print(ANS)


Measured memory_bytes: 3692
#include <iostream>

using namespace std;

int MAX = 1000000;
int c[1000010];

int main() {
	int n;
	
	for (int i=0; i<=MAX; i++) c[i] = 1;
	
	for (int j=2; 2*j<=MAX; j++) c[2*j] = 0;
	
	for (int i=3; i<=MAX/2; i++) {
		if (c[i]==0) continue;
		for (int j=2; i*j<=MAX; j++) {
			c[i*j] = 0;
		}
	}
		
	while (cin>>n) {
		
		int ans = 0;
		for (int i=2; i<=n; i++) {
			ans += c[i];
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 5060
from collections import deque

N = int(input())

A = deque(range(1,10))

count = 0
for _ in range(N):
    k = A.popleft()
    m = k % 10
    if m != 0:
        A.append(10 * k + m -1)
    A.append(10 * k + m)
    if m != 9:
        A.append(10 * k + m + 1)
print(k)
    

Measured memory_bytes: 11956
import sys
sys.setrecursionlimit(10 ** 7)
inp = sys.stdin.buffer.readline


def resolve():
    MOD = 10 ** 9 + 7

    n = int(inp())
    e = [[] for _ in range(n)]
    for _ in range(n - 1):
        x, y = map(lambda x: int(x) - 1, inp().split())
        e[x].append(y)
        e[y].append(x)

    # dp[i][0]:i番目のノードが白のときの組み合わせの数
    # dp[i][1]:i番目のノードが黒のときの組み合わせの数
    dp = [[1, 1] for _ in range(n)]
    visited = [False for _ in range(n)]

    def dfs(vi, prnt):
        # if visited[vi]:
        #     return
        visited[vi] = True

        for chld in e[vi]:
            if chld == prnt or visited[chld]:
                continue
            dfs(chld, vi)

            # 親が白なら子は白でも黒でもいい
            dp[vi][0] *= (dp[chld][0] + dp[chld][1]) % MOD
            dp[vi][0] %= MOD
            # 親が黒田と子は白じゃないとダメ
            dp[vi][1] *= dp[chld][0] % MOD
            dp[vi][1] %= MOD

    dfs(0, -1)
    print((dp[0][0] + dp[0][1]) % MOD)


if __name__ == "__main__":
    resolve()


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

typedef long long int ll;

int main(){
  ll X;
  cin >> X;
  ll cnt = 0;
  ll D = 0;
  for(ll i = 1;i < X*10;i++){
     D += i;
     cnt++;
     if(D >= X){
        break;
     }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    set<int>s;
    for(int i = 0;  i< n; i++){
        int x;
        cin >> x;
        s.insert(x);
    }
    int ans = s.size();
    if(ans % 2 ==0)ans--;
    cout << ans <<endl;
}


Measured memory_bytes: 4992
#include<stdio.h>

int main(void){
    int a,b,ans;
    char op;

    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op == '?')
            break;
        else if(op == '+')
            ans = a + b;
        else if(op == '-')
            ans = a - b;
        else if(op == '*')
            ans = a * b;
        else
            ans = a / b;
        printf("%d\n",ans);
    }

    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,K;
  cin >> N >> K;
  ll A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N-K; i++) {
    if (A[i] < A[i+K]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<ll> l(n);
    rep(i, n)cin >> l[i];

    int ans = 0;
    rep(i, n)rep(j, n)rep(k, n){
        if(i >= j || j >= k)continue;
        if(l[i] == l[j])continue;
        if(l[j] == l[k])continue;
        if(l[k] == l[i])continue;
        if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[k]+l[i]>l[j])ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int n, a[N];
int main(){
	scanf("%d", &n);
	int cnt = 0;
	for(int i = 0; i < n; ++i){
		scanf("%d", &a[i]);
		cnt += a[i];
	}
	a[n] = 0;
	n += 1;
	int ans = 0;
	while(cnt != 0){
		int mn = 1e9, temp = 0;
		for(int i = 0; i < n; ++i){
			if(a[i] == 0 && temp != 0){
				break;
			}
			else if(a[i] != 0){
				mn = min(mn, a[i]);
				temp ++;
			}
		}
		
		cnt -= (temp * mn);
		temp = 0;
		for(int i = 0; i < n; ++i){
			if(a[i] == 0 && temp != 0){
				break;
			}else if(a[i] != 0){
				a[i] -= mn;
				temp ++;
			}
		}
		ans += mn;
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 256
#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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
#define BOOST        ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define AZ(x)        x.begin(),x.end()
#define fi           first
#define se           second
#define pb           push_back
#define emp          emplace_back
#define mp           make_pair
#define mt           make_tuple
#define debug(x)     cerr << #x << " : " << x << endl;


template<typename T> using V = vector<T>;
template<typename T, typename U> using P = pair<T,U>;

typedef long long ll;
typedef long double ld;


template<typename T>
// for super_map add a parameter Y above and replace "null_type" with "Y"

// set with two additional super powers
    // find_by_order(int k) - returns k'th smallest element (0-indexed)
    // order_of_key(int k) - returns number of elements strictly smaller than k.
using super_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


const int mod=1e9+7,N=1e5+5;
const ll INF = 1e18;



ll power(ll a,ll b)
{
    a = a%mod;
    ll result = 1;

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

ll super_rand(ll n) // Random number from set [0,n-1]
{
    uniform_int_distribution<ll> uid(0, n - 1);
    return uid(rng);
}



/*

1. Make sure you're taking all the inputs.
2. In case of nested loops, remember to use different variables.
3. If in doubt, do int -> ll
4. Don't fight the question, try solving the next one.
5. ffs (positon of first set bit), clz (leading 0s, max->32), ctz (trailing 0s), popcount (set bits). Don't use any of these on 0;
*/



//  Don't code anything above this //


int main() 
{ 
    BOOST

    int k,x;
    cin>>k>>x;

    for(int i=x-k+1;i<=x+k-1;i++)
        cout<<i<<" ";
    cout<<"\n";
    return 0;    
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include <vector>
using namespace std;
int main() {
	long long n; string a, b, c; cin >> a >> b >> c;
	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
<?php
$n = intval(fgets(STDIN));
$str = trim(fgets(STDIN));
$Q = intval(fgets(STDIN));


function op($a, $b){return $a | $b;}

for($i = 0; $i < $n; $i++){
  $array[] = 1<<(ord($str[$i])-97);
}
$seg = new SegTree($array);

while($Q--){
  list($q, $a, $b) = explode(" ", trim(fgets(STDIN)));
  if($q == "1"){
    $seg->set($a-1, 1<<(ord($b)-97));
  }else{
    $ret[] = popcount($seg->get($a-1, $b));
  }
}
echo implode("\n", $ret);


class SegTree{
  public $tree;
  public $bits;
  function __construct($n){
    if(is_array($n)){
      $array = $n;
      $n = count($array);
      $this->bits = max(1, ceil(log($n)/log(2)));
      for($i = $n, $I = 2**$this->bits; $i < $I; ++$i){
        $array[] = 0;
      }
      $this->tree[0] = $array;
      $this->rollupAll();
    }else{
      $this->bits = max(1, ceil(log($n)/log(2)));
      for($i = 0; $i < $this->bits; ++$i){
        $this->tree[$i] = array_fill(0, 2**($this->bits-$i), 0);
      }
    }
  }
  function rollupAll(){
    for($i = 1; $i < $this->bits; ++$i){
      $treei = &$this->tree[$i];
      $treeim = $this->tree[$i-1];
      for($j = 0, $J = 2**($this->bits - $i); $j < $J; $j++){
        $treei[$j] = op($treeim[($j<<1)], $treeim[($j<<1)+1]);
      }
    }
  }
  function set($i, $amount){
    $this->tree[0][$i] = $amount;
    for($j = 1, $J = $this->bits; $j < $J; ++$j){
      $this->tree[$j][$i>>$j] = op($this->tree[$j-1][$i>>$j<<1], $this->tree[$j-1][($i>>$j<<1) + 1]);
    }
  }
  function get($f, $t){
    $sum = 0;
    $tree = $this->tree;
    $bits = $this->bits;
    $i = 0;
    while($f!=$t){
      $treei = $tree[$i];
      if(($f >> $i) & 1 == 1){
        $sum = op($sum, $treei[$f>>$i]);
        $f+=1<<$i;
      }
      if(($t >> $i) & 1 == 1){
        $sum = op($sum, $treei[($t>>$i)-1]);
        $t-=1<<$i;
      }
      ++$i;
    }
    return $sum;
  }
}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}


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

int n;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    int l = n % 10;
    if (l == 2 || l == 4 || l == 5 || l == 7 || l == 9)
    {
        cout << "hon";
    }
    else if (l == 0 || l == 1 || l == 6 || l == 8)
    {
        cout << "pon";
    }
    else
    {
        cout << "bon";
    }
}

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

int main(){
  vector<int64_t> sum(1001);
  sum.at(0)=0;
  for(int i=1;i<=1000;i++){
    sum.at(i)=i+sum.at(i-1);
  }
  int N,K;
  cin >> N >> K;
  vector<double> p(N);
  vector<double> e(N+1);
  e.at(0)=0;
  for(int i=0;i<N;i++){
    cin >> p.at(i);
    e.at(i+1)=sum.at(p.at(i))/p.at(i)+e.at(i);
  }
  priority_queue<double> pq;
  for(int i=K;i<=N;i++){
    pq.push(e.at(i)-e.at(i-K));
  }
  cout << fixed << setprecision(12) << pq.top() << endl;
  return 0;
}


Measured memory_bytes: 5496
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define so(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pa pair
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<ll,ll>> vpl;
typedef vector<vector<pair<int,int>>> vvp;




int main()
{
    
    vvi A(26);
    string s,t;
    cin >> s >> t;
    int ns = int(s.length());
    int nt = int(t.length());
    
    rep(i,ns) A[s[i]-'a'].push_back(i);
    
    vi C;
    int a = -1;
    rep(i,nt){
        int b = t[i]-'a';
        if(A[b].size() == 0){cout << -1 << endl;return 0;}
        auto c = upper_bound(all(A[b]),a);
        int cc = c-A[b].begin();
        if(int(A[b].size()) == cc) a = A[b][0];
        else a = A[b][cc];
        //out(a);
        C.push_back(a);
    }
    
    //outve(C);
    ll ans = 0;
    ll bbb = ll(C[0])+1;
    rep(i,nt-1){
        if(C[i] >= C[i+1]) ans += ll(ns),bbb = ll(C[i+1])+1;
        else bbb = ll(C[i+1])+1;
    }
    out(bbb+ans);
    
    return 0;
}




Measured memory_bytes: 1724
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
log2K = int(math.log2(10**12))+1
count_bit = [0 for i in range(log2K)]
for ai in A:
    for i in range(log2K):
        if ai & 1:
            count_bit[i] += 1
        ai = ai >> 1
b = 2**(log2K)
X = 0
for c in count_bit[::-1]:
    b //= 2
    if c*2 < N and X + b <= K:
        X += b
ans = 0
for ai in A:
    ans += X ^ ai
print(ans)

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> arr(n);
  int total = 0;
  for(auto& x : arr) {
    cin >> x;
    total += x;
  }
  sort(arr.begin(), arr.end());
  reverse(arr.begin(), arr.end());
  for(int i = 0; i < m; i++) {
    int score = arr[i];
    // score >= total/4m
    // score*4*m >= total
    if (score*4*m < total) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}

Measured memory_bytes: 256
N,x = map(int,input().split())
if not(1 < x < N*2-1):
    print("No")
    exit()

print('Yes')
A = [i+1 for i in range(N*2-1)]
A[N-1],A[x-1] = A[x-1],A[N-1]
if A[N-1] < A[N-2]:
    A[N-2],A[0] = A[0],A[N-2]
if A[N-1] > A[N]:
    A[N],A[-1] = A[-1],A[N]
for i in A:
    print(i)




Measured memory_bytes: 12484
// ProblemURL : https://atcoder.jp/contests/abc100/tasks/abc100_a
// ---------------------------------------------
package main

import "fmt"

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	ok := a <= 8 && b <= 8
	if ok {
		fmt.Println("Yay!")
	} else {
		fmt.Println(":(")
	}
}


Measured memory_bytes: 512
package main

import (
	"fmt"
)



func main(){
    var T, X int
    tmps := scanNums(2)
    T, X = tmps[0], tmps[1]
    
    fmt.Printf("%f\n", float64(T)/float64(X))
}

/**
 * １行に空白区切りで数字を読み込み
 */
func scanNums(len int) (nums []int) {
	nums = make([]int, len)
	for i := 0; i < len; i++ {
		fmt.Scan(&nums[i])
	}
	return
}


Measured memory_bytes: 512
/*
I believe on myself and I will achieve
this->author = Fuad Ashraful Mehmet, CSE-UAP
Todo:
https://codeforces.com/contest/1398/problem/E
https://codeforces.com/problemset/problem/374/C
*/
#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define all(o) (o).begin(),(o).end()
#define dbg(o)  cerr<<"at "<<__LINE__<<" response = "<<o<<endl;
#define pb push_back
using namespace std;

const int N=1005;
int n,k,m;

void HalfDead()
{
      int d,t,s;
      cin>>d>>t>>s;
      if(t*s>=d)
      {
            cout<<"Yes"<<endl;
      }
      else
      {
            cout<<"No"<<endl;
      }
      
}
int main()
{
      ios_base::sync_with_stdio(0); cin.tie(nullptr);  cout.tie(0);
      int tc=1;
     // cin>>tc;
      while(tc--)
      {
            HalfDead();
      }
      return 0;
}

Measured memory_bytes: 3656
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a: Vec<char> = input::<String>().chars().collect();
    let b: Vec<char> = input::<String>().chars().collect();
    let c: Vec<char> = input::<String>().chars().collect();

    let mut ai = 0;
    let mut bi = 0;
    let mut ci = 0;
    let mut next = 'a';
    let ans;
    loop {
        if next == 'a' {
            if ai == a.len() {
                ans = "A";
                break;
            }
            next = a[ai];
            ai += 1;
        } else if next == 'b' {
            if bi == b.len() {
                ans = "B";
                break;
            }
            next = b[bi];
            bi += 1;
        } else {
            if ci == c.len() {
                ans = "C";
                break;
            }
            next = c[ci];
            ci += 1;
        }
    }

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


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

using namespace std;

int main(int argc, char *argv[]) {
    int N;
    cin >> N;
    vector<int> arr(N);
    for (int i = 0; i < N; i++) {
        cin >> arr[i]; 
    }
    sort(arr.begin(), arr.end());
    int mi = arr[0];
    int mx = arr[N - 1];

    int ans = INT_MAX;
    for (int j = mi; j <= mx; j++) {
        int sum = 0;
        for (int k = 0; k < N; k++) {
            int cur = arr[k];
            sum += (cur - j) * (cur - j);
        }
        ans = min(ans, sum);
    }

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


Measured memory_bytes: 256