akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
#define debug(x) cout << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1<<30;
const ll LINF = 1LL<<61;
const ll MOD = 1000000007;

int main()
{
    ll n;
    cin >> n;
    V<ll> a(n), as(n);
    rep(i,n) cin >> a[i];
    rep(i,n-1) as[i+1] = a[i];
    rep(i,n-1) as[i+1] += as[i];
    rep(i,n) as[i] %= MOD;
    // cout << as << endl;
    ll ans = 0;
    rep(i,n)
    {
        ans += (a[i] * as[i]) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int ans = n;  // 1日目の合計
    for (int i = 0; i < n; i++) {
        for (int day = a[i] + 1; day <= d; day += a[i]) {
            ans++;
        }
    }
    ans += x;
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void PR(bool f){
  cout << (f ? "YES" : "NO") << "\n";
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  string s, t;
  cin >> s >> t;
  ll q;
  cin >> q;
  ll n = SZ(s), m = SZ(t);
  vll sa(n+1, 0), sb(n+1, 0), ta(m+1, 0), tb(m+1, 0);
  rep(i, n){
    sa[i+1] = sa[i] + (s[i] == 'A');
    sb[i+1] = sb[i] + (s[i] == 'B');
  }
  rep(i, m){
    ta[i+1] = ta[i] + (t[i] == 'A');
    tb[i+1] = tb[i] + (t[i] == 'B');
  }
  while(q--){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    a--; c--;
    PR((sa[b]-sa[a]-sb[b]+sb[a]+3000000)%3 == (ta[d]-ta[c]-tb[d]+tb[c]+3000000)%3);
  }
}


Measured memory_bytes: 4048
import sys
sys.setrecursionlimit(10**6)

def dfs(x, g, vis):
    if vis[x]:
        return
    vis[x] = 1
    for y in g[x]:
        dfs(y, g, vis)

def main():
    N, M = map(int, input().split())
    g = [[] for _ in range(N)]
    for i in range(M):
        X, Y, Z = map(int, input().split())
        X -= 1
        Y -= 1
        g[X].append(Y)
        g[Y].append(X)
    vis = [0] * N

    ans = 0
    for i in range(N):
        if vis[i] == 0:
            dfs(i, g, vis)
            ans += 1
    print(ans)

main()

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

int main(void) {

	int n;
	vector<string>s(10000);
	vector<string>t(10000);
	int dp[10000] = {};
	
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> s[i] >> t[i];
	}
	for (int i = 1; i <= n; i++) {
		int a, b, c, d;

		for (int p = 0; p <= s[i].size() - 1; p++) {
			if (p == 0) {
				switch (s[i][p]) {
					case 'm':
						dp[i] += 1000;
						break;
					case 'c':
						dp[i] += 100;
						break;
					case 'x':
						dp[i] += 10;
						break;
					case 'i':
						dp[i] += 1;
						break;
				}
			}
			else {
				switch (s[i][p]) {
				case 'm':
					if ('2' <= s[i][p - 1] && s[i][p - 1] <= '9') {
						dp[i] += 1000 * (s[i][p - 1] - '0');
					}
					else {
						dp[i] += 1000;
					}
					
					break;
				case 'c':
					if ('2' <= s[i][p - 1] && s[i][p - 1] <= '9') {
						dp[i] += 100 * (s[i][p - 1] - '0');
					}
					else {
						dp[i] += 100;
					}
					break;
				case 'x':
					if ('2' <= s[i][p - 1] && s[i][p - 1] <= '9') {
						dp[i] += 10 * (s[i][p - 1] - '0');
					}
					else {
						dp[i] += 10;
					}
					break;
				case 'i':
					if ('2' <= s[i][p - 1] && s[i][p - 1] <= '9') {
						dp[i] +=(s[i][p - 1] - '0');
					}
					else {
						dp[i] += 1;
					}
					break;
				}
			}
			
		}
		for (int p = 0; p <= t[i].size() - 1; p++) {
			if (p == 0) {
				switch (t[i][p]) {
				case 'm':
					dp[i] += 1000;
					break;
				case 'c':
					dp[i] += 100;
					break;
				case 'x':
					dp[i] += 10;
					break;
				case 'i':
					dp[i] += 1;
					break;
				}
			}
			else {
				switch (t[i][p]) {
				case 'm':
					if ('2' <= t[i][p - 1] && t[i][p - 1] <= '9') {
						dp[i] += 1000 * (t[i][p - 1] - '0');
					}
					else {
						dp[i] += 1000;
					}

					break;
				case 'c':
					if ('2' <= t[i][p - 1] && t[i][p - 1] <= '9') {
						dp[i] += 100 * (t[i][p - 1] - '0');
					}
					else {
						dp[i] += 100;
					}
					break;
				case 'x':
					if ('2' <= t[i][p - 1] && t[i][p - 1] <= '9') {
						dp[i] += 10 * (t[i][p - 1] - '0');
					}
					else {
						dp[i] += 10;
					}
					break;
				case 'i':
					if ('2' <= t[i][p - 1] && t[i][p - 1] <= '9') {
						dp[i] += (t[i][p - 1] - '0');
					}
					else {
						dp[i] += 1;
					}
					break;
				}
			}

		}

		a = dp[i] / 1000;
		b = (dp[i] - 1000 * a) / 100;
		c = (dp[i] - 1000 * a - 100 * b) / 10;
		d = (dp[i] - 1000 * a - 100 * b - 10 * c);

		if (a != 0) {
			if (a == 1) {
				cout << 'm';
			}
			else {
				cout << a << 'm';
			}
		}
		if (b != 0) {
			if (b == 1) {
				cout << 'c';
			}
			else {
				cout << b << 'c';
			}
		}
		if (c != 0) {
			if (c == 1) {
				cout << 'x';
			}
			else {
				cout << c << 'x';
			}
		}
		if (d != 0) {
			if (d == 1) {
				cout << 'i';
			}
			else {
				cout << d << 'i';
			}
		}
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3312
#include <stdio.h>

int main(void){

	int house[4][3][10]={};
	int n,b,f,r,v;
	int i=0;

	scanf("%d",&n);

	while(i<n){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		if(b>4 && b<1)
			continue;
		else if(f>3 && f<1)
			continue;
		else if(r>10 && r<1)
			continue;
		else{
			b--;
			f--;
			r--;
			house[b][f][r]+=v;
			if(house[b][f][r]<0)
				house[b][f][r]=0;
			else if(house[b][f][r]>9)
				house[b][f][r]=9;

		}
		i++;
	}
	for(b=0;b<4;b++){
		for(f=0;f<3;f++){
			for(r=0;r<10;r++){
				printf(" %d",house[b][f][r]);

			}
			printf("\n");

		}
		if(b<3){
			for (int i = 0; i < 20; i++){
				printf("#");
			}
			printf("\n");
		}
	}
	return 0;
	
}


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

int main(){
    int n, m, ans = 0;
    cin >> n >> m;
    vector<pair<int, int>> s(m);
    for(int i = 0; i < m; i++) cin >> s[i].first >> s[i].second;
    sort(s.begin(), s.end());

    for(int i = 0; i < m; i++){
        if(i >= 1){
            if(s[i-1].first == s[i].first){
                if(s[i-1].second != s[i].second){
                    ans = -1;
                    break;
                }
            }
            else{
                int num = n - s[i].first;
                if(num == 2) num = 100;
                if(num == 1) num = 10;
                if(num == 0) num = 1;
                ans += s[i].second * num;
            }
        }
        if(s[i].first == 1 && n > 1){
            if(s[i].second == 0){
                ans = -1;
                break;
            }
        }
        if(i == 0){
            int num = n - s[i].first;
                if(num == 2) num = 100;
                if(num == 1) num = 10;
                if(num == 0) num = 1;
            ans += s[i].second * num;
        }
    }

    if(n == 2 && ans < 10 && ans >= 0) ans += 10;
    if(n == 3 && ans < 100 && ans >= 0) ans += 100;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n , k;
    cin >> n >> k;
    int ans = 1;
    while(n--)
    {
        if(ans > k) ans += k;
        else ans *= 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int INF = 1 << 30; // < 2**31, > 10**9

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

    int curMinR = INF, curMaxP = -INF;
    int R;
    cin >> R;
    curMinR = R;
    for(int i=1; i<N;i++){
        cin >> R;
        curMaxP = max(curMaxP, R - curMinR);
        curMinR = min(curMinR, R);
    }

    cout << curMaxP << endl;
}


Measured memory_bytes: 3084
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }
int gcd(int a, int b){ return a == 0 ? b : gcd(b % a, a);}

int main(){
	
	int N, M;
	cin >> N >> M;
	string S,T;
	cin >> S >> T;
	
	ll L = (ll)(N / gcd(N, M)) * (ll) M;
	
	map<ll, char> h;
	ll inc = L / N;
	for(int i=0;i<N;i++) h[i * inc] = S[i];
	
	inc = L / M;
	for(int i=0;i<M;i++){
		if(h.find(i * inc) != h.end()){
			if(h[i * inc] != T[i]){
				cout << -1 << endl;
				return 0;
			}
		}
	}
	
	cout << L << endl;
	
    return 0;
}

Measured memory_bytes: 6144
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    int n=0;
    long a[] =new long[N];
    a[0]=sc.nextLong();
    long M=a[0];
    for(int i=1;i<N;i++){
      a[i]=sc.nextLong();
      M = M^a[i];}
    long ans ;
    for(int j=0;j<N;j++){
      ans =M^a[j];
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 55424
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repin(a,n) vector<ll> a(n);rep(i,n){cin>>a[i];}
#define in(a) ll a;cin>>a;
#define ins(a) string a;cin>>a;
#define ind(a) double a;cin>>a;
template<class T>
inline void out(T a){cout<<a<<endl; }
inline void out(double a){ printf("%.10f\n", a);} 

ll mod = 1000000007;

ll mmul(ll a, ll b) {
	return ((a % mod) * (b % mod)) % mod;
}

ll mpow(ll a, ll b) {
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll d = mpow(a, b / 2);
		return (d * d) % mod;
	}
	return (a * mpow(a, b - 1)) % mod;
}

ll mdiv(ll a, ll b) {
	return mmul(a, mpow(b, mod - 2));
}

int main()
{
    in(n);
    in(m);
	priority_queue<ll> a;
    rep(i,n){
		in(v);
		a.push(v);
	}
	rep(i,m){
		ll v = a.top()/2;
		a.pop();
		a.push(v);
	}
	ll ans = 0;
	while (!a.empty()) {
      ans += a.top();
      a.pop();
    }
	out(ans);
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], k;
int32_t main(){_

   cin>>n>>k;

   priority_queue<int> pq;
   for (int i = 1; i <= n; ++i)
   {
      cin >> a[i];
      pq.push(a[i]);
   }
         
   int ans = 0;
   while(!pq.empty() and k){
      int x = pq.top();
      pq.pop();
      x >>= 1;
      --k;
      if(x > 0){
         pq.push(x);
      }
   }

   while(!pq.empty()){
      ans += pq.top();
      pq.pop();
   }

   cout<<ans;

   return 0;
}

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

int main() {
  int N,Z=0;
  cin>>N;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(i%2==0&&a%2==1){
      Z++;
    }
  }
cout<<Z<<endl;
}

Measured memory_bytes: 3564
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); ++i)

int main(){
    int a,b; std::cin >> a >> b;
    if(a > b) std::swap(a,b);
    rep(i,b) std::cout << a;
    std::cout << '\n';
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 666666;
void GG(){puts("No");exit(0);}
int n,a[N];
int main() {
	read(n);rep(i,1,n)read(a[i]);
	int mx=0;rep(i,1,n)mx=max(mx,a[i]);
	int cnt=0,cnt1=0;
	rep(i,1,n)if(a[i]==mx)cnt++;
	else if(a[i]==mx-1)cnt1++;else GG();
	if(cnt==n&&mx==n-1){puts("Yes");return 0;}
	if(1+cnt1<=mx&&mx<=cnt/2+cnt1)puts("Yes");else GG();
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  int cardNum, gateNum;
  cin >> cardNum >> gateNum;
  int smallest = 0;
  int biggest = 100001;
  for(int i=0; i<gateNum; i++){
    int l, r;
    cin >> l >> r;
    if(smallest < l) smallest = l;
    if(biggest > r) biggest = r;
  }
  if(biggest >= smallest) cout << biggest - smallest + 1;
  else cout << 0;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const ll mod = 1e9 + 7;

int main()
{
    int a, b, c, d, e, f;
    double ans = 0, water, sugar;
    int ans1, ans2;
    cin >> a >> b >> c >> d >> e >> f;
    for (int i = 0; i * a * 100 <= f; i++)
    {
        for (int j = 0; j * b * 100 + i * a * 100 <= f; j++)
        {
            water = j * b * 100 + i * a * 100;
            for (int k = 0; k * c + water <= f; k++)
            {
                for (int l = 0; l * d + k * c + water <= f; l++)
                {
                    sugar = l * d + k * c;
                    if (water / 100 * e >= sugar)
                    {
                        if (ans <= 100 * sugar / (water + sugar))
                        {
                            ans = 100 * sugar / (water + l * d + k * c);
                            ans1 = water + sugar;
                            ans2 = sugar;
                        }
                    }
                }
            }
        }
    }
    cout << ans1 << " " << ans2 << endl;
    return 0;
}


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

template <typename t>
void print (const t &v){
        for ( auto i :v){
                cout << i << " " ;
        }
        cout << endl;
} 

inline void saveme(){
        ios_base::sync_with_stdio(false);
        cout.tie(0);
        cin.tie(0);
}

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

        vector <ll> v;
        while (n--){
                ll no;
                cin >> no;
                v.push_back(no);
        }

        ll sum=0; 
        sort (v.rbegin(), v.rend());
        sum = accumulate (v.begin(), v.end(), 0.0);
        if (k == 0){
                cout << sum << endl;
        }

        else if ( k >= v.size() ){
                cout << "0" << endl;
        }

        else if( k < v.size() ) {
                ll sum2=accumulate (v.begin() +k, v.end(), 0.0);
                cout << sum2 << endl;
        }
        return 0;
}


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

int main() {
    int N;
    cin >> N;
    int64_t sum = 1;
    int64_t b_sum = 1;
    int64_t s = 1000000000000000000;
    vector<int64_t>vec(N);
    bool include_zero = false;
    for (int i=0; i < N; i++) {
        cin >> vec.at(i);
        if (vec[i] == 0) {
            include_zero = true;
        }
    }

    if (!include_zero) {
        for (int i=0; i < N; i++) {
            int64_t n = vec[i];
            b_sum = sum;
            sum = sum * n;
            if (sum > s || b_sum > sum) {
                sum = -1;
                break;
            }
        }
    } else {
        sum = 0;
    }


    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4052
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)
int h, a[MAX + 1];
void maxHeapify(int i) {
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;
    if (l <= h&&a[l] > a[i])largest = l;
    else largest = i;
    if (r <= h&&a[r] > a[largest])largest = r;
    if (largest != i) {
        swap(a[i], a[largest]);
        maxHeapify(largest);
    }
}
int extract() {
    int maxv;
    if (h < 1)return -INFTY;
    maxv = a[1];
    a[1] = a[h--];
    maxHeapify(1);
    return maxv;
}
void increaseKey(int i, int key) {
    if (key < a[i])return;
    a[i] = key;
    while (i > 1 && a[i / 2] < a[i]) {
        swap(a[i], a[i / 2]);
        i = i / 2;
    }
}
void insert(int key) {
    h++;
    a[h] = -INFTY;
    increaseKey(h, key);
}
int main() {
    int key;
    string com;
    while (1) {
        cin >> com;
        if (com[0] == 'e'&&com[1] == 'n')break;
        if (com[0] == 'i') {
            cin >> key;
            insert(key);
        }
        else {
            cout << extract() << endl;
        }
    }
    return 0;
}


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


void solver() {
  string s;
  cin >> s;

  bool a = false;
  bool b = false;

  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A') {
      a = true;
    } else {
      b = true;
    }
  }

  if (a && b){
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return;
}

int main() {
  solver();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <math.h>
#define PI 3.14159265

int main(){
  int n;
  std::cin>>n;
  int x[n],y[n];
  for (int i = 0; i < n; i++) std::cin>>x[i];
  for (int i = 0; i < n; i++) std::cin>>y[i];
  double a1=0;
  for (int i = 0; i < n; i++) a1+=abs(x[i]-y[i]);
  printf("%.6f\n",a1);
  double a2=.0;
  for (int i = 0; i < n; i++) a2+=(double)abs(x[i]-y[i])*abs(x[i]-y[i]); 
  printf("%.6f\n",sqrt(a2));
  double a3=.0;
  for (int i = 0; i < n; i++) a3+=(double)abs(x[i]-y[i])*abs(x[i]-y[i])*abs(x[i]-y[i]); 
  printf("%.6f\n",pow(a3,1.0/3.0));
  double a4=0;
  for (int i = 0; i < n; i++) a4=fmax(a4,abs(x[i]-y[i]));
  printf("%.6f\n",a4);
}



Measured memory_bytes: 3348
def main():
    _ = int(input())
    A = list(map(int, input().split()))

    A.append(-1)
    A = [a for a, b in zip(A, A[1:]) if a != b]
    A.insert(0, -1)
    A.append(-1)
    A = [b for a, b, c in zip(A, A[1:], A[2:]) if (a < b) != (b < c)]

    A.append(-1)
    A = sorted((a, (1 if a < b else -1)) for a, b in zip(A, A[1:]))

    n = 1
    n_max = 0
    prev = 0
    for a, s in A:
        if prev < a:
            if n_max < n:
                n_max = n
            prev = a
        n += s
    print(n_max)
main()



Measured memory_bytes: 16676
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int max(int* array, int n){
  int max = 0;

  for(int i=0; i<n; i++)
    if(array[i] > max)
      max = array[i];

  return max;
}

int main(){
  int N, H;
  cin >> N >> H;

  int a[N], b[N];
  for(int i=0; i<N; i++)
    cin >> a[i] >> b[i];

  int a_max = max(a, N);
  sort(b,b+N,greater<int>());

  int damage = 0, count = 0;

  for(int i=0; i<N; i++){
    if(damage < H){
      if(b[i] > a_max){
        damage += b[i];
        count++;
      }else
        break;
    }else{
      cout << count << endl;
      return 0;
    }
  }

  if(damage >= H){
    cout << count << endl;
    return 0;
  }

  if((H-damage)%a_max == 0)
    count += (H-damage)/a_max;
  else
    count += (H-damage)/a_max + 1;

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 1024
N = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

res = float('inf')
for x in make_divisors(N):
    res = min(res, x + N//x - 2)
print(res)

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

using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="a"||s=="e"||s=="i"||s=="o"||s=="u"){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let b = input::<String>();
    let ans = match b.chars().next().unwrap() {
        'A' => 'T',
        'T' => 'A',
        'C' => 'G',
        'G' => 'C',
        _ => '?',
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

#define TOP_NUM 19
#define NOTOP_NUM 7

int main(){
	IO_STREAM;
	int D;	cin>>D;
	vi c(26);
	vector<pair<int,int>>cs(26);
	rep(i,0,26){
		cin>>c[i];
		cs[i].first=c[i];
		cs[i].second=i;
	}
	int s[D][26];
	rep(i,0,D){
		rep(j,0,26){
			cin>>s[i][j];
		}
	}

	sort(all(cs));
	reverse(all(cs));
	vi top(D,1);
	rep(i,0,TOP_NUM){
		top[i]=cs[i].second+1;
	}
	vi notop(D,1);
	rep(i,0,NOTOP_NUM){
		notop[i]=cs[i+TOP_NUM].second+1;
	}

	int cnt=1;
	int nt_idx=0;
	while(1){
		rep(i,0,TOP_NUM){
			cout<<top[i]<<endl;
			cnt++;
			if(cnt>D) return 0;
		}
		rep(i,0,5){
			cout<<notop[nt_idx]<<endl;
			nt_idx++;
			if(nt_idx>=NOTOP_NUM) nt_idx=0;
			cnt++;
			if(cnt>D) return 0;
		}
	}
	return 0;
}


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

using namespace std;

int N,Q;
vector<vector<int>> G;
vector<bool> C;
vector<long int> test;

void dfs(int c,int s){
    C[c] = true;
    test[c] += s;
    for(auto u :G[c]){
        if(C[u])
            continue;
        dfs(u, test[c]);
    }
}

int main(){
    cin >> N >> Q;
    G.resize(N);
    for (int i = 1; i < N;i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    C.resize(N,0);
    test.resize(N,0);
    for (int i = 0; i < Q;i++){
        int a, b;
        cin >> a >> b;
        a--;
        test[a] += b;
    }
    dfs(0, 0);
    for (int i = 0; i < N;i++)
        cout << test[i] << " ";
    cout << endl;
    return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ;
  cin >> n ;
  int ans = 0;
  int A[100100] = {0};
  
  rep(i,n){
    int c ;
    cin >> c ;
    if(c > 100100) ans++;
    else A[c]++;
  }
  
  rep(i,100100){
    if(A[i] > i) ans += A[i] - i ;
    if(A[i] < i) ans += A[i];
  }

  cout <<ans ;
      
    
  


}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  long long x[n][3], maximum = - pow(10, 10) * 3;
  for (int i = 0; i < n; i++)
    cin >> x[i][0] >> x[i][1] >> x[i][2];

  for (int i = 0; i < 8; i++){
    vector<long long> tmp;
    for (int j = 0; j < n; j++){
      long long sum = 0;
      for (int k = 0; k < 3; k++){
        if ((i / (1 << k)) % 2 == 0)
          sum += x[j][k];
        else
          sum -= x[j][k];
      }
      tmp.push_back(sum);
    }
    sort(tmp.begin(), tmp.end());
    reverse(tmp.begin(), tmp.end());
    long long answer = 0;
    for (int j = 0; j < m; j++)
      answer += tmp[j];
    maximum = max(answer, maximum);
  }
  cout << maximum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)
 
using ll  = long long;
using ull = unsigned long long;

int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    std::vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) {
        std::cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        std::cin >> B[i];
    }

    ll Asum = 0;
    ll Bsum = 0;
    for (int i = 0; i < N; i++) {
        Asum += A[i];
    }
    for (int i = 0; i < N; i++) {
        Bsum += B[i];
    }

    int ans = 0;
    bool flag = true;

    if (Asum < Bsum) {
        ans = -1;
    } else {
        std::vector<int> sub(N);
        for (int i = 0; i < N; i++) {
            sub[i] = A[i] - B[i];
        }

        for (int i = 0; i < N; i++) {
            if (sub[i] < 0) {
                flag = false;
            }
        }

        if (flag) {
            std::cout << 0 << std::endl;
            return 0;
        }

        ll hu = 0;
        std::vector<int> sei;
        for (int i = 0; i < N; i++) {
            if (sub[i] < 0) {
                ans++;
                hu += sub[i];
            } else if (sub[i] > 0) {
                sei.push_back(sub[i]); 
            }
        }

        std::sort(sei.rbegin(), sei.rend());

        for (int i = 0; i < sei.size(); i++) {
            hu += sei[i];
            ans++;
            if (hu >= 0) {
                break;
            }
        }
    }

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

Measured memory_bytes: 1792
#各桁の和を求める
def findSumOfDigits(n):
  sum = 0
  while n > 0:
    sum += int(n % 10)
    n = int(n / 10)
  return sum

N = int(input())

if N % 10 != 0 :
  print(findSumOfDigits(N))
else:
  print("10")

Measured memory_bytes: 2940
x,y,z,k = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
lst = [a+b for a in A for b in B]
lst.sort(reverse=True)
lst = [e+c for e in lst[:k] for c in C]
lst.sort(reverse=True)
for i in range(k): print(lst[i])

Measured memory_bytes: 142796
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int a,b,c,n;
bool func(vector<string>in){
  bool h=false;
  int now=b-1;
  rep(i,n){
    if(now&&in[i][now-1]=='1')now--;
    else if(now!=a-1&&in[i][now]=='1')now++;
  }
  if(now==c-1)h=true;
  return h;
}
int main(){
  while(cin>>a,a){
    cin>>b>>c>>n;
    vector<string>in(n);
    rep(i,n)cin>>in[i];
    if(func(in)){
      cout<<0<<endl;
      continue;
    }
    bool h=false;
    rep(j,n)rep(i,a-1){
      if(in[j][i]=='1')continue;
      if(i&&in[j][i-1]=='1')continue;
      if(i!=a-1&&in[j][i+1]=='1')continue;
      //cout<<"!"<<j+1<<" "<<i+1<<endl;
      in[j][i]='1';
      if(func(in)){
	cout<<j+1<<" "<<i+1<<endl;
	j=n;
	h=true;
	break;
      }
      in[j][i]='0';
    }
    if(!h)cout<<1<<endl;
  }
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
                                                                                                
  
int main(){
                                                                                                
   
    int i;
 
    char m;

    string s;

    int k = 700;

    
    cin >> s;


    for( i = 0 ; i < s.size() ; i = i + 1 ){

         m = s.at(i);

         if( m != 'x' ) k += 100;

         }


    cout << k << endl;


    return 0;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N = 0, c = 0;
	double m = 0, E = 0, M = 0;
	cin >> N >> M;
	vector<double> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	for(int i = 0; i < N; i++){
    	E = E + A.at(i);
    }
	m = E / (M * 4);
	for(int i = 0; i < N; i++){
		if(A.at(i) >= m){
			c++;
        }
    }
	if(c >= M){
		cout << "Yes";
	} else {
		cout << "No";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//cout<<fixed<<setprecision(15)<<

signed main(){
    char c; cin >> c;
    char res=c+1;
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<math.h>
#define MOD 1000000007
#define lint long long int
using namespace std;

int main()
{
	int N, M;	cin >> N >> M;
	vector<int> a(M+1,0);	
	vector<lint> ans(N + 1);
	for (int i = 0; i < M; i++)
		cin >> a[i];

	int i = 0;	//障害物の添え字
	ans[0] = 1;
	if (a[0] == 1)
	{
		i++;
		ans[1] = 0;
	}
	if (a[0] != 1)	ans[1] = 1;

	for (int j = 2; j <= N; j++)
	{

		if (a[i] != j)
		{
			ans[j] = (ans[j - 2] + ans[j - 1])%MOD;
		}
		if (a[i] == j)	//障害物があるとき
		{
			ans[j] = 0;
			i++;
		}
		//cout << ans[j]<<endl;
	}

	cout << ans[N]%MOD;

	return 0;
}

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

using namespace std;

int main(){
	int N;
	string S;
	cin >> N;
	cin >> S;

	int a[N];
	int b[N];
	int count_w = 0;
	for(int i = 0; i < N; i++){
		if(S[i] == 'W'){
			count_w++;
		}
		a[i] = count_w;
	}
	for(int i = 0; i < N; i++){
		b[i] = i + 1 - a[i];
	}

	int ans = 1e9;
	for(int i = 0; i < N; i++){
		int sum = 0;
		if(i == 0){
			sum = b[N - 1] - b[0];
		}else{
			sum += a[i - 1] + b[N - 1] - b[i];
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
  using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<int> l(N);
  int mx=0;
  int sum=0;
  int j;
  for(int i=0;i<N;i++){
    cin>>j;
    sum+=j;
    mx=max(mx,j);
  }
  if(mx<sum-mx){
   cout<<"Yes" <<endl;
  }else{
   cout<<"No" <<endl;    
  }
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int[] a = new int[n];
		int y = 0;
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
			y ^= a[i];
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; ++i) {
			sb.append(y ^ a[i]);
			sb.append((i < n - 1) ? ' ' : '\n');
		}
		System.out.println(sb.toString());
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		}

		ptr = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}

		return buflen > 0;
	}

	private int readByte() {
		return hasNextByte() ? buffer[ptr++] : -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public String nextLine() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b) || b == ' ') {
			sb.appendCodePoint(b);
			b = readByte();
		}

		while (b != '\n') {
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 48444
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n=Integer.parseInt(st.nextToken()), k=Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int[]ar=new int[n],dp=new int[n];
		for(int i=0;i<n;i++)ar[i]=Integer.parseInt(st.nextToken());
		Arrays.fill(dp, Integer.MAX_VALUE);
		dp[0]=0;
		for(int i=1;i<n;i++){
			for(int j=1;j<=k;j++){
				if(i-j<0)break;
				dp[i]=Math.min(dp[i], dp[i-j]+Math.abs(ar[i]-ar[i-j]));
			}
		}
		System.out.println(dp[n-1]);
	}

}


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

int main() {
	vector<int>a(3);
	for (int i = 0; i < 3; i++)cin >> a.at(i);
	sort(a.begin(), a.end());
	cout << a.at(2)-a.at(0) << endl;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  (n : x : y : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    d :: Int -> Int -> Int
    d i j | j <= x || y <= i = j - i
          | otherwise        = min (j - i) (abs (j - y) + 1 + abs (x - i))
    ds = [1..(pred n)] >>= \i -> [(succ i)..n] >>= \j -> return (d i j) :: [Int]
  VU.mapM_ print . VU.tail . count n $ ds

count :: Int -> [Int] -> VU.Vector Int
count n = VU.accum (+) (VU.replicate n 0) . map (flip (,) 1)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 1020
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int ans = -1;
    for(int i = 1; i <= 1000; i++) {
      int C = (((int)8 * i) / (int)100);
      int D = (((int)10 * i) / (int)100);
      if((A == C) && (B == D)) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35708
a = int(input())
b = int(input())
c = int(input())
v = int(input())

ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i + 100*j + 50*k == v:
        ans += 1

print(ans)

Measured memory_bytes: 3060
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var n=arr.shift()-0;
   if(n==0)break;
   var ary=arr.slice(0,n);
   ary=ary.map(v=> v.split(" ").map(Number).slice(1));
   var flag=true;
   var h=[];
   for(var i=0;i<n;i++)h.push([i]);
   for(var i=1;i<=30;i++){
      var a=[];
      ary.forEach((v,j)=>{
         if(v.includes(i))a.push(j);
      });
      var b=[];
      a.forEach(v=>b.push(...h[v]));
      b= b.filter((x, i, self) => self.indexOf(x) == i);
      if(b.length==n){
         flag=false;
         console.log(i);
         break;
      }
      a.forEach(v=> h[v]=b);
   }
   if(flag)console.log(-1);
   arr=arr.slice(n);
}


Measured memory_bytes: 34748
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int n,m; scanf("%d%d",&n,&m); ll ans=0;
	if (n>m) swap(n,m);
	if (n==1){
		if (m==1) puts("1");
		else printf("%d\n",m-2);
	} else{
		ans=1ll*n*m-2ll*(n-1+m-1);
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int xorAll = 0;
		int a[] = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
			xorAll ^= a[i];
		}

		for(int i = 0; i < n; i++){
			if(i != 0){
				System.out.print(" ");
			}

			System.out.print(xorAll^a[i]);
		}

		System.out.println();
	}

}


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

int main()
{

int n,m;
cin >> n >> m;
int sum = 0;
for (int i=0; i<m; i++)
{   int a; cin >> a; sum+=a;
}

if (n<sum) cout << "-1"; else cout << n- sum;



}







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

int main()
{
int r;
cin >> r;
cout << 2 * r * 3.14159265359;
}
*/


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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    if ((g*10+b)%4==0){
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k,r,s,p,m;
string t;
char x,o[1000006];
void g ()
{
    if (x=='r')
        m+=r;
    else if (x=='p')
        m+=p;
    else
        m+=s;
}
int main()
{   //r-p
    //p-s
    //s-r
    cin>>n>>k>>r>>s>>p>>t;
    for (int i=0;i<n;i++)
    {
        if (t[i]=='r')
            x='p';
        else if (t[i]=='p')
            x='s';
        else
            x='r';
        if (i>=k)
        {
            if (o[i-k]==x)
            {
                o[i]='.';
            }
            else
            {
                o[i]=x;
                g();
            }
        }
        else
        {
            o[i]=x;
            g();
        }
    }
    cout<<m;
    return 0;
}


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

int N, M, C;
int B[22];
int A[22];

int main() {
    cin >> N >> M >> C;
    for (int i=0; i<M; ++i) cin >> B[i];

    int ans = 0;
    for (int i=0; i<N; ++i) {
        int temp = C;
        for (int j=0; j<M; ++j) {
            cin >> A[j];
            temp += A[j]*B[j];
        }
        if (temp > 0) ++ans;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
using namespace std;
typedef pair<int, int> point;

int main(void) {
    int n, r=1;
    cin >> n;
    int a[n+2];
    for(int i=1; i<=n; i++)
        cin >> a[i];
    vector<int> b;
    for(int i=1; i<=n; i++) {
        if(r)
            b.push_back(a[i]);
        else
            b.insert(b.begin(), a[i]);
        r=1-r;
    }
    
    if(n%2==0) {
        for(int i=0; i<n; i++)
            printf("%d ", b[i]);
    }else {
        for(int i=n-1; i>=0; i--)
            printf("%d ", b[i]);
    }
}


Measured memory_bytes: 3828
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.util.function.DoubleToLongFunction;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		int[] a = new int[N];
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt()-1;
		}
		int ans = 0;
		for(int i = 0; i < N; i++){
			if(a[a[i]] == i) ans++;
		}
		ans /= 2;
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 24336
#include<bits/stdc++.h>
#define N 200100
using namespace std;
int a[N],b[N];
int main(){
	priority_queue<pair<int,int>> pq;
	int n;
	long long cnt=0;
	bool gg=false;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
		pq.push(make_pair(b[i],i));
	}
	while(!pq.empty()){
		auto p=pq.top();
		pq.pop();
		int i=p.second;
		if(p.first!=b[i]) continue;
		int nb=b[(i+1)%n]+b[(i+n-1)%n];
		if(b[i]>=nb){
			if(b[i]%nb<=a[i]){
				if(b[i]%nb!=a[i]%nb){
					gg=true;
					break;
				}
				else{
					cnt+=(b[i]-a[i])/nb;
					b[i]=a[i];
				}
			}
			else{
				cnt+=b[i]/nb;
				b[i]%=nb;
				pq.push(make_pair(b[i],i));
			}
		}
	}
	for(int i=0;i<n;i++) if(a[i]!=b[i]) gg=true;
	if(gg) puts("-1");
	else printf("%lld\n",cnt);
	return 0;
}

Measured memory_bytes: 3700
mx=100000
p=[True]*(mx+10)
p[0]=p[1]=False
for i in range(2,mx+1):
  if p[i]==True:
    for j in range(i*i,mx+1,i):
      p[j]=False
A=[]
for i in range(1,mx+1):
  if p[i]==True and i%5==1:
    A.append(i)

N=int(input())
print(*A[0:N])

Measured memory_bytes: 3828