akhauriyash/Code-Regression huggingface dataset:
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

nn = inputs[0][0]
lst = inputs[1]

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
  p nn
  p lst
end

flag = true
if nn % 3 != 0
  val = lst[0]
  lst.each do |l_i|
    if l_i != val
      flag = false
      break
    end
  end
  if val != 0
    flag = false
  end
else
  cnt = 0
  vals_hh = {}
  lst.each do |l_i|
    if vals_hh[l_i] == nil
      if cnt == 3
        flag = false
        break
      else
        cnt += 1
        vals_hh[l_i] = 1
      end
    else
      vals_hh[l_i] += 1
    end
  end # l_i
  arr = vals_hh.to_a
  pd arr
  if arr.size == 1
    if !(arr[0][0] == 0)
      flag = false
    end
  elsif arr.size == 2
    if !((arr[0][0] == 0 and (arr[0][1]*2 == arr[1][1])) or (arr[1][0] == 0 and (arr[0][1] == arr[1][1]*2)))
      flag = false
    end
  elsif !(arr[0][0] ^ arr[1][0] ^ arr[2][0] == 0 and arr[0][1] == arr[1][1] and arr[1][1] == arr[2][1])
    flag = false
  end
end

if flag == true
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 9244
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

pair<int,int> z[100000];
int o[100000];

int main(){
    int h,w,d;
    cin >> h>> w>> d;
    rep(i,h){
        rep(j,w){
            int a;
            cin >> a;
            z[a]=mp(i,j);
        }
    }
    int q;
    cin >> q;
    
    rep(i,d){
        o[i]=0;
    }
    reps(i,d,90005){
        o[i]=o[i-d]+abs(z[i].first-z[i-d].first)+abs(z[i].second-z[i-d].second);
    }
    
    
    rep(i,q){
        int l,r;
        cin >> l>> r;
        int temp=0;
        temp=o[r]-o[l];
        qu.push(temp);
    }
    while(!qu.empty()){
        int ans=qu.front();
        qu.pop();
        cout<<ans<<endl;
    }
    cerr<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, X, T;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> X >> T;

	int ans = (N + X - 1) / X * T;
	cout << ans << endl;
}







Measured memory_bytes: 3584
import java.util.*;

public class Main {

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

		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if((n|m)==0)break;
			int[] a = new int[n];
			int[] b = new int[m];
			int sumA = 0;
			int sumB = 0;
			for(int i=0;i<n;i++){
				a[i] = sc.nextInt();
				sumA += a[i];
			}
			for(int i=0;i<m;i++){
				b[i] = sc.nextInt();
				sumB += b[i];
			}
			if((sumA+sumB)%2==1){
				System.out.println("-1");
			}else{
				Arrays.sort(a);
				Arrays.sort(b);
				int sub = (sumA+sumB)/2 - sumA;
				boolean go = true;
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(b[j]-a[i]==sub){
							System.out.println(a[i] + " " + b[j]);
							i=n;
							j=m;
							go = false;
						}
					}
				}
				if(go==true)System.out.println("-1");

			}	
		}
	}
}

Measured memory_bytes: 21020
/* ITP1_8_A: Toggling Cases */

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

char toggle_case(char c) {
    if ('a' <= c && c <= 'z')
        return toupper(c);
    else if ('A' <= c && c <= 'Z')
        return tolower(c);
    else
        return c;
}

int main() {
    string s;
    getline(cin, s);
    transform(s.begin(), s.end(), s.begin(), toggle_case);
    cout << s << endl;
    return 0;
}

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

using namespace std;

constexpr int MAX = 100000;

int main() {
	int n, m;
	int l[MAX], r[MAX];
	fill(l, l + MAX, 0);
	fill(r, r + MAX, 114514);

	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		cin >> l[i] >> r[i];
	}

	sort(l, l + MAX);
	sort(r, r + MAX);

	if (l[MAX - 1] > r[0]) {
		cout << 0;
	}
	else {
		cout << r[0] - l[MAX - 1] + 1;
	}
	cout << endl;

	return 0;
}

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

#define X first
#define Y second
#define MP make_pair

using namespace std;

typedef long long ll;

const int N = 1e3 + 123;
const ll mod = 1e9 + 7;

int n, m, q;
ll k;
bool a[N][N];

ll bin_pow(ll x, ll y){		
	ll res = 1ll;
	while(y){
		if(y & 1ll)
			res = res * x % mod;
		x = x * x % mod;
		y >>= 1ll;
	}
	return res;
}

ll mtx[2][2], mrs[2][2] = {{1, 0}, {0, 1}};
ll need[2][2];

int main () {
	scanf("%d %d %lld\n", &n, &m, &k);
	char temp;
	ll cnt = 0;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			scanf("%c", &temp), a[i][j] = (temp == '#'), cnt += a[i][j];
		}
		scanf("\n");
	}

	int hor = 0, ver = 0;
	for(int i = 0;i < n;i++)
		hor += (a[i][0] && a[i][m - 1]);
	for(int i = 0;i < m;i++)
		ver += (a[0][i] && a[n - 1][i]);
	if((hor && ver) || k == 0)
		return cout << 1, 0;
	if(!(hor || ver))
		return cout << bin_pow(cnt, k - 1), 0;
	mtx[0][0] = cnt, mtx[1][1] = hor + ver;
    for(int i = ver > 0;i < n;i++){
    	for(int j = hor > 0;j < m;j++){
    		if(hor && a[i][j] && a[i][j - 1])
    			mtx[0][1] -= 1;
    		if(ver && a[i - 1][j] && a[i][j])
    			mtx[0][1] -= 1;
    	}
    }
    k -= 1;
    // cerr << mtx[0][0] << " " << mtx[0][1] << "\n";
    // cerr << mtx[1][0] << " " << mtx[1][1] << "\n";
    // cerr << "\n\n";
    // cerr << mrs[0][0] << " " << mrs[0][1] << "\n";
    // cerr << mrs[1][0] << " " << mrs[1][1] << "\n";
    // cerr << "\n\n";
    while(k){
    	if(k & 1ll){
    		for(int i = 0;i < 2;i++){
    			for(int j = 0;j < 2;j++){
    				need[i][j] = 0;
    				for(int z = 0;z < 2;z++){
    					need[i][j] = (need[i][j] + mrs[i][z] * mtx[z][j] % mod + mod) % mod;
    				}
    			}
    		}
    		for(int i = 0;i < 2;i++){
    			for(int j = 0;j < 2;j++){
    				mrs[i][j] = need[i][j];
    			}
    		}
    	}
    	for(int i = 0;i < 2;i++){
   			for(int j = 0;j < 2;j++){
   				need[i][j] = 0;
   				for(int z = 0;z < 2;z++){
   					need[i][j] = (need[i][j] + mtx[i][z] * mtx[z][j] % mod + mod) % mod;
   				}
   			}
   		}
   		for(int i = 0;i < 2;i++){
   			for(int j = 0;j < 2;j++){
   				mtx[i][j] = need[i][j];
   			}
   		}
   		k >>= 1ll;
    }
    cout << (mrs[0][0] + mrs[0][1] + mod) % mod;
}


Measured memory_bytes: 4836
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // シミュレーション
        Scanner sc = new Scanner(System.in);
        int[] antena = new int[6];
        for (int i = 0; i < 6; i++) {
            antena[i] = sc.nextInt();
        }

        int limit = antena[5];
        boolean isJumming = false;
        for (int i = 0; i < 6; i++) {
            for (int j = i + 1; j < 6; j++) {
                if ((antena[j] - antena[i]) > limit) {
                    isJumming = true;
                }
            }
        }

        System.out.println(isJumming ? ":(" : "Yay!");
    }
}


Measured memory_bytes: 23636
h,w= map(int, input().split())
n=int(input())
a=list(map(int, input().split()))
maze=[[0]*w for i in range(h)]
for i in range(h):
  for j in range(w):
    maze[i][j]=n
    a[n-1]-=1
    if a[n-1]==0:
      a.pop(-1)
      n-=1
for i in range(h):
  if i%2==1:
    print(*maze[i][::-1])
  else:
    print(*maze[i])
  

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

struct Job {
    int t, d;
    Job(int t = 0, int d = 0) : t(t), d(d) {}
};

bool operator< (Job a, Job b) {
    return a.d < b.d;
}

Job a[MAXN];
int n;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) cin >> a[i].t >> a[i].d;
    sort(a+1, a+n+1);
    ll now = 0;
    FOR(i,1,n) {
        now += a[i].t;
        if (now > a[i].d) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 1792
k = gets.to_i
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
puts array[k-1]

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int N;
	string S;
	cin >> N >> S;

	int c = 1;
	for (int i = 1; i < N; i++) {
		if (S[i] != S[i - 1]) c++;
	}

	cout << c << endl;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    ll a = 1, b = 0;
    while(n--) {
        ll q, x;
        cin >> q >> x;
        if(q == 1) {
            a *= x;
            b *= x;
        } else if(q == 2) {
            b += x;
        } else if(q == 3) {
            b -= x;
        }
    }

    cout << -b << " " << a << endl; 

    return 0;
}



Measured memory_bytes: 3208
#!/usr/bin/python3.6
import bisect
n = int(input())
x = [int(item) for item in input().split()]
l = int(input())
q = int(input())
ab = []
for i in range(q):
    a, b = [int(item) for item in input().split()]
    a -= 1; b -= 1
    if a > b:
        a, b = b, a
    ab.append((a, b))

dt = [[0] * n for _ in range(40)]
for i, item in enumerate(x):
    dt[0][i] = i
    dt[1][i] = bisect.bisect_right(x, item + l) - 1

for i in range(2, 40):
    for j in range(n):
        dt[i][j] = dt[i-1][dt[i-1][j]]

for a, b in ab:
    days = 0
    is_ok = False
    while a < b:
        for i in range(0, 40):
            if dt[i][a] >= b:
                if i == 1:
                    days += 1
                    is_ok = True
                else:
                    a = dt[i-1][a]
                    days += 2**(i-2)
                break
        if is_ok:
            break
    print(days)

Measured memory_bytes: 112280
#include<bits/stdc++.h>
using namespace std;
bool have[200];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int x, n;
	cin >> x >> n;
	for (int i = 1; i <= n; ++i) {
		int y;
		cin >> y;
		have[y] = true;
	}
	int answer = 0;
	int mn = 2e9;
	for (int i = 0; i <= 198; ++i) {
		if (have[i] == false) {
			if (abs(i - x) < mn) {
				mn = abs(i - x);
				answer = i;
			}
		}
	}
	cout << answer;
}

Measured memory_bytes: 3608
N=int(input())
A=list(map(int,input().split()))
def combinations_count2(n):
  return n*(n-1) // 2
d=[0]*(N+1)
for a in A:
  d[a]+=1
ans=0
for i in range(1,N+1):
  if d[i]>1:
    _=combinations_count2(d[i])
    ans+=_
    d[i]=_-combinations_count2(d[i]-1)
  else:
    d[i]=0
for a in A:
  print(ans-d[a])

Measured memory_bytes: 24996
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    ll N,M;
    cin >> N >> M;
    vector<pair<pair<ll,ll>,ll>> v(M);
    rep(i,M){
        cin >> v[i].first.first >> v[i].first.second;
        v[i].second = i;
    }
    sort(v.begin(),v.end());
    vector<pair<ll,ll>> out(M);
    ll cnt = 1;
    rep(i,M){
        out[v[i].second].first = v[i].first.first;
        if(i==0) ;
        else if(v[i].first.first==v[i-1].first.first) cnt++;
        else cnt = 1;
        out[v[i].second].second = cnt;
    }
    rep(i,M) cout << setfill('0') << right << setw(6) << out[i].first << setfill('0') << right << setw(6) << out[i].second << endl;
    return 0;
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


enum DIR{
	UNDEFINED,
	UP,
	DOWN,
	HORIZON,
};

enum Type{
	Kougen,
	Bonchi,
	Sanpuku,
	Mine,
	Kubochi,
};

int main(){

	DIR pre_pre = UNDEFINED,pre = UNDEFINED,current;

	int N;
	int H_pre,H_current;
	int table[5];

	for(int i = 0; i < 5; i++){

		table[i] = 0;
	}

	scanf("%d %d",&N,&H_pre);

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

		scanf("%d",&H_current);

		if(H_pre == H_current){

			current = HORIZON;

		}else{

			if(H_pre > H_current){

				current = DOWN;

				if(pre == HORIZON){

					if(pre_pre == UP){

						table[Kougen]++;

					}else if(pre_pre == DOWN){

						table[Sanpuku]++;
					}

				}else if(pre == UP){

					table[Mine]++;
				}

			}else{

				current = UP;

				if(pre == HORIZON){

					if(pre_pre == UP){

						table[Sanpuku]++;

					}else if(pre_pre == DOWN){

						table[Bonchi]++;
					}

				}else if(pre == DOWN){

					table[Kubochi]++;
				}
			}
		}

		H_pre = H_current;

		if(current != pre){
			pre_pre = pre;
			pre = current;
		}
	}

	printf("%d %d %d %d %d\n",table[Kougen],table[Bonchi],table[Sanpuku],table[Mine],table[Kubochi]);

	return 0;
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  ll e = 0, c = 1;
  while (c <= n) {
    c *= 2;
    e++;
  }
  cout << (ll)(c - 1) << endl;
}

Measured memory_bytes: 256
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();

            long possession = 1000;
            var max = line[0];
            var min = line[0];
            bool? increased = null;

            for(var i = 1; i < n; i++)
            {
                if(line[i] > line[i - 1])
                {
                    if(increased != true)
                    {
                        increased = true;
                        min = line[i - 1];
                        max = line[i];
                    }
                    max = Max(max, line[i]);
                }
                else if(line[i] < line[i - 1])
                {
                    if(increased != false)
                    {
                        if(increased == true)
                        {
                            possession += (possession / min) * (max - min);
                            max = line[i];
                            min = line[i];
                        }
                        increased = false;
                        max = line[i - 1];
                    }
                    min = Min(min, line[i]);
                }
            }

            if(increased == true)
            {
                possession += (possession / min) * (max - min);
            }

            WriteLine(possession);
        }
    }
}


Measured memory_bytes: 28068
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n,k,q; cin>>n>>k>>q;
	vl a(n),b(n);
	rep(i,0,q){
		ll p; cin>>p;
		--p;
		a[p]++;
	}
	rep(i,0,n){
		if(q-a[i]>=k) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
using namespace std;
long N,H,D,mod=1e9+7;
//1-indexed
#include<vector>
template<typename T>
struct BIT{
	int n;
	vector<T>bit;
	BIT(int n_=0,T a=0):n(n_),bit(n_+1,a){}
	T sum(int i)
	{
		T ans=0;
		for(;i>0;i-=i&-i)(ans+=bit[i])%=mod;
		return ans;
	}
	void add(int i,T a)
	{
		if(i==0)return;
		for(;i<=n;i+=i&-i)(bit[i]+=a)%=mod;
	}
};
main()
{
	cin>>N>>H>>D;
	BIT<long>P(H);
	long s=0,p=1;
	for(int i=1;i<=N;i++)
	{
		p=p*i%mod;
		s=(s+p)%mod;
	}
	for(int i=0;i<D;i++)if(i<H)P.add(i+1,p);
	for(int i=1;i<H;i++)
	{
		P.add(i+1,(P.sum(i)-P.sum(i-D))*s%mod);
	}
	cout<<((P.sum(H)-P.sum(H-1))%mod+mod)%mod<<endl;
}


Measured memory_bytes: 8064
#include<cstdio>
#define MAXN 300000
int N,Ans,Pr=MAXN+5;
char Str[MAXN+5];
int main(){
	scanf("%d %s",&N,Str);
	for(int i=1;i<N;i++)
		if(Str[i]=='E')
			Ans++;
	Pr=Ans;
	for(int i=1;i<N;i++){
		if(Str[i]=='E')
			Ans--;
		if(Str[i-1]=='W')
			Ans++;
		if(Pr>Ans)
			Pr=Ans;
	}
	printf("%d\n",Pr);
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll r; cin>>r; cout<<3*r*r<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
int a[N];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
	}
	sort(a, a + n);
	int flag = 1;
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			flag = 0;
			break;
		}
	}
	if (flag)
		puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3

H = 2


def solve(n, board):
    max_res = 0
    for down_step in range(n):
        is_down = [False for _ in range(n)]
        is_down[down_step] = True
        r, c = 0, 0
        res = board[r][c]
        for step in is_down:
            if step:
                r += 1
            else:
                c += 1
            res += board[r][c]
        assert (r, c) == (H - 1, n - 1)
        max_res = max(max_res, res)
    return max_res


def main():
    n = int(input())
    board = [[int(a) for a in input().split()] for _ in range(H)]
    print(solve(n, board))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K = MI()
    if K==0:
        print(N**2)
        return
    ans = 0
    for b in range(K+1,N+1):
        roop = N//b
        ans += roop*(b-K)
        remain = N-roop*b
        ans += max(0,remain-K+1)
    print(ans)
if __name__ == '__main__':
    main()

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if((A<=C && C<=B)||(A>=C && C>=B)){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

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

void solve()
{
	ll n; cin >> n;
	map<ll , ll>m;
	ll sum = 0;
	for (int i = 0; i < n; ++i)
	{
		ll tp; cin >> tp;
		sum += tp;
		m[tp]++;
	}
	ll q; cin >> q;
	while (q--)
	{
		ll b, c; cin >> b >> c;
		ll x = m[b];
		sum += (c * x) - (b) * (x);
		m.erase(b);
		m[c] += x;
		cout << sum << '\n';
	}
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	ll t = 1; //cin >> t;
	while (t--)
		solve();
	return 0;
}



Measured memory_bytes: 7580
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>

using namespace std;
int main (){
    int N;
    pair<pair<string, int>, int> pair[100];

    if(!(cin >> N))return 0;
    if(N<=0 || N>100)return 0;

    int p;
    string s;
    for (int i =0 ; i<N ;i++){
        cin >> s >> p;
        pair[i]=make_pair(make_pair(s,-1*p),i);
    }
    sort(pair, pair+N);
    for (int i=0;i<N;i++)cout << pair[i].second+1<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    string s; cin>>s;
    REP(i,s.size()){
        string t = s.substr(0,s.size()-i);
        if(t.size()%2==1)continue;
        string s1 = t.substr(0,t.size()/2);
        string s2 = t.substr(t.size()/2, t.size());
        if(s1==s2){cout<<s.size()-i<<endl; return 0;}
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<char>>A(H, vector<char>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> A.at(i).at(j);
		}
	}
	for (int i = 0; i < H; i++) {
		int num = 0;
		for (int j = 0; j < W; j++) {
			if (A.at(i).at(j) == '#') num++;
		}
		if (num == 0) {
			for (int j = 0; j < W; j++) {
				A.at(i).at(j) = 'X';
			}
		}
	}
	for (int i = 0; i < W; i++) {
		int num = 0;
		for (int j = 0; j < H; j++) {
			if (A.at(j).at(i) == '#') num++;
		}
		if (num == 0) {
			for (int j = 0; j < H; j++) {
				A.at(j).at(i) = 'X';
			}
		}
	}
	for (int i = 0; i < H; i++) {
		int num = 0;
		for (int j = 0; j < W; j++) {
			if (A.at(i).at(j) != 'X') cout << A.at(i).at(j);
			else num++;
		}
		if (num != W) cout << endl;
	}
}

Measured memory_bytes: 256
# -*- coding: UTF-8 -*-
import math
import bisect
# f=open("test.txt")
# line=f.readline()
# lists=[]
# while line:
#     lists.append("".join(list(line)[:-1]))
#     line=f.readline()
# 
# f.close()
# 
# s=lists[0]
# t=lists[1]

s=input()
t=input()

alpha=list("abcdefghijklmnopqrstuvwxyz")

dic_s={alpha[i]:0 for i in range(26)}
dic_t={alpha[i]:0 for i in range(26)}

a={alpha[i]:[] for i in range(26)}
b={alpha[i]:[] for i in range(26)}


for i in range(len(s)):
  
    if dic_s[s[i]]==0:
        dic_s[s[i]]=+1
    a[s[i]].append(i+1)


for j in range(len(t)):
    
    if dic_t[t[j]]==0:
        dic_t[t[j]]=+1
    b[t[j]].append(j+1)
for i in range(26):
	a[alpha[i]].append(10**9)
flag=True

for i in range(26):
    if dic_t[alpha[i]]>0 and dic_s[alpha[i]]==0:
        flag=False

place=[0,0]

if flag:
    #文字を構成できる場合
    for i in range(len(t)):
        string=t[i]
        num=bisect.bisect_right(a[string],place[0])  
        if a[string][num]==10**9:
            place[1]+=1
            place[0]=a[string][0]
        else:
            place[0]=a[string][num]
  

    print(place[0]+place[1]*len(s))

else:
    #構成できない場合
    print(-1)


Measured memory_bytes: 49116
X, Y = map(int,input().split())
ans = 0
flag = False
for turu in range(X+1):
    for kame in range(X+1):
        if kame*4 + turu*2 == Y and turu+kame == X:
            print("Yes")
            flag = True
            break
        elif turu+kame == 2*X:
            print("No")
            flag = True
            break
    if flag:
        break


Measured memory_bytes: 9200
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  string S, T, U;
  int A, B;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  if (S == U) {
    cout << A - 1 << " " << B << endl;
  } else {
    cout << A << " " << B - 1 << 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>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	char c;
    	cin>>c;
    	if(c<='z'&&c>='a')
    	{
    	
    		cout<<'a';
		}
		else
		{
			c=c+32;
			cout<<'A';
		}

    }

}

Measured memory_bytes: 3620
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let s = next()
    let m = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    const first = s.slice(0, 2)
    const second = s.slice(2)
    if (m.includes(first) && m.includes(second)) {
        console.log("AMBIGUOUS")
        return
    } else if (m.includes(first) && !m.includes(second)) {
        console.log("MMYY")
        return
    } else if (!m.includes(first) && m.includes(second)) {
        console.log("YYMM")
        return
    } else {
        console.log("NA")
        return
    }
}
Main()


Measured memory_bytes: 30600
H,W,K = list(map(int,input().split()))
#i行(j+1)列にたどり着く場合の数
dp = [[0 for j in range(W)] for i in range(H+1)]
dp[0][0] = 1
mod = 1000000007


for i in range(H):
    for j in range(W):
        for k in range(1<<W-1):
            ok = 1
            for l in range(W-2):
                if ((k >> l)&1 == 1)and((k>>l+1)&1 == 1):
                    ok = 0

            if ok:
                #左にたどる
                if (j >= 1) and ((k>>j-1)&1 == 1):
                    dp[i+1][j-1] += dp[i][j]
                    dp[i+1][j-1] %= mod
                #右にたどる
                elif (j <= W-2) and ((k>>j)&1 == 1):
                    dp[i+1][j+1] += dp[i][j]
                    dp[i+1][j+1] %= mod
                #直下
                else:
                    dp[i+1][j] += dp[i][j]
                    dp[i+1][j] %= mod

print(dp[H][K-1])

Measured memory_bytes: 3064
n=int(input())
h=list(map(int,input().split()))

cost=[0]*(n+1)

cost[0]=0
cost[1]=abs(h[1]-h[0])
for i in range(0,n-2):
    cost[i+2]=min(cost[i+1]+abs(h[i+2]-h[i+1]),cost[i]+abs(h[i+2]-h[i]))

print(cost[n-1])

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

unsigned int N, Y;

tuple<int, int, int> solve()
{
    unsigned int T = Y - 1000 * N;
    for(unsigned int y=0; y<=N; y++){
        for(unsigned int x=0; x<=N; x++){
            if(x+y > N){
                break;
            }
            if(9000 * x + 4000 * y == T){
                return make_tuple(x, y, N-x-y);
            }
        }
    }
    return make_tuple(-1, -1, -1);
}

int main()
{
    cin >> N >> Y;
    auto result = solve();
    cout << get<0>(result) << " " << get<1>(result) << " " << get<2>(result) << endl;
    return 0;
}


Measured memory_bytes: 888
#include <cstdio>
#include <string>
#include <iostream>

int main(int argc, char const *argv[]) {
  std::string str;
  std::cin >> str;
  int N = str.length();
  if (N%2 == 0) {
    str.pop_back();
    str.pop_back();
    N -= 2;
  }else{
    str.pop_back();
    N--;
  }

  while (str.length() > 2) {
    std::string sub1 = str.substr(0,N/2), sub2 = str.substr(N/2,N/2);
    if(sub1 == sub2){
      printf("%d\n", (int)str.length());
      return 0;
    }
    str.pop_back();
    str.pop_back();
    N -= 2;
  }
  printf("%d\n", (int)str.length());
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int k , i ;
double p , n ;
int main() {
  cin >> n ;
  for ( i = 1 ; i <= n ; i++ )
    if ( i % 2 == 1 ) k ++ ;
  p = k / n ;
  cout << fixed ;
  cout << setprecision(9) << p ;
  return 0 ;
}

Measured memory_bytes: 256
"use strict";
function main(arg) {
  const input = String(arg).trim();
  // 文字列 "0101・・・"　との差
  // 文字列 "1010・・・"　との差
  let unMatchCont0 = 0;
  let unMatchCont1 = 0;
  input.split("").forEach((char, index) => {
    if (index % 2 === 0) {
      if (char != "0") {
        unMatchCont0++;
      } else {
        unMatchCont1++;
      }
    } else {
      if (char != "1") {
        unMatchCont0++;
      } else {
        unMatchCont1++;
      }
    }
  });
  console.log(Math.min(unMatchCont0, unMatchCont1));
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 8396
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

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

  int s, w;
  cin >> s >> w;
  if(s <= w){
    cout << "unsafe\n";
  } else {
    cout << "safe\n";
  }
  return 0;
}


Measured memory_bytes: 3664
import java.lang.*;
import java.util.Scanner;
class Main{
   public static void main(String[] args){
      Scanner stdIn = new Scanner(System.in);
      
      String O = stdIn.nextLine();
      String E = stdIn.nextLine();
      
      String Pass = new String();
      
      int i;
      for(i = 0;i < E.length(); i++){
         System.out.print(O.substring(i,i+1));
         System.out.print(E.substring(i,i+1));
      }
      if(O.length() - E.length() == 1){
         System.out.print(O.substring(O.length()-1));
      }
   }
}

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

int main(){
    int n;
    cin >> n;
    ll a[n];
    ll ans = 0;
    rep(i,n){
        cin >> a[i];

        if(i>0){
            int high = min((a[i]-a[i-1]), ll(0));
            //cout << high << endl;
            ans += abs(high);
            if(a[i]<a[i-1]){
                a[i]=a[i-1];
            }
            
        }
    }
    cout << abs(ans) << endl;
}

Measured memory_bytes: 5152
#include <cstddef>
#include <cstdint>
#include <vector>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

template <typename T>
std::vector<T> make_v(usize a) { return std::vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(usize a, Ts... ts) {
  return std::vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename std::enable_if<std::is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename std ::enable_if<std::is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename T, typename V>
inline void chmin(T &a, V b) {
  if (a > b) a = b;
}
template <typename T, typename V>
inline void chmax(T &a, V b) {
  if (a < b) a = b;
}

} // namespace null_null

#include <algorithm>
#include <iostream>
#include <utility>

namespace null_null {

std::vector<usize> G[202020];
std::vector<bool> flag(202020);
std::vector<i64> sum(202020, 0);

void rec(usize n, usize pre) {
  if (flag[n]) return;
  flag[n] = true;
  for (auto x : G[n]) {
    if (x != pre) {
      sum[x] += sum[n];
    }
    rec(x, n);
  }
}

void main_() {
  usize N, Q;
  std::cin >> N >> Q;
  for (usize i = 0; i < N - 1; i++) {
    usize a, b;
    std::cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  for (usize i = 0; i < Q; i++) {
    usize p, x;
    std::cin >> p >> x;
    p--;
    sum[p] += x;
  }

  rec(0, -1);

  for (usize i = 0; i < N; i++) {
    if (i != 0) std::cout << " ";
    std::cout << sum[i];
  }
  std::cout << std::endl;
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}


Measured memory_bytes: 24320
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef double ld;
typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

ll X;

int main(){ _

	cin >> X;

	ll l = 0, r = (1e16 + 10);
	while(l < r){
		ll m = l + (r - l)/2;

		ll at = (m/2)*(11) + 6*(m & 1);

		if(at >= X)
			r = m;
		else l = m + 1;
	}

	cout << l << endl;


	return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

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

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

		if (a >= b) {
			System.out.println("10");
		} else {
			System.out.println("0");
		}
	}
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (1) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3592
//
//  ITP1_2_D.cpp
//  AizuOnlineJudge
//
//  Created by jiji on 2019/09/20.
//  Copyright © 2019 jiji4000. All rights reserved.
//

#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>

using namespace std;

struct Vec2{
    int x;
    int y;
    
    Vec2(int x1,int y1){
        x = x1;
        y = y1;
    }
    Vec2(){
        
    }
};

struct Line{
    // vector2D
    Vec2 base;
    // vector2D
    Vec2 direction;
};

struct Rectangle {
    Vec2 origin;
    Vec2 size;
};

int clampOnRange(int x,int min,int max){
    if(x < min){
        return min;
    }else if(x > max){
        return max;
    }else{
        return x;
    }
}

Vec2 clampOnRectangle(Vec2 point,Rectangle rectangle){
    Vec2 clamp;
    //　x軸とy軸の最短点を取得し返すだけ
    clamp.x = clampOnRange(point.x,rectangle.origin.x,rectangle.origin.x + rectangle.size.x );
    clamp.y = clampOnRange(point.y,rectangle.origin.y,rectangle.origin.x + rectangle.size.y );
    return clamp;
}

Vec2 subtractVector(Vec2 vecA,Vec2 vecB){
    Vec2 vec;
    vec.x = vecA.x - vecB.x;
    vec.y = vecA.y - vecB.y;
    return vec;
}

float getVectorLength2D(Vec2 vec){
    return sqrt((vec.x * vec.x) + (vec.y * vec.y));
}

bool collideWithPoint(Vec2 center,Vec2 point,float radius){
    Vec2 distance = subtractVector(center,point);
    return getVectorLength2D(distance) <= radius;
}

bool circleRectangleCollision(Vec2 center,Rectangle rectangle,float radius){
    Vec2 clamped = clampOnRectangle(center,rectangle);
    return collideWithPoint(center,clamped,radius);
}

float getlengthLineBetweenPoint(float a,float b,float c,Vec2 point){
    // 点と直線の距離の公式に当てはめる
    return abs((a * point.x + b * point.y + c) / sqrt((a * a) + (b * b)));
}

int main(void){
    int width,height,centerX,centerY,radius;
    cin >> width >> height >> centerX >> centerY >> radius;
    
    // 原点を通る縦直線(x = 0)
    float distance1 = getlengthLineBetweenPoint(1,0,0,Vec2(centerX,centerY));
    // 原点を通る横直線(y = 0)
    float distance2 = getlengthLineBetweenPoint(0,1,0,Vec2(centerX,centerY));
    // 縦直線
    float distance3 = getlengthLineBetweenPoint(1,0,-width,Vec2(centerX,centerY));
    // 横直線
    float distance4 = getlengthLineBetweenPoint(0,1,-height,Vec2(centerX,centerY));
    
    string str = "No";
    // 円の半径の距離が全ての直線との距離未満ならばぶつかっていないことになる
    // 円と直線がぶつかっていない
    if(distance1 >= radius && distance2 >= radius && distance3 >= radius && distance4 >= radius){
        // かつ円の中心が四角形の内部になる
        // x座標
        if(centerX > 0 && centerX < width){
            // y座標
            if(centerY > 0 && centerY < height){
                str = "Yes";
            }
        }
    }
    cout << str << endl;
    
    return 0;
}




Measured memory_bytes: 3156
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let o = read::<String>().chars().collect::<Vec<char>>();
    let e = read::<String>().chars().collect::<Vec<char>>();
    for i in 0..o.len() {
        print!("{}", o[i]);
        if i < e.len() {
            print!("{}", e[i]);
        }
    }
    println!("");
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	if (n >= m) {
		cout << 0 << endl; return 0;
	}
	int ans = 0;
	VE x(m); rep(i, m)cin >> x[i];
	sort(ALL(x));
	VE sa(m - 1);
	rep(i, m - 1)sa[i] = x[i + 1] - x[i];
	rep(i, m - 1)ans += sa[i];
	sort(ALLR(sa));
	rep(i, n - 1)ans -= sa[i];
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long> c(n,0);
	cin >> c[0];
	for(int i = 1 ; i < n; i++){
		long temp;
		cin >> temp;
		c[i] = temp + c[i-1];
	}
	long sum = c[n-1];
	long ans = (long)(2*1e10);
	for(int i = 1; i < n; i++){
		long temp = sum - 2 * c[i-1];
		temp = temp > 0 ? temp: -temp;
		ans = min(temp, ans);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){ 
    string S;
    cin >>S;
    int N = S.size();
   int ans = 0;
   for(int i = 0;i < N;i++){
       if(S[i] == 'A' || S[i] == 'G' || S[i] == 'C' || S[i] == 'T'){
           int longa = 0;
           for(int j = i;j < N;j++){
               if(S[j] == 'A' || S[j] == 'G' || S[j] == 'C' || S[j] == 'T' ){
                   longa++;
               }
               else break;
           }
           ans = max(ans,longa);
       }
   }
   cout << ans << endl;
}

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 m=sc.nextInt();
    int[] a=new int[31];
    for(int i=0;i<n;i++){
      int k=sc.nextInt();
      for(int j=0;j<k;j++){
        a[sc.nextInt()]++;
      }
    }
    int c=0;
    for(int i=0;i<31;i++){
      if(a[i]==n){
        c++;
      }
    }
    System.out.println(c);
  }
}

Measured memory_bytes: 22484
n, k, q = map(int, input().split())
s = [k for i in range(n)]
d = {}
for i in range(q):
    z = int(input())
    if z-1 not in d:
        d[z-1] = 1
    else:
        d[z-1] += 1 

for i in range(n):
    if i in d:
        s[i] = s[i] - q + d[i]
        if s[i] > 0:
            print('Yes')
        else:
            print('No')
    else:
        s[i] -= q
        if s[i] > 0:
            print('Yes')
        else:
            print('No')

Measured memory_bytes: 12824
import java.util.Scanner;

public class Main {
			static long x;
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String array = sc.next();
		x=0;
		for(int i=0;i<array.length();i++) {
			f(i,0,array);
		}
		System.out.println(x);
	}
	
	static void f(int plus,long sum,String str) {
		if(plus!=0) {
			for(int i=1;i<str.length()-plus+1;i++) {
				f(plus-1,Long.parseLong(str.substring(0,i))+sum,str.substring(i,str.length()));
			}
		}else {
			x+=sum+Long.parseLong(str);
		}
	}
}


Measured memory_bytes: 23764