akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	int n, k, r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	map<char, int> point;
	point['r'] = r;
	point['s'] = s;
	point['p'] = p;

	V<char> hand(n);
	int ans = 0;

	REP(i, n) {
		if (t[i] == 'r') {
			char h = 'p';
			hand[i] = h;
			if (i >= k) {
				if (hand[i - k] != h) {
					ans += point[h];
				}
				else {
					hand[i] = '.';
				}
			}
			else {
				ans += point[h];
			}
		}
		else if (t[i] == 's') {
			char h = 'r';
			hand[i] = h;
			if (i >= k) {
				if (hand[i - k] != h) {
					ans += point[h];
				}
				else {
					hand[i] = '.';
				}
			}
			else {
				ans += point[h];
			}
		}
		else {
			char h = 's';
			hand[i] = h;
			if (i >= k) {
				if (hand[i - k] != h) {
					ans += point[h];
				}
				else {
					hand[i] = '.';
				}
			}
			else {
				ans += point[h];
			}
		}
	}
	col(ans);
	return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    set<string> s;
    rep(i, n){
        string si;
        cin >> si;
        s.insert(si);
    } 
    cout << s.size() << endl;
}

Measured memory_bytes: 19052
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	int s[M][N] = {};
	for (int i = 0; i < M; i++) {
		int tmp;
		cin >> tmp;
		for (int j = 0; j < tmp; j++) {
			cin >> s[i][j];
		}
	}

	vector<int> p(M);
	for (int i = 0; i < M; i++) {
		cin >> p.at(i);
	}

	vector<set<int>> switches(N);
	for (int i = 0; i < M; i++) {
		for (auto x : s[i]) {
			if (x == 0) break;
			switches.at(x - 1).insert(i + 1);
		}
	}

	int cnt = 0;
	for (int bit = 0; bit < (1 << N); bit++) {
		set<int> ss;
		for (int i = 0; i < N; i++) {
			if (bit & (1 << i)) {
				ss.insert(i);
			}
		}

		vector<int> light(M);
		for (auto x : ss) {
			for (auto y : switches.at(x)) {
				light.at(y - 1)++;
			}
		}

		for (int i = 0; i < M; i++) {
			light.at(i) %= 2;
		}

		if (light == p) {
			cnt++;
		}
	}

	cout << cnt << endl;
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong A, B;
	cin >> A >> B;

	vector<int> ansA(60,0),ansB(60,0), ans(60,0);
	if(A > 0){
		A--;
		for(llong i = 0, beki = 2; i < 60; i++, beki *= 2){
			// cerr << (A+1)/beki*beki/2 << " ";
			// cerr << max(0ll,(A+1)%beki - beki/2);
			// cerr << endl;
			ansA[i] = (A+1)/beki*beki/2 + max(0ll, (A+1)%beki - beki/2);
		}
	}
	for(llong i = 0, beki = 2; i < 60; i++, beki *= 2){
		ansB[i] = (B+1)/beki*beki/2 + max(0ll, (B+1)%beki - beki/2);
	}

	for(int i = 0; i < 60; i++){
		ans[i] = ansB[i] - ansA[i];
		ans[i] &= 1;
	}

	llong ret = 0;
	for(int i = 59; i >= 0; i--)
		ret = ret*2 + ans[i];

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
var os = require('os');
function func(line) {
    var nums = line.split(' ');
    var a = parseInt(nums[0]) + parseInt(nums[1]);
    results.push(a.toString().length);
}
 
var results = [];
var input = '';
 
 
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(data) {
  input += data;
  var index = input.indexOf(os.EOL);
  while(index > -1){
    var line = input.substring(0, index);
    input = input.substring(index + 1);
    func(line);
    index = input.indexOf(os.EOL);
  }
});
process.stdin.on('end', function(data) {
    if(input.length > 0){
        func(input);
    }
  var output = results.join(os.EOL) + os.EOL;
  process.stdout.write(output);
});
process.stdin.resume();

Measured memory_bytes: 15716
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"
#ifdef DEBUG
#define dump(v) cerr << "["#v << ":" << (v) << "]" << endl;
#else
#define dump(v)
#endif
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
const ll MOD = (1e9+7);
const ll INF = (1e9+123456789);
const ll INFL = (INF*INF);
inline ll addm(ll a, ll b, ll m = MOD) {return ((a+b)%m);}
inline ll subm(ll a, ll b, ll m = MOD) {return (((a-b)%m+m)%m);}
inline ll mulm(ll a, ll b, ll m = MOD) {return ((a*b)%m);}
ll powm(ll a, ll b, ll m = MOD) {ll ret=(!b)?1:powm(a, b/2, m);return (!b)?1:mulm(mulm(ret,ret,m),b%2?a:1,m);}
ll inv(ll x, ll m = MOD) {return powm(x,m-2,m);}

const int N = 5050;
ll dp[N][N];

void solve()
{
    int n; cin >> n;
    vector<pll> v;
    for (int i = 0; i < n; i++) {
        ll s, w; cin >> s >> w;
        v.emplace_back(s, w);
    }
    sort(all(v), [](const pll &a, const pll &b) {
        /* return a.first + a.second < b.first + b.second; */
        return min(a.first-b.second, b.first) < min(b.first-a.second, a.first);
    });

    for (int i = 0; i < n; i++) for (int j = 0; j <= n; j++)
        dp[i][j] = (j) ? INFL : 0;
    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= n; j++) {
            ll ret = dp[i][j];
            if (dp[i][j-1] <= v[i].first)
                ret = min(ret, dp[i][j-1] + v[i].second);
            dp[i+1][j] = ret;
        }
    }
    int ans = 0;
    for (int i = 0; i <= n; i++) {
        if (dp[n][i] != INFL)
            ans = max(ans, i);
    }
    cout << ans << endl;
}

int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 199168
#include <stdio.h>

int main(){
    int N;
    scanf("%d",&N);
    int A[N],B[N];
    int ans=0;
    int a=1;
    int count = 1;
    B[0]=0;
    for(int i = 1;i<N;i++){
        scanf("%d",&A[i]);
        B[i] = 0;
    }
    for(int i = 1;i<N;i++) B[A[i]-1]++;
    for(int i = 0;i<N;i++) printf("%d\n",B[i]);
    
    return 0;
}

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

#define  all(v)            v.begin(), v.end()
#define  sz(x)             (int)x.size()
#define  debug(x)          cout << #x << ':' << x << endl;
#define  rep(i,n)          for(long long i = 0; i <  n ; i++)
#define  reps(i,n)         for(long long i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
const ll MOD = 1000000007;
bool cmp(int X, int Y) {return X > Y;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}

ll ncr(ll n , ll r){
	if(r > n - r) {r = n - r;}
	if(r==1){return n;}
	if(r==0){return 1;}
	
	if(r == n){return 1;}
	
	return ((n*ncr(n-1,r-1))/r)%MOD;
	}


int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll s;cin>>s;
ll dp[s+1];
memset(dp,0,sizeof(dp));
dp[0] = 0;
dp[1]=dp[2]=0;
dp[3] = 1;

for(ll i = 4;i<=s;i++){
	dp[i] = 1;
	for(ll j = (i-3);j>=3;j-- ){
		dp[i]+=dp[j];
		dp[i] = (dp[i]+MOD)%MOD;
		}
	
	}
dp[s]=(dp[s]+MOD)%MOD;
cout<<dp[s]<<endl;
				

}	







	


Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

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

  if(b >= a){
    cout << a << endl;
  } else {
    cout << a-1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    bool flag = false;
    cin >> a >> b >> c;
    if(a < b){
        if(b < c){
            flag = true;
        }
    }
    if(flag){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }
    
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  char c[n];
  int i,l=0,r=0;
  for(i=0;i<n;i++){
    cin >> c[i];
    if(c[i]=='R'){
      l++;
    }else{
      r++;
    }
  }
  int ans=0;
  for(i=0;i<l;i++){
    if(c[i]=='W'){
      ans++;
    }
  }
  for(i=l;i<n;i++){
    if(c[i]=='R'){
      ans++;
    }
  }
  ans=(ans+1)/2;
  cout << ans;
}
  
  

Measured memory_bytes: 3768
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
#include <algorithm>
// #include "./Debug.h"

namespace AtCoder {
	using Input = std::vector<std::string>;
	using Num = std::vector<int>;

	Input input(void) {
		Input result;
		{
			std::string buf = "", row = "";
			std::getline(std::cin, buf);
			for (unsigned int i = 0; i < buf.size(); i++) {
				if (' ' == buf[i]) {
					result.push_back(row);
					row = "";
				} else {
					row += buf[i];
				}
			}
			result.push_back(row);
		}
		return result;
	}

	Num replaceToInteger(Input original = { "" }) {
		Num result;
		for (unsigned int i = 0; i < original.size(); i++) {
			result.push_back(atoi(original[i].c_str()));
		}
		return result;
	}

	std::vector<int> sort(std::vector<int> vec = { 0 }) {
		std::sort(vec.begin(), vec.end());
		return vec;
	}
}

int main(void) {

	AtCoder::Num s = AtCoder::replaceToInteger(AtCoder::input());

	const int n = s[0];

	AtCoder::Num h = AtCoder::replaceToInteger(AtCoder::input());

	bool ans = true;

	/* sp */
	if (1 == n) {
		printf("Yes\n");
		return 0;
	}

	AtCoder::Num diffh = AtCoder::sort(h);

	for (int i = 0; i < n; i++) {
		if (1 < h[i] - diffh[i]) {
			ans = false;
			break;
		}
	}

	if (ans) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 5364
//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g PROGRAM -o OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
    if (!y)
        return x;
    return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;


inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

vector<string> split(char d,string s)
{
    stringstream ss(s);
    string t;
    vector<string> words;
    while(getline(ss,t,d))
    {
        words.pb(t);
    }

    return words;
}


int main(int argc, char *argv[])
{
#ifdef LOCAL
    auto start = chrono::high_resolution_clock::now();
#endif
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    VII bit;
    while(n>0LL)
    {
        n--;
        bit.pb(n % 26LL);
        n /= (26LL);
    }
    string s = "";
    for(auto x:bit)
        s += (x + 'a');
    reverse(all(s));
    cout << s;
    exit(0);

#ifdef LOCAL
    auto end = chrono::high_resolution_clock::now();
    double time_taken =
        chrono::duration_cast<chrono::nanoseconds>(end - start).count();

    time_taken *= 1e-9;

    cerr << "\nTime taken by program is : " << fixed
         << time_taken << setprecision(9);
    cerr << " sec" << endl;
#endif
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

int main() {
    lint k, n;
    cin >> k >> n;

    vector<lint> a(n);
    for(auto& elem : a)  cin >> elem;

    vector<lint> d(n);
    for(lint i=0; i<n-1; i++) {
        d[i] = a[i+1] - a[i];
    }
    d[n-1] = (a[0] + k) - a[n-1];

    cout << (k - *max_element(d.begin(), d.end())) << endl;
}

Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  string s; cin >> s;
  int ans = 0;
  for(int i=0;i<s.size()/2;i++){
    if(i == s.size()-1-i) continue;
    if(s[i]!=s[s.size()-1-i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main() {
	int n,p;
	while (cin >> n >> p && n != 0 && p != 0) {
		vector<int> a(n, 0);
		int flag = n;
		int winner;

		int i = 0;
		while (1) {
			if (p != 0) {
				if (a[i % n] == 0) flag--;
				a[i % n] += 1;
				p--;	
			} else if (a[i % n] != 0) {
				flag++;
				p += a[i % n];
				a[i % n] = 0;
			}
			if (p == 0 && flag == n - 1) {
				winner = i % n;
				break;
			}

			i++;
		}
		cout << winner << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
fun main(args: Array<String>) {
    val (N, M) = listOfIntg()
    val P = listOfIntg()
    val uf = UnionFind(N)
    repeat(M) { m->
        val (x, y) = listOfIntg(-1)
        uf.union(x, y)
    }
    var ans = 0
    repeat(N) { n->
        if (uf.isSame(n, P[n] - 1)) ans += 1
    }
    println(ans)
}

class UnionFind(n: Int) {
    var rank: IntArray
    var par:  IntArray
    var size: IntArray
    init {
        this.rank = IntArray(n) { 0 }
        this.par  = IntArray(n) { it }
        this.size = IntArray(n) { 1 }
    }
    fun union(x: Int, y: Int): Boolean {
        var rx = this.root(x)
        var ry = this.root(y)
        if (rx == ry) return false
        if (this.rank[rx] < this.rank[ry]) {
            val w = rx
            rx = ry
            ry = w
        } else if (this.rank[rx] == this.rank[ry]) {
            this.rank[rx] += 1
        }
        this.par[ry] = rx
        this.size[rx] += this.size[ry]
        return true
    }
    fun find(x: Int): Int {
        if (this.par[x] == x) return x
        else {
            this.par[x] = this.find(this.par[x])
            return this.par[x]
        }
    }
    fun isSame(x: Int, y: Int) = this.root(x) == this.root(y)
    fun size(x: Int): Int = this.size[this.find(x)]
    fun root(x: Int): Int = this.find(x)
    fun unite(x: Int, y: Int) = this.union(x, y)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfIntg(d: Int = 0) = listOfString().map { it.toInt() + d }


Measured memory_bytes: 72348
// AtCoder ABC132: A - Fifty-Fifty
// 2019.9.3 bal4u

#include <stdio.h>

char f[128];

int main()
{
	int i, n;
	char S[10];

	scanf("%s", S);
	n = 0; for (i = 0; i < 4; i++) if (++f[S[i]] == 2) n++;
	puts(n == 2? "Yes": "No");
	return 0;
}


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

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int dp[n];
// 	memset(dp,INT_MAX,sizeof(dp));
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(int i=2;i<=k && i<n;i++){
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
		for(int j=i-1;j>=0;j--){
			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
		}
	}
	for(int i=k+1;i<n;i++){
		int z = k-1;
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
		for(int j=i-1;j>=0 && z>=0;j--,z--){
			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
		}
	}
// 	for(int i=0;i<n;i++) cout<<dp[i]<<" ";
// 	cout<<"\n";
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
int cards[200];
int n;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	roop(i, 200) { cards[i] = -1; }
	cin >> n;
	roop(i, 2 * n) { cards[i] = i + 1; }
	int m;
	cin >> m;
	roop(i, m) {
		vector<int>up_down;
		vector<int>down_up;
		int t;
		cin >> t;
		if (t != 0)
		{
			for (int j = 0; j < t; j++) {
				up_down.push_back(cards[j]);
			}
			for (int j = t; j < 2 * n; j++) {
				down_up.push_back(cards[j]);
			}
			for (int j = 0; j < down_up.size(); j++) {
				cards[j] = down_up[j];
			}
			for (int j = down_up.size(); j < 2 * n; j++) {
				cards[j] = up_down[j-down_up.size()];
			}
			continue;
		}
		for (int j = 0; j < n; j++) {
			up_down.push_back(cards[j]);
		}
		for (int j = n; j < 2 * n; j++) {
			down_up.push_back(cards[j]);
		}
		for (int j = 0; j < 2 * n; j++) {
			if (j % 2 == 0) { cards[j] = up_down[(j / 2)]; }
			else { cards[j] = down_up[(j - 1) / 2]; }
		}
	}
	roop(i, 2 * n) {
		cout << cards[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3132
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int K = scan.nextInt();
        int A = scan.nextInt();
        int B = scan.nextInt();
        boolean found = false;
        for (int i = A; i <= B; i++) {
            if (i % K == 0) {
                found = true;
                break;
            }
        }
        if (found) {
            System.out.println("OK");
        } else {
            System.out.println("NG");
        }
    }
}


Measured memory_bytes: 27112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#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 REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;
string s;

ll modPow(ll x, ll y) {
  if (y == 1) return x;
  else if (y == 0) return 1;
  else if (y % 2 == 0) return modPow((x*x)%2019, y/2);
  else return (modPow((x*x)%2019, y/2) * x) % 2019;
}

int main(void){
  
  IN(s);
  N = s.length();

  vl r(2019, 0);

  ll n = 0;
  FOR(i, 0, N) {
    n += (s[N-1-i] - '0') * modPow(10, i);
    n %= 2019;
    r[n] += 1;
  }

  ret += r[0];
  FOR(i, 0, 2019) {
    ret += r[i] * (r[i] - 1) / 2;
  }

  PRINT(ret);

}


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

using namespace std;

const int INF = 1000000000;

int main(){
    int n, ans = 0;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    h.push_back(0);
    bool f = true;
    while(f){
        f = false;
        int t = INF;
        for(int i = 0; i <= n; i++){
            if(h[i] > 0){
                f = true;
                t = min(t, h[i]);
            }else{
                if(t == INF) continue;
                ans += t;
                int p = i - 1;
                while(p >= 0 && h[p] > 0){
                    h[p] -= t;
                    p--;
                }
                t = INF;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<58;
const ll mod=1e9+7;


int main(){
  ll i,j;
  ll n;
  cin>>n;
  ll a[n];
  ll ans=0;
  for(i=0;i<n;i++) cin>>a[i];
  vector<ll> v(62,0);
  for(j=0;j<=61;j++){
    for(i=0;i<n;i++) v[j]+=(a[i]>>j)&1;
  }
  
 
  for(i=0;i<=61;i++){
    ans=ans+((1ll<<i)%mod)*(v[i]*(n-v[i])%mod)%mod;
    ans%=mod;
  }
  cout<<ans<<endl;
  
  return 0;
}

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

void solve() {
	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int ans = 0;
	for (int i = 0; i < k; i++) {
		ans += a[i];
	}
	cout << ans << endl;
}

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

    int t = 1;
//    cin>>t;
    for(; t; t--) {
    	solve();
	}
	return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main() {
    int H, W;
    while (true) {
        scanf("%d %d", &H, &W);
        if (H == 0 && W == 0) break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i == 0 || i == H-1 || j == 0 or j == W-1) printf("#"); else printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2580
#include<bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i=0;i<n;i++)
const int maxm=1e5+4;
int arr[maxm];
int dp[maxm];
int cal(int i)
{   
	if(i==0)return 0;
	if(dp[i]!=-1)return dp[i];
	if(i==1)return abs(arr[1]-arr[0]);
	return dp[i]= min(abs(arr[i]-arr[i-2])+cal(i-2),abs(arr[i]-arr[i-1])+cal(i-1));
	//cout<<i<<" "<<val<<"\n";
	
}
int main()
{
   memset(dp,-1,sizeof(dp));
  int n;cin>>n;
  fr(i,n)cin>>arr[i];
  cout<<cal(n-1);
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
const int mo=998244353;
const int maxn=2e5+10;
int n,m,k;
long long p[maxn],inv[maxn],ans;
long long po(long long a,long long b)
{
	if (b==0) return 1;
	if (b==1) return a%mo;
	long long c=po(a,b/2);
	if (b&1) return c*c%mo*a%mo;else return c*c%mo;
}
long long C(int n,int m){return p[n]*inv[m]%mo*inv[n-m]%mo;}
int main()
{
	p[0]=1; for (int i=1;i<=2e5;i++) p[i]=p[i-1]*i%mo;
	inv[200000]=po(p[200000],mo-2); for (int i=199999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mo;
	scanf("%d%d%d",&n,&m,&k);
	for (int i=0;i<=k;i++)
	{
		long long now=C(n-1,i);
		now=now*m%mo*po(m-1,n-1-i)%mo;
		ans=(ans+now)%mo;
	}
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 6952
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;

ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll get_val(vector<ll>&ft,ll index)
{
  ll res=0;
  for(;index>=0;index=(index & (index+1))-1)
    res+=ft[index];
  return res;
}

void update(vector<ll>&ft,ll index,ll val)
{
  for(;index<(ll)ft.size();index|=index+1)
    ft[index]+=val;
}

ll mex(vector<ll>&a, ll n)
{
  ll res=0;
  // set<ll>st;
  vector<ll>b(n+1,0);
  for(auto x:a) b[x]++;
    while(res<n && b[res]>0) res++;
  return res;
}

ll h,w,k,ans=0;
char mat[6][6];

// ll v[3]={0};
void gen(ll index,ll n,vector<ll> &v,vector<vector<ll>>&vv)
{
  // for(ll i=0;i<n;i++) cout<<v[i]<<" ";
    // cout<<"\n";
  vv.pb(v);
  for(ll i=index;i<n;i++)
  {
    v[i]=1;
    gen(i+1,n,v,vv);
    v[i]=0;
  }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //   #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    
    // Sieve();
   ll tests=1;
 // cin>>tests;
  // ll t=1;
    while(tests--)
    {
      ll i,j;
      cin>>h>>w>>k;
      rep(i,0,h-1)
      {
        rep(j,0,w-1)
        cin>>mat[i][j];
      }
      vector<vector<ll>>row,col;
      vector<ll>v(h,0);
      gen(0,h,v,row);
      v.resize(w,0);
      gen(0,w,v,col);

      for(auto x:row)
      {
        for(auto y:col)
        {
          ll cur=0;
          rep(i,0,h-1)
          {
            if(x[i]==1) continue;
            rep(j,0,w-1)
            {
              if(y[j]==1) continue;
              if(mat[i][j]=='#') cur++;
            }
          }
          if(cur==k) ans++;
        }
      }
      cout<<ans;
    }

    return 0;
   }

Measured memory_bytes: 14164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int  main(){
int N;
  cin>>N;
vector<double>a(N);
for(int i=0;i<N; i++){
    cin>>a.at(i);
}
double answer=0.00000;
for(int i=0; i<N; i++){
  double k=1/a.at(i);
    answer+=k;
}
cout<< 1/answer<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define fill(x,v) memset(x, v, sizeof(x))
#define PI (ld)acos(-1)
#define endl '\n'
#define dbg(x) cout<<#x<<"="<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<endl; 
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define IO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
const ld eps=(ld)1e-9;
const ll inf=(ll)1e9;
const ll mod=(ll)1e9+7;


void solve(){
	int n;
	cin>>n;
	int h[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>h[i];
	}
	vector<int>dp(n,inf);
	dp[0]=0;
	for (int i = 0; i < n; ++i)
	{
		for(int j:{i+1,i+2}){
			if(j<n){
				dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
			}
		}
	}
	cout<<dp[n-1];
}

int main(){fio;
int test=1;
// cin>>test;
while(test--){
	solve();
	cout<<endl;
}
return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  //値を突っ込むパート
  in n,m,k;
  cin>>n>>m>>k;
  vector<in> a(n),b(m);
  rep(i,n)
    cin>>a.at(i);
  rep(i,m)
    cin>>b.at(i);
  
  vector<in> sum_a(n+1,0),sum_b(m+1,0);//sum_a.at(i) はa列の上からi番目までの総和
  //それを作る
  rep(i,n)
    sum_a.at(i+1)=sum_a.at(i)+a.at(i);
  rep(i,m)
    sum_b.at(i+1)=sum_b.at(i)+b.at(i);
  
  int ans=0;//求める答え
  
  rep(i,n+1){//a列を上からi番目まで選んだとき
    
    auto itr = lower_bound(all(sum_b),k-sum_a.at(i)+1);//和が初めてKを超えるsum_bの値の場所
//sum_b が元々昇順なのでO(log(N))で計算できる
    
    int nan = distance(sum_b.begin(),itr)-1;//その場所が最初からどれだけ離れてるか（bを選べる個数）
    
    nan+=i;         //それに選んだAの個数を加える
    
    if(sum_a.at(i)>k)//Aの和だけでKを超えてたらアウト
      nan=0;
    
    if(nan>ans)  //今まで記憶してたansの値と新しいのを比較して大きい方をans として残す
      ans=nan;
  }
  
  cout<<ans<<endl; //出力
}

Measured memory_bytes: 9516
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < 3; ++i){
	   if (s[i]=='1') ++ans;
	}
	cout << ans << endl;
}


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp19
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1;i<10;i+=1)
            {
                for (int j = 1;j < 10; j += 1)
                {
                    Console.WriteLine(i.ToString()+"x"+j.ToString()+"="+(i * j).ToString());
                }
            }
        }
    }
}



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

int main() {

  int n;
  cin >> n;
    
  vector<int>x(n);
  for (int i = 0; i < n; i++) {
    cin >> x.at(i);
  }
  
  vector<int>y(n);
  for (int i = 0; i < n; i++) {
    cin >> y.at(i);
  }
  
  double D1 = 0;
  for (int i = 0; i < n; i++) {
    if (x.at(i)-y.at(i) > 0) {
      D1 += x.at(i)-y.at(i);
    }
    else {
      D1 += y.at(i)-x.at(i);
    }
  }
  
  double D20 = 0;
  for (int i = 0; i < n; i++) {
    D20 += (x.at(i)-y.at(i))*(x.at(i)-y.at(i));
  }
  double D2 = 0;
  D2 = sqrt(D20);
  
  double D30 = 0;
  for (int i = 0; i < n; i++) {
    if (x.at(i)-y.at(i) > 0) {
      D30 += (x.at(i)-y.at(i))*(x.at(i)-y.at(i))*(x.at(i)-y.at(i));
    }
    else {
      D30 += (y.at(i)-x.at(i))*(y.at(i)-x.at(i))*(y.at(i)-x.at(i));
    }
  }                                              
  double D3 = 0;
  D3 = pow(D30, 1.0/3.0);
  
  printf("%.8lf\n%.8lf\n%.8lf\n",D1,D2,D3);
  
  vector<int>z(n);
  for (int i = 0; i < n; i++) {
    if (x.at(i)-y.at(i) > 0) {
      z.at(i) = x.at(i)-y.at(i);
    }
    else {
      z.at(i) = y.at(i)-x.at(i);
    }
  }
  sort(z.begin(), z.end());
  cout << z.at(n-1) << endl;
}





Measured memory_bytes: 3384
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<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;}

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

class Radix {
private:
  const char* s;
  int a[128];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  Radix r;
  OUT(r.to(a,b).size());
}

Measured memory_bytes: 256
'use strict';

function main(input) {
  const YEN_1000 = 1000;
  const YEN_5000 = 5000;
  const YEN_10000 = 10000;
  let ans_i = -1;
  let ans_j = -1;
  let ans_k = -1;
  let inputs = input.split(' ').map(num => parseInt(num, 10));
  let numbers = inputs[0];
  let amount = inputs[1];

  for (let i = 0; i <= numbers; i++) {
    for (let j = 0; j <= numbers - i; j++) {
      let k = numbers - i - j;
      let sum = YEN_10000 * i + YEN_5000 * j + YEN_1000 * k;
      if (i + j + k === numbers && sum === amount) {
        ans_i = i;
        ans_j = j;
        ans_k = k;
      }
    }
  }

  console.log(`${ans_i} ${ans_j} ${ans_k}`);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

// 1000**5 - 999**5 = 4.99001e+12
#define NUM_MAX 1000

struct pair {
    int a;
    int b;
};

int main(void) {
    int64_t target = get_int();
    int a, b;
    struct pair ans = {0, 0};
    for(a = 0; a <= NUM_MAX; a++) {
        for(b = 0; b <= NUM_MAX; b++) {
            int64_t a5 = (int64_t)a*a*a*a*a;
            int64_t b5 = (int64_t)b*b*b*b*b;
            if(a5+b5 == target) {
                ans = (struct pair){a, -b};
                goto finish;
            }
            if(a5-b5==target) {
                ans = (struct pair){a, b};
                goto finish;
            }
        }
    }
finish:
    printf("%d %d\n", ans.a, ans.b);
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int w=0,g=0,r=0,c=0;
    for(int i=0; i<n; i++) {
        if(s[i]=='R') {
            r=i;
            c++;
        }

    }
    for(int i=0; i<=r; i++) {
        if(s[i]=='W')w++;
        
    }
    int ans=min(w,c);
    int bw=0;
    for(int i=0; i<n; i++) {
        if(s[i]=='W')bw++;
        else c--;
        if(bw==c) {
            ans=min(ans,bw);
            break;
        }
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3704
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
	//Implement solution here.
		char[] ca = next().toCharArray();
		int ez = 0;
		int oz = 0;
		for(int i = 0; i < ca.length; i++){
			if(i % 2 == 0){
				ez += ca[i] != '0' ? 1 : 0;
				oz += ca[i] != '1' ? 1 : 0;
			}else {
				ez += ca[i] != '1' ? 1 : 0;
				oz += ca[i] != '0' ? 1 : 0;
			}
		}
		System.out.println(Math.min(ez, oz));
	}

    //Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
            	br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 24660
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//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/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll n; cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  vvi bbb(n,vi(30));
  //ll limit=0;
  rep(i,n){
    ll x=a[i];
    //bool f=true;
    rep(j,30){
      /*if(x==0){
        if(f) chmax(limit,j);
        f=false;
      }*/
      bbb[i][j]=x%2;
      x/=2;
    }
  }
  rep(j,30){
    ll cnt=0;
    rep(i,n){
      if(bbb[i][j]==1) cnt++;
    }
    if(cnt%2==1){
      rep(i,n){
        bbb[i][j]=1-bbb[i][j];
      }
    }
  }
  //outvv(bbb);
  rep(t,n){
    ll p=1;
    ll ans=0;
    rep(i,30){
      ans+=bbb[t][i]*p;
      p*=2;
    }
    out(ans);
  }
  //out(limit);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 59444
#include<cstdio>
#include<bitset>
#include<algorithm>
using namespace std;
const int maxn=2000;
int n,a[maxn+10],sum;
bitset<maxn*maxn+10> b;
int main(){
	scanf("%d",&n); b[0]=1;
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]); sum+=a[i];
		b|=b<<a[i];
	}
	sort(a+1,a+n+1);
	for(int i=sum/2;;--i) if(b[i]){
		printf("%d",sum-i); return 0;
	}
}

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

#define INF (1LL << 32)

void APSP(vector<vector<long long>>& v)
{
	for (int k = 0; k < v.size(); k++)
	{
		for (int i = 0; i < v.size(); i++)
		{
			if (v[i][k] == INF) continue;
			for (int j = 0; j < v.size(); j++)
			{
				if (v[k][j] == INF) continue;
				v[i][j] = min(v[i][j], (v[i][k] + v[k][j]));
			}
		}
	}
}

int main(void)
{
	long long V, E, s, t, d;
	cin >> V >> E;

	vector<vector<long long>> v(V, vector<long long>(V, INF));
	for (int i = 0; i < V; i++) v[i][i] = 0;
	for (int i = 0; i < E; i++)
	{
		cin >> s >> t >> d;
		v[s][t] = d;
	}

	APSP(v);

	for (int i = 0; i < V; i++) {
		if (v[i][i] < 0) {
			cout << "NEGATIVE CYCLE" << endl;
			return 0;
		}
	}

	for (int i = 0; i < V; i++)
	{
		for (int j = 0; j < V; j++)
		{
			if (j) cout << " ";
			if (v[i][j] != INF) cout << v[i][j];
			else cout << "INF";
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3228
# coding: utf-8
# Your code here!
n,k=map(int,input().split())
a=[[] for i in range(n)]
for i in range(n):
    a[i]=list(map(int,input().split()))

a.sort(key=lambda x:x[0],reverse=True)
c=0
while c<k:
    x=a.pop()
    c+=x[1]
print(x[0])



Measured memory_bytes: 62112
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = -100; i < 101; ++i) {
    ll sum = 0;
    for (int j = 0; j < N; ++j) {
      sum += (i - a[j]) * (i - a[j]);
    }
    if (i == -100) {
      ans = sum;
    } else {
      ans = min(ans, sum);
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(void) {
    double l;
    //long double oth;
    cin >> l;

    //l = l * 1.0;
    //oth = l / 3;
    cout << fixed << setprecision(12) << (l / 3.0) * (l / 3.0) * (l / 3.0) << endl;
    return 0;
}

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

using namespace std;

int main() {
    char c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }

    cout << c[0][0] << c[1][1] << c[2][2] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>

using namespace std;

struct point
{
	int id;
	int x;
	int y;
};

struct edge
{
	int src;
	int dst;
	int cost;

	bool operator<(const edge &other) const
	{
		return other.cost < cost;
	}
};

int main()
{
	int N;
	cin >> N;
	vector<point> p(N);

	for (int i = 0; i < N; ++i) {
		p[i].id = i;
		cin >> p[i].x >> p[i].y;
	}

	vector<vector<edge>> g(N);

	sort(p.begin(), p.end(), [](auto &a, auto &b) {return a.x < b.x; });
	for (int i = 0; i + 1 < N; ++i) {
		edge e;
		e.src = p[i].id;
		e.dst = p[i + 1].id;
		e.cost = p[i + 1].x - p[i].x;
		g[e.src].push_back(e);
		swap(e.src, e.dst);
		g[e.src].push_back(e);
	}

	sort(p.begin(), p.end(), [](auto &a, auto &b) {return a.y < b.y; });
	for (int i = 0; i + 1 < N; ++i) {
		edge e;
		e.src = p[i].id;
		e.dst = p[i + 1].id;
		e.cost = p[i + 1].y - p[i].y;
		g[e.src].push_back(e);
		swap(e.src, e.dst);
		g[e.src].push_back(e);
	}

	set<int> visited;
	priority_queue<edge> q;
	auto visit = [&](int x) -> bool {
		if (!visited.insert(x).second) {
			return false;
		}
		for (auto &e : g[x]) {
			q.push(e);
		}
		return true;
	};
	visit(0);
	int ans = 0;
	while (!q.empty()) {
		auto e = q.top();
		q.pop();
		if (visit(e.dst)) {
			ans += e.cost;
		}
	}
	cout << ans << endl;
}


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

int n;
string x;
int d;

int main(){
	cin >> n >> x >> d;
	
	int cnt = 0;
	string y = x;

	for( int i = 0; i < n; i++ ){
		if( cnt < d && x[i] == '0' ){
			y[i] = '1';
			cnt++;
		}
	}
	for( int i = n - 1; i >= 0; i-- ){
		if( cnt < d && x[i] == '1' ){
			y[i] = '0';
			cnt++;
		}
	}
	cout << y << endl;
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int score =0;
    for(int day=1; ;day++){
        score +=a;
        if(day%7==0){
            score +=b;
        }
        if(score>=c){
            cout << (day) << endl;
            break;
        }
    }
}



Measured memory_bytes: 3084
#include <stdio.h>

int main(void){
  int i, a, b, c, n = 0;

  scanf("%d%d%d", &a, &b, &c);
  for(i = a; i <= b; i++){
    if(c % i == 0){
      n++;
    }
  }
  printf("%d\n", n);

  return 0;
}

Measured memory_bytes: 596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class C {
    static IEnumerable<int> Even() {
        int k = 1;
        while (true) {
            yield return k;
            yield return k;
            k += 2;
        }
    }

    static IEnumerable<int> Odd() {
        yield return 0;
        int k = 2;
        while (true) {
            yield return k;
            yield return k;
            k += 2;
        }
    }

    static bool Valid(int[] a) {
        Array.Sort(a);
        var trueSeq = (a.Length & 1) == 0 ? Even() : Odd();
        return trueSeq.Take(a.Length).SequenceEqual(a);
    }

    public static void Main() {
        Console.ReadLine();
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        if (Valid(a))
            Console.WriteLine(BigInteger.ModPow(2, a.Length >> 1, 1000000007));
        else Console.WriteLine(0);
    }
}


Measured memory_bytes: 17504