akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    double a, b;
    cin >> a >> b;
    printf("%.10lf\n", a / b);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;

int main()
{
	int N, K;

	while(cin>>N>>K && (N || K)){
		vector<int> line;
		bool flag = false;

		for(int i = 0; i < K; i++){
			int buf;
			cin>>buf;
			if(buf)	line.push_back(buf);
			else	flag = true;
		}
		sort(line.begin(), line.end());

		int res = 0;
		for(int i = 0; i < line.size(); i++){
			int len = 1;
			for(int j = i+1; j < line.size() && line[j]-1 == line[j-1]; j++) len++;
			i += len;
			if(flag){
				if(i > 0 && i < line.size() && line[i-1] +2 == line[i]){
					int l = 1;
					for(int j = i+1; j < line.size() && line[j]-1 == line[j-1]; j++) l++;
					len += l+1;
				}else{
					len++;
				}
				i--;
			}
			res = max(res, len);
		}
		cout<<res<<endl;
	}
}

Measured memory_bytes: 0
n, m, l = list(map(int, input().split()))

#a = [0]*n
#b = [0]*m
#c = [[0 for col in range(l)] for row in range(n)]

#for i in range(n):
#    a[i] = list(map(int,input().split()))
#for i in range(m):
#    b[i] = list(map(int,input().split()))

a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for i in range(m)]

#for i in range(n):
#    for j in range(l):
#        for k in range(m):
#            c[i][j] += a[i][k]*b[k][j]
for i in range(n):
    print(*[sum([a[i][k]*b[k][j] for k in range(m)]) for j in range(l)])

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

int main() {
    int N;
    while (cin >> N, N) {
        vector<int> v(N);
        for (auto& i : v) cin >> i;

        vector<vector<int>> dp(N+1, vector<int>(N));
        for (int i = 0; i < N; i++) {
            if (abs(v[i] - v[i+1]) < 2) {
                dp[2][i] = 1;
            }
        }
        for (int i = 4; i <= N; i += 2) {
            for (int j = 0; j + i <= N; j++) {
                if (dp[i-2][j+1] && abs(v[j] - v[j + i - 1]) < 2) {
                    dp[i][j] = 1;
                } else {
                    vector<int> flag(i+1);
                    for (int k = 2; j + k < j + i; k += 2) {
                        if (dp[k][j] && dp[i - k][j + k]) {
                            dp[i][j] = 1;
                        }
                    }
                }
            }
        }

        vector<int> sum(N+1);
        for (int i = 0; i < N; i++) {
            if (i) sum[i] = max(sum[i], sum[i-1]);
            for (int j = 2; j <= N; j += 2) {
                if (dp[j][i]) {
                    sum[i+j] = max(sum[i+j], sum[i] + j);
                }
            }
        }

        cout << max(sum[N-1], sum[N]) << endl;
    }

    return 0;
}

Measured memory_bytes: 3240
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  double N,M,D;
  cin>>N>>M>>D;
  double ans=1;
  double X=max(0.0,N-D*2);
  cout<<setprecision(10);
  if(D==0) cout<<X*(M-1)/(N*N)<<endl;
  else cout<<(2*X+N-X)*(M-1)/(N*N)<<endl;
}

Measured memory_bytes: 256
def myAnswer(N:int,H:list) -> str:
   pre = H.pop(0) - 1
   for h in H:
      if(pre < h):
         pre = h - 1
      elif(pre > h):
         return "No"
      else:
         pre = h
   return "Yes"


def modelAnswer():
   tmp=1
def main():
   N = int(input())
   H = list(map(int,input().split()))
   print(myAnswer(N,H[:]))
if __name__ == '__main__':
   main()



Measured memory_bytes: 14396
//============================================================================
// 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 main() {
	cin>>N;

	if(N/10==9 || N%10==9)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s; cin >> s;
	for (int i = 0; i < s.length() - 8; i++) cout << s[i];
	return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int n;
    cin>>n;
    int d;
    vector<int> dd;
    rep(i,n){
        cin>>d;
        dd.pb(d);
    }
    sort(dd.begin(),dd.end());
    int mid=n/2-1;
    int ans=0;
    if(dd[mid]==dd[mid+1]){
        cout<<0<<endl;

    }
    else{
        ans=dd[mid+1]-dd[mid];
        cout<<ans<<endl;
    }
    
    return 0;
}

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

int main() {
int n;
cin>>n;
vector<int> s(n);
int a=0;
int b=0;
int x=0;
int y=0;
int minn =1000;
for(int i=0;i<n;i++){
  cin>>s[i];
  y+=s[i];
  if(s[i]%10==0){
    a++;
  }
  else if(s[i]%10!=0){
    b++;
    x+=s[i];
    minn=min(minn,s[i]);
  }
}
if(a==n){
  cout<<0<<endl;
}
else if(b==n){
  cout<<x<<endl;
}else if(y%10!=0){
  cout<<y<<endl;
}
else{
  cout<<y-minn<<endl;
}

  return 0;
}



Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func f(n int, l float64, price map[float64]int) int {
	t := int(float64(n) / l)
	if l == 0.25 {
		return t * price[l]
	}
	return min(f(n-int(l*float64(t)), l/2, price)+t*price[l], f(n, l/2, price))
}

func main() {
	var Q, H, S, D int
	fmt.Scan(&Q, &H, &S, &D)
	var N int
	fmt.Scan(&N)
	price := map[float64]int{0.25: Q, 0.5: H, 1.0: S, 2.0: D}
	fmt.Println(f(N, 2.0, price))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5+5, M = 1e4+5, OO = 0x3f3f3f3f;
typedef  long long LL;
typedef  long double LD;
#define PI 3.14159265358979323846
#define INF LONG_MAX
const int  MOD = 1e9+7;
int main()
{
    int n; cin>>n;
    bool b=0;
    while(n>0){
        int x = n%10;
        if (x==7) {b=1;break;}
        n/=10;
    }
    cout<<(b ?"Yes\n" : "No\n");
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
string s;
ll n,m,r,c,t;
int main(){
	long long n,r;
	cin>>n>>r;
	int sum=0;
	while(n>0){
		n=n/r;
		sum++;
	}
	cout<<sum;
	return 0;
}



Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//223
	int a,b;
	cin>>a>>b;
	cout<<max(a+b,max(a-b,a*b));
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

bool isGood(int n) {
    ostringstream str1; 
    str1 << n; 
	string str = str1.str();
	if((str.at(0) == str.at(1) && str.at(1) == str.at(2)) || (str.at(1) == str.at(2) && str.at(2) == str.at(3))) {
		return true;
	}
	
	return false;
}

int main() {
	int n;
	cin >> n;
	bool good = isGood(n);
	if (good) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10 ** 6)


def main():
	h, w = map(int, sys.stdin.readline().split())
	s = [list(sys.stdin.readline().rstrip())[::-1] for i in [0]*h][::-1]
	cost = [[0]*w for i in [0]*h]
	for y in range(h):
		for x in range(w):
			if y == 0 and x == 0:
				if s[y][x] == "#":
					cost[y][x] = 1
			elif y == 0:
				if s[y][x] == "#" and s[y][x-1] != "#":
					cost[y][x] = cost[y][x-1] + 1
				else:
					cost[y][x] = cost[y][x-1]
			elif x == 0:
				if s[y][x] == "#" and s[y-1][x] != "#":
					cost[y][x] = cost[y-1][x] + 1
				else:
					cost[y][x] = cost[y-1][x]
			else:
				if s[y][x] == "#" and s[y-1][x] != "#":
					cost[y][x] = cost[y-1][x] + 1
				else:
					cost[y][x] = cost[y-1][x]
				if s[y][x] == "#" and s[y][x-1] != "#":
					cost[y][x] = min(cost[y][x], cost[y][x-1] + 1)
				else:
					cost[y][x] = min(cost[y][x], cost[y][x-1])
	print(cost[h-1][w-1])

main()

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

int main()
{
    int n;
    cin >> n;
    vector<float> a(n);
    int i;
    float sum = 0;
    for(i = 0;i < n;++i){
        cin >> a.at(i);
        sum += 1/a.at(i);
    }
    cout << 1/sum << endl;
    return 0;
}

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

using namespace std;
int p[110], c[110], n;
int dp[11][1101];

int f(int pos, int prob){
    if(pos > n) return 0;
    if(prob == 0)   return 0;
    if(dp[pos][prob] != -1) return dp[pos][prob];

    for(int i = 0; i <= p[pos] && i <= prob; ++i)
        dp[pos][prob] = max(dp[pos][prob], f(pos + 1, prob - i) + 100*pos*i + (i == p[pos])*c[pos]);
    return dp[pos][prob];
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int g, ans = 0, sum = 0;
    cin >> n >> g;
    memset(dp, -1, sizeof dp);
    for(int i = 1; i <= n; ++i)  cin >> p[i] >> c[i], sum += p[i];
    for(int i = 1; i <= sum; ++i)   f(1, i);
    for(int i = 1; i <= sum; ++i){
        for(int j = 1; j <= n; ++j)
            if(dp[j][i] >= g){
                cout << i << "\n";
                return 0;
            }
    }

    return 0;
}

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

int main() {
  string S; cin >> S;
  if (S == "Sunny") cout << "Cloudy" << endl;
  else if (S == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  return 0;
}

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

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

    // 「1 の個数」「0 の個数」を交互に記録していく
    vector<int> nums;    
    if (S[0] == '0') nums.push_back(0); // 先頭が 0 だったら
    for (int i = 0; i < S.size();) {
        int j = i;
        while (j < S.size() && S[j] == S[i]) ++j; // S[i] の数値がどこまで続くか
        nums.push_back(j - i);
        i = j;
    }
    if (S.back() == '0') nums.push_back(0);

    // 累積和
    vector<int> sums((int)nums.size() + 1, 0);
    for (int i = 0; i < nums.size(); ++i) sums[i+1] = sums[i] + nums[i];

    // 偶数番目の添字から始まる、長さ 2K+1 の区間の総和のうち、最大値を求める
    int res = 0;
    for (int left = 0; left < sums.size(); left += 2) {
        int right = left + K*2+1;
        if (right >= sums.size()) right = (int)sums.size() - 1;
        res = max(res, sums[right] - sums[left]);
    }
    cout << res << endl;
}


Measured memory_bytes: 1272
program main
  implicit none
  integer :: N
  integer,allocatable :: A(:)
  integer :: Amin, i_loop,Amin_bf
  integer :: i,j,k
  read(*,*) N
  allocate( A(N) )
  read(*,*) A
  Amin = minval(A)
  where ( mod(A,Amin) == 0 )   A = Amin
  A = mod(A,Amin)
  ! calc mod
  do 
     where(A > Amin ) A = A-Amin
     where ( mod(A,Amin) == 0 )   A = Amin
     if ( any(A < Amin ) ) then
        Amin = minval(A,A>0)
     end if
     if ( count(A > 0 ) == 1 .or. all( A == Amin ) ) exit
  end do
  write(*,'(i0)') minval(A,A >0 )
  deallocate(A)
  stop
contains
  recursive function iqsort(ix) result(ires)
        integer, allocatable :: ires(:)
        integer, intent(in)  :: ix(:)
        integer :: k
        if (size(ix) <= 1) then 
          ires = ix
        else  
          k = ix(size(ix) / 2)
          ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
        end if
      end function iqsort  
end program main


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define M1 1000000007
#define M2 998244353

#define fl(i,a,b)  for(ll i=a;i<b;i++)
#define ifl(i,a,b) for(ll i=b-1;i>=a;i--)
#define f(i,n)     for(int i=0;i<n;i++)
#define bf(i,n)    for(int i=n-1;i>=0;i++)


#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define bn "\n"

//------------------------------------------------------------------------ 
// #define V(a) vector<a>
// #define vt() vector< tuple < int ,int ,int > > ;
// #define vector< int ,int > pv;
// vector< pair <int,int> > vect;


//------------------------------------------------------------------------

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

//---------------------------------------------------------------------------

// variable = Expression1 ? Expression2 : Expression3
// max = (n1 > n2) ? n1 : n2; 
// (n>m) ? cout<<"True"<<endl:cout<<"false"<<endl ;

// ---------------------------------------------------------------------------	

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

//----------------------------------------------------------------------------

// vector< tuple < int ,int ,int > > tv;
// vector< int ,int > pv;


//----------------------------------------------------------------------------


int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int tt=1;
   // cin>>tt;
	while(tt--)
	{
	    set<string > s1;
	    int n;
	    cin>>n;
	    
	    for(int i=0;i<n;i++)
	    {
	        string s;
	        cin>>s;
	        s1.insert(s);
	    }
	   cout<<s1.size()<<bn;
	   
	   
	    
	}
	
	return 0;
}


Measured memory_bytes: 19292
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string S;
    cin >> S;
    set<char> chars;
    REP(i, S.length()) { chars.insert(S[i]); }
    if(chars.size() == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll res = 100;
    ll times;
    // https://pyteyon.hatenablog.com/entry/2019/02/27/200000
    for(auto key = chars.begin(); key != chars.end(); ++key) {
        // prepare simulation
        string str = S;
        bool flag = true;
        times = 1;
        while(flag) {
            string vacant;
            flag = false;
            REP(i, str.length() - 1) {
                if(str[i] == *key or str[i + 1] == *key) {
                    vacant += *key;
                } else {
                    vacant += str[i];
                    flag = true;
                }
            }
            if(flag) {
                //まだ終了していない
                str = vacant;
                times++;
            }
        }
        res = min(res, times);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if(a-b >= 0) print("delicious");
  else if(a+x-b>=0) print("safe");
  else print("dangerous");
}


Measured memory_bytes: 888
import bisect
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    for j in range(i+1, N):
        t = L[i] + L[j]
        idx = bisect.bisect_left(L, t)
        ans += max(0, idx-j-1)
print(ans)

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

int main(){
	set<int> s{1,2,4,8,16,32,64};
	int n;
	cin >> n;
	
	while (n){
		if (s.count(n)){
			cout << n;
			break;
		}
		n--;
	}
}


Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;



int main(){
    string s;cin>>s;
    int sta=0,cn=0;
    if(s.at(0)=='B')sta=1;
    
    rep(i,1,s.size()){
        if(s.at(i)=='B'&&sta==0){
            cn++;
            sta=1;
        }
        else if(s.at(i)=='W'&&sta==1){
            cn++;
            sta=0;
        }
    }
    cout<<cn<<endl;
}






Measured memory_bytes: 512
// EbTech's Rust template. Thanks EbTech!
#![allow(unused_imports)]
use std::cmp::{max, min, Reverse};
use std::collections::{HashMap, HashSet};
use std::io::{self, prelude::*};
use std::str;

/*
5 2
5 -4 4 3 -5
4 3
3 -1

5 -4 4 3 -5 -> 8
5 -4 4 3 3  -> 11
5 -4 4 -1 3 -> 7
*/

struct Scanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: str::SplitWhitespace<'static>,
}
impl<R: BufRead> Scanner<R> {
    fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_whitespace(),
        }
    }
    fn next<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_whitespace())
            }
        }
    }
}

fn solve<R: BufRead, W: Write>(scan: &mut Scanner<R>, w: &mut W) {
    let n: usize = scan.next();
    let m: usize = scan.next();
    let mut al = vec!(vec!();n);
    for _ in 0..m {
        let u: usize = scan.next();
        let v: usize = scan.next();
        al[u-1].push(v-1);
        al[v-1].push(u-1);
    }
    fn dfs (u: usize, al: & Vec<Vec<usize>>, vis: &mut Vec<bool>) -> usize {
        let mut count = 1;
        if vis[u] {
            return 0;
        }
        vis[u] = true;
        for v in &al[u] {
            count += dfs (*v, al, vis);
        }
        count
    }
    let mut vis = vec![false;n];
    let mut res = 0;
    for i in 0..n {
        if vis[i] {
            continue}
        res = max(res, dfs (i, &al, &mut vis));
    }
    writeln!(w, "{}", res);
}

fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());
    // let t: u64 = scan.next();
    let t = 1;
    for _ in 0..t {
        solve(&mut scan, &mut out);
    }
}


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

#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 300300;
const long long mod = 1e9 + 7;

using namespace std;

int n;
int c[200];
int d[200];

void solve()
{
        cin >> n;
        for(char i = 'a'; i <= 'z'; i++) d[i] = 1e9;
        for(int i = 0; i < n; i++){
                string s;
                cin >> s;
                for(int j = 0; j < s.size(); j++) c[s[j]]++;
                for(char j = 'a'; j <= 'z'; j++){
                        d[j] = min(d[j], c[j]);
                        c[j] = 0;
                }
        }
        for(char i = 'a'; i <= 'z'; i++){
                for(int j = 0; j < d[i]; j++) cout << i;
        }
        cout << "\n";
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("landscape.in");
        //fout("landscape.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int ans = 0;
    while(N) {
        N /= K;
        ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
/*
时间:2020-7-29
书籍：算法和数据结构
内容：线性搜索
页数：P91
*/
#include<iostream>
using namespace std;
bool LinerSearch(int *S,int length,int n)                  //数组S的实际长度是n+1，其中最后一位为标志位，带有标志的线性搜索
{
	S[length] = n;
	int i = 0;
	while (S[i] != n)
	{
		++i;
	}
	if (i == length)
		return false;
	else
		return true;
}
int main()
{
	int n;
	cin >> n;
	int* S = new int[n+1];
	for (int i = 0; i < n; ++i)
		cin >> S[i];
	int q;
	cin >> q;
	int* T = new int[q];
	for (int i = 0; i < q; ++i)
		cin >> T[i];
	int count = 0;
	for (int i = 0; i < q; ++i)
	{
		if (LinerSearch(S, n, T[i]))
			++count;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3108
L, R = map(int, input().split())
intnumber = []
for i in range(L, min(R+1, L+2019)):
    intnumber.append(i%2019)

intnumber.sort()
ans = 2019
for i in range(len(intnumber)):
    for j in range(i+1, len(intnumber)):
        ans = min(ans, (intnumber[i]*intnumber[j])%2019)

print(ans)


Measured memory_bytes: 40812
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var H = sc.ArrayInt(N);
        var min = H[N - 1];
        for (int i = N-2; i >= 0; i--) {
            if (min < H[i]) {
                H[i]--;
                if (min < H[i]) {
                    WriteLine("No");
                    return;
                }
            }
            min = H[i];
        }
        WriteLine("Yes");
    }
    
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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


Measured memory_bytes: 27104
#include <stdio.h>


int main(){
	int n, x, y=0, aux, cont=0, sum=0;
	scanf("%i %i", &n, &x);
	aux=n;
	while(aux--){
		scanf("%i", &y);
		sum+=y;
		if(sum<=x)
			cont++;
		
	}
	if(cont!=0)
		printf("%i\n", cont+1);
	else
		printf("%i\n", cont);
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

class Node<T>
{
    private int Height { get; set; }
    private Node<T> Parent { get; set; }
    private long size;
    public long Size { get { return Find().size; } set { size = value; } }
    public T Item { get; }

    public Node(T item)
    {
        Height = 0;
        Parent = this;
        Item = item;
        Size = 1;
    }

    public Node<T> Find()
    {
        if (Parent == this)
        {
            return this;
        }
        var p = Parent.Find();
        Parent = p;
        return p;
    }

    public static void Unite(Node<T> a, Node<T> b)
    {
        var p = a.Find();
        var q = b.Find();
        if (p.Height < q.Height)
        {
            p.Parent = q;
            q.Height = Math.Max(p.Height + 1, q.Height);
            q.Size += p.Size;
            p.Size = 0;
        }
        else
        {
            q.Parent = p;
            p.Height = Math.Max(q.Height + 1, p.Height);
            p.Size += q.Size;
            q.Size = 0;
        }
    }

    public static bool Same(Node<T> a, Node<T> b)
    {
        return a.Find().Item.Equals(b.Find().Item);
    }
}

class MyClass
{
    public static void Solve()
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = input[0];
        var S = input[1];
        var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var sum = A[0];
        var l = 0;
        var r = 0;
        var min = int.MaxValue;
        while (l < N && r < N)
        {
            if (sum >= S)
            {
                min = Math.Min(min, r - l + 1);
            }
            if (sum >= S && l < r)
            {
                sum -= A[l];
                l++;
            }
            else
            {
                r++;
                if (r < N)
                {
                    sum += A[r];
                }
            }
        }
        Console.WriteLine(min == int.MaxValue ? 0 : min);
    }

    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}



Measured memory_bytes: 23980
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer stk = new StringTokenizer(br.readLine());
		long x = Long.parseLong(stk.nextToken());
		long y = Long.parseLong(stk.nextToken());
		long rta = 0;
		if(x < 0){
			if(y<0){
				if(x<y){
					System.out.println(Math.abs((y*-1) -(x*-1)));
				}else{
					System.out.println(Math.abs((y*-1) -(x*-1))+2);
				}
			}else{
				if(x*-1<y){
					System.out.println(Math.abs((y) -(x*-1))+1);
				}else if(x*-1==y){
					System.out.println(1);
				}else{
					if(y==0) System.out.println(x*-1);
					else System.out.println(Math.abs((x*-1) -(y))+1);
				}
			}
		}else{
			if(y<0){
				if(x<y*-1){
					System.out.println(Math.abs((y*-1) -(x))+1);
				}else if(x==y*-1){
					System.out.println(1);
				}else{
					System.out.println(Math.abs(x-(y*-1))+1);
				}
			}else{
				if(x>y){
					if(y==0) System.out.println(x+1);  
					else System.out.println(Math.abs((y)-(x))+2);
				}else{
					System.out.println(Math.abs((y)-(x)));
				}
			}
		}
		/*if(x > y){
			if(x < 0 && y < 0)
				rta+=1;
			rta += Math.abs(Math.abs(x) - Math.abs(y));
			rta+=1;
		}
		else if(x < y){
			if(x < 0 && y > 0)
				rta+=1;
			if(x <0 && Math.abs(x) > Math.abs(y))
				rta+=1;
			rta += Math.abs(Math.abs(x) - Math.abs(y));
		}
		if(x == 0 || y == 0)
			rta = Math.abs(Math.abs(x) - Math.abs(y));
		System.out.println(rta);*/
	}

}


Measured memory_bytes: 21204
#include "bits/stdc++.h"
 
using namespace std;

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b;
	int sum;
	string str;
	string s,t;
	char c;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 

	//cin >> n >> m;
	//cin >> a >> b;
	cin >> a >> b >> m;
	//cin >> str;
	//cin >> n;
	
	//cin >> s >> t;
	//cin >> c;

	cout << (a+b)*m/2 << endl;

	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int R = stdIn.nextInt();
        double pie = 3.141952;
        double L = 0.0;
        L = 2 * pie * (double)R;
        System.out.print(L);

    }
} 

Measured memory_bytes: 36008
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   int h, a;
   cin>>h>>a;

   int num=(h-1)/a+1;

   cout<<num<<endl;
   return 0;
}


Measured memory_bytes: 3592
X, Y = map(int,input().split())

total = (X+Y)/3
k = (2*X-Y)//3

if (total == int(total)) and (k>=0):
    total = (X+Y)//3

    mod = 10 ** 9 + 7

    modinv_table = [-1] * (k + 1)
    for i in range(1, k + 1):
        modinv_table[i] = pow(i, -1, mod)


    def binomial_coefficients(n, k):
        ans = 1
        for i in range(k):
            ans *= n - i
            ans *= modinv_table[i + 1]
            ans %= mod
        return ans

    print(binomial_coefficients(total,k))
else:
    print(0)

Measured memory_bytes: 22088
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N, M;
	cin >> N >> M;

	static int amCnt[35];
	REP(i, N) {
		int k;
		cin >> k;
		REP(j, k) {
			int A;
			cin >> A;
			amCnt[A]++;
		}
	}

	int ans = 0;
	REP(i, M + 1) {
		if (amCnt[i] == N) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;

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

	void run() {
		Scanner sc = new Scanner();
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int a = 0, b = 0, c = 0;
		int[] P = new int[N];
		for (int i = 0; i < N; ++i) {
			P[i] = sc.nextInt();
			if (P[i] <= A)
				++a;
			else if (A + 1 <= P[i] && P[i] <= B)
				++b;
			else if (B + 1 <= P[i])
				++c;
		}
		System.out.println(Math.min(Math.min(a, b), c));
	}

	void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

}

class Scanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}
}


Measured memory_bytes: 24916
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

int a, b, c;

int main() {
	cin >> a >> b >> c;
	if (a == b) wrln(c);
	else if (a == c) wrln(b);
	else wrln(a);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
   cin.tie(0);
   ios::sync_with_stdio(false);
   int n, m;
   cin >> n >> m;
   vector<int> vc(n);
   int sum = 0;
   for(int i = 0;i < n;i++) {
      cin >> vc[i];
      sum+=vc[i];
   }
   sort(vc.rbegin(), vc.rend());
   for(int i = 0;i < m;i++) {
      if(vc[i]*4*m<sum) {
         cout << "No" << endl;
         return 0;
      }
   }
   cout << "Yes" << endl;
}

Measured memory_bytes: 256
import sys
import bisect
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    
    l, r = -1, 10**6
    while r-l > 1:
        k = (r+l)//2
        count = 0
        for i in range(n):
            count += n-bisect.bisect_left(a, k-a[i])
        
        if count > m:
            l = k
        else:
            r = k
    ans = 0
    count = 0
    b = [0]*(n+1)
    for i in range(n):
        b[i+1] += b[i]+a[i]
    for i in range(n):
        index = bisect.bisect_left(a, r-a[i])
        ans += b[n]-b[index]+a[i]*(n-index)
        count += n-index
    
    if count < m:
        ans += (m-count)*l
    
    print(ans)
    
    
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 20040
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793

int main(){
	char str[20];
	scanf("%s", str);
	str[5] = ' ';
	str[13] = ' ';
	printf("%s\n", str);
	
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int a[100050];
int main()
{
   int n;
   int l=0;
   int flag=0;
   int p=0;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       scanf("%d",&a[i]);
       if(a[i]%4==0)l++;
       if(a[i]%2==0)p++;
   }
   int w=p-l;
   int y=w/2;
   if(n%2==0){if(l+y>=n/2)flag=1;}
   else {if(l+y>=(n-1)/2)flag=1;}

  if(flag)
    printf("Yes\n");
  else
    printf("No\n");
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 2e5 + 10;

int n, m1, m2;

struct dsu {
  vector<int> root[2];
  int n;
  dsu (int _n = 0) : n(_n) {
    root[0].resize(n+1);
    root[1].resize(n+1);
    for (int t = 0; t < 2; ++t)
    for (int u = 1; u <= n; ++u) {
      root[t][u] = u;
    }
  }
  int findroot(int u, int t) {
    return (u == root[t][u] ? u : root[t][u] = findroot(root[t][u], t) );
  }
  void unite(int u, int v, int t) {
    int ru = findroot(u, t), rv = findroot(v, t);
    if (ru == rv) return;
    root[t][rv] = ru;
  }
};

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//  freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
  cin >> n >> m1 >> m2;
  dsu T(n);

  for (int i = 1; i <= m1; ++i) {
    int u, v; cin >> u >> v;
    T.unite(u, v, 0);
  }

  for (int i = 1; i <= m2; ++i) {
    int u, v; cin >> u >> v;
    T.unite(u, v, 1);
  }
  map<pair<int,int>, int> m;
  for (int u = 1; u <= n; ++u) {
    T.findroot(u, 0); T.findroot(u, 1);
    m[{T.root[0][u], T.root[1][u]}]++;
  }
  for (int u = 1; u <= n; ++u) {
    int num = m[{T.root[0][u], T.root[1][u]}];
    cout << num << ' ';
  }
  return 0;
}


Measured memory_bytes: 15948
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

/*
    ユークリッドの互除法（正の整数x, yの最大公約数を返す）
*/

long long gcd(long long x, long long y) {
    if (x < y) swap(x, y);
    while (x % y != 0) {
        long long divisor = x % y;
        x = y;
        y = divisor;
    }
    return y;
}

/*
    最小公倍数を求める
*/

long long lcm(long long x, long long y) {
    long long g = gcd(x, y);
    return g * (x / g) * (y / g);
}

int main() {
    
    long long A, B, C, D;
    cin >> A >> B >> C >> D;

    long long l = lcm(C, D);
    cout << ((B - (B / C + B / D - B / l)) - ((A - 1) - ((A - 1) / C + (A - 1) / D - (A - 1) / l))) << endl;

    return 0;
}

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

const long double EPS = 1e-14;

int main(){
  long double a,b,c;
  cin >> a >> b >> c;
  if(sqrt(a) + sqrt(b) + EPS < sqrt(c)){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
s = input()
k = int(input())
arr = set()
arr.add(s)
for i in range(len(s)-1):
    if i > 5:
        break
    for j in range(0, len(s)):
        arr.add(s[j:j+i+1])

arr = list(arr)
arr.sort()
print(arr[k-1])


Measured memory_bytes: 4848
#include <stdio.h>
int main(void)
{
  	char S[3];
  	char T[3];
  
  	int i;
  
  	scanf("%s",S);
  	scanf("%s",T);
  
  	if(S[0] == T[0])
      	i++;
  	if(S[1] == T[1])
      	i++;
  	if(S[2] == T[2])
      	i++;
  	printf("%d",i);
  
  	return 0;
}

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

#define _USE_MATH_DEFINES
//BIAR MANTAB LAH YA
#define Willy using
#define Indrayana namespace
#define Komara std
 
Willy Indrayana Komara;

using ll = long long int;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    cout << setprecision(12) << 2 * atan(1.0)*4 * n << '\n';
}

Measured memory_bytes: 3800
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;

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

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

vector<pint> s;
int mem[210];
int n,m;

int f(int k){
	if(mem[k]>-1)return mem[k];
	int res=0;
	rep(i,n+m){
		if(s[k].first>s[i].first&&s[k].second>s[i].second)chmax(res,f(i)+1);
	}
	return mem[k]=res;
}

int main() {
	for(;;){
		cin>>n;
		if(n==0)break;
		s.clear();
		rep(i,n){
			pint buf;
			cin>>buf.first>>buf.second;
			s.push_back(buf);
		}
		cin>>m;
		rep(i,m){
			pint buf;
			cin>>buf.first>>buf.second;
			s.push_back(buf);
		}
		memset(mem,-1,sizeof(mem));
		rep(i,n+m)f(i);
		int res=0;
		rep(i,n+m)chmax(res,mem[i]);
		cout<<res+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val k = sc.nextInt()
  val h = (1..n).map { sc.nextInt() }.toIntArray()

  val hh = h.sorted()
  val ansList = mutableListOf<Int>()

  for (i in 0 .. n - k) {
    val max = hh[i + k - 1]
    val min = hh[i]
    ansList.add(max - min)
  }

  println(ansList.min())
}

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

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

  int answer = 0 ;
  for(int i = 1 ; i <= 1000 ; i++)
  {
    for(int j = 2 ; j <= 1000 ; j++)
    {
      int calcu = pow(i, j) ;
      //cout << i << " " << j << endl ;
      if(calcu > x)
      {
        break ;
      }
      else if(calcu <= x)
      {
        answer = max(calcu, answer) ;
      }
    }
  }

  cout << answer << endl ;
}


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

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

	char S[N];
	for (int i=0; i<N; ++i) {
		cin >> S[i];
	}

	string result = "Three";

	for (int i=0; i<N; ++i) {
		if (S[i] == 'Y') result = "Four";
	}

	cout << result << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N, K;
    cin >> N >> K;
    
    vector<int> h(N);
    for (int i = 0; i < N; i++) {
        cin >> h.at(i);
    }
    sort(h.begin(), h.end());
    
    int ans = h.at(N-1)- h.at(0); //max
    for (int i = N-1; i >= 0+K-1; i--) {
        ans = min(ans, h.at(i) - h.at(i-K+1));
    }
    cout << ans << endl;
}


Measured memory_bytes: 640