akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string plus_string(string a, string b){
	string c;
	reverse( a.begin() , a.end() );
	reverse( b.begin() , b.end() );
	while( a.size() != b.size() ){
		if( a.size() < b.size() ){
			a.push_back('0');
		}else{
			b.push_back('0');
		}
	}
	for(int i=0 ; i < a.size() ; i++ ){
		c.push_back('0');
	}
	int n=0;
	for(int i=0 ; i < a.size() ; i++ ){
		if( n+a[i]+b[i]-'0'-'0' <= 9 ){
			c[i] = a[i] + b[i] - '0' + n;
			n = 0;
		}else{
			c[i] = a[i] + b[i] - '0' - 10 + n;
			n = 1;
		}
	}
	if( n == 1 ){
		c.push_back( '1' );
	}
	reverse( c.begin() , c.end() );
	return c;
}

string change_X(string s, char c){
	for(int i=0 ; i < s.size() ; i++ ){
		if( s[i] == 'X' ){
			s[i] = c;
		}
	}
	return s;
}

void solve(string s){
	string num1, num2, num3, a, b, c;
	int plus, equal;
	for(int i=0 ; i < s.size() ; i++ ){
		if( s[i] == '+' )
			plus = i;
		if( s[i] == '=' )
			equal = i;
	}
	num1 = s.substr( 0 , plus );
	num2 = s.substr( plus+1 , equal-plus-1 );
	num3 = s.substr( equal+1 );
	for(int i=0 ; i <= 9 ; i++ ){
		a = change_X( num1 , i+'0' );
		b = change_X( num2 , i+'0' );
		c = change_X( num3 , i+'0' );
		if( plus_string( a , b ) == c ){
			cout << i << endl;
			return;
		}
	}
	cout << "NA" << endl;
}

int main(){
	string s;
	while( cin >> s ){
		solve( s );
	}
}

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

i = 0
c = 0
min_c = 0
while i < N:
    if S[i] == "(":
        c += 1
    else:
        c -= 1
    min_c = min(c, min_c)
    i += 1

print("(" * (-min_c) + S + ")" * (c-min_c))

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int h, n, total = 0;
	cin >> h >> n;
	vector<int> a(n); 
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}

	if (total >= h) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_NM = 15;
int C[MAX_NM],temp[MAX_NM],A[MAX_NM][MAX_NM];

void init()
{
	rep(i,MAX_NM)
	{
		temp[i] = 0;
	}
	return;
}

int main()
{
	int N,M,X;
	cin >> N >> M >> X;
	rep(i,N)
	{
		cin >> C[i];
		rep(j,M)
		{
			cin >> A[i][j];
		}
	}
	int ans = 2000000;
	for (int bits = 0; bits < (1 << N); ++bits)
	{
		init();
		int tempp = 0;
		rep(i,N)
		{
			if (1 & (bits >> i))
			{
				tempp += C[i];
				rep(j,M)
				{
					temp[j] += A[i][j];
				}
			}
		}
		bool flag = true;
		rep(i,M)
		{
			if (temp[i] < X) flag = false;
		}
		if (flag)
		{
			ans = min(ans,tempp);
		}
	}
	if (ans == 2000000) cout << "-1" << endl;
	else cout << ans << endl;
	return 0;
}

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

    res = []
    xorSum = 0

    for i in range(0,N-1):
        xorSum ^= A[i]
    
    res.append(xorSum)
    A_reversed = A[::-1]

    for i in range(N-1):
        xorSum = xorSum ^ A_reversed[i] ^ A_reversed[i+1]
        res.append(xorSum)
    
    print(" ".join(map(str, res[::-1])))

if __name__ == '__main__':
    main()

Measured memory_bytes: 45156
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e10;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

signed main(void){
    int n = in(), k = in(); 
    vector<int> num(n);
    REP(i, n) cin >> num[i];
    int ans = INF;
    REP(i, n - k + 1){
        ans = min(ans, min(abs(num[i]), abs(num[i + k - 1])) + num[i + k - 1] - num[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    int ans = 1;
    while(n > 0)
    {
        int a = ans * 2;
        int b = ans + k;
        ans = min(a,b);
        n--;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll A[100010];
int main() {
	ll a,b;
	cin>>a>>b;
	ll ans=1;
	if(a==b){
		ans*=2;
	}
	if(abs(a-b)>1){
		ans=0;
	}
    // 前処理
    COMinit();
    A[1]=1;
    for(ll i=2;i<100010;i++){
    	A[i]=i*A[i-1];
    	A[i]%=inf;
    }
    cout << (ans*A[a]*A[b])%inf;
}

Measured memory_bytes: 13180
#include<iostream>
#include<fstream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<ctime>
#include<queue>
using namespace std;
#define int long long
#define pii pair <int, int>
#define XX first
#define YY second

// constants:
const int mn = 200005;
const int mod = 1000000007;
const long long inf = 4444444444444444444;
const int sminf = 1111111111;
const bool is_multitest = 0;
const bool is_interactive = 0;

// i/o methods:
const bool input_from_file = 0;
const bool output_to_file = 0;
#define filename ""
#define in_extension "inp"
#define out_extension "out"

// data preprocessing: (e.g.: divisor generating, prime sieve)
void preprocess()
{
    
}

// global variables:
int n, k;

bool IP[mn];
vector <int> divisor[mn];
int POW(int u, int v) {
    // cerr<<u<<" "<<v<<"\n";
    if (v==0) return 1;

    int mid = POW(u, v/2);
    mid = (mid*mid)%mod;

    if (v%2==0) return mid;
    else return (mid*u)%mod;
}
int upd[mn];
// main solution goes here:
void execute(int test_number)
{
    for (int i=2; i<mn; i++) IP[i] = 1;
    for (int i=2; i<mn; i++) if (IP[i]) {
        for (int j=i*i; j<mn; j+=i) IP[j] = 0;
    }
    cin>>n>>k;
    for (int i=1; i<=k; i++) {
        for (int j=i*2; j<=k; j+=i) {
            if (true) {
                divisor[j].push_back(i);
            }
        }
    }

    // cerr<<POW(2, 2)<<"\n";

    int ans = 0;
    for (int i=1; i<=k; i++) {
        int v = 0;
        for (int u: divisor[i]) v+=upd[u];
        upd[i] = i-v;
        ans=((ans+(i-v)*POW(k/i, n))%mod+mod)%mod;
    }
    cout<<ans;
}
// REMEMBER TO CHOOSE TEST METHODS
// PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS
// Solution by low_



















signed main()
{
#ifdef lowie
    if (!is_interactive)
    {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
#else
    if (input_from_file) freopen(filename"."in_extension, "r", stdin);
    if (output_to_file) freopen(filename"."out_extension, "w", stdout);
#endif
    if (!is_interactive)
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }

    preprocess();
    int ntest;
    if (is_multitest) cin >> ntest;
    else ntest = 1;

    for (int testno = 1; testno <= ntest; testno++)
    // use for instead of while to serve facebook hacker cup test format
    {
        execute(testno); // only start coding in this function, not in main
    }
}
// Template by low_
// Contact me via mail: ttuandung1803@gmail.com
// ...or codeforces: www.codeforces.com/profiles/low_
// ...or if you're interested in food: www.instagram.com/lowie.exe/

Measured memory_bytes: 22936
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>
using namespace std;
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	fill((T*)array, (T*)(array + N), val);
}

const ll INF = 1e18;

int main() {
	IOS;
	ll n, m, x, y;
	cin >> n >> m >> x >> y;
	vector<ll> a(n), b(m);
	REP(i, n)cin >> a[i];
	REP(i, m)cin >> b[i];
	sort(ALL(a));
	sort(ALL(b));
	dump(max(x, a[n - 1]) < min(y, b[0]) ? "No War" : "War");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String S = sc.next();
		
		if(S.equals("ABC")){
        	System.out.println("ARC");
        }
        else{
        	System.out.println("ABC");
        }
	}
}

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

using namespace std;

int main(){
    int p;
    while(cin >> p){
        vector<int> inv(p);
        vector<int> fact(p);
        vector<int> factInv(p);
        for(int i=0;i<2;i++) inv[i] = fact[i] = factInv[i] = 1;
        for(int i=2;i<=inv.size()-1;i++){
            inv[i] = inv[p % i] * (p - p / i) % p;
            fact[i] = fact[i-1] * i % p;
            factInv[i] = factInv[i-1] * inv[i] % p;
        }
        auto comb = [&](int n, int r){
            if(n < r) return 0;
            return fact[n] * factInv[n-r] % p * factInv[r] % p;
        };
        vector<int> b(p, 0);
        for(int i=0;i<p;i++){
            int a; cin >> a;
            if(!a) continue;
            b[0] = (b[0] + 1) % p;
            int m = 1;
            for(int j=p-1;j>=0;j--){
                int add = comb(p-1, j) * m % p;
                if((p-1-j)%2 == 0) add = (p - add) % p;
                b[j] = (b[j] + add) % p;
                m = (m * i) % p;
            }
        }
        cout << b[0];
        for(int i=1;i<p;i++) cout << " " << b[i];
        cout << endl;
    }
}

Measured memory_bytes: 256
""" AtCoder """

import collections

N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

ss = collections.Counter(s)
tt = collections.Counter(t)

ans = 0

for i in range(len(ss)):
    ans = max(ss.most_common()[i][1] - tt[ss.most_common()[i][0]], ans)

print(ans)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
/*
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
using Graph = VV;
*/
typedef  long long ll;
typedef vector<long long> VL;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	string t;
	cin >> t;
	VL dp(30, 0);
	dp[s[0] - 'a']++;
	for (int i = 1; i < n - 1; i++) {
		int A = s[i] - 'a';
		int B = t[i] - 'a';
		dp[A] += dp[B];
		dp[A] %= MOD;
	}
	int G = t[n - 1] - 'a';
	cout << dp[G] << endl;
	return 0;
}


Measured memory_bytes: 3284
# 右と下の両方に#があったら終了だしどちらにもなくても終了
# なんやこのクソみたいな実装は

h, w = map(int, input().split())
table = []
sharp = 0
for _ in range(h):
    get = input()
    table.append(get)
    sharp += get.count("#")

flag = False
pos = [0, 0]
path = 0
while True:
    if pos == [h - 1, w - 1]:
        path += 1
        flag = True
        break
    if h <= pos[0] or w <= pos[1]:
        break
    if (
        pos[0] < h - 1
        and pos[1] < w - 1
        and table[pos[0] + 1][pos[1]] == "#"
        and table[pos[0]][pos[1] + 1] == "#"
    ):
        break
    if pos[0] < h - 1 and pos[1] < w - 1 and table[pos[0] + 1][pos[1]] == "#":
        pos[0] += 1
        path += 1
        continue
    elif pos[0] < h - 1 and pos[1] < w - 1 and table[pos[0]][pos[1] + 1] == "#":
        pos[1] += 1
        path += 1
        continue
    if pos[0] == h - 1 and pos[1] < w - 1 and table[pos[0]][pos[1] + 1] == "#":
        pos[1] += 1
        path += 1
        continue
    elif pos[0] < h - 1 and pos[1] == w - 1 and table[pos[0] + 1][pos[1]] == "#":
        pos[0] += 1
        path += 1
        continue
    else:
        break

print("Possible" if flag and path == sharp else "Impossible")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
	ll n,k;cin>>n>>k;
	ll x[n];rep(i,0,n)cin>>x[i];
	ll res = min(abs(x[0])+abs(x[k-1]-x[0]), abs(x[k-1])+abs(x[k-1]-x[0]));
	rep(i,0,n-k+1){
		ll tmp = min(abs(x[i])+abs(x[i+k-1]-x[i]), abs(x[i+k-1])+abs(x[i+k-1]-x[i]));
		if( res > tmp )
			res = tmp;
	}
	cout << res << ednl;
}

Measured memory_bytes: 1024
import java.lang.StringBuffer;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuffer string = new StringBuffer(scanner.next());

        while(true) {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        }
    }
}


Measured memory_bytes: 28836
<?php
  fscanf(STDIN,"%d %d",$n,$T);
  $list = [];
  for($i=0; $i<$n; $i++){
    fscanf(STDIN,"%d %d",$c,$t);
    if($t <= $T){
      $list[] = $c;
    }
  }
  if(count($list) > 0){
    echo min($list)."\n";
  }else{
    echo "TLE\n";
  }

Measured memory_bytes: 4728
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<iostream>
const int N=1e5+10;
struct apple
{
	int x,y;
}edge[N];
int k,f[N];
long long cnt;
void push_back(int x,int y)
{
	edge[++k].x=x;
	edge[k].y=y;
 } 
int find(int x)
{
	if(f[x]==x)
		return x;
	f[x]=find(f[x]);
	return f[x];
}
void unioned(int x,int y)
{
	int fx,fy;
	fx=find(x);
	fy=find(y);
	if(fx!=fy)
	{
		f[fx]=fy;
		cnt--;
	} 
}
int judge(int x,int y)
{
	int fx,fy;
	fx=find(x);
	fy=find(y);
	if(fx==fy)
		return 0;
	return 1;
}
int main()
{
	int fla,q,i,x,y,z;
	long long n,m;
	fla=1;
	k=0;
	scanf("%lld%lld%d",&n,&m,&q);
	cnt=n;
	for(i=1;i<=n;i++)
		f[i]=i;
	for(i=1;i<=q;i++)
	{
		scanf("%d%d%d",&x,&y,&z);
		x++;
		y++;
		if(z==0)
			unioned(x,y);
		else
			push_back(x,y);
	}
	//for(i=1;i<=n;i++)
	//	printf("%d ",f[i]);
	//printf("\n");
	if(m==n-1)
	{
		if(k>0)
			printf("No");
		else
			printf("Yes");
		return 0;
	}
	for(i=1;i<=k;i++)
		if(!judge(edge[i].x,edge[i].y))
			fla=0;
	//printf("%d\n",fla);
	if(m>n-cnt+cnt*(cnt-1)/2)
		fla=0;
	if(fla)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<algorithm>
using namespace std;
int dp[510][21000];
int c[10010];
int d[510];
int e[510];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%d",c+i);
	std::sort(c,c+a);
	for(int i=0;i<b;i++){
		scanf("%d%d",d+i,e+i);
	}
	for(int i=0;i<=b;i++){
		for(int j=0;j<21000;j++){
			dp[i][j]=999999999;
		}
	}
	dp[0][0]=0;
	for(int i=0;i<b;i++){
		for(int j=0;j<=20500;j++){
			if(dp[i][j]>=99999999)continue;
			dp[i+1][j+d[i]]=min(dp[i+1][j+d[i]],dp[i][j]+e[i]);
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
		}
	}
	for(int i=20200;i>=0;i--)dp[b][i]=min(dp[b][i],dp[b][i+1]);
	int ret=-999999999;
	int val=0;
	for(int j=0;j<=a;j++){
		ret=max(ret,val-dp[b][j]);
		val+=c[a-1-j];
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 42196
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while (1) {
        int N,L,R; cin >> N >> L >> R;
        if (N+L+R==0) break;
        vector<int> A(N);
        rep(i,N) cin >> A[i];

        int ans = 0;
        for (int i = L; i <= R; ++i) {
            bool flag = (N&1 ? 0 : 1);
            rep(j,N) {
                if (i%A[j]==0) {
                    if (j&1) flag = 0;
                    else flag = 1;
                    break; 
                }
            }
            if (flag) ans++;
        }
        cout << ans << ln;
    }
}



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

using namespace std;

int main()
{
	int i, j, k;
	int n;

	cin >> n;

	vector<int> l;
	l.resize(n);

	int max = 0;
	int mn = -1;
	int sum = 0;

	for (i = 0; i < n; i++)
	{
		cin >> l[i];
		if (max < l[i])
		{
			sum += max;
			max = l[i];
			mn = i;
		}
		else
		{
			sum += l[i];
		}
	}

	if (sum > max)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}

	return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define forp(x,a,b) for(int x=a; x<b; x++)
#define forn(x,a,b) for(int x=a; x>b; x--)
#define SZ(a) ((int)(a).size())
#define pb push_back
#define vec(x) vector<x>
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
#define umpii unordered_map<int,int>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed<<setprecision(n)
#define ff first
#define ss second
#define print(x) for(auto it:x) cout<<it<<" ";
using namespace std;
typedef long long ll;

int pot(int x,int y){if(y==0){return 1;}
else{return x*pot(x,y-1);}
}

int bin(int x,int y){if((x==0 && y!=0)||(y==0 && x!=0)){return 1;}
else{return bin(x,y-1)+bin(x-1,y);}
}

void strlwr(string& s){for(int i=0;(unsigned)i<s.size();i++){if(s[i]>='A' && s[i]<='Z'){s[i]+=32;}}
}



int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m,k,mx=0;
    ll x; 
    cin>>n>>m>>k;
    vector<ll> a, b;
    forp(i,0,n+1){if(i==0){a.pb(0LL);}
    else{cin>>x; a.pb(a[i-1]+x);}}
    forp(i,0,m+1){if(i==0){b.pb(0LL);}
    else{cin>>x; b.pb(b[i-1]+x);}}
    b.pb(100000000000000LL);
     forp(i,0,n+1){if(a[i]<=k){int y=k-a[i]; int z=upper_bound(b.begin(),b.end(), y)-1-b.begin();mx=max(mx, z+i);
     }}
     
     cout<<mx;
     
    return 0;}

Measured memory_bytes: 7952
/*
    
*/
#include<bits/stdc++.h>
using namespace std;
#define CoDeFoRcEs_and_ChIlL ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define pii pair<ll,ll>
#define ff first
#define ss second
#define endl '\n'
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
const ll M =1000000007;
const double pi  =acos(-1);
const int N = 2e5 + 10;
int main()
{  
    CoDeFoRcEs_and_ChIlL;
    /*ll a,b,c,d,i=0;
    cin>>a>>b>>c>>d;
    while(a>0 or c>0)
    {
        if(i%2==0)
        c-=b;
        else a-=d;
        i++;
    }
    if(a<=0)cout<<"No";
    else cout<<"Yes";*/
    ll n;
    cin>>n;
    map<string,ll> m;
    fl(i,0,n)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<m.size();
} 

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

int main() {
	int d;
	cin >> d;
	string k = "Christmas";
	for(int i = 25;i > 21;i--)
	{
		if(d == i)
		{
			break;
		}
		k += " Eve";
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll lcm(ll a,ll b){return a*b/__gcd(a,b);}
ll const MOD = 1e9 + 7;
ll const N = 1e6+5;
vector<int>chk(N,0);
int main()
{
    int n,gg=1;
    cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        chk[a[i]]++;
    }
    for(ll i=2;i<=N;i++)
    {
        int x=0;
        for(ll j=i;j<=N;j+=i)
           x+=chk[j];
        if(x>=2){gg=5ll;goto done;}
    }
    done:;
    ll g=0;
    for(ll i=0;i<n;i++)
        g=__gcd(g,a[i]);
    if(gg==1)cout<<"pairwise coprime"<<endl;
    else if(g==1)cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
}


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

namespace _1_1_a
{
    class Program
    {
        static void Main()
        {
                string[] i = Console.ReadLine().Split(' ');
                int a = int.Parse(i[0]);
                int b = int.Parse(i[1]);
                int c = int.Parse(i[2]);

                var count = 0;

                for (int x = a; x <= b; x ++)
                {
                    if (c % x == 0) count++;
                }
                Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 17944
#include<bits/stdc++.h> 
using namespace std;
#define int long long
const int N=1005,M=1e9+7;
struct zz{
    int a[2][2];
}Ans;
zz operator *(const zz &x,const zz &y){
    zz z;memset(z.a,0,sizeof z.a);
    for (int i=0;i<2;i++)
        for (int j=0;j<2;j++)
            for (int k=0;k<2;k++)
                (z.a[i][k]+=x.a[i][j]*y.a[j][k])%=M;
    return z;
}
zz ksm(zz a,int b){
    zz ans;memset(ans.a,0,sizeof ans.a);
    for (int i=0;i<2;i++)ans.a[i][i]=1;
    for (;b;b>>=1,a=a*a)
		if (b&1)ans=ans*a;
    return ans;
}
int Ksm(int a,int b){
    int res=1;
    for (;b;b>>=1,a=a*a%M)
		if (b&1)res=res*a%M;
    return res;
}
char s[N][N];
int n,m,k;
signed main(){
    scanf("%lld%lld%lld",&n,&m,&k);
    for (int i=1;i<=n;i++)scanf("%s",s[i]+1);
    int cnt=0,s1=0,s2=0,h1=0,h2=0;
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            if (s[i][j]=='#'){
                cnt++;
                if (s[i][j+1]=='#')s1++;
                if (s[i+1][j]=='#')s2++;
            }
        }
        if (s[i][1]=='#'&&s[i][m]=='#')h1++;
    }
    for (int i=1;i<=m;i++)
		if (s[1][i]=='#'&&s[n][i]=='#')h2++;
    if (h1&&h2){
        puts("1");
        return 0;
    }
    if (!h1&&!h2){
        printf("%d\n",Ksm(cnt,k-1));
        return 0;
    }
    if (!h1)swap(s1,s2),swap(h1,h2);
    Ans.a[0][0]=cnt,Ans.a[0][1]=s1,Ans.a[1][1]=h1;
    Ans=ksm(Ans,k-1);
    printf("%lld\n",(Ans.a[0][0]-Ans.a[0][1]+M)%M);
    return 0;
}

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


int main() {
	string S,T;
int r ,b;
    cin >> S >> T  ;
    cin >> r >> b  ;
string ny;
cin >> ny;

if(ny.compare(S)==0)r--;
if(ny.compare(T)==0)b--;

cout << r << " " << b << "\n";

return 0;
}

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

int main(){
    using namespace std;
    unsigned long N, M, K;
    cin >> N >> M >> K;
    vector<unsigned long> A{0}, B{0};
    copy_n(istream_iterator<unsigned long>(cin), N, back_inserter(A));
    copy_n(istream_iterator<unsigned long>(cin), M, back_inserter(B));
    partial_sum(begin(A), end(A), begin(A));
    partial_sum(begin(B), end(B), begin(B));
    A.erase(upper_bound(begin(A), end(A), K), end(A));
    B.erase(upper_bound(begin(B), end(B), K), end(B));
    A.push_back(2 * K);
    auto it = end(A) - 1;
    unsigned long ans{0};
    for(unsigned long i{0}; i < B.size(); ++i){
        while(*it + B[i] > K)--it;
        ans = max<unsigned long>(ans, i + it - begin(A));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7964
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 10000000000000
#define vll vector<ll>
using namespace std;
const int N=200005;

void solve()
{
	ll n,ans[104],y,i;
	string x;
	vector<pair<pair<string,ll>,ll> >v;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>x>>y;
		v.pb(MP(MP(x,-y),i));

	}
	sort(all(v));
	i=1;
	for(auto it:v)
		cout<<it.S+1<<"\n";
	
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let n = read!(usize);
    let abc: Vec<(usize, usize, usize)> = read!(usize, usize, usize; n - 1);
    let (q, k) = read!(usize, usize);
    let k: usize = k - 1; // 0-based
    let xy: Vec<(usize, usize)> = read!(usize, usize; q);

    let abc = abc
        .into_iter()
        .map(|x| (x.0 - 1, x.1 - 1, x.2))
        .collect::<Vec<(usize, usize, usize)>>();
    let xy = xy
        .into_iter()
        .map(|x| (x.0 - 1, x.1 - 1))
        .collect::<Vec<_>>();

    // 経由点であるkから各頂点への距離を求める
    // dist[i] := kからiまでの距離
    let mut dist = vec![INF as usize; n];
    dist[k] = 0;

    let mut links = vec![vec![]; n];
    for &r in &abc {
        let from = r.0;
        let to = r.1;
        let cost = r.2;
        links[from].push((to, cost));
        links[to].push((from, cost));
    }

    // bfs
    let mut deque = VecDeque::new();
    for &l in &links[k] {
        deque.push_back((k, l.0, l.1));
    }
    while let Some(cur) = deque.pop_front() {
        if dist[cur.1] != INF as usize {
            // もう最短距離計算済み
            continue;
        }
        // next
        for &l in &links[cur.1] {
            deque.push_back((cur.1, l.0, l.1));
        }

        dist[cur.1] = dist[cur.0] + cur.2;
    }

    // query processing
    for &query in &xy {
        println!("{}", dist[query.0] + dist[query.1]);
    }
}


Measured memory_bytes: 29980
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;

ll dfs(ll L, ll X, vector<ll>& c, vector<ll>& p) {
    if (L == 0) {
        return 1;
    }
    if (X == 0) {
        return 0;
    }
    if (X == c[L] / 2) {
        return p[L] - p[L] / 2;
    }
    if (X == c[L] - 1) {
        return p[L];
    }
    if (X < c[L] / 2) {
        return dfs(L - 1, X - 1, c, p);
    }
    else {
        ll res = dfs(L - 1, X - c[L] / 2 - 1, c, p);
        res += 1 + p[L] / 2;
        return res;
    }
}

void Main()
{
    ll n, X;
    cin >> n >> X;
    X--;

    vector<ll> c(n + 1);
    vector<ll> p(n + 1);
    c[0] = 1;
    repi(i, n + 1) c[i] = c[i - 1] * 2 + 3;
    p[0] = 1;
    repi(i, n + 1) p[i] = p[i - 1] * 2 + 1;

    ll res = dfs(n, X, c, p);
    put(res);
}
signed main(){ Main();return 0;}

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

int main(){
  string s;
  cin >> s;
  long long int c=0;
  long long int p=0;
  for(long long int i=0;i<s.size();i++){
    if(s.at(i)=='W'){
      c++;
      p=p+i+1;
    }
  }
  cout << p-c*(c+1)/2 << endl;
}

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

using namespace std;

vector< int64_t > divisor(int64_t n) {
    vector< int64_t > ret;
    for(int64_t i = 1; i * i <= n; i++) {
        if(n % i == 0) {
        ret.push_back(i);
        if(i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

int main(void) {
    int N;
    cin >> N;
    int ans = 0;
    for(int i=1; i<=N; i+=2) {
        if(divisor(i).size() == 8) {
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool binary(int key,int arr[],int n){
  int left = 0;
  int right = n;

  while(left < right){
    int mid = (left + right) / 2;
    if(arr[mid] == key)
      return true;
    else if(key < arr[mid])
      right = mid;
    else
      left = mid + 1;
  }

  return false;
}

int main(){
  int n,s[100000],q,t[50000];

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

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

  int cnt=0;
  for(int i=0; i<q; ++i){
    cnt+=binary(t[i],s,n);
  }

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 3660
n = int(input())
P = list(map(int, input().split()))
c = 0
for i in range(1, n-1):
  b = P[i-1:i+2]
  m = max(b)
  midx = b.index(m)
  b[midx] = 0
  sm = max(b)
  if sm == b[1]:
    c += 1
print(c)

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

int main(void)
{

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

    for (int i = 0; i < n - 1 ; i++)
    {   
        if(a[i] >= a[i + 1]){
            counter++;
            //cout << ">=|";
        }else{
            counter = 0;
            //cout << "<|";
        }
        ans = max(ans,counter);
    }
    cout << endl;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define forn(i,n) for(int i=0;i<n;i++)
#define fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%lld", &n)
#define sff(a,b) scanf("%lld %lld", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define f find
#define ub upper_bound
#define lb lower_bound
#define ld long double
#define in insert
#define bs binary_search  
#define le length()
const ll N=9999;
#define np(s) next_permutation(s.begin(),s.end())
//it gives the lexicographically next string//

int main()
{
  int arr[5];
  for(int i=0;i<5;i++)
   cin>>arr[i];
    for(int i=0;i<5;i++)
    {
      if(arr[i]==0)
      {
        cout<<i+1;
        break;
      }
    }
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000000
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto c:v) cout<<" "<<c; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}

void solve(){
	int d,t,s;
	cin>>d>>t>>s;
	if(s*t>=d)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}

int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--)
		solve();
}



Measured memory_bytes: 3648
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys
from collections import deque

num_tc = int(sys.stdin.readline())
queue = deque()

for i in range(num_tc):
    q = list(map(int, sys.stdin.readline().split()))
    if q[0] == 0:
        if q[1]: queue.append(q[2])
        else: queue.appendleft(q[2])
    elif q[0] == 1:
        print(queue[q[1]])
    elif q[0] == 2:
        if q[1]: queue.pop()
        else: queue.popleft()
    else:
        raise ValueError




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

int main() {
  int n;
  cin>>n;
  if (n % 10 == 7) {
    cout<<"Yes"<<endl;
    return 0;
  }
  n /= 10;
  if (n % 10 == 7) {
    cout<<"Yes"<<endl;
    return 0;
  }
  n /= 10;
  if (n % 10 == 7) {
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;

}

Measured memory_bytes: 3632
<?php

$is_honban = 1;

if ($is_honban) {
  //----------------------------------------------------------------------------------
  // Input for honban
  //----------------------------------------------------------------------------------
  $sc = new Scanner();
  $n = $sc->nextInt();
  $y = $sc->nextInt();



} else {
  //----------------------------------------------------------------------------------
  // Input for test
  //----------------------------------------------------------------------------------
  error_reporting(E_ERROR | E_WARNING | E_PARSE);

  $n = 9;
  $y = 45000;



}
//----------------------------------------------------------------------------------
// Main
//----------------------------------------------------------------------------------

$ans = 0;

$ok = 0;
for ($sen = 0; $sen <= $n; $sen++) {
  for ($gosen = 0; $gosen <= $n - $sen; $gosen++) {
    $man = $n - $sen - $gosen;
    if ($sen * 1000 + $gosen * 5000 + $man * 10000 == $y) {
      $ok = 1;
      break 2;
    }
  }
}


if ($ok) {
  $ans = $man . ' ' . $gosen . ' ' . $sen;
} else {
  $ans = '-1 -1 -1';
}





//----------------------------------------------------------------------------------
// Output
//----------------------------------------------------------------------------------
out::println($ans);



//----------------------------------------------------------------------------------
// Ref: https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
//----------------------------------------------------------------------------------
class Scanner {
  private $arr = array();
  private $count = 0;
  private $pointer = 0;
  public function next() {
    if($this->pointer >= $this->count) {
      $str = trim(fgets(STDIN));
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    $this->pointer++;
    return $result;
  }
  public function hasNext() {
    return $this->pointer < $this->count;
  }
  public function nextInt() {
    return (int)$this->next();
  }
  public function nextDouble() {
    return (double)$this->next();
  }
}

class out {
  public static function println($str = "") {
    echo $str . PHP_EOL;
  }
}

?>


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

long long score[100005];

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  for (int i = 1; i <= q; i++) {
    int a;
    cin >> a;
    score[a]++;
  }
  for (int i = 1; i <= n; i++) {
    score[i] += k - q;
  }
  for (int i = 1; i <= n; i++) {
    // cout << score[i] << " ";
    if (score[i] <= 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (ll)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// ll        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum ^= a[i];
  }
  vector<ll> l(n + 1);
  vector<ll> r(n + 1);
  l[0] = 0;
  repz(i, 1, n + 1) { l[i] = l[i - 1] ^ a[i - 1]; }
  r[n] = 0;
  for (ll i = n - 1; i >= 0; i--) {
    r[i] = r[i + 1] ^ a[i];
  }
  rep(i, n) {
    ll temp = sum^a[i];
    cout << temp;
    if (i == n - 1)
      cout << endl;
    else
      cout << " ";
  }

  ret;
}


Measured memory_bytes: 7880
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

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

string s;
cin >> s;
fin(s<="2019/04/30" ? "Heisei" : "TBD");

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll d, t, s;
	cin >> d >> t >> s;
	if (d <= t*s ){
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}



Measured memory_bytes: 3632
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    string s; cin>>s;
    int k; cin>>k;
    REP(i,n){
        if(s[i]!=s[k-1]) s[i]='*';
    }
    print(s);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
typedef long long int ll;
static const int MAX_N = 1000;

ll A, B, C; int N;
int x[MAX_N], y[MAX_N], z[MAX_N];

int main(){
	scanf("%lld %lld %lld %d", &A, &B, &C, &N);
	for(int i = 0; i < N; i++) scanf("%d %d %d", &x[i], &y[i], &z[i]);
	ll res = 2 * (A * B + B * C + C * A);
	for(int i = 0; i < N; i++){
		int cnt = 6;
		if(x[i] == 0) cnt -= 2;
		if(y[i] == 0) cnt -= 2;
		if(z[i] == 0) cnt -= 2;
		if(x[i] == A - 1) cnt -= 2;
		if(y[i] == B - 1) cnt -= 2;
		if(z[i] == C - 1) cnt -= 2;
		for(int j = i + 1; j < N; j++){
			if(x[j] == x[i] + 1 && y[j] == y[i] && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] - 1 && y[j] == y[i] && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] + 1 && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] - 1 && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] && z[j] == z[i] + 1) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] && z[j] == z[i] - 1) cnt -= 2;
		}
		res += cnt;
	}
	printf("%lld\n", res);
	return 0;
}



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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
	double a,b;
	long double x;
	cin >> a >> b >> x;
	double y;
	//cout << a*a*b/2 << " " << x << endl;
	if(a*a*b/2 >= x) {
		y = atan((b*b*a)/(2*x));
		
	}
	else {
		 y = atan((2*(a*a*b-x))/(a*a*a));
	}
	double pi = 3.14159265358979;
	double ans = y / pi * 180.0;
	//cout << y << endl;
	cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main( )
{
  int a,b,c,sub = 0;
  
  scanf("%d%d%d",&a,&b,&c);

  if(a > b)
    {
      sub = a;
      a = b;
      b = sub;
    }

  if(b > c)
    {
      sub = b;
      b = c;
      c = sub;
    }

  if(a > b)
    {
      sub = a;
      a = b;
      b = sub;
    }

  printf("%d %d %d\n",a,b,c);

  return 0;
}

Measured memory_bytes: 596
N = int(input())
T = [int(i) for i in input().split(' ')]
M = int(input())
PX = []
for _ in range(M):
    PX.append([int(i) for i in input().split(' ')])
SUM = sum(T)

for p,x in PX:
    print(SUM - T[p-1] + x)

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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N;
  cin >> N;
  bool ret = false;
  for (int i=0; i<N; i++) {
    ll A;
    cin >> A;
    ret = ret || A%2==1;
  }

  if (ret) {
    cout << "first" << endl;
  } else {
    cout << "second" << endl;
  }

  return 0;
}


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

int main() {

  int N;
  cin >> N;

  vector<long long> D(N),num(N);
  bool can = true;
  for(int i = 0;i < N;i++) {
    cin >> D.at(i);
    if(D.at(0) != 0) can = false;
    if(i > 0 && D.at(i) == 0) can = false;
    num.at(D.at(i))++;
  }

  long long ans = 1;
  for(int i = 2;i < N;i++) {
    for(int j = 0;j < num.at(i);j++) {
      ans *= num.at(i-1);
      ans %= 998244353;
    }
  }

  if(can) cout << ans << endl;
  else cout << 0 << endl;
}




Measured memory_bytes: 1792