akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for (int i = 0;;i++) {
		if (a%2 || b%2 || c%2) {
			printf("%d\n",i);
			break;
		}else if (a == b && b == c) {
			printf("-1\n");
			break;
		}
		int newa = (b+c)/2;
		int newb = (a+c)/2;
		int newc = (a+b)/2;
		a = newa;
		b = newb;
		c = newc;
	}
	return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [int(input()) for _ in range(N)]

ans = A[0] - 1
p = 2

i = 1
while i < N:
    a = A[i]
    if a == p:
        p += 1
    else:
        ans += (a - 1) // p
    i += 1

print(ans)

Measured memory_bytes: 13084
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int maxn = 1000000 + 10;

inline int inc(int a, int b) { return (a + b >= MOD) ? (a + b - MOD) : (a + b); }
inline int dec(int a, int b) { return (a >= b) ? (a - b) : (a + MOD - b); }
inline int mul(int a, int b) { return 1LL * a * b % MOD; }

inline int power(int x, int k) {
	int tmp = 1;
	while(k) {
		if(k & 1) tmp = mul(tmp,x);
		x = mul(x,x);
		k >>= 1;
	}
	return tmp;
}

int n, inv[maxn];
int main() {
//	freopen("data.in","r",stdin);
	int n; scanf("%d", &n);
	int Ans = 0; int inv3 = power(3,MOD - 2), now = 1;
	inv[0] = 0; inv[1] = 1;
	for(int i = 2;i <= n;i ++) inv[i] = mul(dec(MOD,MOD / i),inv[MOD % i]);
	for(int i = 1;i <= n;i ++) {
		now = mul(now,inv3);
    int tmp = mul(now,inv[n - i + 1]);
		Ans = inc(Ans,tmp);
	}
	Ans = mul(Ans,power(n,MOD - 2));
	printf("%d\n", Ans);
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  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^(int b) {mint res = 1;while(b > 0) {if(b&1) {res = (res*(*this));}*this=(*this)*(*this);b>>=1;} return res;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
typedef vector<mint> vm;
typedef vector<vm> vvm;

class Combi {
private:
  v(ll) fac, inv, finv;
  void init(int N) {
    fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
      fac[i] = fac[i - 1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
      finv[i] = finv[i - 1] * inv[i] % MOD;
    }
  }
public:
  Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }
  ll Cmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
  }
  ll Pmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[n - k] % MOD;
  }
};
  
int main() {
  int N,K;
  cin >> N >> K;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  sort(rng(A));
  Combi c(N);
  mint ans = 0;
  rep(i,N) {
    if(N-i>=K) {
      ans -= c.Cmod(N-i-1,K-1) * A[i];
    }
    if(i+1>=K) {
      ans += c.Cmod(i,K-1) * A[i];
    } 
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 2944
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

x = int(input())
for i in range(x, 1000000):
    if is_prime(i):
        print(i)
        break

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,j;
    cin >> n;
    long long dp[n][3] = {},a[n][3];
    for(i = 0; i < n; i++)
    {
        for(j = 0; j < 3; j++)
            cin >> a[i][j];
    }
    dp[0][0] = a[0][0];dp[0][1] = a[0][1];dp[0][2] = a[0][2];
    for(i = 1; i < n; i++)
    {
        for(j = 0; j < 3; j++)
            dp[i][j] = a[i][j] + max(dp[i - 1][(j + 1)%3],dp[i - 1][(j + 2)%3]);
    }
    cout<<max(dp[n - 1][0],max(dp[n - 1][1],dp[n - 1][2]))<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define int long long

using namespace std;
vector <int> a(3);
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>a[0]>>a[1]>>a[2];
    sort(a.begin(),a.end());
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <vector>

using namespace std;

template<class T, class V>
bool dfs(T& g, V& seen, int N, int x, int goal){
    seen[x] = true;

    if(x == goal)
        return true;

    for(int i=0; i<N; i++){
        if(g[x][i] && !seen[i])
           if(dfs(g, seen, N, i, goal))
            return true;
    }
    return false;
}

int main(void){
    int N, M, ans;

    cin >> N >> M;

    vector<vector<int>> g(N,vector<int>(N, 0));
    vector<pair<int, int>> path(M, pair<int, int>(0, 0));
    vector<bool> seen(N, false);

    for(int i=0; i<M; i++){
        int s, t;
        cin >> s >> t;

        s--; t--;
        g[s][t] = g[t][s] = 1;
        path[i].first = s;
        path[i].second = t;
    }

    ans = 0;
    for(int i=0; i<M; i++){
        int x,y;
        x = path[i].first;
        y = path[i].second;

        g[y][x] = g[x][y] = 0;

        for(auto&& x : seen)
            x = false;
        if(dfs(g, seen, N, x, y) == false)
            ans++;
        
        g[y][x] = g[x][y]  = 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char o[120],e[120],a[120];
  int i;
  scanf("%s %s",o,e);
  for(i=0;i<100;i++){
    if(i%2==0){
      a[i]=o[i/2];
    }else{
      a[i]=e[i/2];
    }
  }
  printf("%s",a);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h> 
#define N 105
 
int main(){
  int x,y,n,k,i,j,a[N][N];
 
  for(i=0; i < N; i++){
    for(j=0; j < N; j++){
      a[i][j]=0;
    }
  }
scanf("%d",&n);
  for(i=1; i <=n; i++){
    scanf("%d%d",&x,&k);
    for(j=1; j <=k; j++){
      scanf("%d",&y);
      a[x][y]=1;
    }
  }
 
  for(i=1; i <=n; i++){
    for(j=1; j <=n; j++){
      printf("%d",a[i][j]);
      if(j==n) printf("\n");
      else printf(" ");
    }
  }
 
  return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
long long h[100005],tem;
long long n,a,b;
bool check(long long mid)
{
	long long res=0;
	for(int i=0;i<n;i++)
	{
		tem=(long long)(h[i])-(long long)(mid*b);
		if(tem>0) res+=(long long)(tem/a)+(tem%a!=0);
	}
	return res<=mid;
}
// a
int main()
{
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	a-=b;
	long long l=0,r=1e9,mid,res=1e15;
	while(r>l+1)
	{
		mid=(l+r)/2ll;
		if(check(mid))
		{
			r=mid;
			res=min(mid,res);
		}
		else l=mid;
	}
	cout<<res;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  LL x; cin>>x;
  for(LL i=1;i*i<=x; i++){
  	if(x%i==0){
  		for(LL b = -1e5; b<=1e5;b++){
  			LL a = b+i;
  			LL z = a*a*a*a*a - b*b*b*b*b;
  			if(z==x){
  				cout<<a<<" "<<b<<endl;
  				return 0;
  			}
  		}
  	}
  }
  for(LL i=1;i*i<=x; i++){
  	if(x%i==0){
  		for(LL a = -1e5; a<=1e5;a++){
  			LL b = a-i;
  			LL z = a*a*a*a*a - b*b*b*b*b;
  			if(z==x){
  				cout<<a<<" "<<b<<endl;
  				return 0;
  			}
  		}
  	}
  }
  return 0;
}

Measured memory_bytes: 3648
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("pyramid.in", "r", stdin);*/
#endif
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
	//File();
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e5 + 15;
int dx[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };

int n, k;
ll arr[nn];
ll dp[nn];
int main()
{
	fast();
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	fill(dp, dp + nn, oo*oo);
	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0]);
	for (int i = 2; i < n; i++)
	{
		ll mn = oo*oo;
		for (int j = 1; j <= min({ i, k }); j++)
		{
			mn = min(mn, dp[i - j] + abs(arr[i - j] - arr[i]));
		}
		dp[i] = mn;
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args)throws IOException {
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int zero = 0, one = 0, ans = 0;
        for(int i=0;i<n;i++){
            if(s[i]=='0'){
                if(one>0){
                    one--;
                    ans+=2;
                }else{
                    zero++;
                }
            }  else{
                if(zero>0){
                    zero--;
                    ans += 2;
                }else{
                    one++;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 25936
#[allow(unused_macros)]
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" ) } ; }
#[allow(unused_macros)]
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 ) * } } ; }
#[allow(unused_macros)]
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 ) * } } ; }

fn main() {
    input! {
        N: usize,
        X: i32,
        m: [i32; N],
    }
    let s: i32 = m.iter().sum();
    let min = m.iter().min().unwrap().clone();
    let ret = N as i32 + (X - s) / min;
    println!("{}", ret);
}


Measured memory_bytes: 2072
// ALDS1_3_B 
#include <stdio.h>
#include <string.h>
#define MAX 100005

typedef struct process{
    char name[1000];
    int time;
}P;
P Q[MAX];
int head, tail, n;

int isEmpty(){
    return head==tail;
}
int isFull(){
    return head==(tail+1)%MAX;
}
void enqueue(P x){
    if(isFull()){
        puts("overflow");
        return;
    }
    Q[tail] = x;
    tail = (tail+1)%MAX;
}

P dequeue(){
    if(isEmpty()){
        puts("underflow");
    }
    P x = Q[head];
    head = (head+1)%MAX;
    return x;
}
int main(void){
    int i, q;
    int elaps=0, c;
    P u;
    scanf("%d%d", &n, &q);
    for(i=0; i<n; i++){
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].time);
    }
    head=0, tail=n;
    while(head!=tail){
        u=dequeue();
        c = q<u.time ? q : u.time;
        u.time -= c;
        elaps += c;
        if(u.time > 0)enqueue(u);
        else{
            printf("%s %d\n", u.name, elaps);
        }
    }
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> start(N, 0);
  for (int i = 0; i < 2*M; i++) {
    int spot;
    cin >> spot;
    start.at(spot - 1)++;
  }
  for (int i = 0; i < N; i++) {
    cout << start.at(i) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }

int main(){
    int n;
    string s;
    in(n,s);
    int d,e,f;
    uset<int> kind,kind2,kind3;
    for(int i=0;i<n-2;i++){
        f=stoi(s.substr(i,1));
        if(kind3.count(f))continue;
        kind3.insert(f);
        for(int j=i+1;j<n-1;j++){
            e=10*stoi(s.substr(i,1))+stoi(s.substr(j,1));
            if(kind2.count(e))continue;
            kind2.insert(e);
            for(int k=j+1;k<n;k++){
                d=100*stoi(s.substr(i,1))+10*stoi(s.substr(j,1))+stoi(s.substr(k,1));
                kind.insert(d);
            }
        }
    }
    out(kind.size());
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;++x)
#define Red(x,y,z) for(int x=y;x>=z;--x)
using namespace std;
const int MAXN=5e3+5,Mod=1e9+7;
char buf[1<<12],*p1=buf,*p2=buf,nc;int ny;
inline char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
	x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}int n,g[MAXN],sz[MAXN],F[MAXN][MAXN],t[MAXN];vector<int>G[MAXN];
void DFS(int x,int f){
	F[x][1]=1,sz[x]=1;
	for(auto y:G[x])if(y!=f){
		DFS(y,x);Rep(i,0,sz[x]+sz[y])t[i]=0;
		Rep(i,0,sz[x])Rep(j,0,sz[y])t[i+j]=(t[i+j]+1ll*F[x][i]*F[y][j])%Mod;
		Rep(i,0,sz[x]+sz[y])F[x][i]=t[i];sz[x]+=sz[y];
	}for(int i=2;i<=n;i+=2)F[x][0]=(F[x][0]-1ll*F[x][i]*g[i]%Mod+Mod)%Mod;
}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read();
	Rep(i,1,n-1){
		int x=read(),y=read();
		G[x].push_back(y),G[y].push_back(x);
	}g[0]=1;for(int i=2;i<=n;i+=2)g[i]=1ll*g[i-2]*(i-1)%Mod;
	DFS(1,0);cout<<(Mod-F[1][0])%Mod<<'\n';
	return 0;
}




Measured memory_bytes: 97408
#include<iostream>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
int main(void){
  int maze[2][100][100];
  int n,m;
  int a,b,c,t;
  while(cin>>m>>n,n+m){
    rep(i,n)rep(j,n)rep(k,2)maze[k][i][j]=100000;
    rep(i,m){
      cin>>a>>b>>c>>t;
      maze[0][--a][--b]=c;
      maze[1][a][b]=t;
      maze[0][b][a]=c;
      maze[1][b][a]=t;
    }
    rep(k,n)rep(i,n)rep(j,n)rep(l,2)
      maze[l][i][j]=min(maze[l][i][j],maze[l][i][k]+maze[l][k][j]);
    cin>>m;
    //cout<<endl;rep(i,n)rep(j,n)cout<<maze[1][i][j]<<(j==n-1?'\n':' ');
    
    rep(i,m){
      cin>>a>>b>>c;
      cout<<maze[c][--a][--b]<<endl;
    }
  }
}

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

int main(){

  int N;
  cin>>N;
  int K;
  cin>>K;
  

  int a=0;

  int count=0;
  rep(i,N){

    cin>>a;
    if(a>=K)count++;
    
  }

  cout<<count;
}


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

typedef long long int ll;
const ll INF=10e11+1;

ll f(ll b,ll n){
    if(n<b)return n;
    return f(b,n/b)+n%b;
}

ll rmin(ll r,ll b){
    if(b>1){
        return min(r,b);
    }
    return r;
}

ll mainmain(ll n,ll s){
    if(n<s)return -1;
    ll res=INF;
    if(s==1) res=rmin(res,n);
    if(n==s) res=rmin(res,n+1);

    for(ll i=2; i*i<=n; i++){
        if(f(i,n)==s){
            res=rmin(res,i);
            break;
        }
    }

    for(ll p=1; p*p<=n; p++){
        ll b=(n-s)/p+1;
        if(b!=1 and f(b,n)==s){
            res=rmin(res,b);
        }
    }
    return res==INF?-1:res;
}

int main(){
    ll N,S;
    cin>>N>>S;
    cout<<mainmain(N,S)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unsigned long long int ull;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
const ll MOD=1e9+7;


int main(){
    ll N,T;cin>>N>>T;
    vector<ll> A(N);
    for(int i=0;i<N;++i) cin>>A[i];
    ll mn=INF;
    vector<ll> res(N);
    for(int i=0;i<N;++i){
        if(mn>A[i]) mn=A[i];
        res[i]=A[i]-mn;
    }
    sort(res.begin(),res.end());
    cout<<(int)(upper_bound(res.begin(),res.end(),res[N-1])
    -lower_bound(res.begin(),res.end(),res[N-1]))<<endl;
    return 0;
}

Measured memory_bytes: 4828
#include <stdio.h>
#define NIL -1

struct setu {
  int r;
  int l;
  int p;
 };
struct setu T[100000];
int n,D[100000];

int rec(int,int);
void print(int);

int main(){

  int i,j,id,k,c,l,r;

  scanf("%d",&n);


  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;

  for(i=0;i<n;i++){

    scanf("%d %d",&id,&k);

    for(j=0;j<k;j++){

      scanf("%d",&c);
      if( j==0 ) T[id].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = id;

    }
  }

  for(i=0;i<n;i++){
    if(T[i].p == NIL) r = i;
  }
  rec(r,0);

  for(i = 0;i<n ;i++) print(i);

  return 0;
}

int rec(int u, int p){
   D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p + 1);
}

void print(int u){

  int i,c;

  printf("node %d: ", u);
  printf("parent = %d, ", T[u].p);
  printf("depth = %d, ", D[u]);

  if(T[u].p == NIL ) printf("root, ");

 else if(T[u].l == NIL) printf("leaf, ");

 else printf("internal node, ");

printf("[");

 for(i=0,c = T[u].l ; c !=NIL;i++,c = T[c].r){
  if(i) printf(", ");
  printf("%d",c);
 }
printf("]\n");
}

Measured memory_bytes: 5296
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    string s;
    cin >> s;
    int n = s.size();
    bool f = false;
    if (s[0] == '0' || s[n - 1] == '1')
        f = true;
    rep(i, n - 1) if (s[i] != s[n - i - 2]) f = true;
    if (f)
    {
        cout << -1 << endl;
        return 0;
    }
    vector<int> par(n);
    int pos = n;
    s[n - 1] = '1';
    repr(i, n - 1)
    {
        par[i] = pos;
        if (s[i] == '1')
            pos = i + 1;
    }
    rep(i, n - 1) cout << i + 1 << " " << par[i] << endl;
}

Measured memory_bytes: 2384
//https://atcoder.jp/contests/abc133/tasks/abc133_e

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll mod =  1000000007;
const int N = 100005;

vector < int > g[N];
ll fat[N];

ll fastPow(ll base, ll p)
{
	if(p == 0) return 1LL;
	ll x = fastPow(base, p >> 1);
	x = (x * x)%mod;
	if(p & 1) x = (x * base)%mod;
	return x;
}	

ll dfs(int u, int p, const int k)
{
	ll ans = 1LL;
	int rem = k - (p != -1) - 1;
	int children = g[u].size() - (p != -1);

	if(rem < children) return 0LL;
	ans = (ans * (fat[rem] * fastPow(fat[rem-children], mod-2))%mod)%mod;

	for (int v : g[u])
	{
		if(v == p) continue ;
		ans = (ans * dfs(v, u, k))%mod;
	}

	return ans;
}

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	fat[0] = 1LL;
	for (int i=1; i<=k; i++){
		fat[i] = (fat[i-1] * i)%mod;
	}
	for (int i=0; i<n-1; i++){
		int u, v;
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ll ans = (k * dfs(1, -1, k))%mod;
	printf("%lld\n", ans);
}

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

int x,y;

struct grid{
  char g[11][11];
  int count;
};

void DFS(grid& gr,char firstcell,char changecolor,int posx,int posy){

  if(posx < 0 || posx >= x  || posy < 0 || posy >= y || gr.g[posx][posy] != firstcell){
    return;
  }

  gr.g[posx][posy] = changecolor;

  DFS(gr,firstcell,changecolor,posx+1,posy);
  DFS(gr,firstcell,changecolor,posx-1,posy);
  DFS(gr,firstcell,changecolor,posx,posy+1);
  DFS(gr,firstcell,changecolor,posx,posy-1);
}

int main(){

  while(1){

    cin >> x >> y;

    if(x==0 && y==0){
      break;
    }

    grid start;

    for(int i=0; i<y; i++){
      for(int j=0; j<x; j++){
        cin >> start.g[j][i];
      }
    }

    char firstcell = start.g[0][0];

    bool flag = true;

    for(int i=0; i<y; i++){
      for(int j=0; j<x; j++){
        if(start.g[j][i]!=firstcell){
          flag = false;
          break;
        }
      }
      if(!flag){
        break;
      }
    }
    if(flag){
      cout << 0 << endl;
      continue;
    }

    start.count = 0;

    queue<grid> q;

    q.push(start);

    while(1){

      grid BeforeGrid = q.front();
      q.pop();

      BeforeGrid.count++;

      grid tmp = BeforeGrid;

      firstcell  = tmp.g[0][0];

      if(firstcell != 'R'){
          DFS(tmp,firstcell,'R',0,0);

          flag = true;
          for(int i=0; i<y; i++){
            for(int j=0; j<x; j++){
              if(tmp.g[j][i]!='R'){
                flag = false;
                break;
              }
            }
            if(!flag){
              break;
            }
          }
          if(flag){
            cout << tmp.count << endl;
            break;
          }

          q.push(tmp);
          tmp = BeforeGrid;
      }

      if(firstcell != 'G'){
          DFS(tmp,firstcell,'G',0,0);

          flag = true;
          for(int i=0; i<y; i++){
            for(int j=0; j<x; j++){
              if(tmp.g[j][i]!='G'){
                flag = false;
                break;
              }
            }
            if(!flag){
              break;
            }
          }
          if(flag){
            cout << tmp.count << endl;
            break;
          }

          q.push(tmp);
          tmp = BeforeGrid;
      }

      if(firstcell != 'B'){
          DFS(tmp,firstcell,'B',0,0);

          flag = true;
          for(int i=0; i<y; i++){
            for(int j=0; j<x; j++){
              if(tmp.g[j][i]!='B'){
                flag = false;
                break;
              }
            }
            if(!flag){
              break;
            }
          }
          if(flag){
            cout << tmp.count << endl;
            break;
          }

          q.push(tmp);
          tmp = BeforeGrid;
      }

    }






  }


    return 0;
}

Measured memory_bytes: 18592
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
using namespace std;

int main(){
  long long n,m;
  cin >> n >> m;
  long long count = n*m;
  if (min(n,m) == 1) count = abs(count-2);
  else{
    count -= 2*(n-1) + 2*(m-1);
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++) cout << 'x';
}
int main(){
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
rest = []
for i in range(N):
    c, s = input().split()
    s = -int(s)
    rest.append([c, s, i])

rest = sorted(rest, key=lambda x: [x[0], x[1]])
for r in rest:
    print(r[2]+1)


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int& a : A) cin >> a;
  long ans = A[0] / 2; A[0] %= 2;
  for (int i = 1; i < A.size(); i++) {
    if (A[i-1] == 1 && 0 < A[i]) {
      ans++;
      A[i]--;
    }
    ans += A[i] / 2; A[i] %= 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
 
#define MAX 1000
#define MIN 1
 
using namespace std;
 
bool right(int a,int b,int c) {
 if(((a * a) + (b * b)) == (c * c)) {
  return true;
 } else {
  return false;
 }
}

int main() {
 int i = 0,j;
 int n;
 int side[3];
 bool cnt = false;
 vector<string> judge;
 
 cin >> n;
 
 while(i < n) {
  cin >> side[0] >> side[1] >> side[2];
 
  for(j = 0;j < 3;++j) {
   if((side[j] < MIN) || (side[j] > MAX)) {
    cnt = true;
   }
  }
 
  if(cnt == true) continue; 
 
  sort(side, side + 3);
 
  if(right(side[0],side[1],side[2]) == true) {
   judge.push_back("YES");
  } else {
   judge.push_back("NO");
  }

  ++i;
 }
 
 for(i = 0;i < judge.size();++i) {
  cout << judge.at(i) << endl;
 }
 
 return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(x) x.begin(), x.end()
#define lp(i, n) for (int i = 0; i < n; i++)
#define mem(a, v) memset(a, v, sizeof(a))
#define X real()
#define Y imag()
#define angle(a) (atan2(a.Y, a.X))
#define vec(a, b) ((b) - (a))
//#define length(a) (hypot(a.Y , a.X))
#define normalize(a) (a) / length(a)
#define dotP(a, b) ((conj(a) * b).X)
#define crossP(a, b) ((conj(a) * b).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(a) dotP(a, a)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(v, m) conj(v / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll n, ll x) {
  if (!x)
    return 1;
  if (x % 2)
    return n * fastpow(n, x - 1);
  ll p = fastpow(n, x / 2);
  p %= mod;
  p *= p;
  p %= mod;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll ret = num % mod;
  while (ret < 0)
    ret += mod;
  return ret;
}

ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
long double dist(pair<ll, ll> &a, pair<ll, ll> &b) {
  return sqrt(
      ((a.f - b.f) * (a.f - b.f) * 1.0 + (a.se - b.se) * (a.se - b.se)));
}
/*vector<int> ap;
bool np[MX];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <MX; j+=i) np[j] = 0;
        }
    }
    for(ll i = 2 ; i< MX ; i++) if(np[i]) ap.pb(i);
}*/
const ll MX = 1e5+5;
vector<int> arr(3005);    
ll dp[3005][3005][2];
int n;
ll solve(int l , int r,bool turn){
	if(l > r) return 0;
	ll &ret = dp[l][r][turn];
	if(~ret) return ret;
	if(turn)ret = max(solve(l+1,r,!turn) + arr[l] , solve(l,r-1,!turn) + arr[r]);
	else ret = min(solve(l+1,r,!turn) - arr[l] , solve(l,r-1,!turn) - arr[r]);
	return ret;
}
int main()
{
    IO;
    cin>>n;
    ll s= 0;
    for(int i = 0 ;i<n ;i++){
		 cin>>arr[i];
		s+=arr[i];
	}
	mem(dp,-1);
	cout<<solve(0,n-1,1);
    return 0;
}



Measured memory_bytes: 141568
/*
title:D - Practical Skill Test

url:

二次元配列の要素がすべて異なるという、少し変わった（？）条件があるので、
1次元配列に変換して、計算量を減らすことができる。
ただ、それだけではダメで、累積和をとってさらに計算量を減らさないといけない。
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

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

int main()
{
    int h, w, d;
    cin >> h >> w >> d;
    pint *data = (pint *)malloc(sizeof(pint) * (300 * 300 + 1));
    REP(i, h)
    {
        REP(j, w)
        {
            int tmp;
            scanf("%d", &tmp);
            data[tmp] = make_pair(i, j);
        }
    }
    int *cm_sum = (int *)malloc(sizeof(int) * (300 * 300 + 1));
    for (int i = 0; i < d; i++)
    {
        cm_sum[i] = 0;
    }
    for (int i = d + 1; i <= h * w; i++)
    {
        int next = i;
        int pre = next - d;
        cm_sum[i] = abs(data[pre].first - data[next].first) +
                    abs(data[pre].second - data[next].second);
        cm_sum[i] += cm_sum[i - d];
    }

    int q = 0;
    cin >> q;
    pint problem[q];
    REP(i, q)
    {
        int l, r;
        scanf("%d %d", &l, &r);
        problem[i] = make_pair(l, r);
    }
    REP(i, q)
    {
        int ans = cm_sum[problem[i].second] - cm_sum[problem[i].first];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
N, K, Q =map(int, input().split())

A = {}
for i in range(Q):
    a = int(input())
    if a in A:
        A[a] += 1
    else:
        A[a] = 1

for i in range(N):
    if K - Q > 0:
        print("Yes")
    elif (i + 1) in A:
        if (K - (Q -A[i + 1])) > 0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  ll ans=0;
  rep(i,n){
     ans=ans^a.at(i);
  }
  rep(i,n){
    ll p=ans;
    p=ans^a.at(i);
    cout << p << " ";
  }
}

Measured memory_bytes: 4752
from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N,M = (int(_) for _ in input().split())
    if(M<2):
        print(0)
        exit()
    if N>M//2:
        N = N-(N - M//2)
    ans = (N*2 + M)//4
    # while True:
    #     N = N -1
    #     M = M -2
    #     ans = ans + 1
    #     if(N<=0 or M<=0):
    #         break
    # if(N<=0 and M>0):
    #     ans = ans + M//4
             
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N;
vector<int> a;

bool C(int m) {
  if (m == -1) return false;

  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (i <= m) {
      sum += a[i];
    } else if (sum * 2 >= a[i]) {
      sum += a[i];
    } else {
      return false;
    }
  }

  return true;
}

signed main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    a.pb(tmp);
  }

  sort(ALL(a));

  int ok = N - 1, ng = -1;
  for (int i = 0; i < 50; i++) {
    int mid = (ok + ng) / 2;
    if (C(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  cout << N - ok << endl;
  return 0;
}


Measured memory_bytes: 1400
H, W, K = map(int, input().split(' '))
ls, result = [], 0
for i in range(H):
    ls.append(input())

for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '#':
                    cnt += 1
        if cnt == K:
            result += 1
print(result)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int a, b;
	cin>>a>>b;
	REP(i, 100){
		if(i*(a-1)+1>=b){
			cout<<i<<'\n';
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	S := readInt()
	H := S / 100
	L := S % 100

	if mm(H) {
		if mm(L) {
			println("AMBIGUOUS")
		} else {
			println("MMYY")
		}
	} else {
		if mm(L) {
			println("YYMM")
		} else {
			println("NA")
		}
	}
}

func mm(a int) bool {
	if 1 <= a && a <= 12 {
		return true
	}
	return false
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include<stdio.h>

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


Measured memory_bytes: 2084
import java.io.*;

class Main{
    public static void main(String[] a){
        StringBuffer sb = new StringBuffer(1024);
        for(int i=1; i<=9; i++)
            for(int j=1; j<=9; j++)
                sb.append(i).append("x").append(j).append("=").append(i*j).append("\n");
        System.out.print(sb);
    }
}

Measured memory_bytes: 23860
N=int(input())
D=[]
for i in range(N):
  x=int(input())
  D.append([x,i+1])

C=sorted(D)  
for i in range(N):
  C[i].append(i+1)

cnt=0
for a,b,c in C:
  if (abs(b-c))%2==1:
    cnt+=1
print(cnt//2)

Measured memory_bytes: 27112
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long int
#define pi 3.1415926536
using namespace std;

/*ll merge(vector<ll> &v,ll l,ll m,ll r)
{
	ll n1=m-l+1;
	ll n2=r-m;
	ll inv=0;
	vector<ll> a(n1),b(n2);
	for(ll i=0;i<n1;i++)
	a[i]=v[l+i];
	for(ll i=0;i<n2;i++)
	b[i]=v[m+1+i];
	ll i=0,j=0,k=l;
	while(i<n1&&j<n2)
	{
		if(a[i]<=b[j])
		{
			v[k]=a[i];
			i++;
		}
		else
		{   inv+=(m-i+1);
			v[k]=b[j];
			j++;
		}
		k++;
	}
	while(i<n1)
	{
		v[k]=a[i];
		i++;
		k++;
	}
	while(j<n2)
	{
		v[k]=b[j];
		j++;
		k++;
	}
	return inv;
}
ll mergesort(vector<ll> &v,ll l,ll r)
{  ll inv=0;
	if(l<r)
	{
		ll m=l+(r-l)/2;
		inv=mergesort(v,l,m);
		inv+=mergesort(v,m+1,r);
		inv+=merge(v,l,m,r);
	}
	return inv;
}*/
void solve()
{ll t,n,k,x,y,ans,z,d=0,p,q,l=INT_MIN,mini=0,prev;
  cin>>k>>x;
  z=x-(k-1);
  y=x+(k-1);
  for(ll i=z;i<=y;i++)
  cout<<i<<" ";
}

int main()
{
  fast
ll t=1;

while(t--)
{solve();
 //cout<<ma<<endl;
}
return 0;}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> K;
	while (K--) {
		string s, t;
		cin >> s >> t;
		int b = 0, c = 0;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '1')b = i;
			if (t[i] == '1')c = i;
		}
		int ans = 0;
		while (s != t) {
			if (b > c) {
				b--;
				ans++;
				s[b] = '1';
				s[b + 1] = '0';
			}
			else if (c > b) {
				c--;
				ans++;
				t[c] = '1';
				t[c + 1] = '0';
			}
			else {
				ans += 2;
				b--, c--;
				s[b] = t[c] = '1';
				s[b + 1] = t[c + 1] = '0';
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define maxN 52
#define ll long long
using namespace std;

int n;
ll a[maxN];

ll k;
void lastOp(int N)
{
    for (int i = 1; i <= N; ++ i)
        {
            int posMax = 1;

            for (int j = 2; j <= n; ++ j)
                    if (a[j] > a[posMax])
                posMax = j;
            if (a[posMax] < n)
            return ;
            ++ k;
            a[posMax] -= n + 1;
            for (int j = 1; j <= n; ++ j)
                ++ a[j];
        }
}
ll nrOp(ll m)
{
    ll ret = 0;
    for (int i = 1; i <= n; ++ i)
        if (a[i] > m)
       ret += (a[i] - m - 1) / (n + 1) + 1;
       return ret;
}
ll bs()
{
    sort(a + 1, a + n + 1);
    ll i = a[n], p = 1LL << 59;
    while (p)
    {
        if (i >= p && nrOp(i - p) <= k)
            i -= p;
        p >>= 1;
    }
    return i;
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++ i)
        {
            scanf("%lld", &a[i]);
            k += a[i];
        }
    if (k <= n * n)
        {
            int cp = k;
            k = 0;
            lastOp(cp);
        }
    else
    {
        k -= n * n;
        for (int i = 1; i <= n; ++ i)
            a[i] += k;
        ll m = bs(), newK = nrOp(m);

        for (int i = 1; i <= n; ++ i)
            if (a[i] > m)
        a[i] -= ((a[i] - m - 1) / (n + 1) + 1) * (n + 1);
         for (int i = 1; i <= k - newK; ++ i)
            {
                sort(a + 1, a + n + 1);
                a[n] -= n + 1;
            }
        lastOp(n * n);
    }
    printf("%lld\n", k);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000

int gcd(int x, int y){
	if (x > y)swap(x, y);
	if (x <= 0)return y;
	if (y%x == 0)return x;
	return gcd(y%x, x);
}

int main(){
	int n, x, ans;
	ans = 0;
	scanf("%d", &n);
	f(i, n){
		scanf("%d", &x);
		ans = gcd(ans, x);
	}
	printf("%d\n", ans);
		return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<lint> a(n);
    lint x = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 2; i < n; ++i) {
        x ^= a[i];
    }
    map<array<lint, 3>, lint> cache;
    function<lint(lint, lint, lint)> dfs = [&](lint a, lint b, lint x) {
        if (cache.count({a, b, x}) == 1)
            return cache[{a, b, x}];
        if (((a & 1) ^ (b & 1)) != (x & 1))
            return inf;
        if (a == 1 || a == 0) {
            if ((a ^ b) == x)
                return 0LL;
            else
                return inf;
        }
        lint c = inf, d = inf;
        if (a != 0)
            c = dfs((a - 1) >> 1, (b + 1) >> 1, x >> 1) * 2 + 1;
        d                       = dfs((a) >> 1, (b) >> 1, x >> 1) * 2;
        return cache[{a, b, x}] = min({inf, c, d});
    };
    lint ret = dfs(a[0], a[1], x);
    if (ret == inf)
        cout << -1 << "\n";
    else
        cout << ret << "\n";
    return 0;
}


Measured memory_bytes: 3596