akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(){
	string a, b;
	cin >> a >> b;

	int res = 0;
	for(int i = 0; i < 3; i++) {
		if (a[i] == b[i]) res++;
	}
	cout << res;

	return 0;
}

Measured memory_bytes: 888
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getLine
    k <- getInt
    print $ count n k

count :: String -> Int -> Int
count _ 0 = 1
count (s : []) 1 = read [s]
count (s : []) _ = 0
count (s : ss) k 
    | s == '0' = count ss k
    | otherwise = count ss (k - 1) + (read [s] - 1) * count (map (\_ -> '9') ss) (k - 1) + count (map (\_ -> '9') ss) k


Measured memory_bytes: 2428
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

int main(){

    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> xs(n), ys(m);

    REP(i,n){
        cin >> xs[i];
        if(xs[i]>=y){
            cout << "War" << endl;
            return 0;
        }
    }
    int x_border = max(x, *max_element(xs.begin(), xs.end()));

    REP(i,m){
        cin >> ys[i];
        if(ys[i]<=x_border){
            cout << "War" << endl;
            return 0;
        }
    }

    cout << "No War" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <complex>
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <sstream>
 
class Point {
public:
    Point();
    Point(double x_in, double y_in);
 
    Point  operator+(const Point& obj);
    Point  operator-(const Point& obj);
    Point  operator*(const double n);
    Point  operator/(const double n);
 
    void set(double x_in, double y_in);
 
    double x;
    double y;
};
 
Point::Point() {
    x = 0;
    y = 0;
}
 
Point::Point(double x_in, double y_in) {
    x = x_in;
    y = y_in;
}
 
Point Point::operator+(const Point& obj) {
    Point temp;
    temp.x = x + obj.x;
    temp.y = y + obj.y;
    return temp;
}
 
Point Point::operator-(const Point& obj) {
    Point temp;
    temp.x = x - obj.x;
    temp.y = y - obj.y;
    return temp;
}
 
Point Point::operator*(const double n) {
    Point temp;
    temp.x = x * n;
    temp.y = y * n;
    return temp;
}
 
Point Point::operator/(const double n) {
    Point temp;
    temp.x = x / n;
    temp.y = y / n;
    return temp;
}
 
void Point::set(double x_in, double y_in) {
    x = x_in;
    y = y_in;
}
 
double abs(Point point) {
    return sqrt(point.x * point.x + point.y * point.y);
}
 
int N;
Point V[50];
 
std::string solve() {
    if (N % 2 != 0) return "NA";
    Point center = (V[0] + V[N / 2]) / 2.0;
    for (int i = 1; i < N / 2; i++) {
        Point median = (V[i] + V[i + N / 2]) / 2.0;
        Point dist = center - median;
        if (abs(dist) >= 0.00001) {
            return "NA";
        }
    }
    std::ostringstream str;
    str.setf(std::ios::fixed, std::ios::floatfield);
    str << center.x << " " << center.y;
    return str.str();
}
 
int main() {
    //入力
    std::cin >> N;
    double x, y;
    for (int i = 0; i < N; i++) {
        std::cin >> x >> y;
        V[i].set(x, y);
    }
    //演算
    std::string answer = solve();
    //出力
    std::cout << answer << std::endl;
    return 0;
}

Measured memory_bytes: 1312
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flush := NewIO()
	defer flush()

	n := io.ScanInt()
	nums := io.ScanInts(n)
	xor := 0
	for i := 0; i < n; i++ {
		xor = xor ^ nums[i]
	}
	for i := 0; i < n; i++ {
		fmt.Printf("%d ", xor ^ nums[i])
	}
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInt2() (int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt3() (int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt4() (int, int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 11936
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	string s;
	cin >> s;
	int l = s.size();

	map<char,int> m;
	rep(i,l){
		m[s[i]] = 1;
	}

	int mi = 100;
	for (auto &item: m){
		int ma = 0;
		int sub = 0;
		rep(i,l){
			if (s[i]==item.first){
				ma = max(ma,sub);
				sub = 0;	//reset
			}
			else if (i==l-1){
				sub++;
				ma = max(ma,sub);
			}
			else {
				sub++;
			}
		}
		mi = min(mi, ma);
	}

	cout << mi << endl;
}


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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  int res = 0;
  res += b;
  b -= 1;
  if (a > b) swap(a, b);
  res += b;
  cout << res << '\n';
  return 0;
}

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

int gcd(int a, int b) {
  int r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int a, b;
  while (cin >> a >> b) {
    int GCD = gcd(a, b);
    int LCM = a / GCD * b;
    cout << GCD << " " << LCM << endl;
  }
}

Measured memory_bytes: 3064
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

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

        int n = sc.nextInt();
        int cnt = 0;
        int[] ar = new int[n];
        boolean[] b = new boolean[n];
        for (int i = 0; i < n; i++) {
            ar[i] = sc.nextInt() - 1;
            b[i] = false;
        }
        int num = ar[0];
        while (true) {
            if (b[num] || b[1]) {
                break;
            }
            b[num] = true;
            num = ar[num];
            cnt++;
        }
        System.out.println(b[1]?cnt:-1);
        sc.close();
    }
}

class io {
    public static void br() {
        System.out.println("");
    }

    public static void YesNo(boolean f) {
        System.out.println(f ? "Yes" : "No");
    }

    public static void YESNO(boolean f) {
        System.out.println(f ? "YES" : "NO");
    }

}

class Algo {
    public static boolean isOdd(int n) {
        return n % 2 == 1;
    }

    public static boolean isEven(int n) {
        return n % 2 == 0;
    }


}



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

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define all(x) x.begin(),x.end()
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=2e6+10, mod=998244353;

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	char c;
	cin>>c;
	cout<<char(c+1);
	
    yogeshk972();
}


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

using namespace std;

int const NMAX = 100;
int v[1 + NMAX + 1];

int main() {

  long long a, b, c;
  cin >> a >> b >> c;
  cout << min(abs(((a / 2) + a % 2) * (b * c) - ((a / 2)) * (b * c) ),min(abs(((b / 2) + b % 2) * (a * c) - ((b / 2)) * (a * c) ), abs(((c / 2) + c % 2) * (b * a) - ((c / 2)) * (b * a) )));
  return 0;
}


Measured memory_bytes: 3612
#include <queue>
#include <iostream>
#include <string>

using namespace std;

int main() {
	int N,Q;
	cin >> N >> Q;
	int tq;
	string tn;

	queue<int> process,Rprocess;
	queue<string> name,Rname;
	for(int i=0;i<N;i++) {
		cin >> tn >> tq;
		name.push(tn);
		process.push(tq);
	}
	string tempn;
	int tempq;
	int time = 0;
	while(process.size() > 0) {
		tempn = name.front();
		name.pop();
		tempq = process.front();
		process.pop();

		if(tempq-Q <= 0) {
			time += tempq;
			Rname.push(tempn);
			Rprocess.push(time);
		}
		else {
			time += Q;
			tempq -= Q;
			name.push(tempn);
			process.push(tempq);
		}
	}
	for(int i=0;i<N;i++) {
		cout << Rname.front() << " " << Rprocess.front() << endl;
		Rname.pop(); Rprocess.pop();
	}


}

Measured memory_bytes: 6140
from collections import defaultdict
def inpl(): return [int(i) for i in input().split()]
class UnionFind():
    def __init__(self, num):
        self.par = [-1 for _ in range(num)]
    
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            x = self.par[x]
            return self.find(x)
    
    def union(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            if self.par[rx] < self.par[ry]:
                self.par[ry] = rx
            if self.par[rx] > self.par[ry]:
                self.par[rx] = ry
            else:
                self.par[rx] -= 1
                self.par[ry] = rx
        return
    
lang = defaultdict(lambda: [])
N, M = inpl()
for i in range(N):
    L = inpl()[1:]
    for j in L:
        lang[j].append(i)
CF = UnionFind(N)
for Li in lang.values():
    t = Li[0]
    for j in Li:
        CF.union(t, j)
uni = [i for i in CF.par if i< 0]
if len(uni) == 1:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 16396
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>A(N+100);
    map<int,int>M;
    for(int i=1;i<=N;i++){
        cin>>A.at(i);
        M[A.at(i)]=i;
    }
    for(int i=1;i<=M.size();i++){
        cout<<M.at(i);
        if(i<M.size()){cout<<" ";}
        if(i==M.size()){cout<<endl;}
    }
    
}

Measured memory_bytes: 5888
#include <stdio.h>
 
int main(){
  int N;
  int st=0;
  int sum=0;
  int bst = 0;
  int ast= 0;
  scanf("%d", &N);
  int x[N];
  
  for (int l=0;l<N;l++){
   	scanf("%d", &x[l]);
    sum+= x[l];
  }
  int ave = sum / N;
  
  for (int j=0; j<N; j++){
  	st += (x[j] - ave) * (x[j] - ave);
    bst+= (x[j] - ave+1) * (x[j] - ave+1);
    ast+= (x[j] - ave-1) * (x[j] - ave-1);
  }
  
  if(st < ast){
    if(st < bst){
        printf("%d\n", st);
   	}else{
        printf("%d\n", bst);
  	}
  } else if (ast < bst){
  	printf("%d\n", ast);
  } else {
    printf("%d\n", bst);
  }

  return 0;
}

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

ll solve() {
    ll X;
    cin >> X;
        
    ll ans = (X / 500) * 1000 + ( X % 500) / 5 * 5;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

const int maxi=1e6+2;

int a[maxi];
string s;
vector<int> v[maxi];
map<int,int > mp;
int n;
int b[maxi];
int main()
{
    cin>>n;

    for (int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            b[i]=a[i];
        }

   sort(b+1,b+n+1);

   int left = b[n/2];
   int right = b[n/2+1];

   for (int i=1;i<=n;i++)
   {
       if (a[i]<=left) printf("%d\n",right); else printf("%d\n",left);
   }
    return 0;
}
//sala mala


Measured memory_bytes: 29568
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	string ans="aaa";
	ans[0] = s1[0] - 'a' + 'A';
	ans[1] = s2[0] - 'a' + 'A';
	ans[2] = s3[0] - 'a' + 'A';

	ANS(ans)


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) REP(I,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
using namespace std;
using namespace __gnu_pbds;
int N,M,i,x,y,dp[100001],ans,v;
vector<vector<int> > G;
int rec(int v){
  if(dp[v]!=-1)return dp[v];
  int res=0;
  for(auto nv:G[v])res=max(res,rec(nv)+1);
  return dp[v]=res;
}
inline void solve(){
  IN2(N,M);
  G.assign(N,vector<int>());
  REP(i,M){
    IN2(x,y);
    --x;--y;
    G[x].push_back(y);
  }
  fill(dp,dp+100001,-1);
  REP(v,N)ans=max(ans,rec(v));
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 8192
# -*- coding: utf-8 -*-

s = list(input())
s = list(map(int,s))

pat0 = []
pat1 = []
for i in range(len(s)):
    if i % 2 == 0:
        pat0.append(0)
        pat1.append(1)
    else:
        pat0.append(1)
        pat1.append(0)

cnt0 = 0
cnt1 = 0
for i in range(len(s)):
    if s[i] != pat0[i]:
        cnt0 += 1
    else:
        cnt1 += 1

print(min(cnt0,cnt1))


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

#define ll long long

int main(){

    int n;
    int a;
    vector<int> hairetu;
    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> a;
        hairetu.push_back(a);
    }

    for(int i=n-1; i>=0; i--){
        if( i != 0){
            cout << hairetu[i] << " ";
        }else{
            cout << hairetu[i] << endl; 
        }        
    }

    return 0;
}

Measured memory_bytes: 3136
#include<iostream>
#include<numeric>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    ll ans=0,x=1,sum=0;
    map<ll,int> m;
    for(ll i=0;i<(ll)s.size();i++){
        m[sum]++;
        sum+=(s[i]-'0')*x;
        sum%=2019;
        ans+=m[sum];
        x=x*10%2019;
    }
    cout<<ans<<endl;
}

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

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

const ll INF = 1LL << 60;



//大文字小文字気をつけろ

int main(){
  string s;
  int k;
  cin >> s >> k;
  set<string> v;
  FOR(i,s.size()){
    FOR(j,k){
      if(i+j>=s.size()){break;}
      v.insert(s.substr(i,j+1));
    }
  }
  int c=0;
  for(auto x : v){
    c++;
    if(c==k){
      cout << x << endl;
      return 0;
    }
  }
}


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

int64_t sum[5001];
int64_t imos[5002][5002];
vector<pair<int, int>> B[200];

int main(){
    int N, M;
    cin >> N >> M;
    for(int i=2; i<=N; i++){
        int a;
        scanf("%d", &a);
        sum[i] = sum[i-1] + a;
    }
    for(int i=1; i<=N; i++){
        for(int j=0; j<M; j++){
            int b;
            scanf("%d", &b);
            B[j].push_back({b, i});
        }
    }

    for(int j=0; j<M; j++){
        sort(B[j].rbegin(), B[j].rend());
        set<int> st;
        st.insert(0);
        st.insert(N+1);
        for(auto& p : B[j]){
            int b = p.first, i = p.second;
            auto it = st.lower_bound(i);
            int r = *it, l = *prev(it);
            imos[i][i] += b;
            imos[i][r] -= b;
            imos[l][i] -= b;
            imos[l][r] += b;
            st.insert(i);
        }
    }

    for(int l=N  ; l>=0; l--) for(int r=0; r<=N+1; r++) imos[l][r] += imos[l+1][r];
    for(int l=N+1; l>=0; l--) for(int r=1; r<=N+1; r++) imos[l][r] += imos[l][r-1];

    int64_t ans = 0;
    for(int l=1; l<=N; l++){
        for(int r=l; r<=N; r++){
            int64_t result = imos[l][r] - (sum[r] - sum[l]);
            ans = max(result, ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 206848
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;


void solve(){
    int a,b;
    cin >> a >> b;
    if((a*b)%2==1) cout << "Odd" << endl;
    else cout << "Even" << endl;
}

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


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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

int s,w;cin>>s>>w;
if(w>=s){
  cout<<"unsafe"<<endl;
}else{
  cout<<"safe"<<endl;

}
  
  return 0;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 924844033

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

bool used[2222];
ll  dp[4444][2222];
ll kaijo[2222];

int main(){
	
	ll n,k;cin >> n >> k;
	vector<int> v;
	ll sum = 0;
	ll seica = 1, chan = 0;
	
	kaijo[0] = 1;
	REP(i,2221)kaijo[i+1] = (kaijo[i] * (i+1)) % MOD;
	
	REP(i,n){
		if(!used[i]){
			used[i] = true;
			ll num = i + k;
			ll cou = 0;
			while(num < n && !used[num]){
				used[num] = true;
				cou++;
				num += k;
			}
			if(cou){
				v.PB(cou);
				v.PB(cou);
				sum += 2 * cou;
			}
		}
	}
	
	dp[0][0] = 1;
	REP(i,sum){
		ll tasi = 2;
		if(seica == v[chan]){
			seica = 0;
			chan++;
			tasi--;
		}
		
		REP(j, 2220){
			dp[i + 1][j] += dp[i][j];
			dp[i + tasi][j+1] += dp[i][j];
			dp[i + 1][j] %= MOD;
			dp[i + tasi][j+1] %= MOD;
		}
		seica++;
	}
			
	seica = 1;
	ll ans = 0;
	REP(i,n+1){
		ans += dp[sum][i] * kaijo[n - i] * seica + MOD;
		ans %= MOD;
		seica *= -1;
	}
	
	cout << ans << endl;
	
	return 0;
}

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

int main(){
	int n, mat[101][101], u, k, v, i,j;
	
	cin>>n;
	for(i=0; i<n; i++){
		for(j=0; j<n; j++){
			mat[i][j]=0;
		}
	}
	for(i=0; i<n; i++){
		cin>>u>>k;
		for(j=0; j<k; j++){
			cin>>v;
			mat[u-1][v-1]=1;
		}
	}
	
	for(i=0; i<n; i++){
		for(j=0; j<n; j++){
			cout<<mat[i][j];
			if(j!=(n-1)) cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

int N,X;
int A[111];

signed main(){
    cin>>N>>X;
    rep(i,N)cin>>A[i];
    sort(A,A+N);
    rep(i,N-1)A[i+1]+=A[i];

    int k=upper_bound(A,A+N,X)-A;
    if(k<N)cout<<k<<endl;
    else if(A[N-1]==X)cout<<k<<endl;
    else cout<<k-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <climits>
using namespace std;

int n;
int t[52];
int dp[100000];

int greedy(int x){
  int res = 0;

  for(int i = n - 1; i >= 0; i--){
    int div = x / t[i];
    res += div;
    x -= div * t[i];
  }

  return res;
}

void solve(){
  fill(dp, dp + 100000, INT_MAX);
  dp[0] = 0;

  for(int i = 0; i < 100000; i++){
    if(dp[i] == INT_MAX){
      cout << "Cannot pay some amount" << endl;
      return;
    }
    if(dp[i] != greedy(i)){
      cout << "Cannot use greedy algorithm" << endl;
      return;
    }

    for(int j = 0; j < n; j++){
      if(i + t[j] < 100000){
        dp[i + t[j]] = min(dp[i + t[j]], dp[i] + 1);
      }
    }
  }

  cout << "OK" << endl;
}

int main(){
  for(int SET = 1; cin >> n, n; SET++){
    cout << "Case #" << SET << ": ";

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

Measured memory_bytes: 1556
import sys

input_methods=['clipboard','file','key']
using_method=2
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def is_gg(s):
	if len(s)%2 == 1:
		return False
		
	mannaka=len(s)//2
	for a,b in zip(s, s[mannaka:]):
		if a!=b:
			return False
	return True
	
	
def main():
	s = input()
	for i in range(1, len(s)):
		if is_gg(s[:len(s)-i]):
			return len(s) - i
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int n,k;
int main(){
  cin >> n >> k;
  int a[n+1];
  for(int i=0;i<=n;i++) a[i] = 0;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    a[x]++;
  }
  sort(a,a+(n+1));
  int count = 0,ans = 0;
  for(int i=0;i<=n;i++) if(a[i] != 0) count++;
  for(int i=0;i<=n;i++){
    if(count <= k) break;
    if(a[i] == 0) continue;
    if(count > k){
      ans += a[i];
      count--;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int[] A = new int[n];

    for(int i = 0; i < n; i++)
      A[i] = scan.nextInt();

    int min = A[0];
    int max = A[0];
    for(int i = 1; i < n; i++){
      min = Math.min(min, A[i]);
      max = Math.max(max, A[i]);
    }

    System.out.println(max - min);
  }
}


Measured memory_bytes: 21972
import collections,sys
d=collections.deque()
input()
for e in sys.stdin.readlines():
 if'i'==e[0]:d.appendleft(e.split()[1])
 else:
  if' '==e[6]:
   m=e.split()[1]
   if m in d:d.remove(m)
  elif len(e)%2:d.pop()
  else:d.popleft()
print(*d)


Measured memory_bytes: 212228
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


    using namespace std;
 
    int main(){
      char a,b;
      cin >> a >> b;
      if(a==b) cout << 'H' << endl;
      else cout << 'D' << endl;
      return 0;}


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

void solve() {
    ll N, D;
    cin >> N >> D;
    int ans = 0;

    for (int i = 0; i < N; ++i) {
        ll x, y;
        cin >> x >> y;
        ll dist = x*x + y*y;
        if (dist <= D*D) {
            ans++;
        }
    }
    cout << ans << "\n";
}

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

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


Measured memory_bytes: 3648
import math 
A,B,H,M = map(int, input().split())
Ar = H*0.5*60
Br = M*5.5
d = abs(Ar-Br)
ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(d))
print(math.sqrt(ans))

Measured memory_bytes: 9444
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    int i, j, n, kaijo = 1;
    cin >> n;
    
    int x[n], y[n];
    double avg, itoj = 0;
    
    for(i = 0 ; i < n ; i++){
        cin >> x[i] >> y[i];
    }
    

    for(i = 0 ; i < n ; i++){
        for(j = i+1 ; j < n ; j++){
            if(i != j){
                itoj += sqrt( pow((x[i] - x[j]),2) + pow((y[i] - y[j]), 2) );
            }
        }
    }
    
    
    cout << fixed << setprecision(10) << ( itoj * ( 2.0 / (double)n) ) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import Counter
input = sys.stdin.readline
INF = 10**9

n, m = [int(item) for item in input().split()]
s = input().rstrip()
s = s[::-1]
frm = 0
ans = []
ok = True
while frm < n:
    nxt = s[frm:frm+m+1].rfind("0")
    if nxt == 0:
        ok = False
        break
    ans.append(nxt)
    frm += nxt
if not ok:
    print(-1)
else:
    print(" ".join([str(item) for item in ans[::-1]]))

Measured memory_bytes: 11544
#include <iostream>
//#include <vector>
//#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <assert.h>
/*
#include <map>
#include <functional>
#include <set>
#include <iterator>
*/

using namespace std;
typedef long long ll;

ll H, W;
char S[60][60];
int main() {
   cin >> H >> W;
   for (int i=1;i<=H;i++) {
      cin >> &S[i][1];
   }
   for (int i=1;i<=H;i++) {
      for (int j=1;j<=W;j++) {
         if (S[i][j] != '.') continue; 
         int cnt = 0;
         for (int k=-1;k<=1;k++) {
            for (int l=-1;l<=1;l++) {
               cnt += (S[i+k][j+l] == '#');
            }
         }
         S[i][j] = '0' + cnt;
      }
   }
   for (int i=1;i<=H;i++) {
      cout << &S[i][1] << endl;
   }
}

Measured memory_bytes: 256
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|(2**x)
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,num2,cost2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if num1>=g:
      break
    if (g-num1+i*100-1)//(i*100)<l[i-1][0]:
      cost1+=(g-num1+i*100-1)//(i*100)
      num1+=((g-num1+i*100-1)//(i*100))*100*i
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if num2>=g:
      break
    if (g-num2+(i*100)-1)//(i*100)<l[i-1][0]:
      cost2+=(g-num2+(i*100)-1)//(i*100)
      num2+=((g-num2+(i*100)-1)//(i*100))*100*i
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  if num1<g:
    cost1=10**18
  if num2<g:
    cost2=10**18
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

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

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first                               
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"

const int N = 1e5 + 10;

string s, t;
int nxt[30][N];

int main () {
	ios_base::sync_with_stdio(0);
	cin >> s;
	s = '#' + s;
	cin >> t;
	t = '#' + t;
	for(int ch = ('a' - 97); ch <= ('z' - 97); ++ch) {
		int an = -1;
		for(int i = sz(s) - 1; i >= 0; --i) {
			nxt[ch][i] = an;		
			if(ch == (s[i] - 97)) an = i;		
		}
	}
	ll ans = 0, pos = 0;
	for(int i = 1; i < sz(t); ++i) {
		if(nxt[(t[i] - 97)][0] == -1) {
			//cout << t[i] <<'\n';
			cout << -1;
			return 0;
		}
/*		show(t[i]);
		show(pos);
		show(nxt[(t[i] - 97)][pos]);*/
		if(nxt[(t[i] - 97)][pos] == -1) {
			ans += sz(s) - 1;
			pos = nxt[(t[i]- 97)][0];
			continue;
		}
		pos = nxt[(t[i] - 97)][pos];
	}		
	ans += pos;
	cout << ans;
	return 0;
}

Measured memory_bytes: 10860
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    ll n; cin>>n;
    vector<vector<int>> cnt(10, vector<int>(10));

    for (int i = 1; i <= n; ++i) {
        string s = to_string(i);
        int head = s[0]-'0'; int tail = s.back()-'0';
        cnt[head][tail]++;
    }

    ll ans = 0;

    for (int i = 1; i <= n; ++i) {
        string s = to_string(i);
        int tail = s[0]-'0'; int head = s.back()-'0';
        ans += cnt[head][tail];
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main () {
    int N, M, cnt=0, x=0, y=0;
    cin >> N >> M;
    for (int i=0;i<N*M;i++){
        string a;
        cin >> a;
        if (a=="snuke")
            cnt=i;
    }
    y=cnt/M;
    x=cnt%M;
    cout << char(x+65) << y+1;
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc174/tasks/abc174_f
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

struct Query {
    // 左端、右端、クエリ番号
    int l, r, i;
    // 左端が小さい順にソート（逆順にするにはリバース オペレータ使用）
    bool operator<(const Query &t) const { return l < t.l; };
    Query(int l, int r, int i) : l(l), r(r), i(i) {}
};

// BIT(Binary-Indexed-Tree) 別名：Fenwick Tree
template <typename T> struct BIT {
    int n;
    vector<T> d;
    BIT(int n = 0) : n(n), d(n + 1) {}
    // 要素iにxを加算
    void add(int i, T x = 1) {
        for (i++; i <= n; i += i & -i) {
            d[i] += x;
        }
    }
    // 区間[0, i]の合計を求める（閉区間）
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i & -i) {
            x += d[i];
        }
        return x;
    }
    // 区間[l, r]の合計を求める（閉区間）
    T sum(int l, int r) { return sum(r - 1) - sum(l - 1); }
};

signed main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> c(N);
    REP(i, N) cin >> c[i];
    vector<Query> query;
    REP(qi, Q) {
        int l, r;
        cin >> l >> r;
        l--;
        r--;
        query.emplace_back(l, r, qi);
    }
    // 左端が大きい順
    sort(ALLR(query));
    vector<int> ans(Q);
    vector<int> pi(N + 1, -1);
    vector<pair<int, int>> p;
    REP(i, N) {
        int prev = pi[c[i]];
        if (prev != -1) {
            p.emplace_back(prev, i);
        }
        pi[c[i]] = i;
    }
    BIT<int> bit(N + 5);
    sort(ALLR(p));
    int index = 0;

    REP(i, Q) {
        int l = query[i].l;
        int r = query[i].r;
        int qi = query[i].i;
        while (index < (int)p.size()) {
            if (p[index].first < l)
                break;
            bit.add(p[index].second, 1);
            index++;
        }
        // 重複している数
        int a = bit.sum(r);
        // lからrまでの長さから重複分を減らす
        ans[qi] = r - l + 1 - a;
    }

    REP(i, Q) cout << ans[i] << "\n";
    return 0;
}


Measured memory_bytes: 42404
a=[]
b=[]
while True:
    n,m= map(int,input().split())
    if n == 0 and m== 0:
        break
    a.append(n)
    b.append(m)
for i in range (len(a)):
    if b[i] < a[i]:
        print(b[i],a[i])
    else:
        print(a[i],b[i])



Measured memory_bytes: 6120
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	string s; 
	cin >> s ; 
	auto ispal =[&](string st){
		string as = st ;
		reverse(all(st));
		if(as == st) return true;
		return false;
	};
	string st = s.substr(0,sz(s)/2);
	int n = sz(s)+3;
	n/=2;
	string sat = s.substr(n-1,sz(s));
	if(ispal(s) and ispal(sat) and ispal(st)) cout << "Yes\n";
	else cout << "No\n";
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3664
#include<stdio.h>
int partition(int *A, int p, int r){
  int x,i,j,tmp;
  x = A[r];
  i = p-1;
  for(j = p;j <= r-1; j++){
    if(A[j] <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return (i+1);
}
int main(){
  int n,A[100000];
  int i,j,k;
  scanf("%d",&n);
  for(i =0;i <n;i++) scanf("%d",&A[i]);
  k = partition(A,0,n-1);
  for(i =0;i <k; i++) printf("%d ",A[i]);
  printf("[%d] ",A[k]);
  for(i =k+1;i < n-1;i++) printf("%d ",A[i]);
  printf("%d\n",A[i]);
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int temp1 = h1 * 60 + m1;
	int temp2 = h2 * 60 + m2;
	cout << temp2 - temp1 - k << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int MAxn = 2e5 + 5;
const int MA_N = 5e3 + 5;
 
int main(){
	int a, b, c, d;
	while(cin >> a >> b >> c >> d)
      {
	int m = max(a, c);
	int n = min(b, d);
	int ans = n - m;
	if(ans < 0) printf("0\n");
	else cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;


int main() {

	int N, K, Q;
	cin >> N >> K >> Q;
	
	vector<int> SCORE(N, K);
	vector<int> WIN(N,0);
	
	int a1;
	for(int i = 0; i < Q; i++){
		cin >> a1;
		WIN[a1 - 1]++;		
	}
	
	int b1;
	for(int i = 0; i < N; i++){
		b1 = K - Q + WIN[i];
		if(b1 > 0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}

    return 0;
}


/*

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

for(int i = 0; i < N; i++){
	for(int j = 0; j < N; j++){
		
	}
}


*/


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


int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = b/x-(a+x-1)/x+1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=2e5+5;
const ll mod=998244353;
ll power(ll a,ll b)
{
	ll val=1;
	while(b)
	{
		if(b%2)
			val=(val*a)%mod;
		b/=2;
		a=(a*a)%mod;
	}
	return val;
}
ll fact[M],ifact[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n,m,k;
	cin>>n>>m>>k;
	fact[0]=1;
	ifact[0]=1;
	for(ll i=1;i<=n;i++)
	{
		fact[i]=(i*fact[i-1])%mod;
		ifact[i]=power(fact[i],mod-2);
	}
	ll ans=0;
	for(ll i=n-1;i>=(n-1-k);i--)
	{
		ll z=(fact[n-1]*ifact[i])%mod;
		z=(z*ifact[n-1-i])%mod;
		z=(z*m)%mod;
		if(i)
		{
			z=(z*power(m-1,i))%mod;
		}
		ans=(ans+z)%mod;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 6780
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H , W;
  cin >> H >> W;
  
   for (int i = 0; i < W; i++) {
   cout << "#"; }
   cout << "##" << endl;
  
   for (int j = 0; j < H; j++) {
    string v;
    cin >> v; 
    cout << "#" << v << "#" << endl;
   }
  
   for (int i = 0; i < W; i++) {
   cout << "#"; }
   cout << "##" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  string s;
  cin >> s;
  ll k=s.size();
  ll l=0,r=k-1;
  ll cnt=0;
  while(r-l>0){
    if(s[l]==s[r]){
      r--;
      l++;
    }
    else if(s[r]=='x'&&s[l]!='x'){
      r--;
      cnt++;
    }
    else if(s[l]=='x'&&s[r]!='x'){
      l++;
      cnt++;
    }
    else{
      cnt=-1;
      break;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 512
import math
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
maxi = max(a)
a.sort()

div = [0] * (maxi + 1)
for n in a:
    div[n] += 1
    if div[n] == 1:
        for j in range(n*2, maxi + 1, n):
            div[j] += 100
print(div.count(1))

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

int main() {
  int N, K;
  cin >> N;
  cin >> K;

  int minimum = 2048; //2の11乗は取り得る値より大きい
  for(int i = 0; i <= N; i++) {
    int a, b;
    a = i;
    b = N - a;

    int num = 1;
    if(a) {
      for(int j = 0; j < a; j++) {
        num *= 2;
      }
    }
    num += K * b;
    minimum = min(minimum, num);        
  }
  
  cout << minimum << endl;
}

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

int main(void){

    int N;

    scanf("%d", &N);

    char S[N][2];

    for(int i = 0; i < N; i++){
        scanf("%s", S[i]);
    }

    int t = 1;

    for(int i = 0; i < N; i++){
        if(S[i][0] == 'Y'){
            t = 0;
            break;
        }
    }

    if(t == 1){
        printf("Three\n");
    }else{
        printf("Four\n");
    }

    return 0;
}

Measured memory_bytes: 1616
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve()
{
  int N; cin >> N;
  int m = INTINF;
  int ans = 0;
  REP0(i, N)
  {
      int p; cin >> p;
      if (p <= m) ans++;
      m = min(m, p);
  }
  cout << ans << endl;
}

int main(int argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,m;
	int i,j;
	scanf("%d",&n);
	while(n!=0){
		char before[n],after[n];
		for(i=0;i<n;i++){
			scanf(" %c %c",&before[i],&after[i]);
		}
		scanf("%d",&m);
		char data[m];
		for(i=0;i<m;i++){
			scanf(" %c",&data[i]);
			for(j=0;j<n;j++){
				if(data[i]==before[j]){
					data[i]=after[j];
					break;
				}
			}
		}
		for(i=0;i<m;i++){
			printf("%c",data[i]);
		}
		printf("\n");
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1096
#include <stdio.h>

#define	MAX_HW	50


int main(void)
{
	int h, w;
	char s[MAX_HW][MAX_HW+1];
	int i, j;
	
	scanf("%d %d", &h, &w);
	for(i=0; i<h; i++)
		scanf("%s", s[i]);
	
	for(i=0; i<h; i++)
		for(j=0; j<w; j++){
			if(s[i][j] == '.')
				continue;
			else if( s[i-1][j] == '#' && (i-1)>=0 )
				continue;
			else if( s[i][j+1] == '#' && (j+1)<w )
				continue;
			else if( s[i+1][j] == '#' && (i+1)<h )
				continue;
			else if( s[i][j-1] == '#' && (j-1)>=0 )
				continue;
			
			printf("No");
			return 0;
		}
	
	printf("Yes");
	
	
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF            1e9
#define REP(i,n)       for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)      for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n)  for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPR(i,n)      for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)     for(lint i=(n);i>0;--i)
#define REPRI(i,ini,n) for(lint i=(ini)-1,i##_len=(n);i>=i##_len;--i)
#define REPC(i,obj)    for(auto i:obj)
#define R_UP(a,b)      (((a)+(b)-1)/(b))
#define ALL(obj)       (obj).begin(),(obj).end()
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
int binary_search_p(int first_w, int last_w, int k, int max_w, const vector<int>&w)
{
	auto get_minimum_k = [&w](int p_candidate)
	{
		int result = 1;
		int temp = 0;
		REPC(i, w)
		{
			if (temp + i <= p_candidate)temp += i;
			else
			{
				result++;
				temp = i;
			}
		}
		return result;
	};
	int p_candidate = first_w + (last_w - first_w) / 2;
	if (first_w > last_w)for (int i = max(p_candidate, max_w);; i++)if (get_minimum_k(i) <= k)return i;
	return get_minimum_k(p_candidate) <= k ? binary_search_p(first_w, p_candidate - 1, k, max_w, w) : binary_search_p(p_candidate + 1, last_w, k, max_w, w);
}
signed main()
{
	int n = in(), k = in();
	vector<int>w(n);
	int min_w = 10001, max_w = -1, sum_w = 0;
	REPC(&i, w)
	{
		i = in();
		if (min_w > i)min_w = i;
		if (max_w < i)max_w = i;
		sum_w += i;
	}
	cout << binary_search_p(min_w, sum_w, k, max_w, w) << endl;
}


Measured memory_bytes: 3128
#include<cstdio>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N=1e5+9;

int n;
ll c,x[N],v[N];
ll suml[N],sumr[N];
ll stk[N],top;

inline void chkmax(ll &a,ll b){if(a<b)a=b;}

int main()
{	
	if(fopen("vj.in","r"))
	{
		freopen("vj.in","r",stdin);
		freopen("vj.out","w",stdout);
	}

	scanf("%d%lld",&n,&c);
	for(int i=1;i<=n;i++)
		scanf("%lld%lld",&x[i],&v[i]);

	for(int i=1;i<=n;i++)
		suml[i]=suml[i-1]+v[i]-(x[i]-x[i-1]);
	x[n+1]=c;
	for(int i=n;i>=1;i--)
		sumr[i]=sumr[i+1]+v[i]-(x[i+1]-x[i]);

	ll ans=0;
	for(int i=1;i<=n;i++)
		chkmax(ans,suml[i]);
	for(int i=1;i<=n;i++)
		chkmax(ans,sumr[i]);

	for(int i=1;i<=n;i++)
		stk[i]=max(stk[i-1],suml[i]);

	for(int i=n;i>=1;i--)
		chkmax(ans,sumr[i]+stk[i-1]-(c-x[i]));

	for(int i=n;i>=1;i--)
		stk[i]=max(stk[i+1],sumr[i]);

	for(int i=1;i<=n;i++)
		chkmax(ans,suml[i]+stk[i+1]-x[i]);

	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4096