akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#define maxn 100005
#define maxbits 45 // log2(1e12) < 40 < 45
using namespace std;

typedef long long LL;

LL a[maxn], k;
int cnt[maxbits][2], n;

template<typename T>
inline int countbit(T x)
{
	int cnt = 1;
	while(x >>= 1) cnt ++;
	return cnt;
}

int main(int argc, char** argv)
{
	// Input
	scanf("%d%lld", &n, &k);
	int maxc = -1;
	for(int i=0; i<n; i++)
	{
		scanf("%lld", a + i);
		int c = 0;
		while(true)
		{
			LL t = 1LL << c;
			if(a[i] < t) break;
			cnt[c++][int(bool(a[i] & t))] ++; // Add to bit count
		}
		if(c > maxc) maxc = c;
		do
		{
			cnt[c][0] ++;
		} while(++c < maxbits);
	}
	// Calculate x
	LL x = 0, ans = 0;
	for(int i=maxc-1; i>=0; i--)
	{
		x <<= 1LL;
		if(cnt[i][1] < cnt[i][0]) x ++;
	}
	if(x < k)
		if(maxc < countbit(k))
			x = k - k % (1LL << maxc) + x;
	if(x > k)
		if((x %= (1LL << countbit(k))) > k)
			for(int i=countbit(x)-1; i>=0; i--)
			{
				LL temp = 1LL << i;
				bool kbit = k & temp, xbit = x & temp;
				if(xbit == kbit) continue;
				if(kbit) break;
				x -= temp;
			}
	// Calculate & Print result
	for(int i=0; i<n; i++) ans += a[i] ^ x;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 896
import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  s <- lines <$> getContents
  putChar $ game s 'a'

game ["",_,_] 'a' = 'A'
game [_,"",_] 'b' = 'B'
game [_,_,""] 'c' = 'C'
game [sa,sb,sc] turn
  |turn=='a' = game [(tail sa),sb,sc] (head sa)
  |turn=='b' = game [sa,(tail sb),sc] (head sb)
  |turn=='c' = game [sa,sb,(tail sc)] (head sc)

Measured memory_bytes: 3688
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

pq = sorted(P[:X] + Q[:Y])
cnt = 0
for i in range(min(C, X+Y)):
    if R[i] <= pq[i]: 
        break
    cnt += 1

ans = sum(pq[cnt:]) + sum(R[:cnt])

print(ans)


Measured memory_bytes: 29336
K,T=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A,reverse=True) #大きい順
ans=A[0]-1 #被る日
for i in range(1,T): 
    ans-=A[i]
    if ans<0:
        ans=0
        break
print(ans)

Measured memory_bytes: 38384
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	line1 := make([]int, n)
	line2 := make([]int, n)
	for i := 1; i <= n; i++ {
		if i != n {
			fmt.Scanf("%d", &line1[i-1])
		} else {
			fmt.Scanf("%d\n", &line1[i-1])
		}
	}

	for i := 1; i <= n; i++ {
		if i != n {
			fmt.Scanf("%d", &line2[i-1])
		} else {
			fmt.Scanf("%d\n", &line2[i-1])
		}
	}

	ans := 0
	for i := 0; i < n; i++ {
		total := 0
		for j := 0; j < n; j++ {
			if j <= i {
				total += line1[j]
			}
			if j >= i {
				total += line2[j]
			}
		}
		if ans <= total {
			ans = total
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1848
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int a=sc.nextInt(),b=sc.nextInt(),c=a+b;
    if(a*b*c%3==0){
      System.out.println("Possible");
    }else{
      System.out.println("Impossible");
    }
  }
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int H,N;
int A[1010],B[1010];
int dp[100010];

signed main(){
	cin>>H>>N;
	REP(i,N){
		cin>>A[i]>>B[i];
	}
	REP(i,100010){
		dp[i]=INF;
	}
	dp[0]=0;
	REP(i,N){
		for(int j=0;j<=H;j++){
			if(dp[j]!=INF){
				dp[j+A[i]]=min(dp[j+A[i]],dp[j]+B[i]);
			}
		}
	}
	DEB(dp[10])END
	int ans=INF;
	for(int i=H;i<100010;i++){
		ans=min(ans,dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int n,a[101],dp[100001][3];
int solve(int i,int j){
	if (dp[i][j]!=-1)return dp[i][j];
    int res=0;
	for(int k=0;k<n;k++){
		if (a[k]<=i){
			if (!solve(i-a[k],j^1)){
				res=1;
				break;
			}
		}
	}
	return dp[i][j]=res;
}

int main(){
	int k;
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
    memset(dp,-1,sizeof(dp));
	cout <<(solve(k,0)?"First":"Second")<<std::endl;
	return 0;
}


Measured memory_bytes: 6144
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  cout<<a[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()
s1=s[:n]
s2=s[n:][::-1]
dic1={}
dic2={}
for i in range(2**n):
  r1=''
  r2=''
  b1=''
  b2=''
  flag=format(i,'b')
  l=len(flag)
  if l!=n:
    flag='0'*(n-l)+flag
  for j in range(n):
    if flag[j]=='0':
      r1+=s1[j]
      r2+=s2[j]
    else:
      b1+=s1[j]
      b2+=s2[j]
  if (r1,b1) not in dic1:
    dic1[(r1,b1)]=1
  else:
    dic1[(r1,b1)]+=1
  if (r2,b2) not in dic2:
    dic2[(r2,b2)]=1
  else:
    dic2[(r2,b2)]+=1
ans=0
for i in dic1.keys():
  if i in dic2:
    ans+=dic1[i]*dic2[i]
print(ans)

Measured memory_bytes: 125760
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
#define LIMIT1 200010
#define INF (1<<29)
#define LLINF (1LL<<60)
typedef long long ll;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
const ll MAX_E = LIMIT1;
const ll MAX_V = LIMIT1;

struct edge { ll from,to,cost; };
edge es[MAX_E];

ll d[MAX_V];
int V,E;

bool negative[LIMIT1];

void shortest_path(int s){
    for(int i=0;i<V;i++){
        d[i]=LLINF;
        negative[i]=false;
    }
    d[s] = 0;
    for(int loop=0;loop<V-1;loop++){
        for(int i=0;i<E;i++){
            edge e=es[i];
            if(d[e.from] != LLINF && d[e.to] > d[e.from]+e.cost){
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }
}
bool find_negative_loop(){
  for(int i=0;i<V;i++) negative[i]=false;
  for(int loop=0;loop<V;loop++){
    for(int i=0;i<E;i++){
      if(d[es[i].from] == LLINF) continue;
      
      if(d[es[i].to] > d[es[i].from] + es[i].cost){
        d[es[i].to] = d[es[i].from] + es[i].cost;
        negative[es[i].to] = true;
      }
      if(negative[es[i].from]==true){
        negative[es[i].to] = true;
      }
    }
  }
  return negative[V-1];
}

int main(){
    int i,j;
    ll result=0;
    cin >> V >> E;
    rep(i,E){
        cin >> es[i].from >> es[i].to >> es[i].cost;
        es[i].from--;
        es[i].to--;
        es[i].cost *= -1;
    }
    shortest_path(0);
    result = -d[V-1];
    if(find_negative_loop()){
      cout << "inf" << endl;
      return 0;
    }
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  cout << N + N*N + N*N*N << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main() {
  long long n; cin >> n; long long m=1e9, minus=0,zero=0,sum=0;
  for (int i=0; i<n; i++) {
    long long a; cin >> a;
    sum+=abs(a);
    if (a!=0) m=min(m,abs(a));
    else zero++;
    if (a<0) minus++;
  }
  if (minus % 2 == 0) cout << sum << endl;
  else {
    if (zero>=1) cout << sum << endl;
    else cout << sum - 2*m << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
long long cnt;
using namespace std;
int l;
int A[10000000];
vector<int> G;
void insertionSort(int *A, int n, int g)
{
    for (int i = g; i < n; i++)
    {
        int v = A[i];
        int j = i - g;
        while (j >= 0 && A[j] > v)
        {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
}

void shellSort(int *A, int n)
{
    for (int h = 1;;)
    {
        if (h > n)
            break;
        G.push_back(h);
        h = 3 * h + 1;
    }
    for (int i = G.size() - 1; i >= 0; i--)
        insertionSort(A, n, G[i]);
}

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

    for (int i = 0; i < n; i++)
        cin >> A[i];
    cnt = 0;
    shellSort(A, n);

    cout << G.size() << endl;
    for (int i = G.size() - 1; i >= 0; i--)
    {
        cout << G[i];
        if (i)
            cout << " ";
    }
    cout << endl;
    cout << cnt << endl;

    for (int i = 0; i < n; i++)
        cout << A[i] << endl;

    return 0;
}


Measured memory_bytes: 7076
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Text.RegularExpressions;
    using System.Text;
    using System.Net;

     
    public class Program
    {

        public void Proc() {
            int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).OrderBy(a=>a).ToArray();
            Console.WriteLine(inpt.Take(2).Sum());
            


        }




        public class Reader {
            public static bool IsDebug = false;
            private static System.IO.StringReader SReader;
            private static string InitText = @"







700 600 780






";
            public static string ReadLine() {
                if(IsDebug) {
                    if(SReader == null) {
                        SReader = new System.IO.StringReader(InitText.Trim());
                    }
                    return SReader.ReadLine();
                } else {
                    return Console.ReadLine();
                }
            }
        }
        public static void Main(string[] args)
        {
            #if DEBUG
            Reader.IsDebug = true;
            #endif
            Program prg = new Program();
            prg.Proc();
        }
    }

Measured memory_bytes: 13396
n=int(input())
t=[0 for i in range(n)]
x=[0 for i in range(n)]
y=[0 for i in range(n)]
for i in range(n):
    t[i],x[i],y[i]=list(map(int,input().split(" ")))
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(n):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i+1]-t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i+1]%2:
        print("No")
        exit(0)
print("Yes")

Measured memory_bytes: 11824
#include <iostream>

using namespace std;

int main()
{
    int n,x=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    for(int i=0;i<n;i++){
        if(i%2==0 && arr[i]%2==1)
            x+=1;
    }
    cout<<x;
    return 0;
}


Measured memory_bytes: 3636
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var strs = str.Split('/');

            var mm = int.Parse(strs[1]);
            var dd = int.Parse(strs[2]);

            if (mm < 4)
            {
                Console.WriteLine("Heisei");
                return;
            }

            if (mm >= 5)
            {
                Console.WriteLine("TBD");
                return;
            }

            if (mm == 4 && dd <= 30)
            {
                Console.WriteLine("Heisei");
                return;
            }

            Console.WriteLine("TBD");
        }
    }
}


Measured memory_bytes: 13140
N=int(input())
A=list(map(int, input().split())) 
k =  len(bin(max(A))[2:])
A = [bin(i)[2:].zfill(k) for i in A]
mod = 10**9+7
ans = 0
for i in range(k):
  cnt = sum([1 for j in A if j[i]=='1'])
  ans += cnt*(N-cnt)*(2**(k-i-1))
  ans %= mod 
print(ans)

Measured memory_bytes: 180280
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0; i < n; i++)
using namespace std;

int n;
int a, b;
int cnt[3];

signed main() {
	int i;
	
	cin >> n >> a >> b;
	rep(i, n) {
		int p; cin >> p;
		if (p <= a) cnt[0]++;
		else if (p <= b) cnt[1]++;
		else cnt[2]++;
	}
	cout << min({cnt[0], cnt[1], cnt[2]}) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  vector<int> s(n);
  for(auto &i:s) cin >> i;
  int q;cin >> q;
  int ans = 0;
  for(int i=0;i<q;i++){
    int data;cin >> data;
    for(auto &i:s){
      if(i==data){
          ans++;
          break;
      }
    }
  }
  cout << ans << endl;
}



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

int main(){
    vector<int> a(3);
    for(int i = 0; i < 3; i++){
        cin >> a[i];
    }
    if(a[0] == a[1] && a[1] == a[2]){
        cout << 0 << endl;
        return 0;
    }
    sort(a.begin(), a.end(), greater<int>());
    int ans = 0;
    for(int i = 0; i < 2; i++){
        ans += a[i] - a[i+1];
    }
    cout << ans << endl;
    return 0;
}


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


int main(void){
	int n;
	cin >> n;
	int ans;
	if(n<=3 ||n==5|| n == 7 || n == 11){
		ans = 1;
		for(int i = 0; i < n-1; i++){
			ans *= 2;
		}
	}else if(n==4){
		ans = 2*3;
	}else if(n==6){
		ans = 2*2*3;
	}else if(n==8){
		ans = 2*2*2*3;
	}else if(n==9){
		ans = 2*2*3*3;
	}else if(n==10){
		ans = 2*2*2*2*3;
	}else{
		ans = 2*2*3*5;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e2+5;

struct Point{
        int x,y;
}p[MAXN];

bool cmp(Point a,Point b) {
        return atan2(a.y,a.x) < atan2(b.y, b.x);
}

int nx[MAXN];//让它循环
int main() {
        int n;
        cin>>n;
        for(int i=1;i<=n;++i)   cin>>p[i].x>>p[i].y;
        for(int i=1;i<=n;++i)    nx[i] = i+1; nx[n] = 1;
        sort(p+1,p+n+1,cmp);
        ll  ans=0;
        for(int i=1;i<=n;++i) {
                ll x = p[i].x, y = p[i].y;
                ans = max(ans, x * x + y * y);
                for(int j=nx[i];j!=i;j = nx[j]) {
                        x += p[j].x;
                        y += p[j].y;
                        ans = max(ans, x * x + y * y);
                }
        }
        printf("%.10lf\n",sqrt(ans));
        return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main() {
	int R[MAX], n;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> R[i];
	int maxv = -2000000000;
	int minv = R[0];
	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}
	cout << maxv << endl;
	return 0;
}


Measured memory_bytes: 3876
#include<bits/stdc++.h>
#include<unordered_map>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define mk make_pair
#define loop(i,intial,n)  for(int i=int(intial);i<n;i++)
#define loopn(j,n) for(int j=int(n);j>=0;j--)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const ll oo = (ll) 10e9+7;
const double EPS = 1e-4;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");

int main()
{
   afify();
   int n,m;
   cin>>n>>m;
   vector<string> v(n);
   loop(i,0,n) cin>>v[i];
   loop(i,0,m+2) cout<<'#';
   cout<<endl;
   loop(i,0,n){
	   cout<<'#'<<v[i]<<'#'<<endl;
   }
    loop(i,0,m+2) cout<<'#';
	 cout<<endl;

	return 0; 
}

Measured memory_bytes: 256
//Maximum Heap
//2019-01-15
//Ebitani Akira

#include <stdio.h>
#include <stdlib.h>

#define N 500001
void MaxHeapify(int);
void BuildMaxHeap();

int n;
int array[N];

int main(){
  int i;

  scanf("%d", &n);
  if(n < 1 || n > 500000){
    printf("ヒープサイズが適当ではありません。\n");
    exit(1);
  }

  for(i = 1 ; i <= n ; i++){
    scanf("%d", &array[i]);
    //printf("%d\n", array[i]);
  }

  BuildMaxHeap();

  for(i = 1 ; i <= n ; i++){
    printf(" %d", array[i]);
  }

  printf("\n");

  return 0;
}

void BuildMaxHeap(){
  int i;
  for(i = n/2 ; i >= 1 ; i--){
    MaxHeapify(i);
  }
}

void MaxHeapify(int x){
  int left, right;
  int largest;

  left = 2 * x;
  right = 2 * x + 1;

  if(left <= n && array[left] > array[x]){
    largest = left;
  }
  else{
    largest = x;
  }

  if(right <= n && array[right] > array[largest]){
    largest = right;
  }

  int temp;
  if(largest != x){
    temp = array[x];
    array[x] = array[largest];
    array[largest] = temp;
    MaxHeapify(largest);
  }

}



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

int main(){
    int N,M,C;
    vector<int> B;
    int ans = 0;
    cin >> N >> M >> C;
    for(int i = 0; i < M ; i++){
        int tmp;
        cin >> tmp;
        B.push_back(tmp);
    }
    for(int i = 0; i < N ; i++){
        int sum = 0;
        for (int j = 0 ; j < M ; j++){
            int tmp;
            cin >> tmp;
            sum += tmp * B[j];
        }
        if(sum + C > 0){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;

int main() {
  int N,T, A; cin >> N >> T >> A;
  int H[N+1];
  double ans =  100000000;
  int tmp;
  for ( int i = 1; i <= N; i++ ) {
    cin >> H[i];
    ans = min(ans,abs(A-(T - H[i] * 0.006)));
  }

  for ( int i = 1; i <= N; i++ ) {
    if ( ans == abs( A-(T - H[i] * 0.006)) )
      tmp = i;
  }
  
  cout << tmp << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
	int N,M; cin >> N >> M;
	vector<int> A(N-1);
	rep(i,M) {
		int a,b; cin >> a >> b;
		a--; b--;
		if (a > b) swap(a,b);
		A[a]++; A[b]--;
	}
	rep(i,N-1) {
		if (i == 0) continue;
		A[i] += A[i-1];
	}
	bool flag = true;
	rep(i,N-1) {
		if (A[i] % 2 == 1) flag = false;
	}

	cout << (flag ? "YES" : "NO") << endl;
}

Measured memory_bytes: 640
import collections
N = int(input())
X = list(map(int,input().split()))
clst = collections.Counter(X)
clst = clst.most_common()
cnt = 0
for i in range(len(clst)):
	if clst[i][0] > clst[i][1]:
		cnt += clst[i][1]
	else:
		cnt += clst[i][1]-clst[i][0]

print(cnt)

Measured memory_bytes: 21232
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		int[] B = A.clone();
		Arrays.sort(B);
		for(int i = 0; i < N; i++) {
			if (A[i] == B[N-1]) {
				System.out.println(B[N-2]);
			} else {
				System.out.println(B[N-1]);
			}
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 68504
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
 //各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()
//文字→数字　'0' アルファベット→数字　'a'　'A'が65番,'a'が97番だわ
//型キャスト　char('a'+1)
//reverse 回文
//if(isupper('A'))->大なら真


//グローバル変数宣言
ll p=0,q=0,r=0;

int main()
{
  ll h,w;
  cin>>h>>w;
  vvc c(h,vc(w));

  rep(i,h)
  {
    rep(j,w)
    {
      cin>>c[i][j];
    }
  }

  rep(i,2*h)
  {
    rep(j,w)
    {
      cout<<c[(i+2)/2-1][j];
      if(j==w-1)cout<<endl;
    }
  }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  //ll n = 80;
  //vector<ll> a(n);
  //rep(i, n) a[i] = (i & 1 ? 200 : 100);

  a.push_back(0);
  ll ans = 1000, idx = 0;
  while (idx < n) {
    ll mi = a[idx], mx = a[idx];
    while (idx < n && a[idx] <= a[idx + 1]) mx = a[++idx];
    ans = ans / mi * mx + ans % mi;
    idx++;
  }
  cout << ans << '\n';






  
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

stack<pair<int,int> > deal(string s){
    char ch;
    stack<int> S1;
    stack<pair<int,int> > S2;
    int sum=0;
    for(int i=0;i<s.length();i++){
        ch=s[i];
        if(ch=='\\'){
            S1.push(i);
        }else if(ch=='/'&&S1.size()>0){
            int j=S1.top();
            S1.pop();
            sum+=i-j;
            int a=i-j;
            while(S2.size()>0&&S2.top().first>j){
                a+=S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }
    cout<<sum<<endl;
    return S2;
}

int main(){
    string s;
    vector<int> ans;
    cin>>s;
    stack<pair<int,int> > temp=deal(s);
    while(!temp.empty()){
        ans.push_back(temp.top().second);
        temp.pop();
    }
    reverse(ans.begin(),ans.end());
    cout<<ans.size();
    for(int i=0;i<ans.size();i++){
        cout<<' '<<ans[i];
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3192
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. ABA.
000021 DATA DIVISION.
000022 WORKING-STORAGE SECTION.
000023 01 S PIC X(05).
000024 01 S1 PIC X(02).
000025 01 S2 PIC X(02).
000028 01 A PIC 9(02).
000029 01 B PIC 9(02).
000030 01 C PIC 9(02).
000040 PROCEDURE DIVISION.
000050 MAIN SECTION.
000100     ACCEPT S FROM SYSIN.
000101     UNSTRING S DELIMITED BY SPACE INTO S1, S2.
000102     MOVE S1 TO A.
000103     MOVE S2 TO B.
000104     IF FUNCTION MOD(B,A) = ZERO THEN
000105         COMPUTE C = A + B
000106     ELSE
000107         COMPUTE C = B - A
000108     END-IF.
000110     DISPLAY C(2 - FUNCTION INTEGER(FUNCTION LOG10(C)):)
           UPON SYSOUT.
000200 	   STOP RUN.

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main() {
    int a,b,c;
    cin >>a>>b>>c;
    if(a+b+c>=22){
      cout << "bust" << endl;
    }
    else{
    cout << "win" << endl;
  }

}


Measured memory_bytes: 256
import java.util.*;
import java.text.*;
/*
Main class for AOJ where there is no input.
*/
public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String str;
      String[] arr;
      int midterm;
      int finalexam;
      int retake;
      int sum;
      char grade;
      
      while(true){
         str = sc.nextLine();
         arr = str.split(" ");
         
         midterm = Integer.parseInt(arr[0]);
         finalexam = Integer.parseInt(arr[1]);
         retake = Integer.parseInt(arr[2]);
         
         sum = midterm + finalexam;
         
         if(midterm == -1 && finalexam == -1 && retake == -1){
            break;
         }
         
         if(midterm == -1 || finalexam == -1){
            grade = 'F';
         }else if(sum >= 80){
            grade = 'A';
         }else if(sum >= 65){
            grade = 'B';
         }else if(sum >= 50){
            grade = 'C';
         }else if(sum >= 30){
            if(retake >= 50){
               grade = 'C';
            }else{
               grade = 'D';
            }
         }else{
            grade = 'F';
         }
         System.out.println(grade);
      }  
      
   }//main
}//class

Measured memory_bytes: 26272
from fractions import gcd

A, B, C, D = map(int, input().split())
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print(y - x)

Measured memory_bytes: 5176
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std ;

int N , Fstate , a[262144] ;
struct Data{
	int m1 , m2 ;
	void update( int x ){
		if( a[x] > a[m1] ) m2 = m1 , m1 = x ;
		else if( x != m1 && a[x] > a[m2] ) m2 = x ;
	}
} d[262144] ;

void solve(){
	for( int i = 1 ; i <= Fstate ; i ++ )
		for( int j = 1 ; j <= Fstate ; j <<= 1 )
			if( i & j ) d[i].update( d[i^j].m1 ) , d[i].update( d[i^j].m2 ) ;
	int ans = 0 ;
	for( int i = 1 ; i <= Fstate ; i ++ ){
		ans = max( ans , a[ d[i].m1 ] + a[ d[i].m2 ] ) ;
		printf( "%d\n" , ans ) ;
	}
}

int main(){
	scanf( "%d" , &N ) , Fstate = ( 1 << N ) - 1 ;
	for( int i = 0 ; i <= Fstate ; i ++ )
		scanf( "%d" , &a[i] ) , d[i].m1 = i ;
	solve() ;
}


Measured memory_bytes: 6016
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int h = n / 3600 ;
	int m = (n - h * 3600) / 60 ;
	int s = n % 60 ;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

ll f0(ll x){
	if(x < 0) return 0;
	ll ret = 0;
	for(int i=0;i<60;i++){
		
		ll b = (ll)1 << i;
		ll cnt = (x / (b * 2)) * b;
		if((x % (b * 2)) > 0) cnt += max((ll)0, (x % (b * 2)) - b + 1);
		
		if(cnt % 2 == 1){
			ret |= ((ll)1 << i);
		}
//cerr << cnt << endl;
	}
	
	return ret;
}



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

//cerr << f0(B) << " " << f0(A - 1) << endl;	
	
	cout << (f0(B) ^ f0(A - 1)) << endl;
	
	
	
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=1000000007;

int a[200020];

int Count[2019];
string s;

int pow(int n)
{
	if(n==0)return 1;
	
	int x=pow(n/2);
	if(n%2==0)return (x*x)%2019;
	else return (10*x*x)%2019;

}
int main(){

	LL ans=0;
	for(int i=0;i<2019;i++)Count[i]=0;
	
        cin>>s;
	int num=s.size();
	for(int i=num-1;i>=0;i--)
	{
		int po=((int)s[i])-48;
		if(i==num-1)a[i]=po;
		else a[i]=(a[i+1]+pow(num-1-i)*po)%2019;
		
		Count[a[i]]++;
	}
	Count[0]++;
	for(int i=0;i<2019;i++)
	{
		ans+=Count[i]*(Count[i]-1)/2;	
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4516
n, q = gets.split( " " ).map { |val| val.to_i }
ps = []
t = []
n.times { |i|
	ps[i], t[i] = gets.split( " " )
}

output = []
qsum = 0
while !t.empty?
	psi = ps.shift
	ti = t.shift.to_i
	if ti <= q
		qsum += ti	
		output.push( psi+" "+qsum.to_s )
	else
		t.push( ti - q )
		ps.push( psi )
		qsum += q
	end
end

puts( output.join( "\n" ) )

Measured memory_bytes: 14348
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main(N):
    ans = 0

    for n in range(1,N+1):
        ans += (N // n) * n * (1 + (N // n)) // 2

    print(ans)


if __name__ == "__main__":
    N = int(readline())
    main(N)


Measured memory_bytes: 63072
n = gets.chomp.to_i
h = Hash.new
count = 0

n.times do
	s = gets.chomp.to_s.split(//).sort.join
	if h.key?(s)
		h[s] += 1
		count += h[s]
	else
		h[s] = 0
	end
end

puts count


Measured memory_bytes: 17276
#!/bin/python3

import os
import sys
from collections import *
from queue import *
import math
def main():
	a,b,c = list(map(int,input().split()))
	k = int(input())

	for i in range(k):
		if a>= b:
			b *= 2
		else:
			c *= 2
	if a<b and b<c:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	#sys.stdin = open("input","r")
	#sys.stdout = open("output","w")
	main()




Measured memory_bytes: 9672
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll>vec(N);
  for(ll i=0;i<N;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  ll a=0;
  if(N>K){
    for(ll i=K;i<N;i++){
      a+=vec.at(i);
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

void print_vector2(vector<vector<ll> >v){
    for(ll i=0;i<v.size();i++){
        for(ll j=0;j< v[i].size();j++){
            cout<<v[i][j]<<" ";
        }cout<<"\n";
    }
}

void print_vector1(vector<ll> v){
    for(ll i=0; i<v.size();i++){
        cout<<v[i]<<" ";
    }cout<<"\n";
}

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

int main(){
    ll n, k;
    cin>>n>>k;
    vector<ll> v(n, 1);
    for(ll i=0; i<k; i++){
        ll d;
        cin>>d;
        for(ll j=0; j<d; j++){
            ll temp;
            cin>>temp;
            v[temp-1] = 0;
        }
    }
    cout<<accumulate(v.begin(), v.end(), 0);
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>

#define ll long long

using namespace std;

ll a, b, res = 0;

int main()
{
	cin >> a >> b;
	if ((a + b) % 2 != 0) cout << "IMPOSSIBLE";
	else
	{
		res = (a + b) / 2;
		cout << res;
	}

	return 0;
}

Measured memory_bytes: 256
#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 <queue>
#include <bitset>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
	int res = a % MOD;
	if(res < 0) {
		return res + MOD;
	}
	return res;
}
int mul_mod(int a, int b)
{
	ll res = ((ll)a * (ll)b) % MOD;
	return mod((int)res);
}
int pow_mod(int a, int b)
{
	ll res = 1;
	while (b > 0) {
		if(b & 1) {
			res = res * (ll)a % (ll)MOD;
		}
		a = mul_mod(a, a);
		b >>= 1;
	}
	return (int)res;
}
int inv_mod(int a)
{
	return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
	return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 1000001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < FAC_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;
	}
}
ll com_mod(int a, int b){
	if (a < b) return 0;
	if (a < 0 || b < 0) return 0;
	return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

int main(void)
{
	com_init();
	int x, y;
	cin >> x >> y;
	if ((2 * y - x) % 3 != 0 || (2 * x - y) % 3 != 0
	 || (2 * y - x) < 0 || (2 * x - y) < 0) {
		 cout << 0 << endl;
	} else {
		int a = (2 * x - y) / 3, b = (2 * y - x) / 3;
		cout << com_mod(a + b, a) << endl;
	}
	return 0;
}

Measured memory_bytes: 23680
N,A,B,C,D = map(int,input().split())
S = input()
if C == D:
    print("No")
    exit()
dot = 0
rock = 0
bol = 0
for i in range(1,N+1):
    if S[i-1] == ".":
        dot += 1
        rock = 0
        if dot >= 3 and B < i <= D + 1:
            bol = 1
    else:
        rock += 1
        dot = 0
        if rock >= 2 and A < i < max(C,D):
            print("No")
            exit()
if C < D:
    print("Yes")
    exit()
print("Yes" if bol == 1 else "No")

Measured memory_bytes: 9480
package main

import (
	"bufio"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	K, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	Q, _ := strconv.Atoi(sc.Text())

	A := make([]int, Q)
	for i := 0; i < Q; i++ {
		sc.Scan()
		A[i], _ = strconv.Atoi(sc.Text())
	}

	points := make([]int, N)
	for i := 0; i < N; i++ {
		points[i] = K - Q
	}

	for _, person := range A {
		points[person-1]++
	}

	writer := bufio.NewWriter(os.Stdout)
	for _, point := range points {
		if point > 0 {
			writer.WriteString("Yes\n")
		} else {
			writer.WriteString("No\n")
		}
	}
	writer.Flush()
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int a[100010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=1;i<=n;++i)a[i]=gi();
	ll ans=0;
	for(int i=1;i<=n;++i){
		ans+=a[i]>>1;a[i]&=1;
		if(a[i]&&a[i+1])--a[i],--a[i+1],++ans;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 640
# coding: utf-8
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces


def permutation(ret: list, leftovers: list) -> list:
    if len(leftovers) == 0:
        yield ret
    
    for left in leftovers:
        leftoverscopy = [i for i in leftovers]
        leftoverscopy.remove(left)
        yield from permutation(ret+[left], leftoverscopy)


def canAssign(xs, ys):
    for i in range(7):
        for j in range(i+1,8):
            if abs(xs[i]-xs[j]) == abs(ys[i]-ys[j]):
                return False
    return True


def displayChessboard(xs, ys):
    board = [['.']*8 for i in range(8)]
    for i in range(8):
        board[ys[i]][xs[i]] = 'Q'
    for i in range(8):
        for j in range(8):
            print(board[i][j], end='')
        print()
    return


def main():
    k = ni()
    queens = [na() for _ in range(k)]
    xqueens = []
    yqueens = []
    xs = [x for x in range(8)]
    ys = [y for y in range(8)]
    for queen in queens:
        xs.remove(queen[1])
        ys.remove(queen[0])
        xqueens.append(queen[1])
        yqueens.append(queen[0])
    
    for yspernm in permutation([],ys):
        if canAssign(xqueens+xs, yqueens+yspernm):
            displayChessboard(xqueens+xs, yqueens+yspernm)
            return
    
    print("Can't make chessboard.")
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 5624
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz");
char s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> s;
  s++;
  Cout(s);
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 

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

        if(S.equals("a")||S.equals("i")||S.equals("u")||S.equals("e")||S.equals("o"))
            System.out.println("vowel");
        else
        System.out.println("consonant");
        
        
    }
    
}    





Measured memory_bytes: 21204
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    CIN(N);
    set<int> se;
    int f = 0;
    for(int a = 0;a < N;a++){
        CIN(w);
        if(w/400 < 8){
            se.insert(w/400);
        }else{
            f++;
        }
    }
    LL ans = se.size();
    LL hoge = se.size();
    if(ans == 0 && f)ans++;
    hoge += f;
    cout<<ans<<" "<<hoge<<endl;
    return 0;
}


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

using namespace std;

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

int main(){
    int i,j;
    int n;
    //入力
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    //処理
    long s=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            s=s+(d[i]*d[j]);
        }
    }
    //出力
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
typedef long long LL;
bool a[1005][1005],vis[1005][1005];
int dir[4][2]={1,0,-1,0,0,1,0,-1};
int n,m;
queue<pair< pair<int,int>,int> >able,temp;
bool bfs(int bx,int by,int ex,int ey,int cnt){
	//cout<<"start position: "<<bx<<"	"<<by<<endl;
	queue<pair<int,int> >q;
	q.push(make_pair(bx,by));
	vis[bx][by]=1;
	while(!q.empty()){
		pair<int,int>cur = q.front();
		for(int j=-2;j<=2;j++){
			for(int k=-2;k<=2;k++){
				int xxx=cur.first+j,yyy=cur.second+k;
				if(xxx>=1&&xxx<=n&&yyy>=1&&yyy<=m&&a[xxx][yyy]==1&&vis[xxx][yyy]==0)
						able.push(make_pair(make_pair(xxx,yyy),cnt+1) );
				}
		}
		q.pop();
		for(int i=0;i<4;i++){
			int xx=cur.first+dir[i][0],yy=cur.second+dir[i][1];
			if(xx>=1&&xx<=n&&yy>=1&&yy<=m&&a[xx][yy]==1&&vis[xx][yy]==0){
				q.push(make_pair(xx,yy));
				vis[xx][yy]=1;
				//cout<<"has reach: "<<xx<<" "<<yy<<endl;
			}
		}
	}
	//cout<<"bfs结束 输出跳跃可达位置"<<endl;
//	while(able.size()){
//		pair< pair<int,int>,int>x=able.front();
//	temp.push(x); able.pop();
//		cout<<x.first.first<<"	"<<x.first.second<<"	"<<x.second<<endl;
//	}
//	while(!temp.empty()){
//		able.push(temp.front());
//		temp.pop();
//	}
	return vis[ex][ey];
}
int main()
{
	cin>>n>>m;
	int bx,by,ex,ey; cin>>bx>>by>>ex>>ey;
	for(int i=1;i<=n;i++){
		string x; cin>>x;
		for(int j=0;j<m;j++){
			if(x[j]=='.')
				a[i][j+1]=1;
			else
				a[i][j+1]=0;
		}
	}
	int cnt=0;
	while(!bfs(bx,by,ex,ey,cnt)){
		pair<pair<int,int>,int>cur=able.front();
		while(able.size()&&vis[cur.first.first][cur.first.second]){
			able.pop();
			if(able.size())
				cur=able.front();
		}
		if(able.size()){
			cur=able.front();
			cnt=cur.second;
			bx=cur.first.first; by=cur.first.second;
		}
		else
			break;
	}
	if(vis[ex][ey]){
		cout<<cnt<<endl;
	}
	else{
		cout<<-1<<endl;
	}


    return 0;
}


Measured memory_bytes: 6100
#include <stdio.h>

void print(int a[], int N)
{
	for (int i = 0; i < N; i++)
	{
		printf("%d", a[i]);
		if (i != N - 1)
		{
			printf(" ");
		}
		
	}
	printf("\n");
}
int main()
{
	int a[100];
	int key;
	int N;
	scanf("%d", &N);

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


	print(a, N);


	int j;
	for (int i = 1; i < N; i++)
	{
		key = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > key)
		{
			a[j + 1] = a[j];
			j--;
			a[j + 1] = key;
		}
		print(a, N);
	}

	return 0;
}


Measured memory_bytes: 2000