akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, x, y; cin >> n >> x >> y;
    --x, --y;
    vector<VI> g(n);
    FOR(i, 1, n) {
        g[i - 1].push_back(i);
        g[i].push_back(i - 1);
    }
    g[x].push_back(y);
    g[y].push_back(x);

    VI ans(n);

    auto dis = defvec<int>(INF, n, n);
    PQ<pair<ll, int>> dik;
    FOR(i, 0, n) {
        dis[i][i] = 0;
        dik.emplace(0, i);
        while (!dik.empty()) {
            int d, now;
            tie(d, now) = dik.top();
            dik.pop();
            if (dis[i][now] < d)continue;
            each(to, g[now]) {
                if (!chmin(dis[i][to], d + 1))continue;
                dik.emplace(d + 1, to);
            }
        }
        FOR(j, i, n)++ans[dis[i][j]];
    }

    FOR(i, 1, n)cout << ans[i] << "\n";
}


Measured memory_bytes: 16128
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;

int main() {
	ll n, x;
	cin >> n >> x;
	ll a[n];
	for (int i = 0;i < n;i++)cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	for (int i = 0;i < n;i++) {
		x -= a[i];
		if (x < 0)break;
		ans++;
	}
  	if(x>0)ans--;
	cout << ans << endl;
}

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

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

const int MAX_N = 200100;
int a[MAX_N];
int n;

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];

    sort(a, a+n);

    rep(i, n-1) {
        if (a[i] == a[i+1]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}

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


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define snd second
#define fst first
#define debug printf("--%d--\n",__LINE__)
#define ll long long int

int n;
string s;

int main(void){
	cin >> s;
	n = s.size();
	int ans = 0;
	for(int i=0;i<n;i++){
		if (i<(n+1)/2){
			if (s[i]=='p') ans--;
		}else{
			if (s[i]=='g') ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
int
gcd(int x, int y)
{
  int _x, _y;
  if (x >= y) {
    _x = x;
    _y = y;
  } else {
    _x = y;
    _y = x;
  }

  if (_y == 0) {
    return _x;
  }

  return gcd(_y, _x % _y);
}

int
main()
{
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d\n", gcd(a,b));
}



Measured memory_bytes: 2112
#include<stdio.h>
int gcd(int a, int b)
{
	int r = a % b;
	while (r > 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
int prime(int n)
{
	int i;
	for (i = 2; i * i <= n; i++)
		if (n % i == 0)
			return i;
	return n;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int a[1000006];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	int b = a[0];
	for (i = 0; i < n; i++)
		b = gcd(b, a[i]);
	if (b > 1)
	{
		printf("not coprime\n");
		return 0;
	}
	int p;
	int c[1000006];
	for (i = 0; i < 1000006; i++)
		c[i] = 0;
	for (i = 0; i < n; i++)
	{
		while (a[i] > 1)
		{
			p = prime(a[i]);
			c[p]++;
			while (a[i] % p == 0)
				a[i] /= p;
		}
	}
	p = 0;
	for (i = 0; i < 1000006; i++)
		if (c[i] > 1)
			p++;
	if (p > 0)
		printf("setwise coprime\n");
	else
		printf("pairwise coprime\n");
	return 0;
}

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

int main()
{
	string str;
	cin >> str;
	int k=0,u=0,p=0,c=0;
	for(unsigned i=0;i<str.size();i++){
		switch(str[i]){
			case 'K':
				k++;
				break;
			case 'U':
				u++;
				break;
			case 'P':
				p++;
				break;
			case 'C':
				c++;
				break;
		}
	}
	cout << min(k,min(u,min(p,c))) << endl;
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=998244353;
const int MAX=1000010;
vector<vector<ll> >comp_g(710);
vector<ll>color(710,-1);
bool f;
pll dfs(ll i,ll p){
    ll res1=0;
    ll res0=0;
    for(auto e:comp_g[i]){
        if(p==e)continue;
        if(color[e]>=0){
            if(color[i]==color[e])f=0;
            continue;
        }
        color[e]=1-color[i];
        pll k=dfs(e,i);
        res1+=k.fi;
        res0+=k.se;
    }
    if(!color[i])res0++;
    return mp(res1+1,res0);
}
signed main(){
    ll n,m;cin>>n>>m;
    vector<vector<ll> >exist(n,vector<ll>(n));
    rep(i,m){
        ll a,b;cin>>a>>b;
        a--;b--;
        exist[a][b]=1;
        exist[b][a]=1;
    }
    rep(i,n){
        rep(j,n){
            if(i==j||exist[i][j])continue;
            comp_g[i].pb(j);
        }
    }
    f=1;
    priority_queue<pll>pq;
    rep(i,n){
        if(color[i]>=0)continue;
        color[i]=0;
        pll k=dfs(i,-1);
        if(!f){
            cout<<-1<<endl;
            return 0;
        }
        pq.push(mp(abs(k.se*2-k.fi),k.fi));
    }
    ll l=0,r=0;
    while(!pq.empty()){
        pll k=pq.top();
        pq.pop();
        ll mi=(k.se-k.fi)/2;
        ll ma=k.se-mi;
        if(l<r){
            l+=ma;
            r+=mi;
        }else{
            l+=mi;
            r+=ma;
        }
    }
    ll ans=(r*(r-1)/2+l*(l-1)/2);
    cout<<ans<<endl;
}

Measured memory_bytes: 12508
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		long a = kb.nextInt();
		long b = kb.nextInt();
		long gcd = 1;

		for (int i = 1; i <= a && i <= b; ++i) {
			// Checks if i is factor of both integers
			if (a % i == 0 && b % i == 0)
				gcd = i;
		}

		System.out.println(a * b / gcd);
		kb.close();
	}

}


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

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

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  string A, B;
  cin >> A >> B;

  if (A.size() > B.size())
    B = string("0", A.size() - B.size()) + B;
  else
    A = string("0", B.size() - A.size()) + A;

  if (A < B)
    cout << "LESS" << endl;
  else if (A == B)
    cout << "EQUAL" << endl;
  else if (A > B)
    cout << "GREATER" << endl;
  return 0; 
}


Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 300;
const int MOD = 1000000007;

// ncyc in cycle -> dcyclesum
// N'=N-ncyc+1, i not in cycle: di'=di -> di<=N-ncyc, icyc: dicyc'=dcyclesum-2*ncyc -> dcyclesum-ncyc<=N (always true)

int n;
int d[MAXN];

int fac[2 * MAXN + 1];
int inv[2 * MAXN + 1];
int ifac[2 * MAXN + 1];

int dp[MAXN + 1][2 * MAXN + 1]; // dp[i][j] = the sum of for each way of (selecting i items for the cycle with total sum j-2*i) the product of ifac[d[i]-2] for them and ifac[d[i]-1] for others

void run() {
	fac[0] = 1; FORE(i, 1, 2 * MAXN) fac[i] = (ll)fac[i - 1] * i%MOD;
	inv[1] = 1; FORE(i, 2, 2 * MAXN) inv[i] = (MOD - (ll)(MOD / i)*inv[MOD%i] % MOD) % MOD;
	ifac[0] = 1; FORE(i, 1, 2 * MAXN) ifac[i] = (ll)ifac[i - 1] * inv[i] % MOD;

	scanf("%d", &n); REP(i, n) scanf("%d", &d[i]);
	//n = 300; REP(i, n) d[i] = i / 100 + 1;


	memset(dp, 0, sizeof(dp)); dp[0][0] = 1;
	int mxdx = 0;
	REP(k, n) {
		for (int i = k; i >= 0; --i) REPE(j, mxdx) if (dp[i][j] != 0) {
			if (d[k] >= 2)	dp[i + 1][j + d[k] - 2] = (dp[i + 1][j + d[k] - 2] + (ll)ifac[d[k] - 2] * dp[i][j]) % MOD;
			dp[i][j] = (ll)dp[i][j] * ifac[d[k] - 1] % MOD;
		}
		if (d[k] >= 2) mxdx += d[k] - 2;
	}

	int ret = 0;
	FORE(ncyc, 3, n) REPE(dx, mxdx) {
		int dpval = dp[ncyc][dx]; if (dpval == 0) continue;
		assert(dx <= n - ncyc);
		int nn = n - ncyc + 1, ntree;
		if (dx == 0) {
			if (nn != 1) continue; else ntree = 1;
		} else {
			if (nn < 2) continue; else ntree = (ll)fac[nn - 2] * dpval%MOD*ifac[dx - 1] % MOD;
		}
		int cur = (ll)ntree*fac[ncyc - 1] % MOD*inv[2] % MOD*fac[dx] % MOD;
		ret = (ret + cur) % MOD;
	}
	printf("%d\n", ret);
}

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


Measured memory_bytes: 896
N = int(input())
S = input()

ans = S[1:].count('E')
minans = ans
for i in range(1, N):
    if S[i-1] == 'E':
        ans -= 0
    else:
        ans += 1
    if S[i] == 'E':
        ans -= 1
    else:
        ans += 0
    minans = min(ans, minans)

print(minans)

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
const ll INF=1LL<<60;
const ll MOD=1000000007;


int main(){
    ll A;
    cin >> A;
    ll B;
    cin >> B;
    ll C;
    cin >> C;
    ll K;
    cin >> K;
    ll ans=0;
    if(A<K){
        ans+=A;
        K-=A;
    }
    else {ans+=K;cout<<ans<<endl;return 0;}
    if(B<K){
        K-=B;
    }
    else {cout<<ans<<endl;return 0;}
    if(K>0)
    ans-=K;
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3624
n,m=map(int,input().split())
A=[input() for _ in range(n)]
B=[input() for _ in range(m)]
#print(B)
for i in range(n-m+1):
    for j in range(n-m+1):
        tmp=["" for i in range(m)]
        for k in range(m):
            for r in range(m):
                tmp[k]+=A[i+k][j+r]
        #print(tmp)
        if tmp == B:
            print("Yes")
            exit()
print("No")

Measured memory_bytes: 9200
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    double score;
    int N,k;

    cin>>N>>k;
    score = 0.0;

    cout<<setprecision(15);

    for(int x = 1;x <= N;x++) {
        int u = x;
        int num = 0;
        while(u < k) {
            u *= 2;
            num++;
        }
        score += (1.0/pow(2,num))/N;
    }

    cout<<score<<endl;

    return 0;
}






Measured memory_bytes: 256
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
main=V.mapM_ print.solve.map((\[a,b]->(a,b)).unfoldr(B.readInt.B.dropWhile isSpace)).B.lines=<<B.getContents
solve((n,m):abcd)=V.map f ab where
  (ab,cd)=V.splitAt n$V.fromList abcd
  f(a,b)=snd.V.minimum$V.imap(\i (c,d)->(abs(a-c)+abs(b-d),i+1))cd

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

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

	if (a > b) { t = a; a = b; b = t;}
	if (b > c) { t = b; b = c; c = t;}
	if (a > b) { t = a; a = b; b = t;}

	cout << a << " " << b <<  " " << c << endl;

	return 0; 
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;
int bcnt(int a) {
	int res = 0;
	while (a > 0) {
		res += (a & 1);
		a /= 2;
	}
	return res;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	bool flip = false;
	if (N > M) {
		flip = true;
		swap(N, M);
	}
	int X = 1 << N;
	int Y = 1 << M;
	vector<vector<int> > A(X, vector<int>(Y));
	// for (int i = 0; i < X; i++) {
	// 	int t = 1 << (M + 1 - (i % (M + 1)));
	// 	for (int j = 0; j < Y; j++) {
	// 		if (j % t >= t / 2) {
	// 			A[i][j] = 1;
	// 		}
	// 	}
	// }
	for (int i = 0; i < X; i++) {
		for (int j = 0; j < Y; j++) {
			A[i][j] = bcnt(i & j) % 2;
		}
	}

	// for (int i = 0; i < X; i++) {
	// 	for (int j = 0; j < Y; j++) {
	// 		cerr << A[i][j] << " ";
	// 	}
	// 	cerr << endl;
	// }
	vector<vector<int> > res(X - 1, vector<int>(Y - 1));
	for (int i = 0; i < X - 1; i++) {
		for (int j = 0; j < Y - 1; j++) {
			res[i][j] = (A[i][j] ^ A[i + 1][j] ^ A[i][j + 1] ^ A[i + 1][j + 1]);
		}
	}
	if (flip) {
		for (int j = 0; j < Y - 1; j++) {
			bool f = true;
			for (int i = 0; i < X - 1; i++) {
				cout << res[i][j];
			}
			cout << endl;
		}
	} else {
		for (int i = 0; i < X - 1; i++) {
			bool f = true;
			for (int j = 0; j < Y - 1; j++) {
				cout << res[i][j];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 17792
#include <iostream>
#include <math.h>
#include <string>

using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int d=0;
    if(a== b && b!=c){
        d=1;
    }
    if(b== c && c!=a){
        d=1;
    }
    if(c== a && a!=b){
        d=1;
    }
    if(d ){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,sum=0,c=0,f=0;
    cin>>a>>b;
    sum=a+b;
while(sum>0)
    {
        sum=sum/10;
        c++;
        if(c==2)
        {
            f=1;
            break;
        }

    }
    if(f==1)
    {
        cout<<"error"<<endl;

    }
    else
    {
        cout<<a+b<<endl;
    }


}


Measured memory_bytes: 256
s = str(input())
t = str(input())
s_list = list(s)
t_list = list(t)
index = len(s_list)-1
ans=''
for i in range(len(s_list)):
    s_list = [s_list[index]] + s_list[0:index]
    if s_list == t_list and ans == '':
        print('Yes')
        ans = 'yes'
if ans == '':
    print('No')

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());

			int x;

			for(int i = 1; i <= N; i++)
			{
				if(i%3 == 0){
					System.out.printf(" %d",i);
				}else{
					x = i;
					do{
						if(x%10 == 3){
							System.out.printf(" %d",i);
							break;
						}
						x /=10;
					}while(x != 0);
				}
			}
			System.out.printf("\n");

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}





Measured memory_bytes: 38040
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

/*
計算量について
n = 20くらいまでならbit全探索できるよ

なお、j番目のマスク（2^j）が欲しいだけなら、
「1 << j」として、
1をj回左シフトするだけで一瞬で作れるので、
わざわざリストを作る必要はない。
*/

/*
cf. Bit探索メモ
1. 2^N通りの全てを探索する場合
	0 <= i < 2^Nまでの全ての整数をチェックする必要。
	（なお、2^N = (1 << N)）

2. j番目のビットが立っているか確認する場合。
	対象の数値をiとしたとき、
	「(i & (1 << j)) == 0」ならば、ビットは立っていない。
	（AND演算子を使用。この時の「1 << j」（= 2^j）が、マスクになる。）

3. j番目のビットを立たせたい場合。
	対象の数値をiとしたとき、
	「k = i | (1 << j)」とすれば、
	kは、iのj番目のビットを立たせた数値となる。
	（OR演算子を使用。bit DPなどで役立つ。）
*/

class Program
{
	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] line = Console.ReadLine().Split(' ');
		int D = int.Parse(line[0]);
		int G = int.Parse(line[1]);
		int[] Pn = new int[D];
		int[] Cn = new int[D];
		for(int i=0; i<D; i++){
			string[] line1 = Console.ReadLine().Split(' ');
			Pn[i] = int.Parse(line1[0]);
			Cn[i] = int.Parse(line1[1]);
		}

		//最小問題数
		int ans = 10000000;

		//bit探索（0 <= 1 < 2^D）
		for(int i=0; i<(1<<D); i++){
			//得点合計
			int score = 0;
			//解いた問題数
			int cnt = 0;

			//各ビットをチェック
			/*
			ビットが立っている場合、コンプリートボーナスを得ている
			*/
			for(int j=0; j<D; j++){
				//ビットが立っていない場合、次へ
				if((i & (1 << j)) == 0){
					continue;
				}

				//更新
				score += (Pn[j]*(j+1)*100 + Cn[j]);
				cnt += Pn[j];
			}

			//得点が足りていない間、得点の高い問題から解き続ける
			for(int j=D-1; j>=0; j--){
				//得点が足りていたら、終わり
				if(score >= G){
					break;
				}

				//既に解いている場合（ビットが立っている）、スキップ
				if((i & (1 << j)) != 0){
					continue;
				}

				//解いていない場合、足りない分だけ解く
				int times = (G - score) / ((j+1)*100);
				times = Math.Min(times,Pn[j]);
				score += ((j+1)*100 * times);
				cnt += times;
			}

			//得点が足りていなかったら、次へ
			if(score < G){
				continue;
			}

			//最小回数を更新
			if(ans > cnt){
				ans = cnt;
			}
		}

		//出力
		Console.WriteLine(ans);
	}
}



Measured memory_bytes: 17752
#include<stdio.h>
int main()
{
    int h, w;
    scanf("%d %d", &h, &w);
    int i, j;
    int q=0;
    char s[50][50];
    for (i = 0; i < h; i++)
    {
        scanf("%s", s[i]);
        for (j = 0; j < w; j++)
            if (s[i][j] == '.')
                q++;
    }
    int v[50][50];
    for (i = 0; i < 50; i++)
        for (j = 0; j < 50; j++)
            v[i][j] = 10000;
    v[0][0] = 0;
    int a;
    int min;
    for (a = 0; a < h*w; a++)
    {
        for (i = 0; i < h ; i++)
        {
            for (j = 0; j < w ; j++)
            {
                if (i != 0 || j != 0)
                {
                    if (s[i][j] == '.' && v[i][j] == 10000)
                    {
                        min = 10000;
                        if (v[i - 1][j] != 10000 && i!=0)
                            min = v[i - 1][j];
                        if (v[i + 1][j] != 10000 && i!=h-1)
                            if (min > v[i + 1][j])
                                min = v[i + 1][j];
                        if (v[i][j - 1] != 10000 && j!=0)
                            if (min > v[i][j - 1])
                                min = v[i][j - 1];
                        if (v[i][j + 1] != 10000 && j!=w-1)
                            if (min > v[i][j + 1])
                                min = v[i][j + 1];
                        if (min != 10000)
                            v[i][j] = min + 1;
                    }
                }
            }
        }
        if (v[h - 1][w - 1] != 10000)
            break;
    }
    if (v[h - 1][w - 1] == 10000)
    {
        printf("-1\n");
        return 0;
    }
    printf("%d\n", q - v[h - 1][w - 1] - 1);
    return 0;

}

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

int main() {
	int i, x[10000];
	
	for(i=1;i<=10000; i++){
		cin >> x[i];
	}
	for(i=1; i<=10000; i++){
		if(x[i] == 0){
			break;	
		}
		cout << "Case " << i <<": "<< x[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
n=int(input())
acount,wcount,tcount,rcount=0,0,0,0
for _ in range(n):
    ans=input()
    if ans=="AC":
        acount+=1
    elif ans=="WA":
        wcount+=1
    elif ans=="TLE":
        tcount+=1
    else:
        rcount+=1
print(f"AC x {acount:}\nWA x {wcount:}\nTLE x {tcount:}\nRE x {rcount:}")
 
  

Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC169 F - Knapsack for All Subsets
// 2020.06.23

ll MOD = 998244353;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, S; cin >> N >> S;
  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
  }

  vector<vector<ll> > dp(3005, vector<ll>(3005, 0));
  dp[0][0] = 1;
  for(int i = 0; i < N; i++){
    for(int j = 0; j <= S; j++){
      if(j+A[i] <= S) dp[i+1][j+A[i]] = (dp[i+1][j+A[i]]+dp[i][j])%MOD;
      dp[i+1][j] = (dp[i+1][j]+dp[i][j]*2)%MOD; 
    }
  }
  ll ans = dp[N][S]%MOD;
  cout << ans << endl;
}

Measured memory_bytes: 73936
#include<iostream>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, x, n) for (int i = x; i < (n); ++i)
using namespace std;

// using ll = long long;
// using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    int size = (int) s.size();

    string res = s[0] + to_string(size-2) + s[size-1];

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){int n,m,i,a,b,ans=0;
cin>>n>>m;
int h[n+1];
int mx[n+1]={0};
for(i=1;i<=n;i++){cin>>h[i];}
for(i=0;i<m;i++){cin>>a>>b;
    mx[a]=max(mx[a],h[b]);
    mx[b]=max(mx[b],h[a]);
}
for(i=1;i<=n;i++){if(mx[i]<h[i]){ans++;}}
cout<<ans;
    return 0;}

Measured memory_bytes: 4420
N=int(input())
a,b=map(int,input().split())
P=[int(i) for i in input().split()]
x=0
y=0
z=0
for p in P:
    if p<=a:
        x+=1
    elif a+1<=p<=b:
        y+=1
    elif b+1<=p:
        z+=1
print(min(x,y,z))

Measured memory_bytes: 38384
#include <cstdio>
#include <cmath>

int main(){
	double a, b, C;
	scanf("%lf %lf %lf", &a,&b,&C);
	printf("%.8lf\n", 0.5*a*b*sin(M_PI*C/180));
	printf("%.8lf\n", sqrt(a*a+b*b-2*a*b*cos(M_PI*C/180))+a+b);
	printf("%.8lf\n", b*sin(M_PI*C/180));	
}


Measured memory_bytes: 2880
n = int(input())
dp =[0 for i in range(n+1)]
for i in range(n+1):
    if i == 0:
        dp[i] = 2
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = dp[i-1] + dp[i-2]
print(dp[n])
    

Measured memory_bytes: 3060
n,m = map(int,input().split())
A = set([int(input()) for _ in range(m)])
mod = 1000000007
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
    dp[i] = (dp[i-1] + dp[i-2])%mod
    if i in A:dp[i] = 0
print(dp[n])


Measured memory_bytes: 13216
from collections import Counter
def main():
    n = int(input())
    s = input()
    d = Counter(s) 
    ans = d['R'] * d['G'] * d['B']
    cnt = 0
    for i in range(n):
        for j in range(i+1,n): 
            k = 2*j-i 
            if k < n:
                x = s[i]
                y = s[j]
                z = s[k]
                if (x!=y) and (x!=z) and (y!=z):
                    cnt+=1
    
    print(ans-cnt)
main()

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














int N;
string ans[1010];
//---------------------------------------------------------------------------------------------------
void copy(int sx, int sy, vector<string>& vs) {
	int n = vs.size();
	rep(dx, 0, n) rep(dy, 0, n) ans[sy + dy][sx + dx] = vs[dy][dx];
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	if (N == 2) {
		cout << -1 << endl;
		return;
	}

	if (N == 3) {
		cout << "aa." << endl;
		cout << "..a" << endl;
		cout << "..a" << endl;
		return;
	}

	if (N == 7) {
		cout << "aabbcc." << endl;
		cout << "dd.dd.a" << endl;
		cout << "..d..da" << endl;
		cout << "..d..db" << endl;
		cout << "dd.dd.b" << endl;
		cout << "..d..dc" << endl;
		cout << "..d..dc" << endl;
		return;
	}

	rep(y, 0, N) rep(x, 0, N) ans[y] += ".";

	int a, b, c = -1;
	rep(c4, 0, N + 1) rep(c5, 0, N + 1) {
		int d = N - c4 * 4 - c5 * 5;
		if (0 <= d and d % 6 == 0) {
			a = c4, b = c5, c = d / 6;
		}
	}

	vector<string> vs4 = {
		"aabc",
		"ddbc",
		"bcaa",
		"bcdd"
	};

	vector<string> vs5 = {
		"aabba",
		"bcc.a",
		"b..cb",
		"a..cb",
		"abbaa"
	};


	vector<string> vs6 = {
		"aabc..",
		"ddbc..",
		"..aabc",
		"..ddbc",
		"bc..aa",
		"bc..dd"
	};
	
	int x = 0, y = 0;
	
	rep(i, 0, a) {
		copy(x, y, vs4);
		x += 4;
		y += 4;
	}
	rep(i, 0, b) {
		copy(x, y, vs5);
		x += 5;
		y += 5;
	}
	rep(i, 0, c) {
		copy(x, y, vs6);
		x += 6;
		y += 6;
	}
	
	rep(y, 0, N) printf("%s\n", ans[y].c_str());

}







Measured memory_bytes: 2304
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc149/tasks/abc149_c>
 問題文============================================================
 C - Next Prime
 =================================================================
 解説=============================================================
 ================================================================
 */

// 素数列挙
const ll MAX_PRIME = 200000;
vector<int> primes;
vector<int> is_prime(MAX_PRIME + 1,true);
void init_primes(){
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= MAX_PRIME;i++){
        if(is_prime[i]){
            primes.push_back(i);
            for(int j = i*2; j <= MAX_PRIME; j+=i) is_prime[j] = false;
        }
    }
}

template<class Type>
Type solve(Type res = Type()){
    init_primes();
    ll X; cin >> X;
    res = *lower_bound(primes.begin(),primes.end(),X);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main(){
  int k;
  cin>>k;
  int a[1000001];
  a[1]=7%k;
  for(int i=2;i<=k;i++) a[i]=(a[i-1]*10+7)%k;
  for(int i=1;i<=k;i++){
    if(a[i]==0){
      cout<<i<<endl;
      return 0;
    }
  }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 7500
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

S = input()
S = S[::-1]

a = "dream"
b = "dreamer"
c = "erase"
d = "eraser"

while len(S) > 0:
    if S[:5] == a[::-1] or S[:5] == c[::-1]:
        S = S[5:]
    elif S[:6] == d[::-1]:
        S = S[6:]
    elif S[:7] == b[::-1]:
        S = S[7:]
    else:
        print("NO")
        exit()
print("YES")




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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f)
{
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void visit(const Graph & g, int v, int u, Edges& brdg, stack<int>& roots, stack<int>& S, vector<bool>& inS, vi& num, int& time)
{
  num[v] = ++time;
  S.push(v); inS[v] = true;
  roots.push(v);
  vrep(e, g[v]) {
    int w = e->dst;
    if (num[w] == 0)
      visit(g, w, v, brdg, roots, S, inS, num, time);
    else if (u != w && inS[w])
      while (num[roots.top()] > num[w]) roots.pop();
  }
  if (v == roots.top()) {
    brdg.push_back(Edge(u, v, 1));
    while (1) {
      int w = S.top(); S.pop(); inS[w] = false;
      if (v == w) break;
    }
    roots.pop();
  }
}

void Bridge(const Graph& g, Edges& brdg)
{
  const int n = g.size();
  vi num(n);
  vector<bool> inS(n);
  stack<int> roots, S;
  int time = 0;
  rep(u, n) if (num[u] == 0) {
    visit(g, u, n, brdg, roots, S, inS, num, time);
    brdg.pop_back();
  }
}

int V, E;
int s, t;

int main()
{
  cin >> V >> E;
  Graph g(V);
  Edges brdg;
  rep(i, E){
    cin >> s >> t;
    g[s].pb(Edge(s, t, 1));
    g[t].pb(Edge(t, s, 1));
  }

  Bridge(g, brdg);

  vrep(v, brdg) if(v->src > v->dst) swap(v->src, v->dst);
  sort(ALL(brdg));

  vrep(v, brdg) cout << v->src << " " << v->dst << endl;

  return 0;
}

Measured memory_bytes: 4664
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll T;
    cin >> T;
    rep(i, T){
        ll N, M, A, B;
        cin >> N >> M >> A >> B;
        cout << floor_sum(N, M, A, B) << endl;
    }
}

Measured memory_bytes: 3652
N = int(input())
S, P = [""], [0]
for _ in range(N):
    s, p = input().split()
    S.append(s)
    P.append(int(p))

I = [i for i in range(1, N + 1)]
I.sort(key=lambda i: P[i], reverse=True)
I.sort(key=lambda i: S[i])

print(*I, sep='\n')


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
	int x;
	int a[5] = {5, 4, 3, 2, 1 };
	int x2, x1;

	cin >> x;

	x1 = int(x / 100);
	x2 = int(x % 100);

	int count = 0;

	for (int i = 0; i < 5; i++)
	{
		if (x2 >= a[i])
		{
			count += int(x2 / a[i]);
			x2 = x2 % a[i];

		}
	}
	if (x1 >= count)
	{
		cout << 1;
	}
	else
	{
		cout << 0;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

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

#define MAXN

int soler(int n) {
	int i;
	int num = 0;
	num = (n>>1)*(n-(n>>1));
	return num;
}

int main() {
	int n;

	scanf("%d", &n);

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

	return 0;
}



Measured memory_bytes: 128
n = gets.chomp!.to_i

takahashi = []
aoki = []
tokuten = []

n.times do |i|
  a, b = gets.chomp!.split(" ").map(&:to_i)
  takahashi << a
  aoki << -1 * b
  tokuten << { idx: i, point: a + b }
end

puts tokuten.sort { |a, b| b[:point] <=> a[:point] }.map.with_index { |k, idx| idx.even? ? takahashi[k[:idx]] : aoki[k[:idx]] }.inject(:+)


Measured memory_bytes: 34544
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

struct Position{
  int x;int y;
};

int main(){
  int h,w,d;
  cin>>h>>w>>d;
  int a[h][w];
  vector<Position> numToPos(h*w);
  REP(i,h){
    REP(j,w){
      cin>>a[i][j];
      a[i][j]--;
      numToPos[a[i][j]]=Position{i,j};
    }
  }
  
  vector<int> dist[d];
  int temp;
  Position pos;
  REP(i,d){
    temp=i;
    dist[i].push_back(0);
    while(temp+d<h*w){
      dist[i].push_back(dist[i][(temp-i)/d]+abs(numToPos[temp+d].x-numToPos[temp].x)+abs(numToPos[temp+d].y-numToPos[temp].y));
      temp += d;
    }
  }
  
  int q;
  cin>>q;
  int l,r;
  int rest;
  int res;
  REP(i,q){
    cin>>l>>r;
    l--;r--;
    rest = l%d;
    res = dist[rest][r/d]-dist[rest][l/d];
    cout<<res<<endl;
  }
  
  return 0;
}


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

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

    string s;
    cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';

    char op1, op2, op3;
    REP(i, 2) REP(j, 2) REP(k, 2) {
        if (i == 0) b *= -1;
        if (j == 0) c *= -1;
        if (k == 0) d *= -1;
        if (a + b + c + d == 7) {
            if (i == 0) op1 = '-';
            else op1 = '+';
            if (j == 0) op2 = '-';
            else op2 = '+';
            if (k == 0) op3 = '-';
            else op3 = '+';
        }
        a = s[0] - '0';
        b = s[1] - '0';
        c = s[2] - '0';
        d = s[3] - '0';
    }

    cout << s[0] << op1 << s[1] << op2 << s[2] << op3 << s[3] << "=7" << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main()
{	
    ios::sync_with_stdio(false);
    cin.tie(0);
 
	int n,k,h[112345];
	cin>>n>>k;
	int res=0;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
		res+=h[i]>=k;
	}
	cout<<res<<endl;
	return 0;
}




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

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define infinity (1 << 28)
#define LL long long
#define PI acos(-1)
#define gcd(a, b) __gcd(a, b)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // __builtin_popcountll for LL
#define SZ(v) (int)(v.size())
#define eps 1e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

struct point{int x, y; point () {} point(int a, int b) {x = a, y = b;}};
template <class T> T sqr(T a){return a * a;}
template <class T> T power(T n, T p) { T res = 1; for(int i = 0; i < p; i++) res *= n; return res;}
template <class T> double getdist(T a, T b){return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));}    // distance between a and b
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}
template <class T> string tostring(T n) {stringstream ss; ss << n; return ss.str();}
//LL bigmod(LL B,LL P,LL M){LL R=1; while(P>0)  {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
struct fast{fast(){ios_base::sync_with_stdio(0);cin.tie(0);}}cincout;

#define MAX 100010
/***********************************THE GRASS IS ALWAYS GREENER ON THE OTHER SIDE***********************************/

int main()
{
    // in;
    string s, t;
    cin>> s >> t;
    if(t.substr(0, s.size()) == s){
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
using namespace std;

int main(){
	int n;
	cin>>n;
	int a[n];
	vector<pair<int,int> > neg;
	bool used[n];
	rep(i,n)used[i]=false;
	bool alt=false;
	int num,cnt=0;
	rep(i,n){
		cin>>a[i];
		if(a[i]==0||a[i]==1)used[i]=false;
		else if(a[i]==-1){
			if(!alt){
				used[i]=true;
				alt=true;
				num=i;
			}
		}
		else if(a[i]==-2){
			cnt++;
			used[i]=true;
		}else used[i]=true;
	}
	if(cnt%2==0 && alt){
		used[num]=false;
	}else if(cnt%2 && !alt){
		for(int i=n-1;i>=0;i--){
			if(a[i]==-2){
				used[i]=false;
				break;
			}
		}
	}
	int ans=0;
	rep(i,n)if(used[i])ans++;
	cout<<ans<<endl;
	rep(i,n){
		if(used[i])cout<<i+1<<endl;
	}
	return 0;
}


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

signed main(){
    int n , k;
    cin >> n >> k;
    int a[n];
    for(int i =0;i<n;i++){
        cin >> a[i];
       
    }
    sort(a,a+n,greater<>());
   
    int e=0;
    while(e<n&&a[e]>=k)e++;
    if(e==n)cout << 0;
    else{
    int b[n-e];
    int c[n-e];
    c[n-e-1]=0;
    
    for(int i= n-e-2;i>=0;i--){c[i]=c[i+1]+a[i+e+1];}
   int t;
   int mine = e-1;
    for(int i=e;i<n;i++){
        t=a[i];
        for(int j=e;j<i;j++){
            
            if(b[j-e]+a[i]<k&&t<b[j-e]+a[i])t =b[j-e]+a[i];
            

        }
        b[i-e]=t;
        //cout << t<<' ';

    }
    int ans=0;
    int u=0;
    if(b[0]+c[0]<k){
        u=1;
        ans++;
    }

     //cout << b[0]<<' '<< c[0]<< ' '<<ans<<endl;
    for(int i=1;i<n-e;i++){
        if(a[i-1+e]==a[i+e]){
            if(u==1)ans++;
        }else{
            if(b[i-1]+a[i+e]+c[i]<k){
                ans++;
                u=1;
            }else{
                u=0;
            }
        }
        
       // cout << b[i-1]<<' '<<a[i+e]<<' '<< c[i]<<' '<<ans<< endl;

    }
    cout << ans;
    }
    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	fmt.Printf("%d\n", resolve(os.Stdin))
}

func resolve(r io.Reader) int {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	n := scanInt(sc)
	h := make([]int, n+1)
	h[0] = math.MaxInt64
	for i := 1; i <= n; i++ {
		h[i] = scanInt(sc)
	}
	minCost := make([]int, n+1)
	for i := 2; i <= n; i++ {
		c1 := minCost[i-1] + abs(h[i-1]-h[i])
		c2 := minCost[i-2] + abs(h[i-2]-h[i])
		minCost[i] = min(c1, c2)
	}
	return minCost[n]
}

func abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int n; cin >> n;
    map<char, int> ans;
    map<char, int> m;

    for(char i = 'a'; i <= 'z'; i++){
        ans[i] = 0;
        m[i] = 0;
    }

    rep(i,n){
        string s; cin >> s;
        if(i==0){
            rep(j,s.size()){
                ans[s[j]]++;
            }
        }else{
            rep(j,s.size()){
                m[s[j]]++;
            }
            for(char j = 'a'; j <= 'z'; j++){
                ans[j] = min(ans[j],m[j]);
            }
            m.clear();
        }
    }
    for(auto ch : ans){
        if(ch.second>=1){
            rep(i,ch.second){
                cout << ch.first;
            }
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
int main(){
  long long a,v,b,w,t;scanf("%lld%lld%lld%lld%lld",&a,&v,&b,&w,&t);
  if(v<=w)puts("NO");
  else puts(abs(a-b)*1.0/abs(v-w)<=t?"YES":"NO");
}

Measured memory_bytes: 1660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <bits/stdc++.h>

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
using namespace std;

int cloud[105][105];

int check(string st, int h, int w){
			
	rep(i,w){
		if(st[i] == 'c') cloud[h][i] = 0;
	}

	rep(i,w){
		if(cloud[h][i] == 0){
			for(int j=i; j<w; j++){
				if(cloud[h][j] != 0) cloud[h][j] = j-i;
			}
		}
	}
}

int main(){

	memset(cloud, -1, sizeof(cloud));
	int h, w;
	string s;

	cin >> h >> w;

	rep(i, h){
		cin >> s;
		check(s, i, w);
	}

	rep(i,h){
		rep(j,w-1){
			cout << cloud[i][j] << ' ';
		}
		cout << cloud[i][w-1] << endl;
	}

	return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 330;

int n;
double dp[MAX_N][MAX_N][MAX_N];

double solve (int i, int j, int k) {
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i == 0 && j == 0 && k == 0) return dp[0][0][0] = 0.0;
    
    double res = 0.0;
    if (i > 0) res += solve(i-1, j, k) * i;
    if (j > 0) res += solve(i+1, j-1, k) * j;
    if (k > 0) res += solve(i, j+1, k-1) * k;
    res += n;
    res *= (1.0 / (i + j + k));
    return dp[i][j][k] = res;
}

int main() {
    int e, a = 0, b = 0, c = 0;
    cin >> n;
    for (int _ = 0; _ < n; _++) {
        cin >> e;
        if (e == 1) a++;
        if (e == 2) b++;
        if (e == 3) c++;
    }
    
    memset(dp, -1, sizeof(dp));
    double ans = solve(a, b, c);
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define fori(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(n) fori(somethingStupid,1,(n))


using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

bool tests = false;


void solve(){
    int x, y; cin >> x >> y;
    if (2*x <= y && y <= 4*x && (y % 2 == 0)){
        cout << "Yes" << endl;
        return;
    }cout << "No" << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    rep(t) solve();
    return 0;
}


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

#define fi first
#define se second

const int N = 100100;
const int mod = 998244353;

using namespace std;

int n;
int m;
int a[N];
int res[N];

int main()
{
    ios_base::sync_with_stdio(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin >> n >> m;
    for(int i = 1; i <= n; i++) a[i] = 1;
    res[1] = 1;
    for(int i = 1; i <= m; i++){
        int x, y;
        cin >> x >> y;
        a[x] -= 1;
        a[y] += 1;
        res[y] |= res[x];
        if(a[x] == 0) res[x] = 0;
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++) cnt += res[i];

    cout << cnt << "\n";
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll x, y;
    cin>>x>>y;
    ll g = __gcd(x, y);
    // cout<<"gcd is "<<g<<endl;
    ll ans = 1;
    // cout<<1<<endl;
    ll temp = g;
    for (ll i = 2; i<=sqrt(g); i++){
        if (temp%i==0){
            // cout<<i<<endl;
            ans++;
            while(temp%i==0)temp/=i;
        }
        if (temp == 1)break;
    }
    if (temp > 1)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3600