akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
const ll M=1000000007;
//------------------------------------------//

int main(){
  int A,B;cin>>A>>B;
  bool flag=true;
  rep(i,1001){
    if(int(i*0.08)==A && int(i*0.1)==B){
      flag=false;
      cout<<i<<endl;
      break;
    }
  }
  if(flag) cout<<-1<<endl;
}

Measured memory_bytes: 3604
import java.util.Scanner;

class Main{
	public static void main(String args[]){
	Scanner scan = new Scanner(System.in);
	int i = 1;
	int x;
		do{
			x = scan.nextInt();
			if(x == 0){
				break;
			}	
			System.out.println("Case "+i+": "+x);
			i++;
		}while(true);
	}
}

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

using namespace std;

const uint64_t MOD = 1e+9 + 7;

struct VectorItem {
  uint64_t r, g, b;

  VectorItem(uint64_t r = 0, uint64_t g = 0, uint64_t b = 0)
    :r(r), g(g), b(b) {}
};

int main()
{
  uint64_t N;
  cin >> N;

  vector<uint64_t> A(N);
  for (uint64_t n = 0; n < N; ++n) { cin >> A[n]; }

  vector<VectorItem> B(N + 1);
  for (uint64_t n = 0; n < N; ++n) {
    B[n + 1] = B[n];

    if (B[n].r == A[n]) { ++B[n + 1].r; }
    else if (B[n].g == A[n]) { ++B[n + 1].g; }
    else if (B[n].b == A[n]) { ++B[n + 1].b; }
  }

  uint64_t S = 1;
  for (uint64_t n = 0; n < N; ++n) {
    uint64_t T = 0;

    if (B[n].r == A[n]) { ++T; }
    if (B[n].g == A[n]) { ++T; }
    if (B[n].b == A[n]) { ++T; }

    S = (S * T) % MOD;
  }
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 3328
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,k,a[maxn],p[maxn],p0[maxn],suf[maxn];

int main()
{
	n=read(); k=read(); rep(i,1,n) a[i]=read(),p[i]=p[i-1]+a[i];
	rep(i,1,n) if(a[i]>0) p0[i]=p0[i-1]+a[i]; else p0[i]=p0[i-1];
	per(i,n,1) if(a[i]>0) suf[i]=suf[i+1]+a[i]; else suf[i]=suf[i+1];
	ll ans=0;
	rep(i,k,n)
	{
		ll tmp=p0[i-k]+suf[i+1]; if(p[i]-p[i-k]>0) tmp+=(p[i]-p[i-k]);
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

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

// ITP1_1_D
// 秒で与えられる入力をh:m:sの形式に変換して出力
int main()
{
	int iInputS;
	int iHours;
	int iMinutes;
	int iSeconds;

	scanf("%d", &iInputS);
	iHours = iInputS / (60 * 60);
	iInputS = iInputS % (60 * 60);
	iMinutes = iInputS / 60;
	iSeconds = iInputS % 60;

	printf("%d:%d:%d\n", iHours, iMinutes, iSeconds);

	return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> c[i];
    rep(i, n) p[i]--;   /* パーミテーション1 始まりを0 始まりにずらし変換. */
    ll ans = -1e18;
    rep(si, n) {    /* siは開始位置. */
        int x = si;
        vector<int> s;
        ll tot = 0; /* 周期の中の合計がプラスかどうかを調べる用. */
        while (1) {
            x = p[x];   /* 移動先をセット. */
            s.push_back(c[x]);  /* 移動先のスコアを格納する配列. */
            tot += c[x];
            if (x == si) break; /* 1周したらやめる. */
        }
        /* このsの中のどこを切るかを全部試していく. */
        int l = s.size();
        ll t = 0; /* 周期内の今までの和. */
        rep(i, l) {
            t += s[i];
            if ((i+1) > k) break; /* kが1周期以下の回数時の避け. */
            ll now = t;
            if (tot > 0) {
                ll e = (k-(i+1))/l;   /* 何周できるか. */
                now += tot*e;
            }
            ans = max(ans, now);
        }
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3748
#include"bits/stdc++.h"
#include<valarray>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define MAX 100002

int n;
long long int x;

struct st{
	long long int b;
	long long int l;
	long long int u;
	inline long long int calc(long long int x){
		if(x<=b){
			return l*x;
		}
		long long int add=l*b;
		x-=b;
		return add+u*x;
	}
};

vector<st> v;

long long int cur;



inline bool check(long long int cnt){
	//long long int need=cur;
	long long int choose=cnt%x;
	vector<pair<long long int,int> > vv;
	for(int i=0;i<n;i++){
		vv.push_back(make_pair(v[i].b*v[i].l+(x-v[i].b)*v[i].u,i));
	}
	sort(vv.begin(),vv.end(),greater<pair<long long int,int> >() );
	long long int complete=cnt/x;
	if(choose==0LL){
		long long int ret=0;
		for(int j=0;j<complete;j++){
			ret+=vv[j].first;
		}
		return ret>=cur;
	}
	long long int ret=0;
	for(int j=0;j<complete;j++){
		ret+=vv[j].first;
	}
	for(int i=0;i<vv.size();i++){
		long long int tmp=ret;
		if(i<complete){
			tmp-=vv[i].first;
			tmp+=vv[complete].first;
		}
		int idx=vv[i].second;
		tmp+=v[idx].calc(choose);
		if(tmp>=cur)return true;
	}
	return false;
}

int main(){
	cin>>n>>x;
	for(int i=0;i<n;i++){
		long long int b,l,u;
		scanf("%lld%lld%lld",&b,&l,&u);
		cur+=b*l;
		v.push_back({b,l,u});
	}
	//(a[i]-b[i])*u  || a[i]>b[i]
	//(b[i]-a[i])*l[i]  || a[i]<b[i]
	long long int mint=0;
	long long int maxt=x*n;
	while(mint+1LL<maxt){
		long long int mid=(mint+maxt)/2LL;
		if(check(mid)){
			maxt=mid;
		}
		else{
			mint=mid;
		}
	}
	if(check(mint)){
		maxt=mint;
	}
	else{
		mint=maxt;
	}
	printf("%lld\n",mint);
	return 0;
}


Measured memory_bytes: 6932
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int N=Integer.parseInt(br.readLine());
		String s=br.readLine();
		int num;
		if(N>1){
	        num=Integer.parseInt(s.substring(0, s.indexOf(" ")));
		}else{
			num=Integer.parseInt(s.substring(0));
		}
        int min=num,max=num;
        long sum=num;
		if(N>1){
	        String[] a=s.substring(s.indexOf(" ")+1).split(" ");
	        for(String n:a){
	        	num=Integer.parseInt(n);
	            if(num<min) min=num;
	            if(num>max) max=num;
	            sum+=num;
	        }
		}
        System.out.println(min+" "+max+" "+sum);
	}
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N,K;
  cin>>N>>K;
  vector<bool>b(N,false);
  for(int i=0;i<K;i++){
    int d;
    cin>>d;
    for(int j=0;j<d;j++){
      int a;
      cin>>a;
      a--;
      b[a]=true;
    }
  }
  int ans=0;
  for(auto it:b)if(!it)ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	string S, T, result;
	cin >> S >> T;
	int rotateNum = 0;
	while (true) {
		if (S == T) {
			result = "Yes";
			break;
		}
		S.push_back(S[0]);
		S.erase(S.begin());
		rotateNum++;
		if (rotateNum >= T.size()) {
			result = "No";
			break;
		}
	}
	cout << result << endl;
	return 0;
}

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

typedef   long long  int ll;
typedef  long double ld;
typedef std::vector<ll> vi;
typedef std::vector<std::vector<ll> > vv;

#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,b) for(i=a;i<b;i++)
#define mp make_pair
#define pb(x) push_back(x)
#define fi first
#define se second
#define print(vec,a,b) for(ll i=a;i<b;i++) cout<<vec[i]<<" ";cout<<endl;
#define all(a) a.begin(),a.end()
#define input(vec,a,b) for(ll i = a;i<b;i++) cin>>vec[i];
#define ms(a,val) memset(a,val,sizeof(a))
using namespace std;

const int N = 1e5 + 5;


void solve(){
            ll i,j,n,m;
            ll mincost[N];
            ms(mincost,0);
            cin>>n;
            ll a[n];
            input(a,0,n);
            mincost[1] = abs(a[0]-a[1]);//a[0];
            fo(i,2,n)
            {
				mincost[i] = min(mincost[i-1]+abs(a[i]-a[i-1]),mincost[i-2]+abs(a[i-2]-a[i]));
			}
             cout<<mincost[n-1]<<endl;
            
    
            
						            









}

int main()
{
    IO;
      ll t=1;
      //cin>>t;


      while(t--)
      {

          solve();
      }
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

class UnionFind{
public:
  vector<int> p;		// 親
  vector<int> rank;	// サイズ・各集合の根のみ有効
  UnionFind(int n){
    p.resize(n, -1);
    rank.resize(n, 1);
  }
  int root(int x){
    if(p[x] == -1)return x;
    else return p[x] = root(p[x]); // 深さを 1 にしている
  }
  void unite(int x, int y){
    x = root(x); y = root(y);
    if(x == y)return;
    if(rank[x] > rank[y]) swap(x, y); // rankの小さいものを下につける
    rank[y] += rank[x];
    p[x] = y;
  }
  //xが属すグループのサイズ
  int size(int x){ return rank[root(x)]; }
  bool same(int x, int y){ return (root(x) == root(y)); }
};

void solve()
{
  int n, m;
  cin >> n >> m;
  vector<int> p(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> p[i];
  }

  UnionFind uf(n + 1);
  ll inx, iny;
  for(int i = 0; i < m; ++i)
  {
    cin >> inx >> iny;
    uf.unite(inx, iny);
  }

  int ans = 0;
  for(int i = 0; i < n; ++i)
  {
    ans += uf.root(i + 1) == uf.root(p[i]);
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 4456
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  bool ans=false;
  int taka_hp,taka_att,aoki_hp,aoki_att;
  cin >> taka_hp >> taka_att >> aoki_hp >> aoki_att;
  rep(i,100){
    aoki_hp -=taka_att;
    taka_hp -=aoki_att;
    if(aoki_hp<=0){ans=true;break;}
    if(taka_hp<=0){ans=false;break;}
  }
  if (ans){cout << "Yes" <<endl;}
  else {cout << "No" <<endl;}
  return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn = 100005;
pair <int, int> v[maxn];
int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> v[i].first;
        v[i].second = i;
    }
    sort(v + 1, v + n + 1);
    for(int i = 1; i <= n; i++)
        cout << v[i].second << " ";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 1664
<?php
$n = fgets(STDIN);
$a = explode(' ', fgets(STDIN));
rsort($a);
$alice = 0;
$bob = 0;
for ($i = 0; $i < $n; $i++) {
    if ($i % 2 === 0) {
        $alice += $a[$i];
    } else {
        $bob += $a[$i];
    }
}
echo $alice - $bob;
?>

Measured memory_bytes: 3576
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
#include <climits>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
        // setw(6) << setfill('0')
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << "(" << v.first << ", " << v.second << ")";
    return ostr;
}

vector<string> split(const string &s, char delim) {
    vector<string> result;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
        if (!item.empty()) {
            result.push_back(item);
        }
    }
    return result;
}

int main() {
    double n; cin >> n;
    cout << ceil((n / 2)) / n << endl;
}


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

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

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

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N, M;
  cin >> N >> M;
  vector<ll> A(N);
  vector<pair<ll, ll>> BC;
  rep(i, N) cin >> A[i];

  rep(i, M) {
    ll b, c;
    cin >> b >> c;
    BC.push_back(make_pair(c, b));
  }
  sort(A.begin(), A.end());
  sort(BC.begin(), BC.end());
  reverse(all(A));
  reverse(all(BC));

  int i = 0, j = 0;
  ll ans = 0;
  for (int p = 0; p < N; p++) {
    if (A[j] < BC[i].first && i < M) {
      ans += BC[i].first;
      if (1 < BC[i].second)
        BC[i].second--;
      else
        i++;
    } else {
      ans += A[j];
      j++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3188
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

signed main()
{
    int x, p;
    cin >> x >> p;
    cout << setprecision(15) << (x+1)/2 * 100.0 / p << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MAX 100000

int A[MAX],n;

int sort(int p,int r){
  int x,i,j;

  x=A[r];
  i=p-1;

  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
    swap(A[i],A[j]);
  }
}
swap(A[i+1],A[r]);
return i+1;
}

int main(){
  int q;

  cin >> n;
  for(int i=0;i<n;i++) cin >> A[i];

  q=sort(0,n -1);

  for(int i=0;i<n;i++){
    if(i) cout << " ";
    if(i==q) cout << "[";
    cout << A[i];
    if(i==q) cout << "]";

  }
  cout << endl;
  return 0;
}



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

int main() {
  char a;
  cin >> a;
  if (a == 'a' || a == 'i' || a == 'u' || a == 'e'
    || a == 'o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
/*
 * Author: Zhang Jiangbin 
 * Created Time:  2011/8/22/ææä¸ 15:59:48
 * File Name: a.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
#define SZ(v) ((int)(v).size())

int main() 
{         
    int n, a, b, c, d, l, m, ll, dd, mm, inter, d_;
    for (scanf("%d", &n); n; scanf("%d", &n)){
        l = d = m = ll = dd = mm = 0;
    while (n--) {
        scanf("%d%*c%d%d", &a, &b, &d_);
        c = a;
        if (b>d_) {
            c = (c+1)%24;
            inter = d_-b+60;
        } else{
            inter = d_-b;
        }
        if (a<=5) a+=24;
        if (c<=5) c+=24;
        if (11<=a&&a<=14) {
            ll++;
            if (inter<=8) l++;
        } else
        if (18<=a&&a<=20) {
            dd++;
            if (inter<=8) d++;
        } else
        if (21<=a&&a<=25) {
            mm++;
            if (inter<=8) m++;
        }
    }
        printf("lunch ");if (ll==0) puts("no guest"); else printf("%d\n", int(1.0*l/ll*100));
        printf("dinner ");if (dd==0) puts("no guest"); else printf("%d\n", int(1.0*d/dd*100));
        printf("midnight ");if (mm==0) puts("no guest"); else printf("%d\n", int(1.0*m/mm*100));
}
    return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <vector>
#define X real()
#define Y imag()
#define EPS (1e-10)
using namespace std;
typedef complex<double> P;
typedef vector<P> Poly;
typedef pair<P,P> L;

namespace std{
  bool operator<(const P& a, const P& b){
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}

double dot(P a, P b){return a.X*b.X + a.Y*b.Y;}

double cross(P a, P b){return a.X*b.Y - a.Y*b.X;}

int ccw(P a, P b, P c){
  b -= a;c -= a;
  if(cross(b, c) > EPS) return 1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(c) - norm(b) > EPS) return -2;
  return 0;
}

bool is_cross(L a, L b){
  if(ccw(a.first,a.second,b.first)*ccw(a.first,a.second,b.second) <= 0 &&
     ccw(b.first,b.second,a.first)*ccw(b.first,b.second,a.second) <= 0) return true;
  return false;
}


P intersection(L a, L b){
  //??´???a??¨??´???b?????????
  return a.first + cross(b.second-b.first,a.first-b.first)/(-cross(b.second-b.first,a.second-b.first)+cross(b.second-b.first,a.first-b.first))*(a.second-a.first);
}

int in_poly(P a, Poly p){
  int n = p.size(), c = 0;
  for(int i = 0; i < n; ++i){
    P s = p[i]-a, t = p[(i+1)%n]-a;
    if(!ccw(s,t,P(0,0))) return 1;//??????
    if(s.Y > t.Y + EPS) swap(s,t);
    if((s.Y*t.Y < 0 || (s.Y*t.Y < EPS && t.Y > EPS)) && cross(s,t) < EPS) ++c;
  }
  if(c%2) return 2;//?????¨
  return 0;//?????¨
}


int main(){
  int N;
  map<int, int> M_x, M_y;
  while(cin >> N, N){
    double x, y;
    Poly W;
    for(int i = 0; i < N; ++i){
      cin >> x >> y;
      W.push_back(P(x,y));
      M_x[(int)x] = 0;
      M_y[(int)y] = 0;
    }
    Poly C;
    for(int i = 0; i < 4; ++i){
      cin >> x >> y;
      C.push_back(P(x,y));
      M_x[(int)x] = 0;
      M_y[(int)y] = 0;
    }
    int k = 0;
    vector<int> V_x;
    for(auto p: M_x){
      p.second = k++;
      V_x.push_back(p.first);
    }
    k = 0;
    vector<int> V_y;
    for(auto p: M_y){
      p.second = k++;
      V_y.push_back(p.first);
    }
    int n_x = V_x.size(), n_y = V_y.size();
    long long int ans = 0LL;
    for(int i = 1; i < n_x; ++i){
      for(int j = 1; j < n_y; ++j){
	P p = P((double)(V_x[i]+V_x[i-1])/2.0, (double)(V_y[j]+V_y[j-1])/2.0);
	if(in_poly(p,W) && !in_poly(p,C)) ans += (V_x[i]-V_x[i-1])*(V_y[j]-V_y[j-1]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3200
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define Y 110
#define Z 100010
long long max_num(long long x, long long y)
{
	return x > y ? x : y;
}
int main()
{
	long long n, w;
	long long (*wei) = (long long(*))malloc(100010  * sizeof(long long));

	long long(*val) = (long long (*))malloc(100010 * sizeof(long long));

	
	long long(*dp)[Z] = (long long (*)[Z])malloc(Y*Z * sizeof(long long));

	scanf("%lld%lld", &n, &w);
	for (long long  i = 1;i <= n;i++)
	{
		scanf("%lld%lld", &wei[i], &val[i]);
	}
	for (long long i = 0;i <= n;i++)dp[i][0] = 0;
	for (long long i = 0;i <= w;i++)dp[0][i] = 0;
	for (long long i = 1;i <= n;i++)
	{
		for (long long j = 1;j <= w;j++)
		{
			if (wei[i] > j)dp[i][j] = dp[i - 1][j];
			else dp[i][j]=max_num(dp[i - 1][j], val[i] + dp[i - 1][j - wei[i]]);
			
		}
	}

	printf("%lld", dp[n][w]);
	return 0;
}

Measured memory_bytes: 80768
#include<cstdio>
#include<queue>
#include<map>

using namespace std;
int main(void){
  int n=0,q=0;
  char namem[1000][10]={0};
  pair<int,int> prolon[1000];
  queue<pair<int,int> > que;
  scanf("%d%d",&n,&q);
  int i=0;
  for(i=0;i<n;i++){
    scanf("%s",namem[i]);
    prolon[i].first=i;
    scanf("%d",&(prolon[i].second));
    que.push(prolon[i]);
  }
  int time=0;
  pair<int,int> pc;
  while(!(que.empty())){
    pc=que.front();
    que.pop();
    if(pc.second<=q){
      time+=pc.second;
      printf("%s\x0020%d\n",namem[pc.first],time);
    }
    else{
      time+=q;
      pc.second-=q;
      que.push(pc);
    }
  }
  return 0;
}

Measured memory_bytes: 1084
n = int(input())
s = input()
from itertools import product

for v in product([1,0], repeat=2):
    v = list(v)
    for i in range(n-2):
        if v[i+1]:
            if s[i+1] == 'o':
                v.append(v[i])
            else:
                v.append(int(not v[i]))
        else:
            if s[i+1] == 'o':
                v.append(int(not v[i]))
            else:
                v.append(v[i])
    ans = [0,0]
    for i in range(-1,1):
        if v[i]:
            if s[i] == 'o':
                if v[i-1] == v[i+1]:
                    ans[i+1] = 1
                else:
                    ans[i+1] = 0
            else:
                if v[i-1] != v[i+1]:
                    ans[i+1] = 1
                else:
                    ans[i+1] = 0
        else:
            if s[i] == 'o':
                if v[i-1] == v[i+1]:
                    ans[i+1] = 0
                else:
                    ans[i+1] = 1
            else:
                if v[i-1] != v[i+1]:
                    ans[i+1] = 0
                else:
                    ans[i+1] = 1
    if ans[0] and ans[1]:
        for i in range(n):
            if v[i]:
                v[i] = 'S'
            else:
                v[i] = 'W'
        print(''.join(v))
        exit()
print(-1)


    

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

using namespace std;

#define ll long long
#define ull unsigned long long

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

    int a, b, c;
    cin >> a >> b >> c;
    if ((a == b && b == c) || (a != b && b != c && c != a)) cout << "No\n";
    else cout << "Yes\n";
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		ArrayList<Character> c = new ArrayList<>();
		int a=0,b=0;
		for(int i=0 ; i<s.length(); i++) {
			c.add(s.charAt(i));
		}
		for(int i=0 ; i<c.size() ; ++i) {
			if(c.get(i) == '0') {
				a++;
			}else {
				b++;
			}
		}
		if(a>=b) {
			System.out.println(b*2);
		}else {
			System.out.println(a*2);
		}
    }
}


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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

struct Node{
	int key;
	Node* parent;
	Node* left;
	Node* right;
};

Node* root;
Node* NIL;

void insert(int key){
	Node* x = root;
	Node* y = NIL;
	Node* z;
	z = (Node*)malloc(sizeof(Node));
	z->key = key;
	z->left = NIL;
	z->right = NIL;
	while(x != NIL){
		y = x;
		if(x->key < z->key){
			x = x->right;
		}else{
			x = x->left;
		}
	}
	z->parent = y;
	if(y == NIL){
		root = z;
	}else{
		if(y->key > z->key){
			y->left = z;
		}else{
			y->right = z;
		}
	}
}

void preorder(Node* x){
	cout << " " << x->key;
	if(x->left != NIL) preorder(x->left);
	if(x->right != NIL) preorder(x->right);
}

void inorder(Node* x){
	if(x->left != NIL) inorder(x->left);
	cout << " " << x->key;
	if(x->right != NIL) inorder(x->right);
}

int main(){
	int n;
	cin >>n;
	rep(i,n){
		string s;
		int k;
		cin >> s;
		if(s[0] == 'i'){
			cin >> k;
			insert(k);
		}
		if(s[0] == 'p') {
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}
	}
}



Measured memory_bytes: 26600
# coding: utf-8
# Your code here!

from collections import deque

N = int(input())
a = deque(list(map(int, input().split())))
tmp = 0
ctr = 0

for i in range(N):
    tmp = a.pop()
    if a == deque([]):
        ctr += 1
    elif max(a) <= tmp:
        ctr += 1
print(ctr)


Measured memory_bytes: 3316
#coding: utf-8

S = input()

N = len(S)-1

def calc(S, bit):
    retval = 0
    l = 0
    for i in range(N):
        if ((bit >> i) & 1):
            retval += int(S[l:i+1])
            l = i+1
    retval += int(S[l:])
    return retval 

ret = 0
for i in range(2 ** N):
    ret += calc(S, i)

print(ret)


Measured memory_bytes: 8920
X,Y,Z,K=map(x->parse(Int,x),split(readline()))
A=sort(map(x->-parse(Int,x),split(readline())))
B=sort(map(x->-parse(Int,x),split(readline())))
C=sort(map(x->-parse(Int,x),split(readline())))
P=Array{Int}(0)
for i=1:X
	for j=1:Y
		for k=1:Z
			if i*j*k<=K
				push!(P,A[i]+B[j]+C[k])
			else
				break
			end
		end
	end
end
sort!(P)
for i=1:K
	println(-P[i])
end


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

int main(){
int X, A, B;
cin >> X >> A >> B;

if(A >= B) print("delicious");
else if(A + X >= B) print("safe");
else print("dangerous");
}



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

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s="";
	
	int s1s2=0, s3s4=0;
	bool isYY_=false, is_MM=false;
	bool isMM_=false, is_YY=false;
	
	cin >> s;
	
	s1s2 = ((s[0]-48)*10) + (s[1]-48);
	s3s4 = ((s[2]-48)*10) + (s[3]-48);
	
	if(s1s2 <= 99 && s1s2 >=0) isYY_=true;
	if(s3s4 <= 12 && s3s4 >=1) is_MM=true;
	
	if(s1s2 <= 12 && s1s2 >=1) isMM_=true;
	if(s3s4 <= 99 && s3s4 >=0) is_YY=true;
	
	if(isYY_ && is_MM && isMM_ && is_YY) cout << "AMBIGUOUS";
	else if(isYY_ && is_MM) cout << "YYMM";
	else if(isMM_ && is_YY) cout << "MMYY";
	else cout << "NA";
	
	
	return 0;
}


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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int inf = int (1e9) + int (1e5);
const ll infl = ll(2e18) + ll(1e10);
const ui M = 1E9 + 7;
const double eps = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);i++)
#define MP make_pair

const int NMAX=100000;

int main() {
   // freopen("in.txt", "r", stdin);
    int N;
    cin >> N;
    int cnt = 0;
    vi A(N);
    for (int i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    int ii=0;
    while (ii<N-1){
        if (A[ii]==ii+1){
            if (A[ii+1]==ii+2){
                cnt++;
                swap(A[ii],A[ii+1]);
                ii +=2 ;
            }
            else{
                swap(A[ii],A[ii+1]);
                cnt++;
                ii++;
            }
        }
        else ii++;
    }
    if (A[N-1]==N) cnt++;
    cout << cnt;

    return 0;
}


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

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> ans(N);
  for (int i = 0; i < N; i++){
    ans.at(i) = 0;
  }
  
  int a, b;
  for (int i = 0; i < M;i++){
    cin >> a >> b;
    ans.at(a-1)++;
    ans.at(b-1)++;
  }
  
  for (int i = 0; i < N; i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <list>

using namespace std;

int main() {
	int n, m, q; cin >> n >> m >> q;
    list<int> st;
	for (int i = 0; i < n; ++i) st.push_back(i);
	auto it = st.begin();
	while (m--) {
		int a; cin >> a;
		if (a & 1) {
			while (a--) {
				if (it == st.begin()) it = st.end();
				it--;
			}
		} else {
			while (a--) {
				it++;
				if (it == st.end()) it = st.begin();
			}
		}
		it = st.erase(it);
		if (it == st.end()) it = st.begin();
	}
	while (q--) {
		int qu; cin >> qu;
		auto qit = lower_bound(st.begin(), st.end(), qu);
		cout << ((qit != st.end() && *qit == qu) ? 1 : 0) << endl;
	}

	return 0;
}


Measured memory_bytes: 9308
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

ll f(ll n) {
  if(n % 2)
    return (n + 1) / 2 % 2;
  else
    return n / 2 % 2 ^ n;
}

int main() {
  ll a, b;
  cin >> a >> b;
  a--;
  cout << (f(a) ^ f(b)) << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[M];
    int[] B = new int[M];
    for (int i = 0; i < M; i++) {
      A[i] = sc.nextInt();
      B[i] = sc.nextInt();
    }
    int[] C = new int[K];
    int[] D = new int[K];
    for (int i = 0; i < K; i++) {
      C[i] = sc.nextInt();
      D[i] = sc.nextInt();
    }
    sc.close();

    @SuppressWarnings("unchecked")
    List<Integer>[] f = new List[N + 1];
    for (int i = 0; i < M; i++) {
      int a = A[i];
      int b = B[i];
      if (f[a] == null) f[a] = new ArrayList<>();
      if (f[b] == null) f[b] = new ArrayList<>();
      f[a].add(b);
      f[b].add(a);
    }

    int[] gn = new int[N + 1];
    int[] gc = new int[N + 1];
    for (int i = 1; i < N + 1; i++) {
      Deque<Integer> q = new ArrayDeque<>();
      q.addLast(i);
      while (!q.isEmpty()) {
        int n = q.pollLast();
        if (gn[n] != 0) continue;
        gn[n] = i;
        gc[i]++;
        q.addAll(f[n] != null ? f[n] : Collections.emptyList());
      }
    }

    int[] bc = new int[N + 1];
    for (int i = 0; i < K; i++) {
      int c = C[i];
      int d = D[i];
      if (gn[c] == gn[d]) {
        bc[c]++;
        bc[d]++;
      }
    }

    int[] ans = new int[N + 1];
    for (int i = 1; i < N + 1; i++)
      ans[i] = gc[gn[i]] - 1
          - (f[i] != null ? f[i].size() : 0)
          - bc[i];

    for (int i = 1; i < N + 1; i++)
      System.out.print(ans[i] + " ");
    System.out.println();
  }
}

Measured memory_bytes: 110584
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define mod 1000000007

using namespace std;
class CompareFirst
{
public:
  bool operator()(pair<int,int> n1,pair<int,int> n2) {
    return n1.first>n2.first; //>:desc <:asc
  }
};

int main(){

  long long n,k,ans;

  //入力を受け取る
  cin >> n;
  n--;

  //ans = 0.5 * n * (n+1) (1,...,n-1の和） 
  //桁あふれしないように、変数kで途中計算を受け取る
/*
  if(n%2==0){
    k=n/2;
    ans = k*(n+1);
  }else{
    k=(n+1)/2;
    ans = n*k;
  }*/
  ans = n*(n+1)/2;
 
  cout << ans << endl;
  return 0;

}


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

using namespace std;

int main() {
    string s;
    getline(cin, s);

    int n = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '1') {
            n++;
        }
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
K,T=map(int,raw_input().split())
arr=map(int,raw_input().split())

yesterday=-1
nokori1=False
for i in range(K):
    
    mai=arr.index(max(arr))
    if yesterday!=mai:
        arr[mai]-=1     #一番多いのを食べる
        yesterday=mai
        #print mai
    else:
        for j in range(len(arr)+1):
            if j==len(arr):
                nokori1=True
                break
            if arr[j]>0 and yesterday!=j:
                arr[j]-=1
                yesterday=j
                #print j
                break
    if nokori1:
        break
ans=0
if arr.index(max(arr))==yesterday:
    ans=max(arr)
else:
    ans=max(arr)-1
if ans==-1:
    ans+=1
print ans



Measured memory_bytes: 14444
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main() {
  int N,A,B,C,D;
  string S;
  cin>>N>>A>>B>>C>>D>>S;
  bool CAN=true;
  
  for(int i=A; i<max(C,D); ++i){
    if(S[i]=='#'&&S[i+1]=='#') CAN=false;
  }
  
  if(C>D){
    bool CAN2=false;
    for(int i=B-1; i<=D-1; ++i){
      if(S[i-1]=='.'&&S[i]=='.'&&S[i+1]=='.') CAN2=true;
    }
    if(CAN2==false) CAN=false;
  }
  
  if(CAN) COYe;
  else CONo;
  return 0;
}

Measured memory_bytes: 640
M=1000003
o=->a,n{n<1?1:(n%2>0?a:1)*o[a,n/2]**2%M}
f=f=1,*(1..M).map{|i|f=f*i%M}
gets
$<.map{|s|x,d,n=s.split.map &:to_i
t=x*o[d,M-2]%M
p d<1?o[x,n]:M<t+n ?0:f[t+n-1]*o[f[t-1],M-2]*o[d,n]%M}

Measured memory_bytes: 19580
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

a = l()

al = []

co = 1

for i in range(n):
    if a[i] == 0:
        co *= max(0,(3-len(al)))
        al.append(0)
    else:
        on = 0
        flag = True
        for j in range(len(al)):
            if al[j] == a[i]-1:
                on += 1
                if flag == True:
                    al[j] += 1
                    flag = False
        co *= on
        co %= mod
print(co)




Measured memory_bytes: 53740
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
vector<bool> isPrime(100010);
vector<int> acm(100010);
//------------------------------------------------------------------------------
void _main()
{
    isPrime.assign(100010, true);
    isPrime[0] = isPrime[1] = false;
    for (int i = 0; i < 100010; ++i)
    {
        if (isPrime[i])
        {
            for (int j = 2; i * j < 100010; ++j)
            {
                isPrime[i * j] = false;
            }
        }
    }

    acm.assign(100010, 0);
    rep(i, 1, 100010)
    {
        const bool like2017 = (i % 2 == 1) && isPrime[i] && isPrime[(i + 1) / 2];
        acm[i] = acm[i - 1] + (like2017 ? 1 : 0);
    }

    int Q;
    cin >> Q;
    int l, r;
    rep(i, 0, Q)
    {
        cin >> l >> r;
        cout << acm[r] - acm[l - 1] << endl;
    }
}


Measured memory_bytes: 1024
import java.util.*;
class Main{
  public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
	int N = stdIn.nextInt();
    int K = stdIn.nextInt();
	int[] h = new int[N];
    int count=0;
	for(int i=0;i<N;i++){
      h[i]=stdIn.nextInt();
      if(h[i]>=K){
        count++;
      }
	}
    System.out.println(count);
  }
}
    
    

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

int main(){
  string S;
  cin >> S;
  int l = S.size();
  string T;
  cin >> T;
  string ans = "Yes";
  for(int i=0;i<l;i++){
    if(S.at(i) !=T.at(i)){
      ans = "No";
      break;
    }
  }
  int ll =T.size();
  if(ll != l+1){
    ans = "No";
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 3628
// https://atcoder.jp/contests/abc071/tasks/arc081_b

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 52;
const int MOD = 1000000007;

const int INITIAL = 0;
const int VERTICAL = 1;
const int HORIZONTAL = 2;

const int coef[3][3] = { {0, 3, 6}, {0, 2, 2}, {0, 1, 3} };

int N;
char S[2][N_MAX + 1];

vector<int> a;

void solve() {
  a.push_back(INITIAL);
  bool skip = false;
  REP(i, N) {
    if (skip) {
      skip = false;
    } else if (S[0][i] == S[1][i]) {
      a.push_back(VERTICAL);
    } else {
      a.push_back(HORIZONTAL);
      skip = true;
    }
  }
  ll ans = 1;
  REP(i, a.size() - 1) {
    ans = ans * coef[a[i]][a[i + 1]] % MOD;
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, 2) scanf("%s", S[i]);
}

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


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int mod = 1e9 + 7;

int sm(int a) {
    if(a%2 == 0) {
        return a/2*(a+1)%mod;
    } else {
        return (a+1)/2*a%mod;
    }
}

int pow(int a, int b) {
    if(b == 0) return 1;
    if(b%2) return a*pow(a, b-1)%mod;
    return pow(a*a%mod, b/2)%mod;
}

int ncr(int a, int b) {
    int ret = 1;
    for(int i = 0; i < b; ++i) {
        int num = a-i;
        ret = (ret*num)%mod;
    }
    int denom = 1;
    for(int i = 1; i <= b; ++i) {
        denom = (denom*i)%mod;
    }
    ret *= pow(denom, mod-2);

    return ret;
}

int32_t main() {

    int n, m, k; cin >> n >> m >> k;

    int ans = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < m; ++j) {
            int left = sm(j);
            int right = sm(m-j-1);
            int rows_below = n-i-1;
            int below = (left+right)*rows_below + m*sm(rows_below);
            ans += right + below;
            ans %= mod;
        }
    }

    int picks = ncr(n*m-2, k-2)%mod;
    ans = (ans*picks)%mod;

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int power(int a,int n){
  int res = 1;
  while(n){
    if(n%2){
      res = res * a;
      n--;
    }
    else{
      a = a*a;
      n/=2;
    }
  }
  return res;
}
 
int main(){
  int a;
  cin>>a;
  int aSq = power(a,2);
  int aCu = power(a,3);
  cout<< a+ aCu + aSq;
  return 0;
}

Measured memory_bytes: 3688
package main

import (
	"errors"
	"fmt"
	"math"
)

func main() {
	var A, B int64
	fmt.Scanf("%d", &A)
	fmt.Scanf("%d", &B)

	gcd, _ := GCD(A, B)
	pfs := PrimeFactors(gcd)

	fmt.Println(1 + len(pfs))
}

func GCD (a, b int64) (int64, error) {
	ret := int64(-1)

	var n int64
	for n = 1; n * n <= a; n++ {
		if a % n == 0 {
			if b % n == 0 {
				ret = int64(math.Max(float64(n), float64(ret)))
			}

			t := a / n
			if b % t == 0 {
				ret = int64(math.Max(float64(t), float64(ret)))
			}
		}
	}

	if ret == -1 {
		return ret, errors.New("empty!")
	} else {
		return ret, nil
	}
}

func PrimeFactors(n int64) map[int64]int64 {
	ret := make(map[int64]int64)

	for n % 2 == 0 {
		ret[2]++
		n /= 2
	}

	var i int64
	for i = 3; i * i <= n; {
		if n % i == 0 {
			ret[i]++
			n /= i
		} else {
			i += 2
		}
	}

	if n != 1 {
		ret[n]++
	}

	return ret
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
long long MOD = 1e9 + 7;
constexpr ll INF = 1e17;

ll selectLargestDivisor(long long n) {
    for (unsigned long long i = sqrt(n) + 1; i >= 1; i--)
    {
        if (n % i == 0) {
            return i;
        }
    }
    return -1LL;
}


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

    ll n;
    cin >> n;

    auto divisor = selectLargestDivisor(n);
    ll ans2 = n / divisor;
    cout << divisor + ans2 - 2 << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
      	double b = sc.nextDouble();
        double x = sc.nextDouble();
        System.out.println((a*a*b/2<=x)?180*Math.atan(2*(a*a*b-x)/(a*a*a))/Math.PI:180*Math.atan(a*b*b/(2*x))/Math.PI);
    }
}

Measured memory_bytes: 23252
N=int(input())
A=list(map(int,input().split()))
D={}

s=0
for i in range(N):
    if D.get(A[i],None)==None:
        D[A[i]]=1
    else:
        D[A[i]]+=1
        s+=1

if s%2==1:
    print(N-s-1)
else:
    print(N-s)

Measured memory_bytes: 61996
b,w=map(int,input().split())
H = 100
bc = wc = 1
print(100,100)
for i in range(H):
    s=""
    for j in range(H):
        if i < 50:
            if i %2!=0 and j%2!=0 and wc<w and j !=99:
                s+='#'
                wc+=1
            else:s+='.'
        else:
            if i %2!=0 and j%2!=0 and bc <b  and j!=99:
                s+='.'
                bc+=1
            else:s+='#'
    print(s)


Measured memory_bytes: 3064
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


def rle(s):
    import itertools
    return list(map(lambda x: (x[0], len(list(x[1]))), itertools.groupby(s)))


s = rs()
ss = rle(s)
res = 0
index = 0
if ss[0][0] == '>':
    x = ss[0][1]
    res += x * (x + 1) // 2
    index = 1
for xx, yy in zip(ss[index::2], ss[index + 1::2]):
    x = xx[1]
    y = yy[1]
    z = max(x, y)
    w = min(x, y) - 1
    res += z * (z + 1) // 2 + w * (w + 1) // 2
if ss[-1][0] == '<':
    x = ss[-1][1]
    res += x * (x + 1) // 2
print(res)

Measured memory_bytes: 24228
import java.util.Scanner;

/**
 * Odds of Oddness
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();

            System.out.println((double) ((N + 1) / 2) / N);
        }
    }

}


Measured memory_bytes: 24020
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    if(n==100000) {
        printf("90909\n");
    }
    else if(n>=10000) {
        printf("%d\n", n-9090);
    }
    else if(n>=1000) {
        printf("909\n");
    }
    else if(n>=100){
        printf("%d\n", n-90);
    }
    else if(n>=9) {
        printf("9\n");
    }
    else {
        printf("%d\n", n);
    }
    return 0;
}


Measured memory_bytes: 128
S = input()
ans = 0
ACGT = 0
for i in range(len(S)):
  if S[i]=='A' or S[i]=='G' or S[i]=='C' or S[i]=='T':
    ACGT += 1
  else:
    ACGT = 0
  ans = max(ans,ACGT)
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

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

	LL cnt = 0, x;

	for (int i = 0; i < n; ++i) {
		cin >> x;
		if (x >= k) {
			cnt++;
		}
	}

	cout << cnt  << endl;
}

Measured memory_bytes: 256