akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
#include <algorithm>
#define INF 1000000000
using namespace std;

int n, m;
int dp[150][80][10];
vector<int> pos[150];
vector<int> risk[150];

int Abs(int x, int y){
	if(x > y) return x-y;
	else return y-x;
}

void solve(){
	for(int i = 0; i < 150; i++){
		pos[i].clear();
		risk[i].clear();
		for(int j = 0; j < 10; j++){
			for(int k = 0; k < 80; k++){
				if(i == 0 && k == 0) dp[i][k][j] = 0;
				else if(i == 1 && k == 1) dp[i][k][j] = 0;
				else dp[i][k][j] = INF;
			}
		}
	}
	for(int i = 0; i < n; i++){
		int t; scanf("%d", &t);
		for(int j = 0; j < t; j++){
			int x, d; scanf("%d%d", &x, &d);
			x--;
			pos[i].push_back(x);
			risk[i].push_back(d);
		}
	}
	for(int i = 0; i < n-1; i++){
		for(int j = 0; j <= m; j++){
			for(int k = 0; k < risk[i+1].size(); k++){
				for(int l = 0; l < risk[i].size(); l++){
					dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][l]+(risk[i+1][k]+risk[i][l])*Abs(pos[i+1][k],pos[i][l]));
				}
			}
		}
		if(i != n-2){
			for(int j = 0; j <= m-1; j++){
				for(int k = 0; k < risk[i+2].size(); k++){
					for(int l = 0; l < risk[i].size(); l++){
						dp[i+2][j+1][k] = min(dp[i+2][j+1][k],dp[i][j][l]+(risk[i+2][k]+risk[i][l])*Abs(pos[i+2][k],pos[i][l]));
					}
				}
			}
		}
	}
	int ans = INF;
	for(int i = 0; i <= m; i++){
		for(int j = 0; j < risk[n-1].size(); j++){
			ans = min(dp[n-1][i][j],ans);
		}
	}
	for(int i = 0; i < m; i++){
		for(int j = 0; j < risk[n-2].size(); j++){
			ans = min(dp[n-2][i][j],ans);
		}
	}
	/*
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= m; j++){
			for(int k = 0; k < risk[i].size(); k++){
				printf("%d ", dp[i][j][k]);
			}
			printf("\n");
		}
		printf("\n");
	}
	*/
	printf("%d\n", ans);
}

int main(){
	while(scanf("%d%d", &n, &m),n||m) solve();
}

Measured memory_bytes: 1556
N,K = map(int,input().split())
 
#奇数の時
if K%2:
    a = N//K
    print(a**3)
#偶数の時
else:
    #Nまででa,b,cそれぞれがKで割り切れる数(割り切れる数同士の和も割り切れる)
    a = N//K
    #あまりがk/2(和がkの倍数になる場合)
    b = (N+K//2)//K
    print(a**3 + b**3)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll n,k;
vector<ll>a((ll)3e5);
bool isOK(ll x){
    ll c=0;
    rep(0,i,n){
        c+=(a[i]+x-1)/x-1;
        if(c>k){
            return false;
        }
    }
    return true;
}
int main(void){
    cin>>n>>k;
    rep(0,i,n)cin>>a[i];
    ll ng=1,ok=2e9;
    if(isOK(1)){
        cout<<1;
        return 0;
    }
    while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(isOK(mid))ok=mid;
        else ng=mid;
    }
    cout<<ok;
}

Measured memory_bytes: 5448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string S; cin>>S;
  rep(i,S.length()) cout<<"x";
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
import bisect

def make_tree(n):
    i = 2
    while True:
        if i >= n * 2:
            tree = [0] * i
            break
        else:
            i *= 2
    return tree

def update(i, x):
    i += len(tree) // 2
    tree[i] = x
    i //= 2
    while True:
        if i == 0:
            break
        tree[i] = tree[2 * i] + tree[2 * i + 1]
        i //= 2
    return

def find(s, t):
    s += len(tree) // 2
    t += len(tree) // 2
    ans = 0
    while True:
        if s > t:
            break
        if s % 2 == 0:
            s //= 2
        else:
            ans += tree[s]
            s = (s + 1) // 2
        if t % 2 == 1:
            t //= 2
        else:
            ans += tree[t]
            t = (t - 1) // 2
    return ans

n, k = map(int, input().split())
a = [int(input()) for _ in range(n)]
s = [0] * (n + 1)
for i in range(n):
    s[i + 1] += s[i] + a[i]
for i in range(n + 1):
    s[i] -= k * i
d = dict()
for i in s:
    if not i in d:
        d[i] = 1
    else:
        d[i] += 1
x = list(d.keys())
x.sort()
tree = make_tree(len(x))
for i in range(len(x)):
    update(i, d[x[i]])
cnt = 0
l = len(tree) // 2
for i in s:
    b = bisect.bisect_left(x, i)
    update(b, tree[l + b] - 1)
    cnt += find(b, l - 1)
print(cnt)

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

#define int long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (long long)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 500005


int32_t main(){
sp;
int n,m;
cin>>n>>m;
pq<int,vector<int>,greater<int> > q;
for(int i=0;i<n; ++i){
    int x;
    cin>>x;
    q.push(x);
}
vector<pi> v(m);
for(int i=0; i<m; ++i)
    cin>>v[i].s>>v[i].f;
    sort(v.rbegin(),v.rend());
    for(auto &it:v){
            int b=it.s;
            int c=it.f;
    while(b--&&q.empty()==0&&q.top()<c){
        q.pop();
        q.push(c);
    }
}
int sum=0;
while(!q.empty()){
       // cout<<q.top()<<" ";
    sum+=q.top();
    q.pop();
}
cout<<sum;
return 0;}


Measured memory_bytes: 2676
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using P = pair<int, int>;

signed main() {

    int n;
    cin >> n;

    int m = n % 10;

    if(m == 3){
        cout << "bon" << endl;
    }
    else if(m == 2 || m == 4 || m == 5 || m == 7 || m == 9){
        cout << "hon" << endl;
    }
    else{
        cout << "pon" << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;

int dp[100005];

int main()
{
    int n; cin >> n;
    vector<int> a;
    for(int i = 0; i <n; i++)
    {
        int x; cin >> x;
        a.push_back(x);
    }
    dp[0] = 0; dp[1] = abs(a[0]-a[1]);
    for(int i = 2; i < n; i++)
        dp[i] =  min(dp[i-1] + abs(a[i-1]-a[i]), dp[i-2] + abs(a[i-2]-a[i]));
    cout << dp[n-1];
}


Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

const double trsf=180.0/3.14159;
int main(){
    double a,b,x;
    cin>>a>>b>>x;
    cout<<fixed<<setprecision(10);
    if(x<=a*a*b/2.0){
        double ans=trsf*atan(a*b*b/(2*x));
        cout<<ans<<endl;
    }else{
        cout<<trsf*atan(2*(a*a*b-x)/(a*a*a))<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
    int a,b,c,d;
    int flag=0;
    while(cin>>a>>b>>c>>d){
        flag=0;
        if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d)){
            flag=1;
        }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String o = sc.next();
		String e = sc.next();
		for(int i = 0; i < o.length(); i++) {
			System.out.print(o.charAt(i));
			if(i < e.length()) {
				System.out.print(e.charAt(i));
			}
		}
	}
}

Measured memory_bytes: 23636
#include<iostream>
#include <vector>
#include <cstring>
#define Long long long int
#define For(i,a,b) for(int i=a;i<=b;i++)
#define ForR(i,a,b) for(int i=a;i>=b;i--)
#define e5 100009
#define maxD 10
using namespace std;

vector<int> ke[e5];
bool isCalled[e5][maxD+1];
int v[e5],d[e5],c[e5];
int color[e5];
int currentColor=0;
void PaintColor(int vertex, int distance){
//	printf(" vertex %d distance %d " , vertex, distance);
	For(i,distance,maxD){
		if(isCalled[vertex][i] == true){
			return;
		}
	}
//	printf(" vertex %d distance %d\n" , vertex, distance);
	isCalled[vertex][distance] = true;	
	if(color[vertex]==0){
		color[vertex] = currentColor;
	}	
	if(distance<=0)	{
		return;	
	}
	int v;
	for(int i=0;v=ke[vertex][i];i++){
		PaintColor(v,distance-1);
	}
}
main(){
	For(i,0,e5){
		ke[i].clear();
	}
	memset(color,0,e5);
	For(i,0,e5){
		memset(isCalled[i],false,maxD+1);
	}
	int N,M,Q,ai,bi;
	cin >> N >> M;
	For(i,1,M){
		scanf("%d%d",&ai,&bi);		
		ke[ai].push_back(bi);
		ke[bi].push_back(ai);
	}
	cin >> Q;
	For(i,1,Q){
		scanf("%d%d%d",v+i,d+i,c+i);
	}	
	For(i,1,N){
		ke[i].push_back(0);
	}	
//	cout << "ke4:";
//	for(int i=0;int v=ke[4][i];i++){
//		cout << v << ",";
//	}
	ForR(i,Q,1){		
		currentColor = c[i];
		PaintColor(v[i],d[i]);		
//		printf("");
	}
	For(i,1,N){
		printf("%d\n",color[i]);
	}
}

Measured memory_bytes: 9080
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vi d(n); rep(i, n) cin >> d[i];
	sort(all(d));
	
	int ans = 0;
	for(int i = n - 1; i > 0; i--) if(d[i] != d[i - 1]){
		if(n - i == n / 2){
			ans += d[i] - d[i - 1];
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#define Max(a,b) a>b?a:b
int main(void)
{
    int n;
    scanf("%d",&n);
    int hotels_height[n];
    
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &hotels_height[i]);
    }
    int count = 0;
    int max = 0;
    for(int i = 0; i < n; i++)
    {
        max = Max(max, hotels_height[i]);
        if(hotels_height[i] - max >= 0)
        {
            count++;
        }
    }
    printf("%d\n",count);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string matrix[3];
  	for (int i = 0; i < 3; i++){
    	cin >> matrix[i];
    }
  	for (int i = 0; i < 3; i++){
    	cout << matrix[i][i];
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(){
  int n,q;
  int *S,*T,B[1000000];
  int i,u;
  int l,m,r;
  int count=0,flag,key;
  
  scanf("%d",&n);
  S=(int *)malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  T=(int *)malloc(q*sizeof(int));
  for(i=0;i<q;i++) scanf("%d",&T[i]);


  for(i=0;i<q;i++){
    key=T[i];
    l=0;
    r=n+2;
    m=(r+l)/2;
    flag=0;

    for(u=0;u<count;u++){
      if(B[u]==key){
	flag=1;
	break;
      }
    }
    
    while(r>l){
      if(flag==1) break;
      if(key==S[m]){
	B[count++]=key;
	break;
      }
      else if(key<S[m]){
	r=m;
	m=(r+l)/2;
      }else if(key>S[m]){
	l=m+1;
	m=(r+l)/2;
      }
    }

  }

  printf("%d\n",count);

  free(S);
  free(T);
  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;

int main(void){
    long N;
    cin >> N;
    N = N % 10;
    if(N == 3){
        cout << "bon" << endl;
    }else if(N == 0 || N == 1|| N == 6|| N == 8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
N = input()
dp = [[0]*2 for _ in range(1001000)]
dp[0][1] = 1
for i in range(len(N)):
    d = int(N[i])
    dp[i+1][0] = min(dp[i][0] + d, dp[i][1] + 10-d)
    dp[i+1][1] = min(dp[i][0] + d + 1, dp[i][1] + 10-d-1)  # もらいすぎている状態を維持する
ans = dp[len(N)][0]
print(ans)


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

using namespace std;

#define max 150

struct rect{
	int w;
	int h;
	int l;	//対角線の長さの2乗

	//sortを用いるために演算子 < をオーバーライドする
	bool operator<( const rect& right ) const {
        return l == right.l ? h < right.h : l < right.l;
    }
};

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	//長方形テーブル作成
	vector<rect> v;

	for(int i = 1; i <= max; i++) {
		for(int j = i + 1; j <= max; j++) {
			rect r;
			r.h = i;
			r.w = j;
			r.l = i * i + j * j;
			v.push_back( r );
		}
	}

	//長方形をソート
	sort( v.begin(), v.end() );


	while(1) {
		int w, h;
		cin >> h >> w;
		if( h == 0 && w == 0 ) break;


		int ans = -1;
		for(int i = 0; i < v.size(); i++) {
			if( h == v.at(i).h && w == v.at(i).w ) {
				ans = i + 1;
				break;
			}
		}
		cout << v.at( ans ).h << " " << v.at( ans ).w << endl;

	}

	//while(1){}

	return 0;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

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


  ll n,d;cin>>n>>d;
  int ans=0;
  for(int i=0;i<n;i++){
    ll x,y;cin>>x>>y;
    if(d*d>=x*x+y*y){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    long W,H,x,y;
    cin >> W>>H>>x>>y;

    int count = 2*x == W && 2*y == H ? 1 : 0;
    cout << fixed << setprecision(10) << (W*H)/2.0 << " " << count << endl;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np


def main():
	n,a,b=map(int,input().split())
	
	if (b-a)%2==0:
		print((b-a)//2)
	else:
		ma=max(a,b)
		mi=min(a,b)
		ko1=min(n-mi,ma-1)
		
		ko2=n-ma+1+(n-(mi+(n-ma+1)))//2
		ko3=mi-1+1+((ma-(mi-1+1))-1)//2
		
		print(min(ko1,ko2,ko3))
		
		
		
	
	
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 38384
/*
* welcome to my code!
* ------------------------------------------
* author : lynmisakura(twitter : @andoreiji11)
*/

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

using ll = long long;

// macro templates

#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < n;i++)
#define dv(TYPE,VAL) TYPE VAL;cin >> VAL;
#define vi(TYPE,NAME,SIZE,INIT) vector<TYPE> NAME(SIZE,(INIT))
#define vin(TYPE,NAME,SIZE) vector<TYPE> NAME(SIZE);rep(i,SIZE)cin >> NAME[i]
#define vout(ARRAY) for(auto i : ARRAY)cout << i << ' ';cout << '\n'
#define vvi(TYPE,NAME,LOW,COL,INIT) vector<vector<TYPE>> NAME(LOW,vector<TYPE>(COL,INIT))
#define vpi(T1,T2,NAME,SIZE,I1,I2) vector<pair<T1,T2>> NAME(SIZE,make_pair(I1,I2))
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define dup(x,y) (x + y - 1)/(y)
#define sz(v) (int64_t)v.size()
#define CUM(arr,cum) vector<ll> cum(sz(a)+1,0); rep(i,sz(a)) cum[i+1] = cum[i] + 1
#define PY(COND) if(COND){cout << "YES" << '\n';return;}
#define PN(COND) if(COND){cout << "NO" << '\n';return;}
#define PYN(COND) cout << ((COND) ? "YES" : "NO") << '\n';
#define Py(COND) if(COND){cout << "Yes" << '\n';return;}
#define Pn(COND) if(COND){cout << "No" << '\n';return;}
#define Pyn(COND) cout << ((COND) ? "Yes" : "No") << '\n';return

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pi acos(-1)
#define fi first
#define se second
#define pq priority_queue

#define MULTITEST; int t;cin >> t;rep(_,t)main2();
#define IOB; cin.tie(0);ios::sync_with_stdio(false);

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

// templates end

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

    int64_t x,y;cin >> x >> y;
    rep(i,200)rep(j,200){
        if(i + j == x && 2 * i + 4 * j == y){
            cout << "Yes" << '\n';
            return 0;
        }
    }
    cout << "No" << '\n';
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e8,cnt;


int main(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d);
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  ll N, K;
  while (cin >> N >> K) {
    int res = 0;
    while (N > 0) {
      ++res;
      N /= K;
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n;
ll m,a[N],b[N];
int main()
{
    scanf("%d%lld",&n,&m);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    ll p=1,s=1;
    bool f=false;
    for(int i=1;i<=n;i++)
    {
        b[i]=a[i]/2;
        p=p/__gcd(p,(ll)b[i])*b[i];
        s=s/__gcd(s,(ll)a[i])*a[i];
        if(s>m)
        {
            f=true;
        }
        if(p>m)
        {
            printf("0\n");return 0;
        }
    }
    for(int i=1;i<=n;i++)
    {
        assert(s/b[i]%2==0);
        if(p/b[i]%2==0)
            {printf("0\n");return 0;}
    }
    if(f)
    {
        cout<<1<<endl;return 0;
    }
    assert(s/p==2);
    ll ans=(m-p)/s+1;
    printf("%lld\n",ans);
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

#define DEB1(x) std::cout << (x) << std::endl;

int n;
std::pair<int, int> arr[501];
int cntl[501], cntr[501];

int main() {
    std::cin >> n;

    for(int i = 0; i < n; ++i) {
        cntl[i] = i;
        cntr[i] = n - i - 1;
        std::cin >> arr[i].first;
        --arr[i].first;
        arr[i].second = i;
    }
    std::sort(arr, arr + n);

    int a = 0, b = 0;
    std::vector<int> vec;
    vec.reserve(n * n);
    for(int i = 0; i < n * n; ++i) {
//        DEB1(b)
        if(a != n && i == arr[a].first) {
            if(cntl[arr[a].second] != 0) {
                std::cout << "No" << std::endl;

                return 0;
            }

            vec.push_back(arr[a].second + 1);
            ++a;
        }else if(b < n) {
            while(cntl[arr[b].second] == 0) {
                ++b;

                if(n <= b) {
                    goto SECOND;
                }
            }
            
            --cntl[arr[b].second];
            vec.push_back(arr[b].second + 1);
        }else {
            SECOND:;
            while(b - n < n && cntr[arr[b - n].second] == 0) ++b;
            if(b - n >= a) {
                std::cout << "No" << std::endl;

                return 0;
            }
            --cntr[arr[b - n].second];
            vec.push_back(arr[b - n].second + 1);
        }
    }
    if(vec.size() != n * n) {
        std::cout << "No" << std::endl;

        return 0;
    }

    for(int i = 0; i < n; ++i) {
        if(cntl[i] != 0 || cntr[i] != 0) {
            std::cout << "No" << std::endl;

            return 0;
        }
    }

    std::cout << "Yes" << std::endl;
    for(int i = 0; i < n * n; ++i) {
        std::cout << vec[i] << (i == n * n - 1 ? "\n" : " ");
    }
}

Measured memory_bytes: 2176
/*
 * RD
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#ifndef rd
#define endl '\n'
#endif
#define deb cout<<"Line: "<<__LINE__<<" plz "
#define pb push_back
#define fi first
#define se second
//#define int long long
typedef long long ll;
#define pii pair<int,int>
#define sz(x) ((int)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define all(con) con.begin(),con.end()
const ll inf=1e18;
const int mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll powm(ll a, ll b, ll m);


void solve()
{
	int n,a,b,te;
	int e=0,m=0,h=0;
	cin>>n>>a>>b;
	for(int i=1; i<=n; i++)
	{
		cin>>te;
		if(te<=a)
			e++;
		else if(te<=b)
			m++;
		else
			h++;
	}
	cout<<min(min(e,m),h)<<endl;
}
signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	auto clk=clock();
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}
ll powm(ll a,ll b, ll m) {
	ll te=1;
	while(b) {
		if(b&1) te=(te*a)%m;
		a=(a*a)%m;
		b>>=1;
	}
	return te;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)

bool b(int N)
{
	int a,i,n,flag;
	
	for(i=1;i<=9;i++)
	{
		flag=0;
		n=N%i;
		if(n==0)
		{
		    a=N/i;
	        if((a<=9)&&(a>=1))
	        {
	        	flag=1;
				return true;
	        }
	        
	    }
	    
	}
	if(flag==0)
	{
	    return false;
	}
	
}

int main()
{
	int N,n,a;
	scanf("%d",&N);
	
	if(b(N)!=false)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define pi acos(-1.0)
#define pb push_back
#define vi vector<int>
#define mapii map<int , int>
#define mapci map<char, int>
#define mapsi map<string,int>
#define FOR(i,n) for(int i = 0;i<n;i++)
#define CP(n) cout<<"Case "<<n<<": "
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
#define MAX 1000007
#define all(x)(x.begin(),x.end())
#define debug(x,c) cout<<x<<": "<<c<<" ";
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
int main()
{
	int n;
	cin>>n;
	ll a[n];
	ll cum[n+1];
	cum[0] = 0;
	for(int i = 0;i<n;i++)
	{
		cin>>a[i];
		cum[i+1] = cum[i]+a[i];
	}
	ll sum = 0;
	ll mod = 1e9 + 7;
	for(int i = 1;i<n;i++)
	{
		sum+=((((a[i-1]%mod)*((cum[n]-cum[i])%mod)))%mod);
		sum%=mod;
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 6672
#include<stdio.h>
#define cls(x,n,i) else if((i)>=(double)(x) && (double)(x)>(n))

int main(void){
  double w;

  while(scanf("%lf",&w)!=EOF){
    if(w>91)printf("heavy\n");
    cls(w,81,91)printf("light heavy\n");
    cls(w,75,81)printf("middle\n");
    cls(w,69,75)printf("light middle\n");
    cls(w,64,69)printf("welter\n");
    cls(w,60,64)printf("light welter\n");
    cls(w,57,60)printf("light\n");
    cls(w,54,57)printf("feather\n");
    cls(w,51,54)printf("bantam\n");
    cls(w,48,51)printf("fly\n");
    else printf("light fly\n");
  } 
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
struct Point{
    double x,y;
};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);  
    double a,b,x;
    const double PI=3.14159265358979323846;
    cin >> a >> b >> x;
    if(2*x<=a*a*b){
        cout << fixed << std::setprecision(10) << (atan2(a*b*b,(2*x))*180/PI) << endl;
    }else if(x==a*a*b){
        cout << 0 << endl;
    }else{
        // cout << 0 << endl;
        cout << fixed << std::setprecision(10) << (atan2(2*(b-x/(a*a)),a)*180/PI) << endl;
    }
}


Measured memory_bytes: 512
D = gets.to_i
c = gets.chomp.split.map(&:to_i)
s = D.times.map{gets.split.map(&:to_i)}

(0..D-1).each do |i|
score = s[i][0] + c[0]
level = 1 
  (1..25).each do |n|
      if score < s[i][n] + c[n]
        score = s[i][n] + c[n]
        level = n+1
      end
  end
puts level
end
    
        
    

Measured memory_bytes: 14368
#include <stdio.h>
  
int main()
{
    int a, b, c, tmp;
    scanf("%d %d %d", &a, &b, &c);
    while(1){
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    else if (b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }
    else if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    else break;
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}  


Measured memory_bytes: 1996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin>>n;
    int a[2][n];
    for (int i=0;i<2;i++)
        for (int j=0;j<n;j++)
            cin>>a[i][j];
    int s[2][n+1];
    s[0][0]=0,s[1][0]=0;
    for (int i=0;i<2;i++)
        for (int j=0;j<n;j++)
            s[i][j+1]=s[i][j]+a[i][j];
    int mx=0;
    for (int i=0;i<n;i++)
        mx=max(mx,s[0][i+1]+s[1][n]-s[1][i]);
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}


#define int long long
int union_tree[100000];
int union_find(int now) {
    if (union_tree[now] == now) return now;
    return union_tree[now] = union_find(union_tree[now]);
}
int union_merge(int a, int b) {
    a = union_find(a);
    b = union_find(b);
    union_tree[a] = b;
    return 1;
}
vector<int> yoko[200000];
vector<int> tate[200000];
void solve() {
    int n, h, w;
    cin >> n >> h >> w;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        yoko[a].push_back(i);
        tate[b].push_back(i);
        union_tree[i] = i;
    }
    REP(i, h) {
        for (int q = 1; q < yoko[i].size(); ++q) {
            union_merge(yoko[i][q - 1], yoko[i][q]);
        }
    }
    REP(i, w) {
        for (int q = 1; q < tate[i].size(); ++q) {
            union_merge(tate[i][q - 1], tate[i][q]);
        }
    }
    int ans = 0;
    int cnt = 0;
    REP(i, n) {
        if (union_find(i) != i) {
            ans++;
            continue;
        }
        cnt++;
    }
    if (cnt > 1) {
        int hoge = cnt + (cnt - 1);
        if (yoko[0].size() != 0 || yoko[h - 1].size() != 0 || tate[0].size() != 0 || tate[w - 1].size() != 0) {
            hoge--;
        }
        ans += hoge;
    }
    cout << ans << endl;
}
#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 14816
#include<cstdio>
#include<cstring>

char str[15];

int main(){
    scanf("%s",str+1);
    int len=strlen(str+1),cnt=0;
    if(str[1]!='A'||str[2]=='C'||str[len]=='C'){
        puts("WA");
        return 0;
    }
    for(int i=3;i<=len-1;i++){
        if(str[i]=='C'){
            if(cnt){
                puts("WA");
                return 0;
            }
            cnt++;
        }
    }
    if(!cnt){
        puts("WA");
        return 0;
    }
    for(int i=2;i<=len;i++){
        if(str[i]=='C') continue;
        if(str[i]<'a'||str[i]>'z'){
            puts("WA");
            return 0;
        }
    }
    puts("AC");
}

Measured memory_bytes: 128
#include<iostream>
#include <cstdlib>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int H[N];
    for(int i = 0; i < N; i++) cin >> H[i];

    if(N == 1) cout << "Yes";

    int k = H[0];

    for(int i = 1; i < N; i++){
      if(k - H[i] > 1){
        cout << "No";
        break;
      }else if(k < H[i]){
        k = H[i];
      }
      if(i == N - 1){
        cout << "Yes";
        break;
      }
    }
}

Measured memory_bytes: 640
N = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(10**5)]
for i in range(N):
    if a[i] > 0 and a[i] < 10**5-1:
        b[a[i]-1] += 1
        b[a[i]] += 1
        b[a[i]+1] += 1
    elif a[i] == 0:
        b[0] += 1
        b[1] += 1
    else:
        b[10**5-2] += 1
        b[10**5-1] += 1
print(max(b))


Measured memory_bytes: 56260
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


struct mint {
    ll x;
    mint(ll x=0):x(x%MOD){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
};

vector<mint> m;

void divisor(ll n, mint p) {
    vll ans;
    for (ll i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            m[i] += p.x;
            if (i*i != n) m[n/i] += p.x;
        }
    }
}

ll modpow(ll a, ll b) {
    ll res = 1;
    for (a %= MOD; b; a = a * a % MOD, b >>= 1)
        if (b & 1) res = res * a % MOD;
    return res;
}

int main() {
    ll n, k;
    cin >> n >> k;

    m.resize(k+1, 0);

    mint ans = 0;
    rrep(i, k) {
        ll num = k/(i+1);
        mint tmp = modpow(num, n);
        tmp -= m[i+1];
        divisor(i+1, tmp);
        tmp *= i+1;
        ans += tmp;
    }

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

Measured memory_bytes: 3996
N = int(input())
 
a_list = []
for _ in range(N):
    a_list.append(int(input()))
 
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 
res = 1
for i in range(N):
    d = gcd(res, a_list[i])
    res = res // d
    res = res * a_list[i]
 
print(res) 

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    cin>>n>>m;
    m/=1000;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            if(10*i+5*j+1*(n-i-j)==m){
                cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int x=s.size();
    if(x<=n)
    cout<<s;
    else
    {
        cout<<s.substr(0,n)+"...";
    }
    cout<<"\n";
}

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

int factorial(int n) 
{ 
    return (n==1 || n==0) ? 1: n * factorial(n - 1);  
} 
  
int main(){
    int n;cin>>n;
    int a=0;
    a=(factorial(n)/(factorial(1)*factorial(n-1)));
    cout<<a*a*a;

}



Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let len = format!("{0:b}", n).len();
    let ans = 1 << (len - 1);
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

bool comp(pair<int,int> a, pair<int, int> b){
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first < b.first;
    }
}

int main(){
    int N, K; cin >> N >> K;
    vector<pair<int, int> > F_set, S_set;
    unordered_map<int,int> MP;
    for(int i = 0 ; i < N; i++){
        int t, d;
        cin >> t >> d;
        //ps[i] = {t, d};
        if(MP[t] == 0) MP[t] = d;
        else{
            if(MP[t] < d){
                S_set.push_back({t, MP[t]});
                MP[t] = d;
            }else{
                S_set.push_back({t,d});
            }
        }
    }
    for(auto itr = MP.begin(); itr != MP.end(); itr++ ){
        F_set.push_back({itr->first, itr->second});
    }
    sort(S_set.begin(), S_set.end(), comp);
    sort(F_set.begin(), F_set.end(), comp);

    ll ans = 0;
    ll pref = 0;
    ll pres = 0;
    if(K <= S_set.size()){
        for(int i = 0; i < K; i++){
            pres += S_set[i].second;
        }
        ans = pres;
        for(int i = 1; i <= K; i++){
            if(i - 1 >= F_set.size()) break;
            ll tmp = 0;
            tmp = (ll)i * (ll)i;
            pres -= S_set[K - i].second;
            pref += F_set[i-1].second;
            tmp += pres + pref;
            ans = max(ans, tmp);
        }
    }else{
        for(int i = 0; i < S_set.size(); i++){
            pres += S_set[i].second;
        }
        for(int i = 0; i < K - S_set.size(); i++){
            pref += F_set[i].second;
        }
        ans = pres + pref + pow((K - S_set.size()), 2);
        for(int i = K - S_set.size() + 1; i <= K; i++){
            if(i - 1 >= F_set.size()) break;
            ll tmp = 0;
            tmp = (ll)i * (ll)i;
            pres -= S_set[K - i].second;
            pref += F_set[i-1].second;
            tmp += pres + pref;
            ans = max(ans, tmp);
        }
    }
    /* 
    for(int i = 0; i <= K; i++){
        if(i > F_set.size()) break;

        ll tmp = 0;
        tmp += i * i;
        tmp += 
        pres += 
        for(int j = 0; j < K - i; j++){
            if(j >= S_set.size()) break;
            tmp += S_set[j].second;
        }
        for(int j = 0; j < i; j++){
            tmp += F_set[j].second;
        }
        ans = max(ans, tmp);
    } */
    cout << ans << endl;
}

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

int main() {
  int N, A, count;
  cin >> N;
  
  vector<int> a(N), b(N);
  for(int i = 0; i < N; i++) 
    cin >> a.at(i);
  
  for(int k = 0; k < N; k++) 
    b.at(a.at(k) - 1) = k + 1;

    
   for(int l = 0; l < N; l++)
   cout << b.at(l) << " ";
  
}


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

int main() {
    int D,G;
    cin >> D >> G;
    vector<int> p(D),c(D);
    for(int i=0;i<D;i++) cin >> p[i] >> c[i];

    int min_n = 1000;//最小問題数
    //どのレベルを全問正解するか全探索
    for(int tmp=0;tmp<(1 << D);tmp++) {
        bitset<10> s(tmp);
        // cout << s << endl;
        int bonus=0; //問題を全問正解したときの得点
        for(int i=0;i<D;i++) {
            if(s.test(i)) bonus += c[i]+(100*(i+1))*p[i];
            // cout << s << endl;
        }
        // cout << "bonus:" << bonus << endl;

        if(bonus >= G) {
            int n = 0;//問題数
            for(int i=0;i<D;i++) {
                if(s.test(i)) n += p[i];
                // cout << n << endl;
            }
            min_n = min(min_n, n);
            // cout << min_n << endl;
        }
        else {
            int n=0;
            int add=0; //追加で解いた問題数
            bool flag=false;
            for(int i=D-1;i>=0;i--) {
                if(!s.test(i)) {
                    for(int j=0;j<p[i]-1;j++) {
                        add++;
                        bonus += (100*(i+1)) * (j+1);
                        if(bonus >= G) {
                            flag = true;
                            break;
                        }
                        bonus -= (100*(i+1)) * (j+1);
                    }
                }
                if(flag) break;
                else continue;
            }
            if(bonus >= G) {
                // cout << "add:" << add << endl;
                // cout << "bonus:" << bonus << endl;
                for(int i=0;i<D;i++) {
                    if(s.test(i)) n += p[i];
                }
                // cout << s << endl;
                min_n = min(min_n, n+add);
            } 
        }
    }
    cout << min_n << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);
	
	void solve(){
		int n=gInt(),m=gInt(),x=gInt();
		int l=0,r=0;
		for(int v:ints(m))
			if(v<x)
				++l;
			else
				++r;
		System.out.println(Math.min(l,r));
	}
	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}
class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}

	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

}


Measured memory_bytes: 26708
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
from bisect import bisect_left
for i in range(n-2):
  for j in range(i+1,n-1):
    ab=l[i]+l[j]
    idx=bisect_left(l,ab)
    ans+=max(idx-j-1,0)
print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <list>
#include <cstring>
#include <map>
#include <queue>
#include <ctime>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>

#define pb push_back
#define mp make_pair
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ull unsigned long long
#define iloop(a,b) for(ll i = a; i < b; ++i)
#define jloop(a,b) for(ll j = a; j < b; ++j)
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(typeofa((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define p(a) cout << a << "\n";
#define p1(a) cout << a << " ";

#define PI 3.141592653589793
#define MOD (ll)(1e9 + 7)

using namespace std;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 

void solve()
{
	int n;
	cin >> n;
	ll arr[n];
	iloop(0,n)
	{
		cin >> arr[i];
	}
	ll sum[n], revsum[n];
	iloop(0,n)
	{
		if(i == 0)
			sum[i] = arr[i];
		else
			sum[i] = arr[i] + sum[i-1];
	}
	for(int i = n-1; i >= 0; --i)
	{
		if(i == n-1)
			revsum[i] = arr[i];
		else
			revsum[i] = revsum[i+1] + arr[i];
	}
	ll mn = 1000000000000000000;
	iloop(0,n-1)
	{
		mn = min(mn, abs(sum[i] - revsum[i+1]));
	}
	p(mn)
}
int main()
{
	bool testing = false;
	IOS
	if(testing)
	{
		freopen("test.txt","rt",stdin);
		int start = clock();
		solve();
		int end = clock();
		cout << "time: " << (end - start)/(double)(CLOCKS_PER_SEC)*1000 << " milliseconds\n";
	}
	else
	{
		solve();
	}
} 

Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

template <typename T>
struct BIT{
	int n;
	vector<T> d;
	BIT(int n=0): n(n), d(n+1){}
	void add(int i, T x=1){
		for(i++; i<=n; i += (i&-i)){
			d[i] += x;
		}
	}
	T sum(int i){
		T x = 0;
		for(i++; i; i-= i&-i){
			x += d[i];
		}
		return x;
	}
	T sum(int l, int r){
		return sum(r-1) - sum(l-1);
	}
};




using P = pair<int, int>;
int main(){

	int N, Q;
	cin >> N >> Q;
	vector<int> c(N);
	vector<int> id(N+1, -1);
	vector<vector<int>> arrow(N);
	for(int i=0; i<N; i++){
		cin >> c[i];
		int left = id[c[i]];
		if(left != -1) arrow[left].push_back(i);
		id[c[i]] = i;
	}

	vector<vector<P>> qs(N);
	for(int i=0; i<Q; i++){
		int left, right;
		cin >> left >> right;
		left--; right--;
		qs[left].emplace_back(right, i);
	}

	vector<int> ans(Q);
	BIT<int> bi(N+1);
	for(int i=N-1; i>=0; i--){
		for(int a : arrow[i])  bi.add(a);
		for(P q : qs[i]){
			int left = i;
			int right = q.first;
			int id = q.second;
			ans[id] = right - i + 1 - bi.sum(right);
		}
	}
	for(int i=0; i<Q; i++) cout << ans[i] << endl;
	return 0;

}



Measured memory_bytes: 59848
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<62;
const int IINF = 1000000000;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

int main(){
    ll N, A, B; cin >> N >> A >> B;
    ll ans = N /(A+B) * A;
    ans += min(N%(A+B), A);

    cout << ans << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define N 100005
#define LL long long
using namespace std;
int n,size[N],id[N],ans1[N],ans2[N];
LL tot,a[N];
map <LL,int> num;
vector <int> vec[N];
bool cmp(int x,int y)
{
    return a[x]>a[y];
}
void dfs(int x,int fa,int d)
{
    tot+=(LL)d;
    for (int i=0;i<vec[x].size();i++)
    if (vec[x][i]!=fa) dfs(vec[x][i],x,d+1);
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%lld",&a[i]),num[a[i]]=i;
    for (int i=1;i<=n;i++) size[i]=1,id[i]=i;
    sort(id+1,id+n+1,cmp);
    for (int i=1;i<=n-1;i++)
    {
        int x=id[i];
        LL w=a[x]-(n-size[x])+size[x];
        if (!num[w] || w>=a[x]) {printf("-1");return 0;}
        int y=num[w];
        ans1[i]=x;ans2[i]=y;
        vec[x].push_back(y);
        vec[y].push_back(x);
        size[y]+=size[x];
    }
    dfs(id[n],0,0);
    if (tot!=a[id[n]]) {printf("-1");return 0;}
    for (int i=1;i<=n-1;i++) printf("%d %d\n",ans1[i],ans2[i]);
    return 0;
}

Measured memory_bytes: 18560