akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *

S = input()
N = len(S)
ans = 1
last = S[0]
i, l = 1, 1
while i < N:
    if S[l:i+1] == last:
        i += 1
    if S[l:i+1] != last:
        ans += 1
    last = S[l:i+1]
    l = i+1
    i += 1
print(ans)


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

int main(){
    string ca;
    cin >> ca;
    int h1,h2;
    while(1){
        if (ca == "-") break;
        
        cin >> h1;
        for (int i=0;i<h1;i++){
            cin >> h2;
            ca = ca.substr(h2,ca.size()-h2) + ca.substr(0,h2);
            
        } 
        cout << ca << endl;
        cin >> ca;

    
    }

    return 0;
}


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

int main() {
    string S,D;
    cin>>S>>D;
    int n;
    n=S.size();
    string check="Yes";
    rep(i,n){
        if(S[i]!=D[i]){
            check="No";
        }
    }
    cout<<check<<endl;
}

Measured memory_bytes: 3600
n = int(input())
def main():
    import sys
    input = sys.stdin.readline
    l = list(map(int,input().split()))
    dp = [[-float("INF")]*(3) for i in range(n+1)]
    dp[0][0] = 0
    dp[1][-1] = 0
    dp[1][1] = l[0]
    for i in range(1,n):
        
        dp[i+1][-1] = max(dp[i][0],dp[i-1][-1]+l[i])
        dp[i+1][0] = max(dp[i][1],dp[i-1][0]+l[i])
        dp[i+1][1] = dp[i-1][1]+l[i]
    print(max(dp[-1][0],dp[-1][-1]))

if __name__ == "__main__":
    main()

Measured memory_bytes: 131620
#include <stdio.h>
#include <string.h>
 
int main(){
  int n,y,z,i,j;
  int ansx=-1,ansy=-1,ansz=-1;
  scanf("%d %d",&n,&y);
  z = y-1000*n;
  for(i=0;i<=n;i++){
    for(j=0;j<=n-i;j++){
      if(9000 * j + 4000 * i == z){
        ansx = j;
        ansy = i;
        ansz = n-i-j;
        i = n+2;
        break;
      }
    }
  }
  printf("%d %d %d",ansx,ansy,ansz);
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    cout << accumulate(A,A+N,0)-N << endl;
}

Measured memory_bytes: 256
open Printf
open Scanf

let id x = x

let n, d = scanf "%d %d\n" (fun n d -> n, float d)
let ary = Array.init n (fun _ -> scanf "%d %d\n" (fun x y -> float x, float y))

let run () =
    let n = Array.fold_left (fun n (x, y) -> if x *. x +. y *. y <= d *. d then n + 1 else n) 0 ary in
    printf "%d\n" n

let () = run ()


Measured memory_bytes: 19180
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！

  double a,b;
  cin >> a >> b;

  cout << fixed << a/b << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    boost;

    ll n;
    ll k;
    cin >> n >> k;
    int arr[n];
    for (int i = 0; i < n; i++)cin >> arr[i];

    sort(arr, arr + n);

    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += arr[i];
    }
    cout << ans << endl;

}

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

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

const ll MOD = 1e9 + 7;

//二項係数 nCk mod p
//aのp乗を求める
ll modpow(ll a, int p) {
   if(p == 0) return 1;
   if(p % 2 == 0) {
   int halfP = p / 2;
   ll half = modpow(a, halfP);
   //a^(p/2)をhalfとして、half*halfを計算
   return half * half % MOD;
} else {
   //pが奇数のときは偶数にするために1減らす
   return a * modpow(a, p-1) % MOD;
   }
}
//二項係数の計算
//10C3 (10*9*8) / (3*2*1)
//(10*9*8):ansMul (3*2*1):ansDiv
ll calcComb(int a, int b) {
   if(b > a - b) return calcComb(a, a - b);

   ll ansMul = 1;
   ll ansDiv = 1;
   rep(i, b) {
       ansMul *= (a - i);
       ansDiv *= (i + 1);
       ansMul %= MOD;
       ansDiv %= MOD;
   }
   //ansMul / ansDiv をしたい
   //ansDivの逆元を求める
   ll ans = ansMul * modpow(ansDiv, MOD - 2) % MOD;

   return ans;
}

int main() {
    int x, y;
  cin >> x >> y;
  if ((x+y)%3) {
    cout << 0 << endl;
    return 0;
  }
  int n = (x+y)/3;
  x -= n; y -= n;
  if (x < 0 || y < 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << calcComb(x+y, x);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>//author::@whohet-->Het Patel
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define test int T; cin>>T; while(T--)
#define endl "\n"
#define int long long
#define uint unsigned long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vvi vector<vector<int>>
#define mii map<int,int>
#define msi map<string,int>
#define mis map<int,string>
#define pb push_back
#define mod 1000000007
#define PI 3.141592653589793238

using namespace std;

//author::@whohet-->Het Patel

signed main()
{
    fasterthanlight;
    
        int n;
        cin>>n;
        int sum=0;
        for(int i=1;i<=n;i++)
        {
            if(i%3!=0 && i%5!=0)
                sum=sum+i;
        }
        cout<<sum<<endl;

    
    return 0;
}


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

using vvc = vector<vector<char>>;
using vpii = vector<pair<int, int>>;

vpii next_step(vpii const& step, vvc& a) {
    int const d[][2] = { -1, 0, 1, 0, 0, -1, 0, 1 };
    vpii r;
    for (auto const& x : step) {
        for (auto const& y : d) {
            int i = x.first + y[0], j = x.second + y[1];
            if (a[i][j] == '.') {
                a[i][j] = '#';
                r.emplace_back(i, j);
            }
        }
    }
    return r;
}

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

    int h, w;
    cin >> h >> w;
    vvc a(h + 2, vector<char>(w + 2));
    vpii step;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> a[i][j];
            if (a[i][j] == '#')
                step.emplace_back(i, j);
        }
    }

    int n = h * w - step.size();
    int ans = 0;
    while (n > 0) {
        ans++;
        step = next_step(step, a);
        n -= step.size();
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 13928
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, X;
    cin >> N >> X;
    vector<ll> L(N);
    REP(i, N) cin >> L[i];
    ll current = 0;
    ll index = 0;
    while (current <= X) {
        current = L[index] + current;
        index++;
    }
    if(index>N) index=N+1;
    cout << index << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#define MIN 1<<31-1
#define HMAX 1000000000000000000
#define MOD 1000000007
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RSET(s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
typedef long long int ll;
using namespace std;
int pre[200000];
int find(int x)
{
    int r=x;
    while(pre[r]!=r)
    r=pre[r];//????????
    int i=x,j;
    while(i!=r)//??????
    {
        j=pre[i];//??x?????
        pre[i]=r;//?i????????r???
        i=j;
    }
    return r;
}
void join(int x,int y)
{
    int a=find(x);//x?????a
    int b=find(y);//y?????b
    if(a!=b)//??a,b????????,???ab?????
    {
        pre[a]=b;//???ab?? ?a????????b
    }
}
struct D{
	int val;
	int loc;
	D(int a=0,int b=0)
	{
		val=a;loc=b;
	}
};
set<int> S[100110];
int flag[100110];
int shu[100110];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>shu[i];
	for(int i=1;i<=n;i++)//n??????????
	{
    	pre[i]=i;//???????????????

	}
	for(int i=0;i<m;i++)
	{
		int a;int b;cin>>a>>b;
		join(a,b);
	}
	for(int i=1;i<=n;i++)
	{
		int Z=find(i);
		S[Z].insert(i);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int Z=find(i);
		if(S[Z].count(shu[i]))
			ans++;
	}
	cout<<ans<<endl;
//	freopen("1.txt","r",stdin);
//	freopen("2.txt","w",stdout);
	return 0;
}

Measured memory_bytes: 10624
#include <stdio.h>

int main(void)
{   int a,b,i;
    char op;
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+')
        {printf("%d\n",a+b);
        }
        else if(op=='-')
        {printf("%d\n",a-b);
        }
        else if(op=='*')
        {printf("%d\n",a*b);
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }else if(op=='?') {
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 2040
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
using namespace std;
int main()
{
	int n, x;
	cin >> n >> x;
	int sum = 0,a=0;

	for (int i = 1; i < n+1; i++) {
		cin >> a;
		sum += a;
		
		if (sum > x) {
			cout << i;
			
			return 0;
		}
		else if (sum == x) {
			cout << i + 1;
			return 0;
		}
	}
	cout << n + 1;

	


	return 0;
}

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

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<long long int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<long long int> b(m);
    for(int i = 0; i < m; i++) cin >> b[i];

    long long int sum = 0;
    int ans = 0;
    int ainde, binde;
    for(ainde = 0; ainde < n && sum+a[ainde] <= k; ainde++){
        sum += a[ainde];
        ans++;
    }

    for(binde = 0; binde < m && sum+b[binde] <= k; binde++){
        sum += b[binde];
        ans++;
    }

    int ansmax = ans;
    for(ainde--; ainde >= 0; ainde--){
        sum -= a[ainde];
        ans--;
        for(; binde < m && sum+b[binde] <= k; binde++){
            sum += b[binde];
            ans++;
        }
        if(ansmax < ans) ansmax = ans;
    }

    cout << ansmax << endl;
    return 0;
}

Measured memory_bytes: 6428
#include<stdio.h>
int main(){
  int n,x=0,i;
  scanf("%d",&n);
  i=n;
  while(i>0){
    x+=(i%10);
    i/=10;


  }
  if(n%x==0){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
package main

import "fmt"

type xy struct {
	y int
	x int
}

func main() {
	var H, W, D int
	fmt.Scan(&H)
	fmt.Scan(&W)
	fmt.Scan(&D)

	po := make([]xy, H*W+1)

	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			var a int
			fmt.Scan(&a)
			po[a] = xy{i + 1, j + 1}
		}
	}

	cost := make([][]int, D)
	for i := 0; i < D; i++ {
		cost[i] = make([]int, H*W/D+10)
	}

	for i := D + 1; i <= W*H; i++ {
		cost[i%D][i/D] = calc(po[i-D], po[i]) + cost[i%D][i/D-1]
	}

	var Q int
	fmt.Scan(&Q)
	for i := 0; i < Q; i++ {
		var L, R int
		fmt.Scan(&L)
		fmt.Scan(&R)

		fmt.Println(cost[R%D][R/D] - cost[L%D][L/D])
	}
}
func calc(a, b xy) int {
	return abs(a.x-b.x) + abs(a.y-b.y)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


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

const int MAXN = 2e5 + 10;
long long n, a[MAXN], mx, ans;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	if (a[0] > 0)
		return cout << -1, 0;
	mx = -1;
	for (int i = n - 1; i >= 0; i--, mx--) {
		if (mx < a[i])
			ans += a[i], mx = a[i];
		else if (mx > a[i])
			return cout << -1, 0;
	}
	cout << ans;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
using namespace std;
string s;
int i;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> s;
	for (i = 0; i < 3; i++)
		if (s[i] == '7')
			break;
	if (i == 3)
		cout << "No";
	else
		cout << "Yes";
	return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int i,j,k;
	int array[n][26] = {0};

	for (i=0;i<n;i++)
	{
		string inp;
		cin >> inp;
		int size = inp.length();

		for (j=0;j<size;j++)
		{
			array[i][inp[j]-97] += 1;
		}
	}
	char chr = 'a';
	int min = 100;
	for (i=0;i<26;i++)
	{
		min = 100;
		for (j=0;j<n;j++)
		{
			if (array[j][i]<min)
				min = array[j][i];
		}
		for (k=0;k<min;k++)
		{
			cout << (char)(chr + i);
		}

	}

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin >> n;
    vector<long long>a(n+1);
    vector<long long>b(n);
    long long ans=0;
    for(int i=0;i<n+1;i++)cin >> a[i];
    for(int i=0;i<n;i++)cin >> b[i];
    for(int i=0;i<n;i++){
        if(a[i]>=b[i]){
            ans+=b[i];
        }
        else if(a[i+1]>b[i]-a[i]){
            ans+=b[i];
            a[i+1]=a[i+1]-(b[i]-a[i]);
        }
        else if(a[i+1]<=b[i]-a[i]){
            ans+=a[i]+a[i+1];
            a[i+1]=0;
        }
        
    }
    cout << ans;
}

Measured memory_bytes: 1792
#include<stdio.h>
#define MAX 10000
#define WHITE 0
#define GRAY  1
#define BLACK 2

int n,M[MAX][MAX];

int prim()
{
  int i;
  int u;
  int min;
  int d[MAX];
  int p[MAX];
  int color[MAX];
  int sum = 0;
  int v;

  for( i = 0 ; i < n ; i++ ){
    d[i] = 10000000;
    p[i] = -1;
    color[i] = WHITE;
  }
  d[0] = 0;

  while(1){
    min = 1000000;
    u = -1;
    for( i = 0 ; i < n ; i++ ){
      if( min > d[i] && color[i] != BLACK ){
	u = i;
	min = d[i];
      }
    }
    if( u == -1 )break;
    color[u] = BLACK;
    for( v = 0 ; v < n ; v++ ){
      if( color[v] != BLACK && M[u][v] != 100000 ){
	if( d[v] > M[u][v] ){
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }
  for( i = 0 ; i < n ; i++ ){
    if( p[i] != -1 ) sum += M[i][p[i]];
  }

  return sum;
}
  
int main()
{
  int i,j;
  int k;

  scanf("%d",&n);
  for( i = 0 ; i < n ; i++ ){
    for( j = 0 ; j < n ; j++ ){
      scanf("%d",&k);
      M[i][j] = (k == -1) ? 1000000 : k;
    }
  }

  printf("%d\n",prim());
  for(i = 0 ; i < n ; i++ );
}
      
      
  



Measured memory_bytes: 2184
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed ios::sync_with_stdio(0);cin.tie(0);
#define rep(i,a) for(ll i=0;i<a;i++)
#define all(v) v.begin(),v.end()
// bitshifting (1LL<<(3)) *2^3
typedef long long int ll;
int main()
{
    speed;
    ll a,b,i,j,d,e,m,count=0;
    set<ll>s;
    cin>>a>>b;
    vector<ll> c(a);
    vector<ll> x(a);
    rep(i,a)
        cin>>c[i],x[i]==0;

    rep(j,b)
    {
        cin>>d>>e;
        x[d-1]=max(x[d-1],c[e-1]);
        x[e-1]=max(x[e-1],c[d-1]);
    }
    rep(i,a)
    {
        if(c[i]>x[i])
            count++;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 4744
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define int long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1*1e5+5;
 
int32_t main() {
	FAST;
	double n, k;
	cin >> n >> k;
	
	double prob = 0;
	for(int i = 1; i <= n; i++) {
		double qtd = 0;
		int sc = i;
		while(sc < k) {
			sc *= 2;
			qtd++;
		}
		prob += 1.0/n*pow(1.0/2.0, qtd);
	}
	cout << fixed << setprecision(10) << prob << endl;
}


Measured memory_bytes: 256
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())
A = inpl()

odd = A[::2]
even = A[1::2]

if N % 2 == 1:
    odd.reverse()
    ans = odd + even
    print(' '.join(map(str, ans)))
else:
    even.reverse()
    ans = even + odd
    print(' '.join(map(str, ans)))


Measured memory_bytes: 31300
n = int(input())
for _ in range(n):
  x, y, b, p = map(int, input().split())
  cost = x * b + y * p
  if b >= 5 and p >= 2:
    print(cost * 4 // 5)
    continue
  print(min(cost, (x * max(5, b) + y * max(2, p)) * 4 // 5))


Measured memory_bytes: 5600
using System;
using System.Linq;

namespace AtCoderBeginnerContest153
{
	class Program
	{
		static void Main(string[] args)
		{
			var numbers = ReadIntArray();

			Console.WriteLine((int)Math.Ceiling((double)numbers[0] / numbers[1]));
		}

		public static int ReadInt()
			=> int.Parse(Console.ReadLine());

		public static int[] ReadIntArray()
			=> Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

		public static long ReadLong()
			=> long.Parse(Console.ReadLine());

		public static long[] ReadLongArray()
			=> Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

		public static string ReadString()
			=> Console.ReadLine();

		public static string[] ReadStringArray()
			=> Console.ReadLine().Split();
	}
}


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

int T, D, L;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (1) {
        cin >> T >> D >> L;
        if (!T & !D & !L) break;
        int t;
        vector<int> imosu(200010, 0);
        int ans = 0;
        for (int i = 0; i < T; i++) {
            cin >> t;
            if (t >= L) {
                imosu[i + 1] += 1;
                imosu[i + 1 + D] -= 1;
            }
        }
        for (int i = 1; i < imosu.size(); i++) {
            imosu[i] = imosu[i - 1] + imosu[i];
        }
        for (int i = 0; i < T; i++) {
            if (imosu[i] > 0) ans++;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3956
import java.util.Scanner;
public class Main {

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

		double N = in.nextDouble();
		double K = in.nextDouble();

		double y = 1;
		double sum = 0;

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

			while ( i * y < K ) {
				y *= 2;
			}
			sum += (1 / y)*(1 / N);
			y = 1.0;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 24660
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin>>A>>B;
    if(1<=A && A <= 9 &&1<=B && B<= 9)
    cout<<A*B<<endl;
    else
    cout<<"-1"<<endl;
    return 0;
}


Measured memory_bytes: 3164
#include<stdio.h>
#include<string.h>
 
int main(){
  char s[100], t[100];
  scanf("%s %s", s, t);
 
  if(strncmp(s, t, strlen(s))!=0){
    printf("No\n");
  }else{
    if(strlen(t)!=strlen(s)+1)
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}


Measured memory_bytes: 1660
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
int n;
string s;
map<string,int>letak;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>s;
        letak[s]++;
    }
    cout<<"AC x "<<letak["AC"]<<endl;
    cout<<"WA x "<<letak["WA"]<<endl;
    cout<<"TLE x "<<letak["TLE"]<<endl;
    cout<<"RE x "<<letak["RE"]<<endl;
}

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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}
template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }
template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }
template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T> inline bool chkmax(T &x, const T &y){ return y > x ? x = y, 1 : 0; }
template <typename T> inline bool chkmin(T &x, const T &y){ return y < x ? x = y, 1 : 0; }

#ifdef ONLINE_JUDGE
#define debug(...) ;
#else
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG
#endif

//---------------------------------------------------------head----------------------------------------------------

bool f  = 0;
deque<int> a;

int main()
{
	int n; scf(n);
	forn(i, 1, n)
	{
		int x; scf(x);
		if(f) a.push_front(x);
		else a.pb(x);
		f ^= 1;
	}
	if(f) reverse(ALL(a));
	for(int x: a) printf("%d ", x); puts("");
	return 0;
}

Measured memory_bytes: 2944
import java.util.*;

public class Main{
    int[] parent;
    int[] size;
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        parent = new int[n];
        size = new int[n];
        for(int i = 0; i < n; i++){
            parent[i] = i;
            size[i] = 1;
        }
        for(int i = 0; i < m; i++){
            int a = scan.nextInt() - 1;
            int b = scan.nextInt() - 1;
            unite(a, b);
        }
        HashSet<Integer> union = new HashSet<>();
        for(int i = 0; i < n; i++){
            union.add(root(i));
        }
        System.out.println(union.size() - 1);
    }

    int root(int x){
        if(parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(size[x] < size[y]){
            parent[x] = y;
            size[y] += size[x];
        }else{
            parent[y] = x;
            size[x] += size[y];
        }
    }

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


Measured memory_bytes: 60424
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    println(problem093a(s))
}

fun problem093a(s: String): String {
    return if (s.count { it == 'a' } == 1 && s.count { it == 'b' } == 1 && s.count { it == 'c' } == 1) {
        "Yes"
    } else {
        "No"
    }
}

Measured memory_bytes: 31132
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    ll odp = 0;
    vector<ll> il0(60, 0), il1(60, 0);
    for (int i = 0; i < n; ++i)
    {
        if (i >= 1)
        {
            for (ll j = 0; j < 60; ++j)
            {
                if ((a[i] & (1LL << j)) == 0)
                    odp = (odp + ((1LL << j) % MOD) * il1[j]) % MOD;
                else
                    odp = (odp + ((1LL << j) % MOD) * il0[j]) % MOD;
            }
        }
        for (ll j = 0; j < 60; ++j)
        {
            if ((a[i] & (1LL << j)) == 0)
                ++il0[j];
            else
                ++il1[j];
        }
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int N; string ans="No"; cin >> N; int a, b, c=0;
REP(i, N){ 
  cin >> a >> b;
  if(a==b){ c++; }else{ c=0; }
  if(c>=3){ ans="Yes"; break; }
}
cout << ans << "\n";
}

Measured memory_bytes: 3600
#include <stdio.h>

int N;
int A[2*100000];

long long abs(long long a){return (a<0)?-a:a;}
long long min(long long a, long long b){return (a<b)?a:b;}
long long max(long long a, long long b){return (a>b)?a:b;}
int s1,s2,s3; //separator s=i is left of s[i] i=[0:N]
int main(){
	scanf("%d",&N);
	for(int i = 0; i < N; i++) scanf("%d",A+i);
	s1 = 1;
	s2 = 2;
	s3 = 3;

	long long S1=A[s1-1],S2=A[s2-1],S3,S4;

	long long sum = 0;
	long long suml = 0;
	for(int t = s3; t <= N ; t++){
		sum += A[t-1];	
	}
	long long mindiff = 2*100000LL*1000000000LL;
	for(int t = s3; t <= N; t++){
		suml += A[t-1];
		if(mindiff > abs(suml - (sum-suml))){
			mindiff = abs(suml-(sum-suml));
			s3 = t;
			S3 = suml;
			S4 = sum-suml;
		}
	}

	//printf("(s1,s2,s3)=(%d,%d,%d),(S1,S2,S3,S4)=(%lld,%lld,%lld,%lld),mindiff=%lld\n",s1,s2,s3,S1,S2,S3,S4,mindiff);
	mindiff = max(S1,max(S2,max(S3,S4))) - min(S1,min(S2,min(S3,S4)));

	while(s2 < N-2){
		s2++;
		if(abs(S1-(S2+A[s2-1])) > abs(S1+A[s1]-(S2+A[s2-1]-A[s1]))){
			S2 += A[s2-1];
			do{
				S2 += -A[s1];
				S1 += A[s1];
				s1++;
			}while(abs(S1-S2) > abs(S1+A[s1]-(S2-A[s1])));
		}else{
			S2 += A[s2-1];
		}
		if(abs(S3-A[s2-1]-S4) > abs((S3-A[s2-1]+A[s3])-(S4-A[s3]))){
			S3 += -A[s2-1];
			do{
				S3 += +A[s3];
				S4 += -A[s3];
				s3++;
			}while(abs(S3-S4) > abs((S3+A[s3])-(S4-A[s3])));
		}else{
			S3 += -A[s2-1];
		} 
		mindiff = min(mindiff, max(S1,max(S2,max(S3,S4))) - min(S1,min(S2,min(S3,S4))));
	//	printf("(s1,s2,s3)=(%d,%d,%d),(S1,S2,S3,S4)=(%lld,%lld,%lld,%lld),mindiff=%lld\n",s1,s2,s3,S1,S2,S3,S4,mindiff);
	}
	printf("%lld\n",mindiff);
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){
    cout << "Yes" << endl;
}
void no(){
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n ;
    cin >> n ;
    vector<ll> vec(n) ;
    REP(i,n){
        cin >> vec[i] ;
    }
    sort(ALL(vec)) ;
    ll ans = 1 ;
    REP(i,n){
        if(log10(ans)+log10(vec[i])>18){
            cout << -1 <<endl;
            return 0 ;
        }
        ans *= vec[i] ;
    }
    if(ans<=LINF){
        cout << ans <<endl ;
    }
    else{
        cout << -1 <<endl ;
    }

    return 0;
}



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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    double sumOfReciprocals = 0;
    for(int i = 0; i < n; i++) sumOfReciprocals += 1.0 / a[i];
    sumOfReciprocals = (1.0 / sumOfReciprocals);
    cout << sumOfReciprocals;
}

Measured memory_bytes: 256
import numpy as np
n=int(input())
s=input()
a=np.ones(n)
m=10**9+7
for i in s:
    if i=="<":
        a=a[:-1].cumsum()
    else:
        a=a[1:][::-1].cumsum()[::-1]
    a%=m
print(int(a[0]))

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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) int(arr.size())

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
ll div_floor(ll a, ll b) { return a / b - (((a ^ b) < 0) and a % b); }
ll div_ceil(ll a, ll b) { return a / b + (((a ^ b) >= 0) and a % b); }

//ll f[200005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }


int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;
	int s, w;
	cin >> s >> w;
	if (w >= s)
		cout << "unsafe";
	else
		cout << "safe";

	return 0;
}

Measured memory_bytes: 3600
//#include<bits/stdc++.h> using namespace std;
#include<iostream>
using namespace std;
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<stack>
#include<queue> //priority_queue inside queue
#include<deque>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl '\n'
typedef long long ll;
typedef unsigned long long ull;
#define f(i,start,end) for(i=start;i<=end;i++)
#define min_heap priority_queue<int, vector<int>, greater<int> >
#define max_heap priority_queue<int>
#define eb emplace_back

bool isPrime(int n)
{
    for(int i=2; i*i<=n; i++)
    {
        if(n%i==0) return false;
    }
    return true;
} //returns true if prime!


int main()
{
    fast;
//int t=0,tc=0; cin >> tc; f(t,1,tc) //testcases
    {
        int n; cin >> n;
        int i = (n%1000);
        if(i>0) i = 1000-i;
        cout << i;
    }
    return 0;
}
    

Measured memory_bytes: 3608
object Main{
  def main(args: Array[String]): Unit={
    val in = readLine.split(" ").map(_.toInt) 
    val n = in(0)
    val a = in(1)
    val b = in(2)
    
    val s = readLine()
    var cnt=0
    var cntb=0
    for(i <- 0 to n-1){
      if(s(i) == 'a'){
        if(a+b > cnt){
          println("Yes")
          cnt+=1
        }
        else{
          println("No")
        } 
      }
      else if(s(i) =='b'){
        if(cnt < (a+b) && cntb < b){
          println("Yes")
          cnt+=1
        }
        else println("No")
        cntb+=1
      }
      else println("No")
    }
  }
}

Measured memory_bytes: 36836
// https://atcoder.jp/contests/abc141/tasks/abc141_c
#include <bits/stdc++.h>
using namespace std;

int main(void){
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> members(N, K);
  for (int i = 0; i < Q; i++){
    int A;
    cin >> A;
    members[A-1] += 1;
  }

  for (int i = 0; i < N; i++){
    string ans = "Yes";
    if (members[i] <= Q){
      ans = "No";
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1024
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

#define MAXN 200001

int maxint = ~0U>>1;
int flow;
int pi[MAXN+1], v[MAXN+1];
int S, T;

struct etype
{
	int t, c;
	etype* next;
	etype* pair;
	etype(){next=0;}
	etype(int _t, int _c, etype* _n){t=_t, c=_c, next=_n;}
}*e[MAXN+1], *eb[MAXN+1], *Pe, *Pool;

int aug(int w, int lim)
{
	int t;
	v[w] = 1;
	if(w == T)
	{
		flow += lim;
		return lim;
	}
	for(etype *& i=e[w]; i; i = i->next)
		if(i->c && !v[i->t] && pi[w] == pi[i->t] + 1)
			if(t = aug(i->t, min(lim, i->c)))
				return i->c -= t, i->pair->c += t, t;
	return 0;
}

bool fix()
{
	int t = maxint;
	for(int i = S; i <= T; i++)
		if(v[i])
		{
			for(etype *j = eb[i]; j; j = j->next)
				if(j->c && !v[j->t])
					t = min(t, pi[j->t] + 1 - pi[i]);
		}
	if(t == maxint)
		return 0;

	for(int i = S; i <= T; i++)
		if(v[i])
			e[i] = eb[i], pi[i] += t;
	return 1;
}

void addedge(int s, int t, int c)
{
	++Pe;
	Pe->t = t, Pe->c = c, Pe->next = e[s];
	e[s] = Pe;
	++Pe;
	Pe->t = s, Pe->c = 0, Pe->next = e[t];
	e[t] = Pe;
	e[s]->pair=e[t];
	e[t]->pair=e[s];
}

void prepare()
{
	if(Pool == NULL)
		Pool = new etype[1000001];
	Pe = Pool;
	memset(e, 0, sizeof(e));
}

int MaxFlow()
{
	flow = 0;
	memcpy(eb, e, sizeof(e));
	memset(pi, 0, sizeof(pi));
	do
	{
		do
		memset(v, 0, sizeof(v));
		while(aug(S, maxint));
	}
	while(fix());
	return flow;
}

/*  Note
	1. Set maxNodes here: #define MAXN 200001
	2. Set maxEdges here: Pool = new etype[1000001];
	3. S must be the min id, T must be the max id
*/

/*  Eaxmple
	prepare();
	S = 1, T = 2;
	addedge(1, 2, 3);
	cout << MaxFlow() << endl;
*/

int n, m;
int inId(int x, int y)
{
	x --;
	y --;
	return (x * m + y) + 2;
}
int outId(int x, int y)
{
	x --;
	y --;
	return (x * m + y + n*m) + 2;
}

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

bool onBoard(int x, int y)
{
	if(x < 1 || y < 1) return false;
	if(x > n || y > m) return false;
	return true;
}

int MAIN()
{
	cin >> n >> m;
	S = 1;
	T = 2*n*m+10;
	prepare();
	for(int i = 1; i <= n; i++)
	{
		string str;
		cin >> str;
		for(int j = 1; j <= m; j++)
		{
			char c = str[j-1];
			int x = i;
			int y = j;
			if(c == 'X')
			{
				addedge(inId(x, y), outId(x, y), 1000000);
				addedge(S, outId(x, y), 1000000);
			}
			else
			{
				addedge(inId(x, y), outId(x, y), 1);	
			}
			for(int f = 0; f < 4; f++)
			{
				int nx = x + dx[f];
				int ny = y + dy[f];
				if(onBoard(nx, ny))
				{
					addedge(outId(x, y), inId(nx, ny), 1000000);
				}
				else
				{
					addedge(outId(x, y), T, 1000000);
					if(c == 'X')
					{
						cout << -1 << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << MaxFlow() << endl;
	return 0;
}

int main()
{
	int start = clock();
	#ifdef LOCAL_TEST
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios :: sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int ret = MAIN();
	#ifdef LOCAL_TEST
		cout << "[Finished in " << clock() - start << " ms]" << endl;
	#endif
	return ret;
}


Measured memory_bytes: 28416
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (ll i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	int N;
	cin >> N;
	string ans;
	if (N <= 999) {
		ans = "ABC";
	}
	else {
		ans = "ABD";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long  MOD=998244353;
long long  binary_exp(long long  a,long long  b)
{
  long long  ans=1;
  while(b>0)
  {
    if(b&1)
    {
      ans=((ans*a))%MOD;
    }
    a=(a*a)%MOD;
    b=b>>1;

  }
  return ans%MOD;
}
map<pair<int,int> ,int> mp;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  T=1;
  while(T--)
  {
    int l,r,d;
    cin>>l>>r>>d;
    int k=l/d;
    int ans=(r/d)-k;
    if(k*d==l)
    {
      ans++;
    }
    cout<<ans<<endl;
  }
   return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
 
#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    int tmp;
    int b4,b2,b1 ;
    b4 = 0;
    b2 = 0;
    b1 = 0;
    rep(i,n) {
        cin >> tmp;
        if(tmp%4 == 0){
            b4++;
        }else if(tmp % 2 == 0){
            b2++;
        }else{
            b1++;
        }
    }

    if(b2>0)b1++;
    if(b1 <= b4+1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int N;

int main(){
    cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];

    ll mn = LINF;
    int mni = -1;
    ll mx = -LINF;
    int mxi = -1;

    for(int i=0;i<N;i++){
        if(mn > a[i]){
            mn = a[i];
            mni = i;
        }
        if(mx < a[i]){
            mx = a[i];
            mxi = i;
        }
    }

    vector<pii> ans;
    if(mn < 0 and mx > 0){
        if(mx >= abs(mn)){
            for(int i=0;i<N;i++){
                if(a[i] < 0){
                    a[i] += mx;
                    ans.push_back(pii(i,mxi));
                }
            }
        }else{
            for(int i=0;i<N;i++){
                if(a[i] > 0){
                    a[i] += mn;
                    ans.push_back(pii(i,mni));
                }
            }
        }
    }

    ll t = [&]() -> ll {
        for(int i=0;i<N;i++) if(a[i] != 0)return a[i];
        return 0;
    }();
    if(t >= 0){
        for(int i=0;i+1<N;i++){
            ans.push_back(pii(i+1,i));
        }
    }else{
        for(int i=N-1;i-1>=0;i--){
            ans.push_back(pii(i-1,i));
        }
    }

    cout << ans.size() << endl;
    for(int i=0;i<ans.size();i++){
        cout << ans[i].second + 1 <<  " " << ans[i].first + 1 << endl;
    }
}


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

using namespace std;
typedef long long int ll;

int main(){

    ll N, K; cin >> N >> K;

    map<ll, ll> mp;
    for(ll i = 0; i < K; i++){
        ll t = 0; cin >> t;
        mp[t] = 1;
    }

    bool f = true;
    
    for(;;){
        f = true;
        ll t = N;
        while(t != 0){
            //cout << t % 10 << endl;
            if(mp[t % 10] == 1 ){
                f = false;
                break;
            }
            t /= 10;
        }
        if(f == true){
            break;
        }
        N++;
    }

    cout << N << endl;
}

Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    a = int(readline())
    b = int(readline())
    for i in range(1, 4):
        if a != i and b != i:
            print(i)
            exit()


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38384
N, X = input().split()
N = int(N)
X = int(X)

mList = []
require = 0
for i in range(N):
    m = int(input())
    require = require + m
    mList.append(m)

result = len(mList)
X = X - require

sortedList = sorted(mList)
print(result + (X // sortedList[0]))

Measured memory_bytes: 3064
a = [list(map(int, input().split())) for _ in range(3)]
is_bingo = [[False]*3 for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i, ai in enumerate(a):
        for j, aii in enumerate(ai):
            if aii == b:
                is_bingo[i][j] = True
is_bingo_flat = [j for i in is_bingo for j in i]
for i in range(3):
    if all(is_bingo[i]) or all(list(zip(*is_bingo))[i]):
        print("Yes")
        break
else:
    if all(is_bingo_flat[::4]) or all(is_bingo_flat[2:7:2]):
        print("Yes")
    else:
        print("No")

        

Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int ans[501][501] = {};

void solve(int l, int r, int revel)
{
	if(r - l <= 1) return;
	int mid = (l + r) / 2;
	for(int i = l; i < mid; i++){
		for(int j = mid; j < r; j++){
			ans[i][j] = revel;
		}
	}
	solve(l, mid, revel + 1);
	solve(mid, r, revel + 1);
}

int main()
{
	int n;
	cin >> n;
	solve(0, n, 1);
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			cout << ans[i][j];
			if(j == n - 1) cout << endl;
			else cout << " ";
		}
	}
}

Measured memory_bytes: 1408