akhauriyash/Code-Regression huggingface dataset:
// Ryo Kamoi
#define DEBUG

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>

using namespace std;

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

typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;

int INF = 1000000000;

struct edge {
  int to; int len;
};

int n;
int col[100010];
vector<edge> graph[100010];

int main(){
  cin >> n;

  REP(i, n) {
    col[i] = -1;
  }

  REP(i, n-1) {
    int u, v, w;
    cin >> u >> v >> w;
    edge e1;
    e1.to = v-1; e1.len = w;
    graph[u-1].push_back(e1);
    
    edge e2;
    e2.to = u-1; e2.len = w;
    graph[v-1].push_back(e2);
  }

  queue<int> que;
  que.push(0);
  col[0] = 0;

  while(!que.empty()) {
    int vertex = que.front(); que.pop();
    REP(i, graph[vertex].size()) {
      int next_v = graph[vertex][i].to;
      if (col[next_v] >= 0) continue;

      if (graph[vertex][i].len %2 == 1) {
        col[next_v] = (col[vertex] + 1) % 2;
      } else {
        col[next_v] = col[vertex];
      }

      que.push(next_v);
    }
  }

  REP(i, n) {
    cout << col[i] << endl;
  }
}


Measured memory_bytes: 6784
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair

using namespace std;

const int N=2e5+5;
const int mod=998244353;
int n,nxt[N];
pii a[N];
int ST[4*N];

int get (int id,int l,int r,int L,int R)
{
    if (r<L||R<l) return 0;
    if (L<=l&&r<=R) return ST[id];
    int mid=(l+r)/2;
    return max(get(id*2,l,mid,L,R),get(id*2+1,mid+1,r,L,R));
}

void update(int id,int l,int r,int u,int x)
{
    if(r==l&&l==u)
    {
        ST[id]=x;
        return;
    }
    if(u>r||u<l) return;
    int mid=(l+r)/2;
    update(id*2,l,mid,u,x);
    update(id*2+1,mid+1,r,u,x);
    ST[id]=max(ST[id*2],ST[id*2+1]);
}

int calc(int l,int r)
{
    if(l>r) return 1;
    return (1+calc(l+1,nxt[l]))*calc(nxt[l]+1,r)%mod;
}

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i].fi>>a[i].se;
    sort(a+1,a+n+1);
    for(int i=n;i>=1;i--)
    {
        int to=a[i].fi+a[i].se;
        if(to>a[n].fi) nxt[i]=n;
        else
        {
            nxt[i]=lower_bound(a+1,a+n+1,mp(to,0ll))-a-1;
            nxt[i]=max(i,get(1,1,n,i,nxt[i]));
        }
        update(1,1,n,i,nxt[i]);
    }
    cout<<calc(1,n);
}


Measured memory_bytes: 17408
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int A = scan.nextInt();
			int B = scan.nextInt();
			int C = scan.nextInt();
			int goukei  = 0;
			
			int []a = {A,B,C};
			
			Arrays.sort(a);//a[2]が一番でかい
			
			if(a[2]%2==0){//偶数
				int x  = 2*(a[1]%2)+a[0]%2;//ぐぐ　０　きぐ　１ぐき２きき３
				
				switch(x){
				case 0:goukei = (a[2]-a[1])/2+(a[2]-a[0])/2;break;//ぐぐ
				case 1:goukei = (a[2]-a[1])/2+(a[2]-a[0])/2+1+1;break;//きぐ
				case 2:goukei = (a[2]-a[1])/2+1+(a[2]-a[0])/2+1;break;//ぐき
				case 3:goukei = (a[2]-a[1])/2+(a[2]-a[0])/2+1;break;//きき
				}	
				System.out.println(goukei);
			}else {//奇数
				int x  = 2*(a[1]%2)+a[0]%2;//ぐぐ　０　きぐ　１ぐき２きき３
				
				switch(x){
				case 0:goukei = (a[2]-a[1])/2+(a[2]-a[0])/2+1;break;//ぐぐ
				case 1:goukei = (a[2]-a[1])/2+1+(a[2]-a[0])/2+1;break;//きぐ
				case 2:goukei = (a[2]-a[1])/2+(a[2]-a[0])/2+1+1;break;//ぐき
				case 3:goukei = (a[2]-a[1])/2+(a[2]-a[0])/2;break;//きき
				}	
				System.out.println(goukei);
				
				
				
			}
			
		}
		
		
	}
		

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (auto&& w : a) cin >> w;
  sort(begin(a), end(a), greater<int>());
  int m = (n - 1) / 2;
  int s1 = accumulate(begin(a), begin(a) + m + 1, 0ll);
  int s2 = accumulate(begin(a) + m + 1, end(a), 0ll);
  int ans, ans1, ans2;
  if (n % 2 == 1) {
    ans1 = (2 * s1 - a[m] - a[m - 1]) - (2 * s2);
    ans2 = (2 * (s1 - a[m])) - (2 * (s2 + a[m]) - a[m] - a[m + 1]);
    ans = max(ans1, ans2);
  } else {
    ans = (2 * s1 - a[m]) - (2 * s2 - a[m + 1]);
  }
  cout << ans << endl;
}

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

const int MaxN = 100005;

int n;
int h[MaxN], f[MaxN];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) scanf("%d", &h[i]);
	f[1] = 0;
	for (int i = 2; i <= n; ++ i) {
		f[i] = f[i - 1] + abs(h[i] - h[i - 1]);
		if (i - 2 >= 1) {
			f[i] = min(f[i], f[i - 2] + abs(h[i] - h[i - 2]));
		}
	}
	printf("%d\n", f[n]); 
	return 0;
}


Measured memory_bytes: 1024
A,B = map(int, input().split())
Anum = int((A/0.08)+0.5)
Bnum = int((B/0.1)+0.5)
check = 0
if Anum>Bnum:
    check=int(Anum*0.1)
    if check!=B:
        print('-1')
    else:
        print(Anum)
elif Anum<Bnum:
    check=int(Bnum*0.08)
    if check!=A:
        print('-1')
    else:
        print(Bnum)
else:
    print(Anum)

Measured memory_bytes: 3064
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd

#define CIN(x) int x;cin>>x;
#define CIN2(x,y) int x,y;cin>>x>>y;
#define CIN3(x,y,z) int x,y,z;cin>>x>>y>>z;
#define SCIN(x) string x;cin>>x;
#define SCIN2(x,y) string x,y;cin>>x>>y;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";
#define ENDL cout<<endl;

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i];
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())


#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){
    CIN2(a,b);

    SANKOU(a*b%2==1,"Odd","Even");

    return 0;
}


Measured memory_bytes: 764
n = int(input())
h = list(map(int, input().split()))
count = 0
l = 0
r = 0
while True:
    for i in range(n):
        if h[i] != 0:
            l = i
            break
        if i == n - 1:
            print(count)
            exit()

    for i in range(l + 1, n):
        if h[i] == 0:
            r = i - 1
            break
        r = i

    if l == n - 1:
        r = l

    min_l_r = min(h[l:r+1])
    for i in range(l, r+1):
        h[i] -= min_l_r
    count += min_l_r


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

namespace abc109_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nums = Console.ReadLine().Split(' ');
            int a = int.Parse(nums[0]);
            int b = int.Parse(nums[1]);

            if((a * b) % 2 == 0)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


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

int main() {
	//char* array;
	//cin >> array;

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

	if (a < 2 * b) {
		cout << "0";
	}
	else {
		cout << a - 2 * b;
	}

	return 0;

}

Measured memory_bytes: 384
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N, *a = map(int, open(0))
    for i in range(N):
        if a[i] % 2 == 1:
            print('first')
            exit()
    print('second')

if __name__ == "__main__":
    main()


Measured memory_bytes: 13316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
int fa[N], a[N], b[N], n, m, sz[N], ans;
int get(int x){ return fa[x] == x? x : fa[x] = get(fa[x]); }
void merge(int x, int y)
{
	int gx = get(x), gy = get(y);
	if(gx == gy) return;
	fa[gy] = gx;
	sz[gx] += sz[gy];
} 
int main()
{
    std::ios::sync_with_stdio(false);
    cin >> n >> m;
    for(int i = 1; i <= n; i++) fa[i] = i, sz[i] = 1;
    for(int i = 1; i <= m; i++)
    {
    	cin >> a[i] >> b[i];
    	merge(a[i], b[i]);
	}
	for(int i = 1; i <= n; i++) if(get(i) == i) ans = max(ans, sz[i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6932
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  ll K;
  cin>>K;
  string tmp = S;
  for(int i=0;i<5;++i) {
    for(int j=0;j<S.size();++j) tmp.push_back(S[j]);
  }
  for(int i=0;i<tmp.size()-1;++i) {
    if(tmp[i]==tmp[i+1]) tmp[i+1] = '*';
  }
  char yey = tmp[2*S.size()-1];
  ll num;
  for(int i=2;i<5;++i) {
    if(tmp[i*S.size()+S.size()-1]==yey) {
      num = i-1;
      break;
    }
  }
  ll arr[num+1];
  for(int i=0;i<=num;++i) arr[i] = 0;
  for(int i=1;i<=num;++i) {
    for(int j=S.size();j<i*S.size()+S.size();++j) {
      if(tmp[j]=='*') arr[i]++;
    }
  }
  int first = 0;
  for(int i=0;i<S.size();++i) {
    if(tmp[i]=='*') first++;
  }
  ll ans = first + (K-1)/num*arr[num];
  if((K-1)%num>0){
    if(S[0]!=S[S.size()-1]) {
      ans += arr[(K-1)%num];
    }
    else {
      if(yey=='*'){
        ans += arr[(K-1)%num];
      }
      else {
        tmp = "";
        for(int i=0;i<(K-1)%num;++i) {
          for(int j=0;j<S.size();++j) tmp.push_back(S[j]);
        }
        tmp[0] = '*';
        for(int i=0;i<tmp.size()-1;++i) {
          if(tmp[i]==tmp[i+1]) tmp[i+1] = '*';
        }
        for(int i=0;i<tmp.size();++i) {
          if(tmp[i]=='*') ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int a;
  cin>>a;
  int ans = a + a * a + a * a * a;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
const int INF=1000000000;

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<vector<int>> e(10,vector<int>(10,INF));
    int mt=0;
    for(int i=0;i<n;++i){
      int a,b,c;
      cin>>a>>b>>c;
      mt=max(mt,max(a,b));
      e[a][b] = min(e[a][b],c);
      e[b][a] = min(e[b][a],c);
    }
    mt++;
    for(int i=0;i<mt;++i)
      e[i][i]=0;
    for(int k=0;k<mt;++k)
      for(int i=0;i<mt;++i)
        for(int j=0;j<mt;++j)
          e[i][j] = min(e[i][j],e[i][k]+e[k][j]);
    int mi=0;
    int mc=INF;
    for(int i=0;i<mt;++i){
      int s=0;
      for(int j=0;j<mt;++j)
        s+=e[i][j];
      if(s<mc){
        mc=s;
        mi=i;
      }
    }
    cout<<mi<<' '<<mc<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;

/**
 *
 * @author shota
 */
public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();
        
        int distance = s * t;
        
        if(distance >= d ) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

int N;
int A[111111];

signed main(){
    scanf("%lld",&N);
    rep(i,N)scanf("%lld",&A[i]);

    int a=0;
    rep(i,N){
        if(i&1)a-=A[i];
        else a+=A[i];
    }

    cout<<a;
    rep(i,N-1){
        cout<<" ";
        int b=2*A[i]-a;
        cout<<b;
        a=b;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 2048
# coding: utf-8
import re
import math
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
#import numpy as np
mod=int(10**9+7)
inf=int(10**20)
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def comb(n,r):return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
 

 
#main
h,n=map(int,input().split())
AB=[list(map(int,input().split())) for a in range(n)]
dp=[[inf for b in range(h+1)] for a in range(n+1)]
dp[0][0]=0

for a in range(1,n+1):
    for b in range(0,h+1):
        dp[a][b]=min(dp[a][b],dp[a-1][b])
        key=min(h,b+AB[a-1][0])
        dp[a][key]=min(dp[a][key],dp[a][b]+AB[a-1][1])
print(dp[n][h])

Measured memory_bytes: 270572
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <cassert>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const int MAX = 510000;
constexpr long long MOD = 998244353;

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

class mint {
public:
    long long x;
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    //mint operator-() const{ return mint(-x);}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

};


struct combination {
    vector<mint> fact, ifact;
    combination(long long n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(long long n, long long k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int main(){
  ll N, M, K; cin >> N >> M >> K;
  combination C(N);
  mint ans;
  vector<mint> p(N + 1, 1);
  rep(i, N) p[i + 1] = p[i] * (M - 1);
  rep(k, K + 1){
    ans += C(N - 1, k) * M * p[N - k - 1];
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 7924
// abc142_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    REP(i, N) cin >> H[i];

    int ans = 0;
    REP(i, N){
        if (H[i] >= K) ans++;
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    vector<int>x(10000);
    vector<int>y(10000);
    int owari =0;
    for(int i=0;i<10000;i++){
        cin >> x[i] >> y[i];
        if(x[i]>y[i])swap(x[i],y[i]);
        if(x[i]==0&&y[i]==0){
            owari =i;
            break;
        }
    }
    
    for(int i=0;i<owari;i++){
        cout << x[i] << " " << y[i] << endl;
    }
}


Measured memory_bytes: 3084
#include <stdio.h>
#include <algorithm>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n,k,i,ans=0;
	scanf("%d %d",&n,&k);
	int a[n];
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n,cmp);
	for(i=0;i<k;i++)
		ans+=a[i];
	printf("%d\n",ans);
}

Measured memory_bytes: 128
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=500001;
P a[maxn],b[maxn];
vector<ll> divisor(ll x){
  vector<ll> res;
  for(ll i=1LL;i*i<=x;i++){
    if(x%i==0){
      res.push_back(i);
      if(i!=x/i)res.push_back(x/i);
    }
  }
  return res;
}

int main(){
  string s;
  cin>>s;
  ll res=0;
  reverse(s.begin(),s.end());
  for(int i=0;i<(1<<(s.size()-1));i++){
    ll now=1;
    ll now2=(ll)((int)s[0]-48);
    for(ll j=0;j<(s.size()-1);j++){
      if(1&i>>j){
        res+=(ll)now2;
        now=1;
        now2=(ll)((int)s[j+1]-48);
      }
      else{
        now*=10;
        now2+=now*(ll)((int)s[j+1]-48);
      }
    }
    //cout<<now*((int)s[s.size()-1]-48)<<endl;
    //now2+=now*((int)s[s.size()-1]-48);  
    res+=(ll)now2;
  }
  cout<<res<<endl;
}


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

#define int long long

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)

#define INF (3e9)

using namespace std;

int N;
int A[300003];

signed main()
{
    cin >> N;
    REP(i, N)
    {
        int a;
        cin >> a;

        A[i*3] = a-1;
        A[i*3+1] = a;
        A[i*3+2] = a+1;
    }
    sort(A, A+N*3);

    int contNum = 0;
    int maxNum = 0;
    int prev = INF;
    REP(i, N*3)
    {
        int a = A[i];
        if (a == prev)
        {
            ++contNum;
        }
        else
        {
            if (contNum > maxNum)
            {
                maxNum = contNum;
            }
            contNum = 1;
        }
        prev = a;
    }
    cout << maxNum << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

#define MAX 100

int n,Time;
int G[MAX][MAX],d[MAX],f[MAX];
bool used[MAX];

void dfs(int v){
  d[v] = Time++;
  used[v] = true;

  for(int i = 0 ; i < n ; i++){
    if(!used[i] && G[v][i]){
      dfs(i);
    }
  }

  f[v] = Time++;
}

int main(){
  cin >> n;

  for(int i = 0 ; i < n ; i++){
    int u,k,v;
    cin >> u >> k;
    for(int j = 0 ; j < k ; j++){
      cin >> v;
      G[u-1][v-1] = v-1;
    }
  }

  Time = 1;
  for(int i = 0 ; i < n ; i++){
    if(!used[i]){
      dfs(i);
    }
  }

  for(int i = 0 ; i < n ; i++){
    cout << i+1 << " " << d[i] << " " << f[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
const int N=3005;
int n;
double p[N],dp[N][N],ans;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%lf",&p[i]);
	dp[0][0]=1;
	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];
			dp[i][j]+=dp[i-1][j]*(1-p[i]); 
		}
	for (int i=(n+1)/2;i<=n;i++)
		ans=ans+dp[n][i];
	printf("%.10lf",ans); 
}

Measured memory_bytes: 68992
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define double long double
const long long mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
struct edge { int to,cost; };
int a[214514];
int rwa[214514], br[214514][23];

int xsum(int s, int t) {
	int res = 0;
	rep(i, 21) {
		int b = br[t+1][i] - br[s][i];
		if (b & 1)res += 1 << i;
	}
	return res;
}

signed main(){
	int n; cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)rwa[i + 1] += a[i];
	rep(i, n)rwa[i + 1] += rwa[i];
	rep(i, n) {
		rep(j, 21) {
			if (a[i] & (1 << j))br[i + 1][j]++;
		}
	}
	rep(i, n)
		rep(j, 21)br[i + 1][j] += br[i][j];
	int ans = 0;

	rep(i, n) {
		int lb = i-1, ub = n;
		while (ub - lb > 1) {
			int mi = (lb + ub) / 2;
			int sum = rwa[mi + 1] - rwa[i];
			int xs = xsum(i, mi);
			if (xs == sum)lb = mi;
			else ub = mi;
		}
		ans += lb - i + 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 41984
#include<iostream>

using namespace std;

struct str
{
	unsigned int p;
	unsigned int d1;
	unsigned int d2;
};

int main()
{
	while(true)
	{
		unsigned int n = 0;
		str info[10001];
		str max;

		cin >> n;

		if(n == 0)
		{
			return false;
		}

		for(unsigned int i = 0; i < n; i++)
		{
			cin >> info[i].p >> info[i].d1 >> info[i].d2;
		}

		// p = 番号 d1 d2 = 歩いた距離

		max = info[0];

		for(unsigned int i = 1; i < n; i++)
		{
			if(max.d1 + max.d2 < info[i].d1 + info[i].d2)
			{
				max = info[i];
			}
		}

		cout << max.p << " " << max.d1 + max.d2 << endl;
	}
}

Measured memory_bytes: 1268
#include <iostream>

using namespace std;

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

  int X = 0, idx = 0;
  for (int i = 1; i <= N; i++) {
    X += i;
    if (X >= N) {
      idx = i;
      break;
    }
  }

  int d = X - N;
  for (int i = 1; i <= idx; i++) {
    if (i != d) cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *NOIP 2019 RP++                                           *
 ***********************************************************/
//#pragma GCC optimize(3)
#define ADD_STACK int size = 512 << 20;\
	char *pp = (char*)malloc(size) + size;  \
	__asm__("movl %0, %%esp\n" :: "r"(pp))
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<fstream>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#include<ctime>
#include<vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))
#define Abs(x) (((x)<(0))?(-(x)):(x))
#define infll (ll)(1e18)
#define infint (1<<30)
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register ll a=b;a<=c;++a)
#define FORD(a,b,c) for (register ll a=b;a>=c;--a)
using namespace std;
//char buf[1<<20],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline ll read(){
	ll x=0,f=1;char c;
	for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
	for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());return x*f;
}
template<typename T>
inline void write(T a){
	if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
	while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
}
inline void write_(){return;}
template<typename T,typename... Args>
inline void write_(T a,Args... b){write(a);putchar(' ');write_(b...);}
inline void writeln(){putchar('\n');return;}
template<typename T,typename... Args>
inline void writeln(T a,Args... b){write(a);putchar(' ');writeln(b...);}
//need c++11

//inline void write(ll a){
//    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
//    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
//inline void write_(ll a){write(a);putchar(' ');}
//inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
inline ll lcm(ll a,ll b){return 1ll*a/gcd(a,b)*b;}
inline ll Pow(ll n,ll a){ll b=1;while(a){if(a&1)b=1ll*b*n%mod;n=1ll*n*n%mod;a>>=1;}return b;}
//---------------------Head Files--------------------------//
int v[2500];
signed main(){
	#ifdef _WIN32
		// freopen("0.in","r",stdin);
		// freopen("0.out","w",stdout);
		long double be=clock();
	#endif
	ll l=read(),r=read(),ans=infll;
	FOR(i,l,Min(r,l+2019+2019+2019+2019))v[i%2019]++;
	// int x=0,y=0;
	FOR(i,0,2018)FOR(j,0,2018)if(i==j&&v[i]>1)ans=Min(ans,1ll*i*j%2019);else
	if(i!=j&&v[i]&&v[j])ans=Min(ans,1ll*i*j%2019);
	// ans=Min(ans,x*y%2019)
	writeln(ans);
	#ifdef _WIN32
		long double en=clock();
		printf("Time: %.0Lfms\n",en-be);
		fclose(stdin);fclose(stdout);
	#endif
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int A, B;
  cin >> A >> B;
  cout << max(A - B * 2, 0);
}
#endif


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std; 
int f(int n){
	int i=1;
	int sum=0;
	if(n%2)
	for(i=1;i<=n;i++)
	{
		if(n%i==0)sum++;
	}
	if(sum==8)return 1;
	else return 0;
}
int main(){
int n;int sum=0;
cin>>n;
if(n<105){
	cout<<0<<endl;
	return 0;
}
int i;
for(i=105;i<=n;i++){
	sum+=f(i);
}
cout<<sum<<endl;
	return 0;
}

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

int d[333][666][666];
vector<int> u;
int p = 998244353;
int f(int i, int v, int w) {
    if(!i)
        return v ? 0 : 1;
    if(v > w)
        return 0;
    if(d[i][v][w] >= 0)
        return d[i][v][w];
    d[i][v][w] = 0;
    for(int j = max(-u[i - 1], -w); j <= v; j++)
        (d[i][v][w] += f(i - 1, v - j, w - abs(j))) %= p;
    return d[i][v][w];
}
int main() {
    string s;
    int k;
    cin >> s >> k;
    k = min(k, 300);
    k += k;
    for(s += '0';;) {
        auto i = s.find('0');
        if(i == -1)
            break;
        s = s.substr(i + 1);
        u.push_back(i);
    }
    for(int i = 0; i < 333; i++)
        for(int j = 0; j <= k; j++)
            for(int w = 0; w <= k; w++)
                d[i][j][w] = -1;
    cout << f(u.size(), 0, k) << endl;
    return 0;
}


Measured memory_bytes: 525440
import java.util.*;
import java.util.stream.Collectors;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 16MB stack
        Thread thread = new Thread(null, new Main(), "", 16 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }


    static class Points {
        int x;
        int y;
        int z;

        public Points(int x, int y, int z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Points points = (Points) o;
            return x == points.x &&
                    y == points.y &&
                    z == points.z;
        }

        @Override
        public int hashCode() {
            return Objects.hash(x, y, z);
        }
    }
    // int a = Integer.parseInt(scanner.nextLine());
    // int[] a = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    static void solve(Scanner scanner) {
        int K = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray()[3];
        long[] a = Arrays.stream(scanner.nextLine().split(" "))
                .map(Long::parseLong)
                .sorted(Comparator.comparing(x -> -x))
                .mapToLong(x -> x)
                .toArray();
        long[] b = Arrays.stream(scanner.nextLine().split(" "))
                .map(Long::parseLong)
                .sorted(Comparator.comparing(x -> -x))
                .mapToLong(x -> x)
                .toArray();
        long[] c = Arrays.stream(scanner.nextLine().split(" "))
                .map(Long::parseLong)
                .sorted(Comparator.comparing(x -> -x))
                .mapToLong(x -> x)
                .toArray();

        Set<Points> used = new HashSet<>();
        used.add(new Points(0, 0, 0));
        Queue<Points> q = new PriorityQueue<>(Comparator.comparing(x -> -(a[x.x] + b[x.y] + c[x.z])));
        q.add(new Points(0, 0, 0));
        for (int i = 0; i < K; i++) {
            Points p = q.poll();
            System.out.println(a[p.x] + b[p.y] + c[p.z]);
            if (p.x < a.length - 1 && used.add(new Points(p.x + 1, p.y, p.z))) {
                q.add(new Points(p.x + 1, p.y, p.z));
            }
            if (p.y < b.length - 1 && used.add(new Points(p.x, p.y + 1, p.z))) {
                q.add(new Points(p.x, p.y + 1, p.z));
            }
            if (p.z < c.length - 1 && used.add(new Points(p.x, p.y, p.z + 1))) {
                q.add(new Points(p.x, p.y, p.z + 1));
            }
        }
    }

}


Measured memory_bytes: 36400
odd_tap = ['R', 'U', 'D']
# odd_tap = 'RUD'
even_tap = ['L', 'U', 'D']


def main():
    S = input()

    res = True
    for i, c in enumerate(S, start=1):
        if i % 2 == 1 and c not in odd_tap:
            res = False
            break
        elif i % 2 == 0 and c not in even_tap:
            res = False
            break

    print("Yes" if res else "No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Linq;

class C
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Enumerable.Range(1, n).Select(i => int.Parse(Console.ReadLine())).ToArray();
        var M = a.Max();
        var k = Array.IndexOf(a, M);
        for (var i = 0; i < n; i++) Console.WriteLine(i == k ? a.Where((x, j) => j != i).Max() : M);
    }
}


Measured memory_bytes: 19412
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;

int main(){
    int a[3][3];
    for(int i=0;i<3;i++){
       for(int j=0;j<3;j++){
            cin >> a[i][j];
       }
    }
    int x,y[3];
    bool check[3];
    for(int i=0;i<=100;i++){
        memset(check,false,sizeof(check));
        check[0]=true;
        for(int j=0;j<3;j++){
            y[j]=a[0][j]-i;
            if(y[j]<0) check[0]=false;
        }
        if(check[0]==false) break;
        for(int s=1;s<3;s++){
            for(int k=0;k<=100;k++){
                for(int j=0;j<3;j++){
                    if(k+y[j]!=a[s][j]) break;
                    if(j==2) check[s]=true;
                }
            }
        }
        if(check[0]==true&&check[1]==true&&check[2]==true){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    long long d;
    cin >> n >> d;
    d *= d;
    int ans = 0;
    long long x, y;
    for (int i = 1; i <= n; i++) {
        cin >> x >> y;
        if (x * x + y * y <= d) ans++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> s[m];
    for(int i=0;i<m;i++){
        int k; cin>>k;
        for(int j=0;j<k;j++){
            int t; cin>>t;
            s[i].push_back(t-1);
        }
    }
    int p[m];
    for(int i=0;i<m;i++){
        cin>>p[i];
    }
    int ans=0;
    for(int i=0;i<1<<n;i++){
        bool flag=true;
        for(int j=0;j<m;j++){
            int sum=0;
            for(int sw:s[j]){
                if(i&(1<<sw))sum++;
            }
            if(sum%2!=p[j]){
                flag=false;
                break;
            }
        }
        if(flag)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
// modifed from aryaporn
#include<bits/stdc++.h>
using namespace std;
#define all(a) begin(a),end(a)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int N=4005;

struct ordered_set {
	int sz = 0, bit[N];

	int size() {
		return sz;
	}

	void update(int k, int x) {
		k++;
		while (k < N) {
			bit[k] += x;
			k += k & -k;
		}
		sz += x;
	}

	int find_by_order(int k) {
		int ans = 0, sum = 0;
		for (int j = 17; j >= 0; --j) {
			ans += 1 << j;
			if (ans < N && sum + bit[ans] < k) {
				sum += bit[ans];
			} else {
				ans -= 1 << j;
			}
		}
		return ans + 1;
	}

	int order_of_key(int k) {
		k++;
		int ans = 0;
		while (k >= 1) {
			ans += bit[k];
			k -= k & -k;
		}
		return ans - 1;
	}
} st[N];

vector<int>adj,adj2;
int dp[2][N];

void solve(){
	int n;
	cin>>n;
	vector<int>a(2*n);
	string s;
	adj.resize(n+1);
	adj2.resize(n+1);
	for(int i=0;i<2*n;i++){
		char z;
		cin>>z;
		s+=z;
		cin>>a[i];
		if(z=='B'){
			adj[a[i]]=i;
		}
		else{
			adj2[a[i]]=i;
		}
	}
	for(int j=0;j<=n;j++){
		dp[0][j]=dp[1][j]=1e9;
		for(int i=0;i<2*n;i++){
			st[j].update(i, 1); 
		}
		for(int i=1;i<=j;i++){
			st[j].update(adj[i], -1);
		}
	}
	dp[0][0]=0;
	for(int i=0;i<2*n;i++){
		for(int j=0;j<=min(n,i);j++){
			int gt=st[j].order_of_key(adj[j+1]);
			dp[1][j+1]=min(dp[1][j+1],dp[0][j]+gt);
		}
		for(int j=0;j<=n;j++){
			if(i-j<0){
	continue;
			}
			if(i-j>n){
	continue;
			}
			int gt=st[j].order_of_key(adj2[i-j+1]);
			dp[1][j]=min(dp[1][j],dp[0][j]+gt);
		}
		for(int j=0;j<=n;j++){
			dp[0][j]=dp[1][j];
			dp[1][j]=1e9;
		}
		for(int j=0;j<=n;j++){
			if(i-j+1<=n&&i-j+1>0){
	st[j].update(adj2[i-j+1], -1);
			}
		}
	}
	cout<<dp[0][n];
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc=1;
	//cin>>tc;
	for(int _=0;_<tc;_++){
		// cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1){
			cout<<'\n';
		}
	}
}


Measured memory_bytes: 62080
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;

class Problem
{
private:
	// Variables
	int n;
	vector<int> a;
	
	int count;

public:
	// Methods
	void input ()
	{
		cin >> n;

		a.resize(n);

		for (int i=0; i<n; ++i) {
			cin >> a[i];
		}

		count = 0;
	}
	
	void process ()
	{
		for (int i=0; i<n; ++i) {
			while (0 == (a[i] & 1)) {
				++count;
				a[i] >>= 1;
			}
		}
	}
	
	void output ()
	{
		cout << count << endl;
	}
};

int main ()
{
	Problem problem;
	problem.input();
	problem.process();
	problem.output();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int n,a[105]={0};
	cin>>n;
	a[0]=0;
	for(int i=1;i<=n;i++)
	{
		int w;
		cin>>w;
		a[i]+=a[i-1]+w;
	}
	int ans=1e9;
	for(int i=1;i<=n;i++)
	{
		int s1,s2;
		s1=a[i];
		s2=a[n]-a[i];
		ans=min(ans,(s2-s1)>0?(s2-s1):(s1-s2));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,m;
    cin>>n;
    
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    cin>>m;
    vector<int> b(m);
    for(int i=0; i<m; i++){
        cin>>b[i];
    }
    cout<<lexicographical_compare(a.begin(),a.end(),b.begin(),b.end())<<endl;
    
    return 0;
}


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

int	main()
{
  int	A;
  int	B;
  int	i;
  
  cin >> A >> B;
  while (A <= B)
  {
    if ((A % 10 == A / 10000) && 
       ((A / 10) % 10 == (A / 1000) % 10))
      i++;
    A++;
  }
  cout << i << endl;
  return (0);
}


Measured memory_bytes: 256
H,W = map(int,input().split())
A = []

for i in range(H):
    t = list(input())
    A.append(t)

tate = (-1,1,0,0)
yoko = (0,0,-1,1)
answer = 0

for i in range(H):
    for j in range(W):
        dp = [[10**4 for i in range(W)] for j in range(H)]
        if A[i][j] == '.':
            dp[i][j] = 0
            Q = list()
            Q.append([i,j])
            while(len(Q) > 0 ):
                s = Q[0][0]
                t = Q[0][1]
                for p, q in zip(tate, yoko):
                    m = s + p
                    n = t + q
                    if m >= 0 and m < H:
                        if n >= 0 and n < W:
                            if A[m][n] == '.':
                                if dp[m][n] == 10**4 :
                                    dp[m][n] = dp[s][t] + 1
                                    Q.append([m,n])
                Q.remove(Q[0])

            for k in range(H):
                for l in range(W):
                    if dp[k][l] < 10**4:
                        answer = max(answer,dp[k][l])

print(answer)

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

void solve() {
    int N; cin >> N;
    vector<int> R(N);
    vector<int> C(N);

    set<int> Rs;
    set<int> Cs;
    
    vector<int> Z(N);
    vector<int> W(N);

    rep(i, N) {
        cin >> R[i] >> C[i];
        R[i]--;
        C[i]--;
        Rs.insert(R[i]);
        Cs.insert(C[i]);

        //i retsu no yatsu
        Z[C[i]] = R[i];
        //yatsu ha kokoni iru
        W[R[i]] = C[i];
    }
    if ( Rs.size() != N || Cs.size() != N) {
        cout << -1 << endl;
        exit(0);
    }
    int cnt = 0;
    rep(i, N){
        if(Z[i] == i)continue;
        int j = W[i];
        int tmp = Z[i];
        Z[i] = i;
        W[i] = i;
        W[tmp] = j;
        Z[j] = tmp;
        cnt++;
    }
    cout << cnt << endl;

}

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



    solve();

    return 0;
}


Measured memory_bytes: 13868
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define fin for(int i=0;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define mp make_pair
#define endl '\n'
#define fi first
#define se second
int m = 1e9+7;
int k = 1e6+1;
int a1[1000000+1],a2[1000000+1],a3[1000000+1];

int add(int x, int y){
	x += y;
	while(x >= m) x -= m;
	while(x < 0) x += m;
	return x;
}

void solve(){
  int n;
  cin>>n;
  if(n == 1){
      cout<<"0";
      return;
  } 
  a1[0] = 1;a2[0] = 1,a3[0] = 1;
  f(i,1,k){
      a1[i] = (a1[i-1]*10)%m;
      a2[i] = (a2[i-1]*9)%m;
      a3[i] = (a3[i-1]*8)%m;
  }
  int ans = add(a2[n],a2[n]);
  ans = add(ans,-a3[n]);
  ans = add(a1[n],-ans);
  cout<<ans;
 
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1;
    while(t--) solve();
}


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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


void solve(){
    int n;
    cin >> n;
    
    int px=0, py=0, ct=0;
    for (int i = 0; i < n; i++) {
        int t, x, y, dist;
        cin >> t >> x >> y;
        dist = abs(x-px) + abs(y-py);
        if (( (t-ct) >= dist) && ( ( (t-ct)-dist + 1) & 1) ) {
            px = x;
            py = y;
            ct = t;
        }else{
            // cout << ct << endl;
            cout << "No" << endl;
            return;
        }
    }

    cout << "Yes" << endl;

}

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

    return 0;
}


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

int main()
{
	int N;
	cin >> N;
	int* a = new int[N];
	int* b = new int[N];
	int* c = new int[N];
	for(int i=0;i<N;i++){
		cin >> a[i] >> b[i] >> c[i] ;
	}
	for(int i=0;i<N;i++){
		if(a[i]*a[i] == b[i]*b[i] + c[i]*c[i])
			cout << "YES" << endl;
		else if(b[i]*b[i] == a[i]*a[i] + c[i]*c[i])
			cout << "YES" << endl;
		else if(c[i]*c[i] == a[i]*a[i] + b[i]*b[i])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
  int n,k;
  int g=1;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    if(g*2>=g+k){
      g+=k;
    }
    else if(g*2<g+k){
      g*=2;
    }
  }
  cout<<g<<endl;
}
    
  


Measured memory_bytes: 256
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#ifdef ConanYu
#include "local.hpp"
#else
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

void Main() {
  int n; cin >> n;
  double ans = double((n + 1) / 2) / double(n);
  cout << fixed << setprecision(10) << ans << "\n";
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        
        int ans = 0;
        int count = 0;
        for(int i = 100; i >= 1; i--) {
            if(a%i == 0 && b%i == 0) {
                count++;
            }
            if(count == k) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
import sys
input = sys.stdin.readline
def main():
  h,w=map(int,input().split())
  a=[list(map(lambda x:0 if x=='#' else -1,list(input()))) for _ in range(h)]
  todo=[]
  from collections import deque
  for i in range(h):
    for j in range(w):
      if a[i][j]==0:
        todo.append([i,j])
  todo=deque(todo)
  ans=0
  while todo:
    i,j=todo.popleft()
    d=a[i][j]+1
    ans=d-1
    if i>0 and a[i-1][j]==-1:
      a[i-1][j]=d
      todo.append([i-1,j])
    if i<h-1 and a[i+1][j]==-1:
      a[i+1][j]=d
      todo.append([i+1,j])
    if j>0 and a[i][j-1]==-1:
      a[i][j-1]=d
      todo.append([i,j-1])
    if j<w-1 and a[i][j+1]==-1:
      a[i][j+1]=d
      todo.append([i,j+1])
  print(ans)
if __name__=='__main__':
  #import datetime
  #print(datetime.datetime.now())
  main()
  #print(datetime.datetime.now())

Measured memory_bytes: 147572