akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int H, W; cin >> H >> W;
    vector<vector<string>> S(H, vector<string>(W)); cin >> S;
    REP(i, H) REP(j, W){
        if(S[i][j] == "snuke"){
            cout << (char)('A' + j) << i + 1 << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int maxn = 200200;
const int mod = 1e9 + 7;
const int N = 2010;
typedef long long ll;
int n;
int A[N + N][N + N], B[N][N];
int fac[maxn], ifac[maxn], inv[maxn];
int main() {
	std::ios::sync_with_stdio(false), std::cin.tie(0);
	fac[0] = fac[1] = ifac[0] = ifac[1] = inv[1] = 1;
	for(int i = 2;i < N + N + N + N;++i) {
		inv[i] = ll(mod - mod / i) * inv[mod % i] % mod;
		fac[i] = (ll) fac[i - 1] * i % mod;
		ifac[i] = (ll) ifac[i - 1] * inv[i] % mod;
	}
	std::cin >> n;
	int ans = 0;
	for(int i = 0, a, b;i < n;++i) {
		std::cin >> a >> b;
		++ A[a + N][b + N];
		++ B[a][b];
		ans = (ans + (ll) (mod - fac[a + a + b + b]) * ifac[a + a] % mod * ifac[b + b]) % mod;
	}
	for(int i = 4010;i >= 0;--i) for(int j = 4010;j >= 0;--j)
		A[i][j] = ((unsigned) A[i + 1][j] + A[i][j + 1] + A[i][j]) % mod;
	for(int i = N;i >= 1;--i) for(int j = N;j >= 1;--j) 
		ans = (ans + (ll) A[i][j] * B[N - i][N - j]) % mod;
	std::cout << ans * ll(mod + 1 >> 1) % mod << '\n';
}


Measured memory_bytes: 79488
from collections import Counter
N = int(input())
s = [input() for _ in range(N)]
#a = list(map(int, input().split()))

c = Counter(s)


imax = len

values, counts = zip(*c.most_common())

for i in range(len(counts)):
    if counts[0]==counts[i]:
        imax = i

value = [values[i] for i in range(imax+1)]
value.sort()
print(*value, sep='\n')



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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};

int main() {
  int N;

  while(cin >> N, N) {
    vector<pii> p(N);
    int ax = 0, ix = 0, ay = 0, iy = 0;
    REP(i, N - 1){
      int n, d;
      cin >> n >> d;
      p[i + 1].first = p[n].first + dx[d];
      p[i + 1].second = p[n].second + dy[d];
      ax = max(ax, p[i + 1].first);
      ix = min(ix, p[i + 1].first);
      ay = max(ay, p[i + 1].second);
      iy = min(iy, p[i + 1].second);
    }
    printf("%d %d\n", ax - ix + 1, ay - iy + 1);
  }
}

Measured memory_bytes: 3208
n = int(input())
li = [111,222,333,444,555,666,777,888,999]
nn = []
for i in range(len(li)):
  if li[i] - n >= 0:
    nn.append(li[i]-n)
  else:
    nn.append(1000)
  
print(li[nn.index(min(nn))])

Measured memory_bytes: 3060
/*
Dice III
ITP1_11_C
サイコロの同一チェック
*/

package main

import "fmt"

/*
出目を含む面番号のスライスを返す

(引数)
dice	: ダイス配列
fig		: 数字

(戻り値)
面番号	: 0~5
		: 6のとき	存在しない
*/
func fno(dice [6]int, fig int) []int {
	var i int
	deme := []int{}

	for i = 0; i < 6; i++ {
		if dice[i] == fig {
			deme = append(deme, i)
		}
	}

	return deme
}

/*
ダイスの裏面の数字を取得する
(引数)
dice	: ダイス配列
no		: 面番号(0~5)

(戻り値)
裏面の数字
*/
func tail(dice [6]int, no int) int {
	return dice[5-no]
}

/*
ダイスの側面の数字を配列で取得する
(引数)
dice	: ダイス配列
no		: 面番号(0~5)

(戻り値)
裏面数字の配列
*/
func side(dice [6]int, no int) [4]int {
	// 面に対する側面の配列(時計回り)
	side_no_idx := map[int][4]int{
		0: {1, 3, 4, 2},
		1: {2, 5, 3, 0},
		2: {0, 4, 5, 1},
		3: {0, 1, 5, 4},
		4: {0, 3, 5, 2},
		5: {1, 2, 4, 3},
	}

	var side_no [4]int

	for i := 0; i < 4; i++ {
		side_no[i] = dice[side_no_idx[no][i]]
	}

	return side_no
}

/*
側面の数字が同じか調べる
(引数)
side	: 側面の数字×4面

(戻り値)
true	: 側面は同じ
fals	: 側面は違う
*/
func is_same_side(side1 [4]int, side2 [4]int) bool {
	var i int

	for i = 0; i < 4; i++ {
		if side1[0] == side2[i] {
			break
		}
	}

	if i == 4 {
		return false
	}

	side3 := append(side2[i:], side2[:i]...)
	for i := 0; i < 3; i++ {
		if side1[i] != side3[i] {
			return false
		}
	}

	return true
}

func main() {
	var dice1, dice2 [6]int

	for i := 0; i < 6; i++ {
		fmt.Scanf("%d", &dice1[i])
	}

	for i := 0; i < 6; i++ {
		fmt.Scanf("%d", &dice2[i])
	}

	// fmt.Println(dice1)
	// fmt.Println(dice2)

	d2top := fno(dice2, dice1[0])
	if len(d2top) == 0 {
		fmt.Println("No")
		return
	}

	yes_or_no := false
	for i := 0; i < len(d2top); i++ {
		var side1, side2 [4]int
		side1 = side(dice1, 0)
		side2 = side(dice2, d2top[i])

		if is_same_side(side1, side2) && tail(dice1, 0) == tail(dice2, d2top[i]) {
			yes_or_no = true
			break
		}
	}

	if yes_or_no {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1188
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>n;--i)

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

ll nCrModPFermat(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    ll fac[r+1]; 
    fac[0] = 1;
    ll j=n-r+1 ;
    for (ll i=1; i<=r;j++, i++) 
        fac[i] = fac[i-1]*j%p; 
    ll fac1[r+1];
    fac1[0] = 1; 
    for (ll i=1; i<=r; i++) 
        fac1[i] = fac1[i-1]*i%p; 
        
    return (fac[r]* modInverse(fac1[r], p)) % p ;
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n,k,j,i,a,b;
    ll ans=0;
    cin >> n >> a >> b ;
    ans+=binpowmod(2,n,P);
    ans=(ans+P-nCrModPFermat(n,a,P))%P;
    ans=(ans+P-nCrModPFermat(n,b,P))%P;
    ans--;
    cout << ans ;
	return 0;
}

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

typedef long long ll;
const int N = 648, mod = 1000000007;

int n;
int a[N], s[N];
int dfact[N], min[N][N], max[N][N], f[N][N];

inline void up(int &x, const int y) {x < y ? x = y : 0;}
inline void down(int &x, const int y) {x > y ? x = y : 0;}
inline int sum(int l, int r) {return s[r] - s[l - 1];}

int main() {
	int i, j, k, u, v, ans = 0;
	scanf("%d%d", &n, &k), n *= 2;
	for (*dfact = i = 1; i < n; i += 2) dfact[i + 1] = dfact[i] = (ll)dfact[i - 1] * i % mod;
	for (; k; --k) scanf("%d%d", &u, &v), a[u] = v, a[v] = u;
	for (i = 1; i <= n; ++i) {
		s[i] = s[i - 1] + !a[i], min[i][i - 1] = INT_MAX, max[i][i - 1] = INT_MIN;
		for (j = i; j <= n; ++j) {
			min[i][j] = min[i][j - 1], max[i][j] = max[i][j - 1];
			if (a[j]) down(min[i][j], a[j]), up(max[i][j], a[j]);
		}
	}
	for (i = 1; i <= n; ++i)
		for (j = i + 1; j <= n; j += 2) {
			if ((u = sum(i, j)) & 1 || min[i][j] < i || max[i][j] > j) continue;
			int &ret = f[i][j]; ret = dfact[u];
			for (k = i + 2; k < j; k += 2) if (!(sum(k, j) & 1))
				ret = (ret - (ll)f[i][k - 1] * dfact[sum(k, j)]) % mod;
			ans = (ans + (ll)ret * dfact[s[n] - u]) % mod;
		}
	printf("%d\n", ans + (ans >> 31 & mod));
	return 0;
}

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

int main() {
	int a, b;
    cin >> a >> b;
    int s = a -2 * b ;
    if (s < 0) s = 0;
    cout << s << endl;

	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef  long ELEM;/*type of components in stack*/
#define STACK_SIZE 100/*the size of stack*/
ELEM stackexe[STACK_SIZE];/* definition of stack*/
int n;/*pointer of stack*/

/* print error message and exit*/
void error(char *s)
{
fprintf(stderr,s);
exit(1);
}

/*initialise stack*/
void init(){
n = 0;
}

/*put datas in stack*/
void push(ELEM x)
{
if(n >= STACK_SIZE)
	cerr << "stack overflow" << endl;
stackexe[n++] = x;
}

/*take datas out of stack*/
ELEM pop()
{
if(n <= 0)
	cerr << "stack underflow" << endl;
return stackexe[--n];
}

/*check whether stack is empty or not*/
/*empty---return1,not empty---return0*/
int empty()
{
return n == 0;
}

/*reverced Polish calculator*/
int main()
{
int c;
long x,a,b;

init();
while ((c = getchar()) != EOF){
	if(isdigit(c)){
		ungetc(c,stdin);
		cin >> x;
		push(x);
	}
	else{
		switch(c){
			case '+':
			    b = pop();
			    a = pop();
			    push(a + b);
			    break;
			case '-':
			    b = pop();
		 	    a = pop();
			    push(a - b);
			    break;
			case '*':
			    b = pop();
			    a = pop();
			    push(a * b);
			    break;
			case '/':
			    b = pop();
			    a = pop();
			    push(a / b);
			    break;
			case '\n':
			    if(! empty())
				cout << pop()<< endl;
			    init();
			    break;
			case ' ':
			case '\t':
			/*do nothing and skip*/
			    break;
			default:
			    cout << "不正な文字がありました" << endl;
			    cout << "入力しなおしてください" << endl;
			    while((c = getchar()) != EOF && c != '\n')
					;
				break;
			}
		}
	}
}



Measured memory_bytes: 3092
#include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s)                                                               \
    do {                                                                       \
    } while (0)
#define dump(x)                                                                \
    do {                                                                       \
    } while (0)
#define BR
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;

constexpr double EPS = 1e-10;
// constexpr double PI  = acos(-1.0);
// constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
// inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template <class T> inline T sqr(T x) { return x * x; }

void solve() {
    int n;
    cin >> n;
    VI t(n + 1), x(n + 1), y(n + 1);
    REP(i, 0, n) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
    REP(i, 0, n) {
        int diff = abs(x[i] - x[i + 1]) + abs(y[i] - y[i + 1]);
        int tdiff = t[i + 1] - t[i];
        if (diff > tdiff || abs(diff - tdiff) % 2 == 1) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main() {
    solve();

    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#include <iostream>

using namespace std;

int ans[300'009];

int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  if (a + b - 1 > n || n > (long long)a * b) {
    puts("-1");
    return 0;
  }
  if (a >= b) {
    for (int i = 0; i < n; i += a) {
      int j = min(i + a - 1, n - 1);
      for (int k = j; k >= i; --k) {
        ans[i + j - k] = n - k;
      }
    }
    for (int i = n / a * a; i >= 0; i -= a) {
      int rem = n - i;
      if (i / a + rem >= b) {
        int need = b - i / a;
        int extra = rem - need + 1;
        sort(ans + i, ans + n);
        reverse(ans + i, ans + n);
        for (int j = 0; j < extra / 2; ++j) {
          swap(ans[i + j], ans[i + extra - 1 - j]);
        }
        break;
      }
    }
  } else {
    for (int i = 0; i < n; i += b) {
      int j = min(i + b - 1, n - 1);
      for (int k = j; k >= i; --k) {
        ans[i + j - k] = k + 1;
      }
    }
    for (int i = n / b * b; i >= 0; i -= b) {
      int rem = n - i;
      if (i / b + rem >= a) {
        int need = a - i / b;
        int extra = rem - need + 1;
        sort(ans + i, ans + n);
        for (int j = 0; j < extra / 2; ++j) {
          swap(ans[i + j], ans[i + extra - 1 - j]);
        }
        break;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (i > 0) {
      putchar(' ');
    }
    printf("%d", ans[i]);
  }
  putchar('\n');
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

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

vector<ll> Prime(1000000,0);
void sosu(ll n){
  Prime.at(0)=2;
  ll t=1;
  for(ll i=3;i<n;i++){
    rep(j,t){
      if(i%Prime.at(j)==0){
        break;
      }
      if(j==t-1){
        Prime.at(t)=i;
        t++;
      }
    }
  }
}

int main(){
  string S;
  ll ans=0;
  cin >> S;
  rep(i,S.size()-1){
    if(S.at(i+1)!=S.at(i)){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 8320
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  char s[101];
  lli k;
  scanf("%s %lld", s, &k);

  int n = strlen(s);
  lli gotyo = 5e12;
  lli mozi, chars = 0;
  rep(i, 0, n) {
    mozi = (lli)(s[i] - '0');
    if ( mozi != 1 ) break;
    chars++;
    if ( chars >= k ) break; 
  }
  printf("%lld\n", mozi);
  return 0;
}



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

using namespace std;

int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> l(N);
    for (int i= 0; i < N; i++) {
        cin >> l[i];
    }

    int count = 1;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += l[i];
        if (sum > X) {
            break;
        }
        count += 1;
    }
    cout << count  << endl;
    return 0;
}


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

using namespace std;

using ll = long long;

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

    int d, n;

    cin >> d >> n;
    const int p = pow(100, d), p2 = pow(100, d + 1);
    int x = p - 1;
    while (n--) {
        ++x;
        while (x % p != 0 || x % p2 == 0) ++x;
    }

    cout << x << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int m = 0;
    for (int i = 0; i < N; i++){
      int j = sc.nextInt();
      if (j >= K){
        m++;
      }
    }
    System.out.println(m);
  }
}

Measured memory_bytes: 47388
#include <bits/stdc++.h>
#define pb push_back
#define siz(n) n.size()
#define dmin(i, j) ((i) < (j) ? (i) : (j))
#define dmax(i, j) ((i) > (j) ? (i) : (j))
#define cmin(i, j) ((i) > (j) ? (i) = (j) : (i))
#define dabs(i) ((i) < 0 ? -(i) : (i))
using namespace std;
int n, siz1, siz2, ans;
char s[5010], t[5010];
vector<int> S, T;
int main() {
	cin >> n; scanf("%s%s", s + 1, t + 1);
	for(register int i = 1; i < n; ++i) if(s[i] != s[i + 1]) S.pb(i);
	for(register int i = 1; i < n; ++i) if(t[i] != t[i + 1]) T.pb(i);
	siz1 = siz(S); siz2 = siz(T); ans = 0x3f3f3f3f;
	for(register int p = -siz1 - 1; p <= siz2 + 1; ++p) {
		if((p + (s[1] == t[1])) & 1) {
			int l = 0;
			for(register int i = dmin(-p, 0); i <= dmax(siz1, siz2 - p); ++i) {
				int r = i + p, _p, _c;
				_p = i < 0 ? 0 : (i >= siz1 ? n : S[i]); _c = r < 0 ? 0 : (r >= siz2 ? n : T[r]); l += dabs(_p - _c);
			}
			cmin(ans, l);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
    public static void main(String[] args)
            throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
   while (scan.hasNext()){
int sum = scan.nextInt()+scan.nextInt();
System.out.println(sum);
}
}
}

Measured memory_bytes: 12000
import sys
H, W, M = map(int, input().split())
Hb = [0] * H
Wb = [0] * W
B = set()
for _ in range(M):
    h, w = map(int, input().split())
    Hb[h - 1] += 1
    Wb[w - 1] += 1
    B.add((h - 1, w - 1))
HB = max(Hb)
WB = max(Wb)
x = set()
y = set()
for i in range(H):
    if Hb[i] == HB:
        y.add(i)
for i in range(W):
    if Wb[i] == WB:
        x.add(i)
for i in y:
    for j in x:
        if (i, j) not in B:
            print(HB + WB)
            sys.exit()
print(HB + WB - 1)


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

const int INF = 1e18;
const int MAX_V = 100010;

struct edge {
    int to;
    int cost;
};

using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

signed main() {
    cin >> V;

    for(int i = 0; i < V - 1; i++){
        int a,b,c;
        cin >> a >> b >> c;
        a--, b--;
        edge e = {b,c};
        edge f = {a,c};
        G[a].push_back(e);
        G[b].push_back(f);
    }

    int q,k;
    cin >> q >> k;
    dijkstra(k-1);
    while(q--){
        int x,y;
        cin >> x >> y;
        x--, y--;
        cout << d[x] + d[y] << endl;
    }
}

Measured memory_bytes: 11120
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	k := nextInt()
	a := []int{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}
	puts(a[k-1])
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


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

int main() {
  int n,k; cin >> n >> k;
  vector<int> a(n+1);
  rep(i,n) {
    int x; cin >> x;
    a[x]++;
  }
  int cnt = 0;
  sort(a.rbegin(), a.rend());
  rep(i,k) {
    cnt += a[i];
  }
  cout << n - cnt << endl;
  return 0;
}

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



int main(){
     long long int n,k;
    
    cin>>n>>k;
    
    long long int x=n%k;
    while(1){
        if(x>abs(x-k)){
        x=abs(x-k);
    }else{
        break;
    }

    }
    
    cout<<x<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef vector<LL> VEC;
typedef vector<VEC> VVEC;
typedef  pair<LL,LL> P;


const LL INF=1<<30;
const LL MOD=1000000007;




int main(){
    LL x,y;
    cin>>x>>y;
    LL ans=0;
    for(LL i=x;i<=y;i*=2){
        ans++;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

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

	int *a = (int*)malloc(m * sizeof(int));
	int *b = (int*)malloc(m * sizeof(int));
	int *co = (int*)malloc(n * sizeof(int));

	for (i = 0; i < n; i++) {
		co[i] = 0;
	}
	for (i = 0; i < m; i++) {
		scanf("%d %d", &a[i], &b[i]);
	}
	for (i = 0; i < m; i++) {
		co[a[i] - 1]++;
		co[b[i] - 1]++;
	}
	for (i = 0; i < n; i++) {
		printf("%d\n", co[i]);
	}
	return 0;

	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 101
#define INF INT_MAX/4
 
int G[MAX][MAX], N;
 
int dijkstra(int a,int b){
    bool used[MAX];
    int cost[MAX];
    memset(used,false,sizeof(used));
    fill(cost, cost+N, INF);
 
    cost[a] = 0;
    while(true){
	int v = -1;
	for(int u = 0 ; u < N ; u++){
	    if(!used[u] && (v == -1 || cost[u] < cost[v])){
		v = u;
	    }
	}
 
	if(v == -1) break;
	used[v] = true;
 
	for(int u = 0 ; u < N ; u++){
	    cost[u] = min(cost[u],cost[v]+G[v][u]);
	}
    }
 
    return cost[b];
}
 
int main(){
    int K, num, a, b, c;
 
    while(scanf("%d%d",&N,&K), (N | K)){
	fill(G[0], G[N], INF);
 
	while(K--){  
	    scanf("%d",&num);
	    if(num){
		cin >> a >> b >> c;
		a--, b--;
		if(G[a][b] > c){
		    G[a][b] = G[b][a] = c;
		}
	    }else{
		cin >> a >> b; a--, b--;
		int val = dijkstra(a,b);
		if(val != INF){
		    printf("%d\n",val);
		}else{
		    puts("-1");
		}
	    }
	}
    }
    return 0;
}

Measured memory_bytes: 3204
# include <cmath>
# include <iostream>
# include <queue>
# include <set>
# include <stack>
# include <string>
# include <vector>


using namespace std;


int main() {
    int n; cin >> n;
    vector<int> b(n-1);
    for (int i=0; i<n-1; i++) cin >> b[i];

    //   2    5   B
    //  / \  / \
    //  2  2   5  A
    //
    //
    //
    //   0 153 10 10 23
    //  /\ /\  /\ /\ /\
    //  0 0  10 10 10 23
    int ans = b.at(0) + b.at(n-2);
    for (int i=0; i<n-2; i++) {
        ans += min(b.at(i), b.at(i+1));
    }

    cout << ans << endl;
    return 0;
}



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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

bool hate(int n, set<int> &h) {

    while (n > 0) {
        int m = n % 10;
        if (contain(h, m)) return true;
        n /= 10;
    }
    return false;

}

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

    set<int> hate_numbers;
    rep(i, k) {
        int d;
        cin >> d;
        hate_numbers.insert(d);
    }

    while (hate(n, hate_numbers)) {
        n++;
    }
    cout << n << endl;
}

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

using namespace std;

short N;
short arr[1004][1004];
short pos[1004];
int did[1004], didN, chk[1004], cnt = 0;

int main(){
    scanf("%hd", &N);
    for(short i = 1; i <= N; ++i){
        for(short j = 1; j <= N - 1; ++j){
            scanf("%hd", arr[i] + j);
        }
        pos[i] = 1;
    }
    int ans = 0, All = N * (N - 1) / 2, nxt, f = 1;
    for(ans = 1; cnt < All; ++ans){
        ++didN, f = 1;
        for(short i = 1; i <= N; ++i) if(did[i] != didN && pos[i] < N){
            nxt = arr[i][pos[i]];
            if(arr[nxt][pos[nxt]] == i && did[nxt] != didN){
                did[i] = did[nxt] = didN;
                ++pos[i], ++pos[nxt];
                f = 0, ++cnt;
            }
        }
        if(f) break;
    }
    if(cnt == All) printf("%d\n", ans - 1);
    else puts("-1");
    return 0;
}


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

bool canDo(int* a,int n,int i,int m,int currSum,bool willPlus){
	if(willPlus)
		currSum += a[i];
	if(currSum == m)
		return true;
	if(i == n - 1)
		return false;
	i++;
	return canDo(a,n,i,m,currSum,true) || canDo(a,n,i,m,currSum,false);
}

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

	int q;
	cin >> q;
	for(int i = 0; i < q;i++){
		int m;
		cin >> m;
		bool can = canDo(a,n,-1,m,0,false);
		cout <<( (can) ? "yes" : "no") << endl;
	}
	return 0;
}


Measured memory_bytes: 3104
N = int(input())
res = []
for i in range(1, N+1):
    s, num = input().split()
    res.append([i, s, int(num)])

res_s = sorted(res, key=lambda x: x[2], reverse=True)    
res_s = sorted(res_s, key=lambda x: x[1], reverse=False)
for x in res_s:
    print(x[0])

Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

void solve (int n)
{
    vi a(n), b(n);
    forn (i, n) cin >> a[i] >> b[i];

    ll add_p = 0;
    ll ans = 0;

    for (int i = n - 1; i >= 0; i--)
    {
        ll R = (a[i] + add_p + b[i] - 1) / b[i];
        R *= b[i];
        ans += R - a[i] - add_p;
        add_p += R - a[i] - add_p;
    }

    cout << ans << '\n';
}

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

    int n;
    while (cin >> n)
        solve(n);
}


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

A, B = nl()

def xor(N):
    if N % 2 == 0:
        t = 0
        if (N // 2) % 2 > 0:
            t = 1
        return N ^ t
    return 1 - ((N // 2) % 2)

print(xor(B) ^ xor(A-1))




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

using namespace std;

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


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


ll N;



int main(){
	cin >> N;
	ll N2 = 1LL<<N;
	vector<int> S(N2+1);
	for ( int i = 0; i < N2; i++ ){
		cin >> S[i];
	}
	S[N2] = -1;
	sort(S.begin(), S.end(), greater<int>());
	
	
	vector<int> SS;
	SS.reserve(N2+1);
	
	for ( int i = 0; i < N; i++ ){
		// [0..p-1]  と  [p..2*p-1] を比較
		int p = 1<<i;
		int k = p;
		int l = p;
		SS.resize(0);
		sort(S.begin(),S.begin()+p, greater<int>());
		
		for ( int j = 0; j < p; j++ ){
			while ( S[j] <= S[k] ){
				SS.push_back( S[k++] );
			}
			S[l++] = S[k++];
			
			if ( k > N2 ){
				cout << "No" << endl;
				
				return 0;
			}
		}
		for ( size_t j = 0; j < SS.size(); j++ ){
			S[l++] = SS[j];
		}
	}
	
	cout << "Yes" << endl;
	return 0;
}


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

using namespace std;

#define sz(x) ((int) ((x).size()))
typedef long long ll;
typedef long double ld;

ll mod = 998244353;

int n, x[300000];
ll r, s[300000], p2[300000];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n;
  char c;
  p2[0] = 1;
  for (int i = 0; i < n; i++)
    cin >> c, x[i] = c == '1', p2[i + 1] = (p2[i] * 2) % mod;
  for (int d = 1; d <= n; d++) {
    if ((n % d) == 0 && (n % (2 * d)) != 0) {
      ll k = 2 * d;
      ll h = 0;
      for (int j = -1; j < d - 1; j++)
        if (x[j + 1] == 1)
          h += p2[d - j - 2];
      bool sm = true;
      for (int j = d; j < n; j++)
        if ((x[j % d] ^ ((j / d) & 1)) != x[j]) {
          sm = (x[j % d] ^ ((j / d) & 1)) < x[j];
          break;
        }
      if (sm)
        h++;
      h %= mod;
      h = (h + mod - s[d]) % mod;
      r = (r + h * k) % mod;
      for (int j = 2; d * j <= n; j++)
        s[d * j] = (s[d * j] + h) % mod;
    }
  }
  cout << r << "\n";
}


Measured memory_bytes: 4608
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
	ll a[100];
	a[0] = 2;
	a[1] = 1;
	for(int i=2;i<=87;i++)	a[i] = a[i-1] + a[i-2];
	int n;
	cin >> n;
	cout << a[n] <<'\n';
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int gcd(int a, int b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, t;
	cin >> n >> t;
	vi a(n), b(n);
	int mn = 1e9;
	rep(i, n){
		cin >> a[i] >> b[i];
		if(b[i] <= t){
			mn = min(mn, a[i]);
		}
	}
	if(mn == 1e9) cout << "TLE" << endl;
	else cout << mn << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int ans,c,n,k,f[1000055],i,r,a,d;
vector<int>V;
 main(){
	cin>>n;
	// a*b=n-c
	for(k=2;k*k<=n;k++){
		
		for(int i=k*k;i<=n;i+=k){
			if(!f[i]) f[i]=k;
		}
	}

	for(k=1;k<n;k++){
		//cout<<k<<"+";
		 a=k;
		 c=1;
		while(a!=1){
			 d=f[a];if(!d) d=a;
			r=0;
			while(a%d==0){
				a/=d;//cout<<"_"<<a<<endl;
				r++;
			} 
			c*=r+1;
		}
		//cout<<c<<endl;
		ans+=c;
	}
	cout<<ans;
}

Measured memory_bytes: 11376
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
const ll INF=1LL<<60;
const ll mod=1E9+7;


int main(){
  int a,b;
  cin >> a >> b;
  cout << max(a-2*b,0);
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace abc110_a
{
    class program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int M = input[1];
            int X = input[2];
            int Y = input[3];
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] y = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int Xmax = X;
            int Ymin = Y;
            for (int i = 0; i < N; i++)
            {
                if (Xmax < x[i])
                {
                    Xmax = x[i];
                }
            }
            for (int i = 0; i < M; i++)
            {
                if (Ymin > y[i])
                {
                    Ymin = y[i];
                }
            }
            if (Xmax < Ymin)
            {
                Console.WriteLine("No War");
            }
            else
            {
                Console.WriteLine("War");
            }
        }
    }
}


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

ll calc(ll a,ll d,ll n){
  if(n==0)return 0;
  return ( a+a+d*(n-1) )*n/2;
}

ll N,X,L;
ll a[MAX_N],d[MAX_N];

ll solve2();

ll solve(){

  ll res=0, val=0;

  
  int j=0;
  for(int i=0;i<N;i++){
    while( j < i+L/X ){
      val+=(a[j]+a[j]+(X-1)*d[j])*X/2;
      j++;
      if(j>=N)break;
    }
    
    res=max(res,val);
    if(j>=N)break;
    
    ll aj =a[j]+(L%X)*d[j];
    double A = -0.5*d[i] + 0.5*d[j];
    double B = -(a[i]-0.5*d[i]) + (aj-0.5*d[j]);
    
    double left=0, right =X-L%X , ll , rr, lv,rv;
    
    for(int p=0;p<100;p++){
      ll=(left+left+right)/3.0;
      rr=(right+right+left)/3.0;
      lv=A*ll*ll+B*ll;
      rv=A*rr*rr+B*rr;
      if(lv < rv)left=ll;
      else right=rr;
    }


    res=max(res, val + calc(a[j],d[j],L%X) );
    res=max(res, val + calc(a[j],d[j],X) - calc(a[i],d[i],X-L%X) );
    
    long long mm = left;
    /*
    cout<<"i="<<i<<" j="<<j<<endl;
    cout<<"val="<<val<<endl;
    cout<<"mm="<<mm<<endl;
    cout<<val + calc(a[j],d[j],L%X)<<endl;
    cout<<endl;
    */
    
    for( long long  dm = mm-1; dm<=mm+1; dm++ ){
      if(dm<0 || dm>(X-L%X) )continue;
      res=max(res, val + calc(a[j],d[j],L%X+dm) - calc(a[i],d[i],dm) );
    }
  
    if(i>0 && L%X>0){
      
      long long fa = a[i-1]+(X-1)*d[i-1];
      long long fd = d[i-1]*-1;
      long long sa = a[j]+(L%X-1)*d[j];
      long long sd = d[j]*-1;

      A = ( fd*fd*0.5 ) - ( sd*sd*0.5 );
      B = ( fa-fd*0.5 ) - ( sa-sd*0.5 );
      
      left=0,right=L%X;
      for(int p=0;p<100;p++){
        ll=(left+left+right)/3.0;
        rr=(right+right+left)/3.0;
        lv=A*ll*ll+B*ll;
        rv=A*rr*rr+B*rr;
        if(lv < rv)left=ll;
        else right=rr;
      }

      mm = left;
      for( long long  dm = mm-1; dm<=mm+1; dm++ ){
        if(dm<0 || dm>(L%X) )continue;
        res=max(res, val + calc(a[j],d[j],L%X) + calc(fa,fd,dm) - calc(sa,sd,dm) );
      }
      
      
    }
    val-=(a[i]+a[i]+(X-1)*d[i])*X/2;
  }
  return res;
}

int main(){
  scanf("%lld %lld %lld",&N,&X,&L);
  for(int i=0;i<N;i++){
    scanf("%lld %lld",&a[i],&d[i]);
  }
  ll ans=solve();

  for(int i=0;i<N;i++){
    a[i]= a[i]+d[i]*(X-1);
    d[i]*=-1;
  }
  printf("%lld\n",ans);
  return 0;
}

ll solve2(){
  ll res=0;
  for(int i=0;i<N;i++){
    ll A = a[i] + (X-1)*d[i];
    ll B = a[i] + (X-L)*d[i];
    ll sum = (A+B)*L/2;
    res=max(res,sum);
  }
  return res;
}

Measured memory_bytes: 4756
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN=200100;
const int MAXK=19;
const int INF = 1e9;
const ll MOD = 998244353;

ll N,a,b,c,d,e,f;
ll A[MAXN];
ll B[MAXN];

int main(){
  cin>>N;
  ll T=0;
  for (int i=1;i<=N;++i){
    cin>>A[i];
    T^=A[i];
  }
  for(int i=1;i<=N;++i)cout<<(T^A[i])<<' ';
}

Measured memory_bytes: 5112
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll x,y;
ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x;
}
int main(){
	scanf("%d%lld",&n,&x);
	for (int i=2;i<=n;i++)
		scanf("%lld",&y),x*=y/gcd(x,y);
	printf("%lld",x);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define FOR(i,n) for(int i = 0; i < n; i++)
#define FORa(i,a,b) for(int i = a; i < b; i++)
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define SORT(a,n) sort(begin(a), begin(a) + n)
#define VSORT(v) sort(v.begin(), v.end())
#define MAX 1000000
#define ll long long
#define LOW(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define UP(s) transform(s.begin(),s.end(),s.begin(),::toupper)

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

int main() {
	string s;
	int ans = 0;
	cin >> s;
	
	for(auto ch: s) {
		ans = (ans + (int)ch - (int)'0')%9;
	}
	
	cout << (ans == 0 ? "Yes" : "No") << endl;
  
	return 0;
}


Measured memory_bytes: 3712
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

struct node {
	int sum=0;
	int win=0;
	vector<node> chi;
	bool operator<(const node &right) {
		return win < right.win;
	}
};


int idx;
string s;
void dfs(node *no) {
	while (1) {
		if (s[idx] == '[') {
			no->chi.resize(no->chi.size() + 1);
			idx++;
			dfs(&no->chi[no->chi.size() - 1]);
		}
		if (s[idx] == ']') {
			if (no->chi.empty()) {

			}
			else {
				SORT(no->chi);
				REP(j, no->chi.size() / 2 + 1) {
					no->win += no->chi[j].win;
				}
			}
			idx++;
			return;
		}
		while (isdigit(s[idx])) {
			no->sum *= 10;
			no->sum += s[idx] - '0';
			no->win = no->sum / 2 + 1;
			idx++;
		}
	}
} 
int main() {
	int kurikaesu;
	cin >> kurikaesu;
	while (kurikaesu--) {
		cin >> s;	
		idx = 1;
		node root;
		dfs(&root);
		cout << root.win << endl;
	}
}

Measured memory_bytes: 3264
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    rr = []
    t = []
    for i in range(1,151):
        for j in range(i+1,151):
            t.append((i**2+j**2, (i,j)))
    t.sort()
    tt = list(map(lambda x: x[1], t))

    while True:
        h,w = LI()
        if h == 0:
            break
        i = tt.index((h,w))
        r = tt[i+1]

        rr.append(' '.join(map(str,r)))

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 10840
from math import atan,degrees
a,b,x=map(int,input().split())
if (x*2)/(a**2)<=b:
    num=degrees(atan((2*x)/(a*b**2)))
    ans=90-num
else:
    if (a**2)*b-x==0:
        ans=0
    else:
        num=degrees(atan((a**3)/(2*((a**2)*b-x))))
        ans=90-num
print(ans)


Measured memory_bytes: 38384
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)
		{
			int N = int.Parse(Console.ReadLine());
			var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
			int[] array = new int[100002];
			for (int i = 0; i < input.Length; i++)
			{
				array[input[i]]++;
				array[input[i] + 1]++;
				array[input[i] + 2]++;
			}
			int ans = 0;
			for (int i = 0; i < array.Length; i++)
			{
				ans = Math.Max(ans, array[i]);
			}
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 18528
#include<bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f,N=1e5+50;
int a[N],b[N];
int main()
{
	int A,B,m,ans,maxa=inf,maxb=inf;
	cin>>A>>B>>m;
	for (int i=0;i<A;i++)
	{
		cin>>a[i];
		maxa=min(a[i],maxa);
	}
	for (int i=0;i<B;i++)
	{
		cin>>b[i];
		maxb=min(b[i],maxb);
	}
	ans=maxa+maxb;
	for (int i=0;i<m;i++)
	{
		int x,y,c;
		cin>>x>>y>>c;
		x--; y--;
		ans=min(ans,a[x]+b[y]-c);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#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 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

int main(){
  ll H,W;
  cin >> H >> W;
  vector<string> A(H);
  REP(i, H) cin >> A[i];
  
  vector<P> vec;

  REP(i,H){
    REP(j,W){
      if(A.at(i).at(j)=='#'){
        vec.push_back(make_pair(i,j));
      }
    }
  }

  queue<P> que;
  vector<vector<ll>> dist(H,vector<ll> (W,-1));
  for(auto x:vec){
    que.push(x);
    dist[x.first][x.second]=0;
  }

  while(!que.empty()){
    ll vy = que.front().first;
    ll vx = que.front().second;
    que.pop();

    REP(k,4){
      ll nvy = vy+dy[k];
      ll nvx = vx+dx[k];
      if(nvy<0||nvy>H-1||nvx<0||nvx>W-1||dist[nvy][nvx]!=-1||A[nvy][nvx]=='#'){
        continue;
      }

      dist[nvy][nvx]=dist[vy][vx]+1;
      que.push(make_pair(nvy,nvx));
    }
  }

  ll MAX = 0;
  REP(i,H){
    REP(j,W){
      if(A[i][j]=='.'){
        chmax(MAX,dist[i][j]);
      }
    }
  }

  cout << MAX << endl;
}

Measured memory_bytes: 44916
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,count;
	while(true){
	cin>>n;
	if(n==0)
		break;
	count=0;
	for(int i=n+1;i<=2*n;i++){
		bool t=true;
		for(int j=2;j*j<=i;j++){
			if(i%j==0)
				t=false;
		}
		if(t==true)
			count++;
	}
	cout<<count<<endl;
	}
    return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanVecInt(A, N);
    map<int, int, greater<int>> count;
    loop(i, N){
        ++count[A[i]];
    }
    ll long_edge = 0;
    for (auto& p : count){
        if (p.second < 2) continue;
        long_edge = p.first;
        p.second -= 2;
        break;
    }
    ll short_edge = 0;
    for (auto& p : count){
        if (p.second < 2) continue;
        short_edge = p.first;
        p.second -= 2;
        break;
    }
    printf("%lld\n", long_edge * short_edge);
}


Measured memory_bytes: 5376