Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())
judge = 1
for i in range(q):
  d = input()
  if d == '1':
    judge *= -1
  else:
    a, b, c = list(d.split())
    b = int(b)
    if (b == 1 and judge ==1) or (b == 2 and judge == -1):
      s.insert(0, c)
    else:
      s.append(c)
if judge == 1:
  print(*s,sep='')
else:
  print(*s[::-1], sep='')

Fixed submission:
s = list(input())
q = int(input())
judge = 1
front = []
back = []
for i in range(q):
  a = list(map(str,input().split()))
  if int(a[0]) == 1:
    judge *= -1
  else:   
    if (int(a[1]) == 1 and judge == 1) or (int(a[1]) == 2 and judge == -1):
      front.append(a[2])
    else:
      back.append(a[2])
ans = front[::-1] + s + back
if judge == -1:
  ans.reverse()
print(*ans, sep='')

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())
for i in range(q):
  d = input()
  if d == '1':
    s.reverse()
  else:
    a, b, c = list(d.split())
    b = int(b)
    if b == 1:
      s.insert(0, c)
    else:
      s.append(c)
print(*s,sep='')

Fixed submission:
s = list(input())
q = int(input())
judge = 1
front = []
back = []
for i in range(q):
  a = list(map(str,input().split()))
  if int(a[0]) == 1:
    judge *= -1
  else:   
    if (int(a[1]) == 1 and judge == 1) or (int(a[1]) == 2 and judge == -1):
      front.append(a[2])
    else:
      back.append(a[2])
ans = front[::-1] + s + back
if judge == -1:
  ans.reverse()
print(*ans, sep='')

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())
for i in range(q):
  d = input()
  if len(d) == 5:
    a, b, c = list(d.split())
    a = int(a)
    b = int(b)
    if b == 1:
      s.insert(0, c)
    else:
      s.append(c)
  else:
    s.reverse()
print(*s,sep='')
    

Fixed submission:
s = list(input())
q = int(input())
judge = 1
front = []
back = []
for i in range(q):
  a = list(map(str,input().split()))
  if int(a[0]) == 1:
    judge *= -1
  else:   
    if (int(a[1]) == 1 and judge == 1) or (int(a[1]) == 2 and judge == -1):
      front.append(a[2])
    else:
      back.append(a[2])
ans = front[::-1] + s + back
if judge == -1:
  ans.reverse()
print(*ans, sep='')
Buggy python submission (verdict: Runtime Error):
60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

Fixed submission:
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())

for _ in range(n):
  b = int(input())
  for y in range(3):
    for x in range(3):
      if a[y][x] == b:
        a[y][x] = -1

for y in range(3):
  f = True
  for x in range(3):
    if a[y][x] != -1:
      f = False
  if f:
    print('Yes')
    exit()
    
for x in range(3):
  f = True
  for y in range(3):
    if a[y][x] != -1:
      f = False
  if f:
    print('Yes')
    exit()
    
f = True
for x in range(3):
  if a[x][x] != -1:
    f = False
if f:
  print('Yes')
  exit()
  
f = True
for x in range(3):
  if a[x][2-x] != -1:
    f = False
if f:
  print('Yes')
  exit()
  
print('No')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
s = []
c = []
for i in range(n):
  S, C = map(int, input().split())
  s.append(S)
  c.append(C)
for i in range(10 **(n + 1)):
  tmp = str(i)
  if len(tmp) == n and all([tmp[s[j] - 1] == str(c[j]) for j in range(m)]):
    print(tmp)
    exit()
print(-1)

Fixed submission:
n, m = map(int, input().split())
s = []
c = []
for i in range(m):
  S, C = map(int, input().split())
  s.append(S)
  c.append(C)
for i in range(10 **(n + 1)):
  tmp = str(i)
  if len(tmp) == n and all([tmp[s[j] - 1] == str(c[j]) for j in range(m)]):
    print(tmp)
    exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
import headq
n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input()split()))
headq.heaify(a)
for i in range(m):
  min = heapq.heapppop(a)
  heapq.heappush(a, (-min//2)*(-1))
print(-sum(a))

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
  min = heapq.heappop(a)
  heapq.heappush(a, (-min//2)*(-1))
print(-sum(a))
Buggy python submission (verdict: Runtime Error):
import bisect
n = int(input())
a = list(map(int, input()))
b = list(map(int, input()))
c = list(map(int, input()))
a.sort()
ans = 0
for i in b:
  d = bisect.bisect_left(a, i)
  e = bisect.bisect_right(c, i)
  if d > 0 and e < len(c):
    ans += d*(n-e)
print(ans)

Fixed submission:
import bisect
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()
ans = 0
for i in b:
  d = bisect.bisect_left(a, i)
  e = bisect.bisect_right(c, i)
  if d > 0 and e < len(c):
    ans += d*(n-e)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
word = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if d[i] = 0:
    continue
  for w in words():
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)

Fixed submission:
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
words = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if dp[i] == 0:
    continue
  for w in words:
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)

Buggy python submission (verdict: Runtime Error):
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
word = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if d[i] = 0:
    continue
  for w in words():
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)

Fixed submission:
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
words = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if dp[i] == 0:
    continue
  for w in words:
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)

Buggy python submission (verdict: Runtime Error):
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'No'
word = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if d[i] = 0:
    continue
  for w in words():
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'Yes'
      break
print(judge)

Fixed submission:
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
words = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if dp[i] == 0:
    continue
  for w in words:
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
l=list(map(int,input().split()))

flag=[0]*n

for i in range(len(l)):
    for j in range(len(l)):
        if i==j:
            continue
        elif flag[i]==1:
            continue
        elif l[i]%l[j]==0:
            flag[i]=1
            break
print(flag.count(0))


Fixed submission:
n= int(input())
l=list(map(int,input().split()))

l.sort()
maxnum=l[len(l)-1]
flag=[0]*(maxnum+1)

for num in l:
    flag[num]+=1
    if flag[num]>1:
        continue
    for j in range(num*2, maxnum+1, num):
        flag[j]+=1
#print(flag)
ans=0

for num in l:
    if flag[num]==1:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])

if temp!=1:
    arr.append([temp, 1])

if arr==[]:
    arr.append([n, 1])

if arr==[[1,1]]:
    print(0)

else:
    # print(arr)
    total=0
    for i in range(len(arr)):
        x=1
        s=0
        c=-1
        while s<=arr[i][1]:
            s+=x
            x+=1
            c+=1
        total+=c
    print(total)


Fixed submission:
n=int(input())

arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])

if temp!=1:
    arr.append([temp, 1])

if arr==[]:
    arr.append([n, 1])

if arr==[[1,1]]:
    print(0)

else:
    total=0
    for i in range(len(arr)):
        x=1
        s=0
        c=-1
        while s<=arr[i][1]:
            s+=x
            x+=1
            c+=1
        total+=c
    print(total)

Buggy python submission (verdict: Runtime Error):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])

if temp!=1:
    arr.append([temp, 1])

if arr==[]:
    arr.append([n, 1])

if arr==[[1,1]]:
    print(0)

else:
    # print(arr)
    total=0
    for i in range(len(arr)):
        x=1
        s=0
        c=-1
        while s<=arr[i][1]:
            s+=x
            x+=1
            c+=1
        total+=c
    print(total)


Fixed submission:
n=int(input())

arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])

if temp!=1:
    arr.append([temp, 1])

if arr==[]:
    arr.append([n, 1])

if arr==[[1,1]]:
    print(0)

else:
    total=0
    for i in range(len(arr)):
        x=1
        s=0
        c=-1
        while s<=arr[i][1]:
            s+=x
            x+=1
            c+=1
        total+=c
    print(total)
Buggy python submission (verdict: Runtime Error):
from collections import deque

N, M = map(int, input().split())
l =[[] for _ in range(N)]

q=deque([0])

TFl=[0]*N
TFl[0]=1
ml=[-1]*N

for i in range(M):
  A,B=map(int,input().split())
  l[B-1].append(A-1)
  l[A-1].append(B-1)

while q:
  p = q.popleft()
  for i in l[p]: #普通に1行ずつ回してるイメージ
    if TFl[i]==1:
      continue
    TFl[i]=1
    ml=p
    q.append(i)

if all([i==1 for i in TFl]):
  print('Yes')
  for i in range(1, N):
    print(ml[i]+1)

else:
  print('No')


Fixed submission:
from collections import deque

N, M = map(int, input().split())
l =[[] for _ in range(N)]

q=deque([0])

TFl=[0]*N
TFl[0]=1
ml=[-1]*N

for i in range(M):
  A,B=map(int,input().split())
  l[B-1].append(A-1)
  l[A-1].append(B-1)

while q:
  p = q.popleft()
  for i in l[p]: #普通に1行ずつ回してるイメージ
    if TFl[i]==1:
      continue
    TFl[i]=1
    ml[i]=p
    q.append(i)

if all([i==1 for i in TFl]):
  print('Yes')
  for i in range(1, N):
    print(ml[i]+1)

else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int,input().split())

ca=[list(map(int,input().split())) for _ in range(n)]

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc=+ca[j][0]
      a+=ca[j][1:]
  if min(a)>=x:
    res=min (sc,res)

if res == INF:
    print(-1)
else:
    print(res)


Fixed submission:
lS=list(input())
T=input()

lT=list(T)
if lS==lT[0:len(lT)-1]:
  print('Yes')

else:
  print('No')
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())

s=-1*K*C

lc=[]
lc_=[]
for i in range(min(K,A+1):
  for j in range(min(K-i+1,B+1)):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    # print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)


Fixed submission:
A,B,C,K = map(int,input().split())

if A+B<K:
  print(A-(K-A-B))
else:
  print(min(A, K))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = map(int,input().split())

s=-1*K*C

lc=[]
lc_=[]
for i in range(A+1):
  for j in range(min(K-i+1,B+1)):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    # print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)


Fixed submission:
A,B,C,K = map(int,input().split())

if A+B<K:
  print(A-(K-A-B))
else:
  print(min(A, K))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = map(int,input().split())

s=-1*K*C

lc=[]
lc_=[]
for i in range(A+1):
  for j in range(K-i+1):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    # print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)


Fixed submission:
A,B,C,K = map(int,input().split())

if A+B<K:
  print(A-(K-A-B))
else:
  print(min(A, K))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = map(int,input().split())

s=-1*K*C

lc=[]
lc_=[]
for i in range(K+1):
  for j in range(K-i+1):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    # print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)


Fixed submission:
A,B,C,K = map(int,input().split())

if A+B<K:
  print(A-(K-A-B))
else:
  print(min(A, K))
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int,input().split())

ca=[list(map(int,input().split())) for _ in range(n)]

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc=+ca[j][0]
      a+=ca[j][1:]
  if min(a)>=x:
    res=min (sc,res)

if res == INF:
    print(-1)
else:
    print(res)


Fixed submission:
n,m,x = map(int,input().split())

ca=[list(map(int,input().split())) for _ in range(n)]

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc+=ca[j][0]
      for k in range(m):
        a[k]+=ca[j][k+1]
  if min(a)>=x:
    res=min(sc,res)

if res == float('inf'):
    print(-1)
else:
    print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N =int(input(''))
K=int(input(''))
A=[]
l=[]
for i in range(K):
    d = int(input(''))
    for j in range(d):
        l_ = int(input(''))
        l.append(l_)
    A.append(l)

a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)

print(np.count_nonzero(np.all(a==0, axis=1)))



Fixed submission:
import numpy as np

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

A=[]
l=[]
for _ in range(K):
    d = map(int, input())
    l=list(map(int,input().split()))
    A.append(l)
#print(A)
a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)
print(np.count_nonzero(np.all(a==0, axis=1)))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations_with_replacement

n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(q)]

# n,m,q=3,4,3
# l=[[1,3,3,100], [1,2,2,10], [2,3,2,10]]

A=list(combinations_with_replacement(range(1,m+1),n))

res=0

for i in range(len(A)):
    tmp=0
    for j in range(len(l)):
        bnum=l[j][1]-1
        anum=l[j][0]-1
        c=l[j][2]
        d=l[j][3]

        if A[i][bnum]-A[i][anum]==c:
            tmp+=d

    res=max(res, tmp)

print(res)

Fixed submission:
from itertools import combinations_with_replacement

n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(q)]

A=list(combinations_with_replacement(range(1,m+1),n))

res=0

for i in range(len(A)):
    tmp=0
    for j in range(len(l)):
        if A[i][l[j][1]-1]-A[i][l[j][0]-1]==l[j][2]:
            tmp+=l[j][3]

    res=max(res, tmp)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n=int(input())
a=deque(map(int,input().split()))

for i in range(n):
    print(a.count(i+1))
    if a.count(i+1)!=0:
        while len(a)!=0 and a[0]==i+1:
            a.popleft()

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n

for i in a:
    b[i-1]+=1

[print(i) for i in b]

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
c=0

for i in range(len(a)):
    print(a.count(i+1))
    c+=a.count(i+1)
    if c==n-1:
        break

for _ in range(n-i-1):
    print(0)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n

for i in a:
    b[i-1]+=1

[print(i) for i in b]

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
 
for i in range(n):
    print(a.count(i+1))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n

for i in a:
    b[i-1]+=1

[print(i) for i in b]

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n-1)]

for i in range(n):
    print(a.count(i+1))



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n

for i in a:
    b[i-1]+=1

[print(i) for i in b]
Buggy python submission (verdict: Time Limit Exceeded):
import math

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += math.gcd(math.gcd(a, b), c)

print(sum)


Fixed submission:
from math import gcd

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(gcd(a, b), c)

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

K = int(input())
#K = 2
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(a, b, c)

print(sum)


Fixed submission:
from math import gcd

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(gcd(a, b), c)

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
 
def gcd(*numbers):
  return reduce(math.gcd, numbers)
 
K = input('')
K=int(K)
la = lb = lc = list(range(1, K+1))
sum = 0
 
for a in range (len(la)):
  for b in range(len(lb)):
    for c in range(len(lc)):
      sum += gcd(la[a],lb[b],lc[c])
print(sum)

Fixed submission:
from math import gcd

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(gcd(a, b), c)

print(sum)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

K = input('')
la = lb = lc = list(range(1, K+1))
sum = 0

for a in range (len(la)):
  for b in range(len(lb)):
    for c in range(len(lc)):
      sum += gcd(la[a],lb[b],lc[c])

print(sum)


Fixed submission:
from math import gcd

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(gcd(a, b), c)

print(sum)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

def sumgcd(K):
for a in range (len(la)):
  for b in range(len(lb)):
    for c in range(len(lc)):
      sum += gcd(la[a],lb[b],lc[c])



Fixed submission:
from math import gcd

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(gcd(a, b), c)

print(sum)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
x=abs(n-k)

if x>k:
    print(x%k)
else:
    print(k%x)


Fixed submission:
n,k=map(int,input().split())

print(min(n%k,abs(k-n%k)))

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())

tmpx=float('inf')
x=abs(n-k)

while tmpx>x:
    tmpx=x
    x=abs(tmpx-k)

print(tmpx)


Fixed submission:
n,k=map(int,input().split())

print(min(n%k,abs(k-n%k)))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [1] * (n-k+1)
for i in range(k):
  b[0] *= a[i]
for i in range(n-k):
  b[i+1] = b[i] * a[k+i] // a[i]
  if b[i+1] > b[i]:
    print("Yes")
  else:
    print("No")

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [1] * (n-k+1)
for i in range(n-k):
  if a[k+i] > a[i]:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n - k + 1):
  b.append(1)
  for j in range(k):
    b[i] *= a[i+j]
    if b[i] > b[i-1]:
      print("Yes")
      break
  if b[i] <= b[i-1] and i != 0:
    print("No")

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [1] * (n-k+1)
for i in range(n-k):
  if a[k+i] > a[i]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
Alist = []
setA = [x for x in set(a)]
for i in setA:
  Alist.append(a.count(i))
Alist.sort()
ans = 0
for i in range(len(Alist) - k):
  ans += Alist[i]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
p =  [0] * (n + 1)
for i in a:
  p[i] += 1
p.sort()
print(sum(p[:n-k+1]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
dictA = {}
for i in a:
  if not(i in dictA.keys()):
    dictA[i] = a.count(i)

sdict = sorted(dictA.values())
ans = 0
for i in range(len(sdict) - k):
  ans += sdict[i]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
p =  [0] * (n + 1)
for i in a:
  p[i] += 1
p.sort()
print(sum(p[:n-k+1]))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
c=input()
list=[0 for i in range(n+1)]
for i in range(n+1):
  if i>0 and i<n:
    r=c.count('R',i,)
    w=c.count('W',0,i)
  if i==0:
    r=c.count('R',i,)
    w=0
  if i==n:
    r=0
    w=c.count('W')


  if r<=w:
    list[i]=w
  else:
    list[i]=r
print(min(list))

Fixed submission:
n=int(input())
c=input()
list=[0 for i in range(n+1)]
r=0
for i in range(n):
  if c[i]=='R':
    r+=1
w=0
list[0]=max(r,w)

#i corresponds to the right side boundary of c[i]
for i in range(n):
  if c[i]=='W':
    w+=1
  if c[i]=='R':
    r-=1
  list[i+1]=max(r,w)
print(min(list))

Buggy python submission (verdict: Runtime Error):
n=int(input())
c=input()
count=0

for i in range(n):
  if c[i]=='W':
    #print('when W in',i)
    s=c[i:]
    num=s.find('R')
    if num<0:
      break
    num+=i
    #print('when num ',num)
    t=c[num:]
    num_ch=t.find('W')
    if num_ch<0:
      num_ch=n-num   
    #print(num_ch)
    num_ch+=num
    
    #print('when num_ch',num_ch)
    if num-i-1<=num_ch-num:
      #print('間が小さいので塗り替える')
      for j in range(i,num):
        #print(j)
        c=c[:j]+'R'+c[j+1:]
        count+=1
    else:
      #print('間が大きいので交換する')
      for j in range(num,num_ch):
        #print(j)
        c=c[:j]+'W'+c[j+1:]
        c[i+j-num]='R'
        count+=1
#print(c)
print(count)


Fixed submission:
n=int(input())
c=input()
list=[0 for i in range(n+1)]
r=0
for i in range(n):
  if c[i]=='R':
    r+=1
w=0
list[0]=max(r,w)

#i corresponds to the right side boundary of c[i]
for i in range(n):
  if c[i]=='W':
    w+=1
  if c[i]=='R':
    r-=1
  list[i+1]=max(r,w)
print(min(list))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k=map(int,input().split())
wa=0
for i in range(k):
  if a>0:
    wa+=1
    a-=1
  else:
    if b>0:
      b-=1
    elif c>0:
      wa-=1
      c-=1
print(wa)


Fixed submission:
a,b,c,k=map(int,input().split())
if k<=a:
  ans=k
elif k>a and k<=a+b:
  ans=a
else:
  ans=a-(k-(a+b))
print(ans)
Buggy python submission (verdict: Runtime Error):
s,w=int(input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')

Fixed submission:
s,w=map(int,input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
g=[]
for i in range(n):
  gi=input()
  x = gi in g
  if x == False:
    g.append(gi)
print(len(g))

Fixed submission:
n=int(input())
g=[]
for i in range(n):
  gi=input()
  g.append(gi)  
g.sort()
count=1
for i in range(n-1):
  if g[i]!=g[i+1]:
    count+=1

print(count)