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

const long long MOD = 1000000007;
const long long MAX = 2000000;

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
int koushin(int c[26],int last[26],int used,int d,int kasan,int sum){
    int tm=last[used];
    last[used]=d;
    int sum_m=sum;
    for(int i=0;i<26;i++){
        sum_m-=c[i]*(d-last[i]);
    }
    last[used]=tm;
    sum_m+=kasan;
    return sum_m;
}

int main()
{
    int D;
    int c[26];
    int last[26];
    for(int i=0;i<26;i++){
        last[i]=0;
    }
    cin>>D;
    pair<int,int>s[D][26];
    pair<int,int>p[D][26];
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    for(int i=0;i<D;i++){
        for(int j=0;j<26;j++){
            int tmp;
            cin>>tmp;
            s[i][j]=make_pair(tmp,j+1);
            p[i][j]=make_pair(tmp,j+1);
        }
        sort(p[i],p[i]+26);
    }
    int sum=0;
    vector<int>anss;
    random_device seed_gen;
    mt19937 engine(seed_gen());
    int tmpp_sum;
    for(int i=0;i<D;i++){
        clock_t start = clock(); 
        clock_t end = clock(); 
        int y=engine()%26;
        if(y==0){
            y=26;
        }
        int mae=last[y];
        int tmp_sum=koushin(c,last,p[i][25].second,i+1,s[D][y].first,sum);
        bool first=true;
        int number=p[i][25].second;
        while(end-start<1000){
        int x= engine()%26;
        if(x==0){
            x=26;
        }
        int maee=last[x];
        tmpp_sum=koushin(c,last,x,i+1,s[i][x].first,sum);
        if(first){
            if(tmp_sum>tmpp_sum){
                number=y;
            }else{
                number=x;
                tmp_sum=tmpp_sum;
            }
            first=false;


        }else{
            if(tmpp_sum>tmp_sum){
                number=x;
                tmp_sum=tmpp_sum;
            }

        }
        end=clock();
        
        }
        sum=tmp_sum;
        anss.push_back(number);


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

    


    
    

}


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

#define fastIO ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MP make_pair
#define inf INT_MAX
#define minf INT_MIN

typedef long long int lli;

ofstream outfile;
ifstream infile;

int n;
int color[100009], dist[100009];
vector <vector <int>> graph;
vector <int> temp;

void BFS()
{
	dist[1] = 0;
	dist[n] = 0;
	color[1] = 1;
	color[n] = 2;

	queue <int> blackq, whiteq;
	int j, t1, t2, d1, d2;

	blackq.push(1);
	whiteq.push(n);

	while( (!blackq.empty()) || (!whiteq.empty()) )
	{
		if( !blackq.empty())
		{
			t1 = blackq.front();
			d1 = dist[t1] + 1;
			blackq.pop();
			//cout << t1 << "\n";

			if( color[t1] == 1){
			for(j = 0; j < graph[t1].size(); ++j)
			{
				if( d1 <= dist[graph[t1][j]])
				{
					//cout << graph[t1][j] << "f\n";
					dist[graph[t1][j]] = d1;
					color[graph[t1][j]] = color[t1];
					blackq.push(graph[t1][j]);
				}
			}}
		}
		if( !whiteq.empty())
		{
			t2 = whiteq.front();
			d2 = dist[t2] + 1;
			whiteq.pop();
			//cout << t2 << "\n";

			if(color[t2] == 2){
			for(j = 0; j < graph[t2].size(); ++j)
			{
				if( d2 < dist[graph[t2][j]])
				{
					//cout << graph[t2][j] << "s\n";
					dist[graph[t2][j]] = d2;
					color[graph[t2][j]] = color[t2];
					whiteq.push(graph[t2][j]);
				}
			}}
		}
	}
}
int main()
{
	infile.open("input.txt");
	outfile.open("output.txt");

	fastIO;
	int u, v, t, i;
	cin >> n;


	for(i = 0; i <= n; ++i)
	{
		dist[i] = 999999;
		color[i] = 0;
		graph.pb(temp);
	}

	for(i = 1; i < n; ++i)
	{
		cin >> u >> v;
		graph[u].pb(v);
		graph[v].pb(u);
	}

	BFS();
	int sumb = 0, sumw = 0;

	for(i = 1; i <= n; ++i)
	{
		if( color[i] == 1)
			++sumb;
		else if( color[i] == 2)
			++sumw;
	}
	if( sumb > sumw)
		cout << "Fennec\n";
	else
		cout << "Snuke\n";
}

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

void insertion(vector<int> a, int N) {
    for(int i = 1; i < N; i++) {

        int tmp = a.at(i);
        int j = i - 1;

        while(j >= 0 && a.at(j) > tmp) {
            a.at(j+1) = a.at(j);
            a.at(j) = tmp;
          	if(j >= 1) j--;
        }      
        if(a.at(j) <= a.at(j+1)) {
              for(int k = 0; k < N; k++) {
                  cout << a.at(k);
                  if(k != N-1) cout << ' ';
              }
              cout << endl;
        }
    }
}

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

    vector<int> a(N);
    for(int i = 0; i< N; i++) {
        cin >> a.at(i);
    }
  
  	for(int i = 0; i < N; i++) {
		cout << a.at(i);
      	if(i != N-1) cout << ' ';
    }
  	cout << endl;
  
    insertion(a, N);
}


Measured memory_bytes: 3168
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<utility>
#include<string>
#include<set>
#include<iterator>
#define mx 1e9
typedef long long ll;
using namespace std;

int main()
{
    int a,b,c,k,s=0;
    cin>>a>>b>>c>>k;
    if(k>=a){
    k=k-a;
    s=s+a;
    }
    else {
        s=s+k;
        k=0;
    }
    if(k>0) k=k-b;
    else{
    cout<<s<<endl;
    return 0;
    }
    if(k>0) s=s-k;
    else{
    cout<<s<<endl;
    return 0;
    }
    cout<<s<<endl;
    return 0;
}



Measured memory_bytes: 3636
s = list(map(int, input().split()))
bingo=[]
bingo+=s
s = list(map(int, input().split()))
bingo += s
s = list(map(int, input().split()))
bingo += s
s = list(map(int, input().split()))
n=s[0]
for i in range(n):
    s = list(map(int, input().split()))
    bingo=[ 0 if j==s[0] else j for j in bingo]
if bingo[0]==bingo[1]==bingo[2]:print('Yes')
elif bingo[0] == bingo[1] == bingo[2]:print('Yes')
elif bingo[3] == bingo[4] == bingo[5]:print('Yes')
elif bingo[6] == bingo[7] == bingo[8]:print('Yes')
elif bingo[0] == bingo[3] == bingo[6]:print('Yes')
elif bingo[1] == bingo[4] == bingo[7]:print('Yes')
elif bingo[2] == bingo[5] == bingo[8]:print('Yes')
elif bingo[0] == bingo[4] == bingo[8]:print('Yes')
elif bingo[2] == bingo[4] == bingo[6]:print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
/*  Author : Ded Stark
    Moto :  Chai piyo, biscuit khao     */
#define int long long
#define isspeed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<bool> vb;
typedef pair<int, int> pi;

#define pb push_back
#define pf push_front
#define sz(v) (int)v.size()
#define fr(i, n) for(int i=0;i<(n);i++)
#define rep(i, a, b) for(int i=a;i<=b;i++)
#define tr(c, it) for(auto it = c.begin();it!=c.end();it++)
#define all(v) v.begin(), v.end()
#define mset(m, v) memset(m, v, sizeof(m))
#define debug(a) cerr << #a << ": " << a << ' ';
#define nl cerr<<'\n';
#define pr(v) tr(v, it)cout<<*it<<' ';cout<<'\n';
#define MP make_pair
#define eb emplace_back
#define F first
#define S second
const int M = 1e9 + 7;const double PI = 2.0*acos(0);
const string here = "here\n";const string yes = "YES\n";const string no = "NO\n";
int binpow(int a, int p){int res=1;for(;p;p>>=1ll){if(p&1)res=(1ll*res*a)%M;a=(1ll*a*a)%M;}return res;}
int dp[10010][100][2][2], d;
string L, R;
int DP(int level, int mod, int thi, int tlo){
    if(level==L.size())
        return (mod ? 0ll : 1ll);
    if(dp[level][mod][thi][tlo]!=-1)
        return dp[level][mod][thi][tlo];
    int temp = 0;
    int blo=0,bhi=9;
    if(tlo)
        blo = L[level]-'0';
    if(thi)
        bhi = R[level]-'0';
    for(int i=blo;i<=bhi;++i){
        int ntlo=tlo, nthi=thi;
        if(i>(L[level]-'0'))
            ntlo=0;
        if((R[level]-'0')>i)
            nthi=0;
        temp = (temp + DP(level+1, (mod+i)%d, nthi, ntlo))%M;
    }
    dp[level][mod][thi][tlo]=temp;
    return dp[level][mod][thi][tlo];
}
void precomp(){

}
void solve(){
    int n, m, i, j, k;
    cin >> R;
    cin>>d;
    L="1";
    mset(dp, -1);
    while(L.size() < R.size())
        L+='0';
    reverse(all(L));
    cout<<DP(0, 0, 1, 1);
}
int32_t main(){
    isspeed
    //clock_t BEGIN = clock();
    #ifndef ONLINE_JUDGE
        freopen("inputf.in", "r", stdin);
        freopen("outputf.in", "w", stdout);
    #endif
    precomp();
    int t = 1;
    //cin>>t;while(t--)
        solve();
    //cerr<<((double)(clock() - BEGIN)/CLOCKS_PER_SEC)<<'\n';
    return 0;
}

Measured memory_bytes: 35784
#include <stdio.h>

#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX],col[MAX],a[MAX],b[MAX],c;


void dfs_v(int l)
{
  int m;
  col[l]=GRAY;
  a[l]=++c;
  for( m=0 ; m<n ; m++ ){
    if( M[l][m]==0 )
      continue;
    if( col[m]==WHITE ){
      dfs_v(m);
    }
  }
  col[l]=BLACK;
  b[l]=++c;
}

void dfs(){
  int l;
  for( l=0 ; l<n ; l++ )
    col[l]=WHITE;
  c=0;

  for( l=0 ; l<n ; l++ ){
    if( col[l]==WHITE )
      dfs_v(l);
  }
  for( l=0 ; l<n ; l++ ){
    printf("%d %d %d\n",l+1,a[l],b[l]);
  }
}

int main()
{
  int l,m,k,i,j;

  scanf("%d",&n);

  for( i=0 ; i<n ; i++ ){
    for( j=0 ; j<n ; j++ )
      M[i][j]=0;
  }

  for( i=0 ; i<n ; i++ ){
    scanf("%d%d",&l,&k);
    l--;
    for( j=0 ; j<k ; j++ ){
      scanf("%d",&m);
      m--;
      M[l][m]=1;
    }
  }

  dfs();

  return 0;
  
}
  
			 
	



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int main(){
	int n; cin >> n; int a, c = 0;
	REP(i,0,n) cin >> a, c += a % 2;
	
	if(c % 2) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 256
S = input()
f = int(S[:2])
s = int(S[2:])

if 1 <= f <= 12 and 1 <= s <= 12:
    print("AMBIGUOUS")
elif 1 <= f <= 12:
    print("MMYY")
elif 1 <= s <= 12:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,M,K; cin>>N>>M>>K;
  vector<int>A(N+1);vector<int>B(M+1);vector<int>C(N+1);vector<int>D(M+1);
  for(int i=1;i<=N;i++){cin>>A[i];C[i]=C[i-1]+A[i];}
  for(int i=1;i<=M;i++){cin>>B[i];D[i]=D[i-1]+B[i];}
  vector<int>E(N+1,0);
  int count=M;
  for(int i=0;i<=N;i++){
    for(int j=count;j>=0;j--){
      if(K>=C[i]+D[j]){E[i]=i+j;count=j;break;}
    }
  }
  sort(E.begin(),E.end());
  cout<<E[N]<<endl;
}

Measured memory_bytes: 11180
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

struct Point {
  int x;
  int y;
  bool paired;
};

int psort(const void *p1, const void *p2) {
  return ((struct Point*)p1)->x > ((struct Point*)p2)->x;
}

int main(void) {
  int N;
  int i, b, r, cnt = 0;
  struct Point *red, *blue;
  scanf("%d", &N);
  red = (struct Point*)malloc(sizeof(struct Point) * 2 * N);
  blue = (struct Point*)malloc(sizeof(struct Point) * 2 * N);
  for (i = 0; i < N; i++) {
    scanf("%d %d", &(red[i].x), &(red[i].y));
    red[i].paired = false;
  }
  for (i = 0; i < N; i++) {
    scanf("%d %d", &(blue[i].x), &(blue[i].y));
    blue[i].paired = false;
  }

  qsort(red, N, sizeof(struct Point), psort);
  qsort(blue, N, sizeof(struct Point), psort);

  for (r = N - 1; r >= 0; r--) {
    int m = 999, mi = -1;
    for (b = N - 1; red[r].x < blue[b].x; b--) {
      if (!blue[b].paired && red[r].y < blue[b].y && m > blue[b].y) {
        m = blue[b].y;
        mi = b;
      }
    }
    if (mi >= 0) {
      blue[mi].paired = true;
      red[r].paired = true;
    }
  }

  for (i = 0; i < N; i++) {
    if (blue[i].paired) cnt++;
  }
  printf("%d\n", cnt);

  return 0;
}


Measured memory_bytes: 128
// ABC158 - B - Count Balls

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

typedef long long int ll;

int main(){
	ll N,A,B;
	cin>>N>>A>>B;
	ll ans=N/(A+B)*A;
	ans+=min(N%(A+B),A);
	cout<<ans<<endl;
}


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */
signed main() 
{
  int n=in();
  int b[n];
  rep(i,n) 
  {
    int tmp=in();
    tmp--;
    b[i]=tmp;
  }
  int now=0,cnt=0;
  while(true)
  {
    if(now==1)
    {
      print(cnt);
      break;
    }
    if(cnt>=n)
    {
      print(-1);
      break;
    }
    cnt++;
    now=b[now];
  }

  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
  int A;
  int B;
  int C;
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);

  if (A == B || B == C || C == A) {
    if (A != B || B != C || C != A) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 1624
# ABC171C
import sys
import re
n = int(input())
ABC = [chr(i) for i in range(97,97+26)]
ans = []

a = n
while a > 0:
    a -= 1
    t = a%26
    a = a//26
    ans.append(ABC[t])
ans.reverse()
print(''.join(ans))

Measured memory_bytes: 9860
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>

int main() {
	int N;
	std::vector<double> v;
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		int v_i;
		scanf("%d", &v_i);
		v.push_back(v_i);
	}
	std::sort(v.begin(), v.end());

	for (int i = 0; i < N - 1; ++i) {
		v[i + 1] = (v[i] + v[i + 1]) / 2.0;
	}

	printf("%f", v[N - 1]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

int main(){
  int n,m,Q; cin >> n >> m >> Q;
  vvi a(n,vi(n));
  rep(i,m) {
    int l,r; cin >> l >> r;
    l--; r--;
    a[l][r]++;
  }
  vvi s(n+1,vi(n+1));
  rep(i,n) rep(j,n) {
    s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i][j] + a[i][j];
  }

  while(Q--){
    int p,q; cin >> p >> q;
    p--; q--;
    cout << s[q+1][q+1] - s[q+1][p] - s[p][q+1] + s[p][p] << endl;
  }
}


Measured memory_bytes: 2944
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if(a%3==0)
        cout<<"Possible";
    else if (b%3==0)
        cout<<"Possible";
    else if ((a+b)%3==0)
        cout<<"Possible";
    else
        cout<<"Impossible";
    return 0;
}


Measured memory_bytes: 764
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   set<int> s;
   int q;
   cin >> q;
   for(int i = 0; i < q; i++){
	  int cmd;
	  cin >> cmd;
	  if (cmd == 0){
		   int val;
		   cin >> val;
		   s.insert(val);
		   cout << (int)s.size() << endl;
		}
      if (cmd == 1){
		  int val;
		  cin >> val;
		  if (s.find(val) == s.end()) cout << 0 << endl;
		  else cout << 1 << endl;  
		}
	  if (cmd == 2){
		  int val;
		  cin >> val;
		  s.erase(val);  
		}
      if (cmd == 3){
		  int l, r;
		  cin >> l >> r;
		  auto it = s.lower_bound(l);
		  auto idx = s.upper_bound(r);
		  while(it != idx){
			   cout << *it << endl;
			   it++; 
			 }
		  }
	}   
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



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

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

    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> dn(n);
    for (int i = 0; i < n; i++) {
        int d;
        cin >> d;

        dn.at(i) = d;
    }

    sort(dn.begin(), dn.end());

    int c = n / 2;
    int k = dn.at(c), kp = dn.at(c - 1);

    if (k == kp) {
        cout << 0 << endl;
        return 0;
    }

    cout << (k - kp) << endl;
}


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

int main(){
    string w,t;
    int counter = 0;
    
    cin >> w;
    
    while(cin >> t){
        if(t == "END_OF_TEXT") break;
        
        if( (int)w.size() == (int)t.size() ){
            for(int i = 0;i<(int)w.size();++i){
                if( isupper(w[i]) ) w[i] = tolower(w[i]);
                if( isupper(t[i]) ) t[i] = tolower(t[i]);
                
                if(w[i] != t[i]) break;
                
                if(i == (int)w.size() - 1){
                    ++counter;
                }
            }
        }
    }
        cout << counter << endl;
        
        return 0;
    
}


Measured memory_bytes: 3212
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

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

	for(;;)
	{
		int n;
		cin >> n;
		if(cin.fail()) break;
		vi l(n);
		for(auto&m:l) cin >> m;

		sort(l.rbegin(), l.rend());
		int ans=0;
		for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
				if(l[i]==l[j]) continue;
				for(int k=j+1;k<n;k++)
				{
					if(l[j]==l[k]) continue;
					if(l[i]>=l[j]+l[k]) break;
					ans++;
				}
			}
		}

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


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
    const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};

    for (;;) {
        int N, M, K; cin >> N >> M >> K;
        if (N == 0) break;

        vi a(N+1);
        int sum = 0;
        while (!a[N]) {
            int s = 0;
            REP(i, N) {
                s += a[i] + 1;
            }
            sum += max(s - K, 1);

            for (int i = 0; ++a[i] == M; ++i) a[i] = 0;
        }
        cout << (double)sum / pow(M, N) << endl;
    }

    return 0;

}



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

int cnts = 0;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };
int t[4][4];
int dst[4][4][16];
bool flag = false;

void init() {
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) t[i][j] = 4 * (i * 4 + j);
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 1; k < 16; k++) {
				int sx = (((k + 15) % 16) / 4), sy = (((k + 15) % 16) % 4);
				dst[i][j][k] = abs(i - sx) + abs(j - sy);
			}
		}
	}
}

bool dfs(int dep, unsigned long long V, int px, int py, int prevdir, int exp) {
	if (flag == true) return true;
	if (dep == 0) {
		flag = true;
		return true;
	}

	for (int i = 0; i < 4; i++) {
		int sx = px + dx[i], sy = py + dy[i];
		if (sx < 0 || sy < 0 || sx > 3 || sy > 3) continue;
		if (((i + 2) & 3) == prevdir) continue;

		unsigned long long V1 = ((V >> t[px][py]) & 15ULL);
		unsigned long long V2 = ((V >> t[sx][sy]) & 15ULL);
		int nexExp = exp - dst[px][py][V1] - dst[sx][sy][V2] + dst[px][py][V2] + dst[sx][sy][V1];
		if (nexExp > dep - 1) continue;

		unsigned long long nexV = V + ((V2 - V1) << t[px][py]) + ((V1 - V2) << t[sx][sy]);
		bool ret = dfs(dep - 1, nexV, sx, sy, i, nexExp);
		if (ret == true) return true;
	}
	return false;
}

int main() {
	// 初期値
	unsigned long long InitV = 0;
	int Initpx, Initpy, Initexp = 0;

	// 入力
	init();
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			unsigned long long pv; cin >> pv;
			InitV += (pv << t[i][j]);
			if (pv != 0) Initexp += dst[i][j][pv];
			if (pv == 0) { Initpx = i; Initpy = j; }
		}
	}
	if (Initexp == 0) {
		cout << "0" << endl;
		return 0;
	}

	// 探索
	for (int i = 1; i <= 80; i++) {
		bool I = dfs(i, InitV, Initpx, Initpy, -1, Initexp);
		if (I == true) { cout << i << endl; break; }
	}
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define rrep(i,n,l) for(int i=n-1;i>=l;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a);
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
//typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

vi v;
int n, l;

int main() {
	while (cin >> n >> l) {
		if (n == 0 && l == 0)break;
		int d[100] = {};
		bool f = 0;
		d[0] = n;
		rep(i,1,21) {
			string s;
			stringstream ss, ss2, ss3;
			ss << n;
			ss >> s;
			while (l>s.size()) {
				s += "0";
			}
			string t1 = s;
			sort(ALL(t1));
			string t2 = t1;
			reverse(ALL(t2));
			int mi, ma;
			ss2 << t1;
			ss2 >> mi;
			ss3 << t2;
			ss3 >> ma;
			n = ma - mi;
			d[i] = n;
			REP(j, i) {
				if (d[i] == d[j]) {
					cout << j << " " << d[i] << " " << i - j << endl;
					f = 1;
					break;
				}
			}
			if (f)break;
		}
	}
}

Measured memory_bytes: 1248
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 100010
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
 
inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}
 
 
int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

int b[20];
int main(){
    //freopen("atlarge.in","r",stdin);
    //freopen("atlarge.out","w",stdout);
    //cout<<setprecision(9)<<fixed;
    int T,j,i,k,ca=0,K,m=0;
    ll n;
    scanf("%lld",&n);
    while(n)b[m++]=n%10,n/=10;
    int ans=(m-1)*9+b[m-1]-1;
    K=1;
    rep(i,0,m-1)K&=(b[i]==9);
    if(K){
        ans=0;
        rep(i,0,m)ans+=b[i];
    }
    printf("%d\n",ans);
    //cerr<<1.*clock()/CLOCKS_PER_SEC<<"ms"<<"\n";
    return 0;
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int r,c;
	while (cin >> r >> c){
		if (!(r | c)) break;
		for (int i=0;i<r;i++){
			for (int j=0;j<c;j++){
				cout << (((i + j)%2 == 0) ? '#' : '.');
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3016
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include <cstring>
#include<bits/stdc++.h>
using namespace std;   
int main()
{
	int a,b,c,x,y,ans=0;
	cin>>a>>b>>c>>x>>y;
	if (a+b>2*c)
	{
		if (x>y)
		{
			ans=ans+y*2*c+(x-y)*a;
		}
		else
		{
			ans=ans+x*2*c+(y-x)*b;
		}
	}
	else
	{
		ans=ans+a*x+b*y;	
	}
	if (c*max(x,y)*2<ans) ans=c*max(x,y)*2;
	cout<<ans<<endl;
	return 0;
} 

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

void solve(long long N, vector<long long> A, vector<long long> B){
    long long ans = 0;
    for(int i = N - 1 ; i >= 0 ; i--){
        A[i] += ans;
        ans +=  (B[i] - A[i] % B[i]) % B[i];
    }
    cout << ans << endl;
}

int main(){    
    long long N;
    scanf("%lld",&N);
    vector<long long> A(N);
    vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, A, B);
    return 0;
}



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

class UnionFind {
private:
  vector<ll> data;

public:
  UnionFind(ll n): data(n, -1) {}

  ll size(ll i) { return -data[find(i)]; }
  bool root(ll i) { return data[i] < 0; }
  bool same(ll i, ll j) { return find(i) == find(j); }

  ll find(ll i) { return root(i) ? i : (data[i] = find(data[i])); }

  bool unite(ll i, ll j) {
    if(same(i, j)) return false;
    data[find(i)] += data[find(j)];
    data[find(j)] = find(i);
    return true;
  }
};

int main(void) {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(M), B(M);
  REP(i, 0, M) cin >> A[i] >> B[i], A[i]--, B[i]--;

  UnionFind uf(N);
  vector<ll> ans(M);
  ll x = N * (N - 1) / 2;
  for (ll i = M - 1; i >= 0; i--) {
    ans[i] = x;
    if (!uf.same(A[i], B[i])) {
      x -= uf.size(A[i]) * uf.size(B[i]);
      uf.unite(A[i], B[i]);
    }
  }

  REP(i, 0, M) cout << ans[i] << endl;
}

Measured memory_bytes: 4480
n = int(input())
a = input().split()
b = []
max = 0
r = (0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200)
for i in range(n):
    if int(a[i]) >= 3200:
        max += 1
    else:
        for j in range(len(r)-1):
            if int(r[j]) <= int(a[i]) < int(r[j+1]):
                b.append(r[j])

min = len(set(b))
print(str(min)+' '+str(min+max) if min != 0 else '1'+' '+str(max))


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long

int main() {
	int N, M; cin >> N >> M;
	vector<int> imos(N+1, 0);
	for(int i=0; i<M; ++i){
	    int l, r;
	    cin >> l >> r;
	    ++imos[l-1];
	    --imos[r];
	}
	int ans=0;
	for(int i=0; i<N; ++i){
	    if(imos[i]==M) ++ans;
	    imos[i+1] += imos[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  int x, a;
  cin >> x >> a;
  if (x < a) {
    cout << "0\n";
  }
  else {
    cout << "10\n";
  }
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
x,y = map(int,input().split())
if 0<=x<=y:
    print(y-x)
elif 0<y<=x:
    print(2+x-y)
elif y==0 and x>=y:
    print(1+x-y)
elif y<=x<0:
    print(2+x-y)
elif y<x==0:
    print(x-y+1)
elif x<y<=0:
    print(y-x)
elif x<0 and y>0:
    if y>=abs(x):
        print(1+y+x)
    else:
        ans = min(-y-x+1,y-x)
        print(ans)
elif y<0 and x>0:
    if abs(y)>=x:
        print(abs(y)-x+1)
    else:
        print(1+y+x)

Measured memory_bytes: 61940
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

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

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

void init()
{
}

void solve()
{
	int x, y;
	cin >> x >> y;

	rep(i, x + 1)
	{
		if (i * 2 + (x - i) * 4 == y)
		{
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main()
{
	init();
	solve();
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i, n)
    {
        cin >> a[i];
        sum = sum ^ a[i];
    }
    rep(i, n)
    {
        cout << (int)(sum ^ a[i]) << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 4052
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ar := []int{}
	for i := 6; i <= n; i *= 6 {
		ar = append(ar, i)
	}
	for i := 9; i <= n; i *= 9 {
		ar = append(ar, i)
	}
	dp := make([]int, n+1)
	for i := range dp {
		dp[i] = i
	}
	for _, v := range ar {
		for i := 0; i+v <= n; i++ {
			if dp[i+v] > dp[i]+1 {
				dp[i+v] = dp[i] + 1
			}
		}
	}
	fmt.Println(dp[n])
}


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

struct str{
  int x;
  int y;
  int h;
};

int main()
{
  int N;
  cin >> N;
  vector<str> v(N);
  rep(i,N){
    int x,y,h;
    cin >> x >> y >> h;
    str w;
    w.x=x;
    w.y=y;
    w.h=h;
    v[i]=w;
  }

  int ans;
  rep(i,101){
    rep(j,101){
      int needH = -1;
      rep(k,N){
        if(v[k].h > 0){
          int q = v[k].h + abs(v[k].x - i) + abs(v[k].y - j);
          if(needH ==-1){
            needH = q;
          }else{
            if(needH != q){
              needH = -2;
              break;
            }
          }
        }
      }
      if(needH==-2)continue;
      rep(k,N){
        if(v[k].h==0){
          int dist = abs(v[k].x - i) + abs(v[k].y - j);
          if(needH > dist){
            needH = -2;
            break;
          }
        }
      }
      if(needH == -2) continue;
      cout << i << " " << j << " " << needH << endl;
      return 0;
    }
  }
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define ceil(a, b) ceil((ld) a / (ld) b);                         // div ceiling
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

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

	ll rl = 0;
	vector<ll> arl(size(s) + 1, 0);
	repr(i, size(s) - 1, -1)
	{
		if (s[i] == '>')
			rl++;
		else
			rl = 0;
		arl[i] = rl;
	}

	ll lr = 0;
	vector<ll> alr(size(s) + 1, 0);
	rep(i, 0, size(s))
	{
		if (s[i] == '<')
			lr++;
		else
			lr = 0;

		alr[i + 1] = lr;
	}

	vector<ll> ans(size(s) + 1, 0);
	rep(i, 0, size(ans))
		ans[i] = max(arl[i], alr[i]);

	cout << accumulate(all(ans), 0LL);
	return 0;
}


Measured memory_bytes: 12548
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

ll nPrS(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--){
        ret *= i;
        ret %= MOD;
    }
    return ret;
}

int main(void){
    int r, g, b;
    cin >> r >> g >> b;
    
    string s = to_string(r) + to_string(g) + to_string(b);

    int n = stoi(s);

    if(n % 4 == 0){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long wmin = 3 * N >> 2;
        if(N % 4 != 0) ++wmin;
        for(long w = wmin; w <= 3500; ++w) {
            for(long n = w; n >= 1; --n) {
                long denominator = 4 * n * w - N * (w + n);
                long numerator = N * n * w;
                if(numerator % denominator != 0) continue;
                long h = numerator / denominator;
                if(h > 0 && h <= n) {
                    System.out.printf("%d %d %d", h, n, w);
                    return;
                }
            }
        }
    }
}


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

int main() {
	int d, t, s;
	cin >> d >> t >> s;

	if(t*s >= d) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

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

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<double> v(N);
    priority_queue<double, vector<double>, greater<double>> que;
    rep(i, N) {
        cin >> v[i];
        que.push(v[i]);
    }

    debug(que.size());
    while ((que.size() != 2)) {
        double f = que.top();
        que.pop();

        double s = que.top();
        que.pop();

        double mix = (f + s) / 2.;
        que.push(mix);
        debug(f, s, mix);
        // debug
        /*
        priority_queue<double, vector<double>, greater<double>> que_d = que;
        while (!que_d.empty()) {
            cout << que_d.top() << endl;
            que_d.pop();
        }
        */
    }

    double f = que.top();
    que.pop();

    double s = que.top();
    que.pop();

    double mix = (f + s) / 2.;
    cout << setprecision(20) << mix << endl;

    return 0;
}


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;

int main() {
    int N, K;
    cin >> N >> K;
    string s;
    cin >> s;
    vector<int> cnts;

    //先頭はかならず'1'であるとする(もし先頭が'0'なら、あらかじめ0個の'1'があるとみなしておく)
    if(s[0] == '0') cnts.push_back(0);
    for(int i=0; i<s.size();) {
        int j = i;
        while(j < s.size() && s[j] == s[i]) j++;
        cnts.push_back(j-i);
        i = j;
    }
    //末尾もかならず'1'であるとする
    if(s[N-1] == '0') cnts.push_back(0);

    vector<int> sums((int)cnts.size()+1, 0);
    for(int i=0; i<(int)cnts.size(); i++) sums[i+1] = sums[i] + cnts[i];
    
    int res = 0;
    for(int i=0; i<sums.size(); i+=2) {
        int r = i + 2*K + 1;
        if(r >= sums.size()) r = (int)sums.size()-1;
        res = max(res, sums[r]-sums[i]);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K,R,S,P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    int ans = 0;
    for(int i = 0;i<N;i++){
        if(K <= i && T.at(i) == T.at(i - K)) T.at(i) = 0;
        if(T.at(i) == 's')ans += R;
        if(T.at(i) == 'p')ans += S;
        if(T.at(i) == 'r')ans += P;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <string>
#include <iostream>

using namespace std;

class Solution {
public:
    int maxHappyness(int money) {
        return (money / 500) * 1000 + (money % 500) / 5 * 5;
    }
};

int main() {
    Solution so;
    int money = 0;
    cin >> money;
    cout << so.maxHappyness(money) << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<ll,int>
#define pip pair<int,pii>
#define ppi pair<pii,int> 
#define ppp pair<pii,pii>
#define pb push_back
#define ppb pop_back
#define pf push_fron
#define ppf pop_front
#define N 200003
#define inf (ll)(1e9+11)
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll mod=1e9+7;

bool ispalin(string s)
{
    int n=s.size(),i,j;
    j=n-1,i=0;
    while(i<j)
    {
        if(s[i]!=s[j])
            break;
        ++i, --j;
    }
    return i>=j;
}

signed main()
{
    warmup
    
    string s;
    cin>>s;
    int n=s.size();
    cout<<((ispalin(s) and ispalin(s.substr(0,n/2)) and ispalin(s.substr(n+1>>1,n/2))) ? "Yes":"No");
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#define rep(i,n) for(int i = 0;i < (n); ++i)
using namespace std;

typedef long long LL;
typedef long double LD;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    string s;
    cin >> n >> s;
    LL red = 0, green = 0, blue = 0; 
    for(int i = 0;i < n; i++){
        if(s[i] == 'R')red++;
        else if(s[i] == 'G')green++;
        else if(s[i] == 'B')blue++;
    }
    LL ans = red * green * blue;
    int k;
    for(int i = 1; i <= n; i++){
        for(int k = i + 2; k <= n; k += 2){
            int j = (i + k) / 2;
            if(s[i - 1] + s[j - 1] + s[k -1 ]  == 'R' + 'G' + 'B'){
                ans--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int x, y;
    cin >> x >> y;
    REP(a,x+1){
        int s = 2 * a + 4 * (x - a);
        if (s == y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632