Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
i=0
count=0
while True:
    if S[i]=='B' and S[i+1]=='W':
        S[i]='W'
        S[i+1]='B'
        i-=1
        count+=1
        if i<0:
            i=0
        continue
    if i > len(S)-3:
        print(count)
        break
    i+=1
    


Fixed submission:
s = input()
ans = 0
b = 0
for c in s:
    if c == 'W':
        ans += b
    elif c == 'B':
        b += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
i=0
count=0
while True:
    if S[i]=='B' and S[i+1]=='W':
        S[i]='W'
        S[i+1]='B'
        i-=1
        count+=1
        if i<0:
            i=0
        continue
    if i > len(S)-3:
        print(count)
        break
    i+=1
    


Fixed submission:
s = input()
ans = 0
b = 0
for c in s:
    if c == 'W':
        ans += b
    elif c == 'B':
        b += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans=float("inf")

for i in range(K):
    if i + K > N+1:
        break
    else:
        a = min(abs(x[K+i-1]),abs(x[i])) 
        ans = min(ans,x[K+i-1]-x[i]+a)
print(ans)

Fixed submission:
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans=float("inf")

for i in range(N-K+1):
    if i + K == N+1:
        break
    else:
        a = min(abs(x[K+i-1]),abs(x[i])) 
        ans = min(ans,x[K+i-1]-x[i]+a)
print(ans)
Buggy python submission (verdict: Runtime Error):
def count_bomb(y,x):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans
h,w=map(int,input().split())
s = [list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j)
for i in range(h):
    print(*s[i],sep="")


Fixed submission:
N=int(input())
S=list(input())
cnt=0
maxcnt=0
for i in range(N):
    if i==0:
        if S[0] in S[1:N]:
            cnt+=1
        if maxcnt<cnt:
            maxcnt=cnt
    elif i == N-1:
        if S[N-1] in S[0:N]:
            cnt-=1
    else:
        if S[i] not in S[0:i] and S[i] in S[i+1:N]:
            cnt+=1
            if maxcnt<cnt:
                maxcnt=cnt
        elif S[i] in S[0:i] and S[i] not in S[i+1:N]:
            cnt-=1
        else:
            pass
print(maxcnt)

Buggy python submission (verdict: Runtime Error):
def count_bomb(y,x,h,w):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans

h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j,h,w)
for i in range(h):
    print(*s[i],sep="")



Fixed submission:
N=int(input())
S=list(input())
cnt=0
maxcnt=0
for i in range(N):
    if i==0:
        if S[0] in S[1:N]:
            cnt+=1
        if maxcnt<cnt:
            maxcnt=cnt
    elif i == N-1:
        if S[N-1] in S[0:N]:
            cnt-=1
    else:
        if S[i] not in S[0:i] and S[i] in S[i+1:N]:
            cnt+=1
            if maxcnt<cnt:
                maxcnt=cnt
        elif S[i] in S[0:i] and S[i] not in S[i+1:N]:
            cnt-=1
        else:
            pass
print(maxcnt)

Buggy python submission (verdict: Runtime Error):
def count_bomb(y,x,h,w):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans

h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j,h,w)
for i in range(h):
    print(*s[i],sep="")



Fixed submission:
N=int(input())
S=list(input())
cnt=0
maxcnt=0
for i in range(N):
    if i==0:
        if S[0] in S[1:N]:
            cnt+=1
        if maxcnt<cnt:
            maxcnt=cnt
    elif i == N-1:
        if S[N-1] in S[0:N]:
            cnt-=1
    else:
        if S[i] not in S[0:i] and S[i] in S[i+1:N]:
            cnt+=1
            if maxcnt<cnt:
                maxcnt=cnt
        elif S[i] in S[0:i] and S[i] not in S[i+1:N]:
            cnt-=1
        else:
            pass
print(maxcnt)
Buggy python submission (verdict: Runtime Error):
import copy
H,W=map(int,input().split())
S=[0]*W
for i in range(H):
    S[i]=list(input()+".")
S+=[["."]*(W+1)]
S2=[["#"]*W]*H

for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            S2[i][j]="#"
        else:
            if i==0:
                im=H
            else:
                im=i-1
            if j==0:
                jm=W
            else:
                jm=j-1

            if i==H-1:
                ip=H
            else:
                ip=i+1

            if j==W-1:
                jp=W
            else:
                jp=j+1
            cnt=[S[im][jm],S[im][j],S[im][jp],S[i][jm],S[i][jp],S[ip][jm],S[ip][j],S[ip][jp]]
            S2[i][j]=cnt.count('#')

print(S2)



Fixed submission:
def count_bomb(y,x):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans
h,w=map(int,input().split())
s = [list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j)
for i in range(h):
    print(*s[i],sep="")
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

K = int(input())

ans = 0
a=[]
for i in range(1,K+1):
	for j in range(1, K+1):
		tmp = fractions.gcd(i,j)
		for k in range(1, K+1):
			ans+=fractions.gcd(tmp,k)

print(ans)

Fixed submission:
import math
K = int(input())

ans = 0
a=[]
for i in range(1,K+1):
	for j in range(1, K+1):
		tmp = math.gcd(i,j)
		for k in range(1, K+1):
			ans+=math.gcd(tmp,k)

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

# 距離間リスト
d_li = []
for i in range(N-1):
	d_li.append(A_li[i+1]-A_li[i])

d_li.append(K+A_li[0] - A_li[N-1])

ans = float('inf')
for d in d_li:
	ans = min(ans,sum(d_li)-d)

print(ans)

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

# 距離間リスト
d_li = []
for i in range(N-1):
	d_li.append(A_li[i+1]-A_li[i])

d_li.append(K+A_li[0] - A_li[N-1])


allsum = sum(d_li)
ans = allsum
for d in d_li:
	ans = min(ans,allsum-d)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]

dic = {}

def count_word(add_word):
	exist = False
	# 辞書dicにすでに書いてあるかチェック
	for key, value in dic.items():
		if add_word==key:
			value += 1
			dic[key] = value
			exist = True
			break
	
	# 辞書dicにない場合、追加
	if exist==False: dic[add_word] = 1

	return dic

for word in s:
	count_word(word)

# 書かれた回数の最大値
value_max = max(dic.values())
# print(value_max)


ans = [k for k, v in dic.items() if v==value_max]
ans = sorted(ans)

for a in ans:
	print(a)
			

Fixed submission:
n = int(input())
s = [input() for i in range(n)]

dic = {}

for word in s:
	if word not in dic:
		dic[word] = 1
	else:
		dic[word] += 1

# 書かれた回数の最大値
value_max = max(dic.values())
# print(value_max)


ans = [k for k, v in dic.items() if v==value_max]
ans = sorted(ans)

for a in ans:
	print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A_list = list(map(int, input().split()))

d = []
for i in range(1, len(A_list)):
		left = sum(A_list[:i])
		right = sum(A_list[i:])
		temp = abs(left - right)
		d.append(temp)

print(min(d))


Fixed submission:
N = int(input())

A_list = list(map(int, input().split()))

left = 0
A_sum = sum(A_list)
ans = A_sum
for a in A_list:
		left += a
		right = A_sum - left
		ans = min(ans, abs(left-right))

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

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans>10**18:
  ans='-1'
print(ans)

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

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans==1000000000000000000:
  ans=1000000000000000000
elif len(str(ans))>=19:
  ans=-1
print(ans)

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

if 0 in a :
  ans=0
else:
  for i in range(n+1):
    if len(str(ans))>=19:
      ans=-1
      break
    else:
      ans*=a[i]

print(ans)

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

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans==1000000000000000000:
  ans=1000000000000000000
elif len(str(ans))>=19:
  ans=-1
print(ans)
Buggy python submission (verdict: Runtime Error):
for i in range(len(tl1)):
  if tl1[i]=="?":
    if i==0:
      if tl1[i+1]=="D":
        tl1[i]="P"
      elif tl1[i+1]=="?":
        tl1[i]="P"
      else:
        tl1[i]="D"
    elif i==len(tl1)-1:
      tl1[i]="D"
    elif tl1[i-1]=="P":
      tl1[i]="D"
    elif tl1[i+1]=="D":
      tl1[i]="P"
    elif tl1[i+1]=="?":
      tl1[i]="P"
    else:
      tl1[i]="D"
  if tl1[i]=="D":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      pd1+=1
d1=tl1.count('D')
s1=d1+pd1
 
print(''.join(tl1))

Fixed submission:
t=input()

tla=list(t)
tlb=list(t)
pd1=0
pd2=0

for i in range(len(tla)):
  if tla[i]=="?":
    if i==0:
      pass
    elif i==len(tla)-1:
      tla[i]="D"
    elif tla[i-1]=="P":
      tla[i]="D"
    elif tla[i+1]=="D":
      tla[i]="P"
    elif tla[i+1]=="?":
      tla[i]="P"
    else:
      tla[i]="D"
  if tla[i]=="D":
    if i==0:
      pass
    elif tla[i-1]=="P":
      pd1+=1
d1=tla.count('D')
s1=d1+pd1

for i in range(len(tlb)):
  if tlb[i]=="?":
    tlb[i]="D"
  if tlb[i]=="D":
    if i==0:
      pass
    elif tlb[i-1]=="P":
      pd2+=1
d2=tlb.count('D')
s2=d2+pd2

if s1>=s2:
  print(''.join(tla))
else:
  print(''.join(tlb))

Buggy python submission (verdict: Runtime Error):
t=input()
tl=list(t)

tl1=tl
pd1=0

for i in range(len(tl1)):
  if tl1[i]=="?":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      tl1[i]="D"
    elif tl1[i+1]=="D":
      tl1[i]="P"
    elif tl1[i+1]=="?":
      tl1[i]="P"
    else:
      tl1[i]="D"
  if tl1[i]=="D":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      pd1+=1
d1=tl1.count('D')
s1=d1+pd1

print(''.join(tl1))

Fixed submission:
t=input()

tla=list(t)
tlb=list(t)
pd1=0
pd2=0

for i in range(len(tla)):
  if tla[i]=="?":
    if i==0:
      pass
    elif i==len(tla)-1:
      tla[i]="D"
    elif tla[i-1]=="P":
      tla[i]="D"
    elif tla[i+1]=="D":
      tla[i]="P"
    elif tla[i+1]=="?":
      tla[i]="P"
    else:
      tla[i]="D"
  if tla[i]=="D":
    if i==0:
      pass
    elif tla[i-1]=="P":
      pd1+=1
d1=tla.count('D')
s1=d1+pd1

for i in range(len(tlb)):
  if tlb[i]=="?":
    tlb[i]="D"
  if tlb[i]=="D":
    if i==0:
      pass
    elif tlb[i-1]=="P":
      pd2+=1
d2=tlb.count('D')
s2=d2+pd2

if s1>=s2:
  print(''.join(tla))
else:
  print(''.join(tlb))
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
ans = 0
m = 0

l = [1]*a
bl = [0]*b
cl = [-1]*c

l.extend(bl)
l.extend(cl)

for i in l:
  ans = ans+i
  m=m+1
  if m==k:
    break

print(ans)

Fixed submission:
a,b,c,k = map(int,input().split())
ans = a

if a>k:
  ak=a-k
  ans=ans-ak
if a+b<k:
  ans=ans-(k-(a+b))

print(ans)
Buggy python submission (verdict: Runtime Error):
var str = readLine()!

if str=="ABC"{
  print("ARC")
}else{
  print("ABC")
}

Fixed submission:
s=input()

if s=='ABC':
    ans='ARC'
else:
    ans='ABC'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())
ans = 0

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

print(ans)

Fixed submission:
import math
k = int(input())
ans = 0

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

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

Fixed submission:
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

if k==1 :
  ln=0
elif k==0 :
  ln=n
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

Fixed submission:
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

if k==1 :
  ln=0
elif n>=k and k!=0 :
  if n//k==0:
    ln=0
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

Fixed submission:
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

if k==1 :
  ln=0
elif n>=k :
  if n//k==0:
    ln=0
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

Fixed submission:
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

if k==1 :
  ln=0
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

Fixed submission:
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)
Buggy python submission (verdict: Runtime Error):
hoge = [0 for i in range(2)]

for i in range(2):
  hoge[i] = input()
  
N = int(hoge[0])
S = hoge[1]

print(S.count('ABC'))

Fixed submission:
K, X = map(int,input().split())
if (500*K) >= X:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
ak = a+k
bk = b-k

for i in range(a,b+1):
  if i<ak or i>bk:
    print(i)

Fixed submission:
a,b,k = map(int,input().split())
ak = a+k
bk = b-k

if a+k>=b:
  for i in range(a,b+1):
    if i<ak or i>bk:
      print(i)
else:
  for i in range(a,a+k+1):
    if i<ak or i>bk:
      print(i)
  if i<b-k:
    for n in range(b-k,b+1):
      if n<b-k or n>bk:
        print(n)
  else:
    for j in range(i+1,b+1):
      if j<ak or j>bk:
        print(j)
Buggy python submission (verdict: Runtime Error):
n=int(input())

a=2
b=1

if n==1:
  s=1
  n=2

for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn

if s==1:
  ans = 1

print(ans)

Fixed submission:
n=int(input())
 
a=2
b=1
s=0
 
if n==1:
  s=1
  n=2
 
for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn
 
if s==1:
  ans = 1
 
print(ans)

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

a=2
b=1


for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn

print(ans)

Fixed submission:
n=int(input())
 
a=2
b=1
s=0
 
if n==1:
  s=1
  n=2
 
for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn
 
if s==1:
  ans = 1
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=0
ans=1

for i in range(n):
  k = k+1
  ans=ans*k

print(ans%(10**9+7))

Fixed submission:
n=int(input())


k=0
ans=1
w=10**9+7

for i in range(n):
  k = k+1
  ans*=k
  ans%=w

print(ans)
Buggy python submission (verdict: Runtime Error):
ans=a
c=a
if a==b :
  ans=a**b
else:
  while c<=b:
    c=c+1
    ans=ans*c
pm = numpy.sign(ans)
if pm==0:
  print('zero')
elif pm==1:
  print('Positive')
else:
  print('Negative')

Fixed submission:
import numpy
a,b = map(int,input().split())

if numpy.sign(a*b)==-1:
  print('Zero')
elif (numpy.sign(a)==1) or (numpy.sign(b)==1):
  print('Positive')
elif (a-b)%2==0:
  print('Negative')
else:
  print('Positive')
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

@lru_cache(None)
def dfs(p, remain):

    n = len(arr)

    if remain == 0 or p >= n:
        return 0

    if remain == 1:
        return max(arr[p:])
        
    len_remain = n - (p + 1)

    t = -float('inf')
    if (remain - 1) * 2 + 1 <= len_remain:
        t = dfs(p + 1, remain)

    t2 = arr[p] + dfs(p + 2, remain - 1)

    return max(t, t2)

    


n = int(input())

arr = list(map(int, input().split()))

ans = dfs(0, n // 2)

print (ans)



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

from functools import lru_cache

@lru_cache(None)
def dfs(p, remain):

    n = len(arr)

    if remain == 0 or p >= n:
        return 0

    if remain == 1:
        return max(arr[p:])
        
    len_remain = n - (p + 1)

    t = -float('inf')
    if (remain - 1) * 2 + 1 <= len_remain:
        t = dfs(p + 1, remain)

    t2 = arr[p] + dfs(p + 2, remain - 1)

    return max(t, t2)

    


n = int(input())

arr = list(map(int, input().split()))

ans = dfs(0, n // 2)

print (ans)
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    flag = 0
    for i in range(K, N):
        if flag==0:
            mae = 1
            for j in range(i-K, i-1):
                mae = mae * A[j]
            ato = mae / A[i-K] * A[i]
            flag=1
        else:
            ato = mae / A[i-K] * A[i]

        if mae < ato:
            print("Yes")
        else:
            print("No")
        
        mae = ato
        
        

Fixed submission:
import numpy as np

if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    for i in range(K, N):
        if A[i-K] < A[i]:
            print("Yes")
        else:
            print("No")
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    A, B, C, K = list(map(int, input().split()))
    sum = 0
    for i in range(K):
        if i < A:
            sum += 1
        elif A<= i < A+B:
            sum = sum
        elif A+B <= i < A+B+C:
            sum -= 1
    print(sum)

Fixed submission:
if __name__ == "__main__":
    A, B, C, K = list(map(int, input().split()))
    if A > K:
        print(K)
    elif A <= K <= A+B:
        print(A)
    else:
        print(A-1*(K-A-B))
Buggy python submission (verdict: Time Limit Exceeded):
import string
def main():
    a = string.ascii_lowercase
    list = []
    num = int(input())

    while(num >= 0):
        list.append(num % 26)
        num = num // 26

    ans = []
    for i in range(1,len(list)+1):
        ans.append(a[list[len(list) - i] - 1])

    print(''.join(ans))


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    a = [chr(ord('a') + i) for i in range(26)]
    a.insert(0,"a")
    list = []
    num = int(input()) 

    while(num > 0):
        if(num % 26 == 0):
            list.append(26)
            num = num // 26 -1
            continue
        else:
            list.append(num % 26)
        num = num // 26

    list.reverse()

    ans = []
    for i in range(0,len(list)):
        ans.append(a[list[i]])
    print(''.join(ans))
    


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import itertools

def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = set(a)
    ansAry = [0] * 10000000

    num = len(a) - len(b)

    count = 0

    a.sort()

    x =  list(itertools.combinations(a,2))
    # print (x)

    
    for i in range(len(x) // 3 * 2):
        if x[i][1] % x[i][0] == 0 and ansAry[x[i][1]] == 0 :
            count += 1
            ansAry[x[i][1]] = 1

    print(n - count - num)

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    x = list(map(int,input().split()))
    ans = x.index(0)

    print(ans+1)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n,m = map(int,input().split())
    h = list(map(list,input().split()))

    for i in range(n):
        h[i].append(int(h[i][0]))

    for i in range(m):
        a,b = map(int,input().split())
        h[a-1].append(int(h[b-1][0]))
        h[b-1].append(int(h[a-1][0]))

    cnt = 0

    for i in range(n):
        if (max(h[i][1:]) == int(h[i][0])):
            if len(h[i][1:]) == len(set(h[i][1:])):
                cnt += 1
    print(cnt)
    
if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n,m = map(int,input().split())
    h = list(map(int,input().split()))
    A = [0] * n
    for i in range(m):
        a,b = map(int,input().split())
        A[a-1] = max(A[a-1],h[b-1])
        A[b-1] = max(A[b-1],h[a-1])

    cnt = 0

    for i in range(n):
        if A[i] < h[i]:
            cnt += 1

    print(cnt)
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def has_duplicates(seq):
    return len(seq) == len(set(seq))

def main():
    n,m = map(int,input().split())
    h = list(map(list,input().split()))

    # h[0].append(int(h[1][0]))
    for i in range(n):
        h[i].append(int(h[i][0]))

    for i in range(m):
        a,b = map(int,input().split())
        h[a-1].append(int(h[b-1][0]))
        h[b-1].append(int(h[a-1][0]))

    cnt = 0

    for i in range(n):
        if max(h[i][1:]) == int(h[i][0]):
            if has_duplicates(h[i][1:]):
                cnt +=1
    print(cnt)
    
if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n,m = map(int,input().split())
    h = list(map(int,input().split()))
    A = [0] * n
    for i in range(m):
        a,b = map(int,input().split())
        A[a-1] = max(A[a-1],h[b-1])
        A[b-1] = max(A[b-1],h[a-1])

    cnt = 0

    for i in range(n):
        if A[i] < h[i]:
            cnt += 1

    print(cnt)
    
if __name__ == "__main__":
    main()