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

Fixed submission:
s = input()

wa = False

if s[0] != 'A':
  wa = True
if s[2:-1].count('C') != 1:
  wa = True

l_s = list(s)
  
if 'A' in l_s:
	del l_s[l_s.index('A')]

if 'C' in l_s:
	del l_s[l_s.index('C')]

for c in l_s:
  if c != c.lower():
    wa = True
    
if wa == True:
  print('WA')
else:
  print('AC')

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

wa = False

if s[0] != 'A':
  wa = True
print(s[2:-1])
if s[2:-1].count('C') != 1:
  wa = True

l_s = list(s)
  
del l_s[l_s.index('A')]

if 'C' in l_s:
	del l_s[l_s.index('C')]

for c in l_s:
  print(c.lower())
  if c != c.lower():
    wa = True
    
if wa == True:
  print('WA')
else:
  print('AC')

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

wa = False

if s[0] != 'A':
  wa = True

if s[2:-1].count('C') != 1:
  wa = True

l_s = list(s)
  
del l_s[l_s.index('A')]
del l_s[l_s.index('C')]

for c in l_s:
  if c != c.lower():
    wa = True
    
if wa == True:
  print('WA')
else:
  print('AC')
Problem p03573 (python)

Fixed submission:
a = list(map(int,input().split()))
 
for i in a:
  if a.count(i) <= 1:
    print(i)
    break

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

for i in a:
  if a.count(i) > 1:
    print(i)
    break
Problem p03827 (python)

Fixed submission:
s = input()
s = input()
x = 0
l_x = [0]
for c in s:
  x += 1 if c == 'I' else -1
  l_x.append(x)
    
print(max(l_x))

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

for c in s:
    x += 1 if c == 'I' else -1
    
print(max(x))
Problem p02640 (python)

Fixed submission:
input_line = input().split(" ")
X = int(input_line[0])
Y = int(input_line[1])
Pat = 0
for i in range(X + 1):
  C = i
  T = X - i
  Cf = C * 2
  Tf = T * 4
  F = Cf + Tf
  if Y == F:
      Pat = Pat + 1
if Pat > 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
input_line = input().split(" ")
X = int(input_line[0])
Y = int(input_line[1])
Pat = 0
for i in range(X + 1):
  	C = i
	T = X - i
    Cf = C * 2
    Tf = T * 4
    F = Cf + Tf
	if Y == F:
      Pat = Pat + 1
if Pat >= 0:
  print("Yes")
else:
  print("No")
Problem p03071 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b,=map(int,input().split())
if a*n>b:
    print(b)
if a*n<b:
    print(a*n)
if a*n==b:
    print(a*n)

Buggy submission (verdict: Runtime Error):
n,a,b,=map(int,input().split())
if a*n>b:
    print(b)
if a*n<b:
    print(a*n)
if a*n==b:
    print(a*n)
Problem p02641 (python)

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


if N == 0:
    print(X)
    exit()

for i in range(102):
    if X - i not in p:
        print(X - i)
        exit()
    
    if X + i not in p:
        print(X + i)
        exit()

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
p = list(map(int, input().split()))


if N == 0:
    print(X)

for i in range(102):
    if X - i not in p:
        print(x - i)
        exit()
    
    if X + i not in p:
        print(x + i)
        exit()

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
p = list(map(int, input().split()))


if N == 0:
    print(X)

for i in range(102):
    if x - i not in p:
        print(x - i)
        exit()
    
    if x + i not in p:
        print(x + i)
        exit()
Problem p02724 (python)

Fixed submission:
X = int(input())
nfh = X // 500
nf = (X - 500 * nfh) // 5
happy = 1000 * nfh + 5 * nf
print(happy)

Buggy submission (verdict: Runtime Error):
X = input()
nfh = X // 500
nf = (X - 500 * nfh) // 5
happy = 1000 * nfh + 5 * nf
print(happy)

Buggy submission (verdict: Runtime Error):
X = input()
n500 = X // 500
n5 = (X - 500 * n500) // 5
happy = 1000 * n500 + 5 * n5
print(happy)

Buggy submission (verdict: Runtime Error):
X = input()
n500 = X // 500
n5 = (X - 500 * n500) // 5
happy = 1000 * n500 + 5 * n5
print(happy)
Problem p03471 (python)

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

for a in range(N + 1):
    for b in range(N + 1 - a):
        if 10000 * a + 5000 * b + 1000 * (N - a - b) == Y:
            print(a, b, N - a - b)
            break
    else:
        continue
    break
else:
    print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())

for a in range(N + 1):
    for b in range(N + 1 - a):
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, N - a - b)
            break
    else:
        continue
    break
else:
    print(-1, -1, -1)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
Ans  = T // A * B
print(Ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
A.insert(0, 0)
dp = list([0] * 2 for i in range(n+1))
dp[0][0] = 0
dp[0][1] = -1000000000000
for i in range(1, n) :
    dp[i][0] = max(dp[i-1][0] + A[i], dp[i-1][1] - A[i])
    dp[i][1] = max(dp[i-1][0] - A[i], dp[i-1][1] + A[i])
ans = max(dp[n-1][0] + A[n], dp[n-1][1] - A[n])    

print(ans)

Buggy submission (verdict: Runtime Error):

def gcd(a, b) :
    if b == 0 :
        return a
    ret = gcd(b, a % b)
    return ret

def main( ) :

  n = int(input())
  v = [int(i) for i in input().split()]

  l = [0 for i in range(n)]
  r = l[:]

  for i in range(1, n) :
      l[i] = gcd(l[i-1], v[i-1])
      r[-i-1] = gcd(r[-i], v[-i])

  ans = 0
  for i in range(n) :
      ans = max(ans, gcd(l[i], r[i]))
  print(ans)
                 

main()
Problem p03494 (python)

Fixed submission:
_ = input()
INPUT = list(map(int, input().split()))

def check_even(l):
    return sum([i % 2 for i in INPUT]) == 0

check_even(INPUT)

count = 0
while True:
    if check_even(INPUT):
        INPUT = [i / 2 for i in INPUT]
        count+=1
    else:
        break
print(count)

Buggy submission (verdict: Runtime Error):
INPUT = [input() for i in range(2)]
INPUT = list(map(int, INPUT))

def check_even(l):
    return sum([i % 2 for i in INPUT]) == 0

check_even(INPUT)

count = 0
while True:
    if check_even(INPUT):
        INPUT = [i / 2 for i in INPUT]
        count+=1
    else:
        break
print(count)
Problem p02700 (python)

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

while True:
    c -= b
    if c<=0:
        print("Yes")
        exit()
        
    a -= d
    if a<=0:
        print("No")
        exit()

Buggy submission (verdict: Runtime Error):
46 4 40 5
Problem p02958 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
flag = 0

for i in range(n):
  if i+1 == p[i]:
    flag += 1

             

if flag >= n-2:
  print('YES')
else:
  print('NO')

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

for i in range(n):
	if i+1 == p[i]:
      	flag += 1

             

if flag >= n-2:   
      print('YES')
else:
      print('NO')
Problem p03254 (python)

Fixed submission:
N, x =map(int, input().split())
a = sorted(map(int, input().split()))

i = 0

while (i<N) and (x>=0):
    x -= a[i]
    if x>=0:
        i += 1

if (i == N) and (x>0) :
    print(N-1)
else:
    print(i)

Buggy submission (verdict: Runtime Error):
N, x =map(int, input().split())
a = sorted(map(int, input().split()))

i = 0

while (i<N) and (x>=0):
    x -= a[i]
    if x>=0:
    i += 1

print(i)
Problem p03285 (python)

Fixed submission:
N = int(input())
flag = 0

for cake in range(26):
    for donut in range(15):
        if cake*4 + donut*7 == N:
            flag = 1
            break
    if flag == 1:
        break

if flag == 1:
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
flag = 0

for cake in range(26):
    for donut in range(15):
        if cake*4 + donut*7 == N:
            flag = 1
            break
    if flag == 1:
        break

if flag = 1:
    print("Yes")
else :
    print("No")
Problem p03308 (python)

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

range=A[N-1]-A[0]

print(range)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort()

# range=A[N-1]-A[0]

range = 0

for i in range(N):
    for j in range(i+1,N):
        x = A[j]-A[i]
        range = max([range,x])

print(range)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort()
range = 0

for i in range(N+1):
    for j in range(i+1,N+1):
        x = A[j]-A[i]
        range = max([range,x])

print(range)
Problem p03408 (python)

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


mine = 0
    
flags = [1] * N

for i in range(N):
    plus = 1
    minus = 0
    
    if flags[i] == 0:
        continue
        
    if flags[i] == 1:
        flags[i] = 0
    
    for j in range(i+1, N):
        if s[i] == s[j]:
            plus += 1
            flags[j] = 0
            
    for k in range(M):
        if s[i] == t[k]:
            minus += 1
            
    mine = max([mine, plus - minus]) 

    
print(mine)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = []
for _ in range(N):
    s.append(input())
    
M = int(input())
t = []
for _ in range(M):
    t.append(input())


mine = 0
    
flags = [1] * N

for i in range(N):
    plus = 1
    minus = 0
    
    if flags[i] == 0:
        continue
        
    if flags[i] == 1:
        flags[i] = 0
    
    for j in range(i+1, N):
        if s[i] == s[j]:
            plus += 1
            flags[j] = 0
            
    for k in range(M):
        if s[i] == t[k]:
            minus += 1
            
    mine = max[mine, plus - minus]       

    
print(mine)
Problem p03469 (python)

Fixed submission:
S = input()

S = S.replace('7','8',1)
print(S)

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

S[3] = 8
print(S)
Problem p03478 (python)

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

total = 0

for n in range(1,N+1):
    sum = 0
    q = n
    while q != 0:
        sum += (q%10)
        q = q//10
    if (A<=sum) and (sum<=B):
        total += n

print(total)

Buggy submission (verdict: Runtime Error):
    n, a, b = map(int, input().split())
     
    ans = 0
    for num in range(n):
      num += 1
      num_0 = num
      place_of_10000 = num//10000
      num -= 10000*place_of_10000
      place_of_1000 = num//1000
      num -= 1000*place_of_1000
      place_of_100 = num//100
      num -= 100*place_of_100
      place_of_10 = num//10
      num -= 10*place_of_10
      
      tmp = place_of_10000 + place_of_1000 + place_of_100 + place_of_10 + num
      if a<=tmp and tmp<=b:
        ans += num_0
        
    print(ans)

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

ans = 0
for num in range(n):
  num += 1
  num_0 = num
  place_of_1000 = num//1000
  num -= 1000*place_of_1000
  place_of_100 = num//100
  num -= 100*place_of_100
  place_of_10 = num//10
  num -= 10*place_of_10
  
  tmp = place_pf_10000 + place_of_1000 + place_of_100 + place_of_10 + num
  if a<=tmp and tmp<=b:
    ans += num_0
    
print(ans)

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

total = 0

for n in range(1,N+1)
    sum = 0
    q = n
    while q != 0:
        sum += (q%10)
        q = q//10
    if (A<=sum) and (sum<=B):
        total += n

print(total)
Problem p03493 (python)

Fixed submission:
s = input()
t = 0
if s[0] == "1":
    t += 1

if s[1] == "1":
    t += 1

if s[2] == "1":
    t += 1

print(t)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

count = -1
flag = True

while flag == True:
    count += 1
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break



print(count)

Buggy submission (verdict: Runtime Error):
s = input()
t = 0
if s[0] == "1":
    t++

if s[1] == "1":
    t++

if s[2] == "1":
    t++

print(t)
Problem p03494 (python)

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

count = -1
flag = True

while flag == True:
    count += 1
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break



print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

count = -1
flag = True

while flag == True:
    count += 1
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break



print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

count = 0
flag = True

while flag == True:
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break

        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

count = 0
flag = True

while flag == True:
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break

        count += 1
Problem p03624 (python)

Fixed submission:
S = input()
A = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] 
B = [0]*26
flag = -1

for i in range(len(S)):
  
  for j in range(len(A)):
    if S[i] == A[j]:
      B[j] += 1
      break
  
  if i == len(S):
    break

for k in range(len(B)):
  if B[k] == 0:
    print(A[k])
    flag = 1
    break
    
if flag == -1:
  print("None")

Buggy submission (verdict: Runtime Error):
S = input()
A = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] 
B = [0]*26
flag = -1

for i in range(len(S)):
  
  for j in range(len(A)):
    if S[i] == A[j]:
      B[j] += 1
      break
  
  if i == len(S)
    break

for k in range(B):
  if B[k] == 0
    print(A[k])
    flag = 1
    break
    
if flag == -1:
  print("none")

Buggy submission (verdict: Runtime Error):
S = input()
A = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z] 
B = [0]*26
flag = -1

for i in range(len(S)):
  
  for j in range(len(A)):
    if S[i] == A[j]:
      B[j] += 1
      break
  
  if i == len(S)
    break

for k in range(B):
  if B[k] == 0
    print(A[k])
    flag = 1
    break
    
if flag == -1:
  print("none")
Problem p03720 (python)

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


ab = []
for _ in range(M):
  ab.append(list(map(int, input().split())))
  
           
bridges = [0] * N
            
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bridges[c] += 1
            
 
for _ in range(N):
  print(bridges[_] )

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
N = int(N)
M = int(M)

ab = []
for _ in range(M):
  ab.append(list(map(int, input().split()))
           
bridges = [0] * N
            
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bridges[c] += 1
            
 
for _ in range(N):
  print(bridges[_] )

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = []
for _ in range(M):
  ab.append(list(map(int, input().split()))
           
bs = [0] * N
            
 
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bs[c] += 1
            
 
for _ in range(N):
  print(bs[_] )

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = []
for _ in range(M):
  ab.append(map(int, input().split())
           
bs = [0] * N
            

for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bs[c] += 1
            

for _ in range(N):
  print(bs[_] )
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
xya = []
for _ in range(N):
  xya.append( list( map(int, input().split() ) ) )
  
W_0 = H_0 = 0
  
for i in range(N):
  
  if xya[i][2] == 1:
        if W_0 < xya[i][0]:
            W_0 =  xya[i][0]
    
  elif xya[i][2] == 2:
        if W > xya[i][0]:
            W = xya[i][0]
    
  elif xya[i][2] == 3:
        if H_0 < xya[i][1]:
            H_0 = xya[i][1]
    
  elif xya[i][2] == 4:
        if H > xya[i][1]:
            H = xya[i][1]
    
  if (W - W_0 <= 0) or (H - H_0 <= 0):
    break
    
print(max([(W - W_0)*(H - H_0), 0]))

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
xya = []
for _ in range(N):
  xya.append( list( map(int, input().split() ) ) )
  
W_0 = H_0 = 0
  
for i in range(N):
  
  if xya[i][2] == 1
    W_0 =  xya[i][0]
    
  elif xya[i][2] == 2:
    W = xya[i][0]
    
  elif xya[i][2] == 3:
    H_0 = xya[i][1]
    
  elif xya[i][2] == 4:
    H = xya[i][1]
    
  if (W - W_0 == 0) or (H - H_0 == 0):
    break
    
print(max([(W - W_0)*(H - H_0), 0]))

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
xya = []
for _ in range(N):
  xya.append( list( map(int, input().split() ) ) )
  
W_0 = H_0 = 0
  
for i in range(N):
  
  if xya[i][2] == 1:
    W_0 =  xya[i][0]
    
  else if xya[i][2] == 2:
    W = xya[i][0]
    
  else if xya[i][2] == 3:
    H_0 = xya[i][1]
    
  else if xya[i][2] == 4:
    H = xya[i][1]
    
  if (W - W_0 == 0) or (H - H_0 == 0):
    break
    
print(max([(W - W_0)*(H - H_0), 0]))
Problem p02658 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
sorted(A)
result=1
if 0 in A:
    result=0
for i in A:
    if result==0:
        break
    result*=i
    if result>1000000000000000000:
        result=-1
        break

print(result)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
result=A[0]
for i in range(1,N)
    result=result*A[i]
if result>10**18:
    print(-1)
else:
    print(result)
Problem p03076 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A%10
b=B%10
c=C%10
d=D%10
e=E%10
result=0
if a==0:
    result+=A
else:
    result+=(A+10-a)
if b==0:
    result+=B
else:
    result+=(B+10-b)
if c==0:
    result+=C
else:
    result+=(C+10-c)
if d==0:
    result+=D
else:
    result+=(D+10-d)
if e==0:
    result+=E
else:
    result+=(E+10-e)
if a==b==c==d==e==0:
    print(result)
else:
    l=set([a,b,c,d,e])
    l.discard(0)
    print(result-(10-min(l)))

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A%10
b=B%10
c=C%10
d=D%10
e=E%10
result=0
if a==0:
    result+=A
else:
    result+=(A+10-a)
if b==0:
    result+=B
else:
    result+=(B+10-b)
if c==0:
    result+=C
else:
    result+=(C+10-c)
if d==0:
    result+=D
else:
    result+=(D+10-d)
if e==0:
    result+=E
else:
    result+=(E+10-e)

l=set([a,b,c,d,e])
l.discard(0)

print(result-(10-min(l)))
Problem p03943 (python)

Fixed submission:
a,b,c=map(int,input().split())
x=sorted([a,b,c])
if x[0]+x[1]==x[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x=sorted[a,b,c]
if x[0]+x[1]==x[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x=sorted[a,b,c]
if x[0]+x[1]=x[2]:
    print("Yes")
else:
    print("No")
Problem p02724 (python)

Fixed submission:
c5, c2 = (500, 5)
yens = int(input())
happiness = 0
if yens >= c5:
    happiness += (1000 * (yens // c5))
    yens %= c5
if yens >= c2:
    happiness += (5 * (yens // c2))

print(happiness)

Buggy submission (verdict: Runtime Error):
c5, c2 = (500, 5)
yens = int(input())
happiness = 0
if yens >= c5:
    noofc5 = yens // c5
    happiness += 1000 * noofc5
    yens -= (noofc5 * c5)
    
if yens >= c2:
    noofc2 = yens // c2
    happiness += 5 * noofc2
    yens -= (noofc5 * c2)
print(happiness)
Problem p03160 (python)

Fixed submission:
import sys
sample = sys.stdin.read().splitlines()
n, stones = int(sample[0]), list(map(int, sample[1].split()))
dp = [float('inf')] * n
jumps = (1, 2)
dp[0] = 0
for idx in range(len(dp)):
  for jump in jumps:
    if idx+jump < len(dp):
      dp[idx+jump] =  min(dp[idx]+abs(stones[idx+jump]-stones[idx]), dp[idx+jump])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
sample = sys.stdin.read().splitlines()
n, stones = int(sample[0]), list(map(int, sample[1].split()))

def frog_jump(n, stones):
    dp = [float('inf')] * n
    jumps = (1, 2)
    dp[0] = 0
    for idx in range(len(dp)):
        for jump in jumps:
            if idx+jump < len(dp):
                dp[idx+jump] =  min(dp[idx]+abs(stones[idx+jump]-stones[idx]), dp[idx+jump])
    return dp[-1]
 
 frog_jump(n, stones)

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

def frog_jump(n:int, stones)->int:
    n, stones = input(), input().split() 
    dp = [float('inf')] * n
    jumps = (1, 2)
    dp[0] = 0
    for idx in range(len(dp)):
        for jump in jumps:
            if idx+jump < len(dp):
                dp[idx+jump] =  min(dp[idx]+abs(stones[idx+jump]-stones[idx]), dp[idx+jump])
    return dp[-1]

frog_jump(n, stones)
Problem p03161 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * n
    dp[0] = 0
    for i in range(n):
        for j in range(1, k + 1):
            i_j = i + j
            if i_j < n:
                x = dp[i] + abs(h[i] - h[i_j])
                if dp[i_j] > x:
                    dp[i_j] = x
    print(dp[-1])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys, os 
sys.setrecursionlimit(10**8)
#resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
from numba import jit

read = lambda : sys.stdin.readline().rstrip('\n')
tint = lambda x: [int(x) for x in x.split()]
inf = float('inf')

@jit
def main():
    n, k = tint(read())
    stones = tint(read())
    dp = [inf]*n
    dp[0] = 0
    for i in range(n):
        for t in range(1, k+1):
            if i+t < n:
                dp[i+t] = min(dp[i+t], dp[i]+abs(stones[i]-stones[i+t]))
    print(dp[-1])

if __name__ == '__main__':    
    main()
Problem p03316 (python)

Fixed submission:
n = input ()
s = sum(list( map ( int , list(n))))
num = int(n)
if num % s == 0 :
  ans = 'Yes'
else :
  ans = 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int( input ())
s = sum(list( map ( int ,list ( str ( n ) ) ) )
if n % s == 0:
  ans = 'Yes'
else :
  ans = 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int( input ())
s = sum( list ( str ( n ) ) )
if n % s == 0 :
  ans = 'Yes'
else :
  ans = 'No'
print(ans)
Problem p03360 (python)

Fixed submission:
a,b,c = map(int,input().split())
k = int(input())
m = max(a,b,c)
ans = a+b+c-m
ans += m * (2**k)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input(),split())
k = int(input())
m = max(a,b,c)
ans = a+b+c-m
abs += m * (2**k)
print(ans)
Problem p02658 (python)

Fixed submission:
x=int(input())
y=list(map(int, input().split()))
z=1
if 0 in y:
  print(0)
  exit()

for i in range(x):
  z = z*y[i]
  if z > 10**18:
    z=-1
    break
print(z)

Buggy submission (verdict: Runtime Error):
x=int(input())
y, z=map(int, input().split())
if y*z > 10**18:
  print(-1)
else:
  print(y*z)
Problem p02923 (python)

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

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

Fixed submission:
n = input()
num_list = list(n)
count = 0

for i in num_list:
  if int(i) == 1:
    count += 1
  else:
    pass

print(count)

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

while all(i%2==0 for i in A):
  A = [a/2 for a in A] 
  n += 1
print(n)