akhauriyash/Code-Regression huggingface dataset:
n, u, v = map(int, input().split())
u, v = u-1, v-1

tree = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

from queue import Queue

# 青木君によるWFS
aoki = [-1 for _ in range(n)]
aoki[v] = 0
todo = Queue()
todo.put(v)
while not todo.empty():
    i = todo.get()
    for j in tree[i]:
        if aoki[j] == -1:
            todo.put(j)
            aoki[j] = aoki[i] + 1

# 高橋君によるWFS
taka = [-1 for _ in range(n)]
taka[u] = 0
todo = Queue()
todo.put(u)
while not todo.empty():
    i = todo.get()
    for j in tree[i]:
        if taka[j] == -1:
            if taka[i] + 1 < aoki[j]:
                todo.put(j)
            taka[j] = taka[i] + 1

# search
ans = 0
for i in range(n):
    if taka[i] != -1:
        if aoki[i] - 1 > ans:
            ans = aoki[i] - 1

print(ans)

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int a[100005];
int b[100005];

int main() {
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	int minf = 1e9, minm = 1e9;
	for (int i=0 ; i<n ; i++) {
		scanf("%d", a+i);
		minf = min(minf, a[i]);
	}
	for (int i=0 ; i<m ; i++) {
		scanf("%d", b+i);
		minm = min(minm, b[i]);
	}
	int sol = minm + minf;
	for (int i=0 ; i<k ; i++) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		x--;
		y--;
		sol = min(sol, a[x]+b[y]-z);
	}
	printf("%d\n", sol);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

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

    int a, b;
    bool flag = false;

    for (int i = 0; i < s.size(); i++) {
        if (!flag) {
            if (s[i] == 'A') {
                a = i;
                flag = true;
            }
        }
        else {
            if (s[i] == 'Z') {
                b = i;
            }
        }
    }

    cout << b - a + 1 << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

struct BinaryIndexedTree{
    private:
    int n;
    vector<int> dat;
    public:
    BinaryIndexedTree(int n_){
        n=1;
        while(n<n_) n*=2;
        dat.resize(n,0);
    }
    void add(int a,int w){
        for (int i=a;i<=n;i+=i&-i) dat[i]+=w;
    }
    int sum(int a){
        int res=0;
        for (int i=a;i>0;i-=i&-i) res+=dat[i];
        return res;
    }
    int lowerbound(int w){
        if (w<=0) return 0;
        int x=0;
        for (int k=n;k>0;k/=2){
            if (x+k<=n&&dat[x+k]<w){
                w-=dat[x+k];
                x+=k;
            }
        }
        return x;
    }
};

ll modpow(ll a,ll n,ll p){
    ll res=1;
    while(n>0){
        if (n&1) res=res*a%p;
        a=a*a%p;
        n>>=1;
    }
    return res;
}

ll modpow(ll n){
    return modpow(2,n,MOD);
}

int main(){
    ll N;
    cin >> N;
    vector<Pll> pos(N);
    vector<ll> xs(N),ys(N);
    rep(i,N){
        cin >> xs[i] >> ys[i];
        pos[i]=Pll(xs[i],ys[i]);
    }
    sort(xs.begin(),xs.end());
    sort(ys.begin(),ys.end());
    xs.erase(unique(xs.begin(),xs.end()),xs.end());
    ys.erase(unique(ys.begin(),ys.end()),ys.end());
    rep(i,N){
        int x=pos[i].first,y=pos[i].second;
        x=lower_bound(xs.begin(),xs.end(),x)-xs.begin();
        y=lower_bound(ys.begin(),ys.end(),y)-ys.begin();
        pos[i]=Pll(x+1,y+1);
    }
    sort(pos.begin(),pos.end());
    BinaryIndexedTree BIT1(N),BIT2(N);
    rep(i,N) BIT2.add(pos[i].second,1);
    ll ans=0,all=modpow(N)-1;
    rep(i,N){
        BIT2.add(pos[i].second,-1);
        ll a=BIT1.sum(pos[i].second-1),b=i-a,c=BIT2.sum(pos[i].second-1),d=N-1-i-c;
        ll A=modpow(a)-1,B=modpow(b)-1,C=modpow(c)-1,D=modpow(d)-1;
        ans=(ans+all+10*MOD-A-B-C-D-A*B%MOD-C*D%MOD-A*C%MOD-B*D%MOD)%MOD;
        BIT1.add(pos[i].second,1);
    }
    cout << ans << endl;
}

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

signed main()
{
  int N; cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }

  vector<int> L(N+1),R(N+1);
  for(int i=0;i<N;i++){
    L[i+1]=max(L[i],a[i]);
  }
  for(int i=N-1;i>=0;i--){
    R[i]=max(R[i+1],a[i]);
  }

  for(int i=0;i<N;i++){
    cout<<max(L[i],R[i+1])<<endl;
  }

  return 0;
}


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

int main() {
  string S;
  cin >> S;
  vector<int> a;
  int x=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='A' || S.at(i)=='C' || S.at(i)=='G' || S.at(i)=='T'){
      x++;
    }
    else{
     a.push_back(x);
      x=0;
    }
  }
  a.push_back(x);
  sort(a.rbegin(), a.rend());
  cout << a[0];
}


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

	// int32_t main(){
	// 	int n;
	// 	cin >> n;
	// 	int res = 1;
	// 	while(n--){
	// 		int x;
	// 		cin >> x;
	// 		res *= x;
	// 	}
	// 	if(res <= INT_MAX) {
	// 		cout << res << endl;
	// 	}
	// 	else{
	// 		cout << -1 << endl;
	// 	}
	// 	return 0;
	// }

	int32_t  main(){
		long double a,b;
		cin >> a >> b;
		long double ans = a * b;
		cout << (int) ans << endl;
		return 0;
	}

Measured memory_bytes: 3728
#include <stdio.h>
int main(void){
    
    int i,n;
    int v[50];
    int c[100];
    int sum[100];
    int a=0;
    
    scanf("%d\n",&n);
    
    for(i=0; i<n; i++){
        scanf("%d",&v[i]);
    }
    for(i=0; i<n; i++){
        scanf("%d",&c[i]);
    }
    
    for(i=0; i <n; i++){
        if(v[i]>c[i]){
            sum[i]=v[i]-c[i];
        }else{
            sum[i]=0;
        }
    }
    for(i=0; i<n; i++){
        a+=sum[i];
    }
    printf("%d",a);
     return 0;
}

Measured memory_bytes: 128
import sys
a,b,c,d = [int(x) for x in list(input())]
if a+b+c+d ==7:
    print("{}+{}+{}+{}=7".format(a,b,c,d))
    sys.exit()
if a+b+c-d ==7:
    print("{}+{}+{}-{}=7".format(a,b,c,d))
    sys.exit()
if a+b-c+d ==7:
    print("{}+{}-{}+{}=7".format(a,b,c,d))
    sys.exit()
if a+b-c-d ==7:
    print("{}+{}-{}-{}=7".format(a,b,c,d))
    sys.exit()
if a-b+c+d ==7:
    print("{}-{}+{}+{}=7".format(a,b,c,d))
    sys.exit()
if a-b+c-d ==7:
    print("{}-{}+{}-{}=7".format(a,b,c,d))
    sys.exit()
if a-b-c+d ==7:
    print("{}-{}-{}+{}=7".format(a,b,c,d))
    sys.exit()
if a-b-c-d ==7:
    print("{}-{}-{}-{}=7".format(a,b,c,d))
    sys.exit()

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

int main()
{
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int h=h2-h1;
    int m=m2-m1;
    cout<< (((h*60)+m)-k)<<endl;


   // if(m<0){
    //    h=-1;
   //     m+=60;
    //}
    //int hourMin=h*60;
    //int res=(hourMin+m)-k;
    //cout<<res<<endl;
}


Measured memory_bytes: 3488
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod =1e9+7;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin>>n;

	ll v1=1,v2=1,tot=1;
	
	for(int i=0;i<n;i++){
		tot=tot*10 %mod;

		v1=v1*9 %mod;
		v2=v2*8 %mod;
	}

	ll ans = (tot-2*v1+v2)%mod;
	if(ans<0)ans+=mod;

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

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

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

  for(int i=a; i<=min(b, a+k-1); i++){
   cout<<i<<endl;}
  for(int i=max(b-k+1, a+k); i<=b; i++){ // 初期値より終了条件のほうが小さいから、
   cout<<i<<endl;}                       // ここの処理は行われない
}

Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
#print(*data, sep='\n')
tmp = sorted(data, key=lambda x:int(x[1]), reverse=True)
ans = sorted(tmp, key=lambda x:x[0])
#print(ans)
for i in range(n) :print(data.index(ans[i])+1)

Measured memory_bytes: 3060
# AtCoder Beginner Contest 064_B

min = 1000;	max = 0

#input n
n = gets.to_i

#make array
array = []
array = gets.split.map(&:to_i)

n.times do |i|
	if array[i] > max 
		max = array[i]
	end
	if min > array[i]
		min = array[i] 
	end
end

puts max - min

Measured memory_bytes: 1788
# [temp1.py] => [29-07-2020 @ 10:25:10] 
# Author & Template by : Udit "luctivud" Gupta
# https://www.linkedin.com/in/udit-gupta-1b7863135/


import math;   from collections import *
import sys;    from functools import reduce
import time;   from itertools import groupby

# sys.setrecursionlimit(10**6)

def input()         : return sys.stdin.readline()
def get_ints()      : return map(int, input().strip().split())
def get_list()      : return list(get_ints())
def get_string()    : return list(input().strip().split())
def printxsp(*args) : return print(*args, end="")
def printsp(*args)  : return print(*args, end=" ")


DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)] 
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1),\
              (+1, +1), (+1, +0), (+1, -1), (+0, +1)]


CAPS_ALPHABETS = {chr(i+ord('A')) : i for i in range(26)}
SMOL_ALPHABETS = {chr(i+ord('a')) : i for i in range(26)}
INF = float('inf')


# Custom input output is now piped through terminal commands.
# for _test_ in range(int(input())): 

maxn = int(5e5) + 2
  
def update(idx, val, bit, n): 
    while idx <= n: 
        bit[idx] += val 
        idx += idx & -idx 
  
def query(idx, bit, n): 
    summ = 0
    while idx: 
        summ += bit[idx] 
        idx -= idx & -idx 
    return summ 
  
def solve(arr, n, queries, q): 
    bit = [0] * (n + 1) 
    prev = [-1] * maxn  
    ans = [0] * q 
    count = 0
    for i in range(n): 
        if prev[arr[i]] != -1: 
            update(prev[arr[i]] + 1, -1, bit, n) 
        prev[arr[i]] = i 
        update(i + 1, 1, bit, n) 
        while count < q and queries[count][2] == i: 
            ans[queries[count][0]] = query(queries[count][2] + 1, bit, n) - query(queries[count][1], bit, n) 
            count += 1
    for i in range(q): 
        print(ans[i]) 

# main
n, q = get_ints()
a = get_list()
queries = []
for i in range(q):
	l, r = get_ints()
	queries.append((i, l-1, r-1))
queries = sorted(queries, key = lambda x: x[2]) 
solve(a, n, queries, q) 

# print("Time Elapsed: {}".format(float(S34p-S34t)))

# Binary Indexed Tree code taken from https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/


Measured memory_bytes: 231364
import java.util.Scanner;

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

		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
      
		System.out.println(z + " " + x + " " + y);

		sc.close();
	}
}
      

Measured memory_bytes: 27092
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Ordering};
use std::io::Read;

fn main() {

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let q = buf_it.next().unwrap().parse::<usize>().unwrap();

    let mut P = (0..N).map(|_|
        (buf_it.next().unwrap(),
        buf_it.next().unwrap().parse::<usize>().unwrap())
    ).collect::<VecDeque<_>>();

    let mut T=0;

    while let Some((name,t)) = P.pop_front(){
        if t <= q{
            T += t;
            println!("{} {}",name,T);
        } else {
            T += q;
            P.push_back((name,t-q));
        }
    }
}


Measured memory_bytes: 6968
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] != t[i]){
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    solve();
}


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

const int MAXN = 100003;
int A[MAXN], B[MAXN];

int main() {
	int n;
	scanf("%d", &n);
	long long s = 0;
	for(int i = 1; i <= n; i++) {
		scanf("%d", A + i);
		s += A[i];
		B[i] = A[i] - A[i - 1];
	}
	B[1] = A[1] - A[n];
	bool fg = 1;
	long long t = (long long)(n + 1) * n / 2;
	if(s % t) fg = 0;
	s /= t;
	for(int i = 1; i <= n; i++) {
		B[i] -= s;
		if(B[i] % n || A[i] < s) {
			fg = 0;
			break;
		}
	}
	if(fg) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 896
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = list(iim())

    A.sort()
    for i in range(1, len(A)):
        if A[i-1] == A[i]:
            print("NO")
            return
    print("YES")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 26680
n = gets.chomp.to_i
ns = gets.chomp.split(' ').map(&:to_i)

ngs = ns.reject { |x| x.odd? }
        .reject { |x| x % 5 == 0 || x % 3 == 0 }
        .count

puts (ngs == 0) ? 'APPROVED' : 'DENIED'


Measured memory_bytes: 3836
N,M = map(int,input().split())
LR = [list(map(int,input().split())) for i in range(M)]

maxi = 10**6
mini = 0
for lr in LR:
    mini = max(lr[0],mini)
    maxi = min(lr[1],maxi)
if maxi-mini < 0:
    print(0)
else:
    print(maxi-mini+1)

Measured memory_bytes: 27328
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef unsigned long ulint;
const int mod = 2019;

int main() {
    ulint L,R;
    cin >> L >> R;
    int ans = 10000;
    if (R-L >= mod)
    {   
        ans = 0;
    } else {
        for (ulint i = L; i < R; i++)
        {
            for (ulint j = i+1; j <= R; j++)
            {
                int tmp = (i*j)%mod;
                ans = min(ans, tmp);
            }
            
        }
    }
    cout << ans << endl;
    return 0;
}

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

signed main() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		for(;;){
			if(a%2==0){
				a/=2;
				ans++;
			}
			else{
				break;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
n_a_b = input().split(' ')

n = int(n_a_b[0])
sum([int(i) for i in list(n_a_b[0])])
a = int(n_a_b[1])
b = int(n_a_b[2])

result = 0
for i in range(1, n+1):
    total = sum([int(s) for s in list(str(i))])
    if total >= a and total <= b:
        result += i

print(result)

Measured memory_bytes: 9140
#include <iostream>

using namespace std;

int N;
int attempt = 0;
int main()
{
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++)
    cin >> a[i];

  for (int i = 0; i < N; i++) {
    int temp = a[i];
    while(true) {
      if(temp % 2 != 0)
        break;
      else {
        attempt += 1;
        temp /= 2;
      }
    }
  }
  cout << attempt << endl;
  return 0;
}


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

int L[101];
int main() {
  int N, X, D;
  int i;
  scanf ("%d %d", &N, &X);
  
  for (i=0;i<N;i++) {
      scanf("%d", &L[i]);
  }
  
  D=0;
  for (i=1;i<N+1;i++) {
      D+=L[i-1];
      if (D>X) {
          printf("%d", i);
          return 0;
      }
  }
  printf("%d", N+1);
  return 0;
}




Measured memory_bytes: 128
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

x.append(X)
y.append(Y)
war=0

nx=sorted(x)
ny=sorted(y)

if nx[N] >= ny[0]:
  print('War')
else:
  print('No War')

Measured memory_bytes: 3064
#include <cassert>
#include <cstdint>
#include <utility>
#include <vector>

class UnionFind {

public:
	using size_type = std::uint_fast32_t;

private:
	std::vector<std::pair<bool, size_type>> tree;

public:
	UnionFind(const size_type size) : tree(size, std::make_pair(1, 1)) {}
	size_type find(const size_type x) {
		assert(x < size());
		if (tree[x].first)
			return x;
		return tree[x].second = find(tree[x].second);
	}
	bool unite(size_type x, size_type y) {
		assert(x < size());
		assert(y < size());
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (tree[x].second < tree[y].second)
			std::swap(x, y);
		tree[x].second += tree[y].second;
		tree[y] = std::make_pair(0, x);
		return true;
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return tree[find(x)].second;
	}
	size_type size() const noexcept { return tree.size(); }
	bool empty() const noexcept { return tree.empty(); }
};

#include <cstddef>
#include <functional>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>

template <class GraphContainer, class UnionFindDataStructure>
std::vector<typename GraphContainer::size_type> TarjansOfflineLCA(
	const GraphContainer &graph, const typename GraphContainer::size_type root,
	const std::vector<std::pair<typename GraphContainer::size_type,
	typename GraphContainer::size_type>> &queries) {
	using size_type = typename GraphContainer::size_type;
	const size_type size_ = graph.size();
	UnionFindDataStructure uft(size_);
	std::vector<size_type> ret(queries.size(), size_), anc(size_);
	std::vector<std::vector<std::size_t>> qset(size_);
	std::stack<std::pair<size_type, size_type>> st;

	for (std::size_t i = 0; i < queries.size(); ++i) {
		qset[queries[i].first].emplace_back(i);
		qset[queries[i].second].emplace_back(i);
	}

	st.emplace(root, 0);

	std::function<void(const size_type, const size_type)> dfs =
		[&](const size_type v, const size_type prev) {
		anc[v] = v;
		for (const auto e : graph[v]) {
			if (e.to != prev) {
				dfs(e.to,v);
				uft.unite(v, e.to);
				anc[uft.find(v)] = v;
			}
		}
		for (const auto e : qset[v])
			if (ret[e] == size_)
				ret[e] = v;
			else
				ret[e] = anc[uft.find(ret[e])];
	};
	dfs(root, size_);
	return ret;
}

#include <cstddef>
#include <vector>

struct edge {
	using cost_type = int;
	using size_type = std::size_t;

	std::size_t to;
	edge(size_type t):to(t){}
};

template <class Edge> using Graph = std::vector<std::vector<Edge>>;

#include<cstdio>
int main() {
	using uint = unsigned int;
	uint n;
	scanf("%u", &n);
	Graph<edge> g(n);
	for (uint i = 0;i < n;++i) {
		uint k, c;
		scanf("%u", &k);
		while (k--) {
			scanf("%u", &c);
			g[i].emplace_back(c);
		}
	}
	uint q;
	scanf("%u", &q);
	using S = typename Graph<edge>::size_type;
	std::vector<std::pair<S, S>> Q;
	Q.reserve(q);
	while (q--) {
		uint u, v;
		scanf("%u%u", &u, &v);
		Q.emplace_back(u, v);
	}
	const auto &&ans=TarjansOfflineLCA<Graph<edge>, UnionFind>(g, 0, Q);
	for (const auto e : ans)
		printf("%u\n", e);
	return 0;
}


Measured memory_bytes: 36032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const int N = 500 + 5;
const int INF = 0x3f3f3f3f;
int s[N];

int main()
{	
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b;
	cin >> a >> b;
	cout << a*b << endl; 
	return 0;
} 

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

using namespace std;

int main() {
    int n, m;

    scanf("%d%d", &n, &m);

    int x, y;
    vector<int> indeg(n + 1);
    vector<vector<int>> to(n + 1);

    for(int i = 0; i < m; ++i) {
        scanf("%d%d", &x, &y);
        ++indeg.at(y);
        to.at(x).push_back(y);
    }

    vector<int> dp(n + 1);
    queue<int> q;

    for(int i = 1; i <= n; ++i) {
        if(indeg.at(i) == 0) {
            q.push(i);
        }
    }

    int qf, ans = 0;

    while(!q.empty()) {
        qf = q.front();
        q.pop();
        ans = max(ans, dp.at(qf));
        for(int qft: to.at(qf)) {
            dp.at(qft) = max(dp.at(qft), dp.at(qf) + 1);
            if(--indeg.at(qft) == 0) q.push(qft);
        }
    }

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

    return 0;
}

Measured memory_bytes: 6528
//https://agc028.contest.atcoder.jp/tasks/agc028_c

#include<bits/stdc++.h>
const int N = 1e5 + 5;
using namespace std;

typedef pair <int, int> ii;
vector <ii> mv;
int n, a[N], b[N];
int cnt[4], num[N];
long long ans;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        mv.push_back(ii(a[i], i));
        mv.push_back(ii(b[i], -i));
    }
    sort(mv.begin(), mv.end());
    cnt[0] = n;
    for (int i = 0; i < n; i++){
        int ck = 1;
        if (mv[i].second < 0) ck = 2;
        cnt[num[abs(mv[i].second)]]--;
        num[abs(mv[i].second)] |= ck;
        cnt[num[abs(mv[i].second)]]++;
        ans += mv[i].first;
    }
    if (cnt[1] != n && cnt[2] != n && (cnt[1] + cnt[2] == n)){
        int ck = 1;
        if (mv[n-1].second < 0) ck = 2;

        cnt[num[abs(mv[n-1].second)]]--;
        num[abs(mv[n-1].second)] ^= ck;
        cnt[num[abs(mv[n-1].second)]]++;
        ans -= mv[n-1].first;


        ck = 1;
        if (mv[n].second < 0) ck = 2;
        cnt[num[abs(mv[n].second)]]--;
        num[abs(mv[n].second)] |= ck;
        cnt[num[abs(mv[n].second)]]++;
        ans += mv[n].first;
        if (cnt[1] != n && cnt[2] != n && (cnt[1] + cnt[2] == n)){
            ans += min(mv[n+1].first - mv[n].first, mv[n-1].first - mv[n-2].first);
        }
    }
    cout << ans;
}


Measured memory_bytes: 3184
n = int(input())
a = list(map(int,input().split()))
P = 10 ** 9 + 7
p = 10 ** 9 + 7
mo = P
inv_t = [0]+[1]
for i in range(2,1000009):
    inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

#print("俺のソフト")

def gcd(a,b):
    if a%b == 0:
        return b
    else:
        return gcd(b,a%b)

M = a[0]
for i in range(1, n):
    M = M * a[i] // gcd(M, a[i])

M = M%p
ans = 0
for i in range(n):
    ans += M*inv_t[a[i]]
    ans = ans %p

print(ans)



Measured memory_bytes: 94092
# author:  Taichicchi
# created: 28.09.2020 23:24:54

import sys

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

if (n == 1) & (m == 1):
    print(1)
elif n == 1:
    print(m - 2)
elif m == 1:
    print(n - 2)
else:
    print((n - 2) * (m - 2))


Measured memory_bytes: 8928
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n, d;
    cin >> n >> d;
    int c = 0;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        if (x * x + y * y <= d * d) c++;
    }
    cout << c << endl;
    return 0;
}

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

int main() {
  int N;
  bool flag=false;
  char A[100];
  cin >> N ;
  
  for(int i=0;i<N;i++){
    cin >> A[i] ;
    if(A[i]=='Y'){
      flag=true;
    }
  }
  if(flag){
    cout << "Four" <<endl;
  }else{
    cout << "Three" <<endl;
  }
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 256;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    lint V[N], C[N];
    cins(V, V + N);
    cins(C, C + N);
    lint ans = 0;
    for(int i = 0; i < N; i++){
        ans += max(0ll, V[i] - C[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N, A, B; cin >> N >> A >> B;
	int num = 0;
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		if (A <= a&&a < B)num++;
	}
	cout << N - num << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#define inf 10000000000000
#define ll unsigned long long
#define boostUP ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fsr(i,n) for(ll i=0;i<n;i++)
#define fcr(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define sz(arr) sizeof(arr)/sizeof(arr[0])
#define mod 1000000007;

using namespace std;
// lower_bound
// it returns pos of the elmnt which is not less then the query elmnt

int main() {
    int k, n;
    cin >> k >> n;
    if(500*k >= n)
        cout << "Yes" <<endl;
    else
        cout << "No" << endl;
}





Measured memory_bytes: 3584
N = int(input())
alist = list(map(int,input().split()))

a_p = 0
b_p = 0

for i in range(N):
    m = max(alist)
    if i%2 == 0:
        a_p += m
        alist[alist.index(m)] = 0
    else:
        b_p += m
        alist[alist.index(m)] = 0
print(a_p - b_p)

Measured memory_bytes: 3060
n = list(input())

if n[0] == "1": n[0] = "9"
elif n[0] == "9": n[0] = "1"
    
if n[1] == "1": n[1] = "9"
elif n[1] == "9": n[1] = "1"
    
if n[2] == "1": n[2] = "9"
elif n[2] == "9": n[2] = "1"

print(n[0] + n[1] + n[2])

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
  int a,b;cin>>a>>b;
  cout<<6-a-b<<endl;
  return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
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;
}
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1LL << 60;

ll dp[4][3005][3005];
ll d[3005][3005];

void solve() {
    int R, C, K;
    cin >> R >> C >> K;
    rep(i, K) {
        ll r, c, v;
        cin >> r >> c >> v;
        r--;
        c--;
        d[r][c] = v;
    }

    // 配るdp
    rep(i, R) rep(j, C) {
        rep(k, 4) {
            chmax(dp[k][i][j + 1], dp[k][i][j]);  // right
            chmax(dp[0][i + 1][j], dp[k][i][j]);  // down
        }
        rep(k, 3) {
            chmax(dp[k + 1][i][j + 1], dp[k][i][j] + d[i][j]);  // right
            chmax(dp[0][i + 1][j], dp[k][i][j] + d[i][j]);      // down
        }
    }

    ll ans = 0;
    chmax(ans, dp[0][R][C - 1]);
    cout << ans << "\n";
}
int main() {
    cin.tie(nullptr);
    // ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 355648
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

template<typename T>
class lazy_segment_tree{
	int n;
	T fval;
	vector<T> dat, lazy;
	
public:
	
	lazy_segment_tree(){
		
	}
	
	lazy_segment_tree(int n_, T val){
		init(n_, val);
	}
	
	~lazy_segment_tree(){
		
	}
	
	void init(int n_, T val){
		fval = val;
		
		n = 1;
		
		while(n < n_) n *= 2;
		
		dat.resize(2 * n - 1);
		lazy.resize(2 * n - 1, fval);
	
		for(int i = 0; i < 2 * n - 1; i++) dat[i] = fval;
	}
	
	void eval(int k, int l, int r){
		
		if(lazy[k] != fval){
			dat[k] = dat[k] + lazy[k];
			
			if(r - l > 1) {
				lazy[2*k+1] = lazy[2*k+1] + lazy[k]/2;
				lazy[2*k+2] = lazy[2*k+2] + lazy[k]/2;
			}
			
			lazy[k] = fval;
		}
	}
	
	void update(int a, int b, T x, int k = 0, int l = 0, int r = -1){
		if(r < 0) r = n;
		eval(k, l, r);
		if(b <= l || r <= a) {return ;}
		if(a <= l && r <= b){
			lazy[k] = lazy[k] + (r - l) * x;
			eval(k, l, r);
		} else {
			update(a, b, x, 2*k+1, l, (l+r)/2);
			update(a, b, x, 2*k+2, (l+r)/2, r);
			dat[k] = dat[2*k+1] + dat[2*k+2];
		}
	}
	
	T query(int a, int b, int k = 0, int l = 0, int r = -1){
		if(r < 0) r = n;
		eval(k, l, r);
		if(r <= a || b <= l){
			return fval;
		}
		if(a <= l && r <= b){
			return dat[k];
		}else {
			T vl = query(a, b, k * 2 + 1, l, (l + r) / 2 );
			T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return vl + vr;
		}
	}
};


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	lazy_segment_tree<long long> lseg;
	
	int n, q;
	
	cin>>n>>q;
	
	lseg.init(n+2, 0);
	
	for(int i = 0; i < q; i++){
		int com, s, t, x;
		cin>>com>>s>>t;
		
		if(com){
			cout<<lseg.query(s,t+1)<<endl;
		} else {
			cin>>x;
			lseg.update(s, t+1, x);
		}
	}
	
	return 0;
}


Measured memory_bytes: 7064
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>

using namespace std;
typedef pair<int,int> pii;

int n;
int arr[2][1001];

int main() {
	scanf("%d",&n);
	for(int i=0;i<2;i++) for(int j=0;j<n;j++) scanf("%d",&arr[i][j]);

	int mx=0;
	for(int j=0;j<n;j++) {
		int sum=0;
		for(int i=0;i<=j;i++) sum+=arr[0][i];
		for(int i=n-1;i>=j;i--) sum+=arr[1][i];
		mx=max(mx,sum);
	}
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

const ll MAXK = 1e5 + 10;
const ll MAXN = 101;

ll dp[MAXK],a[MAXN];
ll n,k;

ll rec(ll curr){
    
    ll &ans = dp[curr];
    if(ans != -1) return ans;

    ans = 0;

    FOR(i,1,n){
        if(curr - a[i] < 0) break;
        ans |= (rec(curr-a[i]) == 0);
    }

    return ans;
}

void solve(){
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;

    FOR(i,1,n) cin>>a[i];

    if(rec(k)) cout<<"First\n";
    else cout<<"Second\n";
}

signed main(){


    ll t;
    t = 1; 
    // cin>>t;
    FOR(tt,1,t){
        solve();
    }
    
}

Measured memory_bytes: 4096
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn=550;
int n,m;
char c[maxn][maxn];

void work(){
	n=read(),m=read();
	rep(i,1,n) rep(j,1,m){
		c[i][j]=getchar();
		while(c[i][j]!='.' && c[i][j]!='#') c[i][j]=getchar();
	}
	rep(i,1,n){
		c[i][1]='R',c[i][m]='B';
		if(i&1){rep(j,2,m-1) if(c[i][j]=='.') c[i][j]='R';}
		else{rep(j,2,m-1) if(c[i][j]=='.') c[i][j]='B';}
	}
	rep(i,1,n){
		rep(j,1,m) if(c[i][j]!='B') putchar('#'); else putchar('.');
		puts("");
	}
	puts("");

	rep(i,1,n){
		rep(j,1,m) if(c[i][j]!='R') putchar('#'); else putchar('.');
		puts("");
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif
	
	work();
	
	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pb push_back
#define pll pair<ll,ll> 
#define mll map<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0; i<n; i++)
#define All(x,v) for(auto x:v)
#define arrin(a,n) ll a[n]; rep(i,n) cin>>a[i]
#define vi vector<int>
#define nl "\n"
#define print(arr) All(x,arr) cout<<x<<" "; cout<<nl
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ing(m,ad) rep(i,m){ int u,v; cin>>u>>v; u--;v--; ad[u].pb(v); ad[v].pb(u);}
#define vdsort(v) sort(v.begin(),v.end(),greater<int>())
#define F first
#define S second
#define mod 1000000007
const int MAXN=100005;
int spf[MAXN];
ll fac1[MAXN],fac2[MAXN],inv[MAXN];
ll gcd(ll x, ll y){ return y?gcd(y,x%y):x; }

void sieve(){  
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)  spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) spf[i] = 2; 
    for (int i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j)  spf[j] = i; 
    } 
} 
vector<int> getFactorization(int x){
    vector<int> ret; 
    while (x != 1) { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
}

ll exp(ll n, ll m){
    ll a = 1;
    while (m){
        if (m & 1) a = (a * n % mod) % mod;
        m /= 2;
        n = (n*n) % mod;
    }
    return a;
}

void pre(){
    fac1[0]=fac2[0]=inv[1]=1;
    for(int i=1;i<MAXN;i++){
        fac1[i]=(fac1[i-1]*i)%mod;
        if(i>1) inv[i]=( mod - ((ll)(mod/i)*inv[mod%i])%mod ) %mod;
    }
    for(int i=1;i<MAXN;i++) fac2[i]=(fac2[i-1]*inv[i])%mod;
}
ll C(int n,int k){
    if(n<k) return 0;
    return ((fac1[n]*fac2[n-k]%mod)*fac2[k]%mod);
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    int n,t=1;
    // cin>>t;
    while(t--){
        cin>>n;
        string s="ACL";
        rep(i,n) cout<<s; cout<<nl;
    }
    return 0;
}

Measured memory_bytes: 3136
n, k, q = map(int, input().split(' '))
point = [0 for _ in range(n)]
a = [0 for _ in range(q)]
for i in range(q):
    a[i] = int(input())
if k > q:
    for i in range(n):
        print('Yes')
else:
    for i in range(q):
        point[a[i]-1] += 1
    for i in range(n):
        if k-q+point[i] > 0:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 8588
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int k[m];
    int s[m][10];
    int p[m];
    for (int i = 0; i < m; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) {
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }

    unsigned int state;
    int ans = 0;
    for (state = 0; state < (1 << n); state++) {
        bool allon = true;
        for (int i = 0; i < m; i++) {
            int parity = 0;
            for (int j = 0; j < k[i]; j++) {
                parity += (state >> (s[i][j] - 1));
                parity %= 2;
            }
            if (parity != p[i]) {
                allon = false;
                break;
            }
        }
        if (allon) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    char ch[2];
scanf("%c",ch);
if(ch[0]=='A')
printf("T");
else if(ch[0]=='T')
printf("A");
else if(ch[0]=='C')
printf("G");
else
printf("C");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n, q, a;
    long int k;
    scanf("%d""%ld""%d", &n, &k, &q);
    long int data[n];
    for(int i = 0; i < n; i++){
        data[i] = 0;
    }
    /*for(int i = 0; i < n; i++){
        printf("%ld \n", data[i]);
    }
    printf("\n");*/
    for(int i = 0; i < q; i++){
        scanf("%d", &a);
        data[a - 1] += 1;
    }
    for(int i = 0; i < n; i++){
        if(q - data[i] >= k){
            printf("No\n");
        }else{
            printf("Yes\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1280
import heapq
from collections import defaultdict

n = int(input())
vs = list(map(int, input().split(' ')))

odds = defaultdict(int)
evens = defaultdict(int)
i = 0
while i < n-1:
    odds[vs[i]] += 1
    evens[vs[i+1]] += 1
    i += 2

odd_tops = heapq.nlargest(2, odds.items(), key=lambda x: x[1])
even_tops = heapq.nlargest(2, evens.items(), key=lambda x: x[1])

odd_top_val = odd_tops[0][0]
even_top_val = even_tops[0][0]

if len(odd_tops) == 1:
    odd_tops.append((None, 0))
if len(even_tops) == 1:
    even_tops.append((None, 0))

if odd_top_val == even_top_val:
    a = odd_tops[0][1]
    b = odd_tops[1][1]
    c = even_tops[0][1]
    d = even_tops[1][1]
    if a+d > b+c:
        print(n - a - d)
    else:
        print(n - b - c)
else:
    print(n - odd_tops[0][1] - even_tops[0][1])

Measured memory_bytes: 18016
from collections import Counter
import numpy as np
import bisect
N,M,V,P = (int(x) for x in input().split())
A = list(map(int, input().split()))
dtype = [('points','int64'),('number','int64')]
c = np.array([x for x in Counter(A).items()],dtype=dtype)
c.sort(order='points')
value = [c[-i][1] for i in range(1,len(c)+1)]
cs = np.cumsum(value)
bs = bisect.bisect_left(cs,P)
thr = c[-bs-1][0]
limit = np.cumsum([(thr-c[i][0])*c[i][1] for i in range(len(c)-bs-1)])
broke = False
if bs == len(cs) - 1:
    print(N)
else:
    for i in range(len(cs)-bs-1):
        point = c[-bs-2-i][0]
        points_needed = thr - point
        if points_needed > M:
            print(cs[bs+i])
            broke = True
            break
        else:
            questions_raised = V - (N - cs[bs+i])
            if questions_raised >= P:
                points_overflowed = M * (questions_raised-(P-1))
                points_limit = limit[-1] - limit[-1-i] + (point+M-thr) * (cs[bs+i]-P+1)
                if points_overflowed > points_limit:
                    print(cs[bs+i])
                    broke = True
                    break
    if broke == False:
        print(N)

Measured memory_bytes: 30276
#include <iostream>
#include <iomanip>
#define ll long long
using namespace std;

int main(){
	ll n;
	string x = "";
	cin >> n;
	while(n > 0){
		n-=1;
		x+=n%26 + 'a';
		n/=26;
	}
	
	for(int i = x.length()-1; i >= 0; i--){
		cout << x[i];
	}
	
	cout << endl;


	return 0;
}


Measured memory_bytes: 3592
package main

import (
	"fmt"
)

func main() {

	var A, B int
	var count int

	fmt.Scan(&A)
	fmt.Scan(&B)

	for i := 0; i <= 100; i++ {
		if i*A-i+1 >= B {
			count = i
			break
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

int main(){

  int n,k;
  cin >> n >> k;
  int a[n];
  rep(i,n) cin >> a[i];
  int dp[n+1][k+1];
  rep(i,n+1) rep(j,k+1) dp[i][j]=0;
  dp[0][0]=1;
  int mod=1e9+7;
  int lim=0;
  rep1(i,n){
    int sum=dp[i-1][0];
    lim+=a[i-1];
    //    cout <<a[i-1] << endl;
    rep(j,k+1){
      if(lim<j) break;
      if(a[i-1]<j) sum-=dp[i-1][j-a[i-1]-1];
      if(sum<0) sum+=mod;
      dp[i][j]=sum;
      //      cout << dp[i][j] << " ";
      if(j!=k)sum+=dp[i-1][j+1];
      sum%=mod;
    }
    //    cout <<"" << endl;
  }
  //  int ans=0;
  /*  rep(i,k+1){
    ans += dp[n][i];
    ans%=mod;
    }*/
  cout << dp[n][k] << endl;
  return 0;

}


Measured memory_bytes: 39680
n=int(input())
lis=[]
for i in range(n):
  x,y,h=map(int,input().split())
  lis.append([h,x,y])
lis.sort()

for i in range(0,101):
  for j in range(0,101):
    temp=0
    onezero=1
    for k in range(0,n):
      k=n-k-1
      xhoukou=abs(i-lis[k][1])
      yhoukou=abs(j-lis[k][2])
      hhoukou=lis[k][0]
      if hhoukou>0:
        keep=xhoukou+yhoukou+hhoukou
        if temp==0:
          temp=keep
        else:
          if keep!=temp:
            onezero=0
      else:
        if xhoukou+yhoukou<temp:
          onezero=0
    if onezero==1:
      print(i,j,temp)
      

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

const int mod = 1000000007;
int dp[100005][2];

int main(void)
{
	string s;
	cin >> s;
	dp[0][0] = 1;
	int n = s.size();

	for (int i = 0; i < n; ++i)
	{
		//a+bのi桁目を0にする
		{
			if (s[i] == '0')
			{
				dp[i + 1][0] = dp[i][0];
				dp[i + 1][1] = dp[i][1];
			}
			else
			{
				dp[i + 1][1] = (dp[i][0] + dp[i][1]) % mod;
			}
		}

		//a+bのi桁目を1にする
		{

			if (s[i] == '0')
			{
				(dp[i + 1][1] += dp[i][1] * 2 % mod) %= mod;
			}
			else
			{
				(dp[i + 1][0] += dp[i][0] * 2 % mod) %= mod;
				(dp[i + 1][1] += dp[i][1] * 2 % mod) %= mod;
			}
		}
	}
	int ans = (dp[n][0] + dp[n][1]) % mod;
	cout << ans << endl;
	return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using ld=long double;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

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


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

    vi pos;
    for(int i=0; i<N; i++){
        pos.push_back(i);
        int cur=i;
        while(cur < N && S[cur] == S[i]) cur++;
        i=cur-1;
    }

    int ans=0;
    for(int i=0; i<(int)pos.size(); i++){
        if(S[pos[i]] == '0'){
            if(i+2*K >= (int)pos.size()) chmax(ans, N-pos[i]);
            else chmax(ans, pos[i+2*K]-pos[i]);
        }
        else{
            if(i+2*K+1 >= (int)pos.size()) chmax(ans, N-pos[i]);
            else chmax(ans, pos[i+2*K+1]-pos[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4096
B, W = map(int, input().split())
mod = int(1e9) + 7
def doubling(n, m):
  y = 1
  base = n
  while m != 0:
    if m % 2 == 1:
      y *= base
      y %= mod
    base *= base
    base %= mod
    m //= 2
  return y
def inved(a):
  x, y, u, v, k, l = 1, 0, 0, 1, a, mod
  while l != 0:
    x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
    k, l = l, k % l
  return x % mod

fact = [1 for i in range(B+W+1)]
invf = [1 for i in range(B+W+1)]
for i in range(B+W):
  fact[i+1] = (fact[i] * (i+1)) % mod
invf[-1] = inved(fact[-1])
for i in range(B+W, 0, -1):
  invf[i-1] = (invf[i] * i) % mod
bina = [1 for i in range(B+W+1)]
invb = [1 for i in range(B+W+1)]
for i in range(B+W):
  bina[i+1] = (bina[i] * 2) % mod
invb[-1] = inved(bina[-1])
for i in range(B+W, 0, -1):
  invb[i-1] = (invb[i] * 2) % mod
if B == W:
  for i in range(B+W):
    print(invf[2])
elif B > W:
  for i in range(W):
    print(invf[2])
  P = invf[2]
  for i in range(W+1, B+1):
    F = (fact[i-2] * invf[i-1-W] * invf[W-1]) % mod
    F *= invb[i]
    F %= mod
    F += P
    F %= mod
    print(F)
    P = F
  for i in range(B+1, B+W+1):
    F = invf[i-1-B] * invf[B-1]
    F %= mod
    F *= fact[i-2]
    F %= mod
    F *= mod - 1
    F += (fact[i-2] * invf[i-1-W] * invf[W-1]) % mod
    F %= mod
    F *= invb[i]
    F %= mod
    F += P
    F %= mod
    print(F)
    P = F
elif B < W:
  for i in range(B):
    print(invf[2])
  P = invf[2]
  for i in range(B+1, W+1):
    F = (fact[i-2] * invf[i-1-B] * invf[B-1]) % mod
    F *= mod - 1
    F %= mod
    F *= invb[i]
    F %= mod
    F += P
    F %= mod
    print(F)
    P = F
  for i in range(W+1, B+W+1):
    F = invf[i-1-B] * invf[B-1]
    F %= mod
    F *= fact[i-2]
    F %= mod
    F *= mod - 1
    F += (fact[i-2] * invf[i-1-W] * invf[W-1]) % mod
    F %= mod
    F *= invb[i]
    F %= mod
    F += P
    F %= mod
    print(F)
    P = F

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

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

		while(true){
			String s = scanner.next();
			
			if(s.equals("-")){
				break;
			}
			
			int m = scanner.nextInt();

			for(int i = 0; i < m; i++){
				int n = scanner.nextInt();
				s += s.substring(0,n);
				s = s.substring(n);
			}

			System.out.println(s);
		}
	}
}

Measured memory_bytes: 26156
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        int M = sc.nextInt();

        System.out.println(solve(N, M) ? YES : NO);
    }

    private static boolean solve(int N, int M) {
        return N == M;
    }
}

Measured memory_bytes: 22228