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

Fixed submission:
lastWeek = input()

thisWeek = "ABC" if (lastWeek == "ARC") else "ARC"

print(thisWeek)

Buggy submission (verdict: Runtime Error):
N, K = input().split(' ')

sunukekuns = [i for i in range(N)]

for k in range(K):
  _ = input()
  sunukekun = input().split(' ')
  for (kun in sunukekun):
    if kun in sunukekuns:
      sunukekuns.remove(kun)

print(len(sunukekuns))
Problem p02747 (python)

Fixed submission:
text = input()

def checkHitachi(text):
  # odd length
  if (len(text)%2 != 0): 
    return 'No'
  # even length
  for i in range(0, len(text)-1, 2):
    if (text[i:i+2]!='hi'):
      return 'No'

  return 'Yes'
 
print(checkHitachi(text))

Buggy submission (verdict: Runtime Error):
text = input()

def checkHitachi(text):
  if (len(text)%2 != 0): # odd length
    return 'No'
  # even length
  for i in range(0, len(text), 2):
    if !((text[i]=='h') and (text[i+1]=='i')):
      return 'No'

  return 'Yes'
 
print(checkHitachi(text))

Buggy submission (verdict: Runtime Error):
text = input()

check_i = False

def checkHitachi(text):
  for i in range(len(text)):
    if check_i:
      if (text[i] != 'i'):
        return 'No'
      else:
        check_i = False
    else:
      if (text[i] != 'h'):
        return 'No'
      else:
        check_i = True
  return 'Yes'

print(checkHitachi(text))
Problem p02748 (python)

Fixed submission:
numA, numB, numCoupon = map(int, input().split(' '))
priceA = list(map(int, input().split(' ')))
priceB = list(map(int, input().split(' ')))

# initial best price
bestPrice = min(priceA) + min(priceB)

for n in range(numCoupon):
  # get coupon details
  typeA, typeB, discount = map(int, input().split(' '))
  # calculate price when this coupon is used
  currentPrice = priceA[typeA-1] + priceB[typeB-1] - discount
  # update best price
  if currentPrice < bestPrice:
    bestPrice = currentPrice

print(bestPrice)

Buggy submission (verdict: Runtime Error):
numA, numB, numCoupon = map(int, input().split(' '))
priceA = map(int, input().split(' '))
priceB = map(int, input().split(' '))

# initial best price
bestPrice = min(priceA) + min(priceB)

for n in range(numCoupon):
  # get coupon details
  typeA, typeB, discount = map(int, input().split(' '))
  # calculate price when this coupon is used
  currentPrice = priceA[typeA-1] + priceB[typeB-1] - discount
  # update best price
  if currentPrice < bestPrice:
    bestPrice = currentPrice

print(bestPrice)

Buggy submission (verdict: Runtime Error):
numA, numB, numCoupon = map(int, input().split(' '))
priceA = map(int, input().split(' '))
priceB = map(int, input().split(' '))

# initial best price
bestPrice = min(priceA) + min(priceB)

for n in range(numCoupon):
  # get coupon details
  typeA, typeB, discount = map(int, coupon.split(' '))
  # calculate price when this coupon is used
  currentPrice = priceA[typeA-1] + priceB[typeB-1] - discount
  # update best price
  if currentPrice < bestPrice:
    bestPrice = currentPrice

print(bestPrice)
Problem p02755 (python)

Fixed submission:
import numpy as np

# get input
eight, ten = map(lambda x: int(x), input().split(' '))

def oriPrice(a, b):
  """
  <int> a = round(0.08 * ori)
  <int> b = round(0.10 * ori)
  """
  # ori = b * 10 ~ (b+1)*10 - 1
  possibleOri = [(b+1)/0.10-i for i in range(10, 0, -1)]
  
  for i in range(len(possibleOri)):
    if np.int(np.floor(possibleOri[i]*0.08)) == a:
      return np.int(possibleOri[i])
  
  return -1

print(oriPrice(eight, ten))

Buggy submission (verdict: Runtime Error):
import numpy as np

# get input
eight, ten = map(lambda x: int(x), input().split(' '))

def oriPrice(a, b):
  """
  <int> a = round(0.08 * ori)
  <int> b = round(0.10 * ori)
  """
  # ori = b*10 ~ (b+1)*10 - 1
  for i in range(10, 0, -1):
    possibleOri = (b+1)/0.10-i
    if np.int(np.floor(possibleOri*0.08)) == a:
      return possibleOri[i]
    
  return -1

print(oriPrice(eight, ten))
Problem p03059 (python)

Fixed submission:
a, b, t = map(int, input().split(' '))
print(int((t+0.5)//a*b))

Buggy submission (verdict: Runtime Error):
a, b, t = map(int, input().split(' '))
return (t+0.5)//a*b

Buggy submission (verdict: Runtime Error):
A, B, T = input().split()
return int((int(T)+0.5)//int(A)*int(B))

Buggy submission (verdict: Runtime Error):
A, B, T = input().split()
return int((T+0.5)//A*B)
Problem p03062 (python)

Fixed submission:
def getNumNeg(L):
  return sum([i<0 for i in L])
  
def findmax2(L):
  numNeg = getNumNeg(L)
  absL = list(map(abs, L))
  if numNeg % 2 == 0:
    print(sum(absL))
  else:
    print(sum(absL)-2*min(absL))
        
n = int(input())
a = list(map(int, input().split()))
findmax2(a)

Buggy submission (verdict: Runtime Error):
def getNumNeg(L):
  return sum([i<0 for i in L])
  
def findmax2(L):
  numNeg = getNumNeg(L)
  absL = list(map(abs, L))
  if numNeg % 2 == 0:
    print(sum(absL))
  else:
    print(sum(absL)-min(absL))
        
n = int(input())
a = list(map(abs, input().split()))
findmax2(a)

Buggy submission (verdict: Runtime Error):
def getNumNeg(L):
    return sum([i<0 for i in L])
  
def findmax2(L):
    numNeg = getNumNeg(L)
    absL = list(map(abs, L))
    if numNeg % 2 == 0:
        print(sum(absL))
    else:
        print(sum(absL)-min(absL))
        
n = int(input())
a = list(map(abs, input().split()))
findmax2(a)

Buggy submission (verdict: Runtime Error):
def getNumNeg(L):
    return sum([i<0 for i in L])

def findmax(L):
    numNeg = getNumNeg(L)
    if numNeg % 2 == 0: # end-point: all positive
         while getNumNeg(L) != 0:
            i = L.index(min(L[:-1]))
            j = i + 1
            L[i] = L[i] * (-1)
            L[j] = L[j] * (-1)
        print(sum(L))
    else: # end-point: smallest abs(number) is negative
        absL = list(map(abs, L))
        stop = min(absL)*(-1)
        while (getNumNeg(L) != 1) or (min(L) != stop):
            i = L.index(min(L[:-1]))
            j = i + 1
            L[i] = L[i] * (-1)
            L[j] = L[j] * (-1)
        print(sum(L))

n = int(input())
a = list(map(int, input().split()))
findmax(a)

Buggy submission (verdict: Runtime Error):
def getNumNeg(L):
    return sum([i<0 for i in L])

def findmax(L):
    numNeg = getNumNeg(L)
    print(numNeg)
    if numNeg % 2 == 0: # end-point: all positive
         while getNumNeg(L) != 0:
            i = L.index(min(L[:-1]))
            j = i + 1
            L[i] = L[i] * (-1)
            L[j] = L[j] * (-1)
        print(sum(L))
    else: # end-point: smallest abs(number) is negative
        absL = list(map(abs, L))
        stop = min(absL)*(-1)
        while (getNumNeg(L) != 1) or (min(L) != stop):
            i = L.index(min(L[:-1]))
            j = i + 1
            L[i] = L[i] * (-1)
            L[j] = L[j] * (-1)
        print(sum(L))

n = int(input())
a = list(map(int, input().split()))
findmax(a)

Buggy submission (verdict: Runtime Error):
def getAbs(L):
  return list(map(abs, L))

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

stop = min(getAbs(a))
while min(a) != stop*(-1):
  if a == getAbs(a):
    break
  i = a.index(min(a))
  j = i + 1
  a[i] = a[i] * (-1)
  a[j] = a[j] * (-1)
print(sum(a))
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 = (int, input().split())

if A == B == C:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = (int, input().split())

if A == B == C :
    print("Yes")
else :
    print("No")
Problem p03795 (python)

Fixed submission:
n = int(input())
  
meal_price = n * 800
meal_discount_count = n // 15
  
print (meal_price - (meal_discount_count * 200))

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

meal_price = n * 15
meal_discount_count = n // 15

return meal_price - (meal_discount_count * 200)
Problem p02741 (python)

Fixed submission:
import sys

lst=[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]
pos = input()
print(lst[int(pos)-1])

Buggy submission (verdict: Runtime Error):
import math
a,b,c=map(int, input().split())
msg= "Yes" if math.sqrt(a)+math.sqrt(b)<math.sqrt(c) else "No"
print(msg)

Buggy submission (verdict: Runtime Error):
import sys
lst=[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(lst[int(sys.argv[1])-1])

Buggy submission (verdict: Runtime Error):
import sys
lst=[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(lst[sys.argv[1]-1])

Buggy submission (verdict: Runtime Error):
import sys
lst=[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(lst[sys.args[1]-1])
Problem p02573 (python)

Fixed submission:
import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

ans=0
g=[]
n=0
input()
for s in sys.stdin:
    x=set()
    d=[]
    for a in s.split():
        x.add(a)
        for i in range(len(g)):
            if a in g[i]:
                d+=[i]
                x|=g[i]
    for i in d:
        del g[i]
    g.append(x)

if g:
    print(max(len(t) for t in g))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys

ans=0
g=set()
input()
for s in sys.stdin:
    for a in s.split():
        for u in [*g]:
            if a in u:
                g.discard(u)
                s+=u
    g.add(s)

print(max(len(set(t.split())) for t in g))

Buggy submission (verdict: Runtime Error):
import sys

ans=0
g=set()
input()
for s in sys.stdin:
    for a in s.split():
        for u in [*g]:
            if a in u:
                g.discard(u)
                s+=u
    g.add(s)

print(max(len(set(t.split())) for t in g))

Buggy submission (verdict: Runtime Error):
import sys

ans=0
g=[]
input()
for s in sys.stdin:
    for a in s.split():
        for u in g:
            if a in u:
                s+=u
    g+=[s]


print(max(len(set(t.split())) for t in g))
Problem p02576 (python)

Fixed submission:
N,X,T=map(int,input().split())
print((N//X+(N%X!=0))*T)

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

ans=mx=0
for x in a:
    mx=max(mx,x)
    ans+=mx-x

print(ans)
Problem p02579 (python)

Fixed submission:
import sys
from heapq import *

H,W=map(int,input().split())
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=list(sys.stdin)

ans=-1
hp=[(0,si,sj)]
dirs=[-2,-1,0,1,2]
dist=[[float('inf')]*W for _ in range(H)]
dist[si][sj]=0
while hp:
    k,i,j=heappop(hp)
    if i==ti and j==tj:
        ans=k
        break
    if k>dist[i][j]:
        continue
    for di in dirs:
        for dj in dirs:
            if di==dj==0:
                continue
            ni,nj=i+di,j+dj
            if not (0<=ni<H and 0<=nj<W):
                continue
            if A[ni][nj]=='#':
                continue
            if abs(di)+abs(dj)==1:
                nk=k
            else:
                nk=k+1
            if nk>=dist[ni][nj]:
                continue
            dist[ni][nj]=nk
            heappush(hp,(nk,ni,nj))

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from heapq import *

H,W=map(int,input().split())
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=list(sys.stdin)

ans=-1
hp=[(0,si,sj)]
dirs=[-2,-1,0,1,2]
dist=[[float('inf')]*W for _ in range(H)]
dist[si][sj]=0
while hp:
    k,i,j=heappop(hp)
    if i==ti and j==tj:
        ans=k
        break
    if k>dist[i][j]:
        continue
    dist[ni][nj]=nk
    for di in dirs:
        for dj in dirs:
            if di==dj==0:
                continue
            ni,nj=i+di,j+dj
            if not (0<=ni<H and 0<=nj<W):
                continue
            if A[ni][nj]=='#':
                continue
            if abs(di)+abs(dj)==1:
                nk=k
            else:
                nk=k+1
            heappush(hp,(nk,ni,nj))

print(ans)
Problem p02613 (python)

Fixed submission:
import sys

next(sys.stdin)

ct=dict(zip('AC WA TLE RE'.split(),[0]*4))
for s in map(str.strip,sys.stdin):
    ct[s]+=1

for k,v in ct.items():
    print(k,'x',v)

Buggy submission (verdict: Runtime Error):
import sys
input()
d=dict.fromkeys('AC WA TLE RE'.split(),0)
for ln in sys.stdin:
    d[ln.strip()]+=1
for k,v in ct.items():
    print(k,'x',v)
Problem p02761 (python)

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

x=[-1]*N
ok=True
for _ in range(M):
    s,c=map(int,input().split())
    s-=1
    if (s==0 and c==0 and N>1) or x[s]!=-1 and x[s]!=c:
        ok=False
        break
    x[s]=c

if ok:
    ans=0
    for i in range(N):
        if x[i]==-1:
            x[i]=0 if (i>0 or N==1) else 1
        ans=ans*10+x[i]
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys

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

x=[-1]*N
valid=True
for _ in range(M):
    s,c=map(int,input().split())
    if x[s-1]!=-1 and x[s-1]!=c:
        print(-1)
        sys.exit(1)
    x[s-1]=c

if N>1 and x[0]==0:
    print(-1)
else:
    ans=0
    for i in range(N):
        if x[i]==-1:
            if i>0 or N==1:
                x[i]=0
            else:
                x[i]=1
        ans=ans*10+x[i]
    print(ans)
Problem p03316 (python)

Fixed submission:
S=input()
print('YNeos'[int(S)%sum(map(int,S))!=0::2])

Buggy submission (verdict: Runtime Error):
S=input()
print('YNEOS'[sum(map(int,S))%int(s)==0::2])

Buggy submission (verdict: Runtime Error):
S=input()
print(sum(map(int,S))%int(s)==0
Problem p03341 (python)

Fixed submission:
N=int(input())
S=input()
l,r=[0]*N,[0]*N
for i in range(N-1):
    l[i+1]+=l[i]+(S[i]=='W')
for i in range(N-1,0,-1):
    r[i-1]+=r[i]+(S[i]=='E')
ans=3*10**5
for i in range(N):
    ans=min(ans,l[i]+r[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input()
d={k:0 for k in 'AC WA TLE RE'.split()}
for ln in sys.stdin:
    d[ln.strip()]+=1
for k,v in d.items():
    print(k,'x',v)
Problem p02582 (python)

Fixed submission:
a = list(input())
c = 0
x = []
for i in a:
    
    if i == 'R':
        c += 1
    else:
        x.append(c)
        c = 0
    x.append(c)
print(max(x))

Buggy submission (verdict: Runtime Error):
a = input()
c = 0
x = []
for i in a:
	if i == 'R':
		c+=1
	if i == "S":
		x.append(c)	
      	c = 0
print(max(x))
Problem p04043 (python)

Fixed submission:
a = input().split()

if a.count('5') == 2 and a.count('7') == 1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
D = set(map(int, input().split()))
for ans in range(n,9999):
    for c in str(ans):
        if int(c) in D:
            break
    else:
        print(ans)
        break
Problem p02658 (python)

Fixed submission:

n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort()

ans = 1

for num in arr:
    ans *= num

    if ans > 10**18:
        print(-1)
        exit(0)

print(ans)

Buggy submission (verdict: Runtime Error):
 = int(input().strip())
arr = list(map(int, input().strip().split()))

ans = 1

for num in arr:
	ans *= num
	
if ans > 10**18:
	print(-1)
else:
	print(ans)
Problem p03160 (python)

Fixed submission:
class Solution:
  def solve(self, sHeights):
    if not sHeights or len(sHeights) == 0:
      return 0
    
    n = len(sHeights)
    
    dp = [0 for _ in range(n)]
    dp[0] = 0
    dp[1] = abs(sHeights[1] - sHeights[0])
    
    for i in range(2, n):
      dp[i] = min(dp[i-1] + abs(sHeights[i] - sHeights[i-1]), dp[i-2] + abs(sHeights[i] - sHeights[i-2]))
      
    return dp[n-1]
  
sol = Solution()

n = int(input().strip())

s = list(map(int, input().strip().split()))

print(sol.solve(s))

Buggy submission (verdict: Runtime Error):

class Solution:
	def solve(self, sHeights):
		if not sHeights or len(sHeights) == 0:
			return 0
			
		n = len(sHeights)
			
		dp = [0 for _ in range(n)]
		dp[0] = 0
		dp[1] = abs(sHeights[1] - sHeights[0])
		
		for i in range(2, n):
			dp[i] = min(dp[i-2] + abs(sHeights[i] - sHeights[i-2]), dp[i-1] + abs(sHeights[i] - sHeights[i-1]))
			
		print(dp)
			
		return dp[n-1]
		
sol = Solution()

# s = [10, 30, 40, 20]
# s = [10, 10]
# s = [30,10,60,10,60,50]

int n = int(input().strip())
s = list(map(int, input().strip().split())
print(sol.solve(s))
Problem p02615 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = a[0]
idx = 1
for i in range(1, n):
    if idx == n - 1:
        break
    ans += a[i]
    idx += 1
    if idx == n - 1:
        break
    ans += a[i]
    idx += 1
print(ans)

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

a.sort(reverse=True)
ans = a[0]
i = 1
while True:
    ans += a[i]
    i += 1
    if i == n - 1:
        break
    ans += a[i]
    i += 1
    if i == n - 1:
        break
print(ans)
Problem p02642 (python)

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

xs = [0] * (max(a) + 1)

for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))

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

xs = [0] * (2 * (10 ** 5) + 1)

for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))

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

xs = [0] * (2 * (10 ** 5) + 1)
for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))

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

xs = [0] * (2 * 10 ** 5 + 1)
for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))

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

xs = [0] * (2 * 10 ** 5 + 1)
for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))
Problem p02683 (python)

Fixed submission:
n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
    xs = list(map(int, input().split()))
    c[i] = xs[0]
    a[i] = xs[1:]
ans = 10 ** 9
for i in range(2 ** n):
    csum = 0
    asum = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            csum += c[j]
            for k in range(m):
                asum[k] += a[j][k]
    if len(list(filter(lambda v: v >= x, asum))) == m:
        ans = min(ans, csum)
print(-1 if ans == 10 ** 9 else ans)

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
    xs = list(map(int, input().split()))
    c[i] = xs[0]
    a[i] = xs[1:]
ans = 10 ** 9
for i in range(2 ** n):
    csum = 0
    asum = [0] * n
    for j in range(n):
        if (i >> j) & 1:
            csum += c[j]
            for k in range(m):
                asum[k] += a[j][k]
    if len(list(filter(lambda v: v >= x, asum))) == m:
        ans = min(ans, csum)
print(-1 if ans == 10 ** 9 else ans)
Problem p02684 (python)

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

b = 0
r = k + 1
seen = [-1] * n
seen[0] = 0
p = 1
for i in range(k):
    p = a[p - 1]
    if seen[p - 1] != -1:
        b = seen[p - 1]
        r = i + 1 - b
        for j in range((k - b) % r):
            p = a[p - 1]
        print(p)
        exit()
    seen[p - 1] = i + 1
else:
    print(p)

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

ans = 0
r = 0
p = 0
seen = {0}
for i in range(k):
    x = a[p] - 1
    if x in seen:
        p = 0
        seen = {0}
        for j in range((k - 1) % r):
            p = a[p] - 1
            ans = p + 1
        print(ans)
        exit()
    p = x
    seen.add(p)
    r = i + 1
    ans = p + 1
print(ans)
Problem p02687 (python)

Fixed submission:
x = input()
if x == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
c = 0
p=[0]*N
for i in range(1,N+1):
  if i not in A and i not in B:
    c = c+1
  else:
    for j in range(1,M+1):
      if i == A[j-1]:
        if H[A[j-1]-1] > H[B[j-1]-1]:
          p[i-1] = p[i-1]+1
      if i == B[j-1]:
        if H[B[j-1]-1] > H[A[j-1]-1]:
          p[i-1] = p[i-1]+1
    if p[i-1] == A.count(i)+B.count(i):
      c =c+1
print(c)
Problem p02681 (python)

Fixed submission:
s=input()
t=input()
if s==t[0:len(t)-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
if a>=k:
  ans=k
elif a+b>=k:
  ans=a
else:
  ans=a-(k-(a+b))
print(ans)
Problem p02705 (python)

Fixed submission:
import math
r=int(input())
ans=math.pi*r*2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
    ans=a.count(i)
    print(ans)
Problem p02714 (python)

Fixed submission:
n=int(input())
s=input()

r_cnt=s.count("R")
g_cnt=s.count("G")
b_cnt=s.count("B")

ans=r_cnt*g_cnt*b_cnt

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>=n:
            break
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            ans-=1

print(ans)

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

r_cnt=s.count("R")
g_cnt=s.count("G")
b_cnt=s.count("B")

ans=r_cnt*g_cnt*b_cnt

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            ans-=1

print(ans)
Problem p02784 (python)

Fixed submission:
h,n=map(int,input().split())
a=list(map(int,input().split()))
damage=sum(a)
if damage>=h:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=list(map(int,input().split())
damage=sum(a)
if damage>=h:
    print("Yes")
else:
    print("No")
Problem p02848 (python)

Fixed submission:
n=int(input())
s=input()
ans=[]
for i in s:
    ans.append(chr((ord(i)-65+n)%26+65))
ans="".join(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
for i in s:
    i=chr()
ans="".join(s)
print(ans)
Problem p02953 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
base=0
for i in h:
    if base>i:
        ans="No"
        break
    base=max(base,i-1)
else:
    ans="Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
base=0
for i in range(n):
    h=int(input())
    if base>h:
        ans="No"
        break
    base=max(base,h-1)
else:
    ans="Yes"
print(ans)
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==1:
    print("IMPOSSIBLE")
else:
    print(int((a+b)/2))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2=1:
    print("IMPOSSIBLE")
else:
    print((a+b)/2)
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(n):
    x,u=input().split()
    if u=="BTC":
        ans+=380000*float(x)
    else:
        ans+=int(x)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
    x,u=input().split()
    if u="BTC":
        ans+=380000*float(x)
    else:
        ans+=int(x)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
    x,u=int(input().split())
    if u="BTC":
        ans+=380000*x
    else:
        ans+=x
print(ans)