akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int c[3][3];
	int mi[3];
	rep(i, 3) {
		mi[i] = INF;
	}
	rep(i, 3) {
		rep(j, 3) {
			cin >> c[i][j];
			chmin(mi[i], c[i][j]);
		}
	}
	rep(i, 3) {
		rep(j, 3) {
			c[i][j] -= mi[i];
		}
	}
	rep(j, 3) {
		if (!(c[0][j] == c[1][j] && c[1][j] == c[2][j])) {
			out("No");
			return 0;
		}
	}
	out("Yes");

	return 0;
}

Measured memory_bytes: 256
N = gets.to_i

a_list = []
N.times{
	a_list << gets.to_i
}

eat = []
N.times{|i|
	if a_list[i] % 2 == 1
		eat << i
	end
}
if eat.length == 0
	puts "second"
else
	puts "first"
end



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

int main(void)
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    int count = 1;
    for (int i = 0; i < N-1; i++) {
        if (S[i] != S[i+1])
            count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 512
package main

import (
	"fmt"
	"strconv"
	"strings"
)

type Card struct {
	mark  string
	value int
}

func main() {
	var n int
	fmt.Scanf("%d", &n)

	A := make([]Card, n)
	B := make([]Card, n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanf("%s", &s)
		num, _ := strconv.Atoi(string([]rune(s)[1]))
		A[i] = Card{string([]rune(s)[0]), num}
		B[i] = Card{string([]rune(s)[0]), num}
	}

	Bubbled := BubbleSort(A, n)
	Selectioned := SelectionSort(B, n)

	BubbledStr := display(Bubbled)
	fmt.Println(BubbledStr)
	fmt.Println("Stable")

	SelectionedStr := display(Selectioned)
	fmt.Println(SelectionedStr)

	if BubbledStr == SelectionedStr {
		fmt.Println("Stable")
	} else {
		fmt.Println("Not stable")
	}
}

func BubbleSort(C []Card, N int) []Card {
	for i := 0; i < N; i++ {
		for j := N - 1; j > i; j-- {
			if C[j].value < C[j-1].value {
				C[j], C[j-1] = C[j-1], C[j]
			}
		}
	}
	return C
}

func SelectionSort(C []Card, N int) []Card {
	for i := 0; i < N; i++ {
		minj := i
		for j := i; j < N; j++ {
			if C[j].value < C[minj].value {
				minj = j
			}
		}
		C[i], C[minj] = C[minj], C[i]
	}
	return C
}

func display(cards []Card) string {
	var s []string
	for _, c := range cards {
		s = append(s, fmt.Sprintf("%s%d", c.mark, c.value))
	}
	return strings.Join(s, " ")
}



Measured memory_bytes: 1156
[N,W] = list(map(int,input().split()))
vl = [0]
wl = [0]
for i in range(N):
  [v,w] = list(map(int,input().split()))
  vl.append(v)
  wl.append(w)
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N+1):
  for j in range(W+1):
    if i == 0 or j == 0:
      dp[i][j] = 0
    else:
      if wl[i] <= j:
        dp[i][j] = max(dp[i-1][j-wl[i]] + vl[i], dp[i-1][j])
      else:
        dp[i][j] = dp[i-1][j]

print(dp[N][W])

Measured memory_bytes: 44464
#include <bits/stdc++.h>
#define ll long long
int main()
{
    std::string s;
    int k;
    std::cin >> s >> k;
    std::vector<std::string> Ans(k, "ああああ");
    for (int i = 0; i < s.size(); ++i) {
        for (int j = 1; (i + j <= s.size() && j <= 5); ++j) {
            for (int l = 0; l < k; ++l) {
                if (Ans.at(l).compare(s.substr(i, j)) == 0) {
                    break;
                } else if (Ans.at(l).compare(s.substr(i, j)) > 0) {
                    Ans.insert(Ans.begin() + l, s.substr(i, j));
                    break;
                }
            }
        }
    }
    std::cout << Ans[k - 1] << std::endl;
}

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

using namespace std;

int main(){
	int a[5];

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

	sort(a, a+5);

	cout << a[4];
	for(int m=3; 0<=m; m--){
		cout << " " << a[m];
	}
	cout << endl;
}

Measured memory_bytes: 1176
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

lli A, B, s;

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

	cin >> A >> B;
	if(A < B){
		s = A;
		A = B;
		B = s;
	}

	cout << max(A+B, (A*2)-1);

	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        h: usize, w: usize,
        a: [chars; h],
    }
    const INF: i64 = 1 << 40;
    let mut mia = INF;
    let mut mib = INF;
    let mut maa = -INF;
    let mut mab = -INF;
    for i in 0..h {
        for j in 0..w {
            if a[i][j] != 'B' { continue; }
            let a = i as i64 + j as i64;
            let b = i as i64 - j as i64;
            mia = min(mia, a);
            maa = max(maa, a);
            mib = min(mib, b);
            mab = max(mab, b);
        }
    }
    puts!("{}\n", max(mab - mib, maa - mia));
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}



Measured memory_bytes: 11128
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

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

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x, n, mini = INF32, ans = 0; cin >> x >> n;
	vector<bool> ok(102, 1);
	for(int i = 0; i < n; i++)
	{
		int p; cin >> p;
		ok[p] = 0;
	}
	for(int i = 0; i < 102; i++) if(ok[i] && abs(i - x) < mini)
	{
		ans = i;
		mini = abs(i - x);
	}
	cout << ans;

	return 0;
}

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

using namespace std;
using ll = long long int;
#define long ll

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

    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    for(auto &e: a) cin >> e;
    for(auto &e: b) cin >> e;
    partial_sum(a.begin(), a.end(), a.begin());
    partial_sum(b.rbegin(), b.rend(), b.rbegin());

    ll r = 0;
    for(ll i=0; i<n; i++)
        r = max(r, a[i]+b[i]);
    cout << r << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner $ = new Scanner(System.in);
		int A = $.nextInt(), P = $.nextInt();
		System.out.println((3 * A + P) / 2);
		/*
		1 3 -> 3
		0 1 -> 0
		32 21 -> 58
		*/
	}
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline

N,D,A=map(int,input().split())
M=[list(map(int,input().split())) for i in range(N)]
M.sort()

PLACE=[M[i][0] for i in range(N)]
HP=[M[i][1] for i in range(N)]

seg_el=1<<(N.bit_length()) # Segment treeの台の要素数
SEG=[0]*(2*seg_el) # 1-indexedなので、要素数2*seg_el.Segment treeの初期値で初期化
LAZY=[0]*(2*seg_el) # 1-indexedなので、要素数2*seg_el.Segment treeの初期値で初期化

for i in range(N):
    SEG[i+seg_el]=HP[i]
    

def indexes(L,R): # 遅延伝搬すべきノードのリストを下から上の順に返す. （つまり, updateやgetvaluesで見るノードより上にあるノードたち）
    INDLIST=[]

    R-=1
    
    L>>=1
    R>>=1

    while L!=R:
        if L>R:
            INDLIST.append(L)
            L>>=1
        else:
            INDLIST.append(R)
            R>>=1

    while L!=0:
        INDLIST.append(L)
        L>>=1

    return INDLIST
        

def adds(l,r,x): # 区間[l,r)を +x 更新
        
    L=l+seg_el
    R=r+seg_el

    L//=(L & (-L))
    R//=(R & (-R))

    UPIND=indexes(L,R)
    
    for ind in UPIND[::-1]: # 遅延伝搬. 上から更新していく. （ただし, 今回はうまくやるとこの部分を省ける. addはクエリの順番によらないので. addではなく, updateの場合必要）
        if LAZY[ind]!=0:
            plus_lazy=LAZY[ind]
            
            SEG[ind<<1]+=plus_lazy
            SEG[1+(ind<<1)]+=plus_lazy
            
            LAZY[ind<<1]+=plus_lazy
            LAZY[1+(ind<<1)]+=plus_lazy
            
            LAZY[ind]=0
    
    while L!=R:
        if L > R:
            SEG[L]+=x
            LAZY[L]+=x
            L+=1
            L//=(L & (-L))

        else:
            R-=1
            SEG[R]+=x
            LAZY[R]+=x
            R//=(R & (-R))

    for ind in UPIND:
        SEG[ind]=min(SEG[ind<<1],SEG[1+(ind<<1)])  # 最初の遅延伝搬を省いた場合, ここを変える
        
def getvalues(l,r): # 区間[l,r)に関するminを調べる

    L=l+seg_el
    R=r+seg_el

    L//=(L & (-L))
    R//=(R & (-R))

    UPIND=indexes(L,R)
    
    for ind in UPIND[::-1]: # 遅延伝搬
        if LAZY[ind]!=0:
            plus_lazy=LAZY[ind]
            
            SEG[ind<<1]+=plus_lazy
            SEG[1+(ind<<1)]+=plus_lazy
            
            LAZY[ind<<1]+=plus_lazy
            LAZY[1+(ind<<1)]+=plus_lazy
            
            LAZY[ind]=0
            
    ANS=1<<31

    while L!=R:
        if L > R:
            ANS=min(ANS , SEG[L])
            L+=1
            L//=(L & (-L))

        else:
            R-=1
            ANS=min(ANS , SEG[R])
            R//=(R & (-R))

    return ANS

plind=0
ANS=0
import bisect

while plind<N:
    RHP=getvalues(plind,plind+1)
    if RHP>0:
        MAX=PLACE[plind]+2*D
        x=bisect.bisect_right(PLACE,MAX)
        adds(0,x,(-RHP//A)*A)
        ANS+=-(-RHP//A)

    else:
        plind+=1

print(ANS)


Measured memory_bytes: 99040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#ifdef LOCAL
#define debug(x) cerr << '[' << #x << " = " << (x) << "]\n"
#else
#define debug(x)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n,k;cin>>n>>k;
	vector<int>v(n),dp(n,1e9);
	rep(i,0,n)cin>>v[i];
	dp[0]=0;
	rep(i,1,n){
		rep(j,1,k+1){
			if(i-j>=0)dp[i]=min(dp[i],abs(v[i]-v[i-j])+dp[i-j]);
			else break;
		}
	}
	cout<<dp[n-1]<<'\n';
}

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

int main() {
	int A, B, ans;
	cin >> A >> B;
	if (A == 1) {
		if (B == 2) {
			ans = 3;
		}
		else if (B == 3) {
			ans = 2;
		}
	}
	if (A == 2) {
		if (B == 1) {
			ans = 3;
		}
		else if (B == 3) {
			ans = 1;
		}
	}
	if (A == 3) {
		if (B == 1) {
			ans = 2;
		}
		else if (B == 2) {
			ans = 1;
		}
	}
	cout << ans << endl;
}

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

#define int long long
#define double long double

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-18;

using namespace std;

int arr[200001];
int prefsum[200001];
int res;

signed main(){

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

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

    prefsum[0]=arr[0];
    for(int i=1;i<n;i++){
        prefsum[i]=prefsum[i-1]+arr[i];
        prefsum[i]%=MOD;
    }

    res=0;
    for(int i=1;i<n;i++){
        res+=prefsum[i-1]*arr[i];
        res%=MOD;
    }

    cout<<res<<endl;

    return 0;
}


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

using i64 = long long int;

int main(){
    int d, n;
    cin >> d >> n;
    int num = 1;
    for(int i=0;i<d;++i){
        num *= 100;
    }
    cout << num * n + (n == 100 ? num : 0) << endl;

    return 0;
}


Measured memory_bytes: 256
//@formatter:off
#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 rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    ll ans = 0;
    rep2(i, 1, n) ans += (n - 1) / i;
    cout << ans << endl;
}

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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 1005;

int n, m, a, b;
char s[N][N];

inline void A(int x, int y) {
  if (a) {
    s[x][y] = '<', s[x][y + 1] = '>', --a;
  }
}

inline void B(int x, int y) {
  if (b) {
    s[x][y] = '^', s[x + 1][y] = 'v', --b;
  }
}

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n), Read(m), Read(a), Read(b);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      s[i][j] = '.';
    }
  }
  if ((n & 1) && (m & 1) && n >= 3 && m >= 3) {
    for (int i = 1; i < m; i += 2) {
      A(n, i);
    }
    for (int i = 2; i < n; i += 2) {
      B(i, m);
    }
    bool flg = false;
    if (a & 1) {
      A(1, m - 1), B(1, m - 2), flg = true;
    }
    for (int i = 1; i < n; i += 2) {
      for (int j = 1; j < m; j += 2) {
        if (i == 1 && j == m - 2 && flg) {
          continue;
        }
        if (a) {
          A(i, j), A(i + 1, j);
        } else if (b) {
          B(i, j), B(i, j + 1);
        }
      }
    }
  } else {
    if (n & 1) {
      for (int i = 1; i < m; i += 2) {
        A(n, i);
      }
    }
    if (m & 1) {
      for (int i = 1; i < n; i += 2) {
        B(i, m);
      }
    }
    for (int i = 1; i < n; i += 2) {
      for (int j = 1; j < m; j += 2) {
        if (a) {
          A(i, j), A(i + 1, j);
        } else if (b) {
          B(i, j), B(i, j + 1);
        }
      }
    }
  }
  if (a || b) {
    puts("NO");
  } else {
    puts("YES");
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        putchar(s[i][j]);
      }
      putchar(10);
    }
  }
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll n; cin >> n;
    set<int> se;
    for(int i = 0; i < n; ++i){
        ll a; cin >> a;
        if(se.count(a) != 0){
            cout << "NO" << endl;
            return;
        }
        se.insert(a);
    }
    cout << "YES" << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 9600
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
sa = [0]*n
wa = [0]*n

ans = 0
for i in range(n):
    sa[i] = a[i]-i
    wa[i] = a[i]+i
b = Counter(wa)
c = Counter(sa)
    
for i in b:
    ans += b[i]*c[-i]
            
print(ans)

Measured memory_bytes: 155808
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  string s;
  cin >> s;
  cout << s.substr(0, s.length()-8);
  return 0;
}


Measured memory_bytes: 256
#include<cstdlib>
#include<iostream>
#include<cmath>
using namespace std;
constexpr long long int LLINT_MAX = 1e18;

void Multiplication1() {
	int A, B;
	cin >> A >> B;
	cout << A * B;
}

void Multiplication2() {
	int N;
	bool isOverflow = false;
	long long int ans = 1;
	cin >> N;
	for (int i = 0; i < N; i++) {
		long long int num;
		cin >> num;
		if (num == 0) {
			cout << 0 << endl;
			return;
		}
		if (isOverflow || num > LLINT_MAX / ans) {
			isOverflow = true;
		}
		ans *= num;
	}
	if (isOverflow) cout << -1 << endl;
	else cout << ans;
}

void Multiplication3() {
	long long int A, ans;
	long double B;
	cin >> A >> B;
	ans = A * B;
	cout << ans;
}

bool IsPrime(long int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	long double sqrtNum = sqrt(num);
	for (long int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0) return false;
	}
	return true;
}

void DivGame() {
	long long int N;
	int e = 1;
	int ans = 0;
	cin >> N;
	if (N == 1) {
		cout << ans;
		return;
	}
	if (IsPrime(N)) {
		cout << 1;
		return;
	}
	for (long long int p = 2; p <= (long double)sqrt(N); p++) {
		if (IsPrime(p)) {
			long int z = p;
			while (N % z == 0) {
				N /= z;
				z *= p;
				ans++;
			}
		}
	}
	cout << ans;
}

int main() {
	Multiplication2();
	//DivGame();
}

Measured memory_bytes: 3196
var st,st1:string;
    yes:boolean;
    i:longint;
begin
  readln(st);
  readln(st1);
  yes:=true;
  for i:=1 to length(st) do
    if st[i]<>st1[3-i+1]
    then yes:=false;
  if yes
  then writeln('YES')
  else writeln('NO');
end.

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cstring>

//#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define int long long
typedef pair<int, int> P;

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

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

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

const ll INF = 1LL << 60;

signed main() {
    int card[14] = { -1,100,2,3,4,5,6,7,8,9,10,11,12,13 };
    int a, b; cin >> a >> b;
    string ans;
    if (card[a] == card[b]) {
        ans = "Draw";
    }
    else if (card[a] < card[b]) {
        ans = "Bob";
    }
    else {
        ans = "Alice";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( 1e9 + 7 )

int main()
{
	ll A, B;
	cin >> A >> B;

	// a ^ ( a + 1 ) == 1を利用する
	// また、a ^ a = 0から、F( A, B ) = F( 0, A - 1) ^ F( 0, B )である
	// -> ( 0 ^ 1 ^ 2 ^ ... (A - 1) ) ^ ( 0 ^ 1 ^ 2 ^ ... (A - 1) ^ A ^ ... B )
	//    となるので、 ( 0 ^ 0 ) ^ ( 1 ^ 1 ) ^ ... となり、(A-1)までは全て0となる
	ll rA = ( ( A / 2 ) % 2 );
	if ( A % 2 )
	{
		// 最大の偶数が残る
		rA ^= ( A - 1 );
	}

	ll rB = ( ( ( B + 1 ) / 2 ) % 2 );
	if ( ( B % 2 ) == 0 )
	{
		rB ^= B;
	}

	cout << ( rA ^ rB ) << endl;

	return ( 0 );
}


Measured memory_bytes: 888
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
VI e[SIZE];
int main(){
    int N,M;
    R(N,M);
    FOR(i,1,M){
        int x,y;
        R(x,y);
        e[y].PB(x);
    }
    int now=0;
    int an=0;
    FOR(i,2,N){
        for(int y:e[i]){
            if(y>now){
                an++;
                now=i-1;
            }
        }
    }
    W(an);
    return 0;
}


Measured memory_bytes: 25984
M = 1046527

def gen_h(key, i)
  ( h1(key) + i * h2(key) ) % M
end

def h1(key)
  key % M
end

def h2(key)
  1 + ( key % ( M - 1 ) )
end

def str2key(str)
  str.chars.map do |c|
    case c
    when 'A'; 1;
    when 'C'; 2;
    when 'G'; 3;
    when 'T'; 4;
    else
    end
  end.each.with_index.inject(0) do |acc, (n, idx)|
    acc += n * 5 ** idx
  end
end

def insert(str, store)
  i = 0
  key = str2key(str)
  loop do
    h = gen_h(key, i)
    break if store[h] == str
    break store[h] = str if store[h].nil?
    i += 1
  end
end

def find(str, store)
  i = 0
  key = str2key(str)
  ret = nil
  loop do
    h = gen_h(key, i)
    break ret = str if store[h] == str
    break ret = nil if store[h].nil?
    i += 1
  end
  ret
end

n = gets.to_i
store = []
n.times do
  c, str = gets.split
  case c
  when 'insert'
    insert(str, store)
  when 'find'
    puts find(str, store) ? 'yes' : 'no'
  else
  end
end


Measured memory_bytes: 37648
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;

class Program
{
    static readonly double INF = 1e20;

    static void Main(string[] args)
    {
        while (true)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int N = input[0], M = input[1], P = input[2], A = input[3] - 1, B = input[4] - 1;
            if (N == 0) break;
            int[] nums = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            double[][] dist = E.Range(0, M).Select(i => E.Repeat(INF, M).ToArray()).ToArray();

            for (int i = 0; i < P; i++)
            {
                input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                dist[input[0] - 1][input[1] - 1] = input[2];
                dist[input[1] - 1][input[0] - 1] = input[2];
            }
            double[][] dp = E.Range(0, 1 << N).Select(i => E.Repeat(INF, M).ToArray()).ToArray();
            dp[0][A] = 0;
            for (int mask = 0; mask < (1 << N); mask++)
                foreach (int use in E.Range(0, N).Where(use => (mask >> use & 1) == 0))
                    foreach (int i in E.Range(0, M).Where(i => dp[mask][i] < INF))
                        foreach (int j in E.Range(0, M).Where(j => i != j && dist[i][j] < INF))
                        {
                            double cost = dp[mask][i] + dist[i][j] / nums[use];
                            int nextMask = mask | 1 << use;
                            dp[nextMask][j] = Math.Min(dp[nextMask][j], cost);
                        }

            double ans = E.Range(0, 1 << N).Min(mask => dp[mask][B]);
            Console.WriteLine((ans == INF) ? "Impossible" : ans.ToString("f3"));
        }
    }
}

Measured memory_bytes: 6452
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int n;
    cin >> n;

    int two = 0, four = 0, other = 0;
    REP(i, n){
        int a;
        cin >> a;
        if(!(a % 4)) four++;
        else if(!(a % 2)) two++;
        else other++;
    }

    if(two){
        if(four >= other + 1){
            //4-1-4-1-4-2-2-2
            cout << "Yes" << endl;
            return 0;
        }else if(four == other){
            //2-2-2-4-1-4-1-4-1
            cout << "Yes" << endl;
            return 0;
        }else if(!(other)){
            cout << "Yes" << endl;
            return 0;
        }else if(!(other) and !(four)){
            cout << "Yes" << endl;
            return 0;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }else{
        //2の倍数がないとき 1-4-1-4-1みたいに挟べればOK
        cout << (four + 1 >= other ? "Yes" : "No") << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
//const long long MOD = 998244353;
long long MOD;

using namespace std;


void solve()
{
    int n, m;
    scanf("%d%d", &n, &m);

    printf("%d\n", n*(n - 1) / 2 + m * (m - 1) / 2);


    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1);I >= (A); --I)
const ll INF=1e18+3;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,m,k;
	cin>>n>>m>>k;
	bool ans = false;
	FOR(i,0,n+1){
		FOR(j,0,m+1){
			ll w = i*(m-j) + j*(n-i);
			if(w==k)ans = true;
		}
	}
	if(ans)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n, m = gets.split(" ").map{|s| s.to_i}

everyones_favorits = nil
(1..n).each {
  favorits = gets.split(" ").map{|s| s.to_i}[1..-1]
  if everyones_favorits.nil?
    everyones_favorits = favorits
  else
    everyones_favorits = everyones_favorits.select{ |favorit| favorits.include?(favorit) }
  end
}

puts(everyones_favorits.size)


Measured memory_bytes: 1916
#include <cstdio>
#include <vector>
#include <utility>
#include <tuple>
#include <iostream>

using namespace std;

int ne(int i, vector<int> &b) {
  while (i < (int)b.size()) {
    if (b[i] % 2 == 1) {
      break;
    }
    ++i;
  }
  return i;
}

int a[509][509];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      scanf("%d", a[i] + j);
    }
  }
  vector<int> b;
  vector<pair<int, int>> pos;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (i % 2 == 0) {
        b.push_back(a[i][j]);
        pos.emplace_back(i, j);
      } else {
        b.push_back(a[i][m - 1 - j]);
        pos.emplace_back(i, m - 1 - j);
      }
    }
  }
  vector<tuple<int, int, int, int>> ans;
  int i = ne(0, b);
  while (i < n * m) {
    int j = ne(i + 1, b);
    if (j >= n * m) {
      break;
    }
    for (int k = i; k < j; ++k) {
      ans.emplace_back(pos[k].first, pos[k].second, pos[k + 1].first, pos[k + 1].second);
    }
    i = ne(j + 1, b);
  }
  printf("%d\n", (int)ans.size());
  for (auto &e : ans) {
    printf("%d %d %d %d\n", get<0>(e) + 1, get<1>(e) + 1, get<2>(e) + 1, get<3>(e) + 1);
  }
}


Measured memory_bytes: 8168
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A,*B;
  int C[VMAX+1];
  int i,n,j;
    
  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  

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

  
  for(i = 0; i < VMAX; i++)
    C[i] = 0;
  
  for(j = 1; j <= n; j++)
    C[A[j]]++;

  for(i = 1; i < VMAX; i++)
    C[i] += C[i-1];

  for(j = n; j > 0; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
  for(i = 1; i <= n; i++){
    if( i != 1)
      printf(" ");
    printf("%d", B[i]);
  }

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


  



Measured memory_bytes: 9580
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

struct card {
	char mark;
	int num;
	bool operator!=(card c) const {
		return this->num != c.num || this->mark != c.mark;
	};
	bool operator<=(card c) const {
		return this->num <= c.num;
	};
	bool operator<(card c) const {
		return this->num <= c.num;
	};
};

queue<card> merge(queue<card> q1, queue<card> q2){
	queue<card> ma;
	while(q1.size() || q2.size()){
		if(!q2.size() || (q1.size() && q1.front() < q2.front())){
			ma.push(q1.front());
			q1.pop();
		}else{
			ma.push(q2.front());
			q2.pop();
		}
	}
	return ma;
}
queue<card> sort(queue<card> q){
	queue<card> nq;
	while(q.size() - nq.size() > 1){
		nq.push(q.front());
		q.pop();
	}
	if(!nq.size()) return q;
	return merge(sort(nq), sort(q));
}

int partition(card *A, int p, int r){
	card x = A[r];
	int i = p-1;
	for(int j = p; j <= r-1; j++){
		if(A[j] <= x){
			swap(A[j], A[++i]);
		}
	}
	swap(A[r], A[++i]);
	return i;
}

bool isStable(queue<card> q, card *c){
	int i = 0;
	while(q.size()){
		if(q.front() != c[i++]) return false;
		q.pop();
	}
	return true;
}

void sort(card *A, int p, int r){
	if(r-p < 1) return;
	int pivot = partition(A, p, r);
	sort(A, p, pivot-1);
	sort(A, pivot+1, r);
}

int main() {
	int n;
	cin >> n;
	
	card d[n];
	queue<card> qc;
	for(int i = 0; i < n; i++){
		cin >> d[i].mark >> d[i].num;
		qc.push(d[i]);
	}
	
	sort(d, 0, n-1);
	qc = sort(qc);
	
	cout << (isStable(qc, d) ? "S" : "Not s") << "table" << endl;
	for(int i = 0; i < n; i++){
		cout << d[i].mark << " " << d[i].num << endl;
	}
	
    return 0;
}

Measured memory_bytes: 5740
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(){
  int a,b;
  double c,ans;
  scanf("%d %d",&a,&b);
  a*=b;
  c=3.305785;
  ans=(double)a/c;
  printf("%lf\n",ans);
  return 0;
}



Measured memory_bytes: 2140
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>

#define CK(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long  LLINF = 1e18;

using namespace std;

int main(){

  string S;
  cin>>S;

  REP(i,0,S.size()){
    if(S[i] == '9'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }

  cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  long long A,B,N;
  cin>>A>>B>>N;
  
  long long x=min(B-1,N);
  
  cout<<A*x/B<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main(void)
{
    char text[10][1000],copy[10][1000];
    int lon, shuff, i, j, count, sum, k=0;
    
    while(1){
        sum=0;
        // 文字列の読み取り
        scanf("%s", text[k]);
        if(text[k][0]=='-') break;
        
        // 文字列の長さのを求める
        lon=strlen(text[k]);
        // シャッフル回数の読み取り
        scanf("%d", &shuff);
        // 実質的なシャッフルの計算
        for(i=0; i<shuff; i++){
            scanf("%d", &count);
            sum+=count;
        }
        sum%=lon;
        
        // 並び替え
        for(i = 0, j = 0; i < sum; i++, j++){
            copy[k][j] = text[k][i];
        }
        for(i = sum, j = 0; i < lon; i++, j++){
            text[k][j] = text[k][i];
        }
        for(i = 0, j = lon-sum; i < sum; i++, j++){
            text[k][j] = copy[k][i];
        }
        
        k++;
    }
    
    for(i=0; i<k; i++) printf("%s\n", text[i]);
    
    return 0;
}


Measured memory_bytes: 2112
read n;
for i in `seq $n`;do
	read s;
	a=(${a[@]} $s);
done
read m;
for i in `seq $m`;do
	read s;
	b=(${b[@]} $s);
done
s=0;
for i in ${a[@]};do
	t=0;
	for j in ${a[@]};do
		if [ $i = $j ];then
			t=$[t+1];
		fi
	done
	for j in ${b[@]};do
		if [ $i = $j ];then
			t=$[t-1];
		fi
	done
	if [ $s -lt $t ];then
		s=$t;
	fi
done
echo $s


Measured memory_bytes: 572
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

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

int main(){
    string s,a,b;
    int ans=0;
    cin>>s;
   for(int i=s.size()-2;i>0;i-=2){
       a=s.substr(0,i/2);
       b=s.substr(i/2,i/2);
       if(a==b){
           ans=a.size()*2;
           break;
       }
   }
   cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI; 
        double area = r*r*pi;
        double length = 2*r*pi;
        System.out.printf("%f %f", area, length);
    }
}


Measured memory_bytes: 28368
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

a, b = map(int, input().split())




def countNum(num):
    cnt = 0
    ans_cnt = []

    while(True):
        tmp_n = pow(2, cnt)
        tmp_n1 = pow(2, cnt+1)

        if tmp_n > num:
            return ans_cnt

        tmp_ans = (num // tmp_n1) * tmp_n + max(0, (num % tmp_n1) - (tmp_n - 1))
        ans_cnt.append(tmp_ans)
        cnt += 1


a_num = countNum(a-1)
b_num = countNum(b)

for i in range(len(a_num)):
    b_num[i] -= a_num[i]

cnt = 0
ans = 0
for b in b_num:
    if b % 2 == 1:
        ans += pow(2, cnt)
    cnt += 1

print(ans)







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

int main(void){
    string s1, s2, s3;
    string result;
    cin >> s1 >> s2 >> s3;
    result[0] = s1[0]-'a'+'A';
    result[1] = s2[0]-'a'+'A';
    result[2] = s3[0]-'a'+'A';

    printf("%c%c%c",result[0],result[1],result[2]);
    
    return 0;
}

Measured memory_bytes: 256
p1, p2 = map(int, input().split())

def gcd(a, b):
    if a == 0:
        return b
    return gcd(b % a, a)

def lcm(a, b):
    return (a*b) / gcd(a, b)

lcm = lcm(p1, p2)
print(int(lcm))

Measured memory_bytes: 2940
# -*- coding: utf-8 -*-
"""
B - Path
https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_b

"""
import sys


def solve(path):
    res = [0] * 5
    for a, b in path:
        res[a] += 1
        res[b] += 1
    res.sort()
    if res == [0, 1, 1, 2, 2]:
        return 'YES'
    return 'NO'


def main(args):
    path = [[int(i) for i in input().split()] for _ in range(3)]
    ans = solve(path)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

int main()
{
    int a, b;

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

       if( a >= 13 ) printf("%d\n", b );
       else if( 6 <= a && a <= 12 ) printf( "%d\n", b / 2 );
       else printf( "0\n");
       return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    ll n,k; cin>>n>>k;
    vector<ll> p(n),c(n);
    rep(i,n) cin>>p[i], --p[i];
    rep(i,n) cin>>c[i];
    /*tmp = 23514205912
    ans2 = 26453481651*/

    vector<ll> lc(n), lv(n);
    auto loop = [&] (ll idx) {
        ll goal = idx;
        ll cur = p[goal];
        ll s = c[cur];
        ll cnt = 1;
        while (cur != goal) {
            cur = p[cur];
            cnt++;
            s += c[cur];
        }
        lc[idx] = cnt;
        lv[idx] = s;
    };

    rep(i,n) loop(i);

    auto simu = [&] (ll idx, ll cnt, ll q) -> ll {
        ll ret = -LINF*2;
        ll tmp = q;
        ll cur = idx;
        while (cnt--) {
            cur = p[cur];
            tmp += c[cur];
            chmax(ret, tmp);
        }
        return ret;
    };

    ll ans = -LINF*2;
    if (k < 10000) {
        rep(i,n) {
            chmax(ans, simu(i,min(k,15000ll), 0ll));
        }
    }
    else {
        rep(i,n) {
            //cout << "i = " << i << '\n';
            //cout << "lv[i] = " << lv[i] << '\n';
            //cout << "lc[i] = " << lc[i] << '\n';
            ll v = lv[i];
            ll cnt = lc[i];
            if (v <= 0) {
                chmax(ans, simu(i, min(cnt, 10000ll), 0ll));
            }
            else {
                ll sho = k/cnt;
                ll yo = k%cnt;
                sho--;
                yo += cnt;
                ll tmp = 0;
                tmp += v*sho;
                if (chmax(ans, simu(i,yo,tmp))) {
                    //cout << "i = " << i << '\n';
                    //cout << "ans = " << ans << '\n';
                }
            }
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3760
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){
    ll n;
    cin>>n;
    map<string,ll> m;

    forn(i,n){
        string s;
        cin>>s;
        auto it=m.find(s);
        if(it==m.end()) m.insert(mp(s,1));
        else m[s]++;
    }
    cout<<m.size();
}

Measured memory_bytes: 19228
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;

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

  while(n > 0) {
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double px, py ,r;

    double a1, a2, b1,b2,c1,c2;
    
    a1 = 2*(x2-x1);
    a2 = 2*(x3-x1);
    b1 = 2*(y2-y1);
    b2 = 2*(y3-y1);
    c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
    c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
    px = (b1*c2-b2*c1)/(a1*b2-a2*b1);
    py = (c1*a2-c2*a1)/(a1*b2-a2*b1);
    r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    
    cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
    n--;
  }
  
  return 0;
}

Measured memory_bytes: 1288