akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  while(1){
    int n,a,b;
    cin>>n>>a>>b;
    if(!n)break;
    vector<bool> v(n+1,false);
    v[0]=true;
    for(int i=0;i<n;++i){
      if(v[i]){
        if(i+a<=n){
          v[i+a]=true;
        }
        if(i+b<=n){
          v[i+b]=true;
        }
      }
    }
    cout<<count(begin(v),end(v),false)<<endl;
  }
  return 0;
}

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

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main() {
    int n;
    while(1){
        cin>>n;
        if(n==0)return 0;
        vector<vector<int>> v(n+1,vector<int>(n+1,0));
        
        rep(i,0,n){
            int sum=0;
            rep(j,0,n){
                cin>>v[i][j];
                sum+=v[i][j];
            }
            v[i][n]=sum;
        }
        
        rep(j,0,n+1){
            int sum=0;
            rep(i,0,n){
                sum+=v[i][j];
            }
            v[n][j]=sum;
        }
        
        rep(i,0,n+1){
            rep(j,0,n+1){
                if(j==0)printf("%5d",v[i][j]);
                else printf("%5d",v[i][j]);
            }
            cout<<endl;
        }
        
        
    }
    return 0;
}




Measured memory_bytes: 3268
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    string s;

    cin >> s;
    cout << s;
    if( s[s.length()-1] == 's'){
        cout << "e";
    }
    cout << "s" << endl;
    return 0; 
}


Measured memory_bytes: 3616
D = [[[-1, -1], [0, -1], [1, -1], [1, 0], [0, 1], [-1, 0]],
     [[-1,  0], [0, -1], [1,  0], [1, 1], [0, 1], [-1, 1]]]

w, h = gets.split.map(&:to_i)
fld = (h+2).times.map{ [false]*(w+2) }
(1..h).each do |i|
  gets.split(" ").each_with_index{ |e, j| fld[i][j+1] = true if e == "1" }
end

tmp = (h+2).times.map{ [false]*(w+2) }
arr = []
arr << [0, 0]
tmp[0][0] = true
until arr.empty?
  y, x = arr.shift
  D[y%2].each do |dy, dx|
    u = y + dy; v = x + dx
    next if u < 0 || u > h+1 || v < 0 || v > w+1
    if !fld[u][v] && !tmp[u][v]
      tmp[u][v] = true
      arr << [u, v]
    end
  end
end
fld = fld.flatten.zip(tmp.flatten).map{ |f, t| !(!f & t) }
sum = 0
fld.each_with_index{ |e, i| sum += D[(i/(w+2))%2].count{ |y, x| !fld[i+y*(w+2)+x] } if e }
p sum

Measured memory_bytes: 9324
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x; scanf("%d", &x); return x;	
}
const int maxn = 3e5 + 10;
const int INF = 1e9;
int mod = 1e9 + 7;
using namespace std;
int n, k;
double a[maxn];
const double eps = 1e-6;
bool check(double mid) {
	double G = 0;
	for (int i = 1; i <= n; ++i) G += ceil(a[i] / mid);
	return G <= k + n;
}
int main() {
	#ifdef LOCAL
		freopen("1.in", "r", stdin);
	#endif
	n = read(), k = read();
	for (int i = 1; i <= n; ++i) a[i] = read();
	double L = 0, R = 1e9;
	double ans = 0;
	while (L + eps < R) {
		double mid = (L + R) / 2.0;
		if (check(mid)) ans = mid, R = mid;
		else L = mid;
	}
//	printf("%.10f\n", ans);
//	cout << check(ans) << endl;
//	cout << "C5=" << ceil(5.0) << endl;
	printf("%.0f", ceil(L));
	return 0;	
}
 	

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

template<class t> void vin(vector<t>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<double> l(n), a(n), b(n);
    rep(i, n) cin >> l[i] >> a[i] >> b[i];
    double ans = 0;
    rep(bi, 1<<n) {
        int tmp = __builtin_popcount(bi);
        if (tmp != m) continue;
        bitset<20> bit(bi);
        double sum = 0;
        rep(i, n) {
            for (int j=i+1; j<n; ++j) {
                if (bit[i] == bit[j] and bit[i] == 1) {
                    sum += (l[i]-l[j])*(l[i]-l[j]) + (a[i]-a[j])*(a[i]-a[j]) + (b[i]-b[j])*(b[i]-b[j]);
                }
            }
        }
        ans = max(ans, sum);
    }
    printf("%.10f\n", ans);
    return 0;
}



Measured memory_bytes: 3264
import sys

def p(x, y):
    return x + y

def m(x, y):
    return x - y

A, B, C, D = map(int, raw_input())
for f1, c1 in ([p, '+'], [m, '-']):
    for f2, c2 in ([p, '+'], [m, '-']):
        for f3, c3 in ([p, '+'], [m, '-']):
            if f3(f2(f1(A, B), C), D) == 7:
                print "%d%s%d%s%d%s%d=7" % (A, c1, B, c2, C, c3, D)
                sys.exit()



Measured memory_bytes: 2568
using System;
class a
{
    public static void Main()
    {
        string s = Console.ReadLine();
        if (s[0] == s[1])
        {
            if (s[2] == s[3]&&s[0]!=s[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");

            }
        }
        else if (s[0] == s[2])
        {
            if (s[1] == s[3]&&s[0]!=s[1])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        else if (s[0] == s[3])
        {
            if (s[1] == s[2]&&s[0]!=s[1])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();
		int x = x2 - x1;
		int y = y2 - y1;
		System.out.print(x2 - y);
		System.out.print(" ");
		System.out.print(y2 + x);
		System.out.print(" ");
		System.out.print(x1 - y);
		System.out.print(" ");
		System.out.print(y1 + x);
		System.out.println();
	}
}


Measured memory_bytes: 23380
#include<stdio.h>

int main(void) {
   long long n, i, max=-1000005, min=1000005, sum=0;
   int x[10000];

   scanf("%lld", &n);
   for (i=1;i<=n;i++){
     scanf("%d", &x[i]);
     if(x[i]>max) max=x[i];
     if(x[i]<min) min=x[i];
     sum+=x[i];
   }

   printf("%lld %lld %lld\n", min, max, sum);
   return 0;
}


Measured memory_bytes: 2760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	
	public static final int MAX = 1000000;
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int t = sc.nextInt();
		
		long[] p = new long[MAX + 1];
		long[] f = new long[MAX + 1];
		
		for(int i = 0; i <= MAX; i++){
			p[i] = 1L;
			f[i] = i;
		}
		
		for(int i = 2; i <= MAX; i++){
			if(p[i] > 0){
				f[i] -= f[i] / i;
				
				for(int j = 2 * i; j <= MAX; j += i){
					p[j] = 0;
					f[j] -= f[j] / i;
				}
			}
		}
		
		long[] sum = new long[MAX + 1];
		sum[0] = f[0] + 1;
		for(int i = 1; i <= MAX; i++){
			sum[i] = f[i] + sum[i - 1];
		}
		
		for(int tt = 0; tt < t; tt++){
			final int n = sc.nextInt();
			
			//System.out.println(f[n]);
			System.out.println(sum[n]);
		}
	}
	
	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;
		
		public Scanner(InputStream is) throws IOException{
			br = new BufferedReader(new InputStreamReader(is));
			getLine();
		}
		
		private void getLine() throws IOException{
			while(tok == null || !tok.hasMoreTokens()){
				tok = new StringTokenizer(br.readLine());
			}
		}
		
		private boolean hasNext(){
			return tok.hasMoreTokens();
		}
		
		public String next() throws IOException{
			if(hasNext()){
				return tok.nextToken();
			}else{
				getLine();
				return tok.nextToken();
			}
		}
		
		public int nextInt() throws IOException{
			if(hasNext()){
				return Integer.parseInt(tok.nextToken());
			}else{
				getLine();
				return Integer.parseInt(tok.nextToken());
			}
		}
		
		public long nextLong() throws IOException{
			if(hasNext()){
				return Long.parseLong(tok.nextToken());
			}else{
				getLine();
				return Long.parseLong(tok.nextToken());
			}
		}
		
		public double nextDouble() throws IOException{
			if(hasNext()){
				return Double.parseDouble(tok.nextToken());
			}else{
				getLine();
				return Double.parseDouble(tok.nextToken());
			}
		}
	}

}

Measured memory_bytes: 48024
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int main(){

    int N;
    cin>>N;

    cout<<3*N*N<<endl;

    return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

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

int n, a[100001];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    rep(i, n - 1) a[i + 1] += a[i];
    int res = 0;
    rep(i, n) {
        if(a[n - 1 - i] * 2 >= a[n - i] - a[n - 1 - i]) ++res;
        else break;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
  char s[4];
  int is[4], month = 12;
  scanf("%s", s);
  for(int i = 0; i < 4; i++) is[i] = s[i] - '0';

  if(10*is[0] + is[1] <= month && 10*is[0] + is[1] != 0) {
    if(10*is[2] + is[3] <= month && 10*is[2] + is[3] != 0) printf("AMBIGUOUS");
    else printf("MMYY");
  }
  else if(10*is[2] + is[3] <= month && 10*is[2] + is[3] != 0) printf("YYMM");
  else printf("NA");
}

Measured memory_bytes: 128
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
Scanner s = new Scanner(System.in);
		int N = Integer.valueOf(s.next());
		int X = Integer.valueOf(s.next());
		int T = Integer.valueOf(s.next());
		
		int Time = 0;
		if(N % X == 0) {
			Time = (N / X) *T;
			
		}else {
			Time = (N / X + 1) * T;
		}
		
		System.out.println(Time);
	}
}

Measured memory_bytes: 35616
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
    x=min(a[i],b[i])
    a[i]-=x
    b[i]-=x
    ans+=x
    y=min(a[i+1],b[i])
    a[i+1]-=y
    b[i]-=y#not neccesary 
    ans+=y
print(ans)






Measured memory_bytes: 19116
N, K = map(int, input().split())
MOD = 998244353

lr = []
for _ in range(K):
    l, r = map(int, input().split())
    lr.append((l, r))
lr.sort()

dp = [0]*(N+1)
dpsum = [0]*(N+1)
dp[1] = 1
dpsum[1] = 1

# 区間の合計を複数回求める＝累積和
# 累積和を作りながらDPをする
for i in range(2, N+1):
    # マスiに移動できる数を求める
    for l, r in lr:
        # iの左側からiへ移動できる区間を求めるので、
        # lとrは逆になる
        li = max(i-r, 1)
        ri = i-l

        # 右のマスが0以下なら移動できないので次へ
        if ri < 1:
            continue

        dp[i] += dpsum[ri]-dpsum[li-1]
        dp[i] %= MOD
    dpsum[i] = dpsum[i-1]+dp[i]
print(dp[N])


Measured memory_bytes: 28004
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
int c=0,b=0;
int a[2];
for(int i=0;i<=2;i++)
cin>>a[i];;
for(int i=0;i<3;i++){
if(a[i]==5)
b++;
if(a[i]==7)
c++;}
if(b==2&&c==1)
cout<<"YES";
else
cout<<"NO";
system("pause");
return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    ll s = a+b+c;
    if(k%2 == 0){
        ll aa = k*s-b-c;
        ll bb = k*s-a-c;
        ll cc = k*s-a-b;
        a = aa;
        b = bb;
        c = cc;
    }
    else{
        ll aa = k*s-a;
        ll bb = k*s-b;
        ll cc = k*s-c;
        a = aa;
        b = bb;
        c = cc;
    }

    if(1e18 < abs(a-b)) cout << "Unfair" << endl;
    else                cout << a-b << endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	long int N,K,S[101],B,i,j,flag;
	
	while(0<=scanf("%ld%ld",&N,&K)){
		if(N==0 && K==0){
			break;
		}
		
		for(i=1;i<=K;i++){
			scanf("%ld",&S[i]);
		}
		
		for(i=1;i<=N;i++){
			for(j=1;j<=K;j++){
				scanf("%ld",&B);
				S[j]=S[j]-B;
			}
		}
		
		flag=0;
		for(i=1;i<=K;i++){
			if(S[i]<0){
				flag=1;
			}
		}
		
		if(flag==1){
			printf("No\n");
		}else{
			printf("Yes\n");
		}
	}
	return 0;
}

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

int main(){
  while(1){
  int d,e;
  double  mini=10000000;
  cin>>d>>e;
  if(d+e==0) break;
  for(int i=0;i<=d;i++)mini=min(fabs(sqrt(pow(i,2)+pow(d-i,2))-e),mini);
  printf("%f\n",mini);
  }
  return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;
#define pprint(A,y,m,n) rep(J,0,m){print(A[J],y,n);}
const long mod=1e9+7;
const int size=1e5+1;
const int inf=1e9+1;
int main(){
	int N; cin>>N;
	int c[N]; int p;
	rep(i,0,N){ cin>>p; c[p-1] = i - N + inf; }
	int a[N],b[N]; a[0] = 1; b[0] = c[0] - 1;
	rep(i,1,N){
		if(c[i-1] < c[i]){
            b[i] = b[i-1] - 1;
            a[i] = c[i] - b[i];
        }else{
            a[i] = a[i-1] + 1;
            b[i] = c[i] - a[i];
        }
	}print(a,,N);print(b,,N);
}

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

int main(){
  int a, b, c, d, L, R;
  cin >> a >> b>> c>> d;
  L = a+ b;
  R = c+d;
  if (L > R){
    cout << "Left" << endl;
  }
  else if(L==R){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

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

int main()
{
  int i, paint = 0;
  size_t len;
  char s[100000+1];

  if (scanf("%s", s) == EOF) {
    return -1;
  }

  len = strlen(s);
  for (i = 1; i < len; i++) {
    if (s[i - 1] == s[i]) {
      if (s[i] == '0')
        s[i] = '1';
      else
        s[i] = '0';
      paint++;
    }
  }

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

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
ll A[MAX_N],B[MAX_N];
map<ll,ll> C;

int main()
{
	int N;
	ll M;
	cin >> N >> M;
	rep(i,N)
	{
		cin >> A[i];	
		A[i] %= M;
	}

	B[0] = 0;
	rep(i,N)
	{
		B[i+1] = (B[i] + A[i]) % M;
	}
	ll ans = 0;
	C[B[0]]++;
	rep(i,N)
	{
		ans += C[B[i+1]];
		C[B[i+1]]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

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

typedef long long ll;

int main(void) {
    int x;
    cin >> x;
    cout << x*x*x <<endl;

    return 0;
}

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

using namespace std;


int mod = 1e9 + 7;
const int N = 1e6+ 2;
int p[N];

void init() {
	int e = sqrt(N) + 2;
	for (int i = 2; i <= e; ++i) {
		if (!p[i]) {
			for (int j = i * i; j < N; j += i)  {
				p[j] = i;
			}
		}
	}
}

signed main() {
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	init();
	// for (int i = 2; i < 100; ++i) cout << p[i] << " ";
	set<int> s;
	int gcd = a[0];
	bool k = false;
	int cnt = 0;
	for (int it : a) {
		if (it == 1) ++cnt;
	}
	if (cnt >= n-1) {
		cout << "pairwise coprime";
		return 0;
	}
	for (int i : a) {
		gcd = __gcd(gcd, i);
		int it = i;
		if (it == 1) continue;
		vector<int> tmp;
		while (p[it] > 0) {
			if (s.count(p[it])) k = true;
			tmp.push_back(p[it]);
			it /= p[it];
		}
		tmp.push_back(it);
		if (s.count(it)) k = true;
		for (int pr : tmp) {
			if (!s.count(pr)) s.insert(pr);
		}
	}
	if (gcd != 1) cout << "not coprime";
	else if (k) cout << "setwise coprime";
	else cout << "pairwise coprime";
	cout << endl;
}


Measured memory_bytes: 14728
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    int N;
    read(N);
    vector<int> h(N);
    for(int i = 0; i < N; i++){
        read(h[i]);
    }
    int ans = 0;
    while(true){
        int l = 0;
        while(true){
            while(l < N && h[l] == 0) {
                l++;
            }
            if(l >= N) {
                break;
            }
            int r = l;
            while(r < N && h[r] != 0) {
                h[r]--;
                r++;
            }
            ans++;
            l = r;
        }
        bool f = true;
        for(int i = 0; i < N; i++){
            if(h[i]) f = false;
        }
        if(f) break;
    }
    write(ans);
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MAX = 3000000;
const ll MOD = 1000000007;
//string s;
ll x;

int main() {
    cin >> x;
    ll a=0;
    ll b=0;
    bool checked = false;
    for(ll i=1;i<1001;i++){
        ll i5 = i*i*i*i*i;
        for(ll j=-1000;j<1001;j++){
            ll j5 = j*j*j*j*j;
            if(i5 - j5 == x){
                a = i;
                b = j;
                checked = true;
            }
            if(checked)break;
        }
        if(checked)break;
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 3592
program bm
    implicit none
    character(99)::S
    logical::CHECK=.TRUE.
    integer::L
    integer::i
    read*,S
    L=len_trim(S)
    do i=1,L/2
        if(S(i:i)/=S(L-i+1:L-i+1))Check=.false.
    end do
    do i=1,(L/2)/2
        if(S(i:i)/=S(L/2-i+1:L/2-i+1))check=.false.
    end do
    print"(A)",trim(merge("Yes","No ",check))
end program bm

Measured memory_bytes: 768
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const int MAX_V = 2503;
const int INF = INT_MAX;

typedef pair<ll, int> P;
int V;

struct Edge {
  int to;
  ll cap;
  ll cost;
  int rev;

  Edge(int to = -1, ll cap = -1, ll cost = -1, int rev = -1) {
    this->to = to;
    this->cap = cap;
    this->cost = cost;
    this->rev = rev;
  }
};

vector <Edge> G[MAX_V];
ll h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V];
int preve[MAX_V];

void add_edge(int from, int to, ll cap, ll cost) {
  G[from].push_back(Edge(to, cap, cost, G[to].size()));
  G[to].push_back(Edge(from, 0, -cost, G[from].size() - 1));
}

ll min_cost_flow(int s, int t, ll flow_limit) {
  ll f = 0;
  ll totalCost = 0;
  fill(h, h + MAX_V, 0);

  while (f < flow_limit) {
    // fprintf(stderr, "f: %d\n", f);
    priority_queue<P, vector<P>, greater<P>> pque;
    fill(dist, dist + V, INF);
    dist[s] = 0;
    pque.push(P(0, s));

    while (!pque.empty()) {
      P p = pque.top();
      pque.pop();
      int v = p.second;
      if (dist[v] < p.first) continue;

      for (int i = 0; i < (int) G[v].size(); ++i) {
        Edge *edge = &G[v][i];
        if (edge->cap <= 0) continue;

        ll cost = edge->cost + h[v] - h[edge->to];
        if (dist[edge->to] - dist[v] > cost) {
          dist[edge->to] = dist[v] + cost;
          prevv[edge->to] = v;
          preve[edge->to] = i;
          pque.push(P(dist[edge->to], edge->to));
        }
      }
    }

    if (dist[t] == INF) {
      return -1;
    }

    for (int v = 0; v < V; ++v) {
      h[v] += dist[v];
    }

    ll c = flow_limit - f;
    for (int v = t; v != s; v = prevv[v]) {
      c = min(c, G[prevv[v]][preve[v]].cap);
    }

    f += c;
    totalCost += c * h[t];

    // fprintf(stderr, "h[s]: %d, h[t]: %d, cost: %d, prev_cost: %d\n", h[s], h[t], cost, prev_cost);

    for (int v = t; v != s; v = prevv[v]) {
      Edge *edge = &G[prevv[v]][preve[v]];
      edge->cap -= c;
      G[v][edge->rev].cap += c;
    }
  }

  return totalCost;
}

int main() {
  ll GETA = 1'000'000'000;
  int N, K;
  cin >> N >> K;
  V = 2 * N + 2;

  int s = 2 * N;
  int t = 2 * N + 1;

  add_edge(s, t, N * K, GETA);

  for (int i = 0; i < N; ++i) {
    add_edge(s, i, K, 0);
    add_edge(N + i, t, K, 0);
  }

  ll a;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> a;

      add_edge(i, N + j, 1, GETA - a);
    }
  }

  auto res = min_cost_flow(s, t, N * K);
  vector<string> grid(N, string(N, '.'));

  cout << N * K * GETA - res << endl;

  for (int i = 0; i < N; ++i) {
    // int j = N + i;

    for (Edge edge : G[i]) {
      // fprintf(stderr, "i: %d, to: %d, cap: %lld\n", i, edge.to, edge.cap);
      if (edge.to == t) continue;
      if (edge.cap != 0) continue;

      grid[i][edge.to - N] = 'X';
    }
  }

  for (int i = 0; i < N; ++i) {
    cout << grid[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3960
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000






int main() {
	vector<int>a;
	map<int, int>mp;
	int n, x, ans;
	scanf("%d", &n);
	f(i, n) {
		scanf("%d", &x);
		a.push_back(x);
		mp[x] = i;
	}
	sort(a.begin(), a.end());
	ans = 0;
	f(i, n) {
		x = (mp[a[i]]) % 2;
		if (i % 2 != x)ans++;
	}
	ans /= 2;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 5368
use proconio::input;
use proconio::marker::Chars;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused)]
const ALPHA_SMALL: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
#[allow(unused)]
const ALPHA: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];

const MOD: usize = 1_000_000_000 + 7;

fn main() {
    input!(N: usize);
    input!(A: [usize; N]);
    let mut sum = vec![0; N + 1];
    for i in 0..N {
        sum[i + 1] = sum[i] + A[i];
        sum[i + 1] %= MOD;
    }

    let mut ans = 0;
    for i in 0..N - 1 {
        let mut t = A[i] * (sum[N] + (MOD - sum[i + 1]));
        //println!("i = {}, t = {}", i, t);
        t %= MOD;
        ans += t;
        ans %= MOD;
    }

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


Measured memory_bytes: 7196
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

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

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<LL> a(1<<n);
		REP(i,1<<n){
			cin >> a[i];
		}
		vector<LL> v;
		while(SZ(a) > 1){
			dpite(ALL(a));
			v.clear();
			REP(i,SZ(a)/2){
				v.push_back(abs(a[i*2]-a[i*2+1]));
			}
			swap(a,v);
		}
		cout << a[0] << endl;
	}
	return 0;
}


Measured memory_bytes: 3448
#include<stdio.h>
int main()
{
    char s[103];
    scanf("%s",s);
    int l,i,c=0;
    l=strlen(s);
    for(i=0;i<l/2;i++)
    {
        if(s[i]!=s[l-i-1])
            c++;
    }
    printf("%d\n",c);
}


Measured memory_bytes: 128
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <deque>
#include <limits>
#include <numeric>
#include <boost/math/common_factor_rt.hpp>


#define INF 100000000
#define MOD 1000000007

#define ll long long

using namespace std;


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

	int max = 100;

	for (int posY = 0; posY <= max; posY++)
	{
		for (int posX = 0; posX <= max; posX++)
		{
			int needH = -1;

			for (int i = 0; i < n; i++)
			{
				if (h[i] > 0) {
					int tmp = h[i] + abs(posY - y[i]) + abs(posX - x[i]);
					if (needH == -1) {
						needH = tmp;
					}
					else {
						if (needH != tmp) {
							needH = -2;
							break;
						}
					}
				}
			}
			if (needH == -2)continue;

			for (int i = 0; i < n; i++)
			{
				if (h[i] == 0) {
					int dist = abs(posY - y[i]) + abs(posX - x[i]);
					if (needH > dist) {
						needH = -2;
						break;
					}
				}
			}

			if (needH == -2)continue;

			cout << posX << " " << posY << " " << needH << endl;
			return 0;
		}
	}
	
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int x_price_per_liter;
  while(~scanf("%d",&x_price_per_liter)){
    int y_base_price;
    int y_upper_limit;
    int y_additional_price;
    int consumption_amount;
    scanf("%d",&y_base_price);
    scanf("%d",&y_upper_limit);
    scanf("%d",&y_additional_price);
    scanf("%d",&consumption_amount);
    printf("%d\n",min(consumption_amount * x_price_per_liter,
                    y_base_price + (consumption_amount <= y_upper_limit ? 0 : (consumption_amount - y_upper_limit) * y_additional_price)));
  }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

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

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(0, c - (a - b)) << endl;
    
    return 0;
}



Measured memory_bytes: 3596
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(){
    string s,t;
    cin >> s >> t;
    int ans = 0;
    rep(i,s.size()){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3888
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;cin>>n;
    vector<ll> v(n);
    for(ll &i:v)cin>>i;
    for(int i=0;i<n;i++)v[i]-=i;
    ll ans=0;
    map<ll,int> m;
    for(int i=n-1;i>=0;i--){
        ll cur=v[i]+2*i;
        ans+=m[cur*-1]*1ll;
        m[v[i]]++;
    }
    cout<<ans;
}

Measured memory_bytes: 27460
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define chmax(x,y) x = max(x, y)

int main() {
    int n, m ;   
    cin >> n >> m ;
    vector<vector<ll>> dp(m+1, vector<ll> (n+1, INF)) ;
    rep(i, m+1){
        dp[i][0] = 0; 
    }
    int c[m] ;
    rep(i, m){
        cin >> c[i];
    }
    rep(i, m){
        rep(j, n+1){
            if(j < c[i]){
                dp[i+1][j] = dp[i][j] ;
            }
            else {
                dp[i+1][j] = min(dp[i][j], dp[i+1][j - c[i]] + 1) ;
            }
        }
    }
    cout << dp[m][n] << endl ;
} 


Measured memory_bytes: 11536
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a,b;//这题范围到了eee三个10^9,合起来可能有10^18,一定要开long long
    cin>>n>>a>>b;
    if(n>1&&b>=a||n==1&&a==b)//本题精华之特判,n=1的时候最大数和最小数必须一致,因为只有一个数,其他的时候就只要满足a>=b即可
        cout<<(n-2)*(b-a)+1<<endl;//按照(n-2)*(a-b)+1的思路打的代码,其实我也想到了(笑)
    else
        cout<<0<<endl; 
 } 

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
# include <bits/stdc++.h>
using namespace std;
long long powerexp(long long base, long long exp, int mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
int gcd(int a, int b)
{
    int c = a % b;
    while(c != 0)
    {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}
void PrintVector(vector<long long int> v,long long int n)
{
 
    for(int i=v.size()-1;i>=0;i--)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
void Takevector(vector<long long int> &v,long long int n)
{
  for(long long int i=0;i <n;i++)
  { long long int number;
    cin>>number;
    v.push_back(number);
  }
}
typedef long long int ll;
typedef vector<long long int> vi;
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define scl(x)         ll x;       scanf("%lld", &x);
#define scll(x, y)     ll x, y;    scanf("%lld %lld", &x, &y);
#define sclll(x, y, z) ll x, y, z; scanf("%lld %lld %lld", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
#define nl cout<<"\n";
int min(int x, int y)  
{  
    return (x < y)? x: y;  
      
}  
int main()
{
  ll tot=0;
  string s;
  cin>>s;
  string str1,str2;
  int k=s.size()-2;
  while(k)
  {
    str1=s.substr(0,k/2);
    str2=s.substr(k/2,k/2);
   // cout<<str1<<" "<<str2<<endl;
    if(str1==str2)
    {
      cout<<k;
      break;
    }
    k-=2;
  }

  
    return 0;

  
  
}

Measured memory_bytes: 256
ss = list(input())
tt = list(input())

ss.sort()
tt.sort(reverse = True)
s1 = ''
t1 = ''
ans = []
for i in ss:
    s1 += i
ans.append(s1)     
for i in tt:
    t1 += i 
ans.append(t1)
ans.sort()
num = ans.index(t1)
if num == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll h, w, a, b;
    cin >> h >> w >> a >> b;
    vector<vector<ll>> ans(h, vector<ll>(w, 0));
    for(ll i = 0; i < h; i++){
        for(ll j = 0; j < w; j++){
            if(i < b && j < a) ans[i][j] = 1;
            if(i < b && j >= a) ans[i][j] = 0;
            if(i >= b && j < a) ans[i][j] = 0;
            if(i >= b && j >= a) ans[i][j] = 1;
        }
    }
    for(ll i = 0; i < h; i++){
        for(ll j = 0; j < w; j++){
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}


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

bool isPrime(int X) {
    bool can = true;
    for (int i = 2; i < X; i++) {
        if (X % i == 0) can = false;
    }
    return can;
}

int main() {
    int X;
    cin >> X;
    if (isPrime(X)) cout << X << endl;
    else {
        int ans = X+1;
        while(isPrime(ans) == false) {
            ans ++;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
// scanf
#pragma warning(disable: 4996)


/*
	v:vector  type:型  order:greater or less
*/
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
/*
	v:vector  default_value:初期値
*/
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
/*
	丸め
*/
#define _round(v) round(v)
/*
	2乗 / 3乗  default_value:初期値
*/
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)


int main()
{
	int n, k, x, y;
	cin >> n >> k >> x >> y;

	int result = n * x - ((n > k) ? (n-k)*(x-y):0);

	printf("%d\n", result);
	return 0;
	//	std::cout << "Hello World!\n"; 
}


Measured memory_bytes: 256
"""
UnionFind
"""
class UnionFind:
    def __init__(self, n: int) -> None:
        self.forest = [-1] * n

    def union(self, x: int, y: int) -> None:
        x = self.findRoot(x)
        y = self.findRoot(y)
        if x == y:
            return
        if self.forest[x] > self.forest[y]:
            x,y = y,x
        self.forest[x] += self.forest[y]
        self.forest[y] = x
        return

    def findRoot(self, x: int) -> int:
        if self.forest[x] < 0:
            return x
        else:
            self.forest[x] = self.findRoot(self.forest[x])
            return self.forest[x]

    def issame(self, x: int, y: int) -> bool:
        return self.findRoot(x) == self.findRoot(y)
    
    def size(self,x: int) -> int:
        return -self.forest[self.findRoot(x)]

n,m = map(int,input().split())

u = UnionFind(n)
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    u.union(a,b)
ans = 0
for i in range(n):
    ans = max(ans,u.size(i))
print(ans)

Measured memory_bytes: 14828
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

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;
}

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

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

int main()
{
    ll n;
    cin >> n;
    map<ll, ll> rensou;
    vector<ll> can;
    ll a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        rensou[a]++;
        if (rensou[a] > 1)
        {
            can.push_back(a);
            rensou[a] = 0;
        }
    }
    sort(can.begin(), can.end(), greater<ll>());
    if (can.size() > 1)
    {
        cout << can[0] * can[1] << endl;
    }
    else
    {
        cout << "0" << endl;
    }
}


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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define int ll

int32_t main(){
    FAST
    int n, W; cin >> n >> W;
    const int V = 1e5 + 1;
    int dp[n + 1][V];
    int weights[n];
    int values[n];
    for(int i = 0; i < n; i++){
        cin >> weights[i];
        cin >> values[i];
    }
    memset(dp, 1e9 + 1, sizeof(dp));
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= 1e5; j++){
            if(j == 0){
                dp[i][j] = 0;
            }
            else if(i == 0){
                dp[i][j] = 1e9 + 1;
            }
            else if(j >= values[i - 1]){
                dp[i][j] = min(dp[i - 1][j], weights[i - 1] + dp[i - 1][j - values[i - 1]]);
            }
            else{
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    int ans = 0;
    for(int i  = 1; i <= n; i++){
        for(int j = 0; j <= 1e5; j++){
            //if(j == 20)break;
            if(dp[i][j] > 0 && dp[i][j] <= W){
                ans = max(ans, j);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

//template
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define repr(i,n) for(ll i=n;i>0;i--)
#define all(v) v.begin(),v.end()
#define in cin>>
#define out cout<<
#define en <<endl
const ll INF = 10000000000000;

int main()
{
	int n,m;
	in n >> m;
	if (n == m)
		out "Yes" en;
	else
		out "No" en;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n;
    cin>>n;
    map<string,int>Mp;
    rep(i,n){
        string temp; cin>>temp;
        Mp[temp]++;
    }
    int m; cin>>m;
    map<string,int>res;
    rep(i,m){
        string temp; cin>>temp;
        res[temp]++;
    }
    int ans=0;
    for(auto itr:Mp){
        int yebi=itr.second;
        for(auto saho:res){
            if(saho.first==itr.first)yebi-=saho.second;
        }
        cmax(ans,yebi);
    }
    cout<<ans<<endl;
}


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

int main()
{
	int x[4],y[4];
	cin >> x[0] >> y[0] >> x[1] >> y[1];
		x[2] = x[1] + (y[0] - y[1]);
		y[2] = y[1] - (x[0] - x[1]);
		x[3] = x[0] + (y[0] - y[1]);
		y[3] = y[0] - (x[0] - x[1]);
		cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;
	return 0;
}

Measured memory_bytes: 256
import copy

n = int(input())
t = list(map(int, input().split()))
m = int(input())
dorink = [list(map(int, input().split())) for _ in range(m)]
for i in range(m):
    t_copy = copy.deepcopy(t)
    t_copy[dorink[i][0] - 1] = dorink[i][1]
    print(sum(t_copy))


Measured memory_bytes: 9212
def solve(H, A_B):
    max_a = 0
    for a_b in A_B:
        if a_b[0] > max_a:
            max_a = a_b[0]

    A_B.sort(key=lambda o: o[1], reverse=True)
    total_dmg = 0
    nage_count = 0
    for a_b in filter(lambda o: o[1] > max_a, A_B):
        total_dmg += a_b[1]
        nage_count+= 1
        if total_dmg >= H:
            return nage_count
    huri_count = int((H - total_dmg) / max_a)
    if H - total_dmg - (huri_count * max_a) <= 0:
        return nage_count + huri_count
    else:
        return nage_count + huri_count + 1


N, H = map(int, input().split())
A_B = [list(map(int, input().split())) for _ in range(N)]
print(solve(H, A_B))

Measured memory_bytes: 28920
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; i++) cin >> p[i];
    int ans = 1, minp = p[0];
    for (int i = 1; i < n; i++) {
        if (minp >= p[i]) minp = p[i], ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        int num = (System.in.read() - '0') * 100;
        System.in.skip(1);
        num += (System.in.read() - '0') * 10;
        System.in.skip(1);
        num += System.in.read() - '0';
        System.out.print(num % 4 == 0 ? "YES" : "NO");
    }
}


Measured memory_bytes: 32308
#include <bits/stdc++.h>
#define int long long
using namespace std;
int N,M;
pair<int,int> a[100000+10];
signed main(){
  cin >> N >> M;
  for(int i=0;i<N;i++){
    cin >> a[i].first >> a[i].second;
  }
  sort(a,a+N);
  int num=M,ans=0,i=-1;
  while(1){
    if(num<0) break;
    i++;
    num-=a[i].second;
    ans+=a[i].second*a[i].first;
  }
  ans-=a[i].second*a[i].first;
  num+=a[i].second;
  ans+=num*a[i].first;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
#define vll vector<ll>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

template<typename T>
void vecin(vector<T>& v, int n = 0){
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n-1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}
void print(string s){
    cout << s << endl;
}

int main()
{
    ciosup;
    int m, d;
    cin >> m >> d;
    ll ans = 0;
    FOR(i,1, m+1)
    {
        FOR(j,1,d+1){
            int d1 = j % 10;
            int d10 = j / 10;
            if (d1 >= 2 && d10 >= 2 && d1*d10 == i){
                ++ans;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# Nが素数のときはNの桁数しかない
# 3桁*3桁 = 6桁 3桁*4桁=6~7桁 2桁*6桁=7~8桁なのでNの桁数がわかればA,Bの桁数が分かる
# A<=BとするとN=10だと(1,9)|(1,10)(2,8)|(2,9)(3,7)|(3,8)(4,6)|(4,7)|(5,5)
# * 最初の(1,9)の一桁では1は素数で省かれているので除く
# なのでせいぜい10^5まで調べりゃいい
n = int(input())


def f(t):
    keta = 0
    while t > 0:
        keta += 1
        t //= 10
    return keta


flag = False
for i in range(2, int(n ** 0.5) + 1):
    if n % i == 0:
        flag = True
        break

if flag is False:
    print(f(n))
    exit()

maxn = 10**9
for a in range(2, 10 ** 6):
    if n % a == 0:
        b = n / a
        maxn = min(maxn, max(f(b), f(a)))

print(maxn)


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

int main(){
  int n;
  cin >> n;
  
  set<string> s;
  string ss;
  for(int i=0; i<n; i++){
    cin >> ss;
    s.insert(ss);
  }
  
  printf("%lu\n", s.size());
  return 0;
}

Measured memory_bytes: 19292
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}
 
fn main() {
  let s: Vec<String> = read_vec();
  let l: i32 = s[0].parse().unwrap();
  let r: i32 =  s[2].parse().unwrap();

  let ans = if s[1] == "+" { l + r } else { l - r } ;
  
  println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int c[200005],w[200005],par[200005],cnt[200005];
pair<int,int> mn[200005],pre[200005],suf[200005];
map<pair<int,int>,int> cnt2;
int find(int x)
{
	if (par[x]!=x)
	par[x]=find(par[x]);
	return par[x];
}
void Union(int x,int y)
{
	x=find(x);
	y=find(y);
	par[x]=y;
}
long long pow_log(long long x,int y)
{
	if (!y)
	return 1;
	long long ret=pow_log(x,y/2);
	ret=(ret*ret)%mod;
	if (y%2)
	ret=(ret*x)%mod;
	return ret;
}
int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	for (int i=1;i<=n;i++)
	mn[i]={1e9,1e9};
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&c[i],&w[i]);
		mn[c[i]]=min(mn[c[i]],make_pair(w[i],i));
		par[i]=i;
	}
	pre[0]={1e9,1e9};
	for (int i=1;i<=n;i++)
	pre[i]=min(pre[i-1],mn[i]);
	suf[n+1]={1e9,1e9};
	for (int i=n;i>0;i--)
	suf[i]=min(suf[i+1],mn[i]);
	for (int i=1;i<=n;i++)
	{
		if (w[i]+mn[c[i]].first<=x)
		Union(i,mn[c[i]].second);
		if (w[i]+min(pre[c[i]-1],suf[c[i]+1]).first<=y)
		Union(i,min(pre[c[i]-1],suf[c[i]+1]).second);
	}
	long long ans=1;
	for (int i=1;i<=n;i++)
	{
		int f=find(i);
		cnt[f]++;
		ans=(ans*cnt[f])%mod;
		cnt2[{f,c[i]}]++;
		ans=(ans*pow_log(cnt2[{f,c[i]}],mod-2))%mod;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 23712