akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    abc151c()
}

fun abc151c() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val psList = (1..m).map { readLine()!!.split(' ').let { Pair(it[0].toInt(), it[1]) } }

    val ac = psList.groupBy { it.first }.map { if (it.value.any { it.second == "AC" }) 1 else 0 }.sum()

    val group = psList.groupBy { it.first }.map { it.value }.map {
        it.indexOfFirst { it.second == "AC" }.let { if (it == -1) 0 else it }
    }

    val pen = group.sum()

    val answer = "$ac $pen"

    println(answer)
}


Measured memory_bytes: 76904
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

#define NMAX 100000
#define MOD 1000000007
#define INF 2000000000

#define MIN(a, b) (a < b ? a : b)

using namespace std;

struct Job {
	int duration;
	int deadline;
};

int nJobs;
Job jobs[2 * NMAX];

bool crit(Job jobA, Job jobB)
{
	return jobA.deadline < jobB.deadline;
}

int main()
{
	cin >> nJobs;
	for (int i = 0; i < nJobs; i++)
		cin >> jobs[i].duration >> jobs[i].deadline;

	sort(jobs, jobs + nJobs, crit);
	int sum = 0;
	for (int i = 0; i < nJobs; i++)
	{
		sum += jobs[i].duration;
		if (sum > jobs[i].deadline)
		{
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n; ld d, x, a = 0; cin >> n >> d >> x;
	for (int i = 1; i <= n; i++) a += (ld)(n + 1 - i) / i;
	cout << a * (d + x * (2 * n - 1) / 2.0) << '\n';
}

Measured memory_bytes: 3800
#include <stdio.h>

using namespace std;


//カードを判定して出力
void outPut(int Array[], char mark)
{
    for (size_t i = 1; i <= 13; i++)
    {
        if (Array[i] == 0)
            printf("%c %d\n", mark, i);
    }
}


int main()
{
    //カードの枚数を宣言
    int n;
    scanf("%d", &n);
    char mark[2]; 
    //mark[0]…入力文字 mark[1]…半角空白 mark[2]…終端記号
    int S[14], H[14], C[14], D[14], tmp; //入力を格納するトランプカードをマーク別に宣言
    for (size_t i = 0; i < 14; i++)
    {
        S[i] = H[i] = C[i] = D[i] = 0;
    } //カードの格納値を初期化

    for (size_t i = 0; i < n; i++)
    {
        scanf("%s %d", &mark, &tmp);
        switch (mark[0]) //カードが存在すれば値を1に
        {
        case 'S':
            S[tmp] = 1;
            break;
        case 'H':
            H[tmp] = 1;
            break;
        case 'C':
            C[tmp] = 1;
            break;
        case 'D':
            D[tmp] = 1;
            break;

        default:
            break;
        }
    }
    outPut(S, 'S');
    outPut(H, 'H');
    outPut(C, 'C');
    outPut(D, 'D');

    return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a % 2 ==0 && a == b && b ==c) {
    cout << -1 << endl;
  } else {
    int count = 0;
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
      int copy_a = a;
      int copy_b = b;
      int copy_c = c;
      a = copy_b / 2 + copy_c / 2;
      b = copy_a / 2 + copy_c / 2;
      c = copy_a / 2 + copy_b / 2;
      count++;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

ll powmod (ll a, ll p) {
	ll ans = 1;
	ll mul = a;
	for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
		if ((p & 1) == 1) ans = (ans * mul) % mod;
	}
	return ans;
}

const int MAX_N = 100010;
ll fact[MAX_N];
ll revFact[MAX_N];
// !!!!!!!!SET FACT!!!!!!!
void setFact(int N) {
	fact[0] = 1;
	for (int i = 1; i < N; i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= mod;
	}
	revFact[N - 1] = powmod(fact[N - 1], mod - 2);
	for (int i = N - 2; i >= 0; i--) {
		revFact[i] = revFact[i + 1] * (i + 1);
		revFact[i] %= mod;
	}
}

ll getC(int a, int b) {
    assert(a >= 0 && b >= 0);
    if (a < b) return 0;
	return (((fact[a] * revFact[b]) % mod) * revFact[a - b]) % mod;
}

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

    setFact(MAX_N);

    int n;
    cin >> n;
    vi a(n + 1);
    vi id(n + 1, -1);
    int l, r, x;
    rep(i, n + 1) {
        cin >> a[i];
        if (id[a[i]] == -1) {
            id[a[i]] = i;
        }
        else {
            l = id[a[i]];
            r = n - i;
            x = a[i];
        }
    }

    rep(i, n + 1) {
        if (i == 0) {
            cout << n << endl;
        }
        else {
            ll ans = getC(n + 1, i + 1);
            ans = (ans + mod - getC(l + r, i)) % mod;
            cout << ans << endl;
        }
    }
}


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

ll dp[3001][3001][4], a[3001][3001];

int main() {
    ll r,c,items, x , y, v, maxi = 0;
    cin >> r >> c >> items;
    while(items--) {
    	cin >> x >> y >> v;
    	a[x-1][y-1]=v;
    }
    for(int i=0;i<r;i++) for(int j=0;j<c;j++) {
        for(int k=2;k>=0;k--) {
            dp[i][j][k+1]=max(dp[i][j][k+1],dp[i][j][k]+a[i][j]);
        }
        for(int k=0;k<4;k++) {
            if(j+1!=c) dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k]);
            if(i+1!=r) dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]);
        }
    }
    for(int k=0;k<4;k++) maxi=max(maxi,dp[r-1][c-1][k]);
    cout << maxi;
	return 0;
}

Measured memory_bytes: 355260
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<set>
#include<stack>
#include<cstring>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
int main()
{
   ll a[105];
    ll m,n,i,j,sum=0,x,y;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    cin>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        cout<<sum-a[x]+y<<endl;
    }
}


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

int main() {
	int N, k;
	cin >> N >> k;
  
  	int l = 0;
  	for (int i=0; i < N; i++) {
    	int x;
      	cin >> x;
      	
      	int a, b;
      	a = x;
      
      	if (x >= k) {
        	b = x - k;
          	l += b;
        }
      	else if (k > x) {
        	b = k - x;
          	if (a >= b) {
            	l += b;
            }
          	else if (b > a) {
            	l += a;
            }
        }
    }
      	
  	cout << l*2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n);i++)
#define rep1(i,n) for(int i=1; i<(n); i++)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;


int main(){
    string N;
    cin >> N;
    int S = 0;
    for(int i=0; i< N.size(); i++){
        S += N[i] - '0';
    }
    if(stoi(N) % S == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))





a,b,c=input2()

if a==b and b==c:
	print("No")
elif a!=b and b!=c and a!=c:
	print("No")
else:
	print("Yes")


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<set>
typedef struct
{
    char name[10];
    long long num;

}ball;
using namespace std;
int main()
{
   ball a,b;
   cin>>a.name>>b.name;
   cin>>a.num>>b.num;
   char u[10];
   cin>>u;
   if(strcmp(a.name,u)==0)
    a.num--;
   else if(strcmp(b.name,u)==0)
    b.num--;
   cout<<a.num<<" "<<b.num<<endl;

}


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

int main(){
  int a,b,k,mi,co,i;
  cin >> a >> b >> k;
  mi=min(a,b);
  co=0;
  for(i=mi;i>=1;--i){
    if(a%i==0 && b%i==0){
      --k;
    }
    if(k==0){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


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

void run(void){
  char s[27];
  scanf("%s",s);
  int n=strlen(s);
  if(n<26){
    int used[26]={0};
    int i;
    for(i=0;i<n;i++) used[s[i]-'a']=1;
    for(i=0;used[i];i++);
    s[n]='a'+i;
    s[n+1]='\0';
    puts(s);
    return;
  }
  int can[26]={0};
  for(int i=n-1;i>=0;i--){
    int k=s[i]-'a';
    can[k]=1;
    int j;
    for(j=k+1;j<26 && !can[j];j++);
    if(j<26){
      s[i]='a'+j;
      s[i+1]='\0';
      puts(s);
      return;
    }
  }
  puts("-1");
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
//#include <iostream>
////#include <queue>
////#include <bits/stdc++.h>


#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <cmath>
#include <fenv.h>
#include <algorithm>
#include <cstdio>
#include <cctype>

using namespace std;
//
//bool is_vowel(char c)
//{
//	return c=='a' || c=='e' || c=='o' || c=='u' || c=='i';
//}
void solve(int a, int b)
{
	stringstream ss;
	ss << a << b;
	int n = atoi(ss.str().c_str());
	float _sqrt = sqrt((double)n);
	if(floor(_sqrt) == _sqrt){
		cout << "Yes" << endl;
		return;
	}
	cout << "No" << endl;

}

int main()
{
	int a,b; cin >> a >> b;
//	int a=12,b=10;
	solve(a,b);

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    char S[128];
    scanf("%s", S);
    for(int i=0; S[i]!='\0'; i++){
        if(
                !(i%2==0 && (S[i] == 'R' || S[i] == 'U' || S[i] == 'D') )
                && !(i%2==1 && (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') )){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通りに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			@SuppressWarnings("unchecked")
			List<Path>[] pathLists = new List[n];
			IntStream.range(0, n).forEach(i -> pathLists[i] = new ArrayList<>());
			IntStream.range(0, n - 1).forEach(i -> {
				int u = scanner.nextInt() - 1, v = scanner.nextInt() - 1;
				long w = scanner.nextLong();
				pathLists[u].add(new Path(u, v, w));
				pathLists[v].add(new Path(v, u, w));
			});
			long[] distances = dijkstra(pathLists, 0, n);
			Arrays.stream(distances).map(l -> l & 1L).forEach(System.out::println);
		}
	}

	/**
	 * @param pathLists ノード間の連結パス一覧の配列
	 * @param src       開始ノード
	 * @param n         ノードの数
	 * @return 開始ノードからの距離の配列
	 */
	private static long[] dijkstra(List<Path>[] pathLists, int src, int n) {
		long[] distances = new long[n];
		Arrays.fill(distances, Long.MAX_VALUE);
		// 最短距離が確定したかどうか
		boolean[] fixed = new boolean[n];
		Arrays.fill(fixed, false);
		// 出発地点までの距離を0とする
		distances[src] = 0;
		Queue<Path> queue = new PriorityQueue<>();
		queue.add(new Path(src, src, 0));
		while (!queue.isEmpty()) {
			int now = queue.poll().to;
			if (!fixed[now]) {
				fixed[now] = true;
				for (Path path : pathLists[now]) {
					if (!fixed[path.to] && distances[path.to] > distances[now] + path.cost) {
						distances[path.to] = distances[now] + path.cost;
						queue.add(new Path(path.to, path.to, distances[path.to]));
					}
				}
			}
		}
		return distances;
	}

	/**
	 * ノード間の一つのパスを表すクラス
	 */
	private static class Path implements Comparable<Path> {
		/** 開始ノード */
		@SuppressWarnings("unused")
		int from;
		/** 終了ノード */
		int to;
		/** 移動コスト */
		long cost;

		Path(int from, int to, long cost) {
			super();
			this.from = from;
			this.to = to;
			this.cost = cost;
		}

		@Override
		public int compareTo(Path path) {
			return Long.compare(cost, path.cost);
		}
	}
}


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

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

  string s;
  cin >> s;

  int k = s.size();
  int cnt = 15-k;
  REP(i,k) if(s[i] == 'o') cnt++;

  if(cnt >= 8) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  string s;cin>>s;
  ll n=s.size();
  ll num[n];rep(i,0,n)num[i]=s[i]-'0';

  ll ans=0;

  rep(bit,0,(1<<(n-1))){
    ll now=num[0];
    rep(i,0,n-1){
      if((bit>>i)&1){
        ans+=now;
        now=num[i+1];
      }else{
        now*=10;
        now+=num[i+1];
      }
    }
    ans+=now;
  }
  out(ans);




  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
dicts = []
sets = []
da = dicts.append
for i in [input() for _ in range(n)]:
    tmp_dict = defaultdict(lambda: 0)
    for j in i:
        tmp_dict[j] += 1
    da(tmp_dict)

intersection = set(dicts[0].keys())
for i in dicts[1:]:
    intersection = intersection & i.keys()
final_words = ''
for i in sorted(list(intersection)):
    tmp = 100
    for j in dicts:
        t = j[i]
        if t < tmp:
            tmp = t
    final_words += i*tmp
print(final_words)

Measured memory_bytes: 3444
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; ll K;
int A[int(2e5 + 5)], visited[int(2e5 + 5)];

vector <int> ans;

int main(){
  cin >> N >> K;
  fill(visited + 2, visited + N + 1, -1);

  for (int i = 1; i <= N; i++) cin >> A[i];

  ll now = 1, start;
  ans.push_back(1);

  while (true){
    now = A[now];
    ans.push_back(now);

    if (visited[now] != -1){
      start = visited[now];
      break;
    }
    visited[now] = ans.size();
  }

  if (ans.size() > K){
    cout << ans[K] << endl;
    return 0;
  }

  ll Period = ans.size() - start;
  if (start == 0) Period--;
  K -= start; K %= Period;
  cout << ans[start + K] << endl;

  return 0;
}


Measured memory_bytes: 5776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<int, ii>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define mp make_pair
#define fi first
#define se second
// #define multicase
const int MOD = 1e9 + 7;
const int INF = 2e9;
// const int N = ;

void solve() {
    int T = 1;
  #ifdef multicase
    cin >> T;
  #endif
    for(int tc = 1, n; tc <= T; tc++) {
        cin >> n;
        cout << n + n * n + n * n * n << "\n";
    }
}

int main() {
 
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    solve();
    
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}
li M=1e9+7;
vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}



li ncr(li n,li r)
{
    li num=1,den=1;

    f(i,0,r-1)
    {
        num = (num * ((n-i)%M))%M;
    }

    f(i,1,r)
    {
        den = (den * i)%M;
    }

    return (num * fastpow(den,M-2,M))%M;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n,a,b;

    cin>>n>>a>>b;

    li total = fastpow(2,n,M);

    total = (total-1)%M;

    total = (total - ncr(n,a) + M)%M;
    total = (total - ncr(n,b) + M)%M;

    cout<<total;

    return 0;
}

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

namespace ABC145
{
    class C
    {
        static double total = 0;
        static long[] x;
        static long[] y;

        static void Main(string[] args)
        {
            //input
            int N = int.Parse(Console.ReadLine());
            x = new long[N];
            y = new long[N];

            for (long i = 0; i < N; i++)
            {
                long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
                x[i] = input[0];
                y[i] = input[1];
            }

            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (i != j) total += Math.Sqrt(Math.Pow(x[j] - x[i], 2) + Math.Pow(y[j] - y[i], 2));
                }
            }

            Console.WriteLine(total / N);

        }
    }
}



Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

const int INF = 1e9;
const int MAXN = 2e5 + 1;
vi adj[MAXN*3];

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);

	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		u = (u-1) * 3;
		v = (v-1) * 3;
		adj[u].push_back(v+1);
		adj[u+1].push_back(v+2);
		adj[u+2].push_back(v);
	}

	int s, t;
	scanf("%d%d", &s, &t);
	s = (s-1) * 3;
	t = (t-1) * 3;
	vi dist(n*3, INF);
	dist[s] = 0;
	queue<int> q;
	q.push(s);
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		if (u == t) break;
		for (int v : adj[u]) {
			if (dist[v] == INF) {
				dist[v] = dist[u] + 1;
				q.push(v);
			}
		}
	}

	printf("%d\n", dist[t] == INF? -1 : dist[t]/3);
}


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

int main(){
    int n;
    string words[4] = {"AC","WA","TLE","RE"};
    string serihu[4] = {"AC x ","WA x ","TLE x ","RE x "};
    int value[4] = {0};
    string s;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        for(int j=0;j<4;j++){
            if (words[j] == s){
                value[j]++;
            }
        }
    }
    for(int i=0;i<4;i++){
        cout << serihu[i] << value[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
MOD = 10**9+7
s = input()

dp = [[0]*4 for _ in range(len(s)+1)]
dp[0][0] = 1
for i, ss in enumerate(s):
    if ss == 'A':
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = (dp[i][1] + dp[i][0])%MOD
        dp[i+1][2] = dp[i][2]
        dp[i+1][3] = dp[i][3]
    elif ss == 'B':
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = dp[i][1]
        dp[i+1][2] = (dp[i][2] + dp[i][1])%MOD
        dp[i+1][3] = dp[i][3]
    elif ss == 'C':
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = dp[i][1]
        dp[i+1][2] = dp[i][2]
        dp[i+1][3] = (dp[i][3] + dp[i][2])%MOD
    else:
        dp[i+1][0] = dp[i][0]*3%MOD
        dp[i+1][1] = (dp[i][1]*3%MOD + dp[i][0])%MOD
        dp[i+1][2] = (dp[i][2]*3%MOD + dp[i][1])%MOD
        dp[i+1][3] = (dp[i][3]*3%MOD + dp[i][2])%MOD

# for dp_ in dp: print(dp_)
print(dp[-1][3])


Measured memory_bytes: 27552
let rec dikjstra ( + ) ( < ) q edge d =
  match q with
  | [] -> ()
  | u :: q ->
      let u, q =
        List.fold_left (fun (u, q') u' ->
          if d.(u) < d.(u') then (u, u' :: q')
          else (u', u :: q')) (u, []) q in
      List.iter (fun (v, c) ->
        if c + d.(u) < d.(v) then
          d.(v) <- c + d.(u)) (edge u);
      dikjstra ( + ) ( < ) q edge d

let () = Scanf.scanf "%d %d %d %d\n%d\n" @@ fun xs ys xt yt n ->
  let xyrs = Array.init (n + 2) @@ function
    | 0 -> (float_of_int xs, float_of_int ys, 0.)
    | 1 -> (float_of_int xt, float_of_int yt, 0.)
    | _ -> Scanf.scanf "%d %d %d\n" @@ fun x y r ->
        float_of_int x, float_of_int y, float_of_int r in
  let d = Array.make (n + 2) infinity in
  d.(0) <- 0.;
  dikjstra ( +. ) ( < )
    (Array.to_list @@ Array.init (n + 2) @@ fun v -> v)
    (fun v ->
      let (x, y, r) = xyrs.(v) in
      List.mapi (fun u (x', y', r') ->
        (u, max 0. (sqrt ((x -. x') ** 2. +. (y -. y') ** 2.) -. r -. r'))) @@
      Array.to_list xyrs) d;
  Printf.printf "%.16f" d.(1)



Measured memory_bytes: 5504
import java.io.*
import java.util.*

fun solve(N: Int, P: IntArray) {
    val accMin = P.toList().scanLeft(P[0]) { a, b -> Math.min(a, b) }.toList()
    // println(accMin)
    (0 until N).count { P[it] == accMin[it] }.let { println(it) }
    return
}

fun <T, R> Iterable<T>.scanLeft(initial: R, operation: (acc: R, T) -> R): Sequence<R> {
    var last = initial
    return this.asSequence().map { last = operation(last, it); last }
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val P = IntArray(N.toInt())
    for (i in 0 until N.toInt()) {
        P[i] = sc.next().toInt()
    }
    solve(N, P)
}


Measured memory_bytes: 61916
#include<stdio.h>
#include<stdlib.h>

#define N 100001
#define nil -1
#define WHITE 0
#define BLACK 1
#define INF 9999999

typedef struct{
  int prev,next,cost;
}Edge;
 
int n,d[N];
Edge e[500000];

void dijkstra(int);
void initializeSingleSource(int);

int main(){

  int i,j,u,k,c,ed=0,v,w=INF,r;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
      for(j=0;j<k;j++){
	e[ed].prev=u;
	scanf("%d%d",&e[ed].next,&e[ed].cost);
	ed++;
      }
  }
  
  dijkstra(ed);

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


void dijkstra(int edges){

  int i,flag;

  for(i=0;i<n;i++){
   d[i]=INF;
  }
  d[0]=0;
    
  flag=1;
  while(flag!=0){
    flag=0;
    for(i=0;i<edges;i++){
      if(e[i].cost+d[e[i].prev]<d[e[i].next]){
	d[e[i].next]=e[i].cost+d[e[i].prev];
	flag=1;
      }
    }
  }
}
  

Measured memory_bytes: 6460
#include <stdio.h>
#include <string.h>

int resipi[101][101],item_price[101],visit[101];
char item_name[101][101];

int func(int num){
	int i,j;
	int ans=0;
	if(resipi[num][0]==0)
		return item_price[num];
	
	for(i=1;i<=resipi[num][0];i++){
		
		if(visit[resipi[num][i]]==1){
			ans+=item_price[resipi[num][i]];
		}
		else if(resipi[resipi[num][i]][0]==0){
			visit[resipi[num][i]]=1;
			ans+=item_price[resipi[num][i]];
		}
		else{
			visit[resipi[num][i]]=1;
			ans+=func(resipi[num][i]);
		}
	}
	if(ans<item_price[num])item_price[num]=ans;
	return item_price[num];
}


int main(void){
	int n;
	while(scanf("%d",&n),n){
		int i,j,l,m,k,t;
		char name[101];
		
		scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%s%d",item_name[i],&item_price[i]);
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%s%d",name,&k);
			for(j=0;j<n;j++){
				if(!(strcmp(item_name[j],name))){
					t=j;
					resipi[t][0]=k;
				}
			}
			for(j=0;j<k;j++){
				scanf("%s",name);
				for(l=0;l<n;l++){
					if(!(strcmp(item_name[l],name))){
						resipi[t][j+1]=l;
						break;
					}
				}
			}
		}
		scanf("%s",name);
		for(i=0;i<n;i++){
			if(!(strcmp(item_name[i],name))){
				break;
			}
		}
		printf("%d\n",func(i));
		
		for(i=0;i<101;i++){
			resipi[i][0]=0;
			visit[i]=0;
		}
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char X = sc.next().toCharArray()[0];
    char Y = sc.next().toCharArray()[0];
    if(X < Y){
      System.out.println("<");
    }
    else if (X == Y){
      System.out.println("=");
    }
    else{
      System.out.println(">");
    }
  }
}


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

using namespace std;

#define ll long long
#define endl '\n'
#define pb push_back
#define inf 1e9

int v[200005];

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

    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    int ans = 0;
    int menor = v[0];
    for (int i = 0; i < n; i++)
    {
        if (v[i] <= menor) {
            ans++;
        }

        menor = min(menor, v[i]);
    }

    cout << ans << endl;

    //Dado um v[i], todos os seus antecessores devem ser menor que ele;

    return 0;
}


Measured memory_bytes: 1024
let fact n =
  if n = 0 || n = 1 then 1
  else
    let rec doit i x y =
      if i = n then y
      else doit (i + 1) y (x + y)
    in doit 2 1 2

let () =
  Printf.printf "%d\n" (fact (read_int ()))

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/05  Problem: ABC 095 B / Link: http://abc095.contest.atcoder.jp/tasks/abc095_b  ----- */


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

	LL N, X; cin >> N >> X;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	X -= accumulate(ALL(a), 0LL);
	LL ans = N;
	ans += X / (*min_element(ALL(a)));
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Numerics;
using System.Collections;
using System.Collections.Generic;
public class Program {
    static void Main (string[] args) {
        var n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        int[] t = a.ToArray();
        Array.Sort(t);
        int m = n / 2 - 1;
        for (int i = 0; i < n; ++i) {
            if (a[i] <= t[m]) {
                Console.WriteLine(t[m+1]);
            } else {
                Console.WriteLine(t[m]);
            }
        }
    }
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	unsigned n; cin >> n;
	unsigned m; cin >> m;
	vector<char> s(n + 1);
	rep(i, n + 1) {
		char c; cin >> c;
		if (c == '0') s[i] = 0; else s[i] = 1;
	}
	reverse(s.begin(), s.end());
	vector<unsigned> ans = { 0 };
	unsigned skips = 0;
	for(unsigned i = 1; i <= n; i++) {
		if (s[i]) {
			skips++;
		}
		else {
			skips++;
			if (ans.back() + skips <= m) ans.back() += skips;
			else if (skips <= m) ans.push_back(skips);
			else { cout << -1 << endl; return; }
			skips = 0;
		}
	}
	reverse(ans.begin(), ans.end());
	rep(i, ans.size()) {
		if (i != 0) cout << " ";
		cout << ans[i];
	}cout << endl;
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 1020
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    SP = [None] * N
    for i in range(N):
        line = input().rstrip().split()
        SP[i] = (line[0], -int(line[1]), i + 1)
    SP.sort(key=lambda x: (x[0], x[1]))
    for i in range(N):
        print(SP[i][2])


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = {{typeid(int), "%d"},
                                                      {typeid(ll), "%lld"},
                                                      {typeid(double), "%lf"},
                                                      {typeid(char), "%c"}};

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	cout << static_cast<char>(s1[0] - 32) << static_cast<char>(s2[0] - 32) << static_cast<char>(s3[0] - 32) << endl;
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  auto tFormat = scanType[typeid(T)];
  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 256
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b,c=mi()
l=[0]*a
for i in range(c):
  j=ii()
  l[j-1]+=1
for k in l:
  if b+k-c>0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 5192
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
#include <iomanip>
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

ll f(ll n){
  ll res = 0;
  while(n>0){
    res += n%10;
    n/= 10;
  }
  return res;
}

double g(ll n){
  return (double)(n)/f(n);
}

int main ()
{
  vector<ll> res;
  ll base = 1;
  for (int i = 0; i < 15; i++)
  {
    for (int j = 1; j < 150; j++)
    {
      res.push_back(base * (j+1) - 1);
    }
    base *= 10;
  }
  sort(res.begin(),res.end());
  res.erase(unique(res.begin(),res.end()),res.end());

  REP(i,res.size()){
    for (ll j = i; j < res.size(); j++)
    {
      if(g(res[i])>g(res[j])){
        res.erase(res.begin()+i--);
        break;
      }
    }
  }

  ll K;cin>>K;
  REP(i,K){
    cout<<res[i]<<endl;
  }
  return 0;
}

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

int main() {
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    double dis;
    dis = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));

    cout << fixed << setprecision(7) << dis << endl;
}



Measured memory_bytes: 3284
#include <cstdio>

//input
int a, b, c, d, e, f;

void solve() {
	double x = 1.0 * (c * e - b * f) / (a * e - b * d);
	double y = (c - a * x) / b;
	if (x == -0)x = 0;
	if (y == -0)y = 0;
	printf("%.3lf %.3lf\n", x, y);
}

int main(int argc, char const *argv[]) {
	//  freopen("in.txt", "r", stdin);

	while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) {
		solve();
	}

	return 0;
}


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

using namespace std;

long int search_prime(long int num) {

    for (long int i = sqrt(num); i > 1; i--) {
        if (num % i == 0) return i;
    }
    return -1;
}

int main() {
    long long int num;

    cin >> num;

    long int div1 = search_prime(num);

    if (div1 == -1) 
        cout << num - 1 << endl;
    else 
        cout << (div1 + (num / div1)) - 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	vector<ll> v(3);
	for(int i = 0; i < 3; i++)
		cin >> v[i];
	
	sort(v.begin(), v.end());
	
	if(v[0] == v[1] && v[0] != v[2]){
		cout << "Yes" << endl;
		return 0;
	}
	
	if(v[2] == v[1] && v[2] != v[0]){
		cout << "Yes" << endl;
		return 0;
	}
	
	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
int cal(int x){
    int ret=0;
    while (x) {
        ret+=(x % 10);
        x/=10;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);
    int ans=10000000;
    cin>>n;
    //for (int i=1; i<=99999; i++) num[i]=cal(i);
    for (int i=1; i<n; i++) ans=min(ans,cal(i)+cal(n-i));
    cout<<ans<<endl;
    return 0;
}

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


int main() {
	//cout << fixed << setprecision(10);
	string str;
	long long int n, m, a=0, b=0, c, d, x, h[30], w, cou = 1,Max=0;
	cin >>str ;
	n = str.length();
	for (int i = 0; i < n; i++) {
		if (str[i] == '0'&&i%2==0) { a++; }
		if (str[i] == '0' && i % 2 == 1) { b++; }
		if (str[i] == '1' && i % 2 == 0) { b++; }
		if (str[i] == '1' && i % 2 == 1) { a++; }
	}
	cout << min(a,b);
	
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;


int main()
{
    char letterts[5] = {'a' , 'e' , 'i' , 'o' , 'u'};
    char input;
    cin>>input;
    for(int i=0 ; i<5 ; i++)
    {
        if(input==letterts[i])
        {
            cout<<"vowel\n";
            break;
        }
        else if(input!=letterts[i]&&i==4)
        {
            cout<<"consonant\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d = sc.nextInt();
    int c = 0;
    int x[][] = new int[n][d];
    for(int i = 0;i < n;i++)
    {
      for(int j = 0;j < d;j++)
      {
        x[i][j] = sc.nextInt();
      }
    }
    
    for(int i = 0;i < n-1;i++)
    {
      for(int j = i+1;j < n;j++)
      {
        double sum = dist(x[i], x[j]);
        if(Math.ceil(sum) == sum)
        {
          c++;
        }
      }
    }
    
    System.out.println(c);
    
  }
  
  
  static double dist(int x[], int y[])
  {
    double sum = 0;
    for(int i = 0;i < x.length;i++)
      sum += Math.pow(x[i]-y[i], 2);
    
    return Math.sqrt(sum);
        
  } 
}
  

Measured memory_bytes: 21844
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}
void solve(){
    ll A, B, N;
    cin >> A >> B >> N;
    if(N >= B - 1){
        ll guess = (A * (B - 1)) / B;
        guess -= A * ((B-1) / B);
        cout << guess << endl;
    }
    else{
        cout << ((A * N) / B) - (A * (N / B)) << endl;
    }
    return;
    int best = 0;
    for(int i = 0; i <= 200; ++i){
        int one = (A * i) / B;
        int two = A * (i / B);
        int diff = one - two;
        best = max(best, diff);
        //cout <<one << " " << two << endl;
    }
    int guess = (A * (B - 1)) / B;
    guess -= A * ((B-1) / B);
    assert(best == guess);
    cout << best << endl;
}

int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t;
    t = 1;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3644
#include <stdio.h>

int main()
{
    int S, h, m, s;
    scanf("%d", &S);
    if(S>= 0 && S<= 86400){
        m = S % 3600;
        h = (S-m)/3600;
        s = m % 60;
        m = (m-s)/60;
        printf("%d:%d:%d\n", h, m, s);
    }
    return 0;
}

Measured memory_bytes: 592
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int K;
    cin >> K;

    deque<int> que;

    const int INF = 1 << 30;
    vector<int> dis(K, INF);
    
    priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
    for (int i = 1; i <= 9; ++i) {
        dis[i % K] = min(dis[i % K], i);
        pq.emplace(dis[i % K], i);
    }

    while (!pq.empty()) {
        int x = pq.top().second;
        int d = pq.top().first;

        pq.pop();

        if (dis[x] != d) {
            continue;
        }

        for (int i = 0; i <= 9; ++i) {
            int nx = (x * 10 + i) % K;
            if (dis[nx] > d + i) {
                dis[nx] = d + i;
                pq.emplace(dis[nx], nx);
            }
        }
    }

    cout << dis[0] << '\n';

    return 0;
}

Measured memory_bytes: 5692
import sys

def main(apples,ln):
    minp=apples[0]
    profit=[0,0]
    for x in range(1,n):
        minp=min(apples[x],minp)
        if profit[1]<apples[x]-minp:
            profit[0]=1
            profit[1]=apples[x]-minp
        elif profit[1]==apples[x]-minp:
            profit[0]+=1
    return profit[0]

n,t=map(int, sys.stdin.readline().strip().split())
apples=list(map(int,sys.stdin.readline().strip().split()))

print(main(apples,n))


Measured memory_bytes: 20508
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(input())
    a = (N + 999) // 1000
    print(a * 1000 - N)

if __name__ == "__main__":
    run()

Measured memory_bytes: 9160