akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 1e2 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;


ll dp[MAXN][100010];
ll w[MAXN], v[MAXN];

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	memset(dp, 31 , sizeof dp);
	ll n, W;
	cin >> n >> W;
	for(int i = 1;i<=n;i++) cin >> w[i] >> v[i];
	
	dp[0][0] = 0;
	for(int i = 1;i<=n;i++){
		for(int j = 0;j < 100010;j++){
			dp[i][j] = dp[i-1][j];
			if(j >= v[i]){
				dp[i][j] = min(dp[i][j], dp[i-1][j-v[i]] + w[i]);
			}
		}
	}
	
	ll ans = 0;
	for(int i = 0;i< 100010; i++) if(dp[n][i] <= W) ans = max(ans, (ll) i);
	cout << ans;
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 86272
x, y, z, k = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

ans = []
for i in A:
    for j in B:
        ans.append(i+j)
ans.sort(reverse=True)
ans = ans[:k]
ans1 = []
for i in C:
    for j in ans:
        ans1.append(i+j)
ans1.sort(reverse=True)
for i in range(k):
    print(ans1[i])


Measured memory_bytes: 160764
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#include <iomanip>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

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

//逆元を求める関数
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;
}

void solve() {
	double w; cin >> w;
	double h; cin >> h;
	int x; cin >> x;
	int y; cin >> y;
	cout << fixed << setprecision(9) << (w * h) / 2.0 << " ";
	if (((int)w % 2 == 0 && (int)h % 2 == 0) && ((int)x == (w / 2) && (int)y == (h / 2))) {
		cout << 1 << endl;
	} else {
		cout << 0 << endl;
	}
    return;
}

int main() {
    solve();
    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);
		int X = sc.nextInt();
		int A = sc.nextInt();
		if (X<A) {
			System.out.println(0);
		} else {
			System.out.println(10);
		}
	}

}

Measured memory_bytes: 21844
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int h,w ;
	cin >> h >> w ;
	vvc g(h+2,vc(w+2,'.')) ;
	vvb ok(h+2,vb(w+2,true)) ;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin >> g.at(i).at(j) ;
			if(g.at(i).at(j)=='#'){
				ok.at(i).at(j) = false ;
			}
		}
	}
	int posi,posj ;
	posi = posj = 1 ;
	while(1){
		ok.at(posi).at(posj) = true ;
		if(ok.at(posi+1).at(posj)&&ok.at(posi).at(posj+1)) break ;
		if(!ok.at(posi).at(posj+1)){
			posj++ ;
		}else{
			posi++ ;
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(!ok.at(i).at(j)){
				cout << "Impossible" << endl ;
				return 0 ;
			}
		}
	}
	cout << "Possible" << endl ;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
int main() {
  int d, g;
  cin >> d >> g;
  g /= 100;
  vector<int> p(d), c(d);
  for (int i = 0; i < d; i++) {
    cin >> p[i] >> c[i];
    c[i] /= 100;
  }
  int ans = 1e9;
  for (int i = 0; i < 1 << d; i++) {
    int cnt = 0;
    int score = 0;
    for (int j = 0; j < d; j++) {
      if (i >> j & 1) {
        cnt += p[j];
        score += p[j] * (j + 1);
        score += c[j];
      }
    }
    for (int j = d - 1; j >= 0; j--) {
      if (~i >> j & 1) {
        for (int k = 0; k < p[j] && score < g; k++) {
          score += j + 1;
          cnt++;
        }
      }
    }
    if (score >= g) {
      ans = min(ans, cnt);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int main(){
	int i=0,j,x;
	char str[1001];		
	while(1)
	{
		gets(str);
		if(atoi(str)==0){break;}
		for(i=0;i<strlen(str);i++){
			x+=str[i]-'0';
		}
		printf("%d\n",x);x=0;
	}
	return 0;
}

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

int main(){
    int n;
    scanf(" %d",&n);
    int ans[n+1];
    memset(ans,0,sizeof(ans));
    for(int i = 0; i < n-1;++i){
        int va; scanf(" %d",&va);
        ++ans[va];
    }
    for(int i = 1; i <= n;++i) printf("%d\n",ans[i]);
    return 0;
}


Measured memory_bytes: 4616
#include <algorithm>
#include <iostream>
#include <vector>
#include <limits>
using namespace std;

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

vector<vector<int>> decompose_to_loops(const vector<int>& P) {
    vector<vector<int>> ret;
    vector<bool> visited(P.size());

    REP(s, P.size()) {
        if (visited[s]) { continue; }

        vector<int> loop;
        int v = s;
        do {
            loop.push_back(v);
            visited[v] = true;
            v = P[v];
        } while (v != s);
        ret.emplace_back(move(loop));
    }

    return ret;
}

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

    int N; cin >> N;
    int64_t K; cin >> K;
    vector<int> P(N);
    REP(i, N) {
        cin >> P[i];
        --P[i];
    }
    vector<int64_t> C(N);
    REP(i, N) {
        cin >> C[i];
    }

    int64_t max_sum = numeric_limits<int64_t>::min();

    for (const auto& loop : decompose_to_loops(P)) {
        int64_t loop_size = loop.size();

        vector<int64_t> cumsum(loop_size+1);
        REP(i, cumsum.size()) {
            cumsum[i] = (i == 0) ? 0 : cumsum[i-1] + C[loop[i-1]];
        }

        for (int64_t k = 0; k < min(K, loop_size); ++k) {
            int64_t bonus = max<int64_t>(0, ((K-k-1) / loop_size) * cumsum[loop_size]);

            REP(s, loop_size) {
                int64_t sum;
                if (s + k < loop_size) {
                    sum = cumsum[s+k+1] - cumsum[s];
                } else {
                    sum = cumsum[loop_size] - cumsum[s] + cumsum[s+k+1-loop_size];
                }
                max_sum = max(max_sum, sum + bonus);
            }
        }
    }

    cout << max_sum << '\n';
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n, m;
    cin >> n>> m;
    vector<vector<int>> g(n);
    for(int i=0;i<m;i++)
    {
        int u, v;
        cin >> u >> v;
        u--,v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    priority_queue<int> q;
    vector<int> a;
    vector<int> vis(n,0);
    for(int i=0;i<n;i++)
    {
        if(vis[i] == 0)
        {
            q.push(i);
            vis[i]  = 1;
            while(!q.empty())
            {
                int x = q.top();
                q.pop();
                a.push_back(x);
                for(auto j:g[x])
                if(vis[j] == 0)
                {
                    vis[j] = 1;
                    q.push(j);
                }
            }
            a.push_back(-1);
        }
    }
    int ans = 0;
    for(auto i:a)if(i==-1)ans++;
    cout << max(ans-1,0) << endl;


}


Measured memory_bytes: 9544
use std::io::*;
use std::str::FromStr;

fn main() {
	let a: i32 = read();
	let b: i32 = read();
	let c: i32 = read();
	if (a == b)&&(b == c) {
		println!("No");
	} else if (a == b)||(b == c)||(c == a) {
		println!("Yes");
	} else {
		println!("No");
	}
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}



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

using namespace std;


int main() {
	int W, H;
	char c[105][105];
	cin >> H >> W;
	for (int i = 0; i < H; i++)
		cin >> c[i];

	for (int i = 0; i < H; i++) {
		cout << c[i] << endl;
		cout << c[i]<< endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0) break;
			int sum = 0;
			int squareSum = 0;
			for (int i = 0; i < n; ++i) {
				int s = sc.nextInt();
				sum += s;
				squareSum += s * s;
			}
			double avg = (double)sum / n;
			double squareAvg = (double)squareSum / n;
			// v(x) = avg(x ^ 2) - avg(x) ^ 2;
			double variance = squareAvg - avg * avg;
			double stdev = Math.sqrt(variance);
			System.out.println(stdev);
		}
	}
}


Measured memory_bytes: 31196
import sys

S=sys.stdin.readline()
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])

for i in range(8):
  candidate=A
  opeList=[]
  if i & (1 << 2) != 0:
    candidate = candidate+B
    opeList.append("+")
  else:
    candidate = candidate-B
    opeList.append("-")
  
  if i & (1 << 1) != 0:
    candidate = candidate+C
    opeList.append("+")
  else:
    candidate = candidate-C
    opeList.append("-")
    
  if i & 1 != 0:
    candidate = candidate+D
    opeList.append("+")
  else:
    candidate = candidate-D
    opeList.append("-")
    
  if candidate == 7:
    print(str(A)+opeList[0]+str(B)+opeList[1]+str(C)+opeList[2]+str(D)+"=7")
    break

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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int src,dst,weight;
	Edge(){};
	Edge(int s,int d,int w):src(s),dst(d),weight(w){}
};
typedef vector<vector<Edge>> Graph;

pii DFS(const Graph& g,int u,int p)
{
	pii res(0,u);
	for(Edge e:g[u]) if(e.dst!=p){
		pii t=DFS(g,e.dst,e.src);
		t.first+=e.weight;
		if(res.first<t.first) res=t;
	}
	return res;
}

int Diameter(const Graph& g)
{
	int u,v,w;
	tie(w,u)=DFS(g,0,-1);
	tie(w,v)=DFS(g,u,-1);
	return w;
}

int main()
{
	for(int n;cin>>n && n;){
		Graph g(n);
		rep(i,n-1){
			int u,v,w; cin>>u>>v>>w;
			g[u].emplace_back(u,v,w);
			g[v].emplace_back(v,u,w);
		}
		cout<<Diameter(g)<<endl;
	}
}

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

int main() {

  long long int n, x;
  cin >> n >> x;

  long long int ans = 1;
  long long int cnt = 0;

  for ( long long int i = 0; i < n; i++ ) {
    long long int in;
    cin >> in;
    cnt += in;
    if ( cnt <= x ) ans++;
  }

  cout << ans << endl;

  return 0;

}


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

int main()
{
	long long x, y;
	cin >> x >> y;
	long long tmp = y, wyn = 1;
	while (tmp >= x)
	{
		tmp /= 2;
		if (tmp >= x) ++wyn;
	}
	cout << wyn;
}


Measured memory_bytes: 256
let rec read_int_list len =
	if len <= 0 then []
	else begin
		let n = read_int () in
		n :: read_int_list (len - 1)
	end

let solve max_passengers max_wait_time arrival_times =
	let remove_passengers start_time times =
		let rec loop passenger_count times =
			match times with
			| [] -> []
			| t :: ts ->
				if (passenger_count < max_passengers) && (t <= start_time + max_wait_time) then
					loop (passenger_count + 1) ts
				else
					t :: ts
		in
		loop 0 times
	in
	let rec count_buses acc times = 
		match times with
		| [] -> acc
		| t :: _ ->
			remove_passengers t times
			|> count_buses (acc + 1)
	in
	count_buses 0 (List.sort compare arrival_times)

let () =
	let [n; c; k] =
		read_line ()
		|> Str.split (Str.regexp " ")
		|> List.map int_of_string
	in
	let t = read_int_list n in
	solve c k t
	|> print_int
	|> print_newline


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> T(N + 1, 0), X(N + 1, 0), Y(N + 1, 0);
  for (int i = 1; i <= N; i++)
    cin >> T[i] >> X[i] >> Y[i];
  for (int i = 1; i <= N; i++) {
    int dt = T[i] - T[i - 1];
    int dx = abs(X[i] - X[i - 1]);
    int dy = abs(Y[i] - Y[i - 1]);
    if (dx + dy > dt || abs(dt - (dx + dy)) % 2 != 0) {
      cout << "No" << '\n';
      return 0;
    }
  }
  cout << "Yes" << '\n';
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#include<vector>
#define pb push_back
#include<iomanip>
int main(){
  int N;
  cin >> N;
  double sum=0;
  
  rep(i,0,N){
    double temp;
    cin >> temp;
    sum += 1./temp;
  }
  
  cout << setprecision(15) << 1./sum << endl;
}


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

const int MAX_N = 1e5+2;
int N;
int a[MAX_N];

void solve()
{
	multiset<int, greater<int>> seen;
	for(int i=0;i<N;++i){
		auto it = seen.upper_bound(a[i]);
		if(it == seen.end()){
			seen.insert(a[i]);
		}else{
			seen.erase(it);
			seen.insert(a[i]);
		}
	}
	cout << seen.size() << '\n';
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i)cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 8572
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[allow(unused_macros)]
macro_rules ! vec_md { ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) } ; ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] } ; ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] } ; }

fn main() {
    input! {
        n: usize,
        a: [i64;n]
    }

    let mut dp = vec_md![None;n+1;n+1];
    println!("{}", rec(&mut dp, &a, 0, n));
}

fn rec(dp: &mut Vec<Vec<Option<i64>>>, a: &[i64], l: usize, r: usize) -> i64 {
    if let Some(src) = dp[l][r] {
        return src;
    }
    if l == r {
        return 0;
    }
    
    let ret = if a.len() % 2 == (r - l) % 2 {
        std::cmp::max(rec(dp,a,l+1,r) + a[l], rec(dp,a,l,r-1) + a[r-1])
    } else {
        std::cmp::min(rec(dp,a,l+1,r) - a[l], rec(dp,a,l,r-1) - a[r-1])
    };
    dp[l][r] = Some(ret);
    ret
}

Measured memory_bytes: 166396
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
using namespace std;

#define ll long long

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
ll MIN(ll a, ll b) {

	if (a < b)return a;
	else return b;

}

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a < b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return a / gcd(a, b)*b;

}
//最小公倍数

int main() {

	ll a, b, sum = 0;
	cin >> a >> b;
	for (int i = 1;i < b - a; i++) {

		sum += i;

	}
	cout << sum - a << endl;

	return 0;
}

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

using ll = long long;
const ll amari = 1e9+7;
#define ben(a) a.begin(),a.end()

int main(){
	string s;
	cin >> s;
	for(int i = 1; i <= 7; i++){
		string b = s.substr(0, i);
		string pb = s.substr(s.size() - (7 - i), 7 - i);
		string ok = b + pb;
		if(ok == "keyence"){
			cout << "YES" << endl;
			return 0;
		}
	}
 
	cout << "NO" << endl;
	return 0;
}

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

using namespace std;

typedef long long          	ll;
typedef long long unsigned 	llu;
typedef double             	dl;
typedef pair<int,int>      	pii;
typedef pair<ll,ll>     	pll;
typedef vector<int>        	vi;
typedef vector<ll>        	vl;
typedef map<int,int> 		mii;
typedef map<ll,ll>         	mll;
typedef map<string,int>    	msi;
typedef map<char,int>      	mci;
typedef pair<int ,pii>      piii;
typedef vector<pii>         vpii;
typedef vector<piii>        vpiii;

#define pi                  acos(-1.0)
#define S                   second
#define F                   first
#define pb                  push_back
#define MP                  make_pair
#define mem(a,b)            memset(a,b,sizeof a)
#define all(v)              v.begin(),v.end()
#define vsort(v)            sort(v.begin(),v.end())
#define IO                  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define gcd(a,b)            __gcd(a,b)

#define I(a)                scanf("%d",&a)
#define I2(a,b)             scanf("%d%d",&a,&b)
#define L(a)                scanf("%lld",&a)
#define L2(a,b)             scanf("%lld%lld",&a,&b)
#define D(a)                scanf("%lf",&a)

#define SP                  cout<<" ";
#define PI(a)               printf("%d",a)
#define PL(a)               printf("%lld",a)
#define PD(a)               printf("%lf",a)
#define CHK                 cout<<"MK"<<endl

template <class T> inline T BMOD(T p,T e,T m){T ret=1;while(e){if(e&1) ret=(ret*p)%m;p=(p*p)%m;e>>=1;}return (T)ret;}
template <class T> inline T MODINV(T a,T m){return BMOD(a,m-2,m);}
template <class T> inline T isPrime(T a){for(T i=2;i<=sqrt(double(a));i++){if(a%i==0){return 0;}}return 1;}
template <class T> inline T lcm(T a, T b){return (a/gcd(a,b))*b;}
template <class T> inline T power(T a, T b){return (b==0)?1:a*power(a,b-1);}
template <class T> inline string to_str(T t) { stringstream ss; ss<<t; return ss.str();}
template <class T> inline long long toLong(T t) {stringstream ss;ss<<t;long long ret;ss>>ret;return ret;}
template <class T> inline int toInt(T t) {stringstream ss;ss<<t;int ret;ss>>ret;return ret;}

//~ cout << fixed << setprecision(20) << Ans << endl;
//~ priority_queue<piii,vpiii, greater<piii> >pq; //for dijkstra
/*                 _                      */
/*____________|\/||_||\||_________________*/



string buffer;
int INT(){
	getline(cin,buffer);
	return toInt(buffer);
}
int LONG(){
	getline(cin,buffer);
	return toLong(buffer);
}

#define MX 150010
const ll MD = 1e9+7;


int main()
{
    IO;
//    freopen("input.txt","r",stdin);
int a,b;
    cin>>a>>b;
    a+=b;
    cout<<a%24<<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)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

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

    ll n;
    cin >> n;

    string ans;

    while(n > 0){
        int x = n % 26;
        if(x == 0){
            ans.push_back('z');
        }else{
            ans.push_back('a'+x-1);
        }
        n = (n-1) / 26;
    }

    reverse(all(ans));

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
    int i,j,k,l,n,m,t,df,v;
    while(scanf("%d %d",&n,&m)!=EOF)
    {
        printf("%d\n",(n-1)*(m-1));
    }
    return 0;
}



Measured memory_bytes: 128
n = int(input())
s = set()       #市名種類
a = []          #インプットリスト
b = dict()          #市別処理
c = []          #結果

for i in range(n):
    t = list(input().split())
    t[1] = int(t[1])
    t.append(i+1)
    a.append(t)
    s.add(t[0])

s = list(s)
s.sort()

for j in range(len(s)):
    b = dict()
    for k in range(n):
        if a[k][0] == s[j]:
            b[a[k][2]] = a[k][1]
    x = sorted(b.items(),key=lambda x:x[1],reverse=True)
    for l in range(len(x)):
        c.append(x[l][0])

for m in range(len(c)):
    print(c[m])

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

#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int h, w, m; cin >> h >> w >> m;
    vector <map <int, bool> > cy(h + 1);
    vi sx(h + 1), sy(w + 1);
    FOR(i, 1, m) {
        int x, y; cin >> x >> y;
        cy[x][y] = 1, sx[x]++, sy[y]++;
    }
    priority_queue <pii> pq;
    FOR(i, 1, w)
        pq.push({sy[i], i});
    int ans = 0;
    FOR(i, 1, h) {
        if (sx[i]) {
            vpii rm;
            int tmx = 0;
            while (!pq.empty() && cy[i][pq.top().se]) {
                tmx = max(tmx, pq.top().fi - 1);
                rm.pb(pq.top()); pq.pop();
            }
            if (!pq.empty()) tmx = max(tmx, pq.top().fi);
            ans = max(ans, sx[i] + tmx);
            for (pii j : rm) pq.push(j);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 50048
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
 
int main(){
  int n,m;
  ll ac=0;
  cin >> n >> m;
  vector<bool>aorw(n,false);
  map<ll,ll>mp;
  rep(i,m){
    ll toi;
    string s;
    cin >> toi >> s;
    toi--;
    if(s=="AC"){
      if(aorw[toi]==false){
        ac++;
        aorw[toi]=true;
      }
    }
    else{
      if(aorw[toi]==false) mp[toi]++;
    }
  }
  ll pen=0;
  for(auto p:mp){
    if(aorw[p.first])pen+=p.second;
  }
  cout << ac << " " <<pen << endl;
  return 0;
}


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

int main() {
    int i;
    int ans = 0;
    char str[101];
    char first[51], last[51];

    scanf("%s", &str);
    for (i = 0; i < strlen(str)/2; i++) {
        first[i] = str[i];
        last[i] = str[strlen(str) - (i + 1)];
    }
    
    for (i = 0; i < strlen(str)/2; i++) if (first[i] != last[i]) ans++;
    printf("%d\n", ans);

   return 0;
}

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

if a <= b:
    if a < k:
        print(-1)
    else:
        print(1)
else:
    if a > k:
        print(1)
    else:
        answer = ((k - b - 1) // (a - b) * 2) + 1
        print(answer)


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main() {
  int h, a;
  cin >> h >> a;

  int ans;
  if (h % a == 0) {
  	ans = h / a;
  } else {
  	ans = h / a + 1;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> // Ishaan Gupta
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cout << *x, 0);
sim > char dud(...);
struct debug {
#ifdef IG_PC
~debug() { cout << endl; }
eni(!=) cout << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define endl '\n'
#define pb push_back
using ll = long long;
using ld = long double;
const ll MOD = 1e9l + 7;
const ll INF = 1e18l + 5;
inline ll add(ll a,ll b){return (a%MOD+b%MOD)%MOD;}
inline ll sub(ll a,ll b){return (a%MOD-b%MOD+MOD)%MOD;}
inline ll mult(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll power(ll a,ll b){a%=MOD;ll r=1;while(b){if(b&1)r=mult(r,a);a=mult(a,a);b>>=1;}return r;}

ll dp[3005][3005];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
#ifdef IG_PC
    freopen("input", "r", stdin);
    freopen("output", "w", stdout);
#endif
    ll n;
    cin >> n;
    vector<ll>a(n);
    for(ll &i : a)
        cin >> i;
    for(ll l = n-1;l >=0; --l)
    {
        for(ll r = l; r < n; r++)
        {
            if(l==r)
            {
                dp[l][r] = a[l];
            }
            else
            {
                dp[l][r] = max(a[l] - dp[l+1][r], a[r] - dp[l][r-1]);
            }
        }
    }
    cout<< dp[0][n-1];

    return 0;
}

Measured memory_bytes: 70016
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    vi v(n);
    rep(i, n) rep(j, 5) {
      int x;
      cin >> x;
      v[i] += x;
    }
    auto p = minmax_element(all(v));
    cout << *p.second << ' ' << *p.first << endl;
  }
}

Measured memory_bytes: 2960
MOD = 1000000007

dp=[0 for _ in range(100001)]
dp[0]=1

for i in range(1, 100001):
    dp[i] = dp[i-1]*i%MOD


N, M = list(map(int, input().split(" ")))

if abs(N - M) > 1:
    print("%d"%(0))
elif (N - M) == 0:
    print ("%d"%(2*((dp[N])*(dp[M]))%MOD))
else :
    print ("%d"%(((dp[N])*(dp[M]))%MOD))

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define pb push_back

const long long MOD = 1000000007;
const long long INF = 1LL<<60;


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(12);

    ll n;
    cin >> n;
    ll a[n];
    rep(i, n){
        cin >> a[i];
    }
    ll b[n+1];
    b[0] = 0;
    rep(i, n){
        b[i+1] = b[i]+a[i];
    }
//    rep(i, n+1){
//        cerr << b[i] << ' ';
//    }
    ll mm = INF;
    rep(i, n){
//        cerr << b[i] << ' ' << b[n]-b[i] << endl;
        mm = min(mm, abs(b[n]-b[i]-b[i]));
    }

    cout << mm << endl;

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int N;cin>>N;
	long A[N];
	rep(i,0,N) cin>>A[i];
	sort(A,A+N);
	if(N % 2 == 0){
		long res = 0;
		rep(i,0,N/2) res -= A[i];
		rep(i,N/2,N) res += A[i];
		cout<<2 * res - A[N/2] + A[N/2-1]<<endl;
	}else{
		long res = 0;
		rep(i,0,N/2-1) res -= A[i];
		rep(i,N/2+1,N) res += A[i];
		long ans = 2 * res - A[N/2] - A[N/2-1];
		res = 0;
		rep(i,0,N/2) res -= A[i];
		rep(i,N/2+2,N) res += A[i];
		ans = max(ans, 2 * res + A[N/2] + A[N/2+1]);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1024
S=list(input())
S=set(S)
A={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'\
    ,'q','r','s','t','u','v','w','x','y','z'}
B=list(A-S)
B.sort()
if len(B)>0:
    print(B[0])
else:
    print('None')

Measured memory_bytes: 3956
package main

import "fmt"

func main() {
	// Code for E - Double Factorial
	var N int
	fmt.Scan(&N)

	var ans int
	var temp int = 10
	if N%2 == 0 {
		for {
			if temp > N {
				break
			}
			ans += N / temp
			temp *= 5
		}
		fmt.Println(ans)
	} else {
		fmt.Println("0")
	}
}


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

int w,h,n,ans;
int tx,ty,x,y;

int main(){
	scanf("%d%d%d", &w, &h, &n);
	for(int i = 0; i < n; i++){
		scanf("%d%d", &x, &y);
		if(i != 0){
			if((tx>x&&ty>y)||tx<x&&ty<y) ans += max(abs(tx-x),abs(ty-y));
			else ans += abs(tx-x)+abs(ty-y);
		}
		tx = x; ty = y;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 1024
#include <atcoder/all>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;
using namespace atcoder;

#include<functional>
template< typename Monoid >
struct SegmentTree {
    using F = function< Monoid(Monoid, Monoid) >;

    int sz;
    vector< Monoid > seg;

    const F f;
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x) {
    seg[k + sz] = x;
    }

    void build() {
    for(int k = sz - 1; k > 0; k--) {
        seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
    }

    void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
        seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
    }

    Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
        if(a & 1) L = f(L, seg[a++]);
        if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
    }

    Monoid operator[](const int &k) const {
    return seg[k + sz];
    }

    template< typename C >
    int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
        Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
        if(check(nxt)) a = 2 * a + type;
        else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
    }


    template< typename C >
    int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
        if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
        return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
        if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
        }
    }
    return -1;
    }

    template< typename C >
    int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
        if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
        return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
        if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
        }
    }
    return -1;
    }
};


int main(void) {
    int N, K;
    cin >> N >> K;
    SegmentTree<int> seg(700000, [](int a, int b) {return max(a, b);}, numeric_limits<int>::min());
    for(int i=0; i<700000; i++) {
        seg.update(i, 0);
    }

    int ans = 0;
    for(int i=0; i<N; i++) {
        int A;
        cin >> A;
        A += 350000;
        ans = max(ans, seg.query(A-K, A+K+1) + 1);
        seg.update(A, seg.query(A-K, A+K+1) + 1);
    }

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


Measured memory_bytes: 11416
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define Endl endl

int V,E;
const int maxN = 114514;
queue<int> Q;
vector<int> G[maxN];
int H[maxN]={};
vector<int> topological(int s[],int t[]){
    vector<int> L;
    for(int i=0;i<E;i++){
        G[s[i]].push_back(t[i]);
        H[t[i]]++;
    }
    for(int i=0;i<V;i++){
        if(H[i]==0){
            Q.push(i);
        }
    }
    while(!Q.empty()){
        int u=Q.front();Q.pop();
        int v=G[u].size();
        L.push_back(u);
        for(int i=0;i<v;i++){
            H[G[u][i]]--;
            if(H[G[u][i]]==0){
                Q.push(G[u][i]);
            }
        }
    }
    return L;
}

signed main(void){
    int x[114514],y[114514];
    cin >> V >> E;
    REP(i,E){
        cin >> x[i] >> y[i];
        x[i]--;y[i]--;
    }
    vector<int> R=topological(x,y);
    int dp[114514]={};
    REP(i,V-1){
        REP(j,(G[R[i]].size())){
            dp[G[R[i]][j]]=max(dp[G[R[i]][j]],dp[R[i]]+1);
        }
    }
    int Ans=0;
    REP(i,V){
        Ans=max(Ans,dp[i]);
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 10488
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}

object Main {
  val MOD = 1000000007
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()

    def countTwoFactors(n: Int): Int = {
      if (n % 2 == 1) 0
      else countTwoFactors(n >> 1) + 1
    }

    val ans =  ((0 until N) map { _ =>
      val a = sc.nextInt()
      countTwoFactors(a)
    }).sum

    println(ans)
  }


  def main(args: Array[String]): Unit = {
    solve()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


Measured memory_bytes: 32224
import math

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    a = list(mi())
    t = a[0]
    for i in range(N-1):
        t ^= a[i+1]

    l = [t^a[i] for i in range(N)]
    print(' '.join(list(map(str, l))))
    


if __name__ == '__main__':
    main()

Measured memory_bytes: 106916
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt();
		int B = s.nextInt();
		String str = s.next();

		if (str.matches("[0-9]" + "{" + A + "}-[0-9]{" + B + "}")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

#define FAST ios_base:: sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ff first
#define ss second
#define mp make_pair
#define FOR(i,a,b) for(ll i=a; i<b ; i++)

typedef long long ll;

int main(){
	FAST;
	ll H,W,h,w;
	cin >> H >> W >> h >> w;
	cout << (H-h)*(W-w);

}




Measured memory_bytes: 256
from functools import lru_cache


@lru_cache(maxsize=None)
def f(x):
    if x == 0:
        return 0
    return f(x % bin(x).count('1')) + 1


n = int(input())
x = input()
d = x.count('1')
y = int(x, base=2)
y0 = y % (d + 1)
y1 = y % (d - 1) if d > 1 else 0
buf = []

for i in range(n):
    if x[i] == '0':
        m = d + 1
        z = (y0 + pow(2, n - i - 1, m)) % m
        # print(0, y0, pow(2, n - i - 1, m))
    else:
        m = d - 1
        if m == 0:
            buf.append(0)
            continue
        z = (y1 - pow(2, n - i - 1, m)) % m
        # print(1, y1, pow(2, n - i - 1, m))
    # print(i, z)
    buf.append(f(z) + 1)

print('\n'.join(map(str, buf)))


Measured memory_bytes: 27440
# -*- coding: utf-8 -*-


def solve():
    w = int(input())
    n = int(input())
    l = [i for i in range(1, w+1)]

    for _ in range(n):
        a, b = map(int, input().split(','))
        a -= 1
        b -= 1
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

solve()

Measured memory_bytes: 7668
#include<bits/stdc++.h>
using namespace std;long long a[5],sum,n,p,i,b[4]={0,0,1,3};main(){cin>>n;for(i=0;i<n;i++){cin>>a[i];sum+=a[i];}sort(a,a+n);if(n<4){p=b[n];}if(n==4){if(sum<9){p=4;}else if(a[0]<3){p=5;}else{p=6;}}if(n==5){if(sum<12){p=6;}else if(a[1]<3){p=7;}else if(a[0]<3||a[3]<4){p=8;}else if(a[0]<4){p=9;}else{p=10;}}cout<<sum-p<<endl;}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
#include<cmath>
#include<string>
using namespace std;
#define f first
#define s second
#define MOD 1000000007
#define fast ios::sync_with_stdio(0),cout.tie(0),cin.tie(0)
#define pb push_back
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define mkt make_tuple
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"wait\n"
#define nax 100
typedef long long ll;
typedef unsigned long long ull;

class solution{
public:
	void solve(){
		int a,b;
		cin>>a>>b;
//		int val1 = a/(0.08);
//		int val2 = b/(0.1);
//		int temp = val1 * 0.1;
		//int val = val2 * 0.08;
		int x= 1;
		
		while(x<1259){
			if((int)(x*0.08) == a && (int)(x * 0.1 )== b){
				cout<<x;
				break; 
			}
			x++;
		}
		if(x == 1259)
			cout<<-1;
	}

};

int main()
{
    fast;
	ll i=0;
	int t=1;
	//cin>>t;
	while(t--){
		solution s;
		s.solve();
	}

 return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,Q;
  cin>>N>>Q;
  Q++;
  vector<ll> A(Q,N);
  for(int i=1;i<Q;i++){cin>>A[i];}
  priority_queue<pll> pq;
  for(ll i=0;i<Q;i++){pq.push({-A[i],i});}
  vector<ll> uku;
  ll mx=-1;
  while(!pq.empty()){
    pll a=pq.top(); pq.pop();
    if(a.S>mx){mx=a.S; uku.push_back(-a.F);}
  }
  ll all=1,ls=A.back();
  multiset<pll> S;
  while(!uku.empty()){
    ll a=uku.back();
    uku.pop_back();
    ll tmp=all;
    all*=ls/a;
    S.insert({ls%a,tmp});
    ls=a;
    auto I=S.end();
    I--;
    while((*I).F>=a){all+=(*I).F/a*(*I).S; S.insert({(*I).F%a,(*I).S}); I=S.erase(I); --I;}
    //cout<<a<<" "<<all<<endl;
    //for(auto &I:S){cout<<"   "<<I;}cout<<endl;
  }
  vector<ll> cnt(N+1,0);
  for(auto &I:S){cnt[I.F]+=I.S;}
  for(ll i=N-1;i>=0;i--){cnt[i]+=cnt[i+1];}
  for(ll i=1;i<=ls;i++){cnt[i]+=all;}
  for(ll i=1;i<=N;i++){cout<<cnt[i]<<endl;}

  return 0;
}


Measured memory_bytes: 13488
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define mx_int_prime 999999937
#define mem(a,b) memset(a, b, sizeof(a) )
typedef long long ll;
typedef long double ld;
const int mx=2e5+125;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
ll p[mx],a[mx],b[mx];
int main()
{
    optimize();
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0; i<n-2; i++){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')c++;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N;
  cin >> N;
  while(N--){
    int H1, W1, H2, W2;
    cin >> H1 >> W1;
    vector<string> block(H1);
    REP(i, H1) cin >> block[i];
    cin >> H2 >> W2;
    vector<string> grid(H2);
    REP(i, H2) cin >> grid[i];
    int ans = -1;
    for(int iter = 0; iter < 4; iter++){
      int my1 = INF, my2 = -INF;
      REP(y, H1) REP(x, W1) if(block[y][x] == '#') my1 = min(my1, y), my2 = max(my2, y);
      for(int by = -my1; by + my2 < H2; by++){
        int y1 = max(by, 0), y2 = min(H2, by + H1);
        if(y2 - y1 <= ans) continue;
        for(int bx = -W1 + 1; bx < W2; bx++){
          bool exist = false;
          REP(y, H1)REP(x, W1) if(block[y][x] == '#' && (!valid(bx + x, by + y, W2, H2) || grid[by + y][bx + x] == '#')){
            exist = true;
            break;
          }
          if(exist) continue; // dame
          vector<string> grid_es = grid;
          REP(y, H1)REP(x, W1) if(block[y][x] == '#') grid_es[by + y][bx + x] = '#';
          int cnt = 0;
          for(int y = y1; y < y2; y++){
            bool ok = true;
            for(int x = 0; x < W2; x++){
              if(grid_es[y][x] != '#'){
                ok = false;
                break;
              }
            }
            if(ok) cnt++;
          }
          ans = max(ans, cnt);
        }
      }
      swap(H1, W1);
      vector<string> new_block(H1, string(W1, ' '));
      for(int y = 0; y < H1; y++){
        for(int x = 0; x < W1; x++){
          new_block[y][x] = block[x][H1 - y - 1];
        }
      }
      block = new_block;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1276
#include <stdio.h>

int main(){
	double a,b;
	
	while(~scanf("%lf%lf",&a,&b)){
		if(a<35.5 && b<71){
			printf("AAA\n");
		}else if(a<37.5 && b<77){
			printf("AA\n");
		}else if(a<40&&b<83){
			printf("A\n");
		}else if(a<43&&b<89){
			printf("B\n");
		}else if(a<50&&b<105){
			printf("C\n");
		}else if(a<55 && b<116){
			printf("D\n");
		}else if(a<70&&b<148){
			printf("E\n");
		}else{
			printf("NA\n");
		}
	}
	return 0;
}

Measured memory_bytes: 0