akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim_i = (b); i < lim_i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Thu Mar 26 18:48:49 JST 2020
 **/

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

template <class T, class S> T make_vec(S x) { return x; }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...));
}

signed main() {
    string s, t;
    cin >> s >> t;
    Int n = s.size(), m = t.size();
    auto dp = make_vec<Int>(n + 1, m + 1, 1e9);
    dp[0][0] = 0;
    REP(i, n + 1) {
        REP(j, m + 1) {
            if (i - 1 >= 0) chmin(dp[i][j], dp[i - 1][j] + 1);
            if (j - 1 >= 0) chmin(dp[i][j], dp[i][j - 1] + 1);
            if (i - 1 >= 0 && j - 1 >= 0) chmin(dp[i][j], dp[i - 1][j - 1] + (s[i - 1] != t[j - 1]));
        }
    }
    cout << dp[n][m] << endl;
}



Measured memory_bytes: 10712
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) n
    allocate(x(n))
    read(*,*)x
    a=x(1)
    do i=2,n
        b=max(a,x(i))

            c=min(a,x(i))
        do j=1,40
            if(mod(b,c)==0)then
            a=c
            exit
            else
                a=mod(b,c)
                b=c
                c=a
            end if
        end do
        if(a==1)then
            write(*,*)1
            stop
        end if
    end do
    write(*,*)a

    stop
end program sample
  



Measured memory_bytes: 3852
#include <bits/stdc++.h>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
int main() 
{
    int n;
    cin >>n;
    
    queue<string> q;
    q.push("a");
    for(int j=1;j<n;j++){
        string s;
        s=q.front();
    
        while(s.size()==j){

            int oldest=-1,x;
            
            rep(i,s.size()){
                x = s.at(i)-'a';
                oldest=max(x,oldest);
            }
            rep(i,oldest+2){
                char y='a'+i;
                string t=s+y;
                q.push(t);
            }
            q.pop();
            s=q.front();

        }  
        
  }
  while(!q.empty()){
    cout << q.front() << endl;
    q.pop();
  }
}

Measured memory_bytes: 9728
n, a, b = gets.chomp.split(' ').map(&:to_i)

if (a -b) % 2 == 0
  puts (a-b).abs / 2
  exit
end

large = [a,b].max
small = [a,b].min

edge_dis = [small-1, n-large].min
puts edge_dis + 1 + (large - small - 1) / 2

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

int main()
{
	int64_t h, n;
	cin >> h >> n;
	vector<int64_t> as(n), bs(n);
	for (int64_t i = 0; i < n; i++)
	{
		cin >> as[i] >> bs[i];
	}

	int64_t inf = (1LL << 60);

	vector<int64_t> dp(h + 1, inf);

	dp[0] = 0;

	for (int64_t i = 0; i < h; i++)
	{
		if (dp[i] == inf)
		{
			continue;
		}
		for (int64_t j = 0; j < n; j++)
		{
			dp[min(i + as[j], h)] = min(dp[min(i + as[j], h)], dp[i] + bs[j]);
		}
	}

	cout << dp[h] << endl;

	return 0;
}

Measured memory_bytes: 384
/*
  AUTHOR:SOURABH
  CREATED:12:02:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,n,i,carry,ans;
    string s;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>s;
        n=s.length();
        carry=0;
        ans=0;
        fr(i,n-1)
        {
            if(carry)
            {
                if(s[i]-'0'<9)
                {s[i]++;carry=0;}
                else
                s[i]='0';
            }
            if(s[i]-'0'<5)
                ans+=s[i]-'0';
            else if(s[i]-'0'>5)
            {ans+=10-(s[i]-'0');carry=1;}
            else
            {
                if(i-1>=0 && s[i-1]>='5')
                {ans+=5;carry=1;}
                else
                ans+=5;
            }
            //cout<<ans<<" ";
        }
        if(carry)
            ans++;
        cout<<ans;
    }
    return 0;
}














Measured memory_bytes: 1948
#include<cstdio>
const int N=2007,P=1000000007;
int n,m,k,fac[N*N],ifac[N*N],f[N][N];
void inc(int&a,int b){a+=b-P,a+=a>>31&P;}
void mul(int&a,int b){a=1ll*a*b%P;}
int C(int n,int m){return 1ll*fac[n]*ifac[m]%P*ifac[n-m]%P;}
int pow(int a,int b){int r=1;for(;b;b>>=1,mul(a,a))if(b&1)mul(r,a);return r;}
int main()
{
    scanf("%d%d",&n,&k),m=n*k,f[0][0]=1;
    if(k==1) return puts("1"),0;
    fac[0]=1;for(int i=1;i<=m;++i)mul(fac[i]=fac[i-1],i);
    ifac[m]=pow(fac[m],P-2);for(int i=m;i;--i)mul(ifac[i-1]=ifac[i],i);
    for(int i=0,z=k-1;i<=n;++i,z+=k-1)
	for(int j=0;j<=i;++j)
	    inc(f[i+1][j],1ll*f[i][j]*C(z+j-1,k-2)%P),inc(f[i][j+1],f[i][j]);
    mul(f[n][n],fac[n]),printf("%d",f[n][n]);
}


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

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int n;
	string s;
	cin >> n >> s;

	int left = 0, right = 0;
	for (int i = 0; i < n; i++) {
		right += (s[i] == '(' ? 1 : -1);
		left = min(left, right);
	}

	left = abs(left);
	for (int i = 0; i < left; i++) {
		s = "(" + s;
		right++;
	}
	for (int i = 0; i < right; i++) {
		s += ")";
	}

	cout << s << endl;
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9+7

using namespace std;

vector<int> prime;
bool is_prime[100005];

struct rect
{
  int area; double sedge, ledge;
  rect(int a, int b) : area(a*b), sedge(double(a>b?b:a)), ledge(double(a>b?a:b)) {}
  bool operator<(const rect &x){
    if(area > x.area) return true;
    return false;
  }
};

void make_prime(){
  REP(i, 100005){
    if(i == 0 or i == 1) continue;
    REP(j, 100005){
      if(j == 0 or j == 1) continue;
      if(i * j >= 100005) break;
      is_prime[i*j] = false;
    }
  }
  REP(i, 100005) if(is_prime[i]) prime.push_back(i);
}

int main(){
  REP(i, 100005) is_prime[i] = true;
  make_prime();
  int m, a, b;
  while(cin >> m >> a >> b and m + a + b){
    vector<rect> rects;
    double rate = (double)a / b;
    REP(i, prime.size()){
      if(prime[i] > m) break;
      REP(j, i+1){
        if(prime[i] * prime[j] > m) break;
        if((double)prime[j] / prime[i] < rate) continue;
        rects.emplace_back(prime[i], prime[j]);
      }
    }
    sort(ALL(rects));
    cout << rects[0].sedge << " " << rects[0].ledge << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	fast_cin();
	ll n; cin >> n;
	ll sq = sqrt(n);
	vector<ll> divisors;
	for (ll i = 1; i <= sq; ++i) {
		if (n % i == 0) {
			divisors.pb(i);
			if (i * i != n) {
				divisors.pb(n / i);
			}
		}
	}
	ll ans = 0;
	for (auto &k : divisors) {
		ll m = n / k - 1;
		if (m and n / m == n % m) {
			ans += m;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

const int MAX_N = 100001*2;

struct SegMax {
  int data[MAX_N * 2 - 1];
  int datb[MAX_N * 2 - 1];
  int n;
  SegMax(int n) : n(n) {
    REP(i,n) data[i]=datb[i]=0;
  }
  void add(int a, int b, int x) {
    add(a,b,x,0,0,n);
  }
  void add(int a, int b, int x, int k, int l, int r) {
    if (a <= l && r <= b) data[k] += x;
    else if (l<b && a<r) {
      add(a, b, x, k*2+1, l, (l+r)/2);
      add(a, b, x, k*2+2, (l+r)/2, r);
      datb[k] = max(data[k*2+1]+datb[k*2+1], data[k*2+2]+datb[k*2+2]);
    }
  }
  int getmax(int a, int b) {
    return getmax(a,b,0,0,n);
  }
  int getmax(int a, int b, int k, int l, int r) {
    if (b<=l || r<=a) return 0;
    else if (a<=l && r<=b) {
      return data[k] + datb[k];
    } else {
      int res = 0;
      res = max(res, getmax(a, b, k*2+1, l, (l+r)/2));
      res = max(res, getmax(a, b, k*2+2, (l+r)/2, r));
      return res + data[k];
    }
  }
};

int di[100000];
int hi[100000];

int main() {
  int N, H;
  cin >> N >> H;
  REP(i,N-1) {
    scanf("%d%d",di+i,hi+i);
  }
  SegMax st(N);
  priority_queue<pii> Q;
  int now = H;
  ll ans = 0;
  REP(i,N-1) {
    st.add(i,i+1,now);
    Q.push(pii(hi[i], i));
    now -= di[i];
    // cout << i << " ; " << now << endl;
    while(now<=0) {
      pii p = Q.top(); Q.pop();
      int heal = p.first;
      int pos = p.second;
      // cout << "(pos,heal) = " << pos << "," << heal << endl;
      int smax = st.getmax(pos, i+1);
      // cout << "segmax = " << smax << endl;
      if (smax + heal > H) {
        Q.push(pii(H-smax, pos));
        continue;
      }
      int num = min((0-now)/heal+1, (H-smax)/heal);
      now += num*heal;
      ans += num;
      // cout << "num = " << num << endl;
      // cout << "now = " << now << endl;
      st.add(pos, i+1, num*heal);
      Q.push(p);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 5732
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D,E,K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> A >> B >> C>> D>>E >> K;
  if (E-A <= K) cout << "Yay!" << endl;
  else cout <<":(" << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int ans,an1;
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='1'){
			ans++;
		}
		else {
			an1++;
		}
	}
	if(ans!=0||an1!=0){
		cout<<min(ans,an1)*2<<endl;
		return 0;
	}
	cout<<"0"<<endl;
}

Measured memory_bytes: 512
a, b, m = map(int, input().split())
a_array = [int(x) for x in input().split()]
b_array = [int(x) for x in input().split()]
array = [[int(x) for x in input().split()] for y in range(m)]
ans = min(a_array)+min(b_array)
for x, y, c in array:
    ans = min(a_array[x - 1] + b_array[y - 1] - c, ans)
print(ans)


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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  vector<int> V;
  for (int i = 1; i <= min(A, B); i++) {
    if (A % i == 0 && B % i == 0) V.push_back(i);
  }
  sort(V.rbegin(), V.rend());
  cout << V.at(K - 1) << "\n";
}

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

int main() {
    int i;
	long n;
	long long ans = 0;
    scanf("%ld", &n);
	for(i = 1; i < n; i++){
		ans += i;
	}
    printf("%lld\n", ans);
    return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<char> S(N);
  for(int i=0; i<N; i++){
    cin>>S.at(i);
  }
  int64_t r =0;
  int64_t g =0;
  int64_t b =0;
  int64_t m =0;
  for(int i=0; i<N; i++){
    if(S.at(i)=='R'){
      r++;
    }
    else if(S.at(i)=='G'){
      g++;
    }
    else{
      b++;
    }
  }
  m = r*g*b;
  int64_t count =0;
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(i-j<0 || i+j>=N){
        continue;
      }
      if(S.at(i)!=S.at(i+j) && S.at(i+j)!=S.at(i-j) && S.at(i-j)!=S.at(i)){
        count++;
      }
    }
  }
  
  cout<< m-count <<endl;
}


Measured memory_bytes: 3596
def main():
    a, b = map(int, input().split())

    # if the number of 1 is odd: 1
    # else: 0
    b += 1
    ans = 0
    unit = 1
    for i in range(b.bit_length()):
        new_unit = unit << 1
        cnt = min(new_unit - a % new_unit, unit) % 2
        cnt += max(0, b % new_unit - unit) % 2
        cnt %= 2
        if cnt:
            ans += unit

        unit = new_unit

    if (b - a) % 2 == 0:
        if ((b - a) // 2) % 2 == 0:
            ans -= 1
    else:
        if a % 2 == 1:
            if ((b - a + 1) // 2) % 2 == 0:
                ans -= 1
        else:
            if ((b - a - 1) // 2) % 2 == 0:
                ans -= 1

    print(ans)

main()

Measured memory_bytes: 61968
#include<stdio.h>
int main (void)
{
    int A,B;
    scanf("%d %d",&A,&B);
    if(A>=1 && A<=9 && B>=1 && B<=9){
    printf("%d",A*B);
	}
    else{
    printf("-1");
	}
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)
#define all(V) V.begin(), V.end()
using i64 = int_fast64_t;
using P = pair<int,int>;

class UnionFind{
private:
    using uint = std::uint_fast64_t;
    
    std::vector<uint> sizes;
    uint find(uint x){
        if(x == par[x]) return x;
        return par[x] = find(par[x]);
    }
public:
    std::vector<uint> par;
    UnionFind() = delete;
    UnionFind(uint size) : par(size), sizes(size, 1){
        for(uint i = 0; i < size; ++i) par[i] = i;
    }

    bool unite(uint x, uint y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        
        if(sizes[x] < sizes[y]) std::swap(x, y);
        if(sizes[x] == sizes[y] && x > y) std::swap(x, y);
        sizes[x] += sizes[y];
        sizes[y] = 0;
        par[y] = x;
        return true;
    }
    bool isSame(uint x, uint y ){ return find(par[x]) == find(par[y]);}
    uint getSize(uint x){return find(sizes[par[x]]);}
}; 

int main(){
    int N, M, W;
    cin >> N >> /*M >> */ W;
    vector<i64> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];
    M = 0;

    UnionFind group(N);
    rep(i,M){
        int a, b;
        cin >> a >> b; a--, b--;
        group.unite(a ,b);
    }
    vector<i64> nw(N, 0), nv(N, 0);
    rep(i,N){
        nw[group.par[i]] += w[i];
        nv[group.par[i]] += v[i];
    }

    vector<vector<i64>> dp(N+1, vector<i64>(W+1, 0));
    for(int i = 0; i < N; i++){
        for(int wei = 0; wei <= W; wei++){
            dp[i+1][wei] = max(dp[i+1][wei], dp[i][wei]);
            if(nw[i] == 0 || nv[i] == 0) continue;
            if(wei - nw[i] < 0) continue;
            dp[i+1][wei] = max(dp[i+1][wei], dp[i][wei - nw[i]] + nv[i]);
        }
    }

    i64 ans = -1;
    rep(i, N+1) rep(wei, W+1) ans = max(ans, dp[i][wei]);
    cout << ans << endl;
}


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

long gcd(long m, long n) {
  if (n == 0) return m;
  return gcd(n, m % n);
}

int main() {
  long a, b;
  cin >> a >> b;
  cout << a * b / gcd(a, b) << endl;
}


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

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

    int temp = N;
    int sum = 0;
    while (temp > 0)
    {
        sum += temp % 10;
        temp = temp / 10;
    }
    // printf("%d\n", sum);
    // printf("%d / %d = %d\n", N, sum, (N / sum));
    if (N % sum == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return (0);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.print(a * b);
		System.out.print(" ");
		System.out.println(a * 2 + b * 2);

	}

}


Measured memory_bytes: 26248
n=int(input())
l=[]
for i in range(n):
    x,u=list(input().split())
    l.append([x,u])
sum=0
for i in range(n):
    if l[i][1]=="JPY":
        sum+=int(l[i][0])
    else:
        sum+=float(l[i][0])*380000
print(sum)

Measured memory_bytes: 3316
class Fixnum
    def bijective_s(base=nil, offset=nil)
        offset ||= 'A'.ord #65
        base ||= 26
        value = self
        result = []
        while value > 0
            value -= 1
            result << (value%base+offset).chr
            value /= base
        end
        result.reverse.join
    end
end

n = gets.to_i
puts n.bijective_s.downcase


Measured memory_bytes: 14392
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=200005;
const int mod=998244353;
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
vector<int> nxt[MAXN];
void ins(int x,int y){nxt[x].emplace_back(y);}
int dis[MAXN],sta[MAXN],tp,n;
void dfs(int x,int fa){for(auto y:nxt[x])if(y^fa)dis[y]=dis[x]+1,dfs(y,x);}
bool getpath(int x,int fa,int ed)
{
	if(x==ed){sta[++tp]=x;return true;}
	for(auto y:nxt[x])if((y^fa)&&getpath(y,x,ed)){sta[++tp]=x;return true;}
	return false;
}
int f[MAXN][3];//存在几条不同子树与父亲差值没变且为mx的 
int trans[3];bool tag[MAXN];
void dp(int x,int fa)
{
	if(SZ(nxt[x])==1)
	{
		if(tag[x])f[x][1]=1,f[x][0]=2;
		else f[x][0]=3;return ;
	}f[x][0]=1;
	for(auto y:nxt[x])if(y^fa)dp(y,x);
	for(auto y:nxt[x])if(y^fa)
	{
		memset(trans,0,sizeof(trans));
		for(int i=0;i<3;i++)for(int j=0;j<3;j++)if(f[x][i]&&f[y][j])
			ad(trans[min(2,i+j)],1LL*f[x][i]*f[y][j]%mod);//+1
		for(int i=0;i<3;i++)f[x][i]=trans[i];
	}f[x][0]=(3LL*f[x][0]+2LL*(f[x][1]+f[x][2]))%mod;
}
int ans[3];
int main()
{
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	n=read();
	for(int i=1;i<n;i++)
	{
		int x=read(),y=read();
		ins(x,y);ins(y,x);
	}dfs(1,0);int p=0,q=0;for(int i=1;i<=n;i++)if(dis[i]>dis[p])p=i;
	dis[p]=0;dfs(p,0);for(int i=1;i<=n;i++)if(dis[i]>dis[q])q=i;
	getpath(p,0,q);
	if(tp&1)
	{
		int u=sta[tp/2+1];dis[u]=0;dfs(u,0);
		for(int i=1;i<=n;i++)if(dis[i]==tp/2)tag[i]=1;
		ans[0]=1;
		for(auto y:nxt[u])
		{
			dp(y,u);int x0=(f[y][0]-(f[y][1]+f[y][2])%mod+mod)%mod,x1=f[y][1];
			ans[2]=(1LL*ans[2]*x0+1LL*ans[1]*x1)%mod;
			ans[1]=(1LL*ans[1]*x0+1LL*ans[0]*x1)%mod;
			ans[0]=1LL*ans[0]*x0%mod;
		}pr2(ans[2]);
	}
	else
	{
		int u=sta[tp/2],v=sta[tp/2+1];dis[u]=dis[v]=0;dfs(u,v);dfs(v,u);
		for(int i=1;i<=n;i++)if(dis[i]==(tp-1)/2)tag[i]=1;
		dp(u,v);dp(v,u);pr2(1LL*f[u][1]*f[v][1]%mod);
	}
	return 0;
}


Measured memory_bytes: 19968
#include <iostream>
#include <string>
#include <sstream>
#include <climits>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;
int n;
int arr[] = {3, 5, 7};

long long dfs(long long num) {
//    cout << num << endl;
    if(num > n) {
        return 0;
    }
    long long temp = num;
    bool a = 0, b = 0, c = 0;
    while(temp > 0) {
        if(a && b && c) {
            break;
        }
        int val = temp % 10;
        temp /= 10;
        if(val == 3) {
            a = 1;
        }
        else if(val == 5) {
            b = 1;
        }
        else if(val == 7) {
            c = 1;
        }
    }
    long long ans = 0;
    if(a && b && c) {
        ans = 1;
    }
    for(int i = 0; i < 3; ++i) {
        ans += dfs(num * 10 + arr[i]);
    }
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    cin >> n;
    cout << dfs(0) << endl;

    return 0;
}


Measured memory_bytes: 3524
fun main(args: Array<String>) {
    fun getPrimeListByEratosthenes(maxValue: Int): BooleanArray {
        val isPrime = BooleanArray(maxValue + 1) { true }
        isPrime[0] = false
        isPrime[1] = false
        val root = Math.sqrt(maxValue.toDouble()).toInt() + 1
        for (i in 2..root) {
            if (isPrime[i]) {
                var j = i * 2
                while (j < maxValue) {
                    isPrime[j] = false
                    j += i
                }
            }
        }
        return isPrime
    }

    val q = readLine()!!.toInt()
    val maxValue = 100000
    val isPrime = getPrimeListByEratosthenes(maxValue)
    val spCount = IntArray(maxValue + 1) { 0 }
    (1..maxValue).forEach { spCount[it] = spCount[it - 1] + if (it % 2 == 1 && isPrime[it] && isPrime[(it + 1) / 2]) 1 else 0 }
    (1..q).forEach {
        val (l, r) = readLine()!!.split(' ').map(String::toInt)
        println(spCount[r] - spCount[l - 1])
    }
}

Measured memory_bytes: 56972
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>
#include <math.h>


int main()
{
    signed long n,mid_term,first_digit,i,k,j,count,final_Result,curr_num,temp,d=0;

    signed char max[6]={0};
    signed long result_forward[10][10]={0};
    final_Result = 0;
    scanf("%ld",&n);
    temp = n;
    while(temp != 0)
    { 
        max[d] = temp%10;
        temp = temp/10;
        d++;
        
    }
    
    if(d>=3)
    {
    
    mid_term = (n/10)%(signed long)(pow(10,(d-2)));
    }
    first_digit = n%10;

    for(i=0;i<10;i++)
    {
        for(j=1;j<10;j++)
        {
            k = 1;
            count = 0;
        while(k<d )
        {
 
            if(k<d-1)
            {
                
                count = count + pow(10,k-1);

            }
            else if(k==d-1)
            {

                curr_num = i+j*(signed long)(pow(10,k));
                if(j<max[k] && curr_num<=n)
                {
                    count = count + pow(10,k-1);

                }
                else if(j==max[k] && d>2 && curr_num<=n)
                {

                    if(i<=first_digit)
                    {
                        
                        count = count + mid_term + 1;
                    }else
                    {
                        count = count + mid_term;
                    }

                }
                else if(j==max[k] && d==2 && curr_num<=n)
                {
                    count++;
                }
            }
            
            k++;
        }
            result_forward[i][j] = count;

        }
    }
    
    for(i=1;i<10;i++)
    {
        result_forward[i][i]++;
    }
    for(i=1;i<10;i++)
    {
        for(j=1;j<10;j++)
        {
 
            {
            final_Result = final_Result + result_forward[i][j]*result_forward[j][i];
            }
           

        }
    }
    
    if(n<10)
    {
        printf("%ld",n);
    }
    else
    printf("%ld",final_Result);
    return 0;
}

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

int main(void){
    long n, k;
    cin >> n >> k;
    long ret = 0;
    for(long b=k+1; b<=n; b++){
        long c = n/b;
        if(k==0){
            ret--;
        }
        ret += c*(b-k);
        long t = n-(c*b+k-1);
        ret += t>0 ? t : 0;
        //printf("%ld %ld\n", b, ret);
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import copy


def input():
    return sys.stdin.readline()[:-1]


def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    a2 = copy.copy(a)
    a2.sort()
    m = a2[len(a)-1]
    m2 = a2[len(a)-2]

    for i in a:
        if i != m:
            print(m)
        else:
            print(m2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61152
#include <stdio.h>

int main(void)
{
    int H;
    int board[10][5];
    int score;
    int n, m;
    int flag;
    int i, j, k, l;

    while (1){
        scanf("%d", &H);
        if (H == 0){
            break;
        }
        for (i = 0; i < H; i++){
            for (j = 0; j < 5; j++){
                scanf("%d", &board[i][j]);
            }
        }
        
        score = 0;
        
        do {
            flag = 0;
            
            for (i = 0; i < H; i++){
                n = 0;
                m = board[i][2];
                if (m == 0){
                    continue;
                }
                for (j = 0; j < 5; j++){
                    if (board[i][j] == m){
                        n++;
                    }
                }
                if (n == 3){
                    if (board[i][1] != m && board[i][3] != m){
                        continue;
                    }
                    if (board[i][1] != m && board[i][4] != m){
                        continue;
                    }
                    if (board[i][0] != m && board[i][3] != m){
                        continue;
                    }
                }
                    
                if (n >= 3){
                    if (n == 4 && (m != board[i][1] || m != board[i][3])){
                        n = 3;
                        if (m == board[i][1]){
                            board[i][0] = board[i][1] = board[i][2] = 0;
                        }
                        else {
                            board[i][2] = board[i][3] = board[i][4] = 0;
                        }
                    }
                    else {
                        for (j = 0; j < 5; j++){
                            if (board[i][j] == m){
                                board[i][j] = 0;
                            }
                        }
                    }
                    score += (m * n);
                    flag = 1;
                }
            }
#if 0
printf("↓↓↓↓↓↓↓\n");
for (i = 0; i < H; i++){
    for (j = 0; j < 5; j++){
        printf("%d ", board[i][j]);
    }
    printf("\n");
}
#endif
            if (flag == 1){
                for (i = H - 1; i >= 0; i--){
                    for (j = 0; j < 5; j++){
                        if (board[i][j] == 0){
                            for (k = i - 1; k >= 0; k--){
                                if (board[k][j] != 0){
                                    board[i][j] = board[k][j];
                                    board[k][j] = 0;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
#if 0            
printf("*************\n");
for (i = 0; i < H; i++){
    for (j = 0; j < 5; j++){
        printf("%d ", board[i][j]);
    }
    printf("\n");
}
#endif
        } while (flag == 1);
        
        printf("%d\n", score);
    }
    
    return (0);
}



Measured memory_bytes: 2056
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
from itertools import combinations_with_replacement
N,M,Q=MI()
A=[]
B=[]
C=[]
D=[]
ans=0
for i in range(Q):
  a,b,c,d=MI()
  a-=1
  b-=1
  A.append(a)
  B.append(b)
  C.append(c)
  D.append(d)
#print(A,B,C,D)
Num=list(range(1,M+1))
#print(Num)
#print(list(combinations(Num,N)))
for j in list(combinations_with_replacement(Num,N)):
  tmp=0
  for i in range(Q):
    if j[B[i]]-j[A[i]]==C[i]:
      tmp+=D[i]
  ans=max(ans,tmp)  
print(ans)

Measured memory_bytes: 21616
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if(a < b && b < c ) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


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

#define int 				long long int
#define all(c)				c.begin(), c.end()
#define init(arr, num)		memset(arr, num, sizeof(arr))
#define fast				ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inputFile			freopen("input.txt", "r", stdin); 
#define outputFile			freopen("output.txt", "w", stdout);
#define modM 				1000000007


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


void solve() 
{ 


	int n;
	cin >> n;

	int a[n], b[n];
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];

	sort(a, a+n), sort(b, b+n);
	int y, z;
	if(n&1){
		y = a[n/2];
		z = b[n/2];
	}else{
		y = a[n/2] + a[n/2-1];
		z = b[n/2] + b[n/2-1];
		// trace(y,z);
	}

	cout << z-y+1;


	

} 
 
 
signed main()
{
 
	
	#ifdef _DEBUG
		inputFile;
	#endif
	fast;
	int T = 1;
	// cin >> T;
	while(T--)
	{
		solve();
		cout << endl;
	}
	
	
	return 0;
 
}


  

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

int n;
set<int> s;

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int x,y;
    scanf("%d %d",&x,&y);
    
    int z=x+y;
    while(s.count(z)>0){
      s.erase(z);
      z++;
    }
    s.insert(z);
  }
  set<int> :: iterator it;
  for(it=s.begin();it!=s.end();it++)
    cout<< *it <<' '<<0<<endl;
  return 0;
}

Measured memory_bytes: 6168
using System;

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;

    private string[] S;
    private int Index;
    private const char Separator = ' ';

    public Scanner(Stream source)
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(source);
    }

    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }

    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public decimal NextDecimal()
    {
        return decimal.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private Scanner Cin;
    private long N, M;

    private void Scan()
    {
        Cin = new Scanner(Console.OpenStandardInput());
        N = Cin.NextLong();
        M = Cin.NextLong();
    }
    public void Solve()
    {
        Scan();
        long ans = 0;
        ans += Math.Min(N, M/2);
        N -= ans;
        M -= ans*2;
        ans += M / 4;
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
fun main() {
    println(nextInt() * nextInt())
}

val sc = java.util.Scanner(System.`in`)
fun next(): String = sc.next()
fun nextInt() = sc.nextInt()
fun next2Int() = Pair(nextInt(), nextInt())
fun next3Int() = Triple(nextInt(), nextInt(), nextInt())
fun nextIntArray(size: Int) = IntArray(size) { nextInt() }
fun nextLong() = sc.nextLong()
fun nextLine(): String = sc.nextLine()
fun nextList() = nextLine().split(" ")
fun printYesNo(isYes: Boolean) = println(if (isYes) "Yes" else "No")
fun printString(action: StringBuilder.() -> Unit) = println(buildString(action))

Measured memory_bytes: 36212
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	long long n = s.length(), i, j, k, MOD = 1000000007, a, b, x;
	vector<vector<long long>> dp(n + 1, vector<long long>(13, 0));
	dp[0][0] = 1;
	for (i = 0; i < n; i++) {
		for (j = 0; j < 13; j++) {
			if (s[i] == '?') a = 0, b = 9;
			else a = s[i] - '0', b = a;

			for (k = a; k <= b; k++) {
				x = (k + j * 10) % 13;
				dp[i + 1][x] = (dp[i + 1][x] + dp[i][j]) % MOD;
			}
		}
	}

	cout << dp[n][5] << "\n";

	return 0;
}


Measured memory_bytes: 13632
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string s;
    cin >> s;
    int n = s.size();
    vvi dp(n+1,vi(2,0));
    dp[0][0] = 1;
    rep(i,n){
        if(s[i] == '1'){
            (dp[i+1][1] += dp[i][1]*3) %= MOD;
            (dp[i+1][1] += dp[i][0]) %= MOD;
            (dp[i+1][0] += dp[i][0]*2) %= MOD;
        }else{
            (dp[i+1][1] += dp[i][1]*3) %= MOD;
            (dp[i+1][0] += dp[i][0]) %= MOD;
        }
    }
    int ans = dp[n][0] + dp[n][1];
    cout << ans % MOD << endl;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

class UF
{
private:
    int         num;
    vector<int> par;
    vector<int> siz;
public:
    //vector<int> val;
public:
    UF(int n): num(n) {
        par.resize(n);
        siz.resize(n);
        //val.resize(n);
        int i;
        for(i=0; i<n; i++) {
            par[i]=i; siz[i]=1;
            //val[i]=0;
        }
    }
	
    int find(int x) {
        if(x==par[x]) return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(siz[x]<siz[y]) {
            par[x]=y;
            siz[y]=siz[x]+siz[y];
            //val[y]=val[x]+val[y];
        }
        else {
            par[y]=x;
            siz[x]=siz[x]+siz[y];
            //val[x]=val[x]+val[y];
        }
    }

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

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

    int ngroup() {
    //int ngroup( int& ans ) {
        int count=0;
        int i;
        for(i=0; i<num; i++) {
            if(par[i]==i) {
                count++;
                //ans += (val[i]? siz[i]: siz[i]-1);
            }
        }
        return count;
    }
};

void solve()
{
    int n,m,K;
    scanf("%d%d%d", &n, &m, &K);
    vector<vector<int> > g(n);
    UF uf(n);
    int i;
    for(i=0; i<m; i++) {
        int a,b;
        scanf("%d%d", &a, &b); a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
        uf.unite(a,b);
    }
    for(i=0; i<K; i++) {
        int a,b;
        scanf("%d%d", &a, &b); a--; b--;
        g[a].push_back(b);
        g[b].push_back(a); 
    }
    vector<int> cnt(n);
    for(i=0; i<n; i++) {
        int par=uf.find(i);
        cnt[par]++;
    }
    for(i=0; i<n; i++) {
        int par=uf.find(i);
        int j;
        int ans=cnt[par];
        for(j=0; j<(int)g[i].size(); j++) {
            int k=g[i][j];
            if(uf.same(i,k)) {
                ans--;
            }
        }
        ans--;
        printf("%d", ans);
        if(i<n-1) printf(" ");
    }
    printf("\n");

    return;
}


int main(int argc, char* argv[])
{
#if 1
	solve();
#else
	int T; scanf("%d", &T);
	while (T--) {
		solve();
	}
#endif
	return 0;
}


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

int main() {
    int N=0,minind,mini=1000000001;
    cin >> N;
    vector<int> life(N);
    for(int i=0; i<N; i++){
        cin >> life[i];
        if(life[i] < mini){
            mini = life[i];
            minind = i;
        }
    }

    while(1){
        for(int i=0; i<N; i++){
            if(i == minind)continue;
            life[i] %= mini;
        }
        int count = 0,premin = life[minind];
        for(int i=0; i<N; i++){
            if(life[i] != 0)count += 1;
            if(life[i] < mini && life[i] > 0){
                mini = life[i];
                minind = i;
            }
        }
        if(count == 1){
            cout << premin << endl;
            break;
        }
    }
    return 0;
}

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

int a[10] = {2,2,1,3,1,1,2,1,2,1};

int main()
{
	int n;
	cin >> n;
	if(a[n%10]==1)
	{
		cout<<"hon"<<endl;
	}
	else if(a[n%10]==2)
	{
		cout<<"pon"<<endl;
	}
	else
	{
		cout<<"bon"<<endl;
	}
}

Measured memory_bytes: 3640
/**
*    author:  y_takano
*    created: 19.06.2020 09:04:22
**/

#include <bits/stdc++.h>

using namespace std;

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

    int h, w;

    for (;;)
    {

        cin >> h >> w;

        if (h != 0 || w != 0)
        {
            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (i == 0 || i == h - 1 || j == 0 || j == w - 1)
                    {
                        cout << '#';
                    }
                    else
                    {
                        cout << '.';
                    }
                }
                cout << endl;
            }
            cout << endl;
        }
        else
        {
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3152
def f(target):
    total = 0
    for item in recipe[target]:
        if item in recipe:
            total += f(item)
        else:
            total += lis[item]
    else:
        if lis[target] < total:
            total = lis[target]
        return total

while True:
    N = int(raw_input())
    if N == 0: break
    lis = {}
    for n in range(N):
        i, p = raw_input().split()
        lis[i] = int(p)
    recipe = {}
    for m in range(int(raw_input())):
        line = raw_input().split()
        recipe[line[0]] = line[2:]
    target = raw_input()
    print f(target) if target in recipe else lis[target]

Measured memory_bytes: 4236
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X;
  int N;
  int flag=0;
  int min=105;
  int minnum=0;
  cin >> X;
  cin >> N;
  vector<int> p(N);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
  }
  for(int i=-1;i<=101;i++){
    flag=0;
    for(int j=0;j<N;j++){
      if(p.at(j)==i)flag=1;
    }
    if(flag==1)continue;
    if(abs(X-i)<min) {
      min=abs(X-i);
      minnum=i;
    }
  }
  cout << minnum << endl;
}

Measured memory_bytes: 3628
while True:
	n = int(raw_input())
	if n == 0: break
	m = int(raw_input())
	s = [map(int, raw_input().split(",")) for i in range(m)]
	s = sorted(s, key=lambda x:x[2])
	ls = range(n)
	ref = ls[:]
	ans = 0
	while s:
	    x,y,d = s.pop(0)
	    a,b = ref[x],ref[y]
	    if a != b:
	        for j in ls:
	            if ref[j] == a: ref[j] = b
	        ans += d/100 - 1
	print ans 

Measured memory_bytes: 5000
#include <stdio.h>
int book[10];

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    book[a]++;
    book[b]++;
    book[c]++;
    if(book[5]==2 && book[7]==1){
        printf("YES\n");
    }
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

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

int main(void){
    int N,M;
    cin>>N>>M;
    priority_queue<long long> A;
    rep(i,N){
        long long temp;
        cin>>temp;
        A.push(temp);
    }

    rep(i,M){
        long long a;
        a=A.top()/2;
        A.pop();
        A.push(a);
    }

    long long ans=0;
    while(!A.empty()){
        ans+=A.top();
        A.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>

using namespace std ;
#define ref(i,n) for(int i =0;i<n;i++)
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ab,ac,bc;
    ab = abs(a-b);
    ac = abs(a-c);
    bc = abs(b-c);
    if((ab <= d && bc <= d) or (ac <= d))
    	cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3604