akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  #define int ll
  int h,w;cin>>h>>w;
  int ans = INF;
  chmin(ans,w * !!(h%3));
  chmin(ans,h * !!(w%3));

  rep(i,h){
    int n = i * w;
    int half1 = w/2 * (h-i);
    int half2 = (w/2 + w%2) * (h-i);
    int tmp = max(n,max(half1,half2)) - min(n,min(half1,half2));
    
    chmin(ans,tmp);
  }

  rep(i,w){
    int n = i * h;
    int half1 = h/2 * (w-i);
    int half2 = (h/2 + h%2) * (w-i);
    int tmp = max(n,max(half1,half2)) - min(n,min(half1,half2));
    chmin(ans,tmp);
    
  }
  print(ans);
  return 0;
}

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

using namespace std;

int main()
{
    long long n;
    cin>>n;
    long long temp1,temp2;
    temp1=n%11;
    temp2=n/11;
    long long ans=0;
    ans+=(2*temp2);
    if(temp1!=0){
        if(temp1>6)
            ans+=2;
        else
            ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,c,temp;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		temp=a;
		a=b;
		b=temp;
	}
	if(a>c){
		temp=a;
		a=c;
		c=temp;
	}
	if(b>c){
		temp=b;
		b=c;
		c=temp;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}



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

using namespace std;
const int MOD = 2019;

int main(){
	int L,R; 
	cin >> L >> R;
	int a,b = R+1-L;
	if(b > MOD/3 || L/MOD!=R/MOD) {
		cout << 0;
		return 0;
	}
	vector<int> c;

	for(int i = 0; i < b; i++){
		for(int j = i+1; j < b; j++){
			c.push_back(((L+i)%2019)*((L+j)%2019)%2019);
		}
	}

	int bb = *min_element(c.begin(),c.end());
	cout << bb;
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
long Gcd(long m, long n){
	while (m % n != 0){
		long temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}
int main(){
    int n;
    cin>>n;
    long rt=0,gcd=0;
    for(int i = 0; i < n; i++){
        long t;
        cin>>t;
        if(rt != 0){
            gcd = Gcd(rt,t);
            rt = (rt/gcd)*t;
        }
        else
            rt = t;
   }
   cout<<rt;
}

Measured memory_bytes: 256
#include<random>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, K;
int P[100011], Q[100011];

int buf[100011];
int idx[100011];
int cur[100011];
void go(int *a, char c) {
    if (c == 'p') {
	REP (i, N) buf[i] = a[P[i]];
    } else if (c == 'q') {
	REP (i, N) buf[i] = a[Q[i]];
    } else if (c == 'P') {
	REP (i, N) buf[P[i]] = a[i];
    } else {
	REP (i, N) buf[Q[i]] = a[i];
    }
    REP (i, N) a[i] = buf[i];
}

void MAIN() {
    scanf("%d%d", &N, &K);
    REP (i, N) scanf("%d", P+i), P[i]--;
    REP (i, N) scanf("%d", Q+i), Q[i]--;

    if (K == 1) {
	REP (i, N) idx[i] = P[i];
    } else if (K == 2) {
	REP (i, N) idx[i] = Q[i];
    } else {
	int len = K - 3 + (K-2) / 3;
	int m = len % 8;
	int r = len / 8;
	REP (i, N) idx[i] = i;
	go(idx, 'q');
	go(idx, 'P');

	REP (i, N) cur[i] = i;
	go(cur, 'Q');
	go(cur, 'p');
	go(cur, 'q');
	go(cur, 'P');

	for (int k=r; k; k>>=1) {
	    if (k & 1) {
		REP (i, N) buf[i] = idx[cur[i]];
		REP (i, N) idx[i] = buf[i];
	    }
	    REP (i, N) buf[i] = cur[cur[i]];
	    REP (i, N) cur[i] = buf[i];
	}

	string z;
	// PqpQPqpQ
	REP (i, m/2) {
	    z.push_back("QpqP"[i]);
	    go(idx, "QpqP"[i]);
	}
	if (m % 2) {
	    go(idx, "QpqP"[m/2]);
	}
	reverse(z.begin(), z.end());
	REP (i, m/2) {
	    go(idx, z[i]);
	}
	
	REP (i, N) cur[i] = i;
	go(cur, 'P');
	go(cur, 'q');
	go(cur, 'p');
	go(cur, 'Q');

	for (int k=r; k; k>>=1) {
	    if (k & 1) {
		REP (i, N) buf[i] = idx[cur[i]];
		REP (i, N) idx[i] = buf[i];
	    }
	    REP (i, N) buf[i] = cur[cur[i]];
	    REP (i, N) cur[i] = buf[i];
	}
    }

    REP (i, N) idx[i]++;
    rprintf("%d", idx, idx+N);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

int main(){
  int n, k;
  cin >> n >>k;
  int digit =1;
  while(n>=k){
    n=n/k;
    digit+=1;
//    cout << n << endl;
  }
  cout << digit << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
const int maxn = 250;
using namespace std;

int n,m,a[15][15],va;

void floyd(){
    for(int k = 0 ; k < 10 ; k++){
        for(int i = 0 ; i < 10 ; i++){
            for(int j = 0 ; j < 10 ; j++){
                a[i][j] = min(a[i][j],a[i][k] + a[k][j]);
            }
        }
    }
}

int main(){
    while(~scanf("%d%d",&n,&m)){
        for(int i = 0 ; i < 10 ; i++){
            for(int j = 0 ; j < 10 ; j++){
                scanf("%d",&a[i][j]);
            }
        }
        int sum = 0;
        for(int i = 1 ; i <= n ; i++){
            for(int j = 1 ; j <= m ; j++){
                scanf("%d",&va);
                floyd();
                sum += a[va][1];
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

Measured memory_bytes: 256
x,y=map(int,input().split())

m = 10**9+7

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]
# aの逆元(mod m)を求める。
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m


nlist=[1]*(10**6)
rlist = [1]*(10**6)

nor = 1
res = 1
for i in range(1,10**6):
    nor = nor*i%m
    res = res*mod_inv(i,m)%m
    nlist[i] = nor
    rlist[i] = res

ans = 0
if (x+y)%3!=0:
    ans=0
else:
    keynum = (x+y)//3
    if x>keynum*2:
        ans=0
    elif x<keynum:
        ans = 0
    else:
        h = y - keynum
        w = keynum-h
        
        #res = 1
        """for i in range(1,int(h+w+1)):
            res = res*i%m
        for i in range(1,int(h+1)):
            res = res*mod_inv(i,m)%m
        for i in range(1,int(h+1)):
            res = res*mod_inv(i,m)%m"""
        
        res = nlist[h+w]*rlist[h]*rlist[w]%m
        ans = res
        
print(ans)

Measured memory_bytes: 58204
N,K=list(map(int,input().split()))
R,S,P= list(map(int,input().split()))
T= list(input())
lock_list=[""] * K
ans=0
dic={"r":"p","p":"s","s":"r"}
for i,j in enumerate(T):
   if lock_list[i%K] != dic[j]:
      lock_list[i%K] = dic[j]
      if j == "r":
         ans+=P
      elif j == "s":
         ans+=R
      else:
         ans+=S
   else:
      try:
         lock_list[i%K] = ""
      except IndexError:
         pass
print(ans)

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

int main(){
	ll a,b,c;
	cin >> a >> b >> c;
	if(max(a,b) > c){
		cout << "No" << endl;
		return 0;
	}
	if(a+b>c){
		cout << "No" << endl;
		return 0;
	}
	if(4*a*b < (c-a-b)*(c-a-b)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b, c, d, e, f;

    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
    printf("%d\n", (a + b * 5 + c * 10 + d * 50 + e * 100 + f * 500) >= 1000);

    return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

using ll = long long;
using namespace std;

int main() {
    ll a, b;
    ll answers[] = {1, 2, 3};

    cin >> a >> b;

    REP(i, 3){
        if (answers[i] != a && answers[i] != b){
            cout << answers[i] << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
    int z;
    cin>>z;
    string s;
    cin>>s;

    int arr[z]= {0},max=0;
    if(s.at(0)=='I')
    {
        arr[0]++;
    }
    else
        arr[0]--;
    max=arr[0];
    for(int i=1; i<z; i++)
    {
        if(s.at(i)=='I')
            arr[i]=arr[i-1]+1;
        else
            arr[i]=arr[i-1]-1;
        if(arr[i]>max)
            max=arr[i];
    }
    if(max<0)
        cout<<"0";
    else
        cout<<max;
}


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

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

ll factorial[1000009];
ll rfactorial[1000009];
int H,W,A,B;

ll mod_pow(ll x, ll n) {
    ll a = 1;
    while (n) {
        if (n%2) a = a*x%INF;
        x = x*x%INF;
        n/=2;
    }
    return a;
}

ll nCr(ll n, ll r) {
    ll ret = factorial[n] * rfactorial[r] % INF;
    ret *= rfactorial[n-r];
    return ret % INF;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> H >> W >> A >> B;
    factorial[0] = 1;
    rfactorial[0] = 1;
    FOR(i,1,H+W+1) {
        factorial[i] = factorial[i-1] * i % INF;
        rfactorial[i] = mod_pow(factorial[i], INF-2);
    }
    
    ll ans = 0;
    FOR(i,B,W) {
        ll h,w;
        h = H-A-1, w = i;
        ll tmp = nCr(h+w, h);
        h = A-1, w = W-i-1;
        tmp *= nCr(h+w, w);
        ans += tmp%INF;
    }
    
    cout << ans%INF << endl;
    
    return 0;
}

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

int main() {
  string S;
  cin >> S;
    
  if(S.at(0)==S.at(1)&&S.at(2)==S.at(3)&&S.at(0)!=S.at(2)){
    cout << "Yes" <<endl;
  } 
  
  else if(S.at(0)==S.at(2)&&S.at(1)==S.at(3)&&S.at(0)!=S.at(1)){
    cout << "Yes" <<endl;
  } 
  
   else if(S.at(0)==S.at(3)&&S.at(2)==S.at(1)&&S.at(0)!=S.at(2)){
    cout << "Yes" <<endl;
  } 
  
  else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  long int n,a[200001],b[200001] = {0},i;
  
  scanf("%ld", &n);
  
  for(i=2;i<=n;i++){
    scanf("%ld", &a[i]);
    b[a[i]]++;
  }
  
  for(i=1;i<=n;i++)
     printf("%ld\n" ,b[i]);
  
  return 0;
}

Measured memory_bytes: 4820
#include<stdio.h>
int main()
{
    int x1, x2, x3, x4, x5;
    scanf("%d %d %d %d %d", &x1, &x2, &x3, &x4, &x5);
    if(x1==0)
    {
        printf("1\n");
    }
    if(x2==0)
    {
        printf("2\n");
    }
    if(x3==0)
    {
        printf("3\n");
    }
    if(x4==0)
    {
        printf("4\n");
    }
    if(x5==0)
    {
        printf("5\n");
    }
    if(x1!=0&&x2!=0&&x3!=0&&x4!=0&&x5!=0)
    {
        printf("0\n");
    }
    return 0;
}


Measured memory_bytes: 1616
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        ss: [usize; n],
    }
    let mut a: Vec<(usize, usize)> = vec![];
    for i in 0..ss.len() {
        a.push((i + 1, ss[i]));
    }
    a.sort_by(|a, b| a.1.cmp(&b.1));
    for b in a {
        print!("{} ", b.0);
    }
}


Measured memory_bytes: 8956
h,w,d=map(int,input().split())
a=[ [ [] for j in range(int(h*w/d+1)) ] for i in range(d) ]
a1=[ [ [] for j in range(int(h*w/d+1)) ] for i in range(d) ]
for i in range(h):
  i+=1
  tmp=list(map(int,input().split()))
  for j in range(w):
    num=tmp[j]
    j+=1
    a[num%d][int( (num-1)/d)]=[i,j]
for i in range(len(a)):
  a1[i][0]=0
  for j in range(len(a[i])-1):
    j=j+1
    if a[i][j]!=[]:
      a1[i][j]=a1[i][j-1]+abs(a[i][j][0]-a[i][j-1][0])+abs(a[i][j][1]-a[i][j-1][1])

q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(a1[l%d][int((r-1)/d)]-a1[l%d][int((l-1)/d)])


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

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

const char newl = '\n';

void next_repeated_combination(int n,int m,vector<int>& ret) {
    if (ret[0] == m) return;
    int cnt = 1,b;
    while (ret.back() == m) ret.pop_back(),cnt++;
    b = ret.back();
    ret.pop_back();
    for (int i = 0;i < cnt;++i) ret.push_back(b+1);
}

int main() {
    int n,m,q;
    cin >> n >> m >> q;
    vector<int> x(n,1),a(q),b(q),c(q),d(q);
    for (int i = 0;i < q;++i) cin >> a[i] >> b[i] >> c[i] >> d[i];
    for (int i = 0;i < q;++i) a[i]--,b[i]--;
    int ans = 0;
    while (1) {
        int sum = 0;
        for (int i = 0;i < q;++i) if (x[b[i]]-x[a[i]] == c[i]) sum += d[i];
        ans = max(ans,sum);
        if (x[0] == m) break;
        next_repeated_combination(n,m,x);
    }
    cout << ans << endl;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int a , b , c , d ;
  cin >> a >> b >> c >> d ;
  
  while(a >0 || c>0 ){
    c-= b;
    if(c<=0){
      cout << "Yes";
      break;
    }
    a-=d;
    if(a<=0){
      cout <<"No";
      break;
    }
  }
  
  
  

}


Measured memory_bytes: 3636
import java.util.ArrayDeque

data class Edge(val to: Int)

fun main(args: Array<String>) {
    val (N, Q) = readLine()!!.split(" ").map {it.toInt()}

    var parent = IntArray(N)
    var points = LongArray(N)
    var neighbors = Array(N){ mutableListOf<Edge>()}
    repeat(N-1){
        val (a,b) = readLine()!!.split(" ").map { it.toInt() }
//        parent[b-1] = a-1
        neighbors[a-1].add(Edge(b-1))
        neighbors[b-1].add(Edge(a-1))
    }

    repeat(Q){
        val (p,x) = readLine()!!.split(" ").map { it.toInt() }
        points[p-1] = points[p-1]+ x
    }

    val queue = ArrayDeque<Int>(N)
    val seen = BooleanArray(N)

    queue.addLast(0)
    while (queue.isNotEmpty()){
        val current = queue.removeFirst()
        for(e in neighbors[current]){
            if(seen[e.to]){
                continue
            }
            points[e.to] += points[current]
            queue.addLast(e.to)
        }
        seen[current] = true

    }

    print(points.joinToString(" "))

}


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

int main() {
	int N, K;
	cin >> N >> K;
	int x;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> x;
		if (x > abs(K-x)) {
			ans += abs(K - x) * 2;
		}
		else {
			ans += x * 2;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,m,t;
  cin >> n >> m >> t;
  vector<int>ti(t+1,0);
  int a;
  for(int i=0;i<n;i++){
    cin >> a;
    for(int j=0;j<=m;j++){
      if(a+j<t+1)ti[a+j]=1;
      ti[a-j]=1;
    }
  }
  int co=0;
  for(int i=1;i<ti.size();i++){
    if(ti[i]==0||ti[i-1]==0)co++;
  }
  cout << co << endl;
  return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

//最大公約数
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

//素数判定(True/Falseを返却)
int IsPrime_tf(ll num){
    if (num < 2) return false; //0、1は素数でない
    else if (num == 2) return true; //2は素数
    else if (num%2==0) return false; // 偶数はあらかじめ除く
    for (ll i = 3; i*i <= num; i += 2){ //チェックは2～√nで十分
        if (num % i == 0) return false; //素数でない
    }
    return true; //素数である
}

//素数判定(割れる値を返却)
ll IsPrime_value(ll num){
    if (num < 2) return -1; //0、1は素数でない
    else if (num == 2) return 2; //2は素数
    for (ll i = 2; i*i <= num; i += 1){ //チェックは2～√nで十分
        if (num % i == 0) return i; //素数でない
    }
    return num; //素数である
}

int main(){
   ll x, k, d;
   cin >> x >> k >> d;
   ll ans=x;
   //cout << abs(ans-d) << " " << abs(ans+d) << " " << abs(ans)/abs(d) << " " << k << endl;
   if(abs(ans-d)>=abs(ans+d)){
       if(abs(ans)/abs(d)<=k){
           k=k-(abs(ans)/abs(d));
           ans=ans+(abs(ans)/abs(d))*d;
       }else{
           ans=ans+k*d;
           k=0;
       }
   }else{
       if(abs(ans)/abs(d)<=k){
           k=k-(abs(ans)/abs(d));
           ans=ans-(abs(ans)/abs(d))*d;
       }else{
           ans=ans-k*d;
           k=0;
       }
   }
   //cout << ans << " " << k << endl;
   if(k!=0 && k%2!=0){
       if(abs(ans-d)>=abs(ans+d)){
           ans=ans+d;
       }else{
           ans=ans-d;
       }
   }
   cout << abs(ans) << endl;
}

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

int main(){

    int n;
    int sum=0,s1=0;
    cin>>n;
    vector<int> w(n);
    for(int i=0;i<n;i++){
        cin>>w[i];
        sum+=w[i];
    }
    int ans=sum;
    for(int i=0;i<n;i++){
        s1+=w[i];
        ans=min(ans,abs(sum-s1-s1));
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
import heapq

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
s = [input() for _ in range(N)]
M = INT()
t = [input() for _ in range(M)]
dic_s = defaultdict(int)
dic_t = defaultdict(int)
for st in s:
	dic_s[st] += 1
for st in t:
	dic_t[st] += 1

ans = 0
for st in s:
	ans = max(ans, dic_s[st]-dic_t[st])
print(ans)


Measured memory_bytes: 5200
#ATCGを小文字へ置き換え、小文字を抽出する作戦
S=input().replace("A","a").replace("T","t").replace("C","c").replace("G","g")

#小文字の列を取得
import re
list=re.findall(r"[a-z]+",S)

#各列の文字列の長さをリストに
list2=[]
for i in range(len(list)):
  list2.append(len(list[i]))
  
#リストが空の場合との場合分け
if list2 ==[]:
  print(0)
else:
  print(max(list2))

Measured memory_bytes: 3188
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (register ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 2e6 + 10 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 1e9 + 7 ;
const double eps = 1e-7 ;
template <class T> void read(T &a)
{
	int f = 1 ; a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	a *= f;
}

ll n;

ll c[maxn];

struct node
{
	ll nex, to;
}
edge[maxn];

ll head[maxn], tot, in[maxn], a[maxn];

void add(ll u, ll v)
{
	edge[++tot].nex = head[u];
	edge[tot].to = v;
	head[u] = tot;
	return ;
}

signed main()
{
	scanf("%lld", &n);
	rep(i, 1, n - 1)
	{
		ll u, v;
		scanf("%lld %lld", &u, &v);
		add(u, v), add(v, u);
		in[u] ++, in[v] ++;
	}
	rep(i, 1, n) scanf("%lld", &c[i]);
	sort(c + 1, c + n + 1);
	queue <ll> q;
	ll tot = 0, ans = 0;
	rep(i, 1, n) if(in[i] == 1) q.push(i);
	while(!q.empty())
	{
		tot ++;
		ll now = q.front();
		q.pop();
		a[now] = c[tot];
		cont(i, now)
		{
			int to = edge[i].to;
			in[to] --;
			if(a[to]) ans += a[to];
			if(in[to] == 1) q.push(to);
		}
	}
	printf("%lld\n", ans);
	rep(i, 1, n) printf("%lld ", a[i]);
	return 0;
}

Measured memory_bytes: 10752
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int z = a * b;
    if(z % 2 == 0){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}

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

using namespace std;

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int m = 2 * max(x, y);
    long long min_cost = 1000000000000;
    for(int nab = 0; nab <= m; nab++) {
        long long cost = a * max(0, x - nab / 2) + b * max(0, y - nab / 2) + c * nab;
        min_cost = min(min_cost, cost);
    }

    cout << min_cost << endl;
}

Measured memory_bytes: 3644
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>

#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,n) for(int i=0;i<(n); ++i)
#define rep2(i,n) for(int i=1;i<=(n);++i)

using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int NMAX = 100000;
const int MMAX = 100000;
const int k = 200000;
static const int INF = 1<<21;
static const int NIL = -1;
static const int mod = 1e9+7;

ll dp[1001][1001]={0},a[1001][1001]={0};
ll gcd(ll a, ll b){
if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b, a%b);
}

vector<vi> pre(NMAX+1);
vi dist(NMAX+1);
vector<bool> visited(NMAX+1);


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


    int H,W;
    char x;
    cin >> H >> W;
    rep2(i,H){
        rep2(j,W){
            cin >> x;
            if(x=='#') a[i][j]=1;
        }
    }
    dp[1][1]=1;

    rep2(i,H){
        rep2(j,W){
            if(!a[i-1][j]) dp[i][j]+=dp[i-1][j];
            if(!a[i][j-1]) dp[i][j]+=dp[i][j-1];
            dp[i][j]%=mod;
        }
    }
    cout << dp[H][W] << endl;
    return 0;
}


Measured memory_bytes: 18688
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

const int INF = 100000000;

string m = "012345678";
P getP(char c){
	int p = m[c-'A']-'0';
	return MP(p%3, p/3);
}

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

int main(){
	while(1){
		int n;
		char s, t, b;
		cin >> n;
		if(!n)break;
		cin >> s >> t >> b;

		P sp = getP(s);
		P tp = getP(t);
		P bp = getP(b);

		double p[16][3][3] = {};

		p[0][sp.Y][sp.X] = 1.0;

		for(int i = 1; i <= n; i++){
			rep(j, 3){
				rep(k, 3){
					if(MP(k, j) == bp) continue;
					int wallcnt = 0;
					rep(l, 4){
						int x = k+dx[l];
						int y = j+dy[l];
						if(x < 0 || x > 2 || y < 0 || y > 2 ||
							MP(x, y) == bp){
							wallcnt++;
							continue;
						}
						p[i][j][k] += p[i-1][y][x]/4;
					}
					p[i][j][k] += p[i-1][j][k]*wallcnt/4;
				}
			}
		}

		printf("%.8lf\n", p[n][tp.Y][tp.X]);
	}

	return 0;
}

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

using namespace std; 
  int main()
  {
      int n;
      cin>>n;
      int i;
      int a[n];
      int dp[n];
      for(i=0;i<n;i++)
      {
          cin>>a[i];
      }
      dp[0]=0;
      dp[1]=abs(a[1]-a[0]);
      for(i=2;i<n;i++)
      {
         dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]); 
      }
      cout<<dp[n-1]<<endl;

      
      return 0;
  }

Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n, t; scanf("%d %d", &n, &t);
	vector<int> times(n, 0);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &times[i]);
	}

	int total = 0;

	for (int i = 0; i < n; ++i) {
		int cToStop = times[i] + t;

		if (i == n-1) {
			// just add T more seconds
			total += t;
		} else if (cToStop < times[i + 1]) {
			// we can consider the full shower interval of i
			total += t;
		} else {
			// shave off the shower interval of the next person
			total += times[i + 1] - times[i];
		}
	}

	printf("%d\n", total);
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
char buf[20000];sz;
inline int rd()
{
	int ret=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		ret=ret*10+k-'0';
	}
	return ret;
}
int d[3001],d2[3001];
const int mod=998244353;
main()
{
	read(0,buf,20000);
	int N=rd();
	int S=rd();
	int ans=0;
	for(int i=1;i<=N;i++)
	{
		d[S]=i;
		int A=rd();
		for(int j=0;j<=S-A;j++)d2[j]=d[j+A];
		for(int j=0;j<=S-A;j++)
		{
			d[j]+=d2[j];
			d[j]-=mod*(d[j]>=mod);
		}
		ans+=d[0];
		ans-=mod*(ans>=mod);
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
n, k = map(int, input().split())
have = [0]*n
for _ in range(k):
    _ = input()
    A = list(map(int, input().split()))
    for x in A:
        have[x-1] += 1
ans = 0
for x in have:
    if x == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9084
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;
typedef vector<LL> VEC;

const LL INF=1<<30;
const LL MOD=1000000007;


int main(){
    int a;
    int b;
    int c;
    cin>>a>>b>>c;
    cout<<min(b/a,c)<<endl;
}



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

signed main(){
	int H; cin>>H;
	int ans=0;
	int tmp2=1;
	while(H>0){
		ans+=tmp2;
		tmp2*=2;
		H/=2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
"use strict";
function main(input) {
    const args = input.split("\n");
    const Vs = args[1].split(" ");
    const Cs = args[2].split(" ");

    const N = parseInt(args[0]);

    let value = 0;
    let ans = 0;

    for(let i = 0; i < N; i++) {
        value = Vs[i] - Cs[i];
        if(value > 0) {
            ans += value
        }
    }

    console.log(ans);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
function Main(input) {
	var lines = input.split("\n");
	var words = lines[0].split(" ");
	var alphabets = 'abcdefghijklmnopqrstuvwxyz'
	console.log(alphabets[alphabets.indexOf(words[0]) + 1])
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int i,k=0;
    string s,s1;
    cin>>s>>s1;
    for(i=0;i<s.size();i++)
    {
        if(s[i]==s1[i])
            k++;
        else
            break;
    }
    if(k==s.size() && k<s1.size())
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}


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

#define PI 3.14159265358979323846

#define ll long long int
#define ff first
#define ss second
#define int long long int
#define pb push_back

#define N 10000010
#define MOD 1000000007

int bexp(int a, int b)
{
    int res = 1;
    while(b)
    {
        if(b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

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

    int ans = 0;
    ans = max({a[0] * a[2], a[1] * a[2], a[0] * a[3], a[1] * a[3]});

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3656
m,d = map(int,input().split())

ans=0
for i in range(1,m+1):
    for j in range(1,d+1):
        d_1 = j%10
        d_10 = (j-(j%10))//10
        if (d_1>=2) and (d_10>=2) and (d_1*d_10==i):
            ans+=1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int dp[maxn],h[maxn];
const int inf=1e9;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,k;
    cin>>n>>k;
    rep(i,1,n)cin>>h[i];
    
    rep(i,1,n)dp[i]=inf;
    dp[1]=0;
    rep(i,1,n){
        rep(j,1,k)if(i-j>0)
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
    }
    cout<<dp[n]<<endl;
}
/* 
i->i+1 or i+2 ... or i+k, with cost |hi-hj|
dp[i]:走到i的花费
dp[i]=min(dp[i-1]+cost1,dp[i-2]+cost2)
 */

Measured memory_bytes: 4736
#include <iostream>
#include <utility>
#include <stdint.h>
#include <string>

using namespace std;

int main()
{
  string S, T;
  cin >> S;
  cin >> T;

  bool ans = (S.size()+1 == T.size()) && (T.substr(0,S.size()) == S);

  cout << (ans ? "Yes":"No") << endl;

  return 0;
}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  for(int i(0);i<N;i++) cin>>A[i];
  sort(A.begin(),A.end());
  int sum(0);
  for(int i(0);i<K;i++){
    sum += A[i];
  }
  cout << sum << endl;
  return 0;
}



Measured memory_bytes: 3632
N = int(input())
A = [0] * 10001
for x in range(1, int(pow(N, 0.5))):
    for y in range(1, int(pow(N, 0.5))):
        for z in range(1, int(pow(N, 0.5))):
            value = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if value > 10000:
                break
            A[value] += 1
for a in A[1:N+1]:
    print(a)


Measured memory_bytes: 70040
<?php
fscanf(STDIN, "%d", $a);
$length = strlen($a);
$last = substr($a, ($length -1), 1);
switch ($last) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        echo 'hon'.PHP_EOL;
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        echo 'pon'.PHP_EOL;
        break;
    case 3:
        echo 'bon'.PHP_EOL;
        break;
}


Measured memory_bytes: 16156
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int K = sc.nextInt();
		
		TreeSet<String> S = new TreeSet<>();
		TreeSet<String> T = new TreeSet<>();
		
		String[] t = s.split("");
		for(String i : t) {
			T.add(i);
		}
		
		for(String i : T) {
			int x = s.indexOf(i);
			int y = 0;
			while(x != -1) {
				for(int j = x; j < s.length(); j++) {
					if(j + 1 - x > K) {
						break;
					}
					S.add(s.substring(x, j + 1));
				}
				y++;
				x = s.indexOf(i, y);
			}
			if(S.size() >= K) {
				break;
			}
		}
		
		int a = 0;
		
		for(String i : S) {
			a++;
			if(a == K) {
				System.out.println(i);
			}
		}
	}
}


Measured memory_bytes: 26068
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()
#define vl vector<lli>
#define pll pair<lli,lli>
#define vpll vector<pll >
const lli MAX=100005;

int main(){
	lli n,k;
	cin>>n>>k;
	lli a[n],b[n];
	loop(i,0,n) cin>>a[i];
	b[0]=0;
	if(n<=k+1){
		cout<<abs(a[n-1]-a[0]);
		return 0;
	}
	loop(i,1,k+1){
		b[i]=abs(a[0]-a[i]);
	}
	loop(i,k+1,n){
		lli alpha=b[i-1]+abs(a[i]-a[i-1]);
		loop(j,i-k,i){
			alpha=min(alpha,b[j]+abs(a[i]-a[j]));
		}
		b[i]=alpha;
	}
	cout<<b[n-1];
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);
bool isPrime(ll n);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;
    char ch,ch2,ch3;
    string s,s1,s2,s3;
    vector<ll> v,w;
    unordered_map<ll,ll> N;
    set<ll> S;
    set<ll> :: iterator itr;
    cin>>n>>k;
    x=0;
    for(i=0;i<n;i++){
        cin>>p;
        if(p>=k){
            x++;
        }
    }
    cout<<x;
    return 0;
}

ll modInv(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

void solve() {
	int n; scanf("%d", &n);
	printf("%d", (n+1)/2);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


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

using namespace std;

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

    vector<int> d(N+1,0);
    for(int i=1;i<=N;i++)
    {
        cin >> d.at(i);
    }

    sort(d.begin(),d.end());

    int answer = d.at(N/2+1) - d.at(N/2);

    cout << answer << endl;

    return 0;
}

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

string check(int d) {
    if (d%7==1) {
        return "Thursday";
    } else if (d%7==2) {
        return "Friday";
    } else if (d%7==3) {
        return "Saturday";
    } else if (d%7==4) {
        return "Sunday";
    } else if (d%7==5) {
        return "Monday";
    } else if (d%7==6) {
        return "Tuesday";
    } else if (d%7==0) {
        return "Wednesday";
    }
}

int main(void){
    int m,d;
    while (cin>>m>>d) {
        if (m==0) {
            break;
        } else {
            if (m==1) {
                cout<<check(d)<<endl;
            } else if (m==2) {
                d=d+31;
                cout<<check(d)<<endl;
            } else if (m==3) {
                d=d+31+29;
                cout<<check(d)<<endl;
            } else if (m==4) {
                d=d+31+29+31;
                cout<<check(d)<<endl;
            } else if (m==5) {
                d=d+31+29+31+30;
                cout<<check(d)<<endl;
            } else if (m==6) {
                d=d+31+29+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==7) {
                d=d+31+29+31+30+31+30;
                cout<<check(d)<<endl;
            } else if (m==8) {
                d=d+31+29+31+30+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==9) {
                d=d+31+29+31+30+31+30+31+31;
                cout<<check(d)<<endl;
            } else if (m==10) {
                d=d+31+29+31+30+31+30+31+31+30;
                cout<<check(d)<<endl;
            } else if (m==11) {
                d=d+31+29+31+30+31+30+31+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==12) {
                d=d+31+29+31+30+31+30+31+31+30+31+30;
                cout<<check(d)<<endl;
            }
        }
    }
}



Measured memory_bytes: 3072
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
char a[1000][1000];
int main()
{
    int n,m,t;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>a[i][j];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            t=0;
            if(a[i][j]=='#')
            cout<<"#";
            else
            {
                if(a[i-1][j+1]=='#') t++;
                if(a[i][j+1]=='#') t++;
                if(a[i+1][j+1]=='#') t++;
                if(a[i-1][j]=='#') t++;
                if(a[i+1][j]=='#') t++;
                if(a[i-1][j-1]=='#') t++;
                if(a[i][j-1]=='#') t++;
                if(a[i+1][j-1]=='#') t++;
                cout<<t;
            }
        }
        cout<<endl;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int n;
vector<int> a;
ll sum =0;
int ans =0;
ll tmp = 1e9;

int main(){
    cin >> n;
    a.resize(n);

    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }

    rep(i,n){
        if(abs(sum- n*a[i]) < tmp){
            tmp = abs(sum- n*a[i]);
            ans = i;
        }
    }

    dunk(ans);
}



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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  /////////////
  string s;
  while(a>0 &&c>0){
    c=c-b;
    if(c<=0){
      s="Yes";
      break;
    }
    else{
      a=a-d;
      if(a<=0){
        s="No";
        break;
      }
    }
  }
  cout<<s<<endl;
}

Measured memory_bytes: 3620
inn = lambda : int(input())
ins = lambda : input().strip()
DBG = True # and False

def ddprint(x):
  if DBG:
    print(x)

import sys,resource
def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(resource.RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  resource.setrlimit(resource.RLIMIT_STACK, (128*1024*1024,hard))

def dfs(l,k):
    global ans
    #ddprint(f"dfs {k=} {l=} - - - -")
    ll = [[] for i in range(26)]
    x = [0]*26
    for z in l:
        #ddprint(f"lsz {ls[z]} {z=} {k=}")
        c = ord(ls[z][-k-1])-orda
        if len(ls[z])==k+1:
            x[c] += 1
        else:
            ll[c].append(z)
    #ddprint(f"{x=} {ll=}")
    for c in range(26):
        for z in l:
            #if len(ls)==2:
            #    ddprint(f" z1 {z[1]} {k=} {c=} fst {first[z[1]][c]}")
            if first[z][c]>=k and len(ls[z])>k+1:
                ans += x[c]
                #if x[c]>0:
                #    ddprint(f"ans += {x[c]}")
    for c in range(26):
        if len(ll[c])>1:
            dfs(ll[c],k+1)

setrlim()
n = inn()
ls = []
first = [[-1]*26 for i in range(n)]
orda = ord('a')
for i in range(n):
    s = ins()
    ls.append(s)
    for c in range(26):
        p = s.find(chr(orda+c))
        first[i][c] = (len(s)-1-p) if p>=0 else -1
#ddprint(f"{ls=}")
#ddprint(f"{first=}")
ans = 0
dfs(list(range(n)),0)
print(ans)


Measured memory_bytes: 361096
if __name__ == '__main__':
    input_line = 1
    for i in range(input_line):
        s = input().rstrip().split(' ')
        H = int(s[0])
        W = int(s[1])
        print(1 if H==1 or W==1 else int(H*W/2) if (H%2==0 or W%2 == 0) else int(H*W/2)+1)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0,tmp;
	cin>>n;
	for(int i=105;i<=n;i+=2){
		tmp=0;
		for(int j=1;j<=n;j+=2)if(i%j==0)tmp++;
		if(tmp==8)ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn f(x: i64, a: i64, b: i64) -> i64 {
    (a * x) / b - a * (x / b)
}

fn main() {
    let mut sc = Scanner::new();
    let a: i64 = sc.cin();
    let b: i64 = sc.cin();
    let n: i64 = sc.cin();
    put!((a*min!(n, b-1))/b);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 2120