akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>   
using namespace std;   
typedef long long ll;

int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	int d; cin >> d;
	if (d == 25)
		cout << "Christmas\n";
	else if (d == 24)
		cout << "Christmas Eve\n";
	else if (d == 23)
		cout << "Christmas Eve Eve\n";
	else
		cout << "Christmas Eve Eve Eve\n";



	return 0;   
}  


Measured memory_bytes: 636
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

vector<ll> inv,fac;

void inverse(ll n){
    //要素数:n+1 (0~n)
    inv[0]=1;
    inv[1]=1;
    for(ll i=2;i<=n;i++){
        inv[i]=(MOD-inv[MOD%i]*(MOD/i))%MOD;
    }
}

void inverse_u(ll n){
    //要素数:n+1 (0~n)
    for(ll i=2;i<=n;i++){
        inv[i]=(inv[i]*inv[i-1])%MOD;
    }
}

void factorial(ll n){
    //要素数:n+1 (0~n)
    fac[0]=1;
    fac[1]=1;
    for(ll i=2;i<=n;i++){
        fac[i]=(fac[i-1]*i)%MOD;
    }
}

ll nCr(ll n,ll r){
    return fac[n]*inv[r]%MOD*inv[n-r]%MOD;
}

ll proinverse(ll x,ll m){
    ll res=1,M=m-2;
    while(M>0){
        if(M&1) res=res*x%m;
        x=x*x%m;
        M>>=1;
    }
    return res;
}

void init_nCr(ll n){
    inv.assign(n+1,0);
    fac.assign(n+1,0);
    inverse(n); inverse_u(n);
    factorial(n);
}


int main(){
    ll k,ls,ans=1,m=1; cin>>k;
    string s; cin>>s;
    ls=s.size();
    init_nCr(k+ls+1);
    rep(i,k+ls){
        ans=(ans*26)%MOD;
        m=(m*25)%MOD;
    }
    ll r=proinverse(25,MOD);
    rep(i,ls){
        ll d=nCr(k+ls,i)*m%MOD;
        ans=(MOD+ans-d)%MOD;
        m=(m*r)%MOD;
    }
    cout<<ans<<endl;
}

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

int main() {
  ll n; string s;
  cin >> n >> s;
  
  if(n>=3200) cout << s << endl;
  else cout << "red" << endl;
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, A, B, C, D;
	std::string S;
	in >> N >> A >> B >> C >> D >> S;

	bool flag1 = true, flag2 = true, flag3 = true;
	for (LL i = A; i < C - 1; ++i)
	{
		if (S[i] == '#' && S[i + 1] == '#')
		{
			flag1 = false;
			break;
		}
	}
	for (LL i = B; i < D - 1; ++i)
	{
		if (S[i] == '#' && S[i + 1] == '#')
		{
			flag2 = false;
			break;
		}
	}
	if (C > D)
	{
		flag3 = false;
		for (LL i = std::max(B - 2, 0LL); i <= D - 2; ++i)
		{
			if (S[i] == '.' && S[i + 1] == '.' && S[i + 2] == '.')
			{
				flag3 = true;
				break;
			}
		}
	}

	out << (flag1 && flag2 && flag3 ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 764
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),m,sum=0,fsum=0;
    int[] t=new int[n];
    for(int i=0;i<n;i++){
      t[i]=sc.nextInt();
      sum+=t[i];
    }
    m=sc.nextInt();
    fsum=sum;
    int[] p=new int[m],x=new int[m];
    for(int i=0;i<m;i++){
      p[i]=sc.nextInt();
      x[i]=sc.nextInt();
      fsum=fsum-t[p[i]-1]+x[i];
      System.out.println(fsum);
      fsum=sum;
    }
  }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        ld a,b;
        cin>>a>>b;
        cout<<fixed<<setprecision(3)<<a/b<<"\n";
        return 0;
}
/**

**/


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
pointx=[]
pointy=[]
for i in range(n):
    x,y=map(int,input().split())
    pointx.append((x,i))
    pointy.append((y,i))
pointx.sort()
pointy.sort()
G=[[] for i in range(n)]
for i in range(n-1):
    dx=abs(pointx[i+1][0]-pointx[i][0])
    G[pointx[i][1]].append((dx,pointx[i+1][1]))
    G[pointx[i+1][1]].append((dx,pointx[i][1]))
    dy=abs(pointy[i+1][0]-pointy[i][0])
    G[pointy[i][1]].append((dy,pointy[i+1][1]))
    G[pointy[i+1][1]].append((dy,pointy[i][1]))
import heapq
q=[]
check=[False]*n
check[0]=True
for i in G[0]:
    heapq.heappush(q,i)
ans=0
while len(q)>0:
    now=heapq.heappop(q)
    if not check[now[1]]:
        ans+=now[0]
        check[now[1]]=True
        for i in G[now[1]]:
            heapq.heappush(q,i)
print(ans)




Measured memory_bytes: 72768
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
// #define DEBUGGING

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

namespace __init {

struct InitIO {
    InitIO() {
        cin.tie(0);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N, M;
    cin >> N >> M;
    auto A = make_v(0, N, M);
    for(auto &v : A) for(auto &e : v) {
        cin >> e;
        e--;
    }

    for(ll ans = 1; ans <= N; ans++) {
        V<bool> ok(M, true);
        V<ll> idxv(N, 0);
        bool suc = true;
        while(true) {
            V<ll> cnt(M, 0);
            V<bool> ng(M, false);
            for(ll i = 0; i < N; i++) {
                ll idx = idxv[i];
                if(!ng[idx]) cnt[A[i][idx]]++;
            }
            for(ll i = 0; i < M; i++) {
                ng[i] = (cnt[i] > ans);
                ok[i] = (ok[i] & !ng[i]);
            }
            bool bflag = false;
            bool check = true;
            for(ll i = 0; i < N; i++) {
                ll &idx = idxv[i];
                if(!ok[A[i][idx]] || ng[A[i][idx]]) {
                    idx++;
                    check = false;
                    if(idx >= M) {
                        bflag = true;
                        break;
                    }
                }
            }
            if(check) break;
            if(bflag) {
                suc = false;
                break;
            }
        }
        if(suc) {
            cout << ans << endl;
            return 0;
        }
    }
    assert(false);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

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

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

int main(){
    ll k; cin>>k;
    vector<ll> a(k);
    for(int i=0; i<k; i++) cin>>a[i];

    ll lb=0, ub=1e18, mid;
    ll minans=1e18+1, maxans=-1;
    while(ub-lb>1){
        mid=(lb+ub)/2;
        ll num=mid;

        for(int i=0; i<k; i++){
            num-=(num%a[i]);
        }

        if(num==2){
            ub=mid;
            chmin(minans, mid);
        }
        else if(2<num) ub=mid;
        else lb=mid;
    }

    lb=0, ub=1e18;
    while(ub-lb>1){
        mid=(lb+ub)/2;
        ll num=mid;

        for(int i=0; i<k; i++){
            num-=(num%a[i]);
        }

        if(num==2){
            lb=mid;
            chmax(maxans, mid);
        }
        else if(num<2) lb=mid;
        else ub=mid;
    }

    if(minans>maxans) cout << -1 << endl;
    else cout << minans << " " << maxans << endl;
}


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

#define fir first
#define sec second
using namespace std;
typedef long long LL;
typedef unsigned long long u64;

template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
int inp() {
	int x = 0, f = 1;char ch;
	for(ch = getchar(); !isdigit(ch); ch = getchar())
		if(ch == '-') f = -1;
	for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	return x * f;
}

const int M = 23, P = 998244353, G = 3;
const int MaxN = (1 << 19) + 10;
int N = 1 << 18;

inline int add(int a, int b) {
    return (a + b) % P;
}

inline int sub(int a, int b) {
    return (a - b + P) % P;
}

inline int mul(int a, int b) {
    return (LL)a * (LL)b % P;
}

inline int exp(int a, int b) {
    int ans = 1;
    for (; b; b >>= 1) {
        if (b & 1) ans = mul(ans, a);
        a = mul(a, a);
    }
    return ans;
}

inline int inv(int x) {
    return exp(x, P - 2);
}

int eps[MaxN], ieps[MaxN];

inline void init() {
    int g = exp(G, (P - 1) / N), ig = inv(g);
    eps[0] = ieps[0] = 1;
    for (int i = 1; i < N; i++) eps[i] = mul(eps[i - 1], ig), ieps[i] = mul(ieps[i - 1], g);
}

inline void trans(int n, int x[], int w[]) {
    for (int i = 0, j = 0; i != n; i++) {
        if (i < j) std::swap(x[i], x[j]);
        for (int l = n >> 1; (j ^= l) < l; l >>= 1);
    }
    for (int i = 2; i <= n; i <<= 1) {
        int l = i >> 1, d = N / i;
        for (int j = 0; j != n; j += i)
            for (int k = 0; k != l; k++) {
                int t = mul(x[j + k + l], w[d * k]);
                x[j + k + l] = sub(x[j + k], t);
                x[j + k] = add(x[j + k], t);
            }
    }
}

inline void dft(int n, int x[]) {
    trans(n, x, eps);
}

inline void idft(int n, int x[]) {
    trans(n, x, ieps);
    for (int i = 0, in = inv(n); i < n; i++) x[i] = mul(x[i], in);
} 

char A[MaxN], B[MaxN];
int n, fac[MaxN], rfac[MaxN], x[MaxN], y[MaxN], z[MaxN];
int main() {
	int i;
	init();
	scanf("%s%s", A + 1, B + 1); n = strlen(A + 1);
	int X = 0, Y = 0;
	for(i = 1; i <= n; i++) {
		if(A[i] == '1' && B[i] == '1')
			++X;
		if(A[i] == '1' && B[i] == '0')
			++Y;
	}
	for(fac[0] = i = 1; i < MaxN; i++) fac[i] = mul(fac[i - 1], i);
 	rfac[MaxN - 1] = inv(fac[MaxN - 1]);
	
	for(i = MaxN - 1; i; i--) rfac[i - 1] = mul(rfac[i], i); 
	int L = 1;
	while(L <= X + X + 1) L <<= 1;
	for(i = 0; i <= X; i++) x[i] = rfac[i + 1];
	
	z[0] = 1;
	for(int t = Y; t; t >>= 1) {
		if(t & 1) {
			dft(L, x); dft(L, z);
			for(i = 0; i < L; i++) z[i] = mul(z[i], x[i]);
			idft(L, z); idft(L, x);
		}
		
		dft(L, x);
		for(i = 0; i < L; i++) x[i] = mul(x[i], x[i]);
		idft(L, x);
		
		for(i = X + 1; i < L; i++) x[i] = z[i] = 0;
	}
	
	int ans = 0;
	for(i = 0; i <= X; i++) ans = add(ans, z[i]);
	int co = mul(fac[X + Y], mul(fac[X], fac[Y]));
	
	printf("%d", mul(ans, co)); 
	return 0;
}




Measured memory_bytes: 10624
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int main(){
	int n;
	scanf("%d", &n);
	if(n >= 1000){
		printf("ABD\n");
	}else{
		printf("ABC\n");
	}
	return 0;
}


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

#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())

using namespace std;

int n;
int p[20005];
int q[20005];

int main() {
    scanf("%d", &n);
    FO(i,0,n) scanf("%d", p+i), q[p[i]-1] = i;

    FO(i,0,n) printf("%d ", 20005 * i + 1);
    printf("\n");
    FO(i,0,n) printf("%d ", 20005 * (n-i-1) + 1 + q[i]);
    printf("\n");
}


Measured memory_bytes: 896
MOD = 998244353

def zeta_gcd(a,primes):
    n = len(a)-1
    for p in primes:
        for i in range(n//p,0,-1):
            a[i] += a[p*i]
            a[i] %= MOD
def mobius_gcd(a,primes):
    n = len(a)
    for p in primes:
        for i in range(1,n):
            if i*p >= n: break
            a[i] -= a[p*i] 
            a[i] %= MOD
def get_primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

NNN = 10**6 + 1
inverse = [0, 1]
for i in range( 2, NNN + 1 ):
    inverse.append( ( -inverse[MOD % i] * (MOD//i) ) % MOD )

N, = map(int, input().split())
X = list(map(int, input().split()))
primes = get_primes(NNN)
fs = [0]*NNN
for x in X:
    fs[x] += x
#print(fs)
zeta_gcd(fs, primes)
#print(fs)
for i, x in enumerate(fs):
    fs[i] = x**2
#print(fs)
mobius_gcd(fs, primes)
#print(fs)
r = 0
for i, f in enumerate(fs[1:]):
    i += 1
    r = (r + f*inverse[i]) % MOD
for x in X:
    r = (r - x) % MOD

print((r*inverse[2])%MOD)


Measured memory_bytes: 141164
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define INF 1e18
#define max_n 1000000

using namespace std;

void solve()
{
	ll n;
	cin>>n;
	ll pre[n],post[n];
	ll a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		if(i==0)pre[i]=a[i];
		else pre[i]=a[i]^pre[i-1];
	}
	for (int i = n-1; i >=0 ; --i)
	{
		if(i==n-1)post[i]=a[i];
		else post[i]=a[i]^post[i+1];
	}
	ll ans[n];
	for (int i = 0; i < n; ++i)
	{
		if(i==0)ans[i]=post[1];
		else if(i==n-1)ans[i]=pre[n-2];
		else ans[i]=post[i+1]^pre[i-1];
		cout<<ans[i]<<" ";
	}
	

}

int32_t main() 
{
	IOS	
	ll T=1;
	// cin>>T;
	for(ll i=1;i<=T;++i)
	{		
		// cout<<"Case #"<<i<<": ";
    	solve();
	}
	return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int D;
  cin >> D;
  switch(D) {
  case 22:
    cout << "Christmas Eve Eve Eve" << endl;
    break;
  case 23:
    cout << "Christmas Eve Eve" << endl;
    break;
  case 24:
    cout << "Christmas Eve" << endl;
    break;
  case 25:
    cout << "Christmas" << endl;
    break;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n, m;
int a[N];
int main() {
	ios::sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i < n; i++) {
 //       cout << " --- " << endl;
		if (a[i] + a[i+1] >= m) {
			cout << "Possible" << endl;
			for (int j = 1; j < i; j++) cout << j << endl;
			for (int j = n - 1; j >= i; j--) cout << j << endl;
			return 0;
		}
	}
	cout << "Impossible" << endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;

typedef pair<int, string> speP;
//vector<speP> memo[1 << 18];
void solve() {
	string s; cin >> s;
	int n = s.length();
	int ans = 0;
	string memo;
	/*memo[0].push_back(speP{ 0,(string)"" });
	rep(i, n) {
		string t1, t2;
		t1.push_back(s[i]);
		if (i < n - 1) {
			t2 = t1; t2.push_back(s[i + 1]);
		}
		rep(j, memo[i].size()) {
			int num = memo[i][j].first;
			string pre = memo[i][j].second;

		}
	}*/
	rep(i, n) {
		string t; t.push_back(s[i]);
		if (memo != t) {
			ans++;
			memo = t;
		}
		else {
			if (i == n - 1)break;
			t.push_back(s[i + 1]); i++;
			memo = t; ans++;
		}
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//init();
	solve();
	//cout << "finish" << endl;
	//stop
	return 0;
}


Measured memory_bytes: 720
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Five Dishes
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 5;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int sum = 0, maxd = 0;
  for (int i = 0; i < N; i++) {
    int ai;
    scanf("%d", &ai);
    int bi = (ai + 9) / 10 * 10;
    sum += bi;
    int d = bi - ai;
    if (maxd < d) maxd = d;
  }

  printf("%d\n", sum - maxd);
  return 0;
}


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

using namespace std;

#define endl "\n"
typedef long long ll;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
inline void setPrecision(int n){cout.precision(n);}

ll INF = 1e10;
ll MOD = 1e9+7;

int n;
int a[21][21];

ll done[1<<21];

ll pairs(int state){
    int idx = __builtin_popcount(state);
    if(idx == n) return 1;
    if(done[state] != -1) return done[state];
    ll ans = 0;
    for(int i=0;i<n;++i)
        if(a[idx][i] && !(state&(1<<i)))
            ans = (ans + pairs(state|(1<<i)))%MOD;
    done[state] = ans;
    return ans;
}

int main(){
    fastio;
    cin>>n;
    for(int i=0;i<n;++i)
        for(int j=0;j<n;++j)
            cin>>a[i][j];
    memset(done, -1, sizeof(done));
    cout<<pairs(0);
    return 0;
}


Measured memory_bytes: 19892
#include<bits/stdc++.h>
using namespace std;
string a[100005];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		char a0[15];
		scanf("%s",&a0);
		sort(a0,a0+10);
		a[i]=a0;
	}
	sort(a,a+n);
	unsigned long long ans=0,b=0;
	for(int i=1;i<=n;i++){
		if(a[i]!=a[i-1])
		{
			--i;
			ans+=(long long)(1+i-b)*(i-b)/2;
			b=++i;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 5888
if __name__ == "__main__":
    N, K = map(lambda x: int(x), input().split())
    a = list(map(lambda x: int(x), input().split()))

    ans = N + 1
    idx = 0
    num = 0
    values = [0] * K
    for s in range(N):
        while (idx < N and num < K):
            v = a[idx]
            if (v <= K):
                values[v - 1] += 1
                if (1 == values[v - 1]):
                    num += 1
            idx += 1
        if (K == num):
            ans = min(ans, idx - s)
        v = a[s]
        if (v <= K):
            values[v - 1] -= 1
            if (0 == values[v - 1]):
                num -= 1
    ans = ans if ans < N + 1 else 0
    print(ans)



Measured memory_bytes: 16388
N = int(input())
A = [int(i) for i in input().split()]
 
s = 0
for i in range(N) :
    s ^= A[i]
    
for i in range(N) :
    A[i] &= ~s
 
r = 0
for i in range(60, -1, -1) :
    for j in range(r, N) :
        if (A[j] >> i) & 1 :
            A[r], A[j] = A[j], A[r]
            break
    else :
        continue
    
    for j in range(N) :
        if j == r :
            continue
        if (A[j] >> i) & 1 :
            A[j] ^= A[r]
    
    r += 1
    
ret = 0
for i in range(r) :
    ret ^= A[i]
    
print(ret * 2 + s)

Measured memory_bytes: 77252
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1102

??????
?¨???????????????°????????????????????????????????????????????¨??????
?¨????????????§??????10000????¶??????????overflow??¨??¨??????

?§£???
?§?????§£???
pair???first????????°???second????????°?????????????????????

??¨??????
???????????±??????????????§is_over????????????????????????
overflow????????????????????´???????°?????????????????¶?????????????WA?????????
?????°??¨???????¬??????¨???????°????????????????????????¨?????????10+-10i???
??????i??¨?????§????????????1i
 */
#include <bits/stdc++.h>
  
using namespace std;
  
typedef string::const_iterator State;
typedef pair<int, int> Pii; //first:?????°???second:?????°
  
#define fr first
#define sc second

bool is_over = false;
  
struct Parser {
  Pii expression(State &idx) {
    Pii ret = term(idx);
    while ( 1 ) {
      if ( *idx == '+' ) {
	idx++;
	Pii tmp = term(idx);
	ret.fr = ret.fr + tmp.fr;
	ret.sc = ret.sc + tmp.sc;
      } else if ( *idx == '-' ) {
	idx++;
	Pii tmp = term(idx);
	ret.fr = ret.fr - tmp.fr;
	ret.sc = ret.sc - tmp.sc;
      } else {
	break;
      }
      if ( abs(ret.fr) > 10000 || abs(ret.sc) > 10000 ) is_over = true;
    }
    return ret;
  }
    
  Pii term(State &idx) {
    Pii ret = factor(idx);
    while ( 1 ) {
      if ( *idx == '*' ) {
	idx++;
	Pii tmp = factor(idx), tmp2 = ret;
	ret.fr = tmp2.fr * tmp.fr - tmp2.sc * tmp.sc;
	ret.sc = tmp2.fr * tmp.sc + tmp2.sc * tmp.fr;
      } else {
	break;
      }
      if ( abs(ret.fr) > 10000 || abs(ret.sc) > 10000 ) is_over = true;
    }
    return ret;
  }
  
  Pii factor(State &idx) {
    Pii ret;
    if ( *idx == '(' ) {
      idx++;
      ret = expression(idx);
      idx++;
    } else {
      ret = number(idx);
    }
    return ret;
  }
  
  Pii number(State &idx) {
    int tmp = 0;
    while ( '0' <= *idx && *idx <= '9' ) {
      tmp *= 10;
      tmp += *idx - '0';
      if ( abs(tmp) > 10000 ) is_over = true;
      idx++;
    }
    if ( *idx == 'i' ) {
      idx++;
      return Pii(0, 1); //i???0+1i??¨??????????????????
    }
   
    else return Pii(tmp, 0);
  }
};
  
int main()
{
  string s;
  while ( cin >> s ) {
    is_over = false;
    Parser ps;
    string tmp = s.substr(0, s.size() - 1);
    State idx = s.begin();
  
    Pii ret = ps.expression(idx);
    if ( abs(ret.fr) > 10000 || abs(ret.sc) > 10000 ) is_over = true;
    if ( is_over ) cout << "overflow" << endl;
    else if ( ret.fr == 0 && ret.sc == 0 ) cout << 0 << endl;
    else if ( ret.fr == 0 ) printf("%di\n", ret.sc);
    else if ( ret.sc == 0 ) printf("%d\n", ret.fr);
    else printf("%d%+di\n", ret.fr, ret.sc); //?????°??¨????¬????????°?????????????
  }
  
  return 0;
}

Measured memory_bytes: 3284
#include "bits/stdc++.h"
using namespace std;

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
ll INF = (1LL << 60);
int MOD = 1000000007;
int N;
long double p[3010];
long double dp[3010][3010];
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> N;
	rep(i, N)cin >> p[i];
	dp[0][0] = 1.0;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= i; j++) {
			if (j) {
				dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1];
			}
			else {
				dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]);
			}
		}
	}
	long double ans = 0;
	for (int i = N / 2 + 1; i <= N; i++) {
		ans += dp[N][i];
	}
	cout << fixed<<setprecision(20)<<ans << endl;
	return 0;
}

Measured memory_bytes: 85588
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pa;

int const veci[4]={0,-1,0,1};
int const vecj[4]={-1,0,1,0};
int N;
int P[250000];
int G[500][500];
int S[500][500];

int main(){
    cin>>N;
    rep(i,N*N) cin>>P[i];
    rep(i,N){
        rep(j,N){
            G[i][j]=min(min(i,j),min(N-i-1,N-j-1));
        }
    }
    rep(i,N) fill(S[i],S[i]+N,1);
    //rep(i,N){rep(j,N){cout<<G[i][j];}cout<<endl;}cout<<endl;

    int ans=0;
    rep(i,N*N){
        int i1=(P[i]-1)/N;
        int j1=(P[i]-1)%N;
        ans+=G[i1][j1];
        //cout<<"P="<<P[i]<<" ans="<<ans<<endl;
        S[i1][j1]=0;

        queue<Pa> que;
        que.push(Pa(i1,j1));
        while(!que.empty()){
            Pa p=que.front(); que.pop();
            //cout<<"i="<<p.first<<", j="<<p.second<<endl;
            rep(k,4){
                int i2=p.first+veci[k];
                int j2=p.second+vecj[k];
                if(0<=i2 && i2<N && 0<=j2 && j2<N){
                    if(S[p.first][p.second]==0 && G[p.first][p.second]<G[i2][j2]){
                        G[i2][j2]=G[p.first][p.second];
                        que.push(Pa(i2,j2));
                    }
                    if(S[p.first][p.second]==1 && G[p.first][p.second]+1<G[i2][j2]){
                        G[i2][j2]=G[p.first][p.second]+1;
                        que.push(Pa(i2,j2));
                    }
                }
            }     
        }
        //rep(x,N){rep(y,N){cout<<G[x][y];}cout<<endl;}cout<<endl;
        //rep(x,N){rep(y,N){cout<<S[x][y];}cout<<endl;}cout<<'\n'<<endl;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 6508
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(ll i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}
template<class T>istream&operator>(istream&i,T&t){return i>>t;}
#ifndef LOCAL
struct ostdmy{
template<class T>ostdmy&operator<<(const T&t){return*this;}
template<class T>ostdmy&operator<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int N;
    cin>N;
    REP(h,1,3501){
        REP(n,h,3501){
            if(4*h*n-N*n-N*h<=0)continue;
            if((N*h*n)%(4*h*n-N*n-N*h)==0){
                cout<<h<<' '<<n<<' '<<(N*h*n)/(4*h*n-N*n-N*h)<<endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
//---->JUST FOCUS ON YOUR GOAL
//-->BY UNBEATABLE BALORIA
//-->NEVER GIVE UP EVERYTHING IS POSSIBLE
//---------------------------------------------------------------------------------------------------//
#include <bits/stdc++.h>
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<string>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#define endl "\n"
#define pb push_back
#define fi first
#define se second
#define pi 3.14159265358979323846
using namespace std;
//---------------------------------------------------------------------------------------------------//
typedef long long ll;
const unsigned int M = 1000000007;
//---------------------------------------------------------------------------------------------------//
bool isPrime(int n)
{
  for(int i=2;i*i<=n;i++)
    if(n%i==0) return false;
  return true;
}
int main(){
  ios::sync_with_stdio(false); 
  cin.tie(0);
  cout.tie(0);
     int a;
     cin>>a;
     cout<<a+(a*a)+(a*a*a)<<endl;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		string[] b = Input();
		int n = int.Parse(b[0]);
		int l = int.Parse(b[1]);
		int[] azi = new int[n];
		int minAzi = 9999999;
		int minIndex = 9999999;
		int souwa = 0;
		for(int i = 0; i < n; i++)
		{
			azi[i] = l + (i+1) -1;
			if(Math.Abs(azi[i])<Math.Abs(minAzi))
			{
				minIndex = i;
				minAzi = azi[i];
			}
			souwa += azi[i];
		}
		
		souwa-=minAzi;
		Console.WriteLine(souwa);
	}

	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}



Measured memory_bytes: 13140
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


s = IS()
P(min(s[::2].count('1')+s[1::2].count('0'), s[::2].count('0')+s[1::2].count('1')))


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

int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  for (int i=0 ; i<h ; i++){
    for (int j=0 ; j<w ; j++)
      cin >> a.at(i).at(j);
  }
  
  for (int i=0 ; i<h ; i++){
    int white = 0;
    for (int j=0 ; j<w ; j++){
      if (a.at(i).at(j) == '.')
        white++;
      else
        break;
    }
    if (white == w){
      a.erase(a.begin() + i);
      h--;
      i--;
    }
  }
  
  for (int i=0 ; i<w ; i++){
    int white = 0;
    for (int j=0 ; j<h ; j++){
      if (a.at(j).at(i) == '.')
        white++;
      else
        break;
    }
    if (white == h){
      for (int j=0 ; j<h ; j++)
        a.at(j).erase(a.at(j).begin() + i);
      w--;
      i--;
    }
  }
  
  w = a.at(0).size();
  
  for (int i=0 ; i<h ; i++){
    for (int j=0 ; j<w ; j++)
      cout << a.at(i).at(j);
    cout << endl;
  }
}

Measured memory_bytes: 3612
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

X = int(input())
if X >= 30:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Measured memory_bytes: 10828
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef unsigned long long ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(ll i=(a);i>(b);i--)
#define F first
#define S second
using namespace std;
const ll INF = 1e12;
const double PI = 3.1415926535897932;
const int i_INF = 2147483647;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
	double a, b, x;
	cin >> a >> b >> x;
	long double v = a * a * b;
	if (x <= (v / 2)) {
		double y = (2 * x) / (a * b);
		double tu = PI / 2;
		double td = 0;
		double tm = (tu + td) / 2;
		rep(i, 0, 10000) {
			tm = (tu + td) / 2;
			if (tan(tm) > (b / y)) {
				tu = tm;
			}
			else {
				td = tm;
			}
		}
		printf("%.11f\n", (tm) * 180 / (PI));
	}

	else {

		double y = (2 * x / (a * a) - b);
		double xx = (a * y) / (b - y);
		double tu = PI / 2;
		double td = 0;
		double tm = (tu + td) / 2;
		rep(i, 0, 10000) {
			tm = (tu + td) / 2;
			if (tan(tm) > (a / (b-y))) {
				tu = tm;
			}
			else {
				td = tm;
			}
		}
		printf("%.11f\n", (90 - (tm) * 180 / (PI)));
	}
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Combination{
	constexpr static int atcoder_mod = 1000000007;
	vector<ll> fac,finv,inv;
public:
	Combination(ll N){
		fac.resize(N+1);
		finv.resize(N+1);
		inv.resize(N+1);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i=2;i<=N;i++){
			fac[i] = fac[i-1] * i % atcoder_mod;
			inv[i] = atcoder_mod - inv[atcoder_mod%i] * (atcoder_mod/i) % atcoder_mod;
			finv[i] = finv[i-1] * inv[i] % atcoder_mod;
		}
	}
	ll Caluclation(ll n,ll r){
		if(n < r) return 0;
		if (n < 0 || r < 0) return 0;
		return fac[n] * (finv[r] * finv[n-r] % atcoder_mod) % atcoder_mod;
	}
	ll GetFInv(ll i){
		return finv[i];
	}
};

ll safemod(ll a,ll m){
	return (a%m+m)%m;
}

ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}

ll extend_gcd(ll a,ll b,ll &x,ll &y){
	if(b==0){
		x = 1;
		y = 0;
		return a;
	}
	ll d = extend_gcd(b,a%b,y,x);
	y -= a/b * x;
	return d;
}

ll modinv(ll a,ll m){
	ll x,y;
	extend_gcd(a,m,x,y);
	return safemod(x,m);
}

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

	int N=in(),A=in(),B=in();

	ll T = powermod(2,N,atcoder_mod);
	T = safemod(T-1LL,atcoder_mod);
	ll NA = 1,NB = 1;
	for(ll i=0;i<A;i++){
		NA *= ll(N)-i;
		NA %= atcoder_mod;
		NB *= i+1LL;
		NB %= atcoder_mod;
	}
	ll NAI = modinv(NB,atcoder_mod);
	T = safemod(T-(NA*NAI)%atcoder_mod,atcoder_mod);

	NA = 1,NB = 1;
	for(ll i=0;i<B;i++){
		NA *= ll(N)-i;
		NA %= atcoder_mod;
		NB *= i+1LL;
		NB %= atcoder_mod;
	}
	NAI = modinv(NB,atcoder_mod);
	T = safemod(T-(NA*NAI)%atcoder_mod,atcoder_mod);
	
	out(T);
	return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    string s, fr;
    cin >> s;
    int q;
    cin >> q;
    bool rev = false;
    rep(i, q) {
        int t;
        cin >> t;
        if (t == 1) rev = !rev;
        else {
            int f;
            char c;
            cin >> f >> c;
            if (rev) f = 3 - f;
            if (f == 1) fr.pb(c);
            else s.pb(c);
        }
    }
    reverse(all(fr));
    string ans = fr + s;
    if (rev) reverse(all(ans));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3988
# DP(貰うDP)
N = int(input())
h = list(map(int, input().split()))

dp = [0] * N
dp[1] = dp[0] + abs(h[1] - h[0])
for i in range(2, N):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
                dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[N - 1])


Measured memory_bytes: 13928
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

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

	// 親⇔子(双方向)リストのマップ
	unordered_map<int, vector<int>> pMap;

	// 値のマップ
	int value[N+1] = {};
	int counter[N+1] = {};

	int a, b, p, x;
	REP(idx, N-1) {
		cin >> a >> b;
		// 双方向に入れる
		pMap[a].push_back(b);
		pMap[b].push_back(a);
	}
	REP(idx, Q) {
		cin >> p >> x;
		counter[p] += x;
	}

	// 処理するノード、親の1をスタート
	int nodes[N];
	nodes[0] = 1;
	// 親フラグ、falseで初期化
	bool parentFlg[N+1];
	FOR(idx, 1, N) {
		parentFlg[idx] = false;
	}

	int node;
	int pos = 0;
	int tailpos = 1;

	while(true) {
		node = nodes[pos++];
		// 親フラグ立てる
		parentFlg[node] = true;

		// 自身のカウンターを足す
		value[node] += counter[node];
		// 子を取得
		if (pMap[node].size() > 0) {
			// 子に親の合計を足す
			REP(idx, ((int) pMap[node].size())) {
				if (!parentFlg[pMap[node][idx]]) {
					// 親として処理済みでないもののみ足す
					value[pMap[node][idx]] += value[node];
					nodes[tailpos++] = pMap[node][idx];
				}
			}
		}

		if (pos >= N) {
			break;
		}

	}

	FOR(idx, 1, N+1) {
		cout << value[idx] << " ";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 23100
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    ll ans = 0;
    ll n;
    cin >> n;
    rep(a, 1, n + 1)
    {
        ll b = 1;
        while (a * b < n)
        {
            ans++; //= n - a * b;
            b++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main() 
{
  lli n;
  cin>>n;
  lli temp=n-1;
  for(int i=2; i<=sqrt(n); i++)
  {
    if(n%i==0)
    {
      lli c=0;
      c=n/i;
      if(temp>i+c-2)
      {
        temp=i+c-2;
      }
    }
  }
  cout<<temp;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()

    return n * (n+1) // 2;

print(main())





Measured memory_bytes: 6724
#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 vector<int> vi;
typedef pair<int, int> pii;

template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 

const int MXN = 2e5 + 5;
//const int MXN = 1e6 + 5;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;

int N, dp[MXN], h[MXN], K;


int main(){ FAST
	//ifstream cin("/Users/konwoo/input.txt");
	//ofstream cout("/Users/konwoo/output.txt");

    cin >> N >> K;
    F0R(i,N) cin >> h[i+1];
    FOR(i,2,N+1){
        dp[i] = INF;
        for (int j = max(i-K,1); j <= i-1; j++){
            dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout << dp[N] << newl;






	return 0;
}


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

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

void solve(std::string S){
    bool is = true;
    if(S[2] != S[3]){
        is = false;
    }
    if(S[4] != S[5]){
        is = false;
    }
    if(is){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>
#include <map>

using namespace std;

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

	int N;
	cin >> N;

	vector<long long> A(N, 0);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	map<long long, int> count;
	for (int i = 0; i < N; i++)
	{
		count[i + A[i]]++;
	}

	long long result = 0;
	for (int i = 0; i < N; i++)
	{
		long long val = i - A[i];
		if (count.find(val) != count.end())
		{
			result += count[val];
		}
	}

	cout << result;

	return 0;
}


Measured memory_bytes: 17152
/*
このコード、と～おれ!
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {

	int n, m;
	scanf("%d%d", &n, &m);
	vector<pair<int, int>> students(n), checkpoint(m), distance(m);
	rep(i, n)scanf("%d%d", &students[i].first, &students[i].second);
	rep(i, m)scanf("%d%d", &checkpoint[i].first, &checkpoint[i].second);
	rep(i, n) {//距離を求める
		rep(j, m) {
			distance[j].first = fabs(students[i].first - checkpoint[j].first) + fabs(students[i].second - checkpoint[j].second);
			distance[j].second = j + 1;
		}
		sort(all(distance));
		printf("%d\n", distance[0].second);
	}

	//vector(pair)をソート。番号を二個目にして出力

	return 0;
}


Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include<string>
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long LL;
typedef double db;
using namespace std;
template<typename T>void read(T &x) {
    char ch=getchar(); x=0; T f=1;
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') f=-1,ch=getchar();
    for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0'; x*=f;
}
string a,b;
int main(){
	int a1,a2,a3;
    read(a1);read(a2);read(a3);
    if(a2-a1==a3-a2)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {

	int a;	
	cin >> a;
	cout << a * a * a + a * a + a << endl;
}

Measured memory_bytes: 3668
import java.io.*;
import java.util.Arrays;

public class Main{
	
	public static void main(String[] argv) throws NumberFormatException, IOException{
		int[] array = new int[1000000];
		Arrays.fill(array, 1);
		for(int i=2; i<(int)(999999/2+1); i++){
			if(array[i] != 1)continue;
			for(int j=2; i*j<=999999; j++){
				array[i*j] = 0;
			}
		}
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		while((line = br.readLine()) != null){
			int n = Integer.parseInt(line);
			int num = 0;
			for(int i=2; i<=n; i++){
				if(array[i] == 1)num++;
			}
			System.out.print(Integer.toString(num)+"\n");
		}
	}
}

Measured memory_bytes: 24004
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define printll(a) printf("%lld\n", a)
#define printdbl(a) printf("%lf\n", a)
#define printYes() printf("Yes\n")
#define printNo() printf("No\n")
#define scanll(a) scanf("%lld", &a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scan4Int(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
typedef long long ll;
const int INF = 1001001001;
using namespace std;
void swap(int *a, int *b) {
    int tmp = *a;
    *a = *b;
    *b = tmp;
    return;
}
int gdc(int a, int b) {
    int r;
    if (a < b)
        swap(&a, &b);
    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    int l;
    scanInt(l);
    double tmp = (double) l / 3.0;
    printf("%.8lf\n", pow(tmp, 3));
    return 0;
}

Measured memory_bytes: 4224