akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

class Node{
public:
    int location;
    int p, l, r;
    Node(){}
};

class Point{
public:
    int id, x, y;
    Point(){}
    Point(int id, int x, int y): id(id), x(x), y(y) {}
    bool operator < (const Point &p) const {
        return id < p.id;
    }
    
    void print(){
        printf("%d\n", id);
    }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2) {return p1.x < p2.x;}
bool lessY(const Point &p1, const Point &p2) {return p1.y < p2.y;}

int makeKDTree(int l, int r, int depth){
    if(!(l < r)) return NIL;
    int mid = (l + r) / 2;
    int t = np++;
    if(depth % 2 == 0){
        sort(P + l, P + r, lessX);
    }
    else{
        sort(P + l, P + r, lessY);
    }
    T[t].location = mid;
    T[t].l = makeKDTree(l, mid, depth + 1);
    T[t].r = makeKDTree(mid + 1, r, depth + 1);
    
    return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans){
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;
    
    if(sx <= x && x <= tx && sy <= y && y <= ty){
        ans.push_back(P[T[v].location]);
    }
    
    if(depth % 2 == 0){
        if(T[v].l != NIL){
            if(sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if(T[v].r != NIL){
            if(x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
    else{
        if(T[v].l != NIL){
            if(sy <= y) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if(T[v].r != NIL){
            if(y <= ty) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
}

int main(){
    int x, y;
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d %d", &x, &y);
        P[i] = Point(i, x, y);
        T[i].l = T[i].r = T[i].p = NIL;
    }
    
    np = 0;
    
    int root = makeKDTree(0, N, 0);
    
    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    vector<Point> ans;
    for(int i = 0; i < q; i++){
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);
        sort(ans.begin(), ans.end());
        for(int j = 0; j < ans.size(); j++){
            ans[j].print();
        }
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 15900
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::map<std::string, int> c;
    for (int i = 0; i < n; i++) {
        std::string s;
        std::cin >> s;
        c[s]++;
    }

    int max = 0;
    for (auto &e : c) {
        max = std::max(max, e.second);
    }

    for (auto &e : c) {
        if (e.second == max) std::cout << e.first << std::endl;
    }

    return 0;
}


Measured memory_bytes: 25216
a,b,c,d = input()
flag = 0
if(a==b and c==d):
    flag = 1
elif(a==c and b==d):
    flag = 1
elif(a==d and b==c):
    flag = 1
else:
    flag = 0
if(a==b and a==c and a==d):
    flag = 0
if(flag==1):
    print("Yes")
else:
    print("No")

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   ll a,b;
   cin >>a>>b;
   bool flg=true;
   if(a>8||b>8)flg=false;
   if(flg)puts("Yay!");
   else puts(":(");
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define Rapido ios::sync_with_stdio(0); cin.tie(0)
const int maxS = 1e6 + 10;

#define MAXN 1000010
// stores smallest prime factor for every number 
int spf[MAXN]; 
int N;

void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 

bool isSqr(int x) {
    int tmp = sqrt(x);
    return ((tmp * tmp) == x);
}

int getFactorization(int x) 
{ 
    unordered_map<int , int> MAP;
    while (x != 1) 
    { 
        MAP[spf[x]]++;
        x = x / spf[x]; 
    }
    int cnt = 1;
    for(auto it : MAP) {
        cnt = cnt * (it.second + 1);
    }
    return cnt; 
} 

void code_idhr_h() {
    cin >> N;
    int ans = 0;
    for(int i = 1; i < N; i++) {
        int dif = N - i;
        int div = getFactorization(dif);
        ans += div;
    }
    cout << ans;
}

int32_t main() {
    Rapido;
    sieve();
    int T = 1; //cin >> T;
    for(int t = 1; t <= T; t++) {
        code_idhr_h();
    }
    return 0;
}

Measured memory_bytes: 11488
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;

int main()
{
  int A,B;
  cin >> A >> B;

  int ans = max(A,B);

  if(A == B){
       cout << ans * 2  << endl;
  }else{
       cout << ans * 2 - 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
use std::io;

fn main() -> io::Result<()> {
    let s = {
        let mut s = String::new(); // バッファを確保
        std::io::stdin().read_line(&mut s).unwrap(); // 一行読む。失敗を無視
        s.trim_end().to_owned() // 改行コードが末尾にくっついてくるので削る
    };

    let num: i32 = s.parse().unwrap();

    match num {
        400..=599 => println!("8"),
        600..=799 => println!("7"),
        800..=999 => println!("6"),
        1000..=1199 => println!("5"),
        1200..=1399 => println!("4"),
        1400..=1599 => println!("3"),
        1600..=1799 => println!("2"),
        1800..=1999 => println!("1"),
        _ => println!("something else"),
    }

    Ok(())
}

Measured memory_bytes: 2132
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cstdio>
using namespace std;
static inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int pow(long x, int n, int m){
    long ret = 1;
    while (n > 0) {
        if (n & 1) ret *= x, ret %= m;
        x *= x, x %= m;
        n >>= 1; 
    }
    return ret % m;
}

int euler_phi(int n) {
   int ret = n;
   for(int i = 2; i * i <= n; ++i){
       if(n % i == 0) {
           ret -= ret / i;
           while(n % i == 0) n /= i;
       }
   }
   if(n > 1) ret -= ret / n;
   return ret;
}

int main()
{
    int K = 0, c = getchar();
    while(c > 47 && c < 58){
        K = K * 10 + c - 48;
        c = getchar();
    }

    K /= gcd(K, 7);
    if(K == 1){
        putchar('1');
        return 0;
    }
    
    K *= 9;

    if(gcd(K, 10) != 1) {
        putchar('-');
        putchar('1');
        return 0;
    }

    int res = euler_phi(K);

    int ans = 1000000;
    long now = 10;
    for(int i = 1; i * i <= res; ++i){
        if(res % i == 0) {
            if(now == 1){
                printf("%d\n", i);
                return 0;
            }
            int tmp = res / i;
            if(pow(10, tmp, K) == 1) if(tmp < ans) ans = tmp;
        }
        now *= 10, now %= K;
    }

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

    return 0;
}

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

int main() {
  ll N;
  cin >> N;
  vector<int> A(N), B(N), C(N);
  for (int i=0; i<N; i++) cin >> A.at(i);
  for (int i=0; i<N; i++) cin >> B.at(i);
  for (int i=0; i<N; i++) cin >> C.at(i);
  sort(A.begin(), A.end());
  sort(C.begin(), C.end());
  ll ans = 0;
  for (int i=0; i<N; i++) {
    auto IterA = lower_bound(A.begin(), A.end(), B.at(i));
    auto IterC = upper_bound(C.begin(), C.end(), B.at(i));
    if (IterA-A.begin()<=N&&C.end()-IterC<=N) ans += (IterA-A.begin())*(C.end()-IterC);
    else if (IterA-A.begin()>N&&C.end()-IterC<=N) ans += N*(C.end()-IterC);
    else if (IterA-A.begin()<=N&&C.end()-IterC>N) ans += (IterA-A.begin())*N;
    else ans += N*N;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
N = int(input())
dic = {}
for i in range(N):
    a, b = input().split()
    b = int(b)
    if a in dic:
        dic[a] += b
    else:
        dic[a] = b
L = [(x, y, len(x)) for x, y in dic.items()]
L.sort(key=lambda x: (x[2], x[0]))

for l in L:
    print(l[0], l[1])


Measured memory_bytes: 5624
def main():
    n = int(input())
    ans = []
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            if i == j or i + j == n + (n + 1) % 2:
                continue
            ans.append([i, j])
    print(len(ans))
    for a in ans:
        print(" ".join(map(str, a)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9416
#include <iostream>
#include <string>
#include <deque>
#include <vector>
#include <algorithm>

int max_index(std::vector<long> &c1){
    std::vector<long>::iterator iter1 = std::max_element(c1.begin(), c1.end());
    int index1 = std::distance(c1.begin(), iter1);
    return index1;
}

long long calc(std::deque<long> &a){
	int n = a.size();
	std::deque<long> b(2);
	b[0] = a.front();	a.pop_front();
	b[1] = a.back();	a.pop_back();
	long long v = std::abs(b[0] - b[1]);

	while( !a.empty() ){
		std::vector<long> t(4);
		t[0] = std::abs(a.front() - b.front());
		t[1] = std::abs(a.front() - b.back());
		t[2] = std::abs(a.back() - b.front());
		t[3] = std::abs(a.back() - b.back());
		int ts = max_index(t);
		switch(ts){
		case 0:
			v += std::abs( b.front() - a.front() );
			b.push_front(a.front());
			a.pop_front();
			break;
		case 1:
			v += std::abs( b.back() - a.front() );
			b.push_back(a.front());
			a.pop_front();
			break;
		case 2:
			v += std::abs( b.front() - a.back() );
			b.push_front(a.back());
			a.pop_back();
			break;
		case 3:
			v += std::abs( b.back() - a.back() );
			b.push_back(a.back());
			a.pop_back();
			break;
		}
	}
	return v;
}



int main(){
	int n;
	std::cin >> n;
	std::deque<long> a(n);
	long tmp;
	for(int i=0; i<n; i++){
		std::cin >> tmp;
		a[i] = tmp;
	}
	std::sort(a.begin(), a.end());

	long long v = calc(a);
	std::cout << v <<std::endl;
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int N, W;
int v[100], w[100];
int dp[101][100001];

int main() {
  cin >> N >> W;
  rep(i, N) {
    cin>> v[i] >> w[i];
  }
  rep(i, W) {
    dp[0][i] = 0;
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j <= W; j++) {
      if(j >= w[i]) {
        dp[i+1][j] = max(dp[i][j-w[i]] + v[i], dp[i][j]);
      } else {
        dp[i+1][j] = dp[i][j];
      }
    }
  }
  cout << dp[N][W] << endl;
  return 0;
}


Measured memory_bytes: 7432
#include <iostream>
using namespace std;
int main(){
  int n,s;
  cin >> n;
  int num[n];
  for (int i = 0; i < n; i++) {
    cin >> s;
    num[i] = s;
  }
  for (int i = n - 1; i >= 0; i--){
    cout << num[i];
    if (i > 0)cout << " ";
    else if (i == 0)cout << endl;
  }
  return 0;
}

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


int main()
{
    char str[1000];
    fgets(str, sizeof(str), stdin);

    char* temp;
    temp = strtok(str, " \n");
    int sunuoNum = atoi(temp);

    int* psunao = (int*)malloc(sizeof(int) * sunuoNum);
    memset(psunao,0, sizeof(int) * sunuoNum);


    temp = strtok(NULL, " \n");
    int okashi = atoi(temp);

    for (int i = 0;i < okashi;i++)
    {
        fgets(str, sizeof(str), stdin);
 
        fgets(str, sizeof(str), stdin);

        char* hoge;
        hoge = strtok(str, " \n");

        int hogehoge;

        while (hoge != NULL)
        {
            hogehoge = atoi(hoge);
            psunao[hogehoge - 1]++;
            hoge = strtok(NULL, " \n");
        }
    }

    int PersonNum = 0;
    for (int j = 0;j < sunuoNum;j++)
    {
        if (psunao[j] == 0)
        {
            PersonNum++;
        }
    }

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


    return 0;
}

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

int main() {
    int n, k,result=1;
    cin >> n >> k;
    int x = floor(log2(k))+1;
    if (x < n) {
        result *= pow(2, x);
        result += (n - x) * k;

    }
    else { result *= pow(2, n); }
    cout << result;
}

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

ll divisor_count(ll a) {
  ll ans = 1;
  for (int i = 2; i <= sqrt(a); i++) {
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= (cnt + 1);
    if (a == 1) break;
  }
  if (a != 1) ans *= 2;
  return ans;
}

int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    ans += divisor_count(n-i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

const int Z = 1e9+7;

int fp(int a, int x) {
    if (x == 0) {
        return 1;
    }
    if (x % 2 == 1) {
        return 1ll * a * fp(a, x - 1) % Z;
    }
    int t = fp(a, x / 2);
    return 1ll * t * t % Z;
}

int inv(int a) {
    return fp(a, Z - 2);
}

int main() {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    a = 1ll * a * inv(100 - c) % Z;
    b = 1ll * b * inv(100 - c) % Z;

    int fac[2*n];
    fac[0] = 1;
    for (int i = 1; i < 2 * n; i++) {
        fac[i] = 1ll * fac[i-1] * i % Z;
    }

    int ans = 0;
    int ifn1 = inv(fac[n-1]);
    for (int i = 0; i < n; i++) {
        int coe = 1ll * fac[n-1+i] * inv(fac[i]) % Z * ifn1 % Z;
        ans = (ans + 1ll * a * coe % Z * fp(a, n - 1) % Z * fp(b, i) % Z * (n + i)) % Z;
        ans = (ans + 1ll * b * coe % Z * fp(b, n - 1) % Z * fp(a, i) % Z * (n + i)) % Z;
    }

    ans = 1ll * ans * 100 % Z * inv(100 - c) % Z;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int V = int.Parse(str[0]);
        int E = int.Parse(str[1]);
        Edge[] edge = new Edge[E];
        for(int i=0;i<E;i++){
            str = Console.ReadLine().Split(' ');
            edge[i] = new Edge(int.Parse(str[0]),int.Parse(str[1]),int.Parse(str[2]));
        }
        Kruskal K = new Kruskal(V,edge);
        sb.Append(K.cost+"\n");
    }
}
class UnionFind{
    int[] par;
    public UnionFind(int n){
        par = new int[n];
        for(int i=0;i<n;i++){
            par[i] = i;
        }
    }
    public void Union(int x,int y){
        par[Get(x)] = Get(y); 
    }
    public bool Same(int x,int y){
        return Get(x) == Get(y);
    }
    int Get(int x){
        if(x != par[x]){
            par[x] = Get(par[x]);
        }
        return par[x];
    }
}
class Edge{
    public int a;
    public int b;
    public long cost;
    public Edge(int a0,int b0,long c){
        a = a0;
        b = b0;
        cost = c;
    }
}
class Kruskal{
    int N,M;
    public Edge[] edges;
    public long cost;
    public Kruskal(int n,Edge[] e){
        N = n;
        edges = e;
        M = e.Length;
        Act();
    }
    public Kruskal(int n,int[] a,int[] b,long[] c){
        N = n;
        M = a.Length;
        edges = new Edge[M];
        for(int i=0;i<M;i++){
            edges[i] = new Edge(a[i],b[i],c[i]);
        }
        Act();
    }
    void Act(){
        UnionFind U = new UnionFind(N);
        cost = 0;
        Array.Sort(edges,(a,b) => a.cost > b.cost ? 1 : (a.cost == b.cost ? 0 : -1));
        for(int i=0;i<M;i++){
            if(!U.Same(edges[i].a,edges[i].b)){
                U.Union(edges[i].a,edges[i].b);
                cost += edges[i].cost;
            }
        }
    } 
}

Measured memory_bytes: 14888
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 2010;
const int MAXK = 110;
const int MAXQ = 200010;

ll a, b;
int nt[1000010];
vector<int> primes;

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

void sieveBase(int n) {
    FOR(i,2,n) {
        if (nt[i] == 0) {
            primes.emplace_back(i);
            nt[i] = i;
            for (ll j = (ll) i * i; j <= n; j += i) nt[j] = i;
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> a >> b;
    ll g = gcd(a, b);
    int res = 1;

    sieveBase(1000000);

    FOR(i,0,SZ(primes)-1)
        if (g % primes[i] == 0) {
            while (g % primes[i] == 0) g /= primes[i];
            res++;
        }
    
    if (g > 1) res++;

    cout << res;
    return 0;
}


Measured memory_bytes: 4860
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < static_cast<ll>(n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= static_cast<ll>(n); ++i)
#define RRANGE(i, m, n) for(ll i = static_cast<ll>(m); i >= static_cast<ll>(n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(ll N) : par(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }

    vector<ll>& vec() {
        return par;
    }
};

int run(istream& in, ostream& out) {
    ll N, M;
    in >> N >> M;
    vector<ll> A(M);
    vector<ll> B(M);
    UnionFind uf{N};
    REP(i, M) {
        in >> A[i] >> B[i];
        A[i]--;
        B[i]--;
        uf.unite(A[i], B[i]);
    }
    ll ans = 0;
    REP(i, N) {
        uf.root(i);
    }
    auto& vec = uf.vec();
    unordered_map<ll, ll> map{};
    for(auto i : vec) {
        map[i]++;
    }
    ll max_count = 0;
    for(auto p : map) {
        max_count = max(max_count, p.second);
    }
    out << max_count << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 13868
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int cnt = 0;
		for (int i = 0;i < q;i++){
			for(int j = 0;j < n;j++){
				if(T[i] == S[j]){
					cnt++;
					break;
				}
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 12000
import bisect

inf = 1 << 60
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

# lis[n] = 最長増加部分列の長さがnであるものの最終要素の最小値
lis = [A[0]]

for a in A:
    if lis[-1] < a:
        lis.append(a)
    else:
        lis[bisect.bisect_left(lis, a)] = a

print(len(lis))



Measured memory_bytes: 10348
N, M = map(int, input().split())
Alist = list(map(int, input().split()))
BClist = []
for i in range(M):
    B, C = map(int, input().split())
    BClist.append([B, C])
Alist.sort()
BClist.sort(reverse=True, key=lambda x: x[1])

num = 0
flag = True
for i in range(M):
    if not flag:
        break
    for j in range(BClist[i][0]):
        if num >= len(Alist):
            flag = False
            break
        elif BClist[i][1] > Alist[num]:
            Alist[num] = BClist[i][1]
            num += 1
        elif BClist[i][1] <= Alist[num]:
            flag = False
            break

print(sum(Alist))


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

int gcd(long long a, long long b){
  long long M = max(a, b), m = min(a, b);
  while(m != 0){
  	long long r = M%m;
    M = m; m = r;
  }
  return M;
}

int digit_sum(long long n){
  long long ans;
  while(n != 0){
  	ans += n%10;
  	n /= 10;
  }
  return ans;
}

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int i,a,b,c,f=0,sum;
	cin>>a>>b>>c;
	for(i=1;i<=b;i++)
	{
		sum=a*i;
		if(sum%b==c)
		{
			f=1;
			cout<<"YES";
			break;
		}
	}
	if(f==0)
	{
		cout<<"NO";
	}
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = LLONG_MAX/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

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

int main(){

    // ifstream in("input.in");
    // cin.rdbuf(in.rdbuf());

    ll n; cin >> n;
    string s[n];
    rep(i,n)cin >> s[i];
    vector<vector<ll>> table(n,vector<ll>(n,INF));
    rep(i,n)rep(j,n)if(s[i][j] == '1')table[i][j] = 1;
    rep(i,n)table[i][i] = 0;

    rep(k,n)rep(i,n)rep(j,n){
        chmin(table[i][j], table[i][k] + table[k][j]);
    }
    bool ok = true;
    rep(i,n)rep(j,i){
        if(s[i][j] == '1' && abs(table[0][i] - table[0][j]) != 1){ok = false; break;}
    }
    ll ret = 0;
    Pll m = {-1,-1};
    // rep(i,n)chmax(m, Pll(table[0][i], i));
    // rep(i,n)chmax(ret, table[m.second][i]);
    rep(i,n)rep(j,n)chmax(ret, table[i][j]);
    cout << (ok ? ret + 1 : -1) << endl;
}

Measured memory_bytes: 768
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)

#A
def A():
    s = S()
    a = s.count("a")
    b = s.count("b")
    c = 3-a-b
    if a&b&c:
        print("Yes")
    else:
        print("No")
#B
def B():
    a,b,k = LI()
    ans = []
    for i in range(a,min(a+k,b+1)):
        ans.append(i)
    for i in range(max(a,b-k+1),b+1):
        ans.append(i)
    ans = list(set(ans))
    ans.sort()
    for i in ans:
        print(i)

#C
def C():
    a,b,c = LI()
    ans = 0
    if a%2:
        if b%2:
            if not c%2:
                ans += 1
                a += 1
                b += 1
        else:
            ans += 1
            if not c%2:
                b += 1
                c += 1
            else:
                a += 1
                c += 1
    else:
        if b%2:
            ans += 1
            if not c%2:
                a += 1
                c += 1
            else:
                b += 1
                c += 1
        else:
            if c%2:
                ans += 1
                a += 1
                b += 1
    ans += (3*max(a,b,c)-a-b-c)//2
    print(ans)
#D
def D():
    q = I()
    for i in range(q):
        a,b = LI()
        x = int((a*b)**0.5)
        y = math.ceil((a*b)/x)-1
        ans = x+y-2
        if a==b:
            ans += 1
        print(ans)

#E
def E():
    s = S()
    f = {"N":0,"W":0,"S":0,"E":0}
    for i in s:
        f[i] = 1
    if f["N"]^f["S"]:
        print("No")
    elif f["W"]^f["E"]:
        print("No")
    else:
        print("Yes")
#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    E()


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

int main(void){
    int S;
    int h, m, s;

    std::cin >> S;

    std::cout << S / 3600 << ":" << (S / 60) % 60 << ":" << (S % 3600) % 60 << std::endl;
    return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define int long long

using namespace std;

constexpr int MAXN = 2e5 + 5;

template <typename T>
inline void read(T& x, T f = 1, char ch = getchar()) {
    x = 0;
    while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

int tc, n, m, cnt;
array<int, MAXN> L;

signed main() {
    std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> L[i];
    sort(L.begin() + 1, L.begin() + n + 1);
    for (int i = 1; i < n; i++)
        for (int j = i + 1; j < n; j++)
            for (int k = j + 1; k <= n; k++) {
                if (L[i] == L[j]) continue;
                if (L[i] == L[k]) continue;
                if (L[j] == L[k]) continue;
                if (L[i] + L[j] > L[k]) cnt++;
            }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3644
def make_good_753(a,digit):
    ans_list = []
    str_list = ["7","5","3"]
    for i in range(digit):
        ans_list.append(a%3)
        a //= 3
    ans_list.reverse()
    ans_list = [ str_list[i] for i in ans_list]
    if set(ans_list) == {'7', '3', '5'}:
        return int("".join(ans_list))
    else:
        return None

candidate_list = []
n = int(input())
for i in range(3,10):
    for j in range(3**i):
        candidate = make_good_753(j,i)
        if candidate != None:
            if candidate <= n:
                candidate_list.append(candidate)
print(len(candidate_list))
    

Measured memory_bytes: 42716
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    scanf("%d", &t);
    if(t <= 599){
        printf("8\n");
    }
    else if(t <= 799){
        printf("7\n");
    }
    else if(t <= 999){
        printf("6\n");
    }
    else if(t <= 1199){
        printf("5\n");
    }
    else if(t <= 1399){
        printf("4\n");
    }
    else if(t <= 1599){
        printf("3\n");
    }
    else if(t <= 1799){
        printf("2\n");
    }
    else {
        printf("1\n");
    }
}

Measured memory_bytes: 3756
{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import           Control.Monad.ST
import           Data.Ord
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

main = do
  n <- readInt
  arr <- UV.fromList <$> readIntList
  print . fst $ foldl' (\(count, mini) i -> if arr UV.! i < mini then (count + 1, arr UV.! i) else (count, mini)) (0, maxBound) [0..(n - 1)]


Measured memory_bytes: 15740
MOD = 10 ** 9 + 7
N = int(input())
A = [int(i) for i in input().split()]
sums = [[0] * 3 for _ in range(N + 1)]

ans = 1
for i, a in enumerate(A):
    f = True
    count = 0
    for j in range(3):
        sums[i + 1][j] = sums[i][j]
        if sums[i][j] == a:
            count += 1
            if f:
                sums[i + 1][j] += 1
                f = False
    ans = ans * count % MOD
#print(sums)
print(ans)

Measured memory_bytes: 89032
#include <bits/stdc++.h>
using namespace std;
void A(int t){
  cout<<t<<endl;
  exit(0);
}
int main() {
  int x,n,t; cin >> x >> n;
  vector<int> p(110,0);
  for (int i = 0; i < n; i++) {
    cin >> t;
    if(p[t]==0) p[t]++;
  }
  int f=0,i=1;
  if(p[x]==0) A(x);
  while (f==0){
    if(x-i<0) {A(0); f=3;}
    if((p[x-i]==0)&&f!=3) {A(x-i); f=2;}
    if(100<x+i) {A(101); f=1;}
    if((p[x+i]==0)&&f!=1) {A(x+i); f=2;}
    i++;
  }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<10;i++)
  {if(n%i==0)
  {int k=n/i;
  if(k>0&&k<10)
  { cout<<"Yes";
  return 0;}
  }}
  cout<<"No";
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i;
	long long c=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0) c+=i;
	}
	printf("%lld\n",c);
	return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    string s;
    cin >> s;
    reverse(all(s));
    ll n = len(s);
    vector<vector<ll>> dp(n + 1, vector<ll>(2, inf));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, 2) {
            ll x = s[i] - '0';
            x += j;
            if (x < 10) dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + x);
            if (x > 0) dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + (10 - x));
        }
    }
    cout << min(dp[n][0], dp[n][1] + 1) << endl;
    return 0;
}


Measured memory_bytes: 55964
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
string s,p[]= {"dreameraser","dreamerase","dreamer","dream","eraser","erase"};
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,k,n,m,l,r;
    cin>>s;
    n=s.size();
    for(i=0; i<n;)
    {
        l=0;
        for(j=0; j<6; j++)
        {
            m=p[j].size();
            int f=0;
            if(i+m>n)
            {
                continue;
            }
            for(k=i,r=0; k<i+m; k++,r++)
            {
                if(p[j][r]!=s[k])
                {
                    f=1;
                    break;
                }
            }
            if(f==0)
            {
                l=1;
                i+=m;
                break;
            }
        }
        if(l==0)
        {
            cout<<"NO\n";
            return 0;
        }
    }
    cout<<"YES\n";
    return 0;
}

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

ll N, M, K, A[100000]={0}, color[100000]={0}, ctid[100000]={0};
set<ll> S[100000], B[100000];

void bfsi(int s, int id) {
    queue<int> Q;
    color[s] = id;
    for(set<ll>::iterator it=S[s].begin();it!=S[s].end();it++) {
        Q.push(*it);
        color[*it]=id;
    }
    while(!Q.empty()) {
        int u = Q.front();
        Q.pop();
        ctid[id]++;
        for(set<ll>::iterator it=S[u].begin();it!=S[u].end();it++) {
            if(color[*it]==0) {
                Q.push(*it);
                color[*it]=id;
            }
        }
    }
}

void bfsinit() {
    int ct=0;
    for(int i=0;i<N;i++) {
        if(color[i]==0) {
            ct++;
            bfsi(i, ct);
        }
    }
}

signed main(){
    cin >> N >> M >> K;
    for(int i=0;i<M;i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        S[a].insert(b);
        S[b].insert(a);
    }
    for(int i=0;i<K;i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        B[a].insert(b);
        B[b].insert(a);
    }
    bfsinit();
    
    for(int i=0;i<N;i++) {
        int bcnt=0;
        for(set<ll>::iterator it=B[i].begin();it!=B[i].end();it++) {
            if(color[*it]==color[i]) bcnt++;
        }
        if(!i) cout << ctid[color[i]]-S[i].size()-bcnt;
        else cout << " " << ctid[color[i]]-S[i].size()-bcnt;
    }

    return 0;
}

Measured memory_bytes: 30720
import heapq

N, K = map(int, input().split())
A = map(int, input().split())

T = [0] * (N + 1)

for a in A:
    T[a] += 1

ns = []
for t in T:
    if t > 0:
        heapq.heappush(ns, t)
ans = 0
while len(ns) > K:
    ans += heapq.heappop(ns)
print(ans)


Measured memory_bytes: 18564
def digit_sum(x):
    res = 0
    while x != 0:
        res += x%10
        x //= 10
    return res
    
[N,A,B] = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
    if A <= digit_sum(i) <= B:
        ans += i
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 2005;
const int mod = 1e9 + 7;

int n, S, T, dia, a, b, ans, g[MAXN], d[MAXN], f[MAXN][MAXN];
vector < int > adj[MAXN];

inline void Inc(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline void Dec(int &x, int y) { x -= y; if (x < 0) x += mod; }

inline void Dfs(int x, int c)
{
	d[x] = c ++;
	for (auto y : adj[x])
		if (y ^ g[x])
			g[y] = x, Dfs(y, c);
}

inline void Find()
{
	Dfs(1, 0);
	mset(g, 0);
	for (int i = 1; i <= n; i ++)
		if (d[i] > d[S])
			S = i;
	Dfs(S, 0);
	for (int i = 1; i <= n; i ++)
		if (d[i] > d[T])
			T = i;
	dia = d[a = T];
	for (int i = 1; i <= d[T] >> 1; i ++, a = g[a]);
	if (d[T] & 1)
		b = g[a];
}

inline void Dfs(int x, int g, int d, int l)
{
	for (auto y : adj[x])
		if (y ^ g)
			Dfs(y, x, d + 1, l);
	for (int i = d - l; i <= l - d; i ++)
	{
		f[x][i + 1002] = 1;
		for (auto y : adj[x])
			if (y ^ g)
				f[x][i + 1002] = 1LL * f[x][i + 1002] * (f[y][i + 1003] + f[y][i + 1001]) % mod;
	}
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 1, x, y; i < n; i ++)
		x = Read(), y = Read(), adj[x].pb(y), adj[y].pb(x);
	Find();
	if (dia & 1)
	{
		Dfs(a, b, 0, dia >> 1); Dfs(b, a, 0, dia + 1 >> 1);
		for (int i = -dia >> 1; i <= dia >> 1; i ++)
			Inc(ans, 1LL * f[a][i + 1002] * (f[b][i + 1003] + f[b][i + 1001]) % mod);
		mset(f, 0);
		Dfs(b, a, 0, dia >> 1); Dfs(a, b, 0, dia + 1 >> 1);
		for (int i = -dia >> 1; i <= dia >> 1; i ++)
			Inc(ans, 1LL * f[b][i + 1002] * (f[a][i + 1003] + f[a][i + 1001]) % mod);
		mset(f, 0);
		Dfs(a, b, 0, dia >> 1); Dfs(b, a, 0, dia >> 1);
		for (int i = -dia >> 1; i <= dia >> 1; i ++)
			Dec(ans, 2LL * f[a][i + 1002] * f[b][i + 1002] % mod);
		for (int i = -dia >> 1; i <= dia >> 1; i ++)
			Dec(ans, 1LL * f[a][i + 1002] * f[b][i + 1004] % mod);
		for (int i = -dia >> 1; i <= dia >> 1; i ++)
			Dec(ans, 1LL * f[b][i + 1002] * f[a][i + 1004] % mod);
		return printf("%d\n", ans), 0;
	}
	else
	{
		Dfs(a, 0, 0, dia >> 1);
		for (int i = -dia >> 1; i <= dia >> 1; i ++)
			Inc(ans, f[a][i + 1002]);
		return printf("%d\n", ans), 0;
	}
}


Measured memory_bytes: 16128
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    prev = A[0]
    for i in range(1, len(A)):
        prev = gcd(prev, A[i])
    return prev

def gcd(a, b):
    if a == 0: return b
    else: return gcd(b % a, a)

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string s,t;
	cin >> s >> t;
	bool ans = true;
	int ms[26];
	int mt[26];
	for (int i = 0;i < 26;i++) {
		ms[i] = -1;
		mt[i] = -1;
	}
	for (int i = 0;i < s.size();i++) {
		ms[s[i]-'a']++;
	}
	for (int i = 0;i < s.size();i++) {
		mt[t[i]-'a']++;
	}
	sort(ms,ms+26);
	sort(mt,mt+26);
	for (int i = 0;i < 26;i++) {
		if (ms[i] != mt[i]) {ans = false;}
	}
	if (ans) {cout << "Yes" << endl;}
	else {cout << "No" << endl;}
}

Measured memory_bytes: 776
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int d1 = Math.abs(x-a);
        int d2 = Math.abs(x-b);

        if(d1 < d2){
            System.out.println("A");
        } else
            System.out.println("B");
    }
}

Measured memory_bytes: 21972
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int X, Y;
	std::cin >> X >> Y;
	int leg = 2 * X;
	for (auto i : boost::irange(X + 1))
	{
		if (leg == Y)
		{
			std::cout << "Yes" << std::endl;
			return;
		}
		leg += 2;
	}
	std::cout << "No" << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	int c = 0;
	for(int i = 0; i < (int)s.size(); i++){
		if(i % 2 == 0 && s[i] == '0')
			c ++;
		else if(i % 2 == 1 && s[i] == '1')
			c ++;
	}
	int mini = c;
	c = 0;
	for(int i = 0; i < (int)s.size(); i++){
		if(i % 2 == 0 && s[i] == '1')
			c ++;
		else if(i % 2 == 1 && s[i] == '0')
			c ++;
	}
	cout << min(mini, c);
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
from collections import deque

class MM:
    def __init__(self, c_max, c_cnt):
        self.c_max = c_max
        self.c_cnt = c_cnt

def solve(N: int, A: "List[int]"):
    sl = list(reversed(sorted(A)))
    score = 0
    c_max = sl[0]
    h = {sl[0]: 1}
    queue = deque()
    queue.append(c_max)
    for i in range(1, len(sl)):
        score += c_max

        h[c_max] -= 1
        if sl[i] in h:
            h[sl[i]] += 2
        else:
            h[sl[i]] = 2
            queue.append(sl[i])

        if h[c_max] == 0:
            queue.popleft()
            c_max = queue[0]
        # print(f'{i} {sl[i]} {c_max} {h}')
    print(score)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 52612
(setq h (read))
(setq w (read))
(setq al "ABCDEFGHIJKLMNOPQRSTUVWXYZ")

(defun read-not-space ()
  (let ((s (read-char)))
	(if (or (eq s nil) (char= s #\space) (char= s #\newline))
	  (read-not-space)
	  s)))

(defun read-5()
  (let ((res (make-array 5)))
	(progn
	  (setf (aref res 0) (read-not-space))
	  (setf (aref res 1) (read-not-space))
	  (setf (aref res 2) (read-not-space))
	  (setf (aref res 3) (read-not-space))
	  (setf (aref res 4) (read-not-space))
	  (concatenate 'string res))))

(defun func(x y)
  (if (string= (read-5) "snuke")
	(progn
	  (princ (aref al x))
	  (princ y))
	(func (mod (1+ x) w) (+ y (floor (1+ x) w)))))
(func 0 1)


Measured memory_bytes: 8292
N = int(input())
F = [int(input().replace(" ", ""), 2) for _ in range(N)]
P = [list(map(int, input().split(" "))) for _ in range(N)]

max_num = -(10**9)
for i in range(1, 1<<10):
    point = 0
    for j in range(N):
        point += P[j][bin(i&F[j]).count("1")]
    # print(point, end=", ")
    # if max_num < point:
    #     print(bin(i), point)
    max_num = max(max_num, point)

print(max_num)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){

long double A, B, H, M, hk, mk, k, ans;
cin >> A >> B >> H >> M;
//なんにも考えずに全部doubleで定義して入力
//hkは分針の角度,mkは時針の角度,kはその差で,ansが答え出力用

mk = M * 6;
hk = H * 60;
hk = hk + M;
hk = hk / 2;
k = fabs(hk - mk);
//ここまでで時計の針の角度を算出
//fabs関数で絶対値を算出できるらしい？

k = k*(3.141592654/180);
//角度をラジアンに変換
ans = 2 * A * B * cos(k);
ans = ans * -1;
A = A * A;
B = B * B;
ans = A + B + ans;
//ここまで余弦定理(c^2=a^2+b^2-2ab cos(a))
ans = sqrtl(ans);
//平方根が答え

cout << fixed << setprecision(20) << ans << endl;

}

Measured memory_bytes: 4164
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (100000)
#define MOD (1000000007)


// Segment Tree
// セグメント木
// 区間最大
// i = 0～
#define SEG_N ((1<<17)) // > 10^5
#define SEG_INVALID (INT_MIN)
int segt[SEG_N*2];

void SEGTupdate(int i, int val)
{
    i = SEG_N-1+i;
    segt[i] = val;
    while(i)
    {
        i = (i-1)/2;
        segt[i] = max(segt[i*2+1], segt[i*2+2]);
    }
}

int SEGTget_sub(int l, int r, int i, int il, int ir)
{
    if((ir < l) || (r < il) ) return SEG_INVALID; // 被らない
    if((l <= il) && (ir<=r) )
    {
        return segt[i]; // 完全にかぶっている
    }else
    {
        int lv = SEGTget_sub(l,r,i*2+1,il, (il+ir+1)/2-1);
        int rv = SEGTget_sub(l,r,i*2+2, (il+ir+1)/2,ir);
        return max(lv,rv);
    }
    
}

int SEGTget(int l, int r)
{
    return SEGTget_sub(l,r,0,0,SEG_N-1);
}

typedef struct 
{
    int a;
    int b;
}ar;

ar ars[MAXN];

int des_ar(const void *a, const void *b){return ((ar*)b)->b - ((ar*)a)->b;} /* 8,7,6,5.. */

int main(void)
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&(ars[i].a),&(ars[i].b));
    }
    qsort(ars, n, sizeof(ar), des_ar);

    for(int i=1;i<m;i++) SEGTupdate(i,i);

    uint64_t ans = 0;
    for(int i=0;i<n;i++)
    {
        if(ars[i].a > m) continue;
        int v = SEGTget(0, m-ars[i].a);
        if(v!=-1)
        {
            ans += ars[i].b;
            SEGTupdate(v, -1);
        }
    }

    printf("%ld\n",ans);

    return 0;
}





Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
typedef long long ll;
typedef double ld;
typedef pair<int,int> p2;
typedef pair<p2,int> p3;
typedef vector<ll> vi;
const ll Mod = 7 + 1e9;
const ll INF32 = 5 + 2e9;
const ll INF64 = 5 + 1e18;
const ll MAX = 5+ 1e5;

int N,W,w[105],v[105];
ll dp[105][MAX];
int main()
{
    cin >> N >> W;
    for(int i=1;i<=N;i++)
        cin >> w[i] >> v[i];
    for(int i=1;i<=N;i++)
        for(int j=0;j<=W;j++)
    {
        dp[i][j] = dp[i-1][j];
        if( j - w[i] >= 0 )
            dp[i][j] = max( dp[i][j] ,v[i] + dp[i-1][j-w[i]] );
    }
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 79360
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(long long i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(long long i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

ll n,a,b;
vector<ll>e[200010];
ll c[2][200010]={0};

signed main() {
	cin>>n;
    for(int i=0;i<n-1;++i){
        cin>>a>>b;
        e[a-1].push_back(b-1);
        e[b-1].push_back(a-1);
    }
	
    
    for(int i=0;i<2;++i){
        for(int j=0;j<n;++j)c[i][j]=-1;
    }
    queue<ll>q;
    q.push(0);
    c[0][0]=0;
    while(!q.empty()){
        ll x=q.front();
        q.pop();
        for(int i=0;i<e[x].size();++i){
            if(c[0][e[x][i]]==-1){
                q.push(e[x][i]);
                c[0][e[x][i]]=c[0][x]+1;
            }
        }
    }
    ll d=-1,k;
    for(int i=0;i<n;++i){
        if(d<c[0][i]){
            d=c[0][i];
            k=i;
        }
    }
    q.push(k);
    c[1][k]=0;
	while(!q.empty()){
        ll x=q.front();
        q.pop();
        for(int i=0;i<e[x].size();++i){
            if(c[1][e[x][i]]==-1){
                q.push(e[x][i]);
                c[1][e[x][i]]=c[1][x]+1;
            }
        }
    }
    d=-1;
    for(int i=0;i<n;++i){
        d=max(d,c[1][i]);
    }

    if(d%3!=1)cout<<"First"<<endl;
    else cout<<"Second"<<endl;

	return 0;
}


Measured memory_bytes: 17520
N = int(input())
V = list(map(int, input().split()))

V.sort()
ans = 0

for count,i in enumerate(V):
  if count == 0 or count == 1:
    ans += i / (2**(N-1))
  else:
    ans += i / (2**(N-count))
else:
  print(ans)

Measured memory_bytes: 3060