akhauriyash/Code-Regression huggingface dataset:
/*
	Author: zxy_hhhh
	date: 2019/11/28
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<iostream>
#define ll long long
inline ll rd() {
	ll _x=0;int _ch=getchar(),_f=1;
	for(;!isdigit(_ch)&&(_ch!='-')&&(_ch!=EOF);_ch=getchar());
	if (_ch=='-'){_f=0;_ch=getchar();}
	for(;isdigit(_ch);_ch=getchar()) _x=_x*10+_ch-'0';
	return _f?_x:-_x;
}
void write(ll _x){if (_x>=10) write(_x/10),putchar(_x%10+'0'); else putchar(_x+'0'); }
inline void wrt(ll _x,char _p){if (_x<0) putchar('-'),_x=-_x; write(_x); if (_p) putchar(_p);}
#define maxn 200005
int n,M,a[maxn],b[maxn];
int calc() {
	int res=0;
	bool tag=0;
	for(int i=1;i<=n;i++) {
		res=std::max(res,b[i]+b[n*2-i+1]);
		if (b[i]+b[n*2-i+1]<0)
			tag=1;
	}
	return tag?-1:res;
}
void move(int x) {
	int tot=0;
	for(int i=x;i<=2*n;i++) {
		b[++tot]=a[i]-M;
	}
	for(int i=1;i<x;i++) {
		b[++tot]=a[i];
	}
}
bool check(int L) {
	move(L);
	return calc()>=0;
}
int main() {
	n=rd();M=rd();
	for(int i=1;i<=2*n;i++) {
		a[i]=rd();
	}
	std::sort(a+1,a+1+n*2);
	int l=1,r=n*2+1,ans=-1;
	while(l<=r) {
		int mid=(l+r)>>1;
		if (check(mid)) r=mid-1,ans=mid;
		else l=mid+1;
	}
	move(ans);
	wrt(calc(),'\n');
}

Measured memory_bytes: 1920
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N,X = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for _ in range(N)]
for i in range(N):
    if X>A[i]:
        B[i] = X-A[i]
    else:
        B[i] = A[i]-X
D = B[0]
for i in range(1,N):
    D = gcd(D,B[i])
print(D)

Measured memory_bytes: 63128
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	ll a,b,c;
	while(~scanf("%lld%lld%lld",&a,&b,&c)){
		ll ans;
		if(c>=b){
			ans=b*2;
			c-=b;
		}else{
			ans=b+c;
			printf("%lld\n",ans);
			continue;
		}
		if(a>=c) ans+=c;
		else ans+=a+1;
		printf("%lld\n",ans);
	}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n; //合計射数
    int h; //的中回数
    
    while(true){
        cin >> n;
        if(n == 0) break;

        int c = 0; //合計的中数
        for(int i = 1; i <= n / 4; i++){
            cin >> h;
            c += h;
        }
        cout << c << endl;
    }
}


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

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

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n, a, b;
    cin >> n >> a >> b;

    if (a > b) {
        cout << 0 << endl;
        return;
    }

    if (n == 1 && a != b) {
        cout << 0 << endl;
        return;
    }

    cout << ((n - 1) * b + a) - ((n - 1) * a + b) + 1 << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    h: [i64; n],
  }
  let mut h = h;
  for i in (1 .. n).rev() {
    if h[i-1] - 1 == h[i] {
      h[i-1] -= 1;
    } else if h[i-1] - 1 > h[i] {
      puts!("No\n");
      return;
    }
  }

  puts!("Yes\n");
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const int INF = 2 * 1e9;
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector <int> c(n);
  vector <vector <int> > a(n, vector <int>(m));
  REP(i, n) {
	cin >> c[i];
	REP(j, m) {
	  cin >> a[i][j];
	}
  }
  int ans = INF;
  REP(s, 1 << n) {
	int cost = 0;
	vector <int> r(m, 0);
	REP(i, n) {
	  if (s & (1 << i)) {
		  cost += c[i];
		  REP(j, m) {
			r[j] += a[i][j];
		  }
		}
	}
	bool comp = true;
	REP(i, m) {
	  if (r[i] < x) {
		  comp = false;
		}
	}
	if (comp) {
		ans = min(ans, cost);
	  }
  }
  if (ans == INF) {
	  cout << -1  << endl;
	} else {
	  cout << ans << endl;
	}
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll fact[200005];
int N, K;

ll power (ll b, ll e){
    ll res = 1;
    while (e > 0){
        if (e % 2 == 1) res = (res * b) % mod;
        b = (b * b) % mod;
        e /= 2;
    }
    return res;
}

ll inv(ll a){
    return power(a, mod-2);
}

ll factorial(ll a){
    if (a == 0) return 1;
    if (fact[a] != -1) return fact[a];
    return fact[a] = factorial(a-1) * a % mod;
}

ll comb(ll n, ll r){
    return factorial(n) * inv(factorial(r)) % mod * inv(factorial(n-r)) % mod;
}

int main() {
    cin >> N >> K;
    memset(fact, -1, sizeof(fact));
    factorial(N);
    ll ans = 0;
    for (int i=0; i<=min(N, K); i++){
        ans = (ans + comb(N,i) * comb(N-1, i) % mod) % mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int dp[1009][1009],n,m,mod=1e9+7;
string s[1009];
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++)
    {
        if(s[i][0]=='#')break;
        dp[i][0]=1;
    }
    for(int i=0;i<n;i++)
    {
        if(s[0][i]=='#')break;
        dp[0][i]=1;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            if(s[i][j]=='#')continue;
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        }
    }
    cout<<dp[n-1][m-1];
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
/* map_for : mapでfor文を回す */
/* gcd_lcm : 最大公倍数 & 最小公約数 */
int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n);
    rep(i,n){
        if(s[i] == 'R') a[i] = 0;
        if(s[i] == 'G') a[i] = 1;
        if(s[i] == 'B') a[i] = 2;
    }
    vector<ll> cnt(3);
    rep(i,n){
        cnt[a[i]]++;
    }
    ll ans = 1;
    //rep(i,3) cout << i << ":" << cnt[i] << endl;

    rep(i,3) ans *= cnt[i];
    //cout << ans << endl;
    rep(j,n){
        rep(i,j){
            int k = j + (j - i);
            if(k < n){
                if(a[i] == a[j]) continue;
                if(a[i] == a[k]) continue;
                if(a[k] == a[j]) continue;
                ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;

ll N, X;
ll a[51];

ll f(ll n,ll x) {
	if (n == 0) {
		return 1;
	}
	if (x == 1) {
		return 0;
	}
	else if (1 < x && x < a[n-1]+2) {
		return f(n-1,x-1);
	}
	else if (x == a[n-1]+2) {
		return f(n - 1, a[n - 1])+1;
	}
	else if (2+a[n-1]<x && x < 2*a[n-1]+3) {
		return f(n-1,x-a[n-1]-2)+1+f(n-1,a[n-1]);
	}
	else {
		return 2 * f(n - 1,a[n-1]) + 1;
	}
}



int main() {	
	cin >> N >> X;
	rep(i, 0, 51) {
		a[i] = 0;
	}
	a[0] = 1LL;
 	rep(i, 1, 51) {
		a[i] = 2 * a[i - 1] + 3;
	}
	
	cout << f(N, X) << endl;

	return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  int i=0;
  while(n){
    n/=k;
    ++i;
  }
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
#define LL long long
#define g(i) (f(x[i],y[i],cx,cy,h[i]))
#define s(i) (t(x[i],y[i],cx,cy,ch))
using namespace std;
const int maxn=100+10;
const LL inf=0x7fffffffffffffff;
LL x[maxn],y[maxn],h[maxn];
LL ch,cx,cy;
int n;
inline LL f(LL x,LL y,LL cx,LL cy,LL h){
	return abs(x-cx)+abs(y-cy)+h;
}
inline LL t(LL x,LL y,LL cx,LL cy,LL ch){
	return max(ch-abs(x-cx)-abs(y-cy),0ll);
}
int main()
{
	int i,j,flag,ref;LL a,b,ch;
	ios::sync_with_stdio(0);
	cin>>n;
	for(i=1;i<=n;i++){cin>>x[i]>>y[i]>>h[i];if(h[i]){ref=i;}}
	//printf("ref=%d\n",ref);
	for(cx=0;cx<=100;cx++){
		for(cy=0;cy<=100;cy++){
			//if(cx!=2||cy!=2){continue;}
			flag=1;ch=g(ref);
			//printf("ch=%lld\n",ch);
			for(i=1;i<=n;i++){
				//printf("i=%d s(i)=%lld h[i]=%lld\n",i,s(i),h[i]);
				if(s(i)!=h[i]){flag=0;break;}
			}
			if(flag){
				cout<<cx<<" "<<cy<<" "<<g(ref)<<endl;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

// vectorの要素を検索
bool vector_exist(vector<char> vec, char number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index!=vec.size()) {
    return true;
  }
  else {
    return false;
  }
}

int main() {
  // アルファベット小文字
  vector<char> alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  // アルファベット大文字
  vector<char> Alphabet;
  for (char c='A'; c<='Z'; c++) Alphabet.push_back(c);
  char alpha;
  cin >> alpha;
  if (vector_exist(Alphabet, alpha)) cout << 'A' << endl;
  else cout << 'a' << endl;
  return 0;
}

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

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

using namespace std;

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

template <class T>
struct edge
{
    int to;
    T cost;
    edge(int t, T c = 0) : to(t), cost(c) {}
};

template <class T>
class graph
{
    private:
        const int number_of_nodes;
        const bool is_directed;
    public:
        vector<edge<T> > *edges;
        graph(int number_of_nodes, bool is_directed = true) : number_of_nodes(number_of_nodes), is_directed(is_directed) {
            edges = new vector<edge<T> >[number_of_nodes];
        }
        ~graph() {
            delete [] edges;
        }
        int size() const {return number_of_nodes;}
        void make_edge(int u, int v, T cost) {
            edges[u].push_back(edge<T>(v, cost));
            if (!is_directed) {
                edges[v].push_back(edge<T>(u, cost));
            }
        }
};

// graph g is connected
template <class T>
T minimum_spanning_tree(graph<T> &g)
{
    T result = 0;
    bool *used = new bool[g.size()]();
    priority_queue<pair<T, int>, vector<pair<T, int> >, greater<pair<T, int> > > q;
    T *mincost = new T[g.size()];
    bool *mincost_defined = new bool[g.size()]();
    mincost[0] = 0;
    q.push(pair<T, int>(0, 0));
    while (!q.empty()) {
        pair<T, int> p = q.top();
        q.pop();
        int from = p.second;
        if (used[from]) {
            continue;
        }
        //printf("append node %d\n", from);
        //printf("add cost %d\n", mincost[from]);
        result += mincost[from];
        used[from] = true;
        for (edge<T> e: g.edges[from]) {
            int to = e.to;
            T cost = e.cost;
            if (!used[to]) {
            //printf("edge (%d, %d), weight: %d\n", from, to, cost);
                if (!mincost_defined[to]) {
                    mincost_defined[to] = true;
                    mincost[to] = cost;
                    q.push(pair<T, int>(cost, to));
                } else if (mincost[to] > cost) {
                    mincost[to] = cost;
                    q.push(pair<T, int>(cost, to));
                }
            }
        }
    }
    delete [] used;
    delete [] mincost;
    delete [] mincost_defined;
    return result;
}

int main(void)
{
    int V, E;
    cin >> V >> E;
    graph<int> g(V, false);
    REP(i, E) {
        int s, t, w;
        cin >> s >> t >> w;
        g.make_edge(s, t, w);
    }
    cout << minimum_spanning_tree(g) << endl;
    return 0;
}




Measured memory_bytes: 6268
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main(){
long long X ;
long long bal = 100;
int year = 0;

cin >> X;

for(int i = 1; i < 65535; i++){
    bal = floor((double)bal * 1.01);
    year ++;
    if(bal >= X){
        cout << year << endl;
        break;
    }
}

/*
m = log( X / (double) 100.0);
n = log(1.01);

year =floor((double)m / (double)n) ;

cout << year << endl;

*/
return 0;
}

Measured memory_bytes: 3712
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 10001;
const ll INF = 1e18 * 4;
using namespace std;

int main(){
    int N, M; cin >> N >> M;
    vii G(N, vi(N, inf));
    vii d(N, vi(N, inf));
    
    rep(i, 0, M){
        int a, b, c; cin >> a >> b >> c;
        a--; b--;
        G[a][b] = c;
        G[b][a] = c;
        d[a][b] = c;
        d[b][a] = c;
    }
    rep(i, 0, N){
        G[i][i] = 0;
        d[i][i] = 0;
    }
    rep(k, 0, N){
        rep(i, 0, N){
            rep(j, 0, N){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]); 
            }
        }
    }
    ll ans = 0;
    rep(a, 0, N){
        rep(b, 0, N){
            int dist = G[a][b];
            bool used = false;
            if(dist == inf) continue;
            if(a == b) continue;
            rep(i, 0, N){
                rep(j, 0, N){
                    if(d[i][a] + dist + d[b][j] == d[i][j]) used = true;
                }
            }
            if(!used) ans++;
        }
    }
    cout << (int)(ans / 2) << endl;
    return 0;
}




Measured memory_bytes: 384
import collections 
h,w = map(int,input().split())

def hkara(h,w):
  hans = 10**9
  for i in range(1,h):
    #yoko
    fst = w*i
    snd = w//2*(h-i)
    trd = (w-w//2)*(h-i)
    mx = max(max(fst,snd),trd)
    mn = min(min(fst,snd),trd)
    hans = min(mx-mn,hans)
    #tate
    tfst = w*i
    tsnd = (h-i)//2*w
    ttrd = (h-(h-i)//2-i)*w
    tmx = max(max(tfst,tsnd),ttrd)
    tmn = min(min(tfst,tsnd),ttrd)
    hans = min(tmx-tmn,hans)
  return hans

def wkara(h,w):
  wans = 10**9
  for i in range(1,w):
    fst = h*i
    snd = h//2*(w-i)
    trd = (h-h//2)*(w-i)
    mx = max(max(fst,snd),trd)
    mn = min(min(fst,snd),trd)
    wans = min(mx-mn,wans)
    #tate
    tfst = h*i
    tsnd = (w-i)//2*h
    ttrd = (w-(w-i)//2-i)*h
    tmx = max(max(tfst,tsnd),ttrd)
    tmn = min(min(tfst,tsnd),ttrd)
    wans = min(tmx-tmn,wans)
  return wans

print(min(hkara(h,w),wkara(h,w)))

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

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

    int batsu = 0;
    for (int i = 0; i < 15; ++i){
    	if (S[i] == 120) batsu++;
    }

    cout << ( 7 >= batsu ? "YES" : "NO") << endl; 
    return 0;
}

Measured memory_bytes: 256
using System;

namespace AOJ.Volume1
{
    public class WhatColor
    {
        private class Color
        {
            public string Name { get; private set; }
            public int R { get; private set; }
            public int G { get; private set; }
            public int B { get; private set; }

            public Color(string name, string rgb)
            {
                Name = name;
                R = Convert.ToInt32(rgb.Substring(0, 2), 16);
                G = Convert.ToInt32(rgb.Substring(2, 2), 16);
                B = Convert.ToInt32(rgb.Substring(4), 16);
            }
        }

        public static int Main()
        {
            var color_list = new Color[8];
            color_list[0] = new Color("black", "000000");
            color_list[1] = new Color("blue", "0000ff");
            color_list[2] = new Color("lime", "00ff00");
            color_list[3] = new Color("aqua", "00ffff");
            color_list[4] = new Color("red", "ff0000");
            color_list[5] = new Color("fuchsia", "ff00ff");
            color_list[6] = new Color("yellow", "ffff00");
            color_list[7] = new Color("white", "ffffff");

            while (true)
            {
                var input = Console.ReadLine();
                if(input == "0") { break; }

                input = input.Replace("#", "");
                int r = Convert.ToInt32(input.Substring(0, 2), 16);
                int g = Convert.ToInt32(input.Substring(2, 2), 16);
                int b = Convert.ToInt32(input.Substring(4), 16);

                var d = double.MaxValue;
                int answer = 0;
                for(int i = 0; i < 8; i++)
                {
                    int r2 = (int)Math.Pow(r - color_list[i].R, 2);
                    int g2 = (int)Math.Pow(g - color_list[i].G, 2);
                    int b2 = (int)Math.Pow(b - color_list[i].B, 2);

                    var tmp_d = Math.Sqrt(r2 + g2 + b2);
                    if (d > tmp_d)
                    {
                        answer = i;
                        d = tmp_d;
                    }
                }

                Console.WriteLine(color_list[answer].Name);
            }

            return 0;
        }
    }
}

Measured memory_bytes: 9464
N = int(input())
A = list(map(int, input().split()))

box = [0] * (N+1)
ans = []
for i in range(N,0,-1):
  work = 0
  for j in range(0,N+1,i):
    work += box[j]
    #print(i,j)
  if work % 2 != A[i-1]:
    box[i] = 1
    ans.append(i)

print(len(ans))
if len(ans) > 0:
  print(" ".join(list(map(str, ans))))

Measured memory_bytes: 19808
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,k,b,sum,asum;
  vector<int> a;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>b;
    a.push_back(b);
  }
  for(int i=0;i<k;i++){
    asum+=a[i];
  }
  sum=asum;
  for(int i=k;i<n;i++){
    sum-=a[i-k];
    sum+=a[i];
    if(asum<sum) cout<<"Yes\n";
    else cout<<"No\n";
    asum=sum;
  }
}

Measured memory_bytes: 5352
#include <bits/stdc++.h>
 
#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void init_io() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); }
 
using namespace std;
using ll = long long;

constexpr int MOD = 1000000007;

class mint {
  int n;
public:
  mint(int n_ = 0) : n(n_) {}
  explicit operator int() { return n; }
  friend mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
  friend mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
  friend mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
  friend mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
  friend mint &operator+=(mint &a, mint b) { return a = a + b; }
  friend mint &operator-=(mint &a, mint b) { return a = a - b; }
  friend mint &operator*=(mint &a, mint b) { return a = a * b; }
  friend bool operator==(mint a, mint b) { return a.n == b.n; }
  friend bool operator!=(mint a, mint b) { return a.n != b.n; }
  friend istream &operator>>(istream &i, mint &a) { return i >> a.n; }
  friend ostream &operator<<(ostream &o, mint a) { return o << a.n; }
};

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};

void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(n); return n < 0 ? 0 : I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

int main() { init_io();
  int X, Y; cin >> X >> Y;
  if ((X + Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int d = (X + Y) / 3;
  X -= d;
  Y -= d;
  cout << C(X + Y, X) << endl;
}


Measured memory_bytes: 14412
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using pint = pair<int, int>;
using pll = pair<ll,ll>;

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int n,h;
    cin >> n >> h;
    vector<int>b(n+1,0);
    int cut_max=0,a;
    REP(i,n){
        cin >> a >> b[i];
        cut_max = max(a,cut_max);
    }
    sort(b.begin(),b.end(),greater<>());
    int index=0,count=0;
    while(h>0){
        if(cut_max<b[index]){
            h-=b[index];
            index++;
            count++;
        }
        else{
            count += (h+cut_max-1)/cut_max;
            break;
        }
    }
    COUT(count);
    return 0;
} 

Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

int solve(ll N, vector<ll> D) {
  sort(ALL(D));
  vector<int> cnt(13);
  REP(i,N) cnt[D[i]]++;
  if (*max_element(ALL(cnt)) > 2) return 0;
  if (cnt[0] >= 1) return 0;
  if (cnt[12] >= 2) return 0;

  if (N >= 12) return 1;

  int res = 0;
  REP(bit,1<<N) {
    vector<int> d;
    REP(i,N) {
      if ((bit >> i) & 1) d.push_back(D[i]);
      else d.push_back(24 - D[i]);
    }
    d.push_back(0);
    sort(ALL(d));
    int mires = 1e9;
    REP(i,N+1) {
      int dd = abs(d[i+1] - d[i]);
      chmin(mires, dd);
      chmin(mires, 24 - dd);
    }
    chmax(res, mires);
  }
  return res;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> D(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &D[i]);
	}
	cout << solve(N, D) << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
if N < 10:
  print(N)
else:
  if 9 < N < 100:
    print("9")
  else:
    if 99 < N < 1000:
      print(N - 90)
    else:
      if 999 < N < 10000:
        print("909")
      else:
        if 9999 < N < 100000:
          print(909 +  N - 9999)
        else:
          if N == 100000:
            print("90909")

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

int main()
{
    long long N;
    scanf("%lld", &N);
    map<long long, int> mapper;
    for (int i = 0; i < N; i++)
    {
        long long element;
        cin >> element;
        mapper[element] = mapper[element] + 1;
    }

    long long ans = 0;

    for (auto i = mapper.begin(); i != mapper.end(); ++i)
    {
        if ((i->second) % 2 == 1)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
const int nMax=2000, MOD=1000000007;
unsigned long C[nMax][nMax], ans=0;
void setC(){
   for(int n=0; n<nMax; n++){ for(int r=0; r<=n-r; r++){ 
      C[n][r]=C[n][n-r]=(r)?(C[n-1][r]+C[n-1][r-1])%MOD:1;
   }}
}

int main(){
int N, K; cin >> N >> K; setC();
for(int i=1; i<=K; i++){ 
  ans=(N-K-(i-1)<0)?0:(C[K-1][i-1]*C[N-K+1][i])%MOD;  
  cout << ans << "\n";
}
}

Measured memory_bytes: 30080
#include <stdio.h>
int main()
{
	int a,b,s,n;
	double p,c;
	scanf("%d%d",&a,&b);
	s=a+b;
	p=s*1.0/2;
	n=s/2;
	c=p-n;
	if(c>=0.5)
	printf("%d\n",n+1);
	else
	printf("%d\n",n);
	return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    
    vector<ll> a(n * 3);
    for(int i = 0; i < n * 3; i++){
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    
    ll ans = 0;
    
    for(int i = 0; i < 2 * n; i+=2){
        ans += a[i+1];
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 1000000
#define INF 1000000

int a[MAX_N];
int b[MAX_N];


int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  string S_, T;
  cin >> S_ >> T;

  // ---------------------
  // 
  int n = S_.size();
  int m = T.size();

  bool flag = false;
  int idx = 0;
  
  for (int i = 0; i <= n - m; i++) {
    
    for (int j = 0; j < m; j++) {
      if (S_[n-1-i-j] == T[m-1-j] || S_[n-1-i-j] == '?') flag = true;
      else {
	flag = false;
	break;
      }
    }
    
    if (flag) {
      idx = n - m - i;
      break;
    }
  }

  if (flag) {
    for (int i = 0; i < n; i++) {

      if (i >= idx && i <= idx + m - 1) {
	cout << T[i - idx];
      }
      else {
	if (S_[i] == '?') cout << 'a';
	else cout << S_[i];
      }
    }
    cout << endl;
    
  }
  else {
    cout << "UNRESTORABLE" << endl;
  }
  
  return 0;
  
}



Measured memory_bytes: 256
use std::io;
fn main() {
    let mut line = String::new();
    let mut num: u32 = 0;
    while let Ok(_) = io::stdin().read_line(&mut line) {
        num += 1;
        {
            let data = line.trim();
            if data == "0" {
                break;
            }
            println!("Case {}: {}", num, data);
        }
        line.clear();
    }
}



Measured memory_bytes: 5016
/*input
1333333333
*/
#include<bits/stdc++.h>
#define int        long long
#define MOD        1000000007
#define MAX        100005
#define pb         push_back
#define mp         make_pair
#define pii        pair<int,int>
#define mii        map<int,int>
#define vi         vector<int>
#define ff         first
#define ss         second
#define T          int t;cin>>t;while(t--)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define umi        unordered_map<int,int>
#define maxheap    priority_queue<int>
#define minheap    priority_queue<int,vector<int>,greater<int> >
#define inp(n)     for(int i=0;i<n;i++)
#define N          200005
#define mxN           2000005
#define all(v)        v.begin(),v.end()
#define lb(v,val)  (int)(lower_bound(v.begin(),v.end(),val)-v.begin())
#define ub(v,val)  (int)(upper_bound(v.begin(),v.end(),val)-v.begin())
using namespace std;
using namespace std::chrono;

void solve(){
    int x;
    cin>> x;
    int n=100,yr=0;
    while(n < x){
        yr++;
        double y=n;
        y=y/100*101;
        n=y;
    }
    cout << yr << '\n';
}

signed main(){

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1; 
    //cin >> t;
    while(t--){
    solve(); 
    }
}




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

int main()
{
    int a,b,k,i,j,ans;
    cin>>a>>b>>k;
    for(i=a;i>=1;i--)
    {
        if(a%i==0 && b%i==0)
        {
            k--;
            if(k==0)
            {
                cout<<i;
                exit(0);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    string S;
    cin >> S;
    
    int o = 0;
    int a = 0;
    for(int i = 0;i <= S.length();i++){
        if(S[i] == 'o')o++;
        a++;
    }
    if(15 - (a - 1) + o >= 8)cout << "YES";
    else cout << "NO";
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,s=0;
  cin >> N >> K;
  vector<int> d(N);
  for(int i=0;i<N;i++){
      cin >> d[i];
  }
  for(int i=0 ; i<N ;i++){
      if(d[i]>=K){
          s++;
      }
  }
  cout << s << endl;
}

Measured memory_bytes: 640
import numpy as np

def judge_prime(num):
    FLAG = True
    
    for i in range(2, int(num**.5)+1):

        if (num%i == 0):
            FLAG = False
    
    if (num == 2):
        FLAG = True
    
    return(FLAG)

X = int(input())

while (True):
    flag = judge_prime(X)
    
    if (flag):
        break
    
    X += 1

print(X)


Measured memory_bytes: 14420
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ

//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π

using namespace std;

//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//#include "./lib/generic/search.h"

int pcnt(int x){ //ポップカウントの計算
    return __builtin_popcount(x); 
}

int f(int x){
    if(x==0) return 0;
    return f(x%pcnt(x))+1;
}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> x(n);
    rep(i,n) x[i] = s[i]-'0';
    int pc = 0;
    rep(i, n) pc += x[i]; //1の数なので
    vector<int> ans(n);
    rep(b, 2){
        int npc = pc;
        if(b==0) npc++; //元のビットが0なら1に変換されるのでポップカウントが1増える
        else npc--; //元のビットが1なら0に変換されるのでポップカウントが1減る
        if(npc <= 0) continue; //npcが0の場合はゼロ割り算が発生するので例外処理
        int r0=0;
        rep(i,n){ //2進数を10進数に変換
            r0 = (r0*2)%npc; //11を整数に直すなら1桁進むごとに2かかる量が増えていくので2をかける。そこに余りを求める処理も追加
            r0 += x[i]; //11なら2桁目は2*1+1なので下の桁数と足している
        }
        int k = 1;
        for(int i=n-1; i>=0; i--){
            if(x[i]==b){ //反転させたビットのとき
                int r = r0;
                if(b == 0) r = (r+k)%npc; //元が0なら1に反転して増えるのでr+k
                else r = (r-k+npc)%npc; //元が1なら0に反転して減るのでr-k。負の値になる可能性があるのでnpcをたす
                ans[i] = f(r)+1;
            }
            k = (k*2)%npc;
        }
    }
    rep(i, n) cout << ans[i] << endl;
    return 0;
}

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

using namespace std;

int w;
int h;
string map[20];
bool come[20][20];

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

int dfs(int x, int y)
{
    if(x < 0 || y < 0 || w <= x || h <= y)return 0;
    if(come[y][x])return 0;
    if(map[y][x] == '#')return 0;

    come[y][x] = true;

    int ret = 1;
    for(int i = 0; i < 4;i++)
    {
        ret += dfs(x + dx[i], y + dy[i]);
    }
    return ret;
}

int main()
{
    while( cin >> w >> h, (w | h) )
    {
        
        string gomi;
        getline(cin, gomi);//??°?????????

        int px, py;

        //input
        for (int i = 0; i < h; i++)
        {
            getline(cin, map[i]);
            for(int j = 0; j < w; j++)
            {
                come[i][j] = false;
                if(map[i][j] == '@')
                {
                    px = j;
                    py = i;
                }
            }
        }
        cout << dfs(px, py) << endl;
    }
    return 0;
}

Measured memory_bytes: 3208
#include<stdio.h>

int main(void){

	int n,m,i,j,num,tmp;
	int *B,**A;

	scanf("%d %d",&n,&m);	/* n??m?????????A?????\??? */
		B = (int *)malloc(sizeof(int)*m);
		A = (int **)malloc(sizeof(int *)*n);

	for(i=0;i<n;i++){
		A[i] = (int *)malloc(sizeof(int )*m);
	}

	for(i=0;i<n;i++){	/* m??1??????????????????b????????????i?????????????´?(i=1,2,...,m) */
		for(j=0;j<m;j++){	/* i???j?????????????´?aij(i=1,2,...,n,j=1,2,...,m) */
			scanf("%d",&A[i][j]);
		}
	}

	for(i=0;i<m;i++){
		scanf("%d",&B[i]);	/*  m??1??????????????????B */
	}

	for(i=0;i<n;i++){
		tmp = 0;
			for(j = 0;j<m;j++){
				tmp = tmp + A[i][j] * B[j];		/* c???i?????????????´?ci */
	}
			printf("%d\n",tmp);		/* A???????´?aij */
		}							/* ????????????c???????´?ci */
	for(i=0;i<n;i++){
		free(A[i]);
	}
	free(A);

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define LL long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=3005;
int a,b,c,d,e,m;
bool f[N][N];
int main()
{
	cin>>a>>b>>c>>d>>e>>m;
	a*=100; b*=100;
	f[0][0]=1;
	for(int i=0;i*a<=m;i++){
		for(int j=0;i*a+j*b<=m;j++){
			int w=i*a+j*b,lim=w/100*e;
//			cout<<w<<' '<<lim<<endl;
			for(int k=0;k*c<=lim&&w+k*c<=m;k++){
				for(int l=0;k*c+l*d<=lim&&w+k*c+l*d<=m;l++){
					int s=k*c+l*d;
//					cout<<s<<endl;
					f[w+s][s]=1;
				}
			}
		}
	}
//	cout<<f[110][10]<<endl;
	double p=-1;
	int ansi=-1,ansj=-1;
	for(int i=1;i<=m;i++)
	  for(int j=0;j<=i;j++)
	    if(f[i][j]&&(double)j/(double)(i+j)>p)
	      p=(double)j/(double)(i+j),ansi=i,ansj=j;
//	printf("%.3lf\n",p);
	printf("%d %d\n",ansi,ansj);
	return 0;
}

Measured memory_bytes: 6784
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	vector<vector<char>> C(2, vector<char>(3));

	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> C[i][j];
		}
	}

	if (C[0][0] != C[1][2] || C[0][1] != C[1][1] || C[0][2] != C[1][0]) {

		cout << "NO" << endl;

	} else{

		cout << "YES" << endl;

	}


	return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
typedef pair<int,int> pii;

int n,m;
pii rs[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int a,b;
    scanf("%d%d", &a,&b);
    --a;--b;
    rs[i] = pii(a,b);
  }
  sort(rs,rs+m);
  int ans = 0;
  priority_queue<int> Q;
  int it = 0;
  REP(i,n){
    if(Q.size() && -Q.top()==i){
      ans++;
      while(Q.size())Q.pop();
    }
    while(it<m){
      if(rs[it].first == i){
        Q.push(-rs[it].second);
        it++;
      }else{
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	map<string,int> mp;
	for(int a=0;a<n;a++){
		string str;
		cin >> str;
		mp[str]++;
	}
	int m;
	cin >> m;
	for(int a=0;a<m;a++){
		string str;
		cin >> str;
		mp[str]--;
	}
	int  ans=0;
	for(pair<string,int> pa:mp){
		ans=max(pa.second,ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    ll x;
    cin >> x;

    ll num3=11;
    ll loop = (x/num3);
    ll rem = (x%num3);
    ll ans = loop*2;
    if (rem>0) ans++;
    if (rem>6) ans++;
    
    cout << ans << endl;
}



Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll k, s;
  cin >> k >> s;
  ll ans = 0;
  rep(x, k+1)rep(y, k+1){
    ll z = s-x-y;
    if(0 <= z && z <= k){
      ++ans;
    }
  }
  print(ans);
}


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

int main()
{
	int n, team1, team2, score1, score2, point[101] = {0};
	vector<int> rank;
	cin >> n;
	for(int i = 0; i < n * (n - 1) / 2; i++){
		cin >> team1 >> team2 >> score1 >> score2;
		if(score1 > score2)
			point[team1] += 3;
		else if(score1 < score2)
			point[team2] += 3;
		else{
			point[team1]++;
			point[team2]++;
		}
	}

	for(int i = 0; i < n; i++)
		rank.push_back(point[i + 1]);

	stable_sort(rank.begin(), rank.end(), greater<int>());

	for(int i = 1; i <= n; i++){
		for(int j = 0; j < n; j++){
			if(point[i] == rank[j]){
				cout << j + 1 << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#define ll          long long
#define dl          double
#define pb          push_back
#define eb          emplace_back
#define mp          make_pair
#define F           first
#define S           second
#define endl        "\n"
#define rep(i,a,b)  for(i=a;i<b;i++)
#define all(v)      v.begin(),v.end()
#define allr(v)     v.rbegin(),v.rend()
#define mod         1000000007
#define CIN(V,s,n)  for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n) for(int i=s;i<n;i++){cout <<  V[i] << " ";}
#define fast        ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);   for(ll i=0;i<V.size();i++) V[i] = 0;

// map<ll,vector<ll> > M;
// map<ll,vector<ll> >:: iterator it;
// it = M.begin();
// it.F will be ll
// it.S will be vector<ll>

using namespace std;

bool SbS(const pair<int,int> &a,const pair<int,int> &b)
{return (a.second < b.second);}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;
}

ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll rd(dl x)
{

        if((ll)x==x)
            return (ll)x;
        else
            return ((ll)x);
}

ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}


int main()
{
ll t=1;
//cin >> t;
while(t--)
{
    ll n,m,k,i,j,l,u,v,x,y,a,b,c,d;
    vector<ll> F(5001,1),IF(5001,1);

    for(i=2;i<=5000;i++)
    {
        F[i]=(F[i-1]*i)%mod;
    }
    for(i=2;i<=5000;i++)
    {
        IF[i]=(IF[i-1]*MI(i,mod))%mod;
        //cout << IF[i] << " ";
    }

    cin >> n >> k;
    vector<ll> Wa(k+1);

    for(i=1;(i<=k and i<=n-k+1);i++)
    {
        Wa[i] = (((F[k-1]*IF[i-1])%mod)*(IF[k-i]))%mod; //(((F[k]*IF[k-i])%mod));//
        Wa[i] = (Wa[i]*((((F[n-k+1]*IF[i])%mod)*IF[n-k+1-i])%mod))%mod;
    }
    for(i=1;i<=k;i++)
    {
        cout << Wa[i] << endl;
    }
}
    return 0;
}


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

using ll = long long;

map <int, int> cnt;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i=0; i<n; i++) {
		cin >> a[i];
		cnt[a[i]] ++;
	}
	sort (a.begin(), a.end());
	int ans = 0;
	for (int i=n-1; i>=0; i--) {
		if (!cnt[a[i]]) continue;
		cnt[a[i]] --;
		int step = 1<<((int)log2(a[i]) + 1);
		int req = step - a[i];
		if (cnt[req]) {
			ans ++;
			cnt[req] --;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 19840
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int top,S[1000];

void push(int);
int pop(void);

int main(){
  int x,y,z;
  top=0;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      x=pop();
      y=pop();
      push(x+y);
    }
    else if ( s[0] == '-' ){
      y=pop();
      x=pop();
      push(x-y);

    }
    else if ( s[0] == '*' ){
      x=pop();
      y=pop();
      push(x*y);
    }
    else {
      z = atoi(s);
      push(z);
    }
  }

  printf("%d\n",pop());

  return 0;
}

void push(int x){
  S[++top]=x;
}

int pop(void){
  top--;
  return S[top+1];
}



Measured memory_bytes: 2100
fun main(args: Array<String>) {
    val b = readLine()!!.toString()
    if(b == "A") {
        println("T")
    } else if(b == "G") {
        println("C")
    } else if(b == "T") {
        println("A")
    } else if(b == "C") {
        println("G")
    }
}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,sum=0,ans=0;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    sort(arr,arr+n);
    cout<<arr[n/2]-arr[(n/2)-1]<<endl;
    return 0;
}


Measured memory_bytes: 1024