akhauriyash/Code-Regression huggingface dataset:
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
#define MATH_PI 3.14159265358979323846
int arrCount[200005] = { 0 };
bool cmp(int iNum1, int iNum2){
	return iNum1 > iNum2;
}
int main(){
	ios::sync_with_stdio(false);
	int nCount, nDiff, i, iTemp, iSum=0;
	cin >> nCount >> nDiff;
	for (i = 1; i <= nCount; ++i){
		cin >> iTemp;
		++arrCount[iTemp];
	}
	sort(arrCount, arrCount + 200005,cmp);
	for (i = nDiff; arrCount[i] != 0; ++i){
		iSum += arrCount[i];
	}
	cout << iSum << endl;
endapp:
	//system("pause > nul");
	return 0;
}

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

int main() {
	int h,a;
	cin>>h>>a;
	if(h%a==0)cout<<h/a<<endl;
	else cout<<h/a+1<<endl;
}


Measured memory_bytes: 256
object Main {
    def step(l: List[Int], c: Array[Int]) = l.updated(c(0), l(c(1))).updated(c(1), l(c(0)))
    def main(args: Array[String]) = {
        val in = io.Source.stdin.getLines.map(_.split(",").map(_(0) - 65))
        println((in.foldLeft(List(1, 0, 0))(step).indexWhere(_ == 1) + 65).toChar)
    }
}

Measured memory_bytes: 44204
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;
using Pos = std::pair<int, int>;
//cout<<fixed<<std:cout<<fixed<<setprecision(2)<<Max<<endl;


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

    cout<<800*N-(int)(N/15)*200<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <stack>
#include <queue>
#include <set>

#define mod 1000000007
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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

//最大公約数
ll gcd(ll a, ll b){
    return b?gcd(b, a%=b):a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= n; j++){
            for(ll k = 1; k <= n; k++){
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>

using namespace std;
using LLI = long long int;
LLI N;

//vector<int>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//vector<int>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//vector<int>dir_x2 = { 0,0,1,-1 };
//vector<int>dir_y2 = { 1,-1,0,0 };
//vector<char>alp = { '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' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI tmp, r;
//	if (x < y) {
//		tmp = x;
//		x = y;
//		y = tmp;
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x,LLI y) {
//	return x / gcd(x,y) * y;
//}

//long nCr(int n,int r) {
//	long ans = 1;
//	for (int i = n; i > n - r;i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1;i++) {
//		ans = ans / i;
//	}
//	return ans;
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

int main(void) {
	int MAX = 0,MAX2 = 0;
	string S;
	cin >> S;
	for (int i = 0; i < S.size();i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
			MAX++;
		}
		else {
			if (MAX > MAX2) {
				MAX2 = MAX;
			}
			MAX = 0;
		}
	}
	if (MAX > MAX2) {
		MAX2 = MAX;
	}
	cout << MAX2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <ll, pair <ll, ll>>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()
#define vvl vector <vector <ll> >
 
typedef long long ll;
 
typedef long double ld;
 
using namespace std;
 
const ll maxn = 1e6 + 100;
const ll maxc = 1e9;

ll n, m, k, t;

ll A[maxn];

vector <ll> I[maxn];

ll J[maxn];

ll F[maxn];

void solve(ll i) {
    vector <ll> ANS;
    // cout << " SOLVING " << i << endl;
    ll q, w;
    while (1) {
        ll j = J[i] + 1;
        // cout << i << " " << j << endl;
        if (I[A[i]].back() == i) {
            // cur++;
            // j = 0;
            j--;
            ANS.pb(A[i]);
        }
        i = (I[A[i]][j] + 1);
        if (i >= n) {
            break;
        }
    }
    for (q = 0; q < ANS.size(); q++) {
        cout << ANS[q] << " ";
    }
    exit(0);
}

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c;
    cin >> n >> k;
    // if (n == 1) {
    //     while(1) {
    //         n++;
    //     }
    // }
    for (q = 0; q < n; q++) {
        cin >> A[q];
        J[q] = I[A[q]].size();
        I[A[q]].pb(q);
    }
    // cout << I[1].size() << endl;
    // if (n == 1) {
    //     if (k % 2) {
    //         cout << A[0];
    //     }
    //     return 0;
    // }
    vector <ll> starts = {0};
    for (q = 1; q < n; q++) {
        F[q] = -1;
    }
    ll i = 0;
    ll cur = 0;
    while (1) {
        // cout << i << " " << cur << " I CUR" << endl;
        if (cur == k - 1) {
            solve(i);
        }
        ll j = J[i] + 1;
        if (I[A[i]].back() == i) {
            cur++;
            j = 0;
            // cout << "HERRE " << j << endl;
            i = (I[A[i]][j] + 1) % n;
            starts.pb(i);
            F[i] = cur;
        }
        else {
            // cout << "ANOTHER WAY OUT" << endl;
            i = (I[A[i]][j] + 1) % n;
        }
        if (cur == k - 1 && i == 0) {
            break;
        }
        if (i == 0) {
            cur++;
            // cout << cur << " " << k << endl;
            starts.pb(i);
            // if (F[i] != -1) {
                // cout << "PYMAV 2 " << i << " " << cur << " " << F[i] << endl;
            ll k1 = k - 1;
            ll c = k1 % (cur);
            // cout << c << " C" << endl;
            ll ind = starts[c];
            // cout << "IND " << ind << endl;
            solve(ind);
            // }
            // F[i] = cur;
        }
    }
    return 0;
}


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

#define fi first
#define se second
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 1e5 + 5;
const int MAXM = 1e7+5;

namespace Flow{
	struct Edge{
		int to,w,nxt;
	}e[MAXN<<1];
	int head[MAXN],cur[MAXN],cnt=1;
	int dep[MAXN];
	int S,T,N;

	inline void add(int u,int v,int w){
		e[++cnt] = (Edge){v,w,head[u]};head[u] = cnt;
		e[++cnt] = (Edge){u,0,head[v]};head[v] = cnt;
	}

	inline bool bfs(){
		FOR(i,0,N) cur[i] = head[i],dep[i] = 0;
		std::queue<int> q;q.push(S);dep[S] = 1;
		while(!q.empty()){
			int v = q.front();q.pop();
			for(int i = head[v];i;i = e[i].nxt){
				if(e[i].w > 0 && !dep[e[i].to]){
					dep[e[i].to] = dep[v] + 1;
					if(e[i].to == T) return true;
					q.push(e[i].to);
				}
			}
		}
		return dep[T];
	}

	inline int dfs(int v,int flow=1e9){
		if(v == T) return flow;
		if(!flow) return 0;
		int ans = 0;
		for(int &i = cur[v];i;i = e[i].nxt){
			if(e[i].w > 0 && dep[e[i].to] == dep[v] + 1){
				int t = dfs(e[i].to,std::min(flow,e[i].w));
				if(t>0){
					ans += t;flow -= t;
					e[i].w -= t;e[i^1].w += t;
					if(!flow) break;
				}
			}
		}
		return ans;
	}

	inline int Dinic(){
		int ans = 0,t = 0;
		while(bfs()) while((t=dfs(S))) ans += t;
		return ans;
	}
};
using namespace Flow;

inline bool isprime(int x){
	if(x == 1) return 0;
	int q = std::sqrt(1.0*x);
	FOR(i,2,q){
		if(!(x%i)) return 0;
	}
	return 1;
}
std::vector<int> s,t;
int a[MAXM];

int main(){
//	freopen("../TestData/2.in", "r", stdin);
	int n;scanf("%d",&n);
	FOR(i,1,n){
		int x;scanf("%d",&x);a[x] = 1;
	}
	FOR(i,1,MAXM-1){
		if(a[i]^a[i-1]){
			if(i&1) s.pb(i);
			else t.pb(i);
		}
	}
	N = s.size()+t.size();S = ++N;T = ++N;
	FOR(i,0,(int)s.size()-1) add(S,i+1,1);
	FOR(i,0,(int)t.size()-1) add(s.size()+i+1,T,1);
	FOR(i,0,(int)s.size()-1){
		FOR(j,0,(int)t.size()-1){
			if(isprime(std::abs(s[i]-t[j]))){
				add(i+1,j+s.size()+1,1);
			}
		}
	}
	int ans = Dinic();
	printf("%d\n",ans+(((int)s.size()-ans)/2)*2+(((int)t.size()-ans)/2)*2+3*(((int)s.size()-ans)&1));
	return 0;
}

Measured memory_bytes: 39168
#include<iostream>
#include<iomanip>
#include<vector>
#include<math.h>
using namespace std ;

int main(){
	int n ; cin >> n ;
	vector<vector<int>> xy(n,vector<int>(2)) ;
	for(int i=0;i<n;i++) cin >> xy.at(i).at(0) >> xy.at(i).at(1) ;
	long double sum = 0 ;
	for(int i=0;i<n;i++)
		for(int j=1;i+j<n;j++){
			int x = xy.at(i).at(0) - xy.at(i+j).at(0) ;
			int y = xy.at(i).at(1) - xy.at(i+j).at(1) ;
			sum += pow(x*x+y*y,0.5)*2/n ;
		}
	cout << fixed << setprecision(10) << sum << endl ;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
double a,b,n,x;
int main()
{
	cin>>a>>b>>n;
	if(n<b)
	{
		x=n;
	}
	else
	{
		x=b-1;
	}
	cout<<floor(a*(x/b-floor(x/b)))<<endl;
	return 0;
}

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

int main()
{
    char a[100],b[100],c[100];
    int x,y;
    scanf("%s %s %d %d %s",&a,&b,&x,&y,&c);
    if((strcmp(a,c))==0){
        printf("%d %d",x-1,y);
    }
    if((strcmp(b,c))==0){
        printf("%d %d",x,y-1);
    }
 
        
    return 0;
}

Measured memory_bytes: 1700
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.IntUnaryOperator;
import java.util.function.LongUnaryOperator;

class Main {
    static In in = new In();
    static Out out = new Out();
    static long mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        int n = in.nextInt();
        long[] a = in.nextLongArray(n);
        long use = 0;
        while (true) {
            long count = 0;
            for (int i = 0; i < n; i++) {
                count += (a[i] + use + 1) / (n + 1);
            }
            if (use >= count) {
                break;
            }
            use = count;
        }
        System.out.println(use);
    }

    public static void main(String[]$) {
        new Main().solve();
        out.flush();
    }
}

class In {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}

class Out {
    private static PrintWriter out = new PrintWriter(System.out);

    void println(Object... a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (Object obj : a) {
            joiner.add(String.valueOf(obj));
        }
        out.println(joiner);
    }

    void flush() {
        out.flush();
    }
}


Measured memory_bytes: 22740
/* ****GT_18**** */

#include<bits/stdc++.h>
#define	MIN(a,b,c)	min(min(a,b),c)
#define	MAX(a,b,c)	max(max(a,b),c)
#define ll          long long
#define itr         vector<int>::iterator
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--)
	{
		int n,m,f=0;;
		cin>>n>>m;
		string a[n],b[m];
		rep(i,0,n)cin>>a[i];
		rep(i,0,m)cin>>b[i];
		rep(i,0,n-m+1)
		{
			f=0;
			rep(j,0,n-m+1)
			{
				f=0;
				rep(k,i,i+m)
				{
					rep(l,j,j+m)
					{
						if(b[k-i][l-j]!=a[k][l])
						{
							f=1;
							break;
						}
					}
					if(f)break;
				}
				if(!f)break;
			}
			if(!f)break;
		}
		if(!f)cout<<"Yes";
		else cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

if sum(A) == 0:
    print('Yes')
    exit()

if len(A) % 3 != 0:
    print('No')
    exit()

c = Counter(A)
if len(c.values()) == 2:
    values = list(c.values())
    if min(values) == N // 3:
        keys = list(c.keys())
        if 0 in keys:
            print('Yes')
            exit()

if len(c.values()) != 3:
    print('No')
    exit()

keys = list(c.keys())
for i, j, k in ([0, 1, 2], [1, 2, 0], [2, 1, 0]):
    if keys[i] ^ keys[j] != keys[k]:
        print('No')
        exit()

values = list(c.values())
if values[0] != values[1] or values[1] != values[2]:
    print('No')
    exit()

print('Yes')

# a b c a b c ...
# a xor b = c
# b xor c = a
# c xor a = b

# 全員0

# x 0 x x 0 x ...


Measured memory_bytes: 14468
#include <iostream>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>

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

using namespace std;
using ll = long long;
const int mod = 1e9+7;

int main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> A(x),B(y),C(z);
    rep(i,x) cin >> A[i];
    rep(i,y) cin >> B[i];
    rep(i,z) cin >> C[i];

    sort(A.begin(),A.end(),greater<ll>() );
    sort(B.begin(),B.end(),greater<ll>() );
    sort(C.begin(),C.end(),greater<ll>() );

    vector<ll> ans;

    rep(a,x){
        rep(b,y){
            if((a+1)*(b+1) > k) break;
            rep(c,z){
                if((a+1)*(b+1)*(c+1) > k) break;
                ans.push_back(A[a]+B[b]+C[c]);
            }
        }
    }
    sort(ans.begin(),ans.end(),greater<ll>() );
    rep(i,k) cout << ans[i] << endl;
    
    return 0;
}

Measured memory_bytes: 1404
m=int(input())
N=input()
cnt=N.count('R')*N.count('G')*N.count('B')
#print(cnt)
for i in range(m-2):
  #print(i,'*',int((m+i)/2))
  for j in range(i+1,int((m+i-1)/2)+1):
    k=2*j-i
    #print(i,j,k)
    if N[k] != N[j] and N[j] != N[i] and N[i] != N[k]:
      #print(i,j,k)
      cnt-=1
print(cnt)

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

using namespace std;

long long n;

int main() {
    cin >> n;
    if (n & 1) cout << "0\n";
    else {
        long long ans = 0;
        for (long long i = 10; i <= n; i *= 10) {
            if (i % 50 != 0) ans += (n / i);
        }
        for (long long i = 50; i <= n; i *= 5) ans += (n / i);
        cout << ans << '\n';
    }
}

Measured memory_bytes: 256
#include <cstdio>
int min(int a, int b) {
	return a<=b?a:b;
}
int main() {
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	printf("%d\n",min(a,min(b,c))+min(d,e)-50);
}

Measured memory_bytes: 0
#include <stdio.h>


int main()

 { 
  	int a, b;

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

	if(a>b)
		printf("a > b\n");
	else if(a<b)
		printf("a < b\n");
	else
		printf("a == b\n");
	
 }



Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

bool dbgflag = false;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n, -1) {}

  //functions
  void init_tree() {
    for (int i = 0; i < d.size(); i++) {
      d[i] = -1;
    }
  }

  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }

  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }

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

  int size(int x) {
    return -d[find(x)];
  }
};

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

  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  vector<pii> bridge(m);
  for (int i = 0; i < m; i++) {
    int s, t;
    cin >> s >> t;
    s--; t--;
    bridge[i].first = s;
    bridge[i].second = t;
  }

  int cnt = 0;
  for (int i = 0; i < m; i++) {
    uf.init_tree();
    for (int j = 0; j < m; j++) {
      if (i == j) continue;
      uf.unite(bridge[j].first, bridge[j].second);
    }
    if (uf.size(0) != n) cnt++;
  }

  cout << cnt << endl;
}


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

int main(void) {

	int a, b, c;

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

	c = a + b;

	if (c >= 10) {
		printf("error\n");
	}
	else {
		printf("%d\n", c);
	}

	return 0;
}

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

using namespace std;

long long eval(string &s) {
	string at = "";
	long long ans = 0;
	for (int i = 0; i < (int)s.size(); ++i) {
		if(s[i] == '+') {
			ans += stoll(at);
			at = "";
		} else {
			at += s[i];
		}
	}
	if(at != "") {
		ans += stoll(at);
	}
	return ans;
}

int main() {
	string s;
	cin >> s;
	int len = s.size();
	long long ans = 0;
	for (int msk = 0; msk < (1<<(len-1)); ++msk) {
		vector <int> plus;
		for (int i = 0; i < len-1; ++i) {
			if(msk & (1<<i)) {
				plus.push_back(i+1);
			}
		}
		int j = 0;
		string at = "";
		for (int i = 0; i < len; ++i) {
			if(j < plus.size() && plus[j] == i) {
				at += "+";
				j++;
			}
			at += s[i];
		}
		//cout << at << endl;
		ans += eval(at);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */
/* main */
int main(){

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

    int q; cin >> q;
    for (int i = 0; i < q; i++) {
        int b, e; cin >> b >> e;
        // A[b] , ..., A[e-1];
        auto first = A.begin() + b;
        auto last = A.begin() + e;
        int target; cin >> target;
        int cnt = count(first, last, target);
        cout << cnt << '\n';
    }
}



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

int main(){
    int ans=0;
    int n,d;
    int dist,distint;
    cin >> n>>d;
    int data[n][d];

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


    for (int i = 0; i < n; i++){
        
        for (int j = 0; j < n; j++){
            if(j==i)continue;
            dist=0;
            for (int k = 0; k < d; k++){
                dist += (data[i][k]-data[j][k])*(data[i][k]-data[j][k]);
            }
            distint =(int)sqrt(dist);
            if(sqrt(dist)==distint)ans++;
        }
    }
    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans/2 << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
local ior = io.input()
local n = ior:read("*n")
local lines = {}
for i = 1, n do lines[i] = {} end
for i = 1, n - 1 do
  local a, b, c = ior:read("*n", "*n", "*n")
  lines[a][b] = c
  lines[b][a] = c
end
local q, k = ior:read("*n", "*n")
local tasks = {k}
local map = {}
for i = 1, n do map[i] = -1 end
map[k] = 0
local tasknum, done = 1, 0
while(done < tasknum) do
  done = done + 1
  local taskidx = tasks[done]
  for k, v in pairs(lines[taskidx]) do
    if(map[k] == -1) then
      map[k] = map[taskidx] + v
      table.insert(tasks, k)
      tasknum = tasknum + 1
    end
  end
end
for i = 1, q do
  local x, y = io.read("*n", "*n")
  print(map[x] + map[y])
end


Measured memory_bytes: 28280
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

int main(){
  char c; cin >> c;
  
  rep(i,27){
    if(large[i] == c){
      cout << "A" << endl;
      return 0;
    }
    
  }
  
  cout << "a" << endl;
  
  
}

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

int board[6000][6];

int main() {
	int n;
	while(cin >> n, n) {
		int top[8];

		for(int i = 0; i < 6000; i++)
			for(int j = 0; j < 6; j++)
				board[i][j] = 0;
		for(int i = 0; i < 8; i++)
			top[i] = 0;

		for(int i = 0; i < n; i++) {
			int d, p, q;
			cin >> d >> p >> q;

			if(d == 1) {
				int h_max = -1;
				for(int j = 0; j < p; j++) {
					h_max = max(top[q - 1 + j], h_max);
				}
				for(int j = 0; j < p; j++) {
					board[h_max][q - 1 + j] = 1;
					top[q - 1 + j] = h_max + 1;
				}

				bool flg = true;
				for(int j = 0; j < 5; j++)
					flg = flg && board[h_max][j];
				if(flg) {
					for(int j = 0; j < 5; j++) {
						for(int k = h_max; k < top[j]; k++) {
							board[k][j] = board[k + 1][j];
						}
					}

					for(int j = 0; j < 5; j++) {
						int tmp = top[j];
						top[j] = 0;
						for(int k = tmp; k >= 0; k--) {
							if(board[k][j]) {
								top[j] = k + 1;
								break;
							}
						}
					}
				}
			}

			else {
				for(int j = 0; j < p; j++) {
					board[top[q - 1] + j][q - 1] = 1;
				}

				int h = top[q - 1];
				top[q - 1] += p;
				int del = 0;
				for(int j = 0; j < p; j++) {
					bool flg = true;
					for(int k = 0; k < 5; k++) {
						flg = flg && board[h + j - del][k];
					}
					if(flg) {
						del++;
					}
					for(int k = 0; k < 5; k++) {
						board[h + j + 1 - del][k] = board[h + j + 1][k];
					}
				}
				for(int j = 0; j < 5; j++) {
					for(int k = h + p - del; k < top[j] + 10; k++) {
						board[k][j] = board[k + del][j];
					}
				}
				for(int j = 0; j < 5; j++) {
					int tmp = top[j];
					top[j] = 0;
					for(int k = tmp; k >= 0; k--) {
						if(board[k][j]) {
							top[j] = k + 1;
							break;
						}
					}
				}
			}
		}

		int ans = 0;
		for(int i = 0; i < 6000; i++) {
			for(int j = 0; j < 5; j++) {
				ans += board[i][j];
			}
		}

		/*
		   for(int i = 10; i >= 0; i--) {
		   for(int j = 0; j < 5; j++) {
		   cout << (board[i][j] ? '*' : '.');
		   }
		   cout << endl;
		   }
		   cout << endl;
		// */
		/*
		   for(int i = 0; i < 5; i++)
		   cout << top[i] << " ";
		   cout << endl;
		// */
		cout << ans << endl;
	}
}

Measured memory_bytes: 1300
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 ll long long
#define pb(a) push_back(a)

ll mod = 1e9 + 7;

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

  ll n;
  cin >> n;

  ll a[4];
  REP(i, 4){
    a[3 - i] = n % 10;
    n /= 10;
  }
  ll p, q, r;
  char x, y, z;
  REP(i, 2){
    REP(j, 2){
      REP(k, 2){
        p = i ? a[1] : -a[1];
        x = i ? '+' : '-';

        q = j ? a[2] : -a[2];
        y = j ? '+' : '-';

        r = k ? a[3] : -a[3];
        z = k ? '+' : '-';

        if(a[0] + p + q + r == 7){
          cout << a[0] << x << a[1] << y << a[2] << z << a[3] << "=7" << endl;
          return 0;
        }
      }
    }
  }
}


Measured memory_bytes: 764
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

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

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 1000 + 47;
const int MOD = 1000 * 1000 + 3;

int A[MAX][MAX];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	int H, W, h, w;
	int x = 1000 * 1000 * 1000 - 1;
	int y = -1000 * 1000 * 1000;

	cin >> H >> W >> h >> w;
	if (H % h == 0 && W % w == 0)
	{
		cout << "No" << endl;
		return 0;
	}

	if (W % w != 0)
	{
		FOR(i, 0, H)
		{
			if (i % h != 0) continue;

			FOR(j, 0, W)
			{
				if (j % w == 0) A[i][j] = x;
				if (j % w == w - 1) A[i][j] = y;
			}
		}
	}
	else
	{
		FOR(j, 0, W)
		{
			if (j % w != 0) continue;

			FOR(i, 0, H)
			{
				if (i % h == 0) A[i][j] = x;
				if (i % h == h - 1) A[i][j] = y;
			}
		}
	}

	cout << "Yes" << endl;
	FOR(i, 0, H)
	{
		FOR(j, 0, W)
		{
			cout << A[i][j] << " ";
		}

		cout << endl;
	}
}

Measured memory_bytes: 7040
import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()

def Z(S):
    n = len(S)
    res = [0] * n
    res[0] = n
    l = r = 0
    for i in range(1, n):
        if res[i - l] < r - i: # 過去の結果が全て使える
            res[i] = res[i - l]
        else:
            l = i
            r = max(i, r) # i < r ならば過去の結果が一部使える
            while r < n and S[r - l] == S[r]: r += 1
            res[i] = r - l
    return res

def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    C = [A[i] ^ A[(i + 1) % n] for i in range(n)]
    D = [B[i] ^ B[(i + 1) % n] for i in range(n)]
    prefix = Z(C + D + D)
    res = []
    for k in range(n, 0, -1):
        if prefix[n + k] >= n:
            print(n - k, A[n - k] ^ B[0])
resolve()

Measured memory_bytes: 120276
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define PQS priority_queue <int, vector<int>, greater<int> > 
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

void solve() {
  int n; cin >> n;
  int dp[n+5] = {0};
  dp[0] = 1;
  for(int i = 3; i <= n; i++) {
    for(int j = 0; j <= i-3; j++) {
      dp[i] += dp[j];
      dp[i] %= mod;
    }
  }
  cout << dp[n] << '\n';
}

/*
  * overflow, array bounds
  * do smth instead of nothing and stay organized
*/
signed main() {   
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
  #endif
   int t = 1; // cin >> t;
   for(int i = 1; i <= t; i++) {
   //  cout << "Case #" << i << ": ";
     solve();
  }
}    

/*

*/

Measured memory_bytes: 3632
import java.util.*;

//Circle in a Rectangle
public class Main {
	public static void main(String args[])
	{
		String str;
		int[] output = new int[10000];
		Scanner sc = new Scanner(System.in);
		str = sc.nextLine();
		int i = 0;
		while(Integer.parseInt(str) != 0)
		{
			output[i] = Integer.parseInt(str);
			str = sc.nextLine();
			i++;
		}
		int n = 0;
		for(n = 0;n<i;n++)
		{
			System.out.println("Case " + (n+1) + ": " + output[n]);
		}
		sc.close();
	}
}



Measured memory_bytes: 62196
answer :: Int -> Int -> Int -> String
answer a b c
  | a < b && b < c = "Yes"
  | otherwise = "No"

main = do
  hoge <- getLine
  let a = head $ words hoge
      b = head $ tail $ words hoge
      c = last $ words hoge
  putStrLn $ answer (read a) (read b) (read c)


Measured memory_bytes: 3624
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll d;
    cin >> d;
    switch (d)
    {
    case 3:
    case 5:
    case 7:
        cout << "YES" << endl;
        break;
    default:
        cout << "NO" << endl;
        break;
    }

}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a, b, H, W;
    while(1) {
    scanf("%d%d",&a,&b);
    if(a==0&&b==0){
        break;
    }
        for(H=1;H<=a;H++){
            for(W=1;W<=b;W++){
                if(H > 1 && H<a && W<b && W>1)
                    printf(".");
                else
                    printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    
    return 0;
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  string s;
  cin >> s;
  vector<int> v(26);
  rep(i,s.size()) v[s[i] - 'a']++;
  rep(i,26) {
    if (!v[i]) {
      cout << (char) ('a' + i) << endl;
      return;
    }
  }
  cout << "None" << endl;
}

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

Measured memory_bytes: 3756
use std::io;
use std::str::FromStr;
use std::collections::HashSet;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn digit(n: u64) -> u64 {
    if n == 0 {
        return 1;
    }
    for i in 0..20u32 {
        if n < 10u64.pow(i) {
            return i as u64;
        }
    }
    20u64
}

fn main() {
    let n: u64 = input();
    let digit = digit(n);
    let k = 3u64;
    let mut count = 0;
    for d in 3..(digit+1) {
        for mask in 0..k.pow(d as u32) {
            let mut tmp = mask;
            let mut num: u64 = 0;
            for i in 0..d {
                let val = tmp % k;
                match val {
                    0 => num = num * 10 + 7,
                    1 => num = num * 10 + 5,
                    2 => num = num * 10 + 3,
                    _ => print!("0")
                }
                tmp /= k;
            }
            if num <= n {
                let c: Vec<char> = num.to_string().chars().collect();
                if c.contains(&'7') && c.contains(&'5') && c.contains(&'3') {
                    // println!("{}", num);
                    count += 1;
                }
            }
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;cin >> a >> b;
	if(a <= 9 && b <= 9) cout << a * b << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int n;
	scanf("%d", &n);
	if(n >= 64){
		printf("64\n");
	}else if(n >= 32){
		printf("32\n");
	}else if(n >= 16){
		printf("16\n");
	}else if(n >= 8){
		printf("8\n");
	}else if(n >= 4){
		printf("4\n");
	}else if(n >= 2){
		printf("2\n");
	}else{
		printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<queue>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  string a,b,c;
  cin >>a >> b>>c;
  
  string s ="";
  s+= a[0]-'a'+'A';
  s+= b[0]-'a'+'A';
  s+= c[0]-'a'+'A';
  
 cout << s;
     return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


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

  if(a%2||b%2||c%2){
    cout<<0<<endl;
    return 0;
  }
  if(a==b&&b==c){
    cout<<-1<<endl;
    return 0;
  }
  int ans=0;
  int x,y,z;
  while(1){
    ++ans;
    x=(b+c)/2;
    y=(c+a)/2;
    z=(a+b)/2;
    a=x;
    b=y;
    c=z;

    if(a%2||b%2||c%2) break;
  }
  ECHO(ans);
  return 0;
}


Measured memory_bytes: 256
import itertools
import sys

input = sys.stdin.readline

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
a_cum = [0] + list(itertools.accumulate(a))
b_cum = [0] + list(itertools.accumulate(b))

y = m  # len(b_cum) - 1
for x in range(len(a_cum)):
    if a_cum[x] > k:
        break
    while b_cum[y] > k - a_cum[x]:
        y -= 1
    ans = max(ans, x + y)

print(ans)

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

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

	int n,m,l,r;
	cin >> n >> m;
	vector<int> imos(n+2,0);
	for (int i = 0; i < m; ++i){
		cin >> l >> r;
		imos[ l ]++;
		imos[r+1]--;
	}
	int ans = 0;
	for (int i = 1; i < n+1; ++i){
		imos[i] += imos[i-1];
		ans += (imos[i]==m);
	}
	cout << ans << endl;
}


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

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

#define mod 1e9+7;
#define inf 1e18+7;

typedef long long ll;

int main() {
    int n,k;cin>>n>>k;
    vector<int>h(n);

    rep(i,n){
        cin>>h[i];
    }

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

    int ans=inf;

    rep(i,n-k+1){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    cout<<ans<<endl;
}



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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           P;
typedef vector<P>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;






int main (){
    
    int n;
    cin >> n;
    vector<ll> a(n+1);
    vector<ll> tot(n+1,0);
    vector<ll> tota(n+1,0);
    REPS(i,n){
        cin >> a.at(i);
    }
    ll count = 0;
    REPS(i,n){//奇数が正
        if(i==1){
            if(a.at(1) <= 0){
                count += (1 - a.at(1));
                tot.at(1) = 1;
                continue;
            }
            tot.at(1) = a.at(1);
            continue;
        }
        if(tot.at(i-1) > 0){ 
            ll sum = tot.at(i-1) + a.at(i);
            if(sum >= 0){
                tot.at(i) = -1;
                count += sum +1;
            }else tot.at(i) = tot.at(i-1) + a.at(i);
        }
        if(tot.at(i-1) < 0){
            ll big = tot.at(i-1) + a.at(i);
            if(big <= 0){
                tot.at(i) = 1;
                count += (1 - big);
            }else tot.at(i) = tot.at(i-1) + a.at(i);
        }

    }
    ll count2 = 0;
    REPS(i,n){//奇数マイナス
        if(i==1){
            if(a.at(1) >= 0){
                count2 += (1 + a.at(1));
                tota.at(1) = -1;
                continue;
            }
            tota.at(1) = a.at(1);
            continue;
        }
        if(tota.at(i-1) > 0){ 
            ll sum = tota.at(i-1) + a.at(i);
            if(sum >= 0){
                tota.at(i) = -1;
                count2 += sum +1;
            }else tota.at(i) = tota.at(i-1) + a.at(i);
        }
        if(tota.at(i-1) < 0){
            ll big = tota.at(i-1) + a.at(i);
            if(big <= 0){
                tota.at(i) = 1;
                count2 += (1 - big);
            }else tota.at(i) = tota.at(i-1) + a.at(i);
        }

    }

    cout << min(count, count2) << endl;




    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int n,k,a[N],id;
int calc(int a,int b){
	if (a==0)
		return 0;
	return (a-1)/b+1;
}
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if (a[i]==1)
			id=i;
	}
	printf("%d",min(calc(id-1,k-1)+calc(n-id,k-1),calc(n-1,k-1)));
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	double a1;
	int a,b,b1;
	scanf("%d%d",&a,&b);
	b=b*10;
	int min,i;
	for(i=b;i<b+10;i++)
	{
		double ii=(double)i;
		a1=ii*0.08;
		b1=(int)a1;
		if(b1==a)
		{
			break;
		}
		if(b1==a)break;
	}
	if(i==b+10)printf("-1");
	else printf("%d",i);
	return 0;
	
} 

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a)
	fmt.Scan(&b)

	if a > b {
		fmt.Println("a > b")
	} else if a < b {
		fmt.Println("a < b")
	} else {
		fmt.Println("a == b")
	}
}



Measured memory_bytes: 1120
using System;
namespace ITP1_4_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = double.Parse(Console.ReadLine());
            Console.WriteLine("{0:f6} {1:f6}", r * r * Math.PI, 2 * r * Math.PI);
        }
    }
}


Measured memory_bytes: 17764
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<stdio.h>
using namespace std;
 
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<25
 
int main()
{
	string O;
	string E;
	cin >> O;
	cin >> E;
	int i = 0;
	int j = 0;
	string s;
	while(i < O.length() || j < E.length()) {
		if (i < O.length()) {
			s += O[i];
		}
		if (j < E.length()) {
			s += E[j];
		}
		i++;
		j++;
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	ll n; cin >> n;
	vector<vector<ll>> bl(n,vector<ll>(3,0));
	REP(i,n){
		string s; cin >> s;
		ll len = s.size();
		REP(j,len){
			if (s[j]=='(') {
				bl[i][2]++;
			}
			else {
				if (bl[i][2]>0) bl[i][2]--;
				else bl[i][1]++;
			}
		}
	}
	bool jud = true;
	ll ltot = 0;
	ll rtot = 0;
	REP(i,n){
		ltot += bl[i][1];
		rtot += bl[i][2];
	}
	if (ltot!=rtot) jud=false;
	ll zerocnt = 0;
	REP(i,n){
		if (bl[i][1]==0){
			zerocnt += bl[i][2];
		}
	}
	REP(i,n){
		if (bl[i][2]-bl[i][1]>0){
			bl[i][0]+=10000000;
			bl[i][0]-=bl[i][1];
		}
		else{
			bl[i][0]+=bl[i][2];
		}
	}

	sort(bl.begin(),bl.end());
	reverse(bl.begin(),bl.end());
	ll rno = 0;
	REP(i,n){
		if (rno<bl[i][1]){
			jud = false;
			break;
		}
		else{
			rno += bl[i][2];
			rno -= bl[i][1];
		}
	}

	//REP(i,n) cout << bl[i][0] << bl[i][1] << endl;

	if (jud) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main() {
  int n; cin >> n;
  string s; cin >> s;
  string x = "", y = "";
  int cnt = 0;
  rep(i, n) {
    if (s[i] == '(') cnt ++;
    else if (s[i] == ')' && cnt > 0) {
      cnt --;
    } else {
      x += '(';
    }
  }
  rep(i, cnt) y += ')';
  cout << x + s + y << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;




int main(){
    int a,b;
    cin >> a >> b;
    
    if(a < b)cout << "a < b" <<endl;;
    if(a > b)cout << "a > b" << endl;
    if(a == b) cout << "a == b" << endl;
}









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

int main() {
  long x,y;
  cin >> x>>y; 
  if(abs(x-y)>1){
    cout<<"Alice"<<endl;
  }
  else{
    cout<<"Brown"<<endl;
  }
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
L_list = [int(input()) for i in range(N)]

INF = 10 ** 9

def dfs(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret1 = dfs(a, b, c, n + 1)
    ret2 = dfs(a + L_list[n], b, c, n + 1) + 10
    ret3 = dfs(a, b + L_list[n], c, n + 1) + 10
    ret4 = dfs(a, b, c + L_list[n], n + 1) + 10
    return min(ret1, ret2, ret3, ret4)


ans = dfs(0, 0, 0, 0)
print(ans)
'''
8 100 90 80
100
100
90
90
90
80
80
80

0


8 1000 800 100
300
333
400
444
500
555
600
666

243

'''

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

int main(){
    int n;
    cin >> n;
    vector <int>a(n);
    int i;
    for(i = 0;i < n;i++){
        cin >> a.at(i);
    }
    for(i = 0;i < n-1;i++){
        int j;
        for(j = n-1;j > i;j--){
            if(a.at(j) > a.at(j-1)){
                int tmp;
                tmp = a.at(j);
                a.at(j) = a.at(j-1);
                a.at(j-1) = tmp;
            }
        }
    }

    int alice = 0;
    int bob = 0;
    for(i = 0;i < n;i+=2){
        alice += a.at(i);
    }
    for(i = 1;i < n;i+=2){
        bob += a.at(i);
    }

    cout << (alice - bob) << endl;
}

Measured memory_bytes: 3616