akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    vector<ll> a(N), b(N);
    rep(i, N) cin >> a[i] >> b[i];
    sort(all(a)); sort(all(b));
    if(N%2){
        cout << b[N/2]-a[N/2]+1 << endl;
    }else{
        ll tmpa = a[N/2-1]+a[N/2];
        ll tmpb = b[N/2-1]+b[N/2];
        cout << tmpb-tmpa+1 << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 10564
import sys
input = sys.stdin.readline

def readlines(n):
    for _ in range(n):
        a, b, c = map(int, input().split())
        yield a, b, c

def main():
    n, m = map(int, input().split())
    edges = [(a-1, b-1, -c) for a, b, c in readlines(m)]
    costs = bellman_ford(0, edges, n)

    if costs == -1:
        print("inf")
    else:
        print(-costs[-1])

def bellman_ford(start, edges, n):
    inf = float("inf")
    costs = [inf] * n
    costs[start] = 0
    for i in range(n):
        for u, v, weight in edges:
            if costs[u] + weight < costs[v]:
                costs[v] = costs[u] + weight
                if i == n - 1 and v == n - 1:
                    return -1

    return costs

main()

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

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

  if(b=="A"){
    cout << "T" << endl;
  }else if(b=="G"){
    cout << "C" << endl;
  }else if(b=="C"){
    cout << "G" << endl;
  }else if(b=="T"){
    cout << "A" << endl;
  }

}




Measured memory_bytes: 256
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約、条件を見落としているかも
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
typedef pair<lint,pint> tint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
struct unionf{
	vector <int> data;
	vector<lint> dp,sum;
	unionf(int size):data(size,-1){}
	bool unions(int x,int y){
		x=root(x);y=root(y);
		if(x!=y){
			//if(data[y]<data[x]){int d=x;x=y;y=d;}
			data[x]+=data[y];data[y]=x;
			//dp[x]=min(max(dp[x],dp[y]+sum[x]),max(dp[y],dp[x]+sum[y]));
			//sum[x]+=sum[y];
		}
		return x!=y;
	}
	void set(lint x,lint y){
		dp.pb(x);sum.pb(y);
	}
	lint get(int x){
		return dp[root(x)];
	}
	bool finds(int x,int y){
		return root(x)==root(y);
	}
	int root(int x){
		return data[x]<0?x:data[x]=root(data[x]);
	}
	int find(int x){
		return -data[x];
	}
};
lint sum[100100],dp[100100];
lint a[100100],b[100100];int c[100100];
vector<int> gr[100100];
vector<pint> ed;
int main()
{
	int n,m,u,v;
	cin>>n>>m;
	rep(i,n){
		cin>>a[i]>>b[i];c[i]=max(0LL,a[i]-b[i]);ed.pb(mp(c[i],i));
	}
	rep(i,m){
		cin>>u>>v;u--;v--;gr[u].pb(v);gr[v].pb(u);
		//lint w=max(0LL,max(a[u]-b[u],a[v]-b[v]));
		//ed.pb(mp(w,mp(u,v)));
	}
	rep(i,n) dp[i]=a[i],sum[i]=b[i];
	unionf uni(n+10);
	//rep(i,n) uni.set(max(a[i],b[i]),b[i]);
	sort(All(ed));
	rep(i,n){
		v=ed[i].se;
		//cout<<v+1<<endl;
		set<int> ch;
		rep(j,gr[v].size()){
			int w=gr[v][j];
			if(c[w]>c[v] || (c[w]==c[v] && v<w)) continue;
			if(uni.finds(v,w)) continue;
			ch.insert(uni.root(w));
		}
		if(ch.empty()) continue;
		vector<int> ch2=vector<int>(All(ch));
		m=ch2.size();
		lint su=0,mi=123456789012345678L;
		rep(j,m){
			su+=sum[ch2[j]];
		}
		rep(j,m){
			mi=min(mi,max(dp[ch2[j]],dp[v]-sum[v])+sum[v]+su-sum[ch2[j]]);
		}
		rep(j,m){
			uni.unions(v,ch2[j]);
		}
		sum[uni.root(v)]=sum[v]+su;
		dp[uni.root(v)]=max(sum[uni.root(v)],mi);
		//cout<<sum[uni.root(v)]<<' '<<dp[uni.root(v)]<<endl;
	}
	cout<<dp[uni.root(0)]<<endl;
}


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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define f first
#define s second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const int inf = (int)1e9;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 600500;

int n, a[N], b[N], p[N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		cin >> p[i];
	}

	for (int i = 1; i <= n; i++)
	{
		a[i] = (i - 1) * (2 * n) + 1;
		b[i] = (n - i + 1) * (2 * n) + 1;
	}


	for (int i = 1; i <= n; i++)
		b[p[i]] += i;

	for (int i = 1; i <= n; i++)
		cout << a[i] << ' ';
	cout << endl;

	for (int i = 1; i <= n; i++)
		cout << b[i] << ' ';
	cout << endl;
                
	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define mp make_pair
#define p(x) cout<< x << " ";
#define pe(x) cout<< x << endl ;
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define el endl
#define M 998244353 
#define int long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROR(i,a,b) for(int i=a;i>=b;i--)
const int N = 1e5 + 5;

int32_t main() 
{ 
    int n,neg=0,pos=0,sum=0,mi=1e8,ma=-1e8;
    cin>>n;
    int a[n];
    multiset<int> s;
    FOR(i,0,n)
    {
        cin>>a[i];
        s.insert(a[i]);
        if(a[i]<0)
        neg++;
        else if(a[i]>0)
        pos++;
        sum+=abs(a[i]);
        ma=max(ma,abs(a[i]));
        mi=min(mi,abs(a[i]));
    }
    if(neg>=1 && pos>=1)
    { 
        cout<<sum<<el;
        for(int i=1;i<=n-1;i++)
        {
            auto it=s.begin();
            auto itr=s.end();
            itr--;
            if(neg>1 || i==n-1)
            { cout<<*itr<<" "<<*it<<endl; neg--;
            s.erase(itr);
            s.erase(it);
            s.insert(*itr-*it);
            }
            else
            { cout<<*it<<" "<<*itr<<endl;
            s.erase(itr);
            s.erase(it);
            s.insert(*it-*itr);
            }
            
        }
    }
    else
    {
        cout<<sum-ma-mi+ma-mi<<endl;
        if(pos>=1)
        {
            for(int i=1;i<=n-1;i++)
            {
                auto it=s.begin();
                auto itr=s.end();
                itr--;
                if(i==n-1)
                { cout<<*itr<<" "<<*it<<endl; 
                s.erase(itr);
                s.erase(it);
                s.insert(*itr-*it);
                }
                else
                { cout<<*it<<" "<<*itr<<endl;
                s.erase(itr);
                s.erase(it);
                s.insert(*it-*itr);
                }
                
            }
        }
        else
        {
            for(int i=1;i<=n-1;i++)
            {
                auto it=s.begin();
                auto itr=s.end();
                itr--;
                
                 cout<<*itr<<" "<<*it<<endl; 
                s.erase(itr);
                s.erase(it);
                s.insert(*itr-*it);
                
               
                
            }
        }
    }
    
    
} 

Measured memory_bytes: 7424
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;

ll fastpowMOD(ll a, ll p,ll MOD);
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; a %= MOD; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }

ll lcm(ll a,ll b){
	return (a*b)/__gcd(a,b);
}



int main(){
	fastio;
	ll h,a;
	cin>>h>>a;
	if(h/a==0){
		cout<<1<<"\n";
		return 0;
	}
	if(h%a==0){
		cout<<h/a<<"\n";
	}
	else cout<<h/a+1<<"\n";
	
}


















Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
 
int main(){
  int n;
  string s;
  cin >> n >> s;

  int m = s.size();
  int moji = 25 + 'A';
  rep(i,m){
    s.at(i) += n;
    if (s.at(i) > moji){
      s.at(i) -= 26;
    }
  }
  

  cout << s << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int l;
int han(char* a,char* b){
  int i;
  for(i=0;i<l;i++){
    if(a[i]>b[i])return -1;
    if(a[i]<b[i])return 1;
  }
  return 0;
}

int main(){
  int n,j,i;scanf("%d%d",&n,&l);
  char s[100][101];
  for(i=0;i<n;i++){
    scanf("%s",s[i]);
  }
  int ans[100];
  for(i=0;i<n;i++)ans[i]=i;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(han(s[ans[i]],s[ans[j]])==1){
        int tmp=ans[i];
        ans[i]=ans[j];
        ans[j]=tmp;
      }
    }
  }
  for(i=0;i<n;i++)printf("%s",s[ans[i]]);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    //X=(a[k]/2)*(2*p-1) (p:natural number)
    //2*p-1で偶数を作れないため，a[k]を2で割れる回数が揃わないと0
    ll n,m;cin>>n>>m;
    vector<ll> a(n);
    set<ll> st;
    rep(i,n){
        ll t;cin>>t;
        a[i]=t;
        ll c=0;
        while(t%2==0){
            t/=2;
            c++;
        }
        st.insert(c);
    }
    if(st.size()>1){
        cout<<0<<endl;
        return 0;
    }
    if(*st.begin()==0){
        cout<<0<<endl;
        return 0;
    }

    rep(i,n) a[i]/=2;
    ll l=a[0];
    for(int i=1;i<n;i++){
        l=l/gcd(l,a[i])*a[i];
        if(l>INF){
            cout<<0<<endl;
            return 0;
        }
    }
    ll ans=(m+l)/(2*l);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

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

int main() {
    cin >> N;
    if(N%2 == 0) cout << N;
    else cout << 2*N;
}


Measured memory_bytes: 256
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                        ll n,x;
                        cin>>n>>x;
                        ll arr[n];
                        ll ans=1;
                        rep(i,0,n){
                                cin>>arr[i];
                                arr[i]/=2;
                                ans=ans*arr[i]/__gcd(ans,(ll)arr[i]);
                        }
                        // ans/=2;
                        rep(i,0,n)
                                if(((ans/arr[i])%2)==0){
                                        cout<<0;
                                        return;
                                }
                        cout<<((x/ans)+1)/2;
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //printf("Case #%d: ", i);
                                solve();
                         }
        return 0; 
}         
 


Measured memory_bytes: 1024
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

// 時刻iにカンガルーは座標0から座標1+2+...+iにたどり着くことができる。
// 時刻iを小さい順に試して可能か調べる

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

    int x;
    cin >> x;

    int cumsumx = 0;

    for (int i = 1;; i++) {
        cumsumx += i;
        if (cumsumx >= x) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3648
# -*- coding: utf-8 -*-
a,b,c = sorted([int(x) for x in input().split()])
ret = (c-a)//2 + (c-b)//2
a = a + 2*((c-a)//2)
b = b + 2*((c-b)//2)

if a==b and b==c:
    print(ret)
elif a<c and b<c:
    print(ret+1)
else:
    print(ret+2)


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

int main(void) {
    int n, d;
    cin >> n >> d;
    int x, y;
    int count = 0;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        long long int dis = pow(x, 2) + pow(y, 2);
        if (dis <= pow(d, 2)) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(W,n)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {REP(aaa,i){REP(bbb,j)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int main(){

	ll n, k;cin >> n >> k;
	ll ans = 0;

	ll tmp = n / k;
	ans += tmp * tmp * tmp;
	if(k % 2 == 0){
		tmp = (n + k / 2) / k;
		ans += tmp * tmp * tmp;
	}

	cout << ans << endl;

	return 0;
}


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

void swap(int a,int b) {
	int tmp = a;
	a = b;
	b = tmp;
}

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

	int a = s.size();

	for (int i = 0; i < (a - 1) / 2; i++) {
		if (s[i] != s[a-i-1]) {
			cout << "No" << endl;
			return 0;
		}
	}

	for (int i = 0; i < (a - 1) / 4;i++) {
		if (s[i] != s[(a - 1) / 2 -i-1]) {
			cout << "No" << endl;
			return 0;
		}
	}

	for (int i = 0; i < (a - 1) / 4; i++) {
		if (s[i+ ((a - 1) / 2)+1] != s[a-i-1]) {
			cout << "No" << endl;
			return 0;
		}
	}

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

Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        
        cin >> H >> W;
        
        if (H == 0 && W == 0) break;
        
        for (int i = 1; i <= H; i ++){
            for (int j = 1; j<= W; j ++){
                if((i+j) % 2 == 0){
                    cout <<"#";
                    
                }
                else{
                   cout <<".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) x.size()

// 1/b%mod=b^(m-2)%mod

typedef double db;
typedef long long ll;

const ll ary=1e5+5;
const ll inf=1e18;

using namespace std;
ll n;
pair<ll,ll> a[ary];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].f;
		a[i].s=i;
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		cout<<a[i].s<<' ';
	}
}

Measured memory_bytes: 2432
str = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
li = list(map(int, str.split(", ")))

idx = int(input()) - 1
print(li[idx])

Measured memory_bytes: 2940
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;

void main() {
    int n, a;
    scan(n);
    scan(a);

    if (n % 500 <= a) {
        writeln("Yes");
    }
    else {
        writeln("No");
    }
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

struct Queue(T) {
    private {
        size_t cap, head, tail;
        T[] data;
    }

    this (size_t n) in {
        assert(n > 0, "The capacity of a queue must be a positive integer.");
    } body {
        cap = n + 1;
        data = new T[](cap);
    }

    void clear() {
        head = tail = 0;
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return head == (tail + 1) % cap;
    }

    size_t length() {
        return head <= tail ? tail - head : cap - head + tail;
    }

    T front() in {
        assert(!empty, "The queue is empty.");
    } body {
        return data[head];
    }

    void removeFront() in {
        assert(!empty, "The queue is empty.");
    } body {
        (++head) %= cap;
    }

    alias popFront = removeFront;

    void insertBack(T x) in {
        assert(!full, "The queue is full.");
    } body {
        data[tail++] = x;
        tail %= cap;
    }

    alias insert = insertBack;

    T[] array() {
        return head <= tail ? data[head .. tail].dup : data[head .. $] ~ data[0 .. tail];
    }

    string toString() {
        import std.format : format;

        if (head <= tail) {
            return format("[%(%s, %)]", data[head .. tail]);
        }
        else {
            return format("[%(%s, %)", data[head .. $]) ~ format(", %(%s, %)]", data[0 .. tail]);
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char str[100010];
int main() {
	scanf("%s",&str);
	int len=strlen(str);
	if(len%2!=0) {
		printf("No");
		return 0;
	}
	for(int i=0; i<len/2; i++) {
		int r=abs(str[i]-str[len-i-1]);
		if(r!=1&&r!=2) { 
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


ll gcd(ll x, ll y)
{
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

map<ll, ll> prime_factor(ll a) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= a; i++) {
		while (a % i == 0 && a != 0) {
			ret[i]++;
			a /= i;
		}
	}
	if (a != 1) {
		ret[a]++;
	}
	return ret;
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	ll p, q; scanf("%lld %lld", &p, &q);
	ll g = gcd(p, q);
	p /= g;
	q /= g;
	map<ll, ll> mp1 = prime_factor(p);
	map<ll, ll> mp2 = prime_factor(q);
	vector<ll> v;
	//for (auto p : mp1) v.push_back(p.first);
	for (auto p: mp2) v.push_back(p.first);
	sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());
	ll res = 1;
	for (auto e : v) res *= e;
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 3240
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	a = []
	for _ in range(3):
		a.append(LI())
	a = np.array(a)
	n = II()
	b = np.array([[False for _ in range(3)] for _ in range(3)])
	for _ in range(n):
		b = np.logical_or(b,a==II())
	if (b[0][0] and b[0][1] and b[0][2]) or (b[1][0] and b[1][1] and b[1][2]) or (b[2][0] and b[2][1] and b[2][2]) or (b[0][0] and b[1][0] and b[2][0]) or (b[0][1] and b[1][1] and b[2][1]) or (b[0][2] and b[1][2] and b[2][2]) or (b[0][0] and b[1][1] and b[2][2]) or (b[0][2] and b[1][1] and b[2][0]) :
		print("Yes")
	else:
		print("No")



if __name__ == '__main__':
	main()

Measured memory_bytes: 12220
a = input()
b = input()

if a == b:
    print("Yes")
else:
    flag = False
    for i in range(1,len(a)):
        a_new = a[-i:] + a[:-i]
        if a_new == b:
            flag = True
            break
    if flag:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 2940
s;n;e;w;i;main(){
    char t[1000];
    gets(t);
    
    for(;i<strlen(t);i++){
        if(t[i]==78)n=1;
        if(t[i]==83)s=1;
        if(t[i]==69)e=1;
        if(t[i]==87)w=1;
    }
    puts(abs(n-s)+abs(w-e)?"No":"Yes");
}

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

int max_size = 0;
vector<int> parent, cnt;
int find(int x) {
	return (x == parent[x] ? x : (parent[x] = find(parent[x])));
}
void merge(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	parent[x] = y;
	cnt[y] += cnt[x];
	cnt[x] = 1;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, m;
	cin >> n >> m;
	parent.resize(n + 1);
	cnt.resize(n + 1);
	for (int i = 0; i <= n; i++) {
		parent[i] = i; 
		cnt[i] = 1;
	}
	while (m--) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		merge(u, v);
	}

	for (int i = 0; i <= n; i++) {
		if (max_size < cnt[i]) max_size = cnt[i];
	}
	cout << max_size << '\n';
	return 0;
}


Measured memory_bytes: 4760
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define all(a)      a.begin(),a.end()
#define getc getchar_unlocked
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int n;
  cin >> n;
  int a[n];
  int x=0;
  f(i,n)
      {cin >> a[i];
      x^=a[i];}
  x^=a[0];
  cout << x << " ";
  fp(i,1,n-1)
    cout << (a[0]^a[i]^x) << " ";
  cout << '\n';
  return;
} 

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


Measured memory_bytes: 5164
#include <stdio.h>
#include <math.h>

int main(void)
{
	long int N,K;
	int sum,i;
	
	int a[100];
	
	scanf("%ld" , &N);
	
	K = N;
	
	for(i = 0; i < 10; i++)
	{
		a[i] = K % 10;
		K = K / 10;
	}
	
	sum = 0;
	
	for(i = 0; i < 10; i++)
	{
		sum += a[i];
	}
	
	if( N % sum == 0){
		printf("Yes");
	}else{
		printf("No");
	}
	
	return 0;
}


Measured memory_bytes: 128
# 埋める配列
# dp[x] = 足場0からスタートして足場xに着地するときに足場xまでに払うコストの最小値

# 計算方法
# dp[0] = 0
# dp[x] = min(dp[x - 1] + |h[x] - h[x - 1]|, dp[x - 2] + |h[x] - h[x - 2]|, ... ,  dp[x - K] + |h[x] - h[x - K]|)

# 埋める順番
# xが小さい順

N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = 10 ** 18

dp = [0] * (N + 5)

for i in range(1, N):
    dp[i] = INF
    for j in range(1, K + 1):
        if i - j >= 0: # 脳死
            dp[i] = min(dp[i], dp[i - j] + abs(H[i] - H[i - j]))

print(dp[N - 1])

Measured memory_bytes: 52448
#include<iostream>
using namespace std;
#define ll long long

int main(){
  ll H, W, A, B;
  cin >> H >> W >> A >> B;

  for(ll h=0; h<H; ++h){
    for(ll w=0; w<W; ++w){
      ll c = ((h>=B || w>=A) && !(h>=B && w>=A)) ? 1 : 0;
      cout << c;
    }
    cout << endl;
  }

  return 0;
}

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

// ビット数カウント
long bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    int D, G;
    cin >> D >> G;

    vector<int> p(D);
    vector<int> c(D);
    for (int i = 0; i < D; i++) {
        cin >> p.at(i) >> c.at(i);
    }

    int min = 1000;

    // piを完全に解く場合を1,全く解かない場合を0としてbitで考える
    for (int bit = 0; bit < (1<<D); bit++) {
        // 合計得点
        int sum_point = 0;
        // 解答数
        int sum_answer = 0;

        // piを完全に解くかどうか
        for (int i = 0; i < D; i++) {
            if(bit & (1<<i)) {
                // piを完全解答
                sum_point += 100 * (i+1) * p.at(i) + c.at(i);
                sum_answer += p.at(i);
            }
        }

        // 目標を超えていたら最小判定
        if(sum_point >= G && sum_answer < min) {
            min = sum_answer;
            continue;
        }

        // 既に解いていない問題のうち、一番得点の高いものを何問解いて目標に達成できるか
        for (int i = D-1; i >= 0; i--) {
            if (!(bit & (1<<i))) {
                for (int j = 1; j < p.at(i); j++) {
                    if(sum_point + j*(i+1)*100 >= G && sum_answer + j < min) {
                        min = sum_answer + j;
                        break;
                    }
                }
                break;
            }
        }
    }

    cout << min << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split()) 
if N < K:
    print(min(N, abs(N-K)))
elif (N >= K) & (N % K == 0):
    print(0)
elif (N >= K) & (N % K != 0):
    r = N % K
    print(min(r, abs(r - K)))
else:
    pass


Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <utility>
#include <queue>
#define INF 1000000007
using namespace std;


int main(){
   for(;;){
        int n,k;
        cin >> n >>k;
        if (n==0&&k==0) {
           break;
        }
        vector<int> card(n,INF);
        for (int i=0; i<k; i++) {
            cin >> card[i];
        }
        sort(card.begin(),card.end());
        int len=0;
        if (card[0]==0) {
            int p=0,q=1;
            while (p<k-1&&q<k) {
                if (card[q]-card[p]==q-p) {
                    if (q==k-1&&p!=0) {
                        len=max(len,q-p+1);
                    }
                    len=max(len,q-p);
                    q++;
                }else{
                if(card[q]-card[p]==1+q-p){
                    len=max(len,q-p+1);
                    q++;
                }else{
                if (card[q]-card[p]>1+q-p) {
                    p++;
                }}}
            }
        }else{
            int p=0,q=1;
            while (p<k-1&&q<k) {
                if (card[q]-card[p]==q-p) {
                    len=max(len,q-p);
                    q++;
                }else{
                if (card[q]-card[p]>q-p) {
                    p++;
                }}

            }
        }
        cout << len+1 <<endl;
    }
    
}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double


int main(){
  char a;
  cin >> a;
  if (a <= 'Z') {
    cout << "A" << endl;
  } else {
    cout << "a" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;

double getMoreHeadsProb(vector<double> inp) {
    int n=inp.size();
    vector<vector<double>> dp(n+1,vector<double>(n+1,0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++) {
        for(int j=0;j<=n;j++) {
            dp[i][j]=(double)(j==0?(double)(dp[i-1][j])*(double)(1-inp[i-1]):(double)(dp[i-1][j])*(double)(1-inp[i-1])+(double)(dp[i-1][j-1])*(double)(inp[i-1]));
        }
    }
    double res=0;
    for(int i=n/2+1;i<=n;i++) {
        res+=(double)(dp[n][i]);
    }
    return res;
}

int main(void){
    // Your code here!
    int n=0;
    cin>>n;
    vector<double> inp(n,0);
    for(int i=0;i<n;i++)cin>>inp[i];
    cout<<setprecision(15)<<getMoreHeadsProb(inp)<<endl;
}


Measured memory_bytes: 73804
N, K = [int(i) for i in input().split()]
mon_list = [int(i) for i in input().split()]
mon_list = sorted(mon_list, reverse=True)
if N <= K:
    output = 0
else:
    if K != 0:
        output = sum(mon_list[K:])
    else:
        output = sum(mon_list)
print(output)

Measured memory_bytes: 26020
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::string S;

  int N;

  std::cin >> N >> S;

  for (const auto& c : S) {
    int x = c - 'A';

    std::cout << static_cast<char>((x + N) % 26 + 'A');
  }

  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 256
/*
    Don't practice until you get it right. Practice until you can't get it wrong.
*/

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld double
#define pii pair<ll,ll>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pii>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000055
#define mod 1000000007
#define ff first
#define ss second
const int INF=0x3f3f3f3f;
const ll int inf = LLONG_MAX;

ll power(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}
	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=-1,mn=INT_MAX;
string s;

int main()
{
	vivek_ghosh;
	
	cin>>n;
	string s,t;
	cin>>s>>t;
	// n = int(s.size());
	for(int i=0,j=0,k=0;i<2*n;i++)
	{
		if(i%2 == 0)
		{
			cout<<s[j++];
		}
		else
		{
			cout<<t[k++];
		}
	}
	




	
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int>P;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n;
const int Maxn=2e5;
ll a[Maxn];
const ll lim=1e18;
int main(){
	cin>>n;
	rep(i,n){
		cin>>a[i]; 
		if(!a[i]){
			cout<<"0"<<endl;
			return 0;
		}
	}
	ll ans=1;
	rep(i,n){
		if(lim/a[i]<ans){
			cout<<"-1"<<endl;
			return 0;
		}
		ans*=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4404
package main

import "fmt"

type Combination struct {
	n int
	f *Factorial
}

func NewCombination(n int, m int64) *Combination {
	f := NewFactorial(n, m)
	return &Combination{n, f}
}

func (c *Combination) Combination(n, k int) int64 {
	return c.f.F[n] * c.f.Inv[k] % c.f.Mod * c.f.Inv[n-k] % c.f.Mod
}

func (c *Combination) Permutation(n, k int) int64 {
	return c.Combination(n+k-1, n-1)
}

func (c *Combination) Factorial(n int) int64 {
	return c.f.F[n]
}

type Factorial struct {
	n      int
	Mod    int64
	F, Inv []int64
}

func NewFactorial(n int, m int64) *Factorial {
	f := Factorial{n, m, nil, nil}
	f.F = make([]int64, n+1)
	f.Inv = make([]int64, n+1)
	f.F[0] = 1
	for i := 1; i <= n; i++ {
		f.F[i] = f.F[i-1] * int64(i) % f.Mod
	}
	f.Inv[n] = pow(f.F[n], f.Mod-2, f.Mod)
	for i := n; i > 0; i-- {
		f.Inv[i-1] = f.Inv[i] * int64(i) % f.Mod
	}
	return &f
}

func pow(x, n, m int64) int64 {
	if n == 0 {
		return 1
	}
	if n&1 == 0 {
		r := pow(x, n/2, m)
		return r * r % m
	}
	return x * pow(x, n-1, m) % m
}

func div(x, n, m int64) int64 {
	return x * pow(n, m-2, m) % m
}

func main() {
	const m int64 = 1000000007
	var x, y int
	fmt.Scan(&x, &y)
	n := y + x
	if n%3 != 0 || x < n/3 || y < n/3 {
		fmt.Println(0)
		return
	}
	n /= 3
	k := x - n
	c := NewCombination(n, m)
	fmt.Println(c.Combination(n, k))
}


Measured memory_bytes: 11264
N = int(input())
t = [0 for i in range(N)]    # リストには最初に要素をN個作っておかないとエラーになる
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())

a = "Yes"
# ここまでが入力
for i in range(N):
    if i == 0:
        dt = t[0]
        dist = abs(x[0]) + abs(y[0])
    else:
        dt = t[i]-t[i-1]
        dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if dist > dt or (dist+dt) % 2 == 1:
        a = "No"
print(a)

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, D;
    cin >> N >> D;
    vector<ll> X(N), Y(N);
    for(int i=0; i<N; i++) cin >> X[i] >> Y[i];

    int ans = 0;
    for(int i=0; i<N; i++)
    {
        if(X[i]*X[i] + Y[i]*Y[i] <= D*D) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6364
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"runtime/debug"
	"strconv"
)

var in = NewScanner(os.Stdin, 0)

/* this is port of top c++ answer to test go performance */
func main() {
	debug.SetGCPercent(-1)
	h, w, k := in.Int(), in.Int(), in.Int()
	f := make([]int, h+w+1)
	f[0] = 1
	for i := 1; i <= h+w; i++ {
		f[i] = f[i-1] * i % M7
	}
	r := 0
	x := f[h+w-2]
	x = x * Pow7(f[h+w-k], M7-2) % M7
	for i := 2; i <= k; i++ {
		y := x * i % M7
		y = y * (i - 1) % M7
		r += y
		if r >= M7 {
			r -= M7
		}
	}
	r = r * h % M7
	r = r * w % M7
	z := (k + 3) * k
	z = z / 2 % M7
	z = z * f[h+w] % M7
	z = z * Pow7(f[h+w-k], M7-2) % M7
	Pln((r + z) % M7)
}

const M7 = 1000000007

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if max <= 0 {
		max = 1048576
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}
func (s *Scanner) Int() int {
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for start < len(data) && isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i + 1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func Pow7(x, k int) int {
	if k == 0 {
		return 1
	}
	r := Pow7(x, k/2)
	r = r * r % M7
	if k%2 == 1 {
		r = r * x % M7
	}
	return r
}
func Pln(s ...interface{}) {
	fmt.Println(s...)
}

type ByteSlice []byte
type IntSlice []byte


Measured memory_bytes: 161920
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	K := nextInt()
	Q := nextInt()

	if K > Q {
		for i := 0; i < N; i++ {
			fmt.Println("Yes")
		}

		return
	}

	pointMap := map[int]int{}
	for i := 0; i < Q; i++ {
		pointMap[nextInt()]++
	}

	for i := 0; i < N; i++ {
		base := K - Q
		base += pointMap[i+1]
		if base < 1 {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
		}
	}
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 7168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

vector<ll> par;
vector<ll> siz;
vector<ll> rnk;

void init(ll n){
  rep(i,n) {
    par[i] = i;
    siz[i] = 1;
    rnk[i] = 0;
  }
}

ll root(ll x){
  if(par[x] == x) return x;
  else return par[x] = root(par[x]);
}

bool same(ll x, ll y){
  return root(x) == root(y);
}

void unite(ll x, ll y){
  x = root(x);
  y = root(y);
  if(x==y) return;
  if(rnk[x] < rnk[y]){
    siz[y] += siz[x];
    par[x] = y;
  }else{
    if(rnk[x] == rnk[y]) rnk[x]++;
    siz[x] += siz[y];
    par[y] = x;
  }
}

int main(){
  ll N, M; cin >> N >> M;
  vector<pair<ll,ll>> AB(M);
  vector<ll> ans(M);
  rep(i,M){
    cin >> AB[i].first >> AB[i].second;
    AB[i].first--; AB[i].second--;
  }
  reverse(all(AB));
  par.resize(N);
  siz.resize(N);
  rnk.resize(N);
  init(N);
  ll nogood = N*(N-1)/2;
  rep(i,M){
    ans[i] = nogood;
    ll a = AB[i].first;
    ll b = AB[i].second;
    if(same(a, b)){}
    else nogood -= siz[root(a)]*siz[root(b)];
    unite(a, b);
  }
  reverse(all(ans));
  rep(i,M){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
ll N, M;
void func()
{
    cin >> N;
    ll ans = 0;
    rep(i, 1, N + 1)
    {

        ans += (i + (N / i) * i) * (N / i) / 2;
    }
    cout << ans << endl;
}
int main()
{
    func();
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int result = n / 2;
        if (n % 2 == 0) {
            result--;
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
 
 int main(){
 int n,k;
 int ans = 1;
 cin >> n >> k ;

 for (int i=0; i<n; i++){
 if (ans*2 < ans +k){
     ans =ans *2;
 }
 else {
     ans = ans +k;
 }
 }
 cout << ans << endl;
 }

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

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

int main()
{
    rep(j,9)rep(i,9) cout << j+1 << "x" << i+1 << "=" << (j+1)*(i+1) << endl;
        return 0;
}

Measured memory_bytes: 1116
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long double n,m;
    cin>>n>>m;
    long double sum=0;
    for(long double i=0;i<n;i++){
        long double a,b;
        cin>>a>>b;
        long double  c=sqrt((a*a)+(b*b));
        if(c<=m)
            sum++;
    }
    cout<<sum;
}


Measured memory_bytes: 3868
#include <bits/stdc++.h>
using namespace std;
int main() {
	string a,b;
	cin>>a>>b;
	vector<char>vec(110,0);
	vector<char>vek(110,0);
	for(int i=0;i<a.size();i++){
		vec.at(100-i)=a[a.size()-1-i];
		//cout<<vec.at(100-i)<<" ";
	}
	//cout<<endl;
	for(int i=0;i<b.size();i++){
		vek.at(100-i)=b[b.size()-1-i];
		//cout<<vek.at(100-i)<<" ";
	}
	//cout<<endl;
	for(int i=0;i<101;i++){
		if(vec[i]>vek[i]){
			cout<<"GREATER"<<endl;
			return 0;
		}
		else if(vec[i]<vek[i]){
			cout<<"LESS"<<endl;
			return 0;
		}
	}
	cout<<"EQUAL"<<endl;
}

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

using namespace std;

typedef vector<vector<int> > mat;

int h,w,c;

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

int change(mat& panel,int color) {
	int cnt=1;
	queue<pair<int,int> > q;
	vector<vector<bool> > used(h,vector<bool>(w));
	used[0][0]=true;
	q.push({0,0});
	while(!q.empty()) {
		pair<int,int> p=q.front(); q.pop();
		for(int i=0;i<4;++i) {
			int nx=p.first+dx[i],ny=p.second+dy[i];
			if(nx<0||ny<0||nx>=h||ny>=w||used[nx][ny]) continue;
			used[nx][ny]=true;
			if(panel[nx][ny]==panel[0][0]) {
				panel[nx][ny]=color;
				q.push({nx,ny});
				++cnt;
			}
		}
	}
	panel[0][0]=color;
	return cnt;
}

int solve(int cnt,mat panel) {
	int res=0;
	if(cnt==4) {
		change(panel,c);
		return change(panel,c);
	}
	for(int i=1;i<=6;++i) {
		if(i==panel[0][0]) continue;
		mat tmp(panel);
		change(tmp,i);
		res=max(res,solve(cnt+1,tmp));
	}
	return res;
}

int main() {
	while(cin >> h >> w >> c,h) {
		mat panel(h,vector<int>(w));
		for(auto&v:panel)
			for(auto&e:v)
				cin >> e;
		cout << solve(0,panel) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

typedef long long ll;


int main(int argc, char *argv[])
{
	ll A, B;
	vector<int> v;

	cin >> A >> B;

	if (A > B) {
		ll t = A;
		A = B;
		B = t;
	}
	int n = (int) sqrt(A);
	ll ans = 0;
	bool b0 = false;
	v.push_back(A);
	for (int i = 2; i <= n + 1; i++) {
		bool b = false;
		while (A % i == 0) {
			A = A / i;
			b = true;
		}
		if (b) {
			if (B % i == 0) {
				v.push_back(i);
			}
		}
	}
	if (A != 1) {
		if (B % A == 0) {
			v.push_back(A);
		}
	}

	cout << v.size() << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
int top,S[10000];
 
void push(int x){
  S[++top]=x;
}
 
int pop(){
 return S[top--];
}
 
int main(){
  int a,b;
  char s[199];
  top=0;
   
  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      b=pop();
      a=pop();
      push(a+b);
    }else if(s[0]=='-'){
      b=pop();
      a=pop();
      push(a-b);
    }else if(s[0]=='*'){
      b=pop();
      a=pop();
      push(a*b);
    }else{
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;
}

Measured memory_bytes: 548