akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
ll a[300010];
ll pre[300010];
int cnt[62];


const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
 
// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}

signed main(){
    int n;
    cin>>n;
    ll mod=1e9+7;
    REP(i,n) cin>>a[i];
    
   // sort(a,a+n);
    for (int i = 0; i < n; i++)
    {
          
                for (int j = 0; j < 60; j++)
                {
                    if(a[i] & (1LL<<j)) cnt[j]++;
                }
                        
    }
    ll sum=0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 60; j++)
        {
            if(a[i] & (1LL<<j)) {
                sum+=((1LL<<j)%MOD)*(n-cnt[j]);
                sum%=mod;
            }
            else{
                sum+=((1LL<<j)%MOD)*cnt[j];
                sum%=mod;
            }
        }
        
    }
    cout<<mult(sum,bin_pow(2,mod-2))<<endl;

    

   
}

Measured memory_bytes: 6656
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int UF[200000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;UF[a]+=UF[b];UF[b]=a;
}
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
char in[410][410];
int W[210000];
int B[210000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<200000;i++)UF[i]=-1;
	for(int i=0;i<a;i++){
		scanf("%s",in[i]);
	}
	for(int i=0;i<a;i++)for(int j=0;j<b;j++){
		for(int k=0;k<4;k++){
			int tx=i+dx[k];
			int ty=j+dy[k];
			if(tx<0||ty<0||tx>=a||ty>=b)continue;
			if(in[i][j]!=in[tx][ty])UNION(i*b+j,tx*b+ty);
		}
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			if(in[i][j]=='.'){
				W[FIND(i*b+j)]++;
			}else{
				B[FIND(i*b+j)]++;
			}
		}
	}
	long long ret=0;
	for(int i=0;i<210000;i++){
		ret+=(long long)W[i]*B[i];
	}
	printf("%lld\n",ret);
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;


int main(){
  ll n;
  cin >> n;
  string ans="";
  ll cnt=2;
  bool odd=false;
  while(abs(n)){
    if(n%2){
     ans += "1";
      if(odd){n++;}else{n--;}
    } else {
      ans += "0";
    }
    n/=2;
    odd=!odd;
  }
  if(ans.empty()){ans="0";}
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskD {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int k = in.nextInt();
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++) {
				a[i] = in.nextInt();
			}
			boolean[][] pref = new boolean[n + 2][k + 1];
			boolean[][] suff = new boolean[n + 2][k + 1];
			pref[0][0] = true;
			for (int i = 1; i <= n; i++) {
				add(pref[i], pref[i - 1], a[i]);
			}
			suff[n + 1][0] = true;
			for (int i = n; i >= 1; i--) {
				add(suff[i], suff[i + 1], a[i]);
			}
			int ans = n;
			int[] s = new int[k + 1];
			outer:
			for (int i = 1; i <= n; i++) {
				for (int j = 0; j < k; j++) {
					s[j + 1] = s[j] + (suff[i + 1][j] ? 1 : 0);
				}
				for (int x = 0; x < k; x++) {
					if (!pref[i - 1][x]) {
						continue;
					}
					int l = k - a[i] - x;
					int r = k - x - 1;
					l = fix(l, k - 1);
					r = fix(r, k - 1);
					if (l <= r && s[r + 1] - s[l] > 0) {
						--ans;
						continue outer;
					}
				}
			}
			out.println(ans);
		}

		private int fix(int x, int m) {
			if (x < 0) {
				return 0;
			}
			if (x > m) {
				return m;
			}
			return x;
		}

		private void add(boolean[] nf, boolean[] f, int x) {
			for (int i = 0; i < f.length; i++) {
				if (!f[i]) {
					continue;
				}
				nf[i] = true;
				if (i + x < f.length) {
					nf[i + x] = true;
				}
			}
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 83416
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repk(i,k,n) for (int i = k; i <= (int)(n); i++)
#define MAX 100010
#define PI 3.14159265359

using namespace std;


int main(){
    double a,b,x;
    scanf("%lf%lf%lf",&a,&b,&x);

    double half = a*a*b/2;
    double tan,ans;   
    if(x>=half){
        ans = atan(2 * (a * a * b - x) / (a * a * a));
    } 
    else{
        ans = M_PI / 2 - atan(2 * x / (a * b * b));
    }

    printf("%.11lf\n",ans * 180.0 / PI);



    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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

int main(){
    std::ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;

    int arr[n+1];
    for(int i=0;i<n;++i)
    {
        cin >> arr[i];
    }
    int ret = 0;
    if( n== k)
    {
        ret = 1;
    }
    else if(((n-k) % (k-1)) == 0)
    {
        ret = ((n-k) / (k-1)) + 1;
    }
    else
    {
        ret = ((n-k) / (k-1)) + 2;
    }

    cout << ret << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;
typedef long long ll;

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

    ll ans = 0;
    int now, prev = 0;
    rep(i, N){
        cin >> now;
        ans += (now - 1) / (prev + 1);
        if(now == prev + 1 or prev == 0)prev++;
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pque = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

int main() {
	int k;
	cin >> k;
	rep(i, k) cout << "ACL";
	cout << '\n';
}

Measured memory_bytes: 3564
N = input()
arr = list(map(int,input().split(" ")))
MOD = int(1e9+7)
sum_arr = sum(arr) % MOD
res = 0
for a in arr:
    sum_arr = (sum_arr-a)%MOD
    res = (res+ sum_arr*a)%MOD
print(res)

Measured memory_bytes: 31396
#include<bits/stdc++.h>
#include<atcoder/all>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;

void solve() {
  ll N, Q;
  cin >> N >> Q;
  fenwick_tree<ll> ft(N+1);
  rep(i, N) {
    ll a;
    cin >> a;
    ft.add(i, a);
  }
  rep(_, Q) {
    ll c;
    cin >> c;
    if (c == 0) {
      ll p, x;
      cin >> p >> x;
      ft.add(p, x);
    } else {
      ll l, r;
      cin >> l >> r;
      cout << ft.sum(l, r) << endl;
    }
  }
}

int main() {
  //ll T;
  //cin >> T;
  //rep(_,T)
    solve();
  return 0;
}


Measured memory_bytes: 8220
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))

if __name__ == "__main__":
    a, b = arr_in()
    out(a*b)


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

const long long inifnity = 1e10;
// dp[items][val] = min_wt
// dp[items][val] = min(dp[items-1][val-val[i]]+wt[i],dp[items-1][val])
long long dp[101][100001];

int main() {
	int n, w;
	cin >> n >> w;
	vector<int> wt(n, 0), val(n, 0);

	//Input
	for (int i = 0; i < n; i++) {
		cin >> wt[i] >> val[i];
	}


	// filling dp states
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= 100000; j++) {
			if (j == 0) {
				dp[i][j] = 0;
			} else if (i == 0) {
				dp[i][j] = inifnity;
			} else {
				if (j >= val[i - 1]) {
					dp[i][j] = min(dp[i - 1][j - val[i - 1]] + wt[i - 1], dp[i - 1][j]);
				} else {
					dp[i][j] = dp[i - 1][j];
				}
			}
		}
	}


	long long max_val = -1;
	for (int i = 100000; i >= 0; i--) {
		if (dp[n][i] <= w) {
			//cout << w << " " << dp[n][i] << endl;
			max_val = i;
			break;
		}
	}

	cout << max_val << endl;
	return 0;
}

Measured memory_bytes: 82540
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long H = sc.nextInt();
        long W = sc.nextInt();
        if (H==1 || W==1) System.out.println(1);
        else System.out.println(H*W/2+H*W%2);
    }
}

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

#define ll long long
#define M 1000000007
using namespace std;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
	int n;
    cin>>n;
    cout<<2*3.1415*n;
    
    
}

Measured memory_bytes: 3800
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <utility>
#include <iomanip>
#define ll long long

using namespace std;

int k;
ll dist[100000];
vector <pair <int, ll>> g[100000];

void dfs(int v, int prev)
{
    int s = g[v].size();
    for (int i = 0; i < s; i++) {
        if (g[v][i].first == prev) continue;
        dist[g[v][i].first] = g[v][i].second + dist[v];
        dfs(g[v][i].first, v);
    }
}

int main()
{
    int n, q, v, u;
    cin >> n;
    pair <int, ll> p;
    ll c;
    for (int i = 0; i < n - 1; i++) {
        scanf("%d%d%lld", &v, &u, &c);
        p.first = u - 1;
        p.second = c;
        g[v - 1].push_back(p);
        p.first = v - 1;
        g[u - 1].push_back(p);
    }
    cin >> q >> k;
    dist[k - 1] = 0;
    dfs(k - 1, -1);
    for (int i = 0; i < q; i++) {
        scanf("%d%d", &v, &u);
        printf("%lld\n", dist[v - 1] + dist[u - 1]);
    }
    return 0;
}

Measured memory_bytes: 15872
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# 全国統一プログラミング王決定戦予選：B - Touitsu


def main():
    N = int(raw_input().strip())
    A = raw_input().strip()
    B = raw_input().strip()
    C = raw_input().strip()

    count = 0
    for i in range(len(A)):
        if A[i] == B[i] == C[i]:
            pass
        elif A[i] == B[i]:
            count += 1
        elif A[i] == C[i]:
            count += 1
        elif B[i] == C[i]:
            count += 1
        else:
            count += 2
    print count


if __name__ == '__main__':
    main()


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

#define ll long long 
#define int ll

int32_t main() {
    ios::sync_with_stdio(0); 

    int n, d; 
    cin >> n >> d;

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        if (x*x + y*y <= d*d) cnt++;
    }

    cout << cnt << endl;


    return 0; 
}



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

int main(){
  int x, y, t;

  while(1) {
    cin >> x >> y;
    if ( x == 0 && y == 0 ) break;
    if ( x > y ) { t = x; x = y; y = t; }
    cout << x << " " << y << endl;
  }

  return 0;
}


Measured memory_bytes: 3048
N = int(input())
A = list(map(int, input().split()))
ans = [0]*N
for i in range(N):
  ans[A[i]-1]+=1
b = 0
for i in range(len(ans)):
  b += ans[i]*(ans[i]-1)//2
for i in range(N):
  print(b-ans[A[i]-1]+1)

Measured memory_bytes: 25644
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	n, _ := nextInt()
	m, _ := nextInt()

	arr := make([][]int, m)
	for i := range arr {
		a, _ := nextInt()
		b, _ := nextInt()
		arr[i] = []int{a, b}
	}

	sort.Slice(arr, func(i, j int) bool { return arr[i][0] > arr[j][0] })
	//	fmt.Println(arr)

	nGot := 0
	spent := 0
	for i := range arr {
		a := arr[i][0]
		b := arr[i][1]
		if a >= n {
			nGot++
		} else if a+b >= n {
			spent += n - a
			nGot++
		}
		if nGot >= m-1 {
			break
		}
	}
	fmt.Println(spent)
}



Measured memory_bytes: 1152
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let d = input::<i64>();
    let n = input::<i64>();

    let ans = (n + n / 100) * 100i64.pow(d as u32);
    println!("{}", ans);
}


Measured memory_bytes: 4352
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let p = read_vec::<usize>();
    let mut min_num = n + 1;
    let mut ans = 0;
    for i in 0..n {
        min_num = min(min_num, p[i]);
        if min_num == p[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 8444
n, y = (int(i) for i in input().split())  
a=-1
b=-1
c=-1
for i in range(n+1):
  for j in range(n-i+1):
      if 10000*i+5000*j+1000*(n-i-j)==y:
        a=i
        b=j
        c=n-i-j
        break

print(a ,b ,c)        

Measured memory_bytes: 3060
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N, x;
	cin >> N >> x;
	VI A(N);
	VI F(N);
	REP(i, N) {
		F[i] = LLINF;
	}
	REP(i, N) {
		cin >> A[i];
	}
	int ans = LLINF;
	eREP(i, N) {
		int cnt = 0;
		REP(j, N) {
			F[j] = min(F[j], A[(j-i+N)%N]);
			cnt += F[j];
		}
		ans = min(ans, cnt + x * i);
	}
	
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 384
import java.util.*;
class Main {
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int cnt[] = new int[26];
        String alphabet="abcdefghijklmnopqrstuvwxyz";
        for(int i=0; i<26; i++)
        {
            cnt[i]=0;
        }
        char ch;
        while(scan.hasNext())
        {
            String text = scan.next();
            for(int i=0; i<text.length(); i++)
            {
                ch=text.charAt(i);
                int n=ch-'A';
                if(n<64 && n>=0) {
                    n=n%32;
                    if(n>=0 && n<26) {
                        cnt[n]++;
                    }
                }
            }
        }
        for(int i=0; i<26; i++)
        {
            System.out.println(alphabet.charAt(i)+" : "+cnt[i]);
        }
        scan.close();

    }
}

Measured memory_bytes: 25964
N, K = map(int, input().split(' '))

if N > K:
    N = N - N // K * K

res = 1e18
s = set()
while True:
    res = min(res, K-N)
    if not N in s:
        s.add(N)
        N = K-N
    else:
        break

print(res)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long k,sum;
int main()
{
	cin>>k;
	for(int i=1;i<=k;i++)
	{
		for(int j=1;j<=k;j++)
		{
			for(int l=1;l<=k;l++)
			{
				long long x=__gcd(i,j);
				x=__gcd(x,l*1ll);
                sum+=x;
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);
    cout.tie(0);
    int n;
   cin>>n;
   int r;
       if(n>=400 && n<=599)
       r=8;
        if(n>=600 && n<=799)
       r=7;
       if(n>=800 && n<=999)
       r=6;
        if(n>=1000 && 1199)
       r=5;
        if(n>=1200 && n<=1399)
       r=4;
        if(n>=1400 && n<=1599)
       r=3;
        if(n>=1600 && n<=1799 )
       r=2;
       if(n>=1800 && n<=1999)
       r=1;
       cout<<r<<"\n";
    return 0;
}


Measured memory_bytes: 3616
N = int(input())
A = list(input().split())

def val(card):
    return int(card[1])

def bubble_sort(A, N):
    x = A.copy()
    for i in range(N):
        for j in range(N-1, i, -1):
            if val(x[j]) < val(x[j-1]):
                x[j], x[j-1] = x[j-1], x[j]
    return x

def selection_sort(A, N):
    x = A.copy()
    for i in range(N):
        mini = i
        for j in range(i, N):
            if val(x[j]) < val(x[mini]):
                mini = j
        x[i], x[mini] = x[mini], x[i]
    return x
    
A_bubble = bubble_sort(A, N)
A_selection = selection_sort(A, N)

print(' '.join(map(str, A_bubble)))
print("Stable")
print(' '.join(map(str, A_selection)))
if A_bubble == A_selection:
    print("Stable")
else:
    print("Not stable")


Measured memory_bytes: 5608
import java.util.Arrays;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] x = new int[N];
        for(int i = 0; i < N; i++)
            x[i] = sc.nextInt();

        Arrays.sort(x);

        int sum = 0;
        for(int p = x[0]; p <= x[N - 1]; p++) {
            int tmp = 0;
            for(int i = 0; i < N; i++) 
                tmp += (x[i] - p) * (x[i] - p);
            
            if(p == x[0]) sum = tmp;
            if(tmp <= sum) sum = tmp;
        }

        System.out.println(sum);
    }

}


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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int main(){
  int a,b;
  cin >> a >> b;
  cout << max(a+b,max(a-b,a*b)) <<endl;
}

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

const int N = 610;
const int MOD = 1e9 + 7;
int n;
int F[N][N][N], flg[N], fac = 1, rua;
void ADD(int &t, int d)
{
	t += d; if (t >= MOD) t -= MOD;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++ i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		if ((a != -1) && (b != -1)) 
			flg[a] = flg[b] = 2;
		else if (a != -1)
			flg[a] = 1;
		else if (b != -1)
			flg[b] = 1;
		else rua ++;
	}
	F[0][0][0] = 1;
	for (int i = 1; i <= 2 * n; ++ i)
		for (int j = 0; j <= 2 * n; ++ j)
			for (int k = 0; k <= 2 * n; ++ k)
			{
				if (flg[i] == 2)
				{
					ADD(F[i][j][k], F[i - 1][j][k]);
				}
				else if (flg[i] == 1)
				{
					ADD(F[i][j][k + 1], F[i - 1][j][k]);
					if (j) ADD(F[i][j - 1][k], 1ll * F[i - 1][j][k] * j % MOD);
				}
				else 
				{
					ADD(F[i][j][k + 1], F[i - 1][j][k]);
					ADD(F[i][j + 1][k], F[i - 1][j][k]);
					if (k) ADD(F[i][j][k - 1], F[i - 1][j][k]);
				}
			}
	for (int i = 1; i <= rua; ++ i) fac = 1ll * fac * i % MOD;
	cout << 1ll * F[2 * n][0][0] * fac % MOD << endl;
}

Measured memory_bytes: 873344
import fractions
import functools

def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    a_gcd = functools.reduce(fractions.gcd,a)
    a = [x//a_gcd for x in a]
    
    a_rev = a[::-1]

    lgcd = [0]
    rgcd = [0]
    for i in range(n):
        l = fractions.gcd(a[i],lgcd[i])
        r = fractions.gcd(a_rev[i],rgcd[i])
        lgcd.append(l)
        rgcd.append(r)

    rgcd = rgcd[::-1]
    g = [fractions.gcd(lgcd[i],rgcd[i+1]) for i in range(n)]
    
    print(max(g)*a_gcd)
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 16152
N, T=gets.split.map &:to_i
t=gets.split.map &:to_i
t<<10**10

res=0
a=t[0]
b=a+T
t[1..N].each do |i|
	if i>b
		res+=b-a
		a=i
		b=a+T
	else
		b=i+T
	end
end
puts res


Measured memory_bytes: 16776
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	int a, b, c;
	cin >> a >> b >> c;

	if (a + b + c > 21) {
		col("bust");
	}
	else {
		col("win");
	}
	
	return 0;
}


Measured memory_bytes: 3660
n = int(input())
l = [int(i) for i in input().split()]

l.sort()

ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] == l[j] or l[j] == l[k]:
                continue
            if l[i]+l[j] > l[k]:
                ans += 1
                
print(ans)

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

 int main(){
   int k,i;
   string s;
   cin>>k;
   cin>>s;
    if(s.size()<=k){
        cout<<s<<endl;
    }
    else{
    for(int i=0;i<k;i++){
        cout<<s[i];
    }
    cout<<"...";
    }



  return 0;
 }


Measured memory_bytes: 3624
n=int(input())
pl=list(map(int,input().split()))
pminl=[pl[0]]
ans=0
for i in range(1,n):
    pminl.append(min(pminl[-1],pl[i]))
for i in range(n):
    if pl[i]==pminl[i]:
        ans+=1
print(ans)

Measured memory_bytes: 26012
#include<stdio.h>

int main(){
    int i;
    char s[1001];
    for(i=0;;i++){
        scanf("%c",&s[i]);
        if(s[i]=='\n')break;
    }
    s[i]='\0';
    for(i=0;s[i+4]!='\0';i++){
        if(s[i]=='a'){
            if(s[i+1]=='p'&&s[i+2]=='p'&&s[i+3]=='l'&&s[i+4]=='e'){
                s[i++]='p';
                s[i++]='e';
                s[i++]='a';
                s[i++]='c';
                s[i]='h';
            }
        }else if(s[i]=='p'){
            if(s[i+1]=='e'&&s[i+2]=='a'&&s[i+3]=='c'&&s[i+4]=='h'){
                s[i++]='a';
                s[i++]='p';
                s[i++]='p';
                s[i++]='l';
                s[i]='e';
            }
        }
    }
    printf("%s\n",s);
    return 0;
}

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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

constexpr int MOD = 1e9 + 7;

// 0 black, 1 white
int dfs(const vector<vi>& tree, vector<array<int, 2>>& dp, int u, int k, int p = -1) {
    int& res = dp[u][k];
    if (res != -1)
        return res;

    res = 1;
    for (int v : tree[u]) {
        if (v == p) continue;

        int child = 0;
        if (k) {
            child = dfs(tree, dp, v, 0, u);
        }

        child += dfs(tree, dp, v, 1, u);
        if (child >= MOD)
            child -= MOD;

        res = 1LL * res * child % MOD;
    }

    // cout << "dfs(" << u << ", " << k << ") = " << res << '\n';
    return res;
}

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

    int n;
    cin >> n;

    vector<vi> tree(n);
    vector<array<int, 2>> dp(n);
    dp[0][0] = dp[0][1] = -1;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        tree[u].push_back(v);
        tree[v].push_back(u);

        dp[i][0] = dp[i][1] = -1;
    }

    int ans = dfs(tree, dp, 0, 0) + dfs(tree, dp, 0, 1);
    if (ans >= MOD)
        ans -= MOD;

    cout << ans << '\n';
    
    return 0;
}


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

long d;
long c[26];
long s[365][26];
long t[365];
long last[26];
long tmpAdd[26];

long nowAns = -1<<30;

long calcMinus(int day,long* last);
long calcScore();

int main(){
    long time = clock();
    
    nowAns = 0;
    cin >> d;
    for(int i=0;i<26;i++)cin >> c[i];
    for(int i=0;i<d;i++){
        for(int j=0;j<26;j++){
            cin >> s[i][j];
        }
    }
    srand(4);

    


    for(int i=0;i<365;i++){
        t[i] = rand()%26 + 1;
    }
    nowAns = calcScore();

    for(int i=0;i<26;i++){
        last[i] = tmpAdd[i];
    }

   do{
        
        int qq = 1;
        int qqbef = 1;
        int dd = 0;
        
            do{
                dd = rand()%365;
                qqbef = t[dd];
                qq = rand()%26 + 1;
                if(s[dd][qq-1] > s[dd][qqbef-1]){
                    if(rand()%100 == 0)qq = qqbef;
                }else{
                    if(rand()%10 > 0)qq = qqbef;
                }
            }while(qq == qqbef);
        
        t[dd] = qq;
        long tmp = calcScore();
        bool chk = true;
        if(tmp > nowAns){
            if(rand()%100 > 98){
                chk = false;
            }
        }else{
            if(rand()%100 > 1){
                chk = false;
            }
        }

        if(chk){
            for(int i=0;i<26;i++){
                last[i] = tmpAdd[i];
            }
            nowAns = tmp;
        }else{
            t[dd] = qqbef;
        }
    }while(clock() - time  < 2*CLOCKS_PER_SEC-20000);

    for(int i=0;i<d;i++){
        cout << t[i]<<endl;
    }
    
}


long calcMinus(int day,long* tmplast){

    long ans = 0;
    for(int i=0;i<26;i++){
        ans -= c[i] * (day - tmplast[i]);
    }

    return ans;
}

long calcScore(){
    long ans = 0;

    long tmplast[26];
    for(int i=0;i<26;i++){
        tmplast[i] = -1;
    }

    for(int i=0;i<d;i++){
        tmplast[t[i]-1] = i;
        ans += s[i][t[i]-1];
        ans += calcMinus(i,tmplast);
    }

    for(int i=0;i<26;i++){
        tmpAdd[i] = tmplast[i];
    }

    return ans;
    
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc137/abc137_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int A, B;
  cin >> A >> B;

  int ans = max(A + B, max(A * B, A - B));
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int ara[3],i=0,j;
    for(j=0;j<3;j++)
    {
        cin>>ara[j];
    }
    if(ara[i]!=ara[i+1] && ara[i]!=ara[i+2])
        cout<<ara[i]<<endl;
    else if(ara[i+1]!=ara[i] && ara[i+1]!=ara[i+2])
        cout<<ara[i+1]<<endl;
    else
        cout<<ara[i+2]<<endl;

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
	int n, k; cin >> n >> k;
	double p = 0;
	int m;
	for(int i = 1; i <= n; i++){
		m = (int)fmax(ceil(log2((double)k/i)), 0);
		p += (1.0/n * pow(2, -m));
	}
	cout << setprecision(12) << p << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    ll n;
    string s;
    cin >> s;
    ll ans = 0;
    rep0(i, s.length()-1){
        int tmp = (int)(s[i] - '0');
        ans += tmp % 9;
    }
    if(ans % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3376
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t K;
  cin>>K;
  int64_t N;
  cin>>N;
  vector<int64_t> A(N);
  vector<int64_t> B(N);
  vector<int64_t> R(N);
  for(int i=0;i<N;i++) {
   cin>>A.at(i);
  }

  B.at(0)=A.at(0)+K-A.at(N-1);
  
  for(int i=1;i<N;i++){
    B.at(i)=A.at(i)-A.at(i-1);
  }
  
  for (int i=0;i<N;i++){
    R.at(i)=K-B.at(i);
  }  
  sort(R.begin(),R.end());
  cout<<R.at(0);
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  ll n;
  int ans = 0;
  cin >> n;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i == 0) {
      int cnt = 0;
      while (n%i == 0) {
        n /= i;
        cnt++;
      }
      int tmp = 1;
      while (cnt >= tmp) {
        ++ans;
        cnt -= tmp;
        ++tmp;
      }
    }
  }
  if (n != 1) ++ans;
  cout << ans << endl;
}

Measured memory_bytes: 3656
/*
 * Author : Sadi
 * Tue 21/07/2020
 * 17:50:15.27
 */
#include <bits/stdc++.h>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int K;
    cin >> K;
    long long sum = 0;
    for(int i = 1; i <= K; ++i) {
        for(int j = 1; j <= K; ++j) {
            for(int k = 1; k <= K; ++k) {
                sum += __gcd(i, __gcd(j, k));
            }
        }
    }
    cout << sum << '\n';
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int T[N];
  for (int i=0; i<N; i++) {
    cin >> T[i];
  }
  int M;
  cin >> M;
  int P[M], X[M];
  for (int i=0; i<M; i++) {
    cin >> P[i] >> X[i];
  }
  for (int j=0; j<M; j++) {
    int ans=0;
    for (int i=0; i<N; i++) {
      if (P[j]==(i+1)) {
        ans+=X[j];
      } else {
        ans+=T[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

int main() {
	int n; i64 d; scanf("%d%lld", &n, &d);

	int ans = 0;
	while(n--) {
		i64 x, y; scanf("%lld%lld", &x, &y);

		ans += (x * x + y * y <= d * d);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3808
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
bool h[1000010]={false};
int main(){
	int n;
	cin>>n;
	int out=100000;
	rep(i,n){
		out*=1.05;
		if(out%1000)out=out-out%1000+1000;
	}
	cout<<out<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
	string S; 
	cin >> S;
	string T = "CODEFESTIVAL2016"; 
	int ans = 0; 
	for(int i = 0; i < 16; i++){
		if(S.at(i) != T.at(i)) ans ++;  
	}
	cout << ans << endl; 
}

Measured memory_bytes: 256
#include<cstdio>
int A[100000];
int partition(int p, int r){
    int x = A[r];
    int i = p-1;
    for(int j=p; j< r; j++){
        if(A[j] <= x){
            i++;
            int t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    int t = A[i+1]; // 最後のrの部分を交換
    A[i+1] = A[r];
    A[r] = t;
    return i+1;
}
int main(){
    int n;
    scanf("%d", &n);
    for(int i=0; i<n;i++) scanf("%d", &A[i]);
    
    int q = partition(0, n-1);

    for(int i= 0; i<n; i++){
        if(i) printf(" ");
        if(i==q) printf("[");
        printf("%d", A[i]);
        if(i==q) printf("]");
    }
    printf("\n");
    
    return 0;

}


Measured memory_bytes: 3068
#include <cstdio>
#include <set>
#define M(x,y)std::make_pair(x,y)
typedef std::set<std::pair<int,int> >S;
int n,x,y,x1,y1,x2,y2,dx,dy;main(){for(;scanf("%d",&n),n;printf("%d\n",n)){
	S s;S::iterator it1,it2;
	for(;n;n--)scanf("%d%d",&x,&y),s.insert(M(x,y));
	for(it1=s.begin();it1!=s.end();it1++)
		for(x1=it1->first,y1=it1->second,it2=it1,it2++;it2!=s.end();it2++)
			if(x2=it2->first,y2=it2->second,dx=x2-x1,dy=y2-y1,dx*dx+dy*dy>n&&s.find(M(x1-dy,y1+dx))!=s.end()&&s.find(M(x2-dy,y2+dx))!=s.end())n=dx*dx+dy*dy;
}}

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

int main()
{
    int N;
    scanf("%d", &N);
    std::vector<long long> A(N);
    for(int i=0; i<N; i++) scanf(" %lld", &A[i]);

    long long sum = 0, count = 0;
    for(int i=0; i<N; i++){
        if(A[i] != 0) sum += A[i];
        else{
            count += sum / 2;
            sum = 0;
        }
    }
    count += sum / 2;

    std::cout << count << std::endl;
}

Measured memory_bytes: 1024
#include<iostream>

#define AMAX 100
#define BMAX 100

using namespace std;

int main(void){
	int A, B;
	cin >> A >> B;
	
	const int diff = A - 2*B;
	if(diff >= 0){
		cout << diff << endl;
	}else{
		cout << 0 << endl;
	}
	
	return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  map<int,int> high;
  for(int i=0;i<N;i++){
    int H;
    cin>>H;
    high[i+1]=H;
  }
  vector<int>A(M);
  vector<int>B(M);
  for(int i=0;i<M;i++)
    cin>>A.at(i)>>B.at(i);
  vector<bool>kanou(N,true);
  for(int i=0;i<M;i++){
    if(high[A.at(i)]>=high[B.at(i)])
      kanou.at(B.at(i)-1)=false;
    if(high[B.at(i)]>=high[A.at(i)])
      kanou.at(A.at(i)-1)=false;
  }
  int count=0;
  for(int i=0;i<N;i++)
    if(kanou.at(i))
      count++;
  cout<<count<<endl;
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

signed main(void){
  int n;cin >> n;
  int ans=0;
  rep(i,n)ans+=i;
  cout << ans << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
const int maxn=30;
int n,m;
char mapp[maxn][maxn];
int vis[maxn][maxn];
int go [8]={1,0,-1,0,0,1,0,-1};
struct point{
    int x,y,v;     //x是横坐标，y是纵坐标，v表示步数
};
int bfs(int i,int j){
    queue<point>q;
    struct point ss;
    ss.x=i;
    ss.y=j;
    ss.v=0;
    vis[i][j]=1;
    q.push(ss);
    int ci=0;
    while(!q.empty()){
        point now,temp;
        now=q.front();
        q.pop();
        if(now.v>ci)
            ci=now.v;
        for(int i=0;i<8;i+=2)
        {
            int xx=now.x+go[i];
            int yy=now.y+go[i+1];
            if(xx>=1&&yy>=1&&xx<=n&&yy<=m&&vis[xx][yy]==0&&mapp[xx][yy]!='#')
            {
                temp.x=xx;
                temp.y=yy;
                temp.v=now.v+1;
                q.push(temp);
                vis[xx][yy]=1;
            }
        }
    }
    return ci;
}
int main()
{
    int i,j;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++){
        scanf("%s",mapp[i]+1);
    }
    int ci=0;
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
    {
        if(mapp[i][j]!='#')
        {
            memset(vis,0,sizeof(vis));
            int cc=bfs(i,j);
            if(cc>ci)
                ci=cc;
        }
    }
    printf("%d\n",ci);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, n, ans = 0, now = 0;
  scanf("%lld", &n);
  ll a[3][n], cnt[n];
  for(i = 0; i < 3; ++i) for(j = 0; j < n; ++j) scanf("%lld", &a[i][j]);
  for(i = 0; i < 3; ++i) sort(a[i], a[i] + n);
  for(i = 0; i < n; ++i) {
    while(now != n && a[0][now] < a[1][i]) now++;
    cnt[i] = now;
    if(i) cnt[i] += cnt[i - 1];
  }
  now = 0;
  for(i = 0; i < n; ++i) {
    while(now != n && a[1][now] < a[2][i]) now++;
    if(now) now--, ans += cnt[now];
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 3328