akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;

int main() {
    int D, N, ans;
    cin >> D >>N;
    if (N == 100) {
        N = 101;
    }
    ans = pow(100, D) * N;

    cout << ans;

    return 0;

}



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

int main() {
  long n,ans=0,mod=1000000007,asum=0,a;
  cin >> n;
  for(long i=0;i<n;i++) {
    cin >> a;
    ans=(a*asum%mod+ans)%mod;
    asum=(asum+a)%mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define mx 1000010

int main(){
	IOS;
	ll n;cin>>n;
	ll a[n];
	rep(i,0,n)cin>>a[i];
	ll od=0,ev=0,k=1,mx1=k,t=1;
	rep(i,0,n)k=__gcd(a[i],k);
	rep(i,0,n){
		if(i==0)t=a[1];else t=a[0];
		rep(j,0,min(n,50ll)){
			if(j!=i){t=__gcd(a[j],t);if(t==k)break;}
		}mx1=max(mx1,t);
	}
	cout<<mx1;
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
ll n, k, l, to[N];
vector<ll>v;
bool vis[N];
void dfs(int u)
{
    vis[u] = 1;
    v.push_back(u);
    if(!vis[to[u]]) dfs(to[u]);
    else            l = to[u];
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i = 1;i <= n;++i)
        cin >> to[i];
    dfs(1);
    if(k < v.size())
        cout << v[k];
    else
    {
        vector<ll>t;
        bool f = 0;
        for(auto &it : v)
        {
            if(it == l) f = 1;
            if(f)   t.push_back(it);
            else    --k;
        }
        cout << t[k % t.size()];
    }
    return 0;
}


Measured memory_bytes: 16908
#include<stdio.h>

int main (void){
    int X,kyu;

    scanf("%d",&X);

    if(400<=X&&X<=599){
        kyu=8;
    }else if(600<=X&&X<=799){
        kyu=7;
    }else if(800<=X&&X<=999){
        kyu=6;
    }else if(1000<=X&&X<=1199){
        kyu=5;
    }else if(1200<=X&&X<=1399){
        kyu=4;
    }else if(1400<=X&&X<=1599){
        kyu=3;
    }else if(1600<=X&&X<=1799){
        kyu=2;
    }else if(1800<=X&&X<=1999){
        kyu=1;
    }

    printf("%d",kyu);

    return 0;
}

Measured memory_bytes: 1724
c=int(input())
s=10**5
s+=100
sosu_flag=[True if i%2==1 else False for i in range(s)]
sosu_flag[1]=False
sosu_flag[2]=True
for i in range(3,s,2):
    if not sosu_flag[i]:
        continue
    for j in range(i+i,s,i):
        sosu_flag[j]=False
sosu=[]
for i in range(s):
    if sosu_flag[i]:
        sosu.append(i)
ans=c+sosu_flag[c:].index(True)
print(ans)

Measured memory_bytes: 5004
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
#define debug(x) cout << #x << " = " << x << '\n';
using namespace std;





int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int x;
    cin >> x;
    for (int i = x; i < x + 1000; i++) {
        bool p = true;
        for (int j = 2; j * j <= i; j++) {
            if (i % j == 0) {
                p = false;
                break;
            }
        }
        
        if (p) {
            cout << i;
            return 0;
        }
    }



}

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

using namespace std;

#define endl '\n'




int main()
{

    int N;
    cin >> N;

	int a[N],b[N],c[N];
    int dp[N][3];
    for(int i = 0; i < N; i++) {

        cin >> a[i] >> b[i] >> c[i];
    }

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for(int i = 1; i < N; i++) {

        dp[i][0] = max(dp[i-1][1]+a[i], dp[i-1][2]+a[i]);
        dp[i][1] = max(dp[i-1][0]+b[i], dp[i-1][2]+b[i]);
        dp[i][2] = max(dp[i-1][1]+c[i], dp[i-1][0]+c[i]);
    }

    cout << max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2])) << endl;


     return 0;


}


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

const int nm = 50, am = 50;
int n, m, s, r;
long long ans[nm], reach[nm][(nm - 1) * am + 1];
bool visited[nm];

struct Edge {
	int opp;
	int cost;
	int time;
	Edge(int o, int c, int t) :
			opp(o), cost(c), time(t) {
	}
};
vector<Edge> g[nm];

struct State {
	long long time;
	int num;
	int coin;
	State(long long t, int n, int c) :
			time(t), num(n), coin(c) {
	}
};
auto comp = [](State &a, State &b) {
	return a.time > b.time;
};

priority_queue<State, vector<State>, decltype(comp)> q(comp);

int main() {
	cin >> n >> m >> s;
	fill(reach[0], reach[n], LLONG_MAX);
	s = min(s, (nm - 1) * am);
	r = n - 1;
	for (int i = 0, u, v, a, b; i < m; i++) {
		cin >> u >> v >> a >> b;
		u--, v--;
		g[u].emplace_back(v, a, b);
		g[v].emplace_back(u, a, b);
	}
	for (int i = 0, c, d; i < n; i++) {
		cin >> c >> d;
		g[i].emplace_back(i, -c, d);
	}
	visited[0] = 1;
	for (int i = 0; i <= s; i++)
		reach[0][i] = 0;
	q.emplace(0, 0, s);
	while (1) {
		long long t = q.top().time;
		int v = q.top().num;
		int c = q.top().coin;
		q.pop();
		if (!visited[v]) {
			visited[v] = 1;
			ans[v] = t;
			if (!--r)
				break;
		}
		for (Edge &e : g[v]) {
			if (e.cost > c)
				continue;
			long long nt = t + e.time;
			int nv = e.opp;
			int nc = min(c - e.cost, (nm - 1) * am);
			if (nt < reach[nv][nc]) {
				for (int i = 0; i <= nc; i++)
					reach[nv][i] = min(reach[nv][i], nt);
				q.emplace(nt, nv, nc);
			}
		}

	}
	for (int i = 1; i < n; i++)
		cout << ans[i] << endl;

}


Measured memory_bytes: 4616
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    	cin.tie(0);
    	ios::sync_with_stdio(false);
     
    	long long a, b, k;
    	cin >> a >> b >> k;
    	if(a >= k) {
    		cout << a - k << " " << b << endl;
    	}else if(a + b >= k) {
    		cout << 0 << " " << a + b - k << endl;
    	}else {
    		cout << 0 << " " << 0 << endl;
    	}
    }

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

int main(){
  vector<int> a(5);
  for(int i=0; i<5; i++){
    cin >> a[i] ;
    }
  int k; cin >>k;

  bool h = true;
  for(int i=4; i>=1; i--){
    for(int j=i-1; j>=0; j--){
      int b = a[i]-a[j];
      if(b>k){
        h = false; break;
      }
    }
  }
  if(h==true){
    cout << "Yay!" << endl;
  }if(h==false){
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
# Range Sum Query (RSQ)
D = [0]
[n, q] = list(map(int, input().split()))

def initRMQ(n_):
    global D, n
    size = 1
    while size < n_:
        size *= 2
    i = 1
    while i <= 2*size - 1 - 1:
        D.append(0)
        i += 1
    n = size

def add(k, a):
    global D
    k += n - 1
    D[k] += a
    while k > 0:
        k = int((k - 1)/2)
        D[k] = D[k*2 + 1] + D[k*2 + 2]

def query(a, b, k, l, r):
    global D
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return D[k]

    vl = query(a, b, k*2 + 1, l, int((l + r)/2))
    vr = query(a, b, k*2 + 2, int((l + r)/2), r)
    return vl + vr

def getSum(a, b):
    global n
    return query(a, b + 1, 0, 0, n)

initRMQ(n)
for i in range(q):
    data = list(map(int, input().split()))
    if data[0] == 0:
        add(data[1] - 1, data[2])
    if data[0] == 1:
        print(getSum(data[1] - 1, data[2] - 1))


Measured memory_bytes: 10852
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  ll h, w;
  cin >> h >> w;
  string s;
  rep(i,h) {
    cin >> s;
    cout << s << '\n' << s << '\n';
  }
}

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

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

    vector<vector<bool>> adj(n, vector<bool>(n, false));
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        adj[a][b] = adj[b][a] = true;
    }

    vector<int> v(n);
    rep(i, 0, n) v[i] = i;

    int ans = 0;
    do {
        if (v[0] != 0) continue;

        bool flag = true;
        rep(i, 0, n - 1) {
            if (!adj[v[i]][v[i + 1]]) flag = false;
        }

        if (flag) ans++;

    } while (next_permutation(v.begin(), v.end()));
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
def two_count(x):
	if x % 2 == 0:
		return 1 + two_count(x//2)
	else:
		return 0

n = int(input())
n_list = [int(n) for n in input().split(" ")]

n_two_count_list = [two_count(n) for n in n_list]

print(min(n_two_count_list))

Measured memory_bytes: 3060
# 2019/07/25

from heapq import heappop,heappush,heapify

input=open(0).readline
n,m=map(int,input().split())

que=[]
for i in range(n):
    que.append(tuple(map(int,input().split())))
heapify(que)

cnt=0
rem=m
while rem:
    a,b=heappop(que)
    c=min(b,rem)
    cnt+=a*c
    rem-=c

print(cnt)

Measured memory_bytes: 16704
#include<stdio.h>
int main()
{
    int mo,a[20],b[20];
    int i,j,k,flg=0;
    int mo2=0,cnt=0;
    while(scanf("%d",&mo))
    {
        if(mo==0)break;
        for(i=0;i<12;i++)
        {
            scanf("%d %d",&a[i],&b[i]);
            mo2+=a[i]-b[i];
            if(flg==0)cnt++;
            if(mo<=mo2)flg=1;
        }
        if(flg==1)printf("%d\n",cnt);
        else printf("NA\n");
        mo2=0;cnt=0;flg=0;
    }
    return 0;
}

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

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

    int a,b,c,cnt = 0;
    while(cin >> a >> b >> c){
        for(int i = a; i <= b; i++) {
            if(c % i == 0){
                ++cnt;
            }
        }
        cout << cnt << endl;
        return 0;
    }
}

Measured memory_bytes: 3148
<?php
list($n) = ints();
foreach (['AC', 'WA', 'TLE', 'RE'] as $v) $cnt[$v] = 0;
for ($i = 0; $i < $n; ++$i) {
    list($s) = strs();
    ++$cnt[$s];
}
foreach (['AC', 'WA', 'TLE', 'RE'] as $v) {
    echo $v . ' x ' . $cnt[$v] . PHP_EOL;
}
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  string s,t; cin >> s >> t;
  int a,b; cin >> a >> b;

  map<string,int> m;
  m[s] = a;
  m[t] = b;

  string u; cin >> u;
  m[u]--;
  cout << m[s]  << " " <<  m[t] << endl;
}


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

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

typedef long long ll;
typedef pair<int, int> pi;

int n;
const int maxn = 105;
int cnt[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    int mx = 0;
    for(int i = 1;i <= n;i++){
        int a;
        cin >> a;
        cnt[a]++;
        mx = max(mx, a);
    } 
    int lb = (mx + 1) / 2;
    for(int i = 1;i < lb;i++){
        if(cnt[i] != 0){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    if(lb * 2 == mx){
        if(cnt[lb] != 1){
            cout << "Impossible" << endl;
            return 0;
        }
    }else{
        if(cnt[lb] != 2){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    for(int i = lb + 1;i <= mx;i++){
        if(cnt[i] < 2){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    cout << "Possible" << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
m,a,r,c,h=0,0,0,0,0
for i in range(n):
  s=input()[0]
  if s =='M':
    m+=1
  elif s =='A':
    a+=1
  elif s =='R':
    r+=1
  elif s =='C':
    c+=1
  elif s =='H':
    h+=1

cnt=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

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 = 1e12;
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 mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

string s;

int main(){
	while(getline(cin,s)&&s!="."){
		vector<int> vi;
		bool ok=true;
		rep(i,s.size()){
			if(!ok)continue;
			if(s[i]=='['){
				vi.push_back(0);
			}
			else if(s[i]=='('){
				vi.push_back(1);
			}
			else if(s[i]==']'){
				if(vi.size()==0)ok=false;
				else if(vi.back()!=0)ok=false;
				else vi.pop_back();
			}
			else if(s[i]==')'){
				if(vi.size()==0)ok=false;
				else if(vi.back()!=1)ok=false;
				else vi.pop_back();
			}
		}
		if(vi.size()!=0)ok=false;
		if(ok)cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
}


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

int main() {
  double r;
  cin >> r;
  cout << fixed;
  cout << setprecision(10);
  cout << r * 2 * M_PI << endl;
  return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

int main(){
  string s, ans = "No";
  cin >> s;
  if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
    ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x, k, d;
    cin >> x >> k >> d;

    ll ans;
    ll cnt = abs(x) / d;
    if (cnt < k) {
        ll diff = abs(x) - cnt * d;
        k -= cnt;
        if (k % 2 == 0) {
            ans = diff;
        } else {
            ans = abs(diff - d);
        }
    } else {
        ans = abs(x) - k * d;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX (1001)

int main() {

	//二次元行列の作成
	static int array[MAX +2][MAX + 2];
	for (int i = 0; i <= MAX + 1;i++) {
		array[0][i] = i;
		array[i][0] = i;
	}

	char str1[MAX];
	char str2[MAX];
	cin >> str1 >> str2;

	int Len1 = strlen(str1);
	int Len2 = strlen(str2);

	for (int i = 1; i <= Len1; i++) {
		for (int j = 1; j <= Len2; j++) {

			int avove = array[i - 1][j]+1;
			int yoko = array[i][j - 1]+1;
			int nanameue = str1[i-1] == str2[j-1] ? array[i - 1][j-1]+0 : array[i - 1][j - 1] + 1;
		
			array[i][j] = min({ avove ,yoko,nanameue });

		}
	}

	cout << array[Len1][Len2]<<"\n";
	return 0;
}


Measured memory_bytes: 7048
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}


int main (){
    int n,m;
    cin >> n >> m;
    vi jud(n,0);
    vi kosu(n,1);
    jud[0]=1;
    rep(i,m){
        int x,y;
        cin >> x >> y;
        kosu[x-1]--;
        kosu[y-1]++;
        if(jud[x-1]==1) jud[y-1]=1;
        if(kosu[x-1]==0) jud[x-1]=0;

    }
    int ans =0;
    rep(i,n){
        if(jud[i]==1&&kosu[i]>0) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define optimize() ios_base ::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n";
using namespace std;


int main()
{
    optimize();
     int n;
     cin>>n;
     if(n==1)
     {
       cout<<"0"<<endl;
     }
     else
     {
       cout<<"1"<<endl;
     }
    

    return 0;
}



Measured memory_bytes: 3584
from collections import defaultdict
from math import factorial

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

for i in range(N):
    s = sorted(input())
    S[''.join(s)] += 1

ans = 0
for v in S.values():
    if v > 1:
        pairs = factorial(v) // (2 * factorial(v-2))
        ans += pairs

print(ans)

Measured memory_bytes: 18228
#include <stdio.h>

int main(int argc, char const *argv[]) {

    int w,h,x,y,r,i;

    i = 0;

    scanf("%d%d%d%d%d",&w,&h,&x,&y,&r);

    if(0 <= x - r && x + r <= w){
        if(0 <= y - r && y + r <= h){
            i = 1;
        }
    }
    if(i == 1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define ll long long int
#define ld long double
#define all(a) a.begin(), a.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)

using namespace __gnu_pbds;
using namespace std;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops") 
 
//template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update>  
    ordered_set;  
 
#ifdef LOCAL
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif

 
std::mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int a, int b) {
    return uniform_int_distribution<int>(a, b)(rng);
}
 
ll power(ll x, ll y, ll p){ 
   ll res = 1;
   x = x % p;  
   while (y > 0) {
      if (y & 1) 
         res = (res * x) % p; 
      y = y >> 1;
      x = (x * x) % p; 
   }
   return res;
}
 
const ll INF = (ll)(8e18);
const ll MOD = (ll)(1e9 + 7);
const ll HMOD = (ll)4222234727;
const ll Hashprime = (ll)31;
 
const int maxn = 100100;

int32_t main(){
    IOS;
    #ifndef ONLINE_JUDGE
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    int t = 1; // cin >> t;
    while(t--){
       int n; cin >> n;
       ll d; cin >> d;
       d = d * d;
       int ans = 0;
       for(int i = 0; i < n; i++){
          ll x,y ; cin >> x >> y;
          ll val = x * x + y * y;
          if(val <= d) ans += 1;
       }
       cout << ans << '\n';
    }
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}
//g++ -DLOCAL -std=c++17 -Wshadow -Wall -o "c" "comp.cpp" -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g

Measured memory_bytes: 3656
import heapq
n,m,s,t = map(int, input().split())
s -= 1
t -= 1
edges1 = [[] for i in range(n)]
edges2 = [[] for i in range(n)]
#  1 real world
#  2 snuuk world
for i in range(m):
    u,v,a,b = map(int, input().split())
    u -= 1
    v -= 1
    # real
    edges1[u].append((v,a))
    edges1[v].append((u,a))
    # snuuk
    edges2[u].append((v,b))
    edges2[v].append((u,b))

def dijkstra(n, edges, s):
    INF = 10**20
    """
    input
        n : 頂点数
        edges : リスト(始点, 終点, コスト)
        s : 始点
    output
        d : 始点からの最短距離
    """
    d = [INF] * n
    used = [False] * n
    d[s] = 0
    used[s] = True
    edgelist = []
    # 初期のやつ
    for v, c in edges[s]:
        # print("v{},c{}".format(v,c))
        # コストを前にしてpushしておく(そこから最小値を取り出すので)
        heapq.heappush(edgelist, (c, v))
    # 空になるまで
    while len(edgelist):
        # コスト最小値を取り出す
        c_min, v_min = heapq.heappop(edgelist)
        # そのエッジがすでに確定していたら終わり
        if used[v_min]:
            continue
        # 確定していなければ、そこから派生するエッジをコスト付与して与える
        d[v_min] = c_min
        used[v_min] = True
        for v, c in edges[v_min]:
            if not used[v]:
                heapq.heappush(edgelist, (c+c_min, v))
    return d


cnt1 = dijkstra(n,edges1,s)
cnt2 = dijkstra(n,edges2,t)
# print(cnt1)
# print(cnt2)
zs = [c1+c2 for c1,c2 in zip(cnt1,cnt2)]
mn = 10**20
ans = []
for z in zs[::-1]:
    # print(mn,z)
    mn = min(mn,z)
    ans.append(10**15-mn)

for a in ans[::-1]:
    print(a)

Measured memory_bytes: 127908
n = int(input())
m = []
a = []
r = []
c = []
h = []
for i in range(n):
    name = input()
    if name[0] == "M":
        m.append(name)
    if name[0] == "A":
        a.append(name)
    if name[0] == "R":
        r.append(name)
    if name[0] == "C":
        c.append(name)
    if name[0] == "H":
        h.append(name)
m = set(m)
a = set(a)
r = set(r)
c = set(c)
h = set(h)
li = [len(m), len(a), len(r), len(c), len(h)]
ans = 0
for i in range(5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += li[i]*li[j]*li[k]
print(ans)

Measured memory_bytes: 15896
#include <iostream>
#include <algorithm>
using namespace std;
int arrCount[200005] = { 0 };
bool cmp(int iNum1, int iNum2){
    return iNum1 > iNum2;
}
int main(){
    ios::sync_with_stdio(false);
    int nCount, nDiff, i, iTemp, iSum=0;
    cin >> nCount >> nDiff;
    for (i = 1; i <= nCount; ++i){
        cin >> iTemp;
        ++arrCount[iTemp];
    }
    sort(arrCount, arrCount + 200005,cmp);
    for (i = nDiff; arrCount[i] != 0; ++i){
        iSum += arrCount[i];
    }
    cout << iSum << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 1000000007

int main(){
    string N;ll K;
    cin>>N>>K;

    ll dp[110][2][5];//i桁目までで0以外を使用したのはk個　jはtrueかfalseで、trueならsmallerはnより小さく、そうでなければnと同じ
    rep(i,110)rep(j,2)rep(k,5) dp[i][j][k]=0;
    dp[0][0][0]=1;

    for(ll i=0;i<N.size();i++){
        for(ll k=0;k<=K;k++){
            //i桁目でnより小さいなら次の桁は1~9全部ok
            dp[i+1][true][k+1]+=9*dp[i][true][k];//次の桁で0以外を選択する場合
            dp[i+1][true][k]+=dp[i][true][k];//0を選ぶ場合

            //i桁目までnと同じで,次の桁で初めてnより小さくなる場合
            if(N[i]!='0'){    
                dp[i+1][true][k+1]+=(N[i]-'0'-1)*dp[i][false][k];//0以外を選択する場合
                dp[i+1][true][k]+=dp[i][false][k];//0を選択する場合
            }

            //i桁目でnと同じで次の桁でもnと同じ時
            if(N[i]!='0'){
                dp[i+1][false][k+1]+=dp[i][false][k];//次の桁が0でないとき
            }else{
                dp[i+1][false][k]+=dp[i][false][k];//次の桁が0の時
            }
        }
    }

    cout<<dp[N.size()][0][K]+dp[N.size()][1][K]<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

int main(void){
	char c;
	while(true){
		scanf("%c",&c);
		if(c == '\n'){
			break;
		}
		if('a' <= c && c <= 'z'){
			cout << (char)( c + ('A' - 'a'));
		} else if('A' <= c && c <= 'Z'){
			cout << (char)( c + ('a' - 'A'));
		} else {
			cout << (char) c;
		}
	}
	cout << endl;

	return 0;
}

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

int f1(int m,vector<int>&s,vector<int>&c){
  string str;
  char tmp;
  for(int i=0;i<10;i++){
    int flag=0;
    str=to_string(i);
    for(int j=0;j<m;j++){
      tmp='0'+c.at(j);
      if(str.at(s.at(j)-1)!=tmp){
        flag=1;
        break;
      }
    }
    if(flag==0){
      return i;
    }
  }
  return -1;
}
int f2(int m,vector<int>&s,vector<int>&c){
  string str;
  char tmp;
  for(int i=10;i<100;i++){
    int flag=0;
    str=to_string(i);
    for(int j=0;j<m;j++){
      tmp='0'+c.at(j);
      if(str.at(s.at(j)-1)!=tmp){
        flag=1;
        break;
      }
    }
    if(flag==0){
      return i;
    }
  }
  return -1;
}
int f3(int m,vector<int>&s,vector<int>&c){
  string str;
  char tmp;
  for(int i=100;i<1000;i++){
    int flag=0;
    str=to_string(i);
    for(int j=0;j<m;j++){
      tmp='0'+c.at(j);
      if(str.at(s.at(j)-1)!=tmp){
        flag=1;
        break;
      }
    }
    if(flag==0){
      return i;
    }
  }
  return -1;
}


int main(){
  int n;int m;
  cin >>n>>m;
  vector<int>s(m);
  vector<int>c(m);
  for(int i=0;i<m;i++){
    cin >>s.at(i);
    cin >>c.at(i);
  }
  if(n==1)
    cout <<f1(m,s,c)<<endl;
  if(n==2)
     cout <<f2(m,s,c)<<endl;
  if(n==3)
    cout <<f3(m,s,c)<<endl;
  return 0;   
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  if (n == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  
  vector<int> h;
  for (int i = 1; i <= n; i++) {
    int hi;
    cin >> hi;
    h.push_back(hi);
  }
  
  for (int i = 0; i < n - 1; i++) {
    if (h[i] < h[i+1])
      h[i+1]--;
    if (h[i] > h[i+1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 892
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <cmath>

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

int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a*b % 2 == 0) {
    puts("Even");
  } else {
    puts("Odd");
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int n,i,j,k;
	cin>>n>>k;
	long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
	long int dp[n];
	dp[0]=0;
	dp[1]=a[1]-a[0];
	if(dp[1]<0)
	dp[1]=dp[1]*-1;
	for(i=2;i<n;i++)
	{
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
		for(j=2;j<=k;j++)
		{
			if(i-j<0)
			break;
			dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
		}
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    ll K,A,B;
    cin >> K >> A >> B;
    if(K<=A)cout << 1;
    else if(A<=B)cout << -1;
    else{
        cout << (K-A-1)/(A-B)*2+3;
    }
    


}

/*



 */



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
#define mp make_pair
#define mod 1000000007
#define INF 1e9+5
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define forn(i,a,b) for(int i=a;i<(int)b;i++)
#define ff first
#define ss second
#define int long long
ll min(ll a, ll b) {return a>b?b:a;}
ll max(ll a, ll b) {return a>b?a:b;}
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(i%3==0 || i%5==0)
            continue;
        ans+=i;
    }
    cout<<ans<<"\n";
    return 0;
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

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

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N;
    cin >> N;

    i64 max_digit=10,ans=0;
    rep(i,1,max_digit){
        rep(j,1,max_digit){
            rep(k,1,max_digit){
                if(i+j+k>10) break;
                vector<i64> digits;
                rep(l,0,i) digits.emplace_back(7);
                rep(l,0,j) digits.emplace_back(5);
                rep(l,0,k) digits.emplace_back(3);
                sort(begin(digits),end(digits));
                do{
                    i64 num=0;
                    for(auto d:digits){
                        num*=10;
                        num+=d;
                    }
                    if(num<=N) ++ans;
                }while(next_permutation(begin(digits),end(digits)));
            }
        }
    }

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  int n, k; cin>>n>>k;
  vector<int> a(n+1);
  for(int i = 0; i<n; i++) cin>>a[i];
  for(int i = 0; i<min(300, k); i++) {
    vector<int> p(n+1);
    for(int j = 0; j<n; j++) {
      p[max(0, j-a[j])]++;
      p[min(n, j+a[j]+1)]--;
    }
    for(int j = 1; j<=n; j++) p[j] += p[j-1];
    for(int j = 0; j<n; j++) a[j] = p[j];
  }
  for(int i = 0; i<n; i++) cout<<a[i]<<" ";
  cout<<endl;
}



Measured memory_bytes: 5000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int ar[1000006];
class compatible
{
public:
    int n1, n2, n3, n4;
};
bool checkbracket(string s)
{
    int i;
    stack<char> st;
    st.push(s[0]);
    for(i=1;s[i];i++){
        if(s[i] == ')'){
            if(st.empty())return false;
            if(st.top() == '(')st.pop();
            else return false;
        }
        if(s[i] == '(')
            st.push(s[i]);
    }
    return st.size() == 0;
}

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n <= 999)cout << "ABC\n";
    else cout << "ABD\n";


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#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,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  ll N,ans;
  cin>>N;
  REP(i,32000){
    if(i*i>N) break;
    ans=i*i;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

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

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	set<int> st;
	for(int i = 0;i < 3;i++){
		int a;
		cin >> a;
		st.insert(a);
	}
	isYes(st.size() == 2);
}

Measured memory_bytes: 256
N, T = gets.split.map!{|x| x.to_i}
input = Array.new

(0..(N - 1)).each do
  input << gets.split.map!{|x| x.to_i}
end

nominee = Array.new

input.each do |r|
  cost = r[0]
  time = r[1]

  nominee << [cost, time] if time <= T
end

result = nominee.map {|i| i[0]}.min

if result.nil?
  puts 'TLE'
else
  puts result
end

Measured memory_bytes: 1788
def main():
    x, y, a, b, c = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))
    s = []
    for v in p:
        s.append([v, "p"])
    for v in q:
        s.append([v, "q"])
    for v in r:
        s.append([v, "r"])
    s.sort(reverse=True)
    ans = 0
    cnt = [0]*3
    for v, c in s:
        if c == "p":
            if cnt[0] < x:
                ans += v
                cnt[0] += 1
        elif c == "q":
            if cnt[1] < y:
                ans += v
                cnt[1] += 1
        else:
            ans += v
            cnt[2] += 1
        if sum(cnt) == x+y:
            break
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 47592
#include<stdio.h>
int main(void)
{
	int a,b,i,min,min2,s;
	min=10000;
	min2=100000;
	for(i=0;i<3;i++){
		scanf("%d",&a);
		if(min>a){
			min=a;
		}
	}
	for(i=0;i<2;i++){
		scanf("%d",&b);
		if(min2>b){
			min2=b;
		}
	}
	s=min+min2-50;
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 1020
import math
a,b,c=map(float,input().split())
d=math.radians(c)
s=math.sin(d)*0.5*a*b
print(format(s,'.10f'))
e=(a**2+b**2-2*a*b*math.cos(d))**0.5
print(format(e+a+b,'.10f'))
h=2*s/a
print(format(h,'.10f'))




Measured memory_bytes: 5708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll par[2][200010],size[2][200010];

void init(int num,int n){
  fr(i,n){
    par[num][i]=i;
    size[num][i]=1;
  }
}

int find(int num,int x){
  if(par[num][x]==x) return x;
  else return par[num][x]=find(num,par[num][x]);
}
 
void unit(int num,int x,int y){
  x=find(num,x);
  y=find(num,y);
  if(x==y) return;
  if(size[num][x]<size[num][y]){
    par[num][x]=y;
    size[num][y]+=size[num][x];
  }
  else{
    par[num][y]=x;
    size[num][x]+=size[num][y];
  }
}
 
bool same(int num,int x,int y){
  return find(num,x)==find(num,y);
}

void prt(vector<ll>& s){
  for(auto it=s.begin();it!=s.end();it++) cout<<(*it)<<" ";
  cout<<endl;
}

int main(){
  ll n,k[2],p,q;
  P pq[200010];
  map<P,ll> tmp;
  cin>>n>>k[0]>>k[1];
  fr(i,2) init(i,n);
  fr(j,2){fr(i,k[j]){cin>>p>>q;unit(j,--p,--q);}}
  fr(i,n) tmp[mp(find(0,i),find(1,i))]++;
  fr(i,n) cout<<tmp[mp(find(0,i),find(1,i))]<<" ";
  cout<<endl;
}

Measured memory_bytes: 18176
#include<bits/stdc++.h>
#include<cmath>
#define PB push_back
#define REP(i,a,b) for(int i=a; i<b; i++)
typedef long long ll;
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k;
	cin>>k;
	if(k%7==0) k=k/7;
	k=k*9;
	ll s=10;
	if(__gcd(k,10)!=1){
		cout<<-1;
	}
	else{
	for(int i=1; i<=k+1; i++){
		if((s-1)%k==0){
			cout<<i;
			break;
		}
		s=(s*10)%k;
	}
}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define FOR(i, x, y) for (i = x; i < y; i++)
typedef long long ll;
using namespace std;

int a[11];
pair<pair<int, int>, pair<int, int>> s[50];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, q, ans = 0;
    cin >> n >> m >> q;
    for (int i = 0; i < q; i++)
        cin >> s[i].first.first >> s[i].first.second >> s[i].second.first >>
            s[i].second.second;
    FOR(a[0], 1, m + 1)
    FOR(a[1], a[0], m + 1) FOR(a[2], a[1], m + 1) FOR(a[3], a[2], m + 1)
        FOR(a[4], a[3], m + 1) FOR(a[5], a[4], m + 1) FOR(a[6], a[5], m + 1)
            FOR(a[7], a[6], m + 1) FOR(a[8], a[7], m + 1)
                FOR(a[9], a[8], m + 1) {
        int score = 0;
        for (int i = 0; i < q; i++)
            if (a[s[i].first.second - 1] - a[s[i].first.first - 1] == s[i].second.first)
                score += s[i].second.second;
        ans = max(ans, score);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int stack[500];
int top = 0;

void push(int num){
	stack[top] = num;
	++top;
}

int pop(){	
	return stack[--top];
}

int main(){
	int num;
	int tmp1, tmp2;
	char line[10];

	while(scanf("%s", line) != EOF){
		if(strcmp(line, "fin") == 0)
			break;
		if(strcmp(line, "+") == 0){
			tmp1 = pop();
			tmp2 = pop();

			push(tmp1 + tmp2);
		}else if(strcmp(line, "*") == 0){
			tmp1 = pop();
			tmp2 = pop();
			push(tmp1 * tmp2);
		}else if(strcmp(line, "-") == 0){
			tmp1 = pop();
			tmp2 = pop();
			push(tmp2 - tmp1);
		}else{
			push(atoi(line));
		}
	}
	printf("%d\n", pop());
	return 0;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i=0;i<n;i++){
    cin >> h[i];
  }
  int count=1;
  int a=h[0];
  for (int i=1;i<n;i++){
    if(h[i]>=a){
      count++;
      a=h[i];
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
from collections import deque

# 初期化周り
N, M = map(int, input().rstrip().split())
G = [[] for i in range(N+1)]
for i in range(M):
    A, B = map(int, input().rstrip().split())
    G[A].append(B)
    G[B].append(A)

# 目印
sign = [-1]*(N+1)
sign[0] = None
sign[1] = 0

queue = deque([1])

while queue:
    node = queue.popleft()
    for next in G[node]:
        if sign[next] > -1:
            continue
        sign[next] = node
        queue.append(next)

if -1 in sign:
    print("No")
else:
    print("Yes")
    for i in range(2, N+1):
        print(sign[i])


Measured memory_bytes: 34168
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
inline int	read()//不管是正负数，都可以 
{
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
	if(a>=10)write(a/10);
	putchar('0'+a%10);
}
inline void writeln(int a){
	write(a); puts("");
}
int n,s[105],dp[10005];
int main(){
	n=read(); 
	for(int i=1;i<=n;i++)s[i]=read(); dp[0]=true;
	for(int i=1;i<=n;i++){
		for(int j=100*i;j>=s[i];j--)dp[j]|=dp[j-s[i]];
	}
	for(int j=100*n;j;j--)if(dp[j]&&(j%10)){
		writeln(j); return 0;
	}
	writeln(0);
}


Measured memory_bytes: 888
n,m=map(int,input().split())
if 2<=abs(n-m):
    print(0)
    exit()
mod=10**9+7

if abs(n-m)==1:
    dog=1
    cat=1
    for i in range(1,n+1):
        dog*=i
        dog=dog%mod
    for i in range(1,m+1):
        cat*=i
        cat=cat%mod
    print(dog*cat%mod)
else:
    dog=1
    cat=1
    for i in range(1,n+1):
        dog*=i
        dog=dog%mod
    for i in range(1,m+1):
        cat*=i
        cat=cat%mod
    print(dog*cat*2%mod)



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

int main() {
    int n,k;
    cin>>n>>k;
    vector<int>v;
    for(int i = 0 ; i < n ; i++)
    {
        int temp;
        cin>>temp;
        v.push_back(temp);
    }
    sort(v.begin(),v.end());
    int sum = 0;
    for(int i = 0 ; i < k ;i++)
        sum += v[i];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3636
### main

loop do
  n, m = gets.split.map(&:to_i)
  break if (n | m) == 0

  ps = gets.split.map(&:to_i)
  #p ps

  nmr = n * (n + 1) / 2
  den = n

  max_bits = (1 << m)

  for bits in (1...max_bits)
    bn = 0
    lcm = 1

    for i in (0...m)
      if (bits & (1 << i)) != 0
        bn += 1
        lcm = lcm.lcm(ps[i])
      end
    end

    nl = n / lcm
    suml = lcm * nl * (nl + 1) / 2

    if (bn & 1) == 0
      nmr += suml
      den += nl
    else
      nmr -= suml
      den -= nl
    end
  end

  puts "%.10f" % (den == 0 ? 0.0 : nmr.to_f / den)
end

Measured memory_bytes: 6164
N,D=map(int,input().split())
XNYN=[map(int,input().split()) for i in range(N)]
XN,YN=[list(i) for i in zip(*XNYN)]
import math
number=0
for i in range(N):
    if math.sqrt(XN[i]*XN[i]+YN[i]*YN[i]) <= D:
        number += 1
print(number)



Measured memory_bytes: 166644
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(){
		
		List<long> L = new List<long>();
		for(int i=0;i<N;i++){
			L.Add(A[i] * 2 + 0);
		}
		for(int i=0;i<M;i++){
			L.Add(B[i] * 2 + 1);
		}
		
		L.Sort();
		
		long ans = 0;
		long ver = M + 1;
		long hor = N + 1;
		foreach(var cd in L){
			long len = cd / 2;
			long dir = cd % 2;
			
			if(dir == 0){
				ans += ver * len;
				hor--;
			} else {
				ans += hor * len;
				ver--;
			}
		}
		
		Console.WriteLine(ans);
		
		
		
	}
	
	
	int N,M;
	long[] A,B;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		A = new long[N];
		B = new long[M];
		for(int i=0;i<N;i++) A[i] = rl();
		for(int i=0;i<M;i++) B[i] = rl();
	}

	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: 22488
#include <iostream>
using namespace std;
typedef long long ll;
const int maxn=1000010;
const int inf=0x3f3f3f3f;
double p[maxn];
double dp[3050][3050];//dp[i][j] 为到第i个硬币时有j个是正面的概率
int n;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        scanf("%lf",&p[i]);
    }
    dp[1][1]=p[1];
    dp[1][0]=1.000000000-p[1];
	for(int i=2;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j==0)
            {
                dp[i][j]=dp[i-1][j]*(1.000000000-p[i]);
                continue;
            }
            dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1.000000000-p[i]);
        }
    }
    double ans=0.000000000;
    for(int i=(n+1)/2;i<=n;i++)
    {
        ans+=dp[n][i];
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 50108
dif::[Int]->[Int]
dif xs = map (\(x,y) -> (x-y)) (zip  (tail xs) xs)

solver::Int -> [Int] -> Int
solver t xs = let d = dif xs in t + (sum (map  (\x-> (min t x)) d ))

main::IO()
main=do
  nc<-getLine
  let n:t:[]= map read (words nc)::[Int]
  datc<-getLine
  let dat = map read (words datc)::[Int]
  print (solver t dat)


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

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

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template<class A, class B>
inline bool chmax(A &a, const B &b) { return b > a ? a = b, 1 : 0; }

template<class A, class B>
inline bool chmin(A &a, const B &b) { return b < a ? a = b, 1 : 0; }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

//IN
void IN() {}
template<class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

//OUTS
template<size_t> struct int_{};
template<class Tuple, size_t Pos>
ostream& print_tuple(ostream& out, const Tuple& t, int_<Pos>) {
  out << get<tuple_size<Tuple>::value-Pos>(t) << " ";
  return print_tuple(out, t, int_<Pos-1>());
}

template <class Tuple>
ostream& print_tuple(ostream& out, const Tuple& t, int_<1>) {
  return out << get<tuple_size<Tuple>::value-1>(t);
}

template<class... Args>
ostream& operator<<(ostream& out, const tuple<Args...>& t) {
  return print_tuple(out, t, int_<sizeof...(Args)>());
}

#define OUTS(...) cout << make_tuple(__VA_ARGS__) << "\n";

//OUTL
void OUTL() {}
template<class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  VAR(int, n);
  OUTL((n >= 1000) ? "ABD" : "ABC");
  return 0;
}


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

using namespace std;

using ll = long long;


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int r, g, b, n;

	cin >> r >> g >> b >> n;

	int ans = 0;

	for (int i = 0; i <= n; i += r)
		for (int j = i; j <= n; j += g)
			if ((n - j) % b == 0)
				ans++;

	cout << ans << endl;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	cout << fixed;

#ifdef LOCAL
	ifstream fin("../input.txt");

	solve(fin);

	cout << setprecision(4) << "clock: " << clock() / (double) CLOCKS_PER_SEC << endl;
#else
	cout << setprecision(20);

	solve();
#endif

	return 0;
}


Measured memory_bytes: 256
import collections
# from scipy.special import comb
from scipy.misc import comb


NUM_MOD = 10 ** 9 + 7


len_arr, num_repeat = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))

differ = [len(list(filter(arr[i].__gt__, arr[i+1:]))) for i in range(0, len_arr)]
ans_internal = sum(differ)
num_kind = len(collections.Counter(arr))

if num_kind == 1:
    ans_external = 0
else:
    differ = [len(list(filter(arr[i].__gt__, arr))) for i in range(0, len_arr)]
    ans_external = sum(differ)

num_comb = comb(num_repeat, 2, exact=True)
ans = num_comb * ans_external + num_repeat * ans_internal
# print(f"inter: {ans_internal}, ext: {ans_external}, {num_comb} {num_repeat}")

print(ans % NUM_MOD)
exit(0)


Measured memory_bytes: 14352