akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pii, int > a, pair < pii, int > b)//true for a before b
{
	if(a.F.F/300 < b.F.F/300)
		return 1;
	if(a.F.F/300 > b.F.F/300)
		return 0;
	if(a.F.S < b.F.S)
		return 1;
	if(a.F.S > b.F.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (2e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 2*550;
const int SQRT = BUCK+9;

ll a[N], sum[N];
map < ll, ll > cnt;

void solve()
{
	int n, i;
	ll ans = 0;
	cin >> n;
	cnt[sum[0]]++;
	fo(i,1,n+1)
	{
		cin >> a[i];
		sum[i] = sum[i-1] + a[i];
		cnt[sum[i]]++;
	}
	for(auto x : cnt)
		ans += ((x.S*(x.S-1LL))/2LL);
	cout << ans << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(v) (v).begin(),(v).end()

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int main()
{
    while(1){
        int n;
        vector<int> vec;
        cin >> n;
        rep(i,n){
            vec.push_back(n-i);
        }
        int r;
        cin >> r;
        if(n == 0){
            break;
        }
        rep(i,r){
            int a,b;
            cin >> a >> b;
            vector<int> up;
            vector<int> bf;
            for(int i = a-1;i<a+b-1;i++){
                up.push_back(vec[i]);
            }
            rep(i,up.size()){
                bf.push_back(up[i]);
            }
            rep(i,a-1){
                bf.push_back(vec[i]);
            }
            for(int i = a+b-1;i < n;i++){
                bf.push_back(vec[i]);
            }
            vec.clear();
            vec = bf;
        }
        cout << vec[0] << "\n";
    }
	return 0;
}

Measured memory_bytes: 3088
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, string).chars().collect::<vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, string).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("parse error")
    };
}
 
fn main() {
    input!{
        a: i64,
        b: i64
    }
    let answer = if a == 0 {
        0
    } else if a % b == 0 {
        0
    } else if b % a == 0 {
        a
    } else {
        let c = a % b;
        cmp::min(c, i64::abs(c - b))
    };
    println!("{}", answer);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
using namespace std;
int main(){
	int n,l,num=1e9,ans=0;
	cin>>n>>l;
	for (int i=1;i<=n;i++){
		int x=l+i-1;
		ans+=x;
		if (abs(x)<abs(num)) num=x;
	}
	cout<<ans-num;
}

Measured memory_bytes: 256
// Hack it and have it ;) //
/*author* Priyanshu Shrivastav (from IIT Palakkad) *
 * *_ __ ___  _ ______ ___  _ ____   ___  ___| |_  *
 * | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
 * | | | | | | | | (_| (_) | | | \ V /| | (__| |_  *
 * |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
When I wrote this, only God and I understood what I was doing
 ** * * * * * * * Now, only God knows * * * * * * */
#include      <bits/stdc++.h>
#include      <ext/pb_ds/assoc_container.hpp>
#include      <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC   optimize ("Ofast")
#pragma GCC   optimize ("unroll-loops")
#pragma GCC   target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define IOS   ios_base::sync_with_stdio(false); cin.tie (nullptr)
#define PREC  cout.precision (10); cout << fixed
#define x     first
#define y     second
#define bg(x) " [ " << #x << " : " << (x) << " ] "
#define un(x) sort(x.begin(), x.end()), \
              x.erase(unique(x.begin(), x.end()), x.end())
using   ll  = long long;
using   ull = unsigned long long;
using   ff  = long double;
using   pii = pair<int,int>;
using   pil = pair<int,ll>;
typedef tree
< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;

struct chash {
   int operator()(pii x) const { return x.x*31 + x.y; }
};
gp_hash_table <pii, int, chash> mp;

seed_seq seq{
   (uint64_t) chrono::duration_cast<chrono::nanoseconds>
      (chrono::high_resolution_clock::now().time_since_epoch()).count(),
      (uint64_t) __builtin_ia32_rdtsc(),
      (uint64_t) (uintptr_t) make_unique<char>().get()
};
mt19937 rng(seq); //uniform_int_distribution<int> (l, h)(rng); //[low, high]

#define debug(args...) { \
   /* WARNING : do NOT compile this debug func calls with following flags: // \
    * // -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2*/ \
   string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');\
   stringstream _ss(_s); \
   istream_iterator<string> _it(_ss); err(_it, args); \
}
void err(istream_iterator<string> it) {
   it->empty(); cerr << " (Line : " << __LINE__ << ")" << '\n';
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
   cerr << fixed << setprecision(15)
      << " [ " <<  *it << " : " << a  << " ] "<< ' ';
   err(++it, args...);
}
/*****************************************************************************/

ll gcd (ll a, ll b) {
   if (a < b) swap(a, b);
   if (b == 0) return a;
   else return gcd(b, a % b);
}

signed main() {
   IOS; PREC;
   ll a, b, c, d;
   cin >> a >> b >> c >> d;
   ll lc = (c * d )/ gcd(c, d);
   cout << (b - a + 1)  - (b/c - (a - 1)/c + b/d - (a - 1)/d - ((b/lc) - (a - 1)/lc)) << '\n';

   return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	bool g = false;
	for (int i = 0; i < s.length(); i++) {
		bool f = true;
		for (int j = 0; j < s.length() - i; j++) {
			if (s[i + j] != t[j]) {
				f = false;
				break;
			}
		}
		if (f) {
			g = true;
			cout << s.length() * 2 - (s.length() - i) << endl;
			break;
		}
	}
	if (g == false) {
		cout << s.length() * 2 << endl;
	}
	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
		ll N,A,B;
	cin >> N>>A>>B;
	vecl(H);
	fx(N) {
		vecpl(H);
	}
	A -= B;
	ll left = 0, right = 2000000000;
	ll mid;
	while(right-left>1) {
		mid = (left + right ) / 2;
		ll k = mid;
		fy(N) {
			if (H[y] >mid*B) {
				//ll tmp = (H[y] - mid * B);
				//k -= (tmp + A - 1) / A;
				if ((H[y]-mid*B)%A==0) {
					k -= (H[y] - mid * B) / A;
				}
				else {
					k -= (H[y] - mid * B) / A + 1;
				}
			}
		}

		if (k >= 0) {
			right = mid;
		}
		else {
			left = mid;
		}
	}
	//doublece(left,right)
	ce(right)
	

    return 0;
}



Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  vector<int> a(3);
  rep(i,3) cin >> a[i];
  sort(all(a));
  cout << a[2]-a[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i,n) cin >> a[i];
    ll t=0;
    rep(i,m) {
        cin >> b[i];
        t+=b[i];
    }
    int j=m,ans=0;
    rep(i,n+1) {
        while(j>0&&t>k) {
            --j;
            t-=b[j];
        }
        if(t>k) break;
        ans=max(ans,i+j);
        if(i==n) break;
        t+=a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6084
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        x: usize,
        t: usize,
    }
    let ans = (n + x - 1) / x * t;
    println!("{}", ans);
}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define all(x) (x).begin(), (x).end()
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 998244353; //1e9+7;
const int MAXN = 1e7+1;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N,X,Y; cin >> N >> X >> Y;
    X--;Y--;

    vector<int> ans(N+1);
    fori(i,N) {
        fore(j,i+1,N-1) {
            int d;
            if(i <= X) {
                if(j >= Y) {
                    d = j-i-(Y-X)+1;
                } else if(j <= X) {
                    d = j-i;
                } else {
                    d = X-i + min(j-X,Y-j+1);
                }
            } else if(i <= Y){
                if(j >= Y) {
                    d = j-Y + min(i-X+1,Y-i);
                } else {
                    d = min(j-i, i-X+Y-j+1);
                } 
            } else {
                d = j-i;
            }
            ans[d]++;
            //debug(i+1);
            //debug(j+1);
            //debug(d);
            //cout << endl;
        }
    }

    fore(d,1,N-1) cout << ans[d] << '\n';
    return 0;
}


Measured memory_bytes: 256
x,y=map(int,input().split())

ans=0
if x==1:
    ans+=300000
elif x==2:
    ans+=200000
elif x==3:
    ans+=100000

if y==1:
    ans+=300000
elif y==2:
    ans+=200000
elif y==3:
    ans+=100000

if x==1 and y==1:
    ans+=400000
print(ans)

Measured memory_bytes: 38384
import collections
N, M = list(map(int, input().split(' ')))
A  = list(map(int, input().split(' ')))
dic = dict(collections.Counter(A))
for _ in range(M):
    B, C = list(map(int, input().split(' ')))
    if C in dic.keys():
        dic[C] += B
    else:
        dic[C] = B
l = 0
su = 0
for key in reversed(sorted(dic.keys())):
    l += dic[key]
    if l < N:
        su += key*dic[key]
    else:
        su += key*(dic[key]+(N-l))
        break
print(su) 

Measured memory_bytes: 32440
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int N, T;
    cin >> N >> T;
    int c[N], t[N];
    REP(i, N) cin >> c[i] >> t[i];

    int m = 10000;
    REP(i, N) {
        if (t[i] <= T) m = min(m, c[i]);
    }
    if (m > 1000) cout << "TLE" << endl;
    else cout << m << endl;
    return 0;
}


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

#define panic {std::cout << "NO\n"; return 0;}

std::vector<std::vector<int>> adjlist;
std::vector<int> a;

int64_t dfs(int node, int parent) {
	int64_t nTail = 0, maxTail = 0;
	if (adjlist[node].size() == 1) return a[node];
	for (int child : adjlist[node]) {
		if (parent != child) {
			int64_t tmp = dfs(child, node);
			nTail += tmp; maxTail = std::max(maxTail, tmp);
		}
	}

	if (nTail < a[node]) throw 0;
	int64_t t1 = a[node] * 2 - nTail;
	if (t1 < 0 ||
//		2 * maxTail - nTail > t1
		maxTail > a[node]
	) throw 0;
//	std::cerr << node+1 << " -> " << t1 << '\n';
	return t1;
}

int main() {
	int n; std::cin >> n;
	a.resize(n);
	for (int& x : a) std::cin >> x;

	if (n == 2) {
		std::cout << (a[0] == a[1] ? "YES\n" : "NO\n");
		return 0;
	}

	adjlist.assign(n, {});
	for (int i = 1; i < n; ++i) {
		int u, v;
		std::cin >> u >> v;
		--u; --v;
		adjlist[u].push_back(v);
		adjlist[v].push_back(u);
	}

	try {
		int root = 0;
		while (adjlist[root].size() == 1) ++root; // ensure that root is not a leaf
		if (dfs(root, -1) != 0) throw 0;
		std::cout << "YES\n";
	} catch (int) {
		std::cout << "NO\n";
	}
}


Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
	int a,b;
	map <int,int> mp;
	mp[1]=1;
	mp[2]=3;
	mp[3]=1;
	mp[4]=2;
	mp[5]=1;
	mp[6]=2;
	mp[7]=1;
	mp[8]=1;
	mp[9]=2;
	mp[10]=1;
	mp[11]=2;
	mp[12]=1;
	cin>>a>>b;
	if (mp[a]==mp[b])
	{
		cout<<"Yes\n";
		return 0;
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#define Max 2*100002
using namespace std;




int main(){
	
	int k,x,i;
	scanf("%d%d",&k,&x);

	int start = (x-k)+1;
	int end = (x+k)-1;

	for(i=start;i<=end;i++)
		printf("%d ",i);
	printf("\n");	

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,a,b,ans=0;
	cin>>n>>a>>b;
	if(a==0){
		cout<<'0'; return 0;
	}
	ans+=n/(a+b)*a;
	if(n%(a+b)>a) ans+=a;
	else ans+=n%(a+b);
	cout<<ans;
	return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PII pair<int,int>
#define f first
#define s second
#define VI vector<int>
#define LL long long
#define MP make_pair
#define LD long double
#define PB push_back
#define ALL(V) V.begin(),V.end()
#define abs(x) max((x),-(x))
#define PDD pair<LD,LD> 
#define VPII vector< PII > 
#define siz(V) ((int)V.size())
#define FOR(x, b, e)  for(int x=b;x<=(e);x++)
#define FORD(x, b, e) for(int x=b;x>=(e);x--)
#define REP(x, n)     for(int x=0;x<(n);x++)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
using namespace std;
LD in[2][6];

LD calc(LD zer)
  {
  LD res = 0;
  REP(i, 6)
    {
    if(in[0][i] * zer > in[1][i] * (1-zer))
      {
      res += in[0][i] / 100.0 * zer;
      }
    else
      {
      res += in[1][i] / 100.0 * (1-zer);
      }
    }
  return 1 - res;
  }
int main()
{
REP(j, 2)
    {
    REP(i, 6)
      {
      scanf("%Lf", &in[j][i]);
      }
    }

LD poc = 0;
LD kon = 1;
LD sr1, sr2;
REP(i, 1000)
  {
  sr1 = poc + (kon - poc) * 1/3;
  sr2 = poc + (kon - poc) * 2/3;
  if(calc(sr1) < calc(sr2))
    {
    poc = sr1;
    }
  else
    {
    kon = sr2;
    }
  }
//cerr<<sr1<<endl;
printf("%.10Lf\n", 1 - calc(sr1));
}

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


int main() {
	int N;
	char S[10001];
	char S2[10001];
	char ch[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
	cin >> N;
	cin >> S;
	for (int i = 0; S[i] != '\0'; i++) {
		for (int j = 0; j <= 25; j++) {
			if (S[i] != ch[j])
				continue;
			S2[i] = ch[j + N];
		}
	}
	for (int j = 0; S[j] != '\0'; j++) {
		cout << S2[j];
	}
	return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   

  const ll M = MOD;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

// mod. m での a の逆元 a^{-1} を計算する
// 逆元をかければ割ったことになる
ll modinv(ll a) {
    ll b = MOD, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}



int main(){
  ll i,j;
  ll n,m,k; cin>>n>>m>>k;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  ll buf2 = 0;
  ll buf3 = 0;
  bool judge = true;
  //cout<<<<endl;
  ll a[n][m];
  a[0][0]=0;
  for(i=1;i<n;i++)a[i][0]=a[i-1][0]+i;
  for(j=1;j<m;j++)a[0][j]=a[0][j-1]+j;
  for(i=1;i<n;i++){
    for(j=1;j<m;j++){
      a[i][j]=a[i][j-1]+a[i][0]+(i+1)*(j);
      //cout<<i spa j spa a[i-1][j] spa a[i][j-1] spa a[i][j]<<endl;
      a[i][j]%=MOD;
      //cout<<a[i][j]<<endl;
    }
  }
//for(i=0;i<n;i++)for(j=0;j<m;j++)cout<<a[i][j]<<endl;

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      result+=a[i][j]+a[n-i-1][m-j-1]
      +a[n-i-1][j]+a[i][m-j-1]-
      a[0][j]-a[0][m-j-1]-a[n-i-1][0]-a[i][0];
      result%=MOD;
      //cout<<a[i][j]<<endl;
    }
  }
  result%=MOD;
  result*=modinv(2);
  result%=MOD;
  //cout<<result<<endl;
  fac[0] = 1;
    ifac[0] = 1;
    for(i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
  ll q=0;
  q = comb(n*m-2, k-2)%M;
  result*=q;
  result%=MOD;
  //cout<<q<<endl;
  cout<<result<<endl;
  return 0;
}

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

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define ll long long
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 2e5+10;
const int inf = 1e9+7;

ll a, b;

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


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

int main() {
	int k, s, x, y, z,ans=0;
	cin >> k >> s;
	for (x = 0; x <= k; x++) {
		for (y = 0; y <= k; y++) {
			z = s - x - y;
			if (z<0 || z>k) {
				continue;
			}
			ans++;
		}
	}
	cout << ans << endl;
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

int main() {
  ll n;
  cin >> n;
  vector<ll> d(n);
  rep(i, n) cin >> d[i];
  sort(d.begin(), d.end());
  if (n % 2 == 0) cout << d[n/2] - d[n/2 - 1] << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

int main(){
    string s;
    ll k;
    bool flag = false;
    cin >> s >> k;
    rep(i,0,s.size()){
        if(s[0] != s[i]) break;
        else if(i == s.size()-1){
            cout << (s.size()*k)/2 << endl;
            return 0;
        }
    }

    ll temp = 0,cnt = 0,memo = 0;
    rep(i,0,s.size()-1){
        if(s[i] != s[i+1]){
            if(!flag){
                flag = true;
                memo = temp+1;
            }
            cnt += (temp+1)/2;
            temp = 0;
        }
        else{
            temp++;
        }
    }

    if(s[0] == s[s.size()-1]){
        cout << (cnt - memo/2)*k + memo/2 + (temp+1)/2 + (memo + temp + 1)/2*(k-1) << endl;
    }
    else{
        cout << (cnt+(temp+1)/2)*k << endl;
    }


}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, l;
    cin >> n >> l;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    for (int i = 1; i < n; ++i) {
        if(v[i-1] + v[i] >= l){
            puts("Possible");
            for (int j = 1; j < i; ++j) {
                printf("%d\n", j);
            }
            for (int j = n-1; j > i; --j) {
                printf("%d\n", j);
            }
            printf("%d\n", i);
            return 0;
        }
    }
    puts("Impossible");
    return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>

int pow_n(int a,int b)
{
	int n=1;

	for(int i;i<b;i++)
	{
		n*=a;
	}

	return n;
}

int main()
{
	int d,n,p;

	scanf("%d %d",&d,&n);

	if(n!=100)printf("%d\n",pow_n(100,d)*n);
	else if(d==0) printf("%d\n",pow_n(100,d)*n+1);
	else if(d==1) printf("%d\n",pow_n(100,d)*n+100);
	else if(d==2) printf("%d\n",pow_n(100,d)*n+10000);

	return 0;
}

Measured memory_bytes: 128
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)

// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll N, K;
	cin >> N >> K;
 
	// 解法
	if (K%2==0){
		ll amari0 = N/K;
		ll amari1 = (N + K/2)/K;
		ll ans = pow(amari0, 3) + pow(amari1, 3);
		printf("%lld\n", ans);
		// cout << pow(amari0, 3) + pow(amari1, 3) << endl;
	}
	else{
		ll amari0 = N/K;
		ll ans = amari0*amari0*amari0;
		printf("%lld\n", amari0*amari0*amari0);
		// cout << pow(amari0, 3) << endl;
	}
}
 


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

class Dice {
public:
  int face[7];

  void roll(char direction) {
    int w;
    if (direction == 'E') {
      w = face[1]; face[1] = face[4]; face[4] = face[6]; face[6] = face[3]; face[3] = w;
    } else if (direction == 'W') {
      w = face[1]; face[1] = face[3]; face[3] = face[6]; face[6] = face[4]; face[4] = w;
    } else if (direction == 'S') {
      w = face[1]; face[1] = face[5]; face[5] = face[6]; face[6] = face[2]; face[2] = w;
    } else {
      w = face[1]; face[1] = face[2]; face[2] = face[6]; face[6] = face[5]; face[5] = w;
    }
  }
};

int main() {
  Dice dice;
  for (int i = 1; i <= 6; i++) cin >> dice.face[i];
  
  string command;
  cin >> command;

  for (int i = 0; i < command.size(); i++) {
    dice.roll(command[i]);
  }

  cout << dice.face[1] << endl;
  
  return 0;
}


Measured memory_bytes: 3204
n, k = map(int, input().split())

num_mod0 = n // k
num_modk2 = (n + k//2) // k

if k % 2 == 0:
  total = num_mod0**3 + num_modk2 ** 3
else:
  total = num_mod0**3
print(total)

'''
Pairs_mod = []
for moda in range(0, k // 2 + 1):
  modb = (k - moda) % k
  for modc in range(k):
    #print(moda, modb, modc)
    if (modc + moda) % k == 0 and (modc + modb) % k == 0:
      Pairs_mod.append([moda, modb, modc])
print(Pairs_mod)
'''

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

long long int INF = 1e18 + 8;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, w; cin >> n >> w;
	long long int total_val = 0;
	vector <pair<long long int,long long int>> items(n); //weight, value
	for (int i = 0; i < n; ++i){
	       	cin >> items[i].first >> items[i].second;	
		total_val += items[i].second;
	}
	vector <long long int> dp(total_val+1, INF);
	dp[0] = 0;
	for (int i = 0; i < n; ++i){
		for (int j = total_val; j >= 0; --j){
			if (j - items[i].second >= 0) dp[j] = min(dp[j], dp[j - items[i].second] + items[i].first);
		}
	}
	long long int ans = -1;
	for (long long int i = total_val; i >= 0; --i){
		if (dp[i] <= w) ans = max(ans, i);
	}
	cout << ans << "\n";	
	return 0;
}


Measured memory_bytes: 4000
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(_e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box<dyn Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let a_b: Vec<i64> = input
        .trim()
        .split_whitespace()
        .map(|s| s.replace(".", "").parse::<i64>().unwrap())
        .collect();
    println!("{:?}", (a_b[0] * a_b[1]) / 100);
    Ok(())
}


Measured memory_bytes: 2144
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


using P = pair<double, double>;

const double eps=1e-7;
const double pi=acos(-1);
double add(double a,double b){
    return a+b;
}

typedef pair<double,double> P;
P operator+(const P& x,const P& y){
    return {add(x.first,y.first),add(x.second,y.second)};
}

P operator-(const P& x,const P& y){
    return {add(x.first,-y.first),add(x.second,-y.second)};

}

void reflect(P& p, P s, P t){
    p = p - s ;
    t = t - s ;
    double a=p.first, b=p.second, x=t.first, y=t.second;
    P ret ={((x*x-y*y)*a+2*x*y*b)/(x*x+y*y), (-(x*x-y*y)*b+2*x*y*a)/(x*x+y*y)};
    p = ret + s;
}

P a[10];

bool check(vector<int> &ord, P s){
    vector<pair<P, P> >  v;
    for(auto i : ord){
        reflect(s, a[i], a[i+1]);
        for(auto& p : v){
            reflect(p.first, a[i], a[i+1]);
            reflect(p.second, a[i], a[i+1]);
        }
        v.emplace_back(a[i],a[i+1]);
    }
    vector<pair<double,double> > ang;
    for(auto p : v){
        p.first = p.first - s;
        p.second = p.second - s;
        complex<double> x(p.first.first, p.first.second);
        complex<double> y(p.second.first, p.second.second);
        double ret1=arg(x), ret2=arg(y);
        if(abs(ret1-ret2)<pi){
            if(ret2<ret1)swap(ret2,ret1);
        }
        else {
            if(ret1>ret2)swap(ret2,ret1);
            ret1+=2*pi;
            swap(ret1,ret2);
        }
        ang.emplace_back(ret1,ret2);
    }
    double l=ang[0].first, r=ang[0].second;
    for(auto p : ang){
        double L = p.first, R = p.second;
        if(l<0&&R>pi){
            R-=2*pi;
            if(L>pi){
                L-=2*pi;
                r=min(R, r);
                l = max(L, l);
            }
            else {
                if(l<R)r=min(r,R);
                else l=max(l,L);
            }
        }
        else if(r>pi&&L<0){
            L+=2*pi;
            if(R<0){R+=2*pi;
                l = max(L, l);
                r = min(R, r);
            }
            else {
                if(L<r)l=max(l,L);
                else r=min(r,R);
            }
        }
        else {
            l=max(l,L);
            r=min(r,R);
        }
    }
    return r-l > eps;
}
void solve(int n){
    P s;
    cin>>s.first>>s.second;
    rep(i,n){
        cin>>a[i].first>>a[i].second;
    }
    a[n]=a[0];
    vector<int> ord(n);
    iota(ord.begin(),ord.end(),0);
    int ans=0;
    do{
        ans+=check(ord, s);
    }while(next_permutation(ord.begin(), ord.end()));
    cout<<ans<<endl;
}

int main(){
    int n;
    while(cin>>n,n!=0){
        solve(n);
    }
}


Measured memory_bytes: 3424
#include <iostream>
#include <algorithm>
#include <functional>
#include <cmath>
using namespace std;

int main(void){
    long long int X,K,D;
    cin>>X>>K>>D;
  		
  	int logX = log10(X);
  	int logK = log10(K);
  	int logD = log10(D);
  	
  	long long int answer = 0;
  
  	if(logD+logK<15){
	  	if(abs(X)>abs(D*K)){
  	        answer = abs(X) - abs(D*K);
        	cout<< answer<<endl;
          	return 0;
        }
    }
  	
  	long long int n = X/D;
  	long long int min = X%D;
  	
  	
  	if( (K-n)%2 == 0){
      	answer = abs(min);
    }else{
      	answer = abs(D)-abs(min);
    }
  	
  	cout<<answer<<endl;
  	return 0;
}

Measured memory_bytes: 3936
#include <bits/stdc++.h>
#define N 301
using namespace std;
typedef complex <double> P;
const double EPS = 1e-8;
P p[N];
int n;

int cnt(P c){
  int res=0;
  for(int i=0;i<n;i++)
    if(1-abs(c-p[i])>-EPS) res++;
  return res;
}

P get_C(P a,P b){
  double x=abs(b-a);
  if(x>2||a==b) return a;
  P c=P(x/2,sqrt(1-x*x/4))*(b-a)/abs(b-a)+a;

  return c;  
}


int main(){
  while(1){
  cin>>n;
  if(!n)break;
  double a,b;
  for(int i=0;i<n;i++)cin>>a>>b,p[i]=P(a,b);
  
  int ans=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      P c=get_C(p[i],p[j]);
      ans=max(ans,cnt(c));
    }
  cout <<ans<<endl;  
  }
  return 0;
}

Measured memory_bytes: 3160
while True:
  w = int(input())
  if w == -1:
    break
  
  if w <= 10:
    price = 1150
  elif 10 < w <= 20:
    price = 1150 + (w - 10) * 125
  elif 20 < w <= 30:
    price = 2400 + (w - 20) * 140
  else:
    price = 3800 + (w - 30) * 160
    
  print(4280 - price)


Measured memory_bytes: 5584
/* Copyright 2016 AcrossTheSky */
#include <iostream>
#include <cstdio>
#include <utility>
#include <cassert>
#include <map>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <sstream>
#include <fstream>
#include <string>
#include <cmath>
#include <algorithm>
#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define PER(i, a, b) for (int i = (a); i >= (b); --i)
#define RVC(i, c) fot (int i = 0; i < (c).size(); ++i)
#define RED(k, u) for (int k = head[(u)]; k; k = edge[k].next)
#define SQR(k) (k) * (k)
#define lowbit(x) ((x) & (-(x)))
#define CL(x, v) memset(x, v, sizeof x)
#define MP std::make_pair
#define PB push_back
#define FR first
#define SC second
#define rank rankk
#define next nextt
#define link linkk
#define index indexx
#define abs(x) ((x) > 0 ? (x) : (-(x)))
using namespace std;
typedef long long LL; typedef pair<int, int> PII;

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

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

template<class T> inline
void read(T *a) {
    char c;
    while (isspace(c = getchar())) {}
    bool flag = 0;
    if (c == '-') flag = 1, *a = 0;
    else
        *a = c - 48;
    while (isdigit(c = getchar())) *a = *a * 10 + c - 48;
    if (flag) *a = -*a;
}

const int mo = 1000000007;
template<class T>
T pow(T a, T b, int c = mo) {
    T res = 1;
    for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c) if (b & i) res = 1LL * res * a % c;
    return res;
}
/*======================= TEMPLATE =======================*/
const int N = 300000;
int n;
int a[N];
int mean(int a, int b, int c) {
    int x[3];
    x[0] = a, x[1] = b, x[2] = c;
    sort(x, x + 3);
    return x[1];
}
int b[N];
int check() {
    REP(i, 1, n) b[i] = a[i];
    REP(h, 1, n / 2)
    REP(i, 1, n) a[i] = mean(a[i], a[i + 1], a[i + 2]);
    int ans = a[1];
    REP(i, 1, n) a[i] = b[i];
    return ans;
}
bool vis[N];
queue<int> q;
int main() {
    int x;
    cin >> n >> x;
    n = 2 * n - 1;
    if (x == 1 || x == n) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    a[n / 2 + 1] = x;
    if (x > 2) {
        a[n / 2] = 1;
        a[n / 2 + 2] = x + 1;
        a[n / 2 + 3] = 2;
        vis[x] = vis[x + 1] = vis[1] = vis[2] = 1;
    }
    else {
        a[n / 2] = x + 1;
        a[n / 2 + 2] = 1;
        a[n / 2 + 3] = x + 2;
        vis[x] = vis[x + 1] = vis[1] = vis[x + 2] = 1;
    }
    REP(i, 1, n) if (!vis[i]) q.push(i);
    REP(i, 1, n) {
        if (a[i]) printf("%d\n", a[i]);
        else printf("%d\n", q.front()), q.pop();
    }
    return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>                
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 0; i <= (n); i++) 
#define repm(i,n) for(int i = (n)-1; i >= 0; i--)
int N;
int A[100005],B[100005];
long long  aoki, takahashi; 
vector< pair<int, int> > v;
int main(void){
	cin >> N;
	rep(i, N) cin >> A[i] >> B[i], v.push_back(make_pair(A[i]+B[i], i));
	sort(v.begin(), v.end());
	rep(i, N){
		if(i%2) aoki += B[v.back().se];
		else takahashi += A[v.back().se];
		v.pop_back();
	}
	cout << takahashi - aoki << endl;
}



Measured memory_bytes: 1912
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000
#define ll long long int

using namespace std;

int main(){
  string s; cin>>s;
  s += '+';
  set <char> OK; 
  OK.insert('A');OK.insert('T');OK.insert('C');OK.insert('G');
  int ans = 0;
  int streak = 0;
  for(int i=0;i<s.size();i++){
    if(OK.find(s[i]) != OK.end() ) {
      streak++;
    } else {
      ans = max(ans,streak);
      streak = 0;
    }

  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 256
#[allow(unused)]
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let (x, y): (usize, usize) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        let mut ws = s.split_whitespace();
        let a = ws.next().unwrap().parse().unwrap();
        let b = ws.next().unwrap().parse().unwrap();
        (a, b)
    };

    if x == 1 && y == 1 {
        println!("{}", shoukin(x) + shoukin(y) + 400000)
    } else {
        println!("{}", shoukin(x) + shoukin(y))
    }
}

fn shoukin(n: usize) -> usize {
    match n {
        1 => 300000,
        2 => 200000,
        3 => 100000,
        _ => 0,
    }
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

int N;
int A[200200];
int Asum[200200];

signed main() {
    cin >> N;
    int sum = 0;
    rep(i, N) {
        cin >> A[i];
        Asum[i + 1] = Asum[i] + A[i];
        sum += A[i];
    }
    int ans = INF;
    for (int i = 1; i <= N - 1; ++i) {
        //Asum[i],sum-Asum[i]
        ans = min(ans, abs(Asum[i] - (sum - Asum[i])));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
a, b = 2, 1
for i in range(n-1):
    a, b = b, a+b
print(b)













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

using int64 = long long;

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

    char march[5] = {'M', 'A', 'R', 'C', 'H'};
    int64 counter[5] = {};

    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;

        for (int j = 0; j < 5; j++) {
            if (S[0] == march[j]) counter[j]++;
        }
    }

    int64 ans = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                ans += counter[i] * counter[j] * counter[k];
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from itertools import combinations
n, k = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 10 ** 12
for p in combinations(range(n), k):
    p = list(p)[::-1]
    ma = 0
    res = 0
    for j in xrange(n):
        if p and j == p[-1]:
            if ma < a[j]:
                ma = a[j]
            else:
                res += ma + 1 - a[j]
                ma += 1
            p.pop()
        else:
            if ma < a[j]:
                ma = a[j]
    if ans > res:
        ans = res
print ans


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

int main() {
    vector<int> a{0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << a[k] << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h> 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const LL MOD=1e9+7;

const int MAX_N=1e5+1;
struct edge{int to,cost;};
vector<edge> G[MAX_N];
vector<PII> res;
bool flag[MAX_N];
int N;

void bfs(int pos,int color){
    if(flag[pos])return;
    flag[pos]=1;
    res.PB(MP(pos,color));
    for(auto a:G[pos]){
        if(a.cost%2==0){
            bfs(a.to,color);
        }else{
            bfs(a.to,(color+1)%2);
        }
    }
}

int main(){
    cin>>N;
    CLR(flag);
    res.clear();
    REP(i,N-1){
        int v1,v2,w;
        cin>>v1>>v2>>w;v1--;v2--;
        edge e1={v1,w};
        edge e2={v2,w};
        G[v1].PB(e2);
        G[v2].PB(e1);
    }
    bfs(0,0);
    SORT(res);
    REP(i,SZ(res)){
        cout<<res[i].second<<endl;
    }
    return 0;
}

Measured memory_bytes: 9848
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
int main() {
    ll N;
    cin >> N;
    ll time = 0;
    ll x    = 0;
    ll y    = 0;
    for (ll i = 0; i < N; ++i) {
        ll t, a, b;
        cin >> t >> a >> b;
        ll td   = t - time;
        ll diff = abs(a - x) + abs(b - y);
#ifdef SOURCE_TEST
        cout << "diff:" << diff << ",td:" << td << "\n";
#endif
        if (diff > td) {
            cout << "No"
                 << "\n";
            return 0;
        } else {
            ll d = diff - td;
#ifdef SOURCE_TEST
            cout << d << "\n";
#endif
            if ((d % 2) != 0) {
                cout << "No"
                     << "\n";
                return 0;
            }
        }
        time = t;
        x    = a;
        y    = b;
    }
    cout << "Yes"
         << "\n";

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
  int a,b;
  cin>>a>>b;
  cout<<(a*b%2==0 ? "Even":"Odd")<<endl;
}

Measured memory_bytes: 256