Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in a:
    b[i-1] = a.index(i)+1
print(*b)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(1,n+1):
    b.append(a.index(i)+1)
print(*b)

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

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

for x in range(1,n+1):
    for y in range(n):
        if x == a[y]:
            print(y+1, end=" ")

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in range(n):
    b[a[i]-1] = i+1
print(*b)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int, input().split())
a = [int(input()) for i in range(q)]
for i in range(n):
    if 0 < k-q+a.count(i+1):
        print('Yes')
    else:
        print('No')

Fixed submission:
n,k,q = map(int, input().split())
p = [k-q]*n
for i in range(q):
    a = int(input())
    p[a-1] += 1
for j in p:
    if 0 < j:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(range(1,n+1))
print(sum(a)-max(a))

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

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(range(n,0,-1))
print(sum(a)-a[0])

Fixed submission:
n = int(input())
print((n*(n-1))//2)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
from collections import Counter
n = int(input())
s = [str(input()) for i in range(n)]
num = 0
for i in itertools.combinations(s,2):
    x = Counter(i[0]).most_common()
    y = Counter(i[1]).most_common()
    x.sort()
    y.sort()
    if x == y:
        num += 1
print(num)

Fixed submission:
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s1 = ''.join(sorted(input()))
    s.append(s1)
s = Counter(s).most_common()
num = 0
for i,h in s:
    num += (h*(h-1))//2
print(num)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
s = [str(input()) for i in range(n)]
m = 0
for i in itertools.combinations(s,2):
    num = 0
    for h in range(10):
        if i[1].count(i[0][h]) == i[0].count(i[0][h]):
            num += 1
    if num == 10:
        m += 1
print(m)

Fixed submission:
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s1 = ''.join(sorted(input()))
    s.append(s1)
s = Counter(s).most_common()
num = 0
for i,h in s:
    num += (h*(h-1))//2
print(num)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
s = [str(input()) for i in range(n)]
w = "abcdefghijklmnopqrstuvwxyz"
num = 0
for h in itertools.combinations(s,2):
    t = 0
    for j in w:
        if h[0].count(j) == h[1].count(j):
            t += 1
        if t == 26:
            num += 1
print(num)

Fixed submission:
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s1 = ''.join(sorted(input()))
    s.append(s1)
s = Counter(s).most_common()
num = 0
for i,h in s:
    num += (h*(h-1))//2
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = tuple(int(input()) for i in range(n))
x = a.count(max(a))
if 2 <= x:
    for i in range(n):
        print(max(a))
else:
    for i in range(n):
        if a[i] != max(a):
            print(max(a))
        else:
            print(max(a[:i] + a[i+1:]))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = tuple(a)
a.sort()
for i in b:
    if i == a[n-1]:
        print(a[n-2])
    else:
        print(a[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
x = a.count(max(a))
if 2 <= x:
    for i in range(n):
        print(max(a))
else:
    for i in range(n):
        if a[i] == max(a):
            print(max(a[:i] + a[i+1:]))
        else:
            print(max(a))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = tuple(a)
a.sort()
for i in b:
    if i == a[n-1]:
        print(a[n-2])
    else:
        print(a[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
for h in range(n):
    b = a[:h] + a[h+1:]
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = tuple(a)
a.sort()
for i in b:
    if i == a[n-1]:
        print(a[n-2])
    else:
        print(a[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
lr = []
for i in range(m):
    l,r = map(int, input().split())
    lr.append((l,r))
num = 0
for h in range(1,n+1):
    t = 0
    for j in lr:
        if j[0] <= h <= j[1]:
            t += 1
        else:
            break
    if t == m:
        num += 1
print(num)

Fixed submission:
n,m = map(int, input().split())
mini = 0
maxi = 10**9
for i in range(m):
    l,r = map(int, input().split())
    if mini < l:
        mini = l
    if r < maxi:
        maxi = r
t = maxi -mini + 1
if maxi < mini:
    print(0)
else:
    print(t)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n,m = map(int, input().split())
lr = []
for i in range(m):
    l,r = map(int, input().split())
    lr += list(range(l,r+1))
lr = Counter(lr).most_common()
num = 0
for h in range(len(lr)):
    if lr[h][1] == m:
        num += 1
    else:
        break
print(num)

Fixed submission:
n,m = map(int, input().split())
mini = 0
maxi = 10**9
for i in range(m):
    l,r = map(int, input().split())
    if mini < l:
        mini = l
    if r < maxi:
        maxi = r
t = maxi -mini + 1
if maxi < mini:
    print(0)
else:
    print(t)
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(map(str, input().split()))
k = k-1

for i in range(n):
  if i != k:
    print(s[i],end="")
  else:
    x = s[i].lower()
    print(x,end="")


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

k = k-1

for i in range(n):
  if i == k:
    x = s[i].lower()
    print(x,end="")
  else:
    print(s[i],end="")

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(map(str, input().split()))
k = k-1

for i in range(n):
  if i != k:
    print(s[i],end="")
  else:
    s[i].lower()
    print(s[i],end="")


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

k = k-1

for i in range(n):
  if i == k:
    x = s[i].lower()
    print(x,end="")
  else:
    print(s[i],end="")

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(map(str, input().split()))
k = k-1

for i in range(n):
  if i != k:
    print(s[i],end="")
  else:
    s[i].upper()
    print(s[i],end="")


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

k = k-1

for i in range(n):
  if i == k:
    x = s[i].lower()
    print(x,end="")
  else:
    print(s[i],end="")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
xy = []
for i in range(1,n+1):
    for h in itertools.combinations(range(0,n),i):
        x = 0
        y = 0
        for j in h:
            x += v[j]
            y += c[j]
        xy.append(x-y)
if max(xy) < 0:
    print(0)
else:
    print(max(xy))

Fixed submission:
import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
xy = 0
for i in range(1,n+1):
    for h in itertools.combinations(range(0,n),i):
        x = 0
        y = 0
        for j in h:
            x += v[j]
            y += c[j]
        if xy < x-y:
            xy = x-y
print(xy)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())
wordn = ""
w = s[k-1]
for i in s:
    if w != i:
        word += "*"
    else:
        word += w
print(word)

Fixed submission:
n = int(input())
s = str(input())
k = int(input())
word = ""
w = s[k-1]
for i in s:
    if w != i:
        word += "*"
    else:
        word += w
print(word)
Buggy python submission (verdict: Runtime Error):
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m < num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))

Fixed submission:
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m <= num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))
Buggy python submission (verdict: Runtime Error):
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
print(max(l))

Fixed submission:
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
l.append(len(w))
print(max(l))
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
num = 0
m = 1
for i in range(min(s.count('1'),s.count('0'))):
    t = num
    for i in range(len(s)-1):
        if (s[i]=='0' and s[i+1]=='1') or (s[i]=='1' and s[i+1]=='0'):
            num += 2
            s = s[:i]+ s[i+2:]
            break
    if t == num:
        break
print(num)

Fixed submission:
s = str(input())
x = s.count('0')
y = s.count('1')
print(min(x,y)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
num = 0
m = 1
while m == 1:
    t = num
    for i in range(len(s)-1):
        if (s[i]=='0' and s[i+1]=='1') or (s[i]=='1' and s[i+1]=='0'):
            num += 2
            s = s[:i]+ s[i+2:]
            break
    if t == num:
        break
print(num)

Fixed submission:
s = str(input())
x = s.count('0')
y = s.count('1')
print(min(x,y)*2)
Buggy python submission (verdict: Runtime Error):
S = str(input())
list = lisr(S)
num = list.count('+')
print(num - (4-num))

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))

Buggy python submission (verdict: Runtime Error):
S = str(input())
list = lisr(S)
num = int(list.count('+'))
print('num - (4-num)')

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))

Buggy python submission (verdict: Runtime Error):
S = str(input())
list = lisr(S)
num = int(list.count('+'))
print('num - (4-num'))

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))

Buggy python submission (verdict: Runtime Error):
S = str(input())
list = lisr(S)
num = list.count('+')
print('num - (4-num)')

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))

Buggy python submission (verdict: Runtime Error):
S = str(input())
list = lisr(S)
num = list.count('+')
print(num - (4-num))

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))

Buggy python submission (verdict: Runtime Error):
S = map(str, input().split())
list = list(S)
a = int(list.count('+'))
b = ist(list.count('-'))
print('a-b')

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))

Buggy python submission (verdict: Runtime Error):
S = map(str, input())
list = list(S)
a = int(list.count('+'))
b = ist(list.count('-'))
print('a-b')

Fixed submission:
S = str(input())
list = list(S)
num = list.count('+')
print(num - (4-num))
Buggy python submission (verdict: Runtime Error):
N = int(input())
num = list(N)
sum = sum(num)
M = int(sum)
if N%M == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = str(input())
num = 0
for i in range(len(n)):
    num += int(n[i])
if int(n)%num == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
num = list(N)
sum = sum(num)
if N%sum == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = str(input())
num = 0
for i in range(len(n)):
    num += int(n[i])
if int(n)%num == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
for i in range(n):
    w = x[:i] + x[i+1:]
    w.sort()
    print(w[((len(w)+1)//2)-1])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
w = tuple(x)
x.sort()
if x[(n//2)-1] == x[n//2]:
    for i in range(n):
        print(x[n//2])
else:
    for h in w:
        if h <= x[(n//2)-1]:
            print(x[n//2])
        else:
            print(x[(n//2)-1])
Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
a = list(map(int, input().split()))
m = 0
for i in itertools.combinations(a,2):
    j = [h for h in itertools.combinations(range(max(i[0],i[1])), min(i[0],i[1]))]
    if m < len(j):
        m = len(j)
        l = i
print(max(l[0],l[1]),min(l[0],l[1]))

Fixed submission:
import itertools
n = int(input())
a = list(map(int, input().split()))
m = max(a)
t = (10**9)+1
for i in a:
    if abs(i-(m//2)) < t and i != m:
        t = abs(i-(m//2))
        s = i
print(m,s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    t = 0
    w = a[:i] + a[i+1:]
    w.append(0)
    w.insert(0,0)
    for h in range(len(w)-1):
        t += abs(w[h]-w[h+1])
    print(t)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0,0)
s = 0
for i in range(len(a)-1):
    s += abs(a[i]-a[i+1])
for h in range(1,n+1):
    t = abs(a[h+1]-a[h-1])-abs(a[h]-a[h-1])-abs(a[h+1]-a[h])
    print(s+t)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list(set(a))
num = 0
for i in b:
    if i < a.count(i):
        num += (a.count(i)-i)
    elif a.count(i) < i:
        num += a.count(i)
print(num)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a = Counter(a).most_common()
num = 0
for i,j in a:
    if i < j:
        num += (j-i)
    elif j < i:
        num += j
print(num)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    l1 = 2
    l2 = 1
    l3 = 0
    for i in range(n-1):
        l3 = l1
        l1 = l2
        l2 += l3
print(l2)

Fixed submission:
n = int(input())
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    l1 = 2
    l2 = 1
    l3 = 0
    for i in range(n-1):
        l3 = l1
        l1 = l2
        l2 += l3
    print(l2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
for i in range(n):
    a = int(input())
    if a not in l:
        l.append(a)
    else:
        l.remove(a)
print(len(l))

Fixed submission:
n = int(input())
a1 = [int(input()) for i in range(n)]
from collections import Counter
a = Counter(a1).most_common()
num = 0
for i in range(len(a)):
    if a[i][1]%2 == 1:
        num += 1
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
ab = []
num = 0
for i in range(m):
    a,b = map(int, input().split())
    if a == 1 or b == n:
        num += 1
        ab.append((a,b))
ab.sort()
x = 'IMPOSSIBLE'
for h in range(num):
    if (ab[h][1],n) in ab:
        x = 'POSSIBLE'
        break
print(x)

Fixed submission:
n,m = map(int, input().split())
b1 = []
b2 = []
for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        b1.append(b)
    if b == n:
        b2.append(a)
if len(b1) + len(b2) == len(list(set(b1+b2))):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
ab = []
num = 0
for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        num += 1
    ab.append((a,b))
ab.sort()
x = 'IMPOSSIBLE'
for h in range(num):
    if (ab[h][1],n) in ab:
        x = 'POSSIBLE'
        break
print(x)

Fixed submission:
n,m = map(int, input().split())
b1 = []
b2 = []
for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        b1.append(b)
    if b == n:
        b2.append(a)
if len(b1) + len(b2) == len(list(set(b1+b2))):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []
if n%2 == 0:
    for i in range(n):
        if i%2 == 0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
else:
    for h in range(n):
        if h%2 == 0:
            b.insert(0,a[h])
        else:
            b.append(a[h])
print(*b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
o = [a[i] for i in range(2,n,2)]
e = [a[h] for h in range(1,n,2)]
if n%2 == 0:
    e.reverse()
    l = e + [a[0]] + o
    print(*l)
else:
    o.reverse()
    l = o + [a[0]] + e
    print(*l)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []
for i in a:
    b.append(i)
    b.reverse()
print(*b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
o = [a[i] for i in range(2,n,2)]
e = [a[h] for h in range(1,n,2)]
if n%2 == 0:
    e.reverse()
    l = e + [a[0]] + o
    print(*l)
else:
    o.reverse()
    l = o + [a[0]] + e
    print(*l)
Buggy python submission (verdict: Runtime Error):
w = []
num = 0
for i in a:
    if 1 <= i <= 399:
        if 1 not in w:
            w.append(1)
    elif 400 <= i <= 799:
        if 400 not in w:
            w.append(400)
    elif 800 <= i <= 1199:
        if 800 not in w:
            w.append(800)
    elif 1200 <= i <= 1599:
        if 1200 not in w:
            w.append(1200)
    elif 1600 <= i <= 1999:
        if 1600 not in w:
            w.append(1600)
    elif 2000 <= i <= 2399:
        if 2000 not in w:
            w.append(2000)
    elif 2400 <= i <= 2799:
        if 2400 not in w:
            w.append(2400)
    elif 2800 <= i <= 3199:
        if 2800 not in w:
            w.append(2800)
    else:
        num += 1
if 0 < len(w):
    print(len(w), len(w)+num)
else:
    print(1, len(w)+num)

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

w = []
num = 0
for i in a:
    if 1 <= i <= 399:
        if 1 not in w:
            w.append(1)
    elif 400 <= i <= 799:
        if 400 not in w:
            w.append(400)
    elif 800 <= i <= 1199:
        if 800 not in w:
            w.append(800)
    elif 1200 <= i <= 1599:
        if 1200 not in w:
            w.append(1200)
    elif 1600 <= i <= 1999:
        if 1600 not in w:
            w.append(1600)
    elif 2000 <= i <= 2399:
        if 2000 not in w:
            w.append(2000)
    elif 2400 <= i <= 2799:
        if 2400 not in w:
            w.append(2400)
    elif 2800 <= i <= 3199:
        if 2800 not in w:
            w.append(2800)
    else:
        num += 1
if 0 < len(w):
    print(len(w), len(w)+num)
else:
    print(1, len(w)+num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = 1
for i in range(1,n+1):
    num *= i
print(num%((10**9)+7))

Fixed submission:
import math
n = int(input())
print(math.factorial(n)%((10**9)+7))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int, input().split())
num = 0
for i in range(a,b+1):
    if i%x == 0:
        num += 1
print(num)

Fixed submission:
a,b,x = map(int, input().split())
if a%x == 0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())
print(in(((a+b)*h)/2))

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print(int(((a+b)*h)/2))
Buggy python submission (verdict: Runtime Error):
ac, wa,tle,re = 0,0,0,0
for _ in range(int(input()):
	s = input()
    if s == 'AC':
    	ac+=1
    elif s=='WA':
        wa+=1
    elif s=='TLE':
        tle+=1
    else:
        re+=1
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))               

Fixed submission:
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(int(input())):
	s = input()
	if s=='AC':
		ac+=1
	elif s=='WA':
		wa+=1
	elif s=='TLE':
		tle+=1
	else:
		re+=1
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))
Buggy python submission (verdict: Runtime Error):
s = input()
 
ans = 0
for i in range(0, 3):
	if s[i] == 'R':
    	ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

Fixed submission:
s = input()
 
ans = 0
for i in range(0, 3):
	if s[i] == 'R':
			ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()

ans = 0
for i in range(0, 3):
	if s[i] == 'R':
      ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

Fixed submission:
s = input()
 
ans = 0
for i in range(0, 3):
	if s[i] == 'R':
			ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(intput())
if a >= 30:
  print("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
if a >= 30:
	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def LI():
    return list(map(int, input().split()))

_ = int(input())
a = LI()
ans = 1
mod = pow(10, 18)

def main(ans):
    for i in a:
        ans *= i
        if ans == 0:
            break
    if ans > mod:
        ans = -1
    print(ans)


if __name__ == "__main__":
    main(ans)

Fixed submission:
def LI():
    return list(map(int, input().split()))

_ = int(input())
a = LI()
ans = 1
mod = pow(10, 18)

def main(ans):
    if 0 in a:
        ans = 0
    else:
        for i in a:
            ans *= i
            if ans > mod:
                ans = -1
                break
    print(ans)

if __name__ == "__main__":
    main(ans)
Buggy python submission (verdict: Runtime Error):
n, a, b, c = list(map(int, input().split()))
s = [list(input()) for _ in range(n)]
d = {"A": a, "B": b, "C": c}
ans = []
for i, [j, k] in enumerate(s):
    if d[j] == 0 and d[k] == 0:
        print("No")
        break
    elif d[j] > d[k]:
        calc(k, j)
    elif d[j] < d[k]:
        calc(j, k)
    elif i + 1 != n:
        if j == "A":
            if s[i + 1][1] == "C":
                calc(k, j)
            else:
                calc(j, k)        
        else:
            if s[i + 1] == ["A", "C"]:
                calc(k, j)
            else:
                calc(j, k)
    else:
        calc(j, k)
else:
    print("Yes")
    for i in ans:
        print(i)   

Fixed submission:
n, a, b, c = list(map(int, input().split()))
s = [list(input()) for _ in range(n)]
s.append(["A", "B"])
d = {"A": a, "B": b, "C": c}
ans = []

def calc(add, sub):
    d[add] += 1
    d[sub] -= 1
    ans.append(add)

for i, [j, k] in enumerate(s):
    if i == n:
        print('Yes')
        print('\n'.join(ans))
        break
    if d[j] == 0 and d[k] == 0:
        print("No")
        break
    elif j == "A" and k == "B":
        
        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A":
                calc(j, k)
            else:
                calc(k, j)
    elif j == "A" and k == "C":

        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A":
                calc(j, k)
            else:
                calc(k, j)
    elif j == "B" and k == "C":

        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A" and s[i + 1][1] == "C":
                calc(k, j)
            else:
                calc(j, k)