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

Fixed submission:
# 2019/05/16
# AtCoder Beginner Contest 091 - B

# Input
n = int(input())
bc = list()
for i in range(n):
    bc.append(input())

m = int(input())
rc = list()
for j in range(m):
    rc.append(input())

bc.sort()
rc.sort()

# Count up
strdict = dict()
wk_str = bc[0]
wk_cnt = 1
for i in range(1, n):
    if wk_str != bc[i]:
        strdict[wk_str] = wk_cnt
        wk_cnt = 1
        wk_str = bc[i]
    else:
        wk_cnt += 1

strdict[wk_str] = wk_cnt

wk_str = rc[0]
wk_cnt = 1

for j in range(1, m):
    if wk_str != rc[j]:
        if strdict.get(wk_str) == None:
            strdict[wk_str] = wk_cnt * -1
        else:
            strdict[wk_str] += wk_cnt * -1
        wk_cnt = 1
        wk_str = rc[j]
    else:
        wk_cnt += 1

if strdict.get(wk_str) == None:
    strdict[wk_str] = wk_cnt * -1
else:
    strdict[wk_str] += wk_cnt * -1

# Search max
maxval = -101
for k in strdict.keys():
    if maxval < strdict[k]:
        maxval = strdict[k]

ans = max(maxval, 0)

print(ans)

Buggy submission (verdict: Runtime Error):
# 2019/05/16
# AtCoder Beginner Contest 091 - B

# Input
n = int(input())
bc = list()
for i in range(n):
    bc.append(input())

m = int(input())
rc = list()
for j in range(m):
    rc.append(input())

bc.sort()
rc.sort()

# Count up
strdict = dict()
wk_str = bc[0]
wk_cnt = 1
for i in range(1, n):
    if wk_str != bc[i]:
        strdict[wk_str] = wk_cnt
        wk_cnt = 1
        wk_str = bc[i]
    else:
        wk_cnt += 1

strdict[wk_str] = wk_cnt

wk_str = rc[0]
wk_cnt = 1

for j in range(1, m):
    if wk_str != rc[i]:
        strdict[wk_str] += wk_cnt * -1
        wk_cnt = 1
        wk_str = rc[i]
    else:
        wk_cnt += 1

strdict[wk_str] += wk_cnt * -1

# Search max
maxval = -101
for k in strdict.keys():
    if maxval < strdict[k]:
        maxval = strdict[k]

ans = max(maxval, 0)

# Output
print(ans)
Problem p03427 (python)

Fixed submission:
# 2019/07/17
# AtCoder Grand Contest 021 - A
# For the answer: 
# 1. 桁分割、桁数Count
# 2-1. 上位桁から9以外を探索
# 2-2. 9以外があれば、その1つ上桁を-1
# 2-3. ただし先頭の場合は自身を-1
# 3. (桁数-1)*9 + 上位桁-1

# Input
n = int(input())

# 1.
wn = n
ketalist = list()
defans = 0
while wn > 0:
    remn = wn % 10
    defans = defans + remn
    ketalist.append(remn)
    wn = int(wn / 10)

# 2. 
ketalist.reverse()
allflg = False
for i in range(len(ketalist)):
    if ketalist[i] < 9:
        if i == 0:
            tgtnum = ketalist[i] - 1
        else:
            tgtnum = ketalist[i-1] - 1
        break
    # Case all 9:
    if i == len(ketalist) - 1:
        allflg = True

# 3.
if len(ketalist) > 1 and allflg == False:
    if ketalist[0] == 1:
        ans = (len(ketalist) - 1) * 9
    else:
        ans = (len(ketalist) - 1) * 9 + tgtnum
elif len(ketalist) > 1 and allflg == True:
    ans = len(ketalist) * 9
else:
    ans = n

# Output
print(max(ans, defans))

Buggy submission (verdict: Runtime Error):
# 2019/07/16
# AtCoder Grand Contest 021 - A
# For the answer: 
# 1. 桁分割、桁数Count
# 2-1. 上位桁から9以外を探索
# 2-2. 9以外があれば、その1つ上桁を-1
# 2-3. ただし先頭の場合は自身を-1
# 3. (桁数-1)*9 + 上位桁-1

# Input
n = int(input())

# 1.
wn = n
ketalist = list()
while wn > 0:
    ketalist.append(wn % 10)
    wn = int(wn / 10)

# 2. 
ketalist.reverse()
for i in range(len(ketalist)):
    if ketalist[i] < 9:
        if i == 0:
            tgtnum = ketalist[i] - 1
        else:
            tgtnum = ketalist[i-1] - 1
        break

# 3.
if len(ketalist) > 1:
    if ketalist[0] == 1:
        ans = (len(ketalist) - 1) * 9
    else:
        ans = (len(ketalist) - 1) * 9 + tgtnum
else:
    ans = n

# Output
print(ans)

Buggy submission (verdict: Runtime Error):
# 2019/07/16
# AtCoder Grand Contest 021 - A
# For the answer: 
# 1. 桁分割、桁数Count
# 2-1. 上位桁から9以外を探索
# 2-2. 9以外があれば、その1つ上桁を-1
# 2-3. ただし先頭の場合は自身を-1
# 3. (桁数-1)*9 + 上位桁-1

# Input
n = int(input())

# 1.
wn = n
ketalist = list()
while wn > 0:
    ketalist.append(wn % 10)
    wn = int(wn / 10)

# 2. 
ketalist.reverse()
for i in range(len(ketalist)):
    if ketalist[i] < 9:
        if i == 0:
            tgtnum = ketalist[i] - 1
        else:
            tgtnum = ketalist[i-1] - 1
        break

# 3.
if ketalist[0] == 1:
    ans = (len(ketalist) - 1) * 9
else:
    ans = (len(ketalist) - 1) * 9 + tgtnum

# Output
print(ans)
Problem p03633 (python)

Fixed submission:
# 2019/06/22
# AtCoder Beginner Contest 070 - C

import fractions

def lcm_fgf(a, b):
    return int(a * b // fractions.gcd(a, b))

# Input
n = int(input())
alcm = 1

for i in range(n):
    wt = int(input())
    alcm = lcm_fgf(alcm, wt)

# Output
print(alcm)

Buggy submission (verdict: Runtime Error):
# 2019/06/22
# AtCoder Beginner Contest 070 - C

import fractions

def lcm_fgf(a, b):
    return int(a * b / fractions.gcd(a, b))

# Input
n = int(input())
alcm = 1

for i in range(n):
    wt = int(input())
    alcm = lcm_fgf(alcm, wt)

# Output
print(alcm)
Problem p03720 (python)

Fixed submission:
# 2019/05/25
# AtCoder Beginner Contest 061 - B

# Input
n, m = map(int, input().split())
rcnt = [0] * (n + 1)
for i in range(m):
    a, b = map(int, input().split())
    rcnt[a] += 1
    rcnt[b] += 1

# Output
for i in range(1, n+1):
    print(rcnt[i])

Buggy submission (verdict: Runtime Error):
# 2019/05/25
# AtCoder Beginner Contest 061 - B

# Input
n, m = map(int, input().split())
rcnt = [0] * (n + 1)
for i in range(m):
    a, b = map(int, input().split())
    rcnt[a] += 1
    rcnt[b] += 1

# Output
for i in range(1, n+1):
    print[i]
Problem p02553 (python)

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

e=a*c
f=a*d
g=b*c
h=b*d

print(max(e,f,g,h))

Buggy submission (verdict: Runtime Error):
n=int(input())
mod=10**9+7
dp=[0]*2001
dp[0]=1
sdp=[0]*2001
sdp[0]=1
for i in range(2000):
  dp[i+1]=sdp[i-2]
  sdp[i+1]=dp[i+1]+sdp[i]
print(dp[n]%mod)
Problem p03557 (python)

Fixed submission:
import bisect
 
N=int(input())
b1=0
d=0

ans=0
 
A=list(map(int, input().split()))
A=sorted(A)
B=list(map(int, input().split()))
B=sorted(B, reverse=True)
C=list(map(int, input().split()))
C=sorted(C)
D=[]
E=[]

for b in B:
  d=d+len(C)-bisect.bisect_right(C,b)
  D.append(d)

D=sorted(D, reverse= True)  
B=sorted(B)

for a in A:
  if 0 <= bisect.bisect_right(B,a) <= len(D)-1:
    ans += D[bisect.bisect_right(B,a)]
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

N=int(input())
a1=0
a2=0
b1=0
b2=0
c1=0
c2=0
c3=0

ans=0

A=list(map(int, input().split()))
A=sorted(A)
B=list(map(int, input().split()))
B=sorted(B)
C=list(map(int, input().split()))
C=sorted(C)

for i in range(len(A)):
  a1=A[i]
  b2=bisect.bisect_left(B,a1)

  if a1==B[b2]:
      for j in range(b2+1,len(B)):
        b1=B[j]
        c2=bisect.bisect_left(C,b1)
        c3=len(C)-c2
        if b1==C[c2]:
          c3 -=1
          ans += c3
        else:
          ans += c3

  else:
    for j in range(b2,len(B)):
      b1=B[j]
      c2=bisect.bisect_left(C,b1)
      c3=len(C)-c2
      if b1==C[c2]:
        c3 -=1
        ans += c3
      else:
        ans += c3

print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

N=int(input())
a1=0
a2=0
b1=0
b2=0
c1=0
c2=0
c3=0

ans=0

A=list(map(int, input().split()))
A=sorted(A)
B=list(map(int, input().split()))
B=sorted(B)
C=list(map(int, input().split()))
C=sorted(C)

for i in range(len(A)):
  a1=A[i]
  b2=bisect.bisect_left(B,a1)

  if a1==B[b2]:
      for j in range(b2+1,len(B)):
        b1=B[j]
        c2=bisect.bisect_left(C,b1)
        c3=len(C)-c2
        if b1==C[c2]:
          c3 -=1
          ans += c3
        else:
          ans += c3

  else:
    for j in range(b2,len(B)):
      b1=B[j]
      c2=bisect.bisect_left(C,b1)
      c3=len(C)-c2
      if b1==C[c2]:
        c3 -=1
        ans += c3
      else:
        ans += c3

print(ans)
Problem p02842 (python)

Fixed submission:
N = int(input())

resultA = N * 100 // 108
resultB = resultA + 1
valueA = resultA * 108 // 100
valueB = resultB * 108 // 100

if N == valueA:
  print(resultA)
elif N == valueB:
  print(resultB)
else:
  print(':(')

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

resultA = N * 100 // 108
resultB = resultA + 1
valueA = resultA * 108 // 100
valueB = resultB * 108 // 100

if N == valueA:
  print(resultA)
elif N == valueB:
  print(resultB)
else:
  print(result)
  print(value)
  print(':(')
Problem p02582 (python)

Fixed submission:
s = input()
if (s == "SSS"):
  print("0")
elif (s == "SSR"):
  print("1")
elif (s == "SRS"):
  print("1")
elif (s == "RSS"):
  print("1")
elif (s == "SRR"):
  print("2")
elif (s == "RSR"):
  print("1")
elif (s == "RRS"):
  print("2")
else:
  print("3")

Buggy submission (verdict: Runtime Error):
s = input()
if (s = "SSS"):
  print("0")
elif (s = "SSR"):
  print("1")
elif (s = "SRS"):
  print("1")
elif (s = "RSS"):
  print("1")
elif (s = "SRR"):
  print("2")
elif (s = "RSR"):
  print("1")
elif (s = "RRS"):
  print("2")
else:
  print("3")
Problem p02583 (python)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
ans = 0
for i in range (n - 2):
  for j in range (i + 1, n - 1):
    for k in range (j + 1, n):
      lst2 = [lst[i], lst[j], lst[k]]
      if (lst2[0] != lst2[1] and lst2[0] != lst2[2] and lst2[1] != lst2[2]):
        if (lst2[0] < lst2[1] + lst2[2] and lst2[1] < lst2[0] + lst2[2] and lst2[2] < lst2[0] + lst2[1]):
          ans = ans + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
lst = list(map(int,input().split()))
ans = 0
for i in range (n - 2):
  for j in range (i + 1, n - 1):
    for k in range (j + 1, n):
      lst2 = [lst[i], lst[j], lst[k]]
      lst3 = sorted(lst2)
      if(lst3[2] < lst3[1] + lst3[0]):
        ans = ans + 1
print(ans)
Problem p02675 (python)

Fixed submission:
n = int(input())
x = n%10
if (x == 2 or x == 4 or x == 5 or x == 7 or x == 9):
  print("hon")
elif (x == 0 or x == 1 or x == 6 or x == 8):
  print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
n = int(input())
x = n%10
if (x == 2, or x == 4, or x == 5, or x == 7, or x == 9):
  print("hon")
elif (x == 0, or x == 1, or x == 6, or x == 8):
  print("pon")
else:
  print("bon")
Problem p02713 (python)

Fixed submission:
k = int(input())
def gcd1 (a, b):
    while True:
        if (a < b):
            a, b = b, a
        c = a%b
        if (c == 0):
            return (b)
        else:
            a = b
            b = c

count = 0
for i in range(k):
    for j in range(k):
        tmp = gcd1(i + 1, j + 1)
        if (tmp == 1):
            count = count + k
        else:
            for l in range(k):
                tmp2 = gcd1(tmp, l + 1)
                count = count + tmp2

print(count)

Buggy submission (verdict: Runtime Error):
k = int(input())
def gcd1 (a, b):
    while True:
        if (a < b):
            a, b = b, a
        c = a%b
        if (c == 0):
            return (b)
        else:
            a = b
            b = c

def gcd2 (a, b, c):
    tmp = gcd1(a, b)
    ans = gcd1(tmp, c)
    return (ans)

count = 0
for i in range(k):
    for j in range(i, k):
        for l in range(j, k):
            tmp = gcd(i + 1, j + 1, l + 1)
            if (i == j == l):
                count = count + tmp
            elif (i == j or j == l):
                count = count + tmp*3
            else:
                count = count + tmp*6
print(count)

Buggy submission (verdict: Runtime Error):
k = int(input())
def gcd1 (a, b):
    while True:
        if (a < b):
            a, b = b, a
        c = a%b
        if (c == 0):
            return (b)
        else:
            a = b
            b = c

def gcd2 (a, b, c):
    tmp = gcd1(a, b)
    ans = gcd1(tmp, c)
    return (ans)

count = 0
for i in range(k):
    for j in range(i, k):
        for l in range(j, k):
            tmp = gcd(i + 1, j + 1, l + 1)
            if (i == J == l):
                count = count + tmp
            elif (i == j or j == l):
                count = count + tmp*3
            else:
                count = count + tmp*6
print(count)

Buggy submission (verdict: Runtime Error):
k = int(input())
def gcd1 (a, b):
    while True:
        if (a < b):
            a, b = b, a
        c = a%b
        if (c == 0):
            return (b)
        else:
            a = b
            b = c

def gcd2 (a, b, c):
    tmp = gcd1(a, b)
    ans = gcd1(tmp, c)
    return (ans)

count = 0
for i in range(k):
    for j in range(k):
        for l in range(k):
            tmp = gcd(i + 1, j + 1, l + 1)
            count = count + tmp
print(count)
Problem p02718 (python)

Fixed submission:
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
lst.reverse()
x = sum(lst)
if (lst[m - 1] < x/4/m):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
lst.reverse()
x = sum(lst)
if (lst[m] < x/4/m):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst = sorted(lst)
lst = reversed(lst)
x = sum(lst)
if (lst[m] < x/4/m):
  print("No")
else:
  print("Yes")
Problem p02719 (python)

Fixed submission:
n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min(x1, x2))

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min[x1, x2])
Problem p02760 (python)

Fixed submission:
b = []
for i in range(3):
  lst = list(map(int,input().split()))
  b.append(lst)
n = int(input())
for i in range(n):
  a = int(input())
  for j in range(3):
    for k in range(3):
      if (b[j][k] == a):
        b[j][k] = 0
if (b[0][0] == b[0][1] == b[0][2] or b[1][0] == b[1][1] == b[1][2] or b[2][0] == b[2][1] == b[2][2] or b[0][0] == b[1][0] == b[2][0] or b[0][1] == b[1][1] == b[2][1] or b[0][2] == b[1][2] == b[2][2] or b[0][0] == b[1][1] == b[2][2] or b[0][2] == b[1][1] == b[2][0]):
  print("Yes")
else:
  print("No")

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

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

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

Fixed submission:
h, a = map(int,input().split())
if (h%a == 0):
  print(h//a)
else:
  print(h//a + 1)

Buggy submission (verdict: Runtime Error):
h, a = int(input())
if (h%a == 0):
  print(h//a)
else:
  print(h//a + 1)
Problem p02848 (python)

Fixed submission:
n = int(input())
s = input()
x = len(s)
for i in range(x):
  a = s[i]
  b = ord(a)
  c = ord("A")
  d = (b + n - c)%26
  print(chr(c + d), end = '')
print()

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
x = len(s)
for i in range(x):
  a = s[i]
  b = ord(a)
  c = ord("A")
  d = (b + n - c)%26
  s[i] = chr(c + d)
print(s)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
count = 0
lst = []
if (n == 1):
    print(0)
else:
    for i in range(n - 1):
        if (h[i] >= h[i + 1]):
            count = count + 1
        else:
            lst.append(count)
            count = 0
    if (count != 0):
        lst.append(count)

    lst.sort()
    lst.reverse()

    print(lst[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
count = 0
lst = []
for i in range(n - 1):
    if (h[i] >= h[i + 1]):
        count = count + 1
    else:
        lst.append(count)
        count = 0
if (count != 0):
    lst.append(count)

lst.sort()
lst.reverse()

print(lst[0])
Problem p02536 (python)

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

def dfs(f):
    if vis[f] == 1: return
    vis[f] = 1
    for t in V[f]:
        dfs(t)
          
          
n, m = map(int, input().split())
E = [[*map(lambda x: int(x)-1, input().split())] for _ in range(m)]
V = [[] for _ in range(n)]
for a, b in E: V[a].append(b); V[b].append(a)
ans = 0
vis = [0]*n

for a in range(n):
    if vis[a]==1:
      continue
    ans+=1
    dfs(a)
print(ans-1)

Buggy submission (verdict: Runtime Error):
def dfs(f):
    if vis[f] == 1: return
    vis[f] = 1
    for t in V[f]:
        dfs(t)
          
          
n, m = map(int, input().split())
E = [[*map(lambda x: int(x)-1, input().split())] for _ in range(m)]
V = [[] for _ in range(n)]
for a, b in E: V[a].append(b); V[b].append(a)
ans = 0
vis = [0]*n

for a in range(n):
    if vis[a]==1:
      continue
    ans+=1
    dfs(a)
print(ans-1)
Problem p03161 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
#n,k=100000,100
#a=[i for i in range(100000)]

kl=[i for i in range(1,k+1)]

dp=[float("inf")]*(n)
dp[0]=0
for i in range(1,n):
  dp[i] = min(dp[j] + abs(a[i] - a[j]) for j in range(max(0, i - k), i))

print(dp[n-1])

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

def main(n,k,a):
  # Worst Case
  #n,k=100000,100
  #a=[p for p in range(100000)]
  
  kl=[p for p in range(1,k+1)]
  dp=[10**9]*(n)
  dp[0]=0
  for i in range(n):
    for j in kl:
      ij=i+j
      if ij < n:
        m=dp[i]+abs(a[i]-a[ij])
        if m < dp[ij]:
          dp[ij]=m
  print(dp[n-1])

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main','(i4,i4,i4[:])')(main)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
    #if True:
      cc_export()
      exit(0)
    from my_module import main
    n,k=map(int,input().split())
    a=np.array(list(map(int,input().split())))    
    main(n,k,a)

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

def main(zz=0):
  # Worst Case
  #n,k=100000,100
  #a=[p for p in range(100000)]
  
  kl=[p for p in range(1,k+1)]
  dp=[10**9]*(n)
  dp[0]=0
  for i in range(n):
    for j in kl:
      ij=i+j
      if ij < n:
        m=dp[i]+abs(a[i]-a[ij])
        if m < dp[ij]:
          dp[ij]=m
  print(dp[n-1])

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main','(i4,)')(main)
    cc.compile()

    
if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import main
    n,k=map(int,input().split())
    a=np.array(list(map(int,input().split())))
    main(0)
Problem p03574 (python)

Fixed submission:
Y_DIR=[-1,0,1]
X_DIR=[-1,0,1]
def count_bomb(y,x):
  cnt=0
  for yd in Y_DIR:
    yy=y+yd
    if not (0<=yy<h):
      continue
    for xd in X_DIR:
      xx=x+xd
      if not (0<=xx<w):
        continue
      if s[yy][xx]=="#":
        cnt+=1
  return cnt

h,w=map(int,input().split())
s=[]
for i in range(h):
  s.append(input())
  
ans=["" for _ in range(h)]
for y in range(h):
  for x in range(w):
    if s[y][x] == ".":
      c=count_bomb(y,x)
      ans[y]+=str(c)
    else:
      ans[y]+=s[y][x]

print("\n".join(ans))

Buggy submission (verdict: Runtime Error):
Y_DIR[-1,0,1]
X_DIR[-1,0,1]
def count_bomb(y,x):
  cnt=0
  for yd in Y_DIR:
    yy=y+yd
    if not (0<=yy<h):
      continue
    for xd in X_DIR:
      xx=x+xd
      if not (0<=xx<w):
        continue
      if s[yy][xx]=="#":
        cnt+=1
  return cnt

h,w=map(int,input().split())
s=[]
for i in range(h):
  s.append(input())
for y in range(h):
  for x in range(w)
    if s[y][x] == ".":
      s[y][x]=str(count_bomb(y,x))

print("\n".join(s))
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
for i in (a,b,a+b):
  if i%3==0:
    print("Possible")
    exit()
    
print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
for i in (a,b,a+b):
  i%3==0:
    print("Possible")
    exit()
    
print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
for i in (a,b,a+b):
  i%3==0:
    print("Possible")
    exit()
    
print("Impossible")
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
n=a-b
if n >= 0:
  print("delicious")
elif x+n >=0:
  print("safe")
else:
  print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input())
n=a-b
if n >= 0:
  print("delicious")
elif x+n >=0:
  print("safe")
else:
  print("dangerous")
Problem p04011 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# template: v1.2

import io
import sys
import math

def solve(n,k,x,y):
    # implement process
    higher = n-k
    if higher < 1:
        return n*x
    else:
        return k*x + higher*y



def main():
    # input
    n,k,x,y = map(int,sys.stdin.read().split())
    
    # process
    ans = str( solve(n,k,x,y) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
2
3
10000
9000
"""
_EXPECTED = """\
20000
"""

def logd(str):
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Buggy submission (verdict: Runtime Error):
import sys
n,k,x,y = map(int,sys.stdio.read().split())
high=n-k
ans=0
if high > 0:
  ans=x*k+high*y
else:
  ans=n*x
print(ans)
Problem p02719 (python)

Fixed submission:
def main():
    N, K = map(int, input().split())
    value_diff_abs = 0

    if N == 0 or N == K :
        print("0")
    elif N > K :
        ans = N % K
        #print(ans)
        N = ans
        for i in range(0 , N + 1) :
            value_diff_abs = N
            N = abs(N - K)
            #print(str(value_diff_abs))
            if value_diff_abs < N :
                print(str(value_diff_abs))
                break
            elif value_diff_abs == N :
                print(str(value_diff_abs))
                break
    else :
        for i in range(0 , N + 1) :
            value_diff_abs = N
            N = abs(N - K)
            if value_diff_abs < N :
                print(str(value_diff_abs))
                break
            elif value_diff_abs == N :
                print(str(value_diff_abs))
                break


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    value_diff_abs = 0

    if K == 1 :
        print("0")
    elif K == 2 and N % 2 == 0 :
        print("0")
    elif K == 2 and N % 2 != 0 :
        print ("1")
    else :
        for i in range(0 , (10^18 // N) + 2) :
            value_diff_abs = N
            N = abs(N - K)
            if value_diff_abs < N :
                print(str(value_diff_abs))
                break


if __name__ == '__main__':
    main()