akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Calc{

    private Integer n;
    private String s;
    Calc(Integer N, String S){
        this.n = N;
        this.s = S;
    }
    
    public String calc() {
        if (n % 2 != 0) {
            return "No";
        }
        int harf = n / 2;
        if (s.substring(0, harf).equals(s.substring(harf, s.length()))) {
            return "Yes";
        } else {
            return "No";
        }
    }
}

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Integer N = Integer.parseInt(sc.next());
        String S = sc.next();
        Calc calc = new Calc(N, S);
        String result = calc.calc();
        System.out.println(result);
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
 
int main() {
    int n;
    cin >> n;
    int flag = 0;

    for(int i = 1; i <= n; i++) {
        int p;
        cin >> p;
        if(p != i) {
            flag++;
        }
    }

    if(flag == 0 || flag == 2) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }
    
    cout << endl;
    return 0;
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll X;
    cin >>  X;

    ll ans = (X/500) * 1000;
    ans += ((X%500)/5 ) * 5;
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x; 
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x; 
        return true;
    }
    return false;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    int x, n; cin >> x >> n;
    vector<int> p(n); FOR(i, 0, n) cin >> p[i];

    if (n==0) {
        cout << x << endl;
        return;
    }

    sort(p.begin(),p.end());
    auto it = find(p.begin(), p.end(), x);
    if (it == p.end()) {
        cout << x << endl;
        return;
    }

    int left = x;
    int right = x;
    for (;;) {
        left--;
        right++;

        auto it_left = find(p.begin(), p.end(), left);
        auto it_right = find(p.begin(), p.end(), right);
              
        if (it_left == p.end()) {
            cout << left << endl;
            return;
        } else if (it_right == p.end()) {
            cout << right << endl;
            return;
        }
    }
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int dp[15][25][200];

signed main(){
    while(1){
        int n, K, s;
        cin >> n >> K >> s;
        if(n + K + s == 0) break;
        rep(i, 0, 15) rep(j, 0, 25) rep(k, 0, 200) dp[i][j][k] = 0;
        dp[0][0][0] = 1;
        rep(i, 0, K){
            rep(j, 0, n){//pre
                rep(k, j + 1, n + 1){//new
                    rep(l, 0, s + 1){
                        // dp[i + 1][j][l] += dp[i][j][l];
                        // if(dp[i][j][l] == -1) continue;
                        if(l + k > s) continue;
                        // if(dp[i + 1][k][l + k] == -1) dp[i + 1][k][l + k] = 0;
                        dp[i + 1][k][l + k] += dp[i][j][l];
                    }
                }
            }
        }
        int ans = 0;
        // rep(i, 0, K + 1){
        //     rep(j, 0, n){
        //         rep(k, 0, 30){
        //             cout << dp[i][j][k] << " ";
        //         }
        //         cout << endl;
        //     }
        //     cout << endl << endl;
        // }
        rep(i, 0, n + 1){
            ans += dp[K][i][s];
        }
        cout << ans << endl;
    }
}

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int, int>
#define pll pair <ll, ll>
#define gcd __gcd
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

const ll L = 3e3+10;

ll dp[L][L];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    string s, t;
    cin >> s >> t;

    for(ll i=0; i<sz(s); i++)
    {
        for(ll j=0; j<sz(t); j++)
        {
            if(s[i]==t[j])
            {
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1);
            }

            else
            {
                dp[i+1][j+1] = max(dp[i+1][j+1], max(dp[i+1][j], dp[i][j+1]));
            }
        }
    }

    ll cx = sz(s);
    ll cy = sz(t);

    string res = "";

    while(cx && cy)
    {
        if(dp[cx][cy]==dp[cx-1][cy])
        {
            cx--;
        }

        else if(dp[cx][cy]==dp[cx][cy-1])
        {
            cy--;
        }

        else
        {
            cx--;
            cy--;
            res = s[cx] + res;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 70784
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        s: chars
    }
    if s[0] == s[1] && s[1] == s[2] {
        println!("No");
    } else {
        println!("Yes");
    }
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

int main(){

    int n = 0, S = 1, N;

    cin >> n;
    N = n;

    S = N * N * N;
    if (n != 0)
    {
        cout << S;
    }
else
    cout << 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vll a(n), b(n);
  rep (i, n) {
    scanf("%lld %lld", &a[i], &b[i]);
  }
  ll cnt = 0;
  for (int i = n-1; i >= 0; --i) {
    ll r = (a[i] + cnt) % b[i];
    if (r == 0) {
      continue;
    }
    cnt += (b[i] - r);
  }
  printf("%lld\n", cnt);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <cfenv>
#include <cmath>
#include <string>
#include <algorithm>
#include <cassert>
#include <functional>
#include <deque>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using namespace std;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  printf("%d %d %d\n", z,x,y);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int s[N];
	int sum = 0;
	rep(i, 0, N) {
		cin >> s[i];
		sum += s[i];
	}

	sort(s, s + N);
	if(sum % 10 != 0) {
		cout << sum << endl;
		return 0;
	}

	rep(i, 0, N) {
		if(s[i] % 10 != 0) {
			cout << sum - s[i] << endl;
			return 0;
		}
	}
	cout << 0 << endl;



}


Measured memory_bytes: 256
//K-OS WITH THE OCDE

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

typedef long long int ll;
typedef long double db;


#define TEST ll t; cin>>t; while(t--)
#define vell vector<ll>
#define pl pair<ll,ll>
#define all(v) v.begin(),v.end()
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define dbg(x)  cerr << #x << ": "<< x <<endl
#define dbg2(x,y) cerr<< #x <<": "<< x <<" || "<< #y << ": " << y << endl

#define endl "\n"
#define MAX 1e18
#define MIN INT_MIN
#define mod 1000000007



void solve()
{
	ll n;
	cin >> n;
	ll f = 7 , p = 7;

     ll mx = 1e6;

     for(ll i = 1 ; i <= mx ; ++i) {

     	 if(f % n == 0) {
     	 	cout << i ;
     	 	return;
     	 }

     	 f %= n;
     	 p = (p * 10) % n;
     	 f += p;
     }

	cout << -1;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0);
	//TEST

	solve();
}



Measured memory_bytes: 3648
#https://atcoder.jp/contests/abc117/tasks/abc117_b
S_list = [input() for i in range(2)]
N = map(int,S_list[0].split())    
L_list = list(map(int,S_list[1].split()))
 
if sum(L_list) > max(L_list) * 2:
    result ="Yes"
else:
    result ="No"
print(result)

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

int v[100001];

int dp(int i,int a[])
{
    if(i==0)
    {v[0]=0;return 0;}
    if(i==1)
    {v[1]= (abs(a[0]-a[1]));return v[1];}
    
    if(v[i]!=-1)
    return v[i];
    
    v[i]=min((abs(a[i]-a[i-1])+dp(i-1,a)),abs(a[i]-a[i-2])+dp(i-2,a));
    //v[i]=a[i];
    return v[i];
}

int main()
{
    int n;
    cin>>n;
    
    int a[n]; 
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)v[i]=-1;
    cout<<dp(n-1,a);    
   
    
    
}

Measured memory_bytes: 4864
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

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

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

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

    while (!b.empty()) {
        int m = (int) b.size();
        bool flag = false;
        for (int i = m - 1; i >= 0; --i) {
            if (b[i] == i + 1){
                b.erase(b.begin() + i);
                ans.emplace_back(i + 1);
                flag = true;
                break;
            }
        }
        if (!flag){
            cout << -1 << endl;
            return 0;
        }
    }

    reverse(ans.begin(), ans.end());
    for(auto &i : ans) cout << i << "\n";
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]

res = 0
for i in range(N):
    sum = 0
    for j in range(M):
        sum += alist[i][j] * blist[j]
    if sum + C > 0:
        res += 1
print(res)

Measured memory_bytes: 3064
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,k = LI()
    a = LI()
    d = defaultdict(lambda:0)
    for i in a:
        d[i] += 1
    d = list(d.values())
    d.sort()
    ans = 0
    for i in range(len(d)-k):
        ans += d[i]
    print(ans)
    return

#B
def B():
    n,z,w = LI()
    a = LI()
    if n == 1:
        print(abs(a[0]-w))
        return
    ans = max(abs(a[-1]-w),abs(a[-2]-a[-1]))
    print(ans)
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 39280
#include<stdio.h>
int main(void){
	int H, W, i, j;
	while(1){
		//数値を2つ入力
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0){
			break;
		}
		for(i = 0; i < H; i++){
			for(j = 0; j < W; j++){
				if((i % 2) == 0){
					if((j % 2) == 0 && j == (W - 1)){
						printf("#\n");
					}else if((j % 2) == 1 && j == (W - 1)){
						printf(".\n");
					}else if((j % 2) == 1){
						printf(".");
					}else{
						printf("#");
					}
				}else{
					if((j % 2) == 0 && j == (W - 1)){
						printf(".\n");
					}else if((j % 2) == 1 && j == (W - 1)){
						printf("#\n");
					}else if((j % 2) == 1){
						printf("#");
					}else{
						printf(".");
					}
				}
			}
		}
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 588
from sys import stdin, setrecursionlimit as lim

lim(100001)

n, m = map(int, raw_input().strip().split())
inp = stdin.readlines()

g1 = [[] for i in xrange(n + 1)]
g2 = [[] for i in xrange(n + 1)]
ans1 = [0 for i in xrange(n + 1)]
ans2 = [0 for i in xrange(n + 1)]

for line in inp:
    u, v = map(int, line.strip().split())
    g1[u].append(v)
    g2[v].append(u)

def dfs1(u):
    if ans1[u] != 0: return ans1[u]
    ret = 0
    for v in g1[u]:
        if ans1[v] != 0: ret = max(ret, ans1[v])
        else: ret = max(ret, dfs1(v))
    ret += 1
    ans1[u] = ret
    return ans1[u]

def dfs2(u):
    if ans2[u] != 0: return ans2[u]
    ret = 0
    for v in g2[u]:
        if ans2[v] != 0: ret = max(ret, ans2[v])
        else: ret = max(ret, dfs2(v))
    ret += 1
    ans2[u] = ret
    return ans2[u]

ans = 0
for i in xrange(1, n + 1):
    if ans1[i] == 0: ans = max(ans, dfs1(i))
for i in xrange(1, n + 1):
    if ans2[i] == 0: ans = max(ans, dfs2(i))

print ans - 1

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int calc (int num) {
    int sum = 0;
    while (num) {
        sum += num % 10;
        num /= 10;
    }
    return sum;
}

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n; cin >> n;
    int ans = INF;
    REP(i, 1, n/2 + 1) {
        int a = calc(i);
        int b = calc(n - i);
        ans = min(ans, a + b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  sort(all(A));

  auto bsearch = [&]() {
    auto test = [&](ll k) {
      auto boundary = [&](ll k, ll a) {
        ll tmp = k/a;
        ll res = (a>0 ? -longinf : longinf);
        for(int d=-2; d<=2; d++) {
          if(a*(tmp+d)<=k) {
            res = (a>0 ? max(tmp+d, res) : min(tmp+d, res));
          }
        }
        return res;
      };
      ll cnt = 0;
      rep(i, N) {
        int j;
        if(A[i] < 0) {
          ll lb = boundary(k, A[i]);
          j = lower_bound(all(A), lb) - begin(A);
          cnt += N - j - (i >= j);
        } else if(A[i] == 0) {
          if(k >= 0) cnt += N-1;
        } else {
          ll ub = boundary(k, A[i]);
          j = upper_bound(all(A), ub) - begin(A);
          cnt += j - (i < j);
        }
      }
      assert(cnt%2==0);
      return cnt/2 < K;
    };

    ll ng = longinf;
    ll ok = -longinf;
    while(abs(ok-ng) > 1) {
      ll mid = (ok+ng)/2;
      if(test(mid)) ok = mid;
      else ng = mid;
    }
    return ok+1;
  };

  cout << bsearch() << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,k; cin>>a>>b>>c>>k;
	while (k && b <= a) b<<=1,k--;
	while (k && c <= b) c<<=1,k--;
	if (b > a && c > b) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3624
S = input()
T = input()
s,t = len(S),len(T)
dp = [[0]*(t+1) for _ in range(s+1)]

for i in range(1,s+1):
  for j in range(1,t+1):
    if S[i-1]==T[j-1]:
      dp[i][j] = dp[i-1][j-1]+1
    else:
      dp[i][j] = max(dp[i-1][j],dp[i][j-1])

ans = ''
n,m = s,t
while n>0 and m>0:
  if dp[n][m]==dp[n-1][m]:
    n -= 1
  elif dp[n][m]==dp[n][m-1]:
    m -= 1
  else:
    ans = S[n-1] + ans
    n -= 1
    m -= 1
print(ans)

Measured memory_bytes: 144524
import java.util.*;

public class Main {
    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int p;
        int max = 0;
        int ans = 0;
        
        for (int i = 0; i < N; i++) {
            p = scan.nextInt();
            if (p > max) {
                max = p;
            }
            ans += p;
        }
        System.out.println(ans - max / 2);
        scan.close();
    }
}

Measured memory_bytes: 21844
from fractions import gcd


def count(l, h, div):
    u = h // div
    d = (l - 1) // div
    return u - d


a, b, c, d = list(map(int, input().split()))
e = c * d // gcd(c, d)
print(b - a + 1 - count(a, b, c) - count(a, b, d) + count(a, b, e))


Measured memory_bytes: 5048
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,D;
	while(cin>>N>>D) {
		VVI w(N, VI(D));
		REP(i, N) REP(j, D) cin>>w[i][j];
		ll ans = 0;
		REP(i, N) RANGE(j, i+1, N) {
			ll l = 0;
			REP(d, D) l += (w[i][d]-w[j][d])*(w[i][d]-w[j][d]);
			ll s = sqrt(l);
			if(s*s==l) ans++;
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
n = int(input())
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(n):
    s = input()
    if s[0] == 'M':
        m += 1
    if s[0] == 'A':
        a += 1
    if s[0] == 'R':
        r += 1
    if s[0] == 'C':
        c += 1
    if s[0] == 'H':
        h += 1
print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)

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

int main(void)
{
    char * taro = malloc(sizeof(char) * 101);
    char * hanako = malloc(sizeof(char) * 101);
    int score[2] = {0, 0};
    int n;
    int i, whowin;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%s", taro);
        scanf("%s", hanako);
        whowin = strcmp(taro, hanako);
        
        if(whowin == 0){
            score[0]++;
            score[1]++;
        }
        else if(whowin > 0){
            score[0] += 3;
        }
        else if(whowin < 0){
            score[1] += 3;
        }
    }
    printf("%d %d\n", score[0], score[1]);

    free(taro);
    free(hanako);

    return 0;
}


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

#define N 1000000
#define L 14

int getChar(char c){
  if(c == 'A') return 1;
  else if(c =='C') return 2;
  else if(c =='G') return 3;
  else if(c =='T') return 4;
  else return 0;
}

int getKey(char str[]){
  int i, sum = 0, x = 1;
  for(i = 0; i < strlen(str); i++){
    sum += x*(getChar(str[i]));
    x*=5;
  }
  return sum;
}

int h1(int key){
  return key % N;
}

int h2(int key){
  return 1 + (key % (N - 1));
}

char H[N][L];

int find(char str[]){
  int key, i, h;
  key = getKey(str);

  i = 0;
  while(1){
    h = (h1(key) + i*h2(key)) % N;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
    i++;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);

  i=0;
  while(1){
    h = (h1(key) + i*h2(key)) % N;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
    i++;
  }
  return 0;
}

int main(){
  int n, i;
  char str[L],instruction[L];

  for(i = 0; i < N; i++){
    H[i][0] = '\0';
  }

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s%s", instruction, str);

    if(instruction[0] == 'i'){
      insert(str);
    }
    else{
      if(find(str)) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 14280
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 14 15:56:37 2016

"""
while True:
    N, M = map(int, input().split())
    if N == M == 0:
        break
    
    PCs = [False] * N
    PCs[0] = True
    Packets = {}
    for _ in range(M):
        t, s, d = map(int, input().split())
        Packets[t] = (s, d)
    
    for key in sorted(Packets):
        if PCs[Packets[key][0] - 1] == True:
            PCs[Packets[key][1] - 1] = True
#            print('PC'+str(Packets[key][1])+' is infected')
            
    print(PCs.count(True))

Measured memory_bytes: 12556
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] l = new int[m];
        for (int i = 0; i < m; i++) {
            l[i] = sc.nextInt();
        }
        Arrays.sort(l);
        int[] diff = new int[m - 1];
        for (int i = 0; i < m - 1; i++) {
            diff[i] = Math.abs(l[i + 1] - l[i]);
        }
        Arrays.sort(diff);
        int sum = 0;
        for (int i = 0; i < diff.length - n + 1; i++) {
            sum += diff[i];
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 50036
#include<stdio.h>
#include<math.h>
#include<string.h>

#define FOR(n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRS(s) printf("%s\n",s)

int kt(int a){
  int b=a;
  int c=0;
  while(b){
    b/=10;
    c++;
  }
  return c;
}
int main(void){
  int n,ans=0;
  scanf("%d",&n);
  FOR(n)if(kt(i+1)%2)ans++;
  PRN(ans);
  return 0;
}

Measured memory_bytes: 128
num = int(input())

h = list(map(int, input().split(' ')))

now = h[0]
ans = 0
ans_max = 0

for i in range(num):
    if now >= h[i]:
        ans += 1
    else:
        ans = 1
        
    if ans_max < ans:
        ans_max = ans
    
    now = h[i]
        
print(ans_max-1)

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

int main() {
    int n;
    while(cin >> n, n) {
        multiset<int, greater<>> d;
        for(int i = 0; i < n * (n - 1) / 2; ++i) {
            int x; cin >> x;
            d.insert(x);
        }

        vector<int> cur = {0, *d.begin()}; // x position
        d.erase(d.begin());
        vector<vector<int>> ans;
        function<void(multiset<int, greater<>>&)> dfs = [&] (multiset<int, greater<>>& s) {
            if((int)cur.size() == n) { // ok
                ans.push_back({});
                for(int i = 1; i < n; ++i) {
                    ans.back().push_back(cur[i] - cur[i - 1]);
                }
                return;
            }
            auto attempt = [&] (int p) {
                vector<int> rm;
                for(auto x : cur) {
                    const auto it = s.lower_bound(abs(p - x));
                    if(it == end(s) || *it != abs(p - x)) break;
                    rm.push_back(*it);
                    s.erase(it);
                }
                if(rm.size() == cur.size()) {
                    cur.insert(lower_bound(begin(cur), end(cur), p), p);
                    dfs(s);
                    cur.erase(find(begin(cur), end(cur), p));
                }
                s.insert(begin(rm), end(rm));
            };
            attempt(*s.begin());
            attempt(cur.back() - *s.begin());
        };

        dfs(d);
        sort(begin(ans), end(ans));
        ans.erase(unique(begin(ans), end(ans)), end(ans));
        for(auto const& v : ans) {
            for(int i = 0; i < n - 1; ++i) {
                cout << v[i] << " \n"[i + 1 == n - 1];
            }
        }
        cout << "-----" << endl;
    }
}



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

int main(){
    int N,A;
    bool  ans=false;
    cin >> N >> A;
    for(int i=0;i<=A;i++){
        if((N%500)==i){
            ans = true;
            break;
        }
    }
    if(ans) cout << "Yes" << endl;
    if(!ans) cout <<"No" <<endl;
    return 0;
}

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

#define int long long
#define double long double

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-12;

using namespace std;

int n,q;
int rem[200001];
int pref[200001];

struct Node{

    int sl,sr;
    int modval;
    int tag;

};

Node st[800001];

void push(int cidx){

    int cl=st[cidx].sl;
    int cr=st[cidx].sr;

    if(st[cidx].tag!=-1){

        st[cidx].modval=pref[cr]+mod;
        if(cl>0) st[cidx].modval-=pref[cl-1];
        st[cidx].modval*=st[cidx].tag;
        st[cidx].modval%=mod;

        if(cl<cr){
            st[cidx*2].tag=st[cidx].tag;
            st[cidx*2+1].tag=st[cidx].tag;
        }

        st[cidx].tag=-1;

    }

    //
    //cout<<"push("<<st[cidx].sl+1<<","<<st[cidx].sr+1<<") "<<st[cidx].modval<<endl;
    //

}

void pull(int cidx){

    push(cidx);
    if(st[cidx].sl<st[cidx].sr){
        push(cidx*2);
        push(cidx*2+1);
        st[cidx].modval=(st[cidx*2].modval+st[cidx*2+1].modval)%mod;
    }

    //
    //cout<<"pull("<<st[cidx].sl+1<<","<<st[cidx].sr+1<<") "<<st[cidx].modval<<endl;
    //

}

void build(int cidx,int cl,int cr){

    st[cidx].sl=cl;
    st[cidx].sr=cr;

    st[cidx].modval=pref[cr]+mod;
    if(cl>0) st[cidx].modval-=pref[cl-1];
    st[cidx].modval%=mod;

    st[cidx].tag=-1;

    if(cl<cr){
        int mid=(cl+cr)/2;
        build(cidx*2,cl,mid);
        build(cidx*2+1,mid+1,cr);
    }

}

void modify(int ml,int mr,int val,int cidx){

    int cl=st[cidx].sl;
    int cr=st[cidx].sr;

    if( mr<cl or cr<ml ){
        return;
    }

    if( ml<=cl and cr<=mr ){
        st[cidx].tag=val;
        //cout<<"tag("<<cl+1<<","<<cr+1<<") "<<st[cidx].tag<<endl;
        return;
    }

    if(cl<cr){
        push(cidx);
        modify(ml,mr,val,cidx*2);
        modify(ml,mr,val,cidx*2+1);
        pull(cidx);
    }

}

int query(int ql,int qr,int cidx){

    int cl=st[cidx].sl;
    int cr=st[cidx].sr;

    if( qr<cl or cr<ql ){
        return 0;
    }

    pull(cidx);

    if( ql<=cl and cr<=qr ){
        return st[cidx].modval;
    }
    else{
        return ( query(ql,qr,cidx*2) + query(ql,qr,cidx*2+1) ) % mod ;
    }

}

signed main(){

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

    int ql,qr,digit;

    cin>>n>>q;

    rem[n-1]=1;
    for(int i=n-2;i>=0;i--){
        rem[i]=(rem[i+1]*10)%mod;
    }

    pref[0]=rem[0];
    for(int i=1;i<n;i++){
        pref[i]=(pref[i-1]+rem[i])%mod;
    }

    build(1,0,n-1);

    //
    //cout<<query(0,n-1,1)<<endl;
    //

    while(q--){

        cin>>ql>>qr>>digit;
        ql--;
        qr--;

        modify(ql,qr,digit,1);
        cout<<query(0,n-1,1)<<endl;

    }

    return 0;
}


Measured memory_bytes: 23168
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
// const ll INF = 1000000000000000000LL;
  
int main() {
    int n;
    cin >> n;
    int cnt = 0;
    int a,b;
    bool can = false;
    rep(i,n){
        cin >> a >> b;
        if(a==b) cnt++;
        else cnt = 0;
        if(cnt==3)  can = true;
    }
    if(can)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int n;
   int m;
   int c;
   
 
   cin >> n >> m >> c;
  
   int a[n+1][m];
  
   for(int i = 0;i<n+1;i++){
     
     for(int j = 0;j<m;j++){
       
    
       cin >> a[i][j];
       
     }
     
   }
  
   int ans = 0;

   for(int i = 1;i<n+1;i++){
     
       int sum = 0;
     
       for(int j = 0;j<m;j++){
      
           sum = sum+a[i][j]*a[0][j];
           
      
       }
       
     
       if(sum+c>0){
         
        // cout << sum + c << endl;
         
         ans = ans+1; 
         
       }
     
   }
  
  
   cout << ans << endl;
   
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

int main() {
    int N;
    cin >> N;
    int A[N], B[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    ll ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        if ((A[i] + ans) % B[i] != 0) {
            ans += B[i] - ((A[i] + ans) % B[i]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
function Main (input) {
  const inputs = input.split(/\s/g).map((num) => parseInt(num));
  const maxDistance = inputs[3];
  const distances = inputs.slice(0, 3);
  const calcs = [
    Math.abs(distances[0] - distances[1]),
    Math.abs(distances[1] - distances[2]),
  ];
  const isEnable1 = Math.abs(distances[0] - distances[2]) <= maxDistance;
  const isEnable2 = calcs.every((distance) => distance <= maxDistance);
  const isEnable = isEnable1 || isEnable2;
  
  console.log('%s', isEnable ? 'Yes' : 'No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, w;
  cin >> n >> w;
  int wi[n];
  int vi[n];
  int ac = 0;
  for(int i = 0; i<n;i++){
    cin >> wi[i] >> vi[i];
    ac+= vi[i];
  }
  long long dp[n+1][ac+1];
  for(int i = 0; i<=n;i++){
    for(int j = 0; j<=ac;j++){
      dp[i][j] = 10000000000000;
    }
  }
  int ans = 0;
  for(int i = 0; i<=n;i++){
    dp[i][0] = 0;
  }
  for(int i = 1;i<=n;i++){
    for(int j = 0; j<=ac;j++){
      if(vi[i-1]<=j){
	dp[i][j] = min(dp[i-1][j],dp[i-1][j-vi[i-1]]+wi[i-1]);
      }else{
	dp[i][j] = dp[i-1][j];
      }
    }
  }
  for(int i = 0; i<=ac;i++){
    if(dp[n][i]<=w){
      ans = max(ans,i);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 82496
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


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

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;

void mymain(){
    int n,m;
    cin >> n >> m;
    multiset<int> s;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        s.insert(a);
    }
    while(m--){
        int key = *(--s.end());
        key /= 2;
        s.erase(--s.end());
        s.insert(key);
    }
    int sum=0;
    for(int i : s)
        sum+=i;
    cout << sum <<endl;
}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
///cin>>t;

for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cmath>
#include <iomanip>
#include <assert.h>
#include <string>

using namespace std;
class dice{
	int a[7];
public:	
	dice(){ for (int i = 1; i <= 6; ++i) a[i] = i + 1; }
	void set(int i, int n){ assert(1<=i && i<=6); a[i] = n; }
	void rot(char ch){
		assert(ch=='W' || ch=='N' || ch=='S' || ch=='E');
		int tmp = a[1];
		switch (ch)
		{
		case 'W':
			a[1] = a[3]; a[3] = a[6]; a[6] = a[4]; a[4] = tmp;
			break;
		case 'E':
			a[1] = a[4]; a[4] = a[6]; a[6] = a[3]; a[3] = tmp;
			break;
		case 'N':
			a[1] = a[2]; a[2] = a[6]; a[6] = a[5]; a[5] = tmp;
			break;
		case 'S':
			a[1] = a[5]; a[5] = a[6]; a[6] = a[2]; a[2] = tmp;
			break;
		}
	}
	int front(){ return a[1]; }
	int south(){ return a[2]; }
	int west(){ return a[4]; }
	int east(){ return a[3]; }
	int north(){ return a[5]; }
	int bottom(){ return a[6]; }
};
int main(){
	dice D;
	for (int i = 1; i <= 6; ++i){
		int tmp; cin >> tmp;
		D.set(i, tmp);
	}
	string str; cin >> str;
	for (int i = 0; i < str.size(); ++i){
		char ch; ch = str[i];
		D.rot(ch);
	}
	cout << D.front() << '\n';
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;

int main()
{
    int x,y;
    cin>>x>>y;
    if((ll)x*y>=0){
        if(x<=y)cout<<y-x<<endl;
        else if(x==0||y==0) cout<<abs(x)+abs(y)+1<<endl;
        else if(x>0) cout<<x-y+2<<endl;
        else cout<<x-y+2<<endl;
    }else cout<<abs(abs(y)-abs(x))+1<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main()
{
    string c;
    cin >> c;
    if(c[0]=='a')
        cout << "vowel";
    else if(c[0]=='e')
        cout << "vowel";
    else if(c[0]=='i')
        cout << "vowel";
    else if(c[0]=='o')
        cout << "vowel";
    else if(c[0]=='u')
        cout << "vowel";
    else
        cout << "consonant";
    cout << endl;
}

Measured memory_bytes: 256
N,K,Q = map(int,input().split())

"""考え方
長さ=Nのリストに対して、数字を加算していく
最後に、要素の値がK未満の場合はYes、そうでないならNoと出力する
"""

ans = [0] * (N+1)

for q in range(0,Q):
  user = int(input())
  ans[user] += 1
  
limit = Q - K
for a in ans[1:]:
  if a > limit:
    print('Yes')
  else:
    print('No')

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

int main(){
  map<int, int> mp;
  int a, b, c;	cin >> a >> b >> c;
  mp[a]++;
  mp[b]++;
  mp[c]++;
  if(mp[5]==2&&mp[7]==1)	cout<<"YES"<<endl;
  else	cout<<"NO"<<endl;
  return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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;}

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
    if(t1*a1 + t2 * a2 == t1 * b1 + t2 * b2){
        cout << "infinity" << endl;
        return 0;
    }
    if(b1 > a1){
        ll x = b1; b1 = a1; a1 = x;
        x = b2; b2 = a2; a2 = x;
    }
    if(t1 * a1 > t1 * b1 && t1*a1 + t2 * a2 <= t1 * b1 + t2 * b2){
        ll dif = t1 * (a1 - b1);
        ll af = t2 * (a2 - b2);
        ll k = abs(dif/(dif + af));
        if(dif %(dif + af) == 0){
            cout << 2*k << endl;
        }else{
            cout << 2*k + 1<< endl;
        }
    }else{
        cout << 0 << endl;
        return 0;
    }
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
  	scanf("%d %d",&n,&k);
	int a[n];
  
  	for(int i=0;i<n;i++)
      scanf("%d",&a[i]);
  
  	sort(a,a+n);
  
  	long long tot=0;
  	for(int i=0;i<k;i++)
      tot+=(long long)a[i];
  
  	printf("%lld",tot);
}

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

from pprint import pprint
from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
INF = float("inf")

x = int(input())
year = 0
money = 100
while True:
    year += 1
    money += money // 100
    if money >= x:
        break

print(year)


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

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if (a > b) swap(a, b);
    if ((b - a) % 2 == 0)
        cout << (b - a) / 2 << endl;
    else
        cout << min(a + (b - a - 1) / 2, n - b + 1 + (b - a - 1) / 2) << endl;
    return 0;
}

Measured memory_bytes: 256
def chk(s,i,j):
          
    cnt = 0
    for ii in range(max(0,i-1),min(h,i+2)):
        for jj in range(max(0,j-1),min(w,j+2)):
            if s[ii][jj] == '#':
                cnt +=1
    s[i][j]= str(cnt)

h,w = map(int,input().split())

s=[]
for _ in range(h):
    s.append(list(input()))

for i in range(h):
    for j in range(w):
        if s[i][j] != '#':
            chk(s,i,j)

for i in range(len(s)):
    print("".join(s[i]))

Measured memory_bytes: 3188
L,R = map(int,input().split())

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

for i in range(L,R):
    for j in range(i+1,R+1):
        l.append((i*j)%2019)
else:
    l.sort()

print(l[0])


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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 (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll X;
    cin >> X;

    ll G = gcd(360, X);
    ll L = 360*X/G;
    cout << L/X << endl;

    return 0;
}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
X, N = map(int, input().split())

if N == 0:
    print(X)
else:
    p_list = list(map(int, input().split()))
    ans_list = [X]
    for i in range(1, 51):
        ans_list.append(X - i)
        ans_list.append(X + i)

    for i in range(len(ans_list)):
        if p_list.count(ans_list[i]) == 0:
            print(ans_list[i])
            break

Measured memory_bytes: 9188
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
  int N,L;
  cin >> N >> L;
  vector<string> s(N);
  for(int i=0; i<N; i++){
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  for (string t:s)cout << t;
  cout << endl;
}

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n, k = map(int, sys.stdin.readline().split())
	p = list(map(int, sys.stdin.readline().split()))
	p.sort()
	print(sum(p[:k]))
	


main()

Measured memory_bytes: 10008
#include<cstdio>
#include<algorithm>
using namespace std;
long long s;
int main(){
	scanf("%lld",&s);
	int x=(1000000000-s%1000000000)%1000000000,y=(s+x)/1000000000;
	printf("0 0 1000000000 1 %lld %lld",x,y);
	return 0;
}

Measured memory_bytes: 128