akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <nmmintrin.h>
#include <immintrin.h>
#include <mmintrin.h>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,P) scanf("%d %d %d %d",&n,&m,&o,&P)
#define SINT5(n,m,o,P,q) scanf("%d %d %d %d %d",&n,&m,&o,&P,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1'010'000'000; // 0x3C33'6080
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second


int main() {
	int n, d;
	cin >> n >> d;
	int D = d * 2 + 1;
	cout << (n + D - 1) / D << endl;
		
}



Measured memory_bytes: 256
N = gets.to_i
T, A = gets.split(' ').map(&:to_i)
H = gets.split(' ').map(&:to_i)
teps = []
for h in H do
  tep = T - (h * 0.006)
  teps << tep
end
gaps = []
teps.each_index do |idx|
  gaps << (teps[idx] - A).abs
end
p (gaps.index(gaps.min) + 1)

Measured memory_bytes: 3836
using System;
using System.Collections.Generic;
namespace std
{
    class Test 
    {
        static void Main(string[] args) {
            var n = Console.ReadLine();
            var num = int.Parse(n);
            int [] input = new int[num]; 
            bool rtn;
            int cnt = 0;

            for( int i = 0; i < num; i++) {
                input[i] = int.Parse(Console.ReadLine());
            }
            Test obj = new Test();
            
           
            for( int i = 0; i < num; i++) {
                rtn = obj.isprime(input[i]);
                if(rtn == true) cnt++;
            }
            Console.WriteLine(cnt);

        }
        public bool isprime(int x) {
        
        
            if (x == 2) return true;
                
            // if x < 2 または x が偶数
            if (x < 2 || x % 2 == 0)  return false;

            int i = 3;
            //  while i <= x の平方根
            while (i <= Math.Sqrt((double)x)) {
            if( x % i == 0)   return false;
            i = i + 2;
            }
            
            return true;
          
        }
    }
}


Measured memory_bytes: 8204
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
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; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  string S;
  int ans1=0,ans2=0;
  cin >> S;
  rep(i,S.size()){
    if(i%2==0){
      if(S[i]=='0');
      else ans1++;
    }
    else{
      if(S[i]=='1');
      else ans1++;
    }
  }
  rep(i,S.size()){
    if(i%2==1){
      if(S[i]=='0');
      else ans2++;
    }
    else{
      if(S[i]=='1');
      else ans2++;
    }
  }
  cout << min(ans1,ans2) << endl;
  return 0;
}


Measured memory_bytes: 512
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
//    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
//    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    if (p == 2 || p == 5) {
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if ((s[i] - '0') % p == 0) ans += i + 1;
        }
        cout << ans;
        return 0;
    }
    map<int, int> cnt;
    int cur = 0, pw = 1;
    int ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        cur = ((s[i] - '0') * pw + cur) % p;
        pw = (pw * 10) % p;
//        cout << i << " " << cur << "\n";
        ans += cnt[cur];
        if (cur == 0) ans++;
        cnt[cur]++;
    }
    cout << ans;
}
/*

*/


Measured memory_bytes: 1020
A=int(input())
B=int(input())
C=int(input())
X=int(input())
s=0
for i in range(A+1):
  x=X-500*i
  if x<0: break
  for t in range(B+1):
    if x<0: break
    elif 50*C>=x:
      s+=1
      x-=100
    else: x-=100
print(s) 

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

int main()
{
  int N, A, B;
  cin >> N; 
  
  if (N == 1)  
    cout << "Hello World" << endl;
  else {
    cin >> A >> B;
    cout << A + B << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define for_list(a) for(auto i:a)
#define f(s,a) for(int i=0;i<s;i++) cin>>a[i];

int count = 0;
void show(int a[201][201]){
    for (int i = 0; i < 201; ++i)
    {
        for (int j = 0; j < 201; ++j)
        {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }

}
 
template<typename T>
vector<int> maxmax_list(T a){
    int l = INT_MIN,p = INT_MAX;
    for_list(a){
        l = max(l,i);
        p = max(i,p);
    }
    vector<int> v = {l,p};
    return v;
}
ll power(ll a,ll b){
    ll s;
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    if(b%2 == 0){
        s = power(a,b/2);
        return s*s;
    }
    else{
        s = power(a,(b-1)/2);
        return a*s*s;
    }
}
int randomize(){
    return (rand()%10000);
}
int b[100000];
int main()
{
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    // cout <<fixed;
    // cout << setprecision(2);
    ll n;cin >> n;
    ll a[n][3];
    for (int i = 0; i < n; ++i)
    {
        cin >>a[i][0];
        cin >>a[i][1];
        cin >> a[i][2];
    }
    ll dp1[n][3];
    dp1[0][0] = a[0][0];
    dp1[0][1] = a[0][1];
    dp1[0][2] = a[0][2];
    for (int i = 1; i < n; ++i)
    {
        dp1[i][0] = max(dp1[i-1][1],dp1[i-1][2]) + a[i][0];
        dp1[i][1] = max(dp1[i-1][0],dp1[i-1][2]) + a[i][1];
        dp1[i][2] = max(dp1[i-1][0],dp1[i-1][1]) + a[i][2];
    }
    cout << max(max(dp1[n-1][0],dp1[n-1][1]),dp1[n-1][2]) << endl;
}

Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int n,a[201];
	cin >> n;
	REP(i, n) {
		cin >> a[i];
	}
	int count = 0;
	while (1) {
		REP(i,n) {
			if(a[i] % 2 != 0) {
				cout << count << endl;
				return 0;
			}
		}
		count++;
		REP1(j, n) a[j] /= 2;
		
	}
	return 0;
}



Measured memory_bytes: 256
n = int(input())
framelist = [int(i) for i in input().split()]

sum = 0


for i in range(n):
  sum += framelist[i]

avg = sum /n

min = avg
value = 0

for i in range(n):
  difference = abs(framelist[i]-avg)
  if min>difference:
    min = difference
    value = framelist[i]
    
print(framelist.index(value))

Measured memory_bytes: 3064
from collections import defaultdict

def get_modulos():
    modulos = []
    for i in range(224):
        modulos.append(10**i%2019)
    return modulos

def count_substring(s):
    found_remainder = defaultdict(int)
    current_mod = 0
    found_remainder[0] = 1

    output = 0

    modulos = get_modulos()
    for i in range(len(s)-1,-1,-1):
        digit = s[i]
        current_mod =  (int(digit)*modulos[(len(s)-1-i)%224] % 2019 + current_mod) % 2019
        # print(i, current_mod)
        output += found_remainder[current_mod]
        found_remainder[current_mod] += 1
    #print(dict(found_remainder))

    return output

s = input()
print(count_substring(s))

Measured memory_bytes: 9576
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
const int xdirec[] = { -1, 0, 1, 0 };
const int ydirec[] = { 0, -1, 0, 1 };

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x%mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

vector<ll> fac(1000001); // m! (mod M)
vector<ll> ifac(1000001);// k!^{M-2} (mod M)
ll mpow(ll x, ll n)
{
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans*x%mod;
		x = x*x%mod;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll n, ll r)
{
	if (n == 0 && r == 0) return 1;
	if (n < r || n < 0) return 0;
	ll tmp = ifac[n - r] * ifac[r] % mod;
	return tmp * fac[n] % mod;
}
int main()
{
	// ABC145-D, 1001, 
	int x, y;
	cin >> x >> y;
	int n = x + y;
	if (n % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	n /= 3;
	if (x < n || y < n) {
		cout << 0 << endl;
		return 0;
	}
	int r = n;
	r -= max(x, y) - min(x, y);
	r /= 2;

	fac[0] = ifac[0] = 1;
	for (ll i = 0; i < 1000000; ++i) {
		fac[i + 1] = fac[i] * (i + 1) % mod;
		ifac[i + 1] = ifac[i] * mpow(i + 1, mod - 2) % mod;
	}

	ll ans = comb(n, r) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 18580
#include<stdio.h>
int main(void)
{
    int i,a,b,c;
	scanf("%d",&a);
	for(i=0;i<a;i++){
	scanf("%d%d",&b,&c);
	if(b%c==0){
	printf("%d\n",c);
	}
	else{
	printf("%d\n",b%c);
	}
	}
	return 0;
	}

Measured memory_bytes: 596
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, X = nl()
Ls = nl()

count = 1
p = 0
for i in range(N):
    p = p + Ls[i]
    if p <= X:
        count += 1

print(count)


Measured memory_bytes: 3060
def factlist(n):
  res = [1]
  for i in range(n):
    res.append(res[i] * (i+1))
  return res

def dic_ord(n, a):
  fact = factlist(n-1)
  b = list(range(1, n+1))
  res = 0
  for i in range(n-1):
    j = b.index(a[i])
    res += fact[n-i-1] * j
    b.pop(j)
  return res

n = int(input())
a = list(map(int,input().rstrip().split()))
b = list(map(int,input().rstrip().split()))

print(abs(dic_ord(n, a)-dic_ord(n, b)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

void solve(istream& cin, ostream& cout) {
  int s, w;
  cin >> s >> w;
  if (w >= s) cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)

#define INF 2e9
#define ALL(v) v.begin(), v.end()

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

Measured memory_bytes: 3632
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i32>();
    let (n, m) = (line[0], line[1]);

    if n == m{
        println!("Yes");
    }else{
        println!("No");
    }
}


Measured memory_bytes: 4352
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let s = scan!();
    let ss: Vec<&str> = s.split('/').collect();
    let n = ss[0].parse::<i32>().unwrap() * 10000
        + ss[1].parse::<i32>().unwrap() * 100
        + ss[2].parse::<i32>().unwrap();
    if n <= 20190430 {
        println!("Heisei");
    } else {
        println!("TBD");
    }
}


Measured memory_bytes: 4352
/*
  Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present.
  Author - Aryan Choudhary (@aryanc403)
 
  const short DEBUG { 0 };
  #define debug(x) if (DEBUG) cout << #x << " = " << x << '\n'
*/

#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"
#define PI 3.1415926535897932384626433832795
typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

//const lli [3] ={ 999119999L,1000000007L,1000992299L};
//const lli [3] ={ 97L,101L,103L};
//const lli  = chrono::high_resolution_clock::now().time_since_epoch().count();
clock_t time_p=clock();
void aryanc403()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

class CMP
{
public:
    bool operator()(lli a , lli b) //For min priority_queue .
    {
        return ! ( a <= b );
    }
};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    map<lli,lli> ::iterator jt;
    jt=m.find(x);
    if(jt==m.end())         m.insert(mp(x,cnt));
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    map<lli,lli> ::iterator jt;
    jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}
const lli INF = 0xFFFFFFFFFFFFFFFL;
const lli mod = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r;
    lli m;
    string s;
    vi a;
    vi :: iterator it;
    //priority_queue < lli , vector < lli > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>k;
    if(k<=(n+1)/2)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}   aryanc403();
    return 0;
}

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

typedef int ll;

#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()

typedef pair<int,int>pii;
typedef pair<int,pair<int,int> > piii;

const int mod=1e9+7;

int POWER[65];
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
int inv(int x) {return power(x,mod-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}

vector<pii>v,v1;
ll main() {
	// freopen("Task.in","r",stdin);freopen("Task.out","w",stdout);
	int n,m;
	cin>>n>>m;

	for (int i=0 ; i<n ; i++) {
		int a,b;
		cin>>a>>b;
		v.pb(mp(a,b));
	}	

	for (int i=0 ; i<m ; i++) {
		int a,b;
		cin>>a>>b;
		v1.pb(mp(a,b));
	}

	for (int i=0 ; i<v.size() ; i++) {
		int val=-1,idx=0;
		for (int j=0 ; j<v1.size() ; j++) {
			int dis=abs(v[i].ff-v1[j].ff)+abs(v[i].ss-v1[j].ss);
			if(val==-1 || val>dis) {
				val=dis;
				idx=j+1;
			}
		}
		cout<<idx<<endl;	
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define rept(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(v) v.bigin(),v.end()
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
int main(){
    ll x,n,s,a,k;
    k=0;
    cin>>x>>n;
    ll p[n];
    s=x;
    a=x;
    rep(i,n){
        cin>>p[i];
    }
    sort(p,p+n);
    rept(i,n){
        if(a==p[i]){
            a-=1;
        }
    }
    rep(i,n){
        if(s==p[i]){
            s+=1;
        }
    }
    if(s-x<x-a){
        cout<<s;
    }
    else{
        cout<<a;
    }
}



Measured memory_bytes: 3620
import java.util.Scanner;


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

			Scanner sc = new Scanner(System.in);
			
			double n = sc.nextDouble();
			double m = sc.nextDouble();
			
			double ret = ((n-m)*100+m*1900)*Math.pow(2.0, m);
			
			System.out.println((int)ret);
			
	    }
		
	}
	


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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var ab = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var a = ab[0] * ab[1];

            for(int i = 1; i <= 3; i++) {
                if(a * i % 2 == 1) {
                    Console.WriteLine("Yes");

                    Console.Out.Flush();
                    return;
                }
            }

            Console.WriteLine("No");

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
# coding:UTF-8
import sys
from math import factorial


def comb(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)


def perm(n, r):
    return factorial(n) // factorial(r)


def resultSur97(x):
    return x % (10 ** 9 + 7)

def dfs(s,n):
    if int(s) > n:
        return 0
    if all(s.count(c) > 0 for c in "753"):
        ret = 1
    else:
        ret = 0
    for c in '753':
        ret += dfs(s+c, n)
    return ret

if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    a = int(input())    # 数字

    # ------ 処理 ------#



    # ------ 出力 ------#
    print("{}".format(dfs("0", a)))
    # if flg == 0:
    #     print("YES")
    # else:
    #     print("NO")


Measured memory_bytes: 9096
a, b, c, k = map(int, input().split())


sum = 0
rest_k = k

if rest_k <= a:
    sum += rest_k
    rest_k = 0
else:
    sum += a
    rest_k -= a

if rest_k <= b:
    rest_k = 0
else:
    rest_k -= b

sum -= rest_k

print(sum)

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

int main() {
	long long N;
	cin >> N;
	long long sum =0;
	for(long long i=1;i<=N;i++){
	    if(i%3 && i%5){
	        sum += i;
	    }
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
struct po{int v,h;};
int dice[7][4] = {
  {0,0,0,0}//0
  ,{3,5,4,2}//1
  ,{4,6,3,1}//2
  ,{6,5,1,2}//3
  ,{5,6,2,1}//4
  ,{3,6,4,1}//5
  ,{4,5,3,2}//6
};
po mp[50][50];  

void check() {
  int cnt[7] = {};
  for(int i=0;i<50;i++)
    for(int j=0;j<50;j++)
      cnt[mp[i][j].v]++;

  for(int i=1;i<=6;i++){ 
    cout << cnt[i];
    if(i != 6) cout <<" ";
  }
  cout << endl;
}

void make(int top ,int front) {
  int nx = 25,ny = 25;
  int H = mp[ny][nx].h+1;
  int flg[7] = {};
  int dx[] = {0,1,0,-1},dy[] = {-1,0,1,0};
  while(1){
    int k,fsite,maxn= -1;
    for(int i=0;i<4;i++) {
      if(flg[dice[top][i]]==0 && maxn<dice[top][i]) maxn = dice[top][i],k = i;
      if(dice[top][i]==front) fsite = i;
    }
    if(maxn == -1 || maxn < 4) break;

    int dir;
    if(fsite-k == 1 ||  fsite-k == -3) dir = 3;
    else if(fsite-k == 2 || fsite-k == -2) dir = 0;
    else if(fsite-k==3 || fsite-k == -1) dir = 1;
    else  dir = 2;
 
    if(mp[ny+dy[dir]][nx+dx[dir]].h+1 < H) {
      nx += dx[dir],ny += dy[dir];
      if(dir == 0) front = 7-top;
      if(dir == 2) front = top;
      top = 7 - maxn;
      H = mp[ny][nx].h + 1;
      flg[4] = flg[5] = flg[6] = 0;
    } else flg[maxn] = 1;
  }
  mp[ny][nx].v = top,mp[ny][nx].h = H;
}

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    for(int i=0;i<50;i++) 
      for(int j=0;j<50;j++)
	mp[i][j].h = mp[i][j].v = 0;

    for(int q=0;q<n;q++){
      int top,front;  
      cin >> top >> front;
      make(top,front); 
    }
    check();
  }
  return 0;
}

Measured memory_bytes: 1180
import java.util.*;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String[]s = new String[N];
    
    int a=0, w=0, t=0, r=0;
    for(int i=0; i<N; i++){
        s[i]=sc.next();
        if(s[i].equals("AC")){
           a++;
        }else if(s[i].equals("WA")){
            w++;
        }else if(s[i].equals("TLE")){
            t++;
        }else if(s[i].equals("RE")){
            r++;
        }
}
    System.out.println("AC x "+a);
    System.out.println("WA x "+w);
    System.out.println("TLE x "+t);
    System.out.println("RE x "+r);
        
    }

}



Measured memory_bytes: 64116
import Foundation

func readInt() -> [Int]{
    return readLine()!.split(separator:" ").map{Int($0)!}
}

let nk = readInt()
let A = readInt()

for i in 1...nk[0] - nk[1]{
  let e = i - 1
  if(A[e + nk[1]] > A[e]){
    print("Yes")
  }else{
    print("No")
  }
}

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

#define MOD 1000000007
#define MOD99 998244353
 
int main(){
  int n,m;
  int a,b;
  int maxi = 0;
  set<int> groups;
  cin >> n >> m;
  dsu g(n);
  for(int i = 0;i < m;i++){
    cin >> a >> b;
    a--;
    b--;
    g.merge(a,b);
  }
  for(int i = 0;i < n;i++){
    groups.insert(g.leader(i));
  }
  cout << groups.size() - 1 << endl;
}

Measured memory_bytes: 7496
n = int(input())
s = [input()for _ in range(n)]
m = int(input())
t = [input()for _ in range(m)]
d = {}
for i in s:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
for i in t:
    if i not in d:
        d[i] = -1
    else:
        d[i] -= 1
d = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(max(d[0][1], 0))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x;
	cin >> x;
	if(x>=400 && x<=599)
		cout << 8 << endl;
	else if(x>=600 && x<=799)
		cout << 7 << endl;
	else if(x>=800 && x<=999)
		cout << 6 << endl;

	else if(x>=1000 && x<=1199)
		cout << 5 << endl;

	else if(x>=1200 && x<=1399)
		cout << 4 << endl;

	else if(x>=1400 && x<=1599)
		cout << 3 << endl;

	else if(x>=1600 && x<=1799)
		cout << 2 << endl;
	
	else if(x>=1800 && x<=1999)
		cout << 1 << endl;

	return 0;
}


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

int gcd(int x, int y) {
	return y ? gcd(y, x % y): x;
}
int main()
{
	int x, y;
	scanf("%d %d", &x, &y);
	printf("%d\n", gcd(x, y));
	return 0;
}


Measured memory_bytes: 3220
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, k; cin >> n >> k;
	ll tst = 1, cnt = 0;
	while(tst <= n) { tst *= k; cnt++; }
	println(cnt);
}


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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, s;
    cin >> n >> s;
    if (n < s) {
        cout << -1;
        return 0;
    }
    if (n == s) {
        cout << s + 1;
        return 0;
    }
    ll ans = n * 2;
    for (ll b = 2; b * b <= n; ++b) {
        ll t = n, k = 0;
        while (t) {
            k += t % b;
            t /= b;
        }
        if (k == s) {
            ans = min(ans, b);
        }
    }
    for (ll x = 1; x * x <= n; ++x) {
        ll b = (n - s) / x + 1;
        if (x < b && n / b + n % b == s) {
            ans = min(ans, b);
        }
    }
    if (ans < n * 2) {
        cout << ans;
    } else {
        cout << -1;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- Coding: utf-8 -*-
import math


def main():
    time = int(input())  #標準入力を行う
    h = math.floor(time / 3600) #時間
    m = math.floor((time - h*3600) / 60)    #分
    s = time - h*3600 - m*60    #秒
    print('{0}:{1}:{2}'.format(h, m, s))


main()


Measured memory_bytes: 5656
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>a>>b;
	cout<<a*b<<endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}
 
void solve() {
    int n, w;
    cin >> n >> w;
    vector<vector<int>> dp(n + 1, vector<int>(1001 * n, INF));
    dp[0][0] = 0;
    int u, v;
    REP(i, n) {
        cin >> u >> v;
        REP(j, 1001 * n) {
            dp[i + 1][j] = dp[i][j];
            if (j - v >= 0) chmin(dp[i + 1][j], dp[i][j - v] + u);
        }
    }
    REPR(i, 1001 * n) {
        if (dp[n][i] <= w) {
            cout << i << EOL;
            return;
        }
    }
}


Measured memory_bytes: 40192
import sys
input = sys.stdin.readline

H, W, N = map(int, input().split())
ab = set(tuple(map(int, input().split())) for i in range(N))

dxy = {0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}
num_all = (H - 2) * (W - 2)
num = [0] * 10
for a, b in ab:
  for i in range(3):
    Da = dxy[i]
    for j in range(3):
      n = 0
      flag = False
      Db = dxy[j]
      for da in Da:
        aa = a + da
        for db in Db:
          bb = b + db
          if aa < 1 or H < aa or bb < 1 or W < bb:
            flag = True
            break
          if (aa, bb) in ab:
            n += 1
        if flag:
          break
      if flag:
        continue
      num[n] += 1

for i in range(2, 10):
  num[i] //= i

num[0] = num_all - sum(num[1:])
print(*num, sep='\n')

Measured memory_bytes: 64344
(function(stdin) {
  var lines = stdin.trim().split('\n');
  var n = parseInt(lines.shift(), 10);
  var m = [];
  for (var i = 0; i < n; i++) {
    m[i] = [];
    for (var j = 0; j < n; j++) {
      m[i][j] = Infinity;
    }
  }
  lines.map(function(row) {
    var nums = row.trim().split(' ').map(Number);
    var u = nums.shift();
    var k = nums.shift();
    for (var i = 0; i < k; i++) {
      var v = nums.shift();
      var c = nums.shift();
      m[u][v] = c;
    }
  });
  var d = [], p = [], color = [];
  for (var i = 0; i < n; i++) {
    color[i] = 'WHITE';
    d[i] = Infinity;
  }
  d[0] = 0;
  p[0] = -1;
  var minv, u;
  while (1) {
    minv = Infinity;
    for (var i = 0; i < n; i++) {
      if (color[i] != 'BLACK' && d[i] < minv) {
        minv = d[i];
        u = i;
      }
    }
    if (minv == Infinity) {
      break;
    }
    color[u] = 'BLACK';
    for (var v = 0; v < n; v++) {
      if (color[v] != 'BLACK' && m[u][v] != Infinity) {
        if (d[u] + m[u][v] < d[v]) {
          d[v] = d[u] + m[u][v];
          p[v] = u;
          color[v] = 'GRAY';
        }
      }
    }
  }
  console.log(d.map(function(c, i) {return [i, c].join(' ');}).join('\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 17888
#include <iostream>

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


using namespace std;

int main(){
	int n, a, b, fr[100005], ans=1;
	cin >> n;
	REP(i,100005){ fr[i] = 0;}
	fr[0] = 1;
	REP(i,n){
		cin >> a >> b;
		fr[a]++;
		fr[b+1]--;
	}
	REP(i,100004){
		fr[i+1] += fr[i];
	}
	for (int i=0; i<=n+1; i++){
		if (fr[i]>ans && fr[i]>=i){
			ans = min(i, fr[i]);
		}
	}
	
	
	//REP(i,10) cerr << fr[i] << " ";
	//cerr << endl;
	
	cout << ans-1 << endl;
	
}


Measured memory_bytes: 3480
#include <bits/stdc++.h>
#define INF 1e9+7
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int lo;

lo a,b,c;
map <lo,lo> m;
int main(){
    cin >> a >> b >> c;
    m[a]++;
    m[b]++;
    m[c]++;
    if(m[5] == 2 and m[7] == 1) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	ll x;
	cin >> x;
	ll r = (x/500)*1000;
	x -= (x/500)*500;
	r += (x/5)*5;
	cout << r << endl;
	return 0;
}



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

int main() {
  int A, B;
  cin >> A >> B ;
   
 if(A + B >= A - B && A + B >= A * B)
 { cout << A + B << endl;
 }
 else if(A - B >= A + B && A - B >= A * B)
 { cout << A - B << endl;
 }
 else if(A * B >= A + B && A * B >= A - B)
 {cout << A * B << endl;
 }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N=2e5+5;
int n,a[N],XoR;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		XoR^=a[i];
	}
	for(int i=0;i<n;i++)
		cout<<(a[i]^XoR)<<" ";
}


Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl;
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; }

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    ll H,W;
    cin >> H >> W;
    if(H % 3 == 0 || W % 3 == 0){
        cout << 0 << endl;
        return 0;
    }
    ll A = H/2*W;
    ll B = (H-H/2)*W;
    ll C = 0;
    ll minv = INF;
    while(B >= 0){
        minv = min(minv,abs(max({A,B,C})-min({A,B,C})));
        A -= H/2;
        B -= (H-H/2);
        C += H;
    }
    A = W/2*H;
    B = (W-W/2)*H;
    C = 0;
    while(B >= 0){
        minv = min(minv,abs(max({A,B,C})-min({A,B,C})));
        A -= W/2;
        B -= (W-W/2);
        C += W;
    }
    minv = min(minv,W);
    minv = min(minv,H);
    cout << minv << endl;
}

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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  
  
  int count = 0;
  for(int j=1;j<=N;j++){
  string s = to_string(j);
  int sum = 0;
  for(int i=0; i<s.size(); i++){
    sum += s.at(i)-'0';
  }
  if(A <= sum&&sum <= B){
    count += j;
  }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define st first
#define sc second
#define arr array
#define yes cout << "Yes" <<"\n"
#define no cout << "No" <<"\n"
#define lb lower_bound
#define ub upper_bound
#define fast ios_base::sync_with_stdio(false)
#define out cin.tie(nullptr)
#define task "A"
#define open(task)  if(fopen(task".inp", "r")){freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout);}
#define open_to_check(task)  if(fopen(task".inp", "r")){freopen(task".inp", "r", stdin);}

using namespace std;

const int maxn = 2e6 + 1;
const ll mod = 1e9 + 7;
const ll lim = 1e18;


int main()
{
    //open_to_check(task);
    ll k;
    cin >> k;
    ll sum = 0;
    for(int i=1; i<=maxn; i++){
        sum = sum*10 + 7;
        sum %= k;
        if(sum == 0){
            cout << i;
            return 0;
        }
    }
    cout << -1;
}
/*
6 8
1 2
1 3
2 3
2 4
2 6
3 5
3 6
4 5

*/


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

int main() 
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if (a+b>c+d)
        cout << "Left";
    else if (a+b<c+d)
        cout << "Right";
    else 
        cout << "Balanced";    
    return 0;
}

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

int main(){
  string S;
  cin >> S;
  int N = S.length();
  for(int i=0; i<(N-1)/2; i++){
    if(S[i]!=S[(N-1)/2-1-i]||S[(N+3)/2-1+i]!=S[N-1-i]||S[i]!=S[N-1-i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long
typedef pair<ll , ll > pii;
ll mod=998244353;
ll p=1e9+7;
const double PI = 3.14159265358979323846;
void solve(){
    int n,m;
    cin>>n>>m;
    int N=n+1;
    int parent[N];
    vector<int> adj[N];
    bool vis[N];
    int set=1;
    memset(vis,false,N);
    for(int i=0; i<m;i++){
        int u,v; cin>>u>>v;
        adj[v].push_back(u);
        adj[u].push_back(v);
    }
    queue<int> q;
    q.push(1);
    vis[1]=true;
    while(!q.empty()){
        int i=q.front(); q.pop();
        for(int u : adj[i]){
            if(!vis[u]){
                parent[u]=i;
                set++;
                //cout<<set<<" "<<u<<endl;
                vis[u]=true;
                q.push(u);
            }
        }
    }
    if(set == n ){
        cout<<"Yes"<<endl;
        for(int i=2; i<=n; i++){
            cout<<parent[i]<<endl;
        }
    }
    else{
        cout<<"No"<<" "<<set;
    }
}
int  main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    
    return 0;
}
 

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

using namespace std;

class UnionFindTree {
private:
    vector<int32_t> parent, rank;

    int32_t find(int32_t x) {
        if (parent[x] == x) {
            return x;
        } else {
            int32_t p = find(parent[x]);
            parent[x] = p;
            return p;
        }
    }

public:
    UnionFindTree(int32_t n) {
        parent.resize(n);
        rank.resize(n);

        for (int32_t i = 0; i < n; i++) {
            parent[i] = i;
            rank[i] = 0;
        }
    }

    void unite(int32_t x, int32_t y) {
        x = find(x);
        y = find(y);

        if (x == y) return;

        if (rank[x] < rank[y]) {
            parent[x] = y;
        } else {
            parent[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
    }

    bool same(int32_t x, int32_t y) {
        return find(x) == find(y);
    }
};

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

    UnionFindTree uf(n);

    for (int32_t i = 0; i < q; i++) {
        int32_t com, x, y;
        scanf("%d %d %d", &com, &x, &y);

        if (com) printf("%d\n", uf.same(x, y) ? 1 : 0);
        else uf.unite(x, y);
    }

    return 0;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var vs = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
			int n = vs[0];
			int d = vs[1];
			int[,] loc = new int[n, d];
			for (int i = 0; i < n; i++) {
				var vs1 = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
				for (int j = 0; j < d; j++) {
					loc[i, j] = vs1[j];
				}
			}

			int ans = 0;
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					double sum = 0;
					for (int k = 0; k < d; k++) {
						sum += Math.Pow(loc[i, k] - loc[j, k], 2);
					}
					double dis = Math.Sqrt(sum);
					if (Math.Floor(dis) == dis) {
						ans++;
					}
				}
			}
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 13396
#include <stdio.h>
#include <math.h>

int main(){
	int q,i;
	double x = 0.0;
	while(1){
		scanf("%d",&q);
		if(q == -1) break;
		x = (double)q / 2.0;
		while(fabs(x * x * x - (double)q) >= 0.00001 * (double)q){
			x = x - (x * x * x - (double)q) / (3.0 * x * x);
		}
		printf("%f\n",x);
	}
	return 0;
}

Measured memory_bytes: 632
process.stdin.resume();
process.stdin.setEncoding("utf8");

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', solve);

function solve() {
  const N = lines[0];
  let a = lines[1].split(' ');
  let count = 0;

  for(let i = 0; i < a.length;  i = i + 2) {
    if(parseInt(a[i]) % 2 === 1) {
      count++;
    }
  }

  console.log(count);
}

Measured memory_bytes: 29976
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef struct point
{
        long long x,y;
        bool operator < (const struct point & t)const
        {
                return x==t.x?y<t.y:x<t.x;
        }
}POINT,*PPOINT;
POINT arr[200002];
long long h,w;
long long fac[200002],inv[200002],f[200002];
void init()
{
        int i;
        fac[0]=fac[1]=inv[0]=inv[1]=1;
        for(i=2;i<=h+w-2;i++)
                inv[i]=-MOD/i*inv[MOD%i]%MOD;
        for(i=2;i<=h+w-2;i++)
        {
                fac[i]=fac[i-1]*i%MOD;
                inv[i]=inv[i-1]*inv[i]%MOD;
        }
}
long long comb(long long n,long long m)
{
        return fac[n]*inv[n-m]%MOD*inv[m]%MOD;
}
int main()
{
        long long i,j,n;
        scanf("%lld %lld %lld",&h,&w,&n);
        for(i=0;i<n;i++)
        {
                scanf("%lld %lld",&arr[i].x,&arr[i].y);
        }
        arr[n].x=h;
        arr[n].y=w;
        sort(arr,arr+n+1);
        init();
        for(i=0;i<=n;i++)
        {
                f[i]=comb(arr[i].x+arr[i].y-2,arr[i].x-1);
                for(j=0;j<i;j++)
                {
                        if(arr[j].y<=arr[i].y)
                        f[i]=f[i]-f[j]*comb(arr[i].x-arr[j].x+arr[i].y-arr[j].y,arr[i].x-arr[j].x)%MOD;
                }
                f[i]=(f[i]+MOD)%MOD;
        }
        printf("%lld\n",(f[n]+MOD)%MOD);
}


Measured memory_bytes: 4864