akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
    bool flag = true;
    string S;
    cin >> n;
    cin >> S;
    if(n%2 != 0){
        cout << "No" << endl;
        return 0;
    }
    for(int i=0;i<n/2;i++){
        if(S[i]!=S[n/2+i]){
            flag=false;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n ; 
    cin >> n ;

    int a[n] ;
    for(int i = 0 ; i < n ; i++ ){
        cin >> a[i] ;
    }
    sort(a , a+n) ;
    long long int ans = 10000000 ;
    int tempans  = 0 ;
    for(int k = 1 ; k <= 100 ; k++ ){
        for(int j = 0 ; j < n ; j++){
           tempans += ( k - a[j]) * (k - a[j]) ; 
        }
        if(tempans <= ans){
            ans = tempans ;
        }
        tempans = 0 ;
    }

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

Measured memory_bytes: 256
# include<iostream>
# include<cstring>
# include<cstdio>
# include<cmath>
# define LL long long
using namespace std;
const int MAX=5e5+1;
const LL mod=998244353;
LL n,a,b,k;
LL fac[MAX],inv[MAX];
/*LL pow(LL a,LL b)
{
	LL ans=1;
	for(;b;b>>=1,a=a*a%mod)
	  if(b&1) ans=ans*a%mod;
	return ans;
}
LL Csmall(int a,int b)
{
	return a>b?0:fac[b]*pow(fac[a],mod-2)%mod*pow(fac[b-a],mod-2)%mod;
}
LL C(int a,int b)
{
	if(a>b) return 0;
	if(!b) return 1;
	return C(a/mod,b/mod)%mod*Csmall(a%mod,b%mod)%mod;
}*/
LL exgcd(LL a,LL b,LL &x,LL &y)
{
	if(!b) return x=1,y=0,a;
	LL ans=exgcd(b,a%b,x,y),tt=x;
	return x=y,y=tt-a/b*y,ans;
}
LL cal(LL a,LL b)
{
	LL x,y,dis=exgcd(a,b,x,y),ans=(x/dis)%(b/dis);
	if(ans<=0) ans+=b;
	return ans;
}
LL C(LL a,LL b)
{
	return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
void work()
{
	fac[0]=1;
	for(int i=1;i<=n;++i)
	  fac[i]=fac[i-1]*i%mod;
	inv[n]=cal(fac[n],mod);
	for(int i=n-1;i>=0;--i)
	  inv[i]=(inv[i+1]*(i+1))%mod;
}
LL read()
{
	LL x=0;
	char ch=getchar();
	for(;!isdigit(ch);ch=getchar());
	for(;isdigit(ch);x=x*10+ch-48,ch=getchar());
	return x;
}
int main()
{
	LL ans=0;
	n=read(),a=read(),b=read(),k=read();
	LL x,y,gcd=exgcd(a,b,x,y),dx=a*b/gcd/a,dy=a*b/gcd/b;
	x*=k/gcd,y*=k/gcd;
	if(x<y) swap(a,b),swap(x,y),swap(dx,dy);
	if(y<0)
	{
        LL d=(-y+dy-1)/dy;
        y+=dy*d,x-=dx*d;
    }
    if(x>n)
	{
        LL d=(x-n+dx-1)/dx;
        x-=dx*d,y+=dy*d;
    }
    work();
	while(x>=0&&y<=n)
	ans=(ans+C(n,x)*C(n,y)%mod)%mod,x-=dx,y+=dy;
	printf("%lld",ans);
	return 0;
}

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

#define ll long long
#define ld long double
#define pi 3.14159265359

int main(){
    double A, B, H, M; cin >> A >> B >> H >> M;
    double wh = 2 * pi / 12, wm = 2 * pi / 60;
    wh *= H + (M / 60), wm *= M;
    double rad = max(wh, wm) - min(wh, wm);
    double c = pow(pow(A, 2) + pow(B, 2) - 2 * A * B * cos(rad), 0.5);
    cout << fixed << setprecision(10);
    cout << c << endl;
}


Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;
 
int main() {
   
int N;
vector<long long> A(1000001);
vector<long long> B;
cin>>N;
fx(N){
cin>>A.at(x+1);	
}
 
int k=N;
 
while(k>1){
cout<<A.at(k);
cout<<" ";
k-=2;
}
k=1;
while(k<N-1){
cout<<A.at(k);
cout<<" ";
if(N%2==1&&k==1){
k+=1;
}else{
k+=2;
}
}
 
if(N==1){
cout<<A.at(N);
}else{
cout<<A.at(N-1);
}
}

Measured memory_bytes: 9984
h, w = map(int, input().strip().split())
s = []

for _ in range(h):
    temp = input()
    s.append(temp)


def func(height, width, string):
    for i in range(height):
        for j in range(width):
            count = 0
            if string[i][j] == '.':
                if i != 0:
                    if j != 0:
                        if string[i-1][j-1] == '#':
                            count += 1
                    if string[i-1][j] == '#':
                        count += 1
                    if j != width - 1:
                        if string[i-1][j+1] == '#':
                            count += 1
                if j != 0:
                    if string[i][j-1] == '#':
                        count += 1
                if j != width - 1:
                    if string[i][j+1] == '#':
                        count += 1
                if i != height - 1:
                    if j != 0:
                        if string[i+1][j-1] == '#':
                            count += 1
                    if string[i+1][j] == '#':
                        count += 1
                    if j != width - 1:
                        if string[i+1][j+1] == '#':
                            count += 1
                if j < width:
                    s[i] = s[i][:j] + str(count) + s[i][j+1:]
                else:
                    s[i] = s[i][:j] + str(count)

    for i in range(height):
        print(string[i])


func(height=h, width=w, string=s)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














ll H, W;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> H >> W;

	if (H == 1 or W == 1) {
		cout << 1 << endl;
		return;
	}

	ll ans = H * W / 2;
	if ((H * W) % 2 == 1) ans++;

	cout << ans << endl;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,a,b,c,d;
  cin >> N;
  a = N/1000;
  b = N%1000/100;
  c = N%100/10;
  d = N%10;
  if((a==b&&b==c)||(b==c&&c==d)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int A, B;
    cin >> A >> B;
    if (A + B >= 10) cout << "error" << endl;
    else cout << A + B << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2020;
int n,q,a,b,c,d,k;
bool check(int x){
    if(!x)return 1;
    if(x%(k+1)==0)return check(x-1);
    int bb=x/(k+1),rb=b-bb,ra=a-(x-bb);
    return 1ll*(ra+1)*k>=rb;
}
void solve(){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    k=max((a+b)/(b+1),(a+b)/(a+1));
    int l=0,r=a+b,ans=0;
    while(l<=r){
        int mid=(l+r)>>1;
        if(check(mid))ans=mid,l=mid+1;
        else r=mid-1;
    }
    for(int i=c;i<=d;i++)
        if(i<=ans)putchar(i%(k+1)?'A':'B');
        else putchar((a+b-i+1)%(k+1)?'B':'A');
    puts("");
}
int main(){
    scanf("%d",&q);
    while(q--)solve();
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

#define REP(i,m,M) for(int i=m; i<M; i++)
#define REPR(i,M,m) for(int i=M; i>m; i—-)
#define REPLL(i,m,M) for(ll i=m; i<M; i++)
#define REPLLR(i,M,m) for(ll i=M; i>m; i—-)
#define ALL(v) v.begin(),v.end()

ll cnst[100002];
ll lin[100002];

int main(int argc, const char * argv[]) {
    int n, m;
    cin >> n >> m;
    int s, t;
    cin >> s;
    REP(i,0,n-1){
        cin >> t;
        
        if(t>s){
            cnst[1] += t-s;
            cnst[s+1] += s+1;
            cnst[t+1] += -1-s;
            lin[s+1] -= 1;
            lin[t+1] += 1;
        }else{
            cnst[1] += 1+t;
            cnst[t+1] += m-s-1;
            cnst[s+1] += 1+s;
            lin[1] += -1;
            lin[t+1] += 1;
            lin[s+1] += -1;
        }
        
        s = t;
    }
    
    ll nowCnst = cnst[1], nowLin = lin[1];
    ll ans = nowCnst+nowLin;
    //cerr << ans << endl;
    REP(i,2,m+1){
        nowCnst += cnst[i];
        nowLin += lin[i];
        ll tmp = nowCnst+i*nowLin;
        //cerr << tmp << endl;
        if(tmp<ans) ans = tmp;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
def solve(X):
    ans = 1
    p = 2
    while True:
        b = int((X ** (1/p)))
        if (b+1) ** p <= X:
            ans = max(ans, (b+1) ** p)
        elif b == 1:
            break
        elif b ** p <= X:
            ans = max(ans, b ** p)
        p += 1
    return ans

X = int(input())
print(solve(X))
#for X in range(1,1011):
#    print(X, solve(X))


Measured memory_bytes: 38256
#include <stdio.h>
#include <ctype.h>

int main(void)
{
    char ch;

    while(1){
        scanf("%c", &ch);

        if(islower(ch)){
            printf("%c", toupper(ch));
        }else if(isupper(ch)){
            printf("%c", tolower(ch));
        }else{
            printf("%c", ch);
        }

        if(ch == '\n'){
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 2140
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    int a, p;
    cin >> a >> p;
    cout << (a * 3 + p) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n-1):
    if a[i] + a[i+1] > x:
        y = a[i] + a[i+1] - x
        count += y
        a[i+1] = max(0, a[i+1]-y)
print(count)

Measured memory_bytes: 19992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

int main()
{
    double r;
    cin >> r;
    double pi = 3.141592653589;
    double s = pi * r * r;
    double l = 2 * pi * r;
    cout << fixed << setprecision(10);
    cout << s << " " << l << endl;
}



Measured memory_bytes: 3284
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LLI long long int
#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 YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define fcout cout<<fixed<<setprecision(10)
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
	int n,k; cin>>n>>k;
	FOR(i,0,n){
		int a; cin>>a;
	}
	cout<<(n+k-3)/(k-1)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[10000];
long long sum1=1,sum2=1;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		sum1*=3;
		if(a[i]&1)sum2*=1;
		else sum2*=2;
	}
	printf("%lld",sum1-sum2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
ll L, N;
vector<ll> X, Sum;
ll ans;

void solve() {
    Sum[0] = 0;
    for(int i = 0; i < N; i++) {
        Sum[i+1] = Sum[i] + X[i];
    }
    for(int i = 0; i < N; i++) {
        ll rest = N - i;
        ll now = 0;
        if(rest % 2 == 0) {
            ll rnum = rest / 2;
            now += 2 * (Sum[i+rnum] - Sum[i]);
            ll lnum = rest / 2 - 1;
            now += 2 * (L * lnum - (Sum[N] - Sum[N-lnum]));
            now += L - X[N-lnum-1];
            //cerr << i << " " << rest << " " << rnum << " " << lnum << " " << now << endl;
            chmax(ans, now);
        } else {
            ll rnum = rest / 2;
            now += 2 * (Sum[i+rnum] - Sum[i]);
            now += X[i+rnum];
            ll lnum = rest / 2;
            now += 2 * (L * lnum - (Sum[N] - Sum[N-lnum]));
            chmax(ans, now);
        }
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> L >> N;
    X.resize(N);
    Sum.resize(N+1);
    for(int i = 0; i < N; i++) cin >> X[i];
    solve();
    for(int i = 0; i < N; i++) {
        X[i] = L - X[i];
    }
    reverse(X.begin(), X.end());
    solve();
    cout << ans << endl;
    return 0;
}

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




int main(){
  int n;
  cin>>n;
  vector<string> s;
  for(int i=0;i<n;i++){
    string a;
    cin>>a;
    s.push_back(a);
  }
  for(int i=s.size()-1;i>=0;i-=2){
    cout << s.at(i)<< " ";
  }
  int k;
  if(n%2==0){
    k=0;
  }
  else{
    k=1;
  }
  for(int j=k;j<s.size();j+=2){
    cout << s.at(j)<< " ";
  }
}

Measured memory_bytes: 15984
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+14;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};


int main(){
    ll N,D,A;
    cin>>N>>D>>A;
    vector<pair<ll,ll>> XH(N+1);
    vector<ll> L(N+1);
    BIT<ll> bit(N+10);
    XH[0]=make_pair(-INF,0);
    REP(i,N){
        ll x,h;
        cin>>x>>h;
        x-=D;
        if(h%A!=0){
            h=h/A+1;
        }else{
            h=h/A;
        }
        
        XH[i+1]=make_pair(x,h);
    }
    sort(ALL(XH));
    REP2(i,1,N+1){
        bit.add(i,i+1,XH[i].second);
        L[i]=XH[i].first;
    }
    L[0]=-INF;
    ll cnt=0;
    REP2(i,1,N+1){
        if(bit.sum(i,i+1)<=0) continue;
        ll down=bit.sum(i,i+1);
        cnt+=down;
        int l=i;
        int r=upper_bound(ALL(L),L[i]+2*D)-L.begin();
        bit.add(l,r,-down);
    }
    cout<<cnt<<endl;


    
}

Measured memory_bytes: 11180
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 2e5 + 5;
int n, p[N], dep[N], mxDep[N];
vector<int> g[N];
void add(int &x, int y) {
	x += y; if (x >= mod) x -= mod;
}
void rem(int &x, int y) {
	x -= y;
	if (x < 0) x += mod;
}
int mul(int x, int y) {
	return 1ll * x * y % mod;
}
int fpow(int a, int p) {
	if (!p) return 1;
	int tmp = fpow(a, p >> 1);
	tmp = mul(tmp, tmp);
	if (p & 1) tmp = mul(tmp, a);
	return tmp;
}
int inv(int a) {
	return fpow(a, mod - 2);
}
struct State {
	int a[3];
	//Save state of 2 balls because balls aren't removed until all are pushed up.
	State(int a0 = 1, int a1 = 0, int a2 = 0) {
		a[0] = a0, a[1] = a1, a[2] = a2;
	}
	State operator+(const State &rhs) const {
		State ans = State(0, 0, 0);
		fw (i, 0, 3) fw (j, 0, 3) {
			add(ans.a[min(i + j, 2)], mul(a[i], rhs.a[j]));
		}
		return ans;
	}
	void debug() {
		cout << a[0] << " " << a[1] << " " << a[2];
	}
};
void dfs(int u) {
	mxDep[u] = dep[u];
	fa (v, g[u]) {
		dep[v] = dep[u] + 1;
		dfs(v);
		mxDep[u] = max(mxDep[u], mxDep[v]);
	}
}
map<int, State> dp[N];
void solve(int u) {
	//dp[u][i]: Probability for vertex u to have 0 or 1 ball, placing all balls at depth i.
	fa (v, g[u]) solve(v);
	int bigChild = -1, secondBig = -1;
	fa (v, g[u]) {
		if (bigChild == -1 || dp[v].size() > dp[bigChild].size()) bigChild = v;
	}
	fa (v, g[u]) if (v != bigChild) {
		if (secondBig == -1 || dp[v].size() > dp[secondBig].size()) secondBig = v;
	}
	dp[u][dep[u]] = State(inv(2), inv(2), 0);
	if (bigChild == -1) return;
	dp[u].swap(dp[bigChild]);
	fa (v, g[u]) {
		if (dp[v].size() > dp[u].size()) dp[u].swap(dp[v]);
		fa (tmp, dp[v]) {
			int depID = tmp.fi;
			State val = tmp.se;
			dp[u][depID] = dp[u][depID] + val;
		}
	}
	int secondMaxDep = -1;
	if (secondBig != -1) secondMaxDep = mxDep[secondBig];
	if (secondMaxDep != -1) {
		fw (depID, dep[u] + 1, secondMaxDep + 1) {
			add(dp[u][depID].a[0], dp[u][depID].a[2]);
			dp[u][depID].a[2] = 0;
		}
	}
//	fa (tmp, dp[u]) {
//		int depID = tmp.fi;
//		add(dp[u][depID].a[0], dp[u][depID].a[2]);
//		dp[u][depID].a[2] = 0;
//	}
}
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	fw (i, 1, n + 1) {
		cin >> p[i];
		g[p[i]].pb(i);
	}
	dep[0] = 0;
	dfs(0);
	solve(0);
	int ans = 0, twoPowerN = fpow(2, n + 1);
	fa (tmp, dp[0]) {
		int depID = tmp.fi;
		State val = tmp.se;
		add(ans, mul(val.a[1], twoPowerN));
//		cout << "depth " << depID << " cnt = " << val.a[1] << "\n";
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 94848
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
// #MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(int argc, char const *argv[]) {
  int n, x, y;
  std::cin >> n >> x >> y;
  std::vector<int> ans(n,0);

  FOR(i,1,n-1) {
    FOR(j,i+1,n) {
      ans[min(j - i, min(abs(x - i) + abs(y - j) + 1, abs(y-i) + 1 + abs(x-j)))]++;
    }
  }

  FOR(i,1,n-1) std::cout << ans[i] << '\n';

  return 0;
}


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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n;cin>>n;
  if(n<=999)printf("ABC\n", n);
  else printf("ABD\n", n);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);

    while (b > 0) {
        ll x = a, y = b;
        a = y;
        b = x % y;
    }
    return a;
}

int main()
{
    ll k; cin >> k;
    ll s = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                s += gcd(gcd(a, b), c);
            }
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> H(n);
  for(int i = 0; i<n; i++){
    cin >> H[i];
  }
  int ans = 0;
  for(int i = 0; i<n; i++){
    bool flag = true;
    for(int j = 0; j<=i; j++){
      if(H[i]<H[j])flag = false;
    }
    if(flag) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Majk
 */

#include <vector>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
using namespace std;

#define x first
#define y second
constexpr int MOD = 1000000007;

typedef std::pair<int,int> pii;
typedef long long ll;

template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

namespace std {
    template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}};
}
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

// #include "../l/mod.h"

class C {
public:
	void solve(istream& cin, ostream& cout) {
		int N; cin >> N;
		int B; cin >> B;
		ll A[3] = {B, -1000000000000000LL, -1000000000000000LL};
		for (int i = 0; i < N-1; ++i) {
			char c; cin >> c;
			cin >> B;

			if (c == '+') {
				A[0] = max(A[0], max(A[1], A[2])) + B;
				A[1] = A[1] - B;
				A[2] = A[2] + B;
			} else {
				A[2] = max(A[1], A[2]) + B;
				A[1] = max(A[1], A[0]) - B;
				A[0] = A[0] - B;
			}
		}

		cout << max(A[0], max(A[1], A[2])) << endl;
	}
};


int main() {
	ios_base::sync_with_stdio(false);
	C solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import math

X = int(input())


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


while True:
    if is_prime(X):
        print(X)
        break
    else:
        X = X + 1


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;

    if (a != 1 && b != 1) {
        cout << 1 << endl;
    } else if (a != 2 && b != 2) {
        cout << 2 << endl;
    } else if (a != 3 && b != 3) {
        cout << 3 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
signed main(){
	int a=0,b=0,memoa;
	string s;
	cin>>s;
	rep(i,s.size()){
		if(s[i]=='C'){
			a=1;
			memoa=i;
		}
	}
	if(!a){
		puts("No");
		return 0;
	}
	for(int i=memoa;i<s.size();i++){
		if(s[i]=='F'){
			b=1;
		}
	}
	if(!b)puts("No");
	else puts("Yes");
}
		
		


Measured memory_bytes: 256
# B - Five Dishes

menu = []
for i in range(5):
    menu.append(int(input()))

roundtime = []
difftime = []
for i in range(5):
    roundtime.append(((menu[i]+9)//10)*10)
    difftime.append(roundtime[i]-menu[i])

print(sum(roundtime)-max(difftime))

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
char str[50];
int main()
{
	int a,b,c;
	while(cin>>a>>b>>c)
	{
		if(a==b+c||b==a+c||c==a+b)
		printf("Yes\n");
		else
		printf("No\n");
	}
return 0;
}

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

int main () {
  int n, l;
  cin >> n >> l;
  vector<string> v;
  for (int i = 0;i < n; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  string ans;
  for (int i = 0; i < n;i++) {
    ans = ans + v[i];
  }
  cout << ans << "\n";  
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g,ko;
    ll x,y,w;
    char hoge,fuga;
    cin>>a>>b>>c;
    if(b-a==c-b) YES;
    else NO;

    return 0;
}


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

int main(){
	vector<long long> a(3-1+1);
	vector<long long> b(3-1+1);
	for(int i = 0 ; i <= 3-1 ; i++){
		scanf("%lld",&a[i]);
		scanf("%lld",&b[i]);
	}
	long long one = 0, two = 0;
	for(long long i = 1 ; i <= 4 ; i++){
		long long cur = 0;
		for (long long j = 0; j <= 2 ; j++) {
			if (a[j] == i) cur++;
		}
		for (long long j = 0; j <= 2 ; j++) {
			if (b[j] == i) cur++;
		}
		if (cur == 1) one++;
		if (cur == 2) two++;
	}
	if (one == 2 && two == 2) printf("YES\n"); else printf("NO\n");
	return 0;
}


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

int main()
{
    int N = 0;
    cin >> N;
    int L[N]{};
    int maxVal = 0;
    int sum = 0;

    for(int i = 0; i < N; i++)
    {
        cin >> L[i];
        maxVal = maxVal < L[i] ? L[i] : maxVal;
        sum += L[i];
    }

    if(maxVal < sum - maxVal)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl; 
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(INF)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	cout<<fixed<<setprecision(10);
	vector<double> v(n);
	for(auto &i:v) cin>>i;
	sort(all(v));
	double ans=(v[0]+v[1])/2.0;
	For(i,2,n-1) ans=(ans+v[i])/2.0;
	cout<<ans<<"\n";
	return 0;
}




























Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int h[1000000];
	cin >> h[0];
	int i = 0;
	bool a = false;
	while (true) {
		if (h[i] % 2 == 0) h[i + 1] = h[i] / 2;
		else h[i + 1] = h[i] * 3 + 1;
		i++;
		for (int j = 0; j < i; j++) {
			if (h[j] == h[i]) a = true;
		}
		if (a == true) break;
	}
	cout << i + 1 << endl;
	return 0;

}


Measured memory_bytes: 256
K = 10 ** 9 + 7

def pow_K(x, n):
  if n == 0:
    return 1
  else:
    return (pow_K(x, n // 2) ** 2 * x ** (n % 2)) % K

H, W, A, B = map(int, input().split())

fact = [0 for i in range(H+W-1)]
fact[0] = 1
for i in range(H+W-2):
  fact[i + 1] = fact[i] * (i+1) % K
fact_inv = [0 for i in range(H+W-1)]
fact_inv[H+W-2] = pow_K(fact[H+W-2], K-2)
for i in range(H+W-2, 0, -1):
  fact_inv[i-1] = fact_inv[i] * i % K

r = 0
for i in range(B, W):
  r += ((fact[H-A-1+i] * fact_inv[H-A-1] %K)*fact_inv[i] % K) * ((fact[W-1-i+A-1] * fact_inv[W-1-i] %K) * fact_inv[A-1] % K) %K
  r %= K

print(r)




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

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

    int n;
    cin >> n;
    int total_count = 0;
    for (int i = 105; i <= n; i += 2) {
        int count = 0;
        for (int j = 1; j <= i; j += 2) {
            count += (i % j == 0);
        }
        total_count += (count == 8);
    }

    cout << total_count << '\n';
    return 0;
}


Measured memory_bytes: 256
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

max_x = max(x)
min_y = min(y)

if (max_x < min_y) and (X < max_x+1 <= Y):
    print('No War')
else:
    print('War')

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

int main(){
    int N,K,i=0;

    cin >> N >> K;
    

        int count=0;
    for(int j=0;j<N;j++){
        int h;
        cin >> h;
        if(h>=K)count++;
    }

    cout << count;
    return 0;
}

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

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}

int n;

int main() {
	cin >> n;
	for (int i = 31; i <= 55555; i += 5) {
		if (isprime(i) == true) {
			if (i != 31) cout << " ";
			cout << i; n--;
		}
		if (n == 0) break;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c<=32)c=_buff.get();return c;}
ll qpow(ll x,ll k){return k==0?1:1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
const int maxn=511;
int n,a[maxn][maxn],sum;
int mk[maxn][maxn],curmk;
ll ans;
void dfs(int x,int y)
{
	mk[x][y]=curmk;sum+=a[x][y];
	if(!mk[x+1][y]&&a[x+1][y])dfs(x+1,y);
	if(!mk[x][y+1]&&a[x][y+1])dfs(x,y+1);
}
void dfs2(int x,int y)
{
	assert(mk[x][y]>0);
	mk[x][y]=curmk;
	if(a[x+1][y])dfs2(x+1,y);
	else if(a[x][y+1])dfs2(x,y+1);
}
void dfs3(int x,int y)
{
	assert(mk[x][y]!=curmk);
	mk[x][y]=0;sum-=a[x][y];
	if(mk[x][y+1]&&mk[x][y+1]!=curmk&&mk[x-1][y+1]==0)dfs3(x,y+1);
	if(mk[x+1][y])dfs3(x+1,y);
}
void debug()
{
	cerr<<"mk:"<<endl;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			cerr<<mk[i][j]<<" ";
		}
		cerr<<endl;
	}
}
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			char c=getreal();
			if(c!='#')a[i][j]=c-'0';
		}
	}
	for(int i=n;i>=1;i--)
	{
		sum=0;
		memset(mk,0,sizeof(mk));
		int lst=-1;
		for(int j=1;j<=n;j++)
		{
			if(a[i][j])
			{
				if(lst==-1)
				{
					curmk=1;
					dfs(i,j);
					lst=j;
				}
				else
				{
					curmk=j;
					if(!mk[i][j])
					{
						dfs(i,j);
					}
					dfs2(i,j);
					dfs3(i,lst);
					lst=j;
				}
				ll csum=sum;
				ans+=a[i][j]*(sum-a[i][j]);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2432
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//233
	int n,q;
	cin>>n>>q;
	string s;
	cin>>s;
	vector<int> arr;
	REP(i,0,n-2) {
		if(s[i]=='A'&&s[i+1]=='C'){
			arr.PUB(i);
			i++;
		}
	}
	
	while(q--) {
		int l,r;
		cin>>l>>r;
		cout<<upper_bound(arr.begin(),arr.end(),r-2)-lower_bound(arr.begin(),arr.end(),l-1)<<endl;
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int gcd(int a,int b){
  int r=a%b;
  while(r>0){
    a=b;
    b=r;
    r=a%b;
  }
  return b;
}

void run(void){
  int n,x;
  scanf("%d%d",&n,&x);
  int a;
  scanf("%d",&a);
  int g=ABS(x-a);
  int i;
  for(i=1;i<n;i++){
    scanf("%d",&a);
    g=gcd(g,ABS(x-a));
  }
  printf("%d\n",g);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double p = (double) (N - N / 2) / (double) N;
		System.out.println(String.format("%.10f", p));
	}
}

Measured memory_bytes: 21972
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, K = map(int, input().split())
h = list(map(int, input().split()))

ans = 0
for i in range(N):
    if h[i] >= K:
        ans += 1

print(ans)

Measured memory_bytes: 89456
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 100;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
int N, M;
int cnt = 0;
vector<int> usedV(MAX), ord(MAX), lowLink(MAX);
vector<vector<int> > G(MAX, vector<int>()), usedE(MAX, vector<int>(MAX));
/* function */
void dfs(int from) {
    usedV[from] = 1;
    ord[from] = lowLink[from] = cnt++;

    for (int to : G[from]) {
        if (!usedV[to]) {
            // nodeが使われていないならdfs
            usedE[from][to] = 1;
            dfs(to);
            // dfsが戻ってきたらlowlinkの更新
            lowLink[from] = min(lowLink[from], lowLink[to]);
        }
        else if (!usedE[to][from]) {
            // 使われている頂点を訪れようとした場合
            // lowlinkの更新
            lowLink[from] = min(lowLink[from], ord[to]);
        }
    }
    return ;
}
int bridge(vector<pii> edges) {
    int ret = 0;
    int from, to;
    for (pii edge : edges) {
        from = edge.first, to = edge.second;
        if (ord[from] < lowLink[to]) ret++;
        if (ord[to] < lowLink[from]) ret++;
    }
    return ret;
}
/* main */
int main(){
    cin >> N >> M;
    int u, v;
    vector<pii> edges;
    for (int i = 0; i < M; i++) {
        cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
        edges.push_back(pii(u, v));
    }
    dfs(0);
    int ans = bridge(edges);
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int)1e9 + 7;
// constexpr int MOD = 998244353;

int main()
{
    int n;
    cin >> n;
    map<int, long> m1;
    map<int, long> m2;
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        m1[i - a]++;
        m2[i + a]++;
    }
    long ans = 0;
    for (const auto p : m1) {
        ans += p.second * m2[p.first];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 37672
#!/usr/bin/env python
import numpy as np
H, W  = map(int, input().split())
data = [input().split() for _ in range(int(H))]
data_new = np.empty((0, W))
data_ = []
for i in data:
    for h in i[0]:
        data_.append(h)        
data_ = np.array(data_).reshape(H, W)

for i in data_:
    if np.any(i == "#"):
        data_new = np.concatenate([data_new, i.reshape(1, W)])
        
data_ = data_new.T
data_new = np.empty((0, data_.shape[1]))

for i in data_:
    if np.any(i == "#"):
        data_new = np.concatenate([data_new, i.reshape(1, data_.shape[1])])

data_new = data_new.T

for i in data_new:
    i = i.tolist()
    print(''.join(i))


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

int main() {

  vector<int> X(10001);
  int i = 0;
  int stop = 0;
  while (i < 10001 && stop == 0) {
	cin >> X.at(i);
    if(X.at(i) != 0) {
      cout << "Case " << i+1 << ": " << X.at(i) << endl;
    } else {
      stop = 1;
    }
    i++;
  }
  
  return 0;
}


Measured memory_bytes: 3052
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

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

def LI(): return list(map(int, sys.stdin.readline().split()))


"""
S.reverse()
extra = 0
each_extras = [[0 for i in range(10)] for i in range(S.count("?"))]
cnt = 0
for i in range(len(S)):
    if S[i] != "?":
        extra += int(S[i]) * 10 ** i
    else:
        each_extras[cnt] = []
        for x in range(10):
            each_extras[cnt].append(x * 10 ** i % 13)
            # each_extras[cnt][x * 10 ** i % 13] = 1
        cnt += 1

# print(each_extras)

# print(extra)
dp = [[0 for i in range(13)] for j in range(cnt+1)]
dp[0][extra % 13] = 1
for i in range(cnt):
    for extras in each_extras[i]:
        for j in range(13):
            dp[i+1][(extras + j)%13] += dp[i][j]
            dp[i+1][(extras + j)%13] %= mod
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % mod


# print(dp)
print(dp[-1][5] % mod)
"""


S = list(str(input()))

dp = [[0 for i in range(13)]for j in range(len(S)+1)]
dp[0][0] = 1
S.reverse()
mul = 1
for i in range(len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i+1][(mul*j+k)%13] += dp[i][k]
                dp[i+1][(mul*j+k)%13] %= mod
    else:
        for k in range(13):
            dp[i+1][(int(S[i])*mul+k)%13] += dp[i][k]
            dp[i+1][(int(S[i])*mul+k)%13] %= mod
    mul *= 10
    mul %= 13

# print(dp)
print(dp[-1][5])


Measured memory_bytes: 96644
s = input()
t = input()

def z_algorithm(s):
    n = len(s)
    res = [0] * n
    i = 1
    j = 0
    while i < n:
        # i番目以降の一致文字数
        while i + j < n and s[j] == s[i + j]:
            j += 1
        res[i] = j

        # 一文字も一致しない場合，次の文字へ
        if j == 0:
            i += 1
            continue

        # 一致したところまでを埋める
        k = 1
        while i + k < n and k + res[k] < j:
            res[i + k] = res[k]
            k += 1
        
        i += k
        j -= k
        
    return res


n = len(t)
if n > len(s):
    ss = s * (n // len(s) + 2)
else:
    ss = s * 2

z = z_algorithm(t + ss * 2)
z = [min(z[i], n) for i in range(n, len(z))]

ans = 0
for i in range(n):
    c = 0
    for v in z[i::n]:
        if v == n:
            c += 1
        else:
            c = 0
        ans = max(ans, c)
        
if ans <= len(ss) // n:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 171972
def solve(fld)
  $h.times do |y|
    fld[y].each_cons(2).with_index do |(a, b), x|
      if a != b
        fld[y][x], fld[y][x+1] = fld[y][x+1], fld[y][x]
        return true if chain(fld.transpose.map{ |ar| ar.reverse })
        fld[y][x], fld[y][x+1] = fld[y][x+1], fld[y][x]
      end
    end
  end
  false
end
  
def chain(fld)
  loop do
    $t = false
    adjust(fld)
    return true if $t
    $f = false
    fld = erase(fld, $w, $h, erase(fld.transpose, $h, $w).transpose)
    return false unless $f
  end
end
  
def erase(fld, r, c, nfld = fld)
  r.times do |y|
    fld[y].each_cons($n).with_index do |ar, x|
      next if ar.any?{ |v| !v }
      if ar.all?{ |v| v == ar[0] }
        $f = true
        while x < c && ar[0] == fld[y][x]
          nfld[y][x] = nil
          x += 1
        end
      end
    end
  end
  nfld
end
  
def adjust(fld)
  $w.times do |x|
    fld[x].map! { |v| v if /[A-Z]/ =~ v }.compact!
  end
  $t = true if fld.flatten.all?{|v| v.nil? }
  fld.map!{|ar| ar.fill(nil, ar.size...$h) }
end
  
$h, $w, $n = gets.split.map(&:to_i)
fld = $h.times.map{ gets.chomp.split('').map{ |v| v if /[A-Z]/ =~ v } }
puts solve(fld) ? 'YES' : 'NO'

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

bool binsearch(ll s[],ll n,ll key){
    ll ok=n,ng=0,mid;
    while(abs(ok-ng)>1){
        mid=(ok+ng)/2;
        if(key==s[mid]) return true;
        else if(key>s[mid]) ng=mid;
        else ok=mid;
    }
    return false;
}

int main(void)
{
    ll n; cin>>n;
    ll s[n];
    rep(i,n) cin>>s[i];
    ll q; cin>>q;

    ll ans=0;
    rep(i,q){
        ll key; cin>>key;
        if(binsearch(s,n,key)) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3836
#include<iostream>
//#include<cstdlib>
//#include<cmath>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b-a == c-b) {
		cout << "YES"<< endl;
	}
	else{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

	long long int num;
	long long int data;

	int cnt=0;

	while(cin>>num){
		cnt = 0;
		if(num==0){
			break;
		}
		for(long long int i = 1;i<=num;i++){
			if(i%5==0){
				long long int tmp = i;
				while(1){
					if(tmp%5!=0){
						break;
					}
					tmp/= 5;
					cnt++;
				}
			}
		}
		cout<<cnt<<endl;

	}
	return 0;
}

/*
Sample Input
2
12
10000
0
Output for the Sample Input
0
2
2499
*/

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1000000000000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair

map<ll, int> m;
ll n, a[202020], ans = 1, c, b;

int main(){
cin>>n;
for(int i=0; i<n; i++){
    cin >> a[i] ;
    m[a[i]]++;
}
sort(a, a+n);
reverse (a, a+n);
for(int i =0 ;i<n; i++){
    if(m[a[i]]>=2)b++, m[a[i]]-=2, ans*=1LL*a[i];
    if(b==2)break;
}
if(b<2)cout << 0 << endl;

else cout << ans  << endl;



return 0;}


Measured memory_bytes: 7296
#include <cstdio>
#include <cstring>
#include <algorithm>
#define SIZE 50010
using namespace std;


int main()
{
    long long k,a,b;
    int times;
    long long ans=1;
    scanf("%lld%lld%lld",&k,&a,&b);
    if(b-a>2)
    {
        k-=a-1;
        times=k>>1;
        ans=a+(b-a)*times;
        if(k&1)
            ans++;
    }
    else
    {
        ans+=k;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128