akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

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


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

  /* input */
  string ans = (station == "AAA" || station == "BBB") ? "No" : "Yes";
  cout << ans << endl;
}

Measured memory_bytes: 256
import math
N, a, b = map(int, input().split())

all = a + b

# a = 0
if a == 0:
    print(0)
    exit(0)

if N <= a:
    print(N)
    exit(0)

# a > 0
c = math.floor(N / all)
d = N % all

roundCnt = a * c
amariCnt = 0

if d != 0:
    if d <= a :
        amariCnt = d
    else:
        amariCnt = a

print(roundCnt + amariCnt)


#a = 0 print 0
#a > 0
# N <= a print N
# N > a
#  N/(a+b)=c     が割り切れる  a * c
#  N/(a+b)=c...d が余りが出る  a * c
#    d <= a のとき a * c + d
#    d >  a のとき a * c + a
#


Measured memory_bytes: 3060
#include <stdio.h>
int main(void)
{
    long int n,k;
    scanf("%ld %ld",&n,&k);
    long long int ans=0;
    if(k==0)
    {
        ans=n*n;
        printf("%lld",ans);
        return 0;
    }
    if(k>=n)
    {
        printf("0");
        return 0;
    }
    ans+=(n-k)*(n-k+1)/2;
    for(int p=k+1;p<n;p++)
    {
        ans+=(p-k)*(n/p-1);
        if(n%p>k-1)ans+=n%p-k+1;
    }
    printf("%lld",ans);
}


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

int main() {
	int A, B , C , D;
	cin >> A >> B >> C >> D;
	if ((A+B)==(C+D) ) {
		cout << "Balanced"<<  endl;
	}
	else if((A+B)>(C+D)) {
		cout << "Left"<<endl;
	}
	else {
		cout << "Right"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;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 INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n,d,x;cin >> n >> d>> x;
    vector<int> a(n);
    int count=x;
    REP(i,n){ 
        cin >> a[i];
        count+=1+ ((d-1)/a[i]);
    }
    cout << count << endl;
    return 0;
    

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define t int t; cin>>t; while(t--)
#define clear(a,x) memset(a,x,sizeof(a))
#define boost ios_base::sync_with_stdio(false)
#define show(a) for(int bm=0;bm<a.size();bm++)cout<<a[bm]<<" ";
#define sc1(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d%d",&x,&y)
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define sc5(a,b,c,d,e) scanf("%d%d%d%d%d",&a,&b,&c,&d,&e)
#define pr1(x) printf("%d\n",x)
#define pr2(x,y) printf("%d %d\n",x,y)
#define pr3(x,y,z) printf("%d %d %d\n",x,y,z)
#define pr4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define pr5(a,b,c,d,e) printf("%d %d %d %d %d\n",a,b,c,d,e)
#define scl(x) scanf("%lld",&x)
#define prl(x) printf("%lld\n",x)
#define u(i,a,b) for(i=a;i<b;i++)
#define d(i,a,b) for(i=a;i>b;i--)
#define all(x) x.begin(),x.end() 
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define mp(x,y) make_pair(x,y) 
#define ff first
#define ss second
#define mod 1000000007
int main()
{
    string s;
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[(int)s.size()-1];
    return 0;
}

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

void print(vector<int>a){
    for(int i=1;i<a.size();i++){
        cout<<"node "<<i<<": key = "<<a[i]<<", ";
        if(i!=1)cout<<"parent key = "<<a[i/2]<<", ";
        if(2*i+1<a.size()){
            cout<<"left key = "<<a[2*i]<<", right key = "<<a[2*i+1]<<", ";
        }else if(2*i<a.size()){
            cout<<"left key = "<<a[2*i]<<", ";
        }
        cout<<endl;
    }
}
int main(){
    int n;
    cin>>n;
    vector<int>a(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    print(a);
}


Measured memory_bytes: 3136
#include <stdio.h>
int main(void){
    int cnt=0,max=0,i;
    char s[11];
    scanf("%s",s);
    for(i=0;i<strlen(s);i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='T' || s[i]=='G') cnt++;
        else{
            if(max<cnt) max=cnt;
            cnt=0;
        }
    }
    if(max<cnt) max=cnt;
    printf("%d",max);
    return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int a, b, t;
    cin >> a >> b >> t;
    int ans = 0;
    for(int i = a; i <= t; i+=a){
        ans += b;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n; cin >> n;
	ll N = 1<<n;
	vl a(N); rep(i,N) cin >> a[i];
	vl ans(N,0);
	vl mx(N,0);
	vl sec(N,0);
	vl get(N,0);
	rep(i,N){
		if(mx[i] <= a[i]){
			sec[i] = mx[i];
			mx[i] = a[i];
			get[i] = i;
		}else if(sec[i] < a[i]){
			sec[i] = a[i];
		}
		if(i>0){
			ans[i] = max(ans[i-1], mx[i] + sec[i]);
		}
		rep(j,n){
			ll t = i | 1<<j;
			if(mx[t] < mx[i]){
				sec[t] = mx[t];
				mx[t] = mx[i];
				get[t] = get[i];
			}else if(mx[t] == mx[i]){
				if(get[t] != get[i]){
					sec[t] = mx[t];
					mx[t] = mx[i];
					get[t] = get[i];
				}
			}else{
				chmax(sec[t],mx[i]);
			}
			chmax(sec[t],sec[i]);
		}
	}
	REP(i,1,N) cout << ans[i] << "\n";
	//REP(i,0,N) print2(mx[i],sec[i]);
}

Measured memory_bytes: 13312
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		while (true) {
			C -= B;
			if (C <= 0) {
				System.out.println("Yes");
				break;
			}
			A -= D;
			if (A <= 0) {
				System.out.println("No");
				break;
			}
		}
	}
}

Measured memory_bytes: 35708
#include <bits/stdc++.h>
using namespace std;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <10 ; i++){
    if(N%i == 0 and N/i < 10){
      yes;
      return 0;
    }
  }
  no;
}


Measured memory_bytes: 3596
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    vi v(n);
    int min = INF;
    int max = -101;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        if(min>v[i]) min = v[i];
        if(max<v[i]) max = v[i];
    }
    int sum = 0;
    vi a;
    for(int i = min; i <= max; i++){
        for(int j = 0; j < v.size(); j++){
            sum+=((v[j]-i) * (v[j]-i));
        }
        a.pb(sum);
        sum = 0;
    }
    sort(all(a));
    cout << a[0];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long hxtype;
typedef pair<int,int> pii;
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=200005;
int a[N],q[N],mx[N],mn[N],oz[N];
int main(){
	int n,k,i,j,qh=1,qt=0;
	scanf("%d%d",&n,&k);
	rep(i,1,n)scanf("%d",&a[i]);
	rep(i,1,n){
		  if (qh<=qt&&  q[qh]==  i-k)++qh;
		while(qh<=qt&&a[q[qt]]<a[i] )--qt;
		q[++qt]=i;
		if(q[qh]==i)mx[i]=1;
	}
	qh=1;qt=0;
	per(i,n,1){
		  if (qh<=qt&&  q[qh]==  i+k)++qh;
		while(qh<=qt&&a[q[qt]]>a[i] )--qt;
		q[++qt]=i;
		if(q[qh]==i)mn[i]=1;
	}
	qh=k-1;qt=0;
	REP(i,1,k)if(a[i]<a[i+1])--qh;
	rep(i,k,n){
		if(!qh)oz[i-k+1]=qt=1;
		if(a[i    ]<a[i  +1])--qh;
		if(a[i-k+1]<a[i-k+2])++qh;
	}
	n=n-k+1;
//	rep(i,1,n)printf("%d ",mn[i]&&mx[i]);printf("\n");
//	rep(i,1,n)printf("%d ",oz[i]       );printf("\n");
//	printf("qt=%d\n",qt);
	for(i=j=1;i<=n;i=j+1){
		qh=oz[j=i];
//		printf("i=%d\n",i);
		while(j!=n&&mn[j]&&mx[j+k])qh|=oz[++j];//printf("j=%d\n",j);
		if(!qh)++qt;
	}
	printf("%d",qt);
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;
static const int MAX_N = 100010;

int main(void){
  long long int N;
  long long int a[MAX_N], parity_a[MAX_N];
  bool win_second = true;//全部偶数の時の場合のみ勝てる
  //入力
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  for(int i = 0; i < N; i++){
    if(a[i] % 2 != 0){
      win_second = false;
      break;
    }
  }
  if(win_second){cout << "second" << endl;}
  else{cout << "first" << endl;}
  return 0;
}


Measured memory_bytes: 1024
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let t = get!() * 1000;
    let a = get!() * 1000;
    let mut xs = vec![];
    for i in 0..n {
    	let h = get!();
        let d = t - h * 6;
        xs.push(((d-a).abs(),i+1));
    }
    xs.sort();
    
    println!("{}", xs[0].1);
}

Measured memory_bytes: 4352
N = int(input())
A = []
x = []
y = []

for i in range(N):
    A.append(int(input()))
    X = []
    Y = []
    for j in range(A[i]):
        a,b = map(int,input().split())
        X.append(a)
        Y.append(b)
    x.append(X)
    y.append(Y)

n = 2**N
ans = 0
for i in range(n):
    flag = True
    honest_person = [0]*N
    #j番目の人が正直者であるかどうか
    for j in range(N):
        honest_person[j] = i>>j & 1
    for j in range(N):
        #j番目の人が正直者ならば...
        if(honest_person[j]):
            for k in range(A[j]):
                #j番目の人の証言は矛盾がないはず
                if honest_person[x[j][k]-1] != y[j][k]:
                    flag = False
    if flag:
        ans = max(ans,honest_person.count(1))
print(ans)


Measured memory_bytes: 3064
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String val = scan.next();
    
    
    if(val.equals("a")|| val.equals("i")|| val.equals("u")|| val.equals("e")|| val.equals("o")){
      System.out.print("vowel");
    }else{
      System.out.print("consonant");
    }
    
  }
}


Measured memory_bytes: 35536
from bisect import bisect
a,b,q,*stx = map(int,open(0).read().split())
s = [-1e10] + stx[:a] + [2*1e10]
t = [-1e10] + stx[a:a+b] + [2*1e10]
x = stx[a+b:a+b+q]
for i in x:
    pos_s = bisect(s,i)
    pos_t = bisect(t,i)
    sl = s[pos_s-1]; sr = s[pos_s]
    tl = t[pos_t-1]; tr = t[pos_t]
    ans = min( i-min(sl,tl), max(sr,tr)-i, (sr-i) + (sr-tl), (tr-i) + (tr-sl), (i-sl) + (tr-sl), (i-tl) + (sr-tl) )
    print(ans)

Measured memory_bytes: 38660
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	int a,b,c,d=0,e=0;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
	if(a*a+b*b==c*c)d++;
	if(a==b)e++;
	}
	printf("%d\n%d\n",d,e);
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;



int main() {
	i64 n;
	cin >> n;
	i64 ans = 0;
	if (n % 2 == 1) {
		cout << ans << endl;
		return 0;
	}
	ff(i, 1, 26) {
		i64 pre = 2;
		ff(j, 0, i)pre *= 5;
		i64 a = n / pre;
		ans += a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
//        char[] arr = sc.next().toCharArray();
//        int count = 0;
//        int blackCount = 0;
//        for (int i = 0; i < arr.length; i++) {
//            if (arr[i] == 'B') {
//                blackCount++;
//            } else {
//                count += blackCount;
//            }
//        }
//        System.out.println(count);
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int b = 0;
        long ans = 0;
        for (char c : s) {
            if (c == 'B') {
                b++;
            } else {
                ans += b;
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long
#define lson node<<1
#define rson (node<<1)+1

const int maxn=1e6+10;
const ll mod=1e9+7;
const double pi=acos(-1);

ll v[maxn];
int main()
{
    int n;
    sint(n);
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        int a;
        sint(a);
        v[a]++;
        sum+=a;
    }
    int q;
    sint(q);
    while(q--)
    {
        int b,c;
        //cout<<mp[b]<<" "<<mp[c]<<endl;
        sint2(b,c);
        sum-=v[b]*b;
        sum+=v[b]*c;
        v[c]+=v[b];
        v[b]=0;
        printf("%lld\n",sum);
    }

    return 0;
}



Measured memory_bytes: 4584
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e9;
const int mod=1e9+7;
const int M=200005;
int d[M];
int c[M];
map<pi,int>id;
vector<pi>edg;
int w[M];
bool cmp(pi a,pi b)
{
    int u1=a.fi;
    int v1=a.si;
    int u2=b.fi;
    int v2=b.si;
    if(d[u1]!=d[u2])return d[u1]<d[u2];
    if(d[v1]!=d[v2])return d[v1]<d[v2];
    return a<b;
}
 main()

{
    fast
    int n,m;
    cin>>n>>m;
    f(i,0,n-1)cin>>d[i];
    memset(c,-1,sizeof c);
    f(i,0,m-1)
    {
        int u,v;
        cin>>u>>v;
        u--;v--;
        if(d[u]<d[v])swap(u,v);
        id[mp(u,v)]=i;
        edg.pb(mp(u,v));
    }
    sort(edg.begin(),edg.end(),cmp);
    f(i,0,m-1)
    {
        int u=edg[i].fi;
        int v=edg[i].si;
        int du=d[u];
        int dv=d[v];
        if(c[u]==-1 && c[v]==-1)
        {
            if(du!=dv)
            {
                cout<<"-1"<<endl;
                return 0;
            }
            c[u]=1;
            c[v]=0;
            w[id[mp(u,v)]]=du;
        }
        else if(c[u]==-1)
        {
            c[u]=c[v]^1;
            w[id[mp(u,v)]]=du;
        }
        else if(c[v]==-1)
        {
            if(du!=dv)
            {
                cout<<"-1"<<endl;
                return 0;
            }
            w[id[mp(u,v)]]=dv;
            c[v]=c[u]^1;
        }
        else
        {
            w[id[mp(u,v)]]=inf;
        }
    }
    f(i,0,n-1)
    {
        if(c[i]==1)cout<<"W";
        else cout<<"B";
    }
    cout<<"\n";
    f(i,0,m-1)
    {
      cout<<w[i]<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 22844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl



int main() {
    int Q;  cin >> Q;
    vector<int> l(Q);
    vector<int> r(Q);
    rep(i, Q)  cin >> l[i] >> r[i];

    int N = int(pow(10, 5));
    vector<int> prime;
    for (int i=2; i<N; i++) {
        if (i % 2 == 0) continue;
        bool flag = true;
        for (int j=2; j<=sqrt(i); j++) {
            if (i % j == 0) {
                flag = false;
            }
        }
        if (flag) {
            prime.push_back(i);
        }
    }

    vector<int> prime2;
    for (int i=2; i<N; i++) {
        if (i % 2 == 0) continue;
        bool flag = true;
        for (int j=2; j<=sqrt(i); j++) {
            if ((i+1)/2 % j == 0) {
                flag = false;
            }
        }
        if (flag) {
            prime2.push_back(i);
        }
    }

    vector<int> primeA;
    rep(i, max(prime.size(), prime2.size())) {
        rep(j, min(prime.size(), prime2.size())) {
            if (prime[i] == prime2[j]) {
                primeA.push_back(prime[i]);
            }
        }
    }

    vector<int> row;
    rep(i, N) {
        bool flag = false;
        rep(j, primeA.size()) {
            if (i == primeA[j]) {
                flag = true;
            }
        }
        if (flag) row.push_back(1);
        else row.push_back(0);
    }

    vector<int> sum(N, 0);
    rep(i, N) {
        if (row[i]) sum[i+1] = sum[i] + 1;
        else sum[i+1] = sum[i];
    }

    rep(i, Q) {
        print(sum[r[i]+1] - sum[l[i]]);
    }

}

Measured memory_bytes: 2424
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;

int disc(int x){
    if(x==2) return 2;
    else if (x==4 or x==6 or x==9 or x==11) return 4;
    else return 1;
}
int main(){
   int x, y;
   cin >> x >> y;

   if(disc(x)==disc(y)) out("Yes");
   else out("No");

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            String line = sc.nextLine();
            if(line.charAt(0) == '.') break;
            
            int flag = 0;
            Deque<Integer> dq = new ArrayDeque<>();
            for(int i = 0; i < 102; i++) {
                char c = line.charAt(i);
                if(c == '.') break;
                else if(c == '(') dq.addLast(1);
                else if(c == '[') dq.addLast(2);
                else if(c == ')') {
                    if(dq.isEmpty() || dq.removeLast() != 1) {
                        flag = 1;
                        break;
                    } 
                }
                else if(c == ']') {
                    if(dq.isEmpty() || dq.removeLast() != 2) {
                        flag = 1;
                        break;
                    }
                }
            }

            if(dq.isEmpty() && flag == 0) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
    }
}


Measured memory_bytes: 45096
n,k=(int(i) for i in input().split())
x=[int(i) for i in input().split()]
ans=float('inf')

for i in range(n-k+1):
  dist=x[k+i-1]-x[i]+min(abs(x[k+i-1]),abs(x[i]))
  if dist < ans:
    ans = dist
    
print(ans)

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

int s(int n) {
  int ret{};
  while (n) {
    ret += n % 10;
    n /= 10;
  }
  // cout << ret << endl;
  return ret;
}

int main() {
  int n;
  cin >> n;
  if ((n % s(n)) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int Z = sc.nextInt();
    
    //AとBを入れ替える
    int S;
    S = X;
    X = Y;
    Y = S;
    //AとCを入れ替える
    int T;
    T = X;
    X = Z;
    Z = T;
    System.out.println(X + " " + Y + " " + Z);
    
  }
}

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

constexpr int si = 1020 * 1002, si_log = 7 + 10, mod = static_cast<int>(1e9) + 7;
int n, m;
int64_t ar[100];
string st[3];
string &s1 = st[1], &s2 = st[2];

int64_t sol() {
   auto is_vert = s1[1] == s2[1];
   ar[1] = ar[2] = is_vert ? 3 : 6;
   int col = is_vert ? 2 : 3;

   for (; col <= n; col++)
   {
      const auto is_ve2 = s1[col] == s2[col];
      if (is_vert) {// |
         if (is_ve2) {// ||
            ar[col] = (ar[col - 1] << 1) % mod;
         }
         else {// |=
            ar[col+1] = ar[col] = (ar[col - 1] << 1) % mod;
            ++col;
         }
      }else{// =
         if (is_ve2) {// =|
            ar[col] = ar[col-1];
         }
         else {// ==
            ar[col + 1] = ar[col] = (ar[col - 1] * 3) % mod;
            ++col;
         }
      }
      is_vert = is_ve2;
   }
   return ar[n];
}

int main() {
   ios_base::sync_with_stdio(0); cin.tie(0);
   while(cin >> n >> s1 >> s2)
   {
      if (n <= 0 || n != (int)s1.size() || n != (int)s2.size())
         break;
      s1 = ' ' + s1;
      s2 = ' ' + s2;
      memset(ar, 0, sizeof ar);
      auto s = sol();
      cout << s << '\n';
   }
   return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  int n, m;
  cin >> n >> m;
  char a[n][n];  rep(i, 0, n) {rep(j, 0, n) cin >> a[i][j];}
  char b[m][m];  rep(i, 0, m) {rep(j, 0, m) cin >> b[i][j];}
  
  for(int i = 0; i+m-1 < n; i++) {
    for(int j = 0; j+m-1 < n; j++) {
      bool flag = true;
      rep(k, 0, m) {
        rep(l, 0, m) {
          if(a[i+k][j+l] != b[k][l]) flag = false;
        }
      }
      if(flag) {
        cout << "Yes" << "\n";
        return 0;
      }
    }
  }
  cout << "No" << "\n";
}


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

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

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

int main(){
	ll n ; cin >> n ;
	vll up(n+1,0),low(n+1,0) ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		up.at(i+1) = up.at(i)+a ;
	}
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		low.at(i+1) = low.at(i)+a ;
	}
	ll ans = 0 ;
	for(int i=1;i<=n;i++){
		ll sub = up.at(i)+low.at(n)-low.at(i-1) ;
		if(sub>ans) ans = sub ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    string ans = "No";
    if  ((a < b && b < c) || (c < b && b < a)) {
        if ((abs(b - a) <= d) && (abs(b - c) <= d)) ans = "Yes";
    } else {
        if (abs(c - a) <= d) ans = "Yes";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,w = map(int,input().split())
WV = [list(map(int,input().split())) for i in range(n)]
dp = [[0 for i in range(w+1)] for j in range(n+1)]

for i in range(n):
    for j in range(w+1):
        if j >= WV[i][0]:
            dp[i+1][j] = max(dp[i][j],dp[i][j-WV[i][0]]+WV[i][1])
        else:
            dp[i + 1][j] = dp[i][j]
print(dp[n][w])

Measured memory_bytes: 171912
#include <iostream>


int strlen (char *str) {
  int len = 0;
  while (*str != '\0') {
    str++;
    len++;
  }
  return len;
}


bool strcmp(char *s, char *p, int size) {
  int ascii_sub;
  for (int i = 0; i < size; i ++) {
    ascii_sub = (int)s[i] - (int)p[i];
    if (ascii_sub != -32 && ascii_sub != 32 && s[i] != p[i]) return false;
  }
  return true;
}

bool strcmp(char *s, char *p) {
  for (int i = 0; i < 11; i ++) {
    if (s[i] != p[i]) return false;
  }
  return true;
}


int main() {
  int count = 0;
  char end[11] = {'E', 'N', 'D', '_', 'O', 'F', '_', 'T', 'E', 'X', 'T'};
  int end_len = 11;
  char W[10];
  int W_len;
  char word[255];
  int word_len;

  std::cin >> W;
  W_len = strlen(W);

  while (true) {
    std::cin >> word;
    word_len = strlen(word);
    if (W_len == word_len && strcmp(word, W, W_len)) count += 1;
    if (end_len == word_len && strcmp(word, end)) break;
  }
  std::cout << count << std::endl;

  return 0;
}



Measured memory_bytes: 3096
#include<iostream>
#include<cmath>
using namespace std;
bool vis[10];
int n;
double dis = 0;
double res = 0;
struct queue{
	double x;
	double y;
}q[10];
void bfs(double x, double y, int i,int cnt) {
	if (cnt == n) {
		res += dis;
		return;
	}
		
	vis[i] = 1;
	for (int j = 1; j <= n; j++) {
		if (vis[j] == 0) {
			double dis1;
			dis1 = dis;
			dis += sqrt((x - q[j].x)*(x-q[j].x) + (y - q[j].y)*(y-q[j].y));
			vis[j] = 1;
			bfs(q[j].x, q[j].y, j,cnt+1);
			dis = dis1;
			vis[j] = 0;
		}
		
	}
	vis[i] = 0;
	return;
}
int main() {
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> q[i].x >> q[i].y;
	}

	for (int i = 1; i <= n; i++) {
		bfs(q[i].x, q[i].y, i,1);
	}
	for (int i = 1; i <= n; i++) {
		res /= i;
	}
	printf("%.10lf", res);
	return 0;
}

Measured memory_bytes: 256
program main
  implicit none
  integer(8) :: x, y, z, m
  read (*, *) x, y
  if (mod(x + y, 3_8) /= 0) then
    write (*, "(i0)") 0
    return
  end if
  z = (x + y) / 3
  if (x < z .or. y < z) then
    write (*, "(i0)") 0
    return
  end if

  m = 1000000007
  write(*, "(i0)") combi(z, x - z, m)
  contains

  function combi(n, k, m)
    implicit none
    integer(8), intent(in) :: n, k, m
    integer(8) :: combi, numera, denomi
    numera = perm(n, k, m)
    denomi = mod(fact(k, m), m)
    combi = mod(numera * inv(denomi, m), m)
  end function combi

  function perm(n, k, m)
    integer(8), intent(in) :: n, k, m
    integer(8) :: i, perm
    perm = 1
    do i = n, n - k + 1, -1
      perm = mod(perm * i, m)
    end do
  end function perm

  function fact(n, m)
    implicit none
    integer(8), intent(in) :: n, m
    integer(8) :: i, fact
    fact = 1
    do i = 1, n
      fact = mod(fact * i, m)
    end do
  end function fact

  function inv(n, m)
    implicit none
    integer(8), intent(in) :: n, m
    integer(8) :: inv
    inv = pow(n, m - 2, m)
  end function inv

  recursive function pow(n, p, m) result(res)
    implicit none
    integer(8), intent(in) :: n, p, m
    integer(8) :: res
    if (p == 0) then
      res = 1
    else if (mod(p, 2_8) == 0) then
      res = mod(pow(n, p / 2, m) ** 2, m)
    else
      res = mod(pow(n, p - 1, m) * n, m)
    end if
  end function pow
end program main


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

long double a, b, c;
ll lA[2010], uA[2010], lB[2010], uB[2010], lC[2010], uC[2010];

void solve() {
	double L;
	cin >> L;
	printf("%.10f\n", L * L * L / 27);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	set<string> st;
	rep(i, n){
		string s; cin >>s;
		st.insert(s);
	}
	cout << sz(st) <<"\n";
	return 0;
}


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

#define ll long long int

using namespace std;

ll fc[15],pp[15];

void prep()
{
    fc[0]=1;
    pp[0]=1;
    for(int i=1;i<15;i++)
    {
        fc[i]=fc[i-1]*i;
        pp[i]=pp[i-1]*10;
    }
}

ll give(int n,int k)
{
    return fc[n]/(fc[k]*fc[n-k]);
}

ll f(int n,int k)
{
    ll res=0;
    for(int i=k;i>=0;i--)
    {
        res+=give(n,i);
    }
    return res;
}

int main()
{
    string s; cin>>s;
    int n=s.length();
    prep();
    ll res=0;
    for(int i=0;i<n;i++)
    {
        int bfr=i;
        int beh=n-i-1;
        for(int w=0;w<=10;w++)
        {
            ll dig=s[i]-'0';
            if(beh<w) break;
            dig*=pp[w];
            ll sum=0;
            ll xx = beh-w;
            ll behind_comb=f(xx-1,xx-1);
            if(beh==w) behind_comb++;
            ll before_sum=0;
            for(int j=bfr-1;j>=0;j--)
            {
                before_sum+=f(j,j);
            }
            before_sum++;
            dig*=before_sum*behind_comb;
            res+=dig;

        }
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,b;
    scanf("%d %d", &a, &b);
    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    return 0;
}
         


Measured memory_bytes: 2604
#include <utility>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <numeric>
#define ll long long
#define rep(i,rept) for (ll i = 0; i < rept; i++)
#define Yes(b) std::cout<< (b ? "Yes" : "No")<<std::endl
#define YES(b) std::cout<< (b ? "YES" : "NO")<<std::endl
using namespace std;
//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
int gcd(int m, int n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;

	// ユークリッドの方法
	while (m != n)
	{
		if (m > n) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
 //*********************************************************
 // 最小公倍数（Least Common Multiple）を返す。
 // 引数に０がある場合は０を返す。
 //*********************************************************
int lcm(int m, int n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;

	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main() {
	ll n, a[3000], ans = 1, sum = 0;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		sum += a[i]-1;
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 256
import collections
import math
def cmb(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
la = list(map(int,input().split()))
all = 0
c = collections.Counter(la)
#print(c)
for i in range(N+1):
    all += cmb(c[i],2)
#print(all)
for k in range(N):
    print(all-c[la[k]]+1)

Measured memory_bytes: 112972
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    int X,N;
    cin>>X>>N;
    set<int>P;
    rep(i,N){
        int a;
        cin>>a;
        P.insert(a);
    }
    vector<int>Q;
    for(int i=1;i<=100;i++){
        Q.push_back(-1*i);
    }
    for(int i=0;i<=200;i++){
        int k=*begin(P);
        if(i!=k){
            Q.push_back(i);
        }
        else{
            P.erase(k);
        }
    }
    int ans=0;
    int mark=200;
    rep(i,Q.size()){
        if(abs(X-Q[i])<mark){
            mark=abs(X-Q[i]);
            ans=Q[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	if(a>b)swap(a,b);
	Yn(a<c&&c<b);
}


Measured memory_bytes: 256
n = int(input())
lst = list(map(int,input().split()))

dp = [0]*n
dp[1] = abs(lst[1] - lst[0])
for i in range(2, n):
    dp[i] = min(dp[i-2]+abs(lst[i]-lst[i-2]), dp[i-1]+abs(lst[i]-lst[i-1]))
print(dp[-1])

Measured memory_bytes: 13928
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
  a,b = map(int, input().split())
  uf.union(a-1, b-1)

ans = 0
for i in range(n):
  ans = max(uf.size(i),ans)
  
print(ans)

Measured memory_bytes: 83396
fn main() {
  let s: String = read();

  let s = s.chars().collect::<Vec<_>>();
  let l = s.len();
  let s = s.into_iter().take(l-8).collect::<String>();
  println!("{}", s);
}

fn read<T: std::str::FromStr>() -> T {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().parse::<T>().ok().unwrap()
}

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

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

int a, b, k;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> k >> a >> b;

    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK\n";
            return 0;
        }
    }

    cout << "NG\n";
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  int a, b; cin >> a >> b;
  if (a == 1) { a = 14; }
  if (b == 1) { b = 14; }

  auto ans = a == b ? "Draw" : a > b ? "Alice" : "Bob";
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char x[100], y[100], z[100];
    scanf("%s %s %s", x, y, z);
    int lenA = strlen(x);
    int lenB = strlen(y);
    if(x[lenA - 1] == y[0] && y[lenB - 1] == z[0])
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}

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

//#define int long long
#define reps(i,s,n) for(ll (i)=(s);(i)<(ll)(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,n+1)
#define repst(i,s,n) reps(i,s,n+1)
#define reprt(i,n,t) for(ll (i)=(n);(i)>=t;--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<n;++i){cout<<x[i]<<(i==n-1?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

// sの後ろから見ていき、"アルファベット26種全てを含む最短のsuffix"を見つける度に切り取っていく(vi segに追加していく)
// segのサイズがkになったとすると、k文字以下の文字列は明らかに全てsの部分列
// k+1文字だと例えば最後に残った文字列s'に含まれていない文字を先頭に、各segの先頭1文字ずつ採用していって出来る文字列は部分列じゃない
// つまり求める文字列の長さはk+1なのは確定
// まず先頭の1文字はs'に含まれていない文字のうち辞書順最小のアルファベットが最善 その文字をlsとする
// seg1の範囲が[l,r)だとして、その中で初めてlsが現れる位置をi(l<i<r)とすると、
// (i,r)に含まれない文字のうち辞書順最小のアルファベットを採用してそれをlsにする これを繰り返せばいい
// a/cbadefghijklmnopqrstuvwxyz

string s, t;
int a[26], c;
vi seg;
char ls;

void wr() {
	rep(i,26) {
		if (a[i]==0) {
			ls = 'a'+i;
			cout << ls;
			break;
		}
	}
}

signed main() {
	cin >> s;
	seg.pb(s.length());
	repr(i,s.length()-1) {
		a[s[i]-'a']++;
		if (a[s[i]-'a']==1) c++;
		if (c==26) {
			seg.pb(i);
			memset(a,0,sizeof(a));
			c = 0;
		}
	}
	wr();
	reprt(i,seg.size()-1,1) {
		int l = seg[i], r = seg[i-1];
		reps(j,l,r) {
			if (s[j]==ls) {
				l = j;
				break;
			}
		}
		memset(a,0,sizeof(a));
		reps(j,l+1,r) a[s[j]-'a']++;
		wr();
	}
	cout << ln;
}

Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <algorithm>

int f() {
    std::string s; std::cin >> s;
    int steps = s.size();
    for (char c = 'a'; c <= 'z'; c++) {
        int m = 0;
        int w = 0;
        for (auto c2 : s) {
            if (c2 == c) {
                m = std::max(m, w);
                w = 0;
            } else {
                w++;
            }
        }
        m = std::max(m, w);
        steps = std::min(steps, m);
    }
    return steps;
}

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

    std::cout << f() << std::endl;
}


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

vector<int> v;

int n;
int main () {
    cin >> n;
    for(int i=0; i<n; i++) {
        int a;
        cin >> a;
        v.push_back(a);
    }
    for(int i=0; i<n; i+=2) {
        if(i) cout << ' ';
        cout << v[n-1-i];
    }
    for(int i=(n%2); i<n; i+=2) {
        cout << ' ' << v[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3060