Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return ( 3 ** (len(l)-1-index) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    n = len(l)
    one = 0
    ans = 0
    for i in range(n):
        if l[i] == '1':
            ans += 2**one * 3**(n-1-i)
            ans %= MOD
            one += 1
    ans += 2**one
    ans %= MOD
    print(ans)

main()

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return ( 3 ** (len(l)-1-index) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    n = len(l)
    one = 0
    ans = 0
    for i in range(n):
        if l[i] == '1':
            ans += pow(2, one, MOD) * pow(3, n-1-i, MOD)
            ans %= MOD
            one += 1
    ans += pow(2, one, MOD)
    ans %= MOD
    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return ( 3 ** (len(l)-1-index) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    print(f(0, l))

main()

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return ( 3 ** (len(l)-1-index) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    n = len(l)
    one = 0
    ans = 0
    for i in range(n):
        if l[i] == '1':
            ans += pow(2, one, MOD) * pow(3, n-1-i, MOD)
            ans %= MOD
            one += 1
    ans += pow(2, one, MOD)
    ans %= MOD
    print(ans)

main()

Buggy python submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return (3 ** (len(l)-1-index) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    print(f(0, l))

main()

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return ( 3 ** (len(l)-1-index) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    n = len(l)
    one = 0
    ans = 0
    for i in range(n):
        if l[i] == '1':
            ans += pow(2, one, MOD) * pow(3, n-1-i, MOD)
            ans %= MOD
            one += 1
    ans += pow(2, one, MOD)
    ans %= MOD
    print(ans)

main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,M = map(int, input().split())
A = list(map(int, input().split()))  # -> li = [1,2,3,...n]
C = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = map(int, input().split())
    C[i][0] = c
    C[i][1] = b
A = sorted(A, reverse=True)
C = sorted(C, reverse=True)
cnt = 0
s = 0
ai = 0
ci = 0
while cnt < N:
    aa = A[ai]
    cc = C[ci][0]
    if aa > cc:
        s += aa
        ai += 1
    else:
        s += cc
        C[ci][1] -= 1
        if C[ci][1] == 0:
            ci += 1
    cnt += 1
print(s)


Fixed submission:
import sys
input = sys.stdin.readline
N,M = map(int, input().split())
A = list(map(int, input().split()))  # -> li = [1,2,3,...n]
C = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = map(int, input().split())
    C[i][0] = c
    C[i][1] = b
A = sorted(A, reverse=True)
C = sorted(C, reverse=True)
cnt = 0
s = 0
ai = 0
ci = 0
while cnt < N:
    aa = A[ai]
    if ci >= M:
        cc = 0
    else:
        cc = C[ci][0]
    if aa > cc:
        s += aa
        ai += 1
    else:
        s += cc
        C[ci][1] -= 1
        if C[ci][1] == 0:
            ci += 1
    cnt += 1
print(s)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,M = map(int, input().split())
A = list(map(int, input().split()))  # -> li = [1,2,3,...n]
C = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = map(int, input().split())
    C[i][0] = c
    C[i][1] = b
A = sorted(A, reverse=True)
C = sorted(C, reverse=True)
cnt = 0
s = 0
ai = 0
ci = 0
while cnt < N:
    aa = A[ai]
    cc = C[ci][0]
    if aa > cc:
        s += aa
        ai += 1
    else:
        s += cc
        C[ci][1] -= 1
        if C[ci][1] == 0:
            ci += 1
    cnt += 1
print(s)


Fixed submission:
import sys
input = sys.stdin.readline
N,M = map(int, input().split())
A = list(map(int, input().split()))  # -> li = [1,2,3,...n]
C = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = map(int, input().split())
    C[i][0] = c
    C[i][1] = b
A = sorted(A, reverse=True)
C = sorted(C, reverse=True)
cnt = 0
s = 0
ai = 0
ci = 0
while cnt < N:
    aa = A[ai]
    if ci >= M:
        cc = 0
    else:
        cc = C[ci][0]
    if aa > cc:
        s += aa
        ai += 1
    else:
        s += cc
        C[ci][1] -= 1
        if C[ci][1] == 0:
            ci += 1
    cnt += 1
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = 1
ans = 0
while x < n:
    if ((n-x) % x) == 0:
        m = (n-x) // x
        if m <= x:
            break
        ans += m
    x += 1
print(ans)

Fixed submission:
n = int(input())
x = 1
ans = 0
while x < n:
    m = (n - x) // x
    if m <= x:
        break
    if ((n-x) % x) == 0:
        ans += m
    x += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)


def dp(i, j):
    if i == 0:
        if j:
            return -float('inf')
        else:
            return 0
    if j:
        return max(dp(i-1, False) - a[i-1], dp(i-1, True) + a[i-1])
    else:
        return max(dp(i-1, False) + a[i-1], dp(i-1, True) - a[i-1])


n = int(input())
a = list(map(int, input().split()))
print(dp(n, False))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = 0
z = False
for aa in a:
    if aa < 0:
        c += 1
    elif aa == 0:
        z = True
if z or c % 2 ==0:
    print(sum(map(abs, a)))
else:
    ab = [abs(x) for x in a]
    ans = sum(ab) - min(ab)*2
    print(ans)

Buggy python submission (verdict: Runtime Error):
def dp(i, j):
    if i == 0:
        if j:
            return -float('inf')
        else:
            return 0
    if j:
        return max(dp(i-1, False) - a[i-1], dp(i-1, True) + a[i-1])
    else:
        return max(dp(i-1, False) + a[i-1], dp(i-1, True) - a[i-1])


n = int(input())
a = list(map(int, input().split()))
print(dp(n, False))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = 0
z = False
for aa in a:
    if aa < 0:
        c += 1
    elif aa == 0:
        z = True
if z or c % 2 ==0:
    print(sum(map(abs, a)))
else:
    ab = [abs(x) for x in a]
    ans = sum(ab) - min(ab)*2
    print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
b = 0
w = 0
for i in range(n):
    if s[i] == '.':
        b += 1
    else:
        w += 1
print(min(b, w))

Fixed submission:
n = int(input())
s = input()
b = 0
w = 0
for i in range(n):
    if s[i] == '.':
        b = min(b,w) + 1
    else:
        b = min(b, w)
        w += 1
print(min(b, w))
Buggy python submission (verdict: Runtime Error):
n=int(input())
li = [int(input()) for _ in range(n)]  # li = ['hoge', 'bar', 'foo']

m = li.sort()[0]
ans = 0
if n % m == 0:
    ans += n//m
else:
    ans += n//m + 1
ans += 4
print(ans)

Fixed submission:
n=int(input())
li = [int(input()) for _ in range(5)]  # li = ['hoge', 'bar', 'foo']

li.sort()
m = li[0]
ans = 0
if n % m == 0:
    ans += n//m
else:
    ans += n//m + 1
ans += 4
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n, m, q = map(int, input().split())
t = [ [0] * (n+1) for _ in range(n+1) ]
qq = []
for _ in range(m):
    l, r = map(int, input().split())
    t[l][r] += 1
for _ in range(q):
    tmp = list(map(int, input().split()))
    qq.append(tmp)

s = [ [0] * (n+1) for _ in range(n+1) ]
for i in range(1, n+1):
    tmp = 0
    for j in range(1, n+1):
        tmp += t[i][j]
        s[j][i] = tmp

x = [ [0] * (n+1) for _ in range(n+1) ]
for i in range(1, n+1):
    for j in range(i, n+1):
        tmp = 0
        for k in range(i, j+1):
            tmp += s[j][k]
        x[i][j] = tmp

for qqq in qq:
    print(x[qqq[0]][qqq[1]])

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

n, m, q = map(int, input().split())
t = [ [0] * (n+1) for _ in range(n+1) ]
qq = []
for _ in range(m):
    l, r = map(int, input().split())
    t[l][r] += 1
for _ in range(q):
    tmp = list(map(int, input().split()))
    qq.append(tmp)

s = [ [0] * (n+1) for _ in range(n+1) ]
for i in range(1, n+1):
    tmp = 0
    for j in range(1, n+1):
        tmp += t[i][j]
        s[j][i] = tmp

x = [ [0] * (n+1) for _ in range(n+1) ]
for i in range(1, n+1):
    for j in range(i, n+1):
        tmp = 0
        for k in range(i, j+1):
            tmp += s[j][k]
        x[i][j] = tmp

for qqq in qq:
    print(x[qqq[0]][qqq[1]])
Buggy python submission (verdict: Time Limit Exceeded):
N, C = map(int, input().split())
d = []
for i in range(C):
    tmp = [int(x) for x in input().split()]
    d.append(tmp)

c = []
for i in range(N):
    tmp = [int(x)-1 for x in input().split()]
    c.append(tmp)

x = [[], [], []] # 0,1,2
for cc in range(C):
    tx = [0] * 3
    for i in range(N):
        for j in range(N):
            tx[(i+j)%3] += d[c[i][j]][cc]
    for i in range(3):
        x[i].append(tx[i])

ans = 10 ** 9
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i == j or j == k or k == i:
                continue
            tmp = x[0][i] + x[1][j] + x[2][k]
            if tmp < ans:
                ans = tmp
print(ans)

Fixed submission:
N, C = map(int, input().split())
d = []
for i in range(C):
    tmp = [int(x) for x in input().split()]
    d.append(tmp)

c = []
for i in range(N):
    tmp = [int(x)-1 for x in input().split()]
    c.append(tmp)

x = [[], [], []] # 0,1,2
for cc in range(C):
    tx = [0] * 3
    for i in range(N):
        for j in range(N):
            tx[(i+j)%3] += d[c[i][j]][cc]
    for i in range(3):
        x[i].append(tx[i])

ans = 10 ** 9
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i == j or j == k or k == i:
                continue
            tmp = x[0][i] + x[1][j] + x[2][k]
            if tmp < ans:
                ans = tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans_lis = []
for i in range(1,10**6):
    if N%i==0:
        ans_lis.appe
        nd(i+(N//i))
print(min(ans_lis)-2)


Fixed submission:
N = int(input())

ans_lis = []
for i in range(1,10**7):
    if N%i==0:
        ans_lis.append(i+(N//i))
print(min(ans_lis)-2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_lis = list(map(int, input().split()))

order = ""
for i in range(len(A_lis)):
    order+=str(A_lis.index(i+1)+1)
    order+=" "
print(order)


Fixed submission:
import numpy as np

N = int(input())
A_lis = list(map(int, input().split()))

order = np.argsort(A_lis)

ans = ""
for elem in order:
    ans+=str(elem+1)
    ans+=" "
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A_lis = [int(input()) for _ in range(Q)]

for i in range(N):
    if K-Q+A_lis.count(i+1)>0:
        print("Yes")
    else:
        print("No")


Fixed submission:
N, K, Q = map(int, input().split())
A_lis = [int(input()) for _ in range(Q)]
#A_lis.sort()

B_lis = [int(K-Q)]*N
for A in A_lis:
    B_lis[A-1]+=1
for B in B_lis:
    if B>0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A_lis = [int(input()) for _ in range(Q)]

score = [K]*N
for A in A_lis:
    for i in range(len(score)):
        if i!=A-1:
            score[i]-=1
for i in range(len(score)):
    if score[i]>0:
        print("Yes")
    else:
        print("No")


Fixed submission:
N, K, Q = map(int, input().split())
A_lis = [int(input()) for _ in range(Q)]
#A_lis.sort()

B_lis = [int(K-Q)]*N
for A in A_lis:
    B_lis[A-1]+=1
for B in B_lis:
    if B>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A_lis = list(map(int, input().split()))
#A_lis.sort()

def discount(B_lis,delta):
    #B_lis.sort()
    max_index = B_lis.index(max(B_lis))
    delta[max_index] += B_lis[max_index]/2
    B_lis[max_index] = B_lis[max_index]/2
    #B_lis.sort()
    return B_lis,delta

dis = [0]*N
for i in range(M):
    A_lis,dis = discount(A_lis,dis)
    #print(A_lis)
    #print(dis)

ans = 0
for i in range(len(A_lis)):
    ans+=int(A_lis[i])
print(ans)


Fixed submission:
import heapq

N,M = map(int, input().split())
A_lis = list(map(lambda x: int(x)*(-1), input().split()))

heapq.heapify(A_lis)

def discount(A_lis):
    popped = heapq.heappop(A_lis)
    heapq.heappush(A_lis,popped/2)
    return A_lis

for i in range(M):
    A_lis = discount(A_lis)
ans = 0
for i in A_lis:
    ans += int(i)
print(ans*(-1))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

def binomial_coeffs1(n, k):
    #top down DP
    if (k == 0 or k == n):
        return 1
    if (memo[n][k] != -1):
        return memo[n][k]

    memo[n][k] = binomial_coeffs1(n-1, k-1) + binomial_coeffs1(n-1, k)
    return memo[n][k]

memo = [[-1 for i in range(2010)] for j in range(2010)]
for i in range(1, K+1):
    print(binomial_coeffs1(N-K+1, i)*binomial_coeffs1(K-1, i-1))


Fixed submission:
N, K = map(int, input().split())

def make_comb_dp(n):
    dp = [[0] * (n + 1) for i in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 1
        dp[i][i] = 1
    for i in range(2, n + 1):
        for j in range(1, i):
            dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]
    return dp

nCk = make_comb_dp(2000)
for i in range(1, K+1):
    print(int(nCk[N-K+1][i]*nCk[K-1][i-1])%(10 ** 9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
memo = []
cnt = 0
for i in range(N):
    next = a_lis[now-1]
    if next in memo:
        print(-1)
        flag = 0
        break
    else:
        memo.append(next)
        now = next
    cnt+=1
    if next ==2:
        print(cnt)
        break


Fixed submission:
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
cnt = 0
while cnt<N and next!=2:
    cnt+=1
    next = a_lis[now-1]
    now = next
if next==2:print(cnt)
else:print(-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
memo = []
cnt = 0
for i in range(N)
    next = a_lis[now-1]
    if next in memo:
        print(-1)
        flag = 0
        break
    else:
        memo.append(next)
        now = next
    cnt+=1
    if next ==2:
        print(cnt)
        break


Fixed submission:
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
cnt = 0
while cnt<N and next!=2:
    cnt+=1
    next = a_lis[now-1]
    now = next
if next==2:print(cnt)
else:print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
memo = []
cnt = 0
while flag:
    next = a_lis[now-1]
    if next in memo:
        print(-1)
        flag = 0
        break
    else:
        memo.append(next)
        now = next
    cnt+=1
    if next ==2:
        print(cnt)
        break


Fixed submission:
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
cnt = 0
while cnt<N and next!=2:
    cnt+=1
    next = a_lis[now-1]
    now = next
if next==2:print(cnt)
else:print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
memo = []
cnt = 0
while flag:
    next = a_lis[now-1]
    if next in memo:
        print(-1)
        break
    else:
        memo.append(next)
        now = next
    cnt+=1
    if next ==2:
        print(cnt)
        break


Fixed submission:
N = int(input())
a_lis = [int(input()) for _ in range(N)]

now = 1
flag = 1
cnt = 0
while cnt<N and next!=2:
    cnt+=1
    next = a_lis[now-1]
    now = next
if next==2:print(cnt)
else:print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
#B - Between a and b ...
a,b,x = map(int, input().split())

if a==b:
    if a%x==0:
        print(1)
    else:
        print(0)
else:
    min_dev = 0
    for i in range(a,b+1):
        if i%x==0:
            min_dev = i
            break

    max_dev = 0
    for i in range(a,b+1)[::-1]:
        if i%x==0:
            max_dev = i
            break

    print((max_dev-min_dev)//x+1)


Fixed submission:
#B - Between a and b ...
import math
a,b,x = map(int, input().split())

if a==b:
    if a%x==0:
        print(1)
    else:
        print(0)
else:
    """
    min_dev = 0
    for i in range(a,b+1):
        if i%x==0:
            min_dev = i
            break
    """
    if a==0:
        min_dev=0
    else:
        min_dev = math.ceil(a/x)

    """
    max_dev = 0
    for i in range(a,b+1)[::-1]:
        if i%x==0:
            max_dev = i
            break
    """
    max_dev = int(b//x)
    print(max_dev-min_dev+1)
Buggy python submission (verdict: Runtime Error):

tmp = []

for i in range(1,10):
  for l in range(1,10):
    tmp.append(i*l)

cnt = 0
    
for n in tmp:
  if n == x:
    cnt += 1
    
if cnt == 0:
  print("No")
else:
  print("Yes")

Fixed submission:
x = int(input())

tmp = []

for i in range(1,10):
  for l in range(1,10):
    tmp.append(i*l)

cnt = 0
    
for n in tmp:
  if n == x:
    cnt += 1
    
if cnt == 0:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

box = list(itertools.combinations(L,3))

ans = 0

for l in box:
  if l[0]+l[1] > l[2] and l[1]+l[2] > l[0] and l[2]+l[0] > l[1]:
    ans += 1

print(ans)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split()))
L = sorted(L)

count = 0
for n in range(N-2):
    for m in range(n+1,N-1):
        count += bisect.bisect_left(L,L[m]+L[n]) - (m + 1)

print(count)
Buggy python submission (verdict: Runtime Error):
x = input().split()
y = input().split()

cnt = 0

for i in y:
  if i >= int(x[1]):
    cnt += 1
    
print(cnt)

Fixed submission:
x = input().split()
y = input().split()

cnt = 0

for i in y:
  if int(i) >= int(x[1]):
    cnt += 1
    
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  for i,point in enumerate(member):
    if (int(y)-1) != i:
      member[i] = (point -1)
      
for z in member:
  if z > 0:
    print("Yes")
  else:
    print("No")

Fixed submission:
x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  member[int(y) - 1] += 1
      
for z in member:
  if (z - int(x[2])) > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
y = [int(input()) for i in range(int(x[2]))]
member = [int(x[1])] * int(x[0])

for l in y:
  for i,point in enumerate(member):
    if (l-1) != i:
      member[i] = (point -1)
      
for z in member:
  if z > 0:
    print("Yes")
  else:
    print("No")


Fixed submission:
x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  member[int(y) - 1] += 1
      
for z in member:
  if (z - int(x[2])) > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
y = [int(input()) for i in range(int(x[2]))]
member = [int(x[1])] * int(x[0])

for l in y:
  for i,point in enumerate(member):
    if (l-1) != i:
      member[i] = (point -1)
      
for z in member:
  if z > 0:
    print("Yes")
  else:
    print("No")


Fixed submission:
x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  member[int(y) - 1] += 1
      
for z in member:
  if (z - int(x[2])) > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
x = input().split()
y = [int(input()) in i in range(int(x[2]))]
member = [int(x[1])] * int(x[0])

for l in y:
  for i,point in enumerate(member):
    if (l-1) != i:
      member[i] = (point -1)
      
for z in member:
  if z > 0:
    print("Yes")
  else:
    print("No")

Fixed submission:
x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  member[int(y) - 1] += 1
      
for z in member:
  if (z - int(x[2])) > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
y = []
member = [int(x[1])] * int(x[0])
for i in range(int(x[2])):
  tmp = input()
  y.append(int(tmp))

for l in y:
  for i,point in enumerate(member):
    if (l-1) != i:
      member[i] = (point -1)
      
for z in member:
  if z > 0:
    print("Yes")
  else:
    print("No")

Fixed submission:
x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  member[int(y) - 1] += 1
      
for z in member:
  if (z - int(x[2])) > 0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
x = [input().split() for i in range(M)]
y = [[] for _ in range(M)]
z = [0 for _ in range(M)]

for i in x:
  y[int(i[0])-1].append(int(i[1])-1)
  y[int(i[1])-1].append(int(i[0])-1)

tmp = y[0]
ans = 0
cnt = 0

while True:
  if cnt != N - 1:
    tmp2 = []
    for l in tmp:
      if z[l] == 0:
        z[l] += 1
        for n in y[l]:
          tmp2.append(n)
    tmp = tmp2
    cnt += 1
  else:
    ans = len(tmp)
    break

print(ans)

Fixed submission:
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(M)]

adj = [[] for _ in range(N)]
for a,b in ab:
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)
    

def dfs(x,s,flags):
    vlist = adj[x]
    flags = list(flags)
    flags[x] = False
    flags = tuple(flags)
    if sum(flags) == 0:
        return 1
    s = 0
    for v in vlist:    
        if flags[v]:
            s += dfs(v,s,flags)
    return s        

Flag = [True] * N
Flag[0] = False
ans = dfs(0,0,tuple(Flag))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(n / 2)

divs = []

for i in range(m):
  if i == 0:
    continue
  mod = n % i
  if mod == 0:
    an = int(n/i)
    if i <= an:
      divs.append(i)
      divs.append(an)
    else:
      break

max = len(divs) -1
print(divs[max] + divs[max-1] - 2)

Fixed submission:
n = int(input())

divs = []

for i in range(1, int(n**0.5)+1):
  if n % i == 0:
      divs.append(i)
      divs.append(n // i)

max = len(divs) -1
print(divs[max] + divs[max-1] - 2)

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

divs = []

for i in range(n + 1):
  if i == 0:
    continue
  mod = n % i
  if mod == 0:
    divs.append(i)

center = int(len(divs) / 2)
print(divs[center-1] + divs[center] -2)

Fixed submission:
n = int(input())

divs = []

for i in range(1, int(n**0.5)+1):
  if n % i == 0:
      divs.append(i)
      divs.append(n // i)

max = len(divs) -1
print(divs[max] + divs[max-1] - 2)
Buggy python submission (verdict: Runtime Error):
weather = ["Sunny", "Cloudy", "Rainy"]
s = input()

print(weather[weather.index(s) + 1])

Fixed submission:
weather = ["Sunny", "Cloudy", "Rainy"]
s = input()
next = weather.index(s) + 1

if next >= len(weather):
  print(weather[0])
else:
  print(weather[next])