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

Fixed submission:
N = int(input())
S =[input() for i in range(N)]
#print(S)

cnt = 0
BA = 0 # 'B~A'
lA = 0 # last 'A'
fB = 0 # first 'B'

for i in S:
  c = i.count('AB')
  # count 'B~*', 'B~A' '*~A'
  if i.find('B') == 0 and i.rfind('A') == len(i)-1:
    BA += 1
  elif i.find('B') == 0:
    fB += 1
  elif i.rfind('A') == len(i)-1:
    lA += 1
  cnt += c

# lA_fB = min(lA, fB)  
# r = min(abs(lA - fB), BA)
# n = max(0, (BA -r) // 2)

if BA > 0:
  cnt += BA -1
  if lA > 0:
    cnt += 1
    lA -= 1
  if fB > 0:
    cnt += 1
    fB -= 1

cnt += min(fB, lA)
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S =[input() for i in range(N)]
print(S)

cnt = 0
BA = 0 # 'B~A'
lA = 0 # last 'A'
fB = 0 # first 'B'

for i in S:
  c = i.count('AB')
  # count 'B~*', 'B~A' '*~A'
  if i.find('B') == 0 and i.rfind('A') == len(i)-1:
    BA += 1
  elif i.find('B') == 0:
    fB += 1
  elif i.rfind('A') == len(i)-1:
    lA += 1
  cnt += c

# lA_fB = min(lA, fB)  
# r = min(abs(lA - fB), BA)
# n = max(0, (BA -r) // 2)

if lA_fB > 0:
  cnt += lA_fB -1
  if lA > 0:
    cnt += 1
    lA -= 1
  if fB > 0:
    cnt += 1
    fB -= 1

cnt += min(fB, lA)
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S =[input() for i in range(N)]
print(S)

cnt = 0
BA = 0 # 'B~A'
lA = 0 # last 'A'
fB = 0 # first 'B'

for i in S:
  c = i.count('AB')
  # count 'B~*', 'B~A' '*~A'
  if i.find('B') == 0 and i.rfind('A') == len(i)-1:
    BA += 1
  elif i.find('B') == 0:
    fB += 1
  elif i.rfind('A') == len(i)-1:
    lA += 1
  cnt += c

# lA_fB = min(lA, fB)  
# r = min(abs(lA - fB), BA)
# n = max(0, (BA -r) // 2)

if lA_fB > 0:
  cnt += lA_fB -1
  if lA > 0:
    cnt += 1
    lA -= 1
  if fB > 0:
    cnt += 1
    fB -= 1

cnt += min(fB, lA)
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S =[input() for i in range(N)]
print(S)

cnt = 0
BA = 0 # 'B~A'
lA = 0 # last 'A'
fB = 0 # first 'B'

for i in S:
  c = i.count('AB')
  # count 'B~*', 'B~A' '*~A'
  if i.find('B') == 0 and i.rfind('A') == len(i)-1:
    BA += 1
  elif i.find('B') == 0:
    fB += 1
  elif i.rfind('A') == len(i)-1:
    lA += 1
  cnt += c

# lA_fB = min(lA, fB)  
# r = min(abs(lA - fB), BA)
# n = max(0, (BA -r) // 2)

if lA_fB > 0:
  cnt += lA_fB -1
  if lA > 0:
    cnt += 1
    lA -= 1
  if fB > 0:
    cnt += 1
    fB -= 1

cnt += min(fB, lA)
print(cnt)
Problem p03071 (python)

Fixed submission:
# スペース区切りの整数の入力
a, b = map(int, input().split())
# 文字列の入力
s = [2*a-1, 2*b-1, a+b]
# 出力
print("{}".format(max(s)))

Buggy submission (verdict: Runtime Error):
a, b = map(int(input().split()))
if a == b:
  print(a + b)
else:
  print(max(a, b) * 2 - 1)
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input())
print(min(C,B//A))
Problem p03125 (python)

Fixed submission:
A,B =map(int, input().split())
if B % A == 0:
  print(A+B)
else:
  print(B-A)

Buggy submission (verdict: Runtime Error):
A,B =map(int, input())
if B % A == 0:
  print(A+B)
else:
  print(B-A)
Problem p03138 (python)

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

# 各桁について、"1"の数が n // 2 以下だったら "1"、 そうでなければ "0"

from math import log2
num = int(log2(10**12) + 1)
box = [0] * (num + 1)
for i in a:
  l = bin(i)[2:][::-1]
  for itr, val in enumerate(l):
    box[itr] += int(val)

X = 0
for itr, val in enumerate(box[::-1]):
  if val <= n // 2 and X + 2 ** (num - itr) <= k:
    X += 2 ** (num - itr)

ans = 0
for i in a:
  ans += X ^ i
  
print(ans)

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

# 各桁について、"1"の数が n // 2 以下だったら "1"、 そうでなければ "0"

from math import log2
num = int(log2(k))
box = [0] * (num + 1)
for i in a:
  l = bin(i)[2:][::-1]
  for itr, val in enumerate(l):
    box[itr] += int(val)

X = 0
for itr, val in enumerate(box[::-1]):
  if val <= n // 2 and X + 2 ** (num - itr) <= k:
    X += 2 ** (num - itr)

ans = 0
for i in a:
  ans += X ^ i
  
print(ans)
Problem p03145 (python)

Fixed submission:
e = list(map(int, input().split()))
e.sort()
print(int(e[0]*e[1]*(1/2)))

Buggy submission (verdict: Runtime Error):
a, b , c = map(int(input().split()))
ans = a * b // 2
print(ans)
Problem p03146 (python)

Fixed submission:
def fn(n):
  if n % 2 == 0:
    return n/2
  else:
    return 3*n + 1

s = int(input())
  
al = []
al.append(s)
cnum = s
for i in range(2,1000000):
  cnum = fn(cnum)
  if cnum in al[:-1]:
    print(i)
    exit()
  else:
    al.append(cnum)

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
 
import itertools
hoges = {}
for i in itertools.combinations(xy, 2):
    if i[0][0] - i[1][0] >= 0:
        hoge = (i[0][0] - i[1][0], i[0][1] - i[1][1])
    else:
        hoge = (i[1][0] - i[0][0], i[1][1] - i[0][1])
    hoges.setdefault(hoge, 0)
    hoges[hoge] += 1
# print(hoges)
max_v = max(hoges.values())
print(N - max_v)
Problem p03164 (python)

Fixed submission:
N, W = [int(i) for i in input().split()]
WV = [[int(i) for i in input().split()] for j in range(N)]

import numpy as np
max_value = np.sum(np.array(WV), axis=0)[1]

# dp[v]: 価値vを達成するのに必要な重さの最小値
dp = np.full(max_value + 1, W + 1, dtype='int64')

dp[0] = 0
for w, v in WV:
    # 価値i(0 <= i <= max_value - v)のときの重さの最小値に対し
    # 次の荷物を入れて、価値i+vのときの重さの最小値を更新
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print(np.max(np.where(dp <= W)))

Buggy submission (verdict: Runtime Error):
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(n):
  for j in range(w + 1):
    if j + wv[i][0] <= w:
      dp[i + 1][j + wv[i][0]] = max(dp[i + 1][j + wv[i][0]], dp[i][j] + wv[i][1])
    dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

V_MAX = 10 ** 5 + 1
INF = 10 **18

dp = [[INF] * (V_MAX) for _ in range(n + 1)]
for i in range(n):
  for j in range(V_MAX):
    if wv[i][1] > j:
      dp[i + 1][j + wv[i][1]] = min(dp[i + 1][j + wv[i][0]], dp[i][j] + wv[i][0])
    dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])
print(min([i for i, v in enumerate(dp[-1]) if v <= w]))

Buggy submission (verdict: Runtime Error):
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(n):
  for j in range(w + 1):
    if j + wv[i][0] <= w:
      dp[i + 1][j + wv[i][0]] = max(dp[i + 1][j + wv[i][0]], dp[i][j] + wv[i][1])
    dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])
print(max(dp[-1]))
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

pos1 = len(s)
for i, v in enumerate(s):
  if v != "1":
    pos1 = i
    break
  
if k < pos1 + 1:
  print(1)
else:
  print(s[pos1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for i, v in enumerate(s):
  if v != "1":
    pos1 = i
    break
  
if k < pos1 + 1:
  print(1)
else:
  print(s[pos1])
Problem p03285 (python)

Fixed submission:
N = int(input())
for i in range(0, 101):
  for j in range(0, 101):
    if i * 4 + j * 7 == N:
      print("Yes")
      exit()
print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(0, 101):
  for j in range(0, 101):
    if i * 4 + j * 7 = N:
      print("Yes")
      exit()
print("No")
Problem p03304 (python)

Fixed submission:
n, m, d = map(int,input().split())
if d == 0:
  print((m-1)/n)
else:
  print((2*(n-d))*(m-1)/(n**2))

Buggy submission (verdict: Runtime Error):
n, m, d = map(int,input().split())
if d == 0:
  print(1/n)
else:
  print((2*(n-d))**(m-1)/(n**2))
Problem p03338 (python)

Fixed submission:
from collections import Counter
n = input()
s = input()
ans = 0
for i in range(len(s)):
  l = s[:i]
  r = s[i:]
  cnt = 0
  cl = Counter(l)
  for i in cl.keys():
    if i in r:
      cnt += 1
  if ans < cnt:
    ans = cnt
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
S = input()

ans = 0
for i in range(1, N):
  l = S[:i]
  r = S[i:]
  lc = collections.Counter(l)
  rc = collections.Counter(r)
  ans = max(ans, lc, rc)

print(ans)
Problem p03351 (python)

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

Buggy submission (verdict: Runtime Error):
import math
 
def hoge(x, p):
  return int((math.floor(x**(1/p)))**p)
 
x = int(input())
 
max_bp = 0
for b in range(2, x):
  for p in range(2, x):
    bp = b ** p
    if bp > x:
      break
    max_bp = max(max_bp, bp)

print(max_bp)
Problem p03361 (python)

Fixed submission:
import numpy as np

h, w = map(int,input().split())
hw = [input() for i in range(h)]

isPaintable = [[1]*w for _ in range(h)]

predList = [[0,1],[0,-1],[1,0],[-1,0]]

for i in range(h):
  for j in range(w):
    if hw[i][j] == "#":
      for x, y in predList:
        if i+y in range(h) and j+x in range(w):
#          print(hw[i][j],hw[i+y][j+x],i,j,y,x)
          if hw[i+y][j+x]=="#":
            isPaintable[i][j] = 0
            break
    elif hw[i][j] == ".":
      isPaintable[i][j] = 0

if np.array(isPaintable).sum() == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]
drc = [[0,1],[0,-1],[1,0],[-1,0]]
for i in range(h):
  for j in range(w):
    if S[i][j] == "#":
      if all([S[i+x][j+y] =="." for x, y in drc if 0 <= i+x < w and 0 <= j+y < h]):
        print("No")
        exit()
print("Yes")
Problem p03369 (python)

Fixed submission:
s = input()
print(700 + s.count("o") * 100)

Buggy submission (verdict: Runtime Error):
s = input()
print(700 + s.count(o) * 100)
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
print(min(sum([1 for x in A if x>X]) , sum([1 for x in A if x<X])))

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
print(min(sum([1 for i in a if > x]), sum([1 for i in a if < x])))
Problem p03407 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A + B >= C:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A + B => C:
  print("Yes")
else:
  print("No")
Problem p03408 (python)

Fixed submission:
import collections

N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
cs = collections.Counter(s)
ct = collections.Counter(t)
ans = 0
for k in cs.keys():
#  print(k, cs[k], ct[k])
  c = cs[k] - ct[k]
  if c > ans:
    ans = c
print(max(ans, 0))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [int(input()) for i in range(N)]
M = int(input())
t = [int(input()) for i in range(M)]
cs = collections.Counter(s)
ct = collections.Counter(t)
print(max(0, cs.most_common()[0][1] - ct.most_common()[0][1]))
Problem p03424 (python)

Fixed submission:
N = input()
s = list(input().split())
if "Y" in s:
  print("Four")
else:
  print("Three")

Buggy submission (verdict: Runtime Error):
N = input()
s = list(map(int, input().split()))
if "Y" in s:
  print("Four")
else:
  print("Three")
Problem p03434 (python)

Fixed submission:
n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
a = sum([v for i, v in enumerate(c) if i % 2 == 0 ])
b = sum([v for i, v in enumerate(c) if i % 2 == 1 ])
print(a - b)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
a = sum([v for i, v in enumerate(c) if i % 2 == 0 ]
b = sum([v for i, v in enumerate(c) if i % 2 == 1 ]
print(a - b)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(map(int, input().split()))
c.sort(rexerse=True)
a = sum([v for i, v in enumerate(c) if i % 2 == 0 ]
b = sum([v for i, v in enumerate(c) if i % 2 == 1 ]
print(a - b)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a % 2 == 1 and b % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a % 2 == 1 and b % 2 == 1:
  print("Odd")
else:
  print("Even)
Problem p03456 (python)

Fixed submission:
ab = int(input().replace(" ", ""))
if ab ** (1 / 2) % 1 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
ab = int(input().replace(" ", "")
if ab ** (1 / 2) % 1 == 0:
  print("Yes")
else:
  print("No")
Problem p03471 (python)

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

flg = -1
for i in range(N+1):
  for j in range(N+1):
    goke = 9000*i + 4000*j
    if (goke == Y - 1000*N) and (i + j <= N):
      A = i
      B = j
      flg = 1
      break

if flg == 1:
  C = N - A -B
  print('{} {} {}'.format(A, B, C))
else:
  print('-1 -1 -1')

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

flg = -1
for i in range(N+1):
  for j in range(N+1):
    goke = 9000*i + 4000*j
    if (goke == Y - 1000*N) and (A + B <= N):
      A = i
      B = j
      flg = 1
      break

if flg == 1:
  C = N - A -B
  print('{} {} {}'.format(A, B, C))
else:
  print('-1 -1 -1')
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
if s[a] == "-" and s.count("-") == 1:
  if ｓ.replace("-", "").isdecimal():
    print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
if s[a] == "-" and s.count("-") == 1:
  if ｓ.replase("-", "").isdecimal():
    print("Yes")
else:
  print("No")
Problem p03478 (python)

Fixed submission:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N + 1):
  if A <= sum(map(int, list(str(i)))) <= B:
    ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
cnt = 0
for i in range(1, N + 1):
  if A <= sum(list(str(i))) <= B:
    cnt += 1
print(cnt)
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
print(math.ceil(int(input() + int(input()))))
Problem p03494 (python)

Fixed submission:
n = input()
A = list(map(int, input().split()))
cnt = 0
while all(a % 2 == 0 for a in A):
    A = [a / 2 for a in A]
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))
cnt = 0
while all(a % 2 == 0 for a in A):
    A=[a / 2 for a in A]
    ans += 1
print(ans)
Problem p03573 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A==B:
  print(C)
elif A==C:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
from collections import deque

h,w = map(int,input().split())
hw = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if hw[i][j] == ".":
      cnt = 0
      for x in [-1, 0, 1]:
        for y in [-1, 0, 1]:
          if i+y in range(h) and j+x in range(w):
            if hw[i+y][j+x]=="#":
              cnt += 1
      hw[i][j]=cnt

for line in hw:
  print("".join(list(map(str, line))))
Problem p03606 (python)

Fixed submission:
n = int(input())
lr = [list(map(int, input().split())) for _ in range(n)]
print(sum([i[1] -i[0] + 1 for i in lr]))

Buggy submission (verdict: Runtime Error):
n = int(input())
lr = [list(map(int, input().split())) for _ in range(n)]
print(sum([i[1] -1[0] + 1 for i in lr]))
Problem p03628 (python)

Fixed submission:
n = int(input())
U = list(input())
input()

mod = 1000000007

if n == 1:
  print(3)
  exit()

idx = 0
li = []
while idx < len(U) - 1:
  if U[idx] == U[idx + 1]:
    li.append(2)
    idx += 1
  else:
    li.append(1)
  idx += 1
if U[-1] != U[-2]:
  li.append(1)

ans = 1
pre = li[0]

if pre == 1:
  ans = ans * 3 % mod
else:
  ans = ans * 6 % mod
  
for i in li[1:]:
  if pre == 1:
    ans = ans * 2 % mod
  else:
    if i == 2:
      ans = ans * 3 % mod
  pre = i

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
U = list(input())
input()

mod = 1000000007

idx = 0
li = []
while idx < len(U) - 1:
  if U[idx] == U[idx + 1]:
    li.append(2)
    idx += 1
  else:
    li.append(1)
  idx += 1
if U[-1] != U[-2]:
  li.append(1)

ans = 1
pre = li[0]

if pre == 1:
  ans = ans * 3 % mod
else:
  ans = ans * 6 % mod
  
for i in li[1:]:
  if pre == 1:
    ans = ans * 2 % mod
  else:
    if i == 2:
      ans = ans * 3 % mod
  pre = i

print(ans)
Problem p03632 (python)

Fixed submission:
ABCD = list(map(int,input().split()))
if ABCD[1]<=ABCD[2] or ABCD[3]<=ABCD[0]:
  print(0)
else:
  ABCD.sort()
  print(ABCD[2]- ABCD[1])

Buggy submission (verdict: Runtime Error):
ABCD = list(map(int,input().split()))
if ABCD[1]<=ABCD[]2 or ABCD[3]<=ABCD[0]:
  print(0)
else:
  ABCD.sort()
  print(ABCD[2]- ABCD[1])
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0] + str(len(s)-2) + s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
ptint(s[0] + str(len(s)+2) + s[-1])
Problem p03643 (python)

Fixed submission:
print("ABC" + input())

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

fst = []

for i in ab:
  if i[0]==1:
    fst.append(i[1])

for i in ab:
  for j in fst:
    if set(i) == set([j, N]):
      print("POSSIBLE")
      exit()
print("IMPOSSIBLE")
Problem p03759 (python)

Fixed submission:
a,b,c = map(int, input().split())
if (b - a) == (c - b):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if b − a == c − b:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if b − a == c − b:
  print("YES"):
else:
  print("NO")
Problem p03760 (python)

Fixed submission:
o = input()
e = input()
ans = []
for i in range(len(o)):
  ans.append(o[i])
  if i < len(o) - 1 or len(e) == len(o):
    ans.append(e[i])
print("".join(ans))

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
ans = []
for i in range(len(o)):
  ans.append(o[i])
  if i < len(o) or len(e) == len(o):
    ans.append(e[i])
print("".join(ans))

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
ans = []
for i in range(len(o)):
  ans.append(o[i])
  if i < len(o) or len(e) == len(o) 
    ans.append(e[i])
print("".join(ans))

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
ans = []
for i in range(len(o)):
  ans.append(o[i])
  ans.append(e[i])
print("".join(ans))
Problem p03827 (python)

Fixed submission:
n = input()
s = input()

ans = 0
cnt = 0
for i in s:
  if i == "I":
    cnt += 1
  else:
    cnt -= 1
  if ans < cnt:
    ans = cnt
print(ans)

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

ans = 0
for i in s:
  if i == "I":
    cnt += 1
  else:
    cnt -= 1
  if ans < cnt:
    ans = cnt
print(ans)
Problem p03853 (python)

Fixed submission:
h, w = map(int, input().split())
for i in range(h):
  s = input()
  print(s)
  print(s)

Buggy submission (verdict: Runtime Error):
h, w = input().split()
for i in range(h):
  s = input()
  print(s)
  print(s)
Problem p03929 (python)

Fixed submission:
n, k = map(int,input().split())
if n < 3:
    print(0)
    exit()

table = [[0] * 5 for i in range(11)]
for i in range(11):
    for j in range(5):
        t = 9 * (j + 2 + 7 * (i + 1))
        table[i][j] = t % 11

c = [0]
for row in table:
    c.append(c[-1] + row.count(k))

d, m = divmod(n - 2, 11)
ans = c[m] + c[-1] * d
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
if n < 3:
    print(0)
    exit()

table = [[0] * 5 for i in range(11)]
for i in range(11):
    for j in range(5):
        t = 9 * (j + 2 + 7 * (i + 1))
        table[i][j] = t % 11

c = [0]
for row in table:
    c.append(c[-1] + row.count(K))

d,m = divmod(n - 2, 11)
ans = c[m] + c[-1] * d
print(ans)
Problem p03962 (python)

Fixed submission:
import collections

li = list(map(int, input().split()))
c = collections.Counter(li)

print(len(c.keys()))

Buggy submission (verdict: Runtime Error):
import collections

li = list(map(int, input().split()))
c = collections.Counter(li)

print(count(c.keys()))
Problem p04011 (python)

Fixed submission:
N, K, X, Y = [int(input()) for _ in range(4)]
print(min(N, K) * X + max(0, N - K) * Y)

Buggy submission (verdict: Runtime Error):
N, K, X, Y = [int(input() for _ in range(4))]
print(min(N, K) * X + max(0, N - K) * Y)
Problem p04026 (python)

Fixed submission:
# a*a と aaの２パターンを探せばよい？
s = input()
n = len(s)
for i in range(n-1):
  if s[i] == s[i + 1]:
    print(i + 1, i + 2)
    exit()
  
for i in range(n-2):
  if s[i] == s[i + 2]:
    print(i + 1, i + 3)
    exit()
  
print(-1, -1)

Buggy submission (verdict: Runtime Error):
# a*a と aaの２パターンを探せばよい？
s = input()
n = len(s)
for i in range(n-2):
  if s[i] == s[i + 1]:
  print(i, i + 1)
  exit()
  
for i in range(n-3):
  if s[i] == s[i + 2]:
  print(i, i + 2)
  exit()
  
print(-1, -1)
Problem p04035 (python)

Fixed submission:
from collections import deque
N, L = map(int, input().split())
c = list(map(int, input().split()))
for i in range(len(c)-1):
  if c[i] + c[i+1] >= L:
    pos = i + 1
    break
else:
  print("Impossible")
  exit()

print("Possible")
for i in range(1,pos):
  print(i)
for i in range(len(c) -1, pos, -1):
  print(i)
print(pos)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, L = map(int, input().split())
c = list(map(int, input().split()))
for i in range(len(c)-1):
  if c[i] + c[i+1] >= L:
    pos = i + 1
    break
else:
  print("Impossible")
  
for i in range(1,pos):
  print(i)
for i in range(len(c) -1, pos, -1):
  print(i)
Problem p04043 (python)

Fixed submission:
n = list(map(int, input().split()))
n.sort()
if n[0] == n[1] == 5 and n[2] == 7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = list(int, input().split())
n.sort()
if n[0] == n[1] == 5 and n[2] == 7:
  print("YES")
else:
  print("NO")
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
res = H // A + (H % A > 0)
print(res)

Buggy submission (verdict: Runtime Error):
H, A = map(int, intput().split())
res = H // A
if H % A > 0:
  	res += 1
print(res)

Buggy submission (verdict: Runtime Error):
H, A = map(int, intput().split())
res = H // A
if H % A > 0:
  	res += 1
print(res)
Problem p02953 (python)

Fixed submission:
from sys import *

n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
last = arr[n - 1]
for i in range(n - 1, -1, -1):
	if arr[i] > last:
		d = arr[i] - last
		if d > 1:
			print("No")
			exit(0)
	last = min(last, arr[i])
print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import *

n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
last = arr[n - 1]
for i in range(n - 1, -1, -1):
	if arr[i] > last:
		d = arr[i] - last
		if d > 1:
			exit(print("No"))
	last = min(last, arr[i])
print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import *

n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
last = arr[n - 1]
for i in range(n - 1, 0, -1):
	if arr[i] > last:
		d = arr[i] - last
		if d > 1:
			exit(print("No"))
	last = min(last, arr[i])
print("Yes")
Problem p03698 (python)

Fixed submission:
from sys import *

s = stdin.readline()
fre = [0] * 200
for ch in s:
	fre[ord(ch)] += 1
	if fre[ord(ch)] > 1:
		print("no")
		exit()
print("yes")

Buggy submission (verdict: Runtime Error):
s = input()
fre = [0] * 27
for ch in s:
  fre[ord(ch)] += 1
  if fre[ord(ch)] > 1:
    print("no")
    exit()
print("yes")