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

Fixed submission:
A, B = map(int, input().split())
 
t = A + B
x = A * B
m = A - B
 
map = {'t': t, 'x': x, 'm': m}

sorted_map = sorted(map.items(), key=lambda x:x[1])

ans = sorted_map[-1]
print(ans[-1])

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

t = A + B
x = A * B
m = A - B

a_flg = False
b_flg = False

if A > 0:
  a_flg = True
if B > 0:
  b_flg = True
  
if A == 0:
  if B < 0:
    print(m)
if B == 0:
  if A < 0:
    print(x)
if A == 0 and B == 0:
  print(t)

if a_flg and b_flg:
  print(x)
elif a_flg == True and b_flg == False:
  print(m)
elif a_flg == False and b_flg == True:
  print(t)
elif a_flg == False and b-flg == False:
  print(x)

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

t = A + B
x = A * B
m = A - B

a_flg = False
b_flg = False

if A > 0:
  a_flg = True
if B > 0:
  b_flg = True
  
if A == 0:
  if B < 0:
    print(m)
if B == 0:
  if A < 0:
    print(x)
if a_flg and b_flg:
  print(x)
elif a_flg == True and b_flg == False:
  print(m)
elif a_flg == False and b_flg == True:
  print(t)
elif a_flg == False and b-flg == False:
  print(x)

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

t = A + B
x = A * B
m = A - B

a_flg = False
b_flg = False

if A > 0:
  a_flg = True
if B > 0:
  b_flg = True
  
if A == 0:
  if B < 0:
    print(m)
if B == 0:
  if A < 0:
    print(t)
if a_flg and b_flg:
  print(x)
elif a_flg == True and b_flg == False:
  print(m)
elif a_flg == False and b_flg == True:
  print(t)
elif a_flg == False and b-flg == False:
  print(x)

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

t = A + B
x = A * B
m = A - B

a_flg = False
b_flg = False

if A >= 0:
  a_flg = True
if B >= 0:
  b_flg = True
  
if A == 0:
  if B < 0:
    print(m)
if B == 0:
  if A < 0:
    print(t)
if a_flg and b_flg:
  print(x)
elif a_flg == True and b_flg == False:
  print(m)
elif a_flg == False and b_flg == True:
  print(t)
elif a_flg == False and b-flg == False:
  print(x)

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

t = A + B
x = A * B
m = A - B

a_flg = False
b_flg = False

if A >= 0:
  a_flg = True
if B >= 0:
  b_flg = True
  
if A == 0 or B == 0:
  print(t)
if a_flg and b_flg:
  print(x)
elif a_flg == True and b_flg == False:
  print(m)
elif a_flg == False and b_flg == True:
  print(t)
elif a_flg == False and b-flg == False:
  print(x)

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

t = A + B
x = A * B
m = A - B

a_flg = False
b_flg = False

if A > 0:
  a_flg = True
if B > 0:
  b_flg = True
  
if a_flg and b_flg:
  print(x)
elif a_flg == True and b_flg == False:
  print(m)
elif a_flg == False and b_flg == True:
  print(t)
elif a_flg == False and b-flg == False:
  print(x)
Problem p02957 (python)

Fixed submission:
a, b = (int(i) for i in input().split()) 
if a == 0 or b > 10**9 or b == 0 or a == b:
  print('IMPOSSIBLE')
  
elif (a + b) % 2 != 0:
  print('IMPOSSIBLE')
else:
  x = (a + b) / 2
  print(int(x))

Buggy submission (verdict: Runtime Error):
num = int(input())
if num >= 2:
  input_list = [int(i) for i in input().split()] 
  sorted_list = sorted(input_list)

  count = 0
  for input, sort in zip(input_list, sorted_list):
    if input != sort:
      count += 1

  if count < 2:
    print('YES')
  else:
    print('NO')
print('NO')

Buggy submission (verdict: Runtime Error):
num = int(input())
if num > 2:
  input_list = [int(i) for i in input().split()] 
  sorted_list = sorted(input_list)

  count = 0
  for input, sort in zip(input_list, sorted_list):
    if input != sort:
      count += 1

  if count < 2:
    print('YES')
  else:
    print('NO')
print('NO')
Problem p02969 (python)

Fixed submission:
r = int(input())
x = 3*(r**2)
print(x)

Buggy submission (verdict: Runtime Error):
inputs = [int(x) for x in input().split()]

N = inputs[0]
D = inputs[1]
answer = 0
if N > (D*2) + 1:
  check = N % ((D*2) + 1)
  answer = N / ((D*2) + 1) 
  answer = int(answer)
  if check != 0:
    answer += 1
  
else:
  answer = 1
  
print(answer)
Problem p03000 (python)

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

sum = 0
count = 1

for i in range(N):
  sum = sum + L[i]
  count += 1
  if sum > X:
    count -= 1
    break
  if sum >= X:
    break
print(count)

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

N += 1

sum = 0
count = 1

for i in range(N):
  sum = sum + L[i]
  count += 1
  if sum > X:
    count -= 1
    break
  if sum >= X:
    break
print(count)

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

N += 1

sum = 0
count = 1

for i in range(N):
  sum = sum + L[i]
  count += 1
  if sum > X:
    count -= 1
    break
  if sum >= X:
    break
print(count)
Problem p03455 (python)

Fixed submission:
num1, num2 = map(int,input().split())

if num1 * num2 % 2 ==0:
  	print('Even')
else:
	print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = tuple(int(num) for input().split())
ab = a * b

if ab % 2:
  print('Odd')
else:
  print('Even')
Problem p02850 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)

N=int(input())
edges = [0 for i in range(N)]
edge_l = [[] for i in range(N)]
cols = [0 for i in range(N)]
out = 0
seen = [False for i in range(N)]
seen2 = [False for i in range(N)]

def paint(cur, parC):
  if seen[cur]:
    return
  curC = 1
  seen[cur] = True
  for e in edge_l[cur]:
    if not seen2[e[1]]:
      seen2[e[1]] = True
      if curC == parC:
        curC+=1
      cols[e[1]] = curC
      paint(e[0], curC)
      curC+=1
  return

for i in range(N-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edges[a]+=1
  edges[b]+=1
  edge_l[a].append([b,i])
  edge_l[b].append([a,i])
  out = max(out,edges[a],edges[b])
print(out)
paint(0,0)
for i in range(N-1):
  print(cols[i])

Buggy submission (verdict: Runtime Error):
N=int(input())
edges = [0 for i in range(N)]
edge_l = [[] for i in range(N)]
cols = [0 for i in range(N)]
out = 0
seen = [False for i in range(N)]

def paint(cur, parC):
  curC = 1
  seen[cur] = True
  for e in edge_l[cur]:
    if not seen[e[0]]:
      if curC == parC:
        curC+=1
      cols[e[1]] = curC
      paint(e[0], cols[cur])
      curC+=1

for i in range(N-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edges[a]+=1
  edges[b]+=1
  edge_l[a].append([b,i])
  edge_l[b].append([a,i])
  out = max(out,edges[a],edges[b])
print(out)
paint(0,0)
for i in range(N-1):
  print(cols[i])
Problem p02818 (python)

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

if A <= K:
    print(0, max(B - (K - A), 0))
else:
    print(A - K, B)

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

if A <= K:
    print(0, max(B - (K - A), 0)
else:
    print(A - K, B)
Problem p03294 (python)

Fixed submission:
import fractions
from functools import reduce
N = int(input())
a = [int(ai) for ai in input().split()]

def f(m):
    answer = 0
    for ai in a:
        answer += m % ai
    return answer

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

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

m = lcm(a) - 1
print(f(m))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
a = [int(ai) for ai in input().split()]

def f(m):
    answer = 0
    for ai in a:
        answer += m % ai
    return answer

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

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

m = lcm(a) - 1
print(f(m))
Problem p03297 (python)

Fixed submission:
import fractions

def judge(A, B, C, D):
    if A < B:   # そもそも買えない
        return False
    if D < B:   # 補充が間に合わないのでいずれ在庫が尽きる
        return False
    if B <= C:  # 補充が間に合う状況で、必ず0個以上の在庫がある
        return True
    G = fractions.gcd(B, D)   # 昼の買い物の後に残る在庫数の候補のステップ数
    R = A % G       # 例えば A = 3, G = 2の場合、必ず1個あまる
    if C + G - R - B  < 0:
        # C + G - R: 在庫の最小数
        return False
    else:
        return True

T = int(input())
data = []
for _ in range(T):
    data.append([int(xi) for xi in input().split()])
for A, B, C, D in data:
    print('Yes') if judge(A, B, C, D) else print('No')

Buggy submission (verdict: Runtime Error):
import math

def judge(A, B, C, D):
    if A < B:   # そもそも買えない
        return False
    if D < B:   # 補充が間に合わないのでいずれ在庫が尽きる
        return False
    if B <= C:  # 補充が間に合う状況で、必ず0個以上の在庫がある
        return True
    G = math.gcd(B, D)   # 昼の買い物の後に残る在庫数の候補のステップ数
    R = A % G       # 例えば A = 3, G = 2の場合、必ず1個あまる
    if C + G - R - B  < 0:
        # C + G - R: 在庫の最小数
        return False
    else:
        return True

T = int(input())
for _ in range(T):
    A, B, C, D = map(int, input().split())
    print('Yes') if judge(A, B, C, D) else print('No')

Buggy submission (verdict: Runtime Error):
import math
T = int(input())
data = []
for i in range(T):
    data.append([int(xi) for xi in input().split()])

def judge(A, B, C, D):
    if A < B:   # そもそも買えない
        return False
    if D < B:   # 補充が間に合わないのでいずれ在庫が尽きる
        return False
    if B <= C:  # 補充が間に合う状況で、必ず0個以上の在庫がある
        return True
    G = math.gcd(B, D)   # 昼の買い物の後に残る在庫数の候補のステップ数
    R = A % G       # 例えば A = 3, G = 2の場合、必ず1個あまる
    if C + G - R - B  < 0:
        # C + G - R: 在庫の最小数
        return False
    else:
        return True

for a, b, c, d in data:
    print('Yes') if judge(a, b, c, d) else print('No')
Problem p03304 (python)

Fixed submission:
n, m, d = map(int, input().split())

if d != 0:
    r = 2 * (n - d) / n**2 * (m - 1)
else:
    r = (m - 1) / n
print(r)

Buggy submission (verdict: Runtime Error):
Ordinary Beauty
Problem p03309 (python)

Fixed submission:
import statistics
N = int(input())
A = [int(x) for x in input().split(' ')]
def score(C, b):
    s = 0
    for i, Ci in enumerate(C):
        s += abs(Ci - b)
    return int(s)

C = [Ai - (i+1) for i, Ai in enumerate(A)]
b = statistics.median(C)
b1 = int(b)
b2 = int(b) + 1
s1 = score(C, b1)
s2 = score(C, b2)
print(min(s1, s2))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = [int(x) for x in input().split(' ')]
def score(A, b):
    s = 0
    for i, Ai in enumerate(A):
        s = math.abs(Ai - i - b)
    return s
s = math.inf
for b in range(min(A), max(A)):
    si = score(A, b)
    if si < s:
        s = si
print(s)
Problem p03323 (python)

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

if int(a) > 8 or int(b) > 8:
    print(':(')
else:
    print('Yay!')

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

if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')

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

if a > 8 or b > 8:
    return ':('
else:
    return 'Yay!'

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

if a > 8 or b > 8:
    return ':('
else:
    return 'Yay!'
Problem p03324 (python)

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

if N == 100:
    print(101*100**D)
else:
    print(N*100**D)

Buggy submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D==0:
    list1  = range(1,100,1)
    print(list1[N-1])
elif D==1:
    list2 = range(100,100*100,100)
    print(list2[N-1])
elif D==2:
    list3 = range(1000,100*1000,1000)
    print(list3[N-1])
Problem p03328 (python)

Fixed submission:
a, b = input().split(' ')
a, b = int(a), int(b)
diff = b - a
a_orig = sum([i for i in range(1, diff)])
snow = a_orig - a
print(snow)

Buggy submission (verdict: Runtime Error):
N = int(input())
print('ABC') if N / 999 <= 1 else print('ABD')

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')
diff = int(b) - int(a)
a_orig = sum([i for i in range(1, diff)])
snow = a_orig - a
print(snow)
Problem p03488 (python)

Fixed submission:
s = input().split('T')
x, y = map(int, input().split())

h, v = [], []
for i, si in enumerate(s):
    if i % 2 == 0:
        h.append(len(si))
    else:
        v.append(len(si))

def search(move, goal, horisontal):
    if horisontal:
        goal -= move.pop(0)

    move.sort(reverse=True)
    for m in move:
        if goal > 0:
            goal -= m
        else:
            goal += m
    return goal == 0

if search(h, x, True) and search(v, y, False):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input().split('T')
x, y = map(int, input().split())

h, v = [], []
for i, si in enumerate(s):
    if i % 2 == 0:
        h.append(len(si))
    else:
        v.append(len(si))

def search(move, goal, vertical):
    if vertical:
        goal -= move.pop(0)

    move.sort(reverse=True)
    for m in move:
        if goal > 0:
            goal -= m
        else:
            goal += m
    return goal == 0

if search(h, x, True) and search(v, y, True):
    print('Yes')
else:
    print('No')
Problem p03632 (python)

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

if B < C or D < A:
    print(0)
else:
    print(min(D, B) - max(C, A))

Buggy submission (verdict: Runtime Error):
A, B, C, D = input().split(' ')
A, B, C, D = int(A), int(B), int(C), int(D)
 
print(min(min(D, B) - max(C, A), 0)

Buggy submission (verdict: Runtime Error):
A, B, C, D = input().split(' ')
A, B, C, D = int(A), int(B), int(C), int(D)
 
print(max(min(D, B) - max(C, A), 0)
Problem p03645 (python)

Fixed submission:
fn = lambda: map(int, input().split())
N, M = fn()
a, b = [0]*M, [0]*M
ones, goals = set(), set()
for i in range(M):
    ai, bi = fn()
    if ai == 1 and bi == N:
        print('POSSIBLE')
        exit()
    elif ai == 1:
        ones.add(bi)
    elif bi == N:
        goals.add(ai)

if len(ones.intersection(goals)) == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

Buggy submission (verdict: Runtime Error):
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

N, M = map(int, input().split())
a, b, d = [0]*M, [0]*M, [0]*M
for i in range(M):
    a[i], b[i] = map(int, input().split())
    a[i], b[i] = a[i] - 1, b[i] - 1

G = csr_matrix(([1]*M, (a, b)), shape=(N, N))
D = dijkstra(G, directed=False, indices=[0, N-1])
if D[0][N-1] == 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Problem p04013 (python)

Fixed submission:
from itertools import product

N, A = map(int, input().split())
x = [int(xi) for xi in input().split()]
y = [xi - A for xi in x]
X = max(max(x), A)

dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]

dp[0][N * X] = 1
for k, t in product(range(1, N + 1), range(2 * N * X + 1)):
    if k > 0 and (t - y[k - 1] < 0 or t - y[k - 1] > 2 * N * X):
        dp[k][t] = dp[k - 1][t]
    elif k > 0 and t - y[k - 1] <= 2 * N * X:
        dp[k][t] = dp[k - 1][t] + dp[k - 1][t - y[k - 1]]

print(dp[N][N * X] - 1)

Buggy submission (verdict: Runtime Error):
from itertools import product
N, A = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)

dp = [[[0 for s in range(x_max * (N + 1))] for n in range(N + 1)] for i in range(N + 1)]
dp[0][0][0] = 1

for i, n, s in product(range(1, N + 1), range(N + 1), range(x_max * (N + 1))):
    if s < x[i - 1]:
        dp[i][n][s] = dp[i - 1][n][s]
    elif 0 < n and x[i - 1] <= s:
        dp[i][n][s] = dp[i - 1][n][s] + dp[i - 1][n - 1][s - x[i - 1]]

ans = sum([dp[N][n][n*A] for n in range(1, N + 1)])
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import product
N, A = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)

dp = [[[0 for s in range(x_max * N + 1)] for n in range(N + 1)] for i in range(N + 1)]
dp[0][0][0] = 1

for i, n, s in product(range(1, N + 1), range(N + 1), range(x_max * N + 1)):
    if s < x[i - 1]:
        dp[i][n][s] = dp[i - 1][n][s]
    elif 0 < n and x[i - 1] <= s:
        dp[i][n][s] = dp[i - 1][n][s] + dp[i - 1][n - 1][s - x[i - 1]]

ans = sum([dp[N][n][n*A] for n in range(1, N + 1)])
print(ans)
Problem p02830 (python)

Fixed submission:
n = int(input())
things = input().split()
s = ""
for i in range(n):
  s += things[0][i]
  s += things[1][i]
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
things = input().split()
s = ""
for i in range(n):
  s += thing[0][i]
  s += thing[1][i]
print(s)
Problem p03160 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n = int(input())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [-1 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    score_1 = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    score_2 = abs(stones[i] - stones[i-2]) + bottum_up[i-2] 
    bottum_up[i] = min(score_1, score_2)

print(bottum_up[-1])

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

tracker = {}
def min_cost(remaining_stones):
    if len(remaining_stones) == 1:
        return 0
    if len(remaining_stones) == 2:
        return abs(remaining_stones[0] - remaining_stones[1])
    
    jump_1 = remaining_stones[1:]
    if jump_1 not in tracker:
        tracker[jump_1] = min_cost(jump_1)
    jump_2 = remaining_stones[2:]
    if jump_2 not in tracker:
        tracker[jump_2] = min_cost(jump_2)

    score_1 = abs(remaining_stones[0] - remaining_stones[1]) + tracker[jump_1]
    score_2 = abs(remaining_stones[0] - remaining_stones[2]) + tracker[jump_2]
    return min(score_1, score_2)


print(min_cost(stones))

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

tracker = {}
def min_cost(remaining_stones):
    if len(remaining_stones) == 1:
        return 0
    if len(remaining_stones) == 2:
        return abs(remaining_stones[0] - remaining_stones[1])
    
    jump_1 = remaining_stones[1:]
    if jump_1 not in tracker:
        tracker[jump_1] = min_cost(jump_1)
    jump_2 = remaining_stones[2:]
    if jump_2 not in tracker:
        tracker[jump_2] = min_cost(jump_2)

    score_1 = abs(remaining_stones[0] - remaining_stones[1]) + tracker[jump_1]
    score_2 = abs(remaining_stones[0] - remaining_stones[2]) + tracker[jump_2]
    return min(score_1, score_2)


print(min_cost(stones))
Problem p03035 (python)

Fixed submission:
a, b = list(map(int, input().split()))
 
if  a>=13:
            m = int(b)
elif a>=6:
            m =int(b/2)
else:
            m =0
            
print(m)

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

if A>=13:
            m = B
elif A>=6:
            m =B/2
else:
            m =0
            
print(m)
Problem p03606 (python)

Fixed submission:
n =int(input())
ans =0
for i in range(n):
    a, b =map(int, input().split())
    ans +=b-a+1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n =input()
ans =0
for i in range(n):
	a, b =map(int, input().split())
  	ans +=b-a
print(ans)

Buggy submission (verdict: Runtime Error):
n =input()
ans =0
for i in range(n)
	a, b =map(int, input().split())
  	ans +=b-a
print(ans)
Problem p03697 (python)

Fixed submission:
a, b =map(int, input().split())
if a+b>=10:
  print('error')
else:
  print(a+b)

Buggy submission (verdict: Runtime Error):
a, b = list(map, int(input().split()))
if a+b >=10:
  print ('error')
else:
  print(a+b)
Problem p03738 (python)

Fixed submission:
a=int(input())
b =int(input())

print('GREATER') if a>b else print ('LESS') if b>a else print('EQUAL')

Buggy submission (verdict: Runtime Error):
a, b = int(input())
print('GREATER') if a>b else print('LESS') if b>a else print('EQUAL')
Problem p04029 (python)

Fixed submission:
n= int(input())
print(int((n*(n+1))/2))

Buggy submission (verdict: Runtime Error):
n= int(input())
print(int((n*(n+1))/2))
print(1+n)*n/2
Problem p02969 (python)

Fixed submission:
a=input()
b=int(a)

S=3*b**2

print(S)

Buggy submission (verdict: Runtime Error):
n = input()
A=[]
for i in range(0,int(n)):
  a=input()
  A.append(int(a))

for i in range(0,int(n)):
  if ( sorted(A)[-1] == A[i]):
  	print (sorted(A)[-2])
  else:
    print(sorted(A)[-1])
Problem p02981 (python)

Fixed submission:
s=input()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Buggy submission (verdict: Runtime Error):

s=inp()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Buggy submission (verdict: Runtime Error):

s=inp()
#s = (1 2 2) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[3] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Buggy submission (verdict: Runtime Error):
s=inp()
#s = (1 2 2) 
s = s.split(" ")


densya = s[0]*s[1]
taxi   = s[3]

if ( densya < taxi):
    print(densya)
else:
    print(taxi)
Problem p04029 (python)

Fixed submission:
N=int(input())
print(N*(N+1)//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(n*(n+1)/2)

Buggy submission (verdict: Runtime Error):
print(0.5*N*(N+1))

Buggy submission (verdict: Runtime Error):
print(0.5(N+1)^2)
Problem p02882 (python)

Fixed submission:
from numpy import arctan, pi

def main():
    a, b, x = map(int, input().split())
    if a * a * b > 2 * x:
        ans = arctan(2*x/(a*b*b))
    elif a * a * b < 2 * x and a * a * b != x:
        ans = arctan(a*a*a/2/(a*a*b-x))
    elif a * a * b < 2 * x:
        print(0)
        exit()
    else:
        ans = arctan(a/b)
    print(90 - ans*180/pi)


if __name__ == '__main__': main()

Buggy submission (verdict: Runtime Error):
from numpy import arctan, pi

def main():
    a, b, x = map(int, input().split())
    if a ** 2 * b > 2 * x:
        ans = arctan(2*x/(a*b*b))
    elif a ** 2 * b < 2 * x:
        ans = arctan(a*a*a/2/(a*a*b-x))
    else:
        ans = arctan(a/b)
    print(90 - ans*180/pi)


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

Fixed submission:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    d = list(map(int, input().split()))
    ans = 0
    for i in range(N-1):
        for j in range(i+1, N):
            ans += d[i] * d[j]
    print(ans)


if __name__ == '__main__': main()

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


def main():
    N = int(input())
    d = list(map(int, input().slit()))
    ans = 0
    for i in range(N-1):
        for j in range(i+1, N):
            ans += d[i] * d[j]
    print(ans)


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

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

def g(ab: list, ans: list, check: list, i: int = 0):
    if len(ab[i]) == 1 and i != 0:
        return
    check[i] = False
    for j in ab[i]:
        if check[j]:
            ans[j] += ans[i]
            g(ab, ans, check, j)

def main():
    N, Q = map(int, input().split())
    ab = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        ab[a-1].append(b-1)
        ab[b-1].append(a-1)
    ans = [0] * N
    check = [True] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        ans[p-1] += x
    g(ab, ans, check)
    print(' '.join(list(map(str, ans))))
    

if __name__ == '__main__': main()

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

def f(ab: list, parent: list, i: int = 0):
    if len(ab[i]) == 1 and i != 0:
        return
    for j in ab[i]:
        if j != parent[i]:
            parent[j] = i
            f(ab, parent, j)

def g(ab: list, parent: list, ans: list, i: int = 0):
    if len(ab[i]) == 1 and i != 0:
        return
    for j in ab[i]:
        if j != parent[i]:
            ans[j] += ans[i]
            g(ab, parent, ans, j)

def main():
    N, Q = map(int, input().split())
    ab = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        ab[a-1].append(b-1)
        ab[b-1].append(a-1)
    parent = [-1] * N
    f(ab, parent)
    ans = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        ans[p-1] += x
    g(ab, parent, ans)
    print(' '.join(list(map(str, ans))))
    

if __name__ == '__main__': main()