akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A,B,C,D,E;
int dp[NMAX] = {};

string S, S2;
vec v;

bool ans = {};

void solve(){
  // main algorithm
  reverse(S.begin(), S.end());
  ans = S == S2;
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  cout << (ans ? "YES" : "NO") << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> S >> S2;
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define ll long long
    #define rep(X,N) for(ll X = 0; X < (N); X++)
    #define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
    #define PI (acos(-1.0))
    #define sorta(V) sort(V.begin(), V.end())
    #define pback push_back
    #define mpair make_pair
    #define MODN 1000000007
    #define ALL(V) (V).begin(),(V).end() 


    using namespace std;


    int main(){

        vector<int> n(3);
        cin >> n[0] >> n[1] >> n[2];
        int k;
        cin >> k;

        sort(ALL(n));

        rep(i,k){
            n[2] = n[2] * 2;
        }

        int sum = n[0] + n[1] + n[2];

        cout << sum << endl;




        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int cnt[100100];

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(0, min(b, d) - max(a, c)) << endl;
}

Measured memory_bytes: 256
# coding: utf-8
class Case02

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  def read
    @h, @n = gets.chomp.split.map(&:to_i)
    @a = gets.chomp.split.map(&:to_i)
  end

  def solve
    if @a.reduce(&:+) >= @h then
      @result = 'Yes'
    else
      @result = 'No'
    end
  end
  
  def output
    puts @result
  end

end

Case02.new.execute if $0 == __FILE__

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

int A, B, C, D;

int main() {
	cin >> A >> B >> C >> D;
	if (A + B > C + D) cout << "Left" << endl;
	if (A + B == C + D) cout << "Balanced" << endl;
	if (A + B < C + D) cout << "Right" << endl;
}

Measured memory_bytes: 256
#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 <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool CAN=true;
using namespace std;

int main(){
  ll N,ans=0;
  cin>>N;
  ll A[N+1],POS[N+1];
  for(int i=1; i<=N; ++i){
    cin>>A[i];
    POS[A[i]]=i;
  }
  
  set<ll> S={0,N+1};
  
  for(int i=1; i<=N; ++i){
    auto itr=S.lower_bound(POS[i]);
    ll R=*itr,L=*(--itr);
    
    ans+=i*(POS[i]-L)*(R-POS[i]);
    S.insert(POS[i]);
  }
  
  cout<<ans<<endl;
  return 0;
}

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

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

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

using namespace std;

int main() {
        int n;
        cin >> n;
        long long sum = 0;
        for(int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                for (int k = 1; k <= n; k++) {
                        sum +=__gcd(i,__gcd(j, k));

                }
            }
        }
        cout << sum << endl;
        return 0;
}


Measured memory_bytes: 3616
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e2+69, INF=2e9+6969;

int qq;

int main()
{
	ll n;
	ll t[R];
	cin >> n;
	t[0]=2;
	t[1]=1;
	for(int i=2;i<=n;++i) t[i]=t[i-1]+t[i-2];
	printf("%lld\n", t[n]);
	return 0;
}


Measured memory_bytes: 3708
n,k=map(int,input().split())
a=sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:-x[1])
t=[0]*(n+1)
p,q=0,0
for i in a[:k]:
    p+=i[1]
    if t[i[0]]==0:
        q+=1
    t[i[0]]+=1
s=0
d=p+q*q
c=a[:k][::-1]
for i in a[k:]:
    if t[i[0]]==0:
        while s!=k:
            if t[c[s][0]]==1:
                s+=1
            else:
                break
        if s==k:
            break
        else:
            t[i[0]]+=1
            p-=c[s][1]-i[1]
            q+=1
            d=max(d,p+q*q)
            s+=1
print(d)

Measured memory_bytes: 33060
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut count = vec![0; n];
    for _ in 0..n {
        let a: usize = sc.read();
        count[a] += 1;
    }
    if solve(count) {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn solve(count: Vec<usize>) -> bool {
    let n = count.len();
    let mut min = 1;
    let mut max = n;
    for colors in 0..n {
        if count[colors] == 0 {
            continue;
        }
        min = cmp::max(min, colors);
        max = cmp::min(max, colors + 1);
    }

    for total_colors in min..(max + 1) {
        let mut ok = true;
        let mut sum = 0;
        let mut group = vec![];
        for colors in 0..n {
            if count[colors] == 0 {
                continue;
            }
            let count = count[colors];
            let others = n - count;
            if count == 1 && colors + 1 != total_colors {
                ok = false;
            }
            if count == 1 {
                sum += 1;
            }
            if count > 1 {
                if total_colors == colors {
                    for groups in 1..(count / 2 + 1) {
                        if total_colors >= groups && total_colors - groups <= others {
                            group.push(groups);
                        }
                    }
                } else if total_colors == colors + 1 && count - 1 <= colors {
                    sum += count;
                } else {
                    ok = false;
                }
            }
        }

        if ok
            && ((group.is_empty() && sum == total_colors)
                || (sum < total_colors && group.contains(&(total_colors - sum))))
        {
            return true;
        }
    }
    false
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
#define float long double
#define PB push_back
#define MP make_pair
#define ss second
#define ff first
#define PI 3.14159265
#define fastrack ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int M = 2007, mod = 998244353;

signed main(){
    fastrack;
    int tt = 1;
    //cin >> tt;
    while(tt--){
        int h1, s1, h2, s2;
        cin >> h1 >> s1 >> h2 >> s2;
        bool ok = 1;
        while(1){
            if(ok){
                h2 -= s1;
            }
            else{
                h1 -= s2;
            }
            if(h2 <= 0){
                cout << "Yes" << "\n";
                break;
            }
            if(h1 <= 0){
                cout << "No" << "\n";
                break;
            }
            ok = !ok;
        }
    }
    return 0;
}


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




int main(){
    int d;
    std::cin >> d;
    std::string s;
    if(d == 22)s = "Christmas Eve Eve Eve";
    if(d == 23)s = "Christmas Eve Eve";
    if(d == 24)s = "Christmas Eve";
    if(d == 25)s = "Christmas";
    std::cout << s << std::endl;
}

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

const int maxn = 200 + 5;
int c[10][10], a[maxn][maxn];

int main() {
    int n, m; cin >> n >> m;
    for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) cin >> c[i][j];
    for (int k = 0; k < 10; ++k) {
        for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) c[i][j] = min(c[i][k] + c[k][j], c[i][j]);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            int x; cin >> x;
            if (x == -1) continue;
            ans += c[x][1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
D = int(input())
c = [int(i) for i in input().split()]
days = [0]*26
ans = []
for k in range(D):
    s = [int(i) for i in input().split()]
    t = 0
    for i in range(1,26):
        if s[t] + days[t]*c[t] <= s[i] + days[i]*c[i]:
            t = i
    ans.append(t)
    for i in range(26):
        if i == t:
            days[i] = 0
        else:
            days[i] += 1
ans = [str(i+1) for i in ans]
print("\n".join(ans))

Measured memory_bytes: 68832
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  int dekka;
  if(b > c){
    dekka = max(a,b);
  } else {
    dekka = max(a,c);
  }

  int sum = a + b + c;
  cout << dekka*10 + sum - dekka << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
bool solve () { 
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a < b || d < b) return false;
  if (c >= b) return true;
  long long g = __gcd(b, d);
  return c >= b + a % g - g;
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int t;
  cin >> t;
  while (t--) cout << (solve() ? "Yes\n" : "No\n");
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next().substring(0,1).toUpperCase();
		String b = sc.next().substring(0,1).toUpperCase();
		String c = sc.next().substring(0,1).toUpperCase();
		System.out.println(a + b +c);
	}
}


Measured memory_bytes: 39212
N=list(input())
#print(N)
x=len(N)
y="Yes"
for i  in range(x):
	if i%2==1:
		if N[i]=="R" :
			y="No"
			break
	if i%2==0:
		if N[i]=="L":
			y="No"
			break
print(y)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1005, inf = 1e18;

ll n, a[N], dt[N] = {-inf}, trk[N], ans;

bool chk[N];

vector<ll> o, st;

int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++) {
		scanf("%lld",&a[i]);
	}
	for(ll i=1;i<=n;i++) {
		dt[i] = a[i];
		for(ll j=2;j<i;j+=2) {
			if(dt[i] < dt[i-j] + a[i]) {
				dt[i] = dt[i-j] + a[i];
				trk[i] = i-j;
			}
		}
		if(dt[i] > dt[ans]) ans = i;
	}
	for(ll i=ans;i;i=trk[i]) {
		chk[i] = true;
		st.push_back(i-trk[i]);
	}
	st.pop_back();
	for(ll i=n;!chk[i];i--) o.push_back(i);
	for(ll i=1;!chk[i];i++) o.push_back(1);
	while(!st.empty()) {
		ll T = st.back(); st.pop_back();
		for(ll i=1;i<=T/2-1;i++) o.push_back(3);
		o.push_back(2);
	}
	printf("%lld\n%d\n",dt[ans],(int)o.size());
	for(auto &T : o) printf("%lld\n",T);
}


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

using namespace std;

string str;
int pos;
map<string, int> m;

typedef long long ll;

ll molecule();
int atom();
int number();

ll molecule() {
	ll res = 0;
	while (pos < str.size() && str[pos] != ')') {
		if (str[pos] == '(') {
			++pos;
			int M = molecule();
			++pos;
			int n = number();
			res += (ll)M * n;
		}
		else {
			int M = atom();
			int n = 1;
			if (isdigit(str[pos])) {
				n = number();
			}
			res += (ll)M * n;
		}
	}
	return res;
}
int atom() {
	string a = "";
	a += str[pos++];
	if ('a' <= str[pos] && str[pos] <= 'z') {
		a += str[pos++];
	}
	if (m.find(a) != m.end()) {
		return m[a];
	}
	else {
		throw 114514;
	}
}
int number() {
	ll res = 0;
	while (pos < str.size() && isdigit(str[pos])) {
		res = res * 10 + (int)(str[pos] - '0');
		++pos;
	}
	return res;
}

int parse(string s) {
	try {
		str = s;
		pos = 0;
		return molecule();
	}
	catch (int v) {
		return -1;
	}
}

int main() {
	string s;
	while (cin >> s, s != "END_OF_FIRST_PART") {
		int M; cin >> M;
		m[s] = M;
	}
	while (cin >> s, s != "0") {
		int ans = parse(s);
		if (ans < 0) {
			cout << "UNKNOWN" << endl;
		}
		else {
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 1292
#include <iostream>

using namespace std;

int main () {

	string s;

	cin >> s;

	int ai = -1;
	int zi = -1;

	for (size_t i=0; i<s.length(); i++) {
		if (s[i] == 'A') {
			ai = i;
			break;
		}
	}

	for (size_t i=s.length()-1; i>=0; i--) {
		if (s[i] == 'Z') {
			zi = i;
			break;
		}
	}

	cout << zi - ai + 1 << endl;

	return 0;
}

Measured memory_bytes: 640
#abc127c

n,m=map(int,raw_input().split())
l=[]
r=[]
for i in xrange(m):
 li,ri=map(int,raw_input().split())
 l.append(li)
 r.append(ri)
lmax=max(l)
rmin=min(r)
if lmax<=rmin:
 print rmin-lmax+1
else:
 print 0


Measured memory_bytes: 8900
#include<stdio.h>
#define MAX 100
#define WHITE 1
#define GREY 2
#define BLACK 3
#define NIL -1

int M[MAX][MAX],c[MAX],d[MAX],f[MAX],ts,n;

void dfs(int u){
  int i;
  d[u]=++ts;
  c[u]=GREY;
  for(i=0;i<n;i++){
    if(M[u][i]==1&&c[i]==WHITE) dfs(i);
  }
  
  f[u]=++ts;
  c[u]=BLACK;
}

void DFS(){
  int i;
  for(i=0;i<n;i++){
    c[i]=WHITE;
  }
  ts=0;
  for(i=0;i<n;i++){
    if(c[i]==WHITE) dfs(i);
  }
}

int main(){
  int i,j,u,k,l;
  scanf("%d",&n);

  for(i=0;i<n;i++)
    for(j=0;j<n;j++) M[i][j]=0;

  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&l);
      M[u-1][l-1]=1;
    }
  }
  DFS();
  /*for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j>0) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
    }*/
  for(i=0;i<n;i++) printf("%d %d %d\n",i+1,d[i],f[i]);
  return 0;
}



Measured memory_bytes: 2044
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

ans = sorted(ans)
print(ans[K-1])


Measured memory_bytes: 4868
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<bitset>
#include<queue>
using namespace std;

int main(){
	unsigned long long int n,x,ans=0;
	cin>>n>>x;
	int mink=100000;
	vector<long long int> v(150);
	long long int aa=0;
	for(int i = 0;i<n;i++){
		cin>>v[i];
		aa += v[i];
		mink=min(mink,(int)v.at(i));
	}
	x-=aa;
	ans+=n;
	ans += x/mink;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll h[100005],dp[100005];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,k;
  cin>>n>>k;
  forn(i,0,n) cin>>h[i];
  forn(i,1,n){
    dp[i]=1e18;
    forn(j,1,k+1){
      if(i-j>=0) {dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));}
    }
  }
  ll ans=dp[n-1];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////

int m;
signed main(){
  cin>>m;
  int sum = 0, dig = 0;
  rep(i,m){
    int d,c;cin>>d>>c;
    sum += d*c;dig += c;
  }
  cout << dig - 1 + (sum-1)/9 << endl;
}




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

int main() {
  int n;
  cin >>n;
  int apoint=0,bpoint=0;
  
  for(int i=0; i < n; i++){
    string a,b;
    cin >> a >> b;
    if(a > b) apoint +=3;
    else if (a < b) bpoint +=3;
    else{
      apoint+=1;
      bpoint+=1;
    }
  }
  cout << apoint <<" " << bpoint << endl;
}


Measured memory_bytes: 3152
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int dp[100001];

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;i++)
        cin >> h[i];
    
    dp[0] = 0;
    for(int i=0;i<n;i++){
        if(i>=1)
            dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if(i>=2)
            dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]),dp[i]);
    }
    cout << dp[n-1];
}

Measured memory_bytes: 1024
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC opatimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }

int main() {
//    freopen("in.txt","r", stdin);
//    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);


    int a,b;
    cin >> a >> b;
    cout << 6 - a - b << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// debug: shift + f9
// sanitize: shift + f11

long long power(long long x, unsigned long long y, long long p)
{
    long long res = 1;     // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    if (x == 0) return 0; // In case x is divisible by p;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

int main(int argc, char **argv)
{
    string S;

    cin >> S;
    map<ll, ll> mods;

    ll val = 0;
    ll res = 0;

    reverse(S.begin(), S.end());

    ++mods[0];

    R1(S.size()) {
        val += ((S[i] - '0')*power(10, i, 2019))%2019;
        val%=2019;

        ++mods[val];
    }

    for(auto & mod : mods) {
        /*if(mod.first == 0) {
            res += mod.second;
        }
        else {*/
            res += (mod.second-1)*(mod.second)/2;
        //}
    }

    cout << res << endl;
}

Measured memory_bytes: 3728
#include<iostream>
#include<string>
#include<algorithm>

static const int N = 1000;
using namespace std;

int LCS(string X,string Y){
  int m,n;
  
  m = X.size();
  n = Y.size();
  
  int dp[N + 1][N + 1] = {0};
  
  X = ' ' + X;
  Y = ' ' + Y;

  for(int i = 1;i <= m;i++){
    for(int j = 1;j <= n;j++){
      if(X[i] == Y[j]){
	dp[i][j] = dp[i - 1][j - 1] + 1;
      }else{
	dp[i][j] = max(dp[i - 1][j],dp[i][j - 1]);
      }
    }
  }
  
  /*for(int i = 0;i < ax;i++){
    for(int j = 0;j < ay;j++){
      cout << dp[i][j] << " ";
    }
    cout << '\n';
    }*/
  
  return dp[m][n];
}

int main(){
  int q;
  string X,Y;
  
  cin >> q;
  
  for(int i = 0;i < q;i++){
    cin >> X >> Y;
    //cout << X.size() << " " << Y.size() << '\n';
    cout << LCS(X,Y) << '\n';
  }
  
  return 0;
}
  



Measured memory_bytes: 7084
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<bool> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    ll n ; cin >> n;
    vector<ll> mozisuu_handan(1,0);
    ll a = 0;
    for(int i=1;i<100;i++){
        a += pow(26,i);
        if(a>=1000000000000001){
            mozisuu_handan.push_back(a);
            break;
        }
        mozisuu_handan.push_back(a);
    }
  
    //cout << "deb" << endl;
  
    auto it = lower_bound(mozisuu_handan.begin(),mozisuu_handan.end(),n);
    ll as = it - mozisuu_handan.begin();
    //cout << as << endl;
    n -= mozisuu_handan.at(as-1) + 1;
    //cout << n << endl;
    string s = string(as,'a');
    for(int i=as-1;i>=0;i--){
        ll x = n%26;
        char c = 'a' + x;
        s.at(i) = c;
        n/=26;
        if(n==0) break;
        //cout << i << endl;
    }
    cout << s << endl;
}

Measured memory_bytes: 4060
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

int main()
{
	//greedy
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i, N) {
		cin >> A[i];
	}
	sort(all(A), greater<int>());
	priority_queue<ll> pq;
	ll ans = 0;
	for (auto a : A) {
		if (!pq.empty()) {
			ans += pq.top();
			pq.pop();
			pq.push(a);
			pq.push(a);
		}
		else {
			pq.push(a);
		}
	}
	cout << ans << endl;
	return 0;
}


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

const int NMAX = 200005;

int n;
ll x[NMAX], S[NMAX];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> x[i];
    for (int i = 1; i <= n; i++)
        S[i] = S[i - 1] + x[i];

    /// 1. [1, l]
    /// 2. [l + 1, m]
    /// 3. [m + 1, r];
    /// 4. [r + 1, n]
    int l = 1, r = 3;
    ll minim = 1000000000LL;
    for (int m = 2; m <= n - 2; m++)
    {
        /// fixam pointerii
        while (l < m - 1 && (abs(S[l] - (S[m] - S[l])) > abs(S[l + 1] - (S[m] - S[l + 1]))))
            l++;
        while (r <= m)
            r++;
        while (r < n - 1 && (abs((S[n] - S[r]) - (S[r] - S[m])) >
                             abs((S[n] - S[r + 1]) - (S[r + 1] - S[m]))))
            r++;

        /// actualizam
        minim = min(minim, max(max(S[l], S[m] - S[l]), max(S[r] - S[m], S[n] - S[r]))
                    - min(min(S[l], S[m] - S[l]), min(S[r] - S[m], S[n] - S[r])));
    }
    cout << minim;
    return 0;
}


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  FAST();

  int n;
  string s;
  cin >> n >> s;
  int cnt = 1;
  REP(i, 1, n)
      if(s[i] != s[i - 1])
        cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 512
/*input
BBB
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

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

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin >> s;
    sort(s.begin(), s.end());
    for(int i = 0; i < 2; i++) if(s[i] != s[i + 1])
    {
    	cout << "Yes";
    	return 0;
    }
    cout << "No";

    return 0;
}

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

using namespace std;

int main(){
    string str;
    getline(cin, str);
    for(int i = 0; i < str.size(); i++){
        if(str[i] >= 'a' && str[i] <= 'z')
            str[i] += 'A' - 'a';
        else if(str[i] >= 'A' && str[i] <= 'Z')
            str[i] += 'a' - 'A';
    }
    cout << str << endl;
    return 0;
}


Measured memory_bytes: 3152
from math import ceil
s=input()
ans=[0]*len(s)
cnt1=1
cnt2=1
for i in range(len(s)-1):
  if s[i]==s[i+1] and s[i]=='R':
    cnt1+=1
  elif s[i]=='R' and s[i+1]=='L':
    ans[i]+=ceil(cnt1/2)
    ans[i+1]+=cnt1//2
    cnt1=1
  if s[len(s)-i-1]==s[len(s)-i-2] and s[len(s)-i-1]=='L':
    cnt2+=1
  elif s[len(s)-i-1]=='L' and s[len(s)-i-2]=='R':
    ans[len(s)-i-1]+=ceil(cnt2/2)
    ans[len(s)-i-2]+=cnt2//2
    cnt2=1
print(*ans)

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

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

    int n;
    cin >> n;
    map <string, int> F;
    while(n--){
        string name;
        cin >> name;
        F[name]++;
    }
    int maxi = 0;
    for(auto it = F.begin(); it != F.end(); it++){
        maxi =  max(maxi, it->second);
    }
    vector <string> ans;
    for(auto it = F.begin(); it != F.end(); it++){
        if(it->second == maxi){
            ans.push_back(it->first);
        }
    }
    sort(ans.begin(), ans.end());
    for(auto x : ans){
        cout << x << endl;
    }
}

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

using namespace std;

int main(){
        int n, d, x;
        cin>>n>>d>>x;
        d--;
        vector <int> a(n);
        int res=0;
        for(int i=0;i<n;i++){
                cin>>a[i];
                res++;
                res+=(d/a[i]);
        }
        cout<<res+x<<endl;
        return 0;
}


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

int main()
{
    int h[100010];
    int dp[100010];
    int n;
    std::cin >> n;
    for (int i = 1; (i <= n); ++i) {
        std::cin >> h[i];
    }
    dp[1] = 0;
    dp[2] = dp[1] + abs(h[2] - h[1]);
    for (int i = 3; (i <= n); ++i) {
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        dp[i] = std::min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    std::cout << dp[n] << std::endl;
    return 0;
}


Measured memory_bytes: 1024
import copy
n, m = map(int,input().split())
graph = []
num = 1
for i in range(m):
    graph.append(list(map(int, input().split())))
pathes = [[[1],graph]]
count = 0
while pathes:
    path_lines = pathes.pop()
    path, lines = path_lines
    if len(path) == n:
        count += 1
    else:
        for line in lines:
            if path[-1] in line:
                new_path = copy.copy(path)
                new_lines = copy.copy(lines)
                new_lines.remove(line)
                new_line = copy.copy(line)
                new_line.remove(new_path[-1])
                
                if new_line[0] in new_path:
                    continue
                new_path.append(new_line[0])
                pathes.append([new_path, new_lines])
print(count)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, nmin, nmax;
  while (cin >> m >> nmin >> nmax) {
    if (m == 0)
      return 0;
    int mx = 0, ans = 0, a[m + 5];
    for (int i = 1; i <= m; i++)
      cin >> a[i];
    for (int i = nmin; i <= nmax; i++) {
      if (a[i] - a[i + 1] >= mx)
        mx = abs(a[i] - a[i + 1]), ans = i;
    }
    // cout << mx << endl;
    cout << ans << endl;
  }
}


Measured memory_bytes: 3084
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint,time,random
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def cal(T):
    res = 0
    last = [0] * 26
    for day in range(D):
        t = T[day]; t -= 1
        last[t] = 0
        res += s[day][t]
        for i in range(26):
            if i == t: continue
            last[i] += 1
            res -= c[i] * last[i]
    return res
def check_change(td,tq):
    global score,res
    old_q = res[td]
    res[td] = tq
    now = cal(res)
    if now > score:
        score = now
    else:
        res[td] = old_q
def out():
    global res
    for x in res:
        print(x)
    quit()

start_time = time.time()
n = 26
D = inp()
c = inpl()
s = []
max_s = []
for i in range(D):
    tmp = inpl()
    mx = 0; ind = -1
    for j in range(n):
        if tmp[j] > mx:
            mx = tmp[j]
            ind = j
    max_s.append(ind+1)
    s.append(tmp)

last = [0] * n
res = [-1] * D
for d in range(D):
    ans = -1
    mx = -INF
    for i in range(n):
        now = s[d][i]
        for j in range(n):
            if i == j: continue
            now -= s[d][j] * (last[j]+1)
        if now > mx:
            mx = now
            ans = i
    res[d] = ans+1
    for j in range(n):
        last[j] += 1
        if j == ans: last[j] = 0
score = cal(res)
# print(now_score)
for x in itertools.combinations(range(D), 2):
    if time.time() - start_time < 1.83: out()
    old = []
    if sum(x^y for x,y in zip(res,max_s)) == 0: continue
    for i in range(2):
        old.append(res[x[i]])
        res[x[i]] = max_s[x[i]]
    now = cal(res)
    if now > score:
        score = now
    else:
        for i in range(2):
            res[x[i]] = old[i]
while True:
    if time.time() - start_time < 1.83: out()
    td,tq = random.randrange(0,D), random.randrange(1,n+1)
    check_change(td,tq)


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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define REPA( i, n )	FOR( i, 1, n )
#define FORR( i, m, n ) for( int (i) = (m); (i) >= 0; (i)-- )
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

const int INF = 1e9;
const int MOD = 1e9 + 7;

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

	int f = s / 100;
	int b = s % 100;

	if( f >= 0 && f <= 99 ) {
		if( f >= 13 || f == 0 ) {
			if( b >= 1 && b <= 12 ) {
				cout << "YYMM" << endl;
			} else {
				cout << "NA" << endl;
			}
		} else {
			if( b >= 1 && b <= 12 ) {
				cout << "AMBIGUOUS" << endl;
			} else if( ( b >= 13 && b <= 99 ) || b == 0 ){
				cout << "MMYY" << endl;
			} else {
				cout << "NA" << endl;
			}
		} 

	} else {
		cout << "NA" << endl;
	}
	
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
  int i, pe, mode = 0;
  int num[100] = {0};
  
  scanf("%d", &pe);
  for( i = 0; i < pe; i++ ){
    scanf("%d" , &num[i]);
  }
  
  for( i = 0; i < pe; i++ ){
      if( num[i] % 2 == 0 && num[i] % 3 != 0 && num[i] % 5 != 0 ){
        printf("DENIED\n");
        
        return 0;
      }
     
   }
    
      printf("APPROVED\n");

    return 0;
  }

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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define pb push_back
#define fst first
#define snd second
#define endl '\n'

typedef long long ll;

const int N = 303;
const int M = 1e9 + 7;

vector<pair<int, int>> g[N];

int n, m;

ll dp[N][N][N];

ll sum(ll a, ll b){
    ll ans=(a+b); if(ans>=M) ans-=M;
    return ans;
}

ll solve(int i, int j, int k) {
    ll &r = dp[i][j][k];
    if(r != -1) return r;
    int p = max({i, j, k}) + 1;
    for(auto x : g[p]) {
        int c = (i >= x.fst) + (j >= x.fst) + (k >= x.fst);
        if(c != x.snd) return r = 0;
    }
    if(p == n + 1) return r = 1;
    ll res = sum(sum(solve(p, j, k), solve(i, p, k)), solve(i, j, p));
    return r = res;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    memset(dp, -1, sizeof dp);
    fore(i, 0, m) {
        int l, r, x; cin >> l >> r >> x;
        g[r + 1].pb({l, x});
    }
    fore(i, 2, n + 2) sort(g[i].begin(), g[i].end());
    cout << solve(0, 0, 0) << endl;
    return 0;
}

Measured memory_bytes: 217728
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int[][] q = new int[M][2];
        for (int i = 0; i < M; i++) {
            q[i][0] = scanner.nextInt();
            q[i][1] = scanner.nextInt();
        }

        long[] ans = new long[M];
        ans[M - 1] = N * (N - 1L) / 2;
        UnionFindTree uft = new UnionFindTree(N);
        for (int i = M - 1; i > 0; i--) {
            ans[i - 1] = ans[i];
            int a = q[i][0] - 1;
            int b = q[i][1] - 1;
            if (uft.same(a, b)) {
                continue;
            }
            long minus = ((long) uft.getCnt(a) * uft.getCnt(b));
            ans[i - 1] = Math.max(0, ans[i] - minus);
            uft.merge(a, b);
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < M; i++) {
            sb.append(ans[i]);
            sb.append('\n');
        }
        System.out.println(sb);
    }

}

class UnionFindTree {
    int size;
    int[] par;
    int[] rank;
    int[] cnt;

    public UnionFindTree(int size) {
        this.size = size;
        par = new int[size];
        for (int i = 0; i < size; i++) {
            par[i] = i;
        }
        rank = new int[size];
        Arrays.fill(rank, 1);
        cnt = new int[size];
        Arrays.fill(cnt, 1);
    }

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

    public boolean same(int x, int y) {
        return root(x) == root(y);
    }

    public int getCnt(int x) {
        return cnt[root(x)];
    }

    public void merge(int x, int y) {
        int xr = root(x);
        int yr = root(y);

        if (xr == yr) {
            return;
        }

        if (rank[xr] < rank[yr]) {
            par[xr] = yr;
            cnt[yr] += cnt[xr];
        } else {
            par[yr] = xr;
            cnt[xr] += cnt[yr];
            if (rank[xr] == rank[yr]) {
                rank[xr]++;
            }
        }
    }

}


Measured memory_bytes: 94820
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
    ll n,k,q;
    cin >> n >> k >> q;
    VI a(q);
    rep(i,q){
        cin >> a.at(i);
    }
    vector<ll> p(n,k-q);
    rep(i,q){
        p.at(a.at(i)-1)++;
    }
    rep(i,n){
        if(p.at(i)>0){
            cout << "Yes" << endl;
        }
        else if(p.at(i)<=0){
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1792
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79824
#include<stdio.h>
int main(void)
{
	int a,b,x,y,i,n;
	while(1){
		x=0; y=0;
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d %d",&a,&b);
			if(a>b) x=x+a+b;
			else if(a<b) y=y+a+b;
			else{
				x=x+a; y=y+b;
			}
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

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

main(){
    int n, x;
    while( cin >> n ){
	if ( n == 0 ) break;
	int sum = 0;
	for ( int i = 0; i < n/4; i++ ){
	    cin >> x; 
	    sum += x;
	}
	cout << sum << endl;
    }
}

Measured memory_bytes: 0
n,m = map(int,input().split())
switch = [[] for _ in range(m)]
for i in range(m):
    switch[i] = [int(_) for _ in input().split()]
p = [int(_) for _ in input().split()]

ans = 0

for i in range(2**n):
    light = [0] * m
    flag = True
    for j in range(m):
        for k in range(1,switch[j][0]+1):
            if (i >> (switch[j][k]-1))&1 == 1:
                light[j] += 1
        if light[j] % 2 != p[j]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)
        

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
 
int main()
{
  ll n, ans=0;
  cin >> n;
  vector<ll> a(n+1), b(n);

  rep(i, n+1) cin >> a[i];
  rep(i, n) cin >> b[i];
  
  rep(i, n){
    ans += min(a[i], b[i]);
    b[i] = max(b[i]-a[i], (ll)0);
    ans += min(a[i+1], b[i]);
    a[i+1] = max(a[i+1]-b[i], (ll)0);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void){

        int n;
        int j,a;
        double i;

        a=100000;
        i=0.05; /* interest */

        scanf("%d",&n);

        for(j=1;j<=n;j++){
        a=a*(1+i);
                if((a%1000)>0){
                a=a-(a%1000)+1000;
                }
        }


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

        return 0;
}

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

int main(){
           int n;
           cin>>n;
           int a[100];
           for(int x=0;x<n;x++) cin>>a[x];
           for(int x=0;x<n-1-x;x++)swap(a[x],a[n-1-x]);

           for(int x=0;x<n;x++){
             if(x) cout<<" ";
             cout<<a[x];
           }
        
           cout<<endl;
     return 0;
}


Measured memory_bytes: 3100
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

int n, m, flag;
char s[1000005]; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin);
#endif
	scanf("%s", s + 1), n = strlen(s + 1), m = n, flag = 1;
	while(flag && m)
	{
		if(m >= 5)
		{
			if(s[m - 4] == 'e' && s[m - 3] == 'r' && s[m - 2] == 'a' && s[m - 1] == 's' && s[m] == 'e') { m -= 5; continue; }
			if(s[m - 4] == 'd' && s[m - 3] == 'r' && s[m - 2] == 'e' && s[m - 1] == 'a' && s[m] == 'm') { m -= 5; continue; }
		}
		if(m >= 6)
			if(s[m - 5] == 'e' && s[m - 4] == 'r' && s[m - 3] == 'a' && s[m - 2] == 's' && s[m - 1] == 'e' && s[m] == 'r') { m -= 6; continue; }
			if(s[m - 6] == 'd' && s[m - 5] == 'r' && s[m - 4] == 'e' && s[m - 3] == 'a' && s[m - 2] == 'm' && s[m - 1] == 'e' && s[m] == 'r') { m -= 7; continue; }		
		flag = 0; 
	}
	if(flag) puts("YES");
	else puts("NO"); 
	return 0; 
}

Measured memory_bytes: 3220
import sys

input = sys.stdin.readline
N, K = map(int, input().split())
cnt = [0]*N
for _ in range(K):
    d = int(input())
    for a in list(map(int, input().split())):
        a -= 1
        cnt[a] += 1

ans = 0
for c in cnt:
    ans += c == 0
print(ans)


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

int main(){
    int n,mn;
    double ave=0;
    
    cin >> n;
    
    int i;
    for(i = 0 ; i < n ; i++){
        cin >> mn;
        ave += mn;
    }
    
    printf("%.0f\n" ,ave/=i);
    
    return 0;
}

Measured memory_bytes: 1188