akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <iomanip>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
int main() {
	long long n, l;
	cin >> n >> l;
	vector<long long> a;
	REP(i, n) {
		long long b;
		cin >> b;
		a.push_back(b);
	}
	long long start = -1;
	long long total = -1;
	for (int i = 0;i < n - 1;++i) {
		if (total < a[i] + a[i + 1]) {
			total = a[i] + a[i + 1];
			start = i;
		}
	}
	if (total < l) {
		cout << "Impossible" << endl;
		return 0;
	}
	else {
		cout << "Possible" << endl;
		for (int i = 1;i <= start;++i) {
			cout << i << endl;
		}
		vector<int> horyy;
		for (int i = start + 2;i < n;++i) {
			horyy.push_back(i);
		}
		for (int i = horyy.size() - 1;i >= 0;--i) {
			cout << horyy[i] << endl;
		}
		cout << start + 1 << endl;
		return 0;
	}
}

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

void prians(bool answer) {
  if(answer)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
int a, b, c;

int main() {
  cin >> a >> b >> c;
  prians(a * b * c == 175);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String N = scan.next(); 
		char[] X = N.toCharArray();
		//System.out.println(X);
		char NLast1= X[X.length-1] ;
		int NLast = Character.getNumericValue(NLast1);
		//System.out.println(NLast);
		//System.out.println(NLast==2);
		if(NLast==2) {
			System.out.println("hon");
		}
		
		if(NLast==4) {
			System.out.println("hon");
		}
		if(NLast==5) {
			System.out.println("hon");
		}
		if(NLast==7) {
			System.out.println("hon");
		}
		if(NLast==9) {
			System.out.println("hon");
		}
		if(NLast==0) {
			System.out.println("pon");
		}
		if(NLast==1) {
			System.out.println("pon");
		}
		if(NLast==6) {
			System.out.println("pon");
		}
		if(NLast==8) {
			System.out.println("pon");
		}
		if(NLast==3) {
			System.out.println("bon");
		}

	}

}


Measured memory_bytes: 35616
N, M = map(int, input().split())
SC = sorted([list(map(int, input().split())) for _ in range(M)], key=lambda x: x[0])

ans = ['_'] * N
for s, c in SC:
    if N >= 2 and s == 1 and c == 0:
        print(-1)
        quit()
    elif ans[s-1] != '_' and ans[s-1] != str(c):
        print(-1)
        quit()
    else:
        ans[s-1] = str(c)

for i, num in enumerate(ans):
    if N == 1 and ans[0] == '_':
        print(0)
        quit()
    elif i == 0 and ans[0] == '_':
        ans[0] = '1'
    elif num == '_':
        ans[i] = '0'

print(int(''.join(ans)))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fo(i,s,n)    for(auto i=s;i<n;++i)
#define foo(i,s,n)    for(auto i=s;i>=n;--i)
#define ll long long
#define ull unsigned long long int
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x

const int MOD = 1000000007;
ll mod(ll x){
    return (x%MOD + MOD)%MOD;
}
ll mul(ll a , ll b){
    return mod(mod(a)*mod(b));
}
bool comp(pair<ll,ll>& a, pair<ll,ll>& b)
{
    if(a.second == b.second)
    return a.first > b.first;
    else
    return b.second < a.second;
}
static int rowNbr[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
static int colNbr[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int main()
{
    int d,t,s;
    cin>>d>>t>>s;
    double r = (double)d/s;
    if(r<=t)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}





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

int prime_factrization(ll n) {
    vector<int> prime_num(int(sqrt(n))+1);
    int ans = 0;
    for (ll i = 2; i*i <= n; i++) {
        while(n % i == 0) {
            prime_num[i]++;
            n /= i;
        }
        int num = 1;
        while(prime_num[i] >= num) {
            prime_num[i] -= num;
            num++;
            ans++;
        }
    }
    if (n != 1)
        ans++;
    return ans;
}


int main() {
    ll N;
    cin >> N;
    int ans = prime_factrization(N);

    if (N != 1 && ans == 0)
        cout << 1 << endl;
    else
        cout << ans << endl;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  cout << min({(a+b), (b+c), (c+a)}) << endl;
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    int cnt=0;
    for (int i=0; i<4; i++){
        if(s.at(i)=='+') cnt++;
        if(s.at(i)=='-') cnt--;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = []

for i in range(N):
  S.append(input())
  
S.sort()
SS = S
count = 1
maxcount = 1
ans = []

for i in range(1, N):
  if S[i-1] == S[i]:
    count += 1
    if count == maxcount:
      ans.append(S[i])
    if count > maxcount:
      ans = []
      ans.append(S[i])
      maxcount = count
  else:
    count = 1
    
if ans == []:
  ans = SS
  
for a in ans:
  print(a)

Measured memory_bytes: 18632
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

ll d;
vector<int> v;
ll pow10[110];
ll ans;
int difcur[110];

void DFS(int maxlen,int lvl=1,ll sumdif=0ll)
{
	if(lvl>=maxlen/2+1)
	{
		if(sumdif!=d)return;
		
		int cnt=9-abs(difcur[1]);
		
		for(int i=2;i<lvl;i++)cnt=cnt*(10-abs(difcur[i]));
		
		ans+=(maxlen%2==1 ? cnt*10ll : cnt*1ll);
		
		return;
	}
	
	if(sumdif+10ll*(pow10[maxlen-lvl]-pow10[lvl-1])<d||sumdif-10ll*(pow10[maxlen-lvl]-pow10[lvl-1])>d)return;
	
	for(int curdif=(lvl==1 ? -8 : -9);curdif<=(lvl==1 ? 8 : 9);curdif++)
	{
		difcur[lvl]=curdif;
		
		DFS(maxlen,lvl+1,sumdif+difcur[lvl]*(pow10[maxlen-lvl]-pow10[lvl-1]));
	}
}

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	cin>>d;
	
	if(d%9){cout<<0;return 0;}
	
	pow10[0]=1;
	for(int i=1;i<=18;i++)pow10[i]=pow10[i-1]*10;
	
	for(int i=1;i<=18;i++)DFS(i);
	
	cout<<ans;
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


Measured memory_bytes: 3644
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
#define MN 100000
#define MOD 1000000007
int p[MN+5],pn,a[MN+5],an;
map<int,int> f;
inline int pw(int x,int y)
{
	int r=1;
	for(;y;y>>=1,x=1LL*x*x%MOD)if(y&1)r=1LL*r*x%MOD;
	return r;
}
int main()
{
	int n,k,i,x,u=0,ans=0;
	scanf("%d%d",&n,&k);
	if(n%2==0)n/=2,u=1;
	for(i=2,x=n;i*i<=x;++i)if(x%i==0)for(p[++pn]=i;x%i==0;)x/=i;
	if(x>1)p[++pn]=x;
	for(i=1;i*i<n;++i)if(n%i==0)a[++an]=i,a[++an]=n/i;if(i*i==n)a[++an]=i;
	sort(a+1,a+an+1);
	for(i=1;i<=an;++i)f[a[i]]=pw(k,u?a[i]:a[i]+1>>1);
	for(x=1;x<=pn;++x)for(i=an;i;--i)if(a[i]%p[x]==0)
		f[a[i]]=(f[a[i]]+MOD-f[a[i]/p[x]])%MOD;
	for(i=1;i<=an;++i)ans=(ans+1LL*f[a[i]]*a[i])%MOD;
	printf("%d",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

int main() {
    //入力
    ll N; 
    cin >> N;
    //long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう
    //ll a[100010][3];    //あまり、a[n]のnを大きくするとエラーなので注意
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];
    //dpテーブル
    //long long dp[100010][3];

    //ll dp[100010][3];
    //初期条件、初期化は既に終わっている

    //遷移
    for (ll i = 0;i<N;i++) {
        for (ll j = 0;j<3;j++) {
            for (ll k = 0;k<3;k++) {
                if (j==k) continue;
                chmax(dp[i+1][k],dp[i][j] + a[i][k]);
            }
        }
    }
    ll ans = max(dp[N][0],dp[N][1]); //dp[i] はi日目なので注意,
    ans = max(ans,dp[N][2]);         //N日目はN-1でなく、dp[N]なので注意
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))

int gcd(int a, int b){
    while( b ){
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

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

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //xのn乗を計算するのにn乗を2進表記にして計算
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//答えに付加
        }
        x=(x*x)%mod;//2乗
        n=n/2;
    }
    return ret;
}

struct VV{
    int x;
    int y;
    int z;
};

class LessInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        if(riLeft.x == riRight.x){
            return riLeft.y > riRight.y;
        }
        return riLeft.x > riRight.x;
        
    }
};

class indInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        return riLeft.x < riRight.x;
        
    }
};

struct XX{
    int zenbu=0;
    int kidoku=0;
};

class xxIntu {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        //第1条件
        if(riLeft.z != riRight.z){
            return riLeft.z < riRight.z;//<:昇順(小さい順)、>:降順(大きい順)
        }
        //第2条件
        return riLeft.x < riRight.x;
    }
};
bool operator< (const VV &riLeft, const VV &riRight){
    return riLeft.z < riRight.z;
};
/*bool operator> (const XX &riLeft, const XX &riRight){
    return riLeft.a > riRight.a;
};*/



int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //ここから
    
    string s;
    cin >> s;
    int f=0;
    if(s.find("N")==string::npos && s.find("S")==string::npos){
        f=1;
    }else if(s.find("N")!=string::npos && s.find("S")!=string::npos){
        f=1;
    }else{
        cout << "No" << endl;
        return 0;
    }
    if(s.find("W")==string::npos && s.find("E")==string::npos){
        f=1;
    }else if(s.find("W")!=string::npos && s.find("E")!=string::npos){
        f=1;
    }else{
        cout << "No" << endl;
        return 0;
    }
    
    cout << "Yes" << endl;
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

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

int a[2000];
int main() {
	int N, Z, W;
	cin >> N >> Z >> W;
	for (int i=0; i < N; i++) {
		cin >> a[i];
	}
	if (N >= 2) {
		cout << max(max(max(W - a[N - 1], a[N - 1] - W), a[N - 1] - a[N - 2]), a[N - 2] - a[N - 1]) << endl;
	}
	else {
		cout << abs(a[N - 1] - W);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        if ((B - A) % 2 == 0) {
            System.out.println((B - A) / 2);
            return;
        }
        long l1 = B - 1;
        long l2 = N - A;
        long l3 = N - B + 1 + (B - A - 1) / 2;
        long l4 = A + (B - A - 1) / 2;
        long a1 = l1 <= l3 ? l1 : l3;
        long a2 = l2 <= l4 ? l2 : l4;
        long ans = a1 <= a2 ? a1 : a2;
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>


using namespace std;
typedef long long ll;

#define INF (long long)(10e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

vector<int> A;

int main(void)
{
    int N;
    cin >> N;
    REP(i, N) {
        int ai;
        cin >> ai;
        A.push_back(ai);
    }
    int cnt = 0;
    int p = 0, p1, p2;
    while(p < N) {
        while(p < N && A[p + 1] == A[p]) {
            p ++;
        }
//        cout << "p:" << p << endl;
        p1 = p;
        p2 = p;
        while(p1 < N && A[p1 + 1] >= A[p1]) {
            p1 ++;
        }
        while(p2 < N && A[p2 + 1] <= A[p2]) {
            p2 ++;
        }
        cnt ++;
        p = max(p1, p2)+1;
    }
    cout << cnt << endl;


}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<int> edges[110000];
vector<int> val[110000];

int ans[110000];

int par[110000];
int find(int a){
	if(a == par[a]) return a;
	return (par[a] = find(par[a]));
}

void join(int u, int v){
	par[find(u)] = find(v);
}

void dfs(int i, int v){
	if(ans[i] == v) return;
	if(ans[i] == 0) return;
	if(ans[i] == -1){
		ans[i] = v;
	} else {
		ans[i] = 0;
	}
	for(int j = 0; j < edges[i].size(); j++){
		dfs(edges[i][j], (ans[i] * val[i][j]) % 7);
	}
}
LL num[7][110000];
LL trash[110000];
int main(){
	int n, m;
	cin >> n >> m;
	vector<int> c, d;
	for(int i = 0; i < n; i++) par[i] = i;
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		c.push_back(a);
		d.push_back(b);
		edges[a].push_back(b);
		edges[b].push_back(a);
		val[a].push_back(2);
		val[b].push_back(4);
		join(a,b);
	}
	for(int i = 0; i < n; i++){
		ans[i] = -1;
	}
	for(int i = 0; i < n; i++){
		if(ans[i] == -1) dfs(i,1);
	}
	for(int i = 0; i < n; i++){
		num[ans[i]][find(i)]++;
	}
	LL fans = 0;
	for(int i = 0; i < n; i++){
		if(find(i) != i) continue;
		trash[i] = 1;
		fans += num[0][i] * num[0][i];
		if(num[0][i]) trash[i] = 0;
		if(num[1][i] == 0) continue;
		if(num[2][i] == 0) continue;
		if(num[4][i] == 0) continue;
		trash[i] = 0;

		fans += num[1][i] * num[2][i];
		fans += num[2][i] * num[4][i];
		fans += num[4][i] * num[1][i];
	}
	for(int i = 0; i < m; i++){
		if(trash[find(c[i])]){
			fans++;
		}
	}
	cout << fans << endl;
}


Measured memory_bytes: 26608
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int f(int n){
  if (n%2==0) {
    return n/2;
  }
  else{
    return 3*n + 1;
  }
}

int solve(){
  int s;cin>>s;
  set<int> x;

  x.insert(s);
  rep(i, 2, 1000003){
    int tmp = f(s);
    if (x.count(tmp)) {
      cout << i << endl;
      return 0;
    }
    x.insert(tmp);
    s = tmp;
  }

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;

int main(){
	long long n, m;
	cin >> n >> m;
	long long ans = 0;
	if(n * 2 < m){
		ans += n;
		m -= n * 2;
		ans += m / 4;
	}
	else if(n < m){
		ans = m / 2;
	}
	else{
		ans = m / 2;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main() {
    int x, y;
    cin >> x >> y;
    x--, y--;
    int group[12] = {0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0};
    if (group[x] == group[y]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
using namespace std;
int main(){
char X,Y;
cin>>X>>Y;
if(X<Y)
cout<<"<"<<endl;
else if(X>Y)
cout<<">"<<endl;
else if(X==Y)
cout<<"="<<endl;
}






Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long a, ans;
int f(int idx) {
    if(idx == 1)
        return ans = a;

    ans = (ans * f( idx / 2) ) % 1000000007;

    if(idx % 2)
        ans = ( ans * a ) % 1000000007;

    return ans;
}
int main() {
    int b;
    while(cin >> a >> b) {
        ans = 1;
        a = a % 1000000007;
        cout << f(b) << "\n";
    }
    return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>
#include<string.h>
int n,k,ans;
int main(){
	scanf("%d%d",&n,&k);
	int i,j;
	int temp=1;
	ans=10000010;
	for(i=1;i<=n;i++){
		temp*=2;
		int p=temp+(n-i)*k;
		if(p<ans)
			ans=p;
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
typedef long long ll;

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

int main()
{
    ll N, X, xi;
    ll result = 0;
    cin >> N >> X;
    for(ll i = 0; i < N; ++i) {
        cin >> xi;
        result = gcd(labs(X - xi), result);
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  ll p = 1;
  ll sum = 0;
  while(true){
    sum += p;
    p++;
    if(sum == N) break;
    if(sum > N){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  cout << p << endl;
  rep(i,p){
    if(i==0){
      vector<int> v;
      int x = 1;
      int y = 0;
      while(y+1 <= sum){
        v.push_back(y+1);
        y += x;
        x++;
      }
      cout << v.size();
      rep(j,v.size()){
        cout << " " << v[j];
      }
      cout << endl;
    }else{
      vector<int> v;
      ll x = i * (ll)(i-1) / 2 + 1;
      rep(j,i){
        v.push_back(x+j);
      }
      int y = x + i;
      int z = i + 1;
      while(y+i <= sum){
        v.push_back(y+i);
        y += z;
        z++;
      }
      cout << v.size();
      rep(j,v.size()){
        cout << " " << v[j];
      }
      cout << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main()
{
  int n=0;
  int ans=0;
  cin>>n;
  for(int i=1;i<10;i++)
  {
    for(int j=1;j<10;j++)
    {
      if(n==i*j)
      {
        ans=1;
        break;
      }
      
    }
    if(ans==1)
    {
      cout<<"Yes"<<endl;
      break;
    }
  }
    if(ans==0)
    {
      cout<<"No"<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0;i<(ll)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;
ll dp[200200]={};
int main(){
    fast_io
    
    ll n;
    cin>>n;
    ll a[n];
    rep(i,n) {
        cin>>a[i];
        dp[a[i]]++;
    }
    ll sum=0;
    rep(i,n+1){
        ll tmp=dp[i]*(dp[i]-1)/2;
        sum+=tmp;
    }
    rep(i,n){
        ll ans=sum-(dp[a[i]]-1);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const ll mod = 1000000007;

int main(){
    ll n, t;
    cin >> n >> t;
    vector<ll> A(n), M(n+1,0);
    for(int i = 0; i < n; i++) cin >> A[i];
    for(int i = n-1; i > -1; i--){
        chmax(M[i], max(A[i], M[i+1]));
    }
    ll ma = 0, cnt = 0;
    for(int i = 0; i < n; i++){
        chmax(ma, M[i] - A[i]);
    }
    for(int i = 0; i < n; i++){
        if(ma == M[i] - A[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;

}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>

int main(int argc, char* argv[])
{
  int a, b, x;

  std::cin >> a >> b >> x;
  if (x > a + b || x < a) {
    std::cout << "NO" << std::endl;
  } else {
    std::cout << "YES" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;

LL gcd(LL a,LL b){
  if(a<b)return gcd(b,a);
  if(b==0)return a;
  return gcd(b,a%b);
}
int main(){
  LL x,y;cin>>x>>y;
  cout<<x*y/gcd(x,y)<<endl;
  return 0;
}

Measured memory_bytes: 256
/*************************************************************************
  >         File: C.cc
  >       Author: Riho.Yoshioka
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Sat 13 Aug 2016 08:01:17 PM CST
*************************************************************************/
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> numbers;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    numbers.push_back(x);
  }
  int res = INT_MAX;
  for (int i = -100; i <= 100; i++) {
    int ans = 0;
    for (auto &x: numbers) {
      ans += (x - i) * (x - i);
    }
    res = min(res, ans);
  }
  cout << res << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define alpha_size 26



int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
    
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    cout << a[2] << " " << a[0] << " " << a[1] << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int a, b, c, i, x=0;
   scanf("%d %d %d",&a, &b, &c);


  for (i = a; i <= b; i++){
    if (c % i == 0){
      x++;
    }
  }
  
  printf("%d\n",x++);
  
  return 0;
}

Measured memory_bytes: 596
int main()
{

    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
    if(a>c){
        d=a;
        a=c;
        c=d;
    }
    if(b>c){
        d=b;
        b=c;
        c=d;
    }
    printf("%d %d %d\n",a,b,c);
    
    
    return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    double i,n,p,ans=0;
    scanf("%lf %lf",&n,&p);
    if(n==1)ans=p;
    else if(n>=40 || n>=p)ans=1;
    else for(i=1; i<=1000000; i++){
        if(fmod(p,pow(i,n))==0)ans=i;
    }
    printf("%.0lf",ans);
    return 0;
}

Measured memory_bytes: 384
S = input()
ans = 0
for i in range(2 ** (len(S) - 1)):
    status = str(bin(i)[2:]).zfill(len(S) - 1)
    index = 0
    S_i = S
    for s in status:
        if s == str(1):
            S_i = S_i[:index] + S_i[index] + "+" + S_i[index + 1:]
            index += 1
        index += 1
    ans += eval(S_i)
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    int wa=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        wa+=a[i];
    }
    vector<int>x;
    for(int i=1;i*i<=wa;i++){
        if(wa%i==0){
            x.push_back(i);
            x.push_back(wa/i);
        }
    }
    sort(x.begin(),x.end(),greater<int>());
    for(int i=0;i<x.size();i++){
        int l=0,r=0;
        int b[n];
        for(int j=0;j<n;j++)b[j]=a[j]%x[i],r+=x[i]-b[j];
        sort(b,b+n);
        for(int j=0;j<n;j++){
            l+=b[j],r-=x[i]-b[j];
            if(l==r && l<=k){
                cout<<x[i]<<endl;
                return 0;
            }
        }
    }
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

using event = tuple<ll, int, ll>;

const int MAX_Q = (int)(2e5 + 5);

int n, q;
ll d[MAX_Q];

priority_queue<event, vector<event>, greater<event>> events;

map<int, ll> ans;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &q);

  for (int i = 0; i < n; ++i) {
    ll s, t, x;
    scanf("%lld %lld %lld", &s, &t, &x);

    events.push(make_tuple(s - x, 1, x));
    events.push(make_tuple(t - x, -1, x));
  }

  for (int i = 0; i < q; ++i) {
    scanf("%lld", &(d[i]));
  }

  set<ll> pos_set;

  for (int i = 0; i < q; ++i) {
    ll period = d[i];

    while (!events.empty() && get<0>(events.top()) <= period) {
      event cur_event = events.top();
      events.pop();

      int in_or_erase = get<1>(cur_event);
      ll cur_pos = get<2>(cur_event);

      if (in_or_erase == 1) {
        pos_set.insert(cur_pos);
      }
      else {
        pos_set.erase(cur_pos);
      }
    }

    if (pos_set.empty()) {
      ans[i] = -1LL;
    }
    else {
      ans[i] = *(pos_set.begin());
    }
  }

  for (auto &e: ans) {
    printf("%lld\n", e.second);
  }

  return 0;
}


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

int main(void) {
  int k, a, b;
  cin >> k >> a >> b;
  
  for (int i=a; i<=b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3596
n = int(input())
a = list(map(int,input().split()))
dp = [[0]*2 for i in range(n+1)]
dp[0][1] = -float('inf')
for i in range(n):
    dp[i+1][0] = max(dp[i][0]+a[i],dp[i][1]-a[i])
    dp[i+1][1] = max(dp[i][0]-a[i],dp[i][1]+a[i])
print(dp[n][0])

Measured memory_bytes: 25644
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
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; }

long long calc(long long A) {
  long long sum = (A+1)/2;
  long long ans = sum%2;
  if (A%2 == 0) ans ^= A;
  return ans;
}

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

  long long A; cin >> A;
  long long B; cin >> B;

  cout << (calc(B)^calc(A-1)) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
int n,c=0 ;
cin >> n ;
string s;
cin >> s;
for (int i =0;i <= n-3 ;i++){
    if (s[i]=='A' && s[i+1]== 'B' && s[i+2]=='C'  )  c++;
}
cout << c << endl;
return 0 ;
}




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


// header area

int main(){
    int N, M; cin >> N >> M;
    vector<int> H(N);
    rep(i, N){
        cin >> H.at(i);
    }

    Graph G(N);
    rep(i, M){
        int a, b; cin >> a >> b;
        G[a-1].push_back(H.at(b-1));
        G[b-1].push_back(H.at(a-1));
    }

    int count=0;
    rep(i, N){
        // cout << "i:" << i << endl;
        if(G[i].empty()){
            count++;
        }
        else{
            int max = *max_element( G[i].begin(), G[i].end() );
            if(H[i] > max){
                count++;
            }
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 8740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

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

int main() {
  string s;
  cin >> s;
  ll n = SZ(s);
  vector<vector<ll>> dp(n + 1, vector<ll>(2, INF));
  dp[0][0] = 0, dp[0][1] = 1;
  REP(i, n) {
    ll x = s[i] - '0';
    chmin(dp[i + 1][0], min(dp[i][0] + x, dp[i][1] + 10 - x));
    chmin(dp[i + 1][1], min(dp[i][0] + x + 1, dp[i][1] + 9 - x));
  }
  // REP(i, n + 1) { printf("%lld %lld\n", dp[i][0], dp[i][1]); }
  cout << dp[n][0] << endl;
}

Measured memory_bytes: 55940
#include <iostream> 
#include <stdio.h>
#include <string>
using namespace std;

int main() {
	int a,b,sum(0);
	cin>>a>>b;
	if (a - b >= 2) {
		sum = a + a - 1;
	} else if (a - b == 1 || a - b == -1 || a == b) {
		sum = a + b;
	} else {
		sum = b + b - 1; 
	} 
	cout << sum;
    return 0;
 }

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	vll a(9) ;
	for(int i=0;i<9;i++) cin >> a.at(i) ;
	ll p,q,r,s ;
	p = a.at(1)-a.at(0) ;
	q = a.at(2)-a.at(1) ;
	r = a.at(3)-a.at(0) ;
	s = a.at(6)-a.at(3) ;
	bool ok = true ;
	for(int i=0;i<3;i++){
		if(a.at(i*3)+p==a.at(i*3+1)&&a.at(i*3+1)+q==a.at(i*3+2)) continue ;
		ok = false ;
	}
	for(int i=0;i<3;i++){
		if(a.at(i)+r==a.at(i+3)&&a.at(i+3)+s==a.at(i+6)) continue ;
		ok = false ;
	}
	yorn(ok) ;
}


Measured memory_bytes: 256
let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let take n lst =
  let rec doit n lst acc =
    if n <= 0 then List.rev acc
    else
      match lst with
      | [] -> List.rev acc
      | hd :: tl -> doit (n - 1) tl (hd :: acc)
  in
  doit n lst []

let () =
  let n = read_int () in
  let l = read_line () in
  let an = take n (List.map int_of_string (split l ' ')) in
  let min = List.fold_left (fun acc ai -> min acc ai) 1000001 an in
  let max = List.fold_left (fun acc ai -> max acc ai) (-1000001) an in
  let sum = List.fold_left ( + ) 0 an in
  Printf.printf "%d %d %d\n" min max sum

Measured memory_bytes: 8984
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
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;
} 
int main(){
    ll n;cin >> n;
    n/=200;
    cout << 10-n <<endl;
} 

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>

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

using namespace std;

int main(){
	int N, M;
	int data[55] = {0};
	int work, work1;
	cin >> N >> M;
	for(int i = 0; i < M; i++){
		cin >> work >> work1;
		data[work - 1]++;
		data[work1 - 1]++;
	}
	for(int i = 0; i < N; i++){
		cout << data[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
  }
   
int n,m,siz[N],p[N];


void init() {
	  rep(i,0,N) {
		    p[i]=i;
		    siz[i]=1;
		  }
	}

int get_par(int x) {
	  while(x!=p[x]) {
		    p[x]=p[p[x]];
		    x=p[x];
		  }
		  return x;
	}	

void uni(int x,int y) {
      int px=get_par(x);
      int py=get_par(y);
      if(px==py) return;
      if(siz[px]<siz[py]) swap(px,py);
      
      siz[px]+=siz[py];
      siz[py]=0;
      p[py]=px;
	}	
	
void solve() {
  cin>>n>>m;
  rep(i,0,m) {
	    int x,y;
	    cin>>x>>y;
	    uni(x,y);
	  }
  

  int maxi=0;
  rep1(i,1,n) {
	    maxi=max(maxi,siz[i]);
	  }
	  cout<<maxi<<endl;		                          
}

    
int32_t main() {
	cool;
	int t=1;	
    init();
	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


Measured memory_bytes: 6796
#include<iostream>
#include<vector>

using namespace std;

vector<vector<int>> vertices;
vector<int> dp;

int longestPath(int root){
    if(dp[root] != -1) return dp[root];
    int max = 0;
    for(int vertex: vertices[root]){
        dp[vertex] = longestPath(vertex);
        if(dp[vertex] > max){
            max = dp[vertex];
        }
    }
    dp[root] = 1+max;
    //cout<<root<<"->"<<max<<endl;

    return dp[root];
}

int main(){
    int N,M;
    cin>>N>>M;
    int maximum = 0;

    vertices = vector<vector<int>>(N+1);
    dp = vector<int>(N+1,-1);
    for(int i = 0; i < M; i++){
        int from,to;
        cin>>from>>to;
        vertices[from].push_back(to);
    }
    for(int i = 1; i <= N; i++){
        if(dp[i] == -1){
            int res = longestPath(i);
            if(res > maximum){
                maximum = res;
            }
        }
    }
    //cout<<endl;
    cout<<maximum-1;
    // cout<<endl;

    // for(int i = 1; i <= N;i++){
    //     cout<<dp[i]<<" ";
    // }
}

Measured memory_bytes: 11952
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int mod = 1000000000+7;

int main(){
    int n,k;    cin >> n >> k;
    vector<int>a(n);
    rep(i, n)   cin >> a[i];
    if(k == 0){
        cout << 1 << endl;
        return 0;
    }
    vector<vector<ll> >dp(n+1, vector<ll>(k+1));    //dp[i][j]:=子供iまでにj個分ける(累積和)
    rep(i, n+1){ dp[i][0] = 1; }
    rep(j, k+1) dp[0][j] = 1;
    /*
     * dpテーブル
     * dp[i][j] = dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1-a[i-1]]
     */
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= k; j++){
            dp[i][j] += dp[i][j-1];
            dp[i][j] %= mod;
            dp[i][j] += dp[i-1][j];
            dp[i][j] %= mod;
            if(j-1-a[i-1] >= 0){
                dp[i][j] -= dp[i-1][j-1-a[i-1]];
                dp[i][j] += mod;
                dp[i][j] %= mod;
            }
        }
    }
    cout << (dp[n][k] - dp[n][k-1] + mod) % mod << endl;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(i,arr)       for(int& i:arr)cin>>i;
#define output(i,arr)      for(int& i:arr)cout<<i<<" ";
#define for_each(arr)      for(auto& it:arr)
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
   // #endif
    cin>>n;
    map<string,int>mp;
    pair<string,int>pp[n];
    for(int i=0; i<n; i++){
    	cin>>s;
    	mp[s]++;
    	//pp[s]++;

    }
  // for(auto it:mp)cout<<it.ff<<" "<<it.ss<<endl;
    auto mx=max_element(mp.begin(),mp.end(),[](const pair<string,int>&p1,const pair<string,int>& p2){return p1.second<p2.second;})->second;
	//cout<<mx<<endl;
	for(auto it:mp){
		if(mp[it.ff]==mx){
			cout<<it.ff<<endl;
		}
	}

    

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


Measured memory_bytes: 27008
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(n) for(int i=0;i<n;i+=1)
#define fill(c,v) memset(c,v,sizeof(c));
#define _h cout<<"here"<<endl;
#define pr(a) cout<<a<<endl;
#define prarr(a,n) rep(n) cout<<a[i]<<" \n"[i==n-1]; 
#define fi first
#define se second
#define pu push_back
#define inf 1000000001
#define MOD 1000000007 
#define INF 100000000000001
const int MAXN = 2e5+10;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    map<int,int> m;
    rep(n)
    {
    	m[(i+1)%k]++;
    }
    ll ans = 0;
    rep(k)
    {
    	if(i==(k-i)%k )
    	{
    		ll t = m[i];
    		ans+=((ll)t*(t)*(t));//-2))/6;
    	}
    	else if((i+i)%k==0)
    	{
    		ll t = m[i];
    		// ans+=
    		ans+=(ll)m[(k-i)%k]*((t*(t)));
    	}
    }
    cout<<ans<<endl;

    return 0;

}


Measured memory_bytes: 4992
from math import sqrt
M = 55556
p = [1]*(M+1)
p[0] = p[1] = 0
for x in range(2, int(sqrt(M))+1):
    if p[x]:
        for y in range(x*x, M+1, x):
            p[y] = 0
N = int(input())
ans = []
c = 0
for i in range(1,M):
    if i%5 == 1 and p[i]:
        ans.append(i)
        c += 1
    if c == N:
        break
print(" ".join(map(str,ans)))
    

Measured memory_bytes: 39408
#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve() {
    int n;
    cin>>n;
    if(n==0) cout<<1;
    else cout<<0;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test = 1;
    while(test--) {
        solve();    
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    vi a(n), b(n);
    rep(i, n) {
        cin >> a[i];
        b[i] = a[i];
    }

    sort(all(b));

    rep(i, n) {
        if(a[i] == b[n-1]) cout << b[n-2] << endl;
        else cout << b[n-1] << endl;
    }

    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }
template<class T>
inline T upper(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	ll ans = 1;
	for (int i = 1; i <= n; ++i) {
		ans = ans * i % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin>>n;
	long long a[n+1]; rep(i,n+1) cin>>a[i];
	long long b[n]; rep(i,n) cin>>b[i];
	long long ans=0;
	for(int i=0;i<n;i++){
		ans+=min(b[i],a[i]);
		b[i]-=a[i];
		if(b[i]>0){
			ans+=min(a[i+1], b[i]);
			a[i+1]=max(0ll,a[i+1]-b[i]);
		}
		// cout<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1920