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

Fixed submission:
n, m = map(int, input().split())
l = []
combo = []
for i in range(max(n, m)+1):
  l.append([])
  
def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return

if m == 0:
  print(0)
else:

  for i in range(m):
    f, t = map(int, input().split())
    if not t in l[f]:
      l[f].append(t)
    
    if not f in l[t]:
      l[t].append(f)

  dfs([1], 1)
  print(len(combo))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = []
combo = []
for i in range(max(n, m) + 1):
  l.append([])
def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return

if m == 0:
  print(0)
else:

  for i in range(m):
    f, t = map(int, input().split())
    if not t in l[f]:
      l[f].append(t)
    
    if not f in l[t]:
      l[t].append(f)

  dfs([1], 1)
  print(len(combo))n, m = map(int, input().split())
l = []
combo = []
for i in range(max(n, m) + 1):
  l.append([])
def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return

if m == 0:
  print(0)
else:

  for i in range(m):
    f, t = map(int, input().split())
    if not t in l[f]:
      l[f].append(t)
    
    if not f in l[t]:
      l[t].append(f)

  dfs([1], 1)
  print(len(combo))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = []
for i in range(m+1):
  l.append([])
types = set()
combo = []
for i in range(m):
  f, t = map(int, input().split())
  if not t in l[f]:
    l[f].append(t)
  
  if not f in l[t]:
    l[t].append(f)

def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return
if m < n-1:
  print(0)
else:
  dfs([1], 1)
  print(len(combo))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = []
for i in range(m+1):
  l.append([])
types = set()
combo = []
for i in range(m):
  f, t = map(int, input().split())
  if not t in l[f]:
    l[f].append(t)
  
  if not f in l[t]:
    l[t].append(f)

def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return

dfs([1], 1)
print(len(combo))
Problem p02707 (python)

Fixed submission:
# 社員数
n = int(input())

# 社員番号
a = list(map(int, input().split()))

# 要素数指定
ans = [0] * n

for i in range(n - 1):
    ans[a[i] - 1] = ans[a[i] - 1] + 1

for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
# 社員数
n = int(input())

# 社員番号
a = (int(x) for x in input().split())

# 要素数指定
ans = [0] * n

for i in range(n - 1):
    ans[a[i] - 1] = ans[a[i] - 1] + 1

for i in ans:
    print(i)
Problem p02753 (python)

Fixed submission:
# -*- coding: utf-8 -*-

# 整数の入力
station = input()

if(station[0] != station[1] or station[0] != station[2]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# スペース区切りの文字列の入力
st = input().split()

for i in range(1000):
  #切り捨て
  a = int(i * 0.08)
  b = int(i * 0.1)
  if(a == int(st[0]) and b == int(st[1])):
    print(i)
    break;
  elif(i == 999):
    print('-1')
Problem p02793 (python)

Fixed submission:
n = int(input())

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

mod = 10**9 + 7

from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm_list(a)
# print(x)

ans = 0
for i in range(n):
    ans += int(x//a[i])

print(int(ans)%mod)

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

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

mod = 10**9 + 7

from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm_list(a)
# print(x)

ans = 0
for i in range(n):
    ans += int(x/a[i])%mod

print(int(ans)%mod)

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

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

mod = 10**9 + 7

from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm_list(a)

# print(x)

ans = 0
for i in range(n):
    ans += x/a[i]

print(int(ans)%mod)
Problem p02880 (python)

Fixed submission:
n = int(input())

if n>81:
    print("No")
elif n<10:
    print("Yes")
else:
    for i in reversed(range(1,10)):
        if n%i==0:
            s = n/i
            if s<10:
                print("Yes")
                exit()
    print("No")

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

if n>81:
    print("No")
    exit()
elif n<10:
    print("Yes")
    exit()
elif n%2==0:
    a = n/2
    if a<10:
        print("Yes")
        exit()
    else n%3==0:
        a = n/3
        if a<10:
            print("Yes")
            exit()
        else n%4==0:
            a = n/4
            if a<10:
                print("Yes")
                exit()
            else n%5==0:
                a = n/5
                if a<10:
                    print("Yes")
                    exit()
                else n%6==0:
                    a = n/6
                    if a<10:
                        print("Yes")
                        exit()
                    else n%7==0:
                        a = n/7
                        if a<10:
                            print("Yes")
                            exit()
                        else n%8==0:
                            a = n/8
                            if a<10:
                                print("Yes")
                                exit()
                            else n%9==0:
                                a = n/9
                                if a<10:
                                    print("Yes")
                                    exit()
                                else:
                                    print("No")
Problem p02948 (python)

Fixed submission:
n,m = map(int,input().split())
ab = [ list(map(int,input().split())) for i in range(n) ]
# print(ab)
ab.sort()
# print(ab)
import heapq
heap = []
ans = 0
i = 0
for day in reversed(range(m)):
    while i<n and ab[i][0]==(m-day):
        heapq.heappush(heap,-ab[i][1])
        i += 1
    if len(heap) > 0:
        ans += -heapq.heappop(heap)
    # print(day,i,ans,heap)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
# print(n)
# print(s)
s = list(map(list, s))
# print(s)
for i in range(n):
    s[i].sort()
    s[i] = "".join(s[i])
# print(s)
dic = {}
for i in range(n):
    if s[i] in dic:
        dic[s[i]] += 1
    else:
        dic.setdefault(s[i],1)
a = list(dic.values())
# print(a)
import math
count = 0
for i in range(len(a)):
    if a[i] >= 2:
        count += math.factorial(a[i])//(math.factorial(a[i]-2)*2)
print(count)
Problem p02990 (python)

Fixed submission:
n,k = map(int,input().split())
mod = 10**9 + 7

b = k
r = n - k

from operator import mul
from functools import reduce
def cmb(n,r):
    if n<r:
        return 0
    else:
        r = min(n-r,r)
        if r == 0: return 1
        over = reduce(mul, range(n, n - r, -1))
        under = reduce(mul, range(1,r + 1))
        return over // under

# a = cmb(n,k)
# print(a)

for i in range(b):
    ans = cmb(r+1,i+1) * cmb(b-1,i)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
mod = 10**9 + 7

b = k
r = n - k

from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

a = cmb(n,k)

for i in range(b):
    ans = cmb(r+1,i+1) * cmb(b-1,i)
    print(ans%mod)
Problem p03053 (python)

Fixed submission:
from collections import deque

h,w = map(int,input().split())
field = [ list(input()) for _ in range(h) ]

visited = [ [0]*w for _ in range(h) ]
q = deque()

for j in range(h):
    for i in range(w):
        a = field[j][i]
        if a=="#":
            q.append([j,i,0])
            visited[j][i] = 1
        else:
            pass

m = 0
while q:
    y,x,d = q.popleft()
    for j,i in ([1,0],[0,-1],[-1,0],[0,1]):
        ny = y + j
        nx = x + i
        if ny==-1 or nx==-1 or ny==h or nx==w:
            pass
        elif visited[ny][nx]==0:
            visited[ny][nx] = 1
            q.append([ny,nx,d+1])
            m = max(m,d+1)   
print(m)

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline

from collections import deque
import numpy as np

def myinput():
    return map(int,readline().split())

h,w = myinput()
field = [ list(input()) for _ in range(h) ]

d = [ [float("inf")]*w for _ in range(h) ]
q = deque()

for j in range(h):
    for i in range(w):
        a = field[j][i]
        if a=="#":
            q.append([j,i])
            d[j][i] = 0
        else:
            pass

def bfs(d):
    m = 0
    while q:
        y,x = q.popleft()
        for j,i in ([1,0],[0,-1],[-1,0],[0,1]):
            ny = y + j
            nx = x + i
            if ny==-1 or nx==-1 or ny==h or nx==w:
                pass
            elif field[ny][nx]=="#":
                pass
            elif d[ny][nx]!=float("inf"):
                pass
            else:
                field[ny][nx] = "#"
                d[ny][nx] = d[y][x] + 1
                m = max(m,d[ny][nx])
                q.append([ny,nx])
    return d,m

d,m = bfs(d)
print(m)

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline

from collections import deque
import copy
import numpy as np

def myinput():
    return map(int,readline().split())

def mycol(data,col):
    return [ row[col] for row in data ]

h,w = myinput()
field = [ list(input()) for _ in range(h) ]
# print(field)

d = [ [float("inf")]*w for _ in range(h) ]

q = deque()

for j in range(h):
    for i in range(w):
        a = field[j][i]
        if a=="#":
            q.append([j,i])
            d[j][i] = 0
        else:
            pass

# print(q)

def bfs(d):
    while q:
        y,x = q.popleft()
        for j,i in ([1,0],[0,-1],[-1,0],[0,1]):
            ny = y + j
            nx = x + i
            if ny==-1 or nx==-1 or ny==h or nx==w:
                pass
            elif field[ny][nx]=="#":
                pass
            elif d[ny][nx]!=float("inf"):
                pass
            else:
                field[ny][nx] = "#"
                d[ny][nx] = d[y][x] + 1
                q.append([ny,nx])
    return d

d2 = bfs(d)

# print(d2)

d3 = np.array(d2)
ans = np.max(d3)
print(ans)
Problem p02572 (python)

Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))

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

modn = int(1e9 + 7)

A = np.mod(A, modn)

ret = 0
for i in range(0, len(A)-1):
  for j in range(i+1, len(A)):
    ret += A[i]*A[j]

print(np.mod(ret, modn))
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
C = list(map(int, input().split(' ')))
m = 0
pre = -1
for a in A:
    m += B[a-1]
    if a - pre == 1:
        m += C[pre-1]
    pre = a
print(m)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
C = list(map(int, input().split(' ')))
m = 0
pre = -1
for a in A:
    m += B[a-1]
    if a - pre == 1
        m += C[pre-1]
    pre = a
print(m)
Problem p02777 (python)

Fixed submission:
# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


# main
S, T = input().split()
A, B = mis()
U = input()

if U == S:
    print(str(A-1) + " " + str(B))
else:
    print(str(A) + " " + str(B-1))

Buggy submission (verdict: Runtime Error):
# python3
# -*- coding: utf-8 -*-
import sys
import math
from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


# main
S, T = input().split()
A, B = mis()
U = input()

if U == S:
    print(str(A-1) + " " + str(B))
else:
    print(str(A) + " " + str(B-1))
Problem p02624 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
    ans+=n//i*(n//i+1)//2*i
print(ans)

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


@jit
def main(n):
    dp = np.zeros(n+1,np.int64)
    #dp[1]=1
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            dp[j]+=1
    dp*=np.arange(n+1)
    return dp.sum()

n = int(input())
print(main(n))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())

dp = np.zeros(n+1,np.int64)
#dp[1]=1
for i in range(1,n+1):
    for j in range(i,n+1,i):
        dp[j]+=1
dp*=np.arange(n+1)
print(dp.sum())
Problem p02891 (python)

Fixed submission:
from collections import Counter

s = list(input())
k = int(input())

ans = 0
s_d = s*2
for i in range(1,len(s_d)):
    if s_d[i-1]==s_d[i]:
        s_d[i] = '_'
        if i>=len(s_d)//2:
            ans+=k-1
        else:
            ans+=1
s_s = set(s)
if len(s_s)==1 and len(s)%2!=0:
    ans = len(s)*(k//2)+(k%2==1)*(len(s)//2)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

s = list(input())
k = int(input())

ans = 0
s_d = s*2
for i in range(1,len(s_d)):
    if s[i-1]==s[i]:
        s[i] = '_'
        if i>=len(s)//2:
            ans+=k-1
        else:
            ans+=1
s_s = set(s)
if len(s_s)==1 and len(s)%2!=0:
    ans = len(s)*(k//2)+(k%2==1)*(len(s)//2)
print(ans)
Problem p03038 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    n,m = map(int,input().split())
    A = list(map(int,input().split()))
    BC = [list(map(int,input().split())) for _ in range(m)]

    BC = sorted(BC,key=lambda x:(x[1]),reverse=True)
    append_list = []
    for b,c in BC:
        if len(append_list)>=n:
            break
        append_list+=[c]*b
    A+=append_list
    A.sort(reverse=True)
    print(sum(A[:n]))
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
from heapq import heapify,heapreplace
def solve(stdin):
    n,m = stdin[:2]
    A = stdin[2:2+n].tolist()
    BC = stdin[2+n:].reshape(-1,2)

    heapify(A)

    BC = sorted(BC,key=lambda x:(x[1]),reverse=True)
    for b,c in BC:
        if c<A[0]:
            break
        for i in range(b):
            if A[0]>c:
                break
            heapreplace(A,c)
        
    #print(A)
    return sum(A)
 
def main():   
    stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
    print(solve(stdin))
 
def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
 
if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
def solve(stdin):
    from heapq import heapify,heapreplace

    n,m = stdin[:2]
    A = stdin[2:2+n].tolist()
    BC = stdin[2+n:].reshape(-1,2)

    heapify(A)

    BC = sorted(BC,key=lambda x:(x[1]),reverse=True)
    for b,c in BC:
        if c<A[0]:
            break
        for i in range(b):
            if A[0]>c:
                break
            heapreplace(A,c)
        
    #print(A)
    return sum(A)
 
def main():
    
    stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
    print(solve(stdin))
 
def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
 
if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()
Problem p03053 (python)

Fixed submission:
from collections import deque
h,w = map(int,input().split())
map_input = [list(input()) for i in range(h)]

queue = deque([])
for i in range(h):
    for j in range(w):
        if map_input[i][j]=='#':
            queue.append([j,i])

mx = [0,0,1,-1]
my = [1,-1,0,0]

ans = -1
def bfs(map_input,queue,ans):
    while queue:
        queue2 = deque([])
        ans+=1
        for x,y in queue:
            for i in range(4):
                nx = x+mx[i]
                ny = y+my[i]
                if 0<=nx<w and 0<=ny<h:
                    if map_input[ny][nx]=='#':
                        continue
                    map_input[ny][nx]='#'
                    queue2.append([nx,ny])

        queue = queue2
    return ans

ans = bfs(map_input,queue,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy import array, ndimage
H, _ = map(int, input().split())
print(ndimage.distance_transform_cdt(array([[c == "." for c in input()] for _ in range(H)], dtype=bool), metric="taxicab").max())
Problem p03127 (python)

Fixed submission:
from fractions import gcd
n = int(input())
a_input = list(map(int,input().split()))

x = a_input.pop(0)
for i in range(len(a_input)):
    x = gcd(x,a_input[i])
print(x)

Buggy submission (verdict: Runtime Error):
from math import gcd
n = int(input())
a_input = list(map(lambda x:-int(x),input().split()))

x = a_input.pop(0)
for i in range(len(a_input)):
    x = gcd(x,a_input[i])
print(x)
Problem p03137 (python)

Fixed submission:
import heapq
n,m = map(int,input().split())
x_input = sorted(list(map(int,input().split())))

cost_li = []
for i in range(m-1):
    heapq.heappush(cost_li,-(x_input[i+1]-x_input[i]))

for i in range(n-1):
    if len(cost_li)==0:
        print(0);exit()
    heapq.heappop(cost_li)

print(-sum(cost_li))

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
x_input = sorted(list(map(int,input().split())))

cost_li = []
for i in range(m-1):
    heapq.heappush(cost_li,-(x_input[i+1]-x_input[i]))

if len(cost_li)==0:
    print(0);exit()
for i in range(n-1):
    heapq.heappop(cost_li)

print(-sum(cost_li))
Problem p02659 (python)

Fixed submission:
import math
a,b=input().split()
a=int(a)
b= int(b.replace(".",""))
print(a*b//100)

Buggy submission (verdict: Runtime Error):
a = int(input(""))
b = float(input(""))

mul = int(a*b)
print(mul)
Problem p02819 (python)

Fixed submission:
x = int(input())

while True:
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            x = x + 1
            break
    else:
        print(x)
        exit()

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

while True:
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            x = x + 1
            break()
        else:
            if i == x-1:
                print(x)
                exit()

Buggy submission (verdict: Runtime Error):
import fractions as gcd

a, b = map(int, input().split())
print(a*b // gcd(a,b))
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
 
result=int(a*b//gcd(a,b))
print(result)

Buggy submission (verdict: Runtime Error):
import fractions as gcd

a, b = map(int, input().split())
print(a*b // gcd(a,b))
Problem p02831 (python)

Fixed submission:
# coding: utf-8
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

 #最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
 
A, B = [int(x) for x in input().split(" ")]
 
print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
A, B = [int(x) for x in input().split(" ")]
 
print(int((A*B) / math.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
A, B = [int(x) for x in input().split(" ")]

print((A*B) // math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
A, B = [int(x) for x in input().split(" ")]

print((A*B) // math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math

A, B = [int(x) for x in input().split(" ")]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))
Problem p02912 (python)

Fixed submission:
# coding: utf-8
import heapq

N, M = [int(x) for x in input().split(" ")]

prices = [-int(x) for x in input().split(" ")]

heapq.heapify(prices)

for i in range(M):
    maxp = heapq.heappop(prices)
    heapq.heappush(prices, -((-maxp) // 2))

total = 0
for x in prices:
    total += -x

print(total)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N, M = [int(x) for x in input().split(" ")]
prices = [int(x) for x in input().split(" ")]
prices.sort()
for i in range(M):
    prices[-1] //= 2
    if prices[-1] < prices[-2]:
        prices.sort()
sum = 0
for num in prices:
    sum += num
print(sum)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N, M = [int(x) for x in input().split(" ")]
As = [int(x) for x in input().split(" ")]
As.sort()
for i in range(M):
    As[-1] //= 2
    if As[-1] < As[-2]:
        As.sort()
sum = 0
for num in As:
    sum += num
print(sum)
Problem p02682 (python)

Fixed submission:
if __name__ == "__main__":
    num = list(map(int, input().split()))

    if (num[3] == 0):
        print(0)
    elif (num[0] == 0 and num[1] == 0 and num[2] == 0):
        print(0)
    elif (num[3] <= num[0]):
        print(num[3])
    else:
        print(num[0] - num[3] + num[0] + num[1])

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    k = int(input())

    if (k <= a + b):
        print(a)
    else:
        print(a - k + a + b)

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    K = int(input())
    
    if (K <= A + B):
        print(A)
    else:
        print(A - K + A + B)
Problem p02771 (python)

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


if (a == b and b == c):
    print('No')
elif(a != c and a != b and b != c):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

if (a == b and b == c):
    print('No')
elif(a != c and a != b and b != c):
    print('No')
else:
    print('Yes')
Problem p02819 (python)

Fixed submission:
import math 
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
  
  
x = int(input())

while True:
  if is_prime(x):
    print(x)
    break
  x += 1

Buggy submission (verdict: Runtime Error):
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
  
  
x = int(input())

while True:
  if is_prime(x):
    print(x)
    break
  x += 1