Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, A, B = map(int, input().split())

cnt = []
for n in range(10 ** 100):
    if len(cnt) == N:
        break
    for i in range(A):
        if len(cnt) == N:
            break
        cnt.append("b")
    for j in range(B):
        if len(cnt) == N:
            break
        cnt.append("r")
ans = collections.Counter(cnt)
print(ans["b"])

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

cnt = A * int(N / (A+B))
if (N % (A+B)) <= A:
    cnt += (N % (A+B))
else:
    cnt += A

print(cnt)

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

cnt = []
for n in range(10 ** 100):
    if len(cnt) == N:
        break
    for i in range(A):
        if len(cnt) == N:
            break
        cnt.append("b")
    for j in range(B):
        if len(cnt) == N:
            break
        cnt.append("r")
print(cnt.count("b"))

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

cnt = A * int(N / (A+B))
if (N % (A+B)) <= A:
    cnt += (N % (A+B))
else:
    cnt += A

print(cnt)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

for k, v in dict(sorted(cnt.items())):
    if v == m:
        print(k)

Fixed submission:
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
        
ans.sort()
for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
ans = sorted([k for k, v in cnt.items() if v == cnt.most_common()[0][1]])

for a in ans:
    print(a)

Fixed submission:
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
        
ans.sort()
for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = []
for n in range(N):
    S.append(input())
    
cnt = collections.Counter(S)
ans = []
for k, v in cnt.items():
    if v == cnt.most_common()[0][1]:
        ans.append(k)
        
ans = sorted(ans)
for a in ans:
    print(a)

Fixed submission:
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
        
ans.sort()
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))

cnt = 1
after = [P[i-1] for i in range(1, N)]
for a in after:
    if a < P[i]:
        break
else:
    cnt += 1
print(cnt)

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

cnt = 1
mini = P[0]
for i in range(1, N):
    if P[i] <= mini:
        mini = P[i]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

cnt = 1
after = []
for i in range(1, N):
    after.append(P[i-1])
    if min(after) >= P[i]:
        cnt += 1
print(cnt)

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

cnt = 1
mini = P[0]
for i in range(1, N):
    if P[i] <= mini:
        mini = P[i]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

cnt = 1
after = []
for i in range(1, N):
    after.append(P[i-1])
    for a in after:
        if a < P[i]:
            break
    else:
        cnt += 1
print(cnt)

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

cnt = 1
mini = P[0]
for i in range(1, N):
    if P[i] <= mini:
        mini = P[i]
        cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for k in range(K):
    if A >= 1:
        A -= 1
        continue
    if B >= 1:
        B -= 1
        continue
        
print(A, B)

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

if A >= K:
    A -= K
    print(A, B)
    sys.exit(0)
else:
    K -= A
    if B >= K:
        B -= K
        print(0, B)
        sys.exit(0)
    else:
        print(0, 0)
Buggy python submission (verdict: Runtime Error):
import sympy
N = int(input())

ans = sympy.divisors(N)
x = ans[int(len(ans)/2)-1]
y = ans[int(len(ans)/2)]

print((x-1)+(y-1))

Fixed submission:
N = 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]

ans = make_divisors(N)
result = []
if len(ans)%2 == 0:
    for i, j in zip(range(0, int(len(ans)/2)), reversed(range(int(len(ans)/2), len(ans)))):
        result.append(int(ans[i]+ans[j])-2)
else:
    x = ans[int(len(ans)/2)]
    result.append((x-1)*2)
print(min(result))

Buggy python submission (verdict: Runtime Error):
import sympy
N = int(input())

ans = sympy.divisors(N)
x = ans[int(len(ans)/2)-1]
y = ans[int(len(ans)/2)]

print((x-1)+(y-1))

Fixed submission:
N = 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]

ans = make_divisors(N)
result = []
if len(ans)%2 == 0:
    for i, j in zip(range(0, int(len(ans)/2)), reversed(range(int(len(ans)/2), len(ans)))):
        result.append(int(ans[i]+ans[j])-2)
else:
    x = ans[int(len(ans)/2)]
    result.append((x-1)*2)
print(min(result))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
p = [K]*N
for _ in range(Q):
    p = list(map(lambda x : x-1, p))
    A = int(input())
    p[A-1] += 1
    
for ans in p:
    if ans <= 0:
        print("No")
    else:
        print("Yes")

Fixed submission:
N, K, Q = map(int, input().split())
p = [0]*N
for _ in range(Q):
    #p = list(map(lambda x : x-1, p))
    A = int(input())
    p[A-1] += 1

for ans in p:
    if ans <= Q-K:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(range(1, N+1))

M = []
for i in range(1, N+1):
    m = list(map(lambda x : i%x, P))
    #print(m)
    M.append(max(m))
    #print(m.index(max(m)))
    del P[m.index(max(m))]
print(sum(M))

Fixed submission:
N = int(input())
print((N-1)*N//2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(range(1, N+1))

M = []
for i in range(1, N+1):
    m = [i%x for x in P]
    M.append(max(m))
    del P[m.index(max(m))]
print(sum(M))

Fixed submission:
N = int(input())
print((N-1)*N//2)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())

cnt = 0
for i in range(len(S)):
    if S[i] == "W":
        cnt += S[:i].count("B")
        
print(cnt)

Fixed submission:
S = list(input())

cnt = 0
b = 0
for s in S:
    if s == "B":
        b += 1
    else:
        cnt += b
        
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
a = input()
b = input()
x = (int(a) + int(b)) / 2
print(math.ceil(x))

Fixed submission:
import math
a,b=map(int,input().split())
x = (int(a) + int(b)) / 2
print(math.ceil(x))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = collections.Counter(A)
cnt = 0
n = len(A.keys())
for _ in range(n):
    if len(A.keys()) <= K:
        break
    k, v = min(A.items(), key=lambda x: x[1])
    cnt += v
    del A[k]
    
print(cnt)

Fixed submission:
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[1])
cnt = A[:len(A)-K]

ans = []
for c in cnt:
    ans.append(c[1])
    
print(sum(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = collections.Counter(A)
cnt = 0
for _ in range(N):
    if len(A.keys()) <= K:
        break
    k, v = min(A.items(), key=lambda x: x[1])
    cnt += v
    del A[k]
    
print(cnt)

Fixed submission:
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[1])
cnt = A[:len(A)-K]

ans = []
for c in cnt:
    ans.append(c[1])
    
print(sum(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = collections.Counter(A)
cnt = 0
while len(A.keys()) > K:
    k, v = min(A.items(), key=lambda x: x[1])
    cnt += v
    del A[k]
    
print(cnt)

Fixed submission:
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[1])
cnt = A[:len(A)-K]

ans = []
for c in cnt:
    ans.append(c[1])
    
print(sum(ans))
Buggy python submission (verdict: Runtime Error):
import sys
S = list(input())

L = list("KIHBR")
for l in L:
    if not l in "".join(S):
        print("NO")
        sys.exit(0)

        N = []
for i in range(len(S)-1):
    if S[i] == "H" or S[i] == "B" or S[i] == "R":
        if S[i+1] != "A":
            N.append(i+1)

i = 0
for n in N:
    S.insert(n+i, "A")
    i += 1
    
if "".join(S) in "AKIHABARA":
    print("YES")
else:
    print("NO")

Fixed submission:
import sys
S = list(input())

L = list("KIHBR")
for l in L:
    if not l in "".join(S):
        print("NO")
        sys.exit(0)

N = []
for i in range(len(S)-1):
    if S[i] == "H" or S[i] == "B" or S[i] == "R":
        if S[i+1] != "A":
            N.append(i+1)

i = 0
for n in N:
    S.insert(n+i, "A")
    i += 1
    
if "".join(S) in "AKIHABARA":
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
A = list(map(int, input().split()))

if N == 1:
    print(1)
    sys.exit(0)
    
cnt = [0 for _ in range(10**5)]
for a in A:
    if a == 0:
        cnt[a] += 1
        cnt[a+1] += 1
    else:
        cnt[a-1] += 1
        cnt[a] += 1
        cnt[a+1] += 1
    
print(max(cnt))

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))

if N == 1:
    print(1)
    sys.exit(0)
    
cnt = [0 for _ in range(10**5+1)]
for a in A:
    if a == 0:
        cnt[a] += 1
        cnt[a+1] += 1
    else:
        cnt[a-1] += 1
        cnt[a] += 1
        cnt[a+1] += 1
    
print(max(cnt))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

cnt = [0]*8
c = 0
for a in A:
    if a <= 399:
        cnt[0] += 1
    elif a >= 400 and a <= 799:
        cnt[1] += 1
    elif a >= 800 and a <= 1199:
        cnt[2] += 1
    elif a >= 1200 and a <= 1599:
        cnt[3] += 1
    elif a >= 1600 and a <= 1999:
        cnt[4] += 1
    elif a >= 2000 and a <= 2399:
        cnt[5] += 1
    elif a >= 2400 and a <= 2799:
        cnt[6] += 1
    elif a >= 2800 and a <= 3199:
        cnt[7] += 1
    else:
        c += 1
        
Min = len([i for i in cnt if i != 0]), 0
if c == 0:
    print(Min, Min)
else:
    Max = min(8, Min+c)
    if Min == 0:
        print(1, Max)
    else:
        print(Min, Max)

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

cnt = [0]*8
c = 0
for a in A:
    if a <= 399:
        cnt[0] += 1
    elif a >= 400 and a <= 799:
        cnt[1] += 1
    elif a >= 800 and a <= 1199:
        cnt[2] += 1
    elif a >= 1200 and a <= 1599:
        cnt[3] += 1
    elif a >= 1600 and a <= 1999:
        cnt[4] += 1
    elif a >= 2000 and a <= 2399:
        cnt[5] += 1
    elif a >= 2400 and a <= 2799:
        cnt[6] += 1
    elif a >= 2800 and a <= 3199:
        cnt[7] += 1
    else:
        c += 1
        
Min = len([i for i in cnt if i != 0])
if c == 0:
    print(Min, Min)
else:
    Max = Min+c
    if Min == 0:
        print(1, Max)
    else:
        print(Min, Max)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

ans = []
for n in range(1, N+1):
    C = list(itertools.combinations(S,n))
    for c in C:
        if sum(c)%10 == 0:
            ans.append(0)
        else:
            ans.append(sum(c))
print(max(ans))

Fixed submission:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

s = sum(S)
if s % 10 != 0:
    print(s)
else:
    S.sort()
    for i in S:
        if i % 10 != 0:
            s -= i
            break
    if s % 10 == 0:
        print(0)
    else:
        print(s)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

if A > B:
    print(0)
    sys.exit(0)
if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    sys.exit(0)

x = B*(N-1)+A
n = A*(N-1)+B
print(x-n+1)

Fixed submission:
import sys
N, A, B = map(int, input().split())

if A > B:
    print(0)
    sys.exit(0)
if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    sys.exit(0)

x = B*(N-1)+A
n = A*(N-1)+B
print(x-n+1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

def solve(n, a):
    a.sort(reverse=True)
    cnt = 0
    for _ in [0]*n:
        cnt += a[1]
        del a[0:2]
        del a[-1]
    return cnt
    
print(solve(N, A))

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

A.sort(reverse=True)
i = 1
n = 1
cnt = 0
while 2*i <= 2*N:
    cnt += A[n]
    i += 1
    n += 2
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
cnt = 0
for _ in range(N):
    cnt += A[1]
    del A[0:2]
    del A[-1]
    
print(cnt)

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

A.sort(reverse=True)
i = 1
n = 1
cnt = 0
while 2*i <= 2*N:
    cnt += A[n]
    i += 1
    n += 2
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
cnt = []
for _ in range(N):
    cnt.append(A[1])
    del A[0:2]
    del A[-1]
    
print(sum(cnt))

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

A.sort(reverse=True)
i = 1
n = 1
cnt = 0
while 2*i <= 2*N:
    cnt += A[n]
    i += 1
    n += 2
    
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    import sys
    import math
    def input():
        return sys.stdin.readline()[:-1]
    N=int(input())
    A=list(map(int,input().split()))
    c=1
    for x in A:
        c=c*x
    
    if c>10**18:
        print(-1)
        sys.exit()

    print(c)
if __name__ == '__main__':
    main()


Fixed submission:

def main():
    import sys
    import math
    def input():
        return sys.stdin.readline()[:-1]
    N=int(input())
    A=list(map(int,input().split()))
    c=1
    if 0 in A:
        print(0)
        sys.exit()
        
    for x in A:     
        c=c*x
        if c>10**18:
            print(-1)
            sys.exit()

    print(c)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
list=[0]*(N-1)
list1=[0]*N
for i in range(1,N):
    list[i-1]=A[i-1]

for j in range(N):
    list1[j]=list.count(j+1)
for l in range(N):
    print(list1[l])

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
list=[0]*(N-1)
list1=[0]*N
for i in range(1,N):
    list[i-1]=A[i-1]
    list1[A[i-1]-1]+=1
list1.append(0)
for j in range(N):
    print(list1[j])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
list=[0]*(N-1)
list1=[0]*N
for i in range(1,N):
    list[i-1]=A[i-1]

for j in range(N-1):
    for k in range(N):
        if list[j]==k+1:
            list1[k]+=1
for l in range(N):
    print(list1[l])

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
list=[0]*(N-1)
list1=[0]*N
for i in range(1,N):
    list[i-1]=A[i-1]
    list1[A[i-1]-1]+=1
list1.append(0)
for j in range(N):
    print(list1[j])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
list=[0]*(N-1)
list1=[0]*N
for i in range(1,N):
    list[i-1]=[i+1,A[i-1]]

for j in range(N-1):
    for k in range(N):
        if list[j][1]==k+1:
            list1[k]+=1
for l in range(N):
    print(list1[l])

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
list=[0]*(N-1)
list1=[0]*N
for i in range(1,N):
    list[i-1]=A[i-1]
    list1[A[i-1]-1]+=1
list1.append(0)
for j in range(N):
    print(list1[j])
Buggy python submission (verdict: Time Limit Exceeded):
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 submission:
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 python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
N=[i for i in range(K*K*K)]
j=0
for a in range(K):
    for b in range(K):
        for c in range(K):
            N[j]=math.gcd(math.gcd((c+1),(b+1)),(a+1))
            j+=1
print(sum(N))

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

max = (10 ** 9) + 7

#入力配列の総和
line = 0
for i in range (n):
    line += a[i]

#a11, a22, ...対角線要素の総和
rem = 0
for i in range(n):
    rem += a[i]*a[i]

sum = ((line*line) - rem) // 2

ans = sum % max

print(ans)


Fixed submission:
in1 = list(map(int,input().split()))
D = in1[0]
T = in1[1]
S = in1[2]

if D <= T * S:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
in1 = list(map(int,input().split()))
D = in1[0]
T = in1[1]
S = in1[2]

if D =< T * S:
    print('Yes')
else:
    print('No')


Fixed submission:
in1 = list(map(int,input().split()))
D = in1[0]
T = in1[1]
S = in1[2]

if D <= T * S:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

max = (10 ** 9) + 7

sum = 0
for i in range (n-1):
    for j in range (n):
        if i > j:
            continue
        if i != j:
            sum += a[i]*a[j]
        if sum > max:
            sum = sum % max


print(sum)


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

max = (10 ** 9) + 7

#一列の総和
wa = 0
for i in range (n):
    wa += a[i]

#a11, a22, ...の総和
rem = 0
for i in range(n):
    rem += a[i]*a[i]

sum = ((wa*wa) - rem) // 2

ans = sum % max

print(ans)

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

max = (10 ** 9) + 7

sum = 0
for i in range (n-1):
    for j in range (n):
        if i > j:
            continue
        if i != j:
            sum += a[i]*a[j]
#        if sum > max:
#            sum - max

if sum > max:
    ans = sum % max

print(ans)


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

max = (10 ** 9) + 7

#一列の総和
wa = 0
for i in range (n):
    wa += a[i]

#a11, a22, ...の総和
rem = 0
for i in range(n):
    rem += a[i]*a[i]

sum = ((wa*wa) - rem) // 2

ans = sum % max

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
list_in = list(map(int,input().split()))
xin = list_in[0]
kin = list_in[1]
din = list_in[2]

now_place = xin

for i in range(kin):
    p_place = now_place + din
    m_place = now_place - din
    if (abs(p_place) < abs(m_place)):
        now_place = p_place
    else:
        now_place = m_place

print(abs(now_place))


Fixed submission:
#memo
"""
繰り返しやった時に絶対値が最小になればよい。
毎回0に近づく動きをさせよう。
"""

list_in = list(map(int,input().split()))
xin = list_in[0]
kin = list_in[1]
din = list_in[2]

now_place = abs(xin)
rem = kin

cnt = min(now_place//din, kin)
now_place -= din * cnt
rem -= cnt

if rem %2 == 1:
    now_place = now_place - din

ans = abs(now_place)

print(ans)
Buggy python submission (verdict: Runtime Error):
#参考：https://marco-note.net/abc-174-work-log/
n = int(input())
c = input()

R.count('R')
cnt = 0

for i in range(R):
    if R[i]=="R":
        cnt += 1
print(R-cnt)


Fixed submission:
#参考：https://marco-note.net/abc-174-work-log/
n = int(input())
c = input()

R=c.count('R')
cnt = 0

for i in range(R):
    if c[i]=="R":
        cnt += 1
print(R-cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if(n%9==0):
  print('Yes')
else print('No')


Fixed submission:
n=int(input())
if(n%9==0):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
r,d,x=map(int,input().split)
for i in range(10):
  x=x*r-d
  print(x)


Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
  x=x*r-d
  print(x)
Buggy python submission (verdict: Runtime Error):
mod = 1000000007

def solve(L):
    n = len(L)
    if n == 0:
        return 1
    n1 = 0
    for i in range(n):
        if L[i] == '1':
            n1 += 1
        else:
            break
    n0 = 0
    for i in range(n1, n):
        if L[i] == '0':
            n0 += 1
        else:
            break
    return (pow(2, n1, mod) * solve(L[n1 + n0:]) + (pow(3, n1, mod) - pow(2, n1, mod)) * pow(3, n - n1, mod)) % mod

L = input()
print(solve(L))

Fixed submission:
mod = 1000000007
L = input()
ans = 1
n = len(L)
i = n - 1
while i >=0:
    n0 = 0
    n1 = 0
    while L[i] == '0':
        n0 += 1
        i -= 1
    while L[i] == '1':
        n1 += 1
        i -= 1
        if i < 0:
            break
    ans *= pow(2, n1, mod)
    ans += (pow(3, n1, mod) - pow(2, n1, mod)) * pow(3, n - i - 1 - n1, mod)
    ans %= mod
print(ans)

Buggy python submission (verdict: Runtime Error):
def solve(L):
    n = len(L)
    if n == 0:
        return 1
    n1 = 0
    for i in range(n):
        if L[i] == '1':
            n1 += 1
        else:
            break
    n0 = 0
    for i in range(n1, n):
        if L[i] == '0':
            n0 += 1
        else:
            break
    return (2 ** n1 * solve(L[n1 + n0:]) + (3 ** n1 - 2 ** n1) * 3 ** (n - n1)) % 1000000007

L = input()
print(solve(L))

Fixed submission:
mod = 1000000007
L = input()
ans = 1
n = len(L)
i = n - 1
while i >=0:
    n0 = 0
    n1 = 0
    while L[i] == '0':
        n0 += 1
        i -= 1
    while L[i] == '1':
        n1 += 1
        i -= 1
        if i < 0:
            break
    ans *= pow(2, n1, mod)
    ans += (pow(3, n1, mod) - pow(2, n1, mod)) * pow(3, n - i - 1 - n1, mod)
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
a = []
for i in range(X):
    for j in range(Y):
        a.append(A[i] + B[j])
a.sort()
b = []
for i in range(min(3000, X * Y)):
    b.append(a[- i - 1])
c = []
for i in range(len(b)):
    for j in range(Z):
        c.append(b[i] + C[j])
c.sort()
for i in range(K):
    print(c[- i - 1])


Fixed submission:
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
a = []
for i in range(X):
    for j in range(Y):
        a.append(A[i] + B[j])
a.sort()
b = []
for i in range(min(3000, X * Y)):
    b.append(a[- i - 1])
c = []
for i in range(len(b)):
    for j in range(Z):
        c.append(b[i] + C[j])
c.sort()
for i in range(K):
    print(c[- i - 1])