akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#define x first
#define y second

namespace dizziness
{
	typedef std::pair<int,int> pii;
	bool cmp_L(pii A,pii B){return A.x<B.x;}
	bool cmp_R(pii A,pii B){return A.y<B.y;}

	struct cmpl{bool operator()(pii A,pii B){return A.x>B.x;}};
	struct cmpr{bool operator()(pii A,pii B){return A.y<B.y;}};

	const int N=101000,INF=1000000007;

	struct BIT
	{
		int s[N];
		inline int lowbit(int x){return x&(-x);}
		inline void inc(int p,int x){for(;p<N;p+=lowbit(p))s[p]+=x;}
		inline void modify(int L,int R,int x){inc(L,x),inc(R+1,-x);}
		inline int query(int p){int ret=0;for(;p;p-=lowbit(p))ret+=s[p];return ret;}
	}T;

	pii s[N];
	int A[N],C[N];
	int n,m,tot;
	void initialize()
	{
		static pii tmp[N];
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
			scanf("%d%d",&tmp[i].x,&tmp[i].y);
		for(int i=1;i<=n+1;i++)
			scanf("%d",C+i);
		std::sort(C+1,C+n+2);
		tot=0;
		for(int i=1;i<=n;i++)
		{
			int x=std::lower_bound(C+1,C+n+2,tmp[i].x)-C;
			int y=std::lower_bound(C+1,C+n+2,tmp[i].y)-C;
			A[i]=x;
			if(y<x)s[++tot]=pii(y,x-1);
		}
	}
	
	std::priority_queue<pii,std::vector<pii>,cmpl> Ql;
	std::priority_queue<pii,std::vector<pii>,cmpr> Qr;

	int f[N];
	int ans;
	bool calcf()
	{
//		for(int i=1;i<=n;i++)printf("%d ",A[i]);printf("\n");
//		for(int i=1;i<=n+1;i++)printf("%d ",C[i]);printf("\n");
//		for(int i=1;i<=tot;i++)printf("%d -- %d\n",s[i].x,s[i].y);
//		printf("-----------------------\n");

		for(int i=1;i<=n;i++)
			T.modify(A[i],n+1,1),T.modify(i,n+1,-1);
		T.modify(n+1,n+1,-1);

		std::sort(s+1,s+tot+1,cmp_R);

		int ind=tot;ans=0;
		for(int i=n+1;i;i--)
		{
			for(;ind && s[ind].y==i;ind--)
				Ql.push(s[ind]);
			while(T.query(i)<-1)
			{
				if(Ql.empty())return 0;
				pii A=Ql.top();Ql.pop();
				T.modify(A.x,A.y,1);
				ans++;
			}
		}

		tot=0;
		for(;!Ql.empty();Ql.pop())
			s[++tot]=Ql.top();
		std::sort(s+1,s+tot+1,cmp_L);

//		for(int i=1;i<=tot;i++)printf("%d -- %d\n",s[i].x,s[i].y);

		ind=1;f[0]=0;
		for(int i=1;i<=n+1;i++)
		{
			for(;ind<=tot && s[ind].x==i;ind++)
				Qr.push(s[ind]);
			f[i]=f[i-1];
			while(T.query(i)<0)
			{
				if(Qr.empty()){f[i]=INF;break;}
				pii A=Qr.top();Qr.pop();
				T.modify(A.x,A.y,1);
				f[i]++;
			}
		}

//		for(int i=1;i<=n+1;i++)
//			printf("%d ",f[i]);
//		printf("\n");

		return 1;
	}
	void solve()
	{
		initialize();
		bool flag=calcf();
		scanf("%d",&m);
		for(int x,y;m--;)
		{
			scanf("%d%d",&x,&y);

			x=std::lower_bound(C+1,C+n+2,x)-C;
			y=std::lower_bound(C+1,C+n+2,y)-C;
			
//			printf("%d %d\n",x,y);

			if(!flag)printf("-1\n");
			else 
			{
				int ret=ans+std::min(f[x-1],f[y-1]+1);
				ret=n+1-ret;
				printf("%d\n",ret>=0?ret:-1);
			}

		}
	}
}

int main()
{
//	freopen("F.in","r",stdin);
	dizziness::solve();
	return 0;
}


Measured memory_bytes: 5620
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<list>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {1, 1, 0, -1, -1, 0};
int dx[] = {1, 0, -1, -1, 0, 1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int n;
    while (cin >> n && n) {
        int c = 0;
        rrep(i, 1, n) {
            int tmp = i;
            rrep(j, i + 1, n) {
                tmp += j;
                if (tmp == n) c++;
                if (tmp > n) break;
            }
        }
        cout << c << endl;
    }
}



Measured memory_bytes: 3120
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
//~ #pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

int pref[maxn];

int ilebia(int l, int p)
{
  if(l > p)
    return 0;
  return pref[p] - pref[l - 1];
}

int ileczar(int l, int p)
{
  if(l > p) return 0;
  return (p - l + 1 - ilebia(l, p));
}

int main()
{
	_upgrade
  int n;
  cin>>n;
  string s;
  cin>>s;
  for(int i = 0;i < SZ(s);i++)
    pref[i + 1] = pref[i] + (s[i] == '.');
  int res = n;
  for(int i = 0;i <= n;i++)
    res = min(res, ileczar(1, i) + ilebia(i + 1, n));
  cout<<res;
	return 0;
}


Measured memory_bytes: 1300
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long n = parseLong(sc.next());
		long k = parseLong(sc.next());
		long a;
		long b;
		HashMap<Long, Long> ab = new HashMap<>();
		for (i = 0; i < n; i++) {
			a = parseLong(sc.next());
			b = parseLong(sc.next());
			if(ab.get(a)==null) {
				ab.put(a, b);
			} else {
				ab.put(a, ab.get(a)+b);
			}
		}
		sc.close();
		ArrayList<Long> abl = new ArrayList<>(ab.keySet());
		Collections.sort(abl);
		long cnt=0L;
		long ans=0L;
		for (Long ll:abl) {
			if(k<=cnt+ab.get(ll)) {
				ans = ll;
				break;
			}
			cnt+=ab.get(ll);
		}
		out.println(ans);
	}
}


Measured memory_bytes: 66220
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, y;
	cin >> n >> y;
	if (n * 10000 < y) {
		cout << "-1 -1 -1" << endl;
		return 0;
	}
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if (i * 10000 + j * 5000 == y - (n - i - j) * 1000) {
				if (i >= 0 && j >= 0 && (n - i - j) >= 0) {
					cout << i << " " << j << " " << n - i - j << " " << endl;
					return 0;
				}
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std ;
int main(){
    int n;
    cin >> n ;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v.at(i);
    }
    sort(v.begin(), v.end() );
    double a, val ;
    for(int i = 0; i < n - 1; i++){
        a = val ;
                if(i == 0){
                    a = v.at(i) ;
                }
        val = ( a + v.at(i + 1) )/2 ;
    }
    cout << setprecision(6) << val << endl ;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int a[100005], b[100005];
int asc1(const void* x, const void* y)
{
	if (a[*(int*)x] > a[*(int*)y])return 1;
	if (a[*(int*)x] < a[*(int*)y])return -1;
	if (b[*(int*)x] > b[*(int*)y])return 1;
	if (b[*(int*)x] < b[*(int*)y])return -1;
	return 0;
}
int asc2(const void* x, const void* y)
{
	if (b[*(int*)x] > b[*(int*)y])return 1;
	if (b[*(int*)x] < b[*(int*)y])return -1;
	if (a[*(int*)x] > a[*(int*)y])return 1;
	if (a[*(int*)x] < a[*(int*)y])return -1;
	return 0;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	for (i = 0; i < n - 1; i++)
	{
		scanf("%d %d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
	}
	int v[100005];
	for (i = 0; i < n; i++)
		v[i] = 0;
	for (i = 0; i < n - 1; i++)
	{
		v[a[i]]++;
		v[b[i]]++;
	}
	int k = 0;
	for (i = 0; i < n; i++)
		if (v[i] > k)
			k = v[i];
	printf("%d\n", k);
	int ans[100005];
	for (i = 0; i < n; i++)
		ans[i] = -1;
	int c[100005], d[100005];
	for (i = 0; i < n; i++)
		c[i] = d[i] = i;
	int ic[100005];
	qsort(c, n - 1, sizeof(int), asc1);
	qsort(d, n - 1, sizeof(int), asc2);
	ic[0] = -1;
	int q[100005], p;
	q[0] = 0;
	p = 1;
	int j, h;
	int min, max, mid;
	while (p > 0)
	{
		j = 1;
		p--;
		h = q[p];
		min = 0;
		max = n - 1;
		while (max - min > 1)
		{
			mid = (max + min) / 2;
			if (a[c[mid]] < h)
				min = mid;
			else
				max = mid;
		}
		if (a[c[min]] < h)
			min++;
		if (min < n - 1)
		{
			while (a[c[min]] == h)
			{
				if (ans[c[min]] < 0)
				{
					if (j == ic[h])j++;
					ans[c[min]] = j;
					q[p] = b[c[min]];
					ic[b[c[min]]] = j;
					j++;
					p++;
				}
				min++;
				if (min == n - 1)
					break;
			}
		}
		min = 0;
		max = n - 1;
		while (max - min > 1)
		{
			mid = (max + min) / 2;
			if (b[d[mid]] < h)
				min = mid;
			else
				max = mid;
		}
		if (b[d[min]] < h)
			min++;
		if (min < n - 1)
		{
			while (b[d[min]] == h)
			{
				if (ans[d[min]] < 0)
				{
					if (j == ic[h])j++;
					ans[d[min]] = j;
					q[p] = a[d[min]];
					ic[a[d[min]]] = j;
					j++;
					p++;
				}
				min++;
				if (min == n - 1)
					break;
			}
		}
	}
	for (i = 0; i < n - 1; i++)
		printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 3572
// C - Maximal Value
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main(){
    int n;
    cin >> n;
    vector<int> b(n-1);
    rep(i, n-1) cin >> b[i];
    int ans = b[0];
    for(int i=0; i<n-2; i++){
        ans += (min(b[i], b[i+1]));
    }
    ans += b[n-2];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    x, y, z = [int(i) for i in input().strip().split()]
    x = x - z
    ans = x // (y + z)
    print(ans)

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 61880
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define NUM 1000
 
int main(void) {
    int len, i;
    char string[NUM];
    fgets( string , NUM, stdin );
    len = strlen(string);
    for(i = 0; i < len; i++ ) {
        string[i] = toupper(string[i]);
    }
    printf("%s",string);
    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    if(n==0&&m==0)cout<<"0";//特判
    else {//使用公式(n-1)(m-1)
        --n;--m;
        cout<<n*m;
    }
    return 0;//好习惯
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int main()
{
	for(int i = 1;i <= 9;i++){
		for(int j = 1;j <= 9;j++){
			printf("%dx%d=%d\n",i,j,i * j);
		}
	}

	return 0;
}

Measured memory_bytes: 3112
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(L);
    READV(R);
    READV(d);
    cout<<(R/d)-((L-1)/d)<<endl;

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


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
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; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

ll n;
string s;

// Antsbook p.132
bool C(ll d){
    //dump(d, n, n-d);
    ll cnt = 0;
    // i=offset j=ptrt k=ptrs
    ll k = 0;
    repr(i, d, n){
        cnt = 0;
        repr(j, i, n){
            k = j-i;
            //dump(i, j, k, s[k], s[j]);
            if(s[k] == s[j]){
                cnt++;
                if(cnt >= d) return 1;
            }else{
                cnt = 0;
            }
        }
    }
    return 0;
}

ll BinarySearch(){
    // [lb, ub)
    ll lb = 0, ub = n/2+1;
    while(ub - lb > 1){
        ll mid = (lb + ub) / 2;
        //dump(lb, ub, mid);
        if(C(mid)){
            // [mid, ub)
            lb = mid;
        }else{
            // [lb, mid)
            ub = mid;
        }
    }
    return lb;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    
    cin >> n;
    cin >> s;
    
    cout << BinarySearch() << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  long S;
  cin >> S;
  //S=(10^9Y-X)
  //S/10^9==Y-1
  //S%10^9==v-x
  long v=1000000000;
  long x=(v-S%v)%v;
  long y=(S+x)/v;
  cout <<"0 0 1000000000 1 "<<x<<" "<<y<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();

        int sum = 0;
        int answer = 0;

        for (int i = 0; i <= a; i++) {
            for (int j = 0; j <= b; j ++) {
                for (int k = 0; k <= c; k++) {
                    sum = (i * 500 + j * 100 + k * 50);
                    if (sum == x) {
                        answer += 1;
                    }
                }
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

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; }
const int INF = 1e9;
const long long INFLL = 1LL<<60;

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

  ll n, a, b;
  cin >> n >> a >> b;

  if (a > b || (n == 1 && a != b)) {
    cout << 0 << endl;
    return 0;
  }

  ll mi = a * (n-1) + b;
  ll ma = a + b * (n-1);
  ll ans = ma - mi + 1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int n,k,i;
int cade[100001];
int main(void){
	while(1){
		scanf("%d %d",&n,&k);
		if(n==0 && k==0){
			break;
		}
		for(i=0;i<100001;i++){
			cade[i]=0;
		}
		int a,flg=0;
		for(i=0;i<k;i++){
			scanf("%d",&a);
			if(a==0){
				flg=1;
			}
			else {
				cade[a]=1;
			}
		}
		for(i=n;i>=1;i--){
			if(cade[i]>=1 && cade[i-1]>=1 && i-1!=0){
				cade[i-1]=cade[i]+1;
			}
		}
		for(i=1;i<n;i++){
			if(cade[i]>0 && cade[i+1]!=0){
				cade[i+1]=cade[i];
			}
		}
		int max=0;
		for(i=1;i<=n;i++){
			if(max<cade[i]){
				max=cade[i];
			}
		}
		if(flg==1){
			for(i=1;i<n;i++){
				if(cade[i]==0 && cade[i+1]>0){
					if(max<cade[i-1]+cade[i+1]){
						max=cade[i-1]+cade[i+1]+1;
					}
				}
			}
		}
		printf("%d\n",max);
	}	
	return 0;
}

Measured memory_bytes: 1420
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    a = list(mi())
    l = [0]*(10**5)
    m = -1
    for i in range(N):
        l[a[i]] += 1
    for i in range(10**5-2):
        t = l[i]+l[i+1]+l[i+2]
        m = max(m, t)
    print(m)


if __name__ == '__main__':
    main()


Measured memory_bytes: 84908
// Aizu 1111: Cyber Guardian
// 2017.9.13 bal4u@uu

#include <stdio.h>

typedef struct { int p; char s[10], d[10]; } FW;
FW fw[1050];

typedef struct { int p; char s[10], d[10], m[52]; } PK;
PK pk[1050];

int match(char *add, char *pat)
{
	int i;
	for (i = 0; i < 8; i++) if (pat[i] != '?' && pat[i] != add[i]) return 0;
	return 1;
}

int main()
{
	int n, m, i, j, s;
	char rule[10], *ss, *dd;

	while (scanf("%d%d", &n, &m) && (n|m)) {
		for (i = 0; i < n; i++)
			scanf("%s%s%s", rule, fw[i].s, fw[i].d), fw[i].p = *rule == 'p';
		for (i = 0; i < m; i++)
			scanf("%s%s%s", pk[i].s, pk[i].d, pk[i].m);
		for (i = 0; i < m; i++) {
			pk[i].p = 0, ss = pk[i].s, dd = pk[i].d;
			for (j = n-1; j >= 0; j--) {
				if (fw[j].p) {
					if (match(ss, fw[j].s) && match(dd, fw[j].d)) { pk[i].p = 1; break; }
				} else {
					if (match(ss, fw[j].s) && match(dd, fw[j].d)) break;
				}
			}
		}
		for (s = i = 0; i < m; i++) s += pk[i].p; printf("%d\n", s);
		for (i = 0; i < m; i++) if (pk[i].p)
			printf("%s %s %s\n", pk[i].s, pk[i].d, pk[i].m);
	}
	return 0;
}

Measured memory_bytes: 1836
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int n;
string a,b;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> a >> b;
    FOR(i,n,2*n+1) if (a.substr(i-n,2*n-i) == b.substr(0,2*n-i)) {
        cout << i;
        exit(0);
    }
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int time;
	int A,B;
	int carda,cardb;
	A=0;
	B=0;
	while(cin>>time&&time!=0){
		A=0;
		B=0;
		for(int i=0;i<time;++i){
			cin>>carda>>cardb;
			if(carda>cardb){
				A+=carda+cardb;
			}else if(carda<cardb){
				B+=carda+cardb;
			}else{
				A+=carda;
				B+=cardb;
			}
		}
		cout<<A<<' '<<B<<endl;
	}
	return 0;
}

Measured memory_bytes: 2976
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
using namespace std;
int main() {
	int a, b, c, d, e = 0;
	cin >> a >> b >> c >> d;
	if (a == b) {
		if (c == d) {
			e = 1;
		}
	}
	if (a == c) {
		if (b == d) {
			e = 1;
		}
	}
	if (a == d) {
		if (b == c) {
			e = 1;
		}
	}
	if (e == 0) {
		cout << "no" << endl;
	}
	else {
		cout << "yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+11;
int k,n,ans[N],len;
int main(){
//	freopen("ex.in","r",stdin);
	scanf("%d%d",&k,&n);
	if(k%2==0){
		printf("%d",k/2);
		for(int i=1;i<n;++i) printf(" %d",k);
		return 0;
	}
	for(int i=1;i<=n;++i) ans[i]=(k+1)/2;
	int T=n/2;
	len=n;
	while(T--){
		if(ans[len]==1) len--;
		else{
			ans[len]--;
			while(len<n) ans[++len]=k;
		}
	}
	for(int i=1;i<=len;++i) printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<array>

using namespace std;
 
int main(){
#include<iostream>

using namespace std;
  string a;
  cin >> a;
  int x = a.size();
  for(int i = 0;i < x;i++){
    for(int j = 0;j < x;j++){
      if(a[i] == a[j] && i != j){
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a1, a2, a3) = readLine()!!.split(' ').map(String::toInt)
    val c = intArrayOf(
        Math.abs(a1 - a2),
        Math.abs(a2 - a3),
        Math.abs(a3 - a1)
    ).sorted().dropLast(1).sum()
    println(c)
}


Measured memory_bytes: 38028
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    if b[i] > a[i]:
        ans += a[i]
        b[i] -= a[i]
        if b[i] >= a[i+1]:
            ans += a[i+1]
            a[i+1] = 0
        else:
            a[i+1] -= b[i]
            ans += b[i]
        
    else:
        ans += b[i]

print(ans)


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

using namespace std;

#define FOE(i, s, t) for (int i = s; i <= t; i++)
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define FOD(i, s, t) for (int i = s; i >= t; i--)

#define LL long long
#define mp make_pair
#define pb push_back

#define K 600001
#define M 1000000007
#define pow nqeofnqw

int n;
LL a[K], b[K];

vector<pair<LL, LL> > V;
map<pair<LL, LL>, int> cnt;

int lone;

LL gcd(LL a, LL b) {
	return (!b ? a : gcd(b, a % b));	
}

LL pow[K];

int main() {
	scanf("%d", &n);
	FOE(i, 1, n) scanf("%lld%lld", &a[i], &b[i]);
	pow[0] = 1;
	FOE(i, 1, n) pow[i] = (pow[i - 1] * 2) % M;

	FOE(i, 1, n) {
		if (a[i] == 0 && b[i] == 0) {
			lone++;
		} else {
			LL g = gcd(a[i], b[i]);
			a[i] /= g; b[i] /= g;
			
			if (a[i] < 0) {
				a[i] *= -1; b[i] *= -1;	
			}
			
			if (a[i] == 0 && b[i] < 0) {
				b[i] *= -1;	
			}
			
		//	printf("FIN %lld %lld\n", a[i], b[i]);
			
			V.pb(mp(a[i], b[i]));
			cnt[mp(a[i], b[i])] = cnt[mp(a[i], b[i])] + 1;
		}
	}
	
	if (V.size()) sort(V.begin(), V.end());
	
	LL ret = 1;
	
	FOR(i, 0, V.size()) {
		pair<LL, LL> V1 = V[i];
		pair<LL, LL> V2 = mp((V[i].second < 0 ? -V[i].second : V[i].second), (V[i].second < 0 ? V[i].first : -V[i].first));
		
		if (cnt[V1] > 0) {
			LL c1 = cnt[V1];
			LL c2 = cnt[V2];
			
		//	printf("?? %lld %lld\n", c1, c2);
		//	printf("(%lld, %lld), (%lld, %lld)\n", V1.first, V1.second, V2.first, V2.second);
			
			ret = ret * (((pow[c1] - 1 + M) % M + (pow[c2] - 1 + M) % M + 1) % M) % M;
			
			cnt[V1] = 0;
			cnt[V2] = 0;
		}
	}
	
	ret = (ret - 1 + M) % M;
	ret = (ret + lone) % M;
	
	printf("%lld\n", ret);
}

Measured memory_bytes: 35880
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,T,ans=10000;
    cin>>n>>T;
    int c,t;
    for(int i=0;i<n;i++){
        cin>>c>>t;
        if(t<=T){
            ans=min(ans,c);
        }
    }
    if(ans==10000){
        cout << "TLE"<<endl;
    }
    else{
        cout << ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#AtCoder 市には、5 つのアンテナが一直線上に並んでいます。
#これらは、西から順にアンテナ A,B,C,D,E と名付けられており、それぞれの座標は a,b,c,d,e です。
#2 つのアンテナ間の距離が k 以下であれば直接通信ができ、k より大きいと直接通信ができません。
#さて、直接 通信ができないアンテナの組が存在するかどうか判定してください。
#ただし、座標 p と座標 q (p<q) のアンテナ間の距離は q−p であるとします。

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())


if (e-a)>k or (e-b)>k or (e-c)>k or (e-d)>k or (d-a)>k or (d-b)>k or (d-c)>k or (c-a)>k or (c-b)>k or (b-a)>k:
    print(':(')
    
else:
    print('Yay!')
    

Measured memory_bytes: 38384
N, K = map(int, input().split())
h = [int(i) for i in input().split()]
dp = [10**6] * 100005
dp[0] = 0
# dp[1] = abs(h[1]-h[0])
for i in range(1, N):
    dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]) for j in range(1,min(K,i)+1))
    # print([dp[i-j] + abs(h[i-j] - h[i]) for j in range(1,min(K,i)+1)])
    # for j in range(1, min(K,i)+1):
    #     dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]))

print(dp[N-1])

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int main() {
  int n,d;
  cin >> n >> d;
  int x[n][d];
  int ans=0;

  rep(i,n){
    rep(j,d){
      cin >> x[i][j];
    }
  }
  rep(i,n){
    for(int j=i+1;j<n;j++){
      int psum=0;
      rep(k,d){
        psum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      //bool flag=false;
      rep(k,psum+1){
        if(k*k==psum){ans++;}
      }
      //if(flag)++ans;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <unordered_map>
#include <vector>
#include <utility>
#include <cassert>
#include <algorithm>
#include <cstring>

using namespace std;

int main(int argc, char *argv[]) {
  int N, K;
  cin >> N >> K;
  if(K == 1) cout << 0 << endl;
  else cout << (N - K) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	string ope,temp;
	map<string,bool> dict;
	for (int i = 0; i < n; ++i) {
		cin >> ope >> temp;
		if (ope == "insert") {
			dict[temp] = true;
		}
		else {
			if (dict[temp]) {
				cout << "yes" << endl;
			}
			else {
				cout << "no" << endl;
			}
		}
	}
	return 0;
}



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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};
bool dp[100010];

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

    dp[0] = 1;
    for(int i = 0; i < S.size(); ++i){
        if(!dp[i])continue; // そこまでで矛盾があったらとりあえず無視
        for(string s : divide){
            if(S.substr(i, s.size()) == s){ // うまく切れたら先に進む
                dp[i + s.size()] = 1;
            }
        }
    }
    cout << (dp[S.size()] ? "YES" : "NO") << endl;
    return 0;
}

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

using namespace std;

int main(){
  string S;
  cin >> S;
  int change = 0;
  for(int i = 0; i < S.size()-1; i++){
    if(S[i] != S[i+1]) change++;
  }
  cout << change;
  
  
  


}


Measured memory_bytes: 512
#include<iostream>
#include<stdlib.h>
#include<algorithm>
using namespace std;

int main(void) {
	int a[3],tmp,i,j;
	cin >> a[0] >> a[1] >> a[2];
	// 昇順ソート
	for (i = 0; i < 3; i++) {
		for (j=i+1; j < 3; j++) {
			if (a[i] > a[j]) {
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
	cout << a[2]-a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>

using namespace std;

int main(){
	stack<int> st;

	while( 1 ){
		int inout;
		cin >> inout;
		if(cin.eof()) break;

		if(inout == 0){
			cout << st.top() << endl;
			st.pop();
		}else{
			st.push(inout);
		}
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A[4];
  cin >> A[0] >> A[1] >> A[2] >> A[3];
  sort(A,A+4);
  if (A[0]==1 and A[1]==4 and A[2]==7 and A[3]==9){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
using ll = long long;
const ll infll = (1ll<<60);
const int mod = 1000000007;
using namespace std;

struct edge{
	int from;
	int to;
	ll cost;
};

vector<edge> graph;

vector<int> checkgraph[3000];
bool besucht[3000];

void checkdfs( int punkt ){
	if( besucht[punkt] ) return;
	besucht[punkt] = true;
	for( auto nextp : checkgraph[punkt] ){
		checkdfs( nextp );
	}
}

int main(){
	int n, m; ll p; cin >> n >> m >> p;
	const int s = 0, g = n-1;
	for( int i = 0; i < m; ++i ){
		int a, b, c; cin >> a >> b >> c;
		--a; --b;
		graph.push_back( (edge){a, b, -(c-p)} );
		checkgraph[a].push_back(b);
	}
	checkdfs(0); 
	vector<ll> d(n);
	fill_n( d.begin(), n, infll );
	d[s] = 0;
	int k = n-1;
	while( k-- ){
		for( auto e : graph ){
			if( !besucht[e.from] ) continue;
			d[e.to] = min(d[e.to], d[e.from]+e.cost);
		}
	}
    // Siehe auch: https://img.atcoder.jp/abc061/editorial.pdf
    // 解説が微妙に誤りで，「負閉路の長さが最大で N であるため…」と書いてあるが
    // 負閉路を検出さえすれば次の伝搬フェーズでゴールに正しく negativ は伝搬する
    // なので次のループはこの 1 回のみでよい 
	bool negativ[n];
	fill_n( negativ, n, false );
	for( auto e : graph ){
		if( !besucht[e.from] ) continue;
		if( d[e.to] > d[e.from]+e.cost ){
			d[e.to] = d[e.from]+e.cost;
			negativ[e.to] = true;
		}
	}
	k = n;
	while( k-- ){
		for( auto e : graph ){
			if( !besucht[e.from] ) continue;
			if( negativ[e.from] ) negativ[e.to] = true;
		}
	}
	if( negativ[g] ) cout << -1 << endl;
	else cout << max(0ll, -d[g]) << endl;
	return 0;
}

/*

基本方針: ベルマンフォードを動かす

負閉路について:
	ベルマンフォードは負の閉路がどこかにあることを検出できるが，そのままでは
	スタートからゴールに行く過程に負閉路があるかどうかはわからない
	・例 3 のノード 2 のような例（スタートから行けるがゴールには行けない）
		→	N-1 回ループを回したあと N 回目を回して，変化があった（⇔負閉路が存在する）ところから
			辿ってゴールに行けるかどうかを確かめる
	・例 3 のノード 3 のような例（ゴールには行けるがスタートからは行けない）
		→	グラフを DFS してたどり着く可能性のある場所を列挙しておく 

嘘解法: たくさん回してゴールの最短距離が更新されたら過程に負の回路がある
		これは正しくない（次のような例では C が更新されないが B で無限にループすることで最短距離を更新できる）
		　B ↩ -10
	-10　↗　 ↘ -10
		A ─→ C
		　-999

*/

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int n,count;
    count=0;
    while (cin>>n) {
        if (n==0) {
            break;
        } else {
            for (int i=1;i<=n;i++) {
                int hoge = i;
                while (hoge%5==0) {
                    count++;
                    hoge = hoge/5;
                }
            }
        }
        cout<<count<<endl;
        count=0;
    }
}


Measured memory_bytes: 2988
def f():
    N, M = map(int, input().split())
    s = []
    c = []

    for m in range(M):
        _s, _c = map(int, input().split())
        s.append(_s)
        c.append(_c)

    if N == 1:
        rg = range(10)
    else:
        rg = range(10 ** (N - 1), 10 ** N - 1)

    for i in rg:
        bl = True
        for m in range(M):

            if (i//(10**(N-s[m])))%10 != c[m]:
                bl = False
                break

        if bl:
            return i

    return -1


print(f())

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
int main()
{
	lli a, b; cin >> a >> b;
	lli arr[a + 50], mx = 1;
	for(int i=0; i<a; i++)
	{
		cin >> arr[i];
		if(i)
		{
			if(arr[i] + arr[i - 1] > arr[mx] + arr[mx - 1])
			{
				mx = i;
			}
		}
	}
	if(arr[mx] + arr[mx - 1] < b)
	{
		cout << "Impossible" << '\n';
		return 0;
	}
	cout << "Possible" << '\n';
	for(int i=1; i<mx; i++)
		cout << i << '\n';
	for(int i=a - 1; i > mx; i--)
		cout << i << '\n';
	cout << mx << '\n';
	return 0;
}

Measured memory_bytes: 1536
from math import sqrt

def readinput():
    n=int(input())
    return n

def main(n):
    k=int((-1+sqrt(1+8*n))/2)
    while(k*(k+1)//2<n):
        k+=1
    dif=k*(k+1)//2 - n
    for i in range(1,dif):
        print(i)
    for i in range(dif+1,k+1):
        print(i)

if __name__=='__main__':
    n=readinput()
    main(n)


Measured memory_bytes: 9208
# D
S = raw_input()

winner = ''
if S[0] == S[-1]:
    if len(S) % 2 == 0:
        winner = 'First'
    else:
        winner = 'Second'
else:
    if len(S) % 2 == 0:
        winner = 'Second'
    else:
        winner = 'First'

print winner

Measured memory_bytes: 2696
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
  int A, B, C, X, result;
  cin >> A >> B >> C >> X;
  for(int a = 0; a <= A; a++){
    for(int b = 0; b <= B; b++){
      for(int c = 0; c <= C; c++){
        int total = a*500 + b * 100 + c * 50;
        if(total == X) result++;
      }
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

type T = (i32, usize);
type P = (T, T);

fn update1(p: P, t: T) -> P {
    if (p.0).1 == t.1 || (p.1).1 == t.1 {
        return p;
    }
    if t > p.0 {
        return (t, p.0);
    }
    if t > p.1 {
        return (p.0, t);
    }
    return p;
}

fn update2(p: P, q: P) -> P {
    return update1(update1(p, q.0), q.1);
}

fn main() {
    let n: usize = read();
    let m = 1 << n;
    let a: Vec<i32> = (0..m).map({|_| read()}).collect();

    let mut dp: Vec<P> = vec![((0, m), (0, m)); m];

    for i in 0..m {
        dp[i] = update1(dp[i], (a[i], i));
    }

    for i in 0..m {
        for b in 0..n {
            let j = i | (1 << b);

            if j == b {
                continue;
            }
            dp[j] = update2(dp[j], dp[i]);
        }
    }

    let mut ans = 0;
    for k in 1..m {
        ans = std::cmp::max(ans, (dp[k].0).0 + (dp[k].1).0);
        // println!("{}: {:?}", k, dp[k]);
        println!("{}", ans);
    }

    //println!("{}", ans);
}


Measured memory_bytes: 15356
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        
        while (true) {
                c -= b;
                if (c <= 0) {
                        cout << "Yes" << endl;
                        return 0;
                }

                a -= d;
                if (a <= 0) {
                        cout << "No" << endl;
                        return 0;
                }
        }

        return 0;
}


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

int main()
{
	int n,k,ans=0,x;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&x);
		if(x>=k)++ans;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <cstring>
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
    ll S, W;

    cin >> S >> W;

    if(W >= S) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }

}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int len = s.length();
    for(int i=0; i<len; i++){
        if(i%2==0){
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define N 1000000007
#define pll pair<ll,ll>
#define fill_nums(A,n) for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}

pair<ll,ll> dfs(vector<vector<ll> > &adj, vector<bool> &visited, int idx) {
	visited[idx]=1;
	ll a=1, b=1;
	for(auto i:adj[idx]) {
		if(!visited[i]) {
			pair<ll,ll> t = dfs(adj,visited,i);
			a = (a*(t.first+t.second))%N;
			b = (b*t.first)%N;
		}
	}
	return {a,b};
}

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

	vector<vector<ll> > adj(n,vector<ll>());
	fill_edges(adj,n-1);

	vector<bool> visited(n,false);
	pair<ll,ll> t = dfs(adj,visited,0);
	cout<<(t.first+t.second)%N<<endl;

    return 0;
}




Measured memory_bytes: 12672
# -*- coding: utf-8 -*-
# モジュールのインポート
import math
import itertools

# 標準入力を取得
N = int(input())
x, y = [], []
for n in range(N):
    x_n, y_n = list(map(int, input().split()))
    x.append(x_n)
    y.append(y_n)

# 求解処理
def get_distance(i: int, j: int) -> float:
    return math.sqrt(math.pow(x[i] - x[j], 2) + math.pow(y[i] - y[j], 2))

ans = 0
for path in itertools.permutations(range(N), N):
    distance = 0
    for i in range(N - 1):
        distance += get_distance(path[i], path[i + 1])
    ans += distance
ans /= math.factorial(N)

# 結果出力
print(ans)

Measured memory_bytes: 9268
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
ll x,y,z;
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
} 
int main()
{
	x=read(),y=read(),z=read();
	cout<<z<<" "<<x<<" "<<y<<endl;
}

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

using namespace std;

int main() {
    int w, h, n;
    cin >> w >> h >> n;
    vector<vector<int>> rect(h);
    for (size_t i = 0; i < h; ++i) rect[i] = vector<int>(w, 0);
    for (size_t i = 0; i < n; ++i) {
        int x, y, a;
        cin >> x >> y >> a;
        switch (a)
        {
        case 1:
            for (size_t i = 0; i < h; ++i) {
                for (size_t j = 0; j < x; ++j) {
                    rect[i][j] = 1;
                }
            }
            break;
        case 2:
            for (size_t i = 0; i < h; ++i) {
                for (size_t j = x; j < w; ++j) {
                    rect[i][j] = 1;
                }
            }
            break;
        case 3:
            for (size_t i = 0; i < y; ++i) {
                for (size_t j = 0;j < w; ++j) {
                    rect[i][j] = 1;
                }
            }
            break;
        case 4:
            for (size_t i = y; i < h; ++i) {
                for (size_t j = 0; j < w; ++j) {
                    rect[i][j] = 1;
                }
            }
            break;
        default:
            break;
        }
    }
    int area = 0;
    for (size_t i = 0; i < h; ++i) {
        for (size_t j = 0; j < w; ++j) {
            if (rect[i][j] == 0) ++area;
        }
    }
    cout << area << endl;
    return EXIT_SUCCESS;
}

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

#define 	pie				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(int i = a ; i < b ; i++)
#define 	mod1 			1000003
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define 	E 				end()
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define 	vi 				vector<int>
#define     pi              pair<int, int>
#define 	vs 				vector<string>
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define     print2(a)       for(auto i : a)cout<<i;cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;

//g++ -std=c++14
//fixed<<setprecision(9);
//max_element(mp.begin(), mp.end(), compare)
//greater<int>()
//__builtin_popcount();


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

void solve()
{
    string str; cin>>str;
    if(str[2] == str[3] && str[4] == str[5])
        cout<<"Yes"<<nl;
    else
    {
        cout<<"No"<<nl;
    }
    

    

}

int main()
{
    int  t;
    //cin>>t;
    t = 1;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
#include <utility>
//#include <set>
//#include <map>
//#include <stack>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(vector<pll> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n,l ;
	cin >> n >> l ;
	vector<pll> p(n) ;
	for(int i=0;i<n;i++){
		ll a,b ;
		cin >> a >> b ;
		p.at(i) = make_pair(a,b) ;
	}
	ll ans = 0 ;
	ll cnt_r = 0,cnt_l = 0 ;
	mysort(p) ;
	for(int i=0;i<n;i++){
		if(p.at(i).second==0){
			if(i==0){
				ans += p.at(i).first-1 ;
				p.at(i).first = 1 ;
			}else{
				if(cnt_r==cnt_l+1){
					ans += p.at(i).first-p.at(i-1).first-1 ;
					p.at(i).first = i+1 ;
					cnt_r = cnt_l = 0 ;
				}else if(cnt_r==0){
					ans += p.at(i).first-(i+1) ;
					p.at(i).first = i+1 ;
					cnt_r = cnt_l = 0 ;
				}else{
					cnt_l++ ;
					if(i==n-1){
						ans += (cnt_r-cnt_l)*(l-p.at(i).first) ;
					}else{
						ans += (cnt_r-cnt_l)*(p.at(i+1).first-p.at(i).first-1) ;
						p.at(i).first = p.at(i+1).first-1 ;
					}
				}
			}
		}else{
			cnt_r++ ;
			if(i==n-1) ans += (l-p.at(i).first)*(cnt_r-cnt_l) ;
			else{
				ans += (p.at(i+1).first-p.at(i).first-1)*(cnt_r-cnt_l) ;
				p.at(i).first = p.at(i+1).first-1 ;
			}
		}
	}
	cout << ans << endl ;
}



Measured memory_bytes: 4344
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n,m;
	cin>>n>>m;
	vvint vv(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--,b--;
		vv[a].PB(b);
		vv[b].PB(a);
	}
	vint p(n);
	deque<int> path(1,0);
	int now = 0;
	vint used(n);
	used[0] = 1;
	while(1){
		if(p[now]==vv[now].size()) break;
		while(p[now]<vv[now].size()){
			if(used[vv[now][p[now]]]){
				p[now]++;
				continue;
			}
			now = vv[now][p[now]++];
			used[now] = 1;
			path.PB(now);
			break;
		}
	}
	now = 0;
	while(1){
		if(p[now]==vv[now].size()) break;
		while(p[now]<vv[now].size()){
			if(used[vv[now][p[now]]]){
				p[now]++;
				continue;
			}
			now = vv[now][p[now]++];
			used[now] = 1;
			path.push_front(now);
			break;
		}
	}

	cout<<path.size()<<endl;
	bool first = true;
	for(int x: path){
		if(!first) cout<<" ";
		first = false;
		cout<<x+1;
	}
	cout<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 7552