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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


using Graph = vector<vector<int>>;

vector<vector<bool>> seen(55, vector<bool>());
vector<pair<int, int>> bridge;

void dfs(const Graph &G, int v, int b) {
    seen[b][v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) {
        if(seen[b][next_v]) continue; // next_v が探索済だったらスルー
        if((v == bridge[b].first && next_v == bridge[b].second) || (v == bridge[b].second && next_v == bridge[b].first)) {
            continue;
        }

        dfs(G, next_v, b); // 再帰的に探索
    }
}

int main() {
    int n, m; cin >> n >> m;
    // グラフ入力受取
    Graph G(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        bridge.push_back(make_pair(a-1, b-1));
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    int ans = 0;
    rep(i, m) {
        seen[i].assign(n, false); // 全頂点を「未訪問」に初期化
        dfs(G, 0, i);
        rep(j, n) if(!seen[i][j]) {
            ans++;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"
const int L = 1<<22 + 5;
ll n;
ll a[22][22];
int dp[L];
ll getSetBits(ll mask)
{
	ll cnt=0;
	while(mask>0)
	{
		if(mask%2)cnt++;
		mask/=2;
	}
	return cnt;
}
ll fx(ll mask)
{
	ll idx = getSetBits(mask);
	if(idx == n)
	{
		if(mask == (1<<n) - 1)
			return dp[mask]=1;
		else
			return dp[mask]=0;
	}
	if(dp[mask] != -1)
		return dp[mask];
	ll su = 0;
	for(int i=0;i<n;i++)
	{
		if(mask&(1<<i))
			continue;
		if(a[idx][i])
			su = (su + fx(mask | (1<<i)))%mod;
	}
	return dp[mask] = su;
} 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	ll i,j;
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			cin>>a[i][j];
	for(i=0;i<L;i++)
		dp[i]=-1;
	cout<<fx(0)<<nl;
	return 0;
}

Measured memory_bytes: 527884
#include<bits/stdc++.h>
#define ll long long
#define vl vector
#define pb push_back
#define ld long double
#define ff first
#define ss second
using namespace std;

ll fact(ll a)
{
    if(a==0) return 1;
    else return a*fact(a-1);
}

vl<ll> divisor(ll n)
{
    vl<ll> v;
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0) 
        {
            if(n/i==i) v.pb(i);
            else
            {
                v.pb(i);
                v.pb(n/i);
            }
        }
    }
    return v;
}

int main()
{
    ll i,j,n,k,t,m,a,b;
    vl<ll> v;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n,greater<ll>());
    ll sum=arr[0];
    ll count=0;
    j=1;
    for(i=0;i<n-2;i++)
    {
        if(count==2)
        {
            count=0;
            j++;
        }
        sum+=arr[j];
        count++;
    }
    cout<<sum;
}

Measured memory_bytes: 5284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const ll MOD = 1e9 + 9;
const int INF = 1e9;
const ll INFF = 1e18;
 
//com[i][j] := iCj
ll com[60][60];
void slv(void){
	 //combination
    com[0][0] = 1;
    for (int i = 1; i <= 55; ++i){
        for (int j = 0; j <= i; ++j){
            //パスカルの３角形
            if(j == 0) com[i][j] = com[i - 1][j];
            else com[i][j] = (com[i - 1][j] + com[i - 1][j - 1]);
        }
    }
}
 
int N, A, B;
map<ll, int> ma;
int main(void){
	cin >> N >> A >> B;
	vector<ll> v(N);
	rep(i, N) cin >> v[i];
	rep(i, N){
		ma[v[i]]++;
	}
	sort(all(v));
	reverse(all(v));
	long double sum = 0;
	int cnt = 0;
	rep(i, A){
		if(i == 0) cnt++;
		else{
			if(v[i - 1] == v[i])cnt++;
			else{
				cnt = 1;
			}
		}
		sum += v[i];
	}
	long double tsum = sum;
	int cntr = cnt;
	reps(i, A, B){
		ll tmp = sum + v[i];
		if(tmp * A == tsum * (i + 1)){
			cntr++, sum = tmp;
		}
		else break;
	}
	ll num = ma[v[A - 1]];
	ll ans = 0;
	slv();
	for (int i = cnt; i <= cntr; ++i){ // num C i
		// if(num < i) break;
		ans += com[num][i];
	}
	printf("%.7Lf\n", tsum / (double)A);
	// cout << (long double)tsum / (long double)A << endl;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#define ll long long
#define pii pair<int, int>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, s, e) FOR(i, e, s) cout << a[i] << ' '



using namespace std;

int main()
{
    string pr[] = {"Sunny", "Cloudy", "Rainy"};
    string s; cin >> s;
    int ind = 0;
    FOR(i, 3, 0)
    {
        if(pr[i] == s)break;
        ind++;
    }
    cout << pr[(ind + 1) % 3];
    return 0;
}


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


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

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int N;  cin >> N;
  string s;
  cin >> s;
  int x = 0;
  int max = 0;
  for(int i = 0;i < N;i++){
    if(s[i] == 'I')x++;
    if(s[i] == 'D')x--;
    if(x > max)max = x;
  }

  cout << max << endl;
}

Measured memory_bytes: 256
s=input()
t=input()
if s+'a' == t:
    print('Yes')
elif s+'b' == t:
    print('Yes')
elif s+'c' == t:
    print('Yes')
elif s+'d' == t:
    print('Yes')
elif s+'e' == t:
    print('Yes')
elif s+'f' == t:
    print('Yes')
elif s+'g' == t:
    print('Yes')
elif s+'h' == t:
    print('Yes')
elif s+'i' == t:
    print('Yes')
elif s+'j' == t:
    print('Yes')
elif s+'k' == t:
    print('Yes')
elif s+'l' == t:
    print('Yes')
elif s+'m' == t:
    print('Yes')
elif s+'n' == t:
    print('Yes')
elif s+'o' == t:
    print('Yes')
elif s+'p' == t:
    print('Yes')
elif s+'q' == t:
    print('Yes')
elif s+'r' == t:
    print('Yes')
elif s+'s' == t:
    print('Yes')
elif s+'t' == t:
    print('Yes')
elif s+'u' == t:
    print('Yes')
elif s+'v' == t:
    print('Yes')
elif s+'w' == t:
    print('Yes')
elif s+'x' == t:
    print('Yes')
elif s+'y' == t:
    print('Yes')
elif s+'z' == t:
    print('Yes')
else:
    print('No')


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    pair<int, int> a, b;
    cin >> a.first >> a.second;
    cin >> b.first >> b.second;

    int dx = b.first - a.first;
    int dy = b.second - a.second;

    pair<int, int> c, d;
    c.first = b.first - dy;
    c.second = b.second + dx;
    d.first = c.first - dx;
    d.second = c.second - dy;

    cout << c.first << ' ' << c.second << ' ';
    cout << d.first << ' ' << d.second << '\n';
    return 0;
}


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

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

typedef long long ll;

int const MOD = 1e9+7;

string line; string::iterator iter;
inline void debug() { cout << "Remain: \"" <<string(iter, line.end())<<'"' << endl; }

void consume(char e) {
  if(*iter == e) { iter++; }
  else { assert(0); }
}

bool ifconsume(char e) {
  if(*iter == e) { consume(e); return 1; }
  return 0;
}

bool strcons(string s) {
  string::iterator is = s.begin();
  string::iterator tmpiter = iter;
  
  while(is!=s.end() &&
        tmpiter!=line.end() &&
        *is == *tmpiter) { tmpiter++; is++; }

  if(is == s.end()) {
    iter = tmpiter;
    return true;
  }
  return false;
}

ll get_num() {
  ll ret = 0;
  while(isdigit(*iter)) { ret *= 10; ret += (*iter)-'0'; consume(*iter); }
  return ret;
}

ll expr();
ll term() {
  if(isdigit(*iter)) { return get_num(); }
  else if(ifconsume('S')) {
    consume('<');
    ll r = expr(); (r*=r) %= MOD;
    consume('>');
    return r;
  }
  else {
    debug();assert(0&&"term");
  }
}

ll expr() {
  ll t1 = term();
  while(strcons(">>")) {
    if(*iter != 'S' && !isdigit(*iter)) { iter -= 2; break; }
    int k = term();
    while(k--) { t1 >>= 1; if(t1 == 0) break; } // log テ・ツ崢榲」ツ?ァテ」ツ?凖」ツ?ケテ」ツ?ヲテ」ツ?ョテヲツ閉エテヲツ閉ーテ」ツつ津・ツーツステ」ツ?湘」ツ?崚」ツつ凝」ツ?ョテ」ツ?ァテ」ツ??ゥツ?氾、ツクツュテ」ツ?ァ == 0 テ」ツ?ョテヲツ楪敕・ツ按暗」ツつ甘」ツつ津・ツ?・テ」ツつ古」ツつ凝」ツ??」ツ?妥」ツ?ァテゥツ?堙」ツつ凝」ツつ暗」ツ??」ツ?ォテ」ツ?ェテ」ツつ凝」ツ??
  }
  return t1;
}

int main() {
  for(string s;getline(cin, s);) {
    if(s == "#") break;
    line.clear();
    int sz=s.size(); rep(i,sz) if(s[i]!=' ') { line.push_back(s[i]); }
    iter = line.begin();
    cout << expr() << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3400
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B] = string_to_int(inputs[0])

    count = 0
    i = 0
    if B == 1:
        return 0
    while count < B:
        if i != 0:
            count -= 1

        count += A

        i += 1
    return i


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3064
s = input().rstrip();
n = len(s);
i = 0;
j = n-1;
ans = 0;
while i < j :
	if s[i] == s[j] :
		i += 1;
		j -= 1; 
	elif s[i] == 'x' :
		ans += 1;
		i += 1;
	elif s[j] == 'x' :
		ans += 1;
		j -= 1;
	else :
		ans = -1;
		break;
print(ans);

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

int main(){
    int A,B,K;cin>>A>>B>>K;
    int count = 0;
    int i = min(A,B)+1;
    while(true){
        i--;
        if(A%i==0 && B%i==0){
            count++;
            //cout<<i<<endl;
        }
        if(count==K) break;
    }
    cout<<i<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <bitset>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SZ = 3e5 + 10, INF = 1e9 + 100, MOD = 1e9 + 7;

ll n, m, q;

ll ans = 0;

vector<tuple<ll, ll, ll>> vec;

ll dsu[SZ], kek[SZ];

ll find(int v) {
	if (dsu[v] == v) return v;
	return dsu[v] = find(dsu[v]);
}

void uni(int v, int u) {
	v = find(v);
	u = find(u);
	if (u != v) {
		dsu[u] = v;
		ans++;
	}
}

void mrk(int v) {
	v = find(v);
	kek[v] = 1;
}

int main() {
	fastInp;

	cin >> n >> m >> q;

	for (int i = 0; i < n; i++) dsu[i] = i;
	while (q--) {
		ll u, v, t;
		cin >> u >> v >> t;
		vec.push_back({ u, v, t });
	}

	for (int i = 0; i < vec.size(); i++) {
		if (get<2>(vec[i]) == 0) {
			uni(get<0>(vec[i]), get<1>(vec[i]));
		}
	}

	for (int i = 0; i < vec.size(); i++) {
		if (get<2>(vec[i]) == 1) {
			mrk(get<0>(vec[i]));
			mrk(get<1>(vec[i]));
			if (find(get<0>(vec[i])) == find(get<1>(vec[i]))) {
				cout << "No";
				return 0;
			}
		}
	}

	ll cnt = 0, mn = 0;
	set<ll> s, s2;
	for (int i = 0; i < n; i++) {
		s.insert(find(i));
		if (kek[i]) s2.insert(find(i));
	}

	if (s2.size() == 0) {
		if (m < ans) {
			cout << "No";
			return 0;
		}
		ll k = s.size();
		if (m > ans + (k * (k - 1)) / 2) {
			cout << "No";
			return 0;
		}

		cout << "Yes";
		return 0;
	}

	if (s.size() == 1) {
		cout << "No";
		return 0;
	}

	if (s.size() == 2) {
		cout << "No";
		return 0;
	}

	if (m < (max(ll(s2.size()), 3ll) + ans)) {
		cout << "No";
		return 0;
	}

	ll k = s.size();
	if (m > (k * (k - 1)) / 2 + ans) {
		cout << "No";
		return 0;
	}

	cout << "Yes";

	return 0;
}

Measured memory_bytes: 16544
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,n,m,t,s,x;
	scanf("%d\n%d\n%d\n%d",&n,&m,&t,&x);
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=m;j++)
		{
			for(k=0;k<=t;k++)
			{
				if(i*500+j*100+k*50==x)
				{
					s++;
				}
			}
		}
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int x,y;
  int work;
  for(int i=0;i<3000;i++)
  {
    scanf("%d %d",&x,&y);
    if(x==0&&y==0)
      break;
    else
      if(x<y)
        printf("%d %d\n",x,y);
      else 
        printf("%d %d\n",y,x);

    }
}

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

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007
#define MOD2 998244353



int main() {
    int N, Q; cin >> N >> Q;
    set<pair<int, pii>> Time;
    int s, t, x, d;
    rep(i, N) {
        cin >> s >> t >> x;
        Time.insert(mp(s - x, mp(-1, x)));
        Time.insert(mp(t - x, mp(0, x)));
    }
    rep(i,Q){
        cin >> d;
        Time.insert(mp(d,mp(1,i)));
    }
    vi res(Q,-1);

    multiset<int> S; 

    for(auto mochi : Time){
        int type = mochi.S.F;
        int num = mochi.S.S;
        if(type == -1) S.insert(num);
        if (type == 0) S.erase(S.find(num));
        if(type == 1) res[num] = (!S.empty() ? *S.begin() : -1);
    }

    rep(i,Q) cout << res[i] << endl;
}


Measured memory_bytes: 48896
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,d=0,x=0,y=0,z=0;
  int c = 0;
  string s="",t="";
  //

  // ここから
  IN(n);
  if(n%111==0) OUT(n);
  else OUT(((n/111)+1)*111);
}


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

int main(void){
int n,d;
int yes=0;
long double ans;
int x[200005],y[200005];
scanf("%d %d",&n,&d);

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

for(int i=0;i<n;i++){
    ans=sqrt((long double)x[i]*(long double)x[i]+(long double)y[i]*(long double)y[i]);
    if(ans<=(long double)d){yes++;}
}
printf("%d\n",yes);

}


Measured memory_bytes: 3716
#include "bits/stdc++.h"

using namespace std;

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

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int n;
	cin >> n;


	map<string, int> mp;
	vector<string> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		mp[s[i]]++;
	}

	int m;
	cin >> m;

	vector<string> t(m);
	for (int i = 0; i < m; i++) {
		cin >> t[i];
		if (0 < mp.count(t[i])) {
			mp[t[i]]--;
		}
	}

	int ans = 0;
	for (auto m : mp) {
		pair<string, int> p = m;
		ans = max(ans, p.second);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,D; cin >> N >> D;
    vector<ll> d(N);
    rep(i,N) cin >> d[i];

    vector<ll> A(N+1),B(N+1);
    A[0] = D;
    rep(i,N) A[i+1] = min(A[i],abs(A[i]-d[i]));
    B[N] = 1;
    for (int i = N-1; i >= 0; i--) {
        if (d[i] < B[i+1]*2) B[i] = min(B[i+1] + d[i],D+1);
        else B[i] = B[i+1];
    }

    int Q; cin >> Q;
    while (Q--) {
        int x; cin >> x;
        --x;
        cout << (A[x] >= B[x+1] ? "YES" : "NO") << ln;
    }
}


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

typedef long long ll;
 
int main(){
  string a, b;
  cin >> a >> b;
  if(a.length()>b.length()){
    cout << "GREATER" << endl;
    return 0;
  }else if(a.length()<b.length()){
    cout << "LESS" << endl;
    return 0;
  }
  for(int i=0; i<a.length(); i++){
    if(a[i]>b[i]){
      cout << "GREATER" << endl;
      return 0;
    }
    if(a[i]<b[i]){
      cout << "LESS" << endl;
      return 0;
    }
  }
  cout << "EQUAL" << endl;
  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int N, X;
    cin >> N >> X;
    int sum = 0;
    int sukunaiyatu = INT_MAX;
    for (int i=0; i < N; i++) {
        int n;
        cin >> n;
        sum += 1;
        X -= n;
        if (n < sukunaiyatu) {
            sukunaiyatu = n;
        }
    }

    sum += X / sukunaiyatu;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
// https://www.youtube.com/watch?v=1CaS4pSpS3c     lana is <3
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 
const ll inf=1e18+1e17;
const ll mod = LLONG_MAX;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const ll N =21000000;

void solve(){
	ll arr[4];
	for ( int i=0;i<4;i++)
		cin>>arr[i];
	cout<<max( arr[0]*arr[2], max(arr[1]*arr[3],max(arr[0]*arr[3],arr[1]*arr[2])))<<'\n';
}


int main(){

	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);

	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif

	int t=1;
	//cin>>t;
	while ( t-- )
		solve();
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define po pop_back
#define fast ios_base::sync_with_stdio(false)
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define map map<ll,ll>
#define set set<ll>
#define tostr to_string
#define toint stoi
#define gcd __gcd


int main()
{
    fast;
    ll r;cin>>r;
   cout<<r*r<<endl;
}


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

int main() {
  int n,d,cnt=0,ans=0;
  cin >> n >> d;
  vector<vector<int>>table(n,vector<int>(d));
  for (int i = 0; i < n; i++) for (int j = 0; j < d; j++) {
    cin >> table.at(i).at(j);
  }
  for (int i = 0; i < n-1; i++) {
    for (int j = i+1; j < n; j++) {
      for (int k = 0; k < d; k++) {
        cnt += (table.at(i).at(k) - table.at(j).at(k)) * (table.at(i).at(k) - table.at(j).at(k)); 
      }
        for (int l = 0; l < 1000; l++) {
          if (cnt == l*l) {
            ans++;
          }
        }
         cnt = 0;                      
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,standard;
    scanf("%d%d",&n,&standard);
    int s[n],a=0;
    for(int i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    for(int j=0;j<n;j++){
        if(s[j]>=standard){
           a++;
        }
    }
    printf("%d",a);
    return 0;
}



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

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

#define INF -10000000000000

int main(){
    ll d[3][200000];
    ll a[200000];
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        d[0][i]=d[1][i]=d[2][i]=INF;
        cin>>a[i];
    }
    d[0][0]=0;
    d[1][1]=0;
    d[2][2]=0;
    for(int i=2;i==2;i++){
        d[0][i]=d[0][i-2]+a[i-2];
    }
    for(int i=3;i==3;i++){
        d[0][i]=d[0][i-2]+a[i-2];
        d[1][i]=max(d[1][i-2]+a[i-2],d[0][i-3]+a[i-3]);
    }
    for(int i=4;i<n;i++){
        d[0][i]=d[0][i-2]+a[i-2];
        d[1][i]=max(d[1][i-2]+a[i-2],d[0][i-3]+a[i-3]);
        d[2][i]=max(d[2][i-2]+a[i-2],max(d[1][i-3]+a[i-3],d[0][i-4]+a[i-4]));
        //cout<<i<<":"<<d[0][i]<<":"<<d[1][i]<<":"<<d[2][i]<<endl;
    }
    ll sum=0;
    if((n+1)%2){
        sum=max(d[0][n-2]+a[n-2],d[1][n-1]+a[n-1]);
    }else{
        sum=max(d[0][n-3]+a[n-3],max(d[1][n-2]+a[n-2],d[2][n-1]+a[n-1]));
    }
    cout<<sum;

    return 0;
}

Measured memory_bytes: 9812
#include <iostream>

using namespace std;

int main()
{
    int A , B ;
    cin >> A >> B ;
    if( A >= 13)
    {
        cout << B << endl;
    }
    if( A >= 6 && A < 13)
    {
        cout << B/2 << endl;
    }
    if( A < 6)
    {
        cout << B - B << endl;
    }
    return 0;
}


Measured memory_bytes: 3568
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in [0]*d]
t=[int(input()) for i in [0]*d]
k=0
n=1
p=[0]*26
for i in t:
    k+=s[n-1][i-1]
    p[i-1]=n
    k-=sum([(n-p[i])*c[i] for i in range(26)])
    print(k)
    n+=1

Measured memory_bytes: 68304
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-8;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		char buf[64];
		int in[26], out[26];
		bool edge[26][26];
		memset(in, 0, sizeof(in));
		memset(out, 0, sizeof(out));
		memset(edge, 0, sizeof(edge));
		while (n--)
		{
			scanf("%s", buf);
			int f = buf[0] - 'a';
			int b = buf[strlen(buf)-1] - 'a';
			++in[f];
			++out[b];
			edge[f][b] = true;
		}

		bool visit[26];
		memset(visit, 0, sizeof(visit));
		int s = 0;
		while (!in[s])
			s++;
		queue<int> q;
		q.push(s);
		while (!q.empty())
		{
			int cur = q.front(); q.pop();
			visit[cur] = true;
			for (int i = 0; i < 26; ++i)
				if (edge[cur][i] && !visit[i])
					q.push(i);
		}

		bool res = true;
		for (int i = 0; i < 26; ++i)
			res &= in[i] == out[i]
				&& (in[i] == 0 || visit[i]);

		if (res)
			puts("OK");
		else
			puts("NG");
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(){
    int N,l,r;
    int cnt,i;
    cnt = 0;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d %d",&l,&r);
        cnt += r-l+1;
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        for(int i=1;;i++){
            int x = sc.nextInt();
            if(x==0) break;
            System.out.printf("Case %d: %d\n",i,x);
        }
    }
}





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

int main() {
    long long N;
    cin >> N;
    map<long long,long long> mp;
    vector<long long> vec;
    for (long long i = 0;i<N;i++) {
        long long a;
        cin >> a;
        mp[a]++;
        if (mp[a] == 2) {
          vec.push_back(a);
          mp[a] = 0;
        }
    }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  if (vec.size() < 2) cout << 0 << endl;
  else cout << vec.at(0)*vec.at(1) << endl;

}


Measured memory_bytes: 6528
n,k = map(int,input().split())

s=list(input())

now_happy_count = 0

for i in range(n-1):
    if s[i] == s[i+1]:
        now_happy_count += 1

index = 0

reverse_candidate = []

while index < n:
    if s[index] != s[0]:
        start = index
        while index < n and s[index] != s[0]:
            index += 1
        end = index - 1
        reverse_candidate.append([start, end])
    else:
        index += 1

if len(reverse_candidate) <= k:
    print(n-1)
else:
    print(now_happy_count+2*k)
   


Measured memory_bytes: 81260
int main(void){
 int a = 0;
 int b = 0;
 int d = 0;
 int r = 0;
 double f = 0;
    
 scanf("%d %d",&a,&b);
 d = a/b;
 r = a%b;
 f = ((double)a)/((double)b);
    
 printf("%d %d %.6lf\n", d, r, f);
 return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;

queue<int> bq;

struct edge{
	int v, flow, C, rev;
};

vector<edge> adj[204];

int level[204], start[204];


void addEdge(int u, int v,int C){
	edge a = { v,0,C,adj[v].size() };
	edge b = { u,0,0,adj[u].size() };
	adj[u].push_back(a);
	adj[v].push_back(b);
}

bool bfs(int s, int t){
	for (int i = 0; i < 204; i++)
		level[i] = -1;
	level[s] = 0;
	bq.push(s);
	while(!bq.empty()){
		int f = bq.front();
		bq.pop();
		for(auto it:adj[f]){
			if(level[it.v]==-1&&it.flow<it.C){
				level[it.v] = level[f] + 1;
				bq.push(it.v);
			}
		}
	}
	if (level[t] == -1)
		return false;
	return true;
}

int dfs(int f, int t, int cflow){
	if (f == t)
		return cflow;
	for (; start[f] < adj[f].size(); start[f]++) {
		edge& ef = adj[f][start[f]];
		if (level[ef.v]==level[f]+1&&ef.flow<ef.C){
			int newflow = min(cflow, ef.C - ef.flow);
			int finalflow = dfs(ef.v, t, newflow);
			if(finalflow>0){
				ef.flow += finalflow;
				adj[ef.v][ef.rev].flow -= finalflow;
				return finalflow;
			}
		}
	}
	return 0;
}

int maxflow(int s, int t){
	int ans = 0;
	while(bfs(s,t)){
		for (int i = 0; i < 204; i++)
			start[i] = 0;
		while (true) {
			int newflow = dfs(s, t, 1000000);
			if (newflow <= 0)
				break;
			ans += newflow;
		}
	}
	return ans;
}

char g[204][204];
int n,m;

void buildGraph(){
    for(int i = 0; i<n+m; i++)
        adj[i].clear();
    for(int i = 0; i<n; i++){
        for(int j = 0; j<m; j++){
            if(g[i][j]=='o'){
                addEdge(i,n+j,1);
                addEdge(n+j,i,1);
            }
        }
    }
}

int main() {
	ios::sync_with_stdio(0);
	scanf("%d%d",&n,&m);
    int sx,sy,ex,ey;
    for(int i = 0; i<n; i++){
        scanf("%s",g[i]);
        for(int j = 0; j<m; j++){
            if(g[i][j]=='S')
                sx = i,sy = j;
            else if(g[i][j]=='T')
                ex = i,ey = j;
        }
    }
    if(sx==ex||sy==ey)
        printf("-1\n");
    else{
        buildGraph();
        addEdge(n+m,sx,10000);
        addEdge(n+m,n+sy,10000);
        addEdge(ex,n+m+1,10000);
        addEdge(n+ey,n+m+1,10000);
        int ans = maxflow(n+m,n+m+1);
        printf("%d\n",ans);
    }
	return 0;
}

Measured memory_bytes: 1152
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

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

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

map<int, int> mp;
signed main(void)
{
  int n;
  cin >> n;
  REP(i, n) {
    int a;
    cin >> a;
    if(mp.find(a) == mp.end()) mp[a] = 1;
    else mp[a]++;
  }

  int ret = 0;
  for(auto i: mp) {
    if(i.second%2==1) ret++;
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const int INF = 1e9;
const int MOD = INF+7;
const i64 LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)
#define int int64_t 

signed main(){
    int D,G;
    cin >> D >> G;
    vector<int> P(D),C(D);
    rep(i,D) cin >> P[i] >> C[i];

    int ans = INF;
    for(int bit = 0;bit < (1 << D); bit++){
        vector<int> p = P;
        int sum = 0;
        int solved = 0;

        for(int i = 0; i < D; i++){
            if(bit & (1 << i)) {
                sum += 100*(i+1)*p[i] + C[i];
                solved += p[i]; 
                p[i] = 0;
            }
        }

        int i = D-1;
        while(sum < G){
            if(p[i] == 0) {i--;continue;}
            sum += 100*(i+1);
            solved++;
            p[i]--;
            if(p[i] == 0) sum += C[i];
        }
        ans = min(ans,solved);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import heapq
job = list()
salary = list()
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    job.append((a,b))

job.sort(reverse = True)

for x in job:
    s,t = x
    heapq.heappush(salary,t)
    if s - m > 0:
        heapq.heappop(salary)
    else:
        m -= 1

print(sum(salary))


Measured memory_bytes: 17620
#include <iostream>
#include <queue>
#include <algorithm>
const int MAX = 2e5 + 10;
using namespace std;

int main()
{
	string s; cin>>s;

	int n = s.length();

	int i=0; int a[MAX] = {0};

	while(i < n) {
		int j = i; int b = 0;
		while(s[j] == 'R') j++;


		int re = j-1;
		int le = j;
		while(s[j] == 'L') j++;
		
		b += j-i;	
		a[re] = b/2;
		a[le] = b/2;	
		if(b%2 == 1) {
			int nr = re-i+1;
			int nl = j-le;
			if(nr > nl) {
				if(nr%2) a[re]++;
				else a[le]++;
			}
			else{
				if(nl%2) a[le]++;
				else a[re]++;
			}
		}
		i = j;
	}

	for(int i=0;i<n;i++) cout<<a[i]<<" ";
}

Measured memory_bytes: 1408
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	r, g := nextInt(), nextInt()
	fmt.Println(2*g - r)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}


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

using namespace std;

int main() {
  int N;
  string s;

  cin >> N;
  cin >> s;

  int ans = 1;
  for (int i = 1; i < N; i++) {
    if (s[i-1] != s[i]) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] a = in.nextIntArray(3);
            Arrays.sort(a);

            out.println(a[0] + a[1]);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



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


int main() {
    int n;
    cin >> n;
    int a[100000];
    for (int i = 0; i < n; ++i){
        cin >> a[i];
    }
    sort(a,a+n);

    int ans=0,t=0;
    while(t<n){
        int point=a[t],cnt=0;
        while(t<n && a[t]==point){
            cnt++;
            t++;
        }
        ans+=cnt%2;
    }
    cout << ans << endl;
}


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

using namespace std;

int main(void){
  int K, T;
  cin >> K >> T;
  vector<int> a(T);
  for(int i = 0; i < T; i++) cin >> a[i];
  int m = *max_element(a.begin(), a.end());
  int s = accumulate(a.begin(), a.end(), 0) - m;
  cout << max(0, m - s - 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int h, n; cin >> h >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        h -= a[i];
    }
    if (h <= 0) {
        puts("Yes");
    }
    else {
        puts("No");
    }
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(vs) (ll)(vs.size())
#define rep(i,a,b) for (ll i = a; i < b; ++i)
#define rep_(i,a,b) for (ll i = a; i > b; --i)
#define endl '\n'
const ll mod = 1e9 + 7;

const ll maxn = 2e5 + 5;

ll n, m, done[maxn];
vi g[maxn];

ll dfs(int u) {
	done[u] = 1;
	int num = 1;
	for (auto v: g[u]) {
		if (!done[v]) {
			num += dfs(v);
		}
	}
	return num;
}

// #include "debug.h"
void solve() {
	cin >> n >> m;
	memset(done, 0, sizeof(done));
	set<pair<int, int>> s;
	rep(i, 0, m) {
		int u, v;
		cin >> u >> v;
		s.insert({u, v});
	}
	for (auto edge: s) {
		g[edge.first].pb(edge.second);
		g[edge.second].pb(edge.first);
	}
	ll ans = 0;
	for (int i = 1; i <= n; ++i) {
		if (!done[i]) {
			ans = max(ans, dfs(i));
		}
	}
	cout << ans << endl;
}

void aux() {
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout<<fixed<<setprecision(10);
	aux();
	ll _ = 1;
	// cin>>_;
	while(_--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 34804
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int n;
  cin>>n;
  int a[n];
  int d = 0;
  int cnt[n] = {};
  REP(i,n){
    cin>>a[i];
    d = max(d, a[i]);
    cnt[a[i]]++;
  }
  
  bool flag = true;
  int temp;
  REP(i,d+1){
    temp = max(i,d-i);
    if(cnt[temp]){
      cnt[temp]--;
    }else{
      flag = false;
      break;
    }
  }
  if(!flag){
    cout<<"Impossible"<<endl;
    return 0;
  }
  
  int l,r;
  l = (d+1)/2+1;
  r = d;
  REP(i,n){
    if(cnt[i]){
      if(l<=i && i<=d){
        continue;
      }else{
        flag = false;
        break;
      }
    }
  }
  
  if(flag){
    cout<<"Possible"<<endl;
  }else{
    cout<<"Impossible"<<endl;
  }
  
  return 0;
}


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++)

 
int main() {
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    
    if(a+b<=2*c)cout<<a*x+b*y<<endl;
    else if(x>y)cout<<min(2*c*y+(x-y)*a,2*c*x)<<endl;
    else cout<<min(2*c*x+(y-x)*b,2*c*y)<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

A,B = inpl()
if B%A == 0:
    print(A+B)
else:
    print(B-A)


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

int main () {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  char c1 = toupper(s1.at(0));
  char c2 = toupper(s2.at(0));
  char c3 = toupper(s3.at(0));
  cout << c1 << c2 << c3 << endl;
}

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

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

typedef long long ll;

const int N = 5050;


#define left __nico_left
#define right __nico_right
int n, p[N], r[N], left, right;
ll dp[N][N], gt[N][N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >>n >> right >> left;
    forn(i,n) {
        cin >>p[i];
        --p[i];
        r[p[i]] = i;
    }
    forn(i,n) {
        int pos = r[i];
        for (int j = pos-1; j >= 0; j--) {
            gt[i][j] = gt[i][j+1] + (p[j] > p[pos]);
        }
    }

    for (int from = n-1; from >= 0; from--) {
        for (int first = n-1; first >= 0; first--) {
            if (r[first] < from) {
                dp[from][first] = dp[from][first+1];
            }
            else {
                ll cost = gt[first][from] > 0 ? left : 0;
                dp[from][first] = min(
                    cost + dp[from][first+1],
                    (ll) right * gt[first][from] + dp[r[first]+1][first]
                );
            }
        }
    }
    cout << dp[0][0] << endl;
    return 0;
}


Measured memory_bytes: 397568
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
#define MOD 1000000007
#define PI 3.14159265358979323846
using namespace std;
typedef long long ll;

#define MAX 1000000000000



int main(void) {
	map<int, int > mp;
	int n; cin >> n;
	rep(i, n-1) {
		int a; cin >> a;
		a--;
		mp[a]++;
	}

	rep(i, n) {
		cout << mp[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 12984
#include <iostream>
#include <vector>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

ll dp[100005];
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> h(n);
  rep(i,n){
      cin >> h[i];
  }
  rep(i,100005){
      dp[i]=LINF;
  }
  dp[0] = 0;
  rep(i,n){
      dp[i+2] = min(dp[i+2], dp[i]+ abs(h[i]-h[i+2]));
      dp[i+1] = min(dp[i+1], dp[i]+ abs(h[i]-h[i+1]));
  }
  cout << dp[n-1] << endl;
  
}


Measured memory_bytes: 1792
# frozen_string_literal: true

n = gets.to_i

arr = [0]
n.times do
  arr << gets.to_i
end

exist = Hash.new(false)
index = 1

count = 0

loop do
  if exist[index]
    count = -1
    break
  else
    exist[index] = true
  end

  count += 1
  next_i = arr[index]

  break if next_i == 2

  index = next_i
end

puts count


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll A, B, K;
    cin >> A >> B >> K;
    
    ll C = A + K - 1;
    ll D = B - K + 1;
    if(C < D) {
        REP(i,A,C+1) PR(i);
        REP(i,D,B+1) PR(i);
    }
    else {
        REP(i,A,B+1) PR(i);
    }

    return 0;
}

/*



*/

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

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

    int da = abs(x - a), db = abs(x - b);
	if(da > db)
    {
        puts("B");
    }else{
        puts("A");
    }
}


Measured memory_bytes: 256
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

X = int(input())

ans = 0
ans += 1000 * (X // 500)
X %= 500
ans += 5 * (X // 5)
print(ans)


Measured memory_bytes: 6712
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)

struct Edge {
    int to, cost;
};
using Graph = vector<vector<Edge>>;

Graph g;
int visited[100010];
int d[100010];
void dfs(int i, int p) {
    d[i] = p;
    visited[i] = 1;
    for (Edge& e : g[i]) if (!visited[e.to]) {
        dfs(e.to, p + e.cost);
    }
}

bool can() {
    bool ok = true;
    rep(i, g.size()) {
        for (Edge& e : g[i]) {
            ok &= d[e.to] == d[i] + e.cost;
        }
    }
    return ok;
}

int main() {
    int n, m; scanf("%d%d", &n, &m);
    g.resize(n);
    rep(i, m) {
        int l, r, d; scanf("%d%d%d", &l, &r, &d);
        l--; r--;
        g[r].push_back(Edge{l, d});
        g[l].push_back(Edge{r, -d});
    }

    rep(i, n) if (!visited[i]) dfs(i, 0);
    puts(can() ? "Yes" : "No");
    return 0;
}

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

int main(){

    //データ定義
    int width;
    int height;
    int circle_x;
    int circle_y;
    int circle_r;

    //長方形の右上の頂点の座標を取得
    cin >> width >> height;

    //円の中心の座標を取得
    cin >> circle_x >> circle_y;

    //円の半径を取得
    cin >> circle_r;

    //円が長方形の内部に含まれるかチェック
    //水平方向チェック
    if((circle_x - circle_r >= 0) && (circle_x + circle_r <= width)){
        //垂直方向チェック
        if((circle_y - circle_r >= 0) && (circle_y + circle_r <= height)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3124