akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstdio>
using namespace std;

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

typedef double Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src_, int dst_, Weight weight_) :
        src(src_), dst(dst_), weight(weight_) { }
    Edge(){}
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

struct UnionFind {
    vector<int> par;
    int cnt;
    UnionFind(int size_) : par(size_, -1), cnt(size_) { }
    bool merge(int x, int y){
        x = find(x); y = find(y);
        if (x != y) {
            if (par[y] < par[x]) swap(x, y);
            par[x] += par[y]; par[y] = x;
            cnt--;
        }
        return x != y;
    }
    bool get(int x, int y){
        return find(x) == find(y);
    }
    int find(int x){
        return par[x] < 0 ? x : par[x] = find(par[x]);
    }
    // optional
    int size(int x){
        return -par[find(x)];
    }
    // optional
    int size(){
        return cnt;
    }
};

int main(){
    int N,M;
    cin >> N >> M;
    vector<complex<double>> ps(N);
    rep(i,N){
        int x,y;
        cin >> x >> y;
        ps[i] = complex<double>(x,y);
    }
    Edges es(M);
    double s = 0;
    rep(i,M){
        int a,b;
        cin >> a >> b;
        a--, b--;
        double d = abs(ps[a]-ps[b]);
        es[i] = Edge(a,b,d);
        s += d;
    }
    sort(begin(es),end(es),[](const Edge & a, const Edge & b){
            return a.weight > b.weight;
        });
    UnionFind uf(N);
    rep(i,M){
        int a = es[i].src, b = es[i].dst;
        if(!uf.get(a,b)){
            s -= es[i].weight;
            uf.merge(a,b);
        }
    }
    printf("%.20lf\n", s);
}

Measured memory_bytes: 1872
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<P> op(m);
  rep(j, m) {
    ll b, c;
    cin >> b >> c;
    op[j] = make_pair(c, b);
  }
  sort(all(op));
  reverse(all(op));
  ll updating = n;
  rep(j, m) {
    ll nb = min(updating, op[j].second);
    op[j].second = nb;
    updating = max(0LL, updating - nb);
  }

  priority_queue<ll, vector<ll>, greater<ll>> queue;
  rep(i, n) queue.emplace(a[i]);
  rep(j, m) {
    for(int k = 0; k < op[j].second; k++) {
      ll na = queue.top();
      queue.pop();
      queue.emplace(max(na, op[j].first));
    }
  }

  ll ans = 0;
  while(queue.size()) {
    ans += queue.top();
    queue.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3704
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))

    tree = [[] for _ in range(n)]
    for idx, a in enumerate(A):
        tree[idx].append(a - 1)

    start = []
    depth = [0 for _ in range(n)]

    def dfs(v, p, d, cnt):
        depth[v] = d
        for u in tree[v]:
            if visited[u]:
                start.append([u + 1, depth[u], cnt + 1])
                return
            else:
                visited[u] = True
                dfs(u, v, d + 1, cnt + 1)
        return

    visited = [False for _ in range(n)]
    visited[0] = True
    dfs(0, -1, 0, 0)

    if k <= start[0][1]:
        print(depth.index(k) + 1)
    else:
        cnt = (k - start[0][1]) % (start[0][2] - start[0][1])
        res = start[0][1] + cnt
        print(depth.index(res) + 1)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 288248
# input string
s = list(input())

odd = True
easy = True

for ch in s:
    if odd:
        if ch == 'L':
            easy = False
            break
        odd = False
    else:
        if ch == 'R':
            easy = False
            break
        odd = True

if easy:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
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();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	double a, b, c, d, e, f;

	while(cin >> a >> b >> c >> d >> e >> f) {
		double x = (c*e-b*f)/(a*e-b*d);
		if(c*e-b*f == 0) {
			x = 0;
		}

		double y = -(c*d-a*f)/(a*e-b*d);
		if(c*d-a*f == 0) {
			y = 0;
		}

		printf("%.3f %.3f\n", x, y);
	}

	return 0;
}

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

using namespace std;

int main(){
    int n, mx=0, cnt=0;
    string s;
    cin >> n;
    cin >> s;
    for(int i=0;i<n;i++){
        if(s[i]=='I'){
            cnt++;
            mx = max(mx, cnt);
        }
        else if(s[i]=='D'){
            cnt--;
        }
    }
    cout << mx << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

signed main()
{
    int k, a, b;
    // Sample 1
    // k = 7
    // a = 500
    // b = 600
    // Expected Output: "OK"

    // Sample 2
    // k = 4
    // a = 5
    // b = 7
    // Expected Output: "NG"

    // Sample 3
    // k = 1
    // a = 11
    // b = 11
    // Expected Output: "OK"

    cin >> k;
    cin >> a;
    cin >> b;

    for (int i = a; i <= b; ++i) //value is a is not being read correctly
    {
        if (i % k == 0)
        {
            cout << "OK"
                 << "\n";
            return 0;
        }
    }
    cout << "NG"
         << "\n";

    return 0;
}


Measured memory_bytes: 3108
#include <cmath>
#include <vector>
#include <map>
#include <functional>
#include <queue>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>

using namespace std;

#define ll long long int
#define ti4 tuple<int,int,int,int>
#define pii pair<ll,ll>
#define REP(x,n) for(int x = 0;x < n;x++)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

ll dp[10][2];

string s;

ll dfs(int i, ll re, ll m)
{
    int c = s[i] - '0';
    ll t = re * 10 + c;
    if(i == s.length()-1)
    {
        return m + t;
    }
    ll sum = 0;
    {
        sum += dfs(i + 1,t,m);
    }
    {
        sum += dfs(i + 1,0,m+t);
    }
    return sum;
}

int main()
{
    cin >> s;
    ll ret = dfs(0, 0, 0);
    cout << ret << endl;
    return 0;
}

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

int main () {
int A,B;
  double i;
  cin >> A >> B;
  for (i=1;i<=1000;i++) {
    if ((int)(0.08*i)==A&&(int)(0.10*i)==B) {
    cout << i << endl;
    return 0;
    }
  }
  cout << -1 << endl;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> P;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)


const ll mod = 1000000007;

ll get(ll x) {
	switch (x) {
	case 1:
		return 300000;
	case 2:
		return 200000;
	case 3:
		return 100000;
	}
	return 0;
}

int main(void)
{
	int x, y;
	cin >> x >> y;
	ll sum = 0;
	sum += get(x);
	sum += get(y);
	if (x == 1 && y == 1) {
		sum += 400000;
	}
	cout << sum << endl;
	return 0;

}


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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A;
    vector<int> B;
    vector<int> C;
    for (int i = 0, num = 0; i < N; i++){ cin >> num; A.push_back(num);}
    for (int i = 0, num = 0; i < N; i++){ cin >> num; B.push_back(num);}
    for (int i = 0, num = 0; i < N; i++){ cin >> num; C.push_back(num);}
    long long total = 0;
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    for (int ansB = 0; ansB < N; ansB++) {
        long long ansA = lower_bound(A.begin(), A.end(), B[ansB]) - A.begin();
        long long ansC = N - (upper_bound(C.begin(), C.end(), B[ansB]) - C.begin());
        total += ansA * ansC;
    }
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 1912
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll h,n;
	cin>>h>>n;
	vpii p(n);
	rep(i,0,n) cin>>p[i].F>>p[i].S;
	vi dp(1e4+4,inf);

	dp[0]=0;
	rep(i,0,n) rep(j,1,h+1) dp[j] = min(dp[j],dp[max(j-p[i].F,(ll)0)]+p[i].S);
	cout<<dp[h]<<"\n";

	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n;cin>>n;
	vector<ip> st(n);
	rep(i,n){st[i].second = i+1; cin>>st[i].first;}
	sort(all(st));
	for(auto x : st)cout<<x.second<<' ';
	cout<<endl; return 0;
}


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

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n,q;
ll a[200005];
map<ll,ll>map1;
//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;ll tot = 0;
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];tot = tot^a[i];
		}
		for(ll i=0;i<n;i++)cout<<(tot^a[i])<<" ";





}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    
}

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

using namespace std;

int main()
{
    // スペース区切りの整数の入力
    int N;
    string s;

    cin >> N;
    cin >> s;
    long long sum = 0;

    long long r_count, b_count, g_count;
    r_count = 0;
    b_count = 0;
    g_count = 0;

    for (int i = 0; i < N; i++)
    {
        if (s[i] == 'R')
        {
            r_count++;
        }else if (s[i] == 'G')
        {
            g_count++;
        }else if (s[i] == 'B')
        {
            b_count++;
        }
    }

    sum = r_count * g_count * b_count;

    for (int i = 0; i < N; i++)
    {
        for (int j = 1; i+j*2<N; j++)
        {
            if (s[i] != s[i+j] && s[i] != s[i+2*j] && s[i+j] != s[i+2*j])
            {
                sum--;
                //cout << i << " " << j << endl;
            }
        }
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3620
#    !/usr/bin/env python3
#    encoding: UTF-8
#    Modified: <07/Jul/2019 05:37:20 PM>


#    ✪ H4WK3yE乡
#    Mohd. Farhan Tahir
#    Indian Institute Of Information Technology (IIIT), Gwalior


import sys
import os
from io import IOBase, BytesIO


def dis(A, B):
    l = len(A)
    ans = 0
    for i in range(l):
        ans += (A[i] - B[i])**2
    return ans


def main():
    n, d = get_ints()
    arr = [0] * n
    for i in range(n):
        arr[i] = get_array()
    from math import floor, sqrt
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            dist = dis(arr[i], arr[j])
            x = floor(sqrt(dist))
            if x**2 == dist:
                ans += 1
    print(ans)


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2 == 1:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode("ascii"))
            self.read = lambda: self.buffer.read().decode("ascii")
            self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


if __name__ == "__main__":
    main()


Measured memory_bytes: 3192
(n,),a,*z=$<.map{_1.split.map &:to_i}
g=(d=[2e9]*-~n).map{[]}
z.map{g[_1]<<_2;g[_2]<<_1}
f=->u,r{x=d[k=d.bsearch_index{_1>=a[u-1]}]
d[k]=a[u-1]
$*[u]=r=[r,k+1].max
g[u].map{$*[_1]||f[_1,r]}
d[k]=x}
f[1,0]
puts$*

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

int main(){
	int n;
  	cin >> n;
  	int cnt = 0;
  	bool ok = false;
  	rep(i, n){
    	int a, b;
      	cin >> a >> b;
      	if(a == b) cnt++;
      	else cnt = 0;
      
      	if(cnt >= 3) ok = true;
    }
  
  	if(ok) cout << "Yes" << endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void){
    unsigned long long k,a,b,ans=1,p,q;
    scanf("%llu%llu%llu",&k,&a,&b);
    while(ans<a){
        ans++;
        k--;
        if (k==0){
            printf("%llu\n",ans);
            return 0;
        }
    }
    if (k%2==1){
        k--;
        ans++;
    }
    for (unsigned long long i=0; i<k/2; i++){
        if (ans<a){
            ans+=2;
        } else {
            p=ans+2;
            q=ans-a+b;
            ans=p>q?p:q;
        }
    }
    printf("%llu\n",ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll d;

int main(){
	cin >> d;
	cout << "Christmas";
	rep(i,25-d)cout << " Eve";
	cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;
using pr  = pair<ll, ll>;

const ll MOD = 998244353;


vec fac(200001); 
vec ifac(200001);

ll mpow(ll x, ll n) 
{
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans*x % MOD;
		x = x*x % MOD;
		n = n >> 1;
	}
	return ans;
}

ll comb(ll a, ll b) 
{
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % MOD;
	return tmp * fac[a] % MOD;
}

int main()
{
	int N, M, K;
	cin >> N >> M >> K;

	fac[0] = 1;
	ifac[0] = 1;
	for (ll i = 0; i < 200000; i++)
	{
		fac[i + 1] = fac[i] * (i + 1) % MOD;
		ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
	}
	
	ll ans = 0;
	for (ll i = 0; i <= K; ++i)
	{
		ll tmp = M;
		tmp = tmp * mpow(M - 1, N - 1 - i) % MOD;
			tmp = tmp * comb(N - 1, i) % MOD;

		ans = (ans + tmp) % MOD;
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 6264
def main():
    N, A, B = map(int, input().split())
    diff = abs(A-B)
    if diff%2 == 0:
        ans = diff//2
    else:
        # 端に行く
        # 一回端のままになる => 偶数のときと同じ
        ans = min(A-1, N-B)
        diff -= 1; ans += 1
        ans += diff//2
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9140
#include<bits/stdc++.h>
using namespace std;
#define int long long
pair<int,int> task[2*100000+10];
int t=0,N;
signed main(){
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> task[i].second >> task[i].first;
  }
  sort(task,task+N);
  for(int i=0;i<N;i++){
    t+=task[i].second;
    if(t<=task[i].first);
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main() {
	//cout<<"GfG!";
	long long int n, m, c = 0;
	float tot, sum = 0, a[100];
	cin>>n>>m;
	for (int i = 0; i < n; i++)
	{
	    cin>>a[i];
	    sum += a[i];
	}
	tot = sum / (4 * m);
	for (int i = 0; i < n; i++)
	{
	    if (a[i] >= tot)
	    {
	        c++;
	    }
	}
	if (c >= m)
	    cout<<"Yes";
	else
	    cout<<"No";
	return 0;
}

Measured memory_bytes: 256
'use strict'

function main(s) {

  const str = s.split('\n')[0].split('');
  const n = str.length - 1;

  const dfs = (i, sum, order) => {
    if (i === n) return eval(order + s[n]);

    sum += dfs(i + 1, sum, order + s[i] + '+') + dfs(i + 1, sum, order + s[i]);

    return sum;
  }

  const ans = dfs(0, 0, '');
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11852
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
const int MR=1e6+10;
typedef long long LL;

int main() {
	LL X;
	cin>>X;
	LL s=100;
	int cnt=0;
	while(1){
		s+=s/100;
		cnt++;
		if(s>=X){
			break;
		}
	}
	printf("%d\n",cnt);
    return 0;
}

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

using namespace std;

int n, k;

string s;

int main(){
	cin >> n >> k;
	cin >> s;
	int cnt = 0;
	for(int i = 0; i < n - 1; i++){
		if(s[i] == s[i+1])cnt++;
	}
	cout << min(n-1, 2 * k + cnt);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=1e5+5;
ll inf=1e15;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        long double d,t,s;
        cin>>d>>t>>s;
        if(d/s<=t){
            cout<<"Yes";
        }
        else
            cout<<"No";
    }

    return 0;
}

Measured memory_bytes: 3736
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int dp[100010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int h[100010];
    rep(i, N) cin >> h[i];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    rep(i, N - 1) {
        int step1 = abs(h[i + 2] - h[i + 1]);
        int step2 = abs(h[i + 2] - h[i]);
        dp[i + 2] = min(dp[i + 1] + step1, dp[i] + step2);
    }
    cout << dp[N - 1] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
		cin.tie(0);
		cout.tie(0);
		int n , h; cin>>n>>h;
	 char c[n][h];
	 long long int dp[n+1][h+1];
	 for(int i=0;i<n;i++)
	 for(int j=0;j<h;j++)
	 cin>>c[i][j];
	 memset(dp,0,sizeof(dp));dp[1][1]=1;
	 for(int i=1;i<=n;i++)
	 {
	 for(int j=1;j<=h;j++)
	 {
	 
	 	if(i==1&&j==1){
	 	dp[i][j]=1;continue;}
	 	
	 	if(i==1||j==1)
	 	{
	 		if(c[i-1][j-1]!='#')
	 		dp[i][j]=dp[i-1][j]+dp[i][j-1];
	 		continue;
		 }
	 	if(c[i-1][j-1]=='#')
	 	continue;
	 	if(c[i-2][j-1]=='.')
	 	dp[i][j]+=dp[i-1][j];
	 	if(c[i-1][j-2]=='.')
	 	dp[i][j]+=dp[i][j-1];
       dp[i][j]=dp[i][j]%1000000007;
	 	
	 }}
	
	 cout<<dp[n][h]%1000000007;
	
}

Measured memory_bytes: 9088
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <unordered_map>
using namespace std;

unordered_map<string, int> weight;
string formula;
string::iterator it;

int Molecule();
int Number();
int Atom();

int Molecule() {
	int res = 0;
	while(it != formula.end() && *it != ')') {
		int w;
		if(*it == '(') {
			++it;
			w = Molecule();
			++it;
		}
		else {
			w = Atom();
		}

		res += w * Number();
	}
	return res;
}

int Atom() {
	string symbol(1, *it);
	if(++it != formula.end() && islower(*it)) {
		symbol += *it;
		++it;
	}

	if(!weight.count(symbol)) throw "UNKNOWN";
	return weight[symbol];
}

int Number() {
	if(it == formula.end() || !isdigit(*it)) return 1;

	int res = 0;
	while(it != formula.end() && isdigit(*it)) {
		res = res * 10 + *it - '0';
		++it;
	}
	return res;
}

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

	string s;
	int num;

	while(cin >> s && s != "END_OF_FIRST_PART") {
		cin >> num;
		weight.insert(make_pair(s, num));
	}

	while(cin >> formula && formula != "0") {
		it = formula.begin();

		try {
			cout << Molecule() << endl;
		} catch(...) {
			cout << "UNKNOWN" << endl;
		}
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1304
#include <stdlib.h>

int main()
{
	int a, b, c;
	int tmp;

	scanf("%d%d%d", &a, &b, &c);
	if (a > b) tmp = a, a = b, b = tmp;
	if (b > c) {
		tmp = b, b = c, c = tmp;
		if (a > b) tmp = a, a = b, b = tmp;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}


Measured memory_bytes: 2048
N, K = map(int, input().split())
h = list(map(int, input().split()))
 
dp = [1<<30]*(N)
dp[0] = 0
 
for i in range(1, N):
  dp[i] = min((dp[j]+abs(h[i]-h[j])) for j in range(max(0, i-K), i))
 
print(dp[N-1])

Measured memory_bytes: 53216
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
use std::collections::VecDeque;
#[derive(Debug)]
struct DirectedAcyclicGraph {
    graph: Vec<Vec<usize>>,
    cost: Vec<Vec<isize>>,
}
impl DirectedAcyclicGraph {
    fn new(n: usize) -> DirectedAcyclicGraph {
        DirectedAcyclicGraph {
            graph: vec![vec![]; n],
            cost: vec![vec![-1; 3]; n],
        }
    }
    fn add_edge(&mut self, u: usize, v: usize) {
        self.graph[u].push(v)
    }
    fn bfs(&mut self, s: usize, t: usize) -> isize {
        let mut deq = VecDeque::new();
        deq.push_back((s, 0));
        while let Some((u, d)) = deq.pop_front() {
            if u == t && d % 3 == 0 {
                return d as isize / 3;
            }
            for &v in &self.graph[u] {
                if self.cost[v][d % 3] == -1 {
                    self.cost[v][d % 3] = d as isize + 1;
                    deq.push_back((v, d + 1));
                }
            }
        }
        -1
    }
}
fn main() {
    input! { n, m, uv: [(usize1, usize1); m], s: usize1, t: usize1 };
    let mut dag = DirectedAcyclicGraph::new(n);
    for &(u, v) in &uv {
        dag.add_edge(u, v);
    }
    println!("{}", dag.bfs(s, t));
}


Measured memory_bytes: 22780
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int beki(long long a,long long b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}


int gyakugen(int a){
	return beki(a,modulo-2);
}

struct combi{
	deque<int> kaijou;
	deque<int> kaijou_;
	
	combi(int n){
		kaijou.push_back(1);
		for(int i=1;i<=n;i++){
			kaijou.push_back(mod(kaijou[i-1]*i));
		}
		
		int b=gyakugen(kaijou[n]);
		
		kaijou_.push_front(b);
		for(int i=1;i<=n;i++){
			int k=n+1-i;
			kaijou_.push_front(mod(kaijou_[0]*k));
		}
	}
	
	int combination(int n,int r){
		if(r>n)return 0;
		int a = mod(kaijou[n]*kaijou_[r]);
		a=mod(a*kaijou_[n-r]);
		return a;
	}
	
	int junretsu(int a,int b){
		int x = mod(kaijou_[a]*kaijou_[b]);
		x=mod(x*kaijou[a+b]);
		return x;
	}
	
	int catalan(int n){
		return mod(combination(2*n,n)*gyakugen(n+1));
	}
	
};

int main(){
	
	int K;
	cin>>K;
	string S;
	cin>>S;
	int ans = 0;
	combi C(3000001);
	for(int i=0;i<=K;i++){
		int t = beki(26,i);
		t = mod(t * C.junretsu((int)S.size()-1,K-i));
		t = mod(t * beki(25,K-i));
		ans = mod(ans + t);
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 28708
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する



int main() {
    vector<int> v({1,2,4,8,16,32,64});


    int N;
    cin >> N;

    for(int i = v.size() -1; i >= 0; i--){
        if( N >= v[i]){
            cout << v[i] << endl;
            return 0;
        }
    }



    return 0;

}


Measured memory_bytes: 256
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_3_B&lang=jp
# Min-Max Element

from functools import reduce
from collections import deque
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    l  = list ( map(int,input().split()))

    for i in range(int(input())):
        (a,n1,n2) = map(int,input().split()) 
        if (a == 0):   
            min = reduce(lambda a,b : a if a < b else b,l[n1:n2])
            print (min)
        elif (a==1):
            max = reduce(lambda a,b : a if a > b else b,l[n1:n2])
            print (max)

if __name__ == '__main__':
    main()


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


int main(){
    long long int N;
    long long int A,B;
    int sum=0;
    bool flag=true;
    string s;
    cin>>A;
    vector<int> a(N);
    map<int,int>ball;

    int sen=A/500*1000;
    int go=A%500/5*5;
    cout<<sen+go<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1e9+10)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))


int main(void){
	int n,z,w;
	cin>>n>>z>>w;
	int a,b;
	rep(i,n){
		cin>>a;
		if(i == n-2){
			b = a;
		}
	}
	if(n==1){
		cout<<abs(a-w)<<endl;
	}else{
		cout<<max(abs(a-w),abs(b-a))<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>


#include <string>


#include <algorithm>


#include <utility>


#include <iomanip>


#include <functional>


#include <queue>


#include <stack>


#include <map>


#include <vector>


#include <cmath>


#include <cctype>


#include <cstdio>


#define ll long long


#define INF 1e+9


#define MOD 1000000007


using namespace std;



int main(){


    int A,B,C;


    cin >> A >> B >> C;


    cout << min(B/A,C) << endl;


    return 0;


}

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

int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(){
	int n,a[100001]={0};
	int i,j;
	int m,q,w;
	long long int ans = 1;
	int flag = 0;
	int sum;
	
	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d",&m);
	for(i = 0;i < m;i++){
		scanf("%d%d",&q,&w);
		sum = 0;
		for(j = 0;j < n;j++){
			sum += a[j];
		}
		sum -= a[q-1];
		sum += w;
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 512
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

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

using namespace std;

int main() {
    int P, Q, R;
    cin >> P >> Q >> R;
    vector<int> vec;

    vec.push_back(P + Q);
    vec.push_back(P + R);
    vec.push_back(Q + R);

    sort(vec.begin(), vec.end());

    cout << vec[0] << endl;

}

Measured memory_bytes: 3560
<?php
/**
 * ABC131
 * B - Bite Eating
 */

// $s = trim(fgets(STDIN));
// fscanf(STDIN, "%d %d", $a, $b);
// $n = array_map('intval', explode(' ', trim(fgets(STDIN))));

fscanf(STDIN, "%d %d", $N, $L);

$tastes = [];

for ($i = 1; $i <= $N; $i++) {
    $tastes[$i] = $L + $i - 1;
}

$min = PHP_INT_MAX;
$min_key = 0;
foreach ($tastes as $key => $taste) {
    if ($min > abs($taste)) {
        $min = abs($taste);
        $min_key = $key;
    }
}

unset($tastes[$min_key]);
echo array_sum($tastes), PHP_EOL;


Measured memory_bytes: 4728
#include <stdio.h>
main()
{
	//若有边长为偶数，结果为0；
	//皆为奇数，结果为两短边之积乘1。 
	long long a,b,c,max;
	scanf("%lld%lld%lld",&a,&b,&c);
	if(a%2==0||b%2==0||c%2==0) printf("0\n");
	else {
		max=a;
		if(b>a) max=b;
		if(c>b) max=c;
		if(max==a) printf("%lld\n",b*c);
		else if(max==b) printf("%lld\n",a*c);
		else if(max==c) printf("%lld\n",a*b);
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)

using namespace std;

int main(void) {

	long long a;
	long long b;

	cin >> a >> b;

	for (int i = b - a + 1; i <= b + a - 1; i++) {
		cout << i << " ";
	}


}




Measured memory_bytes: 256
N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
S =[0] * N
buf = 0
for i in range(N) :
    S[i] = V[i] - C[i]
    if S[i] >= 0 :
        buf += S[i]

print(buf)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <queue>
#include <cstdio>
#define INF (1<<21)
using namespace std;

class Point{
public:
  int n,t;
  double c;
  bool f;
  Point(int n = 0,int t = 0,double c = 0,bool f = false):n(n),t(t),c(c),f(f){};
  bool operator < (const Point &p) const { return c > p.c;}
};

int main(){
  while(1){
    int i,j,n,m,p,s,g,tmax;
    double G[31][31],t[10];
    Point d[31][256],u,v;

    cin >> n >> m >> p >> s >> g;
    if(!n && !m && !p && !s && !g) break;

    for(i=1;i<=m;i++){
      for(j=1;j<=m;j++) G[i][j] = INF;
    }
    tmax = (int)pow(2.0,(double)n);
    for(i=1;i<=m;i++){
      for(j=0;j<tmax;j++){
	d[i][j].c = INF;
	d[i][j].n = i;
	d[i][j].t = j;
      }
    }

    for(i=0;i<n;i++) cin >> t[i];
    for(i=0;i<p;i++){
      int x,y,z;
      cin >> x >> y >> z;
      G[x][y] = G[y][x] = (double)z;
    }

    priority_queue<Point> Q;
    d[s][0].c = 0.0;
    Q.push(d[s][0]);
    while(!Q.empty()){
      u = Q.top();
      Q.pop();

      d[u.n][u.t].f = true;

      for(j=0;j<n;j++){
	int x = (1 << j);
	
	if((u.t & x) == 0){
	  v = u;
	  v.t = (u.t | x);

	  for(i=1;i<=m;i++) d[i][v.t].f = d[i][u.t].f;	  

	  for(i=1;i<=m;i++){
	    if(!d[i][v.t].f && (G[v.n][i] / t[j]) + u.c < d[i][v.t].c && G[v.n][i] != INF){
	      d[i][v.t].c = (G[v.n][i] / t[j]) + u.c;
	      Q.push(d[i][v.t]);
	    }
	  }
	}
      }
    }

    double ans = INF;
    for(i=0;i<tmax;i++) ans = min(ans,d[g][i].c);

    if(ans == INF) cout << "Impossible" << endl;
    else printf("%.6f\n",ans);

  }
  return 0;
}

Measured memory_bytes: 8936
#include<bits/stdc++.h>
using namespace std;	
int n;
string s,s1;
int main(){
	scanf("%d",&n);
	int l=0,r=n,mid;
	cout<<"0"<<endl;
	cin>>s1;
	s=s1;
	while(s!="Vacant"){
                mid=(l+r)/2;
		cout<<mid<<endl;
		cin>>s;
		if((s1==s)^(l%2==mid%2)){
			r=l;
			l=mid;
		}else{
			l=mid;
		}
		s1=s;
	}
}

Measured memory_bytes: 852
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int P = 0;
		if(N >= 10) P = R;
		else P = R + 100 * (10 - N);
		Console.WriteLine(P);
		
	}
	int N,R;
	public Sol(){
		var d = ria();
		N = d[0]; R = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> h(N);
  rep(i,N) cin >> h[i];

  int ans = 0;
  rep(i,N) {
    if(h[i] >= K) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}
  int find(int x) {
    if (d[x] < 0)
      return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y)
      return false;
    if (d[x] > d[y])
      swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

int main() {
  int n, m;
  cin >> n >> m;
  // UnionFind uf(n);
  VI h(n);
  vector<unordered_set<int>> e(n);
  rep(i, n) { cin >> h.at(i); }
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    e.at(a).insert(b);
    e.at(b).insert(a);
    // uf.unite(a, b);
  }
  VI notgood(n);
  int cnt = 0;
  rep(i, n) {

    if (notgood.at(i) == 1) {
      continue;
    }
    bool good = true;

    for (auto to : e.at(i)) {
      if (h.at(to) >= h.at(i)) {
        good = false;
      } else {
        notgood.at(to) = 1;
      }
    }
    if (good) {
      cnt += 1;
    }
  }
  cout << cnt << endl;
  // unordered_set<int> se;
  // rep(i, n) { se.insert(uf.find(i)); }
  // cout << se.size() << endl;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const long long MOD = 1e9 + 7;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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

///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    ll X,Y; cin >> X;
    Y = 100;
    for (size_t i = 1; i < 5000; i++)
    {
        ll dY = Y / 100;
        if (Y + dY >= X){
            cout << i << endl;
            return 0;
        }
        Y = Y + dY;
    }
    
}

Measured memory_bytes: 3620
import java.util.*;
 
public class Main {
	public static final int M   = 0;
	public static final int F   = 1;
	public static final int R   = 2;

	public static final int ABSENT = -1;

	public static final int POINT_A = 80;
	public static final int POINT_B = 65;
	public static final int POINT_C = 50;
	public static final int POINT_D = 30;
	public static final int R_POINT = 50;
	
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );

        while( true ) {
            int m   = scan.nextInt();
            int f   = scan.nextInt();
            int r   = scan.nextInt();
             
            if ( m == ABSENT && f == ABSENT && r == ABSENT )
                break;
			
            String result = "F";
            int sum         = m + f;
             
            if ( m == ABSENT || f == ABSENT ) {
                result = "F";
             
            } else if ( sum >= POINT_A ) {
                result = "A";
                 
            } else if ( sum >= POINT_B && sum < POINT_A ) {
                result = "B";
                 
            } else if ( sum >= POINT_C && sum < POINT_B ) {
                result = "C";
                 
            } else if ( sum >= POINT_D && sum < POINT_C ) {
                result = "D";
                 
                if ( r >= 50 )	result = "C";
                 
            } else if ( sum <= POINT_C ) {
                result = "F";
                 
            }
             
            System.out.println(result);
             
        }
         
    }
}

Measured memory_bytes: 19224
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int x,a; cin>>x>>a;
	if (x<a) cout<<"0";
	else cout<<"10";
	cout<<endl;
	return 0;
}


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

int main()
{
	int N;
	cin >> N;
	vector<int> X(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
	}
	auto Y = X;
	sort(Y.begin(), Y.end());
	for (int i = 0; i < N; i++) {
		int id = lower_bound(Y.begin(), Y.end(), X[i]) - Y.begin();
		cout << Y[N / 2 - (id >= N / 2)] << endl;
	}
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

bool check(int i){
  while(i){
    if(i%10 == 3)
      return true;
    i /= 10;
  }
  return false;
}

int main(){
  int n;
  cin >> n;
  for(int i=1; i<=n; i++){
    if(i%3 == 0 || check(i)){
      cout << " " << i;
    }
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3096
#include <cstdio>

int main(){
    char c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            scanf("\n%c",&c[i][j]);
        }
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(i == j){
                printf("%c",c[i][j]);
            }
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 256
import queue
q = queue.Queue()
K = int(input())
for i in range(1, 10):
  q.put(i)

for i in range(K):
  x = q.get()
  if x % 10 != 0:
    q.put(10*x + x%10-1)
  q.put(10*x+x%10)
  if x % 10 != 9:
    q.put(10*x +x%10 +1)
  
print(x)

Measured memory_bytes: 12452
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,mod=1e9+7;
ll cnt[10];
set< pair<ll,ll> >nbr,st;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h,w,n;cin>>h>>w>>n;
    for(ll i=0,x,y;i<n;i++){
        cin>>x>>y;
        st.insert({x,y});
        for(ll j=0;j<3;j++)for(ll k=0;k<3;k++)nbr.insert({x-j,y-k});
    }
    cnt[0]=(h-2)*(w-2);
    for(auto &ele:nbr){
        ll x=ele.first,y=ele.second;
        if(x<=0 || x+2>h)continue;
        if(y<=0 || y+2>w)continue;
        ll cur=0;
        for(ll i=0;i<3;i++)for(ll j=0;j<3;j++)cur+=st.count({x+i,y+j});
        cnt[cur]++;
        cnt[0]--;
    }
    for(ll i=0;i<10;i++)cout<<cnt[i]<<"\n";
}

Measured memory_bytes: 62720