akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define int long long int
#define fr(i,x,y) for(int i=x;i<y;i++)
#define f(n) for(int i=0;i<n;i++)
#define ff(m) for(int j=0;j<m;j++)
#define F(x) for(auto it:x)
#define in insert
#define pb push_back
#define em emplace_back
#define pi pair<int,int>
#define si second
#define fi first
// new include starts here.
#define endl '\n'
#define vi vector <int>
#define vii vector <pair<int,int>>
#define __s(x) cout<<#x<<"-> "; cout<<"{ ";F(x){cout<<it<<" ";}cout<<" }";cout<<endl;
#define _s(x) cout<<#x<<"-> "<<x<<endl;
#define _sp(x) cout<<#x<<"-> "<<x.fi<<" "<<x.si<<endl;
#define __sp(x) cout<<#x<<"-> "; cout<<"{ "<<endl;F(x){cout<<it.fi<<" "<<it.si<<endl;}cout<<" }";cout<<endl;
#define inf numeric_limits<int > :: max();
#define fit(it,y) for(auto it=y.begin(); it!=y.end();it++)
#define all(x) x.begin(),x.end()
// new includes end here .
//#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
//#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0;
#define FILEIO freopen("/home/adarsh/Desktop/codes/input", "r", stdin); //freopen("/home/adarsh/Desktop/codes/output.txt", "w", stdout);
using namespace __gnu_pbds;
using namespace std;

#define TRACE
#ifdef TRACE
#define _v(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define _v(...)
#endif

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rb;
void print(int a[],int n){f(n){cout<<a[i]<<" ";}cout<<endl;}
int m(int x){return x%1000000007;} 
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
int p(int a,int b){if(b==0)return 1;int t=(p(a,b/2)); if(b%2==0)return (t*t); else return ((a)*(t*t)); } 

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

signed main(){
 
	#ifndef ONLINE_JUDGE
	FILEIO
	#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	//----sure_am-----


	int x, n;
	cin>>x>>n;
	int a[n];
	set <int > s;
	f(n){
		cin>>a[i];
		s.in(a[i]);
	}
	int mi=x+1;
	int ans=-1;
	f(102){
		if(s.find(i)!=s.end()){
			continue;
		}
		if(abs(i-x)<mi){
			mi=abs(i-x);
			ans=i;
		}
	}
	cout<<ans<<endl;


	
	return 0;
}   

Measured memory_bytes: 3664
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s[] = new String[n];

        for(int i = 0; i < n; i++){
                s[i] = scan.next();
        }
        Arrays.sort(s);

        int ans = 1;
        for(int i = 0; i < n - 1; i++){
            if(!(s[i].equals(s[i+1]))){
                ans++;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 69996
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
#define FAST_IO {ios::sync_with_stdio(0);cin.tie(0);}
using namespace std;
int lcm(int a, int b) {
  return (a*b)/__gcd(a,b);
}

signed main() {
  int a, b; cin >> a >> b;
  cout << lcm(a, b) << endl; 
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	unsigned long n;
	cin >> n;
	unsigned long i, temp, a[n], ans = 0;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		ans ^= a[i];
	}
	for (i = 0; i < n; i++)
	{
		temp = ans ^ a[i];
		cout << temp << " ";
	}
	cout << "\n";
}

Measured memory_bytes: 5184
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] ans = new int [N+1];
        int tmp = 0;
        
        for(int i=1; i<N; i++){
            for(int j=1; j<N; j++){
                for(int k=1; k<N ; k++){
                    tmp = i*i+j*j+k*k+i*j+j*k+k*i;
                    if(tmp>N){
                        break;
                    }else if(i == j && j == k){
                        ans[tmp]++;
                    }else if(i != j && j != k && i != k){
                        ans[tmp]++;
                    }else{
                        ans[tmp]++;
                    }
                }
            }
        }
        
        for(int i=1; i<=N; i++){
            System.out.println(ans[i]);
        }
        
    }
}

Measured memory_bytes: 38776
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;

template<class T>
class CoordinateCompression{
    vector<T> dat;
    int s;
    int n;

public:
    CoordinateCompression(const vector<T>& dat_, int s_ = 0){
        build(dat_, s_);
    }

    void build(const vector<T>& dat_, int s_ = 0){
        dat = dat_;

        sort(dat.begin(), dat.end());
        dat.erase(unique(dat.begin(), dat.end()), dat.end());

        s = s_;

        n = (int)dat.size();

        return;
    }

    int get(T x){
        return (int)(lower_bound(dat.begin(), dat.end(), x) - dat.begin()) + s;
    }

    T restore(int k){
        return dat[k - s];
    }

    int size(void){
        return n;
    }
};

#include<iostream>

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

    int n;
    cin >> n;

    vector<int> x1(n), y1(n), x2(n), y2(n);
    vector<int> xs, ys;
    for(int i = 0 ; i < n ; ++i){
        cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
        xs.emplace_back(x1[i]);
        xs.emplace_back(x2[i]);
        ys.emplace_back(y1[i]);
        ys.emplace_back(y2[i]);
    }

    CoordinateCompression<int> x(xs), y(ys);

    vector< vector<int> > imos(y.size(), vector<int>(x.size()));
    for(int i = 0 ; i < n ; ++i){
        int sy = y.get(y1[i]);
        int sx = x.get(x1[i]);
        int gy = y.get(y2[i]);
        int gx = x.get(x2[i]);
        ++imos[sy][sx];
        --imos[sy][gx];
        --imos[gy][sx];
        ++imos[gy][gx];
    }

    for(int i = 0 ; i < y.size() ; ++i){
        for(int j = 1 ; j < x.size() ; ++j){
            imos[i][j] += imos[i][j - 1];
        }
    }

    for(int j = 0 ; j < x.size() ; ++j){
        for(int i = 1 ; i < y.size() ; ++i){
            imos[i][j] += imos[i - 1][j];
        }
    }

    long long ans = 0;
    for(int i = 0 ; i < y.size() - 1 ; ++i){
        for(int j = 0 ; j < x.size() - 1 ; ++j){
            if(imos[i][j] > 0){
                ans += ((long long)y.restore(i + 1) - y.restore(i)) * ((long long)x.restore(j + 1) - x.restore(j));
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

L={}
R={}
ans=0
for i in range(N):
    if i+A[i] in L:
        L[i+A[i]]+=1
    else:
        L[i+A[i]]=1
    if A[i]<=i:
        if i-A[i] in R:
            R[i-A[i]]+=1
        else:
            R[i-A[i]]=1
for r in R:
    if r in L:
        ans+=L[r]*R[r]
print(ans)

Measured memory_bytes: 41708
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 100000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
	long long n;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	vector<pair<long long, long long>> input;
	long long geko = n;
	long long topper = 1;
	for (int q = 2; q <= sqrt(geko); ++q) {
		if (geko % q == 0) {
			int cnt = 0;
			while (geko % q == 0) {
				cnt++;
				geko /= q;
			}
			topper *= cnt + 1LL;
			input.push_back(make_pair(q, cnt));
		}
	}
	if (geko != 1) {
		input.push_back(make_pair(geko, 1));
		topper *= 2LL;
	}
	long long ans = 0;
	for (int i = 1; i < topper; ++i) {
		long long now = i;
		long long geko = 1;
		for (int q = 0; now != 0; ++q) {
			REP(j, now % (input[q].second + 1)) {
				geko *= input[q].first;
			}
			now /= (input[q].second + 1LL);
		}
		long long m = geko - 1LL;
		if (n / m == n % m) {
			ans += m;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	string s,w[4]={"eraser","erase","dreamer","dream"},p[4]={"######","#####","#######","#####"};
	cin>>s;
	for(int i=0;i<4;i++)
	{
		for(int j=0;j<=s.length()-w[i].length();j++)
		{
			if(s.substr(j,w[i].length())==w[i])s.replace(j,w[i].length(),p[i]);
		}
	}
	bool flag=true;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='#')flag=false;
	}
	if(flag)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define ll long long
ll n;
//ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
int main()
{
	scanf("%lld",&n);
	for(ll a=1;a<=3500;++a)
	{
		for(ll b=1;b<=3500;++b)
		{
			ll x=n*a*b,y=4ll*a*b-n*a-n*b;
			if(y&&x%y==0&&(x/y>0))
			{
				printf("%lld %lld %lld",a,b,x/y);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

int main(void){
    // Your code here!
    char S[200001],T[200001],slist[26] = {0},tlist[26] = {0},scount = 1,tcount = 1,flag = 1;
    int n;
    scanf("%s",S);
    scanf("%s",T);
    n = strlen(S);
    slist[S[0]-97] = scount++;
    S[0] = 1;
    tlist[T[0]-97] = tcount++;
    T[0] = 1;
    for(int i = 1; i < n && flag == 1; i++)
    {
        if(slist[S[i]-97] == 0)
            slist[S[i]-97] = scount++;
        
        S[i] = slist[S[i]-97];
        
        if(tlist[T[i]-97] == 0)
            tlist[T[i]-97] = tcount++;
        
        T[i] = tlist[T[i]-97];
        
        if(S[i] != T[i]) flag = 0;
    }
    printf("%s\n",(flag == 1)? "Yes":"No");
}


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

int main(){
    string s;
    cin >> s;
    int count = 0;    
    int maxCount = 0;
    for(auto &i : s){
        if(i == 'R'){
            count++;
        }
        else{
            count = 0;
        }
        if(count > maxCount){
            maxCount = count;
        }
    }
    cout << maxCount;
    return 0;
}

Measured memory_bytes: 3160
N = int(input())
S = input()

ans = 0

for a in range(10):
  if str(a) in S:
    b = S[S.index(str(a))+1:]
    for j in range(10):
      if str(j) in b:
        c = b[b.index(str(j))+1:]
        for k in range(10):
          if str(k) in c:
            ans +=1
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define A first
#define B second
#define make_pair MP
#define MOD 1000000007
#define MAXM 100005
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;

}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res,x);
        y = y>>1;
        x = mulmd(x,x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a-b;
    if(ret<0){
        ret+=MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int phi(int n){
    int result = n;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0){
                n=n/i;
            }
            result-=result/i;
        }
    }
    if(n>1) result-=result/n;
    return result;
}

int gcd(int a, int b, int& x, int& y){
    if(a==0){
        x=0;
        y=1;
        return b;
    }
    int x1,y1;
    int d = gcd(b%a, a, x1, y1);
    x = y1 - (b/a)*x1;
    y = x1;
    return d;
}

int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int>b(n-1);
    vector<int>a(n);
    REP(i,n)
    a[i]=0;
    REP(i,n-1)
    cin>>b[i];
    int sum=0;
    REP(i,n-1)
    {
        if(i==0)
        {
            a[0]=b[0];
            a[1]=b[0];
        }
        if(a[i]<=b[i])
            a[i+1]=b[i];
        else if(a[i]>b[i])
        {
            a[i]=b[i];
            a[i+1]=a[i];
        }
    }
    REP(i,n)
    sum+=a[i];
    cout<<sum;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scn = new Scanner(System.in);

        int numLines = scn.nextInt();

        int time = 0;
        int x = 0;
        int y = 0;

        for (int i = 0; i < numLines; i++) {
            int timeStamp = scn.nextInt();
            int newX = scn.nextInt();
            int newY = scn.nextInt();

            int distance = Math.abs(x - newX) + Math.abs(y - newY);
            if ( (distance <= timeStamp - time) && (timeStamp - time)%2 == distance%2) {
                time = timeStamp;
                x = newX;
                y = newY;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}



Measured memory_bytes: 87848
package main

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

/*-----------Main-----------*/

func main() {
	a, b, c, k := readI(), readI(), readI(), readI()
	if c == 0 {
	}
	if k <= a {
		fmt.Println(k)
	} else if k <= a+b {
		fmt.Println(a)
	} else {
		fmt.Println(a - (k - a - b))
	}
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


Measured memory_bytes: 1784
#87b
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

#50*50*50=125000≒1*10**5なので間に合う
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if X == 500*i + 100*j +50*k:
                ans += 1
                
print(ans)

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

#define rep(i,n) for(int i = 0;i < n;++i)
#define rep2(i,n,m) for(int i = n;i < m;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    char s;
    cin >> s;
    cout << (char)(s+1) << endl;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

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

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for modular inverse
ll inv(ll a,ll m){
	return mpow(a,m-2,m);
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

// Utility for binomial coefficient
ll ncr(ll n,ll k)
{
    if(n<k)
        return 0;
    ll C[n + 1][k + 1];
    ll i,j;
    for(i=0;i<=n;i++){
        for(j=0;j<=min(i,k);j++){
            if (j==0 || j==i)
                C[i][j]=1;
            else
                C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
    return C[n][k];
}

void solve(){
	//code
	ll d,t,s;
	cin>>d>>t>>s;
	if(d<=t*s)
		cout<<"Yes";
	else cout<<"No";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


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

using namespace std;

int main(){
	long long A, B, K; cin >> A >> B >> K;
	for(long long i = 0; i < K; ++i){
		if(i % 2 == 0){
			if(A % 2 != 0) A--;
			long long half_A = A / 2;
			A -= half_A; B += half_A;
		}else{
			if(B % 2 != 0) B--;
			long long half_B = B / 2;
			B -= half_B; A += half_B;
		}
	}
	cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << (x) << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    OUT(max(a * b, c * d));

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>     // std::back_inserter

using namespace std;

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

  vector <int> p(n);
  for(int i = 0; i < n; i++) {
    cin >> p[i];
  }

  std::vector<int> v(n);
  for(int i = 0; i < n; i++) v[i] = p[i];

  // copy(p.begin(), p.end(), back_inserter(v) );
  sort(v.begin(), v.end());


  int cnt = 0;
  for(int i = 0; i < n; i++) {
    if(p[i] != v[i]) cnt++;
    // cout << v[i] << " ";
  }

  if(cnt <= 2) cout << "YES";
  else cout << "NO";

  return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    vector<string>s(3);
    for (int i = 0; i < 3; ++i) {
        cin >>s[i];
        reverse(all(s[i]));
    }
    char ans=s[0].back();
    int k=ans-'a';
    s[0].pop_back();
    while(1){
//         cout <<ans <<endl;
         if(s[k].empty()){
             cout <<(char)(ans+'A'-'a') <<endl;
             return 0;
         }
         ans=s[k].back();
         s[k].pop_back();
         k=ans-'a';
    }
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
//#define ACL
#ifdef ACL
#include <atcoder/all>
using namespace atcoder;
#endif
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
using LD = long double;
using VI = vector<int>;
using VVI = vector<vector<int> >;
using PII = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T> >;
template <typename T> using VVV = vector<vector<vector<T> > >;
void print() {cout << endl;}
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <typename T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <typename T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T> void SORT (T &v) {sort(v.begin(), v.end());}
template <typename T> void SORTR (T &v) {sort(v.begin(), v.end(), greater<>());}
template <typename T> T GCD(T x,T y) {return __gcd(x,y);}
template <typename T> T LCM(T x,T y) {return x/__gcd(x,y)*y;}
template <typename T> int SZ(T v) {return v.size();}
template <typename T> T PCNT(T x) {return __builtin_popcountll(x);}
template <typename T> T BIT(T x) {return 1LL<<(x);}
int INF = 2000000000;
long double PI = acosl(-1);
int MOD = 1000000007;


int32_t main() {
    chrono::system_clock::time_point start_time, end_time;
    start_time = chrono::system_clock::now();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0, res = 0;
    
    int x;
    cin >> x;
    x ^= 1;
    cout << x << endl;

    
    



    end_time = chrono::system_clock::now();
    assert(chrono::duration_cast<chrono::milliseconds>(end_time-start_time).count() < 2500);
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc178/abc178_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc178/abc178_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc178/abc178_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3604
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;


int main() {
    set<int> memo;
    int A, B, C;
    cin >> A >> B >> C;
    for (int i = 1; ; ++i) {
        int m = (A * i) % B;
        if (memo.count(m)) break;
        memo.insert(m);
        if (m == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Otoshidama
    {
        public double value;
        public string type;
        public double sum
        {
            get
            {
                if (type == "BTC")
                {
                    return value * 380000.0;
                }
                else
                {
                    return value;
                }
            }
        }
    }

    class Program
    {

        static void Main()
        {
            //ここから
            int[] vs = ReadLineToIntArray();
            int ans;
            if (vs[1] % vs[0] == 0)
            {
                ans = vs[0] + vs[1];
            }
            else
            {
                ans = vs[1] - vs[0];
            }

            //ここまで


            Console.WriteLine(ans);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }



    }
}


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

int main(){
    
    std::string s, t;

    std::cin >> s >> t;

    size_t cnt = 0;

    for(size_t i = 0; i < 3; i++){
        if(s[i] == t[i]) cnt++;
    }

    std::cout << cnt << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long


signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,temp4=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,anss=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=-1,minn=1e10,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0;
    
    cin>>n>>m;
    int a[n];
    m=m*4;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%m)
    {
        sum=sum/m;
        sum++;
    }
    
    else
    sum=sum/m;
    
    sort(a,a+n,greater<int>());
    //cout<<sum<<endl;
    for(i=0;i<n;i++)
    {
        if(a[i]>=sum)
        {
            ans++;
        }
    }
    
    if(ans>=m/4) cout<<"Yes"<<endl;
    
    else cout<<"No"<<endl;
    
    
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
ll cnt[10][10];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;

	rep(i, 1, N + 1) {
		int btm = i % 10;

		int top = -1, x = i;
		while (0 < x) {
			top = x % 10;
			x /= 10;
		}

		cnt[top][btm]++;
	}

	ll ans = 0;
	rep(Atop, 0, 10) rep(Abtm, 0, 10) ans += cnt[Atop][Abtm] * cnt[Abtm][Atop];
	cout << ans << endl;
}







Measured memory_bytes: 896
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
	re int t=0;
	re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0'){
		t=(t<<3)+(t<<1)+v-48;
		v=getchar();
	}
	return t;
}
int n,m,a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
	n=read();
	printf("%d",a[n-1]);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const string yaku[] = {"null",
		       "one pair",
		       "two pair",
		       "three card",
		       "four card",
		       "straight",
		       "full house"};
int one(int T[]){
  int cnt = 0;
  for(int i = 0 ; i < 4 ; i++){
    if(T[i] == T[i+1])cnt++;
    if(cnt == 1)return 1;
    if(T[i] != T[i+1])cnt = 0;
  }
  return -1;
}

int two(int T[]){
  int cnt = 0,f = 0;
  for(int i = 0 ; i < 4 ; i++){
    if(T[i] == T[i+1])cnt++;
    if(cnt == 2)return 2;
  }
  return -1;
}

int three(int T[]){
  int cnt = 0;
  for(int i = 0 ; i < 4 ; i++){
    if(T[i] == T[i+1])cnt++;
    if(cnt == 2)return 3;
    if(T[i]!=T[i+1])cnt = 0;
  }
  return -1;
}

int four(int T[]){
  int cnt = 0;
  for(int i = 0 ; i < 4 ; i++){
    if(T[i] == T[i+1])cnt++;
    if(cnt == 3)return 4;
    if(T[i] != T[i+1])cnt = 0;
  }
  return -1;
}
int straigt(int T[]){
  int f = 1;
  if(T[0] == 1&&T[4] == 13){
    if(T[1] == 10 && T[2] == 11 && T[3] == 12 )f = 1;
    else f = 0;
  }else{
    for(int i = 0 ; i < 5 ; i++ ){
      if(T[i] != i + T[0])f = 0;
    }
  }
  if(f)return 5;
  else return -1;
}

int fullhouse(int T[]){
  int cmp1=-1,cmp2=-1;
  int cnt = 0;
  //3
  for(int i = 0 ; i < 4 ; i++){
    if(T[i] == T[i+1])cnt++;
    if(cnt == 2){
      cmp1 = T[i];
      break;
    }
    if(T[i] != T[i+1])cnt = 0;
  }
  //2
  cnt = 0;
  for(int i = 0 ; i < 4 ; i++){
    if(T[i] == T[i+1])cnt++;
    if(cnt == 1 && T[i+1] != T[i+2]){
      cmp2 = T[i];
      break;
    }
    if(T[i] != T[i+1])cnt = 0;
  }
  if(cmp1 != cmp2 && cmp1 > 0 && cmp2 > 0)return 6;
  else return -1;
}

int main(){
  int toranpu[5];
  char c;
  while(cin >> toranpu[0]){
    int f = 0;
    for(int i = 1; i < 5 ; i++){
      cin >> c >>toranpu[i];
    }
    sort(toranpu,toranpu+5);

    if(one(toranpu) != -1)f = one(toranpu);

    if(two(toranpu) != -1)f = two(toranpu);

    if(three(toranpu) != -1)f = three(toranpu);

    if(four(toranpu) != -1)f = four(toranpu);

    if(straigt(toranpu) != -1)f = straigt(toranpu);

    if(fullhouse(toranpu) != -1)f = fullhouse(toranpu);

    cout << yaku[f] << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  ll x, k, d;
  cin >> x >> k >> d;
  if(abs(x) / d >= k) {
    cout << abs(x) - d * k << endl;
  } else {
    k -= abs(x) / d;
    x = abs(x) % d;
    if(k % 2 == 0) {
      cout << x << endl;
    } else {
      cout << abs(x - d) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3632
stairs = int(input())
stair_status = list(map(int,input().split(" ")))

move = 0
count = [0]
for i in range(stairs-1):
    if stair_status[i]>=stair_status[i+1]:
        move += 1
        count.append(move)
    else:
        count.append(move)
        move = 0  #reset
    
else:
    print(max(count))

Measured memory_bytes: 14252
(n, m, l) = [int(i) for i in input().split()]

A = []
B = []
for _ in range(n):
    A.append([int(i) for i in input().split()])
for _ in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C = [0 for _ in range(l)]
    for j in range(l):
        for k in range(m):
            C[j] += A[i][k] * B[k][j]
    print(" ".join([str(a) for a in C]))

Measured memory_bytes: 8372
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        cin >> v.at(i);
    }
    for (int i = 0; i < n; i++) {
        cin >> c.at(i);
    }
    vector<int> dif(n);
    for (int i = 0; i < n; i++) {
        dif.at(i) = v.at(i) - c.at(i);
    }
    sort(dif.begin(),dif.end());
    reverse(dif.begin(),dif.end());
    int sum = 0;
    for ( int i = 0; i < n; i++) {
        if (dif.at(i) > 0) {
            sum += dif.at(i);
        }
        else goto last;
    }
    last:
    cout << sum << endl;
}


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

int main() {
    int n,m,temp1,temp2;
    cin>>n>>m;
    vector<bool> f1(n,false),f2(n,false);
    bool flag=false;
    rep(i,m) {
        cin>>temp1>>temp2;
        if (temp1==1) f1[temp2-1]=true;
        if (temp2==n) f2[temp1-1]=true;
    }
    rep(i,n) {
        if (f1[i]&&f2[i]) flag=true;
    }
    if (flag) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
}


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

public class Main {

	public static void main(String[] args) throws Exception {
		
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		
		int x = Integer.parseInt(in.readLine());
		
		System.out.println((long) 1000 * (x/500) + 5 * ((x%500)/5));
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
 
int main(){
int N;
cin>>N;
int K;
cin>>K;
vector<int> dp(N, INT_MAX);
vector<int> h(N);
for(int i=0;i<N;++i)
{
	cin>>h[i];
}
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for(int i = 2; i < N; i++)
{
  for(int k = 1; k <= min(K,i); ++k)
  {
    dp[i] = min(dp[i - k]+abs(h[i]-h[i-k]), dp[i]);
  }
}
cout<<dp[N - 1]<<endl;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> V(n);
	for (int i = 0; i < n; i++) {
		cin >> V[i];
	}
	for (int i = 1; i < n; i++) {		
		for (int j = 0; j < n; j++) {
			cout << V[j];
			if (j < n - 1)
				cout << " ";
			else
				cout << endl;
		}
		int j = i - 1;
		while (j >= 0 && V[j] > V[j + 1]) {
			int a = V[j + 1];
			V[j + 1] = V[j];
			V[j] = a;
			j--;
		}
	}
	for (int j = 0; j < n; j++) {
		cout << V[j];
		if (j < n - 1)
			cout << " ";
		else
			cout << endl;
	}
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int64_t N,K;
  cin>>N>>K;
  vector<int>A(N);
  
  for(int i=0;i<N;i++){
    cin>>A[i];
    A[i]--;
  }
  
  vector<bool>ok(N+1,false);
  vector<int>tab(N+1);
  int c=0;
  int a=0;
  int r=0;
  for(int i=0;i<N;i++){
    c=A[c];
    if(ok[c]){a=i-tab[c];r=tab[c];}
    ok[c]=true;
    tab[c]=i;
  }
  if(N<K){K=(K-r)%a+r;}
  c=0;
  int cnt=0;
  for(int i=0;i<=2*N;i++){
    cnt++;
    c=A[c];
    if(cnt==K){cout<<c+1<<endl;return 0;}
  }
  return 0;
}

Measured memory_bytes: 4796
# coding: utf-8
import sys
import copy

sys.setrecursionlimit(10 ** 9)


def dfs(seen, graph, i):
    for v, w in graph[i]: 
        if seen[v-1] != -1:
            continue
        seen[v-1] = abs((w % 2) - seen[i])
        dfs(seen, graph, v-1)
    

def main():
    n = int(input())
    graph = [[] for _ in range(n)]
    for _ in range(n-1):
        ui, vi, wi = map(int, input().split())
        graph[ui-1].append((vi, wi))
        graph[vi-1].append((ui, wi))
    
    seen = [-1 for _ in range(n)]
    seen[0] = 0
    for i in range(n-1):
        dfs(seen, graph, i)
        
    print(*seen, sep='\n')
        
main()


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int n;
  unsigned long long K;
  cin >> n >> K;
  int log_n = 60;
  std::vector<std::vector<int>> next(log_n + 1, std::vector<int>(n));

  for (int i = 0; i < n; i++) {
    cin >> next[0][i];
    --next[0][i];
  }

  for (int k = 0; k < log_n; ++k) {
    for (int i = 0; i < n; ++i) {
      if (next[k][i] == -1) {
        next[k + 1][i] = -1;
      } else {
        next[k + 1][i] = next[k][next[k][i]];
      }
    }
  }

  int p = 0;

  for (int k = log_n - 1; k >= 0; --k) {
    if (p == -1) {
      break;
    }
    if ((K >> k) & 1) {
      p = next[k][p];
    }
  }

  cout << p + 1 << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 51776
N,M=map(int,input().split())
lst=[0]*M
for i in range(M):
 a,b=map(int,input().split())
 c=list(map(int,input().split()))
 d=0
 for n in range(b):
  d+=2**(c[n]-1)
  lst[i]=(a,d)
ans=[[float("inf") for e in range(2**N)] for f in range(M+1)]
ans[0][0]=0
for j in range(M):
 for i in range(2**N):
  e= i-(lst[j][1]&i)
  ans[j+1][i]=min(ans[j][e]+lst[j][0],ans[j][i])
if ans[M][2**N-1]==float("inf"):
 print(-1)
else:
 print(ans[M][2**N-1])

Measured memory_bytes: 142552
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long N, std::vector<long long> a);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
}

void solve(long long N, std::vector<long long> a){
    int lm = 0;
    REP(i, N){
        lm ^= a[i];
    }
    REP(i, N){
        if(i!=0){
            cout << ' ';
        }
        cout << (lm^a[i]);
    }
    cout << el;
}



Measured memory_bytes: 4840
using System;
using System.Collections.Generic;
using System.Linq;

namespace _079_AreaofPolygon
{
	class Program
	{
		static void Main ( string[] args )
		{
			List<Vector2> list = new List<Vector2> (20);
			string inputStr;

			//input
			while ((inputStr = Console.ReadLine ()) != null)
			{
				decimal[] inputNum = Array.ConvertAll (inputStr.Split (','), decimal.Parse);
				Vector2 v = new Vector2 (inputNum[0], inputNum[1]);
				list.Add (v);
			}

			//process
			decimal area = 0;

			for (int lp = 0; lp < list.Count - 1; lp++)
			{
				decimal edge1 = Vector2.Distance (list[0], list[lp]);
				decimal edge2 = Vector2.Distance (list[0], list[lp+1]);
				decimal edge3 = Vector2.Distance (list[lp], list[lp+1]);
				decimal z = (edge1 + edge2 + edge3) / 2;

				area += Sqrt (z * (z - edge1) * (z - edge2) * (z - edge3));
			}

			Console.WriteLine (area);
		}

		public static decimal Sqrt ( decimal value )
		{
			decimal currentValue = value / 2;
			decimal lastValue = 0m;

			while (currentValue != lastValue)
			{
				lastValue = currentValue;
				currentValue = (currentValue + value / currentValue) / 2;
			}

			return currentValue;
		}
	}

	class Vector2
	{
		public Vector2 ( decimal x, decimal y )
		{
			this.X = x;
			this.Y = y;
		}

		private decimal X { set; get; }
		private decimal Y { set; get; }

		public static decimal Distance ( Vector2 v1, Vector2 v2 )
		{
			decimal x = v1.X - v2.X;
			decimal y = v1.Y - v2.Y;
			return Program.Sqrt (x * x + y * y);
		}
	}
}

Measured memory_bytes: 9336
''' 
    [Bit]
'''
class Bit:
    """ used for only int(>=0) 
        1-indexed (ignore 0-index)
    """
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length()
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def lower_bound(self, x):
        """ 累積和がx以上になる最小のindexと、その直前までの累積和 """
        sum_ = 0
        pos = 0
        for i in range(self.depth, -1, -1):
            k = pos + (1 << i)
            if k <= self.size and sum_ + self.tree[k] < x:
                sum_ += self.tree[k]
                pos += 1 << i
        return pos + 1, sum_

    def get_less_than_x_cnt(self, x):
        """ 累積和がx未満 の個数 """
        lb_pos, lb_sum = self.lower_bound(x)
        return lb_pos-1

    def get_less_than_and_x_cnt(self, x):
        """ 累積和がx以下 の個数 """
        lb_pos, lb_sum = self.lower_bound(x+1)
        return lb_pos-1
    
    def get_more_than_x_cnt(self, x):
        """ 累積和がxより大きい 個数 """
        return self.size - self.get_less_than_and_x_cnt(x)


n = int(input())
pl = list(map(int, input().split()))
pll = []
for i,p in enumerate(pl):
    pll.append((p,i+1))

pll.sort(reverse=True)
bit = Bit(n)
ans = 0
for p,i in pll:
    ix = bit.sum(i)
    # print(ix)
    if ix == 0:
        lmax = 0
        lmin = 0
        lcnt = 0
    else:
        lmax, _ = bit.lower_bound(ix)
        if ix == 1:
            lmin = 0
        else:
            lmin, _ = bit.lower_bound(ix-1)
        lcnt = lmax - lmin
    
    rmin, _ = bit.lower_bound(ix+1)
    rmax, _ = bit.lower_bound(ix+2)
    rcnt = rmax - rmin

    comb = lcnt*(rmin-i) + (i-lmax)*rcnt
    ans += comb*p

    bit.add(i,1)
    # print((p,i))
    # print(lmin,lmax,i,rmin,rmax,'->',comb)
    # print()

print(ans)

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

using namespace std;

#define LL long long 
#define ULL unsigned long long 
#define LD long double 

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int l, r;
	cin>>l>>r;
	if((r-l)>=2019) {
		cout<<0;
		return 0;
	}
	l%=2019;
	r%=2019;
	int w = 2018;
	for(int i=l; i<=r; i++) {
		for(int j=i+1; j<=r; j++) {
			int mod = (i*j)%2019;
			w = min(w, mod);
		}
	}
	cout<<w;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int INF = 1<<29;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

int main(){
	int n,k,i,ans=0;
	cin>>n>>k;
	int s[200005];
	for(i=0;i<n;i++){
		cin>>s[i];
	}
	for(i=0;i<n-1;i++){
		if(s[i]+k>=s[i+1]){
			ans += (s[i+1]-s[i]);
		}else{
			ans += k;
		}
	}
	ans += k;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
// best coder in the world do not mess with me!!
#include <bits/stdc++.h>
#define REP(ii,nn) for(int ii=0; ii<nn ;ii++)
#define FOR(ii, aa, bb) for (int ii = (aa); ii < (bb); ii++)
#define FORD(ii, aa, bb) for(int ii = (aa); ii > (bb); ii--)
#define pb(aa) push_back(aa)
#define fastaff ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lld long long double
#define mp(aa,bb) make_pair(aa,bb)
#define v(a,b) vector<int> a(b)
typedef long long int ll;
using namespace std;
void sol()
{
	long double num1;cin>>num1;cout<<fixed<<setprecision(12)<<num1*num1*num1/27<<endl;
}
int main()
{
	int t = 1;
	while(t--)
	{
		sol();
	}
}

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

using namespace std;

int main()
{
	int a, b, c;

	scanf("%d%d%d", &a, &b, &c);

	if (a < b && b < c) 
		printf("Yes\n");
	else
		printf("No\n");
	return (0);
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int N;
    cin >> N;
    int f = 0;
    int n = N;
    rep(i, 10)
    {
        f += N % 10;
        N /= 10;
    }
    if (n % f == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596