akhauriyash/Code-Regression huggingface dataset:
/*                                 ___ _____ 
  ___  _ __ ___   ___  __ _  __ _ / _ \___  |
 / _ \| '_ ` _ \ / _ \/ _` |/ _` | | | | / / 
| (_) | | | | | |  __/ (_| | (_| | |_| |/ /  
 \___/|_| |_| |_|\___|\__, |\__,_|\___//_/   
                      |___/            
*/
// Getting better at it ! ! !
#include <bits/stdc++.h>
#include <string.h>
#define int long long
#define MAX (int)(1e7 + 5)
#define MAX2D (int)(1e3 + 5)
#define itn int
#define inf 5e18
#define MOD (int)(1e9 + 7)
#define pb push_back
#define mk make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sitr set<int>::iterator
#define mitr map<int, int>::iterator
#define pii pair<int, int>
#define vii vector<pii>
#define vi vector<int>
#define vll vector<unsigned int>
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define fast                       \
    ios_base ::sync_with_stdio(0); \
    cin.tie(NULL);                 \
    cout.tie(NULL)
using namespace std;


void __print(int x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x)
{
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x)
{
    int f = 0;
    cerr << '{';
    for (auto &i : x)
        cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v)
{
    __print(t);
    if (sizeof...(v))
        cerr << ", ";
    _print(v...);
}
#ifndef ONLINE_JUDGE
#define see(x...)                 \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define see(x...)
#endif

signed main()
{
    fast;
    int n, d, cnt = 0;
    cin>>n>>d;
    while(n--) {
        int x,y;
        cin>>x>>y;
        int dist = x*x + y*y, check = d*d;
        if(dist <= check) cnt++;
    }
    cout<<cnt;
    return 0; 
}
 
/*
max factors number = 720720 --> 240 factors
max factors number = 1441440 -->288 factors
 
Beautiful program
Please run for me.
I've tried you in BASIC,
FORTRAN and C.
Beautiful program,
You've errors galore.
And each time I run you,
You're swapped out of core.
*/

Measured memory_bytes: 3648
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n=gets.to_i
x=get_f
y=get_f
3.times do|p|
  ans=0.0
  n.times do|i|
    ans+=((x[i]-y[i]).abs**(p+1)).to_f
  end
  puts ans**(1.0/(p+1).to_f)
end
ans=0
n.times do|i|
  ans=(x[i]-y[i]).abs if ans<(x[i]-y[i]).abs
end
puts ans


Measured memory_bytes: 8968
#include <iostream>

using namespace std;

int heap[251];

int main() {
    int n, v;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> v;
        heap[i] = v;
    }

    for (int i = 1; i <= n; ++i) {
        cout << "node " << i;
        cout << ": key = " << heap[i] << ", ";
        if (i / 2 > 0)
            cout << "parent key = " << heap[i / 2] << ", ";
        if (i * 2 <= n)
            cout << "left key = " << heap[i * 2] << ", ";
        if (i * 2 + 1 <= n)
            cout << "right key = " << heap[i * 2 + 1] << ", ";
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if (a < b) swap(a, b);
    if (b < c) swap(b, c);
    if (a < b) swap(a, b);
    for (int i = 0; i < k; i++) {
        a *= 2;
    }
    cout << a + b + c << endl;
}


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

int main(void)
{
    int a, b, C;
    double c, S, L, h, rad;
    
    scanf("%d %d %d", &a, &b, &C);
    
    rad=C*acos(-1)/180;
    S=a*b*sin(rad)/2;
    c=sqrt( a*a+b*b-2*a*b*cos(rad) );
    L=a+b+c;
    h=S*2/a;
    
    printf("%lf\n",S);
    printf("%lf\n",L);
    printf("%lf\n",h);
    
    return 0;
}


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

using namespace std;
 
int main() {
    vector<int> X (5);
    for(int i = 0;i < 5;i++){
        cin >> X.at(i);
        if(X.at(i) == 0){
            cout << i + 1 << endl;
            return 0;
        }
    }
    
}

Measured memory_bytes: 3624
#include <iostream>
#include<cstring>
#define ll long long
#define MAXN 100+10
using namespace std;

int main() {
	char a[MAXN]={0};
	memset(a,'\0',sizeof(a)-1);
	scanf("%s",a);
	int len=strlen(a);
	cout<<a[0]<<len-2<<a[len-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    f=1;
    for(ll i=100;;f++){
        i=i*1.01;
        if(i>=n) break;
    }

    cout<<f<<endl;
    
    return 0;
}


Measured memory_bytes: 3648
import sys
from collections import deque

input = sys.stdin.readline
q = int(input())
ans = deque()
cursor = 0
for _ in range(q):
    query = [int(i) for i in input().split()]
    if query[0] == 0:
        ans.appendleft(query[1])
    elif query[0] == 1:
        ans.rotate(-1 * query[1])
        cursor += query[1]
    else:
        ans.popleft()
ans.rotate(cursor)
print(*ans, sep="\n")



Measured memory_bytes: 24704
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, N;
  cin >> N >> A;
  if (N < 500 && N<= A){ cout << "Yes" <<endl;}
  else if(N >= 500 && N % 500 <= A){ cout << "Yes" << endl;}
  else{ cout << "No" << endl;}
                        
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int q;
int ans;
priority_queue<int> que1;
priority_queue<int, vector<int>, greater<int>> que2;

signed main() {
	cin >> q;
	for (int i = 0; i < q; i++) {
		int n;
		cin >> n;
		if (n == 1) {
			int a, b;
			cin >> a >> b;
			if (que1.empty() && que2.empty()) {
				que1.push(a);
			}
			else if ((int)que1.size() == (int)que2.size()) {
				if (a < que1.top()) {
					que1.push(a);
					ans += que1.top() - a;
				}
				else if (que2.top() < a) {
					que2.push(a);
					ans += a - que2.top();
					int p = que2.top(); que2.pop();
					que1.push(p);
				}
				else que1.push(a);
			}
			else {
				if (que1.empty()) {
					ans += abs(a - que2.top());
					que2.push(a);
					int p = que2.top(); que2.pop();
					que1.push(p);
				}
				else if (que2.empty()) {
					ans += abs(a - que1.top());
					que1.push(a);
					int p = que1.top(); que1.pop();
					que2.push(p);
				}
				if ((int)que1.size() > (int)que2.size()) {
					if (a < que1.top()) {
						ans += que1.top() - a;
						que1.push(a);
						int p = que1.top(); que1.pop();
						que2.push(p);
					}
					else {
						ans += a - que1.top();
						que2.push(a);
					}
				}
			}
			ans += b;
		}
		else {
			cout << que1.top() << " " << ans << endl;
		}
	}
}

Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    ll N;
    cin >> N;
    vector<ll> v(N), t(N);
    REP(i, N) cin >> t[i];
    REP(i, N) cin >> v[i];
    ll total = 0;
    REP(i, N) total += t[i];
    ll tmp = 0;
    
    map<double, double> mf;
    double ii = 0;
    REP(i, N){
        REP(j, 2 * t[i]){
            if (j == 0 && i != 0) mf[ii] = min(v[i-1], v[i]);
            else mf[ii] = v[i];
            ii += 0.5;
        }
    }
    /*
        ii = 0;
    while(ii <= total){
        cout << ii << " " << mf[ii] << endl;
        ii += 0.5;
    }
    */
    mf[total] = 0;
    double current = 0;
    ii = total - 0.5;
    while(ii >= 0){
        if (mf[ii] > current){
            current += 0.5;
            mf[ii] = current;
        }else{
            current = mf[ii];
        }
        ii -= 0.5;
    }
    /*
    ii = 0;
    while(ii <= total){
        cout << ii << " " << mf[ii] << endl;
        ii += 0.5;
    }
*/
    //REP(i, total+1) cout << i << " " << m[i] << endl;
    double cur = 0;
    ii = 0.5;
    map<double, double> act;
    act[0] = 0;

    while(ii < 2 * total){
        if (cur < mf[ii]){
            cur += 0.5;
            act[ii] = cur;
        }else{
            act[ii] = mf[ii];
            cur = mf[ii];
        }
        ii += 0.5;
    }
    /*
    ii = 0;
    while(ii <= total){
        cout << ii << " " << act[ii] << endl;
        ii += 0.5;
    }
    */
    
    //REP(i, total+1) cout << i << " " << act[i] << endl;
    double ans = 0;
    ii = 0;
    while(ii < 2 * total){
        ans += (double)(act[ii] + act[ii+0.5]) / 4.0;
        ii += 0.5;
    } 
    printf("%.4f\n", ans);


    return 0;
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n; cin>>n;
    if(n==3 || n==5 || n==7) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int limit = 200010;
vector<int> events[limit];

template <int depth>  struct Segment_tree {
const static int h = depth;
const static int n = 1 << h;

using T = long long;
T data[2 * n], lazy[2 * n];
const T out = 0;

inline T vmerge(T l, T r) {return max(l, r);}

void init() {
	fill_n(data, 2 * n, out);
	fill_n(lazy, 2 * n, out);
}

	// lazy_evaluation
void apply(T v, int p, int l, int r) {
	data[p] += v;
	lazy[p] += v;
}

void push(int p, int l, int r) {
	const int m = (l + r) / 2;
	if (lazy[p] == out) return;
	apply(lazy[p], 2 * p + 1, l, m);
	apply(lazy[p], 2 * p + 2, m, r);
	lazy[p] = out;
}

void range_update(int a, int b, T x, int k = 0, int l = 0, int r = n) {
	if (r <= a or b <= l) return;
	if (a <= l and r <= b) return apply(x, k, l, r);
	push(k, l, r);
	const int m = (l + r) / 2;
	range_update(a, b, x, k * 2 + 1, l, m);
	range_update(a, b, x, k * 2 + 2, m, r);
	data[k] = vmerge(data[k * 2 + 1], data[k * 2 + 2]);
}

T range_query(int a, int b, int k = 0, int l = 0, int r = n) {
	if (r <= a or b <= l) return out;
	if (a <= l and r <= b) return data[k];
	push(k, l, r);
	const int m = (l + r) / 2;
	T vl = range_query(a, b, k * 2 + 1, l, m);
	T vr = range_query(a, b, k * 2 + 2, m, r);
	return vmerge(vl, vr);
}
};

Segment_tree<18> seg;

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

	int ans = max(0,n - m);

	rep(i,n){
		int l,r;
		cin >> l >> r;
		events[l].push_back(r);
	}

	rep(l,1,m+1){
		seg.range_update(l,l + 1, l - m - 1);
	}

	for(auto &r:events[0]){
		seg.range_update(0, r + 1, 1);
	}

	chmax<int>(ans, seg.range_query(1, m + 2));	

	rep(l,1,m+1){
		//cerr << seg.range_query(l,m + 2) << " " << -l << endl;
		for(auto &r:events[l]){
			seg.range_update(0, r + 1, 1);
		}

		chmax<int>(ans, seg.range_query(l + 1 ,m + 2) - l);
	}

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

Measured memory_bytes: 16256
#include<stdio.h>

#define N 100

int min(int a, int b){
	if(a < b){
		return a;
	} else {
		return b;
	}
}

int main(void){
	int i, n, j, k, p[N+1], m[N+1][N+1];
	scanf("%d", &n);
	
	for(i = 1; i <= n; i++){
		scanf("%d %d", &p[i-1], &p[i]);
	}
	
	for(i = 1; i <= n; i++){
		m[i][i] = 0;
	}
	
	for(i = 2; i <= n; i++){
		for(j = 1; j <= n - i + 1; j++){
			int a = j + i -1;
			m[j][a] = (1 << 21);
			for(k = j; k <= a - 1; k++){
				m[j][a] = min(m[j][a], m[j][k] + m[k+1][a] + p[j-1] * p[k] * p[a]);
			}
		}
	}
	
	printf("%d\n", m[1][n]);
		
	return 0;
}

				


Measured memory_bytes: 2108
n,m = map(int, raw_input().split())
s = [map(int, raw_input().split()) for _ in range(m)]
c = 0
s.sort()
cur = []
for u,v in s:
	if cur == []:
		cur = [u,v]
	if cur[1] <= u:
		cur = [u,v]
		c += 1 
	else:
		cur = [max(u, cur[0]),min(v, cur[1])]
		if cur[1] - cur[0] == 0: 
			c +=1
			cur = []
print c + (1 if cur else 0)
"""
---- ------
     4    9
       ---
       5 6
       ------?
       5 

       5 ----- 10
"""

Measured memory_bytes: 89460
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

struct Block {
    int w, s, v;
    Block(int w, int s, int v): w(w), s(s), v(v) {}
};

bool blockcmp(Block x, Block y) {
    return x.w + x.s < y.w + y.s; 
}

int main() {
    int n;
    cin >> n;
    vector<Block> b;
    rep(i, n) {
        int w, s, v;
        cin >> w >> s >> v;
        b.emplace_back(w, s, v);
    }
    sort(b.begin(), b.end(), blockcmp);
    vector<ll> dp(10002);
    rep(i, n) {
        int w = b[i].w, s = b[i].s, v = b[i].v;
        for(int j = s; j >= 0; j--) {
            int dest = min(10001, j + w);
            chmax(dp[dest], dp[j] + v);
        }
    }
    ll ans = 0;
    rep(i, 10002) chmax(ans, dp[i]);
    cout << ans << endl;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n,a,b;
    cin >> n >> a >> b;

    if((b-a)%2==0){
        puts("Alice");
    }else{
        puts("Borys");
    }
    return 0;
}
 
 


Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    A,B,N=map(int,readline().split())

    if N>=B:
        x=B-1
        print(A*x//B)
    else:
        x=N
        print(A*x//B)
if __name__=="__main__":
    main()

Measured memory_bytes: 9180
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

void pok() {
  cout << "Yes" << endl;
}
void png() {
  cout << "No" << endl;
}

int main() {
  int n,c; cin >> n >> c;
  int table[31][100001] = {};
  int cnts[1000001];

  int min_s = INT_MAX, max_t = INT_MIN;
  for (int i = 0; i < n; i++) {
    int s, t, c; cin >> s >> t >> c;
    for (int j = s-1; j < t; j++) {
      table[c][j]++;
    }
    min_s = std::min(min_s, s-1);
    max_t = std::max(max_t, t);
  }

  for (int ch = 1; ch <= c; ch++) {
    for (int i = min_s; i <= max_t; i++) {
      if (table[ch][i] > 0) {
        cnts[i]++;
      }
    }
  }

  int max_cnt = 0;
  for (int i = 1; i < max_t; i++) {
    max_cnt = max(max_cnt, cnts[i]);
  }
  cout << max_cnt << endl;
}

Measured memory_bytes: 16256
/*Rajeev Ranjan
  CSE @MNNIT */

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

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define mem(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define S second
#define F first
#define boost ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
typedef long long int ll;
typedef double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N = 1e5 + 5;


ll a[N],dp[N];
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];

    memset(dp,-1,sizeof(dp));
    dp[1]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1; j<=k && (i+j)<=n; j++)
        {
            ll v = abs(a[i+j]-a[i]) + dp[i];
            if(dp[i+j]==-1)
                dp[i+j] = v;
            else
                dp[i+j] = min(dp[i+j],v);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N;
  cin >> N;
  vector<int> V(N);
  vector<int> C(N);
  for(int i = 0; i < N; i++) cin >> V[i];
  for(int i = 0; i < N; i++) cin >> C[i];
  vector<int> Z(N);
  int S = 0;
  for(int i = 0; i < N; i++){
      Z[i] = V[i] - C[i];
      if (Z[i] > 0) S += Z[i];
  }
  cout << S << endl;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rei register int
#define maxn 310
using namespace std;
const int M = 1000000007;
int n,m;
int dp[maxn][maxn][maxn],l2[maxn],r2[maxn],l1[maxn],r1[maxn];
inline void add(int &x,int y){x = x + y >= M ? x + y - M : x + y;}
inline int check(int x,int y,int k){return x >= l2[k] && x <= r2[k] && y >= l1[k] && y <= r1[k] && x < y;}
int main(){
	scanf("%d%d",&n,&m);
	for(rei i = 1;i <= n;++i) r1[i] = r2[i] = i,l1[i] = l2[i] = 0;
	for(rei i = 0,l,r,x;i < m;++i){
	scanf("%d%d%d",&l,&r,&x);
	if(x == 3) l2[r] = max(l2[r],l + 1);
	if(x == 2) r2[r] = min(r2[r],l),l1[r] = max(l1[r],l + 1);
	if(x == 1) r1[r] = min(r1[r],l);
    }
//	for(rei i = 1;i <= n;++i) cout << "1: " << i << ": " << l1[i] << " " << r1[i] << endl;
//  for(rei i = 1;i <= n;++i) cout << "2: " << i << ": " << l2[i] << " " << r2[i] << endl;
	if(r1[1] == 1 && l2[1] == 0) dp[1][0][1] = 3;
	for(rei i = 1;i < n;++i){
	for(rei j = 0;j <= i;++j)
	 for(rei k = j + 1;k <= i;++k) {
//	 if(i == 2) cout << j << " " << k << " " << dp[i][j][k] << endl;
	 dp[i][j][k] *= check(j,k,i);
     }
	for(rei j = 0;j <= i;++j)
	 for(rei k = j + 1;k <= i;++k){
//	if(i == 1) cout << j << " " << k << " " << dp[i][j][k] << endl;
	add(dp[i + 1][k][i + 1],dp[i][j][k]),add(dp[i + 1][j][k],dp[i][j][k]),add(dp[i + 1][j][i + 1],dp[i][j][k]);
//	if(i == 1) cout << dp[i + 1][k][i + 1] << endl;
    }
	}
//	cout << endl;
//	for(rei i = 0;i <= n;++i){
//	 for(rei j = 0;j <= n;++j)
//	cout << dp[2][i][j] << " "; cout << endl;
//  }
	int ans(0);
	for(rei i = l2[n];i <= r2[n];++i)
	 for(rei j = max(l1[n],i + 1);j <= r1[n];++j)
	add(ans,dp[n][i][j]); cout << ans;
	return 0;
}

Measured memory_bytes: 112896
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var p = int.Parse(line[1]);
        var s = Console.ReadLine().Trim();
        if (p == 2 | p == 5) { getAns25(n, p, s); goto exit; }
        var a = new int[n];
        var pow = 1;
        for (int i = 0; i < n; i++)
        {
            var w = s[n - 1 - i] - '0';
            if (i != 0) pow *= 10;
            pow %= p;
            a[i] = (w * pow) % p;
        }
        getAns(n, p, a);
    exit:;
    }
    static void getAns25(int n, int p, string s)
    {
        var ans = 0L;
        for (int i = 0; i < n; i++)
        {
            var w = (s[n - 1 - i] - '0') % p;
            if (w == 0) ans += n - i;
        }
        Console.WriteLine(ans);
    }
    static void getAns(int n, int p, int[] a)
    {
        var d = new Dictionary<int, long>();
        d[0] = 1;
        var pre = 0;
        for (int i = 0; i < n; i++)
        {
            var t = (pre + a[i]) % p;
            if (d.ContainsKey(t)) d[t]++;
            else d[t] = 1;
            pre = t;
        }
        var ans = 0L;
        foreach (var x in d)
            if (x.Value >= 2) ans += (x.Value * (x.Value - 1)) / 2L;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 15200
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define INT(a) int((a)+1e-9)

#define HOU 1000000007

#define SUPL 205

int L;
char us[SUPL];

long rss[SUPL][SUPL];


int solve(){
	FOR(l,0,L+1) FOR(m,0,L+1) rss[l][m]=0;
	rss[0][0]=1;
	FOR(l,0,L+1) FOR(m,0,L+1){
		rss[l][m] = rss[l][m] % HOU;
		if(l<m) continue;
		if(us[l]=='D'){
			rss[l+1][m+1]+=rss[l][m]*(l-m);
			rss[l+1][m+2]+=rss[l][m]*(l-m)*(l-m);
			continue;
		}
		if(us[l]=='U'){
			rss[l+1][m]+=rss[l][m];
			rss[l+1][m+1]+=rss[l][m]*(l-m);
			continue;
		}
	}
	return rss[L][L];
}



int main(){
	int inpL;
	cin >> inpL;
	int i=0;
	REP(gomi,inpL){
		cin>>us[i];
		if(us[i]!='-') i++;
	}
	L=i;


	cout<<solve()<<endl;


}

Measured memory_bytes: 1476
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

ll func(char a,char b,char c){
	if(a == b && b == c)return 0;
	if(a == b || b == c || a == c)return 1;
	return 2;
}

signed main(){
	ll N;
	string A,B,C;
	cin >> N >> A >> B >> C;
	ll ans = 0;
	FOR(i,0,N){
		ans += func(A[i],B[i],C[i]);
	}
	cout << ans << endl;
}

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

int Solve(int n) {
  int ret = 0;
  for (; n; n /= 10) {
    if (n % 10 == 2)
      ++ret;
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  cout << Solve(n) << "\n";
  return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
    }

    let mut factors = vec![];

    for i in 1..=(m as f64).sqrt().ceil() as usize {
        if m % i == 0 {
            factors.push(i);
            factors.push(m / i);
        }
    }

    let mut ans = 0;

    while let Some(val) = factors.pop() {
        if val <= m / n {
            ans = std::cmp::max(ans, val);
        }
    }

    println!("{}", ans);
}


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


int main(){
  int n;
  cin >> n;
  vector<int> A(n,0);
  for (int i=0; i<n-1; i++){
    int a;
    cin >> a;
    A[a-1] ++;
  }
  for(int i=0; i<n; i++){
    cout << A[i] << endl;
  }
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n; cin >> n;
  vi a(n),b(n); rep(i,n) cin >> a[i] >> b[i];
  sort(all(a));
  sort(all(b));
  ll ans = 0;
  if(n%2){
    ans = b[n/2]-a[n/2]+1;
  }else{
    long double m = (a[n/2]+a[n/2-1])/2.0;
    long double M = (b[n/2]+b[n/2-1])/2.0;
    ans = (M-m)*2+1;
  }
  cout << ans;
  cout << endl;
  return 0;
}


Measured memory_bytes: 4656
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, i;
    string w[200100];
    char tmp='a';
    map<string, int> mp;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> w[i];
    }

    for(i=0;i<n;i++){
        if(tmp!=w[i][0] && i!=0){
            cout << "No" <<endl;
            return 0;
        }
        mp[w[i]]++;
        if(mp[w[i]]!=1){
            cout << "No" <<endl;
            return 0;
        }
        tmp=w[i][w[i].size()-1];
    }
    cout << "Yes" <<endl;
    return 0;
}


Measured memory_bytes: 9872
#include "bits/stdc++.h"
 
typedef long long ll;
//#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;
ll cnt = 0;
vector<string> s(410);
int h,w;
int m[410][410] = {0};
pair<int,int> ans[410][410];
int anscnt[410][410] = {0};
void f(int i,int j,int x,int a,int b){
    m[i][j] = x;
    if(s[i][j] == '.')cnt++;
    else{
        ans[i][j] = MP(a,b);
    }
    if(i != 0 && m[i-1][j] != x && s[i][j] != s[i-1][j]){
        f(i-1,j,x,a,b);
    }
    if(i != h-1 && m[i+1][j] != x && s[i][j] != s[i+1][j]){
        f(i+1,j,x,a,b);
    }
    if(j != 0 && m[i][j-1] != x&& s[i][j] != s[i][j-1]){
        f(i,j-1,x,a,b);
    }
    if(j != w-1 && m[i][j+1] != x&& s[i][j] != s[i][j+1]){
        f(i,j+1,x,a,b);
    }
    return;
}



int main(){
    cin >> h >> w;
    rep(i,h) cin >> s[i];
    rep(i,h) rep(j,w) ans[i][j] = MP(-1,-1);
    
    int c = 0;
    rep(i,h){
        rep(j,w){
            if(s[i][j] == '#'){
                if(ans[i][j].fi == -1){
                    int cntnow = cnt;
                    c++;
                    f(i,j,c,i,j);
                    anscnt[i][j] = cnt - cntnow;
                }else{
                    cnt += anscnt[ans[i][j].fi][ans[i][j].se];
                }
            }
        }
    }
    
    cout << cnt << endl;

    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 
// rm -r -f test;oj dl http://arc074.contest.atcoder.jp/tasks/arc074_b

Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
int main(){
 	ios::sync_with_stdio(0);
  	cin.tie(0);
  	int a,b;
  	cin>>a>>b;
  	if(a<=8 and b<=8){
     	cout<<"Yay!";
      	return 0;
    }
  	cout<<":(";
  	return 0;
}

Measured memory_bytes: 384
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7

N = i()
K = i()
X = i()
Y = i()
print(N*X-max(0,N-K)*(X-Y))

Measured memory_bytes: 10044
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

Int Ceil(Int a, Int b) {
    if (a % b == 0) {
        return a / b;
    } else {
        return Floor(a, b) + 1;
    }
}

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

    Int h, w, n;
    cin >> h >> w >> n;

    cout << Ceil(n, max(h, w)) << endl;

    return 0;
}


Measured memory_bytes: 256
p=[]
rank=[]
answer=[]

def makeset(x):
    p[x] = x
    rank[x] = 0
    
def union(x,y):
    link(findset(x),findset(y))
    
def link(x,y):
    if rank[x] > rank[y]:
        p[y] = x
    else:
        p[x] = y
        if rank[x] == rank[y]:
            rank[y] = rank[y] + 1
def findset(x):
    if x != p[x]:
        p[x] = findset(p[x])
    return p[x]

t,s = map(int,input().split())
for i in range(t):
    p.append(None)
    rank.append(None)
while True:
    try:
        o,x,y = map(int,input().split())
    except:
        break
    else:
        if o == 0:
            if p[x] == None:
                makeset(x)
            if p[y] == None:
                makeset(y)
            union(x,y)
        else:
            if p[x] == None:
                makeset(x)
            if p[y] == None:
                makeset(y)
            if findset(x) == findset(y):
                answer.append(1)
            else:
                answer.append(0)
for i in range(len(answer)):
    print(answer[i])        


Measured memory_bytes: 6972
/*
 * main.cpp
 *
 *  Created on: 2011/04/08
 *      Author: satoki
 *      13:05 ~ 6:03
 */
#include <iostream>
#include <string.h>
using namespace std;

int iW;
int iN;
int iA;
int iB;

int iX[31];

void init() {
}

bool input() {
  int i, tmp;
  if (scanf("%d", &iW) == EOF) return false;
  for (i = 0; i <= iW; i++) {
    iX[i] = i;
  }
  scanf("%d", &iN);
  for (i = 0; i < iN; i++) {
    scanf("%d,%d", &iA, &iB);
    tmp = iX[iA];
    iX[iA] = iX[iB];
    iX[iB] = tmp;
  }
  return true;
}

void manage() {
}

int main() {
  int i;
  init();
    input();
    manage();
    for (i = 1; i <= iW; i++) {
      printf("%d\n", iX[i]);
    }
  return 0;
}

Measured memory_bytes: 0
N, K = map(int, input().split())
if K % 2:
    cnt = 0
    for i in range(1, N + 1):
        if i % K == 0:
            cnt += 1
    print(cnt ** 3)
else:
    cnt = [0, 0]
    for i in range(1, N + 1):
        if i % (K // 2) == 0:
            cnt[(i // (K // 2)) % 2] += 1
    print(cnt[0] ** 3 + cnt[1] ** 3)

Measured memory_bytes: 3064
import std.stdio, std.string, std.array, std.conv;

void main() {
    int[] tmp = readln.chomp.split.to!(int[]);
    int a = tmp[0], b = tmp[1], c = tmp[2];
    int cnt = 0;
    foreach (i; a .. b+1) {
        if (c % i == 0) ++cnt;
    }
    cnt.writeln;
}


Measured memory_bytes: 2496
from collections import Counter
def comb(n):
    return n*(n-1)//2
def main():
    n = int(input())
    A = list(map(int,input().split()))
    C = Counter(A)
    mx = sum(comb(b) for b in C.values())
    for a in A:
        print(mx-C[a]+1)
main()

Measured memory_bytes: 26772
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n;
main()
{
	while(cin>>n,n)
	{
		long sum=0;
		for(int i=0;i<n;i++)
		{
			int a;cin>>a;sum+=a;
		}
		vector<int>a(n-1);
		for(int i=0;i<n-1;i++)
		{
			cin>>a[i];
			sum+=a[i];
		}
		sort(a.begin(),a.end());
		long ans=sum;
		for(int i=0;i<n-1;i++)
		{
			sum-=a[i];
			ans=max(ans,sum*(i+2));
		}
		cout<<ans<<endl;
	}
}



Measured memory_bytes: 3268
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

get_numbers(0, []).
get_numbers(N, [X|Xs]) :- 
    get_number(X), 
    N2 is N - 1, 
    get_numbers(N2, Xs).

put_numbers([]).
put_numbers([X|Xs]) :-
    writeln(X),
    put_numbers(Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    length(S, L),
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==

    between(L,U,X): L <= X <= U
    nth0(I, Xs, Y), nth1(I, Xs, Y): (Xs,Y) -> I, (I, Xs) -> Y 

    sort(Key, Order, List, Sorted): Keyは通常0?, Orderは=なしが重複削除，=は重複保持
    \+ P(X) : not P(X)

    sum_list(Xs, Sum)
*/

take(0, _, []) :- !.
take(N, [X|Xs], [Y|Ys]) :- Y = X, N2 is N - 1, take(N2, Xs, Ys).

main :-
    get_chars(S),
    length(S, SL),
    reverse(S, SR),
    N2 is SL div 2,
    take(N2, S, T),
    reverse(T, TR),
    (S = SR, T = TR) -> writeln("Yes") ; writeln("No").

    % statistics(inferences, IC), writeln(IC).


Measured memory_bytes: 8100
#include<stdio.h>
int n,A[50];
int solve(int i,int m){
    int res;
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    res = solve(i+1,m)||solve(i+1,m-A[i]);
    return res;
}
int main(){
    int q,M,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&M);
        if(solve(0,M)){
            printf("yes\n");
        }
        else{
            printf("no\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2052
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let h: usize = read();
    let w: usize = read();
    let mut map: Vec<Vec<i64>> = vec![vec![0; w]; h];
    let mut cnt = 0;
    let mut ans: Vec<(usize, usize, usize, usize)> = vec![];

    for i in 0..h {
        for j in 0..w {
            map[i][j] = read();
        }
    }

    for i in 0..h {
        let mut iter: Vec<usize> = (0..w).collect();
        if i % 2 != 0 {
            iter.reverse()
        }

        if i == h - 1 {
            iter.remove(w - 1);
        }

        for j in iter {
            if map[i][j] % 2 == 0 {
                continue;
            } else {
                let next = next_idx(i, j, h, w);
                cnt += 1;
                ans.push((i, j, next.0, next.1));
                map[i][j] -= 1;
                map[next.0][next.1] += 1;
            }
        }
    }
    println!("{}", cnt);
    for i in 0..ans.len() {
        println!(
            "{} {} {} {}",
            ans[i].0 + 1,
            ans[i].1 + 1,
            ans[i].2 + 1,
            ans[i].3 + 1
        );
    }
}

fn next_idx(i: usize, j: usize, h: usize, w: usize) -> (usize, usize) {
    let mut next = (i, j);

    if i % 2 == 0 {
        if j == w - 1 {
            next = (next.0 + 1, next.1)
        } else {
            next = (next.0, next.1 + 1)
        }
    } else {
        if j == 0 {
            next = (next.0 + 1, next.1);
        } else {
            next = (next.0, next.1 - 1);
        }
    }

    next
}


Measured memory_bytes: 13200
#include<iostream>
#include<vector>
#include<queue>
#include<string.h>
#include<algorithm>
#include<stack>
#include<set>

using namespace std;

typedef pair<int,int>P;

int DYX[4][2]{{-1,0},{1,0},{0,-1},{0,1}};

int H,W;
string graph[50];
int seen[50][50];

void bfs();

int main(){
  cin>>H>>W;
  int n_obs=0;
  for (int h = 0; h < H; h++) {
    cin>>graph[h];
    for (int w = 0; w < W; w++) {
      if(graph[h][w]=='#')n_obs++;
      seen[h][w]=-1;
    }
  }
  bfs();
  if(seen[H-1][W-1]==-1){
    cout<<"-1"<<"\n";
    return 0;
  }
  int ans =H*W-n_obs-seen[H-1][W-1];
  cout<<ans-1<<"\n";

}
void bfs(){
  queue<P> que;
  que.push(P(0,0));
  seen[0][0]=0;

  while(que.size()){
    P next=que.front();que.pop();
    int y=next.first,x=next.second;
    if(y==H-1&&x==W-1)return;
    for(auto dyx :DYX) {
      int ny=y+dyx[0],nx=x+dyx[1];
      if(0<=ny&&ny<H&&0<=nx&&nx<W&&graph[ny][nx]!='#'&&seen[ny][nx]==-1){
        seen[ny][nx]=seen[y][x]+1;
        que.push(P(ny,nx));
      }
    }
  }
}

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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

int main() {

	IOS

	string s, t;
	cin >> s >> t;

	cout << ((t.size() - s.size() == 1 && s == t.substr(0, t.size()-1)) ? "Yes" : "No") << endl;
	return 0;
}

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


int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    
    int n;
    int result = 0;
  
    
    cin >> n;
    if (n%1000 == 0 ) result = 0;
   else  result = (1000 - (n % 1000));
    cout << result;
    return 0;
}

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

long xors(long b, long base) {
    if (b < base)
        return 0;
    long base2 = base << 1;
    return (xors(b, base2) << 1) | (b / base) & ((b + 1) & 1);
}

int main() {
    long a, b;
    cin >> a >> b;

    cout << ((xors(b, 2) << 1) ^ (((b + 1) >> 1) & 1) ^ (xors(a - 1, 2) << 1) ^ ((a >> 1) & 1)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(tuple<ll,ll,ll> a, tuple<ll,ll,ll> b) {
    if(get<1>(a) != get<1>(b)){
        return get<1>(a) < get<1>(b);
        
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};

int main() {
    ll N;
    cin >>N;
    vector<tuple<ll,ll,ll>>xyi(N);
    vector<tuple<ll,ll,ll>>eg;
    rep(i,N){
        ll x,y;
        cin>>x>>y;
        //x--;y--;
        xyi[i]=make_tuple(x,y,i);
    }
    sort(all(xyi));

    rep(i,N-1){
        ll c=abs(get<0>(xyi[i])-get<0>(xyi[i+1]));
        eg.pb(make_tuple(c,get<2>(xyi[i]),get<2>(xyi[i+1])));
    }
    sort(all(xyi),compare);
    rep(i,N-1){
        ll c=abs(get<1>(xyi[i])-get<1>(xyi[i+1]));
        eg.pb(make_tuple(c,get<2>(xyi[i]),get<2>(xyi[i+1])));
    }
    sort(all(eg));
    UnionFind tree(N);
    ll ans=0;
    rep(i,eg.size()){
        if(!tree.same(get<1>(eg[i]), get<2>(eg[i]))){
            tree.unite(get<1>(eg[i]), get<2>(eg[i]));
            ans+=get<0>(eg[i]);
        }
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 11928
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    vll a(N + 1, 0), b(M + 1, 0);
    rep2(i, 1, N + 1){
        cin >> a[i];
    }
    rep2(i, 1, M + 1){
        cin >> b[i];
    }
    ll ans = 0, total = accumulate(all(a), 0LL);
    ll j = 0;
    for(int i = N; i >= 0; i--){
        if (total > K){
            total -= a[i];
            continue;
        }
        while (j <= M && total + b[j] <= K){
            total += b[j];
            j++;
        }
        ans = max(ans, i + j - 1);
        total -= a[i];
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  cin>>N;
  vector<int> x(N);
  for(int i=0; i<N; i++){
    cin>>x.at(i);
  }
  sort(x.begin(),x.end());
  int ans=100000000;
  int y;
  for(int i=1; i<101; i++){
    int sum=0;
    for(int j=0; j<N; j++){
      y=x.at(j)-i;
      sum=sum+y*y;
    }
    if(sum<ans) ans=sum;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

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

int main(){
	string str;
	cin >> str;
	if(str[len(str) - 1] != 's')
		str.pb('s');
	else
		str += "es";
	cout << str << endl;
	
	return 0;
}


Measured memory_bytes: 3628