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

int main() {
  // a b c d
  // 1 2 2 1
  vector<int> cnt(4);
  for ( int i=0; i<3; i++ ) {
    int a,b;
    cin >> a >> b;
    --a; --b;
    cnt[a]++;
    cnt[b]++;
  }
  sort(cnt.begin(),cnt.end());
  if ( cnt[0]==1&&cnt[2]==2&&cnt[0]==cnt[1]&&cnt[2]==cnt[3] ) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


int main() {

  int N, L;

  cin >> N >> L;

  int ans = 0;
  int tmp = abs(L);
  REP(i, N){
    ans += L + i;
    if (tmp > abs(L + i)) tmp = abs(L + i);
  }
//cout << ans << endl;
  if (L >= 0) ans -= tmp;
  else if (L + N - 1 <= 0) ans += tmp;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

lli add(lli a, lli b) {
	a += b;
	if (a >= mod) a -= mod;
	return a;
}

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int h,a;
	cin>>h>>a;
	cout<<(h/a+(h%a!=0))<<endl;
}

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

#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define REP(i, n) for (long long i = 0; i < (n); i++)
const ll INF = 1LL << 60;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
};
signed main() {
    int n;
    cin >> n;
    vector<ll> as(n);
    map<int, int> cnt;
    REP(i, n) {
        cin >> as[i];
        cnt[as[i]]++;
    }
    as.push_back(INF);
    int q;
    cin >> q;
    vector<int> k(q);
    REP(i, q) {
        cin >> k[i];
        if (as[(lower_bound(as.begin(), as.end(), k[i]) - as.begin())] == k[i]) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    }
}


Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	long long add = 0;
	for(int i = n - 1; i >= 0; i--){
		long long v = add + a[i];
		int need = (b[i] - (v % b[i]))%b[i];
		add += need;
	}
	cout << add << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>

int cul[10];

void ard(int v){
	
	if(v < 400){
		cul[0]++;
	}else if(v < 800){
		cul[1]++;
	}else if(v < 1200){
		cul[2]++;
	}else if(v < 1600){
		cul[3]++;
	}else if(v < 2000){
		cul[4]++;
	}else if(v < 2400){
		cul[5]++;
	}else if(v < 2800){
		cul[6]++;
	}else if(v < 3200){
		cul[7]++;
	}else{
		cul[8]++;
	}
	
}


int main(){
	
	int x, N; 
	scanf("%d", &N);
	
	for(int i = 0; i < N; ++i){
		scanf("%d", &x);
		
		ard(x);
	}
	
	int cul1 = 0, cnt2 = cul[8];
	
	for(int i = 0; i < 8; ++i){
		if(cul[i] > 0)
			cul1++;
	}
	
	if(cnt2 > 0){
		printf("%d %d", std::max(cul1, 1), cul1 + cnt2);
	}else{
		printf("%d %d", cul1 , cul1);
	}
	
return 0;	
}




Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

ll sosu(ll a){
    ll ans = 1;
    for(ll i=2; i<=sqrt(a); i++){
        if(a % i == 0){
            do{
                a = a/i;
            }while(a%i==0);
            ans = i;
        }
    }
    if(ans == 1) ans = a;
    return ans;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    if(b>a){
        ll tmp = a;
        a = b;
        b = tmp;
    }
    ll ans = 0;

    ll k;
    k=gcd(a,b);
    k = sosu(k);
    while(k>1){
        //cout <<"konkaiha" << k << endl;
        ans++;
        do{
            a /= k;
            b /= k;
        }while((a%k==0) && (b%k==0));
        k=gcd(a,b);
        k = sosu(k);
    }
    ans++;

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k;
    while(cin>>n>>k&&n>0&&k>0&&n<101&&k<101)
    {
        double temp;
        int ans;
        temp=n/k;
        if((temp*k)>n)
        {
            temp--;
        }
        /*cout<<" temp "<<temp<<endl;*/
        ans=n%k;
       /* cout<<" ans "<<ans<<endl;*/
        int a[110];
        for(int i=0;i<k;i++)
        {
            a[i]=temp;

        }
        int u=0;
        for(int j=1;j<=ans;j++)
        {
            a[u]=a[u]+1;
            u++;
        }
        sort(a,a+k);
        cout<<a[k-1]-a[0]<<endl;


    }


    return 0;
}


Measured memory_bytes: 256
X,K,D = map(int,input().split())
X = abs(X)
ans = 0
if X - D*K> 0:
    ans = X-D*K
else:
    count = X//D
    K -= count
    X -= count*D
    if K%2 == 1:
        X = abs(X-D)
    ans = X
print(ans)

Measured memory_bytes: 9164
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class UnionFindNode
    {
        internal UnionFindNode parent;
        internal int rank;
    }

    class UnionFind
    {
        Dictionary<object, UnionFindNode> _dict;

        public UnionFind()
        {
            _dict = new Dictionary<object, UnionFindNode>();
        }

        public void Unite(IComparable x, IComparable y)
        {
            var xRoot = Root(x);
            var yRoot = Root(y);

            if (xRoot == yRoot) return;

            if (xRoot.rank < yRoot.rank)
            {
                xRoot.parent = yRoot;
            }
            else
            {
                yRoot.parent = xRoot;

                if (xRoot.rank == yRoot.rank) xRoot.rank++;
            }
        }

        public bool IsSame(IComparable x, IComparable y)
        {
            return Root(x) == Root(y);
        }

        UnionFindNode Root(object obj)
        {
            if (!_dict.ContainsKey(obj))
            {
                var node = new UnionFindNode();
                _dict.Add(obj, node);
                return node;
            }
            else
            {
                var node = _dict[obj];
                return Find(node);
            }
        }

        UnionFindNode Find(UnionFindNode node)
        {
            if (node.parent == null) return node;

            return node.parent = Find(node.parent);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split(' ');
            int q = int.Parse(input1[1]);

            UnionFind uf = new UnionFind();
            StringBuilder sb = new StringBuilder();

            for(int i = 0; i < q; i++)
            {
                string[] input2 = Console.ReadLine().Split(' ');
                int com = int.Parse(input2[0]);
                int x = int.Parse(input2[1]);
                int y = int.Parse(input2[2]);

                if (com == 0) uf.Unite(x, y);
                else sb.AppendLine(uf.IsSame(x, y) ? "1" : "0");
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 11248
n, x, m = map(int, input().split())

v = list(range(m))
p = [-1 for _ in range(m)]

a = x
p[a - 1] = 0
s = [x]
l, r = n, n
for i in range(n):
    a = a ** 2 % m
    if p[a - 1] >= 0:
        l, r = p[a - 1], i + 1
        break
    else:
        s.append(a)
        p[a - 1] = i + 1
ans = sum(s[:l])
if l != r:
    b = (n - 1 - i) // (r - l) + 1
    c = (n - 1 - i) % (r - l)
    ans += b * sum(s[l:r]) + sum(s[l:l + c])
print(ans)


Measured memory_bytes: 17492
// https://atcoder.jp/contests/abc139/tasks/abc139_a
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string S, T;
    cin >> S >> T;
    int cnt = 0;
    for (int i = 0; i < 3; ++i)
    {
        if (S[i] == T[i]) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools


input_list = []

for i in iter(input, '0 0'):
    input_list.append(i)

for i in input_list:
    count = 0
    n, x = map(int, i.split())
    for j in itertools.combinations(range(1, n + 1), 3):
        if sum(j) == x:
            count += 1
    print(count)



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

#define ll long long

int main(){
    ll N, K, Q, buf;
    cin >> N >> K >> Q;
    unordered_map<int,int> UM;
    for(int i = 1; i <= Q; ++i){
        cin >> buf;
        ++UM[buf];
    }
    for(int i = 1; i <= N; ++i){
        if(K - (Q-UM[i]) > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 7384
use std::io::prelude::*;
use std::io::{self};

fn main() {
    let mut stdin = io::stdin();
    let mut buf = String::new();

    stdin.read_to_string(&mut buf).unwrap();
    
    let d = buf.trim();
    
    let ans = if d == "25" {"Christmas"}
              else if d == "24" {"Christmas Eve"}
              else if d == "23" {"Christmas Eve Eve"}
              else {"Christmas Eve Eve Eve"};
    
    println!("{}", ans);

}

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

using namespace std;


const long nmax=100010;

using edge= struct {long to, cost;};
vector<edge> tree[nmax];
long depth[nmax];

void dfs(long v,long p,long d){
  depth[v]=d;

  for(auto &e: tree[v]){
   if(e.to==p) continue;
    dfs(e.to,v,d+e.cost);
  }
 
}

int main(){
 long n;
  cin >> n;
 
  for(int i=0;i<n-1;i++) {
    long a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    tree[a].push_back({b,c});
    tree[b].push_back({a,c});
  }
  
  long q,k;
  cin >> q >> k;
  k--;
  
  dfs(k,-1,0);
  for(int i=0;i<q;i++){
   long x,y;
    cin >> x >> y;
    x--;
    y--;
    cout << depth[x]+depth[y] << endl;
  
  }

}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll a[7];
	zep(i, 0, 7){
		cin >> a[i];
	}
	
	ll ans = 0;
	ans += 2*(a[0]/2);
	ans += a[1];
	ans += 2*(a[3]/2);
	ans += 2*(a[4]/2);

	ll ans2 = 0;
	if(a[0] > 0 && a[3] > 0 && a[4] > 0){
		ans2 += 3;
		a[0]--;
		a[3]--;
		a[4]--;
	}
	ans2 += 2*(a[0]/2);
	ans2 += a[1];
	ans2 += 2*(a[3]/2);
	ans2 += 2*(a[4]/2);
	
	print(max(ans, ans2))
	return 0;
}

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

const int maxN = 6005;

int ans, tot;
int len[3];
bool f[3][3][maxN + 1];
char s[3][maxN + 1];

int main()
{
	for(int i = 0; i < 3; i++)
		scanf("%s", s[i] + 1), len[i] = strlen(s[i] + 1);

	tot = ans = len[0] + len[1] + len[2];
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++)
		{
			if(i == j) continue;
			for(int p = 1; p <= tot; p++)
			{
				f[i][j][p] = true;
				for(int l = 1, r = p; l <= len[i] && r <= len[j]; l++, r++)
					if(s[i][l] != s[j][r] && s[i][l] != '?' && s[j][r] != '?')
					{
						f[i][j][p] = false;
						break;
					}
			}
		}

	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++)
		{
			if(i == j) continue;
			int k = 3 - i - j;
			for(int l = 1; l <= tot; l++)
			{
				if(!f[j][i][l]) continue;
				for(int r = 1; r <= tot; r++)
				{
					if(!f[k][j][r]) continue;
					int t = l + r - 1;
					if(!f[k][i][t]) continue;
					ans = min(ans, t - 1 + max(len[k], max(len[j] - r + 1, len[i] - t + 1)));
				}
			}
						
		}

	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;
typedef vector<char> vchar;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================


vbool made(1e8);

bool k;

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	int N;
	cin >> N;

	vpint R(N), B(N);
	for (int i = 0; i < N; i++)
	{
		cin >> R[i].second >> R[i].first;
	}
	for (int i = 0; i < N; i++)
	{
		cin >> B[i].first >> B[i].second;
	}


	sort(R.begin(), R.end(), greater<pair<int, int>>());
	sort(B.begin(), B.end());

	int ans = 0;
	int b_check = 0;



	for(int i = 0; i < N; i++)
	{

		for (int j = 0; j < R.size(); j++)
		{
			if (R[j].first < B[i].second && R[j].second < B[i].first)
			{
				ans++;
				R.erase(R.begin() + j);
				break;
			}
		}


	}



	cout << ans << endl;


}



Measured memory_bytes: 12416
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ')
            .Select(x => int.Parse(x)).ToList();
        var n = inputs[0];
        var d = inputs[1];
        var point = new int[n, d];
        for (var i = 0; i < n; i++)//I点
        {
            var inputs2 = Console.ReadLine().Split(' ')
                .Select(x => int.Parse(x)).ToList();
            for (var j = 0; j < d; j++)//j次元
            {
                point[i, j] = inputs2[j];
            }
        }
        var ans = 0;
        for (var i = 0; i < n; i++)//I点
        {
            for (var j = i + 1; j < n; j++)//J点
            {
                double dis = 0;//あほすぎる
                for (var k = 0; k < d; k++)//k次元
                {
                    dis += Math.Pow(point[i, k] - point[j, k], 2);
                }
                dis = Math.Sqrt(dis);
                if (Math.Floor(dis) == Math.Ceiling(dis))
                {
                    ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int num[110000];

int main(){
  string S;
  cin>>S;
  if(S[0]!=S[1] && S[1]!=S[2] && S[0]!=S[2]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main(){
  int N;
  double a;
  cin>>N;
  a =(float)(N+1)/2/N;
  if(N%2==0) cout<<"0.5000000000"<<endl;
  else cout<<a<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }


        public static readonly int NIL = -1;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NE = Sarray();
            var N = NE[0];
            var E = NE[1];
            var G = new List<KeyValuePair<long, long>>[N];
            for(var i=0;i<N;++i)
            { G[i] = new List<KeyValuePair<long, long>>(); }

            for (var i = 0; i < E; ++i)
            {
                var std = Sarray();
                G[std[0]].Add(new KeyValuePair<long, long>(std[1], std[2]));
            }
            var dst = floyd(G);
            for(var i=0;i<N;++i)
            {
                if(dst[i,i]<0)
                {
                    WriteLine("NEGATIVE CYCLE");
                    return;
                }
            }
            for (var i = 0; i < N; ++i)
            {
                for (var j = 0; j < N; ++j)
                {
                    if (dst[i, j] == long.MaxValue)
                        Write("INF");
                    else
                        Write(dst[i, j]);
                    if (j != N - 1) Write(" ");
                }
                WriteLine();
            }
            //Out.Flush();
        }

        static long[,] floyd( List<KeyValuePair<long, long>>[] M)
        {
            var n = M.Length;
            var d = new long[n, n];
            for (var i = 0; i < n; ++i)
                for (var j = 0; j < n; ++j)
                { d[i, j] = i == j ? 0 : long.MaxValue; }
            for (var i = 0; i < n; ++i)
                foreach (var kv in M[i])
                    d[i, kv.Key] = kv.Value;

            for (var k = 0; k < n; ++k)
            {
                for (var i = 0; i < n; ++i)
                {
                    if (d[i, k] == long.MaxValue) continue;
                    for (var j = 0; j < n; ++j)
                    {
                        if (d[k, j] == long.MaxValue) continue;
                        d[i, j] = Math.Min(d[i, j], d[i, k] + d[k, j]);
                    }
                }
            }
            return d;
        }
    }
}


Measured memory_bytes: 20696
#include <iostream>
#include <bits/stdc++.h>
#include <set>
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define vii vector<pair<int, int> >
#define si stack<int>
#define pb push_back
#define mp make_pair
#define ALL(T) (T).begin(), (T).end()
#define MODU 1000000007
typedef long long ll;
using namespace std;

ll intmax = (1LL<<32)-1;
ll llmax = (1LL<<60)-1;

const int INF = 1e9 + 5;

class fastio{
public:
	fastio(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
	}
} __fastio;

template <typename T>
T abs(T x){
	if(x<0)	return -x;
	else return x;
}

void DFSVisit(int u, vector<int> g[], vector<bool> &visited){ 
    visited[u] = true;
    for(int i=0; i<g[u].size(); i++){
        if(!visited[g[u][i]]){
            DFSVisit(g[u][i], g, visited); 
        }
    }
} 
  
void DFS(vector<int> adj[], int V){
    vector<bool> visited(V, false); 
    for(int u=0; u<V; u++) 
        if(!visited[u]) 
            DFSVisit(u, adj, visited);
}


void solve(){
	
}

int main(){
	int n;
	cin >> n;
	vi a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(ALL(a));
	int mid = n/2;
	int ans = (a[mid] - a[mid-1]);
	cout << ans;
}

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

class T{
  public:
    ll value;
    char c;

    bool operator == (const T &t)const{
      return value == t.value && c == t.c;
    }
};

bool isStable(vector<T> input, vector<T> sorted){
  set<int> nums;
  for(int i = 0; i < input.size(); i++){
    nums.insert(input[i].value);
  }
  for(set<int>::iterator it = nums.begin(); it != nums.end(); it++){
    list<char> order;
    for(int i=0; i < input.size(); i++){
      if(input[i].value == (*it)){
        order.push_back(input[i].c);
      }
    }
    list<char>::iterator c = order.begin();
    for(int i = 0; i < sorted.size(); i++){
      if(sorted[i].value == (*it)){
        if(sorted[i].c != *c) return false;
        else c++;
      }
    }
  }
  return true;
}

ll partition(vector<T> &A, ll p, ll r){
  ll x = A[r].value;
  ll i = p-1;
  for(ll j = p; j < r; j++){
    if(A[j].value <= x){
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i+1], A[r]);
  return i+1;
}

void quicksort(vector<T> &A, ll p, ll r){
  if(p < r){
    ll q = partition(A, p, r);
    quicksort(A, p, q-1);
    quicksort(A, q+1, r);
  }
}

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<T> v(n);
  for(ll i = 0; i < n; i++){
    cin >> v[i].c >> v[i].value;
  }
  vector<T> org(v);
  quicksort(v, 0, n-1);
  if(isStable(org, v)){
    cout << "Stable" << endl;
  }else{
    cout << "Not stable" << endl;
  }
  for(ll i = 0; i < n; i++){
    cout << v[i].c << " " << v[i].value << endl;
  }
  return 0;
}

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

bool r(int x){
    int i=0;
    string S(5,'0');
    while(x){
        S[i]=x%10+'0';
        x/=10;
        i++;
    }
    string tmp=S;
    reverse(S.begin(),S.end());
    if(S==tmp) {
        return true;
    }
    else return false;
}

int main(){
    int A,B;
    cin>>A>>B;
    int ans=0;
    for(int i=A;i<=B;i++){
        ans+=r(i);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x




signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll X;
    cin >> X;

    //vll X(N);
    //REP(i,N) cin >> X[i];


    //本文
    for(ll i=0;i<10000000;i++){
        if((i*(i+1))/2>=X){cout << i;return 0;}
    }
    //出力
    //cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <iomanip>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>

#include <numeric>
#include <algorithm>
#include <functional>

#include <cctype>

#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(unsigned int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))

typedef long long ll;
typedef complex<double> P;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};
const double EPS = 1e-9;
const int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

const int PP =  300000;

bool isPrime[PP] = {false};
void sieve(){
    bool found[PP] = {false};
    for(int i=2;i*i<PP;i++){
        if(found[i]) continue;
        for(int j=2*i;j<PP;j+=i){
            found[j] = true;
        }
    }
    for(int i=2;i<PP;i++){
        isPrime[i] = !found[i];
    }
}

int main(){
    sieve();
    int n;
    while(cin >> n and n != 0){
        int c=0;
        for(int i=n+1;i<=2*n;i++){
            if(isPrime[i]) c++;
        }
        cout << c << endl;
    }
    return 0;
}

Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) (v.begin(), v.end())
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int x;
    cin >> x;
    int sum = 0;
    int i = 0;
    while (sum < x) {
        i++;
        sum += i;
    }

    cout << i << endl;
    return 0;
}


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

typedef long long ll;
using namespace std;

int gcd(int a, int b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

int lcm(int a, int b) { //最小公倍数
  return a * b / gcd(a, b);
}


int main()
{
  ll x,t;
  cin>>x>>t;

  cout<<max(0LL,x-t)<<endl;
  return 0;
}


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

int main()
{
    int n,m;
    cin >> n >> m;
    int a[n][2];
    for(int i=0;i<n;i++)
        cin >> a[i][0] >> a[i][1];
    int ma=m;
    for(int i=0;i<n;i++){
        m+=a[i][0];
        m-=a[i][1];
        if(m<0){
            ma=0;
            break;
        }
        ma=max(ma,m);
    }
    cout << ma << endl;
    return 0;
}



Measured memory_bytes: 3176
#include <iostream>
using namespace std;
#define INF (1<<21)
int main(){
	int a,b;
	while(1){
		a=-1;
		int data[100]={0};
		while(cin >> a >> b && a || b){
			a--;b--;
			data[a]++;
			data[b]++;
		}
		if(a==-1)return 0;

		bool flag = false;
		if(data[0]%2==0 || data[1]%2==0)flag = true;
		for(int i=2;i<100;i++){
			if(data[i]%2==1 && data[i]){
				flag = true;
			}
		}
		cout << (flag?"NG":"OK") << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
 
#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
 
using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define endl '\n';
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; }
template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
    #define eprintf(...) 42
#endif

clock_t startTime;
double getCurrentTime() {
    return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = (ll)1e9 + 7, INF = (ll)1e18;;
ll add(ll x, ll y) {
    x += y;
    if (x >= MOD) return x - MOD;
    return x;
}
ll sub(ll x, ll y) {
    x -= y;
    if (x < 0) return x + MOD;
    return x;
}
ll mul(ll x, ll y) {
    return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(x, bin_pow(x, p - 1));
    return bin_pow(mul(x, x), p / 2);
}

string s;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    startTime = clock();
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    
    cin >> s;
    int ans = 0, p_cnt = 0, g_cnt = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'p') {
            if (p_cnt < g_cnt) {
                ++p_cnt;
            }
            else {
                ++g_cnt;
                --ans;
            }
        }
        else {
            if (p_cnt < g_cnt) {
                ++p_cnt;
                ++ans;
            }
            else {
                ++g_cnt;
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3776
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    // 子どもの人数を標準入力から取得
    int number = scanner.nextInt();

    // キャンディーの個数は子どもの人数Nを利用して「(N + 1) * N / 2」と表される
    System.out.println((number + 1) * number / 2);
  }
}

Measured memory_bytes: 35536
import sys
input=sys.stdin.readline

n=int(input())
a=[]
for i in range(n):
    x=input().rstrip()
    if '.' in x:
        y=x.split('.')
        x=int(y[0])*10**9+int(y[1])*10**(9-len(y[1]))
    else:
        x=int(x)*10**9
    a.append(x)

b=[]
for i in a:
    x=i
    count2=0
    while x%2==0:
        x=x//2
        count2+=1
    count5 = 0
    while x % 5 == 0:
        x = x // 5
        count5 += 1

    b.append((count2,count5))

imos=[[0]*50 for i in range(50)]

for i in b:
    imos[0][0]+=1
    imos[i[0]+1][0]-=1
    imos[0][i[1]+1]-=1
    imos[i[0]+1][i[1]+1]+=1

for i in range(49):
    for j in range(49):
        imos[i][j+1]+=imos[i][j]
for j in range(49):
    for i in range(49):
        imos[i+1][j]+=imos[i][j]

ans=0
for i in b:
    x=18-i[0]
    y=18-i[1]
    x=max(x,0)
    y=max(y,0)
    ans+=imos[x][y]

for i in b:
    if i[0]*2>=18 and i[1]*2>=18:
        ans-=1

ans=ans//2
print(ans)

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

int main(){
    std::string S, T;
    std::cin >> S >> T;
    std::vector< char > char_chg_S(26, 0);
    std::vector< char > char_chg_T(26, 0);
    
    std::string S_chg;
    char index = 'a';
    for(int i=0; i<S.size(); i++){
        if(char_chg_S[S[i] - 'a'] == 0 && char_chg_T[T[i] - 'a'] == 0){
            char_chg_S[S[i] - 'a'] = index;
            char_chg_T[T[i] - 'a'] = index;
            index++;
        }else if(char_chg_S[S[i] - 'a'] != char_chg_T[T[i] - 'a']){
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    
    std::cout << "Yes" << std::endl;
    
    return 0;
}



Measured memory_bytes: 776
def calc(s)
  c, l = 0, s.size
  if l.odd?
    c += 1 if s[l / 2] <= ')'
  end
  (0 .. l / 2 - 1).each do |i|
    if s[i] <= ')'
      c += 1 if (s[i].ord - s[l - i - 1].ord).abs != 1
    else
      c += 1 if s[i] != s[l - i - 1]
    end
  end
  c
end
1.times do
  s = gets.chomp
  puts calc(s)
end

Measured memory_bytes: 8716
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int l_max = 0;
    int r_min = 10000000;
    REP(i,m){
        int l,r;
        cin>>l>>r;
        l_max = max(l_max, l);
        r_min = min(r_min, r);
    }
    int ans = max(0, (r_min - l_max + 1));
    PUTS(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <algorithm>
#include <math.h>
#include <iomanip>
using namespace std;

struct UnionFind{
    vector<int> par;
    vector<int> rank;
    vector<int> siz;

    UnionFind(int n)
        : par(n), rank(n), siz(n, 1)
    {
        for (int i = 0; i < n; i++){
            par[i] = i;
        }
    }

    int Root(int x){
        if (par[x] == x){
            return x;
        } else{
            return par[x] = Root(par[x]);
        }
    }

    bool IsSame(int x, int y){
        return Root(x) == Root(y);
    }

    void Unite(int x, int y){
        x = Root(x);
        y = Root(y);
        if (x == y){
            return;
        }

        if (rank[x] < rank[y]){
            siz[y] += Size(Root(x));
            par[x] = y;
        } else {
            siz[x] += Size(Root(y));
            par[y] = x;
            if (rank[x] == rank[y]){
                rank[x]++;
            }
        }
    }

    int Size(int x){
        if (x >= siz.size()){
            return -1;
        }
        return siz[Root(x)];
    }
};

struct UnionFind2 {
  vector<int> data;
  UnionFind2(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


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

    stack<int> a;
    stack<int> b;

    int t1,t2;
    for (int i = 0; i < m; i++){
        cin >> t1 >> t2;
        a.push(t1 - 1);
        b.push(t2 - 1);
    }

    UnionFind uf(n);
    int amount = n;
    int s1,s2;
    stack<long> output;
  	output.push((long)n * (n - 1) / 2);
    for (int i = 0; i < m - 1; i++){
        t1 = a.top();
        t2 = b.top();
        if (uf.IsSame(t1, t2)){
          	output.push(output.top());
        }
        else{
			output.push(output.top() - (long)uf.Size(t1) * (long)uf.Size(t2));
        }
        uf.Unite(t1, t2);
        a.pop();
        b.pop();
    }
  	while (!output.empty()){
    	cout << output.top() << endl;
      	output.pop();
    }
    return 0;
}



Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tokenizer = null;
    int totalCases, testNum;

    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    void solve() throws IOException {

    }

    void execute() throws IOException {
        String s = ns();
        String t = ns();
        int n = s.length(), m = t.length();
        int[][] dp = new int[n + 1][m + 1];
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                char c1 = s.charAt(i - 1);
                char c2 = t.charAt(j - 1);
                if (c1 == c2) {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }
        int i  = n, j = m;
        StringBuilder sb = new StringBuilder();
        while (dp[i][j] > 0) {
            if (s.charAt(i - 1) == t.charAt(j - 1)) {
                sb.append((s.charAt(i - 1)));
                i--;
                j--;
            } else if (dp[i-1][j] > dp[i][j-1]){
                i--;
            } else {
                j--;
            }
        }

        out.print(sb.reverse().toString());


        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().execute();
    }

    void debug(Object... os) {
        System.out.println(Arrays.deepToString(os));
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String ns() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(br.readLine());
        }
        return tokenizer.nextToken();
    }

    String nline() throws IOException {
        tokenizer = null;
        return br.readLine();
    }

    boolean input() throws IOException {
        return true;
    }

}


Measured memory_bytes: 76632
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	int N, K, Q; cin >> N >> K >> Q;
	int counts[N];
	F0R(i, N) counts[i] = 0;
	int req = Q-K;
	
	F0R(i, Q) {
		int X; cin >> X; X--;
		counts[X]++;
	}
	
	F0R(i, N) {
		cout << (counts[i] > req ? "Yes" : "No") << "\n";
	}
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = 0;
		n = sc.nextInt();
		int [] array = new int [n];

		sc.nextLine();
        for (int i = 0; i < n-1; i++) {
        	int tmp = 0;
        	tmp = sc.nextInt();
        	array[tmp-1]++;
        }
        for (int i = 0; i < n; i++) {
			System.out.println(array[i]);
        }
	}
}


Measured memory_bytes: 58152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; 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;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
   struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

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

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

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

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
  int main(){
     lint N,M;
     cin>>N>>M;
     UnionFind tree(N);
    lint size[N];
    fill(size,size+N,1);
     lint x=N*(N-1)/2;
     vector<lint> ans;
     ans.push_back(x);
     P p[M];
     rep(i,M){
        lint a,b;
        cin>>a>>b;
        --a;--b;
        p[i]=make_pair(a,b);
     }
   reverse(p,p+M);
     rep(i,M-1){
            lint s,v;
            tie(s,v)=p[i];
            if(tree.same(s,v)){
                tree.unite(s,v);
                ans.push_back(x);
            }
            else {
                lint g,y;
                g=size[tree.root(s)];
                y=size[tree.root(v)];
                x-=g*y;
                ans.push_back(x);
                tree.unite(s,v);
                size[tree.root(s)]=g+y;
            }
     }
    reverse(all(ans));
    rep(i,M)cout<<ans[i]<<endl;
   
    }
     
  


Measured memory_bytes: 4980
#include <iostream>

using namespace std;

// 入力
string s;

int main(void) {
    cin >> s;

    int change = 0;
    char point = s[0];
    for (int i = 1; i < s.length(); ++i) {
        if (s[i] != point) {
            change++;
            point = s[i];
        }
    }

    cout << change << endl;
    return 0;
}

Measured memory_bytes: 512
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long
#define ld double
#define ull unsigned long long
#define PI pair < int, int > 
#define hash Hash

const int N = 1e6;
const int M = 123;
const ld Pi = acos(-1);
const ll Inf = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int Sz = 501;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) {
  return 1ll * a * b % mod;
}
int sum(int a, int b) {
  add(a, b);
  return a;
}

int n, k, a[N];

void solve() {
  cin >> n >> k;
  for (int i = 1;i <= n;i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  if (k > a[n]) {
    cout << "IMPOSSIBLE\n";
    return; 
  } 
  int g = a[1];
  for (int i = 1;i <= n;i++) g = __gcd(g, a[i]);
  if (k % g) cout << "IMPOSSIBLE\n";
  else cout << "POSSIBLE\n";
} 

int main() {
  #ifdef wws
   freopen("in", "r", stdin);
  // freopen("out", "w", stdout);
  #endif 
  ios_base::sync_with_stdio(0);
  int tt = 1; 
  while(tt--) solve();
  return 0;
}


Measured memory_bytes: 640
def pow2(n):
	res = 1
	for i in range(0, n):
		res *= 2
	return res

counter = [0]
N, K = map(int, raw_input().split())
for i in range(1, N+1):
	m = i
	cnt = 0
	while m < K:
		m *= 2
		cnt += 1
	counter.append(cnt)
sum = 0
for i in range(1, N+1):
	sum += pow2(counter[1]-counter[i])
dv = N*pow2(counter[1])
print float(sum)/float(dv)

Measured memory_bytes: 38764
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll INF = 1000000000001010;
int main(){
ll n,k,q;cin>>n>>k>>q;
int num[n]={0};
rep(i,q){
    int a;
    cin>>a;a--;
    num[a]++;
}

rep(i,n){
    bool ok=true;
    if(k-(q-num[i])<=0)ok=false;
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
}

Measured memory_bytes: 1024