akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
int nums[6000];
set<int> st;
int main(){
	int N, K,next;
	bool up;
	scanf("%d %d", &N, &K);
	for (int i = 0; i < N; i++)
		scanf("%d", nums + i);
	sort(nums, nums + N);
	int knot = N;
	st.clear();
	st.insert(0);
	vector<int>temp;
	for (int i=N-1;i>=0;i--){
        temp.clear();
		up=0;
		for (auto a:st){
			next=a+nums[i];
			if (next >= K){knot = i;up=1;break;}
			else temp.push_back(next);
		}
		//if(!up)break;
		for(auto a : temp)
			st.insert(a);
	}
	printf("%d\n", knot);
	return 0;
}


Measured memory_bytes: 512
n, m = map(int, input().split())
ls = []
rs = []

for _ in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

l_max = max(ls)
r_min = min(rs)
master_card_num = r_min - l_max

if master_card_num < 0:
    print(0)
else:
    print(master_card_num + 1)
    



Measured memory_bytes: 10992
m = 0
while m == 0:
    n, x = map(int,raw_input().split())
    count = 0    
    if n == 0 and x == 0:
        break
    for i in xrange(1,n+1):
        for j in xrange(1,n+1):
            for k in xrange(1,n+1):
                ans = i + j + k
                if ans == x and i != j and j != k and k != i:
                    count = count + 1
    print count / 6

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

int main()
{
    int h, w;
    cin >> h >> w;
    string s[h];

    rep(i, h) cin >> s[i];

    rep(i, h) rep(j, w) if (s[i][j] == '.') s[i][j] = '0';

    rep(i, h)
    {
        rep(j, w)
        {
            if (s[i][j] == '#')
            {
                rep(k, 8)
                {
                    int nx = i + dx[k], ny = j + dy[k];
                    if (!(0 <= nx && nx < h && 0 <= ny && ny < w) || s[nx][ny] == '#')
                        continue;
                    s[i + dx[k]][j + dy[k]] += 1;
                }
            }
        }
    }
    rep(i, h) OP(s[i]);
    return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int Sum(const string&s){
  int n = (int)s.size();
  int sum = 0;
  for(int i = 0; i < n; ++i)sum += s[i] - '0';
  return sum;
}

int main(){
  int a,b; cin >> a >> b;
  int c = (a+11)%13 - (b+11)%13;
  if(c == 0){
    cout << "Draw" << endl;
  } else if(c < 0){
    cout << "Bob" << endl;
  } else {
    cout << "Alice" << endl;
  }
  return 0;
}


Measured memory_bytes: 3536
using System;
using System.Linq;
using System.Collections.Generic;

class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            int n = int.Parse(Console.ReadLine());
            
            int[] pos = new int[n];
            int[] l = new int[n];
            List<Task> task= new List<Task>();

            for(int i = 0;i < n;i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                pos[i] = int.Parse(input[0]);
                l[i] = int.Parse(input[1]);
                task.Add(new Task(pos[i], l[i]));
            }

            IOrderedEnumerable<Task> sorted = task.OrderBy(x => x.a);

            int z = 0;

            foreach(Task s in sorted)
            {
                pos[z] = s.a;
                l[z] = s.order;
                z++;
            }

            int temp = 0;
            int temp2 = pos[0] + l[0];
            int k = 0;
            int count = 0;

            for(int i = 1;i < n;i++)
            {
                temp = pos[i] - l[i];
                if(temp < temp2)
                {
                    count++;
                    if(temp2 >= pos[i] + l[i])
                    {
                        temp2 = pos[i] + l[i];
                    }
                }
                else
                {
                    temp2 = pos[i] + l[i];
                }
                
            }

            Console.WriteLine(n - count);
    
        }
    }

    public class Task
    {
        public int order;
        public int a;
        public Task(int a, int order)
        {
            this.a = a;
            this.order = order;
        }
    }

Measured memory_bytes: 25664
#include<stdio.h>
 int main(){
  int x,i,y,min,max;
 for(i=1;i<=10000;i++){
 scanf("%d %d",&x,&y);
if(x==0 && y==0) break;
  min=x;
  max=y;
  if(min>y){
     max=min;
     min=y;
  }
  printf("%d %d\n",min,max);
  }
return 0;
}

Measured memory_bytes: 1860
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int mod = 1e9+7;

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

int p[1000];

int main() {

  int n, m, x;
  cin >> n >> m >> x;
  for(int i=0; i<m; i++){
    int a; cin >> a;
    p[a]++;
  }

  int cnt = 0;
  for(int i=0; i<=x; i++){
    if( p[i] ) cnt++;
  }
  cout << min(cnt, m-cnt) << endl;




  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

 using namespace std;
 #define N 100010
 int main(){
 int n,m,h[N],ma[N];
 cin>>n>>m;
 for(int i=1;i<=n;i++){
 cin>>h[i];
 ma[i]=0;
 }
 for(int i=0;i<m;i++){
 int a,b;
 cin>>a>>b;
 ma[a]=max(ma[a],h[b]);
 ma[b]=max(ma[b],h[a]);
 }
 int ans=0;
 for(int i=1;i<=n;i++){
 ans+=h[i]>ma[i];
 }
 cout<<ans<<endl;
 }

Measured memory_bytes: 4428
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

int main() {
    int d, t, s;
    cin >> d >> t >> s;
    if(s*t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
  	int x,y,z;
  	cin >> x >> y >> z;
  	cout << z << " " << x << " " << y;

    

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(void)
{
    int A, B, result;
 
    cin >> A >> B;
 
    result = A - B * 2;
 
    if(result > 0){
        cout << result;
    }
 
    else{
        cout << 0;
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=1e5+5;
ll inf=1e15;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        ll n,m;
        cin>>n;
        long double h[n+1];
        for(int i=1;i<=n;i++)
        {
            cin>>h[i];
        }
        long double dp[n+1][n+1],temp=1.0;

        for(int i=1;i<=n;i++)
        {
            temp*=(1-h[i]);
            dp[i][0]=temp;
        }
        for(int i=1;i<=n;i++)
            dp[0][i]=0;
        dp[0][0]=1;
        for(int i=1;i<=n;i++)
        {
            for(int req=1;req<=n;req++)
            {
                dp[i][req]=dp[i-1][req-1]*h[i]+dp[i-1][req]*(1.0-h[i]);
                // cout<<dp[i][req]<<" ";
            }
            // cout<<endl;
        }
        long double res=0.0;
        for(int i=(n+1)/2;i<=n;i++)
        {
            res+=dp[n][i];
        }
        cout<<fixed<<setprecision(10)<<res;
    }

    return 0;
}

Measured memory_bytes: 144380
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H,W,N;
  cin >> W >> H >> N;
  vector<int> x(N),y(N);
  for(int i=0; i<N; i++){
    cin >> x[i] >> y[i];
  }
  int ans = 0;
  for(int i=0; i<N-1; i++){
    int sx = x[i+1] - x[i];
    int sy = y[i+1] - y[i];
    if(sx*sy >= 0){
      ans += max(abs(sx),abs(sy));
    }else{
      ans += abs(sx) + abs(sy);
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3216
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;

int n, a[200005];
long long min_ = int(1e18), sum[200005];

int main()
{

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		if (i > 0) sum[i] += sum[i - 1] + a[i];
		else sum[i] = a[i];
	}

	for (int i = 0; i < n-1; ++i ) {
		min_ = min(min_, abs(sum[i] - (sum[n-1] - sum[i])));
	}

	cout << min_ << endl;

    return 0;
}



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

using namespace std;
typedef long long LL;
const int MAXN = 234567;
LL presum[MAXN];
LL prexor[MAXN];

int main() {
    int N;
    while (~scanf("%d", &N)) {
          presum[0] = prexor[0] = 0;
          for (int i = 1; i <= N; i++) {
              int tmp;
              scanf("%d", &tmp);
              presum[i] = presum[i - 1] + tmp;
              prexor[i] = prexor[i - 1] ^ tmp;
          }
          int l = 1;
          LL ans = 0;
          for (int i = 1; i <= N; i++) {
              while ((presum[i] - presum[l - 1]) != (prexor[i] ^ prexor[l - 1]))
                    l++;
              ans += (i - l + 1);
          }
          printf("%lld\n", ans);
    }
    return 0;
}


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

public class Main {
    static Scanner sc = new Scanner();
    static List<List<Integer>> tree;
    static int[] score;
	public static void main(String[] args) throws IOException {
        // Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        tree = new ArrayList<>();
        int max = 0;
        for (int i = 0; i < n; i++) {
            tree.add(new ArrayList<>());
        }
        for (int i = 0; i < n-1; i++) {
            int a = sc.nextInt()-1;
            int b = sc.nextInt()-1;
            tree.get(a).add(b);
        }
        score = new int[n];
        for (int i = 0; i < q; i++) {
            int p = sc.nextInt()-1;
            int x = sc.nextInt();
            score[p] += x;
        }
        dfs(0);
        for (int i = 0; i < n; i++) {
            System.out.print(score[i]);
            System.out.print(' ');
        }
    }
    static void dfs(int v) {
        for (int i : tree.get(v)) {
            score[i] += score[v];
            dfs(i);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
 
        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
 
        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}



Measured memory_bytes: 128832
import math
def prime(n):
    max=int(math.sqrt(n))
    li=[i for i in range(2,n+1)]
    primes=[]
    while li[0]<=max:
        primes.append(li[0])
        tmp=li[0]
        li=[i for i in li if i%tmp!=0]
    primes.extend(li)
    return primes
N=int(input())
li=[i for i in prime(1382) if i%5==1]
print(*li[:N])

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

bool bo[100001];
int d[100001],n,m,x,y,fa[100001],siz[100001],hd[100001],la[100001],cnt;
struct node{int to,next,la;}e[200001];

int rev(int i) {return (i&1)?(i+1):(i-1);}
int ask(int x) {return fa[x]==x?x:fa[x]=ask(fa[x]);}

void del(int x,int i)
{
	d[x]--;
	if (i==hd[x]) e[hd[x]=e[i].next].la=0;
	else e[e[i].next].la=e[i].la,e[e[i].la].next=e[i].next;
}

void addedge(int x,int y)
{
	e[++cnt].next=hd[x];
	e[cnt].to=y,e[cnt].la=0;
	e[hd[x]].la=cnt;
	hd[x]=cnt;
}

bool work(int x)
{
	if (bo[x])
	{
		int X=x;
		del(e[rev(la[x])].to,la[x]);
		del(x,rev(la[x])),x=e[rev(la[x])].to;
		while (x!=X) 
		{
			del(e[rev(la[x])].to,la[x]);
			del(x,rev(la[x])),x=e[rev(la[x])].to;
		}
		return 1;
	}
	bo[x]=1;
	for (int i=hd[x]; i; i=e[i].next)
		if (i!=rev(la[x])) 
		{
			la[e[i].to]=i;
			if (work(e[i].to)) return 1;
		}
	return 0;
}

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1; i<=n; i++) fa[i]=i,d[i]=0,siz[i]=0;
	for (int i=1; i<=m; i++)
	{
		scanf("%d%d",&x,&y),addedge(x,y),addedge(y,x);
		d[x]++,d[y]++,x=ask(x),y=ask(y);
		if (x==y) {siz[x]++; continue;}
		fa[x]=y,siz[y]+=(siz[x]+1);
	}
	for (int i=1; i<=n; i++) if (d[i]&1) return puts("No"),0;
	int cnt=0;
	for (int i=1; i<=n; i++)
		if (fa[i]==i&&siz[i]>0) cnt++;
	if (cnt>3) return puts("No"),0;
	int Cnt=0;
	for (int i=1; i<=n; i++)
		if (fa[i]==i&&siz[i]>0)
		{
			int cc=0;
			for (int j=1; j<=n; j++)
				if (ask(j)==i&&d[j]>=4) cc++;
			if (cc>2) return puts("Yes"),0;
			if (cc>=1&&Cnt==1) return puts("Yes"),0;
			if (cc>=0&&Cnt==2) return puts("Yes"),0;
			for (int j=1; j<=n; j++)
				if (ask(j)==i) 
					while (d[j])
					{
						memset(bo,0,sizeof(bo));
						la[j]=0,work(j),Cnt++;
						if (Cnt==3) return puts("Yes"),0;
					}
		}
	return puts("No"),0;
}

Measured memory_bytes: 6784
#include<cstdio>
#include<vector>
#include<queue>


using namespace std;

vector<vector<int> > a;

struct state_t
{
	int r, x, y;
	bool operator < (const state_t& rhs) const
	{
		if(r<rhs.r) return 1;
		return 0;
	}
};

priority_queue<state_t> que;
int w, h;


void push(int x, int y, int r)
{
	que.push((state_t){r, x, y});
}


int pop(int& x, int& y, int& r)
{
	if(que.empty()) return 0;
	state_t s=que.top();
	x=s.x;
	y=s.y;
	r=s.r;
	que.pop();
	return 1;
}



void move(int sx, int sy, int k)
{
	int vx[]={ 1, 0,-1, 0};
	int vy[]={ 0,-1, 0, 1};
	int x, y, r, nx, ny, i;

	push(sx, sy, k);
	while(pop(x, y, r))
	{
		if(a[y][x]!='.') continue;
		a[y][x]='C';
		if(r<=0) continue;
		for(i=0;i<4;i++)
		{
			nx=x+vx[i];
			ny=y+vy[i];
			if(nx<0 || w<=nx || ny<0 || h<=ny) continue;
			push(nx, ny, r-1);
		}
	}
}


int min_u(int& m,int v)
{
	if(m>v)
	{
		m=v;
		return 1;
	}
	return 0;
}


int main(void)
{
	int k;
	int x, y, sx, sy, min;

	while(scanf("%d%d%d", &h, &w, &k)==3)
	{
		a.resize(h);
		for(auto& ax: a) ax.resize(w);

		for(y=0;y<h;y++)
		{
			char buf[800+2];
			scanf("%s", buf);
			for(x=0;x<w;x++)
			{
				a[y][x]=buf[x];
				if(buf[x]=='S')
				{
					sx=x;
					sy=y;
					a[y][x]='.';
				}
			}
		}
		move(sx, sy, k);

		min=(sx+k-1)/k+1;
		for(y=0;y<h;y++)
		{
			for(x=0;x<w;x++)
			{
				if(a[y][x]=='C')
				{
					min_u(min, (x+k-1)/k+1);
					min_u(min, (w-1-x+k-1)/k+1);
					min_u(min, (y+k-1)/k+1);
					min_u(min, (h-1-y+k-1)/k+1);
				}
			}
		}
		printf("%d\n", min);
/*
		printf("(sx,sy)=%d,%d\n", sx, sy);
		for(auto& ax: a)
		{
			for(auto x: ax) printf("%c", x);
			printf("\n");
		}
*/
	}

	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int n, m, a[N], b[N]; map<int, int> h;
int main()
{
    scanf("%d", &n); for(int i = 1; i <= n; ++i) scanf("%d", a+i), b[i] = a[i], ++h[b[i]];
    sort(b+1, b+n+1), m = unique(b+1, b+n+1)-b-1;
    if(m == 1&&b[1] == 0) return puts("Yes"), 0;
    else if(n%3) return puts("No"), 0;
    else if(m == 2&&h[0] == n/3) return puts("Yes"), 0;
    else if(m == 3&&(b[1]^b[2]^b[3]) == 0&&h[b[1]] == n/3&&h[b[2]] == n/3) return puts("Yes"), 0;
    puts("No");
    return 0;
}

Measured memory_bytes: 7744
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
    map<string, int> m;
    
    int n,ans;
    string s;
    cin >> n;
    rep(i,n){
        cin >> s;
        m[s]++;
    }
    ans = m.size();
    cout << ans << endl;
}

Measured memory_bytes: 19224
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	ll n;cin>>n;
	string s=to_string(n);
	cout<<((s[0]==s[2])?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        n: usize,
        a: usize,
        b: usize,
        s: Chars,
    }

    let mut c = 0;
    let mut d = 1;
    for i in 0..n {
        let ok = match s[i] {
            'a' => c < a + b,
            'b' => c < a + b && d <= b,
            _ => false,
        };
        if ok {
            println!("Yes");
            c += 1;
            if s[i] == 'b' {
                d += 1;
            }
        } else {
            println!("No");
        }
    }
}


Measured memory_bytes: 2484
def str2turn(c: str) -> int:
    if c.lower() == 'a':
        return 0
    elif c.lower() == 'b':
        return 1
    return 2


def turn2str(t: int) -> str:
    if t == 0:
        return 'a'
    elif t == 1:
        return 'b'
    return 'c'


def card_game_for_three(Sa: str, Sb: str, Sc: str) -> str:
    indexes = [0, 0, 0]
    limits = [len(Sa), len(Sb), len(Sc)]
    cards = [Sa, Sb, Sc]

    turn = 0
    while indexes[turn] < limits[turn]:
        next_turn = str2turn(cards[turn][indexes[turn]])
        indexes[turn] += 1
        turn = next_turn

    return turn2str(turn).upper()


if __name__ == "__main__":
    Sa = input()
    Sb = input()
    Sc = input()
    ans = card_game_for_three(Sa, Sb, Sc)
    print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
  int a,b,c,d,p;
  int x, y, ans;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &p);

  x = a * p;
  if(p <= c) y = b;
  else y = b + (p-c)*d;
  ans = x < y ? x : y;
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 596
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

L, R = mapint()

lis = []
for i in range(L, min(R+1, L+2101)):
    lis.append(i)

leng = len(lis)
ans = 10**18
for i in range(leng-1):
    a = lis[i]
    for j in range(i+1, leng):
        b = lis[j]
        ans = min(ans, (a*b)%2019)
print(ans)

Measured memory_bytes: 66888
using System;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
            ////?????????????????????

            int count = 0;

            string dmmy = Console.ReadLine();

            int n = int.Parse(dmmy);

            string dmmy1 = Console.ReadLine();

            string[] dmmySP = new string[n];

            char del = ' ';

            dmmySP = dmmy1.Split(del);

            int[] A = new int[n];

            for (int i = 0; i < n; i++)
            {
                A[i] = int.Parse(dmmySP[i]);
            }

            int minj = 0;
            int D = 0;

            for (int i = 0; i < n; i++)
            {
                minj = i;

                for (int j = i; j < n; j++)
                {
                    if(A[j] < A[minj])
                    {
                        minj = j;
                    }
                }

                if (A[i] != A[minj])
                {
                    D = A[i];

                    A[i] = A[minj];
                    A[minj] = D;
                    count++;
                }

            }

            string[] K = new string[n];

            for (int i = 0; i < n; i++)
            {                
                K[i] = A[i].ToString();
            }

            string result = string.Join(" ", K);


            Console.WriteLine(result);

            Console.WriteLine(count);
            Console.ReadLine();

        }
    }

}

Measured memory_bytes: 19912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin >> n >> k;
    vector<ll> p(n),c(n);
    REP(i,n){
        cin >> p[i];
        p[i]--;
    }
    REP(i,n){
        cin >> c[i];
    }
    int logk=1;
    while((1LL<<logk)<k) logk++;
    vector<vector<ll>> d(logk+1,vector<ll>(n)),s(logk+1,vector<ll>(n)),m(logk+1,vector<ll>(n,-INF));
    REP(i,n){
        d[0][i]=p[i];
        s[0][i]=c[p[i]];
        m[0][i]=c[p[i]];
    }
    REP(i,logk){
        REP(j,n){
            d[i+1][j]=d[i][d[i][j]];
            s[i+1][j]=s[i][j]+s[i][d[i][j]];
            m[i+1][j]=max(m[i][j],s[i][j]+m[i][d[i][j]]);
        }
    }
    ll ans=-INF;
    REP(i,n){
        int now=i;
        ll num=k,sum=0;
        int cnt=0;
        while(num){
            if(num&1){
                chmax(ans,sum+m[cnt][now]);
                sum+=s[cnt][now];
                now=d[cnt][now];
            }
            cnt++;
            num>>=1;
        }
        chmax(ans,sum);
    }
    cout << ans << endl;
}


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

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    int a[m],b[m];
    for(int i=0;i<m;i++)cin>>b[i];
    int ans=0;
    for(int i=0;i<n;i++){
        int tmp=0;
        for(int j=0;j<m;j++){
            cin>>a[j];
            tmp+=a[j]*b[j];
        }
        if(tmp+c>0)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;

int main () {
	int N;
	vector <ll> v;
	cin >> N;
	for (int i=0; i<N; i++) {
		ll tmp;
		cin >> tmp;
		v.push_back (tmp);
	}
	sort (v.rbegin(), v.rend());
	ll sum = v[0];
	for (int i=1; i<N/2; i++)
		sum += 2*v[i];
	if (N%2==1)
		sum += v[N/2];
	cout << sum << endl;
	return 0;
}

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

using namespace std;

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

    vector<int> res(n + 1, 0);
    for (int i = 1; i * i <= n; i++) {
        for (int j = 1; i * i + j * j <= n; j++) {
            for (int k = 1; i * i + j * j + k * k + i * j + j * k + k * i <= n; k++) {
                res[i * i + j * j + k * k + i * j + j * k + k * i]++;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << res[i] << endl;
    }
}


Measured memory_bytes: 3600
import numpy as np
from collections import deque
from collections import Counter
from itertools import accumulate
from itertools import permutations, combinations
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt
### ceil切り上げ，floor切り下げ

def main():
    N, D = map(int, input().split())
    cnt = 0
    for _ in range(N):
        x, y = map(int, input().split())
        dist = np.sqrt(np.power(x, 2) + np.power(y, 2))
        if dist <= D:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 27220
#include <bits/stdc++.h>
using namespace std;
using 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--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define PI 3.14159265359
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int k,t;
  cin >> k >> t;
  int a[t];
  FOR(i,0,t-1) cin >> a[i];

  if(t==1){
    cout << k-1 << endl;
    return 0;
  }

  while(1){
    sort(a,a+t,greater<int>());
    if(a[1]>0){
      --a[0]; --a[1];
    }
    else{
      cout << max(0,a[0]-1) << endl;
      return 0;
    }

  }

}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	cin >> s;
	if (s == "SUN") {
		cout << "7" << endl;
	}
	else if (s == "MON") {
		cout << "6" << endl;
	}
	else if (s == "TUE") {
		cout << "5" << endl;
	}
	else if (s == "WED") {
		cout << "4" << endl;
	}
	else if (s == "THU") {
		cout << "3" << endl;
	}
	else if (s == "FRI") {
		cout << "2" << endl;
	}
	else cout << "1" << endl;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

const int MAX_N = 200005;

string S;
int SBit[MAX_N];
int getBit(int l, int r) {
  return SBit[r] ^ SBit[l];
}

int DP[1 << 26];
int setDp(int index, int k) {
  if(DP[index] == -1) {
    DP[index] = k;
  } else {
    DP[index] = min(DP[index], k);
  }
}

int getDp(int index) {
  if(DP[index] == -1) {
    return MAX_N;
  } else {
    return DP[index];
  }
}

int opt[MAX_N];

int main()
{
  cin >> S;
  int N = S.length();
  for(int i = 0; i < S.length(); i++) {
    SBit[i+1] = SBit[i]^(1 << (S[i] - 'a'));
  }

  memset(DP, -1, sizeof(DP));
  
  for(int i = 0; i < MAX_N; i++) {
    opt[i] = 1145141919;
  }
  opt[0] = 0;

  setDp(0, 0);

  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 27; j++) {
      int K;
      if (j == 0) {
	K = 0;
      } else {
	K = (1 << (j-1));
      }
      opt[i+1] = min(opt[i+1], 1 + getDp(K ^ getBit(0, i+1)));
    }
    setDp(getBit(0, i+1), opt[i+1]);
  }

  cout << opt[N] << endl;

  return 0;
}


Measured memory_bytes: 264324
#include <cstdio>
#include <cmath>

int main(){
	int n, x[100], y[100];
	
	scanf(" %d", &n);
	for(int i=0; i<n; ++i)
		scanf(" %d", &x[i]); 
	for(int i=0; i<n; ++i)
		scanf(" %d", &y[i]); 
		
	for(int p=1; p<=3; ++p){
		double d=0;
		for(int i=0; i<n; ++i)
			d += pow( fabs(x[i]-y[i]), p);
		
		printf("%lf\n", pow(d,1.0/p));
	}		
	
	double max=0;	
	for(int i=0; i<n; ++i)
		if(max < fabs(x[i]-y[i])) max = fabs(x[i]-y[i]);
	
	printf("%lf\n", max);	
	
	return 0;
}



Measured memory_bytes: 2912
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
typedef long long ll;

using P = pair<ll,ll>;
#define v first
#define w second

// v高い順（vが同じならw軽い方優先）
bool comp(P a, P b){
    return a.v == b.v ? a.w < b.w : a.v > b.v;
}

int main(void){
    ll N,W;
    cin>>N>>W;
    vector<P> a(N);
    rep(i,N){
        ll v,w;
        cin>>v>>w;
        a[i] = {v,w};
    }
    vector<P> dp = {{0,0}};

    rep(i,N){
        vector<P> tmp;
        for(P s : dp){
            tmp.push_back(s);
            tmp.push_back({s.v + a[i].v, s.w + a[i].w});
        }

        sort(all(tmp),comp);
        dp.clear();
        ll w_border = W+1;
        for(P s : tmp){
            if( w_border > s.w){
                w_border = s.w;
                dp.push_back(s);
            }
        }
        assert((ll)dp.size() <= N*N+1);
    }
    cout<<dp[0].v<<endl;
    return 0;
}



Measured memory_bytes: 3116
#include <chrono>
#include <iostream>
#include <vector>

using namespace std;
using namespace std::chrono;

int main() {
  auto start = high_resolution_clock::now();

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m, r;
  cin >> n >> m >> r;
  vector<vector<int>> c(n, vector<int>(n, -1));
  vector<int> town(r);
  for (int i = 0; i < r; ++i) {
    cin >> town[i];
    --town[i];
  }
  for (int i = 0; i < m; ++i) {
    int a, b, val;
    cin >> a >> b >> val;
    --a;
    --b;
    c[a][b] = c[b][a] = val;
  }

  for (int i = 0; i < n; ++i)
    c[i][i] = 0;

  for (int k = 0; k < n; ++k)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        if (c[i][k] != -1 && c[k][j] != -1)
          if (c[i][j] == -1 || c[i][j] > c[i][k] + c[k][j])
            c[i][j] = c[i][k] + c[k][j];

  auto get_id = [&](int x) {
    int res = 0;
    for (int i = 0; i < r; ++i)
      if (town[i] == x)
        res = (1 << i);
    return res;
  };

  vector<vector<int>> dp((1 << r), vector<int>(n, -1));
  for (int i = 0; i < r; ++i) {
    dp[(1 << i)][town[i]] = 0;
  }
  for (int mask = 0; mask < (1 << r); ++mask) {
    for (int last = 0; last < n; ++last) {
      if (dp[mask][last] == -1)
        continue;
      for (int next = 0; next < n; ++next) {
        int id = get_id(next);
        if (id == 0)
          continue;
        if (mask & id)
          continue;
        if (c[last][next] == -1)
          continue;

        int new_dp = dp[mask][last] + c[last][next];
        int new_mask = mask | id;

        if (dp[new_mask][next] == -1 || dp[new_mask][next] > new_dp)
          dp[new_mask][next] = new_dp;
      }
    }
  }

  int ans = -1;
  for (int last = 0; last < n; ++last) {
    int v = dp[(1 << r) - 1][last];
    if (v == -1)
      continue;
    if (ans == -1 || ans > v)
      ans = v;
  }
  cout << ans << endl;

  cerr << "Total execution time : " << duration_cast<milliseconds>(high_resolution_clock::now() - start).count() << " ms" << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)
#define AAA (1000000007)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main() {
	int N;
	vector<ll> A;
	cin >> N;
	int i, j, k;
	rep(i, 0, 3 * N) {
		ll a;
		cin >> a;
		A.push_back(a);
	}
	sort(A.begin(), A.end());
	ll sum = 0;
	for (i = 0; i <N; ++i) {
		j = 3 * N - 2*i-2;
		sum += A[j];


	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 7792
#include <iostream>
#include <vector>
#include <climits>
#include <iomanip>
#include <cmath>
using namespace std;
using uint = unsigned int;

int main() {
	
	uint N;
	cin >> N;
	
	vector<double> X(N);
	vector<double> Y(N);
	
	double lx = 1000;
	double hx = 0;
	double ly = 1000;
	double hy = 0;
	
	for(uint i=0; i<N; i++) {
		cin >> X[i] >> Y[i];
		lx = min(lx, X[i]);
		hx = max(hx, X[i]);
		ly = min(ly, Y[i]);
		hy = max(hy, Y[i]);
	}
	
	double curX = (hx + lx) / 2;
	double curY = (hy + ly) / 2;
	double nxtX = 0;
	double nxtY = 0;
	
	double alfa = 0.1;
	uint idx = 0;
	
	while(alfa > pow(10, -8)) {	
		curX = nxtX;
		curY = nxtY;
		double maxD = 0;
		
		for(uint i=0; i<N; i++) {
			double d = pow(X[i] - curX, 2) + pow(Y[i] - curY, 2);
			
			if(maxD < d) {
				maxD = d;
				idx = i;
			}
		}
		
		
		nxtX = (1 - alfa) * curX + alfa * X[idx];
		nxtY = (1 - alfa) * curY + alfa * Y[idx];
		alfa = alfa * 0.9999;
		
		//cout << alfa << " " << idx << " " << idx << endl;
	}
	
	double ans = sqrt(pow(X[idx] - curX, 2) + pow(Y[idx] - curY, 2));
	cout << setprecision(10) << ans;
	
	return 0;
}


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

int main(){
  int n,k,d,a;
  cin >> n >> k;
  int A[n] = {};
  for(int i = 0; i < k; i++){
    cin >> d;
    for(int j = 0; j < d; j++){
      cin >> a;
      if(A[a-1] == 0)
        n--;
      A[a-1]++;
    }
  }
  cout << n << endl;
  return 0;
}

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

#define rep(i,c) for(int i = 0; i < (int)c; ++i)
using llint = long long int ;
using namespace std;


int main(){
    int H,W,K;
    cin>>H>>W>>K;
    string S[11];
    rep(i,H) cin>>S[i];

    int ans=10000000;
    for (int bit = 0; bit < ( 1<<(H-1) ) ; bit++)
    {
        int group=0;
        vector<int> id(H);
        rep(i,H){
            id[i]=group;
            if(bit>>i & 1) group++;
        }
        group++;

        int choco[11][1002]={0};
        rep(i,H)rep(j,W) choco[id[i]][j]+=S[i][j]-'0';

        vector<int> now(group,0);
        int num=group-1;
        int cou=1;
        rep(i,W){
            rep(j,group){
                now[j]+=choco[j][i];
                if (now[j]>K){
                    num+=1;
                    now=vector<int> (group,0);
                    rep(l,group) {
                        now[l]+=choco[l][i];
                        if (now[l]>K){ num=10000000; goto hoge; }
                    }
                    /*if(cou==1) {num =100000000; break;}
                    if(cou>1){ i--; cou=1; }
                    break;
                    */
                    break;
                }
                cou++;
            }
        }
        hoge:
        ans=min(ans,num);
    }
    cout<<ans<<endl;
    
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	string s;
	cin >> s;

	vector<string> v;
	string X = "";
	string tmp = X;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'A') {
			tmp += '0';
		} else if (i + 1 < s.size() && s[i] == 'B' && s[i + 1] == 'C') {
			tmp += '1';
			i += 1;
		} else {
			if (tmp != X) {
				v.push_back(tmp);
			}
			tmp = X;
		}
	}
	if (tmp != X) { v.push_back(tmp); }

	for (int i = 0; i < v.size(); ++i) {
		cerr << v[i] << endl;
	}

	ll res = 0;
	for (int i = 0; i < v.size(); ++i) {
		int sz = v[i].size();
		vector<ll> d(sz + 1, 0);
		for (int j = sz - 1; j >= 0; --j) {
			d[j] += (int)(v[i][j] - '0') + d[j + 1];
		}
		ll cnt = 0;
		for (int j = 0; j < sz; ++j) {
			if (v[i][j] == '0') { cnt += d[j]; }
		}
		res += cnt;
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3196
#!/usr/bin/perl
use sort 'stable';
use Math::Trig;

my ($n,$m) = map { $_ - 0 } split(/\s+/,scalar(<STDIN>));

my @n = ();
$#n = $n - 1;

my @mk = ();
$#mk = $n - 1;
$mk[0] = 0;

for(my $i=0;$i<$m;$i++){
  my @ab = map { $_ - 1 } split(/\s+/,scalar(<STDIN>));
  $n[$ab[0]]->{$ab[1]} = 1;
  $n[$ab[1]]->{$ab[0]} = 1;
}

my @p = (0);

while(@p){
  my @newp = ();
  foreach my $pp (@p){
    foreach my $k ( keys %{$n[$pp]} ){
      my $kk = $k - 0;
      if( '' . $mk[$kk] eq '' ){
        push(@newp,$kk);
        $mk[$kk] = $pp;
      }
    }
  }
  @p = (@newp);
}

print "Yes\n";
for(my $i=1;$i<$n;$i++){
  my $v = $mk[$i]+1;
  print "$v\n";
}



Measured memory_bytes: 76480
#include<iostream>
using namespace std;
int main(){
    int n ;
    cin >> n;
    for(int i = 1; i <= n; i ++){
        if (i % 3 == 0){
            cout << " " << i;
        }
        else{
            for (int j = i; j >= 3; j /= 10){
                if(j % 10 == 3){
                    cout << " " << i;
                    break;
                }
                
               
            }
        }
        
    }
    cout<< endl;
    return 0;
    
}


Measured memory_bytes: 3084
import sys

def solve():
    N = int(input())
    ans = 20

    for a in range(1, N + 1):
        if a**2 > N:
            break
        if N % a:
            continue

        b = N // a
        # print(a, b)
        f = max(len(str(a)), len(str(b)))
        ans = min(ans, f)

    print(ans)


def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int n,k,q;
int a[100005];

int main()
{
	cin>>n>>k>>q;
	int x;
	for(int i=1;i<=q;i++)
	{
		scanf("%d",&x);
		a[x]++;
	}
	for(int i=1;i<=n;i++) a[i]=q-a[i];
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=k) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define int long long
using namespace std;
using cd = complex <double>;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <pair <int, int> > vii;
typedef map <int, int> mii;

const int Inf = 1000000000;
const int mod = 1234567;
const double Pi = acos(-1);

void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, m, x, ans = Inf;;
int c[13];
int a[13][13];

void Solve()
{
	cin >> n >> m >> x;
	for(int i = 1; i <= n; i++)
	{
		cin >> c[i];
		for(int j = 1; j <= m; j++)
		{
			cin >> a[i][j];
		}
	}
	int temp = 1 << n;
	for(int i = 0; i < temp; i++)
	{
		int tt = 0;
		bool ok = true;
		for(int k = 1; k <= m; k++)
		{
			int ttt = 0;
			for(int j = 1; j <= n; j++)
			{
				if(i & (1 << (j - 1)))
				{
					ttt += a[j][k];
				}	
			}	
			if(ttt < x)
			{
				ok = false;
			}
		}
		if(ok == true)
		{
			for(int j = 1; j <= n; j++)
			{
				if(i & (1 << (j - 1)))
				{
					tt += c[j];
				}
			}
			ans = min(ans, tt);
		}
	}
	if(ans == Inf)
	{
		cout << -1;
	}
	else
	{
		cout << ans;
	}
}

signed main()
{
	Fastio();
	Solve();
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC098
{
    class Program
    {
        private static bool max;

        static void Main(string[] args)
        {
            int a, b, max;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            max = a + b;

            if (max < a - b) max = a - b;
            if (max < a * b) max = a * b;

            Console.WriteLine(max);      
            Console.ReadKey();

      

            
        }
    }
}


Measured memory_bytes: 11092
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
p = [0] * n

for ai in a:
    p[ai-1] += 1

ans = 0
for pi in p:
    if k-q+pi > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 13696
#include<bits/stdc++.h>
#define lb long double
#define eps 1e-9
using namespace std;
struct Po{lb x,y;}p1,p2,q1,q2,np,nq;
int t;
Po operator -(Po x,Po y){return (Po){x.x-y.x,x.y-y.y};}
lb operator *(Po x,Po y){return x.x*y.y-x.y*y.x;}
lb operator ^(Po x,Po y){return x.x*y.x+x.y*y.y;}
void get(Po &x){scanf("%Lf %Lf",&x.x,&x.y);}
int main(){
	scanf("%d",&t);
	while (t--){
		get(p1);get(p2);np=p2-p1;
		get(q1);get(q2);nq=q2-q1;
		if (fabs(np*nq)<eps)puts("2");
		else{
			if (fabs(np^nq)<eps)puts("1");else puts("0");
		}
	}
	return 0;
}



Measured memory_bytes: 3236
n,k = map(int,input().split())

lst = [list(map(int,input().split())) for _ in range(n)]
lst.sort(key = lambda x:x[0])
cnt = 0

for i in range(n):
    cnt += lst[i][1]
    if cnt >= k:
        ans = lst[i][0]
        break

print(ans)

Measured memory_bytes: 29144
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

using namespace std;

inline void setmin(int &x, int y) { if (y < x) x = y; }
inline void setmax(int &x, int y) { if (y > x) x = y; }
inline void setmin(ll &x, ll y) { if (y < x) x = y; }
inline void setmax(ll &x, ll y) { if (y > x) x = y; }

const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 52;

int min_bit(vector<int> &a) {
    int p = 0;
    while (p < sz(a) && a[p] == 0) {
        p++;
    }
    return p;
}

vector<int> check(vector<vector<int> > &basis, vector<int> v) {
    rep(i, 0, sz(basis)) {
        int b = min_bit(basis[i]);
        if (v[b] == 1) {
            rep(j, 0, sz(v)) {
                v[j] ^= basis[i][j];
            }
        }
    }
    return v;
}

bool is_zero(vector<int> &a) {
    rep(i, 0, sz(a)) {
        if (a[i] != 0) {
            return false;
        }
    }
    return true;
}

int solve(int n, vector<vector<int> > a) {
    vector<vector<int> > basis;
    rep(i, 0, n) {
        vector<int> v = check(basis, a[i]);
        if (!is_zero(v)) {
            basis.push_back(v);
            int p = sz(basis) - 1;
            while (p - 1 >= 0) {
                if (min_bit(basis[p]) < min_bit(basis[p - 1])) {
                    basis[p].swap(basis[p - 1]);
                    p--;
                } else {
                    break;
                }
            }
        }
    }
    return sz(basis);
}

inline void add(int &x, int y) {
    x += y;
    if (x >= MOD2) {
        x -= MOD2;
    }
}

int a[300][300];
int dp[300][300];
ll pw[300 + 1];

void init() {
    pw[0] = 1;
    rep(i, 1, 300 + 1) {
        pw[i] = pw[i - 1] * 2 % MOD2;
    }
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    init();
    int n, m;
    cin >> n >> m;
    vector<vector<int> > a(n, vector<int> (m));
    rep(i, 0, n) {
        rep(j, 0, m) {
            cin >> a[i][j];
        }
    }
    int sz_basis = solve(n, a);
    cout << (pw[n] - pw[n - sz_basis] + MOD2) * pw[m - 1] % MOD2 << "\n";
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>
#define M 10000

void CountingSort(int *,int *,int,int);
int main(){
  int *A,*B,n,i;
  int max=0;
  scanf("%d",&n);
  A = malloc(sizeof(int)*n+1);
  B = malloc(sizeof(int)*n+1);
  for(i=1;i<=n;i++)
    scanf("%d",&A[i]);
  
  CountingSort(A,B,M,n);
  for(i=1;i<n;i++)
    printf("%d ",B[i]);
  printf("%d\n",B[i]);
  return 0;
}

void CountingSort(int *A,int *B,int k,int n){
  int C[k+1],i,j;
  for(i=0;i<=k;i++)
    C[i]=0;

  for(j=1;j<=n;j++)
    C[A[j]]++;

  for(i=1;i<=k;i++)
    C[i]+=C[i-1];

  for(j=n;j>=1;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
}



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

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int main(){
	int sum=0X7fffffff;
	int a=read(),b=read(),c=read();
	c*=2;
	int x=read(),y=read();
	if(x>y){
		swap(x,y);
		swap(a,b);
	}
	sum=min(a*x+b*y,sum);
	sum=min(c*x+(y-x)*b,sum);
	sum=min(c*x+(y-x)*c,sum);
	cout<<sum;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define all(n) n.begin(),n.end()
#define yn(x) cout << (x ? "Yes":"No") << endl;
 

int main() {
  string s,t;
  cin >> s >> t;
  bool x = true;
  rep(i,s.size()){
    if(s[i] != t[i]){
      x = false;
      break;
    }
  }
  yn(x);
    
  return 0;
}


Measured memory_bytes: 3592
#83b
n,a,b=map(int,input().split())
n=[str(i) for i in range(1,n+1)]
ans=0

for i in n:
    temp=[int(x) for x in list(str(i)) ]
    temp=sum(temp)
    if a<=temp<=b:
        ans+=int(i)

print(ans)


Measured memory_bytes: 3572
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
num = min((A-1)%10,(B-1)%10,(C-1)%10,(D-1)%10,(E-1)%10)
print((-(-A//10)*10)+(-(-B//10)*10)+(-(-C//10)*10)+(-(-D//10)*10)+(-(-E//10)*10)+num-9)

Measured memory_bytes: 9176