akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
bitset<50>bit;
/*
bit.reset(); bit=n; bit.count();
*/
#define _for(i,a,b) for( int i=(a); i<(b); ++i)
#define rof(i,a,b)  for( int i=b-1;i>=a;i--)
#define rep(i,a,b)  for( int i=(a); i<=(b); ++i)
#define per(i,a,b)  for( int i=(b); i>=a; --i)
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d %d",&n,&m)
#define sddd(n,m,k) scanf("%d %d %d",&n,&m,&k)
#define pd(n)    printf("%d\n",n)
#define pd_(n)   printf("%d ",n)
#define pdd(n,m) printf("%d %d",n,m)
#define pddd(n,m,k) printf("%d %d %d",n,m,k)
#define pld(n) printf("%lld\n",n)
#define pldd(n,m) printf("%lld %lld\n",n,m)
#define sld(n)   scanf("%lld",&n)
#define sldd(n,m) scanf("%lld %lld",&n,&m)
#define slddd(n,m,k) scanf("%lld %lld %lld",&n,&m,&k)
#define sf(n)    scanf("%lf",&n)
#define sff(n,m) scanf("lf",&n,&m)
#define sfff(n,m,k) scanf("%lf %lf %lf",&n,&m,&k)
#define ss(str)  scanf("%s",str)
#define mm(a,n)  memset(a, n, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
#define fi first
#define se second
#define mod(x) ((x)%MOD)
typedef long long ll;
typedef pair<int,int> PII;
typedef unsigned long long ull;
typedef long double ld;
const int N=1e5+7;
const int MOD = 1e9 + 7;
//const double eps = 1e-9;
const double PI=atan(1.0)*4;
const int maxn=3e5+5;
int h[N];
int n,a,b;
bool check(ll mid)
{
    ll temp=mid*b;
    ll sub=a-b;
    ll sum=0;
    for(int i=n;i>0;i--)
    {
        if(h[i]>temp)
        {
            if((h[i]-temp)%sub)
                sum+=(h[i]-temp)/sub+1;
            else
                sum+=(h[i]-temp)/sub;
        }
    }
    if(sum<=mid)
        return true;
    return false;
}
int main()
{
    sddd(n,a,b);
    ll l,r;
    for(int i=1;i<=n;i++)
        {
            sd(h[i]);
            r+=h[i]/b+1;
        }
    sort(h+1,h+1+n);
    l=1;
    while(l<r)
    {
        ll mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid;
        }
        else
        {
            l=mid+1;
        }
    }
    pld(l);
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		try (Scanner sc = new Scanner(System.in)) {
			int N, K;
			char now;
			N = sc.nextInt();
			K = sc.nextInt();
			char[] charS = sc.next().toCharArray();
			
			now = charS[K - 1];
			if (now == 'A') {
				
				charS[K - 1] = 'a';
				
			} else if (now == 'B') {
				
				charS[K - 1] = 'b';
			
			} else if (now == 'C') {
				
				charS[K - 1] = 'c';
			}
			
			for (char c: charS){
				System.out.print(Character.toString(c));
			}
			System.out.println();
			
			
		} catch (Exception e) {
			// TODO: handle exception
		}

	}

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
int main() 
{
    int x;
    cin >> x;

    long long ans=0;

    REP(i,x){
        REP(j,x){
            REP(k,x){
                ans+=gcd(gcd(j,k),i);
            }
        }
    }

    cout << ans << endl;
}

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

using namespace std;

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

    int g = __gcd(a, b);
    vector<int> vt;
    for (int i = 1; i <= g; ++i) {
        if (g % i == 0) vt.push_back(i);
    }

    reverse(vt.begin(), vt.end());
    cout << vt[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
c = [list(map(int, input().split())) for _ in range(3)]
# a2 + b1 = c21
# a2 + b2 = c22
# a2 + b3 = c23
b1, b2, b3 = c[0][0], c[0][1], c[0][2]

if c[1][0] - b1 == c[1][1] - b2 == c[1][2] - b3 and c[2][0] - b1 == c[2][1] - b2 == c[2][2] - b3:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9104
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
Inf = 10 ** 10

hp = lines[1].sort!
min = hp[0]

for i in 1..35 do
  next_min = Inf
  for j in 1..N do
    rest = hp[j-1] % min
    if rest != 0 then
      hp[j-1] = rest
    end
    if next_min > hp[j-1] then
      next_min = hp[j-1]
    end
  end
  min = next_min
end
    
puts min

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

const ll INF = 1LL << 60;

ll X, Y, Z, K;
vector<ll> A, B, C;

int main() {
    cin >> X >> Y >> Z >> K;
    A.resize(X);
    B.resize(Y);
    C.resize(Z);

    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];

    // K番目までの美味しさの和を大きい順でだす
    // A, B
    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    sort(C.rbegin(), C.rend());

    vector<ll> v;
    rep(i, A.size()) {
        rep(j, B.size()) {
            v.push_back(A[i] + B[j]);
        }
    }
    sort(v.rbegin(), v.rend());

    vector<ll> v2;
    ll target = min((ll)3000, (ll)v.size());
    rep(i, target) {
        rep(j, C.size()) {
            v2.push_back(v[i] + C[j]);
        }
    }
    sort(v2.rbegin(), v2.rend());

    rep(i, K) {
        cout << v2[i] << endl;
    }

    // rep(i, K) {
    //     ll ans = v[i] + C[i];
    //     cout << ans << endl;
    // }
}

Measured memory_bytes: 44132
h , w = map(int, input().split())
field = [["#"] * (w+2)]
for i in range(h):
  temp = input()
  field.append("#" + temp + "#")
field.append(["#"] * (w+2))
now = [[1, 1]]
dots_count = 0
for i in field:
  dots_count += i.count(".")
move = [[0,1], [1, 0], [0,-1], [-1, 0]]
s_field = [[None for _ in range(w+2)] for _ in range(h+2)]
s_field[1][1] = 1
while now:
  x , y = now.pop(0)
  for v, u in move:
    if field[y+u][x+v] == "." and s_field[y+u][x+v] ==None:
      s_field[y+u][x+v] = s_field[y][x]+1
      if y+u == h and x+v == w:
        print(dots_count-s_field[y+u][x+v])
        break
      now.append([x+v, y+u])
  else:
    if not now:
      print(-1)
      break
    continue
  break
  

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==v.size()?"":" ");
    return os;
}


signed main(){
    int n;cin>>n;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int u,v;cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    function<int(int,int)> dfs=[&](int pre,int now){
        int c=0,sum=0,non0=0;
        for(auto to:g[now])if(pre!=to){
            int k=dfs(now,to);
            sum+=k;
            if(k)non0++;
            c++;
        }
        int ad=c-1-non0;
        chmax(ad,0);
        return sum+ad;
    };

    int ans=INF;
    vector<int> st;
    rep(i,n)if(g[i].size()==1)st.push_back(i);
    mt19937 mt(time(0));
    shuffle(ALL(st),mt);
    rep(i,min(100,(int)st.size())){
        chmin(ans,1+dfs(-1,st[i]));
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back

ll mid(vec A)
{
    ll N = SZ(A) - 1;
    if(N % 2 == 1) return A[(N+1)/2];
    else return A[N/2] + A[N/2+1];
}

int main()
{
    ll N;
    cin >> N;
    vec A(N+1, 0), B(N+1, 0);
    REP(i,1,N+1) cin >> A[i] >> B[i];
    
    ASC(A); ASC(B);
    ll midA = mid(A);
    ll midB = mid(B);

    PR(midB-midA+1);


    return 0;
}

/*



*/

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

const int N = (int)1e5 + 5;

int n;

double ans;

int main(){
	cin >> n;
	if(n == 1) cout << fixed << setprecision(9) << 1.0;
	else{
		if(n % 2 == 0){
			cout << fixed << setprecision(9) << 0.5;
		}
		else{
			int x = n;
			n /= 2;
			n++;
			double ans = n;
			cout << fixed << setprecision(9) << ans / x; 
		}
	}
     return 0;
}

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

int main(){
	int n; cin >> n;
	
	int pos = 0, pot;
	for(int i = 1; i <= n; i++){
		pos += i;
		
		if(pos > n){
			pot = pos - n;
			break;
		}
	}
	
	pos = 0;
	for(int i = 1; pos < n; i++){
		if(i == pot) continue;
		pos += i;
		
		cout << i << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
S_A=list(input())
S_B=list(input())
S_C=list(input())

S_A=S_A[::-1]
S_B=S_B[::-1]
S_C=S_C[::-1]

turn='a'

while True:
  if turn=='a':
    if S_A==[]:
      print('A')
      break
    else:
      turn=S_A.pop()
  elif turn=='b':
    if S_B==[]:
      print('B')
      break
    else:
      turn=S_B.pop()
  else:
    if S_C==[]:
      print('C')
      break
    else:
      turn=S_C.pop()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

unordered_map<string, int> mp;
string toStr(int x) {
    string s;
    while(x > 0) {
        s += (char)(x%10 + '0');
        x /= 10;
    }
    reverse(all(s));
    return s;
}
int toInt(string s) {
    int ret = 0;
    rep(i, s.size()) {
        ret *= 10;
        ret += s[i] - '0';
    }
    return ret;
}

string calc(string s, int n) {
    sort(all(s));
    string t = s;
    reverse(all(t));
    string ret = toStr(toInt(t) - toInt(s));
    while(ret.size() < n) ret = "0" + ret;
    return ret;
}

int main(){
    string s;
    int n;
    while(cin >> s >> n) {
        if(s == "0" && n == 0) break;
        mp.clear();
        int cnt = 0;
        while(s.size() < n) s = "0" + s;
        mp[s] = cnt++;
        while(1) {
            s = calc(s, n);
            if(mp.count(s)) {
                cout << mp[s] << " " << toInt(s) << " " << cnt - mp[s] << endl;
                break;
            }
            else {
                mp[s] = cnt++;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
using namespace std;

void solve(long long N, long long T, std::vector<long long> ts){
    multiset<pair<long long, int>> events;
    for(auto t: ts){
        events.insert(make_pair(t, 1));
        events.insert(make_pair(t+T, -1));
    }

    int cnt=0;
    long long prev=0ll, ans=0ll;
    for(auto kv: events){
        auto curr=kv.first;
        if(cnt>0)ans+=(kv.first-prev);
        prev = curr;
        cnt+=kv.second;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 26752
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#define maxn 100010
#define inf 999999999999999
using namespace std;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll ans;
struct P{
    int a,b;
}p[maxn];
bool cmp(P x,P y)
{
    return x.a-x.b>y.a-y.b;
}
int X,Y,Z;
int n;
priority_queue<int,vector<int>,greater<int> >q;
ll pre[maxn],suf[maxn];
int main()
{
    X=read();Y=read();Z=read();n=X+Y+Z;
    for(int i=1;i<=n;i++)
    {
        int x=read(),y=read(),z=read();
        ans+=x;
        p[i].a=y-x;p[i].b=z-x;
    }
    sort(p+1,p+n+1,cmp);
    for(int i=1;i<=n;i++)
    {
        q.push(p[i].a);
        pre[i]=pre[i-1]+p[i].a;
        if(q.size()>Y)
        {
            pre[i]-=q.top();
            q.pop();
        }
    }
    while(q.size())  q.pop();
    for(int i=n;i>=1;i--)
    {
        q.push(p[i].b);
        suf[i]=suf[i+1]+p[i].b;
        if(q.size()>Z)
        {
            suf[i]-=q.top();
            q.pop();
        }
    }
    ll tmp=-inf;
    for(int i=Y;i<=n-Z;i++)  tmp=max(tmp,pre[i]+suf[i+1]);
    cout<<ans+tmp<<endl;
    return 0;
}

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void ng() {
    cout << 0 << endl;
    exit(0);
}

const ll INF = LLONG_MAX / 4;

int N, M;
vector<pii> G[100005];
int parity[100005];
ll sum[100005];
// 頂点0の条件
ll L = 1, R = INF;

void dfs(int u, ll s, int par) {
    parity[u] = par;
    sum[u] = s;

    each(e, G[u]) {
        int v, w;
        tie(v, w) = e;
        if (parity[v]) {
            ll tum = sum[u] + sum[v];
            // 頂点0の値を変えても両端の値がそれぞれ+1, -1するので常に条件を満たす
            // または、常に条件を満たさない
            if (parity[v] != parity[u]) {
                if (tum != w) {
                    ng();
                }
            } else {
                // 頂点0の値を0からxへ書き換えることで
                // parity[u] * 2 * xだけ調節できる
                if ((w - tum) % 2 || (w - tum) / parity[u] < 0) {
                    ng();
                }
                // この場合頂点0の値は確定する。
                ll val = (w - tum) / (parity[u] * 2);
                smax(L, val);
                smin(R, val);
            }
        } else {
            if (par == 1) {
                // 1<= x + s < w
                // 1-s<=x<w-s
                smax(L, 1 - s);
                smin(R, w - s - 1);
            } else {
                // 1<= -x + s < w
                // s-w<x<=s-1
                smax(L, s - w + 1);
                smin(R, s - 1);
            }
            dfs(v, w - s, par*-1);
        }
    }
}

void solve() {
    cin >> N >> M;
    rep(i, M) {
        int u, v, w;
        cin >> u >> v >> w;
        --u; --v;
        G[u].emplace_back(v, w);
        G[v].emplace_back(u, w);
    }

    dfs(0, 0, 1);

    if (L > R) {
        ng();
    }

    cout << R - L + 1 << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 14720
#include<iostream>

using namespace std;

int main(){
    int n; cin >> n;
    int A[105];
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < n-1; i++)
        {
            cout << A[i] << " ";
        }
        cout << A[n-1] << endl;
    for (int i = 1; i < n; i++)
    {
        int key; key = A[i];
        int j; j = i-1;
        while (j >= 0 && A[j] > key)
        {
            A[j+1] = A[j];
            --j;
        }
        A[j+1] = key;
        for (int k = 0; k < n-1; k++)
        {
            cout << A[k] << " ";
        }
        cout << A[n-1] << endl;
    }
}


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

int main(){
  long long int r,tmp,x,a,b;
  cin>>a>>b;
  x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 cout<<x/b;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    string S;
    cin >> S;

    string N;
    while (N.size() <= 1e6-S.size()) {
        N += '0';
    }

    N += S;

    // cout << N.size() << "\n";

    mat dp(1e6+2, vec(2, inf));
    dp[0][0] = 0;
    // dp[i][larger]
    Rep (i, 1e6+1) {
        // larger 0 to 0
        chmin(dp[i+1][0], dp[i][0] + N[i] - '0');

        // larger 0 to 1
        if (N[i] - '0' < 9) {
            chmin(dp[i+1][1], dp[i][0] + N[i] - '0' + 1);
        }

        // larger 1 to 1
        chmin(dp[i+1][1], dp[i][1] + 9 - N[i] + '0');

        chmin(dp[i+1][0], dp[i][1] + 10 - N[i] + '0');
    }

    // for (ll i = 999998; i <= 1e6+1; i++) {
    //     cout << "i=" << i << " " << dp[i][0] << " " << dp[i][1] << "\n";
    // }

    cout << dp[1e6+1][0] << "\n";
    
}

Measured memory_bytes: 56860
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <string.h>
#include <math.h>
#define pi 3.1415926535

using namespace std;

int main(){
	vector<double> ans(1000);
	int index = 0;
	while(true){
		int n;
		cin >> n;
		if(n == 0) break;
		vector<int> s(n);
		double sum = 0;
		double ave;
		for(int i = 0; i < n; i++){
			cin >> s.at(i);
			sum += s.at(i);
		}
		ave = sum / (double)n;
		sum = 0;
		for(int i = 0; i < n; i++){
			sum += ((double)s.at(i) - ave) * ((double)s.at(i) - ave);
		}
		double a = sqrt(sum / n);
		ans.at(index) = a;
		index++;
	}
	for(int i = 0; i < index; i++){
		printf("%.8lf\n", ans.at(i));
	}
}



Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using ll=long long;
using namespace std;
const auto mod=1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int k,x; cin >> k >> x;
  string ans="No";
  if(500*k>=x) ans="Yes";
  cout << ans << endl;
}






Measured memory_bytes: 892
#include<iostream>
using namespace std;
#define N 1000010
int main()
{
    int a[N]={0},n,i,j,count;
    for(i=2;i<=N/2;i++){
	if(a[i]==0){
	    for(j=2;j*i<=N;j++){
		a[i*j]=1;	     
    	    }
	}
    }
    while(1){
    	cin>>n;
	if(n==0)break;
    	count=0;
	for(i=2;i<=n/2;i++){
	    if(a[i]==0&&a[n-i]==0)count++;
	}   
	cout<<count<<endl; 
    }
    return 0;	
}

Measured memory_bytes: 4768
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        boolean flag = true;
        int m = 0;
        while (flag) {
            flag = false;
            for (int i = n - 1; i >= 1; i--) {
                if (a[i] < a[i-1]) {
                    int tmp = a[i];
                    a[i] = a[i-1];
                    a[i-1] = tmp;
                    m++;
                    flag = true;
                }
            }
        }
        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    }
}



Measured memory_bytes: 26564
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 100005;

struct Edge
{
	int u, v, w;
	bool operator < (const Edge &b) const
	{
		return w > b.w;
	}
} e[MAXN];

LL ans[MAXN], tag[MAXN];
vector <int> g[MAXN];
int n, f[MAXN];

inline int Find(int x)
{
	while (x ^ f[x])
		x = f[x] = f[f[x]];
	return x;
}

inline void Merge(int x, int y, int w)
{
	x = Find(x), y = Find(y);
	if (g[x].size() < g[y].size())
		swap(x, y);
	for (auto i : g[y])
		ans[i] += tag[y] - tag[x], ans[i] += 1LL * (g[x].size() - g[y].size()) * w;
	tag[x] += 1LL * g[y].size() * w;
	for (auto i : g[y])
		g[x].pb(i);
	f[y] = x;
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 1; i <= n; i ++)
		f[i] = i, g[i].pb(i);
	for (int i = 1; i < n; i ++)
		e[i].u = Read(), e[i].v = Read(), e[i].w = Read();
	sort(e + 1, e + n);
	for (int i = 1; i < n; i ++)
		Merge(e[i].u, e[i].v, e[i].w);
	for (int i = 1; i <= n; i ++)
		printf("%lld\n", ans[i] + tag[Find(i)]);
	return 0;
}


Measured memory_bytes: 13560
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n;
    cin>>n;
    int x[n],y[n],h[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
    }
    int flag;
    for(int i=0;i<n;i++){
        if(h[i]!=0){
            flag=i;
        }
    }

    int ans_x,ans_y,ans_h;
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            bool ok=true;
            int height=h[flag]+abs(x[flag]-i)+abs(y[flag]-j);
            for(int k=0;k<n;k++){
                int tmp=max(height-abs(x[k]-i)-abs(y[k]-j),0);
                if(tmp!=h[k]){
                    ok=false;
                    break;
                }
                }
                if(ok){
                    cout<<i<<" "<<j<<" "<<height<<endl;
                }
            }
        }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <limits>
#include <iomanip>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    //
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    //
    vector<int> dp(100002,0);
    for(int i=0;i<N;i++){
        if(a[i]>0){
            dp[(a[i])-1]++;
            dp[a[i]]++;
            dp[(a[i])+1]++;
        }
        else{
            dp[a[i]]++;
            dp[(a[i])+1]++;
        }
    }
    //
    int max_num=0;
    int num=0;
    for(int i=0;i<dp.size();i++){
        num = dp[i];
        if(max_num < num){
            max_num = num;
        }
    }
    //
    cout << max_num << endl;
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

// 繰り返し二乗法
ll power(ll a, ll b){
    if(a==1)return a;
    // if(a==0)re
    ll res=1;
    while(b>0){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}

const int MAX=2100000;

ll fact[MAX], fact_inv[MAX];

void init_fact(ll n){
    fact[0]=1;
    // 階乗の計算
    for(ll i=0; i<n; i++) fact[i+1]=fact[i]*(i+1)%MOD;
    fact_inv[n]=power(fact[n], MOD-2);
    // 逆元の計算
    for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}

ll comb(ll n, ll r){
    return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

ll perm(ll n, ll r){
    return (fact[n]*fact_inv[n-r])%MOD;
}

int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    map<string, ll> m;
    ll maxval = 0;
    rep(i,n){
        string s; cin>>s;
        m[s]++;
        chmax(maxval, m[s]);
    }

    vstring ans;
    for(auto p:m){
        string s; ll cnt;
        tie(s, cnt) = p;
        if(cnt == maxval) ans.emplace_back(s);
    }

    sort(ALL(ans));

    for(auto e:ans) cout<<e<<endl;

    return 0;

}

Measured memory_bytes: 26868
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }


int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	int n; sc(n);
	int k=log2 (n);
	if ((1<<k)==n) return puts("No"),0;
	puts("Yes");
	for (int i=2; i< n; i+=2)
		printf ("%d %d\n%d %d\n%d %d\n%d %d\n",1,i,i,i+1,1,n+i+1,n+i+1,n+i);
	printf ("%d %d\n",n+1,3);
	if (!(n&1)) printf ("%d %d\n%d %d\n",n+(1<<k)+1,n,n-(1<<k),n<<1);

    return 0;
}


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

template<class flow_t>
struct ford_fulkerson{
  struct edge{
    int to;
    flow_t cap;
    int rev;
    edge(){}
    edge(int t,flow_t f,int i)
      :to(t),cap(f),rev(i){}
  };

  vector<vector<edge>> adj;
  vector<int> visited;
  int turn;
  const flow_t INF = numeric_limits<flow_t>::max();
  
  ford_fulkerson(){}
  ford_fulkerson(int n){
    adj.resize(n);
    visited.resize(n,-1);
    turn = 0;
  }
  void add_edge(int from,int to,flow_t cap){
    adj[from].emplace_back(to,cap,adj[to].size());
    adj[to].emplace_back(from,0,adj[from].size()-1);
  }
  flow_t dfs(int v,int const t,flow_t flow){
    if(v==t)return flow;
    visited[v] = turn;
    for(auto& e:adj[v]){
      if(e.cap>0&&visited[e.to]!=turn){
        flow_t f = dfs(e.to,t,min(flow,e.cap));
        if(f>0){
          e.cap -= f;
          adj[e.to][e.rev].cap += f;
          return f;
        }
      }
    }
    return 0;
  }
  flow_t max_flow(int s,int t){
    flow_t flow = 0;
    for(flow_t f;(f=dfs(s,t,INF))>0;turn++){
      flow += f;
    }
    return flow;
  }
};

void solve(){

  int n,m;
  cin>>n>>m;
  ford_fulkerson<int> mf(n);
  for(int i=0;i<m;++i){
    int f,t,c;
    cin>>f>>t>>c;
    mf.add_edge(f,t,c);
  }
  int ans = mf.max_flow(0,n-1);
  cout<<(ans)<<endl;

}

int main(){
  solve();
}


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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

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

  string N;
  int K;
  cin>>N>>K;
  int n=N.size();
  vector<int>num(n);
  for(int i=0;i<n;i++){
    num[i]=(N[i]-'0');
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    //dp[上からの桁数][フラグ][0の個数]
    vector<vector<vector<ll>>>dp(n+1,vector<vector<ll>>(2,vector<ll>(K+2,0)));
    if(i==0)dp[i][0][0]=1;
    else dp[i][1][0]=1;
    for(int j=i;j<n;j++){
      for(int k=0;k<2;k++){
        for(int l=(j==i?1:0);l<=(k?9:num[j]);l++){
          for(int m=0;m<K+2;m++){
            if(l!=0)dp[j+1][k||(l<num[j])][min(m+1,K+1)]+=dp[j][k][m];
            else dp[j+1][k||(l<num[j])][m]+=dp[j][k][m];
          }
        }
      }
    }
    ans+=dp[n][0][K]+dp[n][1][K];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char* argv[]) {
	int n;
	int a, b;
	std::cin >> n;
	if (n == 1) {
		std::cout << "Hello World" << std::endl;
		
	}
	else if (n == 2) {
		std::cin >> a >> b;
		std::cout << a + b << std::endl;
	}
	return 0;
}

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

int main(){
	int N,M;
	cin>>N>>M;
	int a[M],b[M],c[N];
	for(int i=0;i<N;i++) c[i]=0;
	for(int i=0;i<M;i++) cin>>a[i]>>b[i];
	for(int i=0;i<M;i++){
		c[a[i]-1]++;
		c[b[i]-1]++;
	}
	for(int i=0;i<N;i++) cout<<c[i]<<endl;
	return 0;
}


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

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

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

int main(void) {

  int n;
  cin >> n;
  int a[3];
  a[0] = n % 10;
  a[1] = (n/10)%10;
  a[2] = n/100;

  bool f = false;
  rep(i, 3) if (a[i] == 7) f = true;

  if (f) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 3584
#include <iostream>

using namespace std;
int main(){
	int zero;
	while(1){
		
		int N;
		int* score;
		int S = 0;
		int max = 0;
		int min = 0;
	
		cin >> N;
		
		if(N == 0){
			return 0;
		}
		
		score = new int[N];
		for(int i=0; i<N; ++i){
			cin >> score[i];
			S += score[i];
			
			if( i == 0 ){
				max = min = score[i];
			}
		
			if( max < score[i] ){
				max = score[i];
			}
			if( min > score[i] ){
				min = score[i];
			}
		}
		S -= max;
		S -= min;
	
		cout << (int)S/(N-2) << endl;

		delete[] score;
	}

}

Measured memory_bytes: 1196
function Main(input) {
  input = input.split("\n");
  w=input[0];
  x=new Array();
  y=new Array();
  var s="Yes";
  wl=w.length;
  var z;
  var z2;
  for(i=0;i<wl;i++){
    a=w.slice(0,1);
    w=w.slice(1);
    //if(x.length==0){
    //  x[0]=a;
    //  y[0]=0;
    //}
    z=0;
    z2=0;
    for(j=0;j<x.length;j++){
      if(x[j]==a){
        z=1;
        z2=j;
      }else{
      }
    }
    if(z==0){
      x[x.length]=a;
      y[x.length-1]=1;

    }else{
      y[z2]=y[z2]+1;

    }


  }
  for(i=0;i<y.length;i++){
    if(y[i]%2==1){
      s="No";
    }
  }
  console.log('%s', s);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9420
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=a-1;i>=b;i--)
#define endl '\n'
#define spc " "
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.14159265358979323
#define sz(a) (int)((a).size())
#define FOR(i,j,k,l) for(ll i=j;i<k;i+=l)


void Fast_IO() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   #ifndef ONLINE_JUDGE
   freopen("in.txt","r",stdin);
   freopen("out.txt","w",stdout); 
   #endif
} 

int main(){
   Fast_IO();
   string s;
   cin>>s;
   cout<<s[0]<<s[1]<<s[2];

}




Measured memory_bytes: 3652
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (H, W) = read!(usize, usize);
    let T = read![String; H]
        .into_iter()
        .map(|line| line.chars().collect::<Vec<_>>())
        .collect::<Vec<_>>();

    let mut M = 0;
    let mut Q = VecDeque::new();
    let mut done = vec![vec![false; W]; H];
    for y in 0..H {
        for x in 0..W {
            if T[y][x] == '#' {
                Q.push_back(((y as i32, x as i32), 0));
            }
        }
    }

    while let Some(((y, x), d)) = Q.pop_front() {
        if done[y as usize][x as usize] {
            continue;
        }
        done[y as usize][x as usize] = true;
        M = max(M, d);

        for &(y, x) in &[(y - 1, x), (y, x - 1), (y + 1, x), (y, x + 1)] {
            if 0 <= y && y < H as i32 && 0 <= x && x < W as i32 {
                Q.push_back(((y, x), d + 1));
            }
        }
    }

    println!("{}", M)
}


Measured memory_bytes: 57908
#include<iostream>
#include<vector>
#include<map>
#include<sstream>
#include<cassert>

using namespace std;

typedef long long ll;

bool isnum(string s){
  for(int i = 0; i < s.length(); i++)
    if(s[i] < '0' || '9' < s[i]) return false;

  return true;
}

bool issep(string s){
  int p = 1;
  if(s[0] != '(') return false;
  for(int i = 1; i < s.length()-1; i++){
    if(s[i] == '(') p++;
    if(s[i] == ')') p--;
    if(p == 0) return false;
  }
  // cout << " test " << s[s.length()-1] << " " << p << endl;
  return ((s[s.length()-1] == ')') && (p == 1));
}

vector<ll> solve(string s){

  //  cout << "s " << s << endl;
  
  vector<ll> V;

  if(isnum(s)){
    stringstream ss(s);
    ll n;
    ss >> n;
    V.push_back(n);
    return V;
  }else if(issep(s)){
    return solve(s.substr(1,s.length()-2));
  }else{
    int para = 0;

    for(int i = 0; i < s.length(); i++){
      vector<ll> v1,v2;
      if(s[i] == '(') para++;
      if(s[i] == ')') para--;

      if(para == 0 && s[i] == '+'){
	v1 = solve(s.substr(0,i));
	v2 = solve(s.substr(i+1));

	for(int j = 0; j < v1.size(); j++)
	  for(int k = 0; k < v2.size(); k++)
	    V.push_back(v1[j]+v2[k]);
	  
      }

      if(para == 0 && s[i] == '-'){
	vector<ll> v1,v2;
	v1 = solve(s.substr(0,i));
	v2 = solve(s.substr(i+1));

	for(int j = 0; j < v1.size(); j++)
	  for(int k = 0; k < v2.size(); k++)
	    V.push_back(v1[j]-v2[k]);
      }

      if(para == 0 && s[i] == '*'){
	vector<ll> v1,v2;
	v1 = solve(s.substr(0,i));
	v2 = solve(s.substr(i+1));

	for(int j = 0; j < v1.size(); j++)
	  for(int k = 0; k < v2.size(); k++)
	    V.push_back(v1[j]*v2[k]);
      }

      if(para == 0 && s[i] == '/'){
	vector<ll> v1,v2;
	v1 = solve(s.substr(0,i));
	v2 = solve(s.substr(i+1));

	for(int j = 0; j < v1.size(); j++)
	  for(int k = 0; k < v2.size(); k++)
	    if(v2[k] != 0) V.push_back(v1[j]/v2[k]);

      }
    }
  }
  return V;
}

int main(){
  
  string in;
  while(getline(cin,in) && in != "#"){
    vector<ll> V = solve(in);
    map<ll,bool> M;
    ll ans = 0;
    for(int i = 0; i < V.size(); i++){
      if(M[V[i]] == false){
	M[V[i]] = true;
	ans++;
      }
    }
    
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

//#define FILE_IO

int N, M;
int v[300005];
int dp[300005][2];

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d", &N);
    M = 1 << N;
    for(int i = 0; i < M; i++)
    {
        scanf("%d", &v[i]);
        dp[i][0] = v[i];
        dp[i][1] = -(1 << 30);
    }

    for(int i = 0; i < N; i++)
        for(int msk = M - 1; msk >= 0; msk--)
            if( (msk >> i) & 1 )
            {
                int x = dp[msk ^ (1 << i)][0];
                if(x > dp[msk][0])
                {
                    dp[msk][1] = dp[msk][0];
                    dp[msk][0] = x;
                }
                else if(x > dp[msk][1])
                {
                    dp[msk][1] = x;
                }

                x = dp[msk ^ (1 << i)][1];
                if(x > dp[msk][0])
                {
                    dp[msk][1] = dp[msk][0];
                    dp[msk][0] = x;
                }
                else if(x > dp[msk][1])
                {
                    dp[msk][1] = x;
                }
            }

    int ans = -(1 << 30);
    for(int i = 1; i < M; i++)
    {
        ans = max(ans, dp[i][0] + dp[i][1]);
        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 6144
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if(sum(A) < sum(B)):
    print(-1)
else:
    p = []
    m = []
    for i in range(N):
        if(B[i]-A[i] <= 0):
            p.append(A[i]-B[i])
        else:
            m.append(B[i]-A[i])
    p.sort(reverse=True)
    ans = len(m)
    idx = 0
    res = sum(m)
    while res > 0:
        if(p[idx] == 0):
            idx += 1
            continue
        res = res - p[idx]
        ans += 1
        idx += 1

    print(ans)

Measured memory_bytes: 24240
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include <vector>

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

using namespace std;

template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& pair)
{
    is >> pair.first >> pair.second;
    return is;
}

template <class T>
istream& operator>>(istream& is, vector<T>& collection)
{
    for (auto& item : collection)
        is >> item;
    return is;
}

template <class T>
istream& operator>>(istream& is, valarray<T>& collection)
{
    for (auto& item : collection)
        is >> item;
    return is;
}

template <class T>
T peak_and_pop(std::queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.front());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::priority_queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::stack<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

struct run_t {
    bool flag;
    int ibegin;
    int length;
    int score;
};

void solution()
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> needed_k(n);
    if(s[0] == '0') needed_k[0] = 1;
    for(int i = 1; i < n; ++i){
        needed_k[i] = needed_k[i-1];
        if(s[i] == '0' && s[i-1] == '1'){
            needed_k[i] += 1;
        }
    }
    int b = 0, e = 1;
    int score = 0;
    while(b < n){
        int nk = needed_k[e-1] - needed_k[b];
        if(s[b] == '0') nk += 1;
        if(nk <= k){
            score = max(score, e - b);
        }
        if(nk <= k && e < n){
            e += 1;
        }
        else{
            b += 1;
            if(b >= e) e = b + 1;
        }
    }
    cout << score << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solution();
    return 0;
}


Measured memory_bytes: 848
import java.util.*;

public class Main{
  
  public static void main(String[] args){
	  Scanner scanner = new Scanner(System.in);
	  int numberOfSheets = scanner.nextInt();
	  int standardValue  = scanner.nextInt();
	  int total = moneyCollection(numberOfSheets);
	  if (total >= standardValue) {
		System.out.println("Yes");
	}else {
		System.out.println("No");
	}
	  

  }

private static int moneyCollection(int numberOfSheets) {
	int sum = 500 * numberOfSheets;
	return sum;
}
}

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

typedef long long ll;

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

    vector<int> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ll pre = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        ll over = C.end() - upper_bound(C.begin(), C.end(), B[i]);
        ans += pre * over;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
    using namespace std;
     
    typedef long long ll;
     
    int main(void)
    {
        //freopen("input.txt", "r", stdin);
     
        int i, n;
        cin >> n;
        string a;
        map <string, int> m;
        vector <string> v;
     
        int cnt = 0;
        for(i = 0; i < n; i++)
        {
            cin >> a;
m[a]++;
cnt = max(m[a], cnt);

        }
     
        for(auto it = m.begin(); it != m.end(); it++)
        {
            if(it->second == cnt)
                cout << it->first << "\n";
        }
     
        return 0;
    }

Measured memory_bytes: 19168
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
max_A = max(A)
max_num = 0
for i in range(N):
    if A[i] == max_A:
        # 最大値が複数ある場合の計算削減
        max_num += 1
        if max_num > 1:
            print(max_A)
        else:
            print(max(A[:i] + A[i + 1:]))
    else:
        print(max_A)

Measured memory_bytes: 15604
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    
    if (n==22) {
      System.out.println("Christmas Eve Eve Eve");
    }
    if (n==23) {
      System.out.println("Christmas Eve Eve");
    }
    if (n==24) {
      System.out.println("Christmas Eve");
    }
    if (n==25) {
      System.out.println("Christmas");
    }
  }
}

Measured memory_bytes: 20692
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String o = sc.next();
		String e = sc.next();
		int m = o.length();
		int n = e.length();
		for(int i=0; i<n; i++){
			System.out.print(o.charAt(i));
			System.out.print(e.charAt(i));
		}
		if(m>n)System.out.print(o.charAt(m-1));
		System.out.println("");
	}
}

Measured memory_bytes: 22608
#include<bits/stdc++.h>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define eb emplace_back
#define pb push_back
#define ll long long
#define mp make_pair
#define x first
#define y second
//# define INF 99999999999999999
#define mod 1000000007
#define mod1 1000000006
#define sc(a) scanf("%d",&a);
#define pc(x) putchar_unlocked(x)
#define PI  3.141592653589793
#define pp pair < ll , ll >
using namespace std;

int min(int a ,  int b)
{
  if(a<b) return a;
  else return b;
}
int max(int a ,  int b)
{
  if(a>b) return a;
  else return b;
}
int a[100005];

int cn[1000005];
int main()
{
	int n;
	cin >> n;
	int i;
	rep(i , 0 , n) cin >> a[i];
	int ans = 0;
	int res = -1;
	rep(i , 1 ,n) {
		if(a[i] <= a[i-1]) ans++;
		else {
			res= max(res,ans);
			ans = 0;
		}
		//cout << ans << "\n";
	}
	
	res= max(res,ans);
	ans = 0;
	cout << res;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
    using namespace std;
    #define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
    int main() {
      int A,B,C;
      cin >> A >> B >> C;
      
      if ( A == B && A == C) {
        cout << "No" << endl;
      }
      else if(A == B || A == C || B == C) {
        cout << "Yes" << endl;
      }
      else {
        cout << "No" << endl;
      }
    }

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        s: Chars,
    }
    let mut res = 0;
    let mut r = 0;
    for c in s {
        if c == 'R' {
            r += 1;
            res = std::cmp::max(r, res);
        } else {
            r = 0;
        }
    }

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


Measured memory_bytes: 2160