akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  ll n;
  cin >> n;
  if (n < 357) {
    cout << 0 << endl;
    return;
  }
  vector<ll> a = {3, 5, 7};
  vector<ll> b;
  queue<ll> q;
  REP(i, a.size()) q.push(a[i]);
  while (1) {
    ll x = q.front();
    if (x > n) break;
    q.pop();
    string s = to_string(x);
    if (s.find("3") != -1 && s.find("5") != -1 && s.find("7") != -1) b.push_back(x);
    REP(i, a.size()) q.push(x * 10 + a[i]);
  }
  ll ans;
  ans = b.size();
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 1020
/*
 *       ~ AtCoder  Botay ~
 *        code by kazalika
 */

#include <bits/stdc++.h>

using namespace std;



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

  int n, m, x;
  cin >> n >> m >> x;
  vector <int> c(n);
  vector <vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (int j = 0; j < m; ++j)
      cin >> a[i][j];
  }
  int ans = 1e9;
  for (int mask = 0; mask < (1 << n); ++mask) {
    vector <long long> lvl(m);
    int co = 0;
    for (int i = 0; i < n; ++i)
      if (mask >> i & 1) {
        co += c[i];
        for (int j = 0; j < m; ++j)
          lvl[j] += a[i][j];
      }
    bool ok = true;
    for (int i = 0; i < m; ++i)
      if (lvl[i] < x)
        ok = false;
    if (ok)
      ans = min(ans, co);
  }
  cout << (ans == 1e9 ? -1 : ans);

}

Measured memory_bytes: 3624
n= int(input())
a=list(map(int, input().split()))
even = [a[i] for i in range(n) if a[i]%2==0]
l = len(even)
res = 0
for i in range(l):
    if even[i] % 3 == 0 or even[i] % 5 ==0:
        res +=1
print("APPROVED" if res == l else "DENIED")


Measured memory_bytes: 8996
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

int main() {
    ll q, h, s, d, n, ans;
    scanf("%lld%lld%lld%lld%lld",
        &q, &h, &s, &d, &n);
    if(2*h<s) s=2*h;
    if(4*q<s) s=4*q;
    if(2*s<d) ans=n*s;
    else ans=d*(n/2)+s*(n%2);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
from sys import stdin,stdout
def f(A):
	for i in A:
		if i%2==0:
			if i%3!=0 and i%5!=0:
				return 'DENIED'
	return 'APPROVED'

def main():  	
	for x in stdin:
		n = int(x)
		mx = 0
		dic = {}
		for i in range(n):
			s = input().strip('\n')
			if s in dic:dic[s] += 1
			else:dic[s] = 1
			mx = max(dic[s],mx)
		A = []
		for x in dic:
			if dic[x]==mx:A.append(x)
		A.sort()
		print('\n'.join(A))
if __name__ == "__main__":
    main()


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

using namespace std;

int n,ans;
map<int,int>mp;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
	    int x;cin>>x;
		if(mp[x])ans--;
		else ans++;
		mp[x]=!mp[x];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;


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

    long long a[N];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    int count1 = 0;
    int count2 = 0;
    int count4 = 0;
    for(int i = 0; i < N; i++){
        if(a[i]%4 == 0){
            count4++;
        }else if(a[i]%2 == 0){
            count2++;
        }else{
            count1++;
        }
    }

    if(count1 == 0){
        puts("Yes");
        return 0;
    }

    //////// こっから確実に1の要素あり ////////

    // 4の倍数がないと絶対無理 //
    if(count4 == 0){
        puts("No");
        return 0;
    }

    //もし4の倍数があるなら、4の倍数に挟まれた隙間に1の要素or2の倍数を入れられる。
    int zone = count4+1;

    if(count2 >= 1){
        count2 = 1;
    }

    if(zone >= count1+count2){
        puts("Yes");
        return 0;
    }else{
        puts("No");
        return 0;
    }

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define range(i,l,h) for(int i=l;i<h;i++)
#define endl '\n'
#define I INT_MAX
#define L INT_MIN
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vi vector<int>
using namespace std;
using std::ios;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;

int main()
{
 
  fastio;
  string s;
  cin>>s;
  ll num=0;
  range(i,0,s.length())
  {
    num+=int(s[i]-'0');
  } 
  if(num%9==0)
    cout<<"Yes";
  else cout<<"No";
  cout<<endl;
}


Measured memory_bytes: 3732
import itertools
## 複数行の入力
count = int(input())
ary = [input() for i in range(count)]
ary_abc = {'M': 0 ,'A': 0, 'R': 0, 'C':0, 'H':0}
for i in ary:
    for abc in ary_abc:
        if abc == i[0]:
            ary_abc[abc] = ary_abc[abc] + 1

ary_res = []

for n in ary_abc:
    if ary_abc[n] != 0:
        ary_res.append(ary_abc[n])

# print(ary_res)
# print(len(ary_res))

result = 0

# print(ary_res)

result_rz = 1
for last_ary in itertools.combinations(ary_res, 3):
    for rz in last_ary:
        result_rz *= rz
    result += result_rz
    result_rz = 1
print(result)

# ary_res = []

# for n in ary_abc:
#     if ary_abc[n] != 0:
#         ary_res.append(ary_abc[n])
        
# l = range(1, 6) # [1, 2, 3, 4, 5]

# # lの各要素を取り出したものの2つ組を並べる
# # 重複は考慮する
# # 順序は考慮しない
# for elem in itertools.product(l, repeat=2):
#     print elem

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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin());
#define io() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
	io();
	int n, k; cin >> n >> k;
	vector<ld> v(n);
	vector<ld> sums(n);
	for(auto &x : v) cin >> x;
	sums[0] = v[0];
	for(int i = 1; i < n; ++i){
		sums[i] = v[i] + sums[i - 1];
	}	
	ld mx = -1;
	int idx = 0;
	for(int i = 0; i < n - k; ++i){
		if(sums[i + k] - sums[i] > mx){
			mx = sums[i + k] - sums[i];
			idx = i + 1;
		}
	}
	ld ans = 0;
	for(int i = idx; i < idx + k; ++i){
		ld cur = v[i]*(v[i]+1)/2;
		ans += (cur/v[i]);
	}
	cout << fixed << setprecision(12) << ans << '\n';
	return 0;
}

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

int main()

{
   long long a=0,b=0,c=0,d,e,f,g,h,i,j,k,l,m,n,t;

       cin>>n;

       long long ar[n]; long long bar[n];

       for(i=0;i<n;i++)
       {
           cin>>ar[i];
       }
         for(i=0;i<n;i++)
       {
           cin>>bar[i];
       }
       for(i=0;i<n;i++)
           {if(ar[i]>bar[i])
           {
               c=ar[i]-bar[i];
               a=a+c;
           }
           }


       cout<<a<<endl;
   }





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

using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
 string s[60] ={};   
 int n;
 cin >> n;
 for(int i= 0;i<n;++i){
     cin >> s[i];
 }
    string ans;
    for(char c = 'a'; c <= 'z'; ++c){
        int small = 100;

        for(int i=0; i< n; ++i){
            int cnt = 0;
            for(int j = 0; j < s[i].length(); ++j){
                if(s[i][j]==c)++cnt;
            }
            small = min(small,cnt);
        }
        for(int i= 0; i< small;++i){
            ans+=c;
        }
    }
    cout << ans << endl;
    return 0;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
using namespace std;
 
int main() {
    long long n,m; cin >> n >> m;
    vector<int> ans(n);
    long long a;
    for (int i = 0; i < 2*m; i++)
    {
        cin >> a;
        ans[a-1] = ans[a-1]+1;
    }
    for (int i = 0; i < n; i++)
    {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 3656
#include <iostream>
#include <string.h>

using namespace std;
int Memo[1000001];
bool IsHamming[1000001];

void Calc()
{
	memset(IsHamming, 0, sizeof(bool) * 1000001);
	for(int i = 1; i < 1000001; ++i)
	{
		int temp = i;
		while(temp % 2 == 0)
		{
			temp /= 2;
		}
		while(temp % 3 == 0)
		{
			temp /= 3;
		}
		while(temp % 5 == 0)
		{
			temp /= 5;
		}
		if(temp == 1)
		{
			IsHamming[i] = true;
		}
	}
	int count = 0;
	for(int i = 1; i < 1000001; ++i)
	{
		if(IsHamming[i])
		{
			count++;
		}
		Memo[i] = count;
	}
}

void solve()
{
	Calc();
	int	m, n;
	while(cin >> m)
	{
		if(!m)
		{
			break;
		}
		cin >> n;
		if(IsHamming[m])
		{
			cout <<	Memo[n] - Memo[m] + 1 << endl;
		} 
		else
		{
			cout << Memo[n] - Memo[m] << endl;
		}
	}
}

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

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp {
  char name[100];
  int t;
} P;
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}
 
P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}
 
int min(int a,int b) {
  return a < b ? a : b; 
}
 
int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  
  scanf("%d %d",&n ,&q);
  for(i=1; i<=n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
 
  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}


Measured memory_bytes: 11848
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,a,chk=0;
    cin>>n;
    for(i=1;i<10;i++)
    {
        if(n%i==0)
        {
            a=n/i;
            if(a>0 && a<10)
            {
                chk=1;
                break;
            }
        }
    }
    if(chk)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll diff(ll a,ll b)
{
	if(a>b) return a-b;
	else return b-a ;
}

int main()
{
	std::ios::sync_with_stdio(false);
	// int T;
	// cin>>T;
	// cin.ignore(); must be there when using getline(cin, s)
	// while(T--)
	// {
		ll n;
		std::cin >> n;
		std::vector<ll> a(n);
		ll ans[n]={0};
		for(ll i=0;i<n;i++) cin>>a[i];
		ans[0]=0;
		ans[1]=diff(a[1],a[0]);
		for(ll i=1;i<n;i++)
		{
			ans[i]=min(ans[i-2]+diff(a[i],a[i-2]),ans[i-1]+diff(a[i],a[i-1]));
		}
		cout<<ans[n-1]<<"\n";
	// }
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main()
{
    double L[10];
    double V1, V2;
    double meet_pos;
    double railway_lenth;
    int cnt1, cnt2;
    int output[50];
    
    cnt2 = 0;
    while(scanf("%lf,", &L[0]) != EOF){
    	for(cnt1 = 1; cnt1 < 10; cnt1++)
			scanf("%lf,", &L[cnt1]);
		scanf("%lf,%lf", &V1, &V2);
    	
    	railway_lenth = 0;
    	for(cnt1 = 0; cnt1 < 10; cnt1++)
			railway_lenth += L[cnt1];
    	meet_pos = railway_lenth * V1 / (V1 + V2);
    	
    	cnt1 = 0;
    	railway_lenth = 0;
    	while(railway_lenth < meet_pos){
			railway_lenth += L[cnt1];
			cnt1++;
    	}
    	output[cnt2] = cnt1;
    	cnt2++;
    }
    
    for(cnt1 = 0; cnt1 < cnt2; cnt1++)
    {
		printf("%d\n", output[cnt1]);
	}
	
    return 0;
} 

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

int main(){
    int n, k, bit = 1, j;
    cin >> n >> k;
    j = k;
    while(1){
        if(n - j < 0) break;
        j *= k;
        bit++;
    }
    cout << bit << endl;
    
    return 0;
}

Measured memory_bytes: 256
A, B, C = gets.split.map(&:to_i)
K = gets.to_i

values = [A, B, C]

K.times do
  if values[0] >= values[1]
    values[1] *= 2
  else
    values[2] *= 2
  end
end

if values[0] < values[1] && values[1] < values[2]
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 14356
/*AOJ 0017*/

#include<iostream>
#include<string>

using namespace std;

char shiftCaesar(char tmp){
	if(tmp>='a' && tmp<= 'y'){
		return tmp+1;
	}
	else if(tmp == 'z'){
		return 'a';
	}
	else{
		return tmp;
	}
}

int main(){
	char str[100];
	string tmp;

	while(cin.getline(str,100)){

		for(;;){

			tmp = str;

			if( tmp.find("the") != -1 || tmp.find("this") != -1 || 
				tmp.find("that") != -1){
					break;
			}

			for(int i=0;str[i]!='\0';i++){
				str[i] = shiftCaesar(str[i]);
			}


		}

		cout<<tmp<<endl;

	}
	return 0;
}

Measured memory_bytes: 0
import math
def combi(n,r):
  ans = math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
  return ans

N, M = map(int,input().split())

ans = 0
if N > 1:
  ans += combi(N,2)
if M > 1:
  ans += combi(M,2)
print(ans)


Measured memory_bytes: 61944
double d,r,s,z[];main(i){for(;~scanf("%lf",z-i--%6);!i|i%6||puts(d>(r=z[2])+(s=z[5])?"0":r>d+s?"2":s>d+r?"-2":"1"))d=hypot(*z-z[3],z[1]-z[4]);}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main()
{
    int n;
    cin>>n;
    int b[n-1];
    for(int i=0;i<n-1;i++)
        cin>>b[i];
    
    int ans=0;
    
    for(int i=0;i<n;i++)
    {
        int mn=INT_MAX;
        mn=min(mn,b[i]);
        if(i-1>=0)
        {
            mn=min(mn,b[i-1]);
        }
        ans+=mn;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N,A,B,C,D = MI()
S = ['#'] + LS2()

for i in range(A,C):
    if S[i] == S[i+1] == '#':
        print('No')
        exit()
for i in range(B,D):
    if S[i] == S[i+1] == '#':
        print('No')
        exit()

if C < D:  # 追い越ししなくてよい
    print('Yes')
else:  # 追い越し必要
    for i in range(B,D+1):
        if S[i-1] == S[i] == S[i+1] == '.':
            print('Yes')
            break
    else:
        print('No')


Measured memory_bytes: 84020
#include<bits/stdc++.h>
#define vi vector<int>
#define vb vector<bool>

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    vi arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    vb dp(k+1,false);
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i-arr[j]>=0){
                if(!dp[i-arr[j]]){
                    dp[i]=true;
                    break;
                }
            }else break;
        }
    }
    if(dp[k]) cout<<"First";
    else cout<<"Second";
}

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

typedef struct A{
  char name[100];
  int t;
} P;

P dequeue();
int min();
void enqueue();
P Q[N];
int head,tail,n;

int main(){
  int e=0,c,i,q;
  P u;
  scanf("%d%d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;tail=n+1;
  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t=u.t-c;
    e=e+c;
    if(u.t>0) enqueue(u);
    else printf("%s %d\n",u.name,e);
  }
  return 0;
}

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%N;
}

P dequeue(){
  P x=Q[head];
  head=(head+1)%N;
  return x;
}

int min(int a,int b){
  return a<b?a:b;
}

Measured memory_bytes: 10756
use proconio::input;
use std::cmp::min;

#[allow(unused_variables)]
fn main() {
    input! {
      n: usize,
      xa: [isize; n]
    };

    let mut ans: isize = std::isize::MAX;

    for i in 1..=100 {
        let mut sum = 0;
        for x in &xa {
            sum += (x - i as isize) * (x - i as isize);
        }

        ans = min(ans, sum)
    }

    println!("{}", ans);
}


Measured memory_bytes: 2132
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

class UnionFind {

	int[] par;

	public UnionFind(int size) {
		par = new int[size];
		Arrays.fill(par, -1);
	}

	public int root(int x) {
		if (par[x] < 0) {
			return x;
		}
		int z = root(par[x]);
		par[x] = z;
		return z;
	}

	public boolean same(int a, int b) {
		return root(a) == root(b);
	}

	public void unite(int a, int b) {
		if (!same(a, b)) {
			int ra = root(a);
			int rb = root(b);

			if (par[ra] < par[rb]) {
				par[ra] += par[rb];
				par[rb] = ra;
			} else {
				par[rb] += par[ra];
				par[ra] = rb;
			}
		}
	}

	public int size(int a) {
		return -par[root(a)];
	}
}

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int K = sc.nextInt();

		UnionFind u = new UnionFind(N);

		int[] numOfFriend = new int[N];

		for (int i = 0; i < M; i++) {
			int A = sc.nextInt() - 1;
			int B = sc.nextInt() - 1;
			u.unite(A, B);

			numOfFriend[A]++;
			numOfFriend[B]++;

		}

		int[] numOfBlock = new int[N];

		for (int i = 0; i < K; i++) {
			int C = sc.nextInt() - 1;
			int D = sc.nextInt() - 1;

			if (u.same(C, D)) {
				numOfBlock[C]++;
				numOfBlock[D]++;
			}
		}

		sc.close();

		StringBuffer buf = new StringBuffer();

		for (int i = 0; i < N; i++) {
			int ans = u.size(i);
			ans--; // 自分を除く
			ans -= numOfFriend[i];
			ans -= numOfBlock[i];
			buf.append(ans);
			buf.append(" ");
		}
		out.println(buf.substring(0, buf.length() - 1));

	}

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


Measured memory_bytes: 103148
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 11;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	int N, i;
	scanf("%d", &N);
	for (i = 1; i <= N; i *= 2);
	return !printf("%d\n", i / 2);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 10000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    IOS
    lli a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a*b,a-b));
    return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
	IOS;
	int n, m;
	cin >> n >> m;
	int ans = (n+m)*(n+m-1)/2;
	ans -= n*m;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
S = input().rstrip()
plus_minus = [1, -1]
A = int(S[0])
for i in plus_minus:
    B = i*int(S[1])
    for j in plus_minus:
        C = j*int(S[2])
        for k in plus_minus:
            D = k*int(S[3])
            total = A+B+C+D
            if total == 7:
                if B >= 0:
                    B = "+" + str(B)
                if C >= 0:
                    C = "+" + str(C)
                if D >= 0:
                    D = "+" + str(D)
                answer = str(A) + str(B) + str(C) + str(D) + "=7"
                print(answer)
                exit()

Measured memory_bytes: 3064
s = input()
n = len(s) + 1

lp = [0] * n
rp = [0] * n

for i in range(1,n):
  if s[i-1] == '>':
    lp[i] = 0
  else:
    lp[i] = lp[i-1] + 1

for i in range(1,n):
  if s[n-1-i] == '<':
    rp[n-1-i] = 0
  else:
    rp[n-1-i] = rp[n-i] + 1

total = 0
for i in range(n):
  total += max(lp[i], rp[i])

print (total)

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

int main(){
	int n,m,p,x[10000],sum,a;
	while(true){
		cin>>n>>m>>p;
		sum=0;
		if(n==0 && m==0 && p==0){
			break;
		}
		for(int i=1;i<=n;i++){
			cin>>x[i];
			sum += x[i];
		}
		if(x[m]!=0){
			a=sum*(100-p)/x[m];
		}
		else{
			a=0;
		}
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
l = int(input())

def f(x,y):
    z = l-x-y
    if z<0 or z>l:
        print(x,y,z)
        return -1
    return x*y*z

def fp(x,y):
    dx = y*(l-x-y) - x*y
    dy = x*(l-x-y) - x*y
    return dx,dy

x = 1.0
y = 1.0
while True:
    dx,dy = fp(x,y)
    if abs(dx)<10**-6 and abs(dy)<10**-6:
        print(f(x,y))
        exit()

    x += dx * 10**-5
    y += dy * 10**-5


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
using namespace std;
using ll = long long;

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

int euclidean_gcd(int a, int b) {
  if (a < b) return euclidean_gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

void makemap(vector<int> &a, map<pair<int,int>, int> &gcds, int begin, int end){
  if(begin==end){
    gcds.insert(make_pair(make_pair(begin, end), a[begin]));
  }
  else{
    makemap(a, gcds, begin, (begin+end)/2);
    makemap(a, gcds, (begin+end)/2+1, end);
    gcds.insert(make_pair(make_pair(begin, end), euclidean_gcd(gcds.at(make_pair(begin, (begin+end)/2)), gcds.at(make_pair((begin+end)/2+1, end)))));
  }
}
    
int searchmap(int i, map<pair<int,int>, int> &gcds, int begin, int end){
  if (begin==end)
    {
      if(begin==i&&begin>0)
	return gcds.at(make_pair(begin-1,end-1));
      else if(begin==i)
	return gcds.at(make_pair(begin+1, end+1));
      else
	return gcds.at(make_pair(begin,end));
    }
  
  else if (i<=(begin+end)/2)
    {
      return euclidean_gcd(searchmap(i, gcds, begin, (begin+end)/2), gcds.at(make_pair((begin+end)/2+1, end)));
    }
  else
    {
      return euclidean_gcd(searchmap(i, gcds, (begin+end)/2+1, end), gcds.at(make_pair(begin,(begin+end)/2)));
    }
}

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

  vector<int> a(n);
  REP(i, n){
    cin >> a[i];
  }
  
  map<pair<int,int>, int> gcds;
  makemap(a, gcds, 0, n-1);

  int ans=0;
  
  REP(i,n)
    {
      ans=max(searchmap(i, gcds, 0, n-1), ans);
    }
  
  cout<<ans<<endl;

  

  
  
}


Measured memory_bytes: 13184
# D - Bouquet

MOD = 10 ** 9 + 7
n, a, b = map(int, input().split())
total = pow(2, n, MOD) - 1

def choose(n, r):
    X = 1
    Y = 1
    for i in range(r):
        X *= n - i
        X %= MOD
        Y *= i + 1
        Y %= MOD
 
    return X * pow(Y, MOD - 2, MOD) % MOD

A = choose(n, a)
B = choose(n, b)
print((total - A - B) % MOD)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
const int N = 1e6 + 1;

int n, a, b;
char s[N];

int main() { cin.tie(0)->sync_with_stdio(0);
	while (true) {
		s[++n] = getchar();
		if (s[n] == '\n') {
			n--;
			break;
		}
		if (s[n] == 'A') a++;
		if (s[n] == 'B') b++;
	}
	if (a && b) cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i=0; i<n; i++) {
			list.add(sc.nextInt());
		}
		
		int ggc = getGreatestCommonMeasure(list.get(0), list.get(1));
		for (int i=2; i<n; i++) {
			ggc = getGreatestCommonMeasure(ggc, list.get(i));
		}
		
		System.out.println(ggc);
	}
	
	public static int getGreatestCommonMeasure(int a, int b) {
		int amari;
		int x = a;
		int y = b;
		while ((amari = x % y) != 0) {
			x = y;
			y = amari;
		}
		
		return y;
	}
}

Measured memory_bytes: 58636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
int main(){
    ll n,P[200001],I[200001];
    cin>>n;
    rep(i,n) cin>>P[i],I[P[i]]=i+1;
    ll ans=0;
    set<ll> A;
    for(ll i=n;i>0;i--){
        if(i==n){
            A.insert(I[n]);
            continue;
        }
        ll l,r,ll,rr;
        l=*--A.lower_bound(I[i]),r=*A.upper_bound(I[i]);
        if(*A.begin()>I[i]) l=0;
        if(*A.rbegin()<I[i]) r=n+1;
        if(l!=0){
            ll=*--A.lower_bound(l);
            if(*A.begin()==l) ll=0;
        }
        else ll=0;
        if(r!=n+1){
            rr=*A.upper_bound(r);
            if(*A.rbegin()==r) rr=n+1;
        }
        else rr=n+1;
        if(l!=0){
            if(r!=0) ans+=(r-I[i])*(l-ll)*i;
            else  ans+=(n-I[i])*(l-ll)*i;
        }
        if(r!=n+1){
            if(l!=0) ans+=(I[i]-l)*(rr-r)*i;
            else  ans+=I[i]*(rr-r)*i;
        }
        //cout<<ll<<" "<<l<<" "<<r<<" "<<rr<<"\n";
        A.insert(I[i]);
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 7296
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC158E();

#if 1
int main()
{
	ABC158E();
	fflush(stdout);
	return 0;
}
#endif

static void ABC158E()
{
	int N, P;
	getint(N, P);

	std::string orgs;
	std::cin >> orgs;

	if ((P == 2) || (P == 5)) {
		LLONG ans = 0;
		for (int i = N - 1; i >= 0; i--) {
			int num = orgs[i] - '0';
			if (num % P == 0) {
				ans += i + 1;
			}
		}
		printf("%lld\n", ans);
		return;
	}

	int mod = 0;
	int factor = 1;
	std::vector<LLONG> counter(P, 0);
	counter[0] = 1;
	for (int i = N - 1; i >= 0; i--) {
		int num = orgs[i] - '0';

		mod = (mod + (num * factor)) % P;
		counter[(int)mod]++;
		factor = (factor * 10) % P;
	}

	LLONG ans = 0;
	for (int i = 0; i < P; i++) {
		ans += (counter[i] * (counter[i] - 1LL)) / 2LL;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 640
from math import gcd
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(set(a))
a=list(map(lambda x: x//2, a))

def lcm(q):
  x = q[0]
  for i in range(1, len(q)):
    x = (x * q[i]) // gcd(x, q[i])
  return x

lcma=lcm(a)
for i in range(len(a)):
  if (lcma//a[i])%2==0:
    print(0)
    exit()
temp=m//lcma
print(-(-temp//2))

Measured memory_bytes: 20192
import java.util.*;
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] c = new int[n];
      int[] s = new int[n];
      int[] f = new int[n];
      for(int i = 1;i < n;i++){
      	c[i]=sc.nextInt();
        s[i]=sc.nextInt();
        f[i]=sc.nextInt();
      }
      int[] sum = new int[n+1];
      for(int i = 1;i < n;i++){
        for(int j = i;j < n;j++){
          int l = s[j];
          if(sum[i]>l){
          	while(sum[i]>l)l+=f[j];
          }
          sum[i]=l;
          sum[i]+=c[j];
        }
        System.out.println(sum[i]);
      }
      System.out.println(0);
    }
}

Measured memory_bytes: 26036
N = int(input())
NT = []
for i in range(N):
    n,t = input().split()
    t = int(t)
    
    NT.append([n,t])
X = input()
flag = False
ans = 0
for a,b in NT:
    if flag:
        ans += b
    if a == X:
        flag = True
print(ans)

Measured memory_bytes: 3064
# include<stdio.h>
int main(void)
{
  char b[1];
  
  scanf("%s",&b);
  
  if(b[0]=='A')  printf("T");
  if(b[0]=='T')  printf("A");
  if(b[0]=='C')  printf("G");
  if(b[0]=='G')  printf("C");
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
#define rep(i, n) for(int i = 0; i < n; i++)

int main(void) {
	int n = 0;
	scanf("%d", &n);
	double X[8], Y[8];

	rep(i, n) {
		scanf("%lf %lf", &X[i], &Y[i]);
	}

	float ans = 0;
	rep(i, n - 1) {
		for (int j = i + 1; j < n; j++) {
			double d_2 = pow(X[i] - X[j], 2) + pow(Y[i] - Y[j], 2);
			ans += sqrt(d_2);
		}
	}

	printf("%lf\n", ans * 2 / n);

	return 0;
}

Measured memory_bytes: 128
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#AB = sorted(AB,key = lambda x:x[0]) # Aに着目して安いやつ Aが値段でBが在庫や！！

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    Al = []
    for i in range(n):
        Al.append([A[i],i+1])
    Al = sorted(Al,key = lambda Al:Al[0]) # ここの lambda Al:Al[0]は一致させないといけないらしい
    ans = []
    for k,v in Al:
        ans.append(v)
    print(*ans)
if __name__ == '__main__':
  main()


Measured memory_bytes: 24832
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        mut abn:[(usize,usize);n],
    }
    // let mut v:Vec<_> = abn.iter().enumerate().map(|(j,&x)|(j,x.1-x.0)).collect();
    // v.sort_by_key(|k|k.1);
    abn.sort();
    abn.sort_by_key(|k|k.1);
    // println!("{:?}",v);
    let mut l = 0;
    // for &(j,last_start) in &v {
    //            println!("l:{} last_start:{}",l,last_start);
    //     println!("{:?}",abn[j]);
 
    //     l += abn[j].0;
    //     if l > abn[j].1 {
    //         println!("No");
    //         return;
    //     }
    for &(a,b) in &abn{
        l += a;
        if l > b {
            println!("No");
            return;
        }
    }
    // }
    println!("Yes");
}

Measured memory_bytes: 12540
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element


signed main()
{
	string S;
	cin >> S;
	
	YesNo(!(S == "AAA" || S == "BBB"));
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double L;
    cin >> L;
    double side = L/3;
    double volume = side * side * side;
    cout << fixed <<  setprecision(12) << volume << endl;
}

Measured memory_bytes: 256
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]

max_score = max(C[1:])
for init in range(1, N + 1):   # 初めの場所をinitとする
    score = [0]  # k回移動後のスコア
    i = init
    for k in range(1, K + 1):
        i = P[i]  # k回移動後に着くところ
        score.append(score[-1] + C[i])
        max_score = max(max_score, score[k])
        if i == init:  # ループ検出
            loop_score = score[-1]
            loop_len = k
            if loop_score > 0:
                max_score = max(max_score, max(score[j] + loop_score * ((K - j) // loop_len) for j in range(1, loop_len + 1)))
            break

print(max_score)

Measured memory_bytes: 81864
n = input()
if int(n[len(n)-1]) == 3:
    print("bon")
elif int(n[len(n)-1]) == 0 or int(n[len(n)-1]) == 1 or int(n[len(n)-1]) == 6 or int(n[len(n)-1]) == 8:
    print("pon")
else:
    print("hon")


Measured memory_bytes: 61900
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;++i){
		int k;
		cin>>k;
		if(i%2==1&&k%2==1) ++sum;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>
int main() {
	int a[3], kind=3;
	scanf("%d%d%d", &a[0], &a[1], &a[2]);
	if (a[0] == a[1]) kind--;
	if (a[0] == a[2]) kind--;
	if (a[1] == a[2]) kind--;
	if(kind==0) printf("%d\n", kind+1);
	else printf("%d\n", kind);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int n, k;
    while (cin >> n >> k, n) {
        vector<long long> ac(n+1, 0);
        for (int i=1; i<=n; ++i) {
            cin >> ac[i];
            ac[i] += ac[i-1];
        }
        long long res = -LLONG_MAX;
        for (int i=k; i<=n; ++i) {
            res = max(res, ac[i] - ac[i-k]);
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1796
#include<stdio.h>

int main(void){
    int a=0,b=0;
    scanf("%d %d",&a,&b);

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

    return 0;
}

Measured memory_bytes: 1708
#include <algorithm>
#include <cstdio>
#define MOD 1000000007
struct data
{
	int x, y, idx;
} arr[200005], seq[200005];
int sum[200005];
int main()
{
	// freopen("AGC015-E.in", "r", stdin);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d%d", &arr[i].x, &arr[i].y);
	std::sort(arr, arr + n, [&] (const data & a, const data & b)
	{
		return a.y < b.y;
	});
	for (int i = 0; i < n; i++)
		arr[i].idx = i;
	std::sort(arr, arr + n, [&] (const data & a, const data & b)
	{
		return a.x < b.x;
	});
	int cur = -1;
	for (int i = 0; i < n; i++)
	{
		cur = std::max(cur, arr[i].idx);
		seq[arr[i].idx].y = cur;
	}
	cur = n - 1;
	for (int i = n - 1; i >= 0; i--)
	{
		cur = std::min(cur, arr[i].idx);
		seq[arr[i].idx].x = cur;
	}
	std::sort(seq, seq + n, [&] (const data & a, const data & b)
	{
		if (a.y == b.y)
			return a.x < b.x;
		return a.y < b.y;
	});
	sum[0] = 1;
	for (int i = 0; i < n; i++)
	{
		seq[i].x++;
		seq[i].y++;
		for (int j = i ? seq[i - 1].y + 1 : 1; j <= seq[i].y; j++)
			sum[j] = sum[j - 1];
		int x = (sum[seq[i].y] - (seq[i].x != 1 ? sum[seq[i].x - 2] : 0) + MOD) % MOD;
		(sum[seq[i].y] += x) %= MOD;
	}
	printf("%d\n", (sum[n] - sum[n - 1] + MOD) % MOD);
	return 0;
}


Measured memory_bytes: 5632
unittest
{
	assert( [ "1 3 4" ].parse.expand.solve == 4 );
	assert( [ "3 2 3" ].parse.expand.solve == 5 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto pqr = input.front.split.to!( long[] );
	return tuple( pqr[ 0 ], pqr[ 1 ], pqr[ 2 ] );
}

auto solve( long p, long q, long r )
{
	return min( p + q, q + r, r + p );
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int N;
    long long a[1000000], r = 1;

    cin >> N;

    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        if (a[i] == 0)
        {
            cout << "0" << endl;
            return 0;
        }
    }

    for (int i = 0; i < N; i++)
    {
        if (a[i] > 1000000000000000000 / r)
        {
            cout << "-1" << endl;
            return 0;
        }

        r *= a[i];

        if(r > 1000000000000000000){
            cout << "-1" << endl;
            return 0;
        }
    }

    cout << r << endl;
    return 0;
}

Measured memory_bytes: 4432
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>  
#include <cstdlib>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++) 

int main() {
    int N;
    cin >> N;
    int H;
    int maxi = 0;
    rep(i,N) {
        cin >> H;
        if (i == 0) {
            maxi = H;
            continue;
        }
        if (maxi - H >= 2) {
            cout << "No" << endl;
            return 0;
        } else {
            maxi = max(maxi,H);
        }

    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long M = sc.nextLong();
		
		long ans = N == M ? 2 : 1;
		
		for (long i = 1; i <= N; i++) {
			ans *= i;
			ans %= 1_000_000_007;
		}
		
		for (long i = 1; i <= M; i++) {
			ans *= i;
			ans %= 1_000_000_007;
		}
		
		if (Math.abs(N-M) > 1)
			ans = 0;
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 22996
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

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

int main() {

  int n, K;
  cin >> n >> K;
  vector<int> a(n);
  for (auto &e : a) {
    cin >> e;
  }
  int ans = 0;
  for (int k = 1; k <= K; k++) {
    for (int d = 1; d <= min(k, n); d++) { // d個取り出す
      auto e = k - d;                      // e個戻す
      if (d < e) continue;
      map<int, int> s;
      int sum = 0;
      int left = d - 1, right = n; // [0, left], [right, n - 1]
      rep(i, d) {
        s[a[i]] += 1;
        sum += a[i];
      }
      {
        int sub = 0, cnt = e;
        for (auto p : s) {
          sub += p.first * min(p.second, cnt);
          cnt -= p.second;
          if (cnt <= 0) break;
        }
        ans = max(ans, sum - sub);
      }
      while (left >= 0) {
        s[a[left]] -= 1;
        sum -= a[left];
        s[a[right - 1]] += 1;
        sum += a[right - 1];
        left--;
        right--;
        int sub = 0, cnt = e;
        for (auto p : s) {
          sub += p.first * min(p.second, cnt);
          cnt -= p.second;
          if (cnt <= 0) break;
        }
        ans = max(ans, sum - sub);
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main()
{
    int n;
    scanf("%d", &n);
    int a[n+2];
    a[0]=0;
    a[n+1]=0;
    long long int all=0;
    for(int i=1;i<n+1;i++){
        scanf("%d", &a[i]);
    }
    for(int i=1;i<n+2;i++){
        if(a[i]<a[i-1]){
            all+=(a[i-1]-a[i]);
        }else{
            all+=(a[i]-a[i-1]);
        }
        //printf("all=%d\n", all);
    }

    for(int i=1;i<n+1;i++){
        if(a[i]<=a[i-1] && a[i]>=a[i+1]){
            printf("%lld\n", all);
        }else if(a[i]>=a[i-1] && a[i]<=a[i+1]){
            printf("%lld\n", all);
        }else if(a[i]<=a[i-1] && a[i-1]<=a[i+1]){
            printf("%lld\n", all-2*(a[i-1]-a[i]));
        }else if(a[i]<=a[i+1] && a[i+1]<=a[i-1]){
            printf("%lld\n", all-2*(a[i+1]-a[i]));
        }else if(a[i-1]<=a[i+1] && a[i+1]<=a[i]){
            printf("%lld\n", all-2*(a[i]-a[i+1]));
        }else if(a[i+1]<=a[i-1] && a[i-1]<=a[i]){
            printf("%lld\n", all-2*(a[i]-a[i-1]));
        }
    }
    return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;  
  vector<int> d(N);
  for (int i = 0; i < N; ++i) {
    cin >> d[i];
  }
  sort(d.rbegin(), d.rend());
  int last = d[0];
  int ans = 1;
  for (int i = 1; i < N; ++i) {
    if (d[i] < last) {
      last = d[i];
      ans++;
    } 
  }
  cout << ans << endl;
  return 0;
}



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

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define rrep()
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    int n,timee;
    cin>>n>>timee;
    ll past=0;
    ll ans=0;
    
    rep(i,0,n){
        ll t;
        cin>>t;
        if(t-past>timee)ans+=timee;
        else ans+=(t-past);
        
        past=t;
    }
    ans+=timee;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;

vector<ll> cnt;

void dfs(const Graph &G,int v,int p){
  cnt[v] += cnt[p];
  for(auto nv:G[v]){
    if(nv == p) continue;
    dfs(G,nv,v);
  }
}

int main(){
  int n,q;
  cin >> n >> q;
  Graph g(n+1);
  for(int i=1;i<=n-1;i++){
    int a,b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  cnt.resize(n+1);
  cnt.assign(n+1,0);
  for(int i=0;i<q;i++){
    int p,x;
    cin >> p >> x;
    cnt[p] += x;
  }

  for(auto nv:g[1]){
    dfs(g,nv,1);
  }

  for(int i=1;i<=n;i++){
    cout << cnt[i];
    if(i!=n) cout <<" ";
    else cout << endl;
  }
}


Measured memory_bytes: 24320