Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03339 (python)

Fixed submission:
n=int(input())
s=input()
left=[0]*(n+1)
right=[0]*(n+1)
for i in range(n):
    if s[i]=="W":
        left[i+1]=left[i]+1
    else:
        left[i+1]=left[i]

for i in range(n-1,0,-1):
    if s[i]=="E":
        right[i-1]=right[i]+1
    else:
        right[i-1]=right[i]
print(min([left[i]+right[i] for i in range(n)]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
half=n//2
if s[half]=="E":
    for i in range(n//2):
        if s[half+1]!=s[half]:
            break
        else:
            half+=1
else:
    for i in range(n//2):
        if s[half-1]!=s[half]:
            break
        else:
            half-=1
before=dict(Counter(s[0:half])).get("W",0)
after=dict(Counter(s[half+1:])).get("E",0)
print(before+after)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
half=n//2
if s[half]=="E":
    for i in range(n//2+1):
        if s[half+1]!=s[half]:
            break
        else:
            half+=1
else:
    for i in range(n//2+1):
        if s[half-1]!=s[half]:
            break
        else:
            half-=1
before=dict(Counter(s[:half])).get("W",0)
after=dict(Counter(s[half+1:])).get("E",0)
print(before+after)
Problem p03504 (python)

Fixed submission:
n,C=[int(i) for i in input().split()]
stc=[[int(i) for i in input().split()] for _ in range(n)]
time=[0]*(2*(10**5+1))
end=[[0]*(10**5+1) for _ in range(C)]   #チャンネル別の終わりの記録

for s,t,c in stc:
    end[c-1][t]+=1

for s,t,c in stc:
    if end[c-1][s]==0:
        time[2*s-1]+=1
    else:
        time[2*s]+=1
    time[2*t]-=1

for i in range(1,2*10**5+2):
    time[i]+=time[i-1]
print(max(time))

Buggy submission (verdict: Runtime Error):
n,C=[int(i) for i in input().split()]
stc=[[int(i) for i in input().split()] for _ in range(n)]
stc.sort(key=lambda x:x[1])
stc.sort(key=lambda x:x[2])
time=[0]*(2*(10**5+1))
end=[[0]*(10**5) for _ in range(C)]

for s,t,c in stc:
    end[c-1][t]+=1

for s,t,c in stc:
    if end[c-1][s]==0:
        time[2*s-1]+=1
    time[2*t]-=1
for i in range(1,2*10**5+2):
    time[i]=time[i-1]+time[i]
print(max(time))

Buggy submission (verdict: Runtime Error):
n,c=[int(i) for i in input().split()]
stc=sorted([[int(i) for i in input().split()] for _ in range(n)],key=lambda x:x[0])
time=[0]*(10**5)
for s,t,c in stc:
    time[s-1]+=1
    time[t]-=1
for i in range(10**5):
    time[i]=time[i-1]+time[i]
print(max(time))
Problem p03699 (python)

Fixed submission:
n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
tmp=ans
num=ans
if ans%10==0:
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
if ans%10==0:
    tmp=ans
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    num=ans
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))
Problem p02934 (python)

Fixed submission:
N=int(input())
A_lis=list(map(int,input().split()))
a=0        
for i in A_lis:
   a += 1/i
ans = 1/a
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A_lis=list(map(int,input().split())
x=0           
for i in A_lis:
   x += 1/i
ans = 1/x
print(ans)
Problem p02982 (python)

Fixed submission:
N, D = map(int, input().split())
X = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    tmp = 0
    for k in range(D):
      tmp += abs(X[i][k]-X[j][k])**2
    tmp = tmp**0.5
    if tmp == int(tmp):
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    tmp=0
    for k in range(d):
      tmp+=abs(x[i][d]-x[j][d])**2
    tmp=tmp**0.5
    if tmp==int(tmp):1
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
x=[list(map(int,input().split()))]
ans=0
for i in range(n):
  for j in range(i+1,n):
    tmp=0
    for k in range(d):
      tmp+=abs(x[i][d]-x[j][d])**2
    tmp=tmp**0.5
    if tmp==int(tmp):1
      ans+=1
print(ans)
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
ans=0
oh=0
l=[int(i) for i in input().split()] 
for j in l:
  if x>=oh:
    ans+=1
  oh+=j
if sum(l)<=x:
    print(ans+1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
,x=map(int,input().split())
ans=0
oh=0
l=[int(i) for i in input().split()]
for j in l:
  if sum(l)<=x:
      if x>=oh:
          ans+=1
  elif x>=oh:
      ans+=1
  oh+=j   
if sum(l)<=x:
  print(ans+1)
else:
  print(ans)
Problem p03029 (python)

Fixed submission:
a,p = map(int,input().split())
print((a*3+p)//2)

Buggy submission (verdict: Runtime Error):
a,p = map(int,input().split())
 print(int((a*3+p)//2))
Problem p03047 (python)

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

for i in range(k):
      nm=[i,1+i ]
for j in range (n):
      nm1=[i,1+i]
print(n-k+1)

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

for i in range( 0, n ):
	m =  input() 
	print(m)
nm=0
nm1=0
cnt=m
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

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

for i in range( 0, n ):
	m =  input() 
	print(m)
nm=0
nm1=0
cnt=m
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)
Problem p03049 (python)

Fixed submission:
N = int(input())
c1 = 0
c2 = 0
c3 = 0
count = 0
for i in range(N):
  s = input()
  count += s.count('AB')
  if s[0] == 'B' and s[-1] == 'A':
    c1 += 1
  elif s[0] == 'B' and s[-1] != 'A':
    c2 += 1
  elif s[0] != 'B' and s[-1] == 'A':
    c3 += 1
  else:
    pass

if c1 == 0:
  print(count + min(c2,c3))
else:
  if c2 > 0 or c3 > 0:
    print(count + c1 + min(c2,c3))
  else:
    print(count + c1-1)

Buggy submission (verdict: Runtime Error):
n=input()
s1,s2=input()      
nm=0
nm1=0
cnt=s1+s2
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

Buggy submission (verdict: Runtime Error):
n=input()
while True:
       for j in range(n):
              j=input()
       
nm=0
nm1=0
cnt=j
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)
Problem p03063 (python)

Fixed submission:
N=int(input())
S = input()
white = S.count(".")
black = 0
ans = white + black
for i in range (N):
    if S[i] == "." :
        white -= 1
    else:
        black += 1
    ans = min(ans,white+black)
print(ans)

Buggy submission (verdict: Runtime Error):
=int(input())
s=input()
bl=s.count('#')
wh=s.count('.')
if bl>wh:
    print(wh)
elif wh>bl:
    print(bl)
Problem p03071 (python)

Fixed submission:
a,b=map(int, input().split())
x=0
if a==b:
    x=a+b
elif a>b:
    x=a+a-1
else:
    x=b+b-1
print(x)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
x=0
if a=b:
    print(a+b)
elif a>b:
    print(a+a-1)
else:
    print(b+b-1)
Problem p03079 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b==c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c:
    print('Yes')
else:
    print('No')
Problem p03210 (python)

Fixed submission:
x=int(input())

if x==7 or x==5 or x==3:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print('YES)
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print(YES)
else:
    print(NO)

Buggy submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print(Yes)
else:
    print(No)
Problem p02657 (python)

Fixed submission:
arr = input().split(' ')
a = int(arr[0])
b = int(arr[1])
print (a * b)

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')
print (a * b)
Problem p02658 (python)

Fixed submission:
n = int(input())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
print (res)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
p
Problem p02606 (python)

Fixed submission:
l, r, d = map(int, input().split())
cnt = 0
for i in range(l, r+1):
  if i%d == 0:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
, r, d = map(int, input().split())
cnt = 0
for i in range(l, r+1):
  if i%d == 0:
    cnt += 1
print(cnt)
Problem p02607 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
  if (i+1)%2 != 0 and a[i]%2 != 0:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input()
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
  if (i+1)%2 != 0 and a[i]%2 != 0:
    cnt += 1
print(cnt)
Problem p02612 (python)

Fixed submission:
n = int(input())
print(0 if n%1000 == 0 else 1000*((n//1000)+1) - n)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(print(0 if n%1000 == 0 else 1000*((n//1000)+1) - n)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
unique = set(range(0, 102)) - set(p)
ans = {}
ans2 = []
for i in unique:
  calc = abs(x-i)
  if calc in ans.keys():
    ans[calc] = min(ans[calc], i)
  else:
    ans[calc] = i
  ans2.append(calc)
print(ans[min(ans2)])

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
unique = set(range(1, max(p)+1)) - set(p)
ans = {}
ans2 = []
for i in unique:
  calc = abs(x-i)
  ans[calc] = i
  ans2.append(calc)
print(ans[min(ans2)])
Problem p02658 (python)

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):
    ans *= a[i]
    if ans > 10**18:
      ans = -1
      break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(input().split()))
ans = 1
if 0 in a:
  ans = 0
else:
  for i in range(n):
    ans *= a[i]
    if ans >= 10**18:
      ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(input().split()))
ans = 1
if 0 in a:
  ans = 0
for i in range(n):
  ans *= a[i]
  print(i)
if ans >= 10**18:
  ans = -1
print(ans)
Problem p02713 (python)

Fixed submission:
from math import gcd
ans = 0
k = int(input())
for i in range(1, k+1):
  for j in range(1, k+1):
    GCD = gcd(i, j)
    for l in range(1, k+1):
      ans += gcd(GCD, l)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
x = np.arange(1, K + 1)
nums = np.gcd.outer(np.gcd.outer(x, x), x)
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
ans = 0
if n%k != 0:
  ans = (min(n, abs((n%k) - k)))
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
if n > k:
  if n%k != 0:
    ans = min(n, abs((n%k) - k))
  else:
    ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
if n > k:
  if n%k != 0:
    ans = min(n, abs((n%k) - k))
  else:
    ans = 0
print(ans)
Problem p02741 (python)

Fixed submission:
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
Problem p02760 (python)

Fixed submission:
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
ans  = [[False]*3 for _ in range(3)]
result = 'No'
for i in range(3):
  for j in range(3):
    for k in b:
      if a[i][j] == k:
        ans[i][j] = True 
for i in ans:
    if all(i):
      result = 'Yes'
for i in range(3):
  cnt = 0
  for j in range(3):
    if ans[j][i]:
      cnt += 1
  if cnt == 3:
    result = 'Yes'
    break
if ans[0][0] and ans[1][1] and ans[2][2]:
  result = "Yes"
if ans[0][2] and ans[1][1] and ans[2][0]:
  result = "Yes"
print(result)

Buggy submission (verdict: Runtime Error):
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
ans  = 'No'
for i in range(3):
  for j in range(3):
    for k in b:
      if a[i][j] == k:
        a[i][j] = 0
for i in range(3):
  if a[i][0] + a[i][1] + a[i][2] == 0:
    ans = 'Yes'
  if a[0][i] + a[1][i] + a[2][i] == 0:
    ans = 'Yes'
if A[0][0]+A[1][1]+A[2][2]==0:
  ans = "Yes"
if A[0][2]+A[1][1]+A[2][0]==0:
  ans = "Yes"
print(ans)
Problem p02765 (python)

Fixed submission:
n,r = map(int,input().split())
if n>10:
  print(r)
else:
  print(r+100*(10-n))

Buggy submission (verdict: Runtime Error):
n,r = int(input())
if n>10:
  print(r)
else:
  print(r-(100*(10-n)))

Buggy submission (verdict: Runtime Error):
n,r = int(input())
if n>10:
  print(r)
else:
  print(100*(10-n))
Problem p02767 (python)

Fixed submission:
n = int(input())
X = list(int(x)for x in input().split())
ans = []
for p in range(min(X),max(X)+1):
  total = 0 
  for x in X:
    total += (x-p)**2
  ans.append(total)
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
X = list(int(x)for x in input().split())
ams = []
for p in range(min(X),max(X)):
  total = 0
  for x in X:
    total += (x-p)**2
  ans.append(total)
print(min(ans))
Problem p02789 (python)

Fixed submission:
n,m = map(int, input().split())
print('Yes' if n == m else 'No')

Buggy submission (verdict: Runtime Error):
n,m = map(int, intput().split())
print('Yes' if n==m else 'No')

Buggy submission (verdict: Runtime Error):
n,m = map(int, intput().split())
print('Yes' if N==M else 'No')
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = map(input().split())
print(s+t)
Problem p02848 (python)

Fixed submission:
n= int(input())
s = input()
al='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(''.join([al[-len(al)+al.index(i)+n] for i in s]))

Buggy submission (verdict: Runtime Error):
n= int(input())
s = input()
al='ABCDEFGHIJKLMNOPQRSTUVXXYZ'
print(''.join([al[-len(al)+al.index(i)+n] for i in s]))
Problem p02909 (python)

Fixed submission:
s =input()
ans = ["Sunny","Cloudy","Rainy"]
ans_index = (ans.index(s)+1)%3 -1
print(ans[ans_index+1])

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=[k-q]*n
for i in range(q):
    point=int(input())
    a[point-1] += 1
for i in range(len(l)):
    if l[i] > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=[k-q]*n
for i in range(q):
    point=int(input())
    a[point-1] += 1
for i in range(len(l)):
    if l[i] > 0:
        print("Yes")
    else:
        print("No")
Problem p02911 (python)

Fixed submission:
n,k,q=map(int,input().split())
a=[k-q]*n
for i in range(q):
    point=int(input())
    a[point-1] += 1
for i in range(len(a)):
    if a[i] > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
from collections import deque
n,k,q = map(int, input().split())
start = [k-q]*n
points = deque(start)
for i in range(q):
    point = int(input())
    points[i-1] += 1
for _ in range(len(points)):
  x = points.popleft()
  if x <= 0:
    print('No')
  else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=[k-q]*n
for i in range(q):
    point=int(input())
    a[point-1] += 1
for i in range(len(l)):
    if l[i] > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=[k-q]*n
for i in range(q):
    point=int(input())
    a[point-1] += 1
for i in range(len(l)):
    if l[i] > 0:
        print("Yes")
    else:
        print("No")

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

Buggy submission (verdict: Runtime Error):
n,k,q = map(int, input().split())
a = [k-q]*n
for i in int(input()):
  a[i-1] += 1
for i in points:
  if i <= 0:
    print('No')
  else:
    print('Yes')
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
count = 0
for i,j in zip(s,t):
  if i==j:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
count = 0
 for i,j in zip(s,t):
  if i==j:
     count += 1
print(count)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
ans = -1*float('inf')
cnt = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
ans = max(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = []
for i in range(0,n-1):
  count = 0
  while h[i] >= h[i+1]:
    count += 1
    if h[i] < h[i+1]:
      break
  ans.append(count)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = []
for i in range(0,n-1):
  if h[i] < h[i+1]:
    ans.append(count)
    count = 0
  if h[i] >= h[i+1]:
    count+= 1
print(max(ans))
Problem p02924 (python)

Fixed submission:
n = int(input())
ans = 0
if n <= 2:
  ans = 1%n
else:
  ans = n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
ans = 0
if n <= 2:
  ans = 1%n
else:
  ans = n*(n-1)//2
print(ans)
Problem p02952 (python)

Fixed submission:
from math import log10
n = int(input())
cnt = 0
for i in range(1,n+1):
  if int(log10(i)+1) % 2 != 0 and i <= n:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n =int(input())
print(len([i for i in range(1, n+1) if int(log10(i)+1) % 2 != 0 and i <= n]))
Problem p02995 (python)

Fixed submission:
import fractions
a, b, c, d =map(int, input().split())
lcm = (c//fractions.gcd(c, d))*d
cnt = (b-a+1)
c_cnt = (b//c) - ((a-1)//c)
d_cnt = (b//d) - ((a-1)//d)
lcm_cnt = (b//lcm) - ((a-1)//lcm)
print(cnt + lcm_cnt - c_cnt - d_cnt)

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d =map(int, input().split())
lcm = (c//math.gcd(c, d))*d
cnt = (b-a+1)
c_cnt = (b//c)-((a-1)//c)
d_cnt = (b//d)-((a-1)//d)
lcm_cnt = (b//lcm)-((a-1)//lcm)
print(cnt+lcm_cnt-c_cnt-d_cnt)

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d =map(int, input().split())
lcm = (c//math.gcd(c, d))*d
cnt = (b-a+1)
c_cnt = (b//c) - ((a-1)//c)
d_cnt = (b//d) - ((a-1)//d)
lcm_cnt = (b//lcm) - ((a-1)//lcm)
print(cnt + lcm_cnt - c_cnt - d_cnt)
Problem p03106 (python)

Fixed submission:
a,b,k = map(int, input().split())
sp =[i for i in range(1, max(a,b)+1) if a%i == 0 and b%i==0]
sp.sort(reverse=True)
print(sp[k-1])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
sp =[i for i in range(1, max(a,b)) if a%i == 0 and b%i==0]
print(sp[k-1])
Problem p03136 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
if max(l) < sum(l) - max(l):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input(.split())))
ind = L.index(max(L))
if sum(L[ind-1:])+sum(L[:ind+1]) < max(L)
    print('Yes')
else:      
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input(.split())))
if sum(L[:N-1]) < max(L):
    print('Yes')
else:      
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int , [input() for i in range(n)]))
l_max = max(l)
if (sum(l) - l_max) > 0:
  print('Yes')
else :
  print('No')
Problem p03140 (python)

Fixed submission:
N = int(input())
A, B, C = input(), input(), input()
ans = 0
for i in range(N):
  ans += len(set([A[i], B[i], C[i]])) - 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
2 A, B, C = input(), input(), input()
3 ans = 0
4 for i in range(N):
5 ans += len(set([A[i], B[i], C[i]])) - 1
6 print(ans)
Problem p03193 (python)

Fixed submission:
n, h, w = map(int, input().split())
a_b = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
for i in range(n):
  if a_b[i][0] >= h and a_b[i][1] >= w:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
a_b = [list(map(int, input().split())) for _ range(n)]
cnt = 0
for i in range(n):
  if a_b[i][0] >= h and a_b[i][1] >= w:
    cnt += 1
print(cnt)
Problem p03220 (python)

Fixed submission:
n = int(input())
t,a =  map(int, input().split())
h = list(map(int, input().split()))
ave = [abs(a-(t-i*0.006)) for i in h]
print(ave.index(min(ave))+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T,A =map(int, input().split())
H = list(map(int, input().split()))
dif = [A-i for i in [int(T-h*0.006) for h in H]]
print(dif.index(min(dif)+1))
Problem p03238 (python)

Fixed submission:
n = int(input())
print('Hello World' if n ==1 else int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input()
b = input()
print('Hello World' if n ==1 else int(a)+int(b))
Problem p03294 (python)

Fixed submission:
import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def function(m, a):
  count = 0
  for i in a:
    count += m%i
  return count
def lcm_base(x, y):
    return (x * y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
max_num = lcm(*a)-1
print(function(max_num, a))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def function(m, a):
  count = 0
  for i in a:
    count += m%i
  return count
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
max_num = lcm(*a)-1
print(function(max_num, a))
Problem p03543 (python)

Fixed submission:
n = input()
ans = [str(i)*3 for i in range(0,10)]
print('Yes' if n[:3] in ans or n[1:] in ans else 'No')

Buggy submission (verdict: Runtime Error):
print('Yes' if input()[:3] in [str(i)*3 for i in range(0,10)] or input()[1:] in [str(i)*3 for i in range(0,10)] else 'No')
Problem p03644 (python)

Fixed submission:
N = int(input())
a = [N-2**i for i in range(0,7) if N-2**i >= 0]
min_index = a.index(min(a))
print(2**min_index)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [N-2**i for i in range(0,7) if N-2**i > 0]
min_index = a.index(min(a))
print(2**min_index)
Problem p03962 (python)

Fixed submission:
a = list(map(int, input().split()))
print(len(set(a)))

Buggy submission (verdict: Runtime Error):
abc = list(map(int, input().split()))
print(len(set(abc))
Problem p02582 (python)

Fixed submission:
s=input()
gou=0
if s[0]=="R" or s[1]=="R" or s[2]=="R":
  gou=1
if s[0]=="R" and s[1]=="R":
  gou=2
if s[1]=="R" and s[2]=="R":
  gou=2
if s[1]=="R" and s[2]=="R" and s[0]=="R":
  gou=3
print(gou)

Buggy submission (verdict: Runtime Error):
s=input()
gou=0
if s[0]=="R" and s[1]=="R":
  gou=2
if s[1]=="R" and s[2]=="R":
  gou=2
if s[1]=="R" and s[2]=="R" and s[3]=="R":
  gou=3
print(gou)
Problem p02640 (python)

Fixed submission:
x,y = map(int,input().split())
k = "No"
for i in range(x+1):
  b=x-i
  if (b*4)+(i*2)==y:
    k="Yes"
print(k)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().sprit())
k = "NO"
for i in range(x+1):
  b=x-i
  if i*4+b*2==y:
    k="YES"
print(k)