akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;
ll modsize = 200010;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

vector<ll> fac(modsize + 5);
vector<ll> inv(modsize + 5);
vector<ll> facinv(modsize + 5);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	int b, w;
	cin >> b >> w;
	vector<int> black(w), white(b);
	rep(i, w) {
		if (i == 0) {
			black[i] = modinv(modpow(2, b));
		}
		else {
			black[i] = black[i - 1] + modinv(modpow(2, b + i))*modcomb(b + i - 1, b - 1);
			black[i] %= mod;
		}
	}
	rep(i, b) {
		if (i == 0) {
			white[i] = modinv(modpow(2, w));
		}
		else {
			white[i] = white[i - 1] + modinv(modpow(2, w + i))*modcomb(w + i - 1, w - 1);
			white[i] %= mod;
		}
	}
	rep(i, b + w) {
		int bc = 0, wc = 0;
		if (i >= b) {
			bc = black[i - b];
		}
		if (i >= w) {
			wc = white[i - w];
		}
		cout << (inv[2] + inv[2] * (wc - bc + mod)) % mod << endl;
	}
}


Measured memory_bytes: 8448
N=int(input())
X=[0]*N
L=[0]*N
t=[0]*N

for i in range(N):
  X[i],L[i]=map(int,input().split())
  t[i]=[X[i]-L[i], X[i]+L[i]]
  
t.sort(key=lambda x:x[1])
#print(t)

pos=float("-inf")
cnt=0
for arm in t:
  if pos<=arm[0]:
    cnt +=1
    pos=arm[1]
    
print(cnt)

Measured memory_bytes: 29288
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  char c;
  cin >> c;
  ++c;
  cout << c << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	int q;
	cin>>q;
	priority_queue<ll,vector<ll>, greater<ll>> que2;
	priority_queue<ll> que1;
	ll sum1 = 0, sum2 = 0;
	ll B = 0;
	while(q--){
		int type; cin>>type;
		if(type==1){
			int a, b;
			cin>>a>>b;
			B += b;
          
			if(que2.empty()||a >= que2.top()){
				sum2 += 2 * a;
				que2.push(a); que2.push(a);
				a = que2.top(); que2.pop();
				sum2 -= a;
				sum1 += a;
				que1.push(a); 
			}
			else {
				sum1 += 2 * a;
				que1.push(a); que1.push(a);
				a = que1.top(); que1.pop();
				sum1 -= a;
				sum2 += a;
				que2.push(a); 
			}
		}
		else {
			ll x = que1.top();
			ll ans = (sum2 - sum1)/2 + B;
			cout<<x<<" "<<ans<<endl; 
		}
	}
	return 0;
}

Measured memory_bytes: 4588
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  if(n/100)n=n%100;
  if(n/10)n=n%10;
  if(n==3)cout << "bon" << endl;
  else if(n==0 || n==1 || n==6 ||n==8)cout << "pon" <<endl;
  else cout << "hon" << endl;
}
  

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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a'){
    cout << "vowel" <<endl;
  }
  
  else if (c == 'i'){
    cout << "vowel" <<endl;
  }
  
  else if (c == 'u'){
    cout << "vowel" <<endl;
  }
  
  else if (c == 'e'){
    cout << "vowel" <<endl;
  }
  
  else if (c == 'o'){
    cout << "vowel" <<endl;
  }
  
  else{
    cout << "consonant" << endl;
}
}      
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vi;
typedef long double td;
typedef vector<td> vd;
typedef pair<ll,ll> ii;
typedef vector<ii> vii; typedef vector<bool> vb;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(ll i = ll(a); i < (ll)(b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define show(v,n) cerr << #v << " = "; forn(i,n) cerr << v[i] << " "; cerr << endl;
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
int MAXN = 500005;

int solve(vector <string> &v, int n, int m)
{
	vector < vector <int> > dp(n+1,vector <int>(m+1,0));
	int modu = (int)(1e9+7);
	dp[0][0]=1;
	forn(i,n)
	{
		forn(j,m)
		{
			if(v[i][j]=='#') continue;
			if(i>0) {dp[i][j]+=dp[i-1][j]; dp[i][j]%=modu;}
			if(j>0) {dp[i][j]+=dp[i][j-1]; dp[i][j]%=modu;}
		}
	}
	
	return dp[n-1][m-1];
}
 
int main()
{ 	
	FIN;
	#ifdef input
		freopen("test1.txt", "r", stdin);
	#endif
	
	int n, m;
	cin >> n >> m;
	vector <string> v(n);
	forn(i,n) cin >> v[i];
	cout << solve(v,n,m) << endl;
    return 0;
}


Measured memory_bytes: 8176
import java.text.ParseException;
import java.util.Scanner;

public class Main {

	public static void main(String[] arges) throws ParseException {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] deme = line.split(" ");

		int[] daice = new int[] { Integer.parseInt(deme[0]),
				Integer.parseInt(deme[1]), Integer.parseInt(deme[2]),
				Integer.parseInt(deme[3]), Integer.parseInt(deme[4]),
				Integer.parseInt(deme[5]) };
		String line2 = sc.nextLine();
		int kazu = Integer.parseInt(line2);
		String[] mondai = new String[kazu];

		for (int i = 0; i < kazu; i++) {
			mondai[i] = sc.nextLine();
		}

		for (String string : mondai) {
			String[] mondai2 = string.split(" ");

			int ue = Integer.parseInt(mondai2[0]);
			int mae = Integer.parseInt(mondai2[1]);
			if (ue == daice[0]) {

				if (mae == daice[1]) {
					System.out.println(daice[2]);
				} else if (mae == daice[2]) {
					System.out.println(daice[4]);
				} else if (mae == daice[3]) {
					System.out.println(daice[1]);
				} else if (mae == daice[4]) {
					System.out.println(daice[3]);
				}
			} else if (ue == daice[1]) {

				if (mae == daice[0]) {
					System.out.println(daice[3]);
				} else if (mae == daice[2]) {
					System.out.println(daice[0]);
				} else if (mae == daice[3]) {
					System.out.println(daice[5]);
				} else if (mae == daice[5]) {
					System.out.println(daice[2]);
				}
			} else if (ue == daice[2]) {

				if (mae == daice[0]) {
					System.out.println(daice[1]);
				} else if (mae == daice[1]) {
					System.out.println(daice[5]);
				} else if (mae == daice[4]) {
					System.out.println(daice[0]);
				} else if (mae == daice[5]) {
					System.out.println(daice[4]);
				}
			} else if (ue == daice[3]) {

				if (mae == daice[0]) {
					System.out.println(daice[4]);
				} else if (mae == daice[1]) {
					System.out.println(daice[0]);
				} else if (mae == daice[4]) {
					System.out.println(daice[5]);
				} else if (mae == daice[5]) {
					System.out.println(daice[1]);
				}
			}else if (ue == daice[4]) {

				if (mae == daice[0]) {
					System.out.println(daice[2]);
				} else if (mae == daice[2]) {
					System.out.println(daice[5]);
				} else if (mae == daice[3]) {
					System.out.println(daice[0]);
				} else if (mae == daice[5]) {
					System.out.println(daice[3]);
				}
			}else if (ue == daice[5]) {

				if (mae == daice[1]) {
					System.out.println(daice[3]);
				} else if (mae == daice[2]) {
					System.out.println(daice[1]);
				} else if (mae == daice[3]) {
					System.out.println(daice[4]);
				} else if (mae == daice[4]) {
					System.out.println(daice[2]);
				}
			}
		}
	}
}

Measured memory_bytes: 25744
#include <stdio.h>
#include <math.h>
#define MAX 500001

int A[MAX];
int n;

void maxHeapify(int i){

	int temp,largest;
	int l = 2 * i;
	int r = 2 * i + 1;

	//左の子、自分、右の子で値が最大のノードを選ぶ
	if(l <= n && A[l] > A[i]) largest = l;
	else largest = i;

	if(r <= n && A[r] > A[largest]) largest = r ;

	if(largest != i){
		temp = A[i];
		A[i] = A[largest];
		A[largest] = temp;
		maxHeapify(largest);
	}
}

void buildMaxHeap(){
	int j;
	for( j = (int)n/2; j >= 1; j--) maxHeapify(j);
}

int main(){
	
	int i;

	scanf("%d",&n);

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

	return 0;
}


Measured memory_bytes: 3668
def is_prime(x):
    if x == 2:
        return True
    
    if x < 2 or x % 2 == 0:
        return False
    
    i = 3
    while i <= x ** (1 / 2):
        if x % i == 0:
            return False
        else:
            i += 2
    
    return True

N = int(input())    
counter = 0
for _ in range(N):
    if is_prime(int(input())):
        counter += 1
    else:
        continue

print(counter)
        
        


Measured memory_bytes: 5656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		 Scanner sc = new Scanner(System.in);
		 String name=sc.next();
		 int k=0;
		 for(int i=0;i<3;i++){
			 for(int j=i;j<3;j++){
				 if(!(String.valueOf(name.charAt(i)).equals(String.valueOf(name.charAt(j))))){
					 k++;
				 }
			 }
		 }
		 if(k==0){
			 System.out.print("No");
		 }else{
			 System.out.print("Yes");
		 }
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

bool b[12];
bool isfriend[12][12];

void solve(){

    string s;
    cin >> s;
    bool b=false;
    if(s[2]==s[3]&&s[4]==s[5]) b=true;
    if(b) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{
    int a[200],i,n,l,sum=0,mi=10000000;
    scanf("%d%d",&n,&l);
    for(i=0;i<n;i++)
    {a[i]=l+i;sum+=a[i];mi=abs(mi)<abs(a[i])?mi:a[i];}
    printf("%d\n",sum-mi);
    return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll n = in(), k = in();
	vector<ll>h(n);
	REP(i, n)h[i] = in();
	sort(ALL(h));
	ll ans = INFLL;
	REP(i, h.size() - k + 1)ans = min(ans, h[i + k - 1] - h[i]);
	cout << ans << endl;
}

Measured memory_bytes: 1024
#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 k,x; cin>>k>>x;
  for(int i = x-k+1; i < x+k; i++)cout<<i<<endl;
}

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

using ll = long long;
using namespace std;


int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];
    set<int> st;

    for(int bit = 0; bit < (1 << n); bit++){
        int cur = 0;
        for(int i = 0; i < n; i++){
            if(bit & (1 << i))cur += a[i];
        }
        st.insert(cur);
    }

    int m; cin >> m;
    vector<int> q(m);
    for(int i = 0; i < m; i++)cin >> q[i];

    for(int i = 0; i < m; i++){
        cout << (st.count(q[i]) ? "yes" : "no" )<< endl;
    }

}


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

int main() {
    int n;
    cin >> n;
    for (int i = 1; i < n+1; i++){
        int count = 0;
        for (int a = 1; a < n+1; a++){
            if(a*a+1+1+a+1+a > i)break;
            for (int b = 1; b < n+1; b++){
                if(a*a+b*b+1+a*b+b+a > i)break;
                for (int c = 1; c < n+1; c++){
                    if(a*a+b*b+c*c+a*b+b*c+c*a == i)count++;
                    if(a*a+b*b+c*c+a*b+b*c+c*a > i)break;
                }
            }
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  ll n = s.size();
  vector<ll> ans(n);
  for(ll i=0;i<s.size()-1;i++){
  	if(s[i] == 'R' && s[i+1] =='L'){
    	for(ll j=i;j>=0 && s[j]=='R';j--){
        	if((i-j)%2==0)
              ans[i]++;
          	else ans[i+1]++;
        }
      	for(ll j=i+1;j<n && s[j]=='L';j++){
        	if((j-i)%2==0)
              ans[i]++;
          	else ans[i+1]++;
        }
    }
  }
  for(auto i:ans)
    cout<<i<<" ";
}
  

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

int main(void)
{
    int N,T;
    cin >> N >> T;
    vector<int> c(N),t(N);
    vector<pair<int,int>> p(N);
    for(int i = 0; i < N; i++){
        cin >> c[i] >> t[i];
        p[i] = make_pair(t[i],c[i]);
    }
    sort(p.begin(),p.end());
    //reverse(p.begin(),p.end());
    int ans = 10000;
    for(int i = 0; i < N; i++){
        if(p[i].first <= T){
            ans = min(ans,p[i].second);
        }
    }
    if(ans == 10000) cout << "TLE" << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3604
#include<stdio.h>

int main(void){
int no , tem=0 ,res=0;
scanf("%d",&no);
for(int i=1;i<=no;i+=2){
tem=0;
for(int cot=1;cot<=i;cot++){
if (i%cot==0){
tem++;
}
}
if(tem==8){
res++;
}
}
printf("%d",res);
return 0;
}

Measured memory_bytes: 504
from math import *
n,m=map(int,input().split())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
c=0
for i in range(n-1):
    for j in range(i+1,n):
        d=0
        for k in range(m):
            d+=(l[i][k]-l[j][k])**2
        dd=sqrt(d)
        if(int(dd)==dd):
            c+=1
print(c)


Measured memory_bytes: 62396
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct BIT{
    vector<ll> bt;
    ll n,m;
    BIT(ll n_){
        n=n_;m=1;
        while(m<=n_) m*=2;
        m/=2;
        bt.resize(n+1);
    }
    ll sum(ll i){
        if(!i) return 0;
        return bt[i]+sum(i-(i&-i));
    }
    ll sum(ll i,ll j){
        return sum(j-1)-sum(i-1);
    }
    ll ad(ll i,ll x){
        if(i>n) return i;
        bt[i]+=x;
        ad(i+(i&-i),x);
        return i;
    }
    ll lb(ll k){
        ll x=0;
        for(int i=m;i>0;i/=2){
            if(x+i<=n&&bt[x+i]<k) {
                k-=bt[x + i];
                x+=i;
            }
        }
        return x+1;
    }
};

bool ok(vector<int>&a,int m){
    int n=a.size();
    vector<int> b(n+1);
    b[0]=n+1;
    fr(i,n) b[i+1]=b[i]+(a[i]<m?-1:1);
    ll c=0;
    BIT bit(2*n+1);
    fr(i,n+1){
        c+=bit.sum(b[i]);
        bit.ad(b[i],1);
    }
    ll k=(ll)n*(n+1)/2;
    return 2*c>=k;
}

class DMedianOfMedians {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n;
        in>>n;
        vector<int> a(n);
        for(auto&i:a) in>>i;
        int l=1,r=1e9+1,m;
        while(r-l>1){
            m=(l+r)/2;
            if(ok(a,m)) l=m;
            else r=m;
        }
        out<<l<<endl;
    }
};

int main() {
    DMedianOfMedians solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 2660
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	LL N,A,B,C,D;
	cin >> N >> A >> B >> C >> D;
	B = abs(A-B);
	A = 0;
	LL M = 0;
	LL m = 1;
	for(int i=1; i<N; i++){
		M += D;
		m += D-C;
	}
	LL tmp = abs(M-B+1);
	if(B <= M && (tmp % (D+C)==0?D+C:tmp % (D+C)) <= m) cout << "YES" << endl;
	else cout << "NO" << endl;
	//cout << M << " " << m << " " << tmp << endl;

	return 0;
}


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

int main(int argc, char const *argv[]) {
    int n,l;
    cin >> n >> l;

    int all = 0;
    for (int i = 1; i <= n; ++i) {
        all += l+i-1;
    }
    
    int ans = 0;
    int abss = INF;

        int tmp = 0;
    for (int i = 1; i <= n; ++i) {
        tmp = 0;
        
        for (int j = 1; j <= n; ++j) {
            if (i == j) continue;
            tmp += l+j-1;
        }
        if (abs(all-tmp) < abss) {
            abss = abs(all-tmp);
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int x, y;
  cin >> x >> y;

  string ans = "No";
  for (int i = 0; i <= x; i++) {
    if (2 * i + 4 * (x - i) == y) ans = "Yes";
  }

  cout << ans << endl;
}


Measured memory_bytes: 3576
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    h = int(input())
    i = int(2*2**math.floor(math.log2(h))-1)
    print(i)

    # 25
    # 12 12
    # 6 6 6 6
    # 3 3 3 3 3 3 3 3
    # 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    #

    # 31
    # 15 15
    # 7 7 7 7
    # 3 3 3 3 3 3 3 3
    # 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1


if __name__ == '__main__':
    main()


Measured memory_bytes: 6420
/*
|| Suyash Yadav | B.Tech (3rd Year CSE) | Tier-3 (NCR,India)
|| suyashky@gmail.com | "suyashky" @linkedIn
||
||		   /\_/\
||		  ( o.o )
|| 	 	   > ^ <
|| From infinity to beyond!
*/

# include <bits/stdc++.h>
using namespace std;
# define INF (long long int)1e28
# define MOD 1000000007
# define all(con) con.begin() , con.end()
# define MAX numeric_limits<int64>::max()
# define MIN numeric_limits<int64>::min()
# define watch1(x) cout<<#x<<": "<<x<<endl
# define watch2(x,y) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
# define watch3(x,y,z) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
# define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int int64;
typedef unsigned long long int uint64;

int64 dp[3001][3001];

int main()
{
/*
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	memset(dp, 0, sizeof(dp));
	string a, b;
	cin >> a >> b;

	int n = a.size(), m = b.size();
	for (int i = 1 ; i <= n ; i++)
	{
		for (int j = 1 ; j <= m ; j++)
		{
			if (a[i - 1] == b[j - 1])
				dp[i][j] = 1 + dp[i - 1][j - 1];
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}

	int i = n, j = m;
	string ans = "";
	while (i > 0 && j > 0)
	{
		if (a[i - 1] == b[j - 1])
		{
			ans += a[i - 1];
			i--;
			j--;
		}

		else if (dp[i - 1][j] < dp[i][j - 1])
			j--;
		else
			i--;
	}
	reverse(all(ans));
	cout << ans << endl;
}

Measured memory_bytes: 70656
#include<cstdio>

int main(){
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d = a / b;
    r = a % b;
    f = (double)a / b;
    printf("%d %d %.5lf\n",d,r,f);
    return 0;
}


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

const int maxn = 2e5 + 5;

struct work
{
	int t;
	int e;
}w[maxn];

bool operator < (work t, work e)
{
	return t.e < e.e;
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> w[i].t >> w[i].e;
	sort(w, w + n);
	int  t = 0;
	for (int i = 0; i < n; i++)
	{
		t += w[i].t;
		if (t > w[i].e)
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    int ans = 999;
    for (int i = 0; i <= N - 3; ++i) {
        int num = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
        ans = min(ans, abs(num - 753));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	height := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &height[i])
	}
	ans := minPossibleTotalCost(n, height)
	fmt.Println(ans)
}

func minPossibleTotalCost(n int, height []int) int {
	dp := make([]int, n)
	dp[0] = 0
	for i := 1; i < n; i++ {
		dp[i] = 1 << 32
	}
	for i := 0; i < n; i++ {
		for _, j := range []int{i + 1, i + 2} {
			if j < n {
				cost := int(math.Abs(float64(height[i] - height[j])))
				dp[j] = min(dp[j], cost+dp[i])
			}
		}
	}
	return dp[n-1]
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 6320
#include<iostream>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
typedef map<string,int> dict;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
double eps = 1e-10 ;

template <typename T>
void out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

template<typename T>
string ntos( T i ) {
  ostringstream s ;
  s << i ;
  return s.str() ;
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int c1,c2,c3,ans;
  while(cin >> c1 >> c2 >> c3){
    ans = 0;
    repc(i,1,10){
      if(i != c1 && i != c2 && i != c3)
      {
        if(c1+c2+i <= 20){
          ++ans;
        }
      }
    }
    if(ans >= 4){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1184
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=1e5+5;
struct rec{
	int x,y;
	bool operator < (const rec& b) const{
		return x<b.x;
	}
} a[MAXN],b[MAXN];
int n,fa[MAXN];
int find(int x){ return fa[x]==x?x:fa[x]=find(fa[x]); }
void uion(int x,int y){ fa[find(x)]=find(y); }
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i].x),a[i].y=i;
	for (int i=1;i<=n;i++) scanf("%d",&b[i].x),b[i].y=i;
	sort(a+1,a+n+1); sort(b+1,b+n+1); 
	bool fl=0;
	for (int i=1;i<=n;i++){
		if (a[i].x>b[i].x) fl=1;
	}
	if (fl) return printf("No\n"),0;
	for (int i=1;i<n;i++){
		if (a[i+1].x<=b[i].x) fl=1;
	}
	for (int i=1;i<=n;i++) fa[i]=i;
	for (int i=1;i<=n;i++){
		uion(a[i].y,b[i].y);
	}
	int top=find(1);
	for (int i=2;i<=n;i++){
		int tmp=find(i);
		if (tmp!=top) fl=1;
	}
	if (fl) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep1(i,n) for(int i=1; i<=(n); i++)
#define mst(x,a) memset(x, a, sizeof(x))
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define ls rt<<1
#define rs rt<<1|1
#define lson rt<<1, l, M
#define rson rt<<1|1, M+1, r
#define ALL(x) x.begin(),x.end()
#ifdef LOCAL
    #define dbg(a) cout << #a": " << a << endl;
#else
    #define dbg(a)
#endif // LOCAL
using namespace std;
typedef long long ll;
typedef unsigned int uin;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const double dinf = inf;
typedef pair<int,int> pii;
typedef pair<ll,ll> PLL;
typedef pair<ull,ull> puu;
typedef pair<double,double> pdd;

const int N = 2e5 + 10;
const int M = 18 + 10;
const int mod = 998244353;
const double eps = 1e-10;
const double PI = acos(-1.0);



void work(){
    ll x,y;
    while(~scanf("%lld%lld",&x,&y)){
        if(y>x) swap(x,y);
        if(x-y<2) printf("Brown\n");
        else printf("Alice\n");
    }
}

int main()
{
#ifdef LOCAL
    freopen("inb.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif // LOCAL
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);

    //int T;
    //scd(T);
    //while(T--)
        work();

    return 0;
}


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

int main(void){
    int n, i, max, index, ans;
	cin >> n;
    vector<int> p(n);

    for(i = 0; i < n; i++){
        cin >> p.at(i);
    }

    max = 99;
    ans = 0;
    for(i = 0; i < n; i++){
        ans += p.at(i);
	    if(p.at(i) > max){
		max = p.at(i);
        }
    }

    cout << (ans - max/2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int int_pow(int,int);
int main(){
	int n,m;
	int *s;
	int *c;
	int *num;
	int ans = 0;
	cin >> n >> m;
	s = new int [m];
	c = new int [m];
	for(int i = 0;i <= m-1;i++){
		cin >> s[i] >> c[i];
	}
	for(int i = 0;i <= m - 2;i++){
		for(int j = i+1;j <= m-1;j++){
			if(s[i] == s[j]){
				if(c[i] != c[j]){
					cout << -1;
					delete [] s;
					delete [] c;
					return 0;
				}
			}
		}
	}
	for(int i = 0;i <= m-1;i++){
		if(s[i] > n){
			cout << -1;
			delete [] s;
			delete [] c;
			return 0;
		}
	}
	num = new int [n];
	for(int i = 0;i <= n-1;i++){
		num[i] = -1;
	}
	for(int i = 0;i <= m-1;i++){
		num[n - s[i]] = c[i];
	}
	if(num[n-1] == -1 && n != 1){
		num[n-1] = 1;
	}
	if(!num[n-1] && n != 1){
		cout << -1;
		return 0;
	}
	for(int i = 0;i <= n-1;i++){
		if(num[i] == -1){
			num[i] = 0;
		}
	}
	for(int i = 0;i <= n-1;i++){
		ans += num[i] * int_pow(10,i);
	}
	cout << ans;
	delete [] s;
	delete [] c;
	delete [] num;

	return 0;
}


int int_pow(int x,int y){
	int ans = 1;
	for(int i = 0;i <= y -1;i ++){
		ans *= x;
	}
	return ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,K;
    cin >> N >> K;
    vector<int> H(N);
    rep(i,0,N)cin >> H[i];
    sort(H.begin(), H.end());
    int mini = INF;
    rep(i,0,N-K+1){
        mini = min(mini, H[i + K - 1] - H[i]);
    }
    cout << mini << endl;
}

Measured memory_bytes: 640
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		
		out.println(N*N*N);
		out.flush();
	}
	
}

Measured memory_bytes: 21332
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long ans = num(b, c, d) - num(a-1, c, d);
        System.out.println(ans);
        
    }

    public static long num(long n, long c, long d) {
        long G = gcd(c, d);
        long L = c / G * d;
        return n - n / c - n / d + n / L;
    }
    
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 22996
/*
ye mera template hai
apna khud likho bc :P
*/

/*
Author : Sarvagya Agarwal
*/

#include<bits/stdc++.h>
using namespace std;

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int32_t main()
{
    fast;
    string s ;
    cin >> s ; 
    int n = s.size() ; 
    int index = 0 ; 
    rep(i,0,n-1)if(s[i]=='A'){index=i;break;}
    for(int i = n-1;i>=0;--i) {
        if(s[i]=='Z') {
            cout << i-index + 1 << endl ; 
            return 0 ; 
        }
    }
    return 0;
}


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

#define reint register int
#define coint const int

using namespace std;

char li[+10086];

int main(void) {
    scanf("%s", li + 1), sort(li + 1, li + 4 + 1);
    puts((li[1] == li[2] && li[3] == li[4] && li[2] != li[3]) ? "Yes" : "No");
    return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
		
	ll a,b;
	cin>>a>>b;
	if(a*b<=0){
		ce("Zero")
	}else{
		if(a>0){
			ce("Positive")
		}else{
			if(b>0){
				if(a%2==0){
					ce("Positive")
				}else{
					ce("Negative")
				}
			}else{
				if((b-a)%2==0){
					ce("Negative")
				}else{
					ce("Positive")
				}
			}
		}
		
	}
	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i = (int)(n)-1; i>=0; --i)
#define For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}
template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}
template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}

int main(){
    int n;cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    while(n--){
        string s;cin >> s;
        if(s == "AC") ++ac;
        else if(s == "WA") ++wa;
        else if(s == "TLE") ++tle;
        else ++re;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	vector<int> v;
	int a;
	for(int i=0;i<2*n;i++){
		cin >> a;
		v.push_back(a);
	}
	std::sort(v.begin(),v.end());
	ll ans = 0;
	for(int i=0;i<n;i++){
		ans += v[2*i];
	}
	cout << ans;
}

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

using namespace std;

int main()
{
	int n,a,count=0;
    cin>>n;
    vector<ll> side;
    
      for(int i=0;i<n;i++)
      {
        cin>>a;
        side.pb(a);
      }
    sort(side.begin(),side.end());
    
    for(int i=0;i<n;i++ )
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(side[i]!=side[j]&&side[j]!=side[k]&&side[i]!=side[k])
                {
                    if(side[i]+side[j]>side[k])
                    {
                        count++;
                    }
                }
            }
        }
    }
    
     cout<<count;   
	return 0;
}

Measured memory_bytes: 3512
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
 int a,s,d,f,g,h,j,i;
 scanf("%d %d",&a,&s);
 d=1;
 for(i=0;i<a;i++){
  if(d<s) d*=2;
  else d+=s;
 }
 printf("%d\n",d);
 return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>

namespace cplib {
    struct UnionFind {
        int n;
        std::vector<int> par, size;
        
        UnionFind(int init_n): n(init_n), par(init_n), size(init_n) {
            for (int i = 0; i < init_n; i++) {
                par[i] = i;
                size[i] = 1;
            }
        }

        int root(int i) {
            if (par[i] == i) {
                return i;
            } else {
                par[i] = root(par[i]);
                return par[i];
            }
        }
        bool is_same(int i, int j) {
            return root(i) == root(j);
        }
        void unite(int i, int j) {
            if (!is_same(i, j)) {
                if (size[i] < size[j]) {
                    std::swap(i, j);
                }
                size[root(i)] += size[root(j)];
                par[root(j)] = root(i);
            }
        }
        int get_size(int i) {
            return size[root(i)];
        }
    };
}

int main() {
    int n, m, k;
    std::cin >> n >> m >> k;

    cplib::UnionFind uf(n);
    std::vector<std::set<int>> fr(n), bl(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        std::cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
        fr[a].insert(b);
        fr[b].insert(a);
    }
    for (int i = 0; i < k; i++) {
        int c, d;
        std::cin >> c >> d;
        c--;
        d--;
        bl[c].insert(d);
        bl[d].insert(c);
    }

    for (int i = 0; i < n; i++) {
        if (i > 0) {
            std::cout << " ";
        }

        int ans = uf.get_size(i) - 1;

        for (int j: fr[i]) {
            ans--;
        }
        for (int j: bl[i]) {
            if (uf.is_same(i, j)) {
                ans--;
            }
        }

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

    return 0;
}


Measured memory_bytes: 29696
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


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

	vector<long long> v(5);
	REP(i, 5) {
		cin >> v[i];
	}

	SORT(v);

	long long m = v[0];

	long long ans = (n + m - 1) / m + 4;

	ANS(ans);

	return 0;
}


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

template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
typedef long long s64;
const int N=2000+5,L=10;
int n;
namespace TREE
{
vector<int>lk[N];	
int belong[N][N];
bitset<N>s[N],sub[N],nsub[N];int q[N],tot,dfn[N],en[N];
void dfs(int x,int fr)
{
	++tot;
	q[tot]=x;
	s[tot]=s[tot-1];s[tot][x]=1;
	dfn[x]=tot;
	for(auto y:lk[x])
	if(y!=fr)dfs(y,x);
	en[x]=tot;
}
void init()
{
	rep(i,1,n-1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		lk[x].push_back(y);lk[y].push_back(x);
	}
	dfs(1,0);
	rep(x,1,n)
	{
		int *b=belong[x];
		b[x]=x;
		static int q[N];
		int t=0;
		for(auto y:lk[x])
		{
			b[y]=y;
			q[++t]=y;
		}
		rep(h,1,t)
		{
			int x=q[h];
			for(auto y:lk[x])
			if(!b[y])b[q[++t]=y]=b[x];
		}
	}
	rep(i,1,n)
	{
		sub[i]=s[dfn[i]-1]^s[en[i]];
		nsub[i]=~sub[i];
	}
}
bitset<N> get(int a,int b)
{
	if(dfn[a]<dfn[b])swap(a,b);
	if(en[a]<=en[b])return sub[a]|nsub[belong[b][a]];
	return sub[a]|sub[b];
}
};

deque<int>q;
bitset<N>lk[N];
void check(int a,int b)
{
	bitset<N>now=TREE::get(a,b)&lk[b]&~lk[a];
	for(int c=0;c=now._Find_next(c),c<=n;)
	{
		lk[a][c]=lk[c][a]=1;
		q.push_back(a*N+c);
	}
}

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);
#endif
	int m;
	cin>>n>>m;
	TREE::init();
	rep(i,1,n)lk[i][i]=1;
	rep(i,1,m)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		lk[x][y]=lk[y][x]=1;
		q.push_back(x*N+y);
	}
	int ans=0;
	while(!q.empty())
	{
		int x=q.front(),y=x%N;q.pop_front();
		x/=N;
		++ans;
		check(x,y);
		check(y,x);
	}
	cout<<ans;
}

Measured memory_bytes: 26384
#include <bits/stdc++.h>
//#include<unordered_map>
#define debug(x) (cout << "#x = " << (x) << endl)
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
//#define mid (l + r >> 1)
#define lowbit(x) (x & -x)
#define Set(x, i) memset(x, i, sizeof x)
#define R register
#define For( i, j, k ) for(R int i = (j); i <= (k); ++i)
#define foR( i, j, k ) for(R int i = (j); i >= (k); --i)
#define Cross( i, j, k ) for(R int i = (j); i; i = (k))using namespace std;
typedef long long ll;
using namespace std;
const ll N = 100011;
const ll Inf = 0x3f3f3f3f3f3f;

namespace IO {

	#define dd ch = getchar()
	inline ll read() {
		ll x = 0; bool f = 0; char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write ( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar ( x % 10 | 48 );
	}

	inline void wrn ( ll x ) { write(x); putchar (' '); }

	inline void wln ( ll x ) { write(x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn(x); wln (y); }

}

using namespace IO;

namespace Cesare {
	
	int main() {
		ll a = read();
		return wln(a * a * 3), 0;
	}
	
}

int main()
{
	return Cesare::main();
}

/*

*/



Measured memory_bytes: 256
def generate_is_prime_sieve(N):
	is_prime = [True]*(N+1)
	is_prime[0] = is_prime[1] = False
	for p in range(2,N+1):
		if is_prime[p]:
			for n in range(2*p,N+1,p):
				is_prime[n] = False
	dummy=[x for x in is_prime]
	for p in range(2,N+1):
		if is_prime[p] and is_prime[(p+1)//2]:
			dummy[p]=True
		else:
			dummy[p]=False
	return dummy
def partial_sums(N):
	something=generate_is_prime_sieve(N)
	counter=0
	partial_sum=[0]*(N+1)
	for i in range(N+1):
		if something[i]:
			counter+=1
		partial_sum[i]=counter
	return partial_sum	
N=partial_sums(10**5+1)
for i in range(int(input())):
	counter=0
	a,b=[int(x) for x in input().split()]
	print(N[b]-N[a-1])



Measured memory_bytes: 80808
#include<stdio.h>
long long f(long long n,long long k){return n%k?n%k:f(n/k,k);}
int main(){
  long long n,c=0,i,j;
  scanf("%lld",&n);
  for(i=2;i*i<n;i++){
    if(n%i)continue;
    if(f(n,  i)==1)c++;
    if(f(n,n/i)==1)c++;
  }
  if(i*i==n&&f(n,i)==1)c++;
  n--;
  //printf("%lld\n",n);
  for(i=1;i*i<n;i++){
    if(n%i==0)c+=2;
  }
  if(i*i==n)c++;
  printf("%lld\n",c);
  return 0;
}
	   


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main()
{
    int n,k,a[55],sum=0;
    cin>>n>>k;
    for(int i=0;i<n;i++) cin>>a[i]; //输入
    for(int i=0;i<n-1;i++)
        for(int j=i+1;j<n;j++)
            if(a[i]<a[j]) swap(a[i],a[j]); //将这n个数从大到小排序
    for(int i=0;i<k;i++) sum+=a[i]; //计算前k大的数的总和
    cout<<sum<<endl; //输出
    return 0; //结束程序
}

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

#define fi first
#define se second

typedef vector<int> vi;
typedef long long ll;

struct Edge{
	int to;
	ll cost;
};

ll dist[510][51];



vector<Edge> es[510];

int main(){
	int n, m;
	cin >> n>> m;
	//cout<<" "<<n<<" "<<m<<endl;
	for(int i = 0; i < m; i++) {
		int x, y;
		ll t;
		cin >> x >> y >> t;
		x--;
		y--;
		es[x].push_back({y, t});
		es[y].push_back({x, t});
		//cout<<"  "<<i<<endl;
	}
	for(int i = 0; i < 510; i++) for(int j = 0; j < 51; j++) dist[i][j] = 1e18;
	int v, a, b, c;
	cin >> v >> a >> b>> c;
	typedef pair<ll, pair<int, int> > P; // dist, v, idx
	priority_queue<P, vector<P>, greater<P> > q;
	q.push({0LL, {v, 0}});
	dist[0][v] = 0;
	P p;
	auto dijkstra = [&]{
		while(!q.empty()) {
			p = q.top();
			q.pop();
			ll cost = p.fi;
			v = p.se.fi;
			int now = p.se.se;
			if(dist[now][v] < cost) continue;
			for(auto& e : es[now]) {
				int to = e.to;
				int nxt_v = (a*v+b)%c;
				ll newCost = cost + e.cost*v;
				if(newCost < dist[to][nxt_v]) {
					dist[to][nxt_v] = newCost;
					q.push({newCost, {nxt_v, to}});
				}
			}
		}
	};
	dijkstra();
	for(int i = 0; i < n-1; i++) for(v = 0; v < c; v++) dist[i][v] = 1e18;
	for(v = 0; v < c; v++) if(dist[n-1][v] != 1e18) q.push({dist[n-1][v], {v, n-1}});
	dijkstra();
	ll ans = 1e18;
	for(int i = 0; i < c; i++) ans = min(ans, dist[0][i]);
	cout<<ans<<endl;
}

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

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

  vector<int> cumsum(N+1);
  for(int i=1; i<cumsum.size(); i++){
    cin >> buf;
    cumsum.at(i)= cumsum.at(i-1)+ buf;
  }

  auto itr= lower_bound(cumsum.begin(), cumsum.end(), cumsum.back()/2);
  int S1= *itr;
  int S2= cumsum.back()- S1;
  int T1= *prev(itr);
  int T2= cumsum.back()- T1;
  
  cout << min(abs(S1- S2), abs(T1- T2)) << endl;
}

Measured memory_bytes: 256
import sys,itertools
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
l = list(map(int, input().split()))
t = 0

for i in range(N):
    k = l[i]
    t += k

t_2 = t/2
pre = 0
A = 0
for i in range(N):
    A += l[i]
    d = A-t_2
    if d>0:
        if d>abs(pre):
            A -= l[i]
        break
    pre = d
print(abs(t-2*A))


Measured memory_bytes: 25772