akhauriyash/Code-Regression huggingface dataset:
//IOI 2021

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

#define pb push_back
#define ff first
#define ss second

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

int a, b, c, ans;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b >> c;
	while (ans < 2e7) {
		if (a % 2 || b % 2 || c % 2)
			return cout << ans << endl, 0;
		int t1 = a / 2, t2 = b / 2, t3 = c/ 2;
		a = t2 + t3;
		b = t1 + t3;
		c = t1 + t2;
		ans++;
	}
	cout << -1 << endl;
	return 0;
}


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

#define MAX 100

int main(){
    int i, N, M, a, A[MAX];
    int cnt=0;
    int total=0;
    cin >> N >> M;
    for(i=0; i<N; i++){
        cin >> A[i];
        total += A[i];
    }
    float thres = total / 4.0 / M;

    for(i=0; i<N; i++){
        if(A[i] >= thres) cnt++;
    }

    if(cnt >= M) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var aaa = int.Parse(Console.ReadLine());
            var sum = 0;

            for(var x=0;x<=aaa;x++)
            {
                sum += x;
            }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11092
n = int(input())
l = list(map(int,input().split()))
u = []
m = n
c = [0]*n
b = 0
count = 0
for i in range(2,n+1):
    while(m>n//i):
        b=0
        for j in range(1,i):
            b = b^l[m*j-1]
            #print(b,m*j)
        l[m-1] = b
        if(b):
            u.append(m)
            count += 1
        m -= 1
b = 0
for i in range(0,n):
    b = b^l[i]
if(b):
    u.append(m)
    count += 1
print(count)
if(u):
    print(*list(reversed(u)))


Measured memory_bytes: 68328
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int a, b, n;
  cin >> n;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    ans += b - a + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
string s;
int n, i, x, c;
int main() {
	for (; cin >> n >> s; cout << s << endl)
		for (int z = 0; z < n; z++) {
			stringstream q;
			for (i = 0; c = s[i]; q << x << s[i], i += x)
				for (x = 0; s[i + x] == c; x++);
			s = q.str();
		}
}

Measured memory_bytes: 1380
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

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

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long 
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;

void fastIO(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int dp[100005]; bool visited[100005]; int indeg[100005]; vector<vector<int>> graph(100005);

void dfs(int par){
    if(!visited[par]){
        visited[par]=true;
        for(auto i:graph[par]){
            dp[i]=max(dp[i],dp[par]+1);
            indeg[i]--;
            if(indeg[i]==0) dfs(i);
        }
    }
    return;
}

int32_t main(){
    
    fastIO();

    int n,m; cin>>n>>m;
    loopf(i,1,100001){dp[i]=0; indeg[i]=0;}
    loopf(i,0,m-1){
        int u,v; cin>>u>>v; graph[u].pb(v); indeg[v]++;
    }
    loopf(i,1,n){
        if(!visited[i] && indeg[i]==0) dfs(i);
    }
    int ans=0; loopf(i,1,n) ans=max(ans,dp[i]);
    cout<<ans;
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

void output(const deque<int> &a) {
  REP(i,a.size()) {
    cout << a[i] << " \n"[i == (int)a.size() - 1];
  }
}

int main() {
  cout << setprecision(12) << fixed << boolalpha;
  int N, M;
  cin >> N >> M;
  deque<int> a, odd;
  REP(i,M) {
    int in; cin >> in;
    if (in % 2) odd.push_back(in);
    else a.push_back(in);
  }
  if (odd.size() > 2) {
    cout << "Impossible" << endl;
    return 0;
  }
  REP(i,odd.size()) {
    if (i == 0) a.push_front(odd[i]);
    else a.push_back(odd[i]);
  }
  output(a);
  if (a.size() == 1) {
    a.push_front(0);
  }
  ++a.front();
  --a.back();
  if (a.back() == 0) a.pop_back();
  cout << a.size() << endl;
  output(a);
  return 0;
}


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

int main(){
	while(1){
		string s1,s2;
		cin>>s1>>s2;
		
		if(s1=="."){
			break;
		}
		
		if(s1==s2){
			cout<<"IDENTICAL"<<endl;
			continue;
		}
		
		string t1=s1;
		string t2=s2;
		
		while(1){
			size_t d1b=t1.find('\"');
			if(d1b==string::npos){
				break;
			}
			t1.replace(d1b,1,"@");
			size_t d1e=t1.find('\"');
			t1.replace(d1e,1,"@");
			
			size_t d2b=t2.find('\"');
			if(d2b==string::npos){
				break;
			}
			t2.replace(d2b,1,"@");
			size_t d2e=t2.find('\"');
			t2.replace(d2e,1,"@");
		
			string u1=s1;
			string u2=s2;
			u1.replace(d1b+1,d1e-d1b-1,"");
			u2.replace(d2b+1,d2e-d2b-1,"");
	
			if(u1==u2){
				t1=u1;
				t2=u2;
				break;
			}
		}
		if(t1==t2){
			cout<<"CLOSE"<<endl;
		}else{
			cout<<"DIFFERENT"<<endl;
		}
			
	}
	return 0;
}

Measured memory_bytes: 3040
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())
count = 0
# 合計金額の全通り
for i in range(coin_500 + 1):
    for j in range(coin_100 + 1):
        for k in range(coin_50 + 1):
            if 500 * i + 100 * j + 50 * k == total:
                count += 1

print(count)

Measured memory_bytes: 3188
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

# code here
a, b = sorted(map(int, input().strip().split()))
c = 1
while True:
    d, r = divmod(b * c, a)

    if r == 0:
        print(b * c)
        break
    else:
        c += 1

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int modinv(int k)
{
	return pow(k, MOD - 2, MOD);
}

int n;
int a[N];

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);
	int cnt = 0;
	int ans = 0;
	for(int i = 1; i <= n; i++)
	{
		int cur = cnt * modinv(2);
		cur %= MOD;
		cur = (cur + 1) * a[i];
 		cur %= MOD;
 		cur *= modinv(2);
 		cur %= MOD;
		ans += cur;
		ans %= MOD;
		cnt++;
	}
	ans *= pow(2, n, MOD);
	ans %= MOD;
	ans *= (pow(2, n, MOD));
	ans %= MOD;
	cout << ans;
	return 0;
}

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

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];

    sort(p.begin(), p.end());
    int ans = 0;
    for(int i = 0; i < k; i++){
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
def main():
    while True:
        data = int(input())
        if data == 1: break

        i = 1
        factlist = []
        while True:
            item = 7 * i - 1
            if item > int(data / 6) + 1: break

            if data % item == 0:
                quo = int(data / item)
                if isms(quo) and ismsp(quo):
                    factlist.append(quo)
            

            item = 7 * i + 1
            if item > int(data / 6) + 1:break

            if data % item == 0:
                quo = int(data / item)
                if isms(quo) and ismsp(quo):
                    factlist.append(quo)

            i += 1

        factlist.sort()
        if factlist == []: factlist.append(data)

        print(str(data) + ":", end = "")

        for item in factlist:
            print(" " + str(item), end = "")
        print("")
            

def isms(num):
    if num % 7 == 1 or num % 7 == 6: return True
    else: return False

def ismsp(num):
    i = 1
    while True:
        item = 7 * i - 1
        if item > int(num / 6) + 1: break

        if num % item == 0: return False

        item = 7 * i + 1
        if item > int(num / 6) + 1: break

        if num % item == 0: return False

        i += 1
    return True
main()



Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x_, i_, j_) cerr << #x_ << "------------" << "\n";cerr << "from " << i_ << " to " << j_ << "\n";for(ll k_=i_; k_<=j_; k_++) cerr << x_[k_] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

const ll MOD = 1e9 + 7;
const int INF = 2e9;
const int MAX_LOG = 21;
const int MAX_N = 12800;

void dfs(int node, int parent, int pcolor, vvi &adj, vpi &edge, int maxcolor, vi &color){
	int curcolor = 1;
	for(int eid: adj[node]){
		int u, v;
		pi p = edge[eid];
		tie(u, v) = p;
		if(u != node){
			swap(u, v);
		}
		if(v != parent){
			while(pcolor == curcolor){
				curcolor++;
			}
			color[eid] = curcolor;
			curcolor++;
			// trace6(u, v, node, parent, pcolor, curcolor);
			dfs(v, node, curcolor - 1, adj, edge, maxcolor, color);
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	vi deg(n + 1, 0);
	vvi adj(n + 1);
	vi color(n);
	vpi edge(n - 1);
	int ans = 0;
	for(int i = 0; i < n - 1; i++){
		int u, v;
		cin >> u >> v;
		edge[i] = {u, v};
		adj[u].push_back(i);
		adj[v].push_back(i);
		deg[u]++;
		deg[v]++;
		ans = max(ans, deg[u]);
		ans = max(ans, deg[v]);
	}
	dfs(1, 1, -1, adj, edge, ans, color);
	cout << ans << endl;
	for(int i = 0; i < n - 1; i++){
		cout << color[i] << "\n";
	}
}		

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

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

    if (N%2==1) cout << "No" << endl;
    else if (S.substr(0,N/2)==S.substr(N/2)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
// #define NMAX 1000000000
int N,K;
vi D;
vvi A;

ll solve(){
	// cout<<" N "<<N;
	// cout<<" K "<<K;
	// cout<<"\n";
	// puts("---");

	// rp(i,0,K){
	// 	cout<<" d "<<D[i];
	// 	cout<<"\n";
	// 	rp(j,0,D[i]){
	// 		cout<<A[i][j]<<" ";
	// 	}
	// 	puts("");
	// }
	// puts("---");

	vi ok(N+1,0);
	rp(i,0,K){
		rp(j,0,D[i]){
			ok[A[i][j]]++;
		}
	}

	ll ans = 0;
	rp(i,1,N+1){
		if(ok[i] == 0){
			ans++;
		}
	}

	return ans;
}

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

	D.resize(K);
	A.resize(K);

	rp(i,0,K){
		cin>>D[i];
		A[i].resize(D[i]);
		rp(j,0,D[i]){
			cin>>A[i][j];
		}
	}

	cout<< solve() <<endl;
	// printf("%f\n",solve());
	// cout<<cout<<setprecision(10)<<ans<<endl;
	// solve();
}


Measured memory_bytes: 3640
s = input()
former = int(s[0]+s[1])
latter = int(s[2]+s[3])
# print(former,latter)
A = former > 0 and former < 13
B = latter > 0 and latter < 13
# print(A,B)
if A and B:
    print('AMBIGUOUS')
elif A:
    print('MMYY')
elif B:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
#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<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll a,b; cin >> a >> b;
  if(a >= 2*b) cout << a-2*b << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,m,k = map(int,input().split())
nm = n*m
class InverseTable:
    __slots__ = ['In', 'fac', 'Ifac']

    def __init__(self, mod, maxnum):
        self.In = [0, 1]; self.fac = [1, 1]; self.Ifac = [1, 1]
        for i in range( 2, maxnum + 1 ):
            self.In.append( ( -self.In[mod % i] * (mod//i) ) % mod )
            self.fac.append( ( self.fac[-1] * i ) % mod )
            self.Ifac.append( (self.Ifac[-1] * self.In[-1]) % mod )
        
    def cmb(self, n, r):
        if ( r<0 or r>n ): return 0
        r = min(r, n-r)
        return self.fac[n] * self.Ifac[r] * self.Ifac[n-r] % mod
    
    def per(self, n, r):
        if ( r<0 or r>n ): return 0
        return self.fac[n] * self.Ifac[n-r] % mod

invt = InverseTable(mod, 10**6)
# maxnum=10**6だとテーブル生成に200ms程かかるので（Pythonだと1000msほど）
# 最大生成領域は問題ごとに要検討
for i in range(n):
  for j in range(m):
    # print(i,j,(i * (i+1) // 2 + (n-1-i) * (n-i) //2 + j * (j+1) // 2 + (m-1-j) * (m-j) //2) * invt.cmb(nm-2,k-2))
    ans += ((i * (i+1) // 2 + (n-1-i) * (n-i) //2) * m + (j * (j+1) // 2 + (m-1-j) * (m-j) //2) * n) * invt.cmb(nm-2,k-2)
    ans %= mod
print(ans*pow(2,mod-2,mod)%mod)

Measured memory_bytes: 127812
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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



int M;
ll length;
ll sum;

int main () {
  cin >> M;

  rep(i, M) {
    ll d, c;
    cin >> d >> c;

    length += c;
    sum += (d * c);
  }

  cout << (length-1) + (sum-1) / 9 << "\n";
}

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

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

	int a, b;
	cin >> a >> b;

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

	return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power(ll a, ll b, ll m)
{
	if (b == 0)
		return(1);
	ll sol = power(a, b / 2, m);
	sol = (sol * sol) % m;
	if (b % 2 == 1)
		sol = (sol * a) % m;
	return(sol);
}
ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	else
	{
		return gcd(b, a % b);
	}
}
ll comb[2001][2001];
void solve()
{
	ll n, k;
	cin >> n >> k;
	for (int i = 0; i < 2001; i++)
	{
		comb[i][0] = 1;
	}
	for (int i = 1; i < 2001; i++)
	{
		for (int j = 0; j < 2001; j++)
		{
			comb[i][j] = (comb[i - 1][j] + comb[i - 1][j-1])%mod;
		}
	}
	for (int i = 1; i <= k; i++)
	{
		ll sol = 0;
		sol = (comb[k - 1][i - 1] * comb[n - k + 1][i]) % mod;
		cout << sol << endl;
	}
}
int main()
{
	int t = 1;
	//cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 31488
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int K = Integer.parseInt(S[1]);
    int ans = 0;
    
    ans = (N-1)/(K-1);
    if((N-1)%(K-1) != 0){
      ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int N;
int D[101];
int main() {
	cin>>N;

	int B[101]={};
	for(int i=0;i<N;i++){
		cin>>D[i];
		B[D[i]]++;
	}
	int ans=N;
	for(int i=1;i<101;i++){
		if(B[i]>1)ans=ans-B[i]+1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
     
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] v = new int[n];
        int[] c = new int[n];
        int sum = 0;

        for (int i=0 ; i<n ; i++) {
            v[i]=sc.nextInt();
        }

        for (int i=0 ; i<n ; i++) {
            c[i]=sc.nextInt();
        }

        for (int i=0 ; i<n ; i++) {
            if (v[i] - c[i] > 0) sum += v[i] - c[i];
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 777;
int g[N][N];
int col[N];

void fail() {
    cout << -1 << '\n';
    exit(0);
}

int n;
void dfs(int u, int c) {
    if (col[u] == c) return;
    if (col[u] != -1) fail();
    col[u] = c;
    forn(v, 0, n) if (g[u][v]) dfs(v, c ^ 1);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int m;
    cin >> n >> m;
    while (m--) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u][v] = 1;
        g[v][u] = 1;
    }
    forn(i, 0, n) forn(j, 0, n) if (i != j) g[i][j] ^= 1;
    forn(i, 0, n) col[i] = -1;
    forn(i, 0, n) if (col[i] == -1) dfs(i, 2 * i);
    vector<int> cnt(2 * n);
    forn(i, 0, n) ++cnt[col[i]];
    bitset<N> poss;
    poss.set(0);
    forn(i, 0, n) {
        poss = (poss << cnt[2 * i]) | (poss << cnt[2 * i + 1]);
    }
    ll ans = LINF;
    for (ll i = 0; i <= n; ++i) if (poss[i])
        setmin(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
    cout << ans << '\n';
}


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

using namespace std;

vector<vector<int>> adjList;
int mem[100002];

int dfs(int node) {
	if(mem[node] != -1)
		return mem[node];

	int ans = 0;
	for(int child : adjList[node]) {
		ans = max(ans, 1+dfs(child));
	}
	return mem[node] = ans;
}

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

	for(int i=0; i<n; i++) {
		adjList.push_back(vector<int>());
	}

	for(int i=0; i<m; i++) {
		int x,y;
		scanf("%d %d", &x,&y);
		adjList[x-1].push_back(y-1);
	}

	memset(mem, -1, sizeof(mem));

	int longest = 0;
	for(int i=0; i<n; i++) {
		longest = max(longest, dfs(i));
	}

	printf("%d\n", longest);

	return 0;
}

Measured memory_bytes: 8304
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T;
  cin >> S >> T;
  int s = S.size();
  int t = s + 1;
  string ans = "Yes";
  for (int i = 0; i < s; i++) {
    if (S.at(i) != T.at(i)) {
      ans = "No";
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
const double eps = 1e-8;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto si : s) os << si << " "; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += (b % mod + mod)) %= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    string s;
    cin >> s;
    int sum = 0;
    rep(i, sz(s)) (sum += s[i] - '0') %= 9;
    cout << (sum % 9 == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3752
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

long sumn(long n) {
    long ans = 0;
    for (long i = 0; i <= n; i++) {
        ans += i;
    }
    return ans;
}

int main() {
    string S;
    cin >> S;
    long sum = 0;
    long ido = 0;
    for (long i = 0; i < S.size(); i++) {
        if (S.at(i) == 'W') {
            sum++;
            ido += i + 1;
        }
    }
    long ans = ido - sumn(sum);
    cout << ans << endl;
}

Measured memory_bytes: 640
n = int(input())
words = list(input())

if words == ['R'] * n or words == ['W'] * n:
  print(0)
else:
  count = 0
  key = n - 1
  flag = False
  while words[key] != 'R':
    key -= 1
  for i in range(n):
    #print(key)
    if key == i or key == i - 1:
      break
    if words[i] == 'R':
      continue
    if words[i] == 'W':
      words[i], words[key] = words[key], words[i]
      count += 1
      key -= 1
      while words[key] != 'R':
        key -= 1
    #print(words)
  print(count)

Measured memory_bytes: 12096
#include <iostream>

using namespace std;

int main(){
    int r,d,x;
    cin >> r >> d >> x;

    int pre, n;
    pre = x;

    for(int i=0; i<10; ++i){
        n = pre * r - d;
        cout << n << endl;
        pre = n;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll MOD = 1000000007;

int main() {
    int N; cin >> N;
    vi a(N); rep(i,N) cin >> a[i];
    int ans = 0;
    rep(i,N){
        if((i+1)%2 == 1 && a[i]%2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int N, K, x;
  cin >> N >> K;
  x = 1;
  for (int i=0; i<N; i++) {
    if (x*2 < x+K) {
      x *= 2;
    }
    else {
      x += K;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
import java.util.*;
    public class Main{
    	public static void main(String[] args){
        	Scanner s  = new Scanner(System.in);
          	long a = s.nextLong();
          	long b = s.nextLong();
          	long c = s.nextLong();
          	long d = s.nextLong();
          	//long res=  1;
            long a1 = a*c;
            long a2 = b*d;
            long a3 = a*d;
          	long a4 = b*c;
          	long res1 = Math.max(a1,a2);
          	long res2 = Math.max(a3,a4);
          	long res = Math.max(res1,res2);
          	System.out.println(res);
        }
    }

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

int main() {
    int x, y;
    cin >> x >> y;
    while ((x != 0) or (y != 0)) {
        if (x <= y)
            cout << x << " " << y << endl;
        else
            cout << y << " " << x << endl;
        cin >> x >> y;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <map>
#include <set>
using namespace std;
#define EACH(it,n) for(S::iterator it = (n).begin(); it != (n).end() ; ++it)
typedef set<int> S;
map< string , S > data;


string expr;

S uni(S a,S b){
	S ans;
	EACH(it,a) ans.insert(*it);
	EACH(it,b) ans.insert(*it);
	return ans;
}
S inter(S a,S b){
	S ans;
	EACH(it,a) if(b.count(*it))ans.insert(*it);
	return ans;
}
S diff(S a,S b){
	S ans;
	EACH(it,a) if(!b.count(*it))ans.insert(*it);
	return ans;
} 
S sym(S a,S b){
	return uni(diff(a,b),diff(b,a));
}
S comp(S a){
	S ans;
	EACH(it,data["U"]) if(!a.count(*it)) ans.insert(*it);
	return ans;
}


int pos = 0;

void view(S s){
	if(s.size()==0) cout << "NULL" << endl;
	EACH(it,s){
		cout << *it;
		S::iterator it2 = it;
		it2++;
		if( it2 == s.end()) cout << endl;
		else cout << " ";
	}
}
set<int> f(int depth){
	string table = "uids";
	set<int> le,ri;
	while(pos < expr.size()){
		int jump = 1;
		if(expr[pos] == ')'){
			return le;
		}else if(expr[pos] == '('){
			pos++;
			le = f(depth+1);
		}else if(expr[pos] == 'c'){
			if(expr[pos+1] == '('){
				pos+=2;
				le = comp(f(depth+1));
			}else{
				jump ++;
				le = comp(data[string(1,expr[pos+1])]);
			}
		}else if(~table.find(expr[pos])){
			char cc = expr[pos];
			if(expr[pos+1] == '('){
				pos+=2;
				ri = f(depth+1);
			}else if(expr[pos+1] == 'c'){
				if(expr[pos+2] == '('){
					pos+=3;
					ri = comp(f(depth+1));
				}else{
					jump+=2;
					ri = comp(data[string(1,expr[pos+2])]);
				}
			}else{
				jump++;
				ri = data[string(1,expr[pos+1])];
			}
			if(cc == 'u') le = uni(le,ri);
			if(cc == 'i') le = inter(le,ri);
			if(cc == 'd') le = diff(le,ri);
			if(cc == 's') le = sym(le,ri);
		}else{
			le = data[string(1,expr[pos])];
		}
		pos += jump;
	}
	return le;
}
int main(){
	while(1){
		string a; int b;
		if(cin >> a >> b){
			if(a == "R" && b == 0){
				cin >> expr;
				while(~expr.find("cc")) expr.replace(expr.find("cc"),2,"");
				pos = 0;
				set<int> res = f(0);
				view(res);
				data.clear();
			}else{
				for(int i = 0 ; i < b ; i++){
					int t; cin >> t;
					data[a].insert(t);
					data["U"].insert(t);
				}
			}
		}else return 0;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;


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

    int A, B;
    cin >> A >> B;
    cout << 100 << ' ' << 100 << endl;
    char c[100][100]{};
    rep(i,100){
        rep(j,100){
            if(i < 50){
                c[i][j] = '#';
            }
            else{
                c[i][j] = '.';
            }
        }
    }
    --A; --B;
    int x = 0, y = 0;
    rep(i,A){
        c[x][y] = '.';
        y += 2;
        if(y >= 50){
            x += 2, y = 0;
        }
    }
    x = 55, y = 0;
    rep(i,B){
        c[x][y] = '#';
        y += 2;
        if(y >= 50){
            x += 2, y = 0;
        }
    }
    rep(i,100){
        rep(j,100){
            cout << c[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define arena ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
    arena
    ll n;
    cin>>n;
    ll sum=(n*(n+1))/2;
    sum=sum-n;
    cout<<sum;
}

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

int main()
{
    ll N,Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    ll L[Q];
    ll R[Q];

    for(ll i = 0; i < Q; i++)
    {
        cin >> L[i] >> R[i];
    }



    ll AC[S.size()] = {0};
    ll count = 0;

    for(ll i = 1; i < S.size(); i++)
    {
        if(S[i-1] == 'A' && S[i] == 'C')
        {
            count++;
        }
        AC[i] = count;
    }

    for(ll i = 0; i < Q; i++)
    {
        cout << AC[R[i]-1] - AC[L[i]-1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3456
#include<iostream>
 
using namespace std;
 
int main(){
 
    int m;
    int n;
    int money,nowmoney,year;
    int type,tesuu;
    int sumrisi;
    int ans;
    double risi;
 
    cin>>m;
 
    for(int i=0;i<m;i++){
        cin>>money;
        cin>>year;
        cin>>n;
        ans=-1;
        for(int j=0;j<n;j++){
            cin>>type>>risi>>tesuu;
            nowmoney=money;
            sumrisi=0;
            for(int k=0;k<year;k++){
                if(type==1){
                    nowmoney+=(nowmoney*risi)-tesuu;
                }
                else{
                    sumrisi+=(nowmoney*risi);
                    nowmoney-=tesuu;
                }
            }
            if(type==0) nowmoney+=sumrisi;
            if(ans<nowmoney) ans=nowmoney;
        }
        cout<<ans<<endl;
    }
 
    return 0;
}

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

int main(){
  int N,W;
  cin>>N>>W;
  int v[N];
  int w[N];
  for(int i=0;i<N;i++){
    cin>>v[i]>>w[i];
  }
  int data[W];
  for(int i=0;i<W+1;i++){
    data[i]=0;
  }
  for(int i=0;i<N;i++){
    for(int j=W;j>=0;j--){
      if(j>=w[i]){
        if(data[j]<=data[j-w[i]]+v[i]){
          data[j]=data[j-w[i]]+v[i];
        }
      }
    }
  }
  int max=0;
  for(int i=0;i<W+1;i++){
    if(max<data[i]){
      max=data[i];
    }
  }
  cout<<max<<endl;
  return 0;
}


Measured memory_bytes: 3120
#include<iostream>

using namespace std;

int prime(int n)
{
	int i;
	if (n == 2)return 1;
	for (i = 2; i*i <= n; i++)
	{
		if (n%i == 0)return 0;
	}
	return 1;
}

int main()
{
	int n, i, a, count = 0;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a;
		count += prime(a);
	}
	cout << count << endl;
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using ll = int_fast64_t;

int main(){
	ll n, k;
	scanf("%ld %ld", &n, &k);
	
	if(k==0){
		printf("%ld\n", n*n);
		return 0;
	}

	ll ans = 0;
	for(ll i=k+1; i<=n; i++){
		ans += (n/i)*(i-k);
		if(n%i) ans += std::max(0l, (n%i)-k+1);
	}
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *	
from heapq import *
from math import *
from itertools import permutations ,product
 
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1
 
#sys.setrecursionlimit(10**6)
if zz:
	input=sys.stdin.readline
else:	
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')
def inc(d,c):
	d[c]=d[c]+1 if c in d else 1
def bo(i):
	return ord(i)-ord('A')	
def li():
	return [int(xx) for xx in input().split()]
def fli():
	return [float(x) for x in input().split()]	
def comp(a,b):
	if(a>b):
		return 2
	return 2 if a==b else 0		
def gi():	
	return [xx for xx in input().split()]
def fi():
	return int(input())
def pro(a): 
	return reduce(lambda a,b:a*b,a)		
def swap(a,i,j): 
	a[i],a[j]=a[j],a[i]	
def si():
	return list(input().rstrip())	
def mi():
	return 	map(int,input().split())			
def gh():
	sys.stdout.flush()
def isvalid(i,j):
	return 0<=i<n and 0<=j<n	
def bo(i):
	return ord(i)-ord('a')	
def graph(n,m):
	for i in range(m):
		x,y=mi()
		a[x].append(y)
		a[y].append(x)


tt=1

while tt>0:
	tt-=1
	s=si()
	t=si()
	n=len(s)
	m=len(t)
	i=m-1
	mini=n	
	while i<n:
		c=0
		for j in range(0,m):
				if s[i-m+1+j]!=t[j]:
					c+=1
		mini=min(mini,c)
		i+=1		
	print(mini)		

	


Measured memory_bytes: 72924
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cmath>

#define mst(a,b)memset(a, b, sizeof(a))
#define repi(a,b)for(ll i = a; i < b; i++)
#define repj(a,b)for(ll j = a; j < b; j++)
#define pii pair<int,int>

#ifdef LOCAL
#define fre()freopen("in.txt","r",stdin)
#endif
#ifndef LOCAL
#define fre()
#endif

//static int x = []() {
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(NULL);
//	return 0;
//}();

#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif

typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;

using namespace std;


int a[100010];
struct aa {
	int b, c;
	bool operator<(const aa& rhs)const {
		return c > rhs.c;
	}
}rifa[100010];
int main() {
	ll n, m, ans = 0; cin >> n >> m;
	repi(0, n) {
		cin >> a[i];
		ans += a[i];
	}
	a[n] = LLINF;
	repi(0, m)cin >> rifa[i].b >> rifa[i].c;
	sort(rifa, rifa + m);
	sort(a, a + n);
	int p = 0;
	repi(0, m) {
		if (rifa[i].c > a[p]) {
			repj(0, rifa[i].b) {
				if (rifa[i].c <= a[p])break;
				ans += rifa[i].c - a[p];
				p++;
			}
		}
	}
	cout << ans << endl;
}

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

int main() {
  long long int a,b,k;
  cin>>a>>b>>k;
  
  for(int i=0;i<k;i++){
    if(i%2==0){
      if(a%2==1){
        a-=1;
      }
      b+=a/2;
      a/=2;
    }
    if(i%2==1){
      if(b%2==1){
        b-=1;
      }
      a+=b/2;
      b/=2;
    }
  }
  cout<<a<<" "<<b<<endl;    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 
 
int32_t main()
{
    fast;
    string s; cin >> s;
    int ans = 0, cur = 0;
    For(i, 0, s.size()) {
        if(s[i] == 'A' or s[i] == 'G' or s[i] == 'C' or s[i] == 'T') cur++;
        else {
            ans = max(ans, cur);
            cur = 0;
        }
    } 
    cout << max(cur, ans);
    
    return 0;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

const int N = 1e5 + 5;
set<int>adj[N];
set<int>b[N];
int par[N];
int sz[N];
void init(int n){
    for(int i=0;i<=n;i++){
        par[i] = i;
        sz[i] = 1;
    }
}
int parent(int x){
    while(x!=par[x]){
        par[x] = par[par[x]];
        x = par[x];
    }
    return x;
}
void merge(int x,int y){
    int a = parent(x);
    int b = parent(y);
    if(a==b){
        return;
    }
    if(sz[a]>sz[b]){
        swap(a,b);
    }
    sz[b] += sz[a];
    sz[a] = 0;
    par[a] = b;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,k;
    cin>>n>>m>>k;
    init(n);
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        adj[u].insert(v);
        adj[v].insert(u);
        merge(u,v);
    }
    for(int i=0;i<k;i++){
        int u,v;
        cin>>u>>v;
        b[u].insert(v);
        b[v].insert(u);
    }
    for(int i=1;i<=n;i++){
        int x = sz[parent(i)];
        // cerr<<adj[i].size()<<endl;
        x -= adj[i].size();
        for(auto get:b[i]){
            cerr<<parent(i)<<endl;
            if(parent(get) == parent(i)){
                x--;
            }
        }
        cout<<x - 1<<" ";
    }
    return 0;
    
}



Measured memory_bytes: 30592
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
for i in range(d):
    cand=0
    for j in range(26):
        if s[i][cand]<s[i][j]:
            cand=j
    print(cand+1)

Measured memory_bytes: 74660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
template<class T>void die(T a){cout << a << endl; exit(0);}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

string S,T,U;
int a,b,c;
vi A,B,C;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    cin>>T;
    int ans = 0;
    rep(i,T.size()) if(T[i] == '?') T[i] = 'D';
    rep(i,T.size()){
        if(T[i] == 'D') ans++;
        if(i >= 1 and T[i-1] == 'P' and T[i] == 'D') ans++;
    }
    out(T);

}

Measured memory_bytes: 3772
#include<stdio.h>

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a < b){
		printf("a < b\n");
	}
	if(a>b){
		printf("a > b\n");
	}
	if(a==b){
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2676
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int H = sc.nextInt();
		int[] h = new int[H + 1];
		int sum = 0;
		int c = 0;
		boolean t = false, z = false;

		for (int i = 0; i < H; i++) {
			h[i] = sc.nextInt();
			sum += h[i];
		}

		while (sum > 0) {
			for (int i = 0; i < H; i++) {
				if (h[i] > 0) {
					h[i]--;
					sum--;
					t = true;
					z = true;
				} else {
					if (t) {
						c++;
						z = false;
					}
					t = false;
				}
			}
			if (z) {
				c++;
			}
			t = false;
		}

		System.out.println(c);

		sc.close();
	}
}


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

int main() {
    int H , A ;
    cin >> H >> A ; // 1 ≤ H,A ≤ 10^4
    int a = 0 ;
    do {
       H = H - A;
        a++;
    } while (H > 0);
    cout << a << endl;
	return 0;
}

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	REP(i, n) {
		if (count(ALL(s), s[i]) != 1) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
attrs = Array.new
while line = $stdin.gets
  attrs << line.chomp.split
end

N, K = attrs[0].map{|a| a.to_i}
h = attrs[1].map{|a| a.to_i}.sort.reverse
K.times do |i|
  h[i] = 0
end
total = h.inject(:+)
puts total

Measured memory_bytes: 22500
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n, k;
    cin >> n >> k;

    for(int i = 0; i < 100000000; i++){
        if(pow(k, i) <= n && n < pow(k, i+1)){
            cout << i+1 << endl;    
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(){
  char a[9],b[4];
  int x,i;
  scanf("%s %s",a,b);
  strcat(a,b);
  x=atoi(a);
  for(i=4;i<=350;i++)
    if(i*i==x){
      printf("Yes\n");
      return 0;
    }
  printf("No\n");
}

Measured memory_bytes: 128
def main():
    N = int(input())
    w = "ATCG"
    INF = 10 ** 9 + 7

    table = {}
    for c1 in w:
        for c2 in w:
            for c3 in w:
                table[c1 + c2 + c3] = 1
    NG = ["AGC", "ACG", "GAC"]
    for ng in NG:
        table[ng] = 0

    for i in range(N - 3):
        t = table.copy()
        for c1 in w:
            for c2 in w:
                for c3 in w:
                    s = c1 + c2 + c3
                    if s in NG:
                        continue

                    if c1 == "G" and c3 == "C" or c2 == "G" and c3 == "C":
                        res = 0
                        for c4 in "TCG":
                            ss = c4 + c1 + c2
                            res += table[ss] % INF
                            res %= INF
                        t[s] = res
                        continue
                    res = 0
                    for c4 in w:
                        ss = c4 + c1 + c2
                        res += table[ss] % INF
                        res %= INF
                    t[s] = res
        table = t

    res = 0
    for v in table.values():
        res += v % INF
        res %= INF
    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064