Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from functools import reduce

n = int(input())

res = []

while True:
  if n == 1:
    res.append(1)
    break
  if n%2 == 0:
    res.append(0)
    n //= -2
  else:
    res.append(1)
    n = (n-1)//(-2)


print(reduce(lambda s, x: s + str(x), reversed(res) ,""))


### FIXED CODE ###

from functools import reduce

n = int(input())

if n == 0:
  print(0)
  exit()

res = []

while True:
  if n == 0:
    break
  if n == 1:
    res.append(1)
    break
  if n%2 == 0:
    res.append(0)
    n //= -2
  else:
    res.append(1)
    n = (n-1)//(-2)


print(reduce(lambda s, x: s + str(x), reversed(res) ,""))
### BUGGY CODE ###

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

previous_average_a = sum(a[0:k])/k

for i in range(k+1, n+1):
    average_a = sum(a[i-k:i])/k
    if previous_average_a < average_a:
        print('Yes')
    else:
        print('No')
    previous_average_a = average_a

### FIXED CODE ###

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

for i in range(k, n):
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

N, Q = map(int, input().split())

# 木構造をリストで表現する
G = [[] for _ in range(N+1)]
for i in range(N-1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

# 各操作で与えられる値を、各頂点ごとに集計しておく
P = [0] * (N+1)
for i in range(Q):
    p, x = map(int, input().split())
    P[p] += x

# 各頂点のカウンター
Count = [0] * (N+1)


def dfs(v, parent, point):
    # 現在いる頂点vの親までの値をpointとし、
    new_point = point + P[v]
    Count[v] = new_point

    for next_v in G[v]:
        if next_v == parent:
            continue
        dfs(next_v, v, new_point)


dfs(1, 0, 0)

res = " ".join(map(str, Count[1:]))

print(res)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

 
N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p,x in PX:
    value[p] += x
 
def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])
 
dfs(1,0,0)
 
answer = ' '.join(map(str,value[1:]))
print(answer)
### BUGGY CODE ###

import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
if m//n>1000000:
  for i in range(1,n):
    if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):
      print('1')
      exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break


### FIXED CODE ###

import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m-i-n>0 and m%(m-i-n)==0 and m//(m-i-n)>n:
    print(m-i-n)
    break
### BUGGY CODE ###

n = int(input())
s = [sorted(input()) for _ in range(n)]
ans = 0
for i in range(n):
    for j in range(i+1,n):
        if s[i] == s[j]:
            ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
used_s = {}
for _ in range(n):
    s = "".join(sorted(input()))
    if not s in used_s.keys():
        used_s[s] = 0
    else:
        used_s[s] += 1
        ans += 1 * used_s[s]

print(ans)
### BUGGY CODE ###

N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()

tate=A
tate.reverse()
yoko=A

def binary_search(y):
   left_index=-1
   right_index=len(yoko)

   while(left_index<right_index-1):
      i=(left_index+right_index)//2
      if yoko[i] >= y:
         left_index=i
      else:
         right_index=i
   return right_index

X=[c for c in range(2*max(A)+1)]
left_index_2=0
right_index_2=len(X)

while left_index_2<right_index_2-1:
   count=0
   j=(left_index_2+right_index_2)//2
   #print("X[j]:",X[j])

   for a in tate:
      y=X[j]-a
      #Aの中でy以上の数を数える
      count+=binary_search(y)
   if count > M:
      left_index_2=j
   elif count <= M:
      right_index_2=j

#print(X[left_index_2])
happiness=0
count_2=0
for a in tate:
   y=X[left_index_2]-a
   z=binary_search(y)
   #print(z)
   happiness+=sum(tate[0:z])+a*z
   count_2+=z

while count_2>M:
   happiness-=X[left_index_2]
   count_2-=1
print(happiness)

### FIXED CODE ###

N, M = map(int, input().split())
a = [10**18] + sorted(map(int, input().split()), reverse=True)


def solve(x):
   count = 0
   j = N
   for i in range(1, N+1):
      while a[i] + a[j] < x:
         j -= 1
      count += j
   
   return count


left, right = 0, 10**18
while left < right - 1:
   mid = (left + right) // 2
   if solve(mid) >= M:
      left = mid
   else:
      right = mid

acc = a[:]
acc[0] = 0
for i in range(N):
   acc[i+1] += acc[i]

ans = 0
j = N
for i in range(1, N+1):
   while a[i] + a[j] < left+1:
      j -= 1
   ans += a[i]*j + acc[j]
   M -= j

if M:
   ans += left * M

print(ans)
### BUGGY CODE ###

# -*- config: utg-8 -*-

n = int(input())
s = [input() for i in range(n)]

sort_list = []

for i in s:
	str_sort_list = sorted(i)
	new_str = ''.join(str_sort_list)
	sort_list.append(new_str)

count = 0
for i in range(n):
  for j in range(n-i):
    if sort_list[i] == sort_list[j+i] and i!=j+i:
      count += 1

print(count)

### FIXED CODE ###

import collections
N = (int(input()))

ans = 0
counter_list = []

for _ in range(N):
    s = input()
    counter_list.append("".join(sorted(s)))

ans = 0
wordcount = {}
for word in counter_list:
    if word in wordcount:
        wordcount[word] += 1
        ans += (wordcount[word])
    else:
        wordcount[word] = 0

print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0

F = []
G = []
for i in range(1, N + 1):
    F.append(i + A[i - 1])
    G.append(i - A[i - 1])
F.sort()
G.sort()
J = 0
for i in range(N):
    j = J + 1
    for j in range(N):
        if F[i] == G[j]:
            ans += 1
            J = j
        if G[j] > F[j]:
            break

print(ans)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
X, Y = [], []
for i in range(N):
    X.append(i + 1 + A[i])
    Y.append(i + 1 - A[i])
XL = Counter(X)
c = 0
for y in Y:
    c += XL.get(y, 0)
print(c)
### BUGGY CODE ###

import sys
input=sys.stdin.readline

N,M = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
ad = {x:As.count(x) for x in set(As)}
for _ in range(M):
  m = max(ad.keys())
  ad[m] -= 1
  if ad[m]==0:
    del ad[m]
  if m//2 in ad:
    ad[m//2] += 1
  else:
    ad[m//2] = 1
print(sum(x*y for x,y in ad.items()))

### FIXED CODE ###

import sys
input=sys.stdin.readline

N,M = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
As = sorted(As,reverse = True)
rest = M
for _ in range(M):
  if rest == 0:
    break
  d = As[0]
  b = d//2 - d//4
  for i in range(N):
    a = As[i]
    check = 0
    if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
    if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break
print(sum(As))
### BUGGY CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split(" ")))
    B = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))

    A.sort()
    B.sort()
    C.sort()

    cnt = 0
    for a in A:
        for b in B:
            if a >= b:
                continue
            for c in C:
                if b >= c:
                    continue
                cnt += 1
    print(cnt) 

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python

import bisect

def main():
    N = int(input())
    A = list(map(int, input().split(" ")))
    B = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))

    A.sort()
    B.sort()
    C.sort()

    cnt = 0
    for b in B:
        a_index = bisect.bisect_left(A, b)
        c_index = bisect.bisect_right(C, b)
        cnt += a_index * (N - c_index)
    print(cnt)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

#coding:utf-8
import bisect,math
import multiprocessing
A,B,Q=map(int,raw_input().split())
s=[0]*A
t=[0]*B
for i in range(A):
    s[i]=input()
for i in range(B):
    t[i]=input()
buf=[]
def f(x):
    sl=bisect.bisect_left(s,x)-1
    sr=bisect.bisect_left(s,x)
    tl=bisect.bisect_left(t,x)-1
    tr=bisect.bisect_left(t,x)
    ans=float("inf")
    if sl!=-1 and tl!=-1:
        A=max(s[sl],t[tl])
        B=min(s[sl],t[tl])
        L=abs(x-A)+abs(A-B)
        ans=min(ans,L)
    if sl!=-1 and tr!=len(t):
        L=abs(x-s[sl])*2 + abs(t[tr]-x)        
        ans=min(ans,L)
        ans=min(ans,abs(x-s[sl])+abs(t[tr]-x)*2)
    if tl!=-1 and sr!=len(s):
        ans=min(ans,abs(x-t[tl])*2+abs(s[sr]-x))
        ans=min(ans,abs(x-t[tl])+abs(s[sr]-x)*2)
    if tr!=len(t) and sr!=len(s):
        A=min(s[sr],t[tr])
        B=max(s[sr],t[tr])
        L=abs(A-x)+abs(B-A)
        ans=min(ans,L)
    return str(ans)

I=[0]*Q
for i in xrange(Q):
    I[i]=input()
r=map(f,I)
print("\n".join(r))
    
    




### FIXED CODE ###

#coding:utf-8
import bisect,sys
A,B,Q=map(int,raw_input().split())
s=[0]*A
t=[0]*B
for i in range(A):    
    s[i]=int(sys.stdin.readline())
for i in range(B):
    t[i]=int(sys.stdin.readline())
buf=[]
def f(x):
    sl=bisect.bisect_left(s,x)-1
    sr=sl+1
    tl=bisect.bisect_left(t,x)-1
    tr=tl+1
    ans=float("inf")
    if sl!=-1 and tl!=-1:
        A=max(s[sl],t[tl])
        B=min(s[sl],t[tl])
        L=abs(x-A)+abs(A-B)
        ans=min(ans,L)
    if sl!=-1 and tr!=len(t):
        L=abs(x-s[sl])*2 + abs(t[tr]-x)        
        ans=min(ans,L)
        ans=min(ans,abs(x-s[sl])+abs(t[tr]-x)*2)
    if tl!=-1 and sr!=len(s):
        ans=min(ans,abs(x-t[tl])*2+abs(s[sr]-x))
        ans=min(ans,abs(x-t[tl])+abs(s[sr]-x)*2)
    if tr!=len(t) and sr!=len(s):
        A=min(s[sr],t[tr])
        B=max(s[sr],t[tr])
        L=abs(A-x)+abs(B-A)
        ans=min(ans,L)
    return str(ans)

I=[0]*Q
for i in xrange(Q):
    I[i]=int(sys.stdin.readline())
r=map(f,I)
print("\n".join(r))
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)


AB = []
for i in range(X):
    for j in range(Y):
        AB.append(A[i] + B[j])
AB.sort(reverse=True)
AB = AB[:K]

ans = []
for ab in AB:
    for c in C:
        ans.append(ab + c)

ans.sort(reverse=True)
print(*ans[:K], sep='\n')


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)


AB = []
for i in range(X):
    for j in range(Y):
        AB.append(A[i] + B[j])
AB.sort(reverse=True)
AB = AB[:K]

ans = []
for ab in AB:
    for c in C:
        ans.append(ab + c)
        
ans.sort(reverse=True)
print(*ans[:K], sep='\n')
### BUGGY CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[8]:


N = int(input())
S = input()


# In[9]:


ans = 0
for i in range(1000):
    tmp = str(i).zfill(3)
    cnt = 0
    f = False
    for s in S:
        if s == tmp[cnt]:
            cnt += 1
            if cnt == 3:
                f = True
                break
    if f:
        ans += 1
print(ans)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[8]:


N = int(input())
S = input()


# In[19]:


ans = 0
for i in range(10):
    str_i = str(i)
    i_index = S.find(str_i)
    if i_index == -1:
        continue
    for j in range(10):
        str_j = str(j)
        j_index = S.find(str_j, i_index+1)
        if j_index == -1:
            continue
        for k in range(10):
            str_k = str(k)
            k_index = S.find(str_k, j_index+1) 
            if k_index != -1:
                ans += 1
print(ans)


# In[ ]:
### BUGGY CODE ###

import math
K=int(input())
N=0
for a in range(K):
    for b in range(K):
        for c in range(K):
            N+=math.gcd(math.gcd((c+1),(b+1)),(a+1))
print(N)

### FIXED CODE ###

import math
K=int(input())
N=0
k=K*K
d1=[0]*int(k)
i=0
j=0
for b in range(K):
    for c in range(K):
        d1[i]=math.gcd((c+1),(b+1))
        i+=1
for a in range(K):
    for x in d1:
        N+=math.gcd(x,(a+1))
print(N)
### BUGGY CODE ###

mod=10**9+7
n,k=map(int,input().split())
l=sorted(map(int,input().split()))
ans=0
ll=1
ans+=ll*l[k-1]%mod
b,s=1,1
for i in range(k,n):
  ll=ll*i//(i-k+1)
  ans+=l[i]*ll%mod
  s*=i
  b*=(i-k+1)
ml=s//b

ans-=ml*l[0]
ans%=mod
for i in range(1,n-k+1):
  ml=ml*(n-i-k+1)//(n-i)
  ans-=ml*l[i]%mod

print(ans%mod)


### FIXED CODE ###

n,k=map(int,input().split())
l=sorted(list(map(int,input().split())))
mod=10**9+7
fact=[1]*(n+1)
inv=[1]*(n+1)
for i in range(2,n+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
for i in range(n):
    if i>=k-1:
        ans+=l[i]*fact[i]*inv[k-1]*inv[i-k+1]%mod
    if n-i-1>=k-1:
        ans-=l[i]*fact[n-i-1]*inv[k-1]*inv[n-i-1-k+1]%mod
    ans%=mod
print(ans)
### BUGGY CODE ###

def main():
    s = input()
    q = int(input())

    flag = 1
    ctn = 0
    for _ in range(q):
        query = input().split()
        if flag:
            if query[0] == "1":
                flag = 0
                ctn += 1
            else:
                if query[1] == "1":
                    s = query[-1] + s
                else:
                    s = s + query[-1]
        else:
            if query[0] == "1":
                flag = 1
                ctn += 1
            else:
                if query[1] == "1":
                    s = s + query[-1]
                else:
                    s = query[-1] + s

    if ctn % 2 == 1:
        print(s[::-1])
    else:
        print(s)

main()

### FIXED CODE ###

from collections import deque

def main():

    s = deque(input())
    q = int(input())

    flag = 0
    query = []

    for _ in range(q):
        temp = input().split()
        if len(temp) == 1:
            flag += 1
        else:
            query.append(temp + [flag%2])

    for q in query:
        if q[-1] == 0:
            if q[1] == "1":
                s.appendleft(q[2])
            else:
                s.append(q[2])
        else:
            if q[1] == "1":
                s.append(q[2])
            else:
                s.appendleft(q[2])

    if flag % 2 == 1:
        print("".join(list(s)[::-1]))
    else:
        print("".join(s))

main()
### BUGGY CODE ###

s = list(input())
def change(i):
    global s
    #print(i)
    if s[i : i + 3] == ["A", "B", "C"]:
        s[i:i + 3] = ["B", "C", "A"]
        #print(s)
        return 1
    return 0

cnt = 0
for i in range(0,  len(s)):
    if change(i):
        cnt += 1
        for j in range(i - 1, -1, -1):
            if not change(j):
                break
            cnt += 1

print(cnt)

### FIXED CODE ###

s = list(input())
def change(i):
    global s
    #print(i)
    if s[i : i + 3] == ["A", "B", "C"]:
        s[i:i + 3] = ["B", "C", "A"]
        #print(s)
        return 1
    return 0

cnt = 0
cnA = 0
i = 0
while i < len(s) - 1:
    #print(i, cnA)
    if s[i:i + 2] == ["B", "C"]:
        cnt += cnA
        i += 1
    elif s[i] == "A":
        cnA += 1
    else:
        cnA = 0
    i += 1

print(cnt)
### BUGGY CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
m = []
m_sum = 0
for i in range(n-k+1):
    p_sum = sum(p[i:i+k])
    if p_sum > m_sum:
        m_sum = p_sum
print((m_sum+k)/2)



### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
m = []
m_sum = 0
for i in range(n-k+1):
    if i == 0:
        p_sum = sum(p[:k])
    else:
        p_sum -= p[i-1]
        p_sum += p[i+k-1]
    if p_sum > m_sum:
        m_sum = p_sum
print((m_sum+k)/2)
### BUGGY CODE ###

from collections import defaultdict
import heapq

def dijkstra(G, s):
    dist = [float('inf')] * len(G.keys())
    dist[s] = 0
    q = [(dist[v], v) for v in G.keys()]
    heapq.heapify(q)
    while True:
        try:
            _, u = heapq.heappop(q)
        except IndexError:
            break
        for v, d in G[u]:
            tmp = dist[u] + d
            if dist[v] > tmp:
                dist[v] = tmp
                heapq.heappush(q, (tmp, v))
    return dist

n, m, s, t = map(int, input().split())
G1 = defaultdict(list)
G2 = defaultdict(list)

for i in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    G1[u].append((v, a))
    G1[v].append((u, a))
    G2[u].append((v, b))
    G2[v].append((u, b))

dist1 = dijkstra(G1, s-1)
dist2 = dijkstra(G2, t-1)

mv = 0
ans = []
for i in range(n-1, -1, -1):
    mv = max(mv, 10**15 - dist1[i] - dist2[i])
    ans.append(mv)

ans.reverse()
for a in ans:
    print(a)

### FIXED CODE ###

from collections import defaultdict
import heapq

def dijkstra(G, s):
    q = []
    heapq.heapify(q)
    prev = [None] * len(G.keys())
    dist = [float('inf')] * len(G.keys())
    dist[s] = 0
    for v in sorted(G.keys()):
        heapq.heappush(q, (dist[v],v))
    while True:
        try:
            _, u = heapq.heappop(q)
        except:
            break
        for v, d in G[u]:
            tmp = dist[u] + d
            if dist[v] > tmp:
                dist[v] = tmp
                prev[v] = u
                heapq.heappush(q, (tmp, v))
    return dist

n, m, s, t = map(int, input().split())
G1 = defaultdict(list)
G2 = defaultdict(list)

for i in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    G1[u].append((v, a))
    G1[v].append((u, a))
    G2[u].append((v, b))
    G2[v].append((u, b))

dist1 = dijkstra(G1, s-1)
dist2 = dijkstra(G2, t-1)

mv = 0
ans = []
for i in range(n-1, -1, -1):
    mv = max(mv, 10**15 - dist1[i] - dist2[i])
    ans.append(mv)

ans.reverse()
for a in ans:
    print(a)
### BUGGY CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))

# まずK学期の評点を求めておきます
score = 1
for i in range(k):
  score *= A[i]

for i in range(n-k):
  new_score = score // A[i] * A[i+k]
  if score < new_score:
    print("Yes")
  else:
    print("No")
  score = new_score

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(n-k):
    if A[i+k] > A[i]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

#!/usr/bin/env python3


def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    r, c, k = map(int, input().split())
    v = [[0 for _ in range(c + 1)] for _ in range(r + 1)]
    for i in range(k):
        row, col, val = map(int, input().split())
        v[row][col] = val

    dp = [[[0 for num in range(4)] for _ in range(c + 1)]
          for _ in range(r + 1)]
    for row in range(1, r + 1):
        for col in range(1, c + 1):
            for num in range(0, 4):
                if num == 0:
                    dp[row][col][num] = max(dp[row-1][col][3],  # down
                                            dp[row][col-1][num],  # right
                                            )
                else:
                    dp[row][col][num] = max(dp[row][col][num-1],  # str
                                            dp[row-1][col][3],  # down x
                                            dp[row][col-1][num],  # right x
                                            dp[row-1][col][3] + \
                                            v[row][col],  # down o
                                            dp[row][col-1][num-1] + \
                                            v[row][col],  # right o
                                            )
    # print(v)
    # print(dp)
    print(dp[r][c][3])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3


def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    r, c, k = map(int, input().split())
    dp = [[[0] * (c+1) for i in range(r+1)] for i in range(4)]
    v = [[0] * (c+1) for i in range(r+1)]
    for i in range(k):
        row, col, val = map(int, input().split())
        v[row][col] = val

    for row in range(1, r + 1):
        for col in range(1, c + 1):
            for num in range(0, 4):
                if num == 0:
                    dp[num][row][col] = dp[3][row-1][col]  # simple down
                else:
                    
                    dp[num][row][col] = max(dp[num-1][row][col],  # str
                                            dp[num][row][col-1],  # right x
                                            dp[3][row-1][col] + \
                                            v[row][col],  # down o
                                            dp[num-1][row][col-1] + \
                                            v[row][col],  # right o
                                            )
    print(dp[3][r][c])


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import Counter
N=int(input())
count=0
s=[]
for i in range(N):
    s.append(input())
for t in range(N):
    for i in range(t+1,N):
        if Counter(s[t])==Counter(s[i]):
            count+=1
print(int((count)))

### FIXED CODE ###

N=int(input())
S=[''.join(sorted((input()))) for i in range(N)]
P={}
for i in range(N):
    if S[i] in P:
        P[S[i]]+=1
    else:
        P[S[i]]=0
for i in P.keys():
    if P[i]>=2:
        P[i]=P[i]*(P[i]+1)/2
print(int(sum(P.values())))
### BUGGY CODE ###

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

s = [k] * n
for i in range(q):
    for j in range(n):
        if a[i] != j:
            s[j] -= 1

for i in range(n):
    if s[i] > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n, k, q = map(int, input().split())
win = [0] * n
for _ in range(q):
    win[int(input()) - 1] += 1

for i in range(n):
    if k - q + win[i] > 0:
        print("Yes")
    else:
        print("No")