akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = 1e9 + 7;
const int MX = (int)2e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

void pre(){
}	

void solve(){
	ll x, k, d;
	cin >> x >> k >> d;
	ll dist = abs(x);

	ll res = 9e18;

	// if(k == 1)
	// 	res = abs(dist - d);
	// else{
		// if(k % 2 == 0)
		// 	res = min(res, dist); // maybe this is okay?
		ll steps_to_origin = min(k, dist / d);
		ll rem = k - steps_to_origin;
		if(rem & 1)
			res = min(res, abs(dist - (steps_to_origin + 1) * d)); // try taking one more step, now u should cross the origin to the other side
		else
			res = min(res, abs(dist - steps_to_origin * d));
	// }
	
	cout << res << "\n";
}

int main(){

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

	// freopen("input.in", "r", stdin);
	// freopen("output.out", "w", stdout);

	int t;
	t = 1;
	// cin >> t;
	// pre();
	for(int i = 1; i <= t; ++i){
		// cout << "Case #" << i << ": \n";
		solve();
	}

	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rp(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main(void){
  int n; cin >>n;
  char s[n];
  rp(i,n){
    cin >> s[i];
  }
  int ans = 0;
  for(int i = 1; i < n-1; i++){
    if(s[i-1] == 'A' && s[i] == 'B' && s[i+1] == 'C'){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque
N=int(input())
mod=100010
visit=[0]*(2*mod)
table=[[] for i in range(2*mod)]
for i in range(N):
    x,y=map(int,input().split())
    y+=mod
    visit[x]=1
    visit[y]=1
    table[x].append(y)
    table[y].append(x)
H=deque()
num=0
for i in range(mod):
    if visit[i]==1:
        X=0
        Y=0
        H.append(i)
        visit[i]=0
        while H:
            pt=H.popleft()
            if pt>mod:
                Y+=1
            else:
                X+=1
            for x in table[pt]:
                if visit[x]==1:
                    visit[x]=0
                    H.append(x)
        #print(X,Y)
        num+=X*Y
print(num-N)

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

int main() {
	int N, T;
	cin >> N >> T;
	int MIN = pow(10, 9) + 1, benefit=0, num=0;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		MIN = min(MIN, A);
		if (benefit < A - MIN) {
			benefit = A - MIN;
			num = 1;
		}
		else if (benefit == A - MIN) {
			num++;
		}
	}
	cout << num << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
//関数
void display(long p,vector<bool> used){
    cout<<p+1<<"で起動し、残り";
    for(int i=0;i<used.size();i++){
        if(used.at(i)) cout<<" ";
        else cout<<i+1;
    }
    cout<<endl;
}
 
void bfs(vector<long> &ans,vector<vector<pair<long,long>>> &graph, vector<bool> &used,long p){
    //display(p,used);
    used.at(p)=true;
    for(int i=0;i<graph.at(p).size();i++){
        //cout<<"#"<<endl;
        long q=graph.at(p).at(i).first;
        if(!used.at(q)){
            ans.at(q)=(ans.at(p)+graph.at(p).at(i).second)%2;
            bfs(ans,graph,used,q);
        }
    }
}
 
 
int main() {
    //入力
    long N;
    cin>>N;
    vector<vector<pair<long,long>>> graph(N,vector<pair<long,long>>(0));
    for(int i=0;i<N;i++){
        long u,v,w;
        cin>>u>>v>>w;
        graph.at(u-1).push_back(make_pair(v-1,w));
        graph.at(v-1).push_back(make_pair(u-1,w));
    }
    //計算
    vector<long> ans(N,0);
    vector<bool> used(N,false);
    bfs(ans,graph,used,0);
    //出力
    for(int i=0;i<N;i++){
        cout<<ans.at(i)<<endl;
    }
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a[200005];
    cin>>n;
    for(int i=0;i<=n-1;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n-1;i++)
    {
    	if(a[i]==a[i+1])
    	{
    		cout << "NO";
    		return 0;
		}
	}
	cout << "YES";
	return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

template<typename T> ostream& operator << (ostream& r, const vector<T> t){vrep(v,t)r<<*v<<(v+1==t.end()?"":" ");return r;}
template<typename T> ostream& operator << (ostream& r, const pair<vector<T>, int> p){int n=p.second;minup(n,p.first.size());rep(i,n-1)r<<p.first[i]<<' ';r<<p.first[n-1];return r;}
template<typename T> ostream& operator << (ostream& r, const pair<T*, int> p){int n=p.second-1;rep(i,n)r<<p.first[i]<<' ';return r<<p.first[n];}
template<typename T, size_t S> ostream& operator << (ostream& r, const T (&a)[S]){rep(i,S-1)r<<a[i]<<' ';return r<<a[S-1];}

const int MAX_N = 12;
int n;

bool check(vi& S, vi& P)
{
  int n = S.size();
  map<int, int> freq;
  rep(i, n) freq[S[i]] += 1;
  rep(i, n) P[i] = freq[S[i]];

  bool ok = true;
  rep(i, n) if(S[i] != P[i]) ok = false;
  S = P;
  return ok;
}

int main()
{
  while(~scanf(" %d", &n) && n){
    vi S(n);
    vi P(n);
    int res = 0;
    rep(i, n) scanf(" %d", &S[i]);
    while(!check(S, P)) res += 1;
    printf("%d\n", res);
    cout << P << endl;
  }

  return 0;
}

Measured memory_bytes: 1264
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; i++){
        cin >> p[i];
    }
    int ans=0;
    for(int i=1; i<n-1; i++){
        if(p[i-1]-p[i]>0 && p[i+1]-p[i]<0) ans++;
        else if(p[i-1]-p[i]<0 && p[i+1]-p[i]>0) ans++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, Z, W;
    cin >> N >> Z >> W;
    ll a[2010];
    rep(i,0,N) cin >> a[i];
    ll ans = 0;
    if(N == 1){
        ans = abs(a[0] - W);
    }else{
        ans = max(abs(a[N-1]-W), abs(a[N-1] - a[N-2]));
    }
    print(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
int n,k,tengah=0,nol=0;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		if(i%k==0)
			nol++;
		if(i%k==k/2)
			tengah++;
	}
	//cout<<nol<<" "<<tengah<<endl;
	LL ans = (LL) nol * (LL) nol * (LL) nol;
	if(!(k&1))
		ans = ans + (LL) tengah * (LL) tengah * (LL) tengah;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
//  RAKSHIT KADAM

 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000000
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
// ll fact[1000005];
//void facto()
//{
//    ll lim =1000005;fact[0]=1;
//    for(ll i=1;i<lim;i++)
//    {
//        fact[i]=(fact[i-1]*i)%MOD;
//    }
//}
//ll ncr(ll a,ll b)
//{
//    ll ret = 0;
//    ret = fact[a]*(modInverse(fact[b],MOD));
//    ret%=MOD;
//    ret*=modInverse(fact[a-b],MOD);
//    ret%=MOD;
//    return ret;
//}

   
void solve()
{
    ll n;cin>>n;
    vector< pair<pii,int > > v;
    for(ll i=0;i<(n<<1);i++)
    {
        ll a,b;cin>>a>>b;
        v.pb(mp(mp(a,b),i>=n));
    }
    sort(v.begin(),v.end());
    multiset<ll>m;
    for(ll i=0;i<2*n;i++)
    {
        
        if(v[i].y)
        {
            auto it = m.lower_bound(v[i].x.y);
            if(it==m.begin())continue;
            it--;
            m.erase(it);
        }
        else
        {
            m.insert(v[i].x.y);
        }
    }
    
    cout<<n-m.size()<<endl;
}
signed main()
{
   Need_for_speed(activated);
//satisfy
//    {
//  solve();
//   }
    solve();
    
    return 0;
}
//Concentrate while implementing,,,!!!
 


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, k, b = 0; cin >> n >> k;
	int a[123456];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int h = n - 1; h >= n - k; h--) {
		b += a[h];
	}
	cout << b << endl;
}

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


void dfs(int v, vector <bool>& used, vector <vector <int>>& g, vector <int>& order) {
	used[v] = 1;
	for (int to: g[v])
		if (!used[to])
			dfs(to, used, g, order);
	order.push_back(v);
	
}


double getProbability(vector <double>& p, int n) {
	vector <vector <double>> dp(n + 1, vector <double>(n + 1, 0));
	double pr = 1.0;
	for (int i = 1; i <= n; ++i) {
		pr *= (1 - p[i - 1]);
		dp[i][0] = pr;
	}
	dp[1][1] = p[0];
	
	for (int i = 2; i <= n; ++i) {
		// cout << i << endl;
		for (int k = 1; k <= i; ++k) {
			// cout << k << " " << dp[i - 1][k - 1] << " " << dp[i - 1][k] << "endl;\n";
			dp[i][k] = dp[i - 1][k - 1]*p[i - 1] +
	dp[i - 1][k]*(1 - p[i - 1]);
		// cout << dp[i][k] << endl;
		
		}
	}
double ans = 0;
for (int i = n; i > n/2; --i)
	ans += dp[n][i];
return ans;
}


int main() {
	int n, m;
	double a, b;
	vector <double> p; 
	cin >> n;
	for(int i = 0; i < n; ++i)
		cin >> a, p.push_back(a);
	printf("%.10f", getProbability(p, n));
	return 0;
}

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

struct point{
	int x,y;
	point(int x = 0,int y = 0):x(x),y(y){
	}
//	bool operator<(const point &p){ return (x < p.x || (x = p.x && y < p.y)); }
};

bool comp(const point &a, const point &b){
    return a.x < b.x;
}
int cnm[100010];
int cnm1[100010];
vector<point> v[100010];
int main()
{
	int n,m;
	cin >> n >> m;
	for(int  i = 1; i <= m; i++){
		int x,y;
		cin >> x >> y;
		cnm1[i] = x;
		v[x].push_back(point(y,i));
	}
	for(int i = 1; i <= n; i++){
		sort(v[i].begin(),v[i].end(),comp);
//		cout << "size = " << v[i].size() <<endl;
		for(int j = 0; j < v[i].size(); j++){
//			cout << v[i][j].x << " " << v[i][j].y << endl;
			cnm[v[i][j].y] = j + 1;
		}
//		cout << endl;
	}
	for(int i = 1; i <= m; i++){
		printf("%06d%06d\n",cnm1[i],cnm[i]);
	}
	return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

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

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

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

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

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

int cnt[26];

signed main() {
  int n = read();
  REP(i, 26) cnt[i] = LONG_MAX;
  REP(i, n) {
    int scnt[26];
    REP(i, 26) scnt[i] = 0;
    string s = readString();
    for (auto &c : s)
      scnt[c - 'a'] += 1;
    for (int j = 0; j < 26; j++)
      chmin(cnt[j], scnt[j]);
  }
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < cnt[i]; j++)
      std::cout << (char)('a' + i);
}

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

#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
void input(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

void swap(int& a, int& b){
	int t=a;
	a = b;
	b = t;
}


void solveTest(){
	int n,m,x;
	cin>>n>>m>>x;
	int less=0;
	int great=0;
	for(int i=0;i<m;i++){
		int a; cin>>a;
		if(x>a){
			less++;
		}
		else great++;
	}
	cout<<min(great,less)<<endl;
	return ;
}

int main(){
	fastio();
	//input();

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

	}
	
	return 0;
}


Measured memory_bytes: 384
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
 
void main() {
    auto s = readln.split;
    char c = (s[0] == s[1]) ? '=' : (s[0] < s[1] ? '<' : '>');
    writefln("%s", c);
}

Measured memory_bytes: 256
#include<stdio.h>
main(){double w;while(scanf("%lf",&w)!=EOF){puts(w<=48?"light fly":w<=51?"fly":w<=54?"bantam":w<=57?"feather":w<=60?"light":w<=64?"light welter":w<=69?"welter":w<=75?"light middle":w<=81?"middle":w<=91?"light heavy":"heavy");}return 0;}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX 10000
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

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

  map<int, int> mp;
  rep(n){
	int tmp;
	scanf("%d", &tmp);
	mp[tmp]++;
  }

  bool odd = (n % 2 == 1);
  ll ans = 1;
  rep(n){
	if(i == 0){
	  if(((!odd && mp[i] > 0) || (odd && mp[i] != 1))){
		printf("%d", 0);
		return  0;
	  }
	}else if(i % 2 == 1){
	  if(odd && mp[i] > 0){
		printf("%d", 0);
		return  0;
	  }
	  if(!odd){
		if(mp[i] == 2){
		  ans *= 2;
		  if(ans > MOD) ans %= MOD;
		}else{
		  printf("%d", 0);
		  return  0;
		}
	  }
	}else{
	  if(!odd && mp[i] > 0){
		printf("%d", 0);
		return  0;
	  }
	  if(odd){
		if(mp[i] == 2){
		  ans *= 2;
		  if(ans > MOD) ans %= MOD;
		}else{
		  printf("%d", 0);
		  return  0;
		}
	  }
	}

  }

  printf("%lld", ans);
  return 0;
}


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

using namespace std;

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i)
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i)

#define DEBUG(...) fprintf(stderr , __VA_ARGS__)

template<typename T>inline int chkmin(T &x , const T &y){ return x > y ? x = y , 1 : 0; }
template<typename T>inline int chkmax(T &x , const T &y){ return x < y ? x = y , 1 : 0; }

template<typename T>inline T read(T &f)
{
	f = 0 ; int x = 1 ; char c = getchar();
	while(!isdigit(c)) x = c == '-' ? -1 : 1 , c = getchar();
	while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
	return f *= x;
}

using int64 = long long;
using uint64 = unsigned long long;

int64 S;

struct Node
{
	int64 x , y;
	int64 operator *(const Node &rhx) const
	{
		// if(abs(x * rhx.y - y * rhx.x) % 2 == 1) puts("-1");
		return abs(x * rhx.y - y * rhx.x) / 2;
	}
} X , Y;

int main()
{
	read(S);
	if(S <= 1000000000)
	{
		cout << "0 0 " << "0 " << S << " 1 0 " << endl;
		X = {0 , S};
		Y = {1 , 0};
	}
	else // (x , y) * (a , b) = S
	{
		cout << "0 0 ";
		int64 x = 1000000000;
		if(S % x == 0)
		{
			int64 d = S / x;
			cout << x << " 0 0 " << d << endl;
		}
		else
		{
			int64 b = S / x + 1;
			int64 a = 1;
			int64 y = x * b - S;
			cout << x << ' ' << y << ' ' << a << ' ' << b << endl;
		}
	}
	// cerr << X * Y << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+10;
void solve(){
    int n=0,m=0;
    string s;
    cin>>s;
    for (int i = 0; i < 3; ++i) {
        if (s[i]=='R') n++;
        else n=0;
        if (m<n)m=n;
    }
    cout<<m<<endl;
}
int main(){
    int _=1;
    while(_--){
        solve();
    }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>P(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  vector<int>ans(N);
  for(int i=0;i<N;i++){
    ans.at(i)=i+1;
  }
  int count=0;
  for(int i=0;i<N;i++){
    if(ans.at(i)!=P.at(i)){
      count++;
    }
  }
  if(count<=2){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector< pair<int,int> > red(N), blue(N);
    for(int i=0; i<N; i++) {
        cin >> red[i].first >> red[i].second;
    }
    for(int i=0; i<N; i++) {
        cin >> blue[i].second >> blue[i].first;
    }

    sort(red.begin(), red.end());
    sort(blue.begin(), blue.end());

    vector<int> used(N);
    for(int i=N-1; i>=0; i--) {
        for(int j=0; j<N; j++) {
            if(!used[j] && red[i].first < blue[j].second && red[i].second < blue[j].first) {
                used[j] = 1;
                break;
            }
        }
    }

    cout << count(used.begin(), used.end(), 1) << endl;
    return 0;
}


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

for sen in range(n + 1):
    for gosen in range(n + 1 - sen):
        ichiman = n - sen - gosen
        if ichiman * 10000 + gosen * 5000 + sen * 1000 == y:
            print(ichiman, gosen, sen)
            exit()

print("-1 -1 -1")


Measured memory_bytes: 2940
s=list(input())
c = 0
humi = 0
for i in s:
    if c%2 == 0:
        if i == 'L':
            humi = 1
            break
    if c%2 == 1:
        if i == 'R':
            humi = 1
            break
    c += 1
print('Yes' if humi == 0 else 'No')

Measured memory_bytes: 38424
#b問題
n=int(input())
ans=1
a=list(int(y) for y in input().split())
# print(a)
if 0 in a:
    print(0)
else:
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            ans=-1
            break
    print(ans)

Measured memory_bytes: 21572
#include<cstdio>
#define F(i,a) for(int i=0;i<a;++i)
int n,N,D1,D2;
int i1[600],j1[600],t1;
int i2[600],j2[600],t2;
bool v1[600][600], v2[600][600];
bool c1[600][600], c2[600][600];
int s[4];
void DFS1(int x,int y,bool c){
	if(x<0||y<0||x>=N||y>=N) return;
	if(v1[x][y]) return;
	v1[x][y]=1, c1[x][y]=c;
	F(k,t1){
		DFS1(x+i1[k],y+j1[k],!c);
		DFS1(x+i1[k],y-j1[k],!c);
		DFS1(x-i1[k],y+j1[k],!c);
		DFS1(x-i1[k],y-j1[k],!c);
	}
}
void DFS2(int x,int y,bool c){
	if(x<0||y<0||x>=N||y>=N) return;
	if(v2[x][y]) return;
	v2[x][y]=1, c2[x][y]=c;
	F(k,t2){
		DFS2(x+i2[k],y+j2[k],!c);
		DFS2(x+i2[k],y-j2[k],!c);
		DFS2(x-i2[k],y+j2[k],!c);
		DFS2(x-i2[k],y-j2[k],!c);
	}
}
int main(){
	scanf("%d%d%d",&n,&D1,&D2); N=n+n;
	F(i,N) if(i*i<=D1)
		F(j,N) if(i*i+j*j==D1)
			i1[t1]=i, j1[t1]=j, t1++;
	F(i,N) if(i*i<=D2)
		F(j,N) if(i*i+j*j==D2)
			i2[t2]=i, j2[t2]=j, t2++;
	F(i,N) F(j,N) DFS1(i,j,0);
	F(i,N) F(j,N) DFS2(i,j,0);
	F(i,N) F(j,N)
		++s[c1[i][j]*2+c2[i][j]];
	F(k,4) if(s[k]>=n*n){
		int cnt=0;
		F(i,N) F(j,N) if(c1[i][j]*2+c2[i][j]==k&&cnt<n*n)
			++cnt, printf("%d %d\n",i,j);
		return 0;
	}
}// contest

Measured memory_bytes: 19072
N=int(input())
P=list(map(int, input().split()))
X=[0]+list(map(int, input().split()))
ko=[[] for _ in range(N+1)]
for i, p in enumerate(P, 2):
  ko[p].append(i)
  
def f(p):
  n=len(ko[p])
  if n==0:
    return X[p], 0
  
  dp=[[float('inf')]*(X[p]+1) for _ in range(n+1)]
  dp[0][0]=0
  for i, c in enumerate(ko[p], 1):
    a, b=f(c)
    for j in range(a, X[p]+1):
      dp[i][j]=min(dp[i][j], dp[i-1][j-a]+b)
    for j in range(b, X[p]+1):
      dp[i][j]=min(dp[i][j], dp[i-1][j-b]+a)
      
  out=min(dp[-1])
  if out==float('inf'):
    print('IMPOSSIBLE')
    exit()
  elif out>X[p]:
    return out, X[p]
  else:
    return X[p], out
  
print('POSSIBLE') if min(f(1))<=X[1] else print('IMPOSSIBLE')

Measured memory_bytes: 97968
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>

#include <iomanip>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
// #define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const ll INF = 1e17;
// ll dp[100005][13];
ll dp[10005];

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

signed main(void) {
  ll N, M;
  cin >> N >> M;
  ll num[N];
  ll ans = 0;
  rep(i, N) {
    num[i] = -1;
  }
  rep(i, M) {
    int s, c;
    cin >> s >> c;
    if (num[N-s] == -1) {
      num[N-s] = c;
    } else {
      if (num[N-s] != c) {
        ans = -1;
      }
    }
  }

  if (ans != -1) {
    ll base = 1;
    rep(i, N) {
      if (i == N-1) {
        if (num[i] > 0) {
          ans += base * num[i];
        } else if (num[i] == 0) {
          if (N==1) {
            ans = 0;
          } else {
            ans = -1;
            break;
          }
        } else {
          if (N == 1) {
            ans = 0;
          } else {
            ans += base;
          }
        }
      } else {
        if (num[i] != -1) {
          ans += base * num[i];
        }
      }
      base *= 10;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
// this line is here for a reason
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define ft front()
#define bk back()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t>
bool ckmin(t& a, const t& b) {
  return a > b ? a = b, true : false;
}
template <class t>
bool ckmax(t& a, const t& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T>
struct IsC {
  template <class C>
  static char test(typename C::const_iterator*);
  template <class C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <class C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '{';
  for (auto it = c.begin(); it != c.end();)
    o << *it << (++it != c.end() ? ", " : "}");
  return o;
}
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p) {
  return o << '(' << p.fi << ", " << p.se << ')';
}

const ll ninf = -1e17;

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

    int n, w;
    cin >> n >> w;

    vector<ll> wgt(n), val(n);
    F0R(i, n) cin >> wgt[i] >> val[i];

    vector<vector<ll>> dp(w + 1, vector<ll>(n, ninf));

    fill(ALL(dp[0]), 0);
    FOR(r, 1, w + 1) {
        F0R(c, n) {
            if(!c) {
                if(wgt[0] == r)
                    dp[r][0] = val[0];
            } else {
                dp[r][c] = max(dp[r][c - 1], 
                               r - wgt[c] < 0 ? ninf : dp[r - wgt[c]][c - 1] + val[c]);
            }
        }
    }

    ll res = 0;
    F0R(i, w + 1)
        ckmax(res, dp[i][n - 1]);
    cout << res << endl;
}



Measured memory_bytes: 82304
H,W=gets.split.map &:to_i;W+=1;B=$<.map(&:chop)*?#+?#*W;*Q=i=0;d=B.count ?.;p((loop{(d-=1;i+=Q.size)if-1==i-=1;break d if H*W==2+k=Q.shift;[-W,-1,W,1].map{|l|l+=k;(B[l]==B[l]=?#)||Q<<l}}rescue-1))

Measured memory_bytes: 3836
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	int p[200020];
	for(int i=0; i<n; i++){
		cin>>p[i];
	}
	int mn=n+1;
	int ans=0;
	for(int i=0; i<n; i++){
		mn=min(mn, p[i]);
		if(mn>=p[i]) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int n,m;
int p[100001], deg[100001];
vector<int> AdjList[100001];

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

	cin >> n >> m;
	for (int i=1;i<=n-1+m;i++)
	{
		int u,v;
		cin >> u >> v;
		AdjList[u].push_back(v);
		deg[v]++;	
	}
	queue<int> q;
	for (int i=1;i<=n;i++)
		if (!deg[i])
		{
			q.push(i);
			break;
		}
	while(!q.empty())
	{
		int u = q.front();
		q.pop();
		for (int i=0;i<AdjList[u].size();i++)
		{
			int v = AdjList[u][i];
			deg[v]--;
			if (!deg[v])
			{
				p[v] = u;
				q.push(v);
			}
		}
	}
	for (int i=1;i<=n;i++)
		cout << p[i] << '\n';
}

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

using namespace std;

int main(){
	if(fopen("1.inp", "r")){
		freopen("1.inp", "r", stdin);
	}

	int n, a, b;
	cin >> n >> a >> b;


	if(a%2!=b%2){
		cout << "Borys";
	}
	else cout << "Alice";

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var S, T []byte
	fmt.Scan(&S, &T)
	var ok, done bool
	for i := len(S) - 1; i >= 0; i-- {
		for j := i; j >= 0; j-- {
			ok = true
			t := S[j : i+1]
			if len(string(S[j:i+1])) == len(string(T)) {
				for k := 0; k < len(t); k++ {
					if T[k] != t[k] && t[k] != '?' {
						ok = false
						break
					}
				}
			} else {
				ok = false
			}
			if ok {
				copy(S[j:j+len(T)], T)
				done = true
			}
		}
		if done {
			break
		}
	}
	if !done {
		fmt.Println("UNRESTORABLE")
	} else {
		fmt.Println(strings.Replace(string(S), "?", "a", -1))
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  string s, answer = "";  
  cin >> s;
 
  int a = s.size();
  for (int i = 1; i <= a; i++) {
    if (i%2 == 1) {
      answer = answer + s[i-1];
    }
  }
  
  cout << answer << endl;
}

Measured memory_bytes: 640
package main

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

func main() {
	n, s := readInt(), readString()
	if s[:n/2] == s[n/2:] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

VI r[200100];
int n,m;

bool bfs() {
	vector<vector<int> > dd(5, vector<int>(n, 0));
	queue< pii > que;
	que.push(pii(0,0)); dd[0][0]=1;
	
	while(!que.empty()){
		int cy,cx; tie(cy,cx) = que.front();
		que.pop();
		for(auto x: r[cx]){
			if(cy>=2 || dd[cy+1][x]) continue;
			que.push( pii(cy+1, x) );
			dd[cy+1][x] = 1;
			if(x==n-1) return true;
		}
	}
	//rep(i,3){ rep(j,n) cout << dd[i][j] <<" "; puts("");}
	return false;
}


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	cin >>n >>m;
	rep(i,m){
		int a,b;
		cin >>a >>b;
		r[a-1].push_back(b-1);
	}
	
	auto ok=bfs();
	cout <<(ok? "POSSIBLE\n": "IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 13184
#include <stdio.h>
int main(void){
    int n, k;
    scanf("%d%d", &n, &k);
    int d;
    int snk[n + 1];
    for(int i = 0; i < n + 1; i++){
        snk[i] = 0;
    }

    for(int i = 0; i < k; i++){
        scanf("%d", &d);
        for(int j = 0; j < d; j++){
            int a;
            scanf("%d", &a);
            snk[a]++;
        }
    }

    int count = 0;
    for(int i = 1; i < n + 1; i++){
        if(snk[i] == 0){
            count++;
        }
    }

    printf("%d", count);
    return 0;
}

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

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 2e7 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 1e4 + 17;

int a, b, c, d, n;

bool read() {
    if (scanf("%d %d %d %d %d", &a, &b, &c, &d, &n) != 5)
        return false;

    return true;
}

void solve() {
    b = min(b, 2 * a);
    c = min(c, min(4 * a, 2 * b));
    d = min(d, min(8 * a, min(4 * b, 2 * c)));
    ll ans = 1ll * d * (n / 2) + c * (n % 2);
    printf("%lld\n", ans);
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define MAX 10100
#define SMAX 50200

int linear_search(int a, int b[],int n);
void input(int a[]);

int main(void)
{
    int count=0;
    int n[1];
    int q[1];
    int S[MAX];
    int T[MAX];
    input(n);
    input(S);    
    input(q);
    input(T);
    for(int i=0;i<q[0];i++)
    {
        if(linear_search(T[i],S,n[0])){count++;}
    }
    printf("%d\n",count);


    return 0;
    
}

int linear_search(int a, int b[],int n)
{
    for(int i=0;i<n;i++)
    {
        if(a == b[i]){return 1;}
        
    }
    return  0;
}
void input(int a[])
{
    char str[SMAX];
    int x;
    int j=0;
    fgets(str,SMAX,stdin);
    int i=0;
    while(str[i]>=' ')
    {
        while(isspace(str[i])){i++;}
        if(isdigit(str[i]))
        {
            x=0;
            while(isdigit(str[i]))
            {
                x=10*x+(str[i]-'0');
                i++;
            }
            a[j]=x;
            j++;
        }
        else
        {
            i++;
        }
    }
}


Measured memory_bytes: 2104
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		List<Long> a = new ArrayList<>();
		List<Long> b = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				a.add(in.nextLong());
			} else {
				b.add(in.nextLong());
			}
		}
		if (n % 2 == 0) {
			Collections.reverse(b);
			for (int i = 0; i < b.size(); i++) {
				System.out.println(b.get(i));
			}
			for (int i = 0; i < a.size(); i++) {
				System.out.println(a.get(i));
			}
		} else {
			Collections.reverse(a);
			for (int i = 0; i < a.size(); i++) {
				System.out.println(a.get(i));
			}
			for (int i = 0; i < b.size(); i++) {
				System.out.println(b.get(i));
			}
		}
		in.close();
	}
}

Measured memory_bytes: 96748
import java.util.Scanner;

/**
 * Created by Manabu on 8/16/19.
 */
public class Main {

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

        int N, A, B;

        N = scanner.nextInt();
        A = scanner.nextInt();
        B = scanner.nextInt();

        //helper(0, A, B, C, X);

        int result = 0;

        for (int i = 1; i <= N; i++) {
            int sum = digitSum(i);
            if (sum >= A && sum <= B) {
                result += i;
            }
        }

        System.out.println(result);
    }

    private static int digitSum(int num) {
        int sum = 0;

        while (num > 0) {
            sum += (num % 10);
            num /= 10;
        }

        return sum;
    }
}

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

using namespace std;

int main() {

  int N;
  cin >> N;

  int ret = 0;
  bool luz = true;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    luz &= x % 2 == 0;
    ret ^= x;
  }
  if(ret == 1 || (luz && ret == 0)) cout << "Bob\n";
  else cout << "Alice\n";
}



Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, a[100000];
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> a[i];

    sort(a, a+n);
    reverse(a, a+n);

    long long ans = 1;
    int cnt = 0;
    for(int i=0; i<n-1; i++){
        if(a[i] == a[i+1]) {
            ans *= a[i];
            i++;
            cnt++;
        }
        if(cnt == 2) break;
    }

    cout << (cnt ? ans : 0) << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<" L-B-W-- "<<x<<" --N-B\n"
#define pb push_back
//#define pii pair<int,int>
#define vii vector<int>
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")
#define sz(x) ((int)(x).size())
#define sf(x) (sizeof(x))
using namespace std;
typedef long long ll;
typedef double db;
const double pai = acos(-1.0);
const double eps = 1e-8;
//const int mod=998244353;
const int mod=2019;
//const int mod=1e9+7;
const int inf=1e9+7;
//const ll inf=0x7f7f7f7f1234abcd;
const int maxn=2e5+10;
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;x=x*x%mod; y>>=1;} return res; }
inline ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}
ll lcm(ll a, ll b) { return a * b / __gcd(a, b); }

int t,n,m,k;
char a[maxn];
int dp[2100];
int d[maxn];
int main(){
    d[1]=1;
    rep(i,2,maxn) d[i]=d[i-1]*10%2019;
    scanf("%s",a+1);
    int s=strlen(a+1),ss=0;
    dp[0]++;
    ll sum=0;
    rep(i,1,s){
        ss=d[s-i+1]*(a[i]-'0')+ss;
        ss%=2019;
        sum+=dp[ss];
        dp[ss]++;
    }
    printf("%lld\n",sum);









    return 0;
}


Measured memory_bytes: 4696
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main()
{
	ll h, w, n;
	cin >> h >> w >> n;
	map<pair<ll, ll>, ll> res;
	rep(i,n){
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		rep2(j,-1,2){
			rep2(k,-1,2){
				if(a+j > 0 && a+j < h - 1 && b + k > 0 && b + k < w - 1){
					// cout << i << ":" << a + j << " " << b + k << endl;
					pair<ll, ll> t(a+j, b+k);
					res[t]++;
				}

			}
		}
	}
	vector<ll> ans(10, 0);
	for (auto x:res){ 
		ans[x.second]++;
	}
	ll s = accumulate(all(ans), 0);
	ans[0] = (h-2)*(w-2)-s;
	rep(i, 10) cout << ans[i] << endl;
	

	return 0;
}

Measured memory_bytes: 59792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (r[0] + r[1] > r[2] + r[3])
            {
                Console.WriteLine("Left");
            }
            else if (r[0] + r[1] < r[2] + r[3])
            {
                Console.WriteLine("Right");
            }
            else
            {
                Console.WriteLine("Balanced");
            }
        }
    }
}

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

using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
int dp[105][4][2];
long long INF = 1LL<<60;
int main(){
    string s;
    int k;
    cin>>s>>k;
    int n=s.size();
    dp[0][0][0]=1;
    rep(i,n)rep(j,4)rep(l,2){
        int d=s[i]-'0';
        rep(nd,10){
            int ni=i+1,nj=j,nl=l;
            if(nd!=0)nj++;
            if(nj>k)continue;
            if(nl==0){
                if(d<nd)continue;
                else if(d>nd)nl=1;
            }
            dp[ni][nj][nl]+=dp[i][j][l];
        }
    }
    int ans=dp[n][k][0]+dp[n][k][1];
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			if(n==0)
				return;
			Point p[]=new Point[n];
			Point q[]=new Point[n*2];
			for(int i=0;i<n;i++)
			{
				String st[]=in.next().split(",");
				p[i]=new Point(Double.valueOf(st[0]), Double.valueOf(st[1]));
			}
			
			Arrays.sort(p,new PointComparator());
			
			int k=0;
			for(int i=0;i<n;i++)
			{
				while(k>1 && cross(q[k-1].x-q[k-2].x, q[k-1].y-q[k-2].y , p[i].x-q[k-1].x, p[i].y-q[k-1].y)<=0)
						k--;
				q[k++]=p[i];
			}
			
			for(int i=n-2,t=k;i>=0;i--)
			{
				while(k>t && cross(q[k-1].x-q[k-2].x, q[k-1].y-q[k-2].y , p[i].x-q[k-1].x, p[i].y-q[k-1].y)<=0)
						k--;
				q[k++]=p[i];
			}
			System.out.println(n-k+1);
		}
	}
	
	static public void debug(Object... o)
	{
		System.err.println(Arrays.deepToString(o));
	}
	
	static double cross(double x1,double y1, double x2,double y2)
	{
		return x1*y2-y1*x2;
	}
}

class Point
{
	double x;
	double y;
	Point(double x,double y)
	{
		this.x=x;
		this.y=y;
	}
}

class PointComparator implements Comparator<Point>
{
	public int compare(Point p1,Point p2)
	{
		double cmp=p1.x-p2.x;
		if(cmp==0)
			cmp=p1.y-p2.y;
		if(cmp<0)
			cmp=-1;
		else
			cmp=1;
		return (int) cmp;
	}
}

Measured memory_bytes: 17292
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

void Main()
{
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> d(n);

    rep(i, n - 1)
    {
        d[i] = a[i + 1] - a[i];
    }
    d[n - 1] = a[0] + (k - a[n - 1]);

    int max = *max_element(all(d));

    cout << (k - max) << endl;

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1792