Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

a = list(map(int,input().split()))
a.sort()

for i in range(m):
  a[n-1] = int(a[n-1]//2)
  a.sort()

res = 0
for i in a:
  res += i
  
print(res)

Fixed submission:
import heapq

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

a = list(map(int,input().split()))
b = list(map(lambda x:-x,a))

heapq.heapify(b)

for i in range(m):
  tmp = heapq.heappop(b)
  heapq.heappush(b,int(tmp/2))

res = 0

for i in range(n):
  
  res += heapq.heappop(b)
  
print(-res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

s = []
for nk in range(n):
  tmp = list(input())
  tmp.sort()
  mo = ''
  for i in tmp:
    mo += i

  s.append(mo)

s.sort()
count =0
for i in range(n):
  for j in range(i+1,n):
    if s[i] == s[j]:
      count += 1
    else:
      break
      
print(count)

Fixed submission:
n = int(input())

s = []
for nk in range(n):
  tmp = list(input())
  tmp.sort()
  mo = ''
  for i in tmp:
    mo += i

  s.append(mo)

def comb(x):
  res = x*(x-1)/2
  return res
  
s.sort()
tc = 1
l = []
ans = 0

for i in range(1,n):
  if s[i-1] == s[i]:
    tc += 1

  else:
    if tc >= 2 :
      ans += comb(tc)
      tc = 1

if tc >= 2 :
  ans += comb(tc)
  tc = 1

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

s = []
for nk in range(n):
  tmp = list(input())
  tmp.sort()
  mo = ''
  for i in tmp:
    mo += i

  s.append(mo)
  
count =0
for i in range(n):
  for j in range(i+1,n):
    if s[i] == s[j]:
      count += 1
      
print(count)

Fixed submission:
n = int(input())

s = []
for nk in range(n):
  tmp = list(input())
  tmp.sort()
  mo = ''
  for i in tmp:
    mo += i

  s.append(mo)

def comb(x):
  res = x*(x-1)/2
  return res
  
s.sort()
tc = 1
l = []
ans = 0

for i in range(1,n):
  if s[i-1] == s[i]:
    tc += 1

  else:
    if tc >= 2 :
      ans += comb(tc)
      tc = 1

if tc >= 2 :
  ans += comb(tc)
  tc = 1

print(int(ans))
Buggy python submission (verdict: Runtime Error):
s = list(input())
l = [0 for _ in range(len(s))]

for i in range(len(s)-1):
  if s[i] == 'R' and s[i+1] == 'L':
    m = i-1
    n = i+2
    rc = lc = 1
    while s[m] == 'R':
      rc += 1
      if m-1 > 0 : 
        m -= 1
      else:
        break
    while s[n] == 'L':
      lc += 1
      if n+1 < len(s)-1:
        n += 1
      else:
        break
    
    l[i] = lc//2 + lc % 2 + rc//2
    l[i+1] = rc//2 + rc%2 + lc//2

print(l)
  

Fixed submission:
s = list(input())
l = [0 for _ in range(len(s))]

for i in range(len(s)-1):
  if s[i] == 'R' and s[i+1] == 'L':
    rc = lc = 1
    if i-1 >= 0 : 
      m = i-1
    
      while s[m] == 'R':
        lc += 1
        if m-1 >= 0 : 
          m -= 1
        else:
          break
    
    if i+2 <=  len(s)-1:
      n = i+2
      
      while s[n] == 'L':
        rc += 1
        if n+1 <= len(s)-1:
          n += 1
        else:
          break

    l[i] = lc//2 + lc% 2 + rc//2
    l[i+1] = rc//2 + rc%2 + lc//2
    
for i in range(len(l)):
  print(l[i], end = ' ')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  a.append(list(map(int,input().split())))

a.sort(key=lambda x: x[1])

q = 0
w = 0
flg = 0
for j in range(n):
  q += j[0]
  w += j[1]
  if q > w :
    flg = 1
    break

if flg == 0:
  print('Yes')
else:
  print('No')
  

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

a.sort(key=lambda x: x[1])

q = 0
w = 0
flg = 0
for j in a:
  q += j[0]
  w = j[1]
  if q > w :
    flg = 1
    break

if flg == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
M = 10**9 + 7
cnt = 0
for i in range(N):
    cnt += A[i] * sum(A[i+1:])
print(cnt%M)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
M = 10**9 + 7

S = sum(A)
S2 = sum(map(lambda x: x**2, A))
print(((S**2 - S2)// 2)%M)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations, combinations, product
import numpy as np

N = int(input())
A = list(map(int, input().split()))
# S = np.array(list(combinations(A,2)))
M = 10**9 + 7
cnt = 0
for i in range(N):
    cnt += A[i] * sum(A[i+1:])
print(cnt%M)



Fixed submission:
n = int(input())
A = list(map(int, input().split()))
M = 10**9 + 7

S = sum(A)
S2 = sum(map(lambda x: x**2, A))
print(((S**2 - S2)// 2)%M)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations, combinations, product
import numpy as np

N = int(input())
A = list(map(int, input().split()))
S = np.array(list(combinations(A,2)))
M = 10**9 + 7

cnt = sum(np.product(S, axis=1)) % M

print(cnt)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
M = 10**9 + 7

S = sum(A)
S2 = sum(map(lambda x: x**2, A))
print(((S**2 - S2)// 2)%M)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
root = [-1] * n

def find_root(x):
    if root[x] < 0:
        return x
    else:
        root[x] == find_root(root[x])
        return root[x]

def unite(x, y):
    x = find_root(x)  
    y = find_root(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find_root(x)
    return -root[x]

for i in range(m):
    x, y = map(int,input().split())
    x -= 1
    y -= 1
    unite(x, y)

max_size = max(map(size, range(n)))

print(max_size)


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
root = [-1] * n

def find_root(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find_root(root[x])
        return root[x]

def unite(x, y):
    x = find_root(x)  
    y = find_root(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find_root(x)
    return -root[x]

for i in range(m):
    x, y = map(int,input().split())
    x -= 1
    y -= 1
    unite(x, y)

max_size = max(map(size, range(n)))

print(max_size)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
root = [-1] * n

def find_root(x):
    if root[x] < 0:
        return x
    else:
        root[x] == find_root(root[x])
        return root[x]

def unite(x, y):
    x = find_root(x)  
    y = find_root(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find_root(x)
    return -root[x]

for i in range(m):
    x, y = map(int,input().split())
    x -= 1
    y -= 1
    unite(x, y)

max_size = max(map(size, range(n)))

print(max_size)


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
root = [-1] * n

def find_root(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find_root(root[x])
        return root[x]

def unite(x, y):
    x = find_root(x)  
    y = find_root(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find_root(x)
    return -root[x]

for i in range(m):
    x, y = map(int,input().split())
    x -= 1
    y -= 1
    unite(x, y)

max_size = max(map(size, range(n)))

print(max_size)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
point = list(map(int, input().split()))

L = []
cnt = 1
for i in range(N-K+1):
    for j in range(K):
        cnt = cnt*point[j+i]
    L.append(cnt)
    cnt = 1

for k in range(N-K):
    if L[k] > L[k+1]:
        print("No")
    elif L[k] == L[k+1]:
        print("No")
    else:
        print("Yes")



Fixed submission:
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 python submission (verdict: Runtime Error):
n = int(input())
given_a = list(map(int, input().split()))

money = 1000
kabu = 0

a = []
for kabuka in given_a:
    if len(a) > 0 and a[-1] == kabuka:
        continue
    else:
        a.append(kabuka)

n = len(a)
for i in range(n):
    if i == 0:
        if a[i+1] < a[i]:
            continue
        else:
            kabu += money // a[i]
            money %= a[i]
    elif i == n-1:
        money += kabu * a[i]
        kabu = 0
    else:
        if a[i-1] < a[i] and a[i] > a[i+1]:
            money += kabu * a[i]
            kabu = 0
        if a[i-1] > a[i] and a[i] < a[i+1]:
            kabu += money // a[i]
            money %= a[i]

print(money)




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

money = 1000
kabu = 0

a = []
for kabuka in given_a:
    if len(a) > 0 and a[-1] == kabuka:
        continue
    else:
        a.append(kabuka)

n = len(a)
if n == 1:
    print(money)
    exit()


for i in range(n):
    if i == 0:
        if a[i+1] < a[i]:
            continue
        else:
            kabu += money // a[i]
            money %= a[i]
    elif i == n-1:
        money += kabu * a[i]
        kabu = 0
    else:
        if a[i-1] < a[i] and a[i] > a[i+1]:
            money += kabu * a[i]
            kabu = 0
        if a[i-1] > a[i] and a[i] < a[i+1]:
            kabu += money // a[i]
            money %= a[i]

print(money)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0]*n
tmp = []

for x in range(1, int(n**0.5) +1):
    for y in range(1, int(n**0.5)+1):
        for z in range(1, int(n**0.5)+1):
            tmp.append(x**2+y**2+z**2+x*y+y*z+z*x)

cnt = collections.Counter(tmp)

for i in range(1, n+1):
    print(cnt[i])
    


Fixed submission:
import collections
import sys
input=sys.stdin.readline

n=int(input())
ans=[0]*n
tmp=[]
for x in range(1,int(n**0.5)+1): #可能なすべてのx,y,zについてx^2+y^2+z^2+xy+yz+zxの値を求める
   for y in range(1,int(n**0.5)+1):
       for z in range(1,int(n**0.5)+1):
           tmp.append(x**2+y**2+z**2+x*y+y*z+z*x)
cnt=collections.Counter(tmp) #x^2+y^2+z^2+xy+yz+zxの値の個数を数える
for i in range(1,n+1): #各iについて、x^2+y^2+z^2+xy+yz+zxの値がiであるものの個数が答えとなる
   print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
cnt = 0

for i in range(n):
    if l[i] <= min(l[:i+1]):
        cnt += 1
print(cnt)




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

cnt = 0
minimun = max(l)
for i in range(n):
    if l[i] <= minimun:
        cnt += 1
        minimun = l[i]
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import combinations

N = int(input())
S = input()
 
l = list(combinations(S,3))
print(len(Counter(l)))

Fixed submission:
N = int(input())
S = input()

cnt = 0

for i in range(10):
    x100 = S.find(str(i))
    if x100 == -1:
        continue
    for j in range(10):
        x10 = S.find(str(j), x100 + 1)
        if x10 == -1:
            continue
        for k in range(10):
            if S.find(str(k), x10 + 1) != -1:
                cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations
from itertools import permutations
from math import factorial


N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
L = np.array(list(permutations(a,3)))
cnt = 0
for i, j, k in L:
    cnt += sum(diff**2 for diff in i -j)**.5 + sum(diff**2 for diff in j -k)**.5
print(cnt/len(L))






Fixed submission:
from itertools import permutations
from math import sqrt, pow, factorial

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

def calc(a, b):
    [x1, y1] = a
    [x2, y2] = b
    return sqrt(pow(x1 - x2, 2) + pow(y1 -y2, 2))
ans = 0
for order in permutations(range(N)):
    tmp = 0
    for i in range(1, N):
        tmp += calc(l[order[i]], l[order[i-1]])
    ans += tmp
print(ans/factorial(N))

Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations
from itertools import permutations
from math import factorial


N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
print(a)
print(list(permutations(a,3)))
L = np.array(list(permutations(a,3)))
print(L)
cnt = 0
for i, j, k in L:
    cnt += sum(diff**2 for diff in i -j)**.5 + sum(diff**2 for diff in j -k)**.5
print(cnt/len(L))






Fixed submission:
from itertools import permutations
from math import sqrt, pow, factorial

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

def calc(a, b):
    [x1, y1] = a
    [x2, y2] = b
    return sqrt(pow(x1 - x2, 2) + pow(y1 -y2, 2))
ans = 0
for order in permutations(range(N)):
    tmp = 0
    for i in range(1, N):
        tmp += calc(l[order[i]], l[order[i-1]])
    ans += tmp
print(ans/factorial(N))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(int(input()) for i in  range(m))

p = 10**9+7
dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    dp[i] = (dp[i-1] + dp[i-2])%p
    if i in a:
        dp[i] = 0
print(dp[n])



Fixed submission:
n, m = map(int, input().split())
a = set(list(int(input()) for i in  range(m)))

p = 10**9+7
dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    dp[i] = (dp[i-1] + dp[i-2])%p
    if i in a:
        dp[i] = 0
print(dp[n])
Buggy python submission (verdict: Runtime Error):
N = input()
S = input()
K =int(Input())

for s in S: print(s if s ==  S[K-1] else "*". end = "")

Fixed submission:
N = input()
S = input()
k = int(input())

for s in S: print(s if s == S[k-1] else "*", end="")
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
l = [i for i in range(A, B+1)]
del l[K:-K]
print(*l, sep='\n')
    

Fixed submission:
a, b, k = map(int, input().split())
r = range(a, b+1)
print(*sorted(set(r[:k]) | set(r[-k:])), sep='\n')
Buggy python submission (verdict: Runtime Error):
n = input()
print("Yes" if n[0] == n[2] else "No)

Fixed submission:
n= input()
print("Yes" if n[0] == n[2] else "No")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations,combinations

N, K = map(int, input().split())
L = list(map(int, input().split()))
P = list(combinations(L, K))
maximum = 0
for p in P:
    maximum = max(maximum, sum(p))
print(maximum)


Fixed submission:
n, k = map(int, input().split())
L = list(map(int,input().split()))
print(sum(sorted(L, reverse=True)[:k]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import queue

N = int(input())
d = list(map(int, input().split()))
b = []
for i in d:
    b.append(i)
    b.reverse()
print(*b)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print(*A[::-2],*A[N%2::2])
Buggy python submission (verdict: Runtime Error):
import math
print(math.factorial(int(input))%(10**9 + 7))

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))

Buggy python submission (verdict: Runtime Error):
import math
print(math.factorial(int(input)))

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

N = factorial(int(input()))
i = 2
ans = dict()
n = N
while i*i <= N:
    while n%i ==0:
        n = n//i
        if i in ans:
            ans[i] += 1
        else:
            ans[i] = 1
    i += 1
if n != 1:
    ans[n] = 1

cnt = 1
for value in ans.values():
    cnt *= value + 1
M = 10**9 + 7    
print(cnt%M)

Fixed submission:
from math import factorial
N = factorial(int(input()))
mod = 10**9 + 7
ans = 1
i = 2

while i*i <= N:
    cnt = 1
    while N%i == 0:
        cnt += 1
        N //= i
    ans *= cnt
    i += 1

if N != 1:
    ans *= 2
print(int(ans%mod))

Buggy python submission (verdict: Runtime Error):
from math import factorial
from sympy import divisors

N = factorial(int(input()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

print(len(make_divisors(N)))

Fixed submission:
from math import factorial
N = factorial(int(input()))
mod = 10**9 + 7
ans = 1
i = 2

while i*i <= N:
    cnt = 1
    while N%i == 0:
        cnt += 1
        N //= i
    ans *= cnt
    i += 1

if N != 1:
    ans *= 2
print(int(ans%mod))
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if 0<= i <= K and 0<= j <= K and 0<=k<=K and i+j+k == S:
                cnt += 1
print(cnt)


Fixed submission:
K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S-i-j <= K:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
N, L = map(int, input().split())
S = [input() for _ in range(N)]
p = list(permutations(S))

print(*sorted(p)[0], sep='')

Fixed submission:
n, l = map(int, input().split())
s = [input() for i in range(n)]
print(*sorted(s), sep="")
Buggy python submission (verdict: Runtime Error):
s = list(input())

length = len(s)

print(s)
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        ans += 1

print(ans)



Fixed submission:
s = list(input())

length = len(s)
ans= 0
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(input())
s_re = s[::-1]
ans =0
for i in range(s//2):
    if s[i] != s_re[i]:
        ans += 1
print(ans)


Fixed submission:
s = list(input())

length = len(s)
ans= 0
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
tmp = a[0]
tmp0 = tmp
x = 0

for i in range(k-1):
    tmp = a[tmp-1]
    if tmp == tmp0:
        x = i
        break

ans = a[0]
for i in range(k % x):
    ans = a[ans-1]
print(ans)


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = []
x = [0] * n
x.append(0)
v = 1
c = 1
l = 0
while x[v] == 0:
    x[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - x[v]
l = x[v]


if k < l:
    print(s[k])
else:
    k -= l
    k = k % c
    print(s[l+k])
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())


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


ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for l in range(1, k + 1):
            ans += gcd(gcd(i, j), l)
print(ans)


Fixed submission:
k = int(input())


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


ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for l in range(1, k + 1):
            ans += gcd(gcd(i, j), l)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

k = int(input())

ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for m in range(1, k + 1):
            ans += np.gcd.reduce([np.gcd.reduce([i, j]), m])
print(ans)


Fixed submission:
k = int(input())


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


ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for l in range(1, k + 1):
            ans += gcd(gcd(i, j), l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

ans = 0

while (n > 0):
    for i in range(a):
        if n < 1:
            break
        else:
            n -= 1
            ans += 1
    for i in range(b):
        if n < 1:
            break
        else:
            n -= 1

print(ans)


Fixed submission:
n, a, b = map(int, input().split())
tmp = (n % (a+b))

if a == 0:
    print('0')
elif tmp == 0:
    print(a * (n // (a+b)))
else:
    if tmp < a:
        print(a * (n // (a+b)) + tmp)
    else:
        print(a * (n // (a+b)) + a)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

s = ''
blue = 'b' * a
red = 'r' * b

while (len(s) <= n):
    s += blue
    s += red

tmp = s[0:n]

print(tmp.count('b'))


Fixed submission:
n, a, b = map(int, input().split())
tmp = (n % (a+b))

if a == 0:
    print('0')
elif tmp == 0:
    print(a * (n // (a+b)))
else:
    if tmp < a:
        print(a * (n // (a+b)) + tmp)
    else:
        print(a * (n // (a+b)) + a)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

s = ''

while (len(s) <= n):
    s += 'b' * a
    s += 'r' * b

tmp = s[0:n]

print(tmp.count('b'))


Fixed submission:
n, a, b = map(int, input().split())
tmp = (n % (a+b))

if a == 0:
    print('0')
elif tmp == 0:
    print(a * (n // (a+b)))
else:
    if tmp < a:
        print(a * (n // (a+b)) + tmp)
    else:
        print(a * (n // (a+b)) + a)

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

s = ''

while (len(s) <= n):
    for i in range(a):
        s += 'b'
    for i in range(b):
        s += 'r'

tmp = s[0:n]

print(tmp.count('b'))


Fixed submission:
n, a, b = map(int, input().split())
tmp = (n % (a+b))

if a == 0:
    print('0')
elif tmp == 0:
    print(a * (n // (a+b)))
else:
    if tmp < a:
        print(a * (n // (a+b)) + tmp)
    else:
        print(a * (n // (a+b)) + a)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
n, k, q = map(int, input().split())
a = []

for i in range(n):
    a.append(k)

for i in range(q):
    b = int(input())
    for j in range(n):
        if j != (b - 1):
            a[j] -= 1

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


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
n, k, q = map(int, input().split())
a = []

for i in range(n):
    a.append(k - q)

for i in range(q):
    b = int(input())
    a[b - 1] += 1

for i in range(n):
    if a[i] > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if c - (a - b) <= 0:
    print(0)
else:
    print(c - (a-b))


Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split())).sort()
print(sum(P[:K]))


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
ans = 0
for p in P[:K]:
    ans += p
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = ""
while N > 26:
    N, mod = divmod(N, 26)
    if mod == 0: mod = 26 
    ans += chr(96+mod)
    if N < 27:break
ans += chr(96+mod) 
print(ans[::-1])

Fixed submission:
N = int(input())
ans = ""
while N > 0:
    N -= 1
    ans += chr(97 + N%26)
    N //= 26
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = ""
while N > 26:
    N, mod = divmod(N, 26)
    if mod == 0: mod = 26 
    print(N,mod)
    ans += chr(96+mod)
    if N < 27:break
ans += chr(96+mod) 
print(ans[::-1])

Fixed submission:
N = int(input())
ans = ""
while N > 0:
    N -= 1
    ans += chr(97 + N%26)
    N //= 26
print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
print("Yes" if 2*Y <= X <= 4*Y and Y%2 == 0 else "No")

Fixed submission:
x_list = list(map(int, input().split()))
for i, num in enumerate(x_list):
    if num == 0:
        print(i+1)
        break
Buggy python submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))
M = 2*10**5+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)


Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
M = 10**6+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)