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

Fixed submission:
N = int(input())
selector = 0
count = 1
A = [int(i) for i in input().split()]
pre_num = A[0]
for num in A[1:]:
    if selector == 0:
        selector = num - pre_num
    if selector > 0:
        if num < pre_num:
            selector = 0
            count += 1
    if selector < 0:
        if num > pre_num:
            selector = 0
            count += 1
    pre_num = num
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
sub = 0
count = 1
A = [int(i) for i in input().split()]
pre_num = A[1]
pre_sub = A[1] - A[0]
for num in A[2:]:
    if not pre_num == num:
        if pre_sub * (num - pre_num) < 0:
            count += 1
            pre_sub = 0
        else:
          	pre_sub = num - pre_num
        pre_num = num
print(count)
Problem p02833 (python)

Fixed submission:
N = int(input())

if N % 2 != 0:
    print(0)
else:
    count = N // 10
    for j in range(1, 50):
        count += N // ((5**j) * 10)
    print(count)

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

if N % 2 != 0:
    print(0)

else:
    count = N // 10
    for j in range(1, 50):
        count += N // ((5**j) * 10)

print(count)

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

if N % 2 != 0:
    print(0)

else:
        count = N // 10
        for j in range(1, 50):
            count += N // ((5**j) * 10)

print(count)

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

L = len(N)
ans = 0
buf = "0"
p = L - 1

if int(N) % 2 != 0:
    print(0)

else:
        count = int(N) // 10
        for j in range(1, 50):
            count += int(N) // ((5**j) * 10)

print(count)
Problem p02834 (python)

Fixed submission:

import copy
import sys

# 再帰上限を引き上げる
sys.setrecursionlimit(10**6)

def dfs(graph, v, d):
    seen[v] = True # 訪問済みかどうか
    dist[v] = d # 距離を記録

    # 頂点vから行ける頂点を全探索
    for i in graph[v]:
        if seen[i]:
            continue
        dfs(graph, i, d+1)

# ここから本文
N, u, v = map(int, input().split())

u -= 1
v -= 1

# グラフ構造を作る
graph = [[] for i in range(N)]
for i in range(N - 1):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    graph[A].append(B)
    graph[B].append(A)

# 青木くんからの各頂点の距離
seen = [False for i in range(N)]
dist = [0 for i in range(N)]
dfs(graph, v, 0)
aoki_dist = copy.deepcopy(dist)

# 高橋くんからの各頂点の距離
seen = [False for i in range(N)]
dist = [0 for i in range(N)]
dfs(graph, u, 0)
takahashi_dist = copy.deepcopy(dist)

ans = 0
for i in range(N):
    if aoki_dist[i] > takahashi_dist[i]:
        if aoki_dist[i] - 1 > ans:
            ans = aoki_dist[i] - 1      

print(ans)

Buggy submission (verdict: Runtime Error):

import copy

def dfs(graph, v, d):
    seen[v] = True # 訪問済みかどうか
    dist[v] = d # 距離を記録

    # 頂点vから行ける頂点を全探索
    for i in graph[v]:
        if seen[i]:
            continue
        dfs(graph, i, d+1)

# ここから本文
N, u, v = map(int, input().split())

u -= 1
v -= 1

# グラフ構造を作る
graph = [[] for i in range(N)]
for i in range(N - 1):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    graph[A].append(B)
    graph[B].append(A)

# 青木くんからの各頂点の距離
seen = [False for i in range(N)]
dist = [0 for i in range(N)]
dfs(graph, v, 0)
aoki_dist = copy.deepcopy(dist)

# 高橋くんからの各頂点の距離
seen = [False for i in range(N)]
dist = [0 for i in range(N)]
dfs(graph, u, 0)
takahashi_dist = copy.deepcopy(dist)

ans = 0
for i in range(N):
    if aoki_dist[i] > takahashi_dist[i]:
        if aoki_dist[i] - 1 > ans:
            ans = aoki_dist[i] - 1      

print(ans)
Problem p03221 (python)

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

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = "00000{}".format(tup[1][0])
    pref_name = pref_name[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = "00000{}".format(count)
    pref_id = pref_id[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")

Buggy submission (verdict: Runtime Error):

N, M = map(int, input().split())
pref_dict = {}

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = f"00000{tup[1][0]}"[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = f"00000{count}"[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")

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

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
print(sorted_dict)

ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = f"00000{tup[1][0]}"[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = f"00000{count}"[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")
Problem p03986 (python)

Fixed submission:
x = input()

st_sub = 0
count = 0
for char in x:

    if st_sub < 0 and char == "S":
        st_sub = 1
    elif char == "S":
        st_sub += 1
    else:
        st_sub -= 1
    
    if st_sub < 0:
        count += 1
    
print(count * 2)

Buggy submission (verdict: Runtime Error):
x = input()
s = t = 0
for i in range(200000):
    if x[i] == "T":
        t += 1
    if x[-i-1] == "S":
        s += 1
print(max(s, t))

Buggy submission (verdict: Runtime Error):
x = input()
s = t = 0
for i in range(200000):
    if x[i] = "T":
        t += 1
    if x[-i-1] = "S":
        s += 1
print(max(s, t))

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

for i in range(200000):
    if x[i] = "T":
        t += 1
    if x[-i-1] = "S":
        s += 1
print(max(s, t))
Problem p03631 (python)

Fixed submission:
a,b,c=input()
if a==c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input())
if a==c:
  print("Yes")
elif a!=c:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input())
if a==c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input())
if a==b:
  print("Yes")
else:
  print("No")
Problem p02829 (python)

Fixed submission:
print(int(6 - int(input()) - int(input())))

Buggy submission (verdict: Runtime Error):
print(int(6 - int(input()) - int(input()))
Problem p02847 (python)

Fixed submission:
import sys, os
import collections

MOD = 10 ** 9 + 7

def solve(input_stream):
  table = {
    "SUN": 7,
    "MON": 6,
    "TUE": 5,
    "WED": 4,
    "THU": 3,
    "FRI": 2,
    "SAT": 1
  }

  target = input_stream.readline().strip()
  return [str(table[target])]

def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

Buggy submission (verdict: Runtime Error):
import sys, os
import collections

MOD = 10 ** 9 + 7

def solve(input_stream):
  pass

def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)
Problem p02834 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10**6)


def get_distance(v):              
    distance = [0] * n
    visited = [0] * n
    visited[v] = 1
    dfs(v, 0, distance, visited)
    return distance


def dfs(v, d, distance, visited):
    distance[v] = d
    for u in adj[v]:
        if not visited[u]:
            visited[u] = 1
            dfs(u, d + 1, distance, visited)


n, u, v = map(int, input().split())

adj = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = (int(i) - 1 for i in input().split()) 
    adj[a].append(b)
    adj[b].append(a)

u_distance = get_distance(u - 1)
v_distance = get_distance(v - 1)

ans = 0
for u, v in zip(u_distance, v_distance):
    if u < v and v - 1 > ans:
        ans = v - 1

print(ans)

Buggy submission (verdict: Runtime Error):
def get_distance(v):              
    distance = [0] * n
    visited = [0] * n
    visited[v] = 1
    dfs(v, 0, distance, visited)
    return distance


def dfs(v, d, distance, visited):
    distance[v] = d
    for u in adj[v]:
        if not visited[u]:
            visited[u] = 1
            dfs(u, d + 1, distance, visited)


n, u, v = map(int, input().split())

adj = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = (int(i) - 1 for i in input().split()) 
    adj[a].append(b)
    adj[b].append(a)

u_distance = get_distance(u - 1)
v_distance = get_distance(v - 1)

ans = 0
for u, v in zip(u_distance, v_distance):
    if u < v and v - 1 > ans:
        ans = v - 1

print(ans)
Problem p03013 (python)

Fixed submission:
N, M = [int(i) for i in input().split()]

dp = [0] * (N + 1)
dp[0] = 1
b = 1
f = False
for _ in range(M):
    a = int(input())
    if a - b == 1:
        f = True
        break
    dp[a] = -1
    b = a

if f:
    ans = 0
elif len(dp) == 2:
    if dp[1] == -1:
        ans = 0
    else:
        ans = 1
else:
    MOD = 10**9 + 7
    
    if dp[1] != -1:
        dp[1] = 1
    for i in range(2, N + 1):
        if dp[i] != -1:
            s = 0 if dp[i-2] == -1 else (dp[i-2] % MOD)
            p = 0 if dp[i-1] == -1 else (dp[i-1] % MOD)
            dp[i] = s + p
            ans = dp[-1] % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]

dp = [0] * (N + 1)
dp[0] = 1
b = 1
f = FalseN, M = [int(i) for i in input().split()]

dp = [0] * (N + 1)
dp[0] = 1
b = 1
f = False
for _ in range(M):
    a = int(input())
    if a - b == 1:
        f = True
        break
    dp[a] = -1
    b = a

if f:
    ans = 0
elif len(dp) == 2:
    if dp[1] == -1:
        ans = 0
    else:
        ans = 1
else:
    MOD = 10**9 + 7
    
    if dp[1] != -1:
        dp[1] = 1
    for i in range(2, N + 1):
        if dp[i] != -1:
            s = 0 if dp[i-2] == -1 else (dp[i-2] % MOD)
            p = 0 if dp[i-1] == -1 else (dp[i-1] % MOD)
            dp[i] = s + p
            ans = dp[-1] % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]

dp = [0] * (N + 1)
dp[0] = 1
b = 1
f = False
for _ in range(M):
    a = int(input())
    if a - b == 1:
        f = True
        break
    dp[a] = -1
    b = a

if f:
    ans = 0
else:
    MOD = 10**9 + 7
    
    if dp[1] != -1:
        dp[1] = 1
    for i in range(2, N + 1):
        if dp[i] != -1:
            s = 0 if dp[i-2] == -1 else (dp[i-2] % MOD)

            p = 0 if dp[i-1] == -1 else (dp[i-1] % MOD)

            dp[i] = s + p
            ans = dp[-1] % MOD
print(ans)
Problem p02912 (python)

Fixed submission:
n1, n2 = [int(i) for i in input().split()]
n3 = [int(i) for i in input().split()]

n3.sort(reverse = True)

c1 = 0
while True:
    n3[0] = n3[0] // 2
    c1 += 1
    if c1 >= n2:
        break
    t2 = 1
    while len(n3) != 1:
        if n3[t2] >= n3[0]:
            n3[t2] = n3[t2] // 2
            t2 += 1
            c1 += 1
            if c1 >= n2 or t2 >= len(n3):
                break
        else:
            break

    if c1 >= n2:
        break

    n3.sort(reverse = True)

r1 = 0
for i2 in range(n1):
    r1 += n3[i2]

print(r1)

Buggy submission (verdict: Runtime Error):
n1, n2 = [int(i) for i in input().split()]
n3 = [int(i) for i in input().split()]

n3.sort(reverse = True)

c1 = 0
while True:
    n3[0] = n3[0] // 2
    c1 += 1
    if c1 >= n2:
        break
    t2 = 1
    while len(n3) != 1:
        if n3[t2] >= n3[0]:
            n3[t2] = n3[t2] // 2
            t2 += 1
            c1 += 1
            if c1 >= n2:
                break
        else:
            break

    if c1 >= n2:
        break

    n3.sort(reverse = True)


r1 = 0
for i2 in range(n1):
    r1 += n3[i2]

print(r1)
Problem p03013 (python)

Fixed submission:
import sys

n1, n2 = [int(i) for i in input().split()]

na1 = []

for i1 in range(n2):
    na1.append(int(input()))

for i3 in range(n2):
    if i3 == 0:
        continue
    else:
        if na1[i3] == na1[i3 - 1] + 1:
            print("0")
            sys.exit()

n3 = 0
n4 = 0
n5 = 0
n6 = 0
n7 = 0
r1 = 1
r2 = []
f1 = False
for i2 in range(n1):
    if len(na1) > n7 and (na1[n7] == i2 + 1 ):
        n3 = 0
        n4 = 0
        n6 = 0
        n7 += 1
        r2.append(r1)
        r1 = 1
        f1 = True

    else:
        if f1 == True:
            f1 = False
            continue
        if n4 == 0 :
            n4 = 1
            r1 = 1
        elif n3 == 0 :
            n3 = 1
            n4 = 2
            r1 = 2
        else:
            n6 = n3 + n4
            r1 = n6
            n3 = n4
            n4 = n6
    if i2 == (n1 - 1) :
        r2.append(r1)

r3 = 1
for i6 in range(len(r2)):
    r3 *= r2[i6]

print(r3 % 1000000007)

Buggy submission (verdict: Runtime Error):
import sys

n1, n2 = [int(i) for i in input().split()]

na1 = []

for i1 in range(n2):
    na1.append(int(input()))

for i3 in range(n2):
    if i3 == 0:
        continue
    else:
        if na1[i3] == na1[i3 - 1] + 1:
            print("0")
            sys.exit()

if na1[n2 -1] == n1:
    print("0")
    sys.exit()
    

n3 = 0
n4 = 0
n5 = 0
n6 = 0
n7 = 0
r1 = 0
r2 = []
f1 = False
for i2 in range(n1 ):
    if len(na1) > n7 and (na1[n7] == i2 + 1 ):
        n3 = 0
        n4 = 0
        n6 = 0
        n7 += 1
        if r1 == 0:
            r1 = 1
        r2.append(r1)
        f1 = True

    else:
        if f1 == True:
            f1 = False
            continue
        if n4 == 0 :
            n4 = 1
            r1 = 1
        elif n3 == 0 :
            n3 = 1
            n4 = 2
            r1 = 2
        else:
            n6 = n3 + n4
            r1 = n6
            n3 = n4
            n4 = n6
    if i2 == (n1 - 1) :
        r2.append(r1)

r3 = 1
for i6 in range(len(r2)):
    r3 *= r2[i6]

print(r3 % 1000000007)

Buggy submission (verdict: Runtime Error):
import sys

n1, n2 = [int(i) for i in input().split()]

na1 = []

for i1 in range(n2):
    na1.append(int(input()))

for i3 in range(n2):
    if i3 == 0:
        continue
    else:
        if na1[i3] == na1[i3 - 1] + 1:
            print("0")
            sys.exit()

if na1[n2 -1] == n1:
    print("0")
    sys.exit()
    

n3 = 0
n4 = 0
n5 = 0
n6 = 0
n7 = 0
r1 = 0
r2 = []
f1 = False
for i2 in range(n1 ):
    if len(na1) > n7 and (na1[n7] == i2 + 1 ):
        n3 = 0
        n4 = 0
        n6 = 0
        n7 += 1
        if r1 == 0:
            r1 = 1
        r2.append(r1)
        f1 = True

    else:
        if f1 == True:
            f1 = False
            continue
        if n4 == 0 :
            n4 = 1
            r1 = 1
        elif n3 == 0 :
            n3 = 1
            n4 = 2
            r1 = 2
        else:
            n6 = n3 + n4
            r1 = n6
            n3 = n4
            n4 = n6
    if i2 == (n1 - 1) :
        r2.append(r1)

r3 = 1
for i6 in range(len(r2)):
    r3 *= r2[i6]

print(r3 % 1000000007)
Problem p03038 (python)

Fixed submission:
num1, num2 = [int(i) for i in input().split()]
num3 = [int(i) for i in input().split()]

numArray = [[0]*2]*num2

for index3 in range(num2):
    numArray[index3] = [int(j) for j in input().split()]

numArray.sort(key=lambda x:(-x[1]))

fg1 = True

for index1 in range(num2):
    for index2 in range(numArray[index1][0]):
        num3.append(numArray[index1][1])
        if len(num3)>=(num1*2):
            fg1= False
            break
    if fg1 == False:
        break

num3.sort(reverse=True)

sum1 = 0
for index4 in range(num1):
    sum1 +=num3[index4]

print(str(sum1))

Buggy submission (verdict: Runtime Error):

num1, num2 = [int(i) for i in input().split()]
num3 = [int(i) for i in input().split()]

numArray = [[0]*2]*num2

for index3 in range(num2):
    numArray[index3] = [int(j) for j in input().split()]


for index1 in range(num1):
     for index2 in range(numArray[index1][0]):
         num3.append(numArray[index1][1])
         if index2 >= num2:
             break

num3.sort(reverse=True)

sum1 = 0

for index2 in range(num1):
    sum1 += num3[index2]

print(sum(num3))

Buggy submission (verdict: Runtime Error):
for index1 in range(num2):
     for index2 in range(numArray[index1][0]):
         num3.append(numArray[index1][1])

num3.sort(reverse=True)

sum1 = 0

for index2 in range(num1):
    sum1 += num3[index2]

print(sum1)

Buggy submission (verdict: Runtime Error):
for index1 in range(num2):
     for index2 in range(numArray[index1][0]):
         num3.append(numArray[index1][1])

num3.sort(reverse=True)

sum1 = 0

for index2 in range(num1):
    sum1 += num3[index2]

print(sum1)
Problem p02831 (python)

Fixed submission:
from fractions import gcd

a, b = [int(val) for val in input().split(' ')]
lcm = int((a*b)/gcd(a, b))
print(lcm)

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

a, b = map(int, input().split(' '))
lcm = np.lcm(a, b)
print(lcm)

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split(' '))
lcm = int((a * b) / math.gcd(a, b))
print(lcm)
Problem p02847 (python)

Fixed submission:
s = input()
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
index = days.index(s)
print(7-index)

Buggy submission (verdict: Runtime Error):
s = input()
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
index = days.index(s)
print(7-index)
Problem p03041 (python)

Fixed submission:
n, k = input().split()
s = input()
sn = s[int(k)-1].lower()
num1 = int(k) - 1
num2 = int(k)
print(s[:num1] + sn + s[num2:])

Buggy submission (verdict: Runtime Error):
n, k = input().split()
s = input()
num = 3
if (num - int(k)) == 0:
    sn = s[0] + s[1] + s[int(k)-1].lower()
    print(sn)
if (num - int(k)) == 1:
    sn = s[0] + s[int(k)-1].lower() + s[2]
    print(sn)
if (num - int(k)) == 2:
    sn = s[int(k)-1].lower() + s[1] + s[2]
    print(sn)
Problem p03242 (python)

Fixed submission:
n = list(input())
for num in n:
    if num == '1':
        num ='9'
    elif num == '9':
        num = '1'
    print(num,end='')

Buggy submission (verdict: Runtime Error):
n = list(input())
for num in n:
    if num ==1:
        num=9
    elif num==1:
        num=9:
print(n)
Problem p03250 (python)

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

print(max([a, b, c])*10+sum([a,b,c])-max([a,b,c]))

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

print(max([a, b, c])*10+sum([a,b,c])-max([a,b,c]))
Problem p02785 (python)

Fixed submission:
import sys


def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


N, K = InL()
H = InL()
H.sort()

if K >= N:
    print(0)
    sys.exit()
else:
    print(sum(H[0:N-K]))

Buggy submission (verdict: Runtime Error):
import sys


def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


N, K = InL()
H = InL().sort()

if K >= N:
    print(0)
    sys.exit()

print(sum(H[0:N-K]))
Problem p02790 (python)

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

axb_text = ''
for _ in range(b):
    axb_text += str(a)

bxa_text = ''
for _ in range(a):
    bxa_text += str(b)


print(axb_text if axb_text < bxa_text else bxa_text)

Buggy submission (verdict: Runtime Error):
line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for i in range(b):
    axb_text = f"{axb_text}{a}"

bxa_text = ''
for i in range(a):
    bxa_text = f"{bxa_text}{b}"

print(axb_text if axb_text < bxa_text else bxa_text)

Buggy submission (verdict: Runtime Error):
line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for _ in range(b):
    axb_text = f"{axb_text}{a}"

bxa_text = ''
for _ in range(a):
    bxa_text = f"{bxa_text}{b}"

print(axb_text if axb_text < bxa_text else bxa_text)
Problem p02835 (python)

Fixed submission:
#/usr/bin/env python3
def main():
  array = []
  array = list(map(int, input().split(' ')))
  
  if sum(array) >= 22:
    print('bust')
  else:
    print('win')

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  array = []
  array = raw_input().split(' ')
  
  if sum(array) >= 22:
    print('bust')
  else:
    print('win')

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

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

s = C-(A-B)
print(s if C-(A-B) > 0 else 0)

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

print(s = C-(A-B) if C-(A-B) > 0 else 0)

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

print(s if C-(A-B) > 0 else 0)
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())

list = [P, Q, R]
min1 = min(list)
list.remove(min1)
min2 = min(list)
print(min1 + min2)

Buggy submission (verdict: Runtime Error):
P, Q, R = map(int, input().split())

list = [P, Q, R]
min1 = min(list)
list.pop(min1)
min2 = min(list)
print(min1 + min2)
Problem p02859 (python)

Fixed submission:
r = int(input())
s = r*r
print(int(s))

Buggy submission (verdict: Runtime Error):
r = input()
print(int(r*r))
Problem p02859 (python)

Fixed submission:
r=int(input())

x=r*r

print(x)

Buggy submission (verdict: Runtime Error):
r=input()
x=r*r
print(x)
Problem p03011 (python)

Fixed submission:
p, q, r= [int(i) for i in input().split()]

l=[p,q,r]
print(sum(l)-max(l))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m = [int(i) for i in input().split()]
a =[]
d = 1000000007

for i in range(m):
    a1=int(input())
    a.append(a1)

a.append(n+1)
a = np.array(a)
#print(a)

if 1 in a[1:]-a[:-1]:
    print(0)
    
elif m == 0:
    dp = [0] * (n + 1)
    dp[1] = 1
    dp[2] = 1
    for i in range(3, len(dp)):
        dp[i] = dp[i - 1] + dp[i - 2]
    print(dp[m])
    

else:
    dp = [0]*(n+1)
    dp[1]=1
    dp[2]=1
    for i in range(3,len(dp)):
        dp[i]=dp[i-1]+dp[i-2]
        #dp[i]=dp[i]%d

    ans = []
    pre = 0
    for i in range(len(a)):
        if i == 0:
            ans.append(a[i]-pre)
        else:
            ans.append(a[i]-pre-1)
        pre = a[i]

    #print(ans)
    x = 1
    for i in ans:
        x = x*dp[i]%d
    print(x)
Problem p03295 (python)

Fixed submission:
n, m = [int(i) for i in input().split()]
a=[]
b=[]
for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    a.append(x1)
    b.append(y1)

c = zip(b,a)
c = sorted(c)
b,a = zip(*c)

#print(a,b)
ans = 0
point=0

for i in range(m):
    if a[i]<point<b[i]:
        continue
    else:
        ans += 1
        point=b[i]-0.5

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import copy
n, m = [int(i) for i in input().split()]
a=[]
b=[]
for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    a.append(x1)
    b.append(y1)

ans = 0
while True:
    bridge = np.array([0]*(n-1))
    for i in range(len(a)):
        bridge[a[i]-1:b[i]-1] += 1
    r = bridge.argmax() + 1

    for i,an,bn in zip(range(len(a)),a,b):
        if an <= r <= bn-1:
            a[i]=0
            b[i]=0

    ans += 1
    if len(set(a))==1 and a[0]==0:
        break

print(ans)
Problem p02785 (python)

Fixed submission:
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))

for i in range(K):
  if len(H) == 0:
    break
  H.pop()

print(sum(H))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))

for i in range(K):
  H.pop()

print(sum(H))