akhauriyash/Code-Regression huggingface dataset:
/*
#include <iostream>
#include <queue>

using namespace std;

int main() {
	int n;
	int h;
	queue<int> cola;

	cin >> n; cin >> h;
	int *a = new int[n];
	int aux = 0;
	int k = n / h;
	int **matriz = new int*[k];
	for (int i = 0; i < k; i++) {
		matriz[i] = new int[h];
	}
	for (int i = 0; i<n; i++)
	{
		cin >> a[i];
	}
	if (n%h==0){
		
		for (int i=0;i<n;i++)
		{
			for (int j=i+1;j<n;j++)
			{
				if(a[i]>a[j])
				{
					aux = a[i];
					a[i] = a[j];
					a[j] = aux;
				}
			}
			cola.push(a[i]);
		}
		int p = 0;
		for (int i = 0; i < n; i++)
		{
			int cont = 1;
			for (int j = i + 1; j < n; j++)
			{
				if (a[i] == a[j])
					{
						cont += 1;
						if (cont > k)
						{
							cout << "impossible" << endl;
							system("pause");
							return 0;
						}
					}
				else { break; }
			}
							
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < k; j++) {
				matriz[j][i] = cola.front();
				cola.pop();
			}
		}
		for (int i = 0; i < k; i++) {
			for (int j = 0; j < h; j++) {
				cout << matriz[i][j] <<" ";
			}
			cout << endl;
		}
		
	}
	else 
	{
		cout << "impossible" << endl;
		system("pause");
		return 0;
	}


	system("pause");
	return 0;
}*/

	#include <cmath>
	#include <cstdio>
	#include <vector>
	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <stack>
	#include <map>
	using namespace std;


	int main() {
		int N;
		int T;
		cin >> N;
		cin >> T;
		vector<int>primero;
		vector<int>segundo;

		for (int i = 0; i < N; i++) {
			int costo, tiempo;
			cin >> costo; cin >> tiempo;
			primero.push_back(costo);
			segundo.push_back(tiempo);
		}
		vector<int>elegido1;
		vector<int>elegido2;
		for (int i = 0; i < N; i++) {
			if (segundo[i] <= T) {
				elegido1.push_back(primero[i]);
				elegido2.push_back(segundo[i]);
			}
		}
		if (elegido1.empty()) {
			cout << "TLE" << endl;
			
			return 0;
		}
		int min = std::min_element(elegido1.begin(), elegido1.end()) - elegido1.begin();
		cout << elegido1[min];
		
		return 0;
	}


Measured memory_bytes: 256
nn = gets.to_i
hh = gets.split.map(&:to_i)

max = 0
cnt = 0
prev = hh[0]
1.upto(nn-1) do |n|
  if prev >= hh[n]
    cnt += 1
  else
    if max < cnt
      max = cnt
    end
    cnt = 0
  end
  #puts cnt#d
  prev = hh[n]
end
if max < cnt
  max = cnt
end
puts max

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

int main() {
    string s;
    cin >> s;
    int n=s.size();
    bool flag;
    if (s[0]!=s[n-1]) {
        if (n%2==1) flag=true;
        else flag=false;
    } else {
        if (n%2==1) flag=false;
        else flag=true;
    }
    if (flag) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
	int M; cin >> M;
	ll dsum = 0;
	ll vsum = 0;
	for (int i = 0; i < M; i++) {
		ll c, d; cin >> d >> c;
		dsum += c;
		vsum += c * d;
	}
	ll ans = dsum - 1;
	ans += (vsum - 1) / 9;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int H,A,N,i;
	int sum = 0;
	scanf("%d%d",&H,&N);
	for(i=0;i<N;i++){
		scanf("%d",&A);
		sum = sum + A;
	}
	if(H<=sum) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
program atcoder_alloy
  implicit none
  integer :: n, h, w, a, b, m, i
  read(*,*) n, h, w
  m = 0
  do i = 1, n
    read(*,*) a, b
    if (a.ge.h.and.b.ge.w) m = m + 1
  end do
  write(*,'(i0)') m
  stop
end program atcoder_alloy

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int Q;
	priority_queue<int> lpq;
	priority_queue<int, vector<int>, greater<int>> rpq;
	int sl = 0, sr = 0;
	int m = INF;
	int B = 0;
	int q, a, b;

	cin >> Q;
	rep(i, 0, Q)
	{
		cin >> q;
		if (q == 1)
		{
			cin >> a >> b;
			B += b;
			if (m == INF)
			{
				m = a;
			}
			else
			{
				if (a <= m)
				{
					lpq.push(a);
					sl += m - a;
				}
				else
				{
					rpq.push(a);
					sr += a - m;
				}

				if (SZ(lpq) > SZ(rpq))
				{
					int t = lpq.top();
					rpq.push(m);
					sr += (m - t)*SZ(rpq);
					sl -= (m - t)*SZ(lpq);
					m = t;
					lpq.pop();
				}
				if (SZ(lpq)+1 < SZ(rpq))
				{
					int t = rpq.top();
					lpq.push(m);
					sl += (t - m)*SZ(lpq);
					sr -= (t - m)*SZ(rpq);
					m = t;
					rpq.pop();
				}

			}
		}
		else
		{
			cout << m << " " << sl + sr + B << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;



int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	string pre = "", cur = "";
	pre += s[0];
	int ans = 1;
	for (int i = 1; i < s.length(); ++i) {
		cur += s[i];
		if (cur != pre) {
			pre = cur;
			++ans;
			cur = "";
		} else {
			
		}
	}
	cout << ans << endl;
}	

Measured memory_bytes: 720
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<math.h>
#include<x86intrin.h>


int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

void InputIntAry(int *a,int nDigit,int N){      //nDigitは想定される最大桁数
    char *buf,*ptr;

    buf=(char*)malloc( (N*(nDigit+2)) * sizeof(char) );
    my_gets(buf,N*(nDigit+2),stdin);

    ptr=strtok(buf," ");
    while(ptr!=NULL && N-->0){
        *(a++)=atoi(ptr);
        ptr=strtok(NULL," ");
    }
    free(buf);
}

int CmpInt(const void *a, const void *b){        //b-aを返す(qsortなら4321)
    return *((int*)b)- *((int*)a);
}

typedef struct{
    int A,B;
} JobInfo_t;

int CmpJob(const void *p1, const void *p2){
    JobInfo_t Job1=*(JobInfo_t*)p1, Job2=*(JobInfo_t*)p2;

    if(Job1.A == Job2.A){
        return Job2.B - Job1.B;
    }
    else{
        return Job1.A - Job2.A;
    }
}

int CmpChar(const void *a, const void *b){        //b-aを返す(qsortなら4321)
    return (int)(*((char*)b)- *((char*)a));
}

int CmpStr(const void *a, const void *b){
    return strcmp((char*)a, (char*)b);
}

#define MAX_OF(a,b) (((a)>(b))?(a):(b))

int main(){
    int N;
    uint64_t cnt=0;
    char s[100000][20]={{}};

    scanf("%d%*c", &N);
    for(int i=0;i<N;i++){
        my_gets(s[i],20,stdin);
        qsort(s[i], 19,sizeof(char), CmpChar);
    }
    qsort(s, N, 20*sizeof(char), CmpStr);
    
    for(int i=0;i<N;i++){
        //printf("i:%d\n",i);
        for(int j=1; ; j++){
            if(strcmp(s[i],s[i+j])){
                i+=j-1;
                break;
            }
            else if(i+j<N){
                cnt+=j;
            }
            else{
                cnt+=j;
                i+=j-1;
            }
        }
    }
    printf("%llu\n",cnt);
    return 0;
}

/*int main(){
    int N,M;
    JobInfo_t Job[100000];

    scanf("%d %d%*c", &N, &M);
    for(int i=0;i<N;i++){
        scanf("%d %d%*c", &(Job[i].A), &(Job[i].B));
    }
    qsort(Job, N, sizeof(JobInfo_t), CmpJob);

    int allowed=0,max;
    for(int i=0;i<N;i++){
        
    }
    return 0;
} */

Measured memory_bytes: 4092
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e6+3)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int gcd(int A,int B) {if(!B)return A;return gcd(B,A%B);}
int main()
{
  ld a,b;
  cin>>a>>b;
  a*=b;
  ll z = a;
  cout<<z;
}

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

int main (){
    int x,y,z;
    cin >> x >> y >> z;
    for(int i=1;i<x;i++){
        if(i*(y+z)+z>x){
            cout << i-1 << endl;
            return 0;
        }
    }
    return 0;
}

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

int main(void)
{
	vector<int> point(5);
	for (int i = 0; i < 5; i++)cin >> point[i];
	int k;
	cin >> k;
	if (point[4] - point[0] <= k)cout << "Yay!" << endl;
	else cout << ":(" << endl;


	return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n,a,b = map(int, input().split())
h=[int(input()) for i in range(n)]

def solve(num):
    all_b = num*b
    cnt=0
    for i in range(len(h)):
        rest = h[i] - all_b
        if rest>0:
            cnt+=(rest - 1) // (a-b) + 1
    if cnt <= num:
        return True
    else:
        return False

import copy
l=0
r=10**10
while r-l>1:
    mid=(l+r)//2

    if solve(mid):
        r=mid
    else:
        l=mid
print(r)

Measured memory_bytes: 44124
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
 
const int N = int(2e5) + 2;
const int LG = 20;
const ll mod = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const ll linf = 1e18; 
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int n, q, ans[N];
vector < int > g[N];

void dfs (int v, int p = -1){
    for (int to : g[v]){
        if (to == p) continue;
        ans[to] += ans[v];
        dfs(to, v);
    }
}

int main (){
    scanf ("%d %d", &n, &q);
    for (int i = 1; i < n; ++i){
        int x, y;
        scanf ("%d %d", &x, &y);
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 1; i <= q; ++i){
        int p, x;
        scanf ("%d %d", &p, &x);
        ans[p] += x;
    }
    dfs(1);
    for (int i = 1; i <= n; ++i) printf ("%d ", ans[i]);
}

Measured memory_bytes: 23424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    string S;
    cin >> S;
    string keyence = "keyence";

    if(S.find(keyence) != -1){
        cout << "YES" << endl;
        return 0;
    }
    int i;
    for(i=0;i<7;i++){
        if(S[i] != keyence[i]){
            break;
        }
    }
    string substring, subkeyence;
    substring = S.substr(i);
    subkeyence = keyence.substr(i);
    //cout << substring << endl;
    //cout << subkeyence << endl;
    int l, l2;
    l = substring.length();
  	l2 = subkeyence.length();
    if(substring.find(subkeyence) != -1){
      	//cout << substring.find(subkeyence) << endl;
        if(substring.rfind(subkeyence) + l2 -1 == l-1)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }else{
        cout << "NO" << endl;
    }
        
   
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			int n = int.Parse(Console.ReadLine());
			var counts = new long[5];
			for (int i = 0; i < n; i++) {
				string s = Console.ReadLine();
				switch (s[0]) {
					case 'M':
						counts[0]++;
						break;
					case 'A':
						counts[1]++;
						break;
					case 'R':
						counts[2]++;
						break;
					case 'C':
						counts[3]++;
						break;
					case 'H':
						counts[4]++;
						break;
					default:
						break;
				}
			}

			long ans = 0;
			for (int i = 0; i < 5; i++) {
				for (int j = i + 1; j < 5; j++) {
					for (int k = j + 1; k < 5; k++) {
						ans += counts[i] * counts[j] * counts[k];
					}
				}
			}

			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 13140
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
ns=list(str(n))
if len(ns)==1:
    print(n)
    exit()
#print(ns[1:])
if int("".join(ns[1:])) == int("".join([str(9)]*(len(ns)-1))):
    print(int(ns[0])+9*(len(ns)-1))
else:
    print(int(ns[0])+9*(len(ns)-1)-1)


Measured memory_bytes: 63212
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define pb push_back
#define mod 1000000007
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int dx8[]={1,-1,0,0,1,1,-1,-1};
int dy8[]={0,0,1,-1,1,-1,1,-1};

ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

 // void dfs(ll node){
 // 	vis[node]=1;
 // 	res.pb(node);
 //    vector<ll> ans;


 // 	for(auto i:v[node]){
 // 		if(!vis[i]){
 // 			ans.pb(i);

 // 		}
 // 	}
 // 	sort(ans.begin(),ans.end());

 // 	for(auto i:ans){
 // 		if(!vis[i])
 // 			dfs(i);
 // 	}




 // }
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
bool sortbyme(const pair<int,int> &a, 
              const pair<int,int> &b){
	return (a.first+a.second > b.first+b.second);

}
void solve(){

ll n;
cin>>n;
vector<pair<ll,ll>> v;
vector<ll> x,y;

ll ans=INT_MIN;

for(ll i=0;i<n;i++){
	ll a,b;
	cin>>a>>b;

	v.pb({a,b});
	x.pb(a+b);
	y.pb(a-b);


}
sort(v.begin(),v.end());

sort(x.begin(),x.end());
sort(y.begin(),y.end());
 ans=max(x[n-1]-x[0],y[n-1]-y[0]);
 cout<<ans<<endl;

    





return;
}



int main()
{  
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
    fast;
    

    ll t;
    t=1;
    // cin>>t;
    while(t--){
    	solve();
    }
    
   
  



#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}

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



vector<bool> visited;


struct S{
	int panel;
	int zero;
	int step;
};

int main(){
	int f[8];
	int goal=1<<3|2<<6|3<<9|4<<12|5<<15|6<<18|7<<21;
	while(cin>>f[0]){
		visited.assign(1<<24,false);
		for(int i=1;i<8;i++)cin>>f[i];
		queue<S> q;
		S a,b;
		int ans=-1;
		a.panel=0;
		for(int i=0;i<8;i++){
			a.panel |= f[i]<<i*3;
			if(f[i]==0)a.zero=i;
		}
		if(a.panel==goal)ans=0;
		a.step=0;
		visited[a.panel].flip();
		q.push(a);
		while(ans==-1&&!q.empty()){
			a=q.front();
			q.pop();
			if(a.zero%4){
				b=a;
				b.step++;
				b.zero--;
				b.panel |= (a.panel>>b.zero*3&7) <<a.zero*3;
				b.panel &= ~(7<<b.zero*3);
				if(!visited[b.panel]){
					visited[b.panel].flip();
					q.push(b);
					if(b.panel==goal)ans=b.step;
				}
			}
			if(a.zero<4){
				b=a;
				b.step++;
				b.zero+=4;
				b.panel |= (a.panel>>b.zero*3&7) <<a.zero*3;
				b.panel &= ~(7<<b.zero*3);
				if(!visited[b.panel]){
					visited[b.panel].flip();
					q.push(b);
					if(b.panel==goal)ans=b.step;
				}
			}
			if(a.zero%4<3){
				b=a;
				b.step++;
				b.zero++;
				b.panel |= (a.panel>>b.zero*3&7) <<a.zero*3;
				b.panel &= ~(7<<b.zero*3);
				if(!visited[b.panel]){
					visited[b.panel].flip();
					q.push(b);
					if(b.panel==goal)ans=b.step;
				}
			}
			if(4<=a.zero){
				b=a;
				b.step++;
				b.zero-=4;
				b.panel |= (a.panel>>b.zero*3&7) <<a.zero*3;
				b.panel &= ~(7<<b.zero*3);
				if(!visited[b.panel]){
					visited[b.panel].flip();
					q.push(b);
					if(b.panel==goal)ans=b.step;
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3116
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong(), m = in.nextLong(), d = in.nextLong();
		System.out.printf("%.6f", ((n - d) * (d == 0 ? 1 : 2)) * (m - 1) / (double)(n * n));
	}
}


Measured memory_bytes: 23124
N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007

C = [3] + [0 for i in range(N)]

ans = 1
for a in A:
  ans *= C[a]
  ans %= MOD
  C[a] -= 1
  C[a+1] += 1
print(ans)

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

int main(){
int s,a;
int s1,s2,s3;

cin >> s;

s1 = (s / 100) % 10;
s2 = (s / 10) % 10;
s3 = (s / 1) % 10;

a = s1 + s2 + s3;

cout << a << endl;

}

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

vector<vector<int>> t;
int N;
int memo[20][1<<17];
int dfs(int now,int bit){
	if(__builtin_popcount(bit) == N)return 0;
	if(memo[now][bit] != -1)return memo[now][bit];
	int ret = 1e9;
	for(int i=0;i<N;i++){ // ?¬??????´???
		if(bit & (1<<i))continue; // ?¨??????????

		int cost = t[i][0];	// ?????????
		for(int j=0;j<N;j++)if(bit & (1<<j))cost = min(cost, t[i][j+1]);
		ret = min(ret, dfs( i, bit | (1<<i)) + cost);
	}
	return memo[now][bit] = ret;
}

int main(void){
	while(true){
		cin >> N;
		if(N == 0)break;
		t = vector<vector<int>>(N,vector<int>(N+1));
		memset(memo,-1,sizeof(memo));
		for(int i=0;i<N;i++){
			for(int j=0;j<N+1;j++){
				cin >> t[i][j];
			}
		}

		int ret = 1e9;
		for(int i=0;i<N;i++)
			ret = min(ret,dfs(i,1<<i) + t[i][0]);
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 13376
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)
//Map<String, Integer> map = new HashMap<String, Integer>(n);
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	static int Y,N;
	public static void main(String[] args) {

	long A=sc.nextLong();
	long B=sc.nextLong();
	long K=sc.nextLong();
	if(A>K) {
		A=A-K;
	}else if(A==K) {
		A=0;
	}else if(A<K) {
		K=K-A;
		A=0;
		if(B>=K) {
			B=B-K;
		}else if(B<K) {
			B=0;
		}
	}
	p(A+" "+B);
	}
}


Measured memory_bytes: 22612
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=922337206854775807ll;
//int & long long
string s;
long long n,dp[10005][105][2],ns;
inline long long f(char c)
{
	return int(c-'0');
}
int main(){
	cin>>s>>n;
	ns=f(s[0]);
	dp[0][ns%n][1]++;
	for(long long i=0;i<f(s[0]);i++)
		dp[0][i%n][0]++;
	for(long long i=1;i<s.size();i++)
	{
		ns+=f(s[i]);
		for(long long j=0;j<n;j++)
			for(long long k=0;k<=9;k++)
			{
				dp[i][(j+k)%n][0]=(dp[i][(j+k)%n][0]+dp[i-1][j][0])%mod;
				if(k<f(s[i]))
					dp[i][(j+k)%n][0]=(dp[i][(j+k)%n][0]+dp[i-1][j][1])%mod;
			}
		dp[i][ns%n][1]=1;
	}
	cout<<(dp[s.size()-1][0][0]+dp[s.size()-1][0][1]-1+mod)%mod;
	return 0;
}

Measured memory_bytes: 16640
import scala.io.StdIn._

object Main {
  def main(args: Array[String]): Unit = {
    val n = readLine()
    n match {
      case "SUN" => println(7)
      case "MON" => println(6)
      case "TUE" => println(5)
      case "WED" => println(4)
      case "THU" => println(3)
      case "FRI" => println(2)
      case "SAT" => println(1)
    }
  }
}


Measured memory_bytes: 25292
#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 1000000007
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define Nmax 500005
const long double PI = acos(-1);


int n,A[Nmax],B[Nmax];
pii v[Nmax];
set<int> L,R;

int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    int ans = 0;
    for (int i=1;i<=n;i++){
        cin >> v[i].first >> v[i].second;
        L.insert(v[i].first);
        R.insert(v[i].second);
    }
    for (int i=1;i<=n;i++){
        L.erase(L.find(v[i].first));
        R.erase(R.find(v[i].second));
        ans = max(ans, v[i].second - v[i].first + 1 + max(0,1+(*R.begin() - *prev(L.end()))));
        L.insert(v[i].first);
        R.insert(v[i].second);
    }
    sort(v+1,v+n+1);
    int r = 1e9;
    for (int i=1;i<=n;i++){
        r = min(r, v[i].second);
        A[i] = max(0, r - v[i].first+1);
    }
    int l = 0;
    r = 1e9;
    for (int i=n;i>=1;i--){
        l = max(l, v[i].first);
        r = min(r, v[i].second);
        B[i] = max(0, r - l+1);
    }
    // dbg_v(A,n+1);
    // dbg_v(B,n+1);

    for (int i=1;i<n;i++){
        ans = max(ans, A[i] + B[i+1]);
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 14592
#include<stdio.h>

int main(){
  char ch;
  while(1){
    scanf("%c",&ch);
    if('a'<=ch && ch<='z')ch-=32;
    else if('A'<=ch && ch<='Z')ch+=32;
    printf("%c",ch);
    if(ch=='\n')break;
  }
  return 0;
}



Measured memory_bytes: 2056
N,K=map(int,input().split())
ans=0
if K==0:
    print(N**2)
    quit()
for b in range(K+1,N+1):
    if N%b==0:
        ans+=(b-K)*(N//b)
    else:
        ans+=(b-K)*(N//b)+max(0,(N%b-(K-1)))
print(ans)


Measured memory_bytes: 39152
package main

import (
        "bytes"
        "fmt"
        "strconv"
)

func main() {
        var s string
        fmt.Scan(&s)
        spaceNum, sum := len(s)-1, 0
        for i := 0; i < 1<<uint(spaceNum); i++ {
                sum += expNum(s, i)
        }
        fmt.Printf("%d\n", sum)
}

func expNum(s string, selection int) (sum int) {
        rest := selection
        buf := bytes.NewBuffer([]byte{})
        for i := 0; i < len(s); i++ {
                buf.Write([]byte{s[i]})
                if rest&1 == 1 {
                        a, _ := strconv.Atoi(buf.String())
                        buf = bytes.NewBuffer([]byte{})
                        sum += a
                }
                rest >>= 1
        }
        if buf.Len() > 0 {
                a, _ := strconv.Atoi(buf.String())
                buf = bytes.NewBuffer([]byte{})
                sum += a
        }
        return sum
}

Measured memory_bytes: 1024
ans=0
last=[0]*26
d=int(input())
c=list(map(int,input().split()))
s=[]
t=[]
for i in range(d):
    List=list(map(int,input().split()))
    s.append(List)
for i in range(1,d+1):
    t=int(input())
    ans+=s[i-1][t-1]
    last[t-1]=i
    for j in range(1,27):
        ans-=c[j-1]*(i-last[j-1])
    print(ans)

Measured memory_bytes: 9180
#include <iostream>
#include <math.h>
#include <strings.h>
#include <queue>
using namespace std;

int main()
{
    int K,N;
    cin>>K>>N;
    
    int a,as;
    int st,ls,d,ds;
    int i;
    cin >> st;
    d=0;
    as=st;
    for(i=1;i<N;i++){
        cin >> a;
        if(d<a-as){
            d=a-as;
        }
        as=a;
    }
    ls=K-a;
    ds=st+ls;
    if(d<ds){
        d=ds;
    }
    cout<<K-d;

    return 0;
}

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

long long int n;
bool flag = false;
int main(){
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }

    sort(a.begin(), a.end());

    for(int i=0;i<n-1;i++){
        if(a[i] == a[i+1]){
            flag = true;
            break;
        }
    }

    if(flag) cout << "NO" <<endl;
    else cout << "YES" <<endl;
}   




Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		char[] s = in.readLine().toCharArray();
		char[] t = in.readLine().toCharArray();
		Queue<Character> queS = new PriorityQueue<>(new Comparator<Character>() {
			@Override
			public int compare(Character o1, Character o2) {
				return Character.compare(o1, o2);
			}
		});
		Queue<Character> queT = new PriorityQueue<>(new Comparator<Character>() {
			@Override
			public int compare(Character o1, Character o2) {
				return -1 * Character.compare(o1, o2);
			}
		});
		for (int i = 0; i < s.length; ++i) {
			queS.add(s[i]);
		}
		for (int i = 0; i < t.length; ++i) {
			queT.add(t[i]);
		}

		boolean enable = false;
		boolean disable = false;
		Character charS, charT;
		while (!queS.isEmpty() && !queT.isEmpty()) {
			charS = queS.poll();
			charT = queT.poll();
			if (charS < charT) {
				// あきらかにOK
				enable = true;
				break;
			}
			if (charS > charT) {
				// どう頑張っても無理
				enable = false;
				disable = true;
				break;
			}
		}
		if (!enable && !disable) {
			if (queS.isEmpty() && !queT.isEmpty()) {
				enable = true;
			}
		}
		String result = enable ? "Yes" : "No";
		System.out.println(result);

	}
}

Measured memory_bytes: 21460
icase=0
if icase==0:
    n=int(input())
    for dornt in range(0,n+1,7):
        for cake in range(0,n+1,4):
            if dornt+cake==n:
                print("Yes")
                break
        if dornt+cake==n:
            break
    if dornt+cake!=n:
        print("No")

Measured memory_bytes: 2940
K,N = map(int, input().split())
A = list(map(int, input().split()))
List=[]
for i in range(N-1):
    List.append(A[i+1]-A[i])
List.append(K-A[N-1]+A[0])
max = List[0]
for i in range(len(List)):
    if List[i] >= max:
        max = List[i]
print(K-max)

Measured memory_bytes: 25840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  int ans = -1;
  cin >> A >> B;
  for(int i=0;i<1500;i++){
    int D=i*0.08;
    int E=i*0.1;
    if( A==D && B==E){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}
      


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

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

  int cnt = 0;

  for (int i = A; i <= B; i++) {
    int a, b, c, d, e;
    a = i / 10000;
    b = (i / 1000) % 10;
    c = (i / 100) % 10;
    d = (i / 10) % 10;
    e = i % 10;
    if (a == e && b == d) {
      cnt++;
    }
  }

  cout << cnt << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n, m, a, b, i, btmp[200000], atmp[200000];
  scanf("%d%d", &n, &m);
  for(i=0; i<n; ++i){
    btmp[i] = 0;
    atmp[i] = 0;
  }
  for (i=0; i<m; ++i) {
    scanf("%d%d", &a, &b);
    if (a == 1){
      if (atmp[b-1] == 1){
	  printf("POSSIBLE\n");
	  return 0;
      }
      btmp[b-1] = 1;
    }
    if (b == n){
      if (btmp[a-1] == 1){
	printf("POSSIBLE\n");
	return 0;
      }
      atmp[a-1] = 1;
    }
  }
  printf("IMPOSSIBLE\n");
  return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    int fac[9];
    fac[0]=1;
    for (int i=1;i<=8;i++)
    fac[i]=(fac[i-1]*i);
    int n;
    scanf("%d",&n);
    int x[n];
    int y[n];
    for (int i=0;i<n;i++)
    scanf("%d%d",&x[i],&y[i]);
    vector<double> v;
    double sum1=0.0;
    for (int i=0;i<n-1;i++)
    {
        for (int j=i+1;j<n;j++)
        {
            double val=sqrt(1.0*(pow(x[i]-x[j],2)+pow(y[i]-y[j],2)));
            v.push_back(val);
        }
    }
    for (int i=0;i<v.size();i++)
    sum1=sum1+v[i];
    double k=((n-1)*fac[n])/(1.0*v.size());
    sum1=1.0*sum1*k;
    sum1=sum1/(1.0*fac[n]);
    cout<<fixed<<setprecision(10)<<sum1<<endl;
    return 0;
}

Measured memory_bytes: 3828
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef long double LD;
typedef vector<LD> vld;
typedef vector<pair<LD, LD>> vpld;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T> T gcd(T a, T b) {return (a == 0) ? b : gcd(b%a, a);}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b;}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec)); vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}


int main(){
#ifdef __DEBUG_LOCAL__
    ifstream file("../../../../../in.txt"); if(file.is_open()) cin.rdbuf(file.rdbuf());
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    
    string S, T; cin >> S >> T;
    ll A, B; cin >> A >> B;
    string U; cin >> U;
    if(U == S) A--;
    else B--;
    cout << A << " " << B << endstr;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long n;
	cin>>n;
	long a[n];
	const long mod=1e9+7;
	long long sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		sum=sum%mod;
	}
	long ans=0;
	for(int i=0;i<n;i++){
		sum-=a[i];
		if(sum < 0){
			sum+=mod;
		}
		ans+=((a[i]%mod)*(sum%mod))%mod;
		ans=ans%mod;
	}
	cout<<ans%mod;
	
}

Measured memory_bytes: 5180
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
int n;
const int N=120;
int  a[N];
int   main()
{
	 scanf("%d",&n);
	for(int  i=1;i<=n;i++)
	scanf("%d",&a[i]);
int  cnt=0;
  for(int i=1;i<n;i++)
  {
	  if(a[i]==a[i+1]){
		  cnt++;
		  i++;
	  }
  }	  
  printf("%d\n",cnt);
  return    0;
}

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

const int MAX = 200005;
int A[MAX];

int main() {
    int N, M, a, b;
    scanf("%d %d", &N, &M);
    for (int i = 0; i < N; i++) A[i] = 0;
    for (int i = 0; i < M; i++) {
        scanf("%d %d", &a, &b);
        if (a == 1 || b == 1) A[max(a,b)-1]++;
        else if (a == N || b == N) A[min(a, b)-1]++;
    }
    int x = 0;
    for (int i = 0; i < N; i++) {
        x = max(x, A[i]);
    }
    if (x > 1) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MAXN 2097152
using namespace std;
int f[MAXN+5][21];
char s[MAXN+5];
int main (){
	int i,j,k,l,n,tar;
	scanf ("%d",&n);
	scanf ("%d",&tar);
	for (i=0;i<=n;i++)
	{scanf ("%s",s);
	for (j=0;j<(1<<i);j++)
	{if (s[j]=='1') f[(1<<i)+j][0]=1;
	}
	}
	for (i=0;i<=20;i++)
	{for (j=20-i;j>=0;j--)
	{for (l=0;l<(1<<(i+j));l++)
	{int id=(1<<(i+j))+l,o=i;
	if (!f[id][o]) continue;
	int s1=(l>>j),s2=l&((1<<j)-1);
	int l1=i,l2=j,f0=-1,f1=-1;
	if (j) f[(1<<i)+s1][i]+=f[id][o];
	for (k=j-1;k>=0;k--)
	{if (!(s2&(1<<k))) {f0=k;break;}
	}
	for (k=j-1;k>=0;k--)
	{if (s2&(1<<k)) {f1=k;break;}
	}
	if (f0!=-1)
	{int rm=s2&((1<<f0)-1);
	int nta=(1<<(i+1+f0))+(s1<<(f0+1))+rm;
	f[nta][i+1]+=f[id][o];
	}
	if (f1!=-1)
	{int rm=s2&((1<<f1)-1);
	int nta=(1<<(i+1+f1))+(((s1<<1)+1)<<f1)+rm;
	f[nta][i+1]+=f[id][o];
	}
	}
	}
	}
	for (i=20;i>=0;i--)
	{for (j=0;j<(1<<i);j++)
	{if (f[(1<<i)+j][i]>=tar)
	{for (l=i-1;l>=0;l--)
	{if (j&(1<<l)) {putchar('1');}
	else {putchar('0');}
	}
	return 0;
	}
	}
	}
	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

int main() {
    int N, M; cin >> N >> M;
    vector<int> s(M), c(M); REP(i, M) cin >> s[i] >> c[i];
    for(int i = 0; i <= 1000; i++) {
        if(i == 1000) {
            cout << -1 << endl;
            break;
        }
        string tmp = to_string(i);
        if(tmp.size() != N) continue;
        bool flag = false;
        for(int k = 0; k < M; ++k) {
            if(char_to_int(tmp[s[k] - 1]) != c[k]) break;
            if(k == M - 1) {
                flag = true;
            }
        }
        if(flag == true || M == 0) {
            cout << tmp << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
integer N,K
integer,allocatable,dimension(:)::a
logical,allocatable,dimension(:)::dp
read*,N,K
allocate(a(N),DP(0:K))
read*,a
DP=.False.
DP(0)=.False.
do i=1,K
  do j=1,N
    if(i-a(j)<0)cycle
    if(.Not.dp(i-a(j)))dp(i)=.True.
  end do
end do

print"(A)",merge(" First","Second",dp(k))

end

Measured memory_bytes: 640
import java.io.*;
import java.util.*;

class Main {
    static final String YES = "Yes";
    static final String NO = "No";

    // Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long K;
        K = sc.nextLong();
        long Q;
        Q = sc.nextLong();
        long[] A = new long[(int)(Q)];
        for(int i = 0 ; i < Q ; i++){
                A[i] = sc.nextLong();
        }
        solve(N, K, Q, A);
    }

    static void solve(long N, long K, long Q, long[] A){
        long[] AnswerNum = new long[(int)(N)];
        Arrays.fill(AnswerNum, 0);

        for (long ai: A) {
            AnswerNum[(int)(ai - 1)]++;
        }

        for (long ANi: AnswerNum) {
            if(ANi > Q - K) System.out.println(YES);
            else System.out.println(NO);
        }
    }
}


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

int main() {
    int N, D, ans = 0;
    cin >> N >> D;
    int X[N][D];
    rep(i, N) rep(j, D) {
        cin >> X[i][j];
    }
    
    rep(i, N) {
        REP(j, i + 1, N) {
            int norm = 0;
            rep(k, D) {
                norm += pow(X[i][k] - X[j][k], 2);
            }
            REP(k, 1, norm + 1) {
                if (k * k == norm) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
        int k, cnt=0, n, p;
        scanf("%d", &n);
        int a[n+1];
        int low, high, mid, j;
        for(j=0; j<n; j++){
            scanf("%d", &a[j]);
            //printf("%d \n", a[j]);
        }
        sort(a, a+n);
        //for(j=0; j<n; j++) printf("%d ", a[j]);
        //printf("\n\n");
        for(j=0; j<n-2;j++){
            for(k=j+1; k<n-1; k++){
                int ans=0;
                p=a[j]+a[k]-1;
                low=k+1;
                high=n-1;
                mid=(low+high)/2;
                while(low<=high){
                    if(a[mid]>p){
                        high=mid-1;
                        mid=(high+low)/2;
                    }
                    else{
                        low=mid+1;
                        mid=(high+low)/2;
                    }
                }
                if(a[mid]<=p) ans=mid-k;
                //ans=ans+k-j-1;
                //if(ans==0) break;
                //printf("%d %d %d\n", a[j], a[k], ans);
                cnt=cnt+ans;
            }
        }
        printf("%d\n", cnt);
}

Measured memory_bytes: 256
//#pragma GCC optimize("03")
//#pragma GCC target("avx2")
 
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sqr(a) (a)*(a)
#define um unordered_map 
#define us unordered_set
using namespace std;
 
hash<string> hfn;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef double dbl;
typedef unsigned int ui;
const int inf = 2e9;
const ll mod = 1e9 + 7;
const ld eps = 1e-7;
const ll biginf = 1e18;
const ld pi = acosl(-1);

void solve()
{
  ll n, W;
  cin >> n >> W;
  vector<ll> w(n), c(n);
  for(int i = 0; i < n; i++)
    cin >> w[i] >> c[i];
  vector<vector<ll> > dp(n, vector<ll>(W+1, 0));
  for(int i = w[0]; i <= W; i++)
    dp[0][i] = c[0];
  for(int i = 1; i < n; i++)
  {
    for(int j = 0; j <= W; j++)
    {
      dp[i][j] = dp[i-1][j];
      if(j - w[i] >= 0)
        dp[i][j] = max(dp[i][j], dp[i-1][j - w[i]] + c[i]);
    }
  }
  cout << dp.back().back();
}
 
void multisolve()
{
  int t;
  cin >> t;
  while(t--)
    solve();
}
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  //freopen("hull.in", "r", stdin);
  //freopen("hull.out", "w", stdout);
  solve();
  //multisolve();
}

Measured memory_bytes: 79488
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
typedef struct{
    char s[11];
    int p;
    int num;
} house;
 
int cmp(const void *a, const void *b){
    return ((house *)b)->p - ((house *)a)->p;
}
 
int scmp(const void *a, const void *b){
    return strcmp(((house *)a)->s, ((house *)b)->s);
}
 
int main(void){
    int n, i;
    scanf("%d", &n);
    house rest[n];
    for(i=0; i<n; i++){
        scanf("%s %d", rest[i].s, &rest[i].p);
        rest[i].num = i + 1;
    }
    qsort(rest, n, sizeof(house), cmp);
    qsort(rest, n, sizeof(house), scmp);
    for(i=0; i<n; i++){
        printf("%d\n", rest[i].num);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
int main(){
    ll n ;
    cin >>  n;
    string s,t ;
    cin >> s >> t ;
    for(int i=0 ; i< n ;i++)
    {
        cout << s[i] <<t[i]  ;
    }

    return 0 ;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int a,b,c,i,n;
    scanf("%lld%lld%lld",&a,&b,&c);
        if(a>c)
            printf("%lld %lld\n",a-c,b);
        else if(b>=c-a)
            printf("0 %lld\n",(b+a)-c);
        else if(a+b<=c)
            printf("0 0");
}


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

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

		int n,m;
		cin>>n>>m;
		int sum=n+m;
		int ans=(sum*(sum-1))/2;
		int p=n*m;
		ans=ans-p;
		cout<<ans<<endl;
}
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
    ll n;
    cin>>n;
    ll a[100005],i;
    a[0]=0;
    for(i=1;i<=n;i++)
    cin>>a[i];
    ll dp[100005]={0};
    dp[1]=0;
    dp[2]=abs(a[2]-a[1]);
    for(i=3;i<=n;i++)
    {
        dp[i]=min((abs(a[i]-a[i-1])+dp[i-1]),(abs(a[i]-a[i-2])+dp[i-2]));
    }
    /*for(i=1;i<=n;i++)
    cout<<dp[i]<<" ";*/
    cout<<dp[n]<<"\n";
    return 0;
}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int[] a = new int[5];
            int ans = 0;
            for (int i = 0; i < 5; i++) {
                a[i] = Integer.parseInt(in.next());
                if (a[i] == 0) ans = i + 1;
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 35780
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()      scanf("")
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF (0x7fffffff)
#else
#define INF (0x7fffffffffffffff)
#endif

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  char s[112345]={};
  scanf("%s",s);
  int len=strlen(s);
  char a[100]={};
  int i;
  for(i=0;i<len;i++)
    a[s[i]-'a']=1;
  
  for(i=0;i<26;i++)
    if(a[i]==0)break;
  if(i==26)puts("None");
  else printf("%c\n",'a'+i);
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(){
  int n,i,k=0,t=0,o=0,d[4]={0};
  char s[10];
  scanf("%d",&n);
  if(n!=0)scanf("\n");
  while(1){
    if(n==k)break;
    fgets(s,9,stdin);
    if(s[0]=='H'){
      if(s[1]=='I'){
	for(i=0;i<3;i++){
	  d[3-i]=d[2-i];
	}
	d[0]=1;
      }
      else{
	for(i=0;i<3;i++){
	  t+=d[i];
	  d[i]=0;
	}
	t++;
      }
      t+=d[3];
      d[3]=0;
    }
    else{
      o++;
      if(o==3){
	o=0;
	k++;
	printf("%d\n",t);
	t=0;
	for(i=0;i<4;i++){
	  d[i]=0;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 600