akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    int res = 0;
    for(int i=0; i<s.size(); i++){
        if(s.at(i) == '+'){
            res++;
        }else{
            res--;
        }
    }
    cout << res << endl;
}


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

char BigAlphaToSmall(char a){
    if (a >= 65 && a <= 90){
        return a + 32;
    }
    return a;
}

char SmallAlphaToBig(char a){
    if (a >= 97 && a <= 122){
        return a - 32;
    }
    return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, a, b;cin >> n >> a >> b;
    string s;cin >> s;
    int count = 0;
    int count_b = 1;
    for (int i = 0; i < n; i++){
        if(s[i] == 'a'){
            if(count < a + b){
                say("Yes")
                count++;
            }else{
                say("No")
            }
            continue;
        }

        if(s[i] == 'b'){
            if(count < a + b && count_b <= b ){
                say("Yes")
                count++;
                count_b++;
            }else{
                say("No")
            }
            continue;
        }

        if(s[i] == 'c'){
            say("No")
            continue;
        }
    }
    
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
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(0) + a.at(1) << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

long long f(long long b,long long n)
{return b>n?n:f(b,n/b)+n%b;}

int main()
{
	long long n,s,m;
	scanf("%lld%lld",&n,&s);
	if(n==s)
	{
		printf("%lld\n",n+1);
		return 0;
	}
	if(n<s)
	{
		puts("-1");
		return 0;
	}
	m=sqrt(n);
	for(long long b=2;b<=m;b++)
		if(f(b,n)==s)
		{
			printf("%lld\n",b);
			return 0;
		}
	for(long long p=m-1,b=(p>=1?(n-s)/p+1:0);p>=1;p--,b=(p>=1?(n-s)/p+1:0))
		if((n-s)%p==0&&n/b==p&&p<=s)
		{
			printf("%lld\n",b);
			return 0;
		}
	if(s==1)
	{
		printf("%lld\n",n);
		return 0;
	}
	puts("-1");
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

int main(){
	cin>>n;
	cout<<32*n<<endl;
}

Measured memory_bytes: 3088
#include <stdio.h>

int main(void) {
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    if ( n * a > b ) {
        printf("%d\n", b);
    }
    else {
        printf("%d\n", n * a);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int main(){
  int h, w, n; cin >> h >> w >> n;
  cout << (n + max(h, w) - 1) / max(h, w) << endl;
}

// EOF

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

vector<int> tree(4 * N, INF), lazy(4 * N, INF);

int join(int a, int b) {
    return min(a, b);
}

void propagate(int node, int l, int r) {
	if (lazy[node] != INF) {
		tree[node] = min(tree[node], lazy[node]);
		
		if (l != r) {
			lazy[node << 1] = min(lazy[node << 1], lazy[node]);
			lazy[(node << 1) + 1] = min(lazy[(node<<1) + 1], lazy[node]);
		}
		
		lazy[node] = INF;
	}
}

void update(int node, int l, int r, int x, int y, int newVal) {
	if (l > r or l > y or r < x) {
		return ;
	}

	propagate(node, l, r);

	if (l >= x and r <= y) {
		tree[node] = min(tree[node], newVal);
		
		if (l != r) {
			lazy[node << 1] = min(lazy[node << 1], newVal);
			lazy[(node << 1) + 1] = min(lazy[(node << 1) + 1], newVal);
		}

		return ;
	}

	int m = (l + r) >> 1;
	update(node << 1, l, m, x, y, newVal);
	update((node << 1) + 1, m + 1, r, x, y, newVal);
    tree[node] = join(tree[node << 1], tree[(node << 1) + 1]);
}

int query(int node, int l, int r, int x, int y) {
    if (l > r or l > y or r < x) {
        return INF;
    }

    propagate(node, l, r);

    if (l >= x and r <= y) {
        return tree[node];
    }

    int m = (l + r) >> 1;
    int q1 = query(node << 1, l, m, x, y);
    int q2 = query((node << 1) + 1, m + 1, r, x, y);
    return join(q1, q2);
}

struct data {
	int s, t, x;
	bool operator< (const data& other) const {
		return x < other.x;
	}
} a[N];

int d[N];

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

	int n, q;
	cin >> n >> q;

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

	sort(a, a + n);

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

	for (int i = 0; i < q; i++) {
		int st = lower_bound(d, d + q, a[i].s - a[i].x) - d;
		int en = upper_bound(d, d + q, a[i].t - a[i].x - 1) - d - 1;
		if (st <= en) {
			update(1, 1, q, st + 1, en + 1, a[i].x);
		}
	}

	for (int i = 0; i < q; i++) {
		int ans = query(1, 1, q, i + 1, i + 1);
		cout << (ans == INF ? -1 : ans) << "\n";
	}
    return 0;
}

Measured memory_bytes: 20608
#include<stdio.h>

int main(void) {
  int a,b;
  int is_a, is_b, is_a_and_b;

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

  is_a = (a % 3 == 0) ? 1 : 0;
  is_b = (b % 3 == 0) ? 1 : 0;
  is_a_and_b = ((a + b) % 3 == 0) ? 1 : 0;

  if (is_a || is_b || is_a_and_b)
    puts("Possible");
  else
    puts("Impossible");

  return 0;
}

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

int main(void)
{
    int r, D, x;
    cin >> r >> D >> x;

    rep(i, 10)
    {
        x = x*r - D;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
chomp($x=<>);
($n,$k) = split/ /,$x;
@ary=();
while(<>){
	chomp();
    ($a,$b)=split/ /,$_;
    $ary[$a]+=$b;
}
for(1..100000){
	if($k<=$ary[$_]){
    	$ans=$_;
        last;
    }else{
    	$k-=$ary[$_];
    }
}

print $ans;

Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] p = new int[N];
		for(int i = 0;i < N;i++) {
			p[i] = scn.nextInt();
		}
		int ans = 0;
		for(int i = 1;i < N-1;i++) {
			if((p[i] < p[i+1]&&p[i] > p[i-1]) || (p[i]>p[i+1]&&p[i] < p[i-1]))ans++;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 21844
#include <iostream>
#define ll long long
#define f(i, n) for (int i=1; i <= n; i++)
// sort(bb, bb+n);

using namespace std;
int main()
{
    std::ios::sync_with_stdio(false);
    ll n,t,r;
    bool luck=false;
    cin >> n;
    t=n/500;
    r= (n-500*t)/5;
    cout <<t*1000+r*5;

    return 0;
}

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

using namespace std;

#define fto(i, s, e) for(int i = s; i <= e; ++i)
#define fto1(i, s, e) for(int i = s; i < e; ++i)
#define fdto(i, s, e) for(int i = s; i >= e; --i)
#define fit(var, it) for(__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define frit(var, it) for(__typeof(var.rbegin()) it = var.rbegin(); it != var.rend(); ++it)

#define newl '\n'
#define debugt cerr << 0.001*clock() << newl
#define debug1(x, i) cout << #x << '[' << i << "] = " << x[i] << newl
#define debug(v, l, r) fto(_i, l, r) debug1(v, _i)
#define debug2(x, i, j) cout << #x << '[' << i << "][" << j << "] = " << x[i][j] << newl
#define debug3(x, i, j, k) cout << #x << '[' << i << "][" << j << "][" << k << "] = " << x[i][j][k] << newl

#define ll long long
#define ii pair<int, int>
#define ff first
#define ss second
#define pb push_back
#define glen(v) int((v).size())

template<typename T1, typename T2> ostream& operator<< (ostream &os, pair<T1, T2> const &v) {
	return os << '(' << v.ff << ", " << v.ss << ')';
}

#define eps 1e-15
#define oo 1000000007
#define OO 1000000000000000003LL
#define maxn 100003

int n, k;
int h[maxn], f[maxn];

int main() {
	#ifndef ONLINE_JUDGE
		//freopen("main.inp", "r", stdin);
		//freopen("main.out", "w", stdout);
	#endif
	//ios_base::sync_with_stdio(0); cin.tie(0);

	scanf("%d%d", &n, &k);

	fto (i, 1, n) scanf("%d", &h[i]);

	fto (i, 2, n) {
		f[i] = oo;
		int mn = min(k, i-1);
		fto (j, 1, mn) {
			f[i] = min(f[i], f[i-j] + abs(h[i] - h[i-j]));
		}
	}

	printf("%d\n", f[n]);

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{   int n;
	cin>>n;
	int v=n%10;
	string ans;
	if(v==0||v==1||v==6||v==8)
	ans="pon";
	else if(v==3)
	ans="bon";
	else 
	ans="hon";
	
	cout<<ans<<endl;
}

Measured memory_bytes: 3620
import math
a, b, h, m = map(int, input().split())

t_a = 2 * math.pi * 1.0 / 720
t_b = 2 * math.pi * 1.0 / 60

c = math.sqrt(a * a + b * b - 2 * a * b * math.cos(((h * 60 + m) * t_a) - (m * t_b)))
print(c)

Measured memory_bytes: 9452
#include<iostream>
#include<vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp make_pair
#define pin pair<int,int>
pin solve(V<pin>& ab, int ex) {
	if (!ex) { return mkp(1,0); }
	V<V<pin>> qab(2);
  int sz=ab.size();
  qab[0].reserve(sz);
  qab[1].reserve(sz);
	for (pin x : ab) {
		qab[x.second & 1].push_back(mkp(x.first / 2,x.second / 2));
		if (x.first & 1) { qab[(x.second + 1) & 1].push_back(mkp(x.first / 2,(x.second + 1) / 2)); }
	}
	V<vel> c(2, vel(2));
	rep(i, 2) {
		for (pin x : qab[i]) {
			int qc = (2 * x.first + x.second) % 3;
			if ((qc+1)%2) { c[i][0] ^= 1; }
			if (qc) { c[i][1] ^= 1; }
		}
	}
	rep(i, 2) {
		if (!c[1 - i][0]&&!c[1-i][1]) {
			pin ans = solve(qab[i], ex - 1);
			ans.first *= 2; ans.second *= 2; ans.second += i;
			return ans;
		}
	}
	for(pin &v:ab) { v.first++; }
	pin ans = solve(ab, ex); ans.first--;
	return ans;
}
signed main() {
	long long inf = 2e17;
	int n; scanf("%lld", &n);
	V<pin> ab(n);
	rep(i, n) {
		long long a, b; scanf("%lld", &a); scanf("%lld", &b);
		ab[i] = { a + inf,b + inf };
	}
	pin ret = solve(ab, 70);
	cout << ret.first - inf << " " << ret.second - inf << "\n";
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int fact(int n){
    int cnt=0;
    for(int i=1;i<n;i++){
        cnt+=(n-i);
    }
    return cnt;
}
int main()
{
    int n,m;
    cin>>n>>m;
    cout<<fact(n)+fact(m);

}


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

int main(void){
  char a[8];
  if(scanf("%s", a)==1)
  
  if((a[0]==a[1])&&(a[2]==a[3])&&(a[1]!=a[2]))      printf("Yes");
  else if((a[0]==a[2])&&(a[1]==a[3])&&(a[0]!=a[1]))	printf("Yes");
  else if((a[0]==a[3])&&(a[1]==a[2])&&(a[0]!=a[1]))	printf("Yes");
  else printf("No");
}


Measured memory_bytes: 128
/* 
	BURN OUT IS BETTER THAN FADE AWAY 
*/	  
	#include <bits/stdc++.h>
	using namespace std;
		     
	#define ll long long int
	#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
		     
	#define mp make_pair
	#define pb push_back
	#define ld long double
	#define F first
	#define S second
	const ll N =(1e6);  
	const ll mod = (1e9+7);
	
int main(){
	fast;
	int a , b , c;
	cin >> a>> b>> c;
	cout<< max(a+b , max(a-b , a*b));	
}


Measured memory_bytes: 256
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10:
        print("YES")
    else:
        print("NO")



Measured memory_bytes: 5608
#include <stdio.h>

int main()
{
  int x, y, z; //a, b, c
  int tmp;
  
  scanf("%d %d %d", &x, &y, &z);
  
  tmp = x;
  x = y;
  y = tmp;
  
  tmp = x;
  x = z;
  z = tmp;
  
  printf("%d %d %d", x, y, z);
  
  return 0;
}

Measured memory_bytes: 1732
use proconio::input;

macro_rules! chmin {
    ($target: expr , $($other: expr),+) => {
        let min = min!($($other),*);
        if min < $target {
            $target = min;
            true
        } else {
            false
        }
    };
}

macro_rules! min {
    ($a: expr) => {
        $a
    };

    ($a: expr, $b: expr) => {
        std::cmp::min($a, $b)
    };

    ($a: expr, $($remain: expr),+) => {
        std::cmp::min($a,min!($($remain),+))
    };
}

fn main() {
    input! {
        n: usize
    }
    let mut dp: Vec<usize> = vec![1 << 60; n + 1];
    dp[0] = 0;

    for i in 1..=n {
        let mut pow = 1;
        while pow <= i {
            chmin!(dp[i], dp[i - pow] + 1);
            pow *= 6;
        }

        pow = 1;
        while pow <= i {
            chmin!(dp[i], dp[i - pow] + 1);
            pow *= 9;
        }
    }

    println!("{}", dp[n]);
}


Measured memory_bytes: 2776
#include <iostream>
using namespace std;
int main()
{
	int N;
	cin>>N;
	int i;
	int cnt=0;
	int count=0;
	for(i=1;i<=N;i+=2){
		for(int j=1;j<=i;j++){
			if(i%j==0){
				cnt++;
			}
		}
		if(cnt==8){
			count++;
		}
		cnt=0;
	}
	cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
///////////////////////////////////////////
const long long int INF = 100000000000;
const long long int Mod = 1000000007;
using ll = long long int; //long long int は64bit
using vi = vector<int>; using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(long long int i=0;i<N;i++)
#define np nullptr
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define fill(x,num) memset(x,num,sizeof(x));
typedef vector<vector<ll> > matrix;
typedef pair<ll,ll> Pair;
bool p_compare(const Pair& firstP, const Pair& secondP)
 { return firstP.first < secondP.first; }//sort(all(v),p_compare)で昇順ソート
//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////
//Snipet -> Caps Lock

ll n;
vi b;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>n;ll bbb;
	rep(i,n){
		cin>>bbb;
		b.pb(bbb);
	}
	ll size = b.size();
	stack<ll> ans;
	rep(k,size){
		for(ll j=b.size();j>0;j--){
			if (b[j-1]==j) {
				ans.push(j);
				b.erase(b.begin()+j-1);
				j = b.size()+1;
			}
		}
	}
	if(ans.size()==size)while(!ans.empty()){
		cout<<ans.top()<<endl;
		ans.pop();
	}
	else cout<<-1<<endl;
	
	return 0;
}

Measured memory_bytes: 256
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
# n = int(input())
mod = 10 ** 9 + 7
p = mod
a.sort(reverse = True)
# print(a)
ans = 0

#
# def C(n, k):
#     if k == 0:
#         return 1
#     elif n < k or k < 0:
#         return 0
#     else:
#         x,y = 1,1
#         while k > 0:
#             x *= n
#             y *= k
#             n, k = n-1, k-1
#
#         return x * pow(y, mod-2, mod) % mod
#

fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
    fac[i + 1] = fac[i] * (i + 1) % mod


def C(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], p - 2, p) * pow(fac[k], p - 2, p) % p


for i in range(0,n-k+1):
    ans += a[i] * C(n-i-1, k-1)
    ans %= mod

a.reverse()
for i in range(0,n-k+1):
    ans -= a[i] * C(n-i-1, k-1)
    ans %= mod



print(ans)


Measured memory_bytes: 14416
#include <iostream>
#include <map>
#include <vector>
#include <cassert>
#include <unordered_set>
#include <set>
#include <bitset>
#include <memory.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
using namespace std;
 
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
 
const int MOD = (int) 1e9 + 7;
 
int main() {
    // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int n, t;
    cin >> n >> t;
 
    vector<int> a(n), b(n);
    vector<pair<int, int> > q;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        q.push_back({a[i], b[i]});
    }

    sort(all(q));

    for (int i = 0; i < n; ++i) {
        a[i] = q[i].first;
        b[i] = q[i].second;
    }
 
    vector<vector<int> > dp(n + 2, vector<int>(t + 2, (int) -1e9));
    dp[0][0] = 0;
 
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= t; ++j) {
            if (dp[i][j] == (int) -1e9)
                continue;
 
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
 
            if (j != t) {
                dp[i + 1][min(t, j + a[i])] = max(dp[i + 1][min(t, j + a[i])], dp[i][j] + b[i]);
            }
        }
    }
 
    int ans = 0;
    for (int j = 0; j <= t; ++j) {
        ans = max(ans, dp[n][j]);
    }
 
    cout << ans << "\n";
}


Measured memory_bytes: 35584
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;


int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&j : v) scanf("%d", &j);
    if(n&1){
        vector<ll> dp1(n/2+1), dp2(n/2+1);
        for (int i = 0; i < n/2; ++i) {
            dp1[i+1] = dp1[i] + v[2*i];
            dp2[i+1] = max(dp1[i], dp2[i]) + v[2*i+1];
        }
        vector<ll> dq1(n/2+1), dq2(n/2+1);
        for (int i = n/2-1; i >= 0; --i) {
            dq1[i] = max(dq2[i+1], dq1[i+1]) + v[i*2+1];
            dq2[i] = dq2[i+1] + v[i*2+2];
        }
        ll ans = -INF<ll>;
        for (int i = 0; i < n/2; ++i) {
            ans = max({ans,
                       dp1[i]+dq1[i+1]+max(v[2*i], v[2*i+1]),
                       dp1[i]+dq2[i+1]+max({v[2*i], v[2*i+1], v[2*i+2]}),
                       dp2[i]+dq1[i+1]+v[2*i+1],
                       dp2[i]+dq2[i+1]+max({v[2*i+1], v[2*i+2]})
                       });
        }
        cout << ans << "\n";
    }else {
        vector<ll> dp1(n/2+1);
        vector<ll> dp2(n/2+1);
        for (int i = 0; i < n/2; ++i) {
            dp1[i+1] = dp1[i] + v[2*i];
        }
        for (int i = n/2-1; i >= 0; --i) {
            dp2[i] = dp2[i+1] + v[2*i+1];
        }
        ll ans = -INF<ll>;
        for (int i = 0; i < n/2+1; ++i) {
            ans = max(ans, dp1[i]+dp2[i]);
        }
        cout << ans << "\n";
    }
    return 0;
}

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

#define M 1046257
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch) {
  if ( ch == 'A' ) return 1;
  else if ( ch == 'C' ) return 2;
  else if ( ch == 'G' ) return 3;
  else if ( ch == 'T' ) return 4;
  return 0;
}

long long getKey(char str[]) {
  long long sum = 0, p = 1, i;
  for(i=0;i<strlen(str);i++) {
    sum += p*(getChar(str[i]));
    p*= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]) {
  long long key, i, h;
  key = getKey(str); 
  for(i=0; ;i++) {
    h = (h1(key) + i*h2(key)) % M;
    if( strcmp(H[h],str) == 0) return 1;
    else if ( strlen(H[h]) == 0 ) return 0;
  }
  return 0;
}

int insert(char str[]) {
  long long key, i, h;
  key = getKey(str);
  for(i=0; ; i++) {
    h = (h1(key) + i * h2(key)) %M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) {
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(void) {
  int i, n;
  char str[L], com[9];
  for(i=0;i<M;i++) H[i][0] = '\0';
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%s %s",com,str);
    if(com[0] == 'i') {
      insert(str);
    } else {
      if(find(str)){
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 16092
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N,M,K;
ll a,b,c;
string s;
ll x[15][15];
int main(){
    cin>> N>>K;
    for(ll i=0;i<N;i++){
        for(ll j=0;j<K;j++){
            cin>>x[i][j];
        }
    }
    ll ans=0;
    for(ll i=0;i<N;i++){
        for(ll j=i+1;j<N;j++){
            ll tmp=0;
            for(ll k=0;k<K;k++){
                tmp+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            ll t=sqrt(tmp);
            if(t*t==tmp){
                ans++;
            }
        }
    }
    cout<<ans <<endl;
    
    return 0;
}

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

int main(){
  ll n,q;
  string s;
  cin>>n>>q>>s;
  vector<int> k(n+1,0);
  vector<int> w(n+1,0);
  rep(i,n-1){
    if(s[i]=='A'&&s[i+1]=='C'){
      k[i+1]++;
      w[i+2]++;
    }
  }
  rep(i,n-1){
    k[i+2]+=k[i+1];
    w[i+2]+=w[i+1];
  }
  rep(i,q){
    int l,r;
    cin >> l >> r;
    cout << w[r]-w[l] << endl;
  }
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
#define row(f,r) (f[r][0]&&f[r][1]&&f[r][2])
#define col(f,c) (f[0][c]&&f[1][c]&&f[2][c])
int main() {
	int a[3][3];
	bool f[3][3];
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> a[i][j];
			f[i][j] = false;
		}
	}
	int n;
	cin >> n;
	for (int k = 0; k < n; ++k) {
		int b1;
		cin >> b1;
		bool flg1 = true;
		for (int i = 0; i < 3 && flg1; ++i) {
			for (int j = 0; j < 3 && flg1; ++j) {
				if (b1 == a[i][j]) {
					f[i][j] = true;
					flg1 = false;
				}
			}
		}
	}
	if(row(f,0)||row(f,1)||row(f,2)||col(f,0)||col(f,1)||col(f,2)||(f[0][0]&&f[1][1]&&f[2][2])||(f[0][2]&&f[1][1]&&f[2][0])){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()

dp = [[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)]
mem_i = [[0 for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
mem_j = [[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)]

for i in range(1, len(s)+1):
    for j in range(1, len(t)+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i - 1][j - 1] + 1
            mem_i[i][j] = i - 1
            mem_j[i][j] = j - 1
        else:
            dp[i][j] = max(
                dp[i - 1][j],
                dp[i][j-1]
            )

            if dp[i - 1][j] < dp[i][j - 1]:
                mem_i[i][j] = i
                mem_j[i][j] = j - 1
            else:
                mem_i[i][j] = i - 1
                mem_j[i][j] = j

i = len(s)
j = len(t)

result = []
while (i > 0 and j > 0):
    prev_i = mem_i[i][j] 
    prev_j = mem_j[i][j]
    if prev_i == i - 1 and prev_j == j - 1:
        _s = s[prev_i]
        result.append(_s)
    i = prev_i
    j = prev_j

print("".join(result[::-1]))


Measured memory_bytes: 270236
#include <iostream>
using namespace std;
 
int main(void){
        string Taro;
        string Hanako;
        int n;
        cin>>n;
        int taro_score=0;
        int hanako_score=0;
        for(int i=0; i<n; i++) {
                cin>>Taro>>Hanako;
                if(Taro==Hanako) {
                        taro_score+=1;
                        hanako_score+=1;
                }
                else if(Taro<Hanako) {
                        hanako_score+=3;
                }
                else{
                        taro_score+=3;
                }
        }
        cout<<taro_score<<" "<<hanako_score<<endl;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a, b) << " " << max(0, a+b-n) << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
#define MOD 1000000007
#define MAXN 200001
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
using namespace std;

int gcd(ll a,ll b){
    while(a!=0){
        ll temp=b;
        b=a;
        a=temp%a;
        
    }
    return b;
}

int main() {
    ll k;
    cin >> k;
    ll ans=0, temp;
    f(i,1,k+1){
        f(j,1,k+1){
            if(i==j ){
                temp=i;
            }else{
                temp=gcd(i,j);
            }
            
            f(l,1,k+1){
                if(temp>=l && temp%l==0){
                    ans+=l;
                }else if(temp<l && l%temp==0){
                    ans+=temp;
                }else{
                    ans+=gcd(temp,l);
                }
            }
        }
    }
    cout<< ans;
    
    
}

Measured memory_bytes: 3640
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/2/16
Solved on 2019/2/16
@author: shinjisu
"""


# ABC 118
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def dmp(x):
    global debug
    if debug:
        print(x)
    return x


def gcd(x, y):  # 最大公約数
    m = max(x, y)
    n = min(x, y)
    while m % n != 0:
        w = m % n
        m = n
        n = w
    return n


def probC():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    hp = A[N-1]
    for i in range(N-1):
        hp = gcd(hp, A[i])
        dmp(hp)
    return hp


debug = False  # True False
print(probC())


def probD():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    return 123


def probA():
    A, B = getIntList()
    dmp((A, B))
    if B % A == 0:
        return A+B
    else:
        return B-A


def probB():
    N, M = getIntList()
    A = getIntMat(N)
    dmp((N, M))
    dmp(A)
    food = set([])
    food = set(A[0][1:])
    dmp(food)
    for i in range(N):
        food2 = set(A[i][1:])
        food = food & food2
        dmp(food)
    return len(food)




Measured memory_bytes: 14480
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
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 long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	string s;
	cin>>s;
	if (s.find("AC")!=string::npos)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long W = sc.nextLong();
		long H = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();
		sc.close();
		// 結果出力
		System.out.println(
			(double)(W * H) / 2 + " " + 
			((x * 2) == W && (y * 2) == H ? "1" : "0"));
	}
}


Measured memory_bytes: 22736
def main():
	n = int(input())
	# b = int(input())
	a = list(map(int,input().split()))
	# A = [list(map(int, input().split())) for _ in range(n)]
	# print(a)
	ans = 0
	kijun=1
	check = 0

	while check < n:
		# print("check = {}".format(check))
		# print("kijun = {}".format(kijun))
		if a[check] == kijun:
			check += 1
			kijun += 1
			# print("true")
		else:
			check += 1
			ans += 1
		# 	print("false")
		# print("-----")



	# for i in range(1,n+1):
	# 	# print("i = {}".format(i))
	# 	if a[i-1]==kijun:
	# 		kijun += 1
	# 		continue
	# 	else:
	# 		ans += 1
		
	if ans == n:
		print(-1)
	else:
		print(ans)
	




if __name__ == '__main__':
	main()

Measured memory_bytes: 77516
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

int x, y, z,i,k,q;

int main()
{
	scanf("%d%d%d",&x,&y,&z);
	q = y + z;
	k = 0;
	for(i = z;i <= x;i+=q)
		{
			k = k+1;
		}
	k = k-1;
	printf("%d\n", k);
	return 0;
}


Measured memory_bytes: 128
xy = gets.split.map(&:to_i)

ans =0

xy.each {|n|
    if n == 1
        ans += 300000
    elsif n == 2
        ans += 200000
    elsif n == 3
        ans += 100000
    end
}
if xy[0]==1 && xy[1]==1
    ans += 400000
end

p ans




Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var f = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            string ret = "NO";
            if (f[0] + f[1] >= f[2] && f[0] <= f[2])
            {
                ret = "YES";
            }
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 13268
fun main(args: Array<String>) {
    a64(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a64(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val num = args[0].replace(" ", "").toInt()
    println(if (num % 4 == 0) "YES" else "NO")
}

Measured memory_bytes: 38200
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
const ll mod = 1000000007;
const ll INF = 1000000000000000;

ll bit[200010];
ll n;

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= n)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll pow_mod(ll x, ll y)
{
	ll res = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
		{
			(res *= x) %= mod;
		}
		(x *= x) %= mod;
		y /= 2;
	}
	return res;
}

ll div(ll x)
{
	return pow_mod(x, mod - 2);
}



int main(void)
{
	cin >> n;

	ll k, h;
	ll ans = 0;

	cin >> k;

	for (int i = 0; i < n; i++)
	{
		cin >> h;
		if (h >= k)
		{
			ans++;
		}
	}

	cout << ans << endl;

	int www;
	cin >> www;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
main(){
  int N, x;
  x = 0;
  cin >> N;
  vector<int> light(N);
  for(int i=0; i<N; i++){
    cin >> light.at(i);
  }
  for(int i=0; i<N; i++){
    if(light.at(x) == 2){
      cout << i+1 << endl;
      break;
    }
    else if(i == N-1){
      cout << -1 << endl;
    }
    else{
      x = light.at(x)-1;
    }
  }
}

Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int cnt = 0;
		int N = S.Length;
		if(N == 1){
			Console.WriteLine(0);
			return;
		}
		
		cnt = 1;
		for(int i=1;i<N;i++){
			if(S[i] == S[i-1])continue;
			cnt++;
		}
		Console.WriteLine(cnt-1);
		
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 3160
#include<stdio.h>

int main(){
  int A[100], n, i, j, t, sw = 0, mini;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);

  for ( i = 0; i < n; i++ ){
    mini = i;
    for ( j = i; j < n; j++ ){
      if ( A[j] < A[mini] ) mini = j;
    }
    t = A[i]; A[i] = A[mini]; A[mini] = t;
    if ( i != mini ) sw++;
  }

  for ( i = 0; i < n; i++ ){
    if (i) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);

  return 0;
}

Measured memory_bytes: 1032
a, b = map(int, (input().split()))

if(a == b):
    print("Draw")
elif(a == 1 and b == 13):
    print("Alice")
elif(b == 1 and a == 13):
    print("Bob")
elif(a > b):
    print("Alice")
elif(a < b):
    print("Bob")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
int main(void)
{
	long long n,i,a,b,c,x;
	scanf("%lld",&n);
	a=1; b=1; c=1;
	while(1){
		a=(a*10)%M;
		b=(b*9)%M;
		c=(c*8)%M;
		n--;
		x=((a+M+M)-(b+b-c))%M;
		if(n==0) break;
	}
	printf("%lld\n",x);
	return 0;
}

Measured memory_bytes: 3832
module E;

import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int h, n;
  readf("%s %s\n", &h, &n);
  auto ab = new int[][](n, 2);
  auto vi = new int[](h+1);
  vi[] = int.max;
  vi[h] = 0;
  foreach (i; 0..n) {
    ab[i] = readln.chomp.split.to!(int[]);
  }
  sort(ab);

  foreach_reverse(j; 1..h+1) {
    if (vi[j] == int.max) continue;
    foreach (i; 0..n) {
      auto d = max(j - ab[i][0], 0);
      auto pd = j;
      while (d != 0) {
        if (vi[d] > vi[pd] + ab[i][1]) {
          vi[d] = vi[pd] + ab[i][1];
          pd = d;
          d = max(j - ab[i][0], 0);
        } else {
          break;
        }
      }
      if (vi[d] > vi[pd] + ab[i][1]) {
        vi[d] = vi[pd] + ab[i][1];
      }
    }
  }
  
  vi[0].writeln;
}


Measured memory_bytes: 2556
def main(): 
    h,w,m = map(int,input().split())
    X = [0]*w
    Y = [0]*h
    g = set([])
    for _ in range(m):
        a,b = map(int,input().split())
        a-=1
        b-=1
        X[b]+=1
        Y[a]+=1
        g.add((a,b))
    
    xmax = max(X)
    ymax = max(Y)

    xlist = []
    for i,x in enumerate(X):
        if x==xmax:
            xlist.append(i)
    ylist = []
    for i,y in enumerate(Y):
        if y==ymax:
            ylist.append(i)
    
    ans = xmax+ymax
    flag = True
    for x in xlist:
        for y in ylist:
            if (y,x) not in g:
                flag = False
                break
        if not flag:
            break
    
    if flag:
        ans-=1
    print(ans)
main()

Measured memory_bytes: 176652
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 200000;
int main()
{
    int n;
    while(cin>>n)
    {
        int maxv=-2000000000;
        int tmp, minv;
        cin>>tmp;
        minv=tmp;
        for(int i=0;i<n-1;i++)
        {
            cin>>tmp;
            maxv = max(maxv,(tmp-minv));
            minv = min(minv,tmp);
        }
        cout<<maxv<<endl;
    }
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>

using namespace std;

int main(){
    int x, y, Max;
    cin >> x >> y;
    Max = x * y;
    if(Max < (x+y))
        Max = x+y;
    if(Max < (x-y))
        Max = x-y;
    
    cout << Max <<endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();

        if(B%A==0){
            System.out.println(A+B);
        }else{
            System.out.println(B-A);
        }
    }
}

Measured memory_bytes: 21716
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int a[202020], b[202020];
int za[202020], zb[202020];
int p[202020];
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num; i++)scanf("%d", &a[i]), za[i] = a[i];
	for (int i = 0; i < num; i++)scanf("%d", &b[i]), zb[i] = b[i];
	sort(za, za + num), sort(zb, zb + num);
	for (int i = 0; i < num; i++)if (za[i] > zb[i])goto l01;
	for (int i = 1; i < num; i++)if (za[i] <= zb[i - 1])goto l02;
	for (int i = 0; i < num; i++)a[i] = lower_bound(za, za + num, a[i]) - za;
	for (int i = 0; i < num; i++)b[i] = lower_bound(zb, zb + num, b[i]) - zb, p[a[i]] = b[i];
	for (int i = 0; i < num; i++)
	{
		int now = i;
		int c = 0;
		for (;;)
		{
			now = p[now];
			c++;
			if (now == i)break;
		}
		if (c == num)goto l01;
		else goto l02;
	}
l02:;
	printf("Yes\n");
	return 0;
l01:;
	printf("No\n");
}

Measured memory_bytes: 2680
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func solve(n int64, as []int64) []int64 {
	t := int64(0)
	for _, a := range as {
		t = t ^ a
	}
	rs := make([]int64, n)
	for i, a := range as {
		rs[i] = a ^ t
	}
	return rs
}

func main() {
	defer out.Flush()

	n := nextInt()
	as := nextInts(n)
	res := solve(n, as)
	for i, r := range res {
		if i != 0 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, r)
	}
	fmt.Fprintln(out)
}

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

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

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

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

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 8876
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();
		String msg=sc.next();
		
		for(int i=0;i<3;i++) {
			if(msg.charAt(i)==msg.charAt(i+1)) {
				System.out.println("Bad");
				return;
			}
		}
		System.out.println("Good");
		
	}
		
}

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;
		} 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: 21332
N, D = gets.split().map(&:to_i)
ans = 0
retu = []

(1..N).each do |cnt|
  #retu.pushで配列の末尾に追加
  retu.push(gets.split().map(&:to_i))
  #retu.lastで配列の最後をとる
  hantei = Math.sqrt(retu.last[0] ** 2 + retu.last[1] ** 2)
  if hantei <= D
    ans += 1
  end
end
puts ans


Measured memory_bytes: 28804
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << "\n"; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve(){
  int h,a;
  cin>>h>>a;
  cout<<(h+a-1)/a<<endl;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var src, dest string
	fmt.Scan(&src, &dest)
	len := len(src)

	ans := "No"
	for i := 0; i < len; i++ {
		last := src[len-1:]
		src = last + src[:len-1]
		if src == dest {
			ans = "Yes"
			break
		}
	}
	fmt.Println(ans)
}


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

int main() {
  int i, j, k, N; cin >> N;
  string s, t;
  vector<int> p(N);
  rep (i, N) cin >> p.at(i);
  int num = 0;
  int min = INF;
  rep (i, N) {
    if (p.at(i) < min) {
      num ++;
      min = p.at(i);
    }
  }
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
using namespace std;
int a[191919], b[191919];
signed main() {
	int n, m, cnt = 0, cnta = 0;
	cin >> n >> m;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int j = 0; j < m; j++)cin >> b[j];
	for (int i = 0; i < n; i++) {
		cnt += a[i];
	}
	for (int j = 0; j < m; j++) {
		cnta += b[j];
	}
	cout << cnt * cnta << endl;
}


Measured memory_bytes: 4688