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

Fixed submission:
N, K = map(int, input().split())
jewels = list(map(int, input().split())) + [0]
ans = 0
for get in range(1, min(N, K)+1):
  put = min(get, K-get)
  for left in range(get+1):
    right = get - left
    values = jewels[:left] + jewels[N-right:]
    sum_v = sum(values)
    minus_values = list(filter(lambda x: x<0, values))
    minus_values.sort()
    cnt = 0
    for v in minus_values:
      if cnt < put:
        sum_v -= v
        cnt += 1
      else:
          break
    ans = max(ans, sum_v)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
jewels = [0] + list(map(int, input().split())) + [0]
ans = 0
for get in range(min(N, K)+1):
  put = get
  for left in range(get+1):
    right = get - left
    values = jewels[left:] + jewels[:N+1-right]
    sum_v = sum(values)
    minus_values = values.filter(lambda x: x<0)
    minus_values.sort()
    cnt = 0
    for v in minus_values:
      sum_v -= v
    ans = max(ans, sum_v)
print(ans)

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

ans = 0
for get in range(K+1):
    put = K - get
    for right in range(get+1):
        left = get - right
        jewels = A[:right] + A[N-left:]
        jewels.sort()
        value = sum(jewels)
        for i in range(get):
            if i + 1 > put:
                break
            if jewels[i] < 0:
                value += abs(jewels[i])
            else:
                break
        ans = max(ans, value)
print(ans)
Problem p03061 (python)

Fixed submission:
import fractions

N = int(input())
A = list(map(int, input().split()))
L = [0] * (N+1)
R = [0] * (N+2)
M = [0] * (N+1)

for i in range(1, N+1):
  L[i] = fractions.gcd(L[i-1], A[i-1])
  R[N-i+1] = fractions.gcd(R[N-i+2], A[N-i])

for i in range(1, N+1):
  M[i] = fractions.gcd(L[i-1], R[i+1])
print(max(M[1:]))

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
A = list(map(int, input().split()))
L = [0] * (N+1)
R = [0] * (N+2)
M = [0] * (N+1)

for i in range(1, N+1):
  L[i] = fractions.gcd(L[i-1], A[i-1])
  R[N-i+] = fractions.gcd(R[N-i+2], A[i-1])

for i in range(1, N+1):
  M[i] = fractions.gcd(L[i], R[i+1])

print(max(M[1:]))

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
A = list(map(int, input().split()))
L = [0] * (N+1)
R = [0] * (N+2)
M = [0] * (N+1)

for i in range(1, N+1):
  L[i] = fractions.gcd(L[i-1], A[i])
  R[N-i] = fractions.gcd(R[N-i+1], A[i])

for i in range(1, N+1):
  M[i] = fractions.gcd(L[i], R[i+1])

print(max(M[1:]))

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

import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)
ans = 0
for idx, num in enumerate(A):
  result = gcd(A[:idx:]+A[idx+1::])
  if result > ans:
    ans = result
print(ans)

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

import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)
ans = 0
for idx, num in enumerate(A):
  result = gcd(A[:idx:]+A[idx+1::])
  if result > ans:
    ans = result
print(ans)

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

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
for idx, num in enumerate(A):
  result = gcd(A[:idx:]+A[idx+1::])
  if ans > result:
    ans = result
print(ans)
Problem p03076 (python)

Fixed submission:
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  if dish%10 == 0:
    ans += dish
  else:
    ans += dish + 10 - dish%10
  if dish%10 < min_digits and dish%10 !=0:
    digits_idx = idx
    min_digits = dish%10
if min_digits == 10:
  print(ans)
else:
  ans -= (10 - min_digits)
  print(ans)

Buggy submission (verdict: Runtime Error):
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  ans += dish + 10 - dish%10
  if dish%10 < min_digits:
    digits_idx = idx
  	min_digits = dish%10
ans -= (10 - dishes[digits_idx]%10)
print(ans)

Buggy submission (verdict: Runtime Error):
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  ans += round(dish, -1)
  if dish%10 < mindigits:
    digits_idx = idx
  	min_digits = dish%10
ans = ans + dishes[digits_idx] - round(dishes[digits_idx], -1)
print(ans)
Problem p03085 (python)

Fixed submission:
b = input()

bases = ('A', 'C', 'G', 'T')

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~(idx))])
    break

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

bases = ('A', 'C', 'G', 'T')

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~bin(idx))])
    break

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

bases = ['A', 'C', 'G', 'T']

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~bin(idx))])
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
LR = [list(map(int, input().split())) for i in range(Q)]

P = [0] * (N)
before_a = False
cnt = 0
for i in range(N):
  if before_a and S[i] == 'C':
    cnt += 1
    before_a = False
  elif S[i] == 'A':
    before_a = True
  else:
    before_a = False
  P[i] = cnt
for i in range(Q):
  print(P[LR[i][1]-1] - P[LR[i][0]-1])

Buggy submission (verdict: Runtime Error):
from functools import reduce

N, Q = map(int, input())
S = input()
LR = [list(map(int, input())) for i in range(Q)]

P = []
before_a = False
for i in range(N):
  if before_a and S[i] == 'C':
    P.append(i)
    before_a = False
  elif S[i] == 'A':
    before_a = True
  else:
    before_a = False
for i in range(Q):
  ans = 0
  for num in P:
    if num-1 >= LR[i][0] and num <= LR[i][1]:
      ans += 1
  print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce

N, Q = map(int, input())
S = input()
LR = [list(map(int, input())) for i in range(Q)]

P = []
before_a = False
for i in range(N):
  if before_a and S[i] == 'C':
    P.append(i)
    before_a = False
  elif S[i] == 'A':
    before_a = True
  else:
    before_a = False
for i in range(Q):
  ans = 0
  for num in P:
    if num-1 >= LR[i][0] and num >= LR[i][1]:
      ans += 1
  print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce

N, Q = map(int, input())
S = input()
LR = [list(map(int, input())) for i in range(Q)]

P = []
before_a = False
for i in range(N):
  if before_a and S[i] == 'C':
    P.append(i)
    before_a = False
  elif S[i] == 'A':
    before_a = True
  else:
    before_a = False
for i in range(Q):
  print(reduce(lambda x: if x >= RL[i][0]-1 and x <= RL[i][1]: return 1, P))
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for j in range(N)]

ans = 0
for elem in A:
  sum_A = 0
  for j in range(M):
    sum_A += elem[j] * B[j]
  if sum_A + C > 0:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for j in range(N)]

ans = 0
for elem in A:
  sum_A = 0
  for j in range(M):
    sum_A += elem[i] * B[i]
  if sum_A + C > 0:
    ans += 1
print(ans)
Problem p03109 (python)

Fixed submission:
A = input()

if int(A[5:7]) >= 5:
  print('TBD')
else:
  print('Heisei')

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

if int(A[6:8]) >= 5:
  print('TBD')
else:
  print('Heisei')
Problem p03110 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  val, currency = input().split()
  if currency == 'JPY':
    ans += float(val)
  else:
    ans += float(val) * 380000.0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
	val, currency = input().split()
    if currency == 'JPY':
      ans += float(val)
    else:
      ans += float(val) * 380000.0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
	value, currency = input().split()
    if currency == 'JPY':
      ans += float(value)
    else:
      ans += float(value) * 380000.0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
XU = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  if XU[i][1] == 'JPN':
    ans += XU[i][0]
  else:
    ans += XU[i][0] * (380000.0)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
XU = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  if XU[i][1] == 'JPN':
    ans += XU[i][0]
  else:
    ans += XU[i][0] * 380000.0
print(ans)
Problem p03136 (python)

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

L.sort(key=lambda x:-x)

if L[0] >= sum(L[1::]):
  print('No')
else:
  print('Yes')

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

L.sort(key=lambda x:-x)

if L[0] >= sum(L[1::]):
  print('No')
else:
  print('Yes')
Problem p03146 (python)

Fixed submission:
S = int(input())

A = [S]
idx = 0
while True:
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+2)
    break
  idx += 1

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

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1

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

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(idx//2)
  else:
    A.append(idx*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1
Problem p03160 (python)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for i in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
items = [list(map(int, input().split())) for _ in range(N)]
v_max = 1000*100
INF = 10**18
dp = [[INF] * (v_max+1) for _ in range(N+1)]
for v in range(v_max+1):
  dp[0][v] = 0

for i in range(N):
  for v in range(v_max+1):
    if v >= items[i][1]:
      dp[i+1][v] = min(dp[i][v-items[i][1]]+items[i][0], dp[i][v])
    else:
      dp[i+1][v] = dp[i][v]

for v in range(v_max+1)[::-1]:
  if dp[N][v] <= W:
    print(v)
    break

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for _ in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])
Problem p03196 (python)

Fixed submission:
N, P = map(int, input().split())
p_dict = {}
if N == 1:
  print(P)
  exit()
for num in range(2, int(P**0.5)+1):
  while P%num == 0:
    if num in p_dict:
      p_dict[num] += 1
    else:
      p_dict[num] = 1
    P //= num
ans = 1
for k, v in p_dict.items():
  ans *= k**(v//N)
print(ans)

Buggy submission (verdict: Runtime Error):
N, P = map(int, input().split())
p_dict = {}
for num in range(int(P*0.5)+1):
  while P%num == 0:
    if num in p_dict:
      p_dict[num] += 1
    else:
      p_dict[num] = 1

ans = 1
for k, v in p_dict.items():
  ans *= k**(N//v)
print(ans)
Problem p03219 (python)

Fixed submission:
X, Y = map(int, input().split())
print(X+Y//2)

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

ans = 0
min_diff = 10**5
for i in range(N):
  if abs((T - H[i]*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H[i]*0.006) - A)
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input())
print((X+Y)//2)

Buggy submission (verdict: Runtime Error):
X, Y = int(input())
print((X+Y)//2)
Problem p03220 (python)

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

ans = 0
min_diff = 10**5
for i in range(N):
  if abs((T - H[i]*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H[i]*0.006) - A)
print(ans)

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

ans = 0
min_diff = 10*5
for i in range(N):
  if abs((T - H*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H*0.006) - A)
print(ans)

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

ans = 0
min_diff = 10*5
for i in range(N):
  if abs((T - H*0.006) - A) < min_diff:
    ans = i+1
print(ans)
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A+B)

Buggy submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = -1
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != -1 and before != height:
        if survey[2] == 0:
          continue
        identified = False
        break
      if before == -1:
        before = height
    if identified:
      print(x, y, before)

Buggy submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = 0
    identified = True
    for survey in surveys:
      if survey[2] == 0:
        continue
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != 0 and before != height:
        identified = False
        continue
      before = height
    if identified:
      print(x, y, before)
      exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = 0
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if height != 0 and before != height:
        identified = False
        continue
      if height != 0:
        before = height
    if identified:
      print(x, y, before)
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
costs = list(filter(lambda x: x[1] <= T, ct))
if len(costs) == 0:
  print('TLE')
else:
  costs.sort(key=lambda x: x[0])
  print(costs[0][0])

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [list(map(int, input().split()), idx+1) for idx in range(N)]

costs = list(filter(lambda x: x[1] <= T, ct))
if len(costs) == 0:
  print('TLE')
else:
  costs.sort(key=lambda x: x[0])
  print(costs[0][2])
Problem p03240 (python)

Fixed submission:
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
surveys.sort(key = lambda x:-x[2])
for x in range(101):
  for y in range(101):
    before = -1
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != -1 and before != height:
        if survey[2] == 0 and before < height:
          continue
        identified = False
        break
      if before == -1:
        before = height
    if identified:
      print(x, y, before)
      break

Buggy submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = -1
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != -1 and before != height:
        if surveys[2] == 0 and before <= height:
          continue
        identified = False
        break
      if before == -1:
        before = height
    if identified:
      print(x, y, before)
Problem p03243 (python)

Fixed submission:
N = int(input())
A = [str(i) * 3 for i in range(1, 10)]
for j in range(9):
  if N <= int(A[j]):
    print(A[j])
    break

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [str(i) * 3 for i in range(10)[1:]]
for j in range(10)[1:]:
  if N >= A[j]:
    print(A[j])
    break
Problem p03262 (python)

Fixed submission:
import fractions

N, X = map(int, input().split())
cities = list(map(int, input().split()))
gcds = abs(cities[0]-X)
for city in cities[1:]:
  gcds = fractions.gcd(gcds, abs(city-X))
print(gcds)

Buggy submission (verdict: Runtime Error):
import fractions

N, X = int(input())
cities = list(map(int, input().split()))
gcds = 0
for city in cities:
  if gcd == 0:
    gcds = fractions.gcd(abs(city-X))
  else:
    gcds = fractions.gcd(gcds, abs(city-X))
print(gcds)
Problem p03264 (python)

Fixed submission:
K = int(input())
if K%2 == 0:
  print((K//2)**2)
else:
  print((K//2)*(K//2+1))

Buggy submission (verdict: Runtime Error):
K = int(input)
if K%2 == 0:
  print((K//2)**2)
else:
  print((K//2)*(K//2+1))
Problem p03273 (python)

Fixed submission:
H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]

L = []
R = []

for i in range(H):
  R_cnt = 0
  for j in range(W):
    if A[i][j] == '.':
      R_cnt += 1
  if R_cnt == W:
    R.append(i)

for j in range(W):
  L_cnt = 0
  for i in range(H):
    if A[i][j] == '.':
      L_cnt += 1
  if L_cnt == H:
    L.append(j)

for i in range(H):
  S = []
  for j in range(W):
    if i in R:
      break
    elif j in L:
      continue
    else:
      S.append(A[i][j])
  if len(S) > 0:
    print(''.join(S))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

L = []
R = []

for i in range(H):
  R_cnt = 0
  for j in range(W):
    if A[i][j] == '.':
      R_cnt += 1
  if R_cnt == W:
    R.append(i)

for j in range(W):
  L_cnt = 0
  for i in range(H):
    if A[i][j] == '.':
      L_cnt += 1
  if L_cnt == H:
    L.append(j)

for i in range(H):
  S = []
  for j in range(W):
    if i in R or j in L:
      break
    else:
      S.append(A[i][j])
  print(' '.join(S))
Problem p03274 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 10**9
for i in range(N-K+1):
  if A[i]*A[i+K-1] <= 0:
    if abs(A[i]) < abs(A[i+K-1]):
      ans = min(ans, (abs(A[i]))*2+A[i+K-1])
    else:
      ans = min(ans, abs(A[i])+A[i+K-1]*2)
  else:
    if abs(A[i]) < abs(A[i+K-1]):
      ans = min(ans, abs(A[i+K-1]))
    else:
      ans = min(ans, abs(A[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 3*10**5
for i range(N):
  if i + K > N:
    break
  if A[i]*A[i+K] <= 0:
    if abs[i] < abs[i+K]:
      ans = min(ans, abs[i]*2+abs[i+K])
    else:
      ans = min(ans, abs[i]+abs[i+K]*2)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
zero_idx = 0
for idx in range(N):
    if A[idx] > 0:
        zero_idx = idx
        break
if zero_idx == 0 and A[0] < 0:
  print(A[N-K])
elif zero_idx == 0 and A[0] > 0:
  print(A[K-1])
else 
  ans = 3*10**5
  for plus in range(N-zero_idx+1):
    if plus > K:
        break
    minus = K - plus
    if minus > zero_idx:
    	continue
    p_dis = A[zero_idx+plus-1]
    if plus == 0:
        p_dis = 0
    m_dis = A[zero_idx-minus]
    if minus == 0:
        m_dis = 0
    if p_dis >= abs(m_dis):
        ans = min(ans, p_dis+abs(m_dis)*2)
    else:
        ans = min(ans, abs(m_dis)+p_dis*2)
  print(ans)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K+1)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  for i in range(len(S)[1:]):
    if i >= K:
      print(1)
      break
    if S[i] != 1:
      print(S[i])
      break
Problem p03293 (python)

Fixed submission:
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False:
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')
Problem p03294 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  ans += A[i]-1
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  ans += A[i]-1
print(ans)
Problem p03316 (python)

Fixed submission:
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += int(N[i])
if int(N)%sum_digit == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += int(N[i])
if N%sum_digit == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += N[i]
if N%sum_digit == 0:
  print('Yes')
else:
  print('No')
Problem p03324 (python)

Fixed submission:
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 100:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100:
    print(1010000)
  else:
    print(N*10000)

Buggy submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 10000:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100
    print(1000100)
  else:
    print(N*10000)

Buggy submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 10000:
    print(10100)
  else:
  	print(N*100)
else:
  if N == 100
    print(1000100)
  else:
    print(N*10000)
Problem p03328 (python)

Fixed submission:
a, b = map(int, input().split())
h = (b-a)*(b-a+1)//2
print(h-b)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
h = (b-a)(b-a+1)//2
print(h-b)
Problem p03338 (python)

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1, N):
  left = S[:i]
  right = S[i:]
  cnt = 0
  both = []
  for j in range(len(right)):
    if right[j] in left and not right[j] in both:
      cnt += 1
      both.append(right[j])
  ans = max(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = 0
for i in range(1, N):
  left = [:i]
  right = [i:]
  cnt = 0
  both = []
  for j in range(len(right)):
    if right[j] in left and not right[j] in both:
      cnt += 1
      both.append(right[j])
  ans = max(ans, cnt)
print(ans)
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if abs(c-a) <= d or (abs(c-b) <= d and abs(b-a) <= d):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if abs(c-a) <= d or (abs(c-b) <= d and dabs(b-a) <= d):
  print('Yes')
else:
  print('No')