akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,j,n) for(int (i)=(j);(i)<(n);(i)++)
#define eFOR(i,j,n) for(int (i)=(j);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
const int INF = 1000000000;
const ll LLINF = 1LL << 62;
const int mod = 1000000007;
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; }

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

    int n, m;
    cin >> n >> m;
    int u, v;
    vector<VI> edge(n * 3 + 1);
    FOR(i, 0, m){
        cin >> u >> v;
        edge[u].push_back(v + n);
        edge[u + n].push_back(v + n * 2);
        edge[u + n * 2].push_back(v);
    }
    int s, t;
    cin >> s >> t;

    vector<bool> ever(n * 3 + 1, 0);
    queue<pair<int, int>> bfs;
    ever[s] = 1;
    bfs.push({ s, 0 });
    while (!bfs.empty()){
        int now = bfs.front().first;
        int dis = bfs.front().second + 1;
        bfs.pop();
        for (int i : edge[now]){
            if (ever[i])continue;
            ever[i] = 1;
            bfs.push({ i, dis });
            if (i == t){
                cout << dis / 3 << "\n";
                return 0;
            }
        }
    }
    cout << -1 << "\n";
}


Measured memory_bytes: 16768
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();

		int[] z = new int[100000];
		for (int i = 0; i < N; i++) {
			z[sc.nextInt()]++;
		}

		sc.close();

		int ans = 0;

		for (int X = 0; X < z.length; X++) {
			int b = z[X];
			if (X > 0)
				b += z[X - 1];
			if (X < z.length - 1)
				b += z[X + 1];

			ans = Math.max(ans, b);
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 50512
/*" بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ -In the name of Allah."
   Never stop chasing!-MD.SOURAV.

   ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
   ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
   ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
   [███████████████████].░░░░░░░░░░░░░░
   ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░
*/


#include <bits/stdc++.h>


#define endl           "\n"
#define MAX            32000
#define F              first
#define S              second
#define sz(x)          x.size()
#define li             long int
#define gcd(a,b)       _gcd(a,b)
#define pb             push_back
#define asrt(a,n)      sort(a,a+n)
#define MOD 	       1000000007
#define ll             long long int
#define lcd(a,b)       (a*b)/gcd(a,b)
#define mp(x,y)        make_pair(x,y)
#define no             cout<<"NO"<<endl
#define yes            cout<<"YES"<<endl
#define f(i, a, n)     for(int i=a;i<n;i++)
#define test           int t;cin>>t;while(t--)
#define srt(v)         sort(v.begin() , v.end())
#define basrt(a,n)     sort(a,a+n, greater<int>())
#define deb(x)         cout << #x<< ": "<< x<< endl;
#define sumof(x)       accumulate(x.begin(),x.end(),0);
#define rsrt(v)        sort(v.begin(),v.end(),greater<int>())
#define enter(v,n)     for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define unique(v)      v.erase(unique(v.begin(),v.end()),v.end())
#define start          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ignore         cin.ignore (std::numeric_limits<std::streamsize>::max(),'\n');



using namespace std;

double pi=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664 ;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef map<ll,ll> mllll;
typedef map<char,ll> mchll;
typedef map<string,ll> msll;
typedef vector<pair<ll,ll>> vpllll;
typedef vector<pair<int,int>> vpiiii;

template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v)
{
    os << '{';
    for (const auto &x : v) os << " " << x;
        return os << '}';
}

void solve()
{

     int d,t,s;
     cin>>d>>t>>s;
     double a=(d*1.00)/s;
     if(a>t)
	 {
	 	cout << "No";
	 }
	 else
		cout << "Yes";



}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll test_case=1;
    //cin>>test_case;
    while(test_case--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

ll digit[300010][70][2];

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

    vector<ll> two(70, 0);
    ll tw = 1;
    ll cnt = 0;
    while (cnt < 62) {
        two[cnt] = tw % MOD;
        tw *= 2;
        cnt ++;
    }

    ll n;
    cin >> n;
    vector<ll> a(n);

    rep(i, n){
        cin >> a[i];
        ll cp = a[i];

        for (int t = 0; t < 70; ++t) {
            if (cp & 1) {
                digit[i+1][t][1] = (digit[i][t][1] + two[t]) % MOD;
                digit[i+1][t][0] = (digit[i][t][0]) % MOD;
            } else {
                digit[i+1][t][1] = (digit[i][t][1]) % MOD;
                digit[i+1][t][0] = (digit[i][t][0] + two[t]) % MOD;
            }
            cp >>= 1;
        }
    }

    /*for (int i = 0; i < n+1; ++i) {
        for (int j = 0; j < 3; ++j) {
            cout << digit[i][j][0] << " ";
            //cout << digit[i][j][1] << " ";
        }

        cout << endl;
    }*/

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ll cp = a[i];
        for (int t = 0; t < 70; ++t) {
            ll one = MOD + digit[n][t][1] - digit[i][t][1];
            ll zero = MOD + digit[n][t][0] - digit[i][t][0];
            // cout << one << " " << zero << endl;
            if (cp & 1) {
                ans += zero % MOD;
            } else {
                ans += one % MOD;
            }

            cp >>= 1;
        }
    }

    cout << ans % MOD << endl;
}

Measured memory_bytes: 330752
/// meowa 

#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;

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

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

void stndrtn() {
#ifdef AM
    freopen(".in", "r", stdin);
#endif        
}                   

const bool flag = 0;

void ma1n() {
    stack<int> s, t;
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n);
    for (int& x : a) {
        cin >> x;
    }
    vector<int> b(m);
    for (int& x : b) {
        cin >> x;
    }
    vector<ll> p(m+1);
    p[0] = 0;
    for (int i = 0; i < m; ++i) {
        p[i+1] = p[i] + b[i];    
    }
    ll sum = 0;
    int ans = upper_bound(p.begin(), p.end(), k)-p.begin()-1;
    for (int i = 0; i < n; ++i) {
        sum += a[i];
        if (sum > k) {
            break;
        }
        ans = max(ans, i+1 + int(upper_bound(p.begin(), p.end(), k-sum)-p.begin())-1);
    }
    cout << ans;
} 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtn();
    int ts = 1;
    if (flag) {
        cin >> ts;
    }
    while (ts--) {
        ma1n(); 
    }
    return 0;
}

Measured memory_bytes: 6340
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 100000000000
#define mod 1000000007
#define pll pair<long,long>
#define se second
#define fi first
#define pb push_back
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update>pllordered_set;


int main()
{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);
			ll n;
			cin>>n;
			vector<ll> v(n);
			map<ll,ll> m;
			for(ll i=0;i<n;i++)
				{cin>>v[i];m[v[i]]++;}
			ll ans=0;
			sort(v.begin(),v.end(),greater<int>());
			for(ll i=0;i<n;i++)
			{
				if(!m[v[i]])
					continue;
				ll val=0;
				ll v1=v[i];
				ll cnt=0;
				while(v1%2==0)
				{
					v1/=2;
					cnt++;
				}
				val+=(1<<cnt);
				while(v1>0)
				{
					if(v1%2==0)
						val+=(1<<cnt);
					cnt++;
					v1/=2;
				}
				m[v[i]]--;
				if(m[val])
				{
				
					m[val]--;
				//	cout<<val<<" "<<v[i]<<endl;
					ans+=1;
				}
				
			}
			cout<<ans;
			
			
			
}


Measured memory_bytes: 26880
def org_fib(t):
    t1 = 1
    t2 = 2
    fib = 0
    if t == 1:
        return t1
    elif t == 2:
        return t2
    else:
        for _ in range(t-2):
            fib = t1+t2
            t1 = t2
            t2 = fib
    return fib % 1000000007

N,M = map(int,input().split())
if N == 1:
    print(1)
elif M == 0:
    print(org_fib(N))
else:
    pre_a = -1
    k = []
    ef = True
    for i in range(M):
        a = int(input())
        if (a-pre_a == 1):break
        k.append(a-pre_a-2)
        pre_a = a
    else:
        ef = False
        k.append(N-a-1)

    if ef:print(0)
    else:
        g = 1
        for kk in k:
            if kk == 0:pass
            else:g = (g * org_fib(kk)) % 1000000007
        print(g)

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    int a;
    cin>>a;
    int i,j;
    for(i=a;i<2*a;i++)
        {
            int flag=0;
            for(j=2;j*j<=i;j++)
                if(i%j==0)
                    {

                    flag=1;
                    }
            if(flag)
                continue;
            else
                break;
        }
    cout<<i<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
typedef pair<int, int> P;

int N, L;
P pl[200000];	//l昇順, (l, r)
P pr[200000];	//r昇順, (r, l)

int calcX() {
	int i = 0;
	int left = 0;
	int ret = 0;
	
	while (i < N) {
		int maxR = left;
		for (; i < N && pl[i].first <= left; i++) {
			maxR = max(maxR, pl[i].second);
		}
		left = maxR;
		ret++;
		if (maxR == L) break;
	}
	return ret;
}

int calcY() {
	int i;
	vector<int> xs;
	
	rep(i, N) {
		xs.push_back(pl[i].first);
		xs.push_back(pl[i].second);
	}
	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());
	
	/*cout << "pl[]" << endl;
	rep(i, N) {
		cout << pl[i].first << ", " << pl[i].second << endl;
	}
	cout << endl;
	cout << "pr[]" << endl;
	rep(i, N) {
		cout << pr[i].first << ", " << pr[i].second << endl;
	}*/
	
	int ret = 0;
	rep(i, xs.size()) {
		//r < x
		int idL = lower_bound(pr, pr + N, P(xs[i], -1)) - pr;
		int cntL = idL;
		//l > x
		int idR = lower_bound(pl, pl + N, P(xs[i] + 1, -1)) - pl;
		int cntR = N - idR;
		ret = max(ret, cntL + cntR);
		//cout << "x = " << xs[i] << ", cntL = " << cntL << ", cntR = " << cntR << endl;
	}
	return ret + 1;
}

signed main() {
	int i;
	
	cin >> N >> L;
	rep(i, N) {
		int l, r;
		cin >> l >> r;
		pl[i] = P(l, r);
		pr[i] = P(r, l);
	}
	sort(pl, pl + N);
	sort(pr, pr + N);
	
	int x = calcX();
	int y = calcY();
	cout << x << " " << y << endl;
	return 0;
}


Measured memory_bytes: 13324
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Math;

class Program
{
    static void Main()
    {
        long k = long.Parse(Console.ReadLine());
        if (k == 0)
        {
            Console.WriteLine(2);
            Console.WriteLine("0 0");
            return;
        }
        if (k == 1)
        {
            Console.WriteLine(3);
            Console.WriteLine("1 0 3");
            return;
        }
        long n = Min(k, 50);
        Console.WriteLine(n);
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = n - 1 + k / n;
        for (int i = 0; i < k % n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (j == i) a[j] += n;
                else a[j]--;
            }
        }
        foreach (var ai in a)
            Console.Write("{0} ", ai);
        Console.WriteLine();
    }
}

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

int n, x[200];

int main(){
  cin >> n;
  rep(i, n) cin >> x[i];
  int res = 1e9;
  for(int i = 0; i < 101; i++){
    int sum = 0;
    rep(j, n){
      int num = abs(x[j] - i);
      num *= num;
      sum += num;
    }
    res = min(sum, res);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define all(collection) (collection).begin(), (collection).end()
#define loop(i, times) for(int i = 0; i < times; i++)
#define seloop(i, start_index, end_index) for(int i = start_index; i < end_index; i++)
#define eqseloop(i, start_index, end_index) for(int i = start_index; i <= end_index; i++)

long CountHalfK(int n, int k)
{
	long count = (n - k / 2) / k + 1;
	return (count * count * count);
}

long CountXK(int n, int k)
{
	long count = n / k;
	return (count * count * count);
}


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

	if (n * 2 - k < 0)
	{
		cout << 0;
		return 0;
	}

	if (k % 2 == 0)
		cout << CountHalfK(n, k) + CountXK(n, k);
	else
		cout << CountXK(n, k);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	var max int
	for i := 0; i < len(s); i++ {
		var count int
		if !(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
			continue
		}
		count++
		for j := i + 1; j < len(s); j++ {
			if s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T' {
				count++
				continue
			}
			break
		}
		if max < count {
			max = count
		}
	}
	fmt.Println(max)
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const ll MOD = 1e9+7;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"[";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"]";return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&p)
{o<<"{"<<p.first<<", "<<p.second<<"}";return o;}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj)
{o<<"{";for(auto itr=obj.begin();itr!=obj.end();++itr)o<<(itr!=obj.begin()?", ":"")<<*itr;o<<"}";return o;}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,m,a,b,ans=0;
  cin >> n >> m;
  vector<P> job;
  priority_queue<int> que;
  for(int i=0; i<n; i++){
    cin >> a >> b;
    job.push_back(P(a,b));
  }
  sort(job.begin(),job.end());
  int l = 0;
  for(int i=m-1; i>=0; i--){
    while(l < n && job[l].first <= m-i){
      que.push(job[l].second);
      l++;
    }
    if(!que.empty()){
      ans += que.top();
      que.pop();
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1908
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int mod = 1000000007;
		int dis = Math.abs(n - m);
		long N = 1;
		long M = 1;
		if(dis >= 2) {
			System.out.println(0);
		} else if(dis == 1) {
			for(int i = n ; i >= 1 ; i--) {
				N = N * i % mod;
			}
			for(int i = m ; i >= 1 ; i--) {
				M = M * i % mod;
			}
			System.out.println(N * M % mod);
		} else {
			for(int i = n ; i >= 1 ; i--) {
				N = N * i % mod;
			}
			for(int i = m ; i >= 1 ; i--) {
				M = M * i % mod;
			}
			System.out.println(N * M * 2 % mod);
		}
	}
}


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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


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

    int cnt = 0;

    rep(i, 1000) {
        int pos = 0;
        int cur = i % 10;

        rep(j, n) {
            if (s[j] - '0' == cur) {
                if (pos >= 2) {
                    cnt++;
                    break;
                }
                pos++;
                cur = int(i / pow(10, pos)) % 10;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
string s;
int n;
int x,y;
int ans=0;
int main(){
	cin>>s;
	n=s.size();
	for(int i=0;i<n;i++){
		if(s[i]=='0')x++;
		else y++;
	}
	if(x==y)ans=x*2;
	else ans=min(x,y)*2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VL a(N), b(N);
    REP(i,N) cin >> a[i];
    REP(i,N) cin >> b[i];
    LL ans = 0;

    for(int i = 0; i <= 30; i++) //i bit
    //for(int i = 0; i <= 4; i++) //i bit
    {
        LL Tn = 1 << (i+1);
        VL xs,ys;
        REP(j,N){
            xs.pb(a[j] % Tn);
            ys.pb(b[j] % Tn);
        }
        sort(xs.begin(),xs.end());
        sort(ys.begin(),ys.end());
        LL cnt = 0;
        //cout << printVector(xs) << endl;
        //cout << printVector(ys) << endl;

        for(LL x : xs)  {
            //int idx = ys.end() - lower_bound(ys.begin(),ys.end(), 3 * (1 << (i))-x);
            int idx = lower_bound(ys.begin(),ys.end(), 4 * (1LL << (i))-x) - lower_bound(ys.begin(),ys.end(), 3 * (1LL << (i))-x) + 1;

            //dump(idx)
            //dump(ys.end()-ys.begin())
            //dump(lower_bound(ys.begin(),ys.end(), 3 * (1 << (i))-x)-ys.begin())
            int idx1 = lower_bound(ys.begin(),ys.end(), 2 * (1LL << (i))-x) - lower_bound(ys.begin(),ys.end(), (1LL << (i))-x) + 1;
            dump(idx+idx1)

            cnt += idx + idx1;
        }
        if((cnt)%2 == 1) {
            dump(i)
            dump(cnt)
            dump(1 << i)
            ans += (1 << i);
        }

    }
    cout << ans << endl;

}

Measured memory_bytes: 9276
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  string s1, s2;
  cin >> s1 >> s2;
  reverse(s1.begin(), s1.end());
  if (s1 == s2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	int d = n % 10;
	string ans;
	if(d == 3) ans = "bon";
	else if (d == 0 ||d == 1 ||d == 6 ||d == 8)ans = "pon";
	else ans = "hon";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#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 << "Balanced" <<endl;
  }
  else {
    cout << "Right" << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(NULL);
 ios::sync_with_stdio(false);
 int n,a[100005];
 int b,c=0,ans=0;
 int dp[100005]={};
 cin>>n;
 for(int i=1;i<=n;i++){
   cin>>a[i];
 }
 for(int i=2;i<=n;i++){
   if(i==2){
     dp[i]=abs(a[i]-a[i-1])+dp[i-1];
   }
   else{
     dp[i]=min((abs(a[i]-a[i-2])+dp[i-2]),(abs(a[i]-a[i-1])+dp[i-1]));
   }
 }
   
 
 cout<<dp[n]<<"\n";

 return 0;
}



Measured memory_bytes: 1024
// abc127_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int Q;
    cin >> Q;

    ll cumsum_l = 0;
    ll cumsum_r = 0;
    priority_queue<int> pq_l;
    priority_queue<int, vector<int>, greater<int>> pq_r;

    ll C = 0;
    ll mid = INF;

    int t;
    int a, b;
    REP(q, Q){
        cin >> t;
        int n =  pq_l.size() + pq_r.size();

        if (t == 1){
            cin >> a >> b;
            C += b; //定数

            if (a <= mid){
                pq_l.push(a);
                cumsum_l += a;
            } else {
                pq_r.push(a);
                cumsum_r += a;
            }

            if (pq_l.size() < pq_r.size()){  // 右のほうが多くなったら
                int x = pq_r.top(); pq_r.pop();
                cumsum_r -= x;
                pq_l.push(x);
                cumsum_l += x;
            } else if (pq_r.size() < pq_l.size() - 1){ // 左のほうが多くなったら
                int x = pq_l.top(); pq_l.pop();
                cumsum_l -= x;
                pq_r.push(x);
                cumsum_r += x;
            }
            mid = pq_l.top();

        } else {
            ll ans;
            if (n % 2 == 0){
                ans = cumsum_r - cumsum_l + C;
            } else {
                ans = mid + cumsum_r - cumsum_l + C;
            }

            print(mid, ans);
        }
    }



    return 0;
}


Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll n, k;
    cin >> n >> k;
    ll res = (n-1)/(k-1);
    if ((n-1)%(k-1) != 0) ++res;
    cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N;
    ll a, b, c;
    ll cost_a[100001],cost_b[100001],cost_c[100001];
    cin>>N;
    

    cost_a[0] = 0;
    cost_b[0] = 0;
    cost_c[0] = 0;
    Rep(i,N){
        cin>>a>>b>>c;
        cost_a[i] = max(cost_b[i-1],cost_c[i-1]) + a;
        cost_b[i] = max(cost_c[i-1],cost_a[i-1]) + b;
        cost_c[i] = max(cost_a[i-1],cost_b[i-1]) + c;
    }
    cout<< max(cost_a[N],max(cost_b[N],cost_c[N]))<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

void solve()
{
	int a, b;
	while(cin >> a >> b)
	{
		int sum = a + b;
		int count = 0;
		while(sum)
		{
			sum /= 10;
			count++;
		}
		cout << count << endl;
	}
}

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

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int a,b,h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 10;
int a[N - 1] = {1, 2, 4, 7, 12, 20, 29, 38, 52};
ll w[N][N];

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

    int n;
    cin >> n;

    ll mx = 0;

    for (int i = 1; i < n; i++) {
        for (int j = 0; j < i; j++) {
            w[j][i] = w[i][j] = (mx + 1) * a[j];
        }
        int b[10];
        for (int j = 0; j <= i; j++) {
            b[j] = j;
        }
        do {
            ll cur = 0;
            for (int j = 0; j < i; j++) {
                cur += w[b[j]][b[j + 1]];
            }
            mx = max(mx, cur);
        } while (next_permutation(b, b + i + 1));
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << w[i][j] << " ";
        }
        cout << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
L = [list(input().split()) for i in range(N)]

for i in range(N):
	L[i][0] = float(L[i][0])
total = 0
for i in range(N):
	if L[i][1] == 'JPY':
		total = total +  L[i][0]
	elif L[i][1] == 'BTC':
		total = total +  L[i][0]*380000
print(total)

Measured memory_bytes: 3064
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<int> acnt(n + 1, 0);
    for (int i = 1; i < n; i++) {
        int a; cin >> a;
        acnt[a]++;
    }

    for (int i = 1; i <= n; i++) cout << acnt[i] << '\n';
    return 0;
}


Measured memory_bytes: 3988
import java.util.*;

public class Main {
  public static void main(String[] args) {
    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 9; j++) {
        System.out.println(i + "x" + j + "=" + (i * j));
      }
    }
  }
}


Measured memory_bytes: 24072
#include <bits/stdc++.h>
    #define rep(i,a,b) for(int i=(a);i<(b);i++)
    #define per(i,a,b) for(int i=(a);i>(b);i--)
    #define pb push_back
    #define ff first
    #define ss second
    #define endl '\n'

    typedef long long ll;
    using namespace std;



    int main(){
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        ll m1,m2,m3,m4;
        m1=a*c;
        m2=a*d;
        m3=b*c;
        m4=b*d;
        ll min= LLONG_MIN;
        ll ans= max(m1,max(m2,max(m3,max(m4,min))));
        cout<<ans;
    return 0;
    }


Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ull n,m,l;
string s,t;
ll d[200010],dp[500][500];
ll a[200010],b[200010];

int main(){
  cin >> n;
  rep(i,0,n)cin >> a[i];
  rep(i,0,n)cin >> b[i];
  rep(i,0,n)cin >> d[i];
  sort(a,a+n);
  sort(b,b+n);
  sort(d,d+n);
  l = 0;
  rep(i,0,n){
    ll p = lower_bound(a,a+n,b[i])-(a);
    ll q = (d+n) - upper_bound(d,d+n,b[i]);
    l += p * q;
  }
  print(l);
  return 0;
}

Measured memory_bytes: 5632
import bisect

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ruiseki_a = [0]
ruiseki_b = [0]

a_index = N+1
for i in range(N):
  if K < ruiseki_a[-1] + A[i]:
    a_index = i+1
    break
  ruiseki_a.append(ruiseki_a[-1] + A[i])
b_index = M+1
for i in range(M):
  if K < ruiseki_b[-1] + B[i]:
    b_index = i+1
    break
  ruiseki_b.append(ruiseki_b[-1] + B[i])
lis = [0 for _ in range(a_index)]
for i in range(a_index):
  index = bisect.bisect_left(ruiseki_b, K-ruiseki_a[i]+1)
  lis[i] = i + max(0, index - 1)
print(max(lis))

Measured memory_bytes: 133236
#include <iostream>
using namespace std;
int main(void){
  int N,K;
  cin >> N >> K;
  
  int num = 1;
  
  for(int i=0;i<N;i++){
    if(num * 2 >= num + K)
      num += K;
    else
      num *= 2;
  }
  
  cout << num << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool) *this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t) v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<(unsigned) 1e9 + 7>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, c; cin >> n >> c;
  V<> w(n); for (auto&& e : w) cin >> e;
  sort(rbegin(w), rend(w));
  int r = accumulate(begin(w), end(w), 0);
  Mint res = r <= c;
  V<Mint> dp(c + 1);
  dp[0] = 1;
  for (int e : w) {
    r -= e;
    for (int i = 0; i <= c; ++i) if (r + i <= c and c < r + i + e) {
      res += dp[i];
    }
    for (int i = c - e; i >= 0; --i) {
      dp[i + e] += dp[i];
    }
  }
  cout << res << '\n';
}


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

#define rep(i,x) for(int i = 0 ; i < x ; i ++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i ++)

typedef long double ld;

struct po{
	ld x;
	ld y;
	po(ld a){ x = a; y = 0; }
	po(){}
	inline ld operator()(const po& rhs) const {
		return x*rhs.x+y*rhs.y;
	}
	inline po& operator+=(const po& rhs){
		x += rhs.x;
		y += rhs.y;
		return *this;
	}
	inline po& operator-=(const po& rhs){
		x -= rhs.x;
		y -= rhs.y;
		return *this;
	}
	inline po& operator*=(const po& rhs){
		ld x_ = x*rhs.x-y*rhs.y;
		y = x*rhs.y+y*rhs.x;
		x = x_;
		return *this;
	}
	inline po& operator/=(const po& rhs){
		ld x_ = x*rhs.x+y*rhs.y;
		y = -x*rhs.y+y*rhs.x;
		x = x_;
		ld nor = rhs(rhs);
		x /= nor;
		y /= nor;
		return *this;
	}
	inline void in(){
		scanf("%Lf%Lf",&x,&y);
	}
};
po operator+(const po& a, const po& b){ return po(a) += b; }
po operator-(const po& a, const po& b){ return po(a) -= b; }
po operator*(const po& a, const po& b){ return po(a) *= b; }
po operator/(const po& a, const po& b){ return po(a) /= b; }

inline po similar(const po& a,const po& b,const po& c,const po& p,const po& q){
	return p+(q-p)*(c-a)/(b-a);
}

struct li{
	ld a;
	ld b;
	ld c;
	li(po p,po q){
		a = q.y-p.y;
		b = p.x-q.x;
		c = p.y*q.x-p.x*q.y;
	}
	li(){}
	inline ld operator()(const po& p) const {
		return a*p.x+b*p.y+c;
	}
};

void intersect(const li &l,const li &m,po* &ret){
	ret = new po;
	ret->x = -(l.c*m.b-m.c*l.b)/(l.a*m.b-m.a*l.b);
	ret->y = -(l.a*m.c-m.a*l.c)/(l.a*m.b-m.a*l.b);
}

typedef pair<po,po> se;
#define fr first
#define sc second

bool on(const po &p,const se &s){
	return (s.fr-p)(s.sc-p) <= 1e-9;
}

void intersect(se s,se t,po* &ret){
	li l = li(s.fr,s.sc);
	li m = li(t.fr,t.sc);
	po *p;
	intersect(l,m,p);
	if(on(*p,s)&&on(*p,t))ret = p;
	else ret = nullptr;
}

int main(){
	int T;
	scanf("%d",&T);
	rep(loop,T){
		po a,b;
		int n;
		po s[102],t[102];
		int o[102],l[102];
		a.in();
		b.in();
		scanf("%d",&n);
		rep1(i,n){
			s[i].in();
			t[i].in();
			scanf("%d%d",&o[i],&l[i]);
		}
		map<ld,int> M;
		rep1(i,n){
			po *p;
			intersect(se(a,b),se(s[i],t[i]),p);
			if(p == nullptr)continue;
			po q = similar(a,b,*p,0,1000000000.0);
			M[q.x] = o[i]^l[i];
		}
		if(M.size() == 1){
			printf("0\n");
			continue;
		}
		int ret = 0;
		int pre = M.begin()->sc;
		for(pair<ld,int> p: M){
			if(p.sc != pre){
				ret ++;
				pre = p.sc;
			}
		}
		printf("%d\n",ret);
	}
}




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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    int N, M;
    cin >> N >> M;
    vector<int> b(N+1, 1);
    vector<bool> f(N+1, false);
    int ans;
    f[1] = true; ans = 1;

    rep(i, M) {
        int x, y;
        cin >> x >> y;
        b[x]--;
        b[y]++;
        if (f[x]) {
            if (b[x] == 0) {
                f[x] = false; ans--;
            }
            if (!f[y]) {
                f[y] = true; ans++;
            }
        }
    }
    // cout_h(f);
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using v = vector<int>;
using ll = long long;
int main(){ 
    int n;
    string s;
    cin >> n;
    cin >> s;

    
    auto it = s.find("ABC");
    int c = 0;
  
    while(it!=string::npos){
        it = s.find("ABC",++it);
        c++;
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

total = 0
# for i in reversed(range(len(B))):
#     # print(i)
#     if A[i+1] >= B[i]:
#         total += B[i]
#         B[i] = 0
#         continue
#     else:
#         total += A[i+1]
#         B[i] -= A[i+1]
#         if A[i] >= B[i]:
#             total += B[i]
#             A[i] -= B[i]
#         else:
#             total += A[i]
for i in range(len(B)):
    temp = min(A[i], B[i])
    A[i] -= temp
    B[i] -= temp
    total += temp
    temp = min(A[i+1], B[i])
    A[i+1] -= temp
    B[i] -= temp
    total += temp
print(total)

Measured memory_bytes: 18624
import Foundation
let alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
             "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

let main = {
  let s = readLine()!
  for c in alpha {
    if !s.contains(c) {
      print(c)
      return
    }
  }
  print("None")
}
main()

Measured memory_bytes: 14152
#include <stdio.h>
int main(void){
     int a,b,i; char op;
     for(i=1;i>0;i++){ scanf("%d %c %d",&a,&op,&b);
     if(op=='+') {printf("%d\n",a+b); 
     } 
     else if(op=='-') {printf("%d\n",a-b);
     }
     else if(op=='*') {printf("%d\n",a*b); 
         
     }
     else if(op=='/'){ printf("%d\n",a/b); 
         
     }
     else if(op=='?') { break; 
         
     }
     } 
     return 0;
     } 



Measured memory_bytes: 2140
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 0; i < n; i++){
            if(n == Math.pow(2,i)){
                System.out.println((int)Math.pow(2,i));
                break;
            }else if(n < Math.pow(2,i)){
                System.out.println((int)Math.pow(2,i-1));
                break;
            }
        }
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using static System.Console;

class Program {
    static void Main() {
        var a = NextInt();
        var b = NextInt();
        var c = NextInt();
        var ans = 0;
        var dic = new List<int[]>();
        var flg = false;

        while (true) {
            var abc = new int[] { a, b, c };
            Array.Sort(abc);
            if (Contains(dic, abc)) {
                ans = -1;
            }
            foreach (var v in abc) {
                if (v % 2 != 0) {
                    flg = true;
                }
            }
            if (flg || ans < 0) {
                break;
            }
            ans++;
            dic.Add(abc);
            var x = b / 2 + c / 2;
            var y = c / 2 + a / 2;
            var z = a / 2 + b / 2;
            a = x;
            b = y;
            c = z;
        }
        WriteLine(ans);
    }

    static bool Contains(List<int[]> dic, int[] abc) {
        foreach (var dic_i in dic) {
            var flg = false;
            var j = 0;
            foreach (var dic_ij in dic_i) {
                if (dic_ij != abc[j]) {
                    flg = true;
                }
                j++;
            }
            if (!flg) {
                return true;
            }
        }
        return false;
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}

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

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 100005
#define MOD 1000
#define oo 1000000000000000007LL
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, p;
ll s[maxN];

int main () {
    scanf("%d%d", &n, &p);
    ll sum = 0;
    fto(i, 1, n) {
        ll w, b;
        scanf("%lld%lld", &w, &b);
        s[i] = (100-p)*w + p*b;
        sum -= p*b;
    }

    sort(s+1, s+n+1);
    reverse(s+1, s+n+1);
    fto(i, 1, n) {
        sum += s[i];
        if (sum >= 0) {
            printf("%d", i);
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 16:50:38 2020

@author: liang
"""
N = int(input())
d = dict()
ans = 0 
A = [int(input()) for _ in range(N)]
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
#print(d)
for key in d.keys():
    if d[key] %2 ==1:
        ans += 1
        d[key] = 0
#print(d)
print(ans)

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

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        multiset<long long>mst,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        multiset<long long>::iterator it;

        scanf("%lld",&n);

        for(i=1;i<=n;i++)
        {
            scanf("%lld",&a);

            mst.insert(a);

            if(a!=*mst.begin())
            {
                it=mst.lower_bound(a); it--;

                f=*it; //cout<<"    "<<a<<" "<<f<<endl;
                mst.erase(mst.lower_bound(f));

            }
            else
            {
                ans++;
            }


        }


        printf("%lld\n",ans);













    return 0;
}





Measured memory_bytes: 8344
#include <bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int maxn = 1e3;
string s;

void read()
{
    cin >> s;
}

void solve()
{
    for(int i = 0; i < s.length(); ++i)
        if((i%2 && s[i] == 'R') || (!(i%2) && s[i] == 'L'))
        {
            cout << "No" << endl;
            return;
        }
    cout << "Yes" << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    read();
    solve();
    return 0;
}

Measured memory_bytes: 384
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 43860
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;




int main(){
	int h,w,i,j;
	cin>>h>>w;
	string a[h];
	for(i=0;i<h;i++)
	{
		cin>>a[i];
	}
	ll dp[h+2][w+2];
	memset(dp,0,sizeof(dp));
	dp[1][1]=1;
	for(i=1;i<=h;i++)
	{
		for(j=1;j<=w;j++)
		{
			if(i==1&&j==1)
			continue;
			if(a[i-1][j-1]=='.')
			{
				dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
			}
			
		}
	}
	cout<<dp[h][w];
}

Measured memory_bytes: 9088
N, M = map(int, input().split())

acs = 0
total_p = 0
penalties = [0] * N
cleared = [False] * N
for _ in range(M):
	p, s = input().split()
	p = int(p) - 1
	if s == "AC":
		if not cleared[p]:
			cleared[p] = True
			total_p += penalties[p]
			acs += 1
	else:
		if not cleared[p]:
			penalties[p] += 1

print(acs, total_p)


Measured memory_bytes: 4596