akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
int cost[10000],skill[10000][20];
int c[30],a[30][30];
signed main(){
    int n,m,x;
    cin>>n>>m>>x;
    rep(i,n){
        cin>>c[i];
        rep(j,m)cin>>a[i][j];
    }
    rep(i,1<<n){
        rep(j,12){
            if(i&(1<<j)){
                cost[i]+=c[j];
                rep(k,m){
                    skill[i][k]+=a[j][k];
                }
            }
        }
    }
    int lowcost=INF;
    rep(i,1<<n){
        bool ok=true;
        rep(j,m){
            if(skill[i][j]<x)ok=false;
        }
        if(ok)lowcost=min(lowcost,cost[i]);
    }
    if(lowcost==INF)cout<<-1<<endl;
    else cout<<lowcost<<endl;
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

template <class T>  inline void smax(T &x,T y){ x = max((x), (y)); }
template <class T>  inline void smin(T &x,T y){ x = min((x), (y)); }

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

int a[55] ;

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d",&n) ;
    j = 1 ;
    for(i=1; i<=n ; i++)
    {
        scanf("%d",&a[i]) ;
        if( abs(a[j] ) < abs(a[i]) ) j = i ;
    }

    printf("%d\n",2*n-1) ;
    for(i=1 ; i<=n ; i++) printf("%d %d\n",j,i) ;

    if( a[j]<0 )
    {
        for(i=n-1; i>=1 ; i--) printf("%d %d\n",i+1,i) ;
    }
    else{
        for(i=2 ; i<=n ; i++) printf("%d %d\n",i-1,i) ;
    }

    return 0 ;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int qsort_compare(const void *a, const void *b)
{
	return(*(int *)a - *(int *)b);
}

int main(int argc, char *argv[])
{
	int n, k;
	int i;
	int delta_min, delta;

	int *h;

	scanf("%d %d", &n, &k);
	h = (int *) malloc(100000 * sizeof(int));

	for (i = 0; i < n; i++) {
		scanf("%d", &h[i]);
	}

	qsort(h, n, sizeof(int), qsort_compare);

	delta_min = INT_MAX;
	for (i = 0; i < n - (k - 1); i++) {
		delta = h[i + k - 1] - h[i];
		if (delta < delta_min) {delta_min = delta;}
	}

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

	free(h);
	return(0);
}


Measured memory_bytes: 892
n = int(input())
a = []
A = input().split()
f = False
for i in range(n):
    a.append(int(A[i]))
    if int(A[i]) % 2 != 0:
        f = True
ans = 0

if f:
    print(ans)
else:
    while True:
        #print (a)
        for i in range(len(a)):
            nx = int(a[i])
            if nx % 2 != 0:
                f = True
            a[i] = nx / 2
        if f:
            #print (a)
            break
        else:
            ans += 1
    print(ans)

Measured memory_bytes: 3064
/*
 * Soltuion 1 in https://img.atcoder.jp/abc144/editorial.pdf 
 */

#include <iostream>
#include <cmath>

using namespace std;

double calc_water_volume(double a, double b, double theta) {
    if (tan(theta) < b / a) {
        return (a * (a * b - (a * a * tan(theta)) / 2.0));
    } else {
        return ((a * b * b / tan(theta)) / 2.0);
    }
}

int main(void) {
    double a, b, x;

    cin >> a >> b >> x;

    double left = 0.0, right = 90.0, mid;
    while (right - left > 0.000001) {
        mid = (left + right) / 2.0;
        double theta = mid * M_PI / 180.0;
        double v = calc_water_volume(a, b, theta);
        if (v < x) {
            right = mid;
        } else {
            left = mid;
        }
    }

    printf("%3.7f\n", left);

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl '\n'
#define pb push_back
#define ff first
#define ff first
#define ss second
#define mod 998244353 
#define inf 4e18
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define mx 500005


int main() {
	fast;
	string str = "ACL";
	int k; cin >> k;
	while (k-1 != 0) {
		string str2 = "ACL";
		str.append(str2);
		k--;
	}
	cout << str << endl;
}

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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll A, B, C;
string s, t;
// 最大公約数
long long gcd(long long a, long long b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}
int main(){
	cin >> A >> B;
	if(A<B){
		swap(A,B);
	}
	p(A*B/gcd(A, B));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;

int main()
{
    char b;
    std::cin >> b;
    if (b == 'A') {
        std::cout << 'T' << std::endl;
    } else if (b == 'T') {
        std::cout << 'A' << std::endl;
    } else if (b == 'G') {
        std::cout << 'C' << std::endl;
    } else if (b == 'C') {
        std::cout << 'G' << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
ll pref_sum[3000][3000] , dp[3000][3000];
int a[3000];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    if(n==1)
    {
        cout<<a[0]<<endl;
        return 0;
    }
    memset(pref_sum,0,sizeof(pref_sum));
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++)
    {
        pref_sum[i][i]=a[i];
        dp[i][i]=a[i];
        for(int j=i+1;j<n;j++)
            pref_sum[i][j] = pref_sum[i][j-1] + a[j];
    }
    int i=0,j=1;
    int jstart=1;
    while( !(i==0 && j==n-1))
    {
        dp[i][j] = pref_sum[i][j] - min(dp[i][j-1] , dp[i+1][j]);
        i++;
        j++;
        if(j==n)
        {
            i=0;
            jstart++;
            j=jstart;
        }

    }
    ll scoreB=min(dp[0][n-2] , dp[1][n-1]);
    ll scoreA=pref_sum[0][n-1] - scoreB;
    cout<<scoreA-scoreB<<endl;
}


Measured memory_bytes: 140928
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	static InputStreamReader in = new InputStreamReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws Exception {
		try (BufferedReader br = new BufferedReader(in)) {
			String[] s = br.readLine().split(" ");
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			int c = Integer.parseInt(s[2]);
			int d = Integer.parseInt(s[3]);
			while (true) {
				c -= b;
				if (c <= 0) {
					out.println("Yes");
					break;
				}
				a -= d;
				if (a <= 0) {
					out.println("No");
					break;
				}
			}
			out.flush();
		}
	}
	
}

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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int h = sc.nextInt();
        int w = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int[][] ans = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (i < b && j >= a)
                    pw.print("1");
                else if (i >= b && j < a)
                    pw.print("1");
                else
                    pw.print("0");
            }
            pw.println();
        }

        pw.close();
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 27724
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
using namespace std;

long long mod_prod(long long a, long long b) {
	long long ret;
	ret = (a * b) % 1000000007;
	return ret;
}

long long N, C[200000], D[200000];
long long pos;
long long ans_1[200000], ans_2[200000], sum[200000];
int main(void) {
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &C[i]);
	}
	pos = 1;
	D[0] = C[0];
	for (int i = 1; i < N; i++) {
		if (C[i] != C[i - 1]) {
			D[pos] = C[i];
			pos++;
		}
	}
	for (int i = 0; i < 200000; i++) {
		sum[i] = 0;
	}
	ans_1[0] = 1;
	ans_2[0] = 0;
	sum[D[0]] = 1;
	for (int i = 1; i < pos; i++) {
		ans_1[i] = (ans_1[i - 1] + ans_2[i - 1]) % 1000000007;
		ans_2[i] = sum[D[i]];
		sum[D[i]] = (sum[D[i]] + ans_1[i]) % 1000000007;
		//printf("%lld %lld %lld\n", ans_1[i], ans_2[i], sum[D[i]]);
	}
	printf("%lld\n", (ans_1[pos - 1] + ans_2[pos - 1]) % 1000000007);
}

Measured memory_bytes: 8064
n, m = map(int, input().split(' '))
graph = []
for i in range(n):
    graph.append([0] * n)
for i in range(m):
    a, b = map(int, input().split(' '))
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1


def dfs(v,n,visited):
    all_visited = True

    for i in range(n):
        if visited[i] == False:
            all_visited = False

    if all_visited:
        return 1

    ret = 0

    for i in range(n):
        if not graph[v][i]:
            continue
        if visited[i]:
            continue
        visited[i] = 1
        ret += dfs(i,n,visited)
        visited[i] = 0

    return ret

def main():
    visited = []
    for i in range(n):
        visited.append(0)
    visited[0] =1
    print((dfs(0,n,visited)))



if __name__ == '__main__':
    main()


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

#define tt template<typename T> ostream& operator <<(ostream& os, const
#define tuv template<typename U, typename V> ostream& operator<<(ostream& os, const
tt vector<T>& v)            { os << "["; for(auto & x : v) os << " " << x; os << " ]"; return os; }
tt vector<vector<T> >& m)   { for(auto & x : m) { for(auto & y : x) os << y << " "; os << "\n"; } return os; }
tt set<T>& s)               { os << "{"; for(auto & x : s) os << " " << x; os << " }"; return os; }
tt unordered_set<T>& s)     { os << "{"; for(auto & x : s) os << " " << x; os << " }"; return os; }
tt queue<T>& q)             { queue<T> q2(q); while(!q2.empty()) { os << q2.front() << " "; q2.pop(); } return os; }
tt stack<T>& s)             { stack<T> s2(s); while(!s2.empty()) { os << s2.top() << " "; s2.pop(); } return os; }
tuv pair<U,V>& p)           { os << "(" << p.first << "," << p.second << ")"; return os; }
tuv map<U,V>& m)            { os << "{ "; for(auto & x : m) os << x.first << ":" << x.second << " "; os << "}"; return os; }
tuv unordered_map<U,V>& um) { os << "{ "; for(auto & x : um) os << x.first << ":" << x.second << " "; os << "}"; return os; }


int main(int argc, char * argv[])
{
    std::ios_base::sync_with_stdio(false);    
    std::cin.tie(NULL);

    string s;
    std::cin >> s;

    if(s.size() == 6 && s[2] == s[3] && s[4] == s[5])
    {
	std::cout << "Yes" << std::endl;
    }
    else
    {
	std::cout << "No" << std::endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main (void)
{
	int a, b, c;
	std::cin >> a >> b >> c;
	
	if (a<=b && b<=c)
	{
		std::cout << a << " " << b << " " << c <<std::endl;
	}

	else if (a<=c && c<=b)
	{
		std::cout <<a  << " " << c   << " " << b <<std::endl;
	}
	
	else if (b<=a && a<=c)
	{
		std::cout << b << " " << a << " " << c <<std::endl;
	}
	
	else if (b<=c && c<=a)
	{
		std::cout << b << " " << c << " " << a <<std::endl;
	}
	
	else if (c<=a && a<=b)
	{
		std::cout << c << " " << a << " " << b <<std::endl;
	}
	
	else if (c<=b && b<=a)
	{
		std::cout << c << " " << b << " " << a <<std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 3096
#include <cstdio>
#include <cstring>

const int MAXN=2e5+5;
int n;
int a[MAXN];
char s[MAXN];

inline int chr_idx(char c){return c-'a';}

template<class T>
long long mge_sort(T a[],int l,int r){
	static T tmp[MAXN];
	if(l==r) return 0;
	int mid=l+r>>1;
	long long ret=mge_sort(a,l,mid)+mge_sort(a,mid+1,r);
	int lp=l,rp=mid+1,cur=l-1;
	while(lp<=mid && rp<=r){
		if(a[lp]<=a[rp]) tmp[++cur]=a[lp++];
		else{
			ret+=mid-lp+1;
			tmp[++cur]=a[rp++];
		}
	}
	while(lp<=mid) tmp[++cur]=a[lp++];
	while(rp<=r) tmp[++cur]=a[rp++];
	memcpy(a+l,tmp+l,(r-l+1)*sizeof(T));
	return ret;
}

inline void deal(){
	static int pos[26],pre[MAXN],nex[MAXN];
	static bool use[MAXN];
	memset(pos,-1,sizeof(pos));
	for(int i=n;i;--i){
		nex[i]=pos[chr_idx(s[i])];
		pos[chr_idx(s[i])]=i;
	}
	memset(pos,-1,sizeof(pos));
	for(int i=1;i<=n;++i){
		pre[i]=pos[chr_idx(s[i])];
		pos[chr_idx(s[i])]=i;
	}
	for(int i=1,x,y;i<=n;++i){
		if(use[i]) continue;
		x=i,y=pos[chr_idx(s[i])];
		while(y!=-1){
			a[n-x+1]=y;
			use[x]=true;
			x=nex[x],y=pre[y];
		}
	}
}

inline bool spj(){
	static int cnt[26];
	for(int i=1;i<=n;++i)
		++cnt[chr_idx(s[i])];
	int tot=0;
	for(int i=0;i<26;++i){
		if(cnt[i]&1) ++tot;
	}
	return tot==(n&1);
}

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	if(!spj()){
		printf("-1");
		return 0;
	}
	deal();
	printf("%lld",mge_sort(a,1,n)>>1);
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<int> v(N),used(N,-1);
  for(int i=0;i<N;i++)cin>>v[i];
  int fans=0;
  for(int k=1;k<=N;k++){
    int ans=0;
    for(int j=k;j<N-1-k;j+=k){
      ans+=v[j];ans+=v[N-1-j];
      if(used[j]==k)break;used[j]=k;
      if(used[N-1-j]==k)break;used[N-1-j]=k;
      fans=max(ans,fans);
    }
  }
  cout<<fans<<endl;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;

	int i;

	bool sameflag = true;

	string s;

	cin >> n;

	cin >> s;

	if (n % 2 == 1)
		sameflag = false;

	for (i = 0; i < n / 2; i++)
	{
		if (s[i] != s[n / 2 + i])
		{
			sameflag = false;
		}
	}

	if (sameflag == true)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(5);
    REP(i, 5)
    {
        cin >> a[i];
    }
    ll min = *min_element(ALL(a));
    ll res = 5 + (n / min - 1);
    // dump(n / min);
    // dump(n % min);
    if (n % min > 0)
    {
        res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
/*
    If they say
    Who cares if one more light goes out?
    In a sky of a million stars
    It flickers, flickers
    Who cares when someone's time runs out?
    If a moment is all we are
    We're quicker, quicker
    Who cares if one more light goes out?
    Well I do
*/

#include<bits/stdc++.h>
using namespace std;

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) ((a) / gcd(a,b)) * (b)
#define all(x)  x.begin(),x.end()

#define ll long long
#define ull unsigned long long
#define VI vector<int>
#define VLL vector<ll>
#define VS vector<string>
#define MPII map<int, int>
#define SET set<int>
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io   ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);

ll MOD = 1e9+7;

ll add(ll a, ll b)
{
    a+=b; a%=MOD;
    if(a<0) a+=MOD;
    return a;
}
ll mult(ll a, ll b)
{
    if(a>MOD) a%=MOD;
    if(b>MOD) b%=MOD;
    ll ans=(a*b)%MOD;
    if(ans<0) ans+=MOD;
    return ans;
}
ll pw(ll a, ll b)
{
    ll r=1;
    while(b){
        if(b&1) r=mult(r,a);
        a=mult(a,a);
        b>>=1;
    }
    return r;
}

void solve(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll d=a;
    if(a%2==0 && b%2==0 && c==0) cout<<"YES"<<endl;
    else{
        ll tmp = a%b;
        while(a%b!=c){
            a+=d;
            //cout<<a<<" "<<a%b<<endl;
            if(a%b==tmp){cout<<"NO"<<endl;return;}
        }
        cout<<"YES"<<endl;
    }
}

int main(){
    fast_io;
    ll t, k=0;
    t=1;
    while(t--){
        //k++;
        //cout<<"Case "<<k<<": ";
        solve();
    }
}



Measured memory_bytes: 3600
//
// Created by kira09 on 05/03/20.
//


#include "bits/stdc++.h"

using namespace std;

#define IOS cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;


int main() {
    IOS

    int n; cin>>n;
    cout<<ceil((ld)n/2.0);
   

}

Measured memory_bytes: 256
require 'set'; require 'prime'
INF=Float::INFINITY
h,w,n = gets.chomp.split.map(&:to_i)
hash = {}
hash.default = 0
zero = (h-2)*(w-2)
n.times do
  a,b = gets.split.map(&:to_i)
  (-1).upto(1).each do |i|
    (-1).upto(1).each do |j|
      aa=a+i-1
      bb=b+j-1
      if 0 < aa && aa < h-1 && 0 < bb && bb < w-1
        hash["#{aa},#{bb}"] += 1
      end
    end
  end
  #p hash
end

ans=Array.new(10,0)
hash.each do |k,v|
  ans[v] += 1
  zero -= 1
end
ans[0] = zero

ans.each do |e|
  puts e
end


Measured memory_bytes: 130844
using System;
using System.Linq;
namespace _2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if(x[0]>x[1])
            {
                Console.WriteLine("a > b");
            }
            else if (x[0] < x[1])
            {
                Console.WriteLine("a < b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
        }
    }
}

Measured memory_bytes: 9356
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int cnt = 0;
  for(int i=0;i<=A;i++){
    for(int j=0;j<=B;j++){
      for(int k=0;k<=C;k++){
        if(500*i+100*j+50*k==X){
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,M,A[10];cin>>N>>M;
    char a[10];
    for(int i=0;i<M;i++)cin>>A[i];
    sort(A,A+M,greater<int>());
    for(int i=0;i<M;i++)a[i]='0'+A[i];

    map<int,int> mp;
    mp[1]=2;mp[2]=5;mp[3]=5;mp[4]=4;mp[5]=5;mp[6]=6;mp[7]=3;mp[8]=7;mp[9]=6;

    int c[10];
    for(int i=0;i<M;i++)c[i]=mp[A[i]];
    sort(c,c+M);

    string dp[10010];

    //初期化
    for(int i=1;i<c[0];i++)dp[i]="Impossible";
    //漸化式
    for(int i=c[0];i<=N;i++){
        if(i-mp[A[0]]>=0&&dp[i-mp[A[0]]]!="Impossible")dp[i]=a[0]+dp[i-mp[A[0]]];
        else                                           dp[i]="Impossible";
        for(int m=1;m<M;m++){
            if(i-mp[A[m]]>=0&&dp[i-mp[A[m]]]!="Impossible"){ 
                if(dp[i]=="Impossible")
                    dp[i]=a[m]+dp[i-mp[A[m]]];
                else{
                    if(dp[i-mp[A[m]]].size()>dp[i].size()-1)
                        dp[i]=a[m]+dp[i-mp[A[m]]];
                }
            }    
        }
    }

    cout<<dp[N]<<endl;
    return 0;

}

Measured memory_bytes: 32896
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  int sx, sy, gx, gy;
  cin >> sx >> sy >> gx >> gy;
  sx--;
  sy--;
  gx--;
  gy--;
  vector<string> in(h);
  for (int i = 0; i < h; i++) cin >> in[i];

  vector<vector<int>> dist(4, vector<int>(h * w, 1 << 30));
  priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> que;
  for (int i = 0; i < 4; i++) dist[i][sx * w + sy] = 0;
  que.push({0, sx * w + sy, 0});
  que.push({0, sx * w + sy, 1});
  que.push({0, sx * w + sy, 2});
  que.push({0, sx * w + sy, 3});
  while (que.size()) {
    auto pos = que.top()[1];
    auto d = que.top()[0];
    auto dir = que.top()[2];
    que.pop();
    if (dist[dir][pos] < d) continue;
    for (int i = 0; i < 4; i++) {
      int x = pos / w;
      int y = pos % w;
      int xx = x + dx[i];
      int yy = y + dy[i];
      if (xx < 0 || xx >= h || yy < 0 || yy >= w || in[xx][yy] == '@') continue;
      int pp = xx * w + yy;
      if (i == dir) {
        int dd = d + 1;
        if (dist[dir][pp] > dd) {
          dist[dir][pp] = dd;
          que.push({dist[dir][pp], pp, dir});
        }
      } else {
        xx = x;
        yy = y;
        pp = xx * w + yy;
        int dd = (d + k - 1) / k * k;
        if (dist[i][pp] > dd) {
          dist[i][pp] = dd;
          que.push({dist[i][pp], pp, i});
        }
      }
    }
  }
  int ans = 1 << 30;
  for (int i = 0; i < 4; i++) {
    //cerr << dist[i][gx * w + gy] << endl;
    if (dist[i][gx * w + gy] == 1 << 30) continue;
    ans = min(ans, (dist[i][gx * w + gy] + k - 1) / k);
  }
  cout << (ans == 1 << 30 ? -1 : ans) << endl;
  return 0;
}


Measured memory_bytes: 34204
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6
 
 
 
int main(){
	fast;
	lli k, n;
	cin>>k>>n;
	vector<lli> v(n);
	vector<lli> diff;
	for(lli i=0 ; i<n; i++){ cin>>v[i]; if(i>0) diff.pb(v[i]-v[i-1]);}
	diff.pb(k+v[0]-v[n-1]);
	lli sum1=0, m=0;
	for(lli i=0; i<n; i++){sum1+=diff[i]; m = max(diff[i], m);}
	cout<<(sum1-m);
	return 0;
}

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

int main(){
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if(a==0){
        cout << 1;
    }
    if(b==0){
        cout << 2;
    }
    if(c==0){
        cout << 3;
    }
    if(d==0){
        cout << 4;
    }
    if(e==0){
        cout << 5;
    }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,x,y,f[500010],hed[500010],too[500010],nxt[500010],nedge;
void ae(int x,int y){
	nxt[++nedge]=hed[x];
	hed[x]=nedge;
	too[nedge]=y;
}
void dfs(int x,int l){
	for (int i=hed[x];i;i=nxt[i]){
		int y=too[i];
		if (y==l) continue;
		dfs(y,x);
		f[x]^=f[y]+1;
	}
}
int main(){
	cin>>n;
	FOR(i,2,n){
		getint(x),getint(y);
		ae(x,y),ae(y,x);
	}
	dfs(1,0);
	puts(f[1]?"Alice":"Bob");
	return 0;
}


Measured memory_bytes: 9984
sum1, sum2, count = 0, 0, 0
while line = gets
    x, y = line.chomp.split(",").map(&:to_i)
    sum1 += x * y
    sum2 += y
    count += 1
end
puts sum1
puts ((sum2.to_f / count) + 0.5).to_i


Measured memory_bytes: 6860
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);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            String S = in.next();
            String T = in.next();
            int a = in.nextInt();
            int b = in.nextInt();
            String U = in.next();
            if (U.equals(S))
            {
                a--;
            } else
            {
                b--;
            }
            out.print(a + " " + b);
        }

    }
}



Measured memory_bytes: 21204
N=list(input())

plus_minus=["+","-"]
for i in range(len(N)-2):
    a=[]
    for j in plus_minus:
        a.append(j+"+")
        a.append(j+"-")
    plus_minus=a

for i in plus_minus:
    sign=list(i)
    sumation=int(N[0])
    for j in range(len(N)-1):
        if(sign[j]=="+"):
            sumation+=int(N[j+1])
        elif(sign[j]=="-"):
            sumation-=int(N[j+1])
        else:
            print("sdfds")
    if(sumation==7):
        answer_sign=i
        break
dis=""
for i in range(len(answer_sign)):
    dis+=N[i]
    dis+=answer_sign[i]
dis+=N[-1]+"=7"
print(dis)

Measured memory_bytes: 3064
a,b,c,d = map(int,input().split())

total = b - a + 1

def lem(A,B):
	AB = A * B
	while B != 0:
		A,B = B,A%B
	return AB // A

bsep = (b // c) + (b // d) - (b // lem(c,d))
asep = (a-1) // c + (a-1) // d - (a-1) // lem(c,d)

ans = total - bsep + asep
print(ans)
	



Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int N = sc.nextInt();
			if (N == 0) {
				return;
			}
			char card[] = sc.next().toCharArray();
			int slave = 0;
			int turn = 0;
			int p[] = new int[N];
			for (int i = 0; i < 100; i++) {
				turn = i % N;
				switch (card[i]) {
				case 'M':
					p[turn]++;
					break;
				case 'S':
					p[turn]++;
					slave += p[turn];
					p[turn] = 0;
					break;
				case 'L':
					p[turn]++;
					p[turn] += slave;
					slave = 0;
					break;
				default:
					break;
				}
			}
			Arrays.sort(p);
			for(int i=0;i<N;i++) {
				System.out.print(p[i]+" ");
			}
			System.out.println(slave);
		}

	}

}

Measured memory_bytes: 21972
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	Scanner sc = new Scanner(System.in);
	public void run(){
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			calc(n);
		}
	}
	public void calc(int n){
		String[] name = new String[50];
		for(int i = 0; i < n; i++){
			String line = sc.next();
			
			int before = 1;
			
			for(int j = 0; j < line.length(); j++){
				String s = line.substring(j, j+1);
				if(before == 1){
					if(name[i] == null) name[i] = s;
					else name[i] = name[i] + s;
					before = 0;
				}
				if(s.equals("a") || s.equals("i") || s.equals("u") || 
						s.equals("e") || s.equals("o")){
					before = 1;
				}
			}
		}
		
		int k = 1;
		
		for(int i = 0; i < n; i++){
			for(int j = i+1; j < n; j++){
				if(name[i].equals(name[j])){
					k = -1;
					break;
				}
				while(true){
					String si, sj;
					if(k > name[i].length()) si = name[i];
					else si = name[i].substring(0, k);
					if(k > name[j].length()) sj = name[j];
					else sj = name[j].substring(0, k);
					
					if(si.equals(sj)) k += 1;
					else break;
				}	
			}
			if(k == -1) break;
		}
		
		System.out.println(k);
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
}

Measured memory_bytes: 41992
#include <stdio.h>
int main(void){
    int N;
    int i;
    int a[50];
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
        scanf("%d",&a[i]);
    }
    int max=0;
    int count=0;
    for(i=0;i<N;i++)
    {
        if(max<=a[i])
        {
            max=a[i];
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define PI 3.141592653

void solve() 
{
    int n;
    scanf("%d",&n);
    if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9)
        printf("hon\n");
    else if(n%10==0 || n%10==1 || n%10==6 || n%10==8)
        printf("pon\n");
    else printf("bon\n");
    
}  
int main(){
    int t;
    // scanf("%d",&t);
    // while(t--){
        solve();
    // }
    return 0;
}

Measured memory_bytes: 1624
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    int ans = 0;
    if (B > C && A < D) {
      ans = Integer.min(B, D) - Integer.max(A, C);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include<stdio.h>
int main() {
  int i, k, n, m, x, data[100], data2[100][100], data3[100] = {0};
  scanf("%d %d", &n, &m);
  for(i = 0; i < m; i++) {
    scanf("%d", &data[i]);
  }
  for(i = 0; i < m; i++) {
    for(k = 0; k < n; k ++) {
      scanf("%d", &data2[i][k]);
    }
  }
  for(i = 0; i < m; i++) {
    x = 0;
    for(k = 0; k < n; k++) {
      if(data[i] == data2[i][k]) {
        data3[k]++;
        if(k == 1) {
        }
      }else{
        data3[data[i] - 1]++;
      }
    }
  }
  for(i = 0; i < n ; i++) {
    printf("%d\n",data3[i]);
  }
  return 0;
}

Measured memory_bytes: 1064
N=int(input())
array=[int(x) for x in input().split()]
dict={}
for i in array:
	if i in dict:
		dict[i]+=1
	else:
		dict[i]=1
total=sum(array)
for i in range(int(input())):
	A,B=[int(x) for x in input().split()]
	if A not in dict:
		dict[A]=0
	if B not in dict:
		dict[B]=0
	total=total-A*dict[A]+B*(dict[A])
	dict[B]=dict[B]+dict[A]
	dict[A]=0
	print(total)
	

Measured memory_bytes: 93756
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<string, int> ss;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ss[s]++;
    }
    int maxi = 0;
    vector<string> ret;
    for (auto &p : ss) {
        if (p.second > maxi) {
            ret.clear();
            ret.push_back(p.first);
            maxi = p.second;
        } else if (p.second == maxi)
            ret.push_back(p.first);
    }
    sort(ret.begin(), ret.end());
    for (auto &r : ret) {
        cout << r << "\n";
    }
    return 0;
}

Measured memory_bytes: 25584
from bisect import bisect_left as bl

n, m, q = map(int, input().split())
lst = [i for i in range(n)]
alst = list(map(int, input().split()))
ind = 0
for a in alst:
  if a % 2 == 0:
    ind += a
  else:
    ind -= a
  ind = ind % len(lst)
  lst.pop(ind)
  ind = ind % len(lst)

qlst = list(map(int, input().split()))
for q in qlst:
  print(int(q in lst))



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

using namespace std;
//int d[5500][5500];

int main(){

	int n,m;
	scanf("%d%d",&n,&m);
	vector<int> d[n+10];
	for(int i = 0;i < n+5;i++)d[i].resize(i+10);
	for(int i = 0;i < n+5;i++)
		for(int j = 0;j < i+1;j++)
			d[i][j] = 0;
	 
	for(int i = 0;i < m;i++){
		int a,b,x;
		scanf("%d%d%d",&a,&b,&x);

		d[a][b]++;
		d[a][b+1]--;
		d[a+x+1][b]--;
		d[a+x+2][b+1]++;
		d[a+x+1][b+x+2]++;
		d[a+x+2][b+x+2]--;
	}

	for(int i = 0;i <= n;i++){
		for(int j = 1;j <= i+2;j++){
			d[i][j] += d[i][j-1];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 0;j <= i+2;j++){
			d[i][j] += d[i-1][j];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= i+2;j++){
			d[i][j] += d[i-1][j-1];
		}
	}
	int ans = 0;
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= i+2;j++){
			if(d[i][j] > 0)ans++;
		}
	}
	printf("%d\n",ans);

	return 0;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

ll gcd(ll x, ll y){ return y==0? x: gcd(y, x%y); }

int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, t;
	cin >>n >>t;
	VI a(n), z(n);
	rep(i, n) cin >>a[i];
	int mns = a[0], mxs=0;
	rep(i, n){
		mns = min(mns, a[i]);
		z[i] = a[i] - mns;
		mxs = max(mxs, z[i]);
	}
	
	cout << count(all(z), mxs) <<"\n";
	
	return 0;
}

Measured memory_bytes: 1024
while 1:
    N = int(input())
    if N == 0:
        break
    R = []
    c = 0
    while N:
        if c:
            if N % 10 > 0:
                R.append(10 - (N % 10))
                N += 10
            else:
                R.append(0)
        else:
            R.append(N % 10)
        c ^= 1
        N //= 10
    R.reverse()
    print(*R, sep='')



Measured memory_bytes: 5604
use std::io::*;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn read_mat<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let v = read_vec::<i64>();
    let (n,c) = (v[0] as usize,v[1]);
    let sus = read_mat::<i64>(n);
    let mut cw: Vec<i64> = vec![0];
    let mut ccw: Vec<i64> = vec![0];
    let mut cwr: Vec<(usize,i64)> = vec![(0,0)];
    let mut ccwr: Vec<(usize,i64)> = vec![(0,0)];
    let mut cw_t = 0;
    let mut ccw_t = 0;
    for i in 0..n {
        cw_t += sus[i][1];
        ccw_t += sus[n-i-1][1];

        let mut tmp = cw_t - sus[i][0];
        let cw_new = cmp::max(cw[i],tmp);
        cw.push(cw_new);

        tmp = ccw_t - (c - sus[n-i-1][0]);
        let ccw_new = cmp::max(ccw[i],tmp);
        ccw.push(ccw_new);

        if i < n / 2 {
            tmp = cw_t - 2 * sus[i][0];
            if 0 < tmp {
                cwr.push((i+1,tmp));
            }

            tmp = ccw_t - 2 * (c - sus[n-i-1][0]);
            if 0 < tmp {
                ccwr.push((i+1,tmp));
            }
        }
    }
    let cwr_max = cwr.iter().map(|x| x.1 + ccw[n - x.0]).max().unwrap();
    let ccwr_max = ccwr.iter().map(|x| x.1 + cw[n - x.0]).max().unwrap();
    let ans = cmp::max(cmp::max(cw[n],ccw[n]),cmp::max(cwr_max,ccwr_max));
    println!("{}",ans);
}


Measured memory_bytes: 16636
//Bismillahir Rahmanir Rahim. Ya Allah....
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7;
const int mx = 1e5+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    int a[n],b[m];
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=0;i<m;i++)
        cin>>b[i];
     ll bsum=0;
    int j=0,ans=0;
    for(int i=n;i>=0;i--)
    {
        if(i<n)
            sum-=a[i];
        if(sum<=k)
        {
            while(j<m&& sum+bsum+b[j]<=k)
            {
                bsum+=b[j];
                j++;
            }
            ans = max(ans,i+j);
        }
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 5180
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using Real=long double;
using Point=complex<Real>;
const Real EPS=1e-10;
const Real pi=acosl(-1);

inline bool eq(Real a,Real b){
    return fabs(a-b)<EPS;
}

Point operator*(const Point &p,const Real &d){
    return Point(real(p)*d,imag(p)*d);
}

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
  return Point(cos(theta)*p.real()-sin(theta)*p.imag(),sin(theta)*p.real()+cos(theta)*p.imag());
}

Real dis(Point a,Point b){
    return abs(a-b);
}

Real radian_to_degree(Real r){
    return r*180.0/pi;
}

Real degree_to_radian(Real d){
    return d*pi/180.0;
}
 
//三角形の面積，サラスの公式
Real area_triangle(Point a,Point b,Point c){
    Point x=b-a,y=c-a;
    return fabs(x.real()*y.imag()-x.imag()*y.real())/2;
}
 
struct Circle{
    Point center;
    Real r;
    Circle(Point center,Real r):center(center),r(r){}
};

Circle MinimumBoundingCircle(vector<Point> v){
    int n=v.size();
    
    //ランダムシャッフル．いぢわるされたくないもんだ
    mt19937 mt(time(0));
    shuffle(v.begin(),v.end(),mt);

    Circle ret(0,0);
 
    //3点で円を作る
    auto make_circle2=[&](Point a,Point b){
        return Circle((a+b)*0.5,dis(a,b)/2);
    };
 
    //3点で円を作る
    auto make_circle3=[&](Point A,Point B,Point C){
        //wikiの公式
        Real S=area_triangle(A,B,C);
        Real a=dis(B,C),b=dis(A,C),c=dis(A,B);
        Point cent=A*(a*a*(b*b+c*c-a*a)/(16*S*S))+B*(b*b*(c*c+a*a-b*b)/(16*S*S))+C*(c*c*(a*a+b*b-c*c)/(16*S*S));
        return Circle(cent,dis(cent,A));
    };
 
    auto isIn=[&](Point a){
        return dis(ret.center,a)<ret.r+EPS;
    };

    ret=make_circle2(v[0],v[1]);
    for(int i=2;i<n;i++){
        //v[i]が円に入っていないなら
        if(!isIn(v[i])){
            //円内にないなら点v[i]は必ず円周上に来る
            ret=make_circle2(v[0],v[i]);
            for(int j=1;j<i;j++){
                if(!isIn(v[j])){
                    //この時iとjが円周上を考える
                    ret=make_circle2(v[i],v[j]);
                    //最後の1点の決定
                    for(int k=0;k<j;k++){
                        if(!isIn(v[k])){
                            ret=make_circle3(v[i],v[j],v[k]);
                        }
                    }
                }
            }
        }
    }
    return ret;
}

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

    int n;cin>>n;
    vector<Point> v(n);
    rep(i,n){
        Real x,y;cin>>x>>y;
        v[i]=Point(x,y);
    }
    auto ans=MinimumBoundingCircle(v);
    cout<<ans.r<<endl;
    return 0;
}



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

int main(){
  int n;
  cin >> n;
  int v[n+10];
  for (int i =0; i<n;i++) cin >> v[i];
  int c[n+10];
  for (int i =0; i<n;i++) cin >> c[i];
  int mxy=0,val=0;
  for (int i =0; i<n;i++){
    val = v[i] - c[i];
    if (val > 0){
      mxy += val;
    }
  }
  cout << mxy;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Procon {
    static void Main (string[] agrs) {
        int N = Int ();
        int K = Int ();
        int Q = Int ();

        var P = new int[N];

        for (int i = 0; i < Q; i++) {
            var A = Int ();
            P[A - 1]++;
        }

        for (int i = 0; i < N; i++) {
            if (Q - P[i] >= K) {
                Console.WriteLine ("No");
            } else {
                Console.WriteLine ("Yes");
            }
        }
    }

    static string String () => Scanner.nextString ();
    static int Int () => int.Parse (Scanner.nextString ());
    static long Long () => long.Parse (Scanner.nextString ());
    static double Double () => double.Parse (Scanner.nextString ());
    static char[] Chars () => String ().ToCharArray ();
    static string[] Strings () => Console.ReadLine ().Split (' ');
    static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();
    static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();
    static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();
    const int M = 1000000007;
}

class PriorityQueue<T> where T : IComparable<T> {
    public T[] heap;
    public int size;
    public int sign;
    public PriorityQueue (int N, bool descend = false) {
        heap = new T[N];
        sign = 1;
        if (descend) sign = -1;
    }
    public int Compare (T x, T y) {
        return x.CompareTo (y) * sign;
    }
    public void Push (T x) {
        int i = size++;
        while (i > 0) {
            int p = (i - 1) / 2;
            if (Compare (x, heap[p]) >= 0) {
                break;
            }
            heap[i] = heap[p];
            i = p;
        }
        heap[i] = x;
    }
    public T Pop () {
        T ret = heap[0];
        T x = heap[--size];
        int i = 0;
        while (i * 2 + 1 < size) {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < size && Compare (heap[a], heap[b]) > 0) {
                a = b;
            }
            if (Compare (heap[a], x) >= 0) {
                break;
            }
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        return ret;
    }
    public int Count () {
        return size;
    }
}

class Scanner {
    static string[] s = new string[0];
    static int i = 0;
    static int max_i = 0;
    static public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        }
        return s[i++];
    }
}

Measured memory_bytes: 15708
#include <bits/stdc++.h>
using namespace std;
typedef std::pair<int, int> ipair;
#define int long long
#define pb push_back
#define ff first
#define INF INT_MAX
#define ss second
#define fr(i, j, a) for (int i = j; i < a; i++)
#define cnt_ones(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define sz size()
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<ipair>
#define mod 1000000007
#define ar array
#define IOS                                                                    \
  std::ios::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
void init() {
  int n;
  cin >> n;
  vi a(n);
  for (int &i : a)
    cin >> i;
  int lst = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > lst)
      ans += a[i] - lst;
    lst = a[i];
  }
  cout << ans << endl;
}
int32_t main() {
  IOS;
  init();
  return 0;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = 26;

		int D = sc.nextInt();
		int[] c = new int[N];
		for(int i=0; i<N; i++)
			c[i] = sc.nextInt();
		
		int[][] s = new int[D][N];
		for(int i=0; i<D; i++)
			for(int j=0; j<N; j++)
				s[i][j] = sc.nextInt();
		
		int[] last = new int[N];
		for(int i=0; i<D; i++) {
			int bestIndex = -1;
			int bestScore = 0;
			for(int j=0; j<N; j++) {
				int score = s[i][j] + c[j]*(i+1-last[j]);
				if(bestIndex < 0 || score > bestScore) {
					bestIndex = j;
					bestScore = score;
				}
			}
			System.out.println(bestIndex+1);
		}

		sc.close();
	}
}


Measured memory_bytes: 38172
n,k = map(int,input().split())
r = (n-1)*(n-2)//2 - k
if r < 0:
  print(-1)
else:
  print(n-1+r)
  for i in range(1,n):
    print(1,i+1)
  for i in range(1,n):
    r -= n-i-1
    if r >= 0:
      for j in range(i+1,n):
        print(i+1,j+1)
    else:
      for j in range(i+1,r+n):
        print(i+1,j+1)
      break

Measured memory_bytes: 3608
#include <stdio.h>
#include <math.h>

int main() {
  int n, max, count = 0;
  scanf("%d %d", &n, &max);

  for(int i = 0; i < n; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    long long sum = a*a + b*b;
    double sq = sqrt(sum);
    if(sq <= max) {
      count++;
    }
  }

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

  return 0;
}

Measured memory_bytes: 3232
#include <cstdio>

typedef unsigned long long ull;

const int MAXN = 2 * 1e5;

int main() {
    int n;
    std::scanf("%d", &n);
    static int arr[MAXN + 5];
    for (int i = 1; i <= n; i++) {
        std::scanf("%d", &arr[i]);
    }

    ull cnt = 0;
    for (int i = 2; i <= n; i++) {
        if (arr[i] < arr[i - 1]) {
            cnt += arr[i - 1] - arr[i];
            arr[i] = arr[i - 1];
        }
    }

    std::printf("%llu\n", cnt);

    return 0;
}


Measured memory_bytes: 3980
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl;
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   " << endl;
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}
 
int main(){
	int N, X, Y;
	cin >> N >> X >> Y;
	X--; Y--;

	vector<ll> ans(N+1, 0);//cnt[k]:歩数kかかる組み合わせ
	for(int s=0; s<=N-2; s++){
		for(int g=s+1; g<=N-1; g++){
			ll steps1 = g - s;//XYの道を使わない歩数
			ll steps2 = abs(s-X) + 1 + abs(Y-g); //XYの道を使う歩数
			ll mn = (steps1 < steps2) ? steps1 : steps2;
			ans[mn]++;
		}
	}

	for(int i=1; i<=N-1; i++){
		cout << ans[i] << endl;
	}

}


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

using namespace std;

class Dice{
private:
  void roll(int a,int b,int c,int d){
    swap(x[a],x[b]);
    swap(x[b],x[d]);
    swap(x[c],x[d]);
  }
public:
  int x[6];
  void roll_N(){ roll(0,1,4,5); }
  void roll_E(){ roll(0,3,2,5); }
  void roll_S(){ roll(0,4,1,5); }
  void roll_W(){ roll(0,2,3,5); }
  void rotation(){ roll(1,2,3,4); }
  void roll(int top,int front){
    for(int i = 0 ; i < 2 ; i++){
      for(int j = 0 ; j < 4 ; j++){
        roll_N();
        if(top == x[0]){ goto next; }
      }
      roll_E();
    }
     next:
    for(int i = 0 ; i < 4 ; i++){
      rotation();
      if(front == x[1]){ break; }
    }
  }
  bool operator == (Dice &d){
    for(int i = 0 ; i < 4 ; i++){
      for(int j = 0 ; j < 4 ; j++){
        d.roll_N();
        bool equals = true;
        for(int k = 0 ; k < 6 ; k++){
          if(x[k] != d.x[k]){
            equals = false;
            break;
          }
        }
        if(equals){ return true; }
      }
      for(int j = 0 ; j < 4 ; j++){
        d.roll_E();
        bool equals = true;
        for(int k = 0 ; k < 6 ; k++){
          if(x[k] != d.x[k]){
            equals = false;
            break;
          }
        }
        if(equals){ return true; }
      }
      d.rotation();
    }
    return false;
  }
};

int main(){
  int N;
  bool ok = true;
  Dice die[100];
  cin >> N;
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < 6 ; j++){
      cin >> die[i].x[j];
    }
    if(i > 0 && die[0] == die[i]){
      ok = false;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int n,tmp;
	scanf("%d",&n);
	int cnt4,cnt2;
	cnt4=cnt2=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&tmp);
		if(tmp%4==0)cnt4++;
		else if(tmp%2==0)cnt2++;
	}
	int flag=0;
	if(cnt4*2>=n-1)flag=1;
	if(cnt2+2*cnt4>=n)flag=1;
	if(flag)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256