akhauriyash/Code-Regression huggingface dataset:
n, m = map(int, input().split())
n -= 1

l = [[] for _ in range(n+1)]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    l[a].append(b)
    l[b].append(a)

if len(l[n]):
    for x in l[n]:
        if l[x].count(0):
            print('POSSIBLE')
            exit()
print('IMPOSSIBLE')

Measured memory_bytes: 38320
n = gets.chomp.to_i
in_num = []
n.times do |num|
  in_num << gets.chomp.to_i
end
min_num = 10_000_000_000_000_000
diff = -10_000_000_000_000_000_000_000_000
in_num.each do |i|
  num = i.to_i
  a = num - min_num 
  diff = a if a > diff
  min_num = num if min_num > num 
end
puts diff

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

int main()
{
	long long a,b,c,k;
	cin>>a>>b>>c>>k;
	long long sum=0;
	if(k<=a)
	{
		sum+=k;
	}
	else if(k<=a+b)
	{
		sum+=a;
	}
	else if(k<=a+b+c)
	{
		sum+=a;
		long long rem=k-a-b;
		sum=sum-rem;
	}
	else
	{
		sum+=a;
		sum-=c;
	}
	cout<<sum<<endl;

	   

    return 0;

}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

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

using namespace std;
using ll = long long;

void solve() {
    int n, h, res = 0;
    cin >> n >> h;
    int a[n], b[n];
    REP(i, n) cin >> a[i] >> b[i];
    sort(a, a+n, greater<int>());
    sort(b, b+n, greater<int>());
    for(int i = 0; i < n, h > 0; i++){
        if(a[0] < b[i]){
            h -= b[i];
            b[i] = 0;
            res++;
        }else{
            res += h/a[0];
            h -= a[0]*(h/a[0]);
        }
    }
    cout << res << endl;
}

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

Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;

int main(void){
    int n;
    cin>>n;
    cout<<0.5*n*(n+1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
typedef long long ll;
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, x;
	cin >> n >> x;
	int m[n];
	for(int i = 0; i < n; i++)
		cin >> m[i];
	sort(m, m + n);
	int cnt = n;
	for(int i = 0; i < n; i++)
	{
		x -= m[i];
	}
	while(x > 0)
	{
		x -= m[0];
		if(x >= 0)
			cnt++;
	}
	cout << cnt  << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int highest=0;
  int num=0;
  cin >> N;
  for(int i=0;i<N;i++){
  	int a;cin>>a;
    if(a>=highest){
      highest = a;
      num++;
    }
  }
  cout<<num<<endl;
}


Measured memory_bytes: 256
n, m, q = map(int, input().split())
mp = [[0] * 502 for _ in range(502)]
for _ in range(m):
    l, r = map(int, input().split())
    mp[l][r] += 1


for x in range(501):
    mp[0][x + 1] += mp[0][x]

for y in range(1, 502):
    for x in range(501):
        mp[y][x + 1] += mp[y][x]
        mp[y][x] += mp[y - 1][x]

for _ in range(q):
    a, b = map(int, input().split())
    print(mp[b][b] - mp[b][a - 1] - mp[a - 1][b] + mp[a - 1][a - 1])

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

int main(){
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A), t(B);
    for(int i=0; i<A; i++) cin >> s[i];
    for(int i=0; i<B; i++) cin >> t[i];

    while(Q>0){
        ll x; cin >> x;
        int sm, tm;
        if(s[A-1]<x) sm = A;
        else sm = lower_bound(s.begin(), s.end(), x) - s.begin();
        if(t[B-1]<x) tm = B;
        else tm = lower_bound(t.begin(), t.end(), x) - t.begin();

        //cout << x << " : " << sm << " " << tm << endl;

        ll smx, slx, tmx, tlx;
        if(sm!=A) smx = s[sm];
        else smx = 1e15; 
        //cout << x << " : " << sm << " " << tm << endl;
        if(tm!=B) tmx = t[tm];
        else tmx = 1e15;
        //cout << x << " : " << sm << " " << tm << endl;
        if(sm!=0) slx = s[sm-1];
        else slx = -1e15;
        //cout << x << " : " << sm << " " << tm << endl;
        if(tm!=0) tlx = t[tm-1];
        else tlx = -1e15;
        //cout << x << " : " << sm << " " << tm << endl;
        // cout << x << " : " << slx << " " << smx << " " << tlx << " " << tmx << endl;

        if(smx==x && tmx==x){
            cout << 0 << endl;
        }else if(smx==x){
            cout << min(tmx-x, x-tlx) << endl;
        }else if(tmx==x){
            cout << min(smx-x, x-slx) << endl;
        }else{
            ll ans = 1e18;
            ans = min(max(tmx-x, smx-x), max(x-slx, x-tlx));
            ans = min(ans, (x-tlx)*2 + smx-x);
            ans = min(ans, (x-slx)*2 + tmx-x);
            ans = min(ans, (tmx-x)*2 + x-slx);
            ans = min(ans, (smx-x)*2 + x-tlx);
            cout << ans << endl;
        }
        Q--;
    }
}


Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
int D, N;

//解法
void solve() {

	cout << (N == 100 ? 101 : N);
	rep(i, D) {
		cout << "00";
	}

	return;
}

int main() {
	//入力
	cin >> D >> N;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char c[100005];
	scanf("%s",c);
	int length=strlen(c);
	if(length%2==0){
		if(c[0]!=c[length-1])
		printf("Second\n");
		else
		printf("First\n");
	}
	else if(length%2==1){
		if(c[0]!=c[length-1])
		printf("First\n");
		else
		printf("Second\n") ;
	}
} 

Measured memory_bytes: 384
#include <stdio.h>
 
#define MAX 2000001
 
int A[MAX], B[MAX], C[MAX];
  
int main(){
  int n, i, j, k = 0;
  
  scanf("%d", &n);
  
  for(i = 1; i <= n; i++){

    scanf("%d", &A[i]);

    if(k < A[i]) k = A[i];

  }
  
  for(i = 0; i <= k; i++){C[i] = 0;}
  
    for(j = 1; j <= n; j++){C[A[j]]++;}
  
  for(i = 1; i <= k; i++){C[i] += C[i-1];}
  
  for(j = n; j >= 1; j--){     

      B[C[A[j]]] = A[j];

      C[A[j]]--;

    }
  
  for(i = 1; i < n; i++){

    printf("%d ", B[i]);

  }

  printf("%d\n", B[n]);

  return 0;

}

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

int main() {
    int a, b, k;
    cin >> k >> a >> b;
    for (int i=a; i<=b; i++) {
        if(i%k==0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Queue;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Map<Integer, Queue<Integer>> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			String[] sa = br.readLine().split(" ");
			Queue<Integer> que = new ArrayDeque<>();
			map.put(i, que);
			for (int j = 0; j < sa.length; j++) {
				que.add(Integer.parseInt(sa[j]) - 1);
			}
		}
		br.close();

		int ans = 0;
		Set<Integer> set = new HashSet<>();
		set.addAll(map.keySet());
		while (true) {
			ans++;
			boolean[] flg = new boolean[n];
			boolean flg2 = false;
			Set<Integer> set2 = new HashSet<>();
			Integer[] keys = set.toArray(new Integer[0]);
			for (int i : keys) {
				if (flg[i]) {
					continue;
				}
				Queue<Integer> que = map.get(i);
				if (que == null) {
					continue;
				}
				int o = que.peek();
				if (flg[o]) {
					continue;
				}

				Queue<Integer> que2 = map.get(o);
				if (que2 == null) {
					continue;
				}
				int o2 = que2.peek();
				if (flg[o2]) {
					continue;
				}

				if (o2 == i) {
					que.poll();
					que2.poll();
					flg[o] = true;
					flg[o2] = true;
					flg2 = true;
					if (que.isEmpty()) {
						map.remove(i);
					}
					if (que2.isEmpty()) {
						map.remove(o);
					}
					set2.add(o);
					set2.add(o2);
				}
			}
			if (map.isEmpty()) {
				break;
			}
			set.clear();
			set.addAll(set2);
			if (!flg2) {
				System.out.println(-1);
				return;
			}
		}
		System.out.println(ans);
	}
}


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

// https://qiita.com/drken/items/a5e6fe22863b7992efdb

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

    vector<int> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    int ans = 0;
    vector<ll> asum(n + 1), bsum(m + 1);

    asum[0] = 0;
    bsum[0] = 0;
    rep(i, n) asum[i + 1] = asum[i] + a[i];
    rep(i, m) bsum[i + 1] = bsum[i] + b[i];

    int aid = 0, bid = 0;

    while (1)
    {
        if (asum[aid] > k)
            break;
        ++aid;
        if (aid > n)
            break;
    }
    aid--;

    while (1)
    {
        int res = k - asum[aid];
        while (1)
        {
            if (bsum[bid] > res)
                break;
            ++bid;
            if (bid > m)
                break;
        }
        --bid;

        ans = max(ans, aid + bid);

        --aid;
        if (aid < 0)
            break;
    }

    cout << ans << endl;
}

Measured memory_bytes: 7996
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int n;
    cin >> n;
    char str[100];
    cin >> str;
    int len=strlen(str);
    if(len<=n)
    {
        for(int i=0;i<len;i++)
        {
            cout << str[i];
        }
        cout << endl;
    }
    else
    {
        for(int i=0;i<n;i++)
        {
            cout << str[i];
        }
        cout << "..." << endl;
    }
}


Measured memory_bytes: 3624
n = int(input())
def c(x,y):
    if 0 <= x < n and 0 <= y < 2:
        if cache[y][x] != " ":
            return cache[y][x]

        if x == 0 and y == 0:
            total = matrice[0][0]
        else:
            if x > 0:
                tt1 = c(x-1,y)
            else:
                tt1 = 0
            if y > 0:
                tt2 = c(x,y-1)
            else:
                tt2 = 0
            total = max(tt1,tt2) + matrice[y][x]
        cache[y][x] = total
        return total

    
matrice = []
cache = [ [" " for i in range(n)] for a in range(2) ] 
for i in range(2):
    matrice.append( [ int(i) for i in input().split() ] )

print( c(n-1,1) )


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod = 1000000007;
const int MAXN = 100010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll S[MAXN], A, B;
ll dp[MAXN], pd[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>A>>B;
	for (int i=1; i<=n; i++) cin>>S[i];
	S[0]=-INF;
	dp[0]=pd[0]=1;
	int pos1=0, pos2=0;
	int last1=0, last2=0;
	ll sum1=0, sum2=0;
	for (int i=2; i<=n; i++){
		while (pos1<i-1 && S[i]-S[pos1]>=A) sum1=(sum1 + pd[pos1++])%mod;
		while (pos2<i-1 && S[i]-S[pos2]>=B) sum2=(sum2 + dp[pos2++])%mod;
		ll s1=0, s2=0;
//		for (int j=last2; j<pos1; j++) s1=(s1 + pd[j])%mod;
//		for (int j=last1; j<pos2; j++) s2=(s2 + dp[j])%mod;
//		if (sum2!=s2) debug(i)
		s1=sum1;
		s2=sum2;
		
		if (S[i]-S[i-1]>=A) s1=(s1 + pd[i-1])%mod;
		if (S[i]-S[i-1]>=B) s2=(s2 + dp[i-1])%mod;
		dp[i-1]=s1;
		pd[i-1]=s2;
		if (S[i]-S[i-1]<A){
			while (last1<i-1){
				if (last1<pos2) sum2=(sum2 - dp[last1])%mod;
				dp[last1]=0;
				last1++;
			}
		}
		if (S[i]-S[i-1]<B){
			while (last2<i-1){
				if (last2<pos1) sum1=(sum1 - pd[last2])%mod;
				pd[last2]=0;
				last2++;
			}
		}
	}
	for (int i=0; i<n; i++) ans=(ans + dp[i] + pd[i])%mod;
	if (ans<0) ans+=mod;
	cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 5964
import sys
import math

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
if n%2==1:
    for i in range(m):
        print(i+1, n-i)
else:
    for i in range(m):
        if i < (n/2)//2:
            print(i+1, n-i)
        else:
            print(i+1, n-i-1)

Measured memory_bytes: 69900
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

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

n = inn()
s = ins()
r = g = b = rg = rb = gr = gb = bg = br = 0
rgb = rbg = gbr = grb = brg = bgr = 0
rgb0 = rbg0 = gbr0 = grb0 = brg0 = bgr0 = 0

for i in range(n):
    c = s[i]
    if c=='R':
        gbr += gb
        bgr += bg
        gr += g
        br += b
        r += 1
        for j in range(1,i//2+1):
            if s[i-j]=='G' and s[i-2*j]=='B':
                bgr0 += 1
            if s[i-j]=='B' and s[i-2*j]=='G':
                gbr0 += 1
    elif c=='G':
        rbg += rb
        brg += br
        bg += b
        rg += r
        g += 1
        for j in range(1,i//2+1):
            if s[i-j]=='R' and s[i-2*j]=='B':
                brg0 += 1
            if s[i-j]=='B' and s[i-2*j]=='R':
                rbg0 += 1
    else:  # c=='B'
        rgb += rg
        grb += gr
        gb += g
        rb += r
        b += 1
        for j in range(1,i//2+1):
            if s[i-j]=='R' and s[i-2*j]=='G':
                grb0 += 1
            if s[i-j]=='G' and s[i-2*j]=='R':
                rgb0 += 1
print(rgb+rbg+bgr+brg+grb+gbr-(rgb0+rbg0+bgr0+brg0+grb0+gbr0))


Measured memory_bytes: 68628
program good_distance
    integer(4)::n,d,i,j,c,y,d2
    integer(4),allocatable:: x(:,:)

    read*, n,d
    allocate(x(d,n))
    do i=1,n
        read*, x(:,i)
    end do
    c=0
    do i=1,n-1
        do j=i+1,n
            d2 = sum((x(:,i)-x(:,j))**2)
            y=0
            do while(y*y <= d2)
                if (d2 == y*y) c=c+1
                y=y+1
            end do
        end do
    end do
    print*,c
    
end program good_distance

Measured memory_bytes: 512
#include <stdio.h>
int main(){
    int N;
    int a[200010];
    scanf("%d",&N);
    int i;
    for(i=1;i<=N;i++){
        scanf("%d",&a[i]);
    }
    int b[200010];
    for(i=1;i<=N;i++){
        b[i]=0;
    }
    int j;
    int ans;
    ans=0;
    for(i=N;i>0;i--){
        if(i>N/2){
            b[i]=a[i];
        }else{
            b[i]=a[i];
            for(j=2;i*j<=N;j++){
                b[i]=(b[i]+b[j*i])%2;
            }
        }
        ans=ans+b[i];
    }
    printf("%d\n",ans);
    for(i=1;i<=N;i++){
        if(b[i]==1){
            printf("%d ",i);
        }
    }
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll X, Y;

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

  cin >> X >> Y;

  if (X%Y == 0) {
      cout << -1 << endl;
  } else {
      cout << X << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
   string s; cin >> s;
   int len  = s.size();
   s += "DDD";
   
   ll res = 0; ll zero = 0; bool mode = false;
   rep(i, len){
       if(mode){
         if(s[i] == 'A') zero++;
         else if(s[i] == 'B' && s[i+1] == 'C'){
             res += zero; i++;
         }else{
             zero = 0; mode = false;
         }
       }else{
           if(s[i] == 'A') zero++, mode = true;
       }
   }
   cout << res << ln;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue 优先队列
#include <map>
#include <set> //multiset  set<int>::reverse_iterator rit; for(rit=s.rbegin();rit!=s.rend();rit++)
#include <vector>
#include <stack>
#include <cmath>
#include <utility>
#include <sstream>
#include <string>
#define mod 1000000007
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
const db eps=1e-6;
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int N=2e5+5;
using namespace std;

int t,n,m,x,y,ans=0;
int fa[55]={0};
int a[55][2];
void init(){
    for(int i=1;i<=n;i++){
	    fa[i]=i;
	}
}
int find(int x){
	int p=x,t;
	while(fa[p]!=p) p=fa[p];
	while(x!=p){
		t=fa[x];
		fa[x]=p;
		x=t;
	}
	return x;
}
void merge(int a,int b){
    int p=find(a),q=find(b);
	if(p!=q){
		fa[q]=p;
    }
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&a[i][0],&a[i][1]);
	}
	for(int i=0;i<m;i++){
		init();
		int sum=0;
		for(int j=0;j<m;j++){
			if(j==i) continue;
			merge(a[j][0],a[j][1]);
		}
		for(int j=1;j<=n;j++){
			if(fa[j]==j) sum++;
		}
		if(sum>1) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())
dum1 = a-k
if dum1 < 0:
  dum2 = b+dum1
  if dum2 < 0:
    print(0,0)
  else:
    print(0,dum2)
else:
  print(dum1,b)

Measured memory_bytes: 2940
import sys

X, N = map(int, input().split())
P = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

p_set = set(P)

if not (X in p_set):
    print(X)
    sys.exit()

for i in range(1, 100):
    if not (X-i in p_set):
        print(X-i)
        break
    if not (X+i in p_set):
        print(X+i)
        break

Measured memory_bytes: 61740
#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;
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; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1173&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

string S;
string solve(){
    stack<char> st;
    for(auto c:S){
        if(c != '(' and c != ')' and c != '[' and c != ']') continue;
        if(c == '(' or c == '[') st.push(c);
        if(c == ')'){ if(st.empty() or st.top() != '(') return "no"; st.pop(); }
        if(c == ']'){ if(st.empty() or st.top() != '[') return "no"; st.pop(); }
    }
    return st.empty()?"yes":"no";
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(getline(cin,S)){
        if(S == ".") break;
        cout << solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 3220
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    string s = "";
    for (int i = 0; i < 4; i++)
    {
        string c;
        cin >> c;
        s += c;
    }
    sort(s.begin(), s.end());
    cout << (s == "1479" ? "YES" : "NO") << endl;
}


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

int main(){
    string S; cin >> S;
    ll K; cin >> K;
    int index = 0;
    for(int i = 0; i < S.size() ;i++){
        if(S[i] == '1') continue;
        else{
            index = i;
            break;
        }
    }
    if( K  < index+1) cout << 1 << endl;
    else cout << S[index] << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,tune=native")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const int mod = 1000000007;
const ll inf = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t1, t2, a1, a2, b1, b2;
	cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
	ll d1 = (a1*t1) - (b1*t1);
	ll d2 = (a1*t1 + a2*t2) - (b1*t1+b2*t2);
	if(d2 == 0) return cout << "infinity", 0;
	if((d1<0)==(d2<0)) return cout << 0, 0;
	a1 = abs(d1), a2 = abs(d2);
	ll ans = (a1+a2-1)/a2;
	ans *= 2;
	if(a1%a2==0) ans++;
	cout << ans-1;

}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  int w;
  cin >> w;
  int n = s.size();
  for (int i = 0; i < n; i += w) {
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();

    int sum = 0;
    for (int i = 1; i <= n; i++) {
      int a1 = i / 10000;
      int a2 = (i % 10000) / 1000;
      int a3 = (i % 1000) / 100;
      int a4 = (i % 100) / 10;
      int a5 = i % 10;

      int j = a1 + a2 + a3 + a4 + a5;
      if (j >= a && j <= b) sum += i;
      
    }
    
    System.out.println(sum);
  }
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define sz(x) ((int)x.size())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e5+3;
const int INF = 1e9;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    fori(i,n) cin >> a[i];
    int x = 0;
    fori(i,n) x ^= a[i];
    debug(x);
    fori(i,n) {
        int b = x^a[i];
        cout << b << ' ';
    }
    cout << endl;
}

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int ntest = 1; 
    //cin >> ntest; 
    while(ntest--) solve();

    return 0;
}


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

using vi = vector<int>;
using vll = vector<long long>;

constexpr long long mod = 1000000007;

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

template <typename T>
T _gcd(T a, T b) {
    return b ? _gcd(b, a % b) : a;
}

template <typename T>
vector<T> _divisor(T a) {
    vector<T> res;
    for (T i = 1; i * i <= a; i++) {
        if (a % i == 0) {
            res.push_back(i);
            if (i != 1 && i * i != a)
                res.push_back(a / i);
        }
    }
    return res;
}

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

    long long n, m;
    cin >> n >> m;

    if (m % n == 0) {
        cout << m / n << endl;
    } else {
        long long p = m / n;
        long long q = m % n;

        vll a = _divisor(m);

        long long ans = 1;

        for (int i = 0; i < a.size(); i++) {
            long long t = m - a[i] * n;
            //ans = max(ans, _gcd(t, n));

            if (t > 0)
                ans = max(ans, _gcd(t, a[i]));
        }

        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
int main(){
  string S , T;
  cin >> S >> T;
  for  (int i = 0; i < T.size() - 1; i++){
    if( S[i] != T[i] ){
      cout <<"No" << endl;
      return 0;
    } 
  }
  cout <<"Yes"<< endl;
  
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using ll = long long;
#define vc vector
using namespace std;
int main() {
  int N,T,t[200000];
  cin>>N>>T;
  for (int i(0);i<N;i++) cin>>t[i];
  ll sum(0);
  int now(0);
  for (int i(0);i<N-1;i++){
    now=t[i];
    int interval;
    if (t[i+1]-t[i]>=T) interval=T;
    else interval=t[i+1]-t[i];
    sum+=interval;
  }
  cout << sum+T<<endl;
}



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

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

  int typ=0;
  int a[n],count[n+1];
  for(int i = 0; i < n+1; i++){
    count[i] = 0;
  }
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(count[a[i]] == 0){
      typ++;
    }
    count[a[i]]++;
  }

  //cout << typ << endl;
  sort(count, count+n+1);
  int chan=0;
  int j = 0;
  for(int i = 0; j < typ-k; i++){
    if(count[i] != 0){
      chan += count[i];
      j++;
    }
  }
  cout << chan << endl;;
  return 0;
}


Measured memory_bytes: 1792
S = str(input())
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == 'L':
      print('No')
      exit()
    else:
      pass
  else:
    if S[i] == 'R':
      print('No')
      exit()
    else:
      pass
print('Yes')

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

int main(){
  int N; cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  
  vector<int>b(N);
  int sum=0;
  
  for(int i=N-1;i>=0;i--){
    int s=0;
    for(int j=i;j<N;j+=i+1){
      s+=b.at(j);
    }
    
    
    if(s%2!=a.at(i)){
      b.at(i)=1;
      sum++;
    }
  }
  
  cout<<sum<<endl;
  for(int i=0;i<N;i++){
    if(b.at(i)==1)
      cout<<i+1<<" ";
  }
}
  
  

Measured memory_bytes: 2432
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define INF (1<<29)
int dist[30][30];
int main(void){
  int n,m;
  char dummy;
  cin >> n >> m;

  rep(i,n){
    rep(j,n){
      if(i==j)dist[i][j]=0;
      else dist[i][j]=INF;
    }
  }

  rep(i,m){
    int a,b,c,d;
    cin >> a >> dummy >> b >> dummy >> c >> dummy >> d;
    dist[a-1][b-1] = c;
    dist[b-1][a-1] = d;
  }

  rep(k,n){
    rep(i,n){
      rep(j,n){
	dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
      }
    }
  }

  int x1 , x2 , y1 , y2;
  cin >> x1 >> dummy >> x2 >> dummy >> y1 >> dummy >> y2;
  cout<< (y1 - y2 - dist[x1-1][x2-1] - dist[x2-1][x1-1]) <<endl; 

}

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

int main() {
	string s;
	cin >> s;

	if(s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N; cin >> N;
	string S; cin >> S;
	if (N % 2 == 1) cout << "No" << endl;
	else cout << (S.substr(0, N / 2) == S.substr(N / 2, N / 2) ? "Yes" : "No") << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const int mod = 1e9 + 7;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  ll res = 1;
  for(int i = 1; i <= n; i++){
    res = (res * i) % mod;
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstdio>

using namespace std;
class Node{
public:
	int cost;
	int w;//x
	int h;//y
	int dir;//up:0 right:1 down:2 left:3
	Node(int c,int _h,int _w,int d){
		cost=c;
		w=_w;
		h=_h;
		dir=d;
	}

	bool operator < (const Node &o) const{
		return cost > o.cost;
	}
};
#define MAX 1000000
#define MAX_NODE 30
#define MAX_FUNC 5
#define STOP 1000
int map[MAX_NODE+1][MAX_NODE+1];
int func[MAX_FUNC];
int w,h;
int dx[]={ 0, 1, 0,-1};
int dy[]={-1, 0, 1, 0};
typedef priority_queue<Node> PQ;
//visited[][]
bool closed[MAX_NODE+1][MAX_NODE+1][MAX_FUNC];
int d[MAX_NODE+1][MAX_NODE+1][MAX_FUNC];

void init(){
	for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)for(int k=0;k<MAX_FUNC;k++)d[i][j][k]=MAX;
}
int search(){
	init();
	PQ pq;
	pq.push(Node(0,1,1,1));
	d[1][1][1]=0;
	while(!pq.empty()){
		Node current = pq.top();pq.pop();
		if(current.h==h&&current.w==w){
			//cout<<"goal["<<current.h<<"]["<<current.w<<"]"<<endl;
			return current.cost;
		}
//		cout<<"["<<current.h<<"]["<<current.w<<"]"<<current.cost<<"("<<current.dir<<")"<<endl;



		for(int i=0;i<4;i++){
			int nextdir=(i+current.dir)%4;
			int nextCost;
			if(i==map[current.h][current.w])nextCost=current.cost;
			else nextCost=current.cost+func[i];

			Node next(nextCost,current.h+dy[nextdir],current.w+dx[nextdir],nextdir);
		//	cout<<"    next("<<next.h<<","<<next.w<<")"<<next.cost<<endl;
			if(next.h<1||next.w<1||next.h>h||next.w>w){
				continue;
			}
			else{
				//cout<<"    d["<<next.h<<"]["<<next.w<<"]"<<d[next.h][next.w][next.dir]<<":"<<next.cost<<endl;
				if(d[next.h][next.w][next.dir]>next.cost){
					d[next.h][next.w][next.dir]=next.cost;
					pq.push(next);
				}
			}
		}
	}
}
bool input(){
	cin>>w>>h;
	//cout<<"w:"<<w<<" h:"<<h<<endl;
	if(w==0&&h==0)return false;
	for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)cin>>map[i][j];
	for(int i=0;i<MAX_FUNC-1;i++){
		cin>>func[i];
		//cout<<func[i]<<endl;
	}
	return true;
}
int main(){
	while(input()){
		cout<<search()<<endl;;
	}
	return 0;
}

Measured memory_bytes: 1036
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef pair<int,ii> iii;
typedef pair<int, iii> iiii;
typedef pair<double, ii> dii;
typedef long long ll;
typedef pair<ll, ii> lii;
const int INF = 1000000000;
const double EPS = 1e-9;
#define LSOne(S) (S & (-S))
int mods(int a, int b) { return (b + (a%b)) % b; }

int n, cap, w[105], v[105];
ll dp[105][100005];
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    cin >> n >> cap;

    for (int i = 1; i <= n; i++)
        cin >> w[i] >> v[i];

    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= cap; j++) {
            if (j < w[i]) dp[i][j] = dp[i-1][j];
            else dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
        }
    }

    cout << dp[n][cap] << '\n';
 
    return 0;
}


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

using namespace std;

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    int ans = 1;
    for(int i = 1; i * i <= m; i++){
        if(m % i == 0){
            if(m/i >= n) ans = max(i, ans);
            if(i >= n) ans = max(m/i, ans);
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
def Z_Algorithm(S):
    N = len(S)
    Z = [0]*N
    Z[0] = N
    
    i = 1   #左
    j = 0   #差分

    while i < N:
        while i + j < N and S[j] == S[j + i]:
            j += 1
        Z[i] = j

        if j == 0:
            i += 1
            continue

        k = 1   # 差分
        while k < j and k + Z[k] < j:
            Z[i + k] = Z[k]
            k += 1
        
        i += k
        j -= k
    
    return Z

def calc(S):
    N = len(S)
    Z = Z_Algorithm(S)

    res = 0
    for i in range(N):
        res = max(res, min(Z[i], i))
    
    return res

N = int(input())
S = input()

res = 0

for i in range(N):
    res = max(res, calc(S[i:]))

print(res)

Measured memory_bytes: 77044
#include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

int main(void){
  int S, LENGTH=4;
  int i;
  bool flag; // true=good, false=bad

  cin >> S;

  for(i=0;i<LENGTH-1;i++){
    int a = int(floor(S/(pow(10, LENGTH-(i+1))))) % 10;
    int b = int(floor(S/(pow(10, LENGTH-(i+2))))) % 10;
    if( a==b ){
      flag = false;
      break;
    }else{
      flag = true;
    }
  }

  if (flag){
    cout << "Good" << endl;
  }else{
    cout << "Bad" << endl;
  }

  return 0;
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;

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

int main()
{
    int n, h, ans = 0;
    cin >> n >> h;
    vector <int> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    int tmp = 0;
    for (int i = n-1; a[n-1] < b[i]; i--) {
        tmp += b[i];
        ans++;
        if (tmp >= h) {
            cout << ans << endl;
            return 0;
        }
    }

    ans += ((h - tmp - 1) / a[n-1]) + 1;
    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

#define INF 1 << 28

int fee[7][7] = {
	{INF, 300, 500, 600, 700, 1350, 1650},
	{300, INF, 350, 450, 600, 1150, 1500},
	{500, 350, INF, 250, 400, 1000, 1350},
	{600, 450, 250, INF, 250, 850, 1300},
	{700, 600, 400, 250, INF, 600, 1150},
	{1350, 1150, 1000, 850, 600, INF, 500},
	{1650, 1500, 1350, 1300, 1150, 500, INF}
};

int dist[7][7] = {
	{INF, 6, 13, 18, 23, 43, 58},
	{6, INF, 7, 12, 17, 37, 52},
	{13, 7, INF, 5, 10, 30, 45},
	{18, 12, 5, INF, 5, 25, 40},
	{23, 17, 10, 5, INF, 20, 35},
	{43, 37, 30, 25, 20, INF, 15},
	{58, 52, 45, 40, 35, 15, INF}
};

bool in_bargain_time(int h, int m) {
	return (17 * 60+ 30 <= h * 60 + m && h * 60 + m <= 19 * 60 + 30);
}

int main() {
	int from, to, hf, mf, ht, mt;
	while (cin >> from, from) {
		cin >> hf >> mf >> to >> ht >> mt;
		if ( (in_bargain_time(hf, mf) || in_bargain_time(ht, mt)) && dist[from-1][to-1] <= 40) {
			cout << (fee[from-1][to-1] / 2 + 49) / 50 * 50 << endl;
		} else {
			cout << fee[from-1][to-1] << endl;
		}
	}
	return 0;
}
		

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

int main(){
 int N,X,L,ans;
 cin>>N>>X;
 L=0;
 ans=1;
  
 for(int i=0;i<N;i++){
  int n;
  cin>>n;
  L+=n;
  if(L<=X) ans++;
  else break;
 }
  cout <<ans<<endl;
  
  return 0;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >vp;
/*void bti(ll n)
{
ll k=1;
  while(n!=0)
    {
    bin[k++]=n%2;
    n/=2;
    }
}*/
/*void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}*/
int main()
{
 ll n,k,a,ans=0;
 cin>>n>>k;
 for(int i=1;i<=n;i++)
 {
     cin>>a;
     if(a>=k)
        ans++;
 }
 cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
s = input()
l = len(s)
rl_list = []
lr_boundary_list = [0]
for i in range(l-1):
    if s[i] == "R" and s[i+1] == "L":
        rl_list.append((i,i+1))
    elif s[i] == "L" and s[i+1] == "R":
        lr_boundary_list.append(i+1)
lr_boundary_list.append(l)


lr_boundary_list_2 = [ (lr_boundary_list[i],lr_boundary_list[i+1]) for i in range(len(lr_boundary_list)-1) ]

ans_list = [ 0 for i in range(l) ]
for i in range(len(lr_boundary_list_2)):
    for j in range(lr_boundary_list_2[i][0],lr_boundary_list_2[i][1]):

        if (j - rl_list[i][0]) % 2 == 0:
            ans_list[rl_list[i][0]] += 1
        else:
            ans_list[rl_list[i][1]] += 1

    
print(*ans_list)

Measured memory_bytes: 51744
S = input()

l0 = [0 if i % 2 == 0 else 1 for i in range(len(S))]
l1 = [1 if i % 2 == 0 else 0 for i in range(len(S))]

gap0 = 0
gap1 = 0
for i in range(len(S)):
    if l0[i] != int(S[i]):
        gap0 += 1
    if l1[i] != int(S[i]):
        gap1 += 1

print(min(gap0, gap1))


Measured memory_bytes: 4724
#include "bits/stdc++.h"
using namespace std;

#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1)
	{
		cerr << name << " = " << arg1 << endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args)
	{
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
		__f(comma+1, args...);
	}
#else
#define debug(...)
#endif

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

const int MAXN = 2e5 + 5;

ll n, mod = 1e9 + 7, a[MAXN], b[MAXN], c1, c2, ans, c3;
map<pair<ll,ll>, bool>done;
map<pair<ll,ll>, ll>cnt;
set<pair<ll,ll>>s;

ll power(ll a, ll b)
{
	ll ans = 1;
	while(b > 0)
	{
		if(b & 1ll) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1ll;
	}
	return ans;
}

int main()
{
	FAST_IO;

	cin >> n;
	for(int i=0;i<n;i++) 
	{	
		cin >> a[i] >> b[i];
		if(!a[i] && !b[i]) c3 += 1;
		else if(!a[i]) c1 += 1;
		else if(!b[i]) c2 += 1;
		else
		{
			if((a[i] < 0 && b[i] < 0) || (a[i] > 0 && b[i] < 0)) a[i] *= -1, b[i] *= -1;
			ll g = __gcd(abs(a[i]), abs(b[i]));
			a[i] /= g; b[i] /= g;
			s.insert({a[i], b[i]}); 
			cnt[{a[i], b[i]}] += 1;
		}
	}	

	ans = (power(2, c1) + power(2, c2)) % mod;
	ans = (ans - 1 + mod) % mod;
	
	for(auto it : s)
	{
		if(done[it]) continue;

		ll x1 = cnt[it], num = -it.second, den = it.first;
		if((num < 0 && den < 0) || (num > 0 && den < 0)) num *= -1, den *= -1;

		ll x2 = cnt[{num, den}];
		
		ll temp = (power(2, x1) + power(2, x2)) % mod;
		temp = (temp - 1 + mod) % mod;
		ans = (ans * temp) % mod;
		
		done[it] = done[{num, den}] = 1;
	}
	ans = (ans + c3) % mod;
	cout << ((ans - 1) % mod + mod) % mod << endl;
	return 0;	
}

Measured memory_bytes: 69168
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const int Nmax=2e5+1;
const int Nd=61;
const int INF=1e5;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x; //
    return d[x] = find(d[x]); //
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main(){
  int n,m; cin>>n>>m;
  vector<int> a(m),b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--; b[i]--;
  }
  int ans=0;
  rep(i,m){
    UnionFind uf(n);
    rep(j,m){
      if(j!=i){
        uf.unite(a[j],b[j]);
      }
    }
    if(uf.size(0)!=n){
      ans++;
    }
  }

  cout<<ans<<endl;
  return 0;

}


Measured memory_bytes: 3608
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws java.io.IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            FastScanner fs = new FastScanner();

            final int num = 3;

            int[] A = new int[num];

            for (int i = 0; i < num; i++) {
                A[i] = fs.nextInt();
            }

            Arrays.sort(A);

            int ans = A[2] - A[0];
            System.out.println(ans);
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  vector<LL> a(n);
  vector<LL> b(n);

  REP (i, n) {
    cin >> a[i];
  }
  REP (i, n) {
    cin >> b[i];
  }

  LL a_sum = accumulate(a.begin(), a.end(), 0LL);
  LL b_sum = accumulate(b.begin(), b.end(), 0LL);

  vector<LL> v;

  if (a_sum < b_sum) {
    cout << -1 << endl;
  } else {
    REP (i, n) {
      if (a[i] != b[i]) {
        v.push_back(a[i] - b[i]);
      }
    }
    sort(v.begin(), v.end());

    int i = 0;
    int j = v.size() - 1;
    int d[v.size()] = {0};
    while (v[i] < 0 && i < j) {
      if (v[j] == 0) j--;
      else if (abs(v[i]) <= v[j]) {
        v[j] += v[i];
        d[i]++;
        d[j]++;
        i++;
      } else {
        v[i] += v[j];
        d[i]++;
        d[j]++;
        j--;
      }
    }
    int ans = 0;
    REP (i, v.size()) if (d[i] > 0) ans++;
    cout << ans << endl;
  }
}


Measured memory_bytes: 3060