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

Fixed submission:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or N in range(1, 5):
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
num = 2
idx = 2
nums = []
while True:
  if num**idx > N:
    if idx == 2:
      break
    else:
      num += 1
      idx = 2
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])
Problem p03360 (python)

Fixed submission:
nums = list(map(int, input().split()))
K = int(input())
print(sum(nums) + max(nums)*(2**K) - max(nums))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
K = int(input())
print(sum(a, b, c) + max(a, b, c)*K)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
K = int(input())
print(sum(a, b, c) + max(a, b, c)*(K-1))
Problem p03361 (python)

Fixed submission:
H, W = map(int, input().split())
campus = [['.' for _ in range(W+2)]]
for _ in range(H):
    campus.append(['.'] + list(input()) + ['.'])
campus.append(['.' for _ in range(W+2)])

finish = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if campus[i][j] == '#':
            if campus[i-1][j] != '#' and campus[i][j+1] != '#' and campus[i+1][j] != '#' and campus[i][j-1] != '#':
                finish = False
                break
    else:
        continue
    break
if finish:
    print('Yes')
else:
    print('No')

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

for i in range(H):
  before = ''
  for j in range(W):
    if campus[i][j] == before and campus[i][j] == '#':
      ans[il[j-1], ans[i][j] = 0, 0
    elif campus[i][j] == '#':
      ans[i][j] = 1
    before = campus[i][j]
for j in range(W):
  before = ''
  for i in range(H):
    if campus[i][j] == before and campus[i][j] == '#':
      ans[i-1][j], ans[i][j] = 0, 0
    elif campus[i][j] == '#':
      ans[i][j] = 1
    before = campus[i][j]
finish = 'Yes'
for i in range(H):
  for j in range(W):
    if ans[i][j] == 1:
      finish = 'No'
      break
   else:
     continue
   break
prin(finish)
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split())
tolls = list(map(int, input().split()))
gate_l = 0
for toll in tolls:
  if toll > X:
    break
  gate_l += 1
print(min(gate_l, M-gate_l))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
tolls = list(map(int, input().split()))
gate_l = 0
for toll in tools:
  if toll > X:
    break
  gate_l += 1
print(min(gate_l, M-gate_l))
Problem p03385 (python)

Fixed submission:
S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[0]:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S = int(input())
if S[0] == S[1] or S[1] == S[2] or S[2] == S[0]:
  print('No')
else:
  print('Yes')
Problem p03386 (python)

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

nums = []
for num in range(A, min(A+K, B+1)):
  nums.append(num)
for num in range(max(B-K+1, A), B+1):
  if not num in nums:
    nums.append(num)
nums.sort()
for num in nums:
  print(num)

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

nums = []
for num in range(A, min(A+K, B+1)):
  nums.append(num)
for num in range(min(B-K+1, a), B+1):
  if not num in nums:
    nums.append(num)
nums.sort()
for num in nums:
  print(num)
Problem p03424 (python)

Fixed submission:
N = int(input())
arares = list(input().split())
four = False
for arare in arares:
  if arare == 'Y':
    four = True
    break
if four:
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
N = int(input())
arares = list(map(int, input().split()))
four = False
for arare in arares:
  if arare == 'Y':
    four = True
    break
if four:
  print('Four')
else:
  print('Three')
Problem p03425 (python)

Fixed submission:
N = int(input())
names = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
FIRST = ('M', 'A', 'R', 'C', 'H')
for _ in range(N):
  name = input()
  if name[0] in FIRST:
    names[name[0]] += 1
ans = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ans += names[FIRST[i]]*names[FIRST[j]]*names[FIRST[k]]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
names_dic = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
FIRST = ('M', 'A', 'R', 'C', 'H')
for _ in range(N):
  nams = input()
  if name[0] in FIRST:
    names_dic[name[0]] += 1
ans = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ans += names_dic[FIRST[i]]*names_dic[FIRST[j]]*names_dic[FIRST[k]]
print(ans)
Problem p03427 (python)

Fixed submission:
N = input()

def rest_nine(x):
  for i in range(1, len(x)):
    if int(x[i]) != 9:
      return False
  return True

if rest_nine(N):
  print(int(N[0])+(len(N)-1)*9)
else:
  print(int(N[0])-1+(len(N)-1)*9)

Buggy submission (verdict: Runtime Error):
N = input()
first = int(S[0])
if first == 0:
  print((len(N)-1)*9)
else:
  print(first-1+(len(N)-1)*9)
Problem p03449 (python)

Fixed submission:
N = int(input())
A = [[0] + list(map(int, input().split())) + [0] for _ in range(2)]

R1 = [0] * (N+1)
R2 = [0] * (N+2)

for i in range(1, N+1):
  R1[i] = R1[i-1]+A[0][i]
  R2[N-i+1] = R2[N-i+2]+A[1][N-i+1]

ans = 0
for i in range(1, N+1):
  ans = max(ans, R1[i]+R2[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [[0] + list(map(int, input())) + [0] for _ in range(2)]

R1 = [0] * (N+1)
R2 = [0] * (N+2)

for i in range(1, N+1):
  R1[i] = R[i-1]+A[0][i]
  R2[i] = R[i+1]+A[1][i]

ans = 0
for i in range(1, N+1):
  ans = max(ans, R1[i]+R2[i])
print(ans)
Problem p03451 (python)

Fixed submission:
N = int(input())
candies = [list(map(int, input().split())) for _ in range(2)]
dp = [[0] * (N) for _ in range(2)]
dp[0][0] = candies[0][0]
dp[1][0] = dp[0][0] + candies[1][0]
for i in range(1, N):
  dp[0][i] = dp[0][i-1] + candies[0][i]
  dp[1][i] = max(dp[0][i], dp[1][i-1]) + candies[1][i]
print(dp[1][N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
candies = [list(map(int, input().split())) for _ in range(2)]
dp = [[0,0] for _ in range(N)]
dp[0][0] = candies[0][0]
dp[1][0] = dp[0][0] + candies[1][0]
for i in range(1, N):
  dp[0][i] += dp[0][i-1] + candies[0][i]
  dp[1][i] = max(dp[0][i], dp[1][i-1]) + candies[1][i]
print(dp[1][N-1])
Problem p03470 (python)

Fixed submission:
N = int(input())
rice_cakes = [int(input()) for _ in range(N)]
print(len(set(rice_cakes)))

Buggy submission (verdict: Runtime Error):
N = int(input())
rice_cakes = [int(input()) for _ in range(N)]
print(len(set(rice_cakes))
Problem p03474 (python)

Fixed submission:
def is_int(s):
    try:
        int(s)
        return True
    except ValueError:
        return False

A, B = map(int, input().split())
S = input()
if is_int(S[:A]) and S[A] == '-' and is_int(S[A+1:]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
S = input()
if is_int(S[:A]) and S[A] == '-' and is_int(S[A+1:]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
S = input()
if is_int(S[:A+1]) and S[A+1] == '-' and is_int(S[A+2:]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
S = input()
if is_integer(S[:A+1]) and S[A+1] == '-' and is_integer(S[A+2:]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
S = input()
if S[:A+1].is_integer() and S[A+1] == '-' and S[A+2:].is_integer():
  print('Yes')
else:
  print('No')
Problem p03485 (python)

Fixed submission:
import math

a, b = map(int, input().split())
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input())
print(math.ceil((a+b)/2))
Problem p03486 (python)

Fixed submission:
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

for i in range(len(t)):
  if i > len(s)-1:
    print('Yes')
    exit()
  elif s[i] == t[i]:
    continue
  elif s[i] > t[i]:
    print('No')
    exit()
  else:
    print('Yes')
    exit()
if len(t) > len(s):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

s.sort()
t.sort(key=lambda x:-x)

for i in range(len(t)):
  if i > len(s)-1:
    print('Yes')
    exit()
  elif s[i] == t[i]:
    continue
  elif s[i] > t[i]:
    print('No')
    exit()
  else:
    print('Yes')
    exit()
if len(t) > len(s):
  print('Yes')
else:
  print('No')
Problem p03487 (python)

Fixed submission:
N = int(input())
dict = {}
nums = list(map(int, input().split()))

for num in nums:
  if num in dict.keys():
    dict[num] += 1
  else:
    dict[num] = 1
ans = 0
for key, value in dict.items():
  if int(key) == value:
    continue
  elif int(key) > value:
    ans += value
  else:
    ans += value - int(key)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
dict = {}
nums = list(map(int, input().split()))

for num in nums:
  if num in dict.keys():
    dict[num] += 1
  else:
    dict[num] = 1
ans = 0
for key, value in dict.items():
  if int(key) == value
    continue
  elif int(key) > value:
    ans += value
  else:
    ans += value - int(key)
print(ans)
Problem p03494 (python)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
ans = 0
while True:
  for idx, num in enumerate(nums):
    if num%2 != 0:
      print(ans)
      exit()
    else:
      nums[idx] = num//2
  ans += 1

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
ans = 0
while True:
  for idx, num in enumerate(nums):
    if num%2 != 0:
      break
    else:
      nums[idx] = num//2
  ans += 1
  else:
    continue
  break
print(ans)
Problem p03502 (python)

Fixed submission:
X = input()
sum_c = 0
for char in X:
  sum_c += int(char)
if int(X)%sum_c == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
X = input()
sum_c = 0
for char in X:
  sum_c += int(char)
if X%sum_c == 0:
  print('Yes')
else:
  print('No')
Problem p03503 (python)

Fixed submission:
N = int(input())
opens = [list(input().split()) for _ in range(N)]
values = [list(map(int, input().split())) for _ in range(N)]

ans = -(10**9)
for time in range(1, 2**10):
  sum_v = 0
  for idx, open in enumerate(opens):
    open_str = ''.join(open)
    bin_str = format(time, '010b')
    both_open = int(bin_str, 2)&int(open_str, 2)
    cnt = 0
    for char in format(both_open, '010b'):
      if char == '1':
        cnt += 1
    sum_v += values[idx][cnt]
  ans = max(ans, sum_v)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
opens = [list(map(int, input().split())) for _ in range(N)]
values = [list(map(int, input().split())) for _ in range(N)]

ans = -(10**9)
for time in range(2**N+1):
  sum_v = 0
  for idx, open in enumerate(opens):
    open_str = ''.join(open)
    bin_str = format(time, '010b')
    both_open = bin_str&bin(open_str)
    cnt = 0
    for char in str(both_open):
      if char == '1':
        cnt += 1
    sum_v += values[idx][cnt]
  ans = max(ans, sum_cnt)
Problem p03524 (python)

Fixed submission:
S = input()
s_dict = {'a': 0, 'b': 0, 'c': 0}
for s in S:
  s_dict[s] += 1
if max(s_dict.values())-min(s_dict.values()) > 1:
  print('NO')
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
S = int(input())
s_dict = {'a': 0, 'b': 0, 'c': 0}
for s in S:
  s_dict[s] += 1
if max(s_dict.values())-min(s_dict.values()) > 1:
  print('NO')
else:
  print('YES')
Problem p03544 (python)

Fixed submission:
N = int(input())
dp = [0] * (87)
dp[0] = 2
dp[1] = 1
for i in range(2, N+1):
  dp[i] = dp[i-1] + dp[i-2]
print(dp[N])

Buggy submission (verdict: Runtime Error):
N = input()
dp = [0] * (87)
dp[0] = 2
dp[1] = 1
for i in range(2, N+1):
  dp[i] = dp[i-1] + dp[i-2]
print(dp[N])
Problem p03545 (python)

Fixed submission:
N = input()
A, B, C, D = int(N[0]), int(N[1]), int(N[2]), int(N[3])
opes = ['-', '+']
for op1 in opes:
  for op2 in opes:
    for op3 in opes:
      result = 0
      if op1 == '-':
        result += A-B
      else:
        result += A+B
      if op2 == '-':
        result -= C
      else:
        result += C
      if op3 == '-':
        result -= D
      else:
        result += D
      if result == 7:
        print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
        exit()

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
opes = ['-', '+']
for op1 in opes:
  for op2 in opes:
    for op3 in opes:
      result = 0
      if op1 == '-':
        result += A-B
      else:
        result += A+B
      if op2 == '-':
        result -= C
      else:
        result += C
      if op3 == '-':
        result -= D
      else:
        result += D
      if result == 7:
        print(str(A)+ope1+str(B)+ope2+str(C)+ope3+str(D))
        exit()

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
opes = ['-', '+']
for op1 in range(2):
  for op2 in range(2):
    for op3 in range(2):
      result = 0
      if op1 == '-':
        result += A-B
      else:
        result += A+B
      if op2 == '-':
        result -= C
      else:
        result += C
      if op3 == '-':
        result -= D
      else:
        result += D
      if result == 7:
        print(str(A)+ope1+str(B)+ope2+str(C)+ope3+str(D))
        exit()
Problem p03556 (python)

Fixed submission:
N = int(input())
num = 1
while True:
  if num**2 > N:
    print((num-1)**2)
    break
  else:
    num += 1

Buggy submission (verdict: Runtime Error):
N = input()
num = 1
while True:
  if num**2 > N:
    print((num-1)**2)
    break
  else:
    num += 1
Problem p03574 (python)

Fixed submission:
H, W = map(int, input().split())
fields = [['.'] * (W+2)] + [['.'] + list(input()) + ['.'] for _ in range(H)] + [['.'] * (W+2)]

for i in range(1, H+1):
  for j in range(1, W+1):
    if fields[i][j] == '#':
      continue
    else:
      mine_cnt = 0
      for row in [-1, 0, 1]:
        for column in [-1, 0, 1]:
          if fields[i+row][j+column] == '#':
            mine_cnt += 1
      fields[i][j] = str(mine_cnt)
for i in range(1 , H+1):
  row = ''.join(fields[i][1:W+1])
  print(row)

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

for i in range(1, H+1):
  for j in range(1, W+1):
    if fields[i][j] == '#':
      continue
    else:
      mine_cnt = 0
      if fields[i][j-1] == '#':
        mine_cnt += 1
      if fields[i][j+1] == '#':
        mine_cnt += 1
      if fields[i-1][j] == '#':
        mine_cnt += 1
      if fields[i+1][j] == '#':
        mine_cnt += 1
      fields[i][j] = mine_cnt
for i in range(1 , H+1):
  row = ''.join(fields[i][1:W+1])
  print(row)

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

for i in range(1, H+1):
  for j in range(1, W+1):
    if fields[i][j] == '#':
      continue
    else:
      mine_cnt = 0
      if fields[i][j-1] == '#':
        mine_cnt += 1
      if fields[i][j+1] == '#':
        mine_cnt += 1
      if fields[i-1][j] == '#':
        mine_cnt += 1
      if fields[i+1][j] == '#':
        mine_cnt += 1
      fields[i][j] = mine_cnt
for i in range(1 , H):
  row = ''.join(fields[i][1:W+1])
  print(row)
Problem p03592 (python)

Fixed submission:
H, W, K = map(int, input().split())
for h in range(0, H+1):
  for w in range(0, W+1):
    if h*W + w*H - 2*h*w == K:
      print('Yes')
      exit()
print('No')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
for h in range(0, H+1):
  for w in range(0, W+1):
    if h*W + w*H - h*w == K:
      print('Yes')
      exit()
print('No')
Problem p03598 (python)

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

ans = 0

for x in X:
  if K >= 2*x:
    ans += x*2
  else:
    ans += (K-x)*2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
ans = 0
for _ in range(N):
  x = int(input())
  if K >= 2*x:
    ans += x*2
  else:
    ans += (K-x)*2
print(ans)
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
ans_sw = 1
ans_s = 0
for a in range(F//(100*A)+1):
  for b in range(F//(100*B)+1):
    if 100*A*a + 100*B*b > F or 100*A*a+100*B*b == 0:
      continue
    for c in range((A*a+B*b)*E+1):
      for d in range((A*a+B*b)*E+1):
        sw = 100*A*a+100*B*b+C*c+D*d
        s = C*c+D*d
        if 0 < sw <= F and s <= (A*a+B*b)*E and ans_s/ans_sw < s/sw:
          ans_s = s
          ans_sw = sw
if ans_sw == 1:
  print(100*A ,0)
else:
  print(ans_sw, ans_s)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
sugar = 0
s_water = 0
for a in range(F//(100*A)+1):
  for b in range((F-100*A*a)//(100*B)+1):
    f = F - 100*(a+b)
    max_s = min((a+b)*E, f)
    sugar_temp = 0
    s_water_temp = 0
    print(max_s)
    if max_s%C >= max_s%D:
      sugar_temp = max_s-max_s%D
    else:
      sugar_temp = max_s-max_s%C
    s_water_temp = 100*(a+b) + sugar_temp
    if sugar_temp/s_water_temp > sugar/s_water:
      sugar = sugar_temp
      s_water = s_water_temp
print(s_water, sugar)
Problem p03609 (python)

Fixed submission:
X, t = map(int, input().split())
print(max(X-t, 0))

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
cnt = 0
ren = 0
for i in range(N):
  if nums[i] == i+1:
    cnt += 1
    ren += 1
  elif ren > 1:
    cnt -= 1
    ren = 0
  else:
    ren = 0
if ren > 1:
  cnt -= 1
print(cnt)
Problem p03625 (python)

Fixed submission:
N = int(input())
sticks = list(map(int, input().split()))
s_dict = {}
for stick in sticks:
  if stick in s_dict:
    s_dict[stick] += 1
  else:
    s_dict[stick] = 1
sorted_dict = sorted(s_dict.items(), key=lambda x:-x[0])
side1 = 0
side2 = 0
for elem in sorted_dict:
  if elem[1] >= 4:
    if side1 == 0:
      side1 = side2 = elem[0]
    else:
      side2 = elem[0]
  elif elem[1] == 2 or elem[1] == 3:
    if side1 == 0:
      side1 = elem[0]
    else:
      side2 = elem[0]
  if side1 != 0 and side2 != 0:
    print(side1*side2)
    exit()
print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
sticks = list(map(int, input().split()))
s_dict = {}
for stick in sticks:
  if stick in s_dict:
    s_dict[stick] += 1
  else:
    s_dict[stick] = 1
sorted_dict = sorted(s_dict.items(), key=lambda:-x[0])
side1 = 0
side2 = 0
for elem in sorted_dict:
  if elem[1] >= 4:
    side1 = side2 = elem[0]
  elif elem[1] == 2 or elem[1] == 3:
    if side1 == 0:
      side1 = elem[0]
    else:
      side2 = elem[0]
  if side1 != 0 and side2 != 0:
    print(side1*side2)
    exit()
print(0)
Problem p03645 (python)

Fixed submission:
N, M = map(int, input().split())
ships = [[] for _ in range(2*10**5+1)]
for _ in range(M):
  _from, _to = map(int, input().split())
  ships[_from].append(_to)
for _to in ships[1]:
  if N in ships[_to]:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ships = [[]] * (2*10**5+1)
for _ in range(M):
  _from, _to = map(int, input().split())
  ships[_from].append(_to)
for _to in ships[1]:
  for _dist in ships[_to]:
  	if _dist == N:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ships =　[[]] * (2*10**5+1)
for _ in range(M):
  _from, _to = map(int, input().split())
  ships[_from].append(_to)
for _to in ships[1]:
  if _to == N:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')
Problem p03673 (python)

Fixed submission:
N = int(input())
nums = list(input().split())
odd = []
even = []
for idx, num in enumerate(nums):
  if idx%2 == 0:
    even.append(num)
  else:
    odd.append(num)
if N%2 == 0:
  print(' '.join(odd[::-1]+even))
else:
  print(' '.join(even[::-1]+odd))

Buggy submission (verdict: Runtime Error):
N = input()
nums = list(map(int, input().split()))
odd = []
even = []
for idx, num in enumerate(nums):
  if idx%2 == 0:
    even.append(num)
  else:
    odd.append(num)
if N%2 == 0:
  print(' '.join(even+odd))
else:
  print(' '.join(odd+even))
Problem p03681 (python)

Fixed submission:
N, M = map(int, input().split())
if abs(N-M) > 1:
  print(0)
else:
  num = max(N, M)
  dp = [1] * (num+1)
  for i in range(2, num+1):
    dp[i] = (i * dp[i-1])%(10**9+7)
  if N == M:
    print((dp[N]*dp[M]*2)%(10**9+7))
  else:
    print((dp[N]*dp[M])%(10**9+7))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if abs(N-M) > 1:
  print(0)
else:
  num = max(N, M)
  dp = [1] * (num+1)
  for i in range(2, num+1):
    dp[i] = (i * dp[i-1])%(10**9+7)
print((dp[N]*dp[M])%(10**9+7))
Problem p03701 (python)

Fixed submission:
N = int(input())
INF =101
sum_num = 0
min_num = INF

for _ in range(N):
  num = int(input())
  if num%10 != 0:
    min_num = min(min_num, num)
  sum_num += num
if min_num == INF:
  print(0)
elif sum_num%10 == 0:
  print(sum_num-min_num)
else:
  print(sum_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
  for i in range(MAX+1)[::-1]:
    if dp[i] == 1 and (i + num) <= MAX+1:
      dp[i+num] = 1
ans = 0
for i in range(MAX+1):
  if dp[i] == 1 and i%10 != 0:
    ans = i
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
  for i in range(MAX+1)[::-1]:
    if dp[i] == 1 and (i + num) <= MAX*MAX:
      dp[i+num] = 1
ans = 0
for i in range(MAX+1):
  if dp[i] == 1 and i%10 != 0:
    ans = i
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
  for i in range(MAX+1)[::-1]:
    if dp[i] == 1:
      dp[i+num] = 1
ans = 0
for i in range(MAX+1):
  if dp[i] == 1 and i%10 != 0:
    ans = i
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums=[int(input()) for _ in range(N)]
sum_nums = sum(nums)
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
  for i in range(MAX+1):
    if dp[i] == 1 and i + num <= MAX:
      dp[i+num] = 1
ans = 0
for i in range(sum_nums+1):
  if dp[i] == 1 and i%10 != 0:
    ans = i
print(ans)
Problem p03720 (python)

Fixed submission:
N, M = map(int, input().split())
cities = [0] * (N+1)
for _ in range(M):
  a, b = map(int, input().split())
  cities[a] += 1
  cities[b] += 1
for idx in range(1, N+1):
  print(cities[idx])

Buggy submission (verdict: Runtime Error):
N, M = int(input())
cities = [0] * (N+1)
for _ in range(M):
  a, b = map(int, input().split())
  cities[a] += 1
  cities[b] += 1
for idx in range(1, N+1):
  print(cities[idx])
Problem p03721 (python)

Fixed submission:
N, K = map(int, input().split())
opes = []
for _ in range(N):
  opes.append(tuple(map(int, input().split())))
opes.sort(key=lambda x:x[0])
sum_ope = 0
for ope in opes:
  sum_ope += ope[1]
  if sum_ope >= K:
    print(ope[0])
    break

Buggy submission (verdict: Runtime Error):
N, K = int(input())
opes = []
for _ in range(N):
  opes.append(tuple(map(int, input().split())))
opes.sort(key=lambda x:x[0])
sum_ope = 0
for ope in opes:
  sum_ope += ope[1]
  if sum_ope >= K:
    print(ope[0])
    break
Problem p03731 (python)

Fixed submission:
N, K = map(int, input().split())
ans = 0
switches = list(map(int, input().split()))
switches.append(2*10**9)
for idx in range(N):
  ans += min(K, switches[idx+1] - switches[idx])
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = 0
switches = list(map(int, input().split()))
switches.append(10**9+10)
for idx in range(N):
  ans += min(K, switches[i+1] - switches[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = int(input())
ans = 0
switches = list(map(int, input().split()))
switches.append(10**9+10)
for idx in range(N):
  ans += min(K, switches[i+1] - switches[i])
print(ans)