akhauriyash/Code-Regression huggingface dataset:
class PriorityQueue
  def initialize
    @heap = [nil]
  end

  def up_heap(x)
    @heap << x
    idx = @heap.size - 1

    while idx != 1
      parent = idx / 2
      break if @heap[idx] < @heap[parent]

      @heap[idx], @heap[parent] = @heap[parent], @heap[idx]
      idx = parent
    end
  end

  def down_heap
    size = @heap.size
    return if size == 1
    return @heap.pop if size == 2

    max = @heap[1]
    @heap[1] = @heap.pop
    size -= 1
    idx = 1

    while idx * 2 < size
      l = idx * 2
      r = idx * 2 + 1

      if @heap[r]
        child = @heap[l] > @heap[r] ? l : r
      else
        child = l
      end

      break if @heap[idx] > @heap[child]

      @heap[idx], @heap[child] = @heap[child], @heap[idx]
      idx = child
    end

    max
  end

  def to_a
    @heap.shift
    @heap
  end

  alias_method :<<, :up_heap
  alias_method :push, :up_heap
  alias_method :shift, :down_heap
end

n, m = gets.split.map(&:to_i)
q = PriorityQueue.new
gets.split.map(&:to_i).each { |e| q << e }

m.times { q.push(q.shift / 2) }

puts q.to_a.inject(:+)

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

int main(){
  int a,b,x;
  cin >> a >> b;
  x = a * b;
  x = x % 2;
  if (x == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
from math import sqrt
def get_divisor(num):
	arr = [i for i in range(1,int(sqrt(num))+1) if num % i == 0]
	arr += [num // i for i in reversed(arr) if num // i not in arr]
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))

Measured memory_bytes: 43548
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <list>
#include <ctime>
#include <memory.h>
#include <bitset>
#include <climits>
#include <iostream>
#include <stdlib.h>

#define F first
#define S second
#define endl "\n"
#define pb push_back
#define mp make_pair
#define bs 1000000007
#define pi 3.141592653589793
#define y1 kjdfshnvoavaofobiopj
using namespace std;

int n, ans, ary[100010], num, newary[100010];

int main(){
//freopen("input.txt", "r", stdin);
ios_base::sync_with_stdio(0);
cin.tie(0);

cin>>n;
for(int i = 1; i <= n; i++)
	cin>>ary[i], newary[i] = ary[i];
sort(ary+1, ary+n+1);
for(int i = 1; i <= n; i++)
{
	num = newary[i];
	int up = upper_bound(ary+1, ary+n+1, num)-ary-1;
	if(up%2 == 0 && i&1)
		++ans;
}
cout<<ans<<endl;

return 0;}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

bool ispal(string s, int l, int r){
	while(l < r){
		if(s[l] != s[r])return false;
		l++, r--;
	}
	return true;
}

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

	
	string s;
	cin >> s;
	int n = sz(s);
	if(ispal(s, 0, n - 1) && ispal(s, 0, (n - 1) / 2 - 1) && ispal(s, (n + 3) / 2 - 1, n - 1)) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::marker::*;
use proconio::*;
use std::cmp;

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        p: [Usize1; n],
        c: [i64; n],
    }
    // annotate for rust-analyzer
    let n: usize = n;
    let k: usize = k;
    let p: Vec<usize> = p;
    let c: Vec<i64> = c;

    let mut ans = std::i64::MIN;
    for si in 0..n {
        let mut x = si;
        let mut s = Vec::new();
        let mut sum = 0;
        loop {
            x = p[x];
            s.push(c[x]);
            sum += c[x];
            if si == x {
                break;
            }
        }
        let mut tmp = 0;
        let len = s.len();
        for i in 0..len {
            tmp += s[i];
            if i > k - 1 {
                break;
            }
            let mut tmp2 = tmp;
            if sum > 0 {
                tmp2 += ((k - 1 - i) / len) as i64 * sum;
            }
            //println!("{} {} {}", ans, tmp, tmp2);
            ans = cmp::max(ans, tmp2);
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2376
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    int w;
    cin >> s;
    cin >> w;
    string A[1000];
    
    if(s.length() % w == 0){
    for(int i = 0;i < (s.length());i+=w){
        if(i == 0){
            A[i] = s[i];
        }
        else if(i % w == 0){
         A[i/w] = s[i];
        }
    }
    
    for(int i = 0;i < (s.length())/w;i++){
        cout << A[i];
    }
    }
    else{
        for(int i = 0;i <= (s.length());i+=w){
        if(i == 0){
            A[i] = s[i];
        }
        else if(i % w == 0){
         A[i/w] = s[i];
        }
    }
    
    for(int i = 0;i <= (s.length())/w;i++){
        cout << A[i];
    }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
    int A, B;
    int a = 0;
    int ans = 1;
    cin >>A>>B;

    for (a = 0; a < B + 1; a++){
        if(B <= ans){
            break;
        }else{
            ans = ans - 1 + A;
        }
    }
  
    cout << a << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	double weight;
	while(~scanf("%lf", &weight))
	{
		if(weight <= 48.0)
		{
			cout << "light fly" << endl;
		}
		else if(weight <= 51.0)
		{
			cout << "fly" << endl;
		}
		else if(weight <= 54.0)
		{
			cout << "bantam" << endl;
		}
		else if(weight <= 57.0)
		{
			cout << "feather" << endl;
		}
		else if(weight <= 60.0)
		{
			cout << "light" << endl;
		}
		else if(weight <= 64.0)
		{
			cout << "light welter" << endl;
		}
		else if(weight <= 69.0)
		{
			cout << "welter" << endl;
		}
		else if(weight <= 75.0)
		{
			cout << "light middle" << endl;
		}
		else if(weight <= 81.0)
		{
			cout << "middle" << endl;
		}
		else if(weight <= 91.0)
		{
			cout << "light heavy" << endl;
		}
		else
		{
			cout << "heavy" << endl;
		}
	}
}

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

Measured memory_bytes: 0
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n;
  int in;
  vector<int>dis;
  cin >> n;
  int count = 0;
  int ans;
  for(int i = 0; i < n; i++) {
    cin >> in;
    dis.push_back(in);
  }
  int none;
  bool flag = false;
  while(1) {
    none = 0;
    for(int i = 0; i <= n; i++) {
      ans = dis[i]%2;
      if(ans == 0) {
        if(dis[i] == 0)
          continue;
        dis[i] = dis[i]/2;
        count++;
      } else {
        none++;
      }
      if(none == n) {
        flag = true;
        break;
      }
    }
    if(flag == true) {
      break;
    }
  }

  cout << count << "\n";
  
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
vector<int> P;
vector<vector<int>> V;
vector<pii> vp;
//=============================
void input()
{
    cin>>N>>M;
    P.resize(N);
    rep(i,N){
        int a;
        cin>>a;
        a--;
        P[i]=a;
    }
    vp.resize(M);
    rep(i,M){
        int a,b;
        cin>>a>>b;
        a--;b--;
        vp[i] = make_pair(a,b);
        
        //V[b].push_back(a);
    }
}
//=============================
void func(){}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
//=============================
void solve()
{
    UnionFind uf = UnionFind(N);
    
    for(auto x : vp){
        uf.unite(x.first, x.second);
    }
    
    int ans= 0;
    rep(i,N){
        if(uf.same(i,P[i])){
            ans++;
        };
    }
    cout<<ans<<endl;
   

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, n) for (int i = (n)-1; i >= 0; i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase(unique(ALL(v)), v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 2e18;
const double PI = acos(-1);

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int cur = 0;
	int i = 0;
	while (cur < N)
	{
		i++;
		cur += i;
	}
	vi ans;
	while (N > 0)
	{
		if (N > i)
		{
			ans.push_back(i);
			N -= i;
		}
		else
		{
			ans.push_back(N);
			break;
		}
		i--;
	}
	REP(i, SZ(ans))
	{
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 384
//#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

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

const int N = 1e6 + 5;

/***************************************************************************/

int main() {

	boost;
	ll a, b, c, x, y;
	cin>>a>>b>>c>>x>>y;

	ll ans = 0;

	if(2*c <= a) {
		ans += x*2*c;
		y -= min(x, y);
		x = 0;
	}

	if(2*c <= b) {
		ans += y*2*c;
		x -= min(x, y);
		y = 0;
	}

	if(2*c <= a+b) {
		int t = min(x, y);
		ans += t*2*c;
		x -= t;
		y -= t;
	}

	ans += a*x;
	ans += b*y;

	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

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

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

    std::sort(A.begin(), A.end(), std::greater<int>());
    double sum = 0.0;
    for (int i=0; i<N; ++i) {
        sum += 1.0 / (double) A[i];
    }

    printf("%.20lf\n", (1.0/sum));
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for m in range(M)]
BC = sorted(BC,key=lambda x:x[1])[::-1]

for b,c in BC:
  A.extend(b*[c])
  if 2*N<len(A):
    break

A = sorted(A)[::-1]
print(sum(A[:N]))

Measured memory_bytes: 39112
(defun _algae (r d x2000)
  (labels ((_algae0 (i x rv)
             (if (= i 2011) (nreverse rv)
               (let ((next-x (- (* r x) d)))
                 (_algae0 (+ i 1) next-x (cons next-x rv))))))
    (_algae0 2001 x2000 nil)))

(defun algae (r d x2000)
  (dolist (i (_algae r d x2000))
    (print i)))

#|
(algae 2 10 20)
(algae 4 40 60)
|#

(let ((r (read))
      (d (read))
      (x2000 (read)))
  (algae r d x2000))


Measured memory_bytes: 11624
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
const int MAXN=100000;
int a[MAXN+10],b[MAXN+10],p1,p2;
LL sa[MAXN+10],sb[MAXN+10];
void solve(long long N, long long K, vector<long long> x){
	
	for(int i=0; i<x.size(); ++i) {
		if (x[i]<0) a[++p1]=x[i];
		else b[++p2]=x[i];
	}	
	for(int i=1; i<=p1; ++i) {
		sa[i]=abs(a[p1-i+1]);
	}
	for(int i=1; i<=p2; ++i) {
		sb[i]=abs(b[i]);
	}
	LL ans=LLONG_MAX/10;
	for(int i=0; i<=p1; ++i) {
		int t=K-i;
		if (t<=p2 && t>=0) {
			ans=min(ans,2*sa[i]+sb[t]);
		}
	}
	for(int i=0; i<=p2; ++i) {
		int t=K-i;
		if (t<=p1 && t>=0) {
			ans=min(ans,2*sb[i]+sa[t]);
		}
	}
	cout<<ans<<endl;
}

int main(){	
#ifdef WAAUTOMATON
	freopen("in_C_4.txt","r",stdin);
#endif
	long long K;
	long long N;
	scanf("%lld",&N);
	vector<long long> x(N-1+1);
	scanf("%lld",&K);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&x[i]);
	}
	solve(N, K, x);
	return 0;
}



Measured memory_bytes: 2944
#include<stdio.h>
void trace(int A[],int N){
int i;
for(i=0;i<N;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
}

void insertionSort(int A[],int N){
int i,j,v;
for(i=1;i<N;i++){
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}

int main(void){
int N,i;
int A[100];
	
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);

trace(A,N);
insertionSort(A,N);
return 0;
}


Measured memory_bytes: 2084
#ABC075B

h,w=map(int,raw_input().split())
l=[]
for i in xrange(h):
 l.append(list(raw_input()))
for y in xrange(h):
 for x in xrange(w):
  if l[y][x]=='#':
   continue
  cnt=0
  for dy in [-1,0,1]:
   for dx in [-1,0,1]:
    ny=y+dy
    nx=x+dx
    if 0<=ny<h and 0<=nx<w:
     if l[ny][nx]=='#':
      cnt+=1
  l[y][x]=str(cnt)
for i in xrange(h):
 print ''.join(l[i])


Measured memory_bytes: 2820
#include <bits/stdc++.h> 
using namespace std;  
long INF=1000000000000000;
int main() {
    long N;
    cin>>N;
    vector<long> A(N);
    for(int i=0;i<N;i++) cin>>A.at(i);
    
    
    long ans=-1;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            ans=max(ans,abs(A.at(i)-A.at(j)));
        }
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<string.h>
#include<algorithm>
using namespace std;

int main() {
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a > k)cout << ":(" << endl;
	else cout << "Yay!" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a[8]={1,2,4,8,16,32,64,128};
	int n;
	cin>>n;
	for(int i=0;i<7;++i)
	{
		if(a[i+1]>n)
		{
			cout<<a[i]<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
int main() {
    ll A, B;
    cin >> A >> B;

    ll ans;
    ans = lcm(A, B);
    cout << ans << endl;
}

Measured memory_bytes: 3636
//69行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

//Simple Array Input
#define SAI int n;cin >> n;vi a(n);ain(a)
//Simple Graph Input
#define SGI(m) for(int i=0;i<m;i++){int a,b;cin >> a >> b;g[--a].pb(--b);g[b].pb(a);}
//Simple Tree Input
#define STI SGI(n-1)

typedef long long ll;
typedef long long integer;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){
    for(int i=0;i<a.size();i++)cout << a[i] << (i < a.size()-1 ? ' ' : '\n');
}
///////////////////////////////////////////////////////////

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int n;cin >> n;
    map<string,int> M;
    rep(i,n){
    	string s;cin >> s;
    	M[s]++;
    }
    cout << M.size() << '\n';
    return 0;
}
/*
 *!!CHECK!! 
 * 制約をよく読め：まず最も愚直な解法を考えろ
 * intの掛け算をしてる場合：overflowは大丈夫？
 * 制約の下限・上限は大丈夫？
 * 木構造は一直線にした時TLEしない？
 * */

/*
* DEBUG before you submit!
* 入力はされてる？
* vectorはサイズを初期化している？
* まずは変数が適切かをチェックする
* 特に二重ループ内部の変数が適切か？
* while文はカウンタがインクリメントされてるかチェック！
*/


Measured memory_bytes: 19232
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		// intXおよびintYの個数intNumの定義
		int intNum = scanner.nextInt();
		// 配列intx,intYの定義
		int intX[] = new int[intNum + 1];
		int intY[] = new int[intNum + 1];

		// 配列intXに2行目の数値を格納
		for (int intI = 0; intI < intNum; intI++) {
			intX[intI] = scanner.nextInt();
		}
		// 配列intYに2行目の数値を格納
		for (int intJ = 0; intJ < intNum; intJ++) {
			intY[intJ] = scanner.nextInt();
		}

		// pが1の時
		double dbMan = 0;
		for (int intA = 0; intA < intNum; intA++) {
			int intElement = intX[intA] - intY[intA];
			dbMan += (double)(Math.abs(intElement));
		}

		// pが2の時
		double dbEleSum = 0;
		double dbEuq;
		for (int intB = 0; intB < intNum; intB++) {
			int intElement = intX[intB] - intY[intB];
			int intEle2 = Math.abs(intElement);
			double dbEle3 = Math.pow(intEle2, 2);
			dbEleSum += dbEle3;
		}
		dbEuq = Math.sqrt(dbEleSum);

		// pが3の時
		double dbEleSum3 = 0;
		double dbCub;
		for (int intC = 0; intC < intNum; intC++) {
			int intElement = intX[intC] - intY[intC];
			int intEle2 = Math.abs(intElement);
			double Ele3 = Math.pow(intEle2, 3);
			dbEleSum3 += Ele3;
		}
		dbCub = Math.cbrt(dbEleSum3);

		//pが∞の時
		double dbChe = 0;
		double dbDis[] = new double[intNum + 1];
		// double dbMax = 0;
		for (int intd = 0; intd < intNum; intd++) {
			dbDis[intd] = (double)(intX[intd] - intY[intd]);
			double dbElement = Math.abs(dbDis[intd]);
			if (dbElement > dbChe) {
				dbChe = dbElement;
			}
		}


		System.out.println(String.format("%.6f", dbMan));
		System.out.println(String.format("%.6f", dbEuq));
		System.out.println(String.format("%.6f", dbCub));
		System.out.println(String.format("%.6f", dbChe));
	}

}



Measured memory_bytes: 26616
class SegTree
  attr_reader :size, :e, :f
  attr_accessor :seg

  def self.create(a=[],e,f)
    n = 1
    n *= 2 while n < a.size
    this = new(n,e,f)
    a.size.times do |i|
      this.seg[i+n] = a[i]
    end
    (n-1).downto(1) do |i|
      this.seg[i] = this.seg[i*2] & this.seg[i*2+1]
    end
    this
  end

  def initialize(n=2**32,e,f)
    @size = n
    @e = e
    @f = f
    @seg = Array.new(size*2, e)
  end

  def [](i)
    i += size
    seg[i]
  end

  def update(i,x)
    i += size
    seg[i] = x
    while i > 1
      i /= 2
      seg[i] = f[ seg[i*2], seg[i*2+1] ]
    end
  end

  def query(a,b)
    ans = e
    a += size; b += size
    while a < b
      (ans = f[ ans, seg[a] ]; a += 1) if a.odd?
      (b -= 1; ans = f[ ans, seg[b] ]) if b.odd?
      a /= 2; b /= 2
    end
    ans
  end

  def inspect
    { size: size, seg: seg }.to_s
  end
end

# SegTree.new(N,E,F)
# := 要素数N、単位元E、演算Fで初期化、ただしNは2の冪
# SegTree.create(A,E,F)
# := 配列A、単位元E、演算Fで初期化で初期化
# update(i,x) := A[i]をxに更新
# query(a,b) := 半開区間[a,b)でのA[i]の演算結果

S = gets.chomp.chars.map{|c| 1 << c.ord - ?a.ord}
N = S.size
T = SegTree.create(S, 0xFFFF_FFFF, ->x,y{x&y})

N.times do |i|
  if T.query(0,N-i) != 0
    puts i
    exit
  end

  (N-i-1).times do |j|
    T.update(j, T[j] | S[j+i+1])
  end
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
*/

string s;
ll ans=0;

int main(void){
	cin>>s;
	rep(i,s.size()){
		reg(j,0,i){
			bool ok=true;
			ll t=0;
			reg(k,j,i){
				if(!(s[k]=='A'||s[k]=='T'||s[k]=='C'||s[k]=='G')){
					ok=false;
					break;
				}
				t++;
			}
			if(ok)ans=max(ans,t);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,q,a;
main(){
	cin>>n;
	vector<int>v(n);
	r(i,n)cin>>v[i];;
	cin>>q;
	while(q--){
		cin>>a;
		vector<int>::iterator it= lower_bound(v.begin(),v.end(),a);
		cout<<it-v.begin()<<endl;
	}
}


Measured memory_bytes: 3104
#include <stdio.h>


int main()
{
	int money;
	int coin[4] = {1, 5, 10, 25};
	int sum, tmp;
	int i;

	scanf("%d", &money);


	sum = 0;
	for(i = 0; i < 4; i++){
		if( (tmp = money / coin[3 - i]) ){
			sum += money / coin[3 - i];
			money %= coin[3 - i];
		}
	}


	printf("%d\n", sum);

	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<double> x(N);
  vector<string> u(N);
  
  for(int i = 0 ; i < N; i++){
    cin >> x.at(i);
    cin >> u.at(i);
  }
  

  double T = 0;
  
  for(int i = 0 ; i < N; i++){
    if(u.at(i) == "JPY"){
      T += x.at(i);
    }
    else {
      T += x.at(i) * 380000;
    }
  }
  
  cout << fixed << setprecision(9);
  cout << T << endl;
      
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, c, p;
string s;
int main(){
	cin >> n >> s;
	for(; p = s.find("ABC", p)+1; c++);
	cout << c << '\n';
}

Measured memory_bytes: 256
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
n = I()
A = LI()
q = I()
m = LI()
partial_sum = set()
stack = [] #indexとsumを入れておく
def dfs():
    stack.append([0,0])
    stack.append([0,A[0]])
    partial_sum.add(A[0])
    while stack:
        i,s = stack.pop()
        i += 1
        if i==n:
            partial_sum.add(s)
            continue
        stack.append([i,s])
        stack.append([i,s+A[i]])
dfs()
for x in m:
    print('yes' if x in partial_sum else 'no')



Measured memory_bytes: 6144
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
    int n;
    string b[100];
    bool ans = true;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
        if (i != 0 && ans)
        {
            if (b[i - 1][b[i - 1].size() - 1] != b[i][0])
                ans = false;
        }
    }
    if (ans)
    {
        sort(b, b + n);
        for (int i = 0; i < n - 1; i++)
        {
            if (b[i] == b[i + 1])
                ans = false;
        }
    }

    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#define NOMINMAX
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <iomanip>
#include <numeric>
using namespace std;

int main()
{
	int N;
	int A;
	int sum = 0;

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> A;
		sum += A;
	}

	string ans = "YES";
	if (sum % 2 != 0)
	{
		ans = "NO";
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define SZ(X) ((int64_t)((X).size()))
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
#define doublemax (std::numeric_limits<double>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

//sort(ALL(v),greater<int>());


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

	int N, M;
	cin >> N >> M;
	vector<vector<int>>g(N, vector<int>(N, intmax));
	rep(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		g[a][b] = c;
		g[b][a] = c;
	}
	auto dist = g;

	rep(k, N)rep(i, N)rep(j, N)dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

	int ans = 0;
	rep(i, N)REP(j, i + 1, N)if (g[i][j] < intmax && dist[i][j] < g[i][j])ans++;
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int a=stdIn.nextInt();
		int b=stdIn.nextInt();
		for(int i=0;i<Math.max(a,b);i++){
			System.out.print(Math.min(a,b));
		}
		System.out.println();
	}
}


Measured memory_bytes: 21204
import numpy as np

N = int(input())
travel_list = [np.array([0, 0, 0])]
add_list = [np.array([int(i) for i in input().split()]) for i in range(N)] 
travel_list.extend(add_list)

def is_travel(arr1, arr2):
    dt, dx, dy = abs(arr2 - arr1)
    if dt < dx + dy:
        return False
    elif dt % 2 != (dx + dy) % 2:
        return False
    else:
        return True
        
travel = 'Yes'
for i in range(N):
    if is_travel(travel_list[i], travel_list[i+1]):
        continue
    else:
        travel = 'No'
        break
print(travel)


Measured memory_bytes: 29564
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	char a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	if(a==f&&b==e&&c==d)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 764
//                                ,.へ 
//___ 　　　　　　　 　 　 　 　 　　　　　　　　　　　　ﾑ　　i 
//「 ﾋ_i〉　　　 　 　　　　　　 　 　　　　　　　　　　　　 ゝ　〈 
//ﾄ　ノ 　　　　　　　　　　　　　　　　　　　　　　　　　　iニ(() 
//i 　{ 　 　　　　　　　 　　　＿＿＿_ 　 　　　　　　　　| 　ヽ 
//i　　i　　　 　　　　　　　／__,　 , ‐-＼ 　 　 　 　 　　i 　　} 
//|　　 i　　　　　　 　　／（●) 　 ( ● )＼　　　　　　 {､　 λ 
//ト－┤.　　　　　　／ 　 　（__人__） 　　　＼　　　 ,ノ　￣ ,! 
//i　　　ゝ､_ 　　　　|　　　　　´￣` 　 　　　　|　,. '´ﾊ　　　,! 
//.　ヽ、 　　　｀`　､,__＼ 　　 　 　　　　　 　 ／"　＼ 　ヽ／ 
//＼ノ　ﾉ　　　ﾊ￣r/:::r―--―/::７　　 ﾉ　　　　／ 
//ヽ.　　　　　　ヽ::〈； . '::. :' |::/　　 /　　　,. " 
//`ｰ ､　　　　＼ヽ::. ;::：|/　　　　　ｒ'" 
//／￣二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二 
/*| 答*/ import java.util.Arrays;import java.util.Scanner;public class Main{public static void main(String[]args){Scanner scan=new Scanner(System.in);int a=scan.nextInt();long w=0,h=0;int d[]=new int[a];int e[]=new int[a];int count=0;for(int i=0;i<a;i++) {d[i]=scan.nextInt();}Arrays.sort(d);for(int i=0;i<a;i++) {e[i]=d[a-i-1];}for(int i=1;i<a;i++) {if(e[i]==e[i-1]) {i++;if(count==0) {w=e[i-1];count++;}else {h=e[i-1];break;}}}System.out.println(w*h);}}//|| 
//＼＿二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二

Measured memory_bytes: 58760
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum = sum ^ a[i];
    }
    for(int i = 0; i < n - 1; i++) {
        cout << (sum ^ a[i]) << " ";
    }
    cout << (sum ^ a[n - 1]) << endl;
}

Measured memory_bytes: 4772
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 100000000000000000	0LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int x;
int main(){
	cin>>x;
	int t=__gcd(x,360);
	cout<<360/t<<endl;
	return 0;
}


Measured memory_bytes: 3628
import java.util.*

fun main(args:Array<String>): Unit {
    val n = readLine()!!.toInt()
    val k = (1 .. (n + 1)).find{it * (it - 1) / 2 == n}
    when(k){
        null -> println("No")
        else -> {
            println("Yes")
            println(k)
            val array = Array(k){LinkedList<Int>()}
            var count = 1
            for (a in 0 until k){
                for (b in (a + 1) until k){
                    array[a].add(count)
                    array[b].add(count)
                    ++count
                }
            }
            for (queue in array){
                println(
                        queue.joinToString(" ", "${queue.size} "){it.toString()}
                )
            }
        }
    }
}

Measured memory_bytes: 54160
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int A,B; int m;
    cin>>A>>B>>m;
    vi a(A);
    vi b(B);
    int xsi=0,ysi=0;
    rep(i,A){cin>>a[i];if(a[xsi]>a[i])xsi=i;}
    rep(i,B){cin>>b[i];if(b[ysi]>b[i])ysi=i;}
    ll mini=a[xsi]+b[ysi];
    rep(i,m){
        int x,y,c;
        cin>>x>>y>>c;
        x--; y--;
        chmin(mini,(ll)a[x]+b[y]-c);
        }
    cout<<mini<<endl;
    return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define endl ("\n")
#define mod 1000000007


long long power(long long a, long long n)
{
    long long sol = 1ll;
    while(n)
    {
        if(n%2)
        {
            sol *= a;
            sol %= mod;
        }
        a *= a;
        a %= mod;
        n /= 2;
    }
    return sol;
}
int main()
{

    long long n;
    cin >> n;
    long long arr[n];
    for(int i = 0;i < n;i++)
    {
        cin >> arr[i];
    }
    const int s = 2000001;
    long long prime[2000001];
    for(int i = 0;i < s;i++)
    {
        prime[i] = i;
    }
    for(int i = 2;i * i < s;i++)
    {
        if(prime[i] == i)
        {
            for(int j = i + i;j < s;j += i)
            {
                prime[j] = min(prime[j], (long long)i);
            }
        }
    }
    map<int,long long> mp;
    for(int i = 0;i < n;i++)
    {
        long long curr = arr[i];
        map<int, int> fact;
        while(curr != 1)
        {
            fact[prime[curr]]++;
            curr /= prime[curr];
        }
        for(auto i:fact)
        {
            int p = i.first;
            if(i.second > mp[p])
            {
                mp[p] =i.second;
            }
        }
    }
    long long lcm = 1;
    for(auto i:mp)
    {
        lcm *= power(i.first, i.second);
        lcm %= mod;
    }
    long long sol = 0ll;
    for(int i = 0;i < n;i++)
    {
        long long b_i = (lcm * power(arr[i], mod - 2))%mod;
        sol += b_i;
        sol %= mod;
    }
    cout << sol;
    
    return 0;
}


Measured memory_bytes: 16512
//なんで遅いんだろ
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	char C = getcha();
	int A = C - '0';
	while ((C = getcha()) >= '0') A = A * 10 + C - '0';
	return A;
}

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


	int N;
	N = getint();
	int A[200000];
	ll B[200001], C;
	B[0] = 0;
	C = 0;

	vector<int> V;
	V.pb(0);
	rep(i, N) A[i] = getint();
	ll mae = A[0];
	rep(i, N) {
		ll a = A[i];
		B[i + 1] = B[i];
		if (mae >= a) {
			a *= 4;
			while (mae >= a) {
				V.pb(0);
				a *= 4;
			}
			V.back()++;
		}
		else {
			while (mae < a) {
				int kari = V.back();
				B[i + 1] += kari;
				if (V.size() > 1) {
					V.pop_back();
					V.back() += kari;
				}
				mae *= 4;
			}
			V.back()++;
		}
		mae = A[i];
	}
	V.clear();
	mae = A[N - 1];
	V.pb(0);
	ll kotae = 2 * B[N] + N;
	for (int i = N - 1; i >= 0; i--) {
		ll a = A[i];
		if (mae >= a) {
			a *= 4;
			while (mae >= a) {
				V.pb(0);
				a *= 4;
			}
			V.back()++;
		}
		else {
			while (mae < a) {
				int kari = V.back();
				C += kari;
				if (V.size() > 1) {
					V.pop_back();
					V.back() += kari;
				}
				mae *= 4;
			}
			V.back()++;
		}
		mae = A[i];
		kotae = min(kotae, B[i] + B[i] + C + C + i);
	}

	printf("%lld", kotae);

	Would you please return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    ll N, K;
    cin >> N >> K;
    if (K==0){
        cout << N*N << endl;
        return 0;
    }
    ll res = 0;
    for(ll b=K+1;b<N+1;b++){
        ll dif1 = ((N+1)/b)*(b-K);
        ll dif2 = max((N+1)%b - K, 0ll);
        res += (dif1+dif2);
        //cout << "b: " << b << ", dif1: " << dif1 << ", dif2: " << dif2 << endl;
    }
    cout << res << 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 N=sc.nextInt();
    
    for(int i=0;i<N;i++){
       int s=sc.nextInt();
      if(s%2==0){
        if(s%3==0||s%5==0){
          ;
        }else{
          System.out.print("DENIED");
          break;
        }
      }
      if(i==N-1){
        System.out.print("APPROVED");
      }
    }
  }

}


Measured memory_bytes: 22100
def find(i, a):
    if i == 0:
        return (a + 1) // 2
    else:
        tmp = max(a % 2**(i + 1) - 2**i + 1, 0)
        return (a // 2**(i + 1)) * 2**i + tmp


def inpl():
    return list(map(int, input().split()))


A, B = inpl()
ans = 0

for i in range(0, 41):
    if A == 0:
        a2 = 0
    else:
        a2 = find(i, A - 1)
    b2 = find(i, B)
    if (b2 - a2) % 2 == 1:
        ans += 2**i
    # print(b2, a2, i)

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>

using std::vector;
using std::printf;
using std::cout;
using std::endl;
using std::string;
using std::cin;
using std::pair;
using std::sort;
using std::priority_queue;

#define i64t long long int
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

template<typename T>
void dump(vector<T> vec) {
    for (auto x : vec) {
        std::cout << x << " ";
    }
    std::cout << std::endl;
}

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

const i64t MOD = 1000000007;

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

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

    sort(A.begin(), A.end());

    priority_queue<int> AQ;
    for (int i = 0; i < N; ++i) {
        AQ.push(A[i]);
    }

    int m = M;
    int tmp;
    while(m > 0) {
        tmp = AQ.top();
        if (tmp < 1) { break; }
        AQ.pop();
        AQ.push(tmp / 2);
        m--;
    }

    i64t sum = 0;
    while (!AQ.empty()) {
        sum += AQ.top();
        AQ.pop();
    }

    printf("%lld", sum);

}

Measured memory_bytes: 1276
/* HARE KRSNA HARE KRSNA KRSNA KRSNA HARE HARE
    HARE RAMA HARE RAMA RAMA RAMA HARE HARE  */

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

#define nl "\n"
#define ff first
#define ss second
#define pp pop_back
#define pf pop_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define b_s binary_search
#define all(x) x.begin(),x.end()
#define test ll t; cin>>t; while(t--)
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define rloop(i,s,n) for(ll i=s;i>=n;i--)
#define fill(a,value) memset(a,value,sizeof(a))

#define debug2(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define debug4(a)  for(auto x : a)  cout<<x.ff<<" "<<x.ss<<nl;
#define debug1(a,n) loop(i,0,n)  cout<<a[i]<<" ";  cout<<nl;
#define debug3(a,n,m)  loop(i,0,n){ loop(j,0,m)	cout<<a[i][j]<<" ";	cout<<nl; }

typedef long long ll;
typedef long double ld;

typedef stack<ll> sll;
typedef queue<ll> qll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<ll, pll> ppll;
typedef vector<vector<ll>> vvll;
typedef priority_queue<ll> pqll;

const ll mod = 1000000007;  //998244353;
const ld pi =  acos((ld) - 1);  //3.1415926535;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll num_generator() 	{ return rand() % 1000; }
void array_generator(ll a[], ll n) { loop(i, 0, n)	a[i] = rand() % 100; }

void solve()
{
	ll a, b, c;	cin >> a >> b >> c;
	ll k;	cin >> k;
	while (b <= a && k > 0)
	{
		b *= 2;
		k--;
	}
	while (c <= b && k > 0)
	{
		c *= 2;
		k--;
	}
	if (a < b && b < c)		cout << "Yes";
	else	cout << "No";
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// test
	solve();

	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string str;
    cin >> str;
    bool n, e, w, s;
    n = e = w = s = false;
    for( int i = 0; i < str.size(); ++i ) {
        if( str[i] == 'N' ) n = true;
        if( str[i] == 'E' ) e = true;
        if( str[i] == 'W' ) w = true;
        if( str[i] == 'S' ) s = true;
    }
    if( n != s || e != w ) cout << "No";
    else cout << "Yes";
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int N, M, i;
  int A[100];
  int cnt = 0;
  double sum = 0;
  
  scanf("%d %d", &N, &M);
  for(i = 0; i < N; i++)
  {
    scanf("%d", &A[i]);
    
    sum += A[i];
  }
  
  for(i = 0; i < N; i++)
  {
     if(A[i] >= sum / (4 * M))
    {
      cnt++;
    }
  }
  
  if(cnt >= M)
    printf("Yes\n");

  else
    printf("No\n");
  
  return 0;
}

Measured memory_bytes: 1660
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL 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; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b;
int q;
LL s[101010], t[101010];
LL x;


int main(){
    INIT;
    cin >> a >> b >> q;
    REP(i, a)cin >> s[i];
    REP(i, b)cin >> t[i];
    REP(i, q){
        cin >> x;
        int s2 = lower_bound(s, s + a, x) - s;
        int s1 = s2 - 1;
        int t2 = lower_bound(t, t + b, x) - t;
        int t1 = t2 - 1;
        LL ret = HINF<LL>();
        if(s2 < a && t2 < b){
            ret = min(ret, max(s[s2], t[t2]) - x);
        }
        if(s1 >= 0 && t1 >= 0){
            ret = min(ret, x - min(s[s1], t[t1]));
        }
        if(s1 >= 0 && t2 < b){
            ret = min(ret, t[t2] - s[s1] + min(x - s[s1], t[t2] - x));
        }
        if(t1 >= 0 && s2 < a){
            ret = min(ret, s[s2] - t[t1] + min(x - t[t1], s[s2] - x));
        }
        cout << ret << endl;
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	int X, N; cin >> X >> N;
	map<int, int> mp;
	rep(i, N) {
		int num; cin >> num;
		mp[num] = 1;
	}
	rep(i, 100) {
		int num = X - i;
		if (mp[num] != 1) {
			cout << num;
			return 0;
		}
		num = X + i;
		if (mp[num] != 1) {
			cout << num;
			return 0;
		}
	}
}

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

int main(){
  int a,b,c,d,n;
  string s;
  cin>>n>>a>>b>>c>>d;
  cin>>s;
  a--;
  b--;
  //##が存在
  if((s.substr(a,c-a).find("##")!=string::npos)||(s.substr(b,d-b).find("##")!=string::npos)){
    cout<<"No"<<endl;
    return 0;
  }

  //抜かせない場合
  if(d<c){
    if(!(s[b-1]=='.'&&s[b+1]=='.')){
      if(s.substr(b,d-b+1).find("...")==string::npos){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }

  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 772
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int N;
ll A[200000];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(A, A+N, greater<ll>());
    ll ans = 0;
    vector<ll> v;
    ans += A[0];
    v.push_back(A[0]);
    if(N == 2){
        cout << ans << endl;
        return 0;
    }
    for(int i = 1; i < N; i++){
        v.push_back(A[i]);
        ans += A[i];
        if(v.size() >= N-1) break;
        v.push_back(A[i]);
        ans += A[i];
        if(v.size() >= N-1) break;
    }
    cout << ans << endl;
}

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

#define ll long long int
#define loop(i,s,e) for(ll i=s; i<e; i++)
#define endl '\n'
#define vll vector<ll>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX
#define minusinf INT_MIN

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

void alpha(){

	ll h;
	cin>>h;

	ll a = log(h)/log(2);
	//bug(a);

	ll ans=0;
	loop(i,0,a+1) ans += pow(2,i);

	cout<<ans<<endl;

	
	return;

}

int main(){

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


    ll t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

Measured memory_bytes: 640