akhauriyash/Code-Regression huggingface dataset:
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = (1 << 31) - 1;


int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);
	vector<int> h(n, 0);
	rep(i, n + m - 1) {
		int p1, p2;
		cin >> p1 >> p2;
		p1--; p2--;
		g[p1].push_back(p2);
		h[p2]++;
	}
	queue<int> none;
	rep(i, n) {
		if (h[i] == 0) {
			none.push(i);
		}
	}
	vector<int> ans(n);
	while (none.size()) {
		int i = none.front(); none.pop();
		for (auto& j : g[i]) {
			h[j]--;
			ans[j] = i + 1;
			if (h[j] == 0) none.push(j);
		}
	}
	rep(i, n) cout << ans[i] << endl;
	return 0;
}

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


int main(void)
{
  int n,i,j,k;
  long long int ans = 0;
  cin>>n;
  for(i=1;i<=n;i++)
  {
  	if(i%3 != 0 && i%5 != 0)
  		ans += i;
  }
  cout<<ans<<endl;
 return 0; 
}

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

const int N = 1e5 + 5;
int steps;
ll dp[N];
ll h[N];
int n;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> steps;
    for (int i = 0; i < n; i++)
        cin >> h[i];
    for (int i = 1; i < n; i++) {
        ll start = max(0, i - steps), mn = 1e9;
        for (int j = start; j < i; j++)
            mn = min(mn, dp[j] + abs(h[i] - h[j]));
        dp[i] = mn;
    }
    cout << dp[n - 1];
    return 0;
}


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

int main(){
	set<int> s;
	int a,b,c;cin >> a >> b >> c;
	s.insert(a);
	s.insert(b);
	s.insert(c);
	if(s.size() == 2)cout << "Yes";
	else cout << "No";
}
// make pair, tuple
// make pair, tuple
// 
// __gcd(int, int);
// lcm = a * b / __gcd(a, b);
// 
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }
// 
// #Count leading & trailing zero of an integer bits
// __builtin_clz(n);
// __builtin_clzll(n);
//
// #Count 1s bits of an integer
// __builtin_popcount(n);
// __builtin_popcountll(n);
//
// #Error checking
// assert(n == 3);
// 
// #Error Printing
// cerr << "Some thing";

// #binary exponentiation
// long long binpow(long long a, long long b) {
//     long long res = 1;
//     while (b > 0) {
//         if (b & 1)
//             res = res * a;
//         a = a * a;
//         b >>= 1;
//     }
//     return res;
// }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	string temp;
	getline(cin, temp);
	int q = stoi(temp);
	list<int>a;
	auto itr = a.end();
	REP(i, q)
	{
		getline(cin, temp);
		stringstream query(temp);
		vector<string>querys;
		while (query)
		{
			query >> temp;
			querys.push_back(temp);
		}
		switch (static_cast<int>(querys[0][0] - '0'))
		{
		case 0:
			itr = a.insert(itr, stoi(querys[1]));
			break;
		case 1:
			advance(itr, stoi(querys[1]));
			break;
		case 2:
			itr = a.erase(itr);
			break;
		}
	}
	REPC(i, a)cout << i << endl;
	return 0;
}


Measured memory_bytes: 18692
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n, sum; vector<int> a;
    
    while(true)
    {
        cin >> n;
        
        if(n == 0) { break; }
        
        a = vector<int>(n); sum = 0;
        
        for(int i = 0; i < n; i++)
        {
            cin >> a[i]; sum += a[i];
        }
        
        int min_ = (1 << 29);
        
        for(int i = 0; i < (1 << n); i++)
        {
            int sum2 = 0;
            
            for(int j = 0; j < n; j++)
            {
                if(i & (1 << j))
                {
                    sum2 += a[j];
                }
            }

            min_ = min(abs(2 * sum2 - sum), min_);
        }
        
        cout << min_ << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define vi vector<int>
#define ll long long
#define pb push_back
#define ii pair<int, int>
#define MAXN int(1e6)
#define qi queue<int>
#define si stack<int>
#define mii map<int, int>
#define msi map<string, int>
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
using namespace std;

ll arr[405], sum[405], dp[405][405], n;

int main(int argc, char** argv) {
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			dp[i][j] = 1e16;

	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		dp[i][i] = 0;
	}

	sum[0] = arr[0];
	for (int i = 1; i < n; i++)
		sum[i] = sum[i-1]+arr[i];

	for (int len = 1; len < n; len++) {
		for (int start = 0; start < n; start++) {
			int end = start+len;

			if (end >= n)
				continue;

			//dp[start][end] = 1e16;

			ll s = sum[end]-sum[start]+arr[start];

			for (int k = start; k < end; k++) {
				ll d = s+dp[start][k]+dp[k+1][end];
				dp[start][end] = min(dp[start][end], d);
			}
		}
	}

	cout << dp[0][n-1] << '\n';


	return 0;
}






Measured memory_bytes: 1536
#include <stdio.h>
#include <string.h>

int main(void) {
    char s[4]={'S','H','C','D'}, c[100];
    int cards[4][13];
    int i, j, n, su, ra;

    for (i=0; i<4; i++) {
        for (j=0; j<13; j++) {
	    cards[i][j] = 0;
	}
    }
    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%s %d", c, &ra);
	if (strcmp(c, "S")==0) su=0;
	if (strcmp(c, "H")==0) su=1;
	if (strcmp(c, "C")==0) su=2;
	if (strcmp(c, "D")==0) su=3;
	cards[su][ra-1]=1;
    }

    for (i=0; i<4; i++) {
        for (j=0; j<13; j++) {
	    if (!cards[i][j]) printf("%c %d\n", s[i], j+1);
	}
    }
    return 0;
}



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

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

    int ans = 1001;
    for(int i=0;i<n;i++){
        int c, ti; cin>>c>>ti;
        if(ti<=t) ans = min(ans, c);
    }

    if(ans==1001) cout<<"TLE"<<endl;
    else cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
N, u, v = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N-1)]
 
#グラフ作成部
graph = [[] for i in range(N+1)]
for i,j in AB:
    graph[i].append(j)
    graph[j].append(i)
 
#深さ優先探索
def dfs(v):
    dist = [-1] * (N+1)
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in graph[v]:
            if dist[w] >= 0:
                continue
            dist[w] = dw
            stack.append(w)
    return dist
 
DU,DV = dfs(u),dfs(v)
 
answer = 0
for u,v in zip(DU[1:],DV[1:]):
    if u < v:
        x = v - 1
        if answer < x:
            answer = x
 
print(answer)

Measured memory_bytes: 43508
n,m=map(int,input().split())
x=list(map(int,input().split()))
if n>=m:
  print(0)
  exit()
kakusa=[]
x.sort()
width=x[-1]-x[0]
for i in range(m-1):
  kakusa.append(x[i+1]-x[i])
kakusa.sort()
for i in range(n-1):
  width-=kakusa[-1-i]
print(width)

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

int Partition(vector<int> &A, int p, int r)
{
	int x = A[r];
	int i = p-1;
	for(int j = p; j < r; j++){
		if(A[j] <= x){
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[i+1], A[r]);
	return i+1;
}


int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}
	
	int q = Partition(A, 0, n-1);
	
	for(int i = 0; i < n; i++){
		if(i == q){
			cout << '[' << A[i] << ']';
		}else{
			cout << A[i];
		}
		if(i == n-1){
			cout << endl;
		}else{
			cout << ' ';
		}
	}
	return 0;
}

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

#define si(v) v.size()
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (n); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

using ll = long long;
using ld = long double;
using namespace std;

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

  string s; cin >> s;
  for (auto &c : s) if (c == ',') c = ' ';

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

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

int main()
{
    double n, ans = 0;
    cin >> n;
    rep(i, n)
    {
        double a;
        cin >> a;
        ans += 1 / a;
    }
    cout << fixed << setprecision(14) << 1.0 / ans << endl;
    return 0;
}

Measured memory_bytes: 3772
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>

using namespace std;

void call(int n) {
	int i = 1;
CHECK_NUM:
	int x = i;
	if (x % 3 == 0) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
INCLUDE3:
	if (x % 10 == 3) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
	x /= 10;
	if (x) goto INCLUDE3;
END_CHECK_NUM:
	if (++i <= n) goto CHECK_NUM;

	cout << endl;
}

int main() {
	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = n - 1; i >= 1; i--) {
		cout << a[i] << ' ';
	}
	cout << a[0] << endl;
	
}

Measured memory_bytes: 1160
import itertools
import sys
input = sys.stdin.readline

L = list(map(int, input().split()))
A, B, C = sorted(L)

ans = 0

if (B - A) % 2 == 0:
    ans += (B-A)//2
    ans += C-B
else:
    ans += (B-A)//2 + 1
    ans += 1
    ans += C - B
print(ans)


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

int gcd(int a,int b){return a==0 ? b : gcd(b%a,a);}

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    a.erase(unique(a.begin(),a.end()),a.end());
    
    if(a.size()==1){
        cout<<(a[0]==k ?  "POSSIBLE" : "IMPOSSIBLE")<<endl;
	return 0;
    }
    
    int dis=-1;

    for(int i=0;i+1<a.size();i++){
        int val=a[i+1]-a[i];
        if(i==0){
            dis=val;
        }
	dis=gcd(dis,val);
    }

    if(gcd(dis,a[0])==1){
        cout<<(k<=a[a.size()-1] ? "POSSIBLE" : "IMPOSSIBLE")<<endl;
    }
    else{
      cout<<(k<=a[a.size()-1] &&  k%dis==a[0]%dis ? "POSSIBLE" :"IMPOSSIBLE")<<endl;
    }
    
    return 0;
}


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

#define S size()
#define E end()
#define B begin()
#define L length()
 
#define endl "\n"
#define cnt count
#define in insert
#define er erase
#define fi first
#define se second
#define fl float
#define ld long double
#define ll long long

#define gcd __gcd
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define all(v) v.B,v.E
#define acc(v) accumulate(all(v), 0)
#define psum partial_sum
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define np next_permutation
#define maxe *max_element
#define mine *min_element
 
#define forl(i,n) for(ll i = 0; i < n; i++)
#define fore(i,m,n) for (ll i = m; i <= n; i++)
#define rforl(i,n) for (ll i = n - 1; i >= 0; i--)
#define rfore(i,m,n) for (ll i = m; i >=n; i--)    
#define iter(s) for(auto it:s)
 

#define prec(n) fixed<<setprecision(n)
#define popcnt(n) __builtin_popcountll(n)
#define parity(n) __builtin_parityll(n)
#define clz(n) __builtin_clzll(n)
#define ctz(n) __builtin_ctzll(n)

#define sll set<ll>
#define sc set<char>
#define mll map<ll,ll>
#define vll vector<ll>
#define vc vector<char>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define msll multiset<ll>
#define msc multiset<char>
#define vvll vector<vector<ll>>
#define rev reverse

#define tc ll q;cin>>q;while(q--)
#define pat ll n;cin>>n;
#define pat1 vll a(n);forl(i,n)cin>>a[i];
#define pat2 ll n,k;cin>>n>>k;vll a;forl(i,n) cin>>a[i];
#define pats string s;cin>>s;
#define yesno if(flag)cout<<"YES\n";else cout<<"NO\n";
#define loop forl(i,n)

#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 MAX LLONG_MAX
#define MIN LLONG_MIN
#define mod1 1000000007
#define mod2 998244353
#define PI 3.1415926535897932384626433832

//**********************************
 vector<ll> res;
void factorize(ll n) {
    ll cnt;
    for (ll i = 2; i * i <= n; ++i) {
        cnt=0;
        while (n % i == 0) {
            cnt++;
            n /= i;
        }
        res.pb(cnt);
    }
    if (n != 1) {
        res.pb(1);
    }
}
ll check(ll a){
    ll i=1;
    while(i*(i+1)/2<a){
        i++;
    }
    if(i*(i+1)/2==a){
        return i;
    }else{
        return i-1;
    }
}
int main(){
    ll n;
    cin>>n;
    factorize(n);
    ll ans=0;
    forl(i,res.size()){
        ans+=check(res[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 11568
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

struct edge {
  int to, cap, rev;
  edge(int to, int cap, int rev) : to(to), cap(cap), rev(rev) {}
};
struct Graph {
  int V;
  vector<vector<edge>> g;
  vector<int> used;
  Graph(int V) : V(V), g(V), used(V) {}
  void add_edge(int from, int to, int cap = 1) {
    g[from].push_back(edge(to, cap, g[to].size()));
    g[to].push_back(edge(from, 0, g[from].size() - 1));
  }
  int augment_path(int s, int t, int f) {
    if (s == t)
      return f;
    used[s] = true;
    rep(i, 0, g[s].size()) {
      edge &e = g[s][i];
      if (used[e.to] or e.cap <= 0)
        continue;
      int d = augment_path(e.to, t, min(f, e.cap));
      if (d > 0) {
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
      }
    }
    return 0;
  }
  int max_flow(int s, int t) {
    int flow = 0;
    while (1) {
      fill(all(used), 0);
      int f = augment_path(s, t, INF);
      if (f == 0)
        break;
      flow += f;
    }
    return flow;
  }
};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  rep(i, 0, H) { cin >> a[i]; }
  int s = H + W, t = s + 1;
  Graph g(H + W + 2);
  auto idx = [&](int x, int y) { return W + x; };

  rep(i, 0, H) rep(j, 0, W) rep(k, 0, H) rep(l, 0, W) {
    if (a[i][j] == 'S' and a[k][l] == 'T') {
      if (i == k or j == l) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  rep(i, 0, H) rep(j, 0, W) {
    if (a[i][j] == 'S') {
      g.add_edge(s, i, INF);
      g.add_edge(s, H + j, INF);
    } else if (a[i][j] == 'T') {
      g.add_edge(i, t, INF);
      g.add_edge(H + j, t, INF);
    } else if (a[i][j] == 'o') {
      g.add_edge(i, H + j);
      g.add_edge(H + j, i);
    }
  }
  cout << g.max_flow(s, t) << endl;

  return 0;
}


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

int main(){
    int N;
    int result = 0;

    cin >> N;

    int V[N], C[N];
    for(int lp=0; lp<N; lp++) cin >> V[lp];
    for(int lp=0; lp<N; lp++) cin >> C[lp];

    for(int lp=0; lp<N; lp++){
        result += V[lp]-C[lp]>0 ? V[lp]-C[lp] : 0;
    }

    //int sum = accumulate(A.begin(), A.end(), 0.0);
    
    cout << result << endl;
}

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

using namespace std;

#define FOE(i, s, t) for (int i = s; i <= t; i++)
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define FOD(i, s, t) for (int i = s; i >= t; i--)

#define LL long long
#define mp make_pair
#define pb push_back

#define K 560001

int n;

int a[K], b[K];

LL ta, tb;
LL allow;

int main() {
	scanf("%d", &n);
	
	FOE(i, 1, n) scanf("%d", &a[i]);
	FOE(i, 1, n) scanf("%d", &b[i]);
	
	FOE(i, 1, n) {
		if (a[i] >= b[i]) {
			ta += (a[i] - b[i]);
		} else {
			ta += (a[i] - b[i]) / 2;	
		}
	}
	
	if (ta <= 0) {
		puts("Yes");	
	} else {
		puts("No");	
	}
}

Measured memory_bytes: 3848
import math
N = int(input())

def f(x,y,z):
    return x*x + y*y + z*z + x*y + y*z + z*x

ans = [0]*(N+1)

# upper = math.ceil(math.sqrt(N/6)) + 1
upper = int(math.sqrt(N)) + 1

for x in range(1, upper+1):
    for y in range(1, upper + 1):
        for z in range(1, upper + 1):
            v = f(x,y,z)
            if v <= N:
                ans[v] += 1
            else:
                break

for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 9136
#include<bits/stdc++.h>
#define ll 				long long
#define ld 				long double
#define fastio 			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) 		cerr<<#x<<" "<<x<<endl
#define cina(a,n) 		for(ll i = 0;i<n;i++)	cin>>a[i];
#define couta(a,n) 		for(ll i = 0;i<n;i++) cout<<a[i]<<" ";
#define fauto(ar)		for(auto x : ar)	cout<<x<<" ";
#define mod 			1000000007
#define inf				100100100100100100
#define siz 			100005
#define f 				first
#define s 				second
#define pb 				push_back
#define endl 			"\n"
#define ci 				cin.ignore()
using namespace std;
int main()
{
	ll n,w,i,j;
	cin>>n>>w;
	ll weight[n],value[n];
	for(i = 0;i<n;i++)	cin>>weight[i]>>value[i];
	
	ll dp[n+1][w+1];
	for(i = 0;i<=n;i++)	dp[i][0] = 0;
	for(i = 0;i<=w;i++)	dp[0][i] = 0;
	
	for(i = 1;i<=n;i++)
	{
		for(j = 1;j<=w;j++)
		{
			// not take the current item
			dp[i][j] = dp[i-1][j];
			
			if(j >= weight[i-1])
			dp[i][j] = max(dp[i][j],value[i-1]+dp[i-1][j-weight[i-1]]);
		}
	}
	cout<<dp[n][w];
}

Measured memory_bytes: 82500
#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<typename T> string join(vector<T> &vec ,string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
vector<int> uf(200010);
int root(int p){
    if(p == uf[p]) return p;
    else{
        
        return uf[p] = root(uf[p]);
    }
}
int main(void){
    int n,m;
    cin >> n >> m;
    n++;
    rep(i,n+1){
        uf[i] = i;
    }
    rep(i,m){
        int a,b;
        cin >> a >> b;
        int rx = root(uf[a]);
        int ry = root(uf[b]);
        if(rx!=ry){
            uf[rx] = ry;
        }
    }
    unordered_map<int,int> mp;
    rep(i,n){
        int p = root(i);
        if(!mp[p]){
            mp[p] = 1;
        }else{
            mp[p]++;
        }
    }
    int max = 0;
    for(auto i=mp.begin();i!=mp.end();i++){
        if(max<i->second) max = i->second;
    }
    cout << max << endl;
}

Measured memory_bytes: 12020
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)

using namespace std;

int calc(vector<int> cup, int m)
{
    int cnt = 0;
    while (1) {
        int i = cnt%2, j = i+1;
        int p = 1;
        while (p <= max(cup[i], cup[j])) p <<= 1;
        p >>= 1;
        if (!p) break;
        cup[i] ^= p;
        cup[j] ^= p;
        cnt++;
        if (cnt > m) return cnt;
    }

    return cnt;
}

int main()
{
    while (1) {
        int n, m; cin >> n >> m;
        if (n == 0 && m == 0) break;
        vector<int> cup(3);
        loop (3, i) {
            int c; cin >> c;
            while (c--) {
                int v; cin >> v;
                cup[i] |= 1 << v--;
            }
        }
        int ans = calc(cup, m);
        swap(cup[0], cup[2]);
        ans = min(ans, calc(cup, m));
        cout << (ans <= m ? ans : -1) << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include<stdio.h>
#define MAXSIZE 10000
#define PI 3.141592653589
using namespace std;
int main(){
  int n;
  std::cin >> n;

  int a[5][4][11]={0};

  for(int i=0;i<n;i++){
    int b,f,r,v;
    std::cin >> b>>f>>r>>v;
    a[b][f][r]+=v;
  }
  for(int i=1;i<4;i++){
    for(int j=1;j<=3;j++){
      for(int k=1;k<=10;k++){
        std::cout <<" "<< a[i][j][k] ;
      }
      std::cout << '\n';
    }
    std::cout << "####################" << '\n';
  }
  for(int j=1;j<=3;j++){
    for(int k=1;k<10;k++){
      std::cout <<" "<< a[4][j][k] ;
    }
    std::cout <<" "<< a[4][j][10] << '\n';
  }

}

Measured memory_bytes: 3092
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL a,b;
    cin >> a >> b;

    cout << a*b - a - b + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
/**
 * 
 */
import java.util.HashSet;
import java.util.Scanner;

/**
 * @author Neeraj
 *
 */
 class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int d;
		int count=0;
		HashSet hs=new HashSet();
		while(k-->0) {
			
			
			
			d=sc.nextInt();
			for(int i=0;i<d;i++) {
			     	hs.add(sc.nextInt());
			}
			
			
		}
		System.out.println(n-hs.size());
	}

}


Measured memory_bytes: 46080
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
using namespace std;


int main(){

  int n; cin >> n;
  vector<int> r(n);
  for (int i=0; i<n; i++) cin >> r[i];

  int ans=INT_MIN;
  int minimum=r[0];

  for (int j=1; j<n; j++){
    ans = max(ans,r[j]-minimum);
    minimum = min(r[j],minimum);
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int no_of_stones, no_of_steps;
    cin >> no_of_stones >> no_of_steps;

    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
        cin >> height[i];

    const int oo = 1e9;
    vector <int> minimum_cost(no_of_stones + 1, oo);
    minimum_cost[1] = 0;

    for(int i = 2; i <= no_of_stones; i++)
    {
        for(int j = i - 1; j >= max(1, i - no_of_steps); j--)
        {
            minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
        }
    }

    cout << minimum_cost[no_of_stones];
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll n;
  cin >> n;
  ll ans = 1001001001001;
  for(ll i = 1;i*i<=n;i++){
    if(n%i!=0) continue;
    ll b = n/i;
    mins(ans,i+b-2);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
# define int long long
# define mo 1000000007
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define fi first
# define se second
signed main()
{
   gok
  string s,t,u;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  cin>>u;
  if(u==s)
    a--;
  if(u==t)
    b--;
  cout<<a<<" "<<b;
   return 0;
}


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

using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int a, b;
    cin >> a >> b;
    if (a == 1) {
        if (b == 2) {
            cout << 3 << EOL;
        } else {
            cout << 2 << EOL; 
        }
    } else if (a == 2) {
        if (b == 1) {
            cout << 3 << EOL;
        } else {
            cout << 1 << EOL; 
        }
    } else {
        if (b == 1) {
            cout << 2 << EOL;
        } else {
            cout << 1 << EOL; 
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, A, B, v[100];
ll dp[100][100];

// return nCr
long long combination(long long n, long long r){
    r = (r < n - r) ? r : n - r;
    long long c = 1;
    for(long long k = 1; k <= r; ++k){
        c = c * n / k;
        n--;
    }
    return c;
}

signed main(){
    cin >> N >> A >> B;
    map<ll, ll> mp, np;
    REP(i, N){
        cin >> v[i];
        mp[v[i]]++;
    }
    sort(v, v + N, greater<ll>());
    vector<ll> C;
    ll n = A, sum = accumulate(v, v + A, 0LL);
    ll max_n = A, max_sum = sum;
    FOR(i, A, B){
        n++;
        sum += v[i];
        if(sum * max_n > max_sum * n){
            max_n = n;
            max_sum = sum;
        }
    }
    n = sum = 0;
    REP(i, A){
        sum += v[i];
        n++;
        np[v[i]]++;
    }
    ll ans = 0;
    FOR(i, A, B + 1){
        if(sum * max_n == max_sum * n){
            ll c = 1;
            for(auto p : np){
                c *= combination(mp[p.first], p.second);
            }
            ans += c;
        }
        sum += v[i];
        n++;
        np[v[i]]++;
    }
    printf("%.9f\n", (double)max_sum / max_n);
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3760
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <stack>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

const int SCC_MAX = 300010;

vector<int> path[SCC_MAX];
vector<int> invpath[SCC_MAX];
stack<int> sta;
bool visited[SCC_MAX];
int SCC_num;
int SCC_ind[SCC_MAX];

void dfs1(int q){
	visited[q] = 1;
	for(vector<int>::iterator it = path[q].begin() ; it != path[q].end() ; ++it){
		if(!visited[*it]) dfs1(*it);
		invpath[*it].push_back(q);
	}
	sta.push(q);
}

void dfs2(int q){
	visited[q] =1;
	SCC_ind[q] = SCC_num;
	for(vector<int>::iterator it = invpath[q].begin() ; it != invpath[q].end() ; ++it){
		if(!visited[*it]) dfs2(*it);
	}
}

void SCC(int n){
	fill(visited,visited+n,0);
	for(int i = 0 ; i < n ; ++i){
		if(!visited[i]) dfs1(i);
	}
	fill(visited,visited+n,0);
	SCC_num = 0;
	while(!sta.empty()){
		if(!visited[sta.top()]){
			dfs2(sta.top());
			++SCC_num;
		}
		sta.pop();
	}
}

const int CM = 1<<15;
int N;
int x[10010][2];
int y[10010][2];
int z[20020];

void def(){
	repp(i,0,CM*4){
		path[i].clear();
		invpath[i].clear();
	}
	repp(i,0,N){
		path[y[i][0]*2].PB(y[i][1]*2+1);
		path[y[i][1]*2].PB(y[i][0]*2+1);
		path[y[i][0]*2+1].PB(y[i][1]*2);
		path[y[i][1]*2+1].PB(y[i][0]*2);
	}
	repp(i,2,CM*2){
		path[i*2].PB(i/2*2);
		path[i/2*2+1].PB(i*2+1);
	}
}

void put(int a , int b , int e , int s , int f , int q){
	if(e <= s || f <= b) return;
	if(s <= b && e <= f){
		path[q*2].PB(a*2+1);
		path[a*2].PB(q*2+1);
	} else {
		put(a*2,b,(b+e)/2,s,f,q);
		put(a*2+1,(b+e)/2,e,s,f,q);
	}
}

bool eval(int c){
	def();
	int l = 0 , r = 0;
	repp(i,0,2*N){
		while(x[z[l]/2][z[l]%2] + c <= x[z[i]/2][z[i]%2]) ++l;
		while(x[z[i]/2][z[i]%2] + c > x[z[r]/2][z[r]%2]) ++r;
		if(l < i) put(1,0,CM,l,i,i+CM);
		if(i+1 < r) put(1,0,CM,i+1,r,i+CM);
	}
	SCC(CM*4);
	repp(i,0,CM*2){
		if(SCC_ind[i*2] == SCC_ind[i*2+1]) return 0;
	}
	return 1;
}

int BS(int a , int b){
	if(b-a<2) return a;
	int c = (a+b) / 2;
	return eval(c) ? BS(c,b) : BS(a,c);
}

bool comp(const int a , const int b){
	return x[a/2][a%2] < x[b/2][b%2];
}

int main(){
	scanf("%d" , &N);
	repp(i,0,N){
		scanf("%d%d" , &x[i][0] , &x[i][1]);
		z[i*2] = i*2;
		z[i*2+1] = i*2 + 1;
	}
	sort(z,z+2*N,comp);
	x[N][0] = x[N][1] = (1e9) * 2 + 1;
	z[2*N] = 2 * N;
	repp(i,0,2*N){
		y[z[i]/2][z[i]%2] = i + CM;
	}
	printf("%d\n" , BS(0,1e9+1));
	return 0;
}


Measured memory_bytes: 49592
import java.util.Scanner;
class Main{
    public void yatary() {
        Scanner sc = new Scanner(System.in);
        int x;
        x = sc.nextInt();
        int y = x *x *x;
     System.out.println(y);   
    }
    public static void main(String[] args){
    new Main().yatary();
    }
}

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

int main(){
        int A,B,C;
        cin >> A >> B >> C;
        if(A + B + C >= 22) cout << "bust" << endl;
        else cout << "win" << endl;
}


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

int main(){
  int N; cin >> N;
  int d[50]; for(int i=0; i<N; i++) cin >> d[i];
  int result=0;
  for(int i=0; i<N-1; i++){
    for(int j=i+1; j<N; j++){
      result+=d[i]*d[j];
    }
  }
  cout << result << endl;
}

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


def read():
    A = input().strip()
    B = input().strip()
    return A, B


def solve(A, B):
    if len(A) > len(B):
        return "GREATER"
    elif len(B) > len(A):
        return "LESS"
    else:
        for i in range(len(A)):
            if int(A[i]) > int(B[i]):
                return "GREATER"
            elif int(B[i]) > int(A[i]):
                return "LESS"
    return "EQUAL"


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


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

int main() {
  int L,amariA,amariB,k,A,B,K,box;
  k=0;
  box=0;
  cin >> A>> B>> K;
  if (A<B){
    L=A;
  }
  else {
    L=B;
  }
  for ( int j=L; j>=1 ; j--){
    if (k==K){
      break;
    }
    else{
      amariA=A%j;
      amariB=B%j;
      if (amariA==0 && amariB==0){
        box=j;
        k++;
      }
    }
  }
  cout << box << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


int main()
{
	ios_base::sync_with_stdio(false);

	ll n, h, ret = 0;
	cin >> n >> h;
	vi a(n), b(n);
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	sort(reall(b));
	sort(reall(a));
	//rep(i, n) cout << a[i] << " ";
	rep(i, n) {
		if (a[0] > b[i])break;
		h -= b[i];
		ret++;
		//cout << h << endl;
		if (h <= 0) break;
	}
	if (h <= 0) {
		cout << ret << endl;
	}
	else {
		cout << ret + (h + a[0] - 1) / a[0] << endl;
	}
	//rep(i,n) cout << a[i];
	return 0;
}

Measured memory_bytes: 1024
# ABC150C - Count Order
from itertools import permutations


def main():
    N = int(input())
    P = tuple(map(int, input().split()))
    Q = tuple(map(int, input().split()))
    perms = list(permutations(range(1, N + 1)))
    ans = abs(perms.index(P) - perms.index(Q))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(ll i=(n);i<(x);++i)
#define rem(i,n,x) for(ll i=(n);i>=(x);--i)
#define SORT(x) sort(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define setp(x) setprecision(x)
using ll = long long;

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

	ll ans = 1e10;
	rep(i, 1, h + 1) {
		ll x = max({ i * w, (h - i) * (w / 2),(h - i) * (w - (w / 2)) })
			- min({ i * w, (h - i) * (w / 2),(h - i) * (w - (w / 2)) });
		ll y = max({ i * w, (h - i) / 2 * w, ((h - i) - ((h - i) / 2)) * w })
			- min({ i * w, (h - i) / 2 * w, ((h - i) - ((h - i) / 2)) * w });
		ans = min({ ans, x, y });
	}
	rep(i, 1, w + 1) {
		ll x = max({ i * h, (w - i) * (h / 2), (w - i) * (h - (h / 2)) })
			- min({ i * h, (w - i) * (h / 2),(w - i) * (h - (h / 2)) });
		ll y = max({ i * h, (w - i) / 2 * h, ((w - i) - ((w - i) / 2)) * h })
			- min({ i * h, (w - i) / 2 * h, ((w - i) - ((w - i) / 2)) * h });
		ans = min({ ans, x, y });
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(x) (int((x).size()))
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
template<typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); }
template<typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); }
typedef long long ll;

int n;
ll x, y;

int main() {
    x = y = 1;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        ll a, b;
        scanf("%lld%lld", &a, &b);
        ll k = std::max((x + a-1) / a, (y + b-1) / b);
        x = a*k;
        y = b*k;
        //printf("%lld %lld\n", x, y);
    }
    printf("%lld\n", x + y);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define rep(i,x,y) for(int (i)=(x);(i)<(y);(i)++)

int main()
{
  while(true){

    char s;

    stack<char> st;
    bool endflag=true;
    bool flag=true;

    while((s=getchar())!='.'){
      endflag=false;
      if(s=='['){
        st.push('[');
      }
      if(s=='('){
        st.push('(');
      }
      if(s==']'){
        if(st.empty()==true){
          flag=false;
          break;
        }else{
          if(st.top()=='['){
            st.pop();
          }else{
            flag=false;
            break;
          }
        }
      }
      if(s==')'){
        if(st.empty()==true){
          flag=false;
          break;
        }else{
          if(st.top()=='('){
            st.pop();
          }else{
            flag=false;
            break;
          }
        }
      }
    }

    if(endflag==true){
      break;
    }
    if(st.empty()==false){
      flag=false;
    }

    if(flag==true){
      cout<<"yes"<<endl;
    }else{
      cout<<"no"<<endl;
    }
    while(getchar()!='\n');
  }

  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cut = 1;
    for(int i=0;i<s.length()-1;i++){
        if(s[i] != s[i+1]) cut++;
    }
    cout << cut << endl;
    
    return 0;
}

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

using namespace std;

int main()
{
   int n,m; cin>>n>>m;
   if(n!=m){
       int val = max(n,m);
       int minc = min(n,m);
       for(int i=0;i<val;i++){
           cout<<minc;
       }
       
   }else{
       for(int i = 0;i<n;i++){
           cout<<m;
       }
   }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,m;
  cin>>n>>m;
  if(n==m)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int N;
    string S;
    cin >> N >> S;
    int ans = 10000000;
    vector<int> b,w;
    char now = '.';
    int a = 0;
    if(S[N-1] == '.') S = S + '#';
    else S = S + '.';
    
    rep(i,N+1){
        if(S[i] == now) a++;
        else{
            //cout << now << a << endl;
            if(now == '.') w.push_back(a);
            else b.push_back(a);
            a = 0;
            now = S[i];
            i--;
        }
    }
    b.push_back(0);
    
    int an = 0;
    rep(i,int(w.size())) an+=w[i];
    ans = an;
    rep(i,int(w.size())){
        an -= w[i];
        ans = min(ans, an);
        an += b[i];
    }
    
    cout << ans << endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 1656
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e;
    while(~scanf("%d %d",&a,&b))
    {

        if(a==0&&b==0)
        {
            printf("0\n");
        }
        else
        {
            c=a+b;
            d=a-b;
            e=a*b;
            if(c>=d&&c>=e)
                printf("%d\n",c);
            else if(d>=c&&d>=e)
                printf("%d\n",d);
            else if(e>=c&&e>=d)
                printf("%d\n",e);
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)



ll n, x[200005], y[200005];

ll cnt(ll z){
    ll p = n - 1, sum = 0;
    
    REP(i, n){
        while(p >= 0){
            if(x[i] + y[p] < z)break;
            p--;
        }
        sum += (p + 1);
    }
    
    return sum;
}

int main() {
    cin >> n;
    
    vector<ll> a(n), b(n);
    REP(i, n){
        cin >> a[i];
    }
    REP(i, n){
        cin >> b[i];
    }
    
    ll ans = 0;
    REP(i, 29){
        REP(j, n){
            x[j] = a[j] & ((1 << (i + 1)) - 1);
            y[j] = b[j] & ((1 << (i + 1)) - 1);
        }
        
        sort(x, x + n);
        sort(y, y + n);
        
        ll c = cnt(4 << i) - cnt(3 << i) + cnt(2 << i) - cnt(1 << i);
        if (c % 2 == 1){
            ans += (1 << i);
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long


signed main(){
  int n,x;
  cin>>n>>x;
  int l[100];
  rep(i,n){
    cin>>l[i];
    if(i!=0) l[i]+=l[i-1];
  }
  rep(i,n){
    if(l[i]>x){cout<<i+1<<endl;return 0;}
  }
  cout<<n+1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
const int MaxN = 2e5;
typedef long long LL;
using namespace std;
char s[MaxN + 5];
int vis[200];
int main()
{
	while(~scanf("%s", s + 1)){
		int len = strlen(s + 1);
		LL res = 0;
		memset(vis, 0, sizeof(vis));
		for(int i = 1;i <= len;i++){
			res += (i - vis[s[i]] - 1);
			vis[s[i]]++;
		}
		printf("%lld\n", res + 1);
	}
}

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

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

typedef long long ll;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

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

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    UnionFind uf(N);
    rep(i, M){
        int a, b; cin >> a >> b;
        uf.merge(a-1, b-1);
    }
    set<int> ans;

    rep(i, N){
        if(ans.count(uf.root(i)) == 0){
            ans.insert(uf.root(i));
        }
    }
    cout << ans.size()-1 << endl;
    return 0;
}

Measured memory_bytes: 7612
import sys
def main():
    input = sys.stdin.readline
    H,W,N = map(int, input().split())
    start = tuple(map(int, input().split()))
    S = input().rstrip()
    T = input().rstrip()
    D = {
        'R': (0,1),
        'L': (0,-1),
        'U': (-1,0),
        'D': (1,0)
    }
    Dc = ['R', 'L', 'U', 'D']

    def move(current, direction):
        d = D[direction]
        return (current[0]+d[0], current[1]+d[1])

    def is_dropped(a):
        return not (1<=a[0]<=H and 1<=a[1]<=W)

    ans = True
    for i in range(4):
        cur = start
        for j in range(N):
            if S[j] == Dc[i]:
                cur = move(cur, Dc[i])
                if is_dropped(cur): ans = False
            if T[j] == Dc[i^1]:
                cur = move(cur, Dc[i^1])
                if is_dropped(cur): cur = move(cur, Dc[i])
    print('YES' if ans else 'NO')

if __name__ == '__main__':
    main()

Measured memory_bytes: 45648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

ll n, a, b;

int main() {
	cin >> n >> a >> b;
	if (a > b) {
		cout << 0 << endl;
		return 0;
	}
	if (a != b&&n == 1) {
		cout << 0 << endl;
		return 0;
	}
	cout << 1 + ((n - 1)*b + a) - ((n - 1)*a + b) << endl;
}



Measured memory_bytes: 256
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

k,x=mp()
m=max(-1000000,x-(k-1))
M=min(1000000,x+k-1)
print(*[i for i in range(m,M+1)])

Measured memory_bytes: 10352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> to(n);
    map<P, int> mp;
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
        mp[make_pair(a, b)] = i;
        mp[make_pair(b, a)] = i;
    }
    int m;
    cin >> m;
    vector<int> v(m), u(m);
    rep(i, m){
        cin >> v[i] >> u[i];
        v[i]--; u[i]--;
    }
    vector<ll> b(m);
    rep(i, m){
        vector<int> p(n, -1);
        queue<int> que;
        que.push(v[i]);
        while(!que.empty()){
            int x = que.front();
            que.pop();
            for(int t : to[x]){
                if(p[t] != -1 || t == v[i])continue;
                p[t] = x;
                que.push(t);
            }
        }
        ll sum = 0;
        int s = u[i];
        while(s != v[i]){
            int t = p[s];
            int k = mp[make_pair(s, t)];
            sum += ((ll)1 << k);
            s = t;
        }
        b[i] = sum;
    }
    ll ans = ((ll)1 << (n-1));
    for(ll i = 1; i < (1 << m); i++){
        ll sum = 0;
        int sign = 0;
        rep(j, m)if(1 & (i >> j)){
            sum |= b[j];
            sign++;
        }
        int cnt = 0;
        rep(j, n)if(1 & (sum >> j))cnt++;
        if(sign % 2 == 1)ans -= ((ll)1 << (n-1-cnt));
        else ans += ((ll)1 << (n-1-cnt));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256