akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T f=0,x=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
namespace run{
	const int N=2009,mod=1e9+7;
	inline int add(int x,int y){return x+y>=mod?x-mod+y:x+y;}
	inline int sub(int x,int y){return x>=y?x-y:x+mod-y;}
	inline int qpow(int x,int y){
		int ret=1;
		while(y){
			if(y&1) ret=1LL*x*ret%mod;
			x=1LL*x*x%mod,y>>=1;
		}
		return ret;
	}

	int f[N<<1][N<<1][2],n,m,k,len;
	int main(){
		n=read<int>(),m=read<int>(),k=read<int>();
		if(!n || !m) puts("1"),exit(0);
		len=(n+m-1)/(k-1),f[0][0][0]=1;

		int ans=0;
		for(int i=1;i<=len;i++){
			for(int p=0;p<=min((i-1)*(k-1),m);p++){
				f[i][p][0]=add(f[i][p][0],add(f[i-1][p][1],f[i-1][p][0]));
				for(int j=1;j<k;j++) f[i][j+p][1]=add(f[i][j+p][1],add(f[i-1][p][0],f[i-1][p][1]));
			}

			for(int j=0;j<=min(m,i*(k-1));j++){
				int tmp=i*(k-1)-j+1;
				if(tmp<=n && j%(k-1)==m%(k-1) && tmp%(k-1)==n%(k-1)) ans=add(ans,f[i][j][1]);
			}
		}
		printf("%d\n",ans);
		return 0;
	}
}
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}

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

int main(void){
    string s;
    cin>>s;
    int n = (int)s.size()+1;
    
    vi a(n, 0);
    
    for(int i=1; i<n; i++){
        if(s[i-1]=='<')
            a[i] = max(a[i], a[i-1]+1);
    }
    for(int i=n-2; i>=0; i--){
        if(s[i]=='>'){
            a[i] = max(a[i], a[i+1]+1);
        }
    }
    
    ll ans = 0;
    rep(i,n)ans += a[i];
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5796
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}

ll inv(ll base) {
    int g = MOD, r = base, x = 0, y = 1;
    while (r != 0) {
        int q = g / r;
        g %= r; swap(g, r);
        x -= q * y; swap(x, y);
    }
    return x < 0 ? x+MOD : x;
}

ll mul(ll A, ll B) {
	return (A*B)%MOD;
}

ll add(ll A, ll B) {
	return (A+B)%MOD;
}

ll dvd(ll A, ll B) {
    return mul(A, inv(B));
}

ll sub(ll A, ll B) {
    return (A-B+MOD)%MOD;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
    int N; cin >> N; int P; cin >> P;
    string S; cin >> S;
    if (P == 5 || P == 2) {
        ll ans = 0;
        F0R(i, N) {
            if ((S[i] - '0') % P == 0) {
                ans += i+1;
            }
        }
        cout << ans << endl;
        return 0;
    }

    ll counts[P]; F0R(i, P) counts[i] = 0;
    counts[0] = 1;
    int cur = 0;
    MOD = P;
    F0R(i, N) {
        cur *= 10; cur += S[i] - '0'; cur %= MOD;
        int val = modExp(10, N-1-i) * cur; val %= MOD;
        counts[val]++;
    }

    ll ans = 0;
    F0R(i, P) ans += (counts[i] * (counts[i] - 1)) / 2;

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



Measured memory_bytes: 720
def f(L, x):
    if L == 0:
        return 0 if x <= 0 else 1
    if x <= total[L - 1] + 1:
        return f(L - 1, x - 1)
    else:
        return patties[L - 1] + 1 + f(L - 1, x - total[L - 1] - 2)


N, X = map(int, input().split())
total = [1]
patties = [1]
for i in range(50):
    total.append(total[-1] * 2 + 3)
    patties.append(patties[-1] * 2 + 1)
print(f(N, X))


Measured memory_bytes: 9140
def main():
    n, m = map(int, input().split())
    # k = []
    s = []
    for i in range(m):
        x = list(map(int, input().split()))
        # k.append(x[0])
        y = 0
        for j in x[1:]:
            y |= 1 << (j - 1)  # 0bit目を1にする
        s.append(y)
    p = list(map(int, input().split()))

    res = 0
    for bit in range(1 << n):
        all_on = True
        for i in range(m):
            n_on = bin(s[i] & bit).count('1')
            if n_on % 2 != p[i]:
                all_on = False
                break
        if all_on:
            res += 1

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus>=201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(std::vector<long long> M, std::vector<long long> D){
  if(M[0]!=M[1]){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
}

int main(){
    std::vector<long long> M(2);
    std::vector<long long> D(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&M[i]);
        scanf("%lld",&D[i]);
    }
    solve(std::move(M), std::move(D));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  for(int i=0;i<10;i++){
    cout<<a*c-b<<endl;
    c=a*c-b;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public boolean isMultipleOfNine(String num) {
        int sum = 0;
        for (int i = 0; i < num.length(); i++) {
            int digit = num.charAt(i) - '0';
            sum += digit;
        }

        if (num.length() < 10) {
            return sum % 9 == 0;
        } else {
            return isMultipleOfNine(String.valueOf(sum));
        }
    }

    public static void main(String[] args) throws Exception {
        Main solution = new Main();

        Scanner scanner = new Scanner(System.in);
        String n = scanner.next();

        boolean answer = solution.isMultipleOfNine(n);
        if (answer) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 40076
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>

#define DEBUG 0
#define lli long long int

lli max(lli a,lli b){
	return a>=b ? a:b;
}

using namespace std;

int main(){

	//dp[i] i:重さ, dp：最大価値
	map<lli , lli> dp;

	//mapのkeyになるもの
	set<lli, greater<lli> > key;
	dp[0]=0;
	key.insert(0);

	lli N,W;
	lli *w,*v;
	cin>>N>>W;

	w = new lli[N];
	v = new lli[N];

	for(int i=0;i<N;i++){
		cin>>w[i]>>v[i];
	}

	for(int i=0;i<N;i++){
		if(DEBUG)cout<<"i="<<i<<endl;
		vector<lli> tmpKey;
		for(auto it = key.begin(); it!= key.end(); it++){
			if(DEBUG)cout<<"key="<<*it<<endl;
			dp[ *it + w[i]] = max(dp[*it]+v[i],dp[ *it + w[i]] );
			if( dp[*it] + v[i] >= dp[*it + w[i]]){
				if(DEBUG)cout<<"nextPushKey="<< *it +w[i] <<endl;
				tmpKey.push_back( *it+w[i] );
			}
		}
		for(int j=0;j<tmpKey.size();j++){
			key.insert(tmpKey.at(j));
		}
	}

	lli ans=0;
	for(auto it = key.begin(); it!= key.end(); it++){
		if(DEBUG)cout<<"w="<<*it<<" v="<<dp[*it]<<endl;
		if(*it > W){
			continue;
		}
		ans = max(ans, dp[*it]);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

bool p[100050];
vector <long long> prime;
void make_prime()
{
	for (int i = 0; i < 100050; i++) p[i] = true;
	p[0] = p[1] = false;
	prime.push_back(2);
	for (int i = 4; i < 100050; i += 2) p[i] = false;
	for (int i = 3; i*i < 100050; i += 2){
		if (p[i]){
			// cout << i << endl;
			for (int j = i*i; j < 100050; j += i){
				p[j] = false;
			}
		}
	}
	// cout << prime.size() << endl;
	for (int i = 0; i < 100050; i++){
		if (p[i]) prime.push_back((long long)i);
	}
	// cout << prime.size() << endl;
}
// pq &#8804; m and a/b &#8804; p/q &#8804; 1
// pq -> max
int main()
{
	make_prime();
	long long m, a, b;
	while (cin >> m >> a >> b, m){
		long long max = 0;
		long long p = -1, q = -1;
		for (int i = 0; i < prime.size(); i++){
			for (int j = i; j < prime.size(); j++){
				long long area = prime[i] * prime[j];
				if (m < area) break;
				if (max < area && area <= m && prime[j] * a <= prime[i] * b){
					max = area;
					p = prime[i];
					q = prime[j];
				}
			}
		}
		if (p <= q) cout << p << " " << q << endl;
		else cout << q << " " << p << endl;
	}

	return 0;
}

Measured memory_bytes: 1436
#include <bits/stdc++.h>
#define rep(i,  x,  y) for(int i = x; i <= y; i ++)
#define ll unsigned long long
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define ls rt << 1
#define rs rt << 1 | 1
#define INF 0x3f3f3f3f
#define mod 1000000007
using namespace std;
inline ll read()
{
	ll x = 0; char ch = getchar();
	while (ch < '0' || ch > '9') {  ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x; 
}
ll a,b;
int main()
{
	a = read();
	b = read();
	b /= a;
	int ans = 0;
	while (b) b >>= 1, ans ++;
	cout << ans << endl;
	return 0;
}

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





int main() {
  int n;
  cin>>n;
  
  int answer=0;
  
  for (int i=0;i<n;i++){
    int l,r;
    cin>>l>>r;
    answer+=(r-l+1);
  }
  cout<<answer<<endl;
  
    
}
  













Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
from functools import lru_cache

def main():
	n=int(input())
	k=int(input())
	
	@lru_cache(None)
	def f(n,k):
		if n<10:
			if k==0:
				return 1
			if k==1:
				return n
			return 0
		q, r = divmod(n, 10)
		ret = 0
		if k>=1:
			ret+=f(q,k-1)*r
			ret+=f(q-1,k-1)*(9-r)
		ret+=f(q,k)
		return ret
	print(f(n,k))
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 39536
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//  
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;

//#define __DBG__



void solve(void){
  
  ll a,b,c;
    
  bool flag=true;
  
  cin >> a >> b >> c;
  
  ll tmp = c-a-b;
    
  if(tmp<1){
    flag=false;
  }
  
  if(a*b*4 >= tmp*tmp){
    flag=false;
  }
  
  if(flag){
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return;
}


int main(int argc, const char * argv[]) {

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

    solve();
 
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <random>

using namespace std;
struct Timer {
    static const unsigned long TICKS_PER_MSEC=3e6;
    unsigned long t1;
    Timer() { reset(); }
    unsigned long elapsed() { return gettime()-t1; }
    double elapsedMsec() { return 1.0*elapsed()/TICKS_PER_MSEC; }
    void reset() { t1=gettime(); }
    unsigned long gettime()
    {
        unsigned long lo, hi;
        asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
        return (hi<<32)|lo;
    }
};

int c[27], s[366][27], t[366], last[27];
int main()
{
    Timer timer;
    int D; cin>>D;
    for(int i=1; i<=26; ++i) cin>>c[i];
    for(int i=1; i<=D; ++i)
        for(int j=1; j<=26; ++j)
            cin>>s[i][j];

    auto calc_score=[&](){
        long score=0;
        for(int i=1; i<=26; ++i) last[i]=0;
        for(int d=1; d<=D; ++d) {
            score+=s[d][t[d]];
            last[t[d]]=d;
            for(int i=1; i<=26; ++i) score-=c[i]*(d-last[i]);
        }
        return score;
    };

    for(int i=1; i<=D; ++i) {
        long bestscore=-(1L<<60), typ=1;
        for(int j=1; j<=26; ++j) {
            t[i]=j;
            auto score=calc_score();
            t[i]=0;
            if (bestscore<score) {
                bestscore=score;
                typ=j;
            }
        }
        t[i]=typ;
    }

    mt19937 engine;
    uniform_int_distribution<> rndT(1, 26), rndD(1, 365), rndR(0, 2);
    auto bestscore=calc_score();

    while (timer.elapsedMsec()<1950) {
        if (!rndR(engine)) {
            int d=rndD(engine);
            int q=rndT(engine);
            int x=t[d];
            t[d]=q;
            auto score=calc_score();
            if (bestscore<score) {
                bestscore=score;
            }
            else {
                t[d]=x;
            }
        }
        else {
            int a=rndD(engine);
            int b=rndD(engine);
            swap(t[a], t[b]);
            auto score=calc_score();
            if (bestscore<score) {
                bestscore=score;
            }
            else {
                swap(t[a], t[b]);
            }
        }
    }
    for(int i=1; i<=D; ++i) cout<<t[i]<<endl;
    //cout<<bestscore<<", "<<cnt<<endl;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
const char nl = '\n';

int main()
{
    long long a;
    long double b;
    cin >> a >> b;
    long long res;
    res = floor(a*b);
    cout << res << endl;
    return 0;
}


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

int main(){
    int N,t=0,x=0,y=0;
    cin >> N;
    for(int i=0;i<N;i++){
        int ti,xi,yi;
        cin >> ti >> xi >> yi;
        int dist = abs(xi - x) + abs(yi - y);
        int move = (ti - t);
        if(move < dist) {
            cout << "No" << endl;
            return 0;
        }
        if((move % 2) != (dist % 2)){
             cout << "No" << endl;
             return 0;
        }
        t=ti,x=xi,y=yi;   
    }
    cout << "Yes" << endl;
}

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

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

#define pb push_back

const int INF = 100100100;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

int main(){

  int x,t;

  cin >> x >> t;

  if( x - t >= 0){
    cout << x-t << endl;
  }else{
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		int[] ans = new int[N];
		
		for(int i = 1; i < N; i++) {
			A[i] = scan.nextInt();
		}
		
		for(int i = 1; i < N; i++) {
			ans[A[i]-1]++;
		}
		
		
		for(int i = 0; i < N; i++) {
			System.out.println(ans[i]);
		}
	}

}


Measured memory_bytes: 62000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

ll mod = 1e9+7;

#define NMAX 10001
ll fac[NMAX];
ll inv[NMAX];

ll mod_pow(ll a, ll n, ll mod){
    ll ret = 1;
    while(n > 0){
        if(n & 1) ret = (ret*(a % mod))%mod;
        a = ((a%mod)*(a%mod)) % mod;
        n = n >> 1;
    }
    return ret;
}

ll mod_inv(ll a, ll mod){
    return mod_pow(a, mod-2, mod);
}

void mae_nck(){
    fac[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < NMAX; i++){
        fac[i] = (fac[i-1] * i)%mod;
        inv[i] = (inv[i-1] * mod_inv(i, mod))%mod;
    }
}

/*
const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

*/

ll mod_nck(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(k == 0 || k == n) return 1;
    ll ret = ((fac[n] * inv[k])%mod * inv[n-k])%mod;
    return ret;
}

ll nck(ll n, ll k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  if(k == 0 || k == n) return 1;
  ll nume = 1, deno = 1;
  for(int i=0; i<k; i++){
    nume *= (n-i);
    deno *= (i+1);
  }
  return (ll)(nume/deno);
}

int main(){
    ll n, k;
    cin >> n >> k;
    mae_nck();
    rep(i, 1, k+1){
        ll ans = mod_nck(n-k+1, i) * mod_nck(k-1, i-1);
        cout << ans%mod << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

const int LIM=260000;
bool sosu[LIM];

int main() {
	int i,j;
	for(i=0;i<LIM;i++){
		sosu[i]=true;
	}
	sosu[0]=sosu[1]=false;
	for(i=0;i<LIM;i++){
		if(sosu[i]){
			for(j=i*2;j<LIM;j+=i){
				sosu[j]=false;
			}
		}
	}
	int n;
	int res;
	while(n=in()){
		res=0;
		for(i=n+1;i<=2*n;i++){
			if(sosu[i])res++;
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long long n,m,a[100009],b[100009];
long long solve(int x)
{
	long long tmp=0;
	for (int i=1; i<=n; i++)
		if (a[i]==(x&a[i]))
			tmp+=b[i];
	return tmp;
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1; i<=n; i++)
		scanf("%d%d",&a[i],&b[i]);
	long long ans=solve(m);
	for (int i=30; i>=0; i--)
	if (m>>i&1)
	{
		int x=m^(1<<i); x|=(1<<i)-1;
		ans=max(ans,solve(x));
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1792
S = input()
N = len(S)

ans = 0
before = 0
for i in range(N):
    tmp = S[i]
    if tmp == 'A' or tmp == 'T' or tmp=='C' or tmp == 'G':
        pass
    else:
        ans = max(i - before, ans)
        before = i + 1

ans = max(N - before, ans)
print(ans)


Measured memory_bytes: 3060
# include <iostream>
using namespace std;
const int N=200001;
int a[N];
long long s,t;
int n;
void work (void)
{
	long long p,q;
	int i;
	p=0;
	for (i=1;i<n;i++)
	{
		p+=a[i];
		if (p<=s/2)
		q=s-p*2;
   else q=p*2-s;
        if (q<t)
        t=q;
	}
	cout<<t;
}
int main (void)
{
	int i;
	t=1000000000000000;
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>a[i];
		s+=a[i];
	}
	work ();
	return 0;
}


Measured memory_bytes: 1024
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

#0:中央 1:南 2:東 3:西 4:北 5:裏側
class Dice():

    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'

    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5


    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]

        if loc == 'E':
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])


    def equals(self,another):

        ret = False;

        for i in range(len(self.order)):
            self.roll(self.order[i])
            FLG = True
            for k in range(6):
                if self.number[k] != another.number[k]:
                    FLG = False
                    break
            if FLG == True:
                return True

        return ret

diceA = Dice()
diceB = Dice()

table = list(map(int,input().split()))
diceA.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])

table = list(map(int,input().split()))
diceB.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])

if diceA.equals(diceB):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 6404
def solve(s):
    n = len(s)
    count_white_right = [0]*(n+1)
    count_black_left = [0]*(n+1)
    for i in range(n):
        count_black_left[i+1] = count_black_left[i] + (1 if s[i]=='#' else 0)
    for i in range(n)[::-1]:
        count_white_right[i] = count_white_right[i+1] + (1 if s[i]=='.' else 0)
    return min([count_black_left[i] + count_white_right[i] for i in range(n+1)])


def main():
    _ = int(input())
    s = input()
    print(solve(s))

if __name__ == "__main__":
    main()

import unittest
class Test(unittest.TestCase):
    def test1(self):
        self.assertEqual(solve('#.#'), 1)
    def test2(self):
        self.assertEqual(solve('#.##.'), 2)
    def test3(self):
        self.assertEqual(solve('.........'), 0)
    def test4(self):
        self.assertEqual(solve('#'), 0)
    def test5(self):
        self.assertEqual(solve('.'), 0)
    def test6(self):
        self.assertEqual(solve('#.'), 1)
    def test7(self):
        self.assertEqual(solve('##'), 0)
    def test8(self):
        self.assertEqual(solve('..'), 0)
    def test9(self):
        self.assertEqual(solve('.#'), 0)
    def test10(self):
        self.assertEqual(solve('#'*1000 + '.' * 999), 999)
    def test11(self):
        self.assertEqual(solve('#'*999 + '.' * 1000), 999)


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

int main(){
    int A, B, a, b;
    int cnt = 0;
    cin >> A >> B;

    for(int i = 0; i < 10000; i++){
        a = i * 0.08;
        b = i * 0.1;
        if(A == a && B == b){
            cout << i << endl;
            cnt = 1;
            break;
        }
    }
    if(cnt == 0) cout << -1 << endl;
    return 0;
}

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

int main(){
    double pai=3.141592653589;
    int n,tmp;
    int s[1000];
    double avg,total,ans;
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        total=0;
        ans=0;
        for(int j=0;j<n;j++){
            scanf("%d",&s[j]);
            total+=s[j];
        }
        avg=total/n;
        for(int k=0;k<n;k++){
            ans+=(s[k]-avg)*(s[k]-avg);
        }
        ans=sqrt(ans/n);
        printf("%.12lf\n",ans);
    }

    return 0;
}


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

int main() {
	string S;
	cin>>S;
	int N =S.size();
	int cnts = 0;
	rep(i,N){
		if(S[i]=='T'){
			if(cnts>0)cnts--;
		}
		else {
			cnts++;
		}
	}
	cout<<cnts*2<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int mx = 0;
    rep(i,n) {
        if (a[i] == k){
            cout << "POSSIBLE" << endl;
            return 0;
        }
        mx = max(mx, a[i]);
    }
    if (mx < k){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    int g = a[0];
    for(int i = 1; i < n; i++){
        g = __gcd(g, a[i]);
    }
    if (g == 1) cout << "POSSIBLE" << endl;
    else if (k % g == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

#define MOD 1000000007


int n, x;
int s[200];

long long dp[100001];

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

	cin >> n >> x;
	rep(i, n)cin >> s[i];


	dp[x] = 1;

	rep(i, n) {
		rep(v, x + 1) {
			if (dp[v] == 0)continue;

			int prev = dp[v] % MOD;
			dp[v] = 0;
			rep(k, n) {
				int w = v % s[k];
				dp[w] += prev;
			}
			dp[v] -= 1LL * i*prev;
		}
	}
	long long ans = 0;
	rep(i, x) {
		ans += 1LL * i*(dp[i] % MOD) % MOD;
	}
	ans %= MOD;
	cout << ans << endl;


	return 0;
}

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

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

  int i = 0;
  while (i < k) {
    if (a % 2 == 1) a --;
    b += a / 2;
    a /= 2;
    i ++;

    if (i == k) break;
    if (b % 2 == 1) b --;
    a += b / 2;
    b /= 2;
    i ++;
  }

  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin>>n;
  	long double ans = 0;
  	int a[n];
  	for(int i=0;i<n;i++)
      cin>>a[i];
  	sort(a,a+n);
  	ans = (a[0]+a[1])/2.0;
  	for(int i=2;i<n;i++)
    {
     	ans = (ans+a[i])/2.0; 
    }
  	cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <iomanip>


using namespace std;


int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
    
  double space = W*H/2;
  
  cout << fixed<<setprecision(9) << space << ' ' << (( W/2 == x && H/2 == y )? 1 : 0) << endl;
  return 0;
}


Measured memory_bytes: 256
import * as fs from "fs"

const judge = (L:number, R:number, d:number) => {
    let ans:number = 0
    for (let i:number = L; i <= R; i ++){
        if (i % d === 0){
            ans ++
        }
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))


    const L: number = data[0]
    const R: number = data[1]
    const d: number = data[2]
    return  judge(L, R, d)
}

console.log(main())


Measured memory_bytes: 29724
/*
ABC151 D BFS

*/

#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> S(h);
    rep(i, h) {
        cin >> S[i];
    }    
    int ans = 0;
    rep(i, h) {
        rep(j, w) {
            if(S[i][j] == '#') continue;
            vector<vector<int>> dist(h, vector<int>(w, INF));
            queue<P> q;
            auto update = [&](int a, int b, int x) {
                if(dist[a][b] != INF) return;
                dist[a][b] = x;
                q.push(P(a, b));
            };
            update(i, j, 0);
            while(!q.empty()) {
                int a = q.front().first;
                int b = q.front().second;
                q.pop();
                rep(dir, 4) {
                    int ni = a + dx[dir], nj = b + dy[dir];
                    if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                    if(S[ni][nj] == '#') continue;
                    update(ni, nj, dist[a][b] + 1);
                }
            }
            rep(i, h) {
                rep(j, w) {
                    if(dist[i][j] == INF) continue;
                    ans = max(ans, dist[i][j]);
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val s = sc.next()
    val t = sc.next()
    println(t+s)

}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 29348
#include "omp.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <random>
#include <bitset>
#include <unordered_set>
#include <cassert>
#include <list>
#include <functional>


using namespace std;

typedef long long ll;
typedef long double ld;


const int sze = 1 << 11, INF = 1e9 + 10;


int n, k, q;


bool check(int up, int down, const vector<int> &values)
{
	vector<int> challengers = values;
	vector<int> positions[3];

	for (int i = n - 1; i >= 0; --i)
	{
		if (challengers[i] > up)
			challengers[i] = 2;
		else if (challengers[i] < down)
			challengers[i] = 0;
		else
			challengers[i] = 1;

		positions[challengers[i]].push_back(i);
	}

	int l = 0, r = 0, cnt = 0, num = 0;
	int a[3] = {};

	while (l < n)
	{
		while (r < n && num < k)
		{
			a[challengers[r]]++;
			num++;
			r++;
		}

		if (num != k)
			break;

		int vl = 0;
		while (!a[vl])
			vl++;

		if (vl == 1)
		{
			cnt++;
			num--;
			a[vl]--;
			positions[vl].pop_back();
		}
		else
		{
			if (positions[challengers[l]].size() && positions[challengers[l]][positions[challengers[l]].size() - 1] == l)
			{
				a[challengers[l]]--;
				positions[challengers[l]].pop_back();
				num--;
			}

			l++;
		}
	}
	
	return cnt >= q;
}


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

	cin >> n >> k >> q;

	vector<int> values(n), challengers;

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

	challengers = values;
	sort(challengers.begin(), challengers.end());


	int M = unique(challengers.begin(), challengers.end()) - challengers.begin();
	challengers.resize(M);

	map<int, int> trans;
	for (int i = 0; i < M; ++i)
		trans[challengers[i]] = i;

	for (int i = 0; i < n; ++i)
		values[i] = trans[values[i]];

	int ans = INF;
	int m = challengers.size();
	for (int i = 0; i < m; ++i)
	{
		int l = i - 1, r = m;

		while (r - l > 1)
		{
			int mid = (l + r) >> 1;
			int up = mid, down = i;

			if (check(up, down, values))
				r = mid;
			else
				l = mid;
		}

		if (r != m)
			ans = min(ans, challengers[r] - challengers[i]);
	}

	cout << ans;
	return 0;
}


Measured memory_bytes: 384
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))

    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)

    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)


Measured memory_bytes: 3064
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 4e6 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b,ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a,ll b){ if(a==0){return b;}else{ return gcd(b%a,a);}}

ll n,k;
ll fac[maxn],inv[maxn];
ll dp[2005][2005];
ll C(ll n,ll x)
{
	return fac[n]*inv[x]%mod*inv[n-x]%mod;
}

void init()
{
	fac[0]=1;
	inv[0]=1;
	ll up = 4e6;
	for(ll i=1;i <= up;i++)
	{
		fac[i]=fac[i-1]*i%mod;
		inv[i]=po(fac[i],mod-2,mod);
	}
}

ll cal(ll i,ll j)
{
	if(dp[i][j]!=-1)
	{
		return dp[i][j];
	}
	ll res=0;
	if(i==0&&j==0)
	{
		return 1;
	}
	if(j > i)
	{
		res += C(i+j*(k-1)-1,k-2)*cal(i,j-1)%mod;
	}
	res%=mod;
	if(i)
	{
		res += cal(i-1,j);
	}
	res%=mod;
	dp[i][j]=res;
	return res;
}

void solve()
{
	memset(dp,-1,sizeof(dp));
	cin>>n>>k;
	if(k==1)
	{
		cout<<1<<endl;
		return;
	}
	ll res= cal(n,n);
	for(ll i=1;i<=n;i++)
	{
		res=res*i%mod;
	}
	cout<<res<<endl;
}
int main()
{
    init();
    solve();
	return 0;
}

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

int main()
{
    int a,b,c,d;
    cin >>a>>b>>c>>d;
    if(a+b>c+d) puts("Left");
    if(a+b==c+d) puts("Balanced");
    if(a+b<c+d) puts("Right");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    double r;cin>>r;
    cout<<setprecision(20)<<r*2*3.141592<<endl;
    
}



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

int main()
{
   string s;
   cin>>s;
   string ans;
   for(int i=0;i<s.length();i++)
   {
       if( s[i] =='0')
           ans += "0";
       else if( s[i] =='1')
       {
           ans += "1";
       } else{
           if( ans.length() >0)
           {
               ans = ans.substr(0 , ans.length() -1);
           }
       }
   }
   cout<<ans;

}

Measured memory_bytes: 3568
#include <iostream>

using namespace std;

int main()
{
	int a, b;
	int x[13] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
	
	cin >> a >> b;
	
	if (x[a] == x[b]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return (0);
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> a(N),b(N);//bをどんどんaに近づけていくぞい
    rep(i,N){
        cin >> a[i];
    }
    rep(i,N){
        cin >> b[i];
    }
    ll cnt=0;
    priority_queue<pair<int,int>> pq;
    rep(i,N){
        pq.push({b[i],i});
    }
    while(pq.size()){
        pair<int,int> p=pq.top();
        int x=p.first,y=p.second;
        pq.pop();
        if(x<a[y]){
            cout << -1 << endl;
            return 0;
        }
        if(x==a[y]){
            continue;
        }
        int res=(x-a[y])/(b[(N+y-1)%N]+b[(y+1)%N]);
        x-=res*(b[(N+y-1)%N]+b[(y+1)%N]);
        b[y]=x;
        if(res==0){
            cout << -1 << endl;
            return 0;
        }
        cnt+=res;
        //cout << cnt << endl;
        pq.push({x,y});
    }
    cout << cnt << endl;
}

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

namespace a
{
    class Program
    {
        public static int Main()
        {
            new Program().calc();
            return 0;
        }

        Scanner sc;

        public void calc()
        {
            sc = new Scanner();
            string s = sc.next();
            string a = "CODEFESTIVAL2016";
            int cnt = 0;
            for (int i = 0; i < a.Length; i++)
            {
                if (s[i] != a[i]) cnt++;
            }
            Console.WriteLine(cnt);
        }

    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            while (i >= s.Length)
            {
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
            }
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

    }
}

Measured memory_bytes: 2776
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 1e18+10 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
signed main(){
	int n;
	cin>>n;
	if(n==1){
		cout<<"Yes"<<endl;
		cout<<"2"<<endl;
		cout<<"1 1"<<endl;
		cout<<"1 1"<<endl;
		return 0;
	}
	loop(i,2,10000)if(i*(i+1)==n*2){
		int t=i;
		cout<<"Yes"<<endl;
		cout<<t+1<<endl;
		vvi in(t+1,vi(t));
		int y=0;
		rep(i,t){
			loop(j,y,y+t-i)in[i][i+j-y]=j;
			loop(j,i+1,t+1)in[j][i]=y+j-i-1;
			y+=t-i;
		}
		rep(i,t+1){
			cout<<t;
			rep(j,t)cout<<" "<<in[i][j]+1;cout<<endl;
		}
		return 0;
	}
	cout<<"No"<<endl;
}








Measured memory_bytes: 2944
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTS(s) printf("%s\n",(s))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

typedef long long ll;

void Swap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}
void ShowData(int x[], int y[],int left,int right)
{
	int i;
	for (i = left; i <= right; i++) {
		printf("%d %d\n", x[i],y[i]);
	}
	printf("\n");
}
void QSort(int x[],int y[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		Swap(x, i, j);
		Swap(y, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x,y, left, i - 1, n);
	if (j + 1 <  right)QSort(x,y, j + 1, right, n);
}


int main() {
	int N, H;
	int a[100000], b[100000];
	scanf("%d %d", &N, &H);
	REP(i, N) {
		scanf("%d %d", &a[i], &b[i]);
	}
	QSort(b,a, 0, N - 1, 1);
	//ShowData(a, b, 0, N - 1);
	int max = 0;
	int idx = 0;
	REP(i, N) {
		if (max < a[i]) {
			max = a[i];
			idx = i;
		}
		else if(max==a[i]&&b[i]<b[idx]){
			idx = i;
		}
	}

	int cnt = 0;
	int now = N - 1;
	while(H>0) {
		if (b[now]>a[idx]&&now!=idx&&H>b[idx]) {
			H -= b[now--];
			cnt++;
		}
		else {
			if (now == idx&&H > a[idx] && H > b[idx]) {
				now--;
				continue;
			}
			if (a[idx] < b[idx]) {
				if (H <= b[idx]) {
					cnt++;
					break;
				}
				else {
					cnt += (H - b[idx]-1) / a[idx]+2;
					break;
				}
			}
			else {
				cnt += (H-1) / a[idx]+1;
				break;
			}
		}
	}
	PRINTD(cnt);
}

Measured memory_bytes: 896
#include <stdio.h>

int main()
{
    int N;
    int H;
    int count;
    int i;
    int max;

    scanf("%d", &N);

    max = 0;
    count = 0;
    for(i = 0; i < N; i++) {
        scanf("%d", &H);
        if(H >= max) {
            count += 1;
        }
        if(max < H) {
            max = H;
        }
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int a,b;
		a=in.nextInt();
		b=in.nextInt();
		while(!(a==0&&b==0) )
		{
			if(a>b)
			{int temp=a;
			a=b;
			b=temp;
			}
			System.out.println(a + " " + b);
			
			a=in.nextInt();
			b=in.nextInt();
			
			
		}
		
	}
}

Measured memory_bytes: 34568
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, x, t;
  cin >> n >> x >> t;
  cout << UPDigit(n, x) * t << '\n';
  return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::string S){
    if (N % 2) cout << NO << '\n';
    else {
        string s1 = S.substr(0, N/2);
        string s2 = S.substr(N/2);
        if (s1 == s2) cout << YES << '\n';
        else cout << NO << '\n';
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256