akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
#define fi first
#define se second
using namespace std;

typedef long long ll;
typedef double db;
const int maxn = 4e5;
int n, B[maxn + 5], top, st[maxn + 5];
ll A[maxn + 5], c[maxn + 5];
db f[maxn + 5];

ll calc(ll x, ll y, ll p, ll q) {
	return x * q - y * p;
}

int main() {
	scanf("%d", &n);
	rep(i, 1, n) scanf("%lld", &A[i]);
	rep(i, 1, n) scanf("%d", &B[i]);
	copy(A + 1, A + n + 1, A + n + 1);
	copy(B + 1, B + n + 1, B + n + 1);
	ll mx = -1e18; int pos = 0;
	rep(i, 1, n) if (A[i] > mx) mx = A[i], pos = i;
	int m = n;
	ll *a = A + pos - 1; int *b = B + pos - 1;
	b[1] = b[n + 1] = 0;
	rep(i, 2, n) c[i + 1] = b[i] * 2;
	rep(i, 1, n + 1) c[i] += c[i - 1];
	rep(i, 1, n + 1) c[i] += c[i - 1];
	rep(i, 1, n + 1) a[i] -= c[i];
	rep(i, 1, n + 1) {
		while (top > 1 && calc(i - st[top], a[i] - a[st[top]], i - st[top - 1], a[i] - a[st[top - 1]]) <= 0) top--;
		st[++top] = i;
	}
	rep(i, 1, top) f[st[i]] = a[st[i]];
	rep(i, 1, top - 1) {
		int l = st[i], r = st[i + 1];
		rep(j, l + 1, r - 1) f[j] = ((db)a[l] * (r - j) + (db)a[r] * (j - l)) / (db)(r - l);
	}
	db sum = 0;
	rep(i, 1, n) f[i] += c[i], sum += f[i];
	printf("%.12lf\n", sum / n);
	return 0;
}

Measured memory_bytes: 12304
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2589

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

const int MAX = 20;
const int NORTH = 0;
const int WEST = 1;

struct fraction {
	int n; //分子
	int d; //分母
};

int main() {
	string s;
	while(cin >> s) {
		if(s == "#") break;
		
		vector<int> dir;
		rep(i, s.size()) {
			if(s[i] == 'n') {
				dir.push_back(NORTH);
				i += 4;
			}
			else if(s[i] == 'w') {
				dir.push_back(WEST);
				i += 3;
			}
		}

		reverse(ALL(dir));
		fraction f = {0, 1};

		int n=dir.size();
		rep(i, n) {
			if(dir[i] == NORTH) {
				f.n = (2 * f.n) - 90;
				if(f.n < 0) f = {0, 1};
			}
			else {
				f.n = (2 * f.n) + 90;
			}
		}

		f.d = 1 << (n-1);

		int g = __gcd(f.n, f.d);
		if(f.d / g == 1) {
			cout << f.n / g << endl;
		} else {
			cout << f.n / g << "/" << f.d / g << endl;     
		}
	}
	return 0;
}

Measured memory_bytes: 1208
def main():
    n = int(input())
    s = list(map(int, input().split())) 
    q = int(input())
    t = list(map(int, input().split()))
   

    def bisect(item, list):
        cnt = 0
        # 左右のindexで考える
        l = 0
        h = len(list) - 1
        while l <= h:
            mid = (l+h) // 2
            tmp = list[mid]
            if item == tmp:
                cnt = 1
                return cnt
            elif tmp < item:
                l = mid + 1
            elif tmp > item:
                h = mid - 1
        return cnt
    
    ans = 0
    for i in t:
        ans += bisect(i, s)
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 16716
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N, D; cin >> N >> D;
    vector<vector<int>>X(N, vector<int>(D));
    rep(i, N)rep(j, D)cin >> X[i][j];
    vector<int>A(N);
    rep(i, N)A[i] = i+1;
    int answer = 0;
    rep(i, N * (N - 1)) {
        long double ans = 0;
        rep(j, D) {
            ans += pow(abs(X[A[0]-1][j] - X[A[1]-1][j]), 2);
        }
        ans = sqrt(ans);
        if (ans == int(ans))answer++;
        if (N == 2 || N == 3) {
            rep(i, 1)next_permutation(A.begin(), A.end());
        }
        else {
            int count = 1;
            REP(i, N - 1)count *= i;
            rep(i, count)next_permutation(A.begin(), A.end());
        }
    }
    cout << answer/2 << endl;
}

Measured memory_bytes: 3692
/*
 * 	Roses are red
 * 		Violets are blue
 * 			I cried
 * 				And so did you
 */
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifndef rd
#define endl '\n'
#endif
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=1e9;
const int mod=998244353;
//const int mod=1000000007;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> oset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
auto clk=clock();
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

const int N=305;
int a[305];
int knap[305*305],knap2[305*305];
int powm(int a,int b) {
	int res=1;
	while(b) {
		if(b&1) {
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
void solve() {
	int n,sum=0;
	cin>>n;
	fr(i,1,n) {
		cin>>a[i];
		sum+=a[i];
	}
	knap[0]=powm(2,n);
	int inverse=powm(2,mod-2);
	const int lim=sum;
	for(int i=1; i<=n; i++) {
		for(int j=lim-a[i]; j>=0; j--) {
			knap[j+a[i]]=(knap[j+a[i]]+knap[j]*inverse)%mod;
		}
	}
	knap2[0]=1;
	for(int i=1; i<=n; i++) {
		for(int j=lim-a[i]; j>=0; j--) {
			knap2[j+a[i]]=(knap2[j+a[i]]+knap2[j])%mod;
		}
	}
	int ans=powm(3,n);
	for(int i=(sum+1)/2; i<=lim; i++) {
		ans=(ans-3*knap[i])%mod;
	}
	if(sum%2==0) {
		ans=(ans+3*knap2[sum/2])%mod;
	}
	if(ans<0)
		ans+=mod;
	cout<<ans<<endl;
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
    #define REP(i, n) for(int i = 0;i < n;i++)
    #define REPR(i, n) for(int i = n;i >= 0;i--)
    #define FOR(i, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF 999999999
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;

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


    int main()
    {
    int n;
    cin>>n;
    vector<int> h(n,0);
    vector<int> c(n,0);
    REP(i,n) cin>>h[i]; //高さ
    int ans=0;
    for(int i=0; i<n; i++)
    {
        int d=h[i]-c[i];
        ans+=d;
        for(int j=i; j<n; j++)
        {
            d=min(d, h[j]-c[j]);
            c[j]+=d;
        }
    }
    cout<<ans<<endl;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
unsigned long long n,sum=0;cin>>n;n++;int a[n+5];for(unsigned long long i=1;i<=n;i++){cin>>a[i];}unsigned long long b[100005]={0},c[100005]={0};b[1]=1,c[n]=a[n];
for(unsigned long long i=2;i<=n;i++){b[i]=(b[i-1]-a[i-1])*2;}
for(unsigned long long i=n-1;i>=1;i--){c[i]=c[i+1]+a[i];}
for(unsigned long long i=1;i<=n;i++){sum+=min(b[i],c[i]);}
for(unsigned long long i=1;i<=n;i++){if(a[i]>b[i]){return cout<<"-1"<<endl,0;}}
cout<<sum<<endl;return 0;}

Measured memory_bytes: 5572
#include <iostream>
#include <math.h>
using namespace std;

int main(){
  int a[3];
  int b[3];
  cin >> a[0] >> a[1] >> a[2];
  b[0] = fabs( a[0] - a[1] );
  b[1] = fabs( a[1] - a[2] );
  b[2] = fabs( a[0] - a[2] );
  if(b[2] >= b[1] && b[2] >= b[0]){
    cout << b[0] + b[1] << endl;
  }else if(b[1] >= b[2] && b[1] >= b[0] ){
    cout << b[0] + b[2] << endl;
  }else{
    cout << b[1] + b[2] << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;

int a[3]={0},b[3]={0},c[3][3];

int main(){
    int flag = 1;
    rep(i,3){
        rep(j,3) {
            cin>>c[i][j];
            // cout<<c[i][j]<<endl;
        }
    }
    rep(i,3) b[i] = c[0][i];
    a[1] = c[1][0] - b[0];
    if(c[1][1] != a[1] + b[1] || c[1][2] != a[1] + b[2]){
        flag =0;
    }
    a[2] = c[2][0] -b[0];
    if(c[2][1] != a[2] + b[1] || c[2][2] != a[2] + b[2]){
        flag = 0;
    }
    cout<<(flag? "Yes":"No")<<endl;
    // rep(i,3){
    //     cout<<b[i]<<endl;
    // }
    // cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    return 0;
}

Measured memory_bytes: 256
// B - Sum of Three Integers
#include <bits/stdc++.h>
using namespace std;
#define ote(x) cout<<(x)<<endl

int main(){
	int k,s; cin>>k>>s;

	int ans = 0;
	for(int z=0; z<=k; z++){
		int xpy = s-z;
		for(int y=0; y<=xpy; y++){
			int x = xpy-y;
			if(x+y+z==s && x<=k && y<=k && z<=k){
				// cout<<x<<","<<y<<","<<z<<"\n";
				ans++;
			}
		}
	}
	ote(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);


using ll = long long;
using namespace std;
using ld = long double;



struct point
{
    int x,y;
};



int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> a(n+1, 0);
    for(int i=1; i<=q; ++i)
    {
        int v;
        cin >> v;
        a[v]++;
    }
    for(int i=1; i<=n; ++i)
        if (k-q+a[i]>0) cout << "Yes" << '\n'; else cout << "No" << '\n';
    return 0;
}



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

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    UnionFind(int n) {
        par.assign(n, 0);
        iota(par.begin(), par.end(), 0);
        rank.assign(n, 0);
    }
    int find(int x) {
        if (par[x] == x) {
            return x;
        }
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) {
                rank[x]++;
            }
        }
    }
};

struct edge {
    int from, to, cost;
};

int main()
{
    int nv, ne;
    cin >> nv >> ne;
    UnionFind uf(nv);
    vector<edge> es;
    rep(i, ne) {
        int u, v, c;
        cin >> u >> v >> c;
        es.push_back({u, v, c});
    }
    sort(es.begin(), es.end(), [](auto& a1, auto& a2) {
        return a1.cost < a2.cost;
    });
    int ans = 0;
    rep(i, ne) {
        edge e = es[i];
        if (uf.find(e.from) != uf.find(e.to)) {
            uf.unite(e.from, e.to);
            ans += e.cost;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

struct UnionFind{
    vector<ll> par;
    vector<ll> sizes;
    UnionFind(ll n) : par(n), sizes(n, 1) {
        rep(i,n) par[i] = i;
    }
    int find(ll x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(ll x, ll y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(ll x, ll y) {
        return find(x) == find(y);
    }

    ll size(ll x) {
        return sizes[find(x)];
    }
};

ll x[100010];
ll y[100010];
ll z[100010];

bool seen[100010];

int main(){
    int n, m;
    cin >> n >> m;
    rep(i, m) cin >> x[i] >> y[i] >> z[i];
    rep(i, m) x[i]--, y[i]--;

    UnionFind tree(n);

    rep(i, m){
        tree.unite(x[i], y[i]);
    }
    map<int,int> rootmp;
    rep(i, n){
        rootmp[tree.find(i)]++;
    }
    cout << rootmp.size() << endl;

    return 0;
}

Measured memory_bytes: 8832
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

i = int(input())
print(a[i - 1])

Measured memory_bytes: 8968
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 200;

string s;
int n, k;

ll dp[maxn][5];

bool ok(){
	int cnt = 0;
	for(auto &c : s)
		if(c != '0')
			cnt++;
	return cnt == k;
}

ll solve(int pos, int cnt){
	if(pos == 0){
		if(cnt == 0)
			return 1;
		return 0;
	}
	
	if(cnt < 0)
		return 0;
	
	if(dp[pos][cnt] != -1)
		return dp[pos][cnt];
	
	ll ans = 0;
	
	for(int i = 0; i < 10; i++){
		int add = i != 0;
		if(cnt - add >= 0)
			ans += solve(pos - 1, cnt - add);
	}
	
	return dp[pos][cnt] = ans;
	
}

ll f(){
	ll ans = 0;
	int cnt = 0;
	
	for(int i = 0; i < n; i++){
		int top = s[i] - '0';
		
		for(int j = 0; j < top; j++){
			int add = j != 0;
			ans += solve(n - i - 1, k - cnt - add);
		}
		
		if(top != 0)
			cnt++;
	}
	
	if(ok())
		ans++;
	return ans;
}

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	cin >> s >> k;
	n = (int)s.size();
	
	memset(dp, -1, sizeof(dp));
	ll ans = f();
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;

#define REP(i,n) for(long long (i)=0;(i)<(long long)(n);(i)++)
#define RREP(i,n) for(long long (i)=(long long)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    string s; cin >> s;
    
    for (int i = 0; i < s.size(); i += 2) {
        cout << s[i];
    }

    cout << endl;

    return 0;
}

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

using namespace std;

const int mod = 1e9 + 7;

int dp[1 << 8][4][4][4];

const string base = "ATCG";

void solve(void)
{
	int n;
	cin >> n;
	for (int i = 0; i < n-2; i++)
	{
		for (int j = 0; j < 4; j++)
			for (int k = 0; k < 4; k++)
				for (int l = 0; l < 4; l++)
				{
					string t = "";
					t += base[j];
					t += base[k];
					t += base[l];
					if (t == "AGC" || t == "ACG" || t == "GAC")
						continue;
					if (i == 0)
					{
						dp[0][j][k][l] = 1;
						continue;
					}
					for (int m = 0; m < 4; m++)
					{
						string nt = t + base[m], nst = nt.substr(1, 3);
						if (nst == "AGC" || nst == "ACG" || nst == "GAC")
							continue;
						bool ok = 1;

						for (int x = 0; x < 3; x++)
						{
							string st = nt;
							swap(st[x], st[x + 1]);
							if (st.substr(0, 3) == "AGC" || st.substr(1, 3) == "AGC")
								ok = 0;
						}
						if (ok)
						{
							dp[i][k][l][m] += dp[i-1][j][k][l];
							dp[i][k][l][m] %= mod;
						}
					}
				}
	}
	int ans = 0;
	for (int j = 0; j < 4; j++)
		for (int k = 0; k < 4; k++)
			for (int l = 0; l < 4; l++)
			{
				ans += dp[n-3][j][k][l];
				ans %= mod;
			}
	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define N 100

int p[N],m[N][N];

void matrixCM(int n){
  int h,i,j,k,b;
  for(h=2;h<=n;h++){
    for(i=1;i<=n-h+1;i++){

      j = i + h - 1;
      m[i][j] = 100000;

      for(k=i;k<j;k++){
        b = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j];

	if(m[i][j]>b) m[i][j]=b;
      }
    } 
  }
}


int main(){
  int num,i,j;
  scanf("%d",&num);
  for(i=1;i<=num;i++){

    scanf("%d %d",&p[i-1],&p[i]);
  }
  for(i=1;i<=num;i++){
    m[i][i]=0;
  }
  matrixCM(num);
  printf("%d\n",m[1][num]);

  return 0;
}



Measured memory_bytes: 2108
package main

import (
	"fmt"
)

func main() {
  var a, b, c, d int
  fmt.Scanf("%d %d %d %d", &a, &b, &c, &d)
  
  L := a + b
  R := c + d
  ans := "Balanced"
  if L > R {
    ans = "Left"
  }
  if L < R {
    ans = "Right"
  }
  
  fmt.Printf("%s\n", ans)
}

Measured memory_bytes: 1832
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,m=map(int, input().split())
    if m==0:
        print(0,0)
    else:
        l=[list(input().split()) for i in range(m)]
        wacnt=[0]*n
        accheck=[False]*n
        pcnt=0
        for p,s in l:
            p=int(p)
            if accheck[p-1]:
                continue
            if s=='WA':
                wacnt[p-1]+=1
            elif s=='AC':
                accheck[p-1]=True
                pcnt+=wacnt[p-1]
        print(sum(accheck),pcnt)
resolve()

Measured memory_bytes: 60252
#include <stdio.h>
int main()
{
  int a[5],i,j,t;
  for(i=0;i<5;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<4;i++){
    for(j=4;j>i;j--){
      if(a[j] > a[j-1]) {
	t = a[j];
	a[j] = a[j-1];
	a[j-1] = t;
      }
    }
  }
  printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <string>
#include <random>
#include <vector>
#include <algorithm>
#include <iomanip>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) FOR(i,0,N)
using namespace std;



int main(void){
  int n;
  int a;
  vector<int> iv;
  
  cin >> n;
  REP(i,n){
   cin >> a;
   iv.push_back(a);
  }
  
 
  vector<int> x(iv);
  sort(x.begin(),x.end());
  REP(i,n){
    if(iv[i] <x[n/2]){
     cout << x[n/2] << endl;
  }
    else{
      cout << x[n/2-1] << endl;
    }
    
  }
    
    
  
}

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

typedef long long ll;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define endl '\n'
#define vll std::vector<ll>

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

        ll a,b; cin >> a >> b;
        if(a <= 8 && b <= 8) cout << "Yay!\n";
        else cout << ":(\n";

        return 0;
}


Measured memory_bytes: 256
n = int(input())

dp = [False] * (n + 1)
dp[0] = True
for i in range(n-3):
    if dp[i]:
        dp[i+4] = True
for i in range(n-6):
    if dp[i]:
        dp[i+7] = True

if dp[n]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61812
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n, x;
  cin >> n >> x;
  vll a(n) ;
  for(ll i = 0; i < n; i++) cin >> a[i];
  vll xx ;
  ll cr  = 0;
  xx.pb(cr);
  for(ll i = 0; i < n; i++) {
    cr+= a[i];
    xx.pb(cr);
  }
  ll c = 0;
  for(ll i = 0; i < n+1; i++) if(xx[i] <= x) c++;
    cout << c << endl;
  return 0;
} //good night.

Measured memory_bytes: 256
#include<cstdio>
#include<bitset>
#include<vector>
#include<algorithm>
using namespace std;
bitset<410>liv[410];
vector<int>v;
int n,m,ans,a[100010],b[100010];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
		scanf("%d%d",a+i,b+i);
	for(int i=1;i<=n;i++){
		liv[i].set(i);
		bool ck=1;
		for(int j=m;j;j--){
			if(liv[i][a[j]]&&liv[i][b[j]]){
				ck=0;
				break;
			}
			if(liv[i][a[j]]||liv[i][b[j]]){
				liv[i].set(a[j]);
				liv[i].set(b[j]);
			}
		}
		if(ck)
			v.push_back(i);
	}
	for(int i=0;i<v.size();i++)
		for(int j=i+1;j<v.size();j++)
			ans+=((liv[v[i]]&liv[v[j]]).count()==0);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) { ll res=1; a%=mod; assert(b>=0); for(;b;b>>=1) { if(b&1) res=res*a%mod; a=a*a%mod; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }

int main() {
	int t;
	//cin >> t;
	t = 1;
	while(t--) {
		int n, k;
        cin >> n >> k;
        
        vector<int> arr(n);
        for(auto &x: arr)
            cin >> x;
        sort(arr.begin(), arr.end());
        
        ll sm = 0;
        for(int i=0; i<k; i++)
            sm += arr[i];
        
        cout << sm << endl;
	}

	return 0;
}

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

//highlight color RGB = [70,70,70]
#define asll unsigned long long
#define ll long long
#define ld long double
#define imt int
#define pii pair<int,int>
#define st first
#define nd second
#define kj <<" "<<
#define kjb <<" ";
#define dg <<","<<
#define ml <<endl;
#define co cout<<
#define ter cout<<endl;
#define sibi cout<<"TES"<<endl;
#define tes(x) cout<<"TES "<<x<<endl;
#define psbk(x) push_back(x);
#define For(x,a,b) for(int x=(a);x<(b);x++)
#define FOR(x,n) for(int x=0;x<(n);x++)
#define kera(x,m) for( int i = 0;i < m ; i++ ){ cout<<"x["<< i <<"] =" kj x[i] ml}
#define kpr(x) cout<<"("<<x.st dg x.nd <<")" ml
#define kkor(p) cout<<"("<<p.x dg p.y <<")" ml
#define m_p make_pair
asll M=1e9+7;
int n,m,tc;
int p,q,r;
int dp[2005];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(0);
	srand(time(0));
	cin>>m;
	dp[0]=1;//bisa WA
	dp[1]=0;
	dp[2]=0;
	for(int i=3;i<=m;i++){
		dp[i]=dp[i-3]+dp[i-1];
		dp[i]=dp[i]%M;
	}
	cout<<dp[m]<<endl;
}


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

int main(){
  int n,l;cin>>n>>l;//l: 文字列の長さ
  vector <string> word(n);

  for(int i=0;i<n;++i) cin >>word[i];
  sort(word.begin(),word.end());
  for (auto str:word) cout << str; cout << endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
t = input()

s = sorted(s)
t = sorted(t, reverse=True)

s_length = len(s)
t_length = len(t)

w1 = ''
w2 = ''

for a in range(0, s_length):
    w1 += s.pop(0)

for a in range(0, t_length):
    w2 += t.pop(0)

if w1 < w2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
int main()
{
    unsigned long long int a, b;
    scanf("%lld %lld", &a, &b);
    unsigned long long int ans = 0;
    unsigned long long int p = 1;
    while (p <= b)
    {
        if (p == 1)
        {
            if ((b - a) % 2 == 1)
            {
                if (((b - a + 1) / 2) % 2 == 1)
                    ans += p;
            }
            else
            {
                if (a % 2 == 0)
                {
                    if (((b - a) / 2) % 2 == 1)
                        ans += p;
                }
                else
                {
                    if (((b - a) / 2) % 2 == 0)
                        ans += p;
                }
            }
        }
        else
        {
            if (a % (2 * p) < p)
            {
                if (b % (2 * p) >= p)
                {
                    if (((b % (2 * p)) - p) % 2 == 0)
                        ans += p;
                }
            }
            else
            {
                if (b % (2 * p) < p)
                {
                    if ((a % (2 * p)) % 2 == 1)
                        ans += p;
                }
                else
                {
                    if (abs((a % (2 * p)) - (b % (2 * p))) % 2 == 0)
                        ans += p;
                }
            }
        }
        p *= 2;
    }
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
//bを何回足せばaを超えるか
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
const int INF=100000001,ID_MAX=20;
int bi_e[ID_MAX]={0};
//2進数表示したときの最高桁
int bi_max(long n){
    int m=0;
    for(m;pow(2,m)<=n;m++);m=m-1;
    return m;
}
//bi_eに二進数表示したやつを代入
void bi_exs(long n){
    rep(i,ID_MAX){
        bi_e[i]=0;
    }
    if(n<pow(2,ID_MAX)){
        int m=bi_max(n);
        long l;
        for(m;m>-1;m--){
            l=pow(2,m);
            bi_e[m]=n/l;
            n=n%l;
        }
    }
}

const long N=100000;

int main(){
    int i;
    //入力
    long n,count=1;
    cin>>n;
    long x[n],l[n];
    rep(i,n){
        cin>>x[i]>>l[i];
    }
    //処理
    long b[n];
    rep(i,n){
        b[i]=i;
    }
    sort(b,b+n,[&x,&l](long i,long j)->bool{return x[i]+l[i]<x[j]+l[j];});
    long l_min=x[b[0]]+l[b[0]];
    for(int i=1;i<n;i++){
        if(x[b[i]]-l[b[i]]>=l_min){
            l_min=x[b[i]]+l[b[i]];
            count+=1;
        }
    }
    //出力
    cout<<count<<endl;
}

Measured memory_bytes: 2560
s=input()
n=len(s)
v=[[0]*13 for i in range(n+1)]
v[0][0]=1
m=10**9+7
for i in range(n):
    for j in range(13):
        for k in range(10):
            x=(10*j+k)%13
            v[i+1][x]=(v[i+1][x]+(1 if s[i]=='?' or s[i]==str(k) else 0)*v[i][j])%m
print(v[n][5])


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

int main(){
  int N,K; cin>>N>>K;
  vector<int> H(N);
  rep(i,N)cin>>H.at(i);
  int res = 0;
  rep(i,N)if(H.at(i)>=K)res++;
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1; char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=1e6+20;

int n;
char S[maxn],T[maxn];

inline void init()
{
	n=read();
	scanf("%s",S+1);
	scanf("%s",T+1);
}

int ans;

inline void doing()
{
	deque<int>q;q.push_back(n+1);
	for(int i=n,j=n+1,del=0;i;i--)
	{
		int tmp=j;
		while(j && (j>i || S[j]!=T[i]))j--;
		if(!j)puts("-1"),exit(0);
		if(j==tmp)
		{
			while(!q.empty() && q.back()-del>=i)q.pop_back();
			q.push_back(i+del); 
		}else
		{
			del++;
			if(i!=j)
			{
				chkmax(ans,SZ(q));
				q.push_front(j+del);
			}
		}
	}
	printf("%d\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}



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

using namespace std;

int n,m;

int main(){
    cin>>n>>m;
    
    n--,m--;
    
    if(m>0&&n>0)
    {
        cout<<m*n<<endl;
    }
    else 
    {
        cout<<0<<endl;
    }
    return 0;
}

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

int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0, mn = 2e9;
  bool ok = false;
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    ans += b;
    if (a > b)
      mn = min(mn, 1LL * b), ok = true;
  }
  printf("%lld\n", (ok ? ans - mn : 0));
  return 0;
}

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

int main()
{
    int n, t, a;
    cin >> n >> t >> a;
    vector<int> h(n);
    vector<int> xxx(n);
    int hozon = 100000000;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> h.at(i);
        xxx.at(i) = 1000 * (t - h.at(i) * 0.006);
        xxx.at(i) = abs(a * 1000 - xxx.at(i));
        hozon = min(hozon, xxx.at(i));
        if (hozon == xxx.at(i))
        {
            ans = i + 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import Control.Monad
import Data.Function
import Data.Char
import Data.List
import Text.Read
import Text.ParserCombinators.ReadPrec

import qualified Data.ByteString.Char8 as B

newtype Pair a b = Pair { getPair :: (a, b) }

instance (Read a, Read b) => Read (Pair a b) where
  readPrec = Pair `dot` (,) <$> readPrec <* get <*> readPrec

instance (Show a, Show b) => Show (Pair a b) where
  show (Pair (a, b)) = show a ++ " " ++ show b

infixr 8 `dot`
dot :: (c -> d) -> (a -> b -> c) -> a -> b -> d
dot = ((.).(.))

main :: IO ()
main = do
  (x, y) <- getPair <$> readLn
  putStrLn $ if solve x y then "Yes" else "No"

solve :: Int -> Int -> Bool
solve x y = or [ 2 * t + 4 * (x - t) == y | t <- [0 .. x] ]


Measured memory_bytes: 3908
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def bs(ar,eq,n) en=(eq==1 ? :>= : :>); ar.bsearch_index{|x|x.send(en,n)} end
def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n = gi
a1 = gsmi
a2 = gsmi

prev1 = sum(a1)
prev2 = a2[-1]
max = prev1 + prev2

1.upto(n-1) do |i|
  prev1 -= a1[n-i]
  prev2 += a2[n-i-1]
  cnt = prev1 + prev2
  #debug "i:#{i},cnt",cnt
  max = cnt if cnt>max
end

puts max


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

int main() {
  int a,b,c,k; cin >> a >> b >> c >> k;

  if(k <= a) { cout << k << endl; }
  else if(k > a) {
    if(b >= k-a) { cout << a << endl; }
    else { cout << a - (k-a-b) << endl; }
  }

  return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
  static int n, k;
  static int[] W;

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      n = sc.nextInt();
      k = sc.nextInt();
      W = new int[n];
      for (int i = 0; i < W.length; i++) {
        W[i] = sc.nextInt();
      }
      solve();
    }
  }

  static void solve() {
    // 最小の積載量を探す。
    // pの候補を線形探索しては間に合わないので二分探索
    int begin = 0;
    int end = 100000 * 10000;// とりあえず n * Wi

    while (end - begin > 1) {
      int center = (begin + end) / 2;
      int target = chackCnt(center);
      if (target >= n) {
        end = center;// 前を探す
      } else {
        begin = center;// 後を探す
      }

    }
    System.out.println(end);
  }

  /**
   * 積載量pのトラックk台で何個積めるか
   */
  static int chackCnt(int p) {
    int cnt = 0;
    for (int j = 0; j < k; j++) {
      int s = 0;
      while (s + W[cnt] <= p) {
        s += W[cnt];
        cnt++;
        if (cnt == n)
          return n;
      }
    }
    return cnt;
  }
}



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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
    int n;
    cin >> n;
    printf("%d\n", 800 * n - (n/15) * 200);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n,l;
  cin>>n>>l;
  int s=0;
  repeat(i,1,n+1) {
    s+=l+i-1;
  }
  int score=abs(l+1-1);
  int aji = s-(l+1-1);
  repeat(i,2,n+1) {
    if(abs((l+i-1))<score) {
      score=abs((l+i-1));
      aji = (s-(l+i-1));
    }
  }
  cout << aji << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int c[] = new int[9];
        for(int i=0;i<9;++i)c[i]=scan.nextInt();
        for(int i=0;i<2;++i){
            int d=c[i*3] - c[(i+1)*3];
            for(int j=0;j<3;++j){
                if(c[i*3+j]-c[(i+1)*3+j]!=d){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}

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

int main(){
    vector<vector<int>> data(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>data.at(i).at(j);
        }
    }
    int n;
    cin>>n;
    vector<int> vec(n);
    for(int k=0;k<n;k++){
        cin>>vec.at(k);
    }
    int num=0;
    while(num<n){
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(data.at(i).at(j)==vec.at(num)){
                    data.at(i).at(j)=0;
                }
            }
        }
        num++;
    }
    string message="No";
    for(int i=0;i<3;i++){
        if(data.at(i).at(0) + data.at(i).at(1) + data.at(i).at(2) == 0){
            message="Yes";
        }
        if(data.at(0).at(i) + data.at(1).at(i) + data.at(2).at(i) == 0){
            message="Yes";
        }
    }
    if(data.at(0).at(0) + data.at(1).at(1) + data.at(2).at(2) == 0){
            message="Yes";
        }
    if(data.at(0).at(2) + data.at(1).at(1) + data.at(2).at(0) == 0){
            message="Yes";
        }
    cout << message <<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    int b[N], memo[N];
    rep(i, N) cin >> b[i];
    rep(i, N) memo[i] = b[i];
    rep(i, N){
        if(b[i] > i+1) {cout << -1 << endl; return 0;}
    }
    vector<int> ans;
    rep(i, N){
        rep3(j, N-1, 0){
            if(b[j] == j+1){
                ans.pb(memo[j]);
                b[j] = 0;
                rep2(k, j+1, N-1) b[k]++;
                break;
            }
        }
    }
    rep3(i, N-1, 0) cout << ans[i] << endl;
}

Measured memory_bytes: 256
(* O(|s|^2) *)
let s = read_line ()
let t = read_line ()
let n = String.length s
let s2 = s ^ s
let _ =
  for i = 0 to n - 1 do if String.sub s2 i n = t then (print_endline "Yes"; exit 0) done;
  print_endline "No"

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

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

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

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans;
    if(n%(a+b) != 0) ans = n/(a+b)*a+min(n%(a+b), a);
    else ans = n/(a+b)*a;

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


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	long long a, b, x;
	cin >> a >> b >> x;
	if (a != 0)cout << (b / x + 1) - ((a - 1) / x + 1) << endl;
	else cout << b / x + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M, K = mapint()
As = [0]+list(mapint())
Bs = [0]+list(mapint())
from itertools import accumulate
from bisect import bisect_right
ac = list(accumulate(As))
bc = list(accumulate(Bs))

ans = 0
for i in range(N+1):
    now = ac[i]
    rest = K-now
    if rest<0:
        break
    idx = bisect_right(bc, rest)
    ans = max(ans, i+idx-1)
print(ans)
    

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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for (int i = a; i <= b; i++) {
		if (c % i == 0)
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3112
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   998244353
#define PI 2*acos(0.0)
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}

//=============================================ASIFAZAD==============================================//


int32_t main()
{
    io;
    int n;
    cin>>n;
    string s;
    cin>>s;
    int cnt = 0;
    set<int> ind;
    for(int i = 0; i< n;i++)
    {
        if(s[i] == '1')
        {
            cnt++;
            ind.insert(n-1-i);
        }
    }
    vi p1(n), p2(n);
    p1[0] = 1, p2[0] = 1;
    for(int i = 1; i< n; i++)
    {
        p1[i] = p1[i-1]*2LL%(cnt+1);
        if(cnt-1)
            p2[i] = p2[i-1]*2LL%(cnt-1);
    }
    int x1 = 0, x2 = 0;
    for(auto i: ind)
    {
        x1 = (x1 + p1[i])%(cnt+1);
        if(cnt-1)
            x2 = (x2 + p2[i])%(cnt-1);
    }
    for(int i = 0; i< n;i++)
    {
        if(cnt -1 == 0 && s[i] == '1')
        {
            cout<<"0\n";
            continue;
        }
        int ac, mv = 1;
        if(s[i] == '0')
            ac = (x1 + p1[n-1-i])%(cnt+1);
        else
            ac = (x2 - p2[n-1-i] + cnt-1)%(cnt-1);
        while(ac)
        {
            bitset<30> b(ac);
            mv++;
            ac = ac%b.count();
        }
        cout<<mv<<"\n";
    }
    return 0;
}

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

bool is_ok(const vector<int>& skill, int border)
{
  for (int x : skill) {
    if (x < border) {
      return false;
    }
  }
  return true;
}

int main()
{
  int nbook, nskill, border;
  cin >> nbook >> nskill >> border;
  vector<vector<int>> book(nbook, vector<int>(nskill+1));
  for (int i = 0; i < nbook; i++) {
    // cost
    cin >> book.at(i).at(0);
    for (int k = 1; k <= nskill; k++) {
      cin >> book.at(i).at(k);
    }
  }
  int res = INT_MAX;
  for (int i = 0; i < (1<<nbook); i++) {
    int cost = 0;
    vector<int> skill(nskill+1);
    skill.at(0) = 1e9;
    for (int shift = 0; shift < nbook; shift++) {
      if ((i & (1<<shift)) == 0) {
        continue;
      }
      cost += book.at(shift).at(0);
      for (int k = 1; k <= nskill; k++) {
        skill.at(k) += book.at(shift).at(k);
      }
    }
    if (is_ok(skill, border)) {
      res = min(res, cost);
    }
  }
  if (res == INT_MAX) {
    cout << "-1\n";
  } else {
    cout << res << '\n';
  }
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int A,B;
	cin>>A>>B;
	for(int i=0;i<2000;i++){
		if(i*8/100==A&&i*10/100==B){cout<<i;return 0;}
	}
	cout<<-1;
	return 0;
}

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

using namespace std;

int main()
{
    ll n;
    cin>>n;
    vector <ll > v;
    v.resize(n);
    for(int i=0;i<n;i++) cin>>v[i];
    ll h=0,mx=v[0];
    for(int j=0;j<n-1;j++){
        if(v[j]>v[j+1]){
            h+=v[j]-v[j+1];
            v[j+1]=v[j];
        }
    }
    cout<<h;
    return 0;
}



Measured memory_bytes: 4832
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto S = RD!string;
	long ans = 1;
	foreach (i; 1..N)
	{
		if (S[i] != S[i-1])
			++ans;
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

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

int main()
{

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

Measured memory_bytes: 256
import numpy as np
N,M = map(int,input().split())
H = np.array(list(map(int,input().split())))

adj = [[] for _ in range(N)]

for _ in range(M):
    a,b = map(lambda x: int(x) -1 ,input().split())
    if a in adj[b]:
        continue
    adj[a].append(b)
    adj[b].append(a)

ans = 0 
for i, item in enumerate(adj):
     if item == []:
         ans+=1
         continue
     adj_max = max(H[item])
     if H[i] > adj_max:
         ans += 1
print(ans)

Measured memory_bytes: 44640
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <queue>

using namespace std;

typedef pair<long,long> P;

int main() {
  long n,m;
  long ans=0;
  cin >> n >> m;
  vector< vector<long> > jobs(m+1);

  for (int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    if(a>m) continue;
    jobs[a].push_back(b);
  }

  priority_queue<int> pq;
  for (int i=1; i<=m; i++) {
    for (auto j : jobs[i]) pq.push(j);

    if(pq.empty()) continue;

    ans += pq.top();
    pq.pop();
  }

  cout << ans << endl;
}


Measured memory_bytes: 5632
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for x in A:
    d[x] += 1
cnt = 0
for x in d:
    if d[x] >= 2 and d[x] % 2 == 0:
        cnt += 1
ans = len(d.keys())
if cnt % 2 == 1:
    ans -= 1
print(ans)

Measured memory_bytes: 22124
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
  long long a,b,x;
  scanf("%lld %lld %lld",&a,&b,&x);
  if(a%x==0) printf("%lld\n",b/x-a/x+1);
  else printf("%lld\n",b/x-a/x);
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextLong();
        }

        // dp[i][j] ... 区間[i, j)における、X-Yの値
        long[][] dp = new long[n + 1][n + 1];

        for (int len = 1; len <= n; len++) {
            for (int i = 0; i <= n - len; i++) {
                int j = i + len;
                boolean isFirst = (n - len) % 2 == 0;
                if (isFirst) {
                    dp[i][j] = Math.max(dp[i + 1][j] + arr[i], dp[i][j - 1] + arr[j - 1]);
                } else {
                    dp[i][j] = Math.min(dp[i + 1][j] - arr[i], dp[i][j - 1] - arr[j - 1]);
                }
            }
        }

//        debug(dp);

        System.out.println(dp[0][n]);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 130040