akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <typeinfo>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;
typedef vector<vector<string>> vvs;

constexpr int dir[4][2] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 } };



int main()
{
	int N;
	cin >> N;
	vvi A(2, vi(N));
	rep(i, 2)rep(j, N) cin >> A[i][j];

	int ans = 0;
	int ansb = 0;

	vi one(N + 1, 0);
	vi two(N + 1, 0);
	
	rep(i, N)
	{
		one[i + 1] = A[0][i];
		two[i + 1] = A[1][i];
	}

	rep(i, N)
	{
		one[i + 1] += one[i];
		two[i + 1] += two[i];
	}

	rep(i, N)
	{
		ans = max(ans, one[i + 1] + two[N] - two[i]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,maxn=10000010;
const double eps=1e-8,pi=acos(-1.0);
const int inf=0x7f7f7f7f;
using namespace std;
int a[maxn];
string s;
signed main()
{
	ios::sync_with_stdio(0);
	int n,a,b,ans=0;
	cin >> n >> a >> b;
	rep(i,3,n)
	{
		int x;
		cin >> x;
		ans ^= x;
	}
	if((a+b-ans)<0||(a+b-ans)&1)
	{
		cout<<"-1\n";
		return 0;
	}
	int res = a+b-ans>>1ll;
	if(res>a)
	{
		cout<<"-1\n";
		return 0;
	}
	per(i,50,0)
		if((1ll<<i)&ans)
			if(res+(1ll<<i)<=a)
				res+=(1ll<<i);
	if(((a+b-res)^res)!=ans||res==0)
	{
		cout << "-1\n";
		return 0;
	}
	cout << a-res;
	return 0;
}


Measured memory_bytes: 3608
from math import ceil

def votes(t, a):
    def ceil(a, b):
        return (a + b - 1) // b
    
    votes_t = votes_a = 1
    for i in range(len(t)):
        k = max(ceil(votes_t, t[i]), ceil(votes_a, a[i]))
        votes_t = t[i] * k
        votes_a = a[i] * k
    return votes_t + votes_a


if __name__ == '__main__':
    lines = [list(map(int, input().split())) for _ in range(int(input()))]
    t = [l[0] for l in lines]
    a = [l[1] for l in lines]
    print(votes(t, a))


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

using namespace std;
int dp[1002][1002];
int main(){
    int T;
    cin>>T;
    while(T--){
        #ifdef LCS
        string s;
        cin>>s;
        int len=s.size();
        int *dp=new int[len+1];
        dp[0]=1;
        int ans=1;
        for(int i=1;i<len;i++){
            char ch=s[i];
            int cnt=0;
            for(int j=0;j<=i-1;j++){
                if(s[j]<ch) cnt=max(cnt,dp[j]);
            }
            dp[i]=cnt+1;
            ans=max(ans,dp[i]);
        }
        cout<<ans<<endl;
        #endif//LCS
        string s1,s2;
        cin>>s1>>s2;
        int len1=s1.size(),len2=s2.size();
        int len=max(len1,len2);
        for(int i=0;i<=len;i++) {
            dp[0][i]=0;
            dp[i][0]=0;
        }
        int ans=0;
        for(int i=0;i<len1;i++){
            for(int j=0;j<len2;j++){
                if(s1[i]==s2[j]) dp[i+1][j+1]=dp[i][j]+1;
                else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
            }
        }
        cout<<dp[len1][len2]<<endl;
    }
}

Measured memory_bytes: 7064
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut py = (0..m).map(|idx| {
        let p: usize = sc.read();
        let y: usize = sc.read();
        (p, y, idx)
    }).collect::<Vec<(usize, usize, usize)>>();
    py.sort_by(|x, y| x.1.cmp(&y.1));
    let mut cities_cnt = vec![0; n + 1];

    let mut result = py.iter().map(|x| {
        let p = x.0;
        let y = x.1;
        let idx = x.2;
        let upper = format!("{:06}", p);
        let bottom = format!("{:06}", cities_cnt[p] + 1);
        cities_cnt[p] += 1;
        (idx, upper + &bottom)
    }).collect::<Vec<(usize, String)>>();
    result.sort_by(|x, y| x.0.cmp(&y.0));

    for x in result {
        println!("{}", x.1);
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 17916
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <boost/multi_array.hpp>

int main() {
    long long N, H;
    std::cin >> N >> H;
    
    std::vector<std::vector<long long>> arr;
    std::priority_queue<long long> que;
    
    //取る行動は最もaの大きい剣を振るか、最もbの大きい剣を投げるか
    //投げるのは最後にまとめて投げていけば良い
    //全て投げた場合のダメージ合計をメモしておき、全て投げれば倒せる状態になったら投げる選択肢を考えれば良い
    
    long long maxa = 0;
    //long long sumth = 0;
    long long hrem = H;
    
    for (int i = 0; i < N; i++) {
        long long a, b;
        std::cin >> a >> b;
        arr.push_back({a, b});
        maxa = std::max(maxa, a);
    }
    //投げても切る最大を超えられない武器は不要なのでそもそも記録しなくていい
    for (int i = 0; i < N; i++) {
        long long b;
        b = arr[i][1];
        if (maxa <= b) {
            //sumth += b; //これはオーバーフローする
            hrem -= b;
            que.push(b);
        }
    }
    //この段階で、投げる攻撃は切るより効率的なので、切り終えたら全て投げていけば良い
    //hremが負の場合、切らずに投げていけば良い
    long long ans = 0;
    if (hrem > 0) {
        ans = hrem / maxa;
    }
    long long h = H - maxa * ans;
    while (h > 0) {
        h -= que.top();
        que.pop();
        ans += 1;
    }

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


Measured memory_bytes: 7856
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B int
	fmt.Scan(&A, &B)

	var x1, x2 float64
	res := 0
	for i := 1; i <= 12500; i++ {
		x1 = math.Floor(float64(i) * 0.08)
		x2 = math.Floor(float64(i) * 0.1)
		// fmt.Println(x1, x2)

		if int(x1) == A && int(x2) == B {
			res = i
			break
		}
	}

	if res == 0 {
		res = -1
	}
	fmt.Println(res)

}


Measured memory_bytes: 512
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <algorithm>   //sort,二分探索,など
#include <bitset>      //固定長bit集合
#include <chrono>      //実行時間計測
#include <cmath>       //pow,logなど
#include <complex>     //複素数
#include <deque>       //両端アクセスのキュー
#include <functional>  //sortのgreater
#include <iomanip>     //setprecision(浮動小数点の出力の誤差)
#include <iostream>    //入出力
#include <iterator>    //集合演算(積集合,和集合,差集合など)
#include <map>         //map(辞書)
#include <numeric>     //iota(整数列の生成),gcdとlcm,accumulate
#include <queue>       //キュー
#include <set>         //集合（順序保持）
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility> //pair
#include <vector>  //可変長配列
using namespace std;
typedef long long ll;
typedef long double ld;

#define REP(i, n) for (int i = 0; i < ll(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < ll(b); i++)
#define FORD(i, a, b) for (int i = a; i > ll(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size()) // sizeをsize_tからllに直しておく
const long long INF = 1e12;
const int MOD = 1e9 + 7;
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define Umap unordered_map
#define Uset unordered_set
#define int long long
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed#c%E3%81%A7%E3%81%AE%E5%AE%9F%E8%A3%85
void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T> void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}

template <class T> void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}
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;
}

signed main() {

    REP(i, 5) {
        int a;
        cin >> a;
        if (a == 0) {
            print(i + 1);
            break;
        }
    }
}


Measured memory_bytes: 3560
/*
coded by : Bissultanov Yedyge;
:)
¤
•
¦
§
*/
#include <bits/stdc++.h>
 
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
 
#define mp make_pair
#define np next_permutation
 
#define bg begin()
#define ed end()
 
#define int long long
#define ioi return 0;
 
#define sz size()
#define fix fixed<<setprecision
 
#define lb lower_bound
#define ub upper_bound
 
#define fr first
#define sc second
 
#define pb push_back
#define ppb pop_back
 
#define pf push_front
#define ppf pop_front
 
typedef long double ld;
typedef unsigned long long ull;
 
const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
 
using namespace std;
 
int ans, cnt;
int n , m;
int a[N] , b[N];
string s;

main(){
	ios
		cin >> s;
		for ( int i = 0 ; i < s.sz ; ++i ){
			if ( s[i] == '0' )ans++;
			if ( s[i] == '1' )cnt++;
		}
		if ( ans == 0 || cnt == 0 ){
			cout << 0;
			ioi
		}
		cout << min(ans,cnt)*2;
	ioi	
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;


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

    string s; cin >> s;
    bool flg=true;

    rep(i, s.size()){
        if(i%2==0 && s[i]=='L') flg=false;
        else if(i%2==1 && s[i]=='R') flg=false;
    }

    if(flg) cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
}

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

int v[101];
int main(){
    int n,m,di,vi;
    while(cin>>n>>m,n|m){
        memset(v,0,sizeof(v));
        rep(i,n){
            cin>>di>>vi;
            --di;
            v[di]=max(v[di],vi);
        }
        int sum=0;
        rep(i,m) sum+=v[i];
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k,ll p) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, k, s;
int solve(int x, int y, int z) {
	if (x == k) {
		if (z == s) return 1;
		else return 0;
	}
	int sum = 0;
	for (int i = y + 1; i + (k - x) - 1 <= n&&z + ari(i, i + (k - x) - 1, (k - x)) <= s; i++) {
		sum += solve(x + 1, i, z + i);
	}
	return sum;
}
signed main() {
	while (cin >> n >> k >> s&&n + k + s > 0) {
		cout << solve(0, 0, 0) << endl;
	}
	getchar(); getchar();
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstdio>
#include <string>
using namespace std;
#define loop(i,n) for(int i = 0; i < (n); i++)
#define loops(i,f,n) for(int i = (f); i < (n); i++)
#define VEC vector<int>
#define INF INT_MAX
#define debug(a) cout<<a
// vector<VEC> v (n, VEC(n))
VEC timeline(482, 0);

int main()
{
		string a, b, c;
		cin >> a;
		b = a.substr(0, 4);
		if (b == "YAKI")cout << "Yes" << endl;
		else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int N, n;
vector<ll> v(0);

int main(){
    cin >> N;
    int iter = 0;
  	double tot = 0;
    REP(i,N){
        ll a;
        cin >> a;
        v.push_back(a);
      tot += 1.0*a;
    }
    double half = 0;
    while (half < tot/2){
        half += 1.0*v[iter];
        ++iter; 
    }
    ll left = (tot/2-half + v[iter - 1])*2+0.25;
    ll right = (half - tot/2)*2+0.25;
    if(iter > 1 && iter < N){
        cout << min((ll)left,  (ll)right)<<"\n";
    }
    else if(iter == 1){
        cout << (ll)right << "\n";
    }
    else if(iter == N){
        cout << (ll)left << "\n";
    }
}



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

int main(){
  long N,sum=0;
  cin >> N;
  for(long i=1; i*i<N; i++){
    if(N%i==0&&i<N/i-1){
      sum+=N/i-1;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b);
#define chmin(a, b) (a)=min(a, b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  
  ll a, b, c, K;
  cin >> a >> b >> c >> K;
  
  if(abs(a-b)>INF) pt("Unfair");
  else if(K&1) pt(b-a);
  else pt(a-b);
  
}





Measured memory_bytes: 256
x,y,a,b,c = (int(x) for x in input().split())

from bisect import insort

p_list = list(map(int,input().split()))
q_list = list(map(int,input().split()))
r_list = list(map(int,input().split()))


p_list.sort()
q_list.sort()
r_list.sort()

red = 0
green = 0
white = 0

sum_num = 0

for i in range(1,x+y+1):
  if red < x:
  	red_num = p_list[(red*-1)-1]
  else:
    red_num = 0
  if green < y:
  	green_num = q_list[(green*-1)-1]
  else:
    green_num = 0
  if white < c:
  	white_num = r_list[(white*-1)-1]
  else:
    white_num = 0
  
  max_p = max([red_num,green_num,white_num])
  sum_num += max_p
  if max_p == white_num:
    white += 1
  elif max_p == red_num:
    red += 1
  elif max_p == green_num:
    green += 1

print(sum_num)

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

int main() {
    int N;
    cin >> N;
    int max = 0;
    int ans = 1;
    for (int i = 1; i <= N; i++)
    {
        int a = i;
        int count = 0;
        while (a % 2 == 0)
        {
            a /= 2;
            count++;
        }
        if(max < count) {
            max = count;
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3524
x,y=map(int,input().split())
MOD=10**9+7
ans=0
if y>x:
    x,y=y,x

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = MOD #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for a in range(1,x//2+1):
    b=x-2*a
    if 2*b+a==y:
        tmp=cmb(b+a,a,mod)%MOD
        ans+=tmp
        ans%=MOD

print(ans)




Measured memory_bytes: 123808
// Devarshi
#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; }

const ll maxn=1000001,mod=1e9+7;

int main(){
    sync
    int n;
    cin>>n;
    int a,b;
    cin>>a>>b;
    int x,y,z;
   // cout<<a<<endl;
    x=y=z=0;
    while(n--){
        int w;
        cin>>w;
        if(w<=a){
            x++;
        }
        else if(w>a&&w<=b){
            y++;
        }
        else{
            z++;
        }
    }
    cout<<min(x,min(y,z));
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    int ok = 0, ng = n / 2 + 1;
    while (ng - ok > 1) {
        int med = (ng + ok) / 2;
        map<string, vector<int> > m;
        rep (i, s.size() - med + 1) m[s.substr(i, med)].push_back(i);
        bool flg = false;
        for (auto x : m) {
            vector<int> tmp = x.second;
            sort(all(tmp));
            if (tmp.back() - tmp.front() >= med) {
                eprintf("%s:%d\n", x.first.c_str(), med);
                flg = true;
                break;
            }
        }
        if (flg) ok = med;
        else ng = med;
    }
    cout << ok << "\n";
    return 0;
}

Measured memory_bytes: 6784
#include <stdio.h>
int main(){
    int W,H,x,y,r;
    W=H=x=y=0;
    scanf("%d",&W);
    scanf("%d",&H);
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&r);
    if(x-r<0||x+r>W||y-r<0||y+r>H){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 1812
$extra = [",", ".", " ", "\n"]
class Caesar < String
  def nexta(n = 1)
    y = Caesar.new
    self.each_char do |x|
      n.times {x = x.next} if not $extra.include?(x)
      y << x[-1]
    end
    return y
  end
end
$word = ["the", "this", "that"]
def decoded?(caesar)
  caesar.each do |i|
    if $word.include?(i)
      return true
    end
  end
  return false
end
#main
arr = Array.new
while line = gets
  arr << line
end
arr.each do |i|
  a = i.split(" ")
  0.upto(a.length - 1) do |j|
    c = Caesar.new(a[j])
    a[j] = c
  end
  until decoded?(a)
    a = a.map{|j| j.nexta}
  end
  puts a.join(" ")
end  

Measured memory_bytes: 6112
n = int(input())
w = [input() for _ in range(n)]

flag = True

before = w[0][0]
for i in w:
    if before != i[0]:
        flag = False
    before = i[-1]
    
if len(set(w))!=n:
    flag = False
    
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
N = int(input())
alpha = [chr(i) for i in range(97, 97+26)]
dic = {i:100 for i in alpha}
for _ in range(N):
    tmpdic = {i:0 for i in alpha}
    S = input()
    for s in S:
        tmpdic[s] += 1
    for i in alpha:
        if tmpdic[i] < dic[i]:
            dic[i] = tmpdic[i]
ans =[]
for i in alpha:
    for _ in range(dic[i]):
        ans.append(i)
print(''.join(ans))

Measured memory_bytes: 39024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	int d[11];
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	int ans = 0;
	for (int i = n; i < 10000000;i++) {
		string s = to_string(i);
		for (int j = 0; j < k; j++) {
			for (int k = 0; k < s.length(); k++) {
				char c = '0' + d[j];
				if (s[k] == c) {
					goto an;
				}
			}
		}
		ans = i;
		break;
	an:continue;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	multiset<int> mu;
	for(int i = 0; i < n; i++) mu.insert(a[i]);
	for(int i = 0; i < n; i++){
		mu.erase(mu.find(a[i]));
		cout << *(--mu.end()) << endl;
		mu.insert(a[i]);
	}
	return 0;
}


Measured memory_bytes: 11776
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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


int main() {
    int a, b, k;
    set<int> s;
    
    cin >> a >> b >> k;
    for(int i = a; i < a + k && i <= b; i++){
        s.insert(i);
    }
    for(int i = b; i > b - k && i >= a; i--){
        s.insert(i);
    }
    
    for(auto x : s){
        cout << x << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    string s;cin>>s;
    string ans="";
    rep(i,s.size()){
        if(i%2==0){
            ans+=s.at(i);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3652
def solve():
  S = input()
  N = len(S)
  dp1,dp2 = [0]*(N+1),[0]*(N+1)
  dp1[1] = 1
  for i in range(2,N+1):
    dp1[i] = dp2[i-1]+1
    if S[i-1]!=S[i-2]:
      dp1[i] = max(dp1[i-1]+1,dp1[i])
    dp2[i] = dp1[i-2]+1
    if i<4 or S[i-2:i]!=S[i-4:i-2]:
      dp2[i] = max(dp2[i],dp2[i-2]+1)
  ans = max(dp1[-1],dp2[-1])
  return ans
print(solve())

Measured memory_bytes: 24748
n = int(input())
a = list(map(int, input().split()))

rec = [0] * n

def check(k):
    off = []
    on = []
    flag = 0
    for i in range(n):
        if (a[i]>>k)&1:
            flag += 1
            on.append(i)
        else:
            off.append(i)

    if flag%2 == 0:
        for i in on:
            rec[i] += pow(2, k)
    else:
        for i in off:
            rec[i] += pow(2, k)

for i in range(31):
    check(i)
print(*rec)



Measured memory_bytes: 171336
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n;
  scanf("%d\n", &n );

  int *a = ( int * )malloc( n * sizeof( int ) );

  for( int i = 0; i < n; i ++ ){
    scanf("%d", a + i );
  }

for( int k = 0; k < n - 1; k ++ )
      printf("%d ", a[ k ] );
    printf("%d\n", a[ n - 1 ] );
    
  for( int i = 1; i < n; i ++ ){
    int key = a[ i ];
    int j = i - 1;
    while( j >= 0 && a[ j ] > key ){
      a[ j + 1 ] = a[ j ];
      j --;
    }
    a[ j + 1 ] = key;
    for( int k = 0; k < n - 1; k ++ )
      printf("%d ", a[ k ] );
    printf("%d\n", a[ n - 1 ] );
  }
  return 0;
}


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

int main(){
    int n,d=1;
    scanf("%d",&n);
    char s[n];
    scanf("%s",s);
    for(int i=1;i<n;i++){
        if(strncmp(&s[i],&s[i-1],1)!=0){
            d++;
        }
    }
    printf("%d\n",d);
    return 0;
}

Measured memory_bytes: 256
# import math
import fractions

a, b, c, d = [int(ch) for ch in input().strip().split()]


# upper 以下で div で割り切れるものの個数
def num_divisor(upper, div):
    return upper // div


# upper 以下で c でも d でも割り切れないものの個数
def num_divisor_c_d(upper, c, d):
    # gcd_cd = c * d // math.gcd(c, d)
    gcd_cd = c * d // fractions.gcd(c, d)

    n1 = num_divisor(upper, c)
    n2 = num_divisor(upper, d)
    n12 = num_divisor(upper, gcd_cd)

    return upper - (n1 + n2 - n12)


ans = num_divisor_c_d(b, c, d) - num_divisor_c_d(a - 1, c, d)

print(ans)


Measured memory_bytes: 5076
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
long long int __lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
 //__gcd 最大公約数
 //__lcm 最小公倍数
 //double 少数（変数）
//sqrt ルート
//ceil 天井関数
//floor 床関数
//abs 絶対値
 
int main() {
  int a,b;
  cin>>a>>b;
  if(a%2019>=b%2019||b-a>=2019)
    cout<<0;
  else{
    int c=2019;
    for(int i=a%2019;i<b%2019+1;i++)
      for(int j=a%2019;j<b%2019+1;j++)
        if(i!=j)
          c=min(c,(i*j)%2019);
    cout<<c;
    }
  }

Measured memory_bytes: 256
#ifdef __APPLE__
  #include "/Users/shizuku/Dropbox/dev/cpp/base_cmake_project_external/frankchen0130/bits/stdc++.h"
#else
  #include "bits/stdc++.h"
#endif
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void _main() {
  int N, M, X;
  cin >> N >> M >> X;
  int less = 0, greater = 0;
  rep(i, 0, M) {
    int t;
    cin >> t;
    if (X > t) less++;
    else greater++;
  }

  int ans = min(less, greater);
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<math.h>
#define ll long long int
#define d double 
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    
    ll x;
    cin>>x;
    ll s=0;
    ll q;
    
	if(x>=500){
	  q=x/500;
	  s=s+(q*1000);
	  x=x%500;
	 } 
	 
	 if(x>=5){
	  q=x/5;
	  s=s+(q*5);
	  x=x%5;	
	 }
	 cout<<s<<endl;
	 return 0;	
}
	

Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define nl n<<1
#define nr (n<<1)|1
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-9;
const ll mod=1e9+7;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' | ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0' && ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void Out(int aa)
{
    if(aa>9)
        Out(aa/10);
    putchar(aa%10+'0');
}
int a[100010];
map<int,int>mapp;
int main()
{
    int n=read();
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int x=read();
        if(mapp[x])
        {
            ans--;
            mapp[x]=0;
        }
        else
        {
            ans++;
            mapp[x]=1;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  while (n != 0) {
    n /= k;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;


int main(){
	int l, r, d, ans = 0;
	cin >> l >> r >> d;
	for (int i = l; i <= r; i++){
		if (i % d == 0){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int H, W;
std::string a[112];
int cou[100];
std::vector<std::pair<int, char>>list;
std::string field[112];

int main()
{
	in >> H >> W;
	rep(i, H)
	{
		in >> a[i];
		field[i].resize(W);
	}

	rep(i, H)
	{
		for (auto c : a[i]) { ++cou[c - 'a']; }
	}
	for (char c = 'a'; c <= 'z'; ++c) { list.push_back(std::make_pair(cou[c - 'a'], c)); }
	std::sort(list.begin(), list.end());
	rep(i, H)
	{
		rep(j, W)
		{
			if (field[i][j] == '\0')
			{
				bool ok = false;
				std::set<std::pair<int, int>>cell;
				cell.insert(std::make_pair(i, j));
				cell.insert(std::make_pair(H - 1 - i, j));
				cell.insert(std::make_pair(i, W - 1 - j));
				cell.insert(std::make_pair(H - 1 - i, W - 1 - j));
				int need = cell.size();
				for (auto& k : list)
				{
					if (k.first >= need)
					{
						ok = true;
						k.first -= need;
						field[i][j] = field[H - 1 - i][j] = field[i][W - 1 - j] = field[H - 1 - i][W - 1 - j] = k.second;
						break;
					}
				}
				if (!ok)
				{
					out << "No" << std::endl;
					return 0;
				}
			}
		}
	}
	out << "Yes" << std::endl;
	return 0;
}

Measured memory_bytes: 256
;; -*- coding:utf-8 -*-

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0))))

(defmacro print-line (obj &optional (stream '*standard-output*))
  `(prog1 (princ ,obj ,stream) (terpri ,stream)))


;; Hauptteil

(deftype uint nil `(integer 0 ,(expt 10 9)))
(defun main ()
  (let ((n (read))
        (k (read)))
    (print-line (if (zerop (mod n k)) 0 1))))

#-swank(main)



Measured memory_bytes: 13288
// inputに入力データ全体が入る
function Main(input) {

  var inp = input.split('\n');
  var N = inp[0];
  var tmp = inp[1].split(' ');
  var tmp2 = inp[2].split(' ');
  var A = new Array;
  A[0] = new Array;
  A[1] = new Array;

  // console.log(tmp2);


  for (var i = 0; i < 2; i++) {
    for (var j = 0; j < N; j++) {
      if (i === 0) {
        A[i][j] = parseInt(tmp[j]);
      } else if (i === 1) {
        A[i][j] = parseInt(tmp2[j]);
      }
    }
  }
  // console.log(A);
  var maxVal = 0;
  var tmp = 0;
  for(var tmp = 0; tmp <= N - 1; tmp++) {
    var sum = 0;
    for (var l = 0; l <= N - 1 - tmp; l++) {
      sum += A[0][l];
    }
    for (var m = N - 1 - tmp; m <= N - 1; m++) {
      sum += A[1][m];
    }
    if (sum > maxVal) maxVal = sum;
    // console.log(maxVal);
  }
  console.log('%d', maxVal);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  long long h;
  cin >> h;
  
  long long c = 1;
  long long result = 0;
  while(h != 0) {
    h /= 2;
    result += c;
    c *= 2;
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<climits>
using namespace std;

int main() {
  long long ans=0;
  int K = 0;
  int N = 0;
  long long tmp = 0;
  int cnt = 0;

  cin >> N;
  vector<int> V(N), C(N), A(N);
  for(long i = 0; i < N; i++){
    cin >> V[i];
  }
  for(long i = 0; i < N; i++){
    cin >> C[i];
  }
  for(long i = 0; i < N; i++){
    A[i] = V[i] - C[i];

    if(A[i] > 0){
      ans += A[i];
    }
  }
  
  
  cout << ans << endl;
}


Measured memory_bytes: 256
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) ((a + b - 1) / b)
#define tomax(a, b) (a = max(a, b))
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}

//#define TEST

using namespace std;
using namespace __gnu_pbds;

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

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

int main(){
    StarBurstStream

    int n;
    cin >> n;

    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1));
    vector<ll> s(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> s[i];
        s[i] += s[i - 1];
    }

    for(int len = 1; len < n; len++){
        for(int l = 1; l + len <= n; l++){
            int r = l + len;
            dp[l][r] = 1LL << 60;
            for(int k = l; k < r; k++){
                dp[l][r] = min(dp[l][r], dp[l][k] + dp[k + 1][r] + s[r] - s[l - 1]);
            }
        }
    }

    cout << dp[1][n] << "\n";

    return 0;
}

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

int main() {
  int n;
  std::cin >> n;
  std::vector<int> ary(n);
  for (int i = 0; i < n; i++) {
    std::cin >> ary[i];
  }
  std::sort(ary.begin(), ary.end());

  int a = 0;
  for (int i = 0; i < n; i+=2)
    a += ary[i];
  int b = 0;
  for (int i = 1; i < n; i+=2)
    b += ary[i];
  int ans = 0;
  if (a > b) ans = a - b;
  else ans = b - a;

  std::cout << ans;

  return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;

  if (A+B > C+D) {
  cout << "Left" << endl;
  }    
  else if(A+B < C+D) {
  cout << "Right" << endl;
  }
  else{
  cout << "Balanced" << endl;
  } 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>
main()
{
    char line[1200];
    fgets(line,sizeof(line),stdin);
    int i,j;
    for(i=0;i<strlen(line);i++)
    {
        char l;
        l = line[i];
        if (isalpha(l))
        {
            if (toupper(l) == l)
            {
                printf("%c",tolower(l));
            }
            else
            {
                printf("%c",toupper(l));
            }
        }
        else if (l == '\0')
        {
            exit(1);
        }
        else
        {
            printf("%c",l);
        }
    }
    return;
}


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

int main(){
  int i,j,n,a[10];
  while(cin >> n){
    for(i=0;i<10;i++){
      a[i] = 0;
    }

    for(i=9;i>=0;i--){
      if(n >= pow(2,(double)i)){
	n -= (int)pow(2,(double)i);
	a[i++]++;
      }
    }

    
    for(i=0;i<10;i++){
      if(a[i] > 0){
	cout << pow(2,(double)i);
	a[i]--;
	break;
      }
    }
    
    for(i=0;i<10;i++){
      for(j=0;j<a[i];j++){
	cout << " " << pow(2,(double)i);
      }
    }
    cout << endl;

  }
  return 0;
}

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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int X, Y, A, B, C;
  while(cin >> X >> Y >> A >> B >> C){
    vector<i64> p(A), q(B), r(C);
    cin >> p >> q >> r;

    sort(RALL(p));
    sort(RALL(q));

    vector<i64> a;
    a.insert(a.end(), p.begin(), p.begin() + X);
    a.insert(a.end(), q.begin(), q.begin() + Y);
    a.insert(a.end(), ALL(r));

    sort(RALL(a));
    auto ans = accumulate(a.begin(), a.begin() + X + Y, 0LL);
    
    pout(ans);
  }


  return 0;
}


Measured memory_bytes: 6848
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const long long M = 1000000007;

map<int,vector<int> > loc;
LL g(int a, bool op)
{
	vector<int>& v=loc[a];
	vector<int>& z=loc[0];
	LL ca=1;
	LL cz=1;
	auto it=lower_bound(z.begin(),z.end(),v[0]);
	for(int i=1;i<v.size();i++){
		auto jt=lower_bound(it,z.end(),v[i]);
		cz+=ca*(jt-it)%M;
		cz%=M;
		ca+=cz;
		ca%=M;
		it=jt;
	}
	return op?ca:cz;
}
// powmod p^n%mod
LL powmod(LL p,LL n,LL mod){
	LL q=p%mod;
	LL pow=1;
	while(n){
		if(n&1){
			pow*=q;
			pow%=mod;
		}
		q=q*q;
		q%=mod;
		n/=2;
	}
	return pow;
}
void solve(long long N, std::vector<long long> A){
	int v=0;
	for(int i=0;i<A.size();i++){
		v^=A[i];
		loc[v].push_back(i);
	}
	//cerr << v << endl;
	if(v!=0){
		cout << g(v,false) << endl;
		return;
	}
	LL ret=0;
	for(auto it=loc.begin();it!=loc.end();it++)
	{
		if(it->first==0){
			ret+=powmod(2,it->second.size()-1,M);
			ret%=M;
		}
		else{
			ret+=g(it->first,true);
			ret%=M;
		}
	}
	cout << ret << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 36212
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>

using namespace std;

const int maxn = 102;

const int INF = 10000000;

int d[maxn][maxn], dist[maxn][maxn];

int n, m;

int main()
{
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      dist[i][j] = (j == i ? 0 : INF);
  for (int i = 0; i < m; i++)
  {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    d[a][b] = d[b][a] = dist[a][b] = dist[b][a] = c;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (dist[i][j] == d[i][j] && d[i][j] != 0 && d[i][j] != INF)
        m--;
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007
#define inf 9999999999999999ll
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    if(k%2)
    {
        ll x=n/k;
        ll ans=x*x*x;
        cout<<ans<<endl;
    }
    else
    {
        ll x=n/k;
        ll ans1=x*x*x;
        ll num=(n/(k/2));
        ll ans2=(num+1)/2;
        ll ans=ans1+ans2*ans2*ans2;
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
#define p(x) cout<<(x)<<endl

int main() {
  int n,x; cin >> n >> x;
  vector<int> ms(n);

  int mi; mi = 0;
  rep(i, n) {
    cin >> ms.at(i);
    mi += ms.at(i);
  }

  int lv = x - mi;
  sort(ms.begin(), ms.end());
  p(n+(lv/ms[0]));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n, k;
    cin>>n>>k;
    vector<ll> t(n);
    cin>>t[0];
    ll ans = 0;
    for(ll i=1;i<n;++i){
        cin>>t[i];
        ans += min(k, t[i]-t[i-1]);
    }
    ans += k;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1792