akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<string>
using namespace std;
int main(){
    int N; 
    cin>>N;
    int a[N];
    int count=0;
    for(int i=0; i<N; i++){
        cin>>a[i];
    }
    bool f = true;
    while(f){
        for(int j=0; j<N; j++){
            if(a[j]%2!=0){
                f = false;
                break;
            }
            else{
                a[j]=a[j]/2;
            }
            if(j==N-1){
                count++;
            }
        }
    }
    cout<<count<<endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <limits>
#include <time.h>
#define inf 998244353

using namespace std;

int a[100005];

int main(void){
    int n, s, k;
    scanf("%d%d%d",&n,&k,&s);
    if(s!=1000000000)
    {
    for(int i=0;i<n;i++)
    {
        if(i<k)
        {
            a[i]=s;
        }
        else
        {
            a[i]=s+1;
        }
        printf("%d%c",a[i],i==n-1?'\n':' ');
    }
    }
    else
    {
        for(int i=0;i<n;i++)
    {
        if(i<k)
        {
            a[i]=s;
        }
        else
        {
            a[i]=1;
        }
        printf("%d%c",a[i],i==n-1?'\n':' ');
    }
    }
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <stack>
#include <cstdlib>
#include <cctype>
using namespace std;

int main(){
  stack<int> st;
  string s;

  while(cin >> s){
    if(isdigit(s[0])){
      st.push(atoi(s.c_str()));
    }
    else{
      int a = st.top(); st.pop();
      int b = st.top(); st.pop();

      if(s == "+") st.push(b + a);
      if(s == "-") st.push(b - a);
      if(s == "*") st.push(b * a);
    }
  }

  cout << st.top() << endl;
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <string.h>
int main()
{
	char str[101],answer[101];
	gets(str);
	int lens=strlen(str),i,lena=0;
	for(i=0;i<lens;i++)
		switch(str[i])
		{
			case '0':answer[lena]='0';lena++;break;
			case '1':answer[lena]='1';lena++;break;
			case 'B':if(lena!=0) lena--;break;
		}
	for(i=0;i<lena;i++)
		printf("%c",answer[i]);
	printf("\n");
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<29;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int x,y,s,i,j,t,m;
    while(1){
        x=in();
        y=in();
        s=in();
        if(!x)break;
        m=0;
        for(i=1;i<s;i++){
            for(j=1;j<s;j++){
                if(i*(100+x)/100+j*(100+x)/100==s)
                    m=max(m,i*(100+y)/100+j*(100+y)/100);
            }
        }
        print(m);
    }
    return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
using namespace std;
typedef long long ll;
const int maxn = 205;

int n,m;
int c[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "w", stdout);
#endif
  cin>>n>>m;
  for(int i=0;i<n;i++){
    int cc;
    cin>>cc;
    while(cc--){
      int x;
      cin>>x;
      c[x]++;
    }
  };
  int ret=0;
  for(int i=1;i<=m;i++)if(c[i]==n)ret++;
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

vector <int> col[200005];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int w, h, n;
    cin >> h >> w >> n;
    for (int i = 1; i <= n; i++)
    {
        int x, y;
        cin >> x >> y;
        col[y].pb(x);
    }
    for (int i = 1; i <= w; i++)
    {
        sort(col[i].begin(), col[i].end());
        col[i].pb(h + 1);
    }
    int ans = col[1][0], pos = 1;
    for (int i = 2; i <= w; i++)
    {
        int uk = 0;
        while (col[i][uk] <= pos) uk++;
        while (pos < h)
        {
            pos++;
            if (col[i][uk] == pos) uk++;
            else break;
        }
        ans = min(ans, col[i][uk]);
    }
    cout << ans - 1;
    return 0;
}


Measured memory_bytes: 11392
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1

print(ans)

Measured memory_bytes: 8936
s,t,a,b,x,y=map(int,open(0).read().split())
if a*s+b*t==x*s+y*t:
  print('infinity')
  exit()
if a<x:a,b,x,y=x,y,a,b
if a*s+b*t>x*s+y*t:
  print(0)
  exit()
n=(a*s-x*s)/(x*s+y*t-(a*s+b*t))
m=int(n)
print(m*2+(n>m))

Measured memory_bytes: 38384
#include <stdio.h>

int main(void)
{
	char str[1200];
	int i;
	gets(str);
	for (i = 0; str[i] != '\0'; i++)
	{
		if ('a' <= str[i] && str[i]  <=  'z')
			str[i] = str[i] - 'a' + 'A';
		else if ('A' <= str[i] && str[i] <= 'Z')
			str[i] = str[i] - 'A' + 'a';
	}
	printf("%s\n", str);
	return 0;
}

Measured memory_bytes: 524
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace app01
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            char[] c = new char[4];
            c = line.ToCharArray();
            int count = 0;

            for (int i = 0; i < 4; i++)
            {
                for(int j = i + 1; j <= 3; j++)
                {
                    if(c[i] == c[j])
                    {
                        count++;
                    }
                }
            }
            if(count == 2)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 11092
while True:
    n = int(input())
    if n == 0:
        break

    step = list(input().split())
    l = r = 0
    ne = 1
    cnt = 0
    for mov in step:
        if mov == "lu":
            l = 1
        elif mov == "ru":
            r = 1
        elif mov == "ld":
            l = 0
        else:
            r = 0
        if l == r == ne:
            cnt += 1
            ne = (ne + 1) % 2
    print(cnt)


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

int main()
{
	int n;
	cin>>n;
	if(n==1) cout<<"1.0000000";
	else if(n%2==0) cout<<"0.50000000";
	else
	{
		printf("%.7f",((n/2+1.0)*1.0)/n);
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

ll gcd(ll a, ll b){
  ll temp;
	while (a % b != 0){
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

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

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};

int main(){
    int N;
    cin >> N;
    cout << pow(N,3) << endl;
    return 0;
}


Measured memory_bytes: 256
// fahadmd16(IIEST Shibpur)

#include<bits/stdc++.h>
#include <algorithm>
using namespace std;

#define ll                          long long
#define pb                          push_back
#define pf                          push_front
#define eb                          emplace_back
#define mp                          make_pair
#define ff                          first
#define ss                          second
#define db                          double
#define pll                         pair<ll, ll>
#define ALL(a)                      (a).begin(),(a).end()
#define endl                        "\n"

#define forn(i, n) for (ll i = 0; i < n; i++)
#define forn1(i, n) for (ll i = 1; i < n; i++)
#define ford(i, n) for (ll i = n - 1; i >= 0; i--)
#define forab(i, a, b) for(ll i = a; i < b; i++)
#define eps 1e-10

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)


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

#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;


const ll sz = 1e5 + 3;
const ll mod = 1e9 + 7;
const ll mod2 = 1e9;


typedef vector<ll> VL;
typedef vector<pll > VLL;
typedef vector<vector<ll> > VVL;

ll power(ll n, ll k, ll m) {
    ll ans = 1;
    while (k) {
        if (k & 1)ans = (ans * n) % m;
        k /= 2;
        n = (n * n) % m;
    }
    return ans;
}

void solver() {
    ll n, m; cin >> n >> m;

    VL a(n);
    ll sum = 0;
    forn(i, n) {cin >> a[i]; sum += a[i];}
    // trace2(sum, n);
    if (sum - n > 0)cout << "-1\n";
    else cout << -sum + n << endl;

}


int main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    IOS;
    ll T = 1; //cin >> T;
    forn1(i, T + 1) {
        // clock_t z = clock();
        solver();
        // debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    }
    return 0;
}


Measured memory_bytes: 11088
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-8;

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

typedef int Weight;
struct Edge {
	int src, dst;
	Weight weight;
	Edge(int src, int dst, Weight weight) :
		src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int main() {
	ll N, M;
	cin >> N >> M;
	Graph g(N);
	vector<ll> dim(N);
	for (int i = 0;i < N - 1 + M;i++) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(Edge(a, b, 1));
		dim[b]++;
	}
	queue<ll> ok;
	for (int i = 0;i < N;i++)
		if (dim[i] == 0)
			ok.push(i);
	vector<ll> ans(N, -1);
	while (!ok.empty()) {
		ll now = ok.front();
		ok.pop();
		for (int i = 0;i < g[now].size();i++) {
			dim[g[now][i].dst]--;
			if (dim[g[now][i].dst] == 0) {
				ok.push(g[now][i].dst);
				ans[g[now][i].dst] = now;
			}
		}
	}
	for (int i = 0;i < N;i++)
		cout << ans[i]+1 << endl;
	return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
using namespace std;
#pragma warning (disable: 4996)
long long N, A[100009], B[100009], C[100009];
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	for (int i = 0; i < N; i++) cin >> C[i];

	sort(A, A + N);
	sort(B, B + N);
	sort(C, C + N);
	long long ret = 0;
	for (int i = 0; i < N; i++) {
		int pos1 = lower_bound(A, A + N, B[i]) - A;
		int pos2 = upper_bound(C, C + N, B[i]) - C;
		ret += 1LL * pos1*(N - pos2);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 2560
use std::collections::HashSet;
use std::cmp::min;
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let n: i32 = read();
    let an:Vec<i32> = read_vec();
    let under_red = an.iter().filter(|&&x| x < 3200).map(|x| x / 400).collect::<HashSet<_>>().len();
    let over_red = an.iter().filter(|&&x| x >= 3200).count();
    let min_ans = if  under_red == 0 {
        min(1,over_red)
    } else {
        under_red
    };
    let max_ans = under_red + over_red;
    println!("{} {}",min_ans,max_ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

ll f[2001001];
 
ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a; 
 while(b > 0)
    {
        if(b%2 == 1)
    {
        x=(x*y);
        if(x>MOD) x%=MOD;
    }
    y = (y*y);
    if(y>MOD) y%=MOD; 
    b /= 2;
    }
 return x;
}
 
/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}
 
ll C(ll n, ll k, ll MOD)
{
 
 return (f[n]*((InverseEuler(f[k], MOD) * InverseEuler(f[n-k], MOD)) % MOD)) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll mod=1e9+7;
    f[0] = 1;
    for(ll i = 1 ; i <= 2001000 ; i++)
        f[i] = (f[i-1]*i)%mod;
    ll n=nxtl(),k=nxtl();
    vector <ll> v(n+1);
    for(int i=1;i<=n;i++)
        cin>>v[i];
    v[0]=INT_MIN;
    sort(v.begin(),v.end());
    vector <ll> prefix(n+1);
    prefix[1]=v[1];
    for(int i=2;i<=n;i++)
        prefix[i]=prefix[i-1]+v[i];
    if(k==1){
        cout<<"0\n";
        return 0;
    }
    ll test=0;
    for(ll dist=k-2;dist<=n-2;dist++)
    {
        ll t=prefix[n]-prefix[max(n-dist-1,1+dist)]-prefix[min(dist+1,n-dist-1)];
        t%=mod;
        //cout<<dist<<" "<<t<<" ";
        t=(t*C(dist,k-2,mod))%mod;

        test=(test+t)%mod;
        //cout<<t<<" "<<test<<endl;


    }

    cout<<test<<endl;

    
  

    return 0;   
}


 
 


Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__);
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
const int INF = 1e18;
const int MX = 1000001;
bool visited[MX];
map<int,int>cnt;
int mx = -1;
set<int>graph[MX];
int c  = 0;

void dfs(int node, int c){
    // see(node,c)
    visited[node]=true;
    // cc[node]=c;
    cnt[c]++;
    mx=max(mx,cnt[c]);
    for(auto child: graph[node]){
        if(!visited[child])
            dfs(child,c);
    }



}

int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    int n,m,x,y;
    cin>>n>>m;
    set<pair<int,int>>st;
    for(int i =0;i<m;i++){
        cin>>x>>y;
        graph[x].insert(y),graph[y].insert(x);
    }
    for(int i = 1;i<=n;i++){
        if(!visited[i]){
            dfs(i,c);
            c++;
        }
    }
    // see(mx);
    cout<<mx<<endl;
    return 0;
}


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

class UnionFind {
public:
    UnionFind() :data(0) {}
    UnionFind(int size) : data(size, -1) { }
    void resize(int size) { *this = { size }; }
    bool unionset(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) std::swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findset(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
private:
    std::vector<int> data;
};


int n;
void solve() {
    cin >> n;

    vector<pair<ll, ll>> ab(n);
    rep(i, n) cin >> ab[i].first;
    rep(i, n) cin >> ab[i].second;

    vector<int> a2(n), b2(n);
    vector<ll> a3(n), b3(n);

    all(sort, ab);
    rep(i, n) {
        a3[i] = ab[i].first;
        ab[i].first = a2[i] = i;
        swap(ab[i].first, ab[i].second);
    }
    all(sort, ab);
    rep(i, n) {
        b3[i] = ab[i].first;
        ab[i].first = b2[i] = i;
        swap(ab[i].first, ab[i].second);
    }


    rep(i, n)
        if (a3[i] > b3[i]) {
            cout << "No" << endn;
            return;
        }

    UnionFind uf(n);
    rep(i, n)
        uf.unionset((int)ab[i].first, a2[i]);

    map<int, bool> mp;
    rep(i, n) mp[uf.root(i)] = true;
    if (mp.size() > 1) { cout << "Yes" << endn; return; }

    rep(i, n - 1)
        if (b3[i] >= a3[i + 1]) { cout << "Yes" << endn; return; }

    cout << "No" << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

    string S; cin >> S;

    bool a = false;
    bool b = false;
    bool c = false;

    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == 'a') {
            a = true;
        }

        if (S[i] == 'b') {
            b = true;
        }

        if (S[i] == 'c') {
            c = true;
        }
    }

    if (a && b && c){
        puts("Yes");
    } else {
        puts("No");
    }
}

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

struct Problem {

    void Solve() {
        UL N; cin >> N;
        UL K; cin >> K;
        UL A[100] = {};
        rep(i, K) {
            UL d; cin >> d;
            while (d--) {
                UL a; cin >> a;
                A[a - 1]++;
            }
        }
        UL ans = 0;
        rep(i, N) {
            if (A[i] == 0) ans++;
        }
        cout << ans << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    p->Solve();
    return 0;
}


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

#define lli long long int
#define pi pair<int,int>
#define mod 1000000007
const int INF=1e9+5;
lli min_cost(vector<int> &v)
{
	int n=v.size();
	vector<lli> dp(n,INF);
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j : {i+1,i+2})
		{
			if(j<n)
				dp[j]=min(dp[j],dp[i]+abs(v[i]-v[j]));
		}
		//dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	return dp[n-1];
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);	cout.tie(0);
	int n;
	cin>>n;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	cout<<min_cost(arr)<<endl;
	return 0;
}

Measured memory_bytes: 1408
n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp = [float('inf')] * n
dp[0] = 0
for i in range(1, n):
  pre = min(i, k)
  while pre > 0:
    dp[i] = min(dp[i], dp[i-pre] + abs(hs[i-pre] - hs[i]))
    pre -= 1
print(dp[-1])

Measured memory_bytes: 54624
from math import radians, cos, sin, ceil, floor
g = 90
x = y = 0
while 1:
    d, a = map(int, input().split(","))
    if d == 0:
        break
    t = radians(g)
    x += cos(t) * d
    y += sin(t) * d
    g -= a
x = floor(x) if x > 0 else ceil(x)
y = floor(y) if y > 0 else ceil(y)
print("%d" % x)
print("%d" % y)



Measured memory_bytes: 5724
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
  lli i,j,q,n,m,x,t,ans,sum = 0,maxi;
  cin >> n;
  vector<lli> vec(n);
  for(i=0;i<n;i++)
  {
    cin >> vec[i];
  }
  maxi = vec[0];
  for(i=1;i<n;i++)
  {
    if(vec[i] >= vec[i-1])
    {
      maxi = vec[i];
    }
    else
    {
      sum = sum + vec[i-1] - vec[i];
      vec[i] = vec[i-1];
      maxi = vec[i];
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 4768
#include <stdio.h>

int main(void) {
	int r, c;
	int sheet[101][101] = {};
	int i, j;
	
	scanf("%d %d", &r, &c);
	
	for (i = 0; i < r; i++){
		for (j = 0; j < c; j++){
			scanf("%d", &sheet[i][j]);
			sheet[i][c] += sheet[i][j];
			sheet[r][j] += sheet[i][j];
			sheet[r][c] += sheet[i][j];
		}
	}
	
	for (i = 0; i <= r; i++){
		for (j = 0; j <= c; j++){
			if (j != 0) printf(" ");
			printf("%d", sheet[i][j]);
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 652
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> P;
#define X real()
#define Y imag()
ld restant(P p){return abs(p);}
//polar(x,y) mag=l,arg=y
//typedef unordered_set<ll> usll;
//typedef unordered_multiset<ll> umsll;
typedef multiset<ll> msll;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll> > vpll;
typedef priority_queue<ll> pqll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
//typedef unordered_multiset<int> umsi;
//typedef unordered_set<int> usi;
typedef pair<int,int> pi;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<double,double> > vpd;
typedef pair<double,double> pd;
typedef priority_queue<int> pqi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ind_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ind_setll;
#define in insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define be begin
#define en end
#define itr iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mo 1000000007
#define inf 1000000000000000001
#define ninf -1000000000000000001
#define ima INT_MAX
#define imi INT_MIN
#define oncnt __builtin_popcount
#define zerobegin __builtin_clz
#define zeroend __builtin_ctz
#define parity __builtin_parity
#define all(x) x.be(),x.en()
#define eps 1e-9
const ld pii=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}

ll dp[3000][3000][2];

ll fun(int st,int l,int r,ll a[])
{
	if(l==r)
	{if(st==0)
	return dp[l][r][st]=a[l];
	return dp[l][r][st]=-a[l];
    }
	if(dp[l][r][st]!=-1)
	return dp[l][r][st];
	if(st==0)
	return dp[l][r][st]=max(a[l]+fun(1-st,l+1,r,a),a[r]+fun(1-st,l,r-1,a));
	return dp[l][r][st]=min(-a[l]+fun(1-st,l+1,r,a),-a[r]+fun(1-st,l,r-1,a));
}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{	
int n;
cin>>n;
ll a[n];
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{
	for(int j=0;j<n;j++)
	{
		for(int k=0;k<2;k++)
		dp[i][j][k]=-1;
	}
}

cout<<fun(0,0,n-1,a);

}return 0;}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define read cin >>
#define echo cout <<
#define fin << '\n'
#define _ << ' ' <<
#define in :
#define var auto&&

constexpr int MOD = (int)1e9 + 7;

int fact[100100];
int iFact[100100];

int power ( int n, int r ) {
    int ans = 1;
    while ( r ) {
        if ( r & 1 ) ans = (ans * n) % MOD;
        n = (n*n) % MOD;
        r >>= 1;
    }
    return (int)ans;
}

int ncr ( int n, int r ) {
    return (((fact[n] * iFact[r]) % MOD) * iFact[n-r]) % MOD;
}

void fact_inv ( ) {
    fact[0] = 1;
    iFact[0] = 1;
    for ( int i = 1; i < 100100; i++ ) {
        fact[i] = (i*fact[i-1]) % MOD;
        iFact[i] = (power(i, MOD-2) * iFact[i-1]) % MOD;
    }
}


signed main ( ) {

    fact_inv();

    int n, k;
    read n >> k;
    vector<int> a(n);
    for ( var i in a ) read i;
    sort(a.begin(), a.end());

    int max_sum = 0;
    int min_sum = 0;

    for ( int i = 0; i < n; i++ ) {
        // max
        if ( i >= k-1 ) {
            max_sum += ( ncr(i, k-1) * a[i] ) % MOD;
            max_sum %= MOD;
        }

        // min
        int up = n - i - 1;
        if ( up >= k-1 ) {
            min_sum += ( ncr(up, k-1) * a[i] ) % MOD;
            min_sum %= MOD;
        }
    }

    echo ( max_sum - min_sum + MOD ) % MOD fin;

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
string s[20000];
string x[20000];
string ss;
vector<string>l,h;
int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
       // cout<<"A"<<endl;
        cin>>s[i];
        x[i]=s[i];
        for(int j=0;j<s[i].size();j++)
        {
            if(s[i][j]=='?')
            {
                s[i][j]='a';
                x[i][j]='z';
            }
        }
        l.push_back(s[i]);
        h.push_back(x[i]);
    }
    cin>>ss;
    l.push_back(ss);
    h.push_back(ss);
    sort(l.begin(),l.end());sort(h.begin(),h.end());
    int low=upper_bound(l.begin(),l.end(),ss) - l.begin();
    int hig=lower_bound(h.begin(),h.end(),ss) - h.begin();
    //cout<<low<<" "<<hig<<endl;
    cout<<hig+1;
    for(int i=hig+2;i<=low;i++)
    {
        cout<<" "<<i;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 2688
set1={1,3,5,7,8,10,12}
set2={4,6,9,11}
set3={2}
x,y=map(int,input().split())
if x in set1 and y in set1:
  print('Yes')
elif x in set2 and y in set2:
  print('Yes')
else:
  print('No')  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n,a[200005];
bool chk(ll m){
    if(m==1){
        for(ll i=1;i<n;i++)if(a[i]<=a[i-1])return 0;
        return 1;
    }
    map<ll,ll> cur;
    for(ll i=1;i<n;i++){
        if(a[i]>a[i-1])continue;
        map<ll,ll>::iterator itr;
        while( (itr=cur.upper_bound(a[i]))!=cur.end() )cur.erase(itr);
        cur[a[i]]++;
        ll val = a[i];
        while(cur[val]>=m){
            cur.erase(val);
            val--;
            cur[val]++;
            if(val==0)return 0;
        }
    }
    return 1;
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(ll i=0;i<n;i++)cin>>a[i];
    ll s=1,e=n;
    while(s<e){
        ll mid=(s+e)>>1;
        if(chk(mid))e=mid;
        else s=mid+1;
    }
    cout<<e;
}




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

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

  long long int ans = 0; 
  for(int min_index=0; min_index < n-2; min_index++){
    int max_index = min_index + 2;
    for(int middle_index = min_index + 1; middle_index < n-1; middle_index++){
      while(max_index < n){
        if(l[min_index] + l[middle_index] > l[max_index]) max_index++;
        else break;
      }
      ans += max_index - middle_index - 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

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

  pair<pair<string, int>, int> p[N];

  for (int i = 0; i < N; ++i) {
    string s;
    cin >> s;
    int point;
    cin >> point;
    p[i] = make_pair(make_pair(s, -point), i + 1);
  }

  sort(p, p + N);

  for (int j = 0; j < N; ++j) {
    cout << p[j].second << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a[4],b[10]={0,1,0,0,1,0,0,1,0,1};
    bool flag=true;
    for(int i=0;i<4;i++){
        cin >> a[i];
        if(b[a[i]]==0){flag=false;}
        else{
            b[a[i]]--;
        }
    }
    if(flag){
        cout<<"YES";
    }else cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
#define REP(i, n) for (i64 (i) = 0; (i) < (n); ++(i))
#define FOR(i, a, b) for (i64 (i) = (a); (i) < (b); ++(i))

const int INF = 1 << 25;

void WF(vector<vector<int>> &mat) {
    int V = mat.size();
    REP(i, V) mat[i][i] = 0;
    REP(k, V) REP(i, V) REP(j, V) {
        if (mat[i][j] > mat[i][k] + mat[k][j]) {
            mat[i][j] = mat[i][k] + mat[k][j];
        }
    }
}

signed main() {

    int N;  cin >> N;
    vector<int> A(N), B(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];

    int cnt = 0;
    REP(i, N) if (A[i] == B[i]) ++cnt;
    if (cnt == N) {
        cout << 0 << endl;
        return 0;
    }

    REP(i, N) if (A[i] != B[i] and A[i] <= 2 * B[i]) {
        cout << -1 << endl;
        return 0;
    }

    int mx = *max_element(A.begin(), A.end());

    ui64 res = 0;

    for (int i = mx; i >= 1; --i) {
        vector<vector<int>> mat(51, vector<int>(51, INF));
        ui64 use = (res | ((1ULL << i) - 1)) >> 1 << 1;
        for (int j = 1; j <= mx; ++j) {
            for (int k = 1; k <= j; ++k) {
                if (use & (1ULL << k)) {
                    mat[j][j % k] = 1;
                }
            }
        }
        WF(mat);
        bool valid = true;
        for (int j = 0; j < N; ++j) {
            if (mat[A[j]][B[j]] >= INF) {
                valid = false;
                break;
            }
        }
        if (not valid) res |= 1ULL << i;
    }

    cout << res << endl;

}

Measured memory_bytes: 256
#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;
template <class T> using treap = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, unordered_map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

int INF = 1e18;
signed main() {
  int n; cin >> n;
  vector<int> a(n); REP (i, n) cin >> a[i];
  vector<int> l(n + 1, -1), r(n + 1, -1);
  REP (i, n) {
    l[i + 1] = max(l[i], a[i]);
  }
  for (int i = n - 1; i >= 0; i--) {
    r[i] = max(r[i + 1], a[i]);
  }
  REP (i, n) {
    cout << max(l[i], r[i + 1]) << endl;
  }
}


Measured memory_bytes: 6272
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque

N,X,Y = map(int, input().split())

queue = deque()

edges = [[] for _ in range(N)]

for i in range(N-1):
    edges[i].append(i+1)
    edges[i+1].append(i)

edges[X-1].append(Y-1)
edges[Y-1].append(X-1)

ans = [0] * N

for i in range(N):
    visited = [0] * N
    visited[i] = 1
    queue.append((i,0))
    while queue:
        current, dist = queue.popleft()
        ans[dist] += 1

        for e in edges[current]:
            if visited[e] != 1:
                queue.append((e, dist+1))
                visited[e] = 1

ans = ans[1:]
for a in ans:
    print(a//2)

Measured memory_bytes: 83036
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14) <<double値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    sort(l.begin(),l.end());
    vector<int> lm;
    int cnt=0;
    int L=0,R=n-1,mid;
    for(int R = n-1; R >= 0; R--){
        for(int L = R-1; L >= 0; L--){
            //key値以上の値のイテレータ
            auto pos = lower_bound(l.begin(),l.end(),l[R]+l[L]);
            int dis = distance(pos,l.end());
            cnt+=n-dis-R-1;
        }
    }
    cout << cnt;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n;
  int w;
  int k=1;
  while(cin >> w >> n, w) {
    int p[n], a[w];
    REP(i, n) {
      scanf("%d,%d", &p[i], &a[i]);
    }
    int dp[n+1][w+1];           // dp[i][j]:iツ氾板姪堋づ慊づづ個陛ウツづ、ツ重ツつウツづ個堕債和ツつェjツ暗按可コツづ個づつォツづ個催妥・
    memset(dp, 0, sizeof(dp));
    REP(i, n) {
      REP(j, w+1) {
        if (j<a[i])
          dp[i+1][j] = dp[i][j];
        else
          dp[i+1][j] = max(dp[i][j],dp[i][j-a[i]] + p[i]);
      }
    }
    printf("Case %d:\n", k++);
    cout << dp[n][w] << endl;
    cout << lower_bound(dp[n], dp[n]+w+1, dp[n][w])-dp[n] << endl;
  }
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long


#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

const int N=1e5+5;
const int mod=1e9+7;

int32_t main() {
int a,b,c;
cin>>a>>c>>b;
if(c==0)return cout<<"NO",0;
int k=1;
while(k*a<=100*a){
    if((k*a)%c==b%c)return cout<<"YES",0;
    k++;
}
cout<<"NO";
}

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

int main() {
    string S, T;
    cin >> S >> T;
    sort(S.begin(), S.end());
    sort(T.rbegin(), T.rend());
    cout << (S < T ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

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

    ll n;
    cin>>n;
    map<string,ll> m;
    ll ans=0;
    for(ll i=0;i<n;++i)
    {
        string s;cin>>s;
        m[s]+=1;
        ans=max(ans,m[s]);
    }

    vector<string> ar;
    for(auto u:m){
        if(u.second==ans){
            ar.pb(u.first);
        }
    }
    sort(ar.begin(),ar.end());
    for(auto u:ar){cout<<u<<endl;}


    return (0);
}


Measured memory_bytes: 25584
#include <iostream>
            #include <bits/stdc++.h>
            #include <cstring>
            #include <cstdlib>
            #include <utility>
            #include <set>
            #include <vector>
            #include <algorithm>
            #include <iomanip>
            using namespace std;
            typedef long long ll;
            long double pie = 3.1415926535;
            int main() {
                
                    ll n;
                    cin >> n;
                    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
                    cout << "hon" << endl;
                    else if(n%10==0||n%10==1||n%10==6||n%10==8)
                    cout << "pon" << endl;
                    else
                    cout << "bon" << endl;
                
                return 0;
            }

Measured memory_bytes: 3636
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], m;
string s, t;

int32_t main(){_
      
   cin >> n >> m;

   if (n == m){
      cout<<"Yes";
   }
   else{
      cout<<"No";
   }
   

   return 0;
}

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

int main(void) {
	int x, a, b;
	int asumi, iguti;
	if (scanf("%d%d%d", &x, &a, &b) != 3) return 1;
	asumi = abs(a - x);
	iguti = abs(b - x);
	puts(asumi <= iguti ? "A" : "B");
	return 0;
}


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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<double> p(N);
    for (int i = 0; i < N; ++i) {
        cin >> p[i];
        p[i] = (p[i] * (p[i] + 1)) / 2.0 / p[i];
    }
    double ans = 0;
    for (int i = 0; i < K; ++i) ans += p[i];
    double sum = ans;
    for (int i = 0; i < N - K; ++i) {
        sum = sum - p[i] + p[i + K];
        ans = max(ans, sum);
    }
    printf("%.10f\n", ans);
}


Measured memory_bytes: 1792
n = int(input())
num = input()
num = num.split()
if '0' in num:
    print(0)
    exit()
ans = 1
MAXX = 1000000000000000000
for item in num:
    ans = ans * int(item)
    if ans > MAXX:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 19420
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long k,a,b;
	cin>>k>>a>>b;
	long long div1=a/k;
	long long div2=b/k;
	
	if(div1!=div2||k==1||a%k==0||b%k==0){
		cout<<"OK"<<endl;
	}else {
		cout<<"NG"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3636
fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val pointList = readLine()!!.split(" ").map { it.toInt() }
    val ans = pointList.indices.filter{ it + 1 != pointList[it] }.count().let { it == 0 || it == 2 }
    println(if(ans) "YES" else "NO")

}




Measured memory_bytes: 37868
N,T = map(int,input().split())

best=-1
best_c=-1
for _ in range(N):
    c,t = map(int,input().split())
    if t <= T:
        if best_c == -1:
            best_c = c
        elif best_c > c:
            best_c = c
if best_c == -1:
    print("TLE")
else: 
    print(best_c)

Measured memory_bytes: 3068
def d_Widespread(N, A, B, H):
    from math import ceil
    low = 0
    high = max(H) // B + 1  # 多くともこの回数だけ魔法を使えば全滅できる

    def enough(t):
        time = 0
        for h in H:
            if h > B * t:
                # Bt以下の体力の魔物は魔法の巻き添えで倒す(狙う必要がない)
                time += ceil((h - B * t) / (A - B))
        if time <= t:
            return True
        else:
            return False

    while high - low > 1:
        mid = (low + high) // 2
        if enough(mid):
            high = mid
        else:
            low = mid
    return high

N,A,B = [int(i) for i in input().split()]
H = [int(input()) for _ in range(N)]
print(d_Widespread(N, A, B, H))

Measured memory_bytes: 7072