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

Fixed submission:
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 #奇数のインデックス
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 1
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
elif len(n) == 1:
  for i in range(len(a)):
    if a[i] % 2 != 0:
      a[i] += 1
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 #奇数のインデックス
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)
Problem p03425 (python)

Fixed submission:
N = int(input())
m = a = r = c = h = 0
for _ in range(N):
  s_in = input()
  if s_in[0] == "M": m += 1
  elif s_in[0] == "A": a += 1
  elif s_in[0] == "R": r+= 1
  elif s_in[0] == "C": c += 1
  elif s_in[0] == "H": h += 1

all_l = [m, a, r, c, h]
ans = 0
import itertools
for v in itertools.combinations(all_l, 3):
  if v[0] * v[1] * v[2] > 0:
    ans += v[0] * v[1] * v[2]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [0] * 5
for _ in range(N):
  s = input()
  if s[0] == "M": S[0] += 1
  elif s[0] == "A": S[1] += 1
  elif s[0] == "R": S[2] += 1
  elif s[0] == "C": S[3] += 1
  elif s[0] == "H": S[4] += 1

ans = 0
for x in range(3):
  for y in range(x+1, N-1):
    for z in range(y+1, N):
      ans += S[x] * S[y] * S[z]
print(ans)
Problem p03427 (python)

Fixed submission:
s = list(input())
ans = [sum(map(int, s)), 9 * (len(s) - 1) + int(s[0]) - 1]
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(input())
ans = [sum(map(int, s)), 9*(len(s)-1) + int(s[0]-1)]
print(max(ans))
Problem p03544 (python)

Fixed submission:
N = int(input())
L = [2, 1]
if N >= 2:
  for i in range(N-1):
    L.append(L[i]+L[i+1])
print(L[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [2, 1]
if N > 2:
  for i in range(N - 1):
    L.append(L[i]+L[i+1])
print(L[N])
Problem p03592 (python)

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

for i in range(n+1):
  for j in range(m+1):
    if i*(m-j)+j*(n-i)==k:
      print("Yes")
      exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m,k = map(int, input().split())
ans = "No"
if k%(m-1)==0 and k//(m-1) > 1:
  if k//(m-1) <= n: ans = "Yes"
if k%(n-1)== 0 and k//(n-1) > 1:
  if k//(n-1) <= m: ans = "Yes"
print(ans)
Problem p03612 (python)

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

ans = 0
for i in range(N):
  if p[i] - 1 == i:
    ans += 1
    if i != N - 1:
      a = p[i]
      b = p[i + 1]
      p[i] = b
      p[i + 1] = a
print(ans)

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

ans = 0
for i in range(N):
  if p[i] - 1 == i:
    a = p[i]
    b = p[i + 1]
    p[i] = b
    p[i + 1] = a
    ans += 1
print(ans)
Problem p03624 (python)

Fixed submission:
S = input()
l = sorted(list(set(S)))

ans = ""
for i in range(len(l)):
  if ord(l[i]) !=  97 + i:
    ans = chr(97+i)
    break
  elif i == 25 and l[i] == "z":
    ans = "None"

if ans != "":
 print(ans)
else:
  print(chr(ord(l[-1])+1))

Buggy submission (verdict: Runtime Error):
s = sorted(set(input()))
x = [chr(i) for i in range(ord("a"), ord("z")+1)]
for i in range(len(x)):
    if x[i] != s[i]:
        print(x[i])
        exit()
print("None")

Buggy submission (verdict: Runtime Error):
S = input()
l = sorted(list(set(S)))

ans ="None"
number = [96]
for i in range(len(S)):
  if ord(l[i]) ==  number[-1] + 1:
    number.append(ord(l[i]))
  else:
    ans = chr(number[-1]+1)
    break

print(ans)
Problem p03680 (python)

Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]

n = 0
count = 0
for i in range(N - 1):
  count += 1
  n = a[n] - 1
  if n == 1:
    break 

print(count if n == 1 else -1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]

n = 0
ans = 1
for _ in range(N):
  ans += 1
  if a[a[n] - 1] == n + 1:
    ans = -1
    break
  elif a[a[n] - 1] == 2:
    break
  n = a[a[n] - 1]

print(ans)
Problem p03687 (python)

Fixed submission:
s = input()
n = len(s)
ans = 1000
for t in set(s):
    ans = min(ans, max([len(l) for l in s.split(t)]))
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input()
if len(set(s)) ==1:
    print(0)
    exit()
if len(set(s)) != len(s):
    cs = Counter(s)
    I = 0
    n = cs.most_common()[0][1]
    ans = 100
    while cs.most_common()[I][1] == n:
        id = [x for x, v in enumerate(s) if v == cs.most_common()[I][0]]
        x = 0
        for i in range(len(id)-1):
            if i == 0 and id[i] > 0 and x < id[i]:
                x = id[i]
            if id[i+1] - id[i] > x:
                x = id[i+1] - id[i] -1
        if ans > x: ans = x
        I += 1
else: ans = len(s) - len(s)//2
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input()
if len(set(s)) ==1:
    print(0)
    exit()
if len(set(s)) != len(s):
    cs = Counter(s)
    I = 0
    n = cs.most_common()[0][1]
    ans = 100
    while cs.most_common()[I][1] == n:
        id = [x for x, v in enumerate(s) if v == cs.most_common()[I][0]]
        x = 0
        for i in range(len(id)-1):
            if id[i+1] - id[i] > x:
                x = id[i+1] - id[i] -1
        if ans > x: ans = x
        I += 1
else: ans = len(s) - len(s)//2
print(ans)
Problem p03761 (python)

Fixed submission:
from collections import Counter

N = int(input())
counter = [Counter(input()) for _ in range(N)]

c = counter[0]
for i in range(1, N):
  for k, v in c.items():
    c[k] = min(counter[i][k], c[k])

c = sorted(c.items())
ans = ""
for k, v in c:
  ans += k * v
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
S = list(input() for _ in range(n))

def intersect_list(l1, l2):
  arr = []
  lst = l1.copy()
  for element in l2:
    try:
      lst.remove(element)
    except ValueError:
      pass
    else:
      arr.append(element)
  return arr

l = intersect_list(list(S[0]), list(S[1]))
for i in range(2, n):
  l = intersect_list(l, list(S[i]))

l.sort()
print("".join(l))
Problem p03994 (python)

Fixed submission:
#"a" 97 "z" 122
s = list(ord(i) for i in input())
k = int(input())

for i in range(len(s)-1):
  if s[i] == ord("a"): continue
  t = ord("z")+1-s[i]
  if k >= t:
    s[i] = 97
    k -= t
if k > 0:
  k %= 26
  s[-1] += k
  if s[-1] > ord("z"):
    s[-1] -= 26
print("".join(list(map(chr, s))))

Buggy submission (verdict: Runtime Error):
#"a" 97 "z" 122
s = list(ord(i) for i in input())
k = int(input())
for i in range(len(s)):
  if 123 - s[i] <= k:
    k -= 123-s[i]
    s[i] = 97

if k > 0:
  s[-1] += k
  if s[-1] >= 123: s[-1] = s[-1]-26
print("".join(list(map(chr, s))))
Problem p04030 (python)

Fixed submission:
s = input()
ans = []
for i in range(len(s)):
  if s[i] == "0":
    ans.append("0")
  elif s[i] == "1":
    ans.append("1")
  elif s[i] == "B":
    if len(ans) > 0:
      ans.pop(-1)

print("".join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []

for i in range(len(s)):
  if s[i] != "B":
    ans.append(s[i])
  else:
    if len(s) == 0:
      continue
    elif len(s) > 0:
      ans.pop(-1)
      
print("".join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []

for i in range(len(s)):
  if s[i] != "B":
    ans.append(s[i])
  else:
    if len(s) > 0:
      ans.pop(-1)
      
print("".join(ans))
Problem p03485 (python)

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

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))

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

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))
Problem p03760 (python)

Fixed submission:
import sys
a = []
b = []
a = input()
b = input()

for num in range(0,len(a)):
   sys.stdout.write(a[num])
   if len(b) > num:
       sys.stdout.write(b[num])

Buggy submission (verdict: Runtime Error):
import sys
a = []
b = []
a = input()
b = input()

for num in range(0,len(a)):
   sys.stdout.write(a[num])
   sys.stdout.write(b[num])
Problem p02684 (python)

Fixed submission:
n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

before=k
roop=1
cnt={}
nxt=1
mp = [1]
for i in range(1, k+1):
    if nxt not in cnt:
        cnt[nxt] = i
        nxt = a[nxt]
    else:
        roop = i - cnt[nxt]
        before = cnt[nxt]-1
        break
    mp.append(nxt)
print(mp[before + (k-before)%roop])

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

before=k
roop=1
cnt={}
nxt=1
mp = []
for i in range(1, k+1):
    mp.append(nxt)
    if nxt not in cnt:
        cnt[nxt] = i
        nxt = a[nxt]
    else:
        roop = i - cnt[nxt]
        before = cnt[nxt]-1
        break
print(mp[before + (k-before)%roop])

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

before=0
roop=0
cnt={}
nxt=1
mp = []
for i in range(1, k+1):
    mp.append(nxt)
    if nxt not in cnt:
        cnt[nxt] = i
        nxt = a[nxt]
    else:
        roop = i - cnt[nxt]
        before = cnt[nxt]-1
        break
    roop=0
if roop == 0:
    print(mp[k])
    exit()
print(mp[before + (k-before)%roop])

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

before=0
roop=0
cnt={}
nxt=1
mp = []
for i in range(1, k+1):
    mp.append(nxt)
    if nxt not in cnt:
        cnt[nxt] = i
        nxt = a[nxt]
    else:
        roop = i - cnt[nxt]
        before = cnt[nxt]-1
        break
    roop=0
    before=0

print(mp[before + (k-before)%roop])
Problem p03169 (python)

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

m = d = t = 0
for i in range(len(a)):
  if a[i] == 1:
    m += 1
  elif a[i] == 2:
    d += 1
  else:
    t += 1
    
M = t + d + m
D = [[[0] * (M + 1) for i in range(d + t + 1)] for j in range(t + 1)]

su = 0
D[t][d][m] = 1

divTable = [1]
for i in range(1, 10000):
  divTable.append(1.0 / i)


for i in range(t, -1, -1):
  for j in range(d + t - i, -1, -1):
    for k in range(M - i - j, -1, -1):
      y = D[i][j][k]
      if y != 0:
        div = y * divTable[i + j + k]
        if i + j + k != 0:
          su += N * div
        if i >= 1:
          D[i - 1][j + 1][k] += i * div
        if j >= 1: 
          D[i][j - 1][k + 1] += j * div
        if k >= 1:
          D[i][j][k - 1] += k * div

print(su)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

def tami(i,j,k):
  if (i == j == k == 0):
    return 0
  else:
    res = 0
    if (i > 0):
      res += dp[i-1][j][k] * i
    if (j > 0):
      res += dp[i+1][j-1][k] * j
    if (k > 0):
      res += dp[i][j+1][k-1] * k
    res += N
    res *= (1 / (i + j + k))
    dp[i][j][k] = res
    return res
  
N = int(input())
a = list(map(float,input().split()))

one = a.count(1)
two = a.count(2)
three = a.count(3)

num = max(one,two,three)

dp = [[[-1]*(three+1) for i in range(N+1)] for i in range(N+1)]

for k in range(0, N + 1):
  for j in range(0, N - k + 1):
    for i in range(0, N - k - j + 1):
      tami(i, j, k)

print(dp[one][two][three])
Problem p02658 (python)

Fixed submission:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  if num == 0:
    sum = 0
    flag = 1
    break
  if flag == 1:
    sum = sum * num
    if sum > upper:
      flag = 2

if flag == 1:
  print(sum)
elif flag == 2:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper:
    flag = 0
  elif num == 0
    sum = 0
if flag == 1:
  print(sum)
elif:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
i = 0
flag = 0
upper = pow(10, 18)
for i in nums:
  sum *= nums[i]
  if sum > upper:
    print(-1)
    flag = 1
    break
if flag == 0:
    print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
i = 0
upper = pow(10, 18)
for i in nums:
  sum *= nums[i]
  if sum > upper:
    print(-1)
    exit()
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 1
for (int i = 0; i < n; i++):
  sum = sum * int(input())
  
if (sum > 1000000000000000000):
  print("-1")
else:
  print(sum)
Problem p02675 (python)

Fixed submission:
numberOfMange= int(input()) % 10
 
if numberOfMange in [2,4,5,7,9]:
  print('hon')
elif numberOfMange in [0,1,6,8]:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
numberOfMange= int(input()) % 10

if numberOfMange in [2,4,5,7,9]:
  print('hon')
elif numberOfMange in [0,1,6,8]:
  print('pon')
else numberOfMange:
  print('bon')
Problem p02677 (python)

Fixed submission:
import math

a, b, h, m = list(map(int, input().split()))
deg = 30 * h - 6 * m + 30 * (m / 60.0)
if deg < 0:
  deg += 360
elif deg > 180:
  deg = 360 - deg

cos = math.cos(math.radians(deg))
c_2 = a * a + b * b - 2 * a * b * cos
print(math.sqrt(c_2))

Buggy submission (verdict: Runtime Error):
import math

a b h m = list(map(int, input().split()))
deg = 30 * h - 6 * m
if deg < 0:
  deg += 360
elif deg > 180:
  deg = 360 - deg

cos = math.cos(math.radian(deg))
c_2 = a * a + b * b - 2 * a * b * cos
print(math.sqrt(c_2))
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if (s == t[0:len(s)] and len(s) + 1 == len(t)):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if (s == t[0:len(s)] && len(s) + 1 == len(t)):
  print('Yes')
else:
  print('No')
Problem p02772 (python)

Fixed submission:
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
  return "APPROVED"
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))

Buggy submission (verdict: Runtime Error):
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
	return "APPROVED"      
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))

Buggy submission (verdict: Runtime Error):
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
return "APPROVED"      
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))

Buggy submission (verdict: Runtime Error):
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
return "APPROVED"      
n = int(input())
li = [int(num) for num in input.split(" ")]
print(fun(li))

Buggy submission (verdict: Runtime Error):
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
return "APPROVED      
n = int(input())
li = [int(num) for num in input.split(" ")]
print(fun(li))
Problem p03166 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**7)
def LPP():
    n, m = map(int, readline().split())
    edges = [[] for _ in range(n)]
    for _ in range(m):
        s, t = map(int, readline().split())
        s -= 1
        t -= 1
        edges[s].append(t)
    dp = [-1]*n
    def dfs(s):
        if dp[s] != -1:
            return dp[s]
        if len(edges[s]) == 0:
            dp[s] = 0
            return 0
        res = 0
        for t in edges[s]:
            res = max(res, dfs(t)+1)
        dp[s] = res
        return res
    for i in range(n):
        dfs(i)
    print(max(dp),end="")

LPP()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
def LPP():
    n, m = map(int, readline().split())
    edges = [[] for _ in range(n)]
    for _ in range(m):
        s, t = map(int, readline().split())
        s -= 1
        t -= 1
        edges[s].append(t)
    dp = [-1]*n
    def dfs(s):
        if dp[s] != -1:
            return dp[s]
        if len(edges[s]) == 0:
            dp[s] = 0
            return 0
        res = 0
        for t in edges[s]:
            res = max(res, dfs(t)+1)
        dp[s] = res
        return res
    for i in range(n):
        dfs(i)
    return max(dp)





print(LPP(), end="")
Problem p02658 (python)

Fixed submission:
n = int(input())
mx = 10**18
a = list(map(int, input().split()))
for x in a:
    if x == 0:
        print(0)
        exit(0)
ans = 1
for x in a:
    ans *= x
    if ans > mx:
        print(-1)
        exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
mx = 10**18
a = list(map(int, input().split()))
for x in a:
    if x == 0:
        print(0)
        exit(0)
ans = 1
for x in a:
    ans *= a
    if ans > mx:
        print(-1)
        exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
mx = 10**18
a = list(map(int, input().split()))
for x in a:
    if x == 0:
        print(0)
        exit(0)
ans = 1
for x in a:
    ans *= a
    if ans > mx:
        print(-1)
        exit(0)
print(ans)
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
X = int(input())
Y = int(input())
Z = int(input())
print(f'{Z} {X} {Y}')

Buggy submission (verdict: Runtime Error):
X, Y, Z = input().split()
print(f'{Z} {X} {Y}')

Buggy submission (verdict: Runtime Error):
X = int(input())
Y = int(input())
Z = int(input())
print(f'A value is {Z}')
print(f'B value is {X}')
print(f'C value is {Y}')
Problem p02705 (python)

Fixed submission:
r = int(input())

K = 3.14159265358979*2*r

print(K)

Buggy submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
 
if (N < M):
	print("-1")
else:
	sum = 0
    for i in range(M):
    	sum = sum + A[i]
    if(sum <= N):
    	sub = N-sum
        print(sub)
   	else:
    	print("-1")

Buggy submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
 
if (N < M):
	print("-1")
else:
	sum = 0
    for i in range(M):
    	sum = sum + A[i]
    if(sum <= N):
    	sub = sum-N
        print(sub)
   	else:
    	print("-1")
Problem p02658 (python)

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

ans = 1
var = pow(10,18)

if 0 in A:
    ans = 0
else:
    for i in range(len(A)):
        ans *= A[i]
        if ans > var:
            ans = -1
            break

print(ans)

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

ans = 1
var = pow(10,18)
for i in range(len(A)):
    ans *= A[i]
    if ans > tmp:
        ans = -1
        break

print(ans)
Problem p02664 (python)

Fixed submission:
T = input()
print(T.replace('?', 'D'))

Buggy submission (verdict: Runtime Error):
T = list(input())

num = T.count('?')
for _ in range(num):
    T[num] = 'D'

print(''.join(T))

Buggy submission (verdict: Runtime Error):
import copy

T = input()
copy_T = copy.copy(T)
ans, ans_T = 0, ''

def do_T():
    global ans, ans_T, T
    tmp = T.index('?')

    T = change_T(T, tmp, 'P')
    if '?' in T: do_T()
    if not '?' in T:
        var = T.count('PD') + T.count('D')
        if ans < var: 
            ans_T = copy.copy(T)
            ans = max(ans, var)

    T = change_T(T, tmp, 'D')
    if '?' in T: do_T()
    if not '?' in T:
        var = T.count('PD') + T.count('D')
        if ans < var: 
            ans_T = copy.copy(T)
            ans = max(ans, var)

def change_T(s, index, char):
    var = list(s)
    var[index] = char
    return ''.join(var)

do_T()
print(ans_T)
Problem p02687 (python)

Fixed submission:
S = input()

if S == 'ABC':
  print('ARC')
else:
  print('ABC')

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

if S = 'ABC':
  print('ARC')
else:
  print('ABC')
Problem p02742 (python)

Fixed submission:
import math
N, W = map(int, input().split())

if N == 1 or W == 1:
  ans = 1
else:
  ans = math.ceil((N * W) / 2)
  
print(ans)

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

if N == 1 or W == 1:
  ans = 1
else
  ans = math.ceil((N * W) / 2)
  
print(ans)
Problem p02755 (python)

Fixed submission:
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A] - 1
A = list_8[A-1]
  
B_ = list_10[B] - 1
B = list_10[B-1]

if A <= B <= A_:
  print(B)
elif B <= A <= B_:
  print(A)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
if B < 100:
  
B_ = list_10[B]
B = list_10[B-1]

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
import math

list_8 = []
list_10 = []

for i in range(100):
  list_8.append( math.floor((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
A = list_8[A-1]

B_ = list_10[B]
B = list_10[B-1]

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
import math

list_8 = []
list_10 = []

for i in range(100):
  list_8.append( math.floor((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
A = list_8[A-1]

B_ = list_10[B]
B = list_10[B-1]

print(A, A_, B, B_)

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)
Problem p02780 (python)

Fixed submission:
def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

Buggy submission (verdict: Runtime Error):
def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
ans = []
for i in range(k):
  sum += exp(p[i])
ans.append(sum)

for i in range(n-k+1):
  sum -= exp(p[i])
  sum += exp(p[k])
  ans.append(sum)

print(max(ans))
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'WA' and P[index] != -1:
      P[index] += 1
  elif P[index] > -1:
    wa += P[index]
    P[index] = -1
  
print(P.count(-1), wa)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'AC':
    wa += P[index]
    P[index] = -1
  elif :
    if P[index] != -1
      P[index] += 1
  
print(P.count(-1), wa)
Problem p02765 (python)

Fixed submission:
n, k = map(int,input().split())
print(k+(100*(10-n)) if n<10 else k)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().slpit())
print(k+(100*(10-k)) if n<10 else k)