akhauriyash/Code-Regression huggingface dataset:
/**
 *  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0015
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#define MAX_DIGITS 80
#define MAX_INPUTS 101

int   add(const char *n1, const char *n2, char **a);
char *stralloc(const size_t length);

int
main()
{
    int   n, i;
    char *r;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        char  n1[MAX_INPUTS];
        char  n2[MAX_INPUTS];
        scanf("%s", n1);
        scanf("%s", n2);

        errno = 0;
        if (add(n1, n2, &r)) {
            /* fprintf(stderr, "%s\n", strerror(errno)); */
            printf("overflow\n");
            continue;
        }
        printf("%s\n", r);
        free(r);
        r = NULL;
    }

    return 0;
}

int
add(const char *n1, const char *n2, char **a)
{
    int   l1, l2, lr;
    int   c = 0;
    int   i;
    char *r;

    l1 = strlen(n1);
    l2 = strlen(n2);
    if (l1 > MAX_DIGITS || l2 > MAX_DIGITS) {
        errno = EINVAL;
        return -1;
    }
    lr = l1 > l2 ? l1 : l2;

    r = stralloc(lr + 1);
    if (r == NULL) {
        /* errno = ENOMEM; */
        return -1;
    }
    while (lr >= 0) {
        int   d;
        d = c + (l1 > 0 ? n1[--l1] - '0' : 0) + (l2 > 0 ? n2[--l2] - '0' : 0);
        c = d / 10;
        r[lr--] = d % 10 + '0';
    }
    i = r[0] == '0' ? 1 : 0;
    if (strlen(r + i) > MAX_DIGITS) {
        free(r);
        r = NULL;
        errno = ERANGE;
        return -1;
    }
    if (i != 0) {
        char *n = r;
        r = stralloc(strlen(n + i));
        if (r == NULL) {
            /* errno = ENOMEM; */
            free(n);
            return -1;
        }
        strcpy(r, n + i);
        free(n);
    }
    *a = r;
    return 0;
}

char *
stralloc(const size_t length)
{
    return (char *)calloc(length + 1, sizeof(char));
}

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

int main() {
    int N, duplicated = 0;
    cin >> N;
    map<int, int> counter;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        counter[A]++;

        if (counter[A] >= 2) {
            duplicated++;
        }
    }

    int ans = counter.size();
    ans -= duplicated % 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=100005;
typedef pair<int,int> P;
#define fi first
#define se second
int n,k;
P p[max_n];
ll solve(vector<P> v,int bit){
    if(bit==-1){
        ll res=0;
        for(auto p:v)res+=p.second;
        return res;
    }
    ll res=0;
    vector<P> nv;
    for(auto p:v){
        int x=p.first>>bit&1,y=k>>bit&1;
        if(x<=y){
            nv.push_back(p);
            if(x<y)res+=p.second;
        }
    }
    return max(solve(nv,bit-1),res);
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d%d",&p[i].fi,&p[i].se);
    vector<P> v;
    for(int i=1;i<=n;i++)v.push_back(p[i]);
    printf("%lld\n",solve(v,30));
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long  double lb;
int mod=1e9+7;
const int N=1e5+5;

int main()
{
    int m,k;cin>>m>>k;
    int n=(1<<m)-1;
    if(k>n) cout<<-1;
    else if(m==1){
        if(k!=1)cout<<0<<" "<<0<<" "<<1<<" "<<1;
        else cout<<-1;
    }
    else {
            for(int i=0;i<=n;i++){
                if(i!=k)cout<<i<<" ";
            }
            cout<<k<<" ";
            for(int i=n;i>=0;i--){
                if(i!=k)cout<<i<<" ";
        }
        cout<<k;
    }
    return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

constexpr int MAX_N = 310, MAX_K = 310;
ll dp[MAX_N][MAX_K][MAX_N];

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

  int N, K;
  cin >> N >> K;
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= K; j++) {
      for (int k = 0; k <= N; k++) {
        dp[i][j][k] = 1e15;
      }
    }
  }
  vector<ll> h(N + 1);
  for (int i = 1; i <= N; i++) cin >> h[i];
  dp[0][0][0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      for (int k = 0; k <= i; k++) {
        dp[i + 1][j + 1][k] = min(dp[i + 1][j + 1][k], dp[i][j][k]);
        dp[i + 1][j][i + 1] =
            min(dp[i + 1][j][i + 1], dp[i][j][k] + max(h[i + 1] - h[k], 0LL));
      }
    }
  }
  ll ret = 1e15;
  for (int j = 0; j <= K; j++) {
    for (int k = 0; k <= N; k++) {
      ret = min(ret, dp[N][j][k]);
    }
  }
  cout << ret << endl;
}


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


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

    int ans;
    if (n == 100000) {
        cout << 90909 << endl;
    }
    else if (n%10000 != n) {
        ans = n - 10000 + 1 + 900 + 9;
        cout << ans << endl;
    }
    else if (n%1000 != n) {
        cout << 909 << endl;
    }
    else if (n%100 != n) {
        cout << n - 100 + 1 + 9 << endl;
    }
    else if (n%10 != n) {
        cout << 9 << endl;
    }
    else cout << n << endl;
    
    return 0;
}

Measured memory_bytes: 3668
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<String>();
    println!("{}{}", v[1], v[0]);
}

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

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


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

#define roop(i, n) for(int i=0;i<n;i++)

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	float r;
	cin >> r;
	cout << (2.0f * r * (float)acos(-1)) << endl;
	return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
//ll const mod=1e9+7;
const ll MAX=300000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


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


int main(){
    int n;
    cin>>n;
    vi a(n),d(100004);
    rep(i,n){
      cin>>a[i];
      a[i]++;
      d[a[i]+1]++;
      d[a[i]]++;
      d[a[i]-1]++;
    }
    int ans=0;
  rep(i,100004){
    chmax(ans,d[i]);
  }
  cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
h = list(map(int,input().split()))
a = [0] * n
a[1] = abs(h[1]-h[0])
for i in range(2,n):
    a[i] = min((abs(h[i-1]-h[i])+a[i-1]),(abs(h[i-2]-h[i])+a[i-2]))
print(a[n-1])

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

string a, b;
int main() {
    cin >> a >> b;
    a += b;
    int c = stoi(a);
    int d = sqrt(c);
    if (d * d == c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  double a;
  cin >> N;
  if (N % 2== 0){
     a = (double)1/2;
  cout <<(double) a  << endl;
  }
  if (N % 2 != 0){
     a = (double)(N+1)/(2*N) ;
  cout << (double) a << endl;
  }
 
}

Measured memory_bytes: 256
<?php
$r1=trim(fgets(STDIN));
$r2=$r3=0;

for($i=1;$i<10;$i++){
  $d=trim(fgets(STDIN));
  if($r1<$d){$r3=$r2;$r2=$r1;$r1=$d;}
  elseif($r2<$d){$r3=$r2;$r2=$d;}
  elseif($r3<$d){$r3=$d;}
}

echo $r1,PHP_EOL,$r2,PHP_EOL,$r3;
?>

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

int main () {
  int N;
  cin >> N;
  vector<ll> A(N);
  rep (i, N) {
    cin >> A.at(i);
  }

  ll ans = 0;

  for (int i = 0; i < N-1; i++) {
   if ( A.at(i) >= A.at(i+1) ) {
     ans += (A.at(i) - A.at(i+1));
     A.at(i+1) = A.at(i);
   }
  }

  cout << ans << endl;
  return 0;
}



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

typedef struct node{
  struct node *p,*r,*l;
  int key;
}Node;

Node *insert(Node *p,int key){
  Node *x,*y,*n;
  x=p;
  y=NULL;
  while(x!=NULL){
    y=x;
    if(x->key<=key)x=x->r;
    else x=x->l;
  }
  
  n=new Node;
  n->p=y;
  n->r=NULL;
  n->l=NULL;
  n->key=key;

  if (p==NULL)return n;
  if (y->key<=key) y->r=n;
  else y->l=n;
  return p;
}

void printA(Node *p){
  if (p==NULL) return;
  printA(p->l);
  cout << " " << p->key;
  printA(p->r);
}

void printB(Node *p){
  if (p==NULL) return;
  cout << " " << p->key;
  printB(p->l);
  printB(p->r);
}

void print(Node *p){
  printA(p);
  cout << endl;
  printB(p);
  cout << endl;
}

void find(Node *p,int key){
  Node *x=p;
  while(x!=NULL){
    if (x->key<key) x=x->r;
    else if (x->key>key) x=x->l;
    else {
      cout << "yes" << endl;
      return;
    }
  }
  cout << "no"<<endl;
}

int main(){
  int n,k;
  Node *root=NULL;
  char cmd[16];

  cin >> n;
  for (int i=0;i<n;i++){
    cin >> cmd;
    if (cmd[0]=='i'){
      cin >> k;
      root=insert(root,k);
    }else if (cmd[0]=='p'){
      print(root);
    }else if (cmd[0]=='f'){
      cin >> k;
      find(root,k);
    }//else if (cmd[0]==''){
    //}
  }
  
  return 0;
}

Measured memory_bytes: 21836
package main

import "fmt"

const LEN = 100005

type item struct {
	Name string
	Time int
}

type Queue struct {
	head   int
	tail   int
	length int
	items  [LEN]item
}

func (q *Queue) enqueue(x item) {
	q.items[q.tail] = x
	q.tail += 1
	if q.tail == LEN {
		q.tail = 0
	}
}

func (q *Queue) dequeue() item {
	tmp := q.head
	if q.head+1 == LEN {
		q.head = 0
	} else {
		q.head++
	}
	return q.items[tmp]
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, q int
	fmt.Scan(&n, &q)
	var items [LEN]item
	queue := &Queue{0, 0, n, items}
	for i := 0; i < n; i++ {
		fmt.Scan(&items[i].Name, &items[i].Time)
		queue.enqueue(items[i])
	}
	var a item
	var totalTime int
	var t int
	queue.head = 0
	queue.tail = n
	for queue.head != queue.tail {
		a = queue.dequeue()

		t = min(q, a.Time)
		a.Time -= t
		totalTime += t
		if a.Time == 0 {
			fmt.Printf("%s %d\n", a.Name, totalTime)
		} else {
			queue.enqueue(a)
		}
	}
}



Measured memory_bytes: 8668
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node{ int p, l, r;};
struct Node T[MAX];
int n, H, D[MAX];

void getDepth(int u){
  // if(D[u]!=NIL) return ;
 
  int d = 0;
  if(T[u].r!=NIL){
   
    D[T[u].r]=D[u];
    getDepth(T[u].r);
  }
  if(T[u].l!=NIL){ 
    D[T[u].l]=D[u]+1;
    getDepth(T[u].l);
  }
}

void print(int u){
  printf("node %d: parent = %d, depth = %d,",u,T[u].p,D[u]);
  if(T[u].p==NIL) printf(" root, ");
  else if(T[u].l==NIL) printf(" leaf, ");
  else printf(" internal node, ");
  printf("[");
  int a;
  a=u;
  if(T[a].l!=NIL){ 
    printf("%d",T[a].l);   
    if(T[T[a].l].r==NIL) printf("]\n");
    else printf(", ");
    a=T[a].l;
    while(T[a].r!=NIL){
      printf("%d",T[a].r);
      if(T[T[a].r].r==NIL) printf("]\n");
      else printf(", ");
      a=T[a].r;
    }
  }
  else puts("]");
 
}

main(){
  int i, j, d, v, c, l,r;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r =D[i]= NIL;
  }

  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
      T[c].p=v;
      if(j>=1){T[r].r=c;}
      if(j==0){T[v].l=c;}
	r=c;
      }
  }
  

  for ( i = 0; i < n; i++ ){
    if(T[i].p==NIL){D[i]=0; getDepth(i); break;}
  }
  

  for ( i = 0; i < n; i++ ) print(i);
  return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

//nが非常に大きく、aが小さい場合
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}


int main(){

    int X, Y; cin >> X >> Y;

    combination c(1000005);

    if ((X+Y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }

    int move_count = (X+Y)/3;

    mint ans = c(move_count, X-move_count);

    cout << ans << endl;;

}

Measured memory_bytes: 18768
#include<bits/stdc++.h>
using namespace std;
int main() {
  int64_t n,k,i,ans=0;
  cin>>n;
  for(i=1;i<=n;i++){
    k=n/i;
    ans+=k*(k+1)/2*i;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 10000000
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define BIG 100000000000000

ll  lcm(ll a,ll b)
{
    ll GCD=__gcd(a,b);
    ll lcm=(a*b)/GCD;
    return lcm;
}
ll dp[1000005];
ll weight[1000005];
ll total,val;
int main()
{
    cin>>total>>val;
    for ( int i = 1; i <=total; i++ )
        cin>>weight[i];

    weight[0]=SIZE;
    for(int i=2; i<=total; i++)
    {
        dp[i]=BIG;
        for(int j=1; j<=val; j++)
            if(i-j>=1)
                dp[i]=min(dp[i],abs(weight[i]-weight[i-j])+dp[i-j]);

    }
    cout<<dp[total]<<endl;
    return 0;
}



Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define MP make_pair
#define mod 1000000007

int main(){
    int arr[5];
    for(int i=0;i<5;i++){
        cin>>arr[i];
    }
    for(int i=0;i<5;i++){
        if(!arr[i]){
           cout<<i+1<<"\n";
           return 0;
        }
    }
}


Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL n,k;
	cin>>n>>k;
	LL j=n/k,h=(n+k/2)/k;
	if(k%2==0){
		cout<<1LL*j*j*j+1LL*h*h*h<<endl;
	}else{
		cout<<1LL*j*j*j<<endl;
	}
    return 0;
}


Measured memory_bytes: 888
import Control.Monad
import Control.Monad.ST
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Array.Unboxed
import Data.Array.ST

main=do
  (n:m:q:_)<-map read.words<$>getLine::IO[Int]
  lrs<-replicateM m $ unfoldr(B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[[Int]]
  pqs<-replicateM q $ unfoldr(B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[[Int]]
  --
  putStr.unlines $ map (show.g (f n lrs)) pqs
--
f n lrs = runSTUArray $ do
  ar <- newArray ((1,0),(n,n)) 0 :: ST s (STUArray s (Int,Int) Int)
  forM_ [(l,rr)|(l:r:_)<-lrs, rr<-[r..n]] $ \(l,rr) -> do
    writeArray ar (l,rr) =<< (+1) <$> readArray ar (l,rr)
  pure ar
--
g :: UArray (Int,Int) Int -> [Int] -> Int
g ar (p:q:_) = foldl' (\ac l-> ac + ar !(l,q) - ar!(l,p-1)) 0 [p..q]

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> L(N);
	for (auto& e: L) scanf("%d", &e);
	std::sort(L.begin(), L.end());
	int ans{};
	for (int i{2}; i < N; i++)
		for (int j{1}; j < i; j++)
		{
			int upper{(int)(std::upper_bound(L.begin(), L.end(), L[i] - L[j]) - L.begin())};
			ans += std::max(0, j - upper);
		}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
a,b,c,x=[int(input()) for i in range(4)]
ans=0
for i in range(a+1):
  for j in range(b+1):
    if (x-i*500-j*100)%50==0 and 0<=(x-i*500-j*100)//50<=c:
      ans+=1
print(ans)

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

using ll = long long; 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

signed main() {
  ll h,w,a,b;
    cin>>h>>w>>a>>b;
  for(int i=0;i<h;i++){
    string s;
    for(int j=0;j<w;j++){
      if(i<b&&j<a) s+='0';
      else if(i>=b&&j>=a) s+='0';
      else s+='1';
    }
    cout<<s<<endl;
  }
}


Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;

int main(){
    int n;cin>>n;
    string s;cin>>s;
    vector<int> E(n,0);
    vector<int> W(n,0);

    rep(i,1,n){
        E[i]=E[i-1]+((s[i-1]=='E')?1:0);
        W[n-1-i]=W[n-i]+((s[n-i]=='W')?1:0);
    }

    int m=0;
    rep(i,0,n)if(m<E[i]+W[i]){
        m=E[i]+W[i];
    }

    cout<<(n-1-m)<<endl;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 998244353
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
const double PI = acos(-1);
typedef long long ll;



int main(void) {
  int N;string S;
  cin>>N>>S;
  int ans=INF;
  VI ce(N+1,0),cw(N+1,0);
  REP(i,N){
    if(S[i]=='E'){
      ce[i+1]=ce[i]+1;
      cw[i+1]=cw[i];
    }else{
      ce[i+1]=ce[i];
      cw[i+1]=cw[i]+1;
    }
  }
  REP(i,N){
    int cnt=ce[N]-ce[i+1]+cw[i];
    ans=min(ans,cnt);
    //cout<<ans<<endl;
  }
  cout<<ans<<endl;
}

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

int main(){
    int n,a,b; cin >> n >> a >> b;
    int sum = 0;
    for(int i=1;i<=n;i++){
        if(i<10){
            int p = i;
            if(a<=p && p<=b){
                sum += i;
            }
        }else if(i<100){
            int p = i/10 + i%10;
            if(a<=p && p<=b){
                sum += i;
            }
        }else if(i<1000){
            int p = i/100 + (i%100-i%10)/10 + i%10;
            if(a<=p && p<=b){
                sum += i;
            }
        }else if(i<10000){
            int p = i/1000 + (i%1000-i%100)/100 + (i%100-i%10)/10 + i%10;
            if(a<=p && p<=b){
                sum += i;
            }
        }else{
            if(a<=1 && 1<=b){
                sum += i;
            }
        }
    }
    cout << sum << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n,now=2000000000,sum=0,ans=0;
int main(){
	//n=read();
	//m=read();	
	//k=n;now=1;
	//while(k<m){
	//	k+=n-1;
	//	now++;
	//}
	//printf("%lld\n",now);
	n=read();
	for(register int i=1;i<=n;i++){
		int x=read();
		if(now>=x)sum++;
		else sum=1;
		ans=max(sum,ans);
		now=x;
	}
	printf("%d\n",ans-1);
	return 0;
}

Measured memory_bytes: 256
n=int(input())
t,a= (int(i) for i in input().split())  
listx = [int(i) for i in input().split()]  
listy=[]
for i in range(n):
    avgx=t-0.006*int(listx[i])
    y=abs(a-avgx)
    listy.append(y)
print(listy.index(min(listy))+1)



Measured memory_bytes: 38384
#include<stdio.h>
void bubble_sort(int m[]);
int m[10],i,j,temp;
int main()
{
    for(i=0;i<10;i++){
        scanf("%d",&m[i]);
    }
    bubble_sort(m);
    return 0;
}

void bubble_sort(int m[])
{
    for(j=0;j<10-1;j++){
            for(i=0;i<10-j-1;i++){
                if(m[i]<m[i+1]){
                    temp=m[i+1];
                    m[i+1]=m[i];
                    m[i]=temp;
                }
            }
        }
    for(i=0;i<3;i++){
        printf("%d\n",m[i]);
    }
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;


bool isPrime(int n){
    if(n < 2) return false;
    for (int i = 2; i*i <= n; i++) {
        if(n%i == 0) return false;
    }
    return true;
}


int main()
{
    int N;
    cin>>N;
    ve<bool> A(55556,true);
    A[0] = false;
    A[1] = false;
    reps(i,1,55556){
        if(isPrime(i)){
            for (int j = i*2; j <= 55555; j+=i) {
                A[j] = false;
            }
        }
    }
    
    ve<int> ans;
    int nn = 0;
    rep(i,55556){
        if(A[i] && i%5 == 1){
            cout << i << " ";
            nn++;
        }
        if(nn == N) break;;
    }
  
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
def solve():
    N = int(input())
    X = [int(i) for i in input().split()]
    M = int(input())
    A = [int(i) for i in input().split()]
    for a in A:
        if not X[a - 1] + 1 in X:
            X[a - 1] = min(X[a - 1] + 1, 2019)
    for x in X:
        print(x)


if __name__ == '__main__':
    solve()



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define inf 1e18
#define pi acos(-1.0)
#define mod 998244353


int main(void)
{
    fastio;

    int n,i,p,c=0;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        cin >> p;
        if(p!=i)c++;
    }
    if(c>2)cout << "NO\n";
    else cout << "YES\n";

    return 0;
}


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

using namespace std;

typedef long long ll;

int max(int a, int b)
{ return (a > b) ? a : b; }

const int MAXN = 20031;

bool a[MAXN][MAXN];

bool knapSack(int W, vector<int> wt)
{
    int n = wt.size();
    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
            a[i][j] = false;
    a[0][0] = true;

    for (int i = 1; i <= n; i++)
    {
        int curW = wt[i - 1];
        for (int j = 0; j < MAXN; j++) {
            a[i][j] = a[i-1][j];
        }
        for (int j = 0; j < MAXN; j++)
        {
            if (a[i - 1][j] && j + curW < MAXN)
            {
                a[i][j + curW] = true;
            }
        }
    }

    if (W < 0) return false;
    if (W >= MAXN) return false;

    return a[n][W];
}

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

    string s;
    cin >> s;

    vector<int> all;

    int i = 0;
    while (i < s.size())
    {
        int t = 0;
        while (i < s.size() && s[i] == 'F')
        {
            t++;
            i++;
        }
        all.push_back(t);
        i++;
    }

    int x, y;
    cin >> x >> y;

    vector<int> a;
    vector<int> b;
    int suma = 0, sumb = 0;
    for (int i = 0; i < all.size(); i++)
    {
        if (i % 2 == 0) {
            if (i == 0) continue;
            a.push_back(2 * all[i]);
            suma += all[i];
        } else {
            sumb += all[i];
            b.push_back(2 * all[i]);
        }
    }

    if (knapSack(suma + x - all[0], a) && knapSack(sumb + y, b)) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;

  vector<int> vh(n);
  for (int i = 0; i < n; ++i) {
    cin >> vh[i];
  }

  vector<int> ma(n, 0);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    ma[a] = max(ma[a], vh[b]);
    ma[b] = max(ma[b], vh[a]);
  }

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (vh[i] > ma[i]) {
      ans++;
    }
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4028
while n = gets.to_i
  break if n == 0
  tile = n.times.map{ gets.split.map(&:to_i).each_slice(2).to_a.map{ |x, y| y * n + x } }.flatten(1)
  visit = [-1] * (n * n)
  cnt = 0
  m = 0
  while pos = visit.index{ |t| t == -1 }
    loop do
      visit[pos] = m
      pos = tile[pos]
      if visit[pos] != -1
        if visit[pos] == m
          cnt += 1
        end
        break
      end
    end
    m += 1
  end
  p cnt
end

Measured memory_bytes: 9528
n, m = map(int, input().split())
x = list(map(int, input().split()))

x.sort()

sub_array = []
for i in range(len(x) - 1):
    sub_array.append(x[i+1] - x[i])

sub_array.sort()

for i in range(n-1):
    if (len(sub_array) == 0):
        break
    sub_array.pop(-1)

print (sum(sub_array))


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

int main() {
    int n,k;
    cin>>n>>k;
    int a[n];
    bool winsTaro[k+1];
    memset(winsTaro, false, sizeof(winsTaro));
    for(int i=0;i<n;i++)
        cin>>a[i];
    winsTaro[0]=false;
    for(int j=1;j<=k;j++) {
        for(int i=0;i<n;i++) {
            if(j-a[i]>=0)
                winsTaro[j]|=(!winsTaro[j-a[i]]);
        }
    }
    // for(int i=0;i<=k;i++)
    //     cout<<winsTaro[i]<<" ";
    // cout<<endl;
    if(winsTaro[k])
        cout<<"First"<<endl;
    else 
        cout<<"Second"<<endl;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int H,W;
  cin >> H >> W;
  
  char a[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
		cin >> a[i][j];
    }
  }

 for(int i=0; i<H; i++){
	for(int j=0; j<W; j++){
		if(a[i][j]=='.'){
          int count=0;
          for(int k=i-1; k<=i+1; k++){
            for(int l=j-1; l<=j+1; l++){
              if(k<0 || k>=H || l<0 || l>=W)
                continue;
              if(a[k][l]=='#')
                count++;
            }
          }
          
          a[i][j]='0' + count;
        }
    }
 }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
		cout << a[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 3608
from operator import itemgetter

n, m = map(int, input().split())
a = list(map(int, input().split()))

b = [2, 5, 5, 4, 5, 6, 3, 7, 6]

c = []

for x in a:
    if x in [1, 4, 7, 8]:
        c.append((x, b[x - 1]))

if 5 in a:
    c.append((5, 5))
elif 3 in a:
    c.append((3, 5))
elif 2 in a:
    c.append((2, 5))

if 9 in a:
    c.append((9, 6))
elif 6 in a:
    c.append((6, 6))

c = sorted(c, key=itemgetter(1), reverse=True)

dp = [-999999 for _ in range(n + 1)]
dp[0] = 0

for i in range(2, n + 1):
    for x, y in c:
        if i >= y:
            dp[i] = max(dp[i], dp[i - y] + 1)
    #print(i, dp)

c = sorted(c, key=itemgetter(0), reverse=True)

#print(c)
#print(dp)

s = []
k = dp[n]
while k > 0:
    #print(s, k)
    #input()
    for x, y in c:
        if n >= y:
            if dp[n - y] == k - 1:
                s.append(str(x))
                k -= 1
                n -= y
                break

print(int(''.join(s)))


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

#define ll long long
#define dd double
#define scl(n)    scanf("%lld",&n)
#define scd(n)    scanf("%lf",&n)
#define ptl(n)    printf("%lld",n)
#define ptd(n)    printf("%lf",n)
#define nline     printf("\n")
#define vld       vector<ll>
#define vbd       vector<bool>
#define eb        emplace_back
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define pi        2*acos(0.0)

using namespace std;

int main()
{
    ll n;
    map<string,ll>mp;
    string s;
    scl(n);
    FOR(i,n)
    {
        cin>>s;
        mp[s]++;
    }
    printf("AC x ");
    ptl(mp["AC"]);
    nline;
    printf("WA x ");
    ptl(mp["WA"]);
    nline;
    printf("TLE x ");
    ptl(mp["TLE"]);
    nline;
    printf("RE x ");
    ptl(mp["RE"]);
    return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;



int main(){
    string S, T; cin >> S >> T;
    map<char, set<char>> counterS, counterT;
    rep(i,S.size()){
        counterT[T[i]].insert(S[i]);
        counterS[S[i]].insert(T[i]);
    }

    bool isOK = true;
    for (char i = 'a'; i <= 'z'; i++){
        if (counterS[i].size() > 1){
            isOK = false;
        }
        if (counterT[i].size() > 1){
            isOK = false;
        }
    }

    if(isOK) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 3912
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

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

// utility of stdin,stdout
#define _CRT_SECURE_NO_WARNINGS
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[]){
	int n;
	cin >> n;
	std::vector<int> a(n),b(n);
	for (int i = 0; i < n; ++i){
		cin >> a.at(i);
		b.at(i) = a.at(i);
	}
	sort(b.begin(), b.end());
	reverse(b.begin(), b.end());
	for (int i = 0; i < n; ++i)
	{
		if(a.at(i) == b.at(0))	OUT(b.at(1)) BR;
		else OUT(b.at(0)) BR;
	}
	RET;
}


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

long long extgcd(long long a, long long b, long long& x, long long& y) {
	long long d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1; y = 0;
	}
	return d;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}

	ll f[N], b[N], x, y;
	f[0] = A[0];
	for (int i=1; i<N; i++) f[i] = extgcd(f[i-1], A[i], x, y);
	b[N-1] = A[N-1];
	for (int i=N-2; i>=0; i--) b[i] = extgcd(b[i+1], A[i], x, y);
	ll res = b[1];
	for (int i=1; i<N-1; i++) res = max(res,extgcd(f[i-1], b[i+1], x, y));
	res = max(res, f[N-2]);

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



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

int main(void){
  
  	int a, b, c; cin >> a >> b >> c;
  	if(a == b) cout << c << endl;
  	else if(b == c) cout << a << endl;
  	else cout << b << endl;

 	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
cnt = Counter(s)
li = sorted(cnt.items(), key=lambda x: (-x[1], x[0]))
m = li[0][1]
for i in range(len(li)):
    if li[i][1] < m:
        break
    print(li[i][0])


Measured memory_bytes: 63788
class DisjointSet
  # 0 ~ (size - 1) を頂点するForestを作成する
  def initialize(size)
    @parents = Array.new(size) { 0 }
    @rank = Array.new(size) { 0 }

    for i in 0..(size-1)
      make_set(i)
    end
  end

  # 要素がxただ1つの新しい集合を作る
  def make_set(x)
    @parents[x] = x
    @rank[x] = 0
  end

  # 要素xが所属する集合の代表を求める
  def find_set(x)
    if x != @parents[x]
      return find_set(@parents[x])
    end
    return @parents[x]
  end

  # x, yを合併する
  def union(x, y)
    link(find_set(x), find_set(y))
  end

  def same?(x, y)
    find_set(x) == find_set(y)
  end

  private

  def link(x, y)
    if @rank[x] > @rank[y]
      @parents[y] = x
    else
      @parents[x] = y
      if @rank[x] == @rank[y]
        @rank[y] += 1
      end
    end
  end
end

n, k, l = STDIN.gets.split(' ').map(&:to_i)
roads = DisjointSet.new(n)
rails = DisjointSet.new(n)

k.times do
  p, q = STDIN.gets.split(' ').map(&:to_i)
  roads.union(p - 1, q - 1)
end

l.times do
  p, q = STDIN.gets.split(' ').map(&:to_i)
  rails.union(p - 1, q - 1)
end

connectivity = Hash.new { 0 }
for i in 0..(n-1)
  connectivity[[roads.find_set(i), rails.find_set(i)]] += 1
end

result = []
for i in 0..(n-1)
  result << connectivity[[roads.find_set(i), rails.find_set(i)]]
end

puts result.join(' ')

Measured memory_bytes: 34684
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
ll mult(ll a,ll b){
    return a*b%MOD;
}
ll fastpow(ll a, ll b){
    ll ans=1;
    for(;b>=1LL;b/=2LL){
        if((b&1LL))ans=mult(ans,a);
        a=mult(a,a);
    }
    return ans;
}
ll soma(ll a,ll b){
    if(a+b>MOD)return a+b-MOD;
    else return a+b;
}
ll subt(ll a,ll b){
    if(a-b<0)return a-b+MOD;
    else return a-b;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    map<pii,ll> cont;
    ll zz=0;
    rep(i,0,n){
        ll a,b;
        cin>>a>>b;
        if(a==0 && b==0)zz++;
        else if(a==0 || b==0){
            if(a!=0)a=1;
            if(b!=0)b=1;
            cont[{a,b}]++;
        }
        else {
            ll anta=abs(a);
            ll antb=abs(b);
            a/=__gcd(anta,antb);
            b/=__gcd(anta,antb);
            if(b<0 && a<0)a*=-1,b*=-1;
            if(b<0)a*=-1,b*=-1;
            cont[{a,b}]++;
        }
    }
    ll ans=1;
    ll nmatch=zz;
    for(auto e: cont){
        // cout<<e.F.F<<" "<<e.F.S<<endl;
        if(e.F.F>0 && e.F.S!=0){
            if(cont[{-e.F.S,e.F.F}]==0 || e.S==0)continue;
            ans = mult(ans,subt(soma(fastpow(2,e.S),fastpow(2,cont[{-e.F.S,e.F.F}])),1)); //// (2^x + 2^y - 1)total possibilities  of this group
            nmatch+=e.S+cont[{-e.F.S,e.F.F}];
        }
        else if(e.F.F==0 || e.F.S==0){/// include the case (1,0) (0,1)
            if(cont[{e.F.S,e.F.F}]==0 || e.S==0)continue;
            if(e.F.F==1){
                ans = mult(ans,subt(soma(fastpow(2,e.S),fastpow(2,cont[{e.F.S,e.F.F}])),1));
                // cout<<e.F.F<<" "<<e.F.S<<" "<<ans<<endl;
                nmatch+=e.S+cont[{e.F.S,e.F.F}];
            }
        }
    }
    ans=mult(ans,fastpow(2,n-nmatch));
    ans=soma(ans,zz);
    cout<<subt(ans,1)<<'\n';
    return 0;   
}


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

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

  cout << "Christmas";
  rep(i,25-d) cout << " Eve";

  cout << endl;
  return 0;
}


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

const int q_MAX=100000;
const int n_MAX=100000;

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

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){int n,i,l=0,k=1,j;
char ch;
string ans="";
   cin>>n;
   int mul[13];
   mul[0]=1;
   for(i=1;i<=12;i++)mul[i]=mul[i-1]*26;
   if(n==1){cout<<"a";return 0;}
   while(1){
       l++;
       if(mul[l]>=n)break;
       n-=mul[l];
   }
   
   for(i=1;i<=l;i++){mul[i]=26*mul[i-1];}
   for(i=1;i<=l;i++){
      for(j=0;j<26;j++){
          if(mul[l-i]>=n){
              ch=(char)('a'+j);
              ans+=ch;
              break;
          }else{n-=mul[l-i];}
      }
   }cout<<ans;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod %
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int ans = 1000000;
    string s; cin >> s;

    for(int i = 0; i < s.length()-2; i++){
        ans = min(ans, abs(753 - stoi(s.substr(i,3))));
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  int aa, bb, cc;
  int ans = 0;
  cin >> a >> b >> c;
  aa = a;
  bb = b;
  cc = c;
  if (a == b && b == c && a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    cout << -1 << endl;
    return 0;
  }
  while (aa % 2 == 0 && bb % 2 == 0 && cc % 2 == 0) {
    a = (bb + cc) / 2;
    b = (cc + aa) / 2;
    c = (aa + bb) / 2;
    aa = a;
    bb = b;
    cc = a;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  int res=1e9;
  rep(i,n){
    int a,b;
    cin>>a;
    if(res>(b=a-(a&(a-1))))res=b;
  }
  cout<<(int)log2(res)<<endl;


  return 0;

}


Measured memory_bytes: 256
S = int(input())
A = [S]
Count = 1
while True:
    Count += 1
    if A[-1]%2==0:
        Next = A[-1]//2
        if Next in A:
            print(Count)
            break
        else:
            A.append(Next)
    else:
        Next = 3*A[-1]+1
        if Next in A:
            print(Count)
            break
        else:
            A.append(Next)

Measured memory_bytes: 9132
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
#define LL long long
int main(){
    int q;
    while(cin>>q){
        LL a=0,b=0;
        while(q--){
            int x,y;
            char key[5];
            scanf("%d%s%d",&x,key,&y);
            if(key[0]=='(') a+=y;
            else b+=y;
            if(a==b) puts("Yes");
            else puts("No");
        }
    }
    return 0;
}

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

#define _u(i,a,b) for(int i=a;i<=b;++i)
#define _d(i,a,b) for(int i=a;i>=b;--i)
#define endl "\n"
#define ii pair<int,int>
#define fi first
#define se second
#define ll long long
#define FIO() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FI(task) freopen(task".inp","r",stdin)
#define FO(task) freopen(task".out","w",stdout)

using namespace std;

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

vector<int>edge[N];
int d[N];
int n, m, res;

void dfs(int u){
    d[u] = 0;
    for(int v:edge[u]){
        if(d[v] == -1) dfs(v);
        d[u] = max(d[u], d[v] + 1);
    }
    res = max(res, d[u]);
}

#define task "test"

int main(){
    FIO();
    //FI(task);
    ///FO(task);

    cin >>n >> m;
    while(m--){
        int u, v;
        cin >>u >> v;
        edge[u].push_back(v);
    }
    memset(d, -1, sizeof d);
    _u(i,1,n) if(d[i] == -1) dfs(i);
    cout << res;
    return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll v[20001], dp[2][1010];
ll a[2][1010],b[2][1010];
int main(){
	ll n,m,k;	cin>>n>>m>>k;
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	for(int i=0;i<2;i++){
		for(int j=0;j<m;j++){
			dp[i][j]=LLONG_MAX;
			a[i][j]=INT_MIN;	b[i][j]=INT_MAX;
		}
	}
	dp[0][0]=k;	a[0][0]=b[0][0]=v[0];
	for(int i=1;i<n;i++){
		for(int j=0;j<m;j++){
			if(dp[0][j]==LLONG_MAX)	continue;
			//その箱に追加する場合
			if(j+1<m){
				dp[1][j+1]=dp[0][j];
				a[1][j+1]=max((ll)a[0][j],v[i]);
				b[1][j+1]=min((ll)b[0][j],v[i]);
			}
			//新しく箱を作る場合
			ll num=k+dp[0][j];
			num+=(a[0][j]-b[0][j])*(j+1);
			dp[1][0]=min(dp[1][0],num);
			a[1][0]=b[1][0]=v[i];
		}
		for(int j=0;j<m;j++){
			dp[0][j]=dp[1][j];	dp[1][j]=LLONG_MAX;
			a[0][j]=a[1][j];	a[1][j]=INT_MIN;
			b[0][j]=b[1][j];	b[1][j]=INT_MAX;
		}
	}
	ll ans=LLONG_MAX;
	for(int i=0;i<m;i++){
		ll num=dp[0][i];
		num+=(a[0][i]-b[0][i])*(i+1);
		ans=min(ans,num);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3312
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
    string s; cin >> s;
    int ans = -1;
    int cnt = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
            cnt++;
        }
        else {
            cnt = 0;
        }
        ans = max(cnt,ans);
    }
    cout << ans << endl;
}

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

int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  sort(a, a+N);
  cout << a[N-1] - a[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
#define MAXN 200100
#define ll long long
int n, k, c, flag[MAXN], a[MAXN], d[MAXN], last;
int cnt, cnt2;
char s[MAXN];
int main()
{
	scanf("%d%d%d",&n,&k,&c);
	scanf("%s",s+1);
	last = 1;
	while(last <= n)
	{
		if(s[last] != 'x') 
		{
			a[++cnt] = last;
			last += c+1;
		}
		else last++;
	}
	last = n;
	while(last >= 1)
	{
		if(s[last] != 'x')
		{
			d[++cnt2] = last;
			last = last-c-1;
		}
		else last--;
	}
	if(cnt == cnt2 && cnt == k)
	{
		for(int i=1;i<=cnt;i++) flag[a[i]]++;
		for(int i=1;i<=cnt2;i++) flag[d[i]]++;
		for(int i=1;i<=n;i++)
		{
			if(flag[i] == 2) printf("%d\n",i);
		}
	}
//cout<<cnt<<" "<<cnt2;

	return 0;
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int A,B,C,ans;
    cin >> A >> B >> C;
    ans=C-(A-B);
    if(ans<0)ans=0;
    P(ans);
}

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

int main() {
    while (true) {
        int n;
        cin >> n;
        
        if (n==0) {
            break;
        }
        
        double y;
        cin >> y;
        
        double max_val = 0;
        int ans = -1;
        
        for (int i=0; i<n; i++) {
            int bi, ti;
            double ri;
            cin >> bi >> ri >> ti;
            
            double val;
            
            if (ti==1) {
                val = ((double)(100)+(double)(y*ri))/(double)(100);
            }
            else {
                val = pow(1+ri/(double)(100), y);
            }
            
            if (val>max_val) {
                max_val = val;
                ans = bi;
            }
        }
        
        cout << ans << endl;
    }
}


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


int main(){

    char b;
    cin >> b;

    if(b=='A') cout << 'T' << endl;
    if(b=='T') cout << 'A' << endl;
    if(b=='C') cout << 'G' << endl;
    if(b=='G') cout << 'C' << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <functional>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  map<int,int> mp;
  for(int i=0;i<n;i++){
    auto itr = mp.find(a[i]);
    if(itr == mp.end()){
      mp.insert(make_pair(a[i],1));
    }else{
      mp[a[i]]++;
    }
  }

  priority_queue<int,vector<int>,greater<int>> q;
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    q.push(itr->second);
  }

  int sum = 0;
  while(q.size() > k){
    sum += q.top();
    q.pop();
  }

  cout << sum << endl;
}


Measured memory_bytes: 11516