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

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
D = np.zeros((10**5)+1)
S = sum(A)
for i in range(len(A)):
    D[A[i]] += 1
Q = int(input())
for _ in range(Q):
    b, c = list(map(int, input().split()))
    S += D[b]*(c-b)
    D[c] += D[b]
    D[b] = 0
    print(int(S))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
Q = int(input())
for _ in range(Q):
    b, c = list(map(int, input().split()))
    A[np.where(A==b)] = c
    A = np.sort(A)
    print(np.sum(A))
Problem p02639 (python)

Fixed submission:
a = list(map(int, input().split()))
for i in range(5):
    if a[i] == 0:
        print(i+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = np.array(list(map(int, input().split())))
for i in range(5):
    if a[i] == 0:
        print(i+1)
Problem p02641 (python)

Fixed submission:
import numpy as np
import sys
X, N = np.array(list(map(int, input().split())))
if N == 0:
    print(X)
    sys.exit()
p = np.array(list(map(int, input().split())))
p = np.sort(p)
a = np.ones(304, dtype = np.int)
a[p+102] = 0
m = X+1000
n = 0
for i in range(304):
    if a[i] == 1:
        if m>abs(i-X-102):
            m = abs(i-X-102)
            n = i-102
print(int(n))

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
X, N = np.array(list(map(int, input().split())))
if N == 0:
    print(X)
    sys.exit()
p = np.array(list(map(int, input().split())))
p = np.sort(p)
a = np.ones(203, dtype = np.int)
a[p+103] = 0
m = X
n = 0
for i in range(203):
    if a[i] == 1:
        if m>abs(i-X-103):
            if i-X-103 != 0:
                m = abs(i-X-103)
                n = i-103
print(n)
Problem p02658 (python)

Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1

print(b, end='')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1

print(b, end='')
Problem p02663 (python)

Fixed submission:
import numpy as np
h1, m1, h2, m2, k = np.array(list(map(int, input().split())))
h = h2 - h1
m = m2-m1
t = h*60 + m
print(t-k)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))
l = 0
n = 1
b = 0
g = np.zeros(N+1)
g[0] = 1-a[0]
for i in range(N+1):
    if a[i] < 0:
        l = -1
for i in range(1, N+1):
    g[i] = (g[i-1]-a[i-1])*2
    if g[i] <= 0:
        l = -1
g[N] = a[N]
for i in range(1, N+1):
    if l<0:
        break
    b = N-i
    if g[b] > g[b+1]+a[b]:
        g[b] = g[b+1]+a[b]
    if g[b] <= 0:
        l = -1
        break
if a[0] != 0 or l == -1:
    print(-1)
else:
    print(int(sum(g)))
Problem p02664 (python)

Fixed submission:
import numpy as np
t = input()

print(t.replace('?', 'D'))

Buggy submission (verdict: Runtime Error):
import numpy as np
t = input()
pre = 'D'
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
Problem p02760 (python)

Fixed submission:
al = [list(map(int, input().split())) for i in range(3)]
al = sum(al, [])
n = int(input())
bl = [int(input()) for i in range(n)]
check = [0 for i in range(9)]

for b in bl:
    if b in al:
        check[al.index(b)] = 1

if [1,1,1] in [check[:3], check[3:6], check[6:], check[0:7:3], check[1:8:3], check[2:9:3], check[0:9:4], check[2:8:2]]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
al = [list(map(int, input().split())) for i in range(3)]
al = sum(a, [])
n = int(input())
bl = [int(input()) for i in range(n)]
check = [0 for i in range(9)]

for b in bl:
    if b in al:
        check[al.index(b)] = 1

if [1,1,1] in [check[:3], check[3:6], check[6:], check[0:7:3], check[1:8:3], check[2:9:3], check[0:9:4], check[3:8:2]]:
    print("Yes")
else:
    print("No")
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 i in range(n)]
cnt = 0

for l in a:
    tmp = 0
    for i in range(m):
        tmp += b[i]*l[i]
    tmp += c
    if tmp > 0:
        cnt += 1

print(cnt)

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 i in range(n)]
cnt = 0

for l in a:
    tmp = 0
    for i in range(m):
        tmp += b[i]*a[i]
    tmp += c
    if tmp > 0:
        cnt += 1

print(cnt)
Problem p02658 (python)

Fixed submission:
over = 10**18

n = int(input())
a = list(map(int, input().split()))
ans = 1;

for i in range(n):
  if a[i] == 0:
    ans = 0
if not ans == 0:
  for i in range(n):
    ans = ans * a[i]
    if ans > over:
      ans = -1
      break
if ans < 0:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys

over = 10**8

n = int(input())
a = list(map(int, input().split()))
ans = 1;
for i in range(n):
  ans = ans * a[i]
  if ans > over:
    ans = -1
if ans < 0:
  print(-1)
else:
  print(ans)
Problem p02664 (python)

Fixed submission:
t = input()
ans = t.replace("?", "D")
print(ans)

Buggy submission (verdict: Runtime Error):
t = input()
ans = t.replace(?, D)
print(ans)
Problem p02719 (python)

Fixed submission:
N,K = map(int, input().split())
N = N%K
absolute = abs(K-N)
print(absolute if absolute < N else N)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
n = n % k
absolutes = abs(k-n)
print(absolutes if absolute < n else n)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = str(input())
print(s.count("ABC"))

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
count = 0
if(int(N)>=3 and int(N)<=50):
    for i in range(1, int(N)-1):
        if S[i-1]+S[i]+S[i+1] == "ABC":
            count += 1
    print(count)
Seen by Sokhom Sovichea at 19:59

Buggy submission (verdict: Runtime Error):
    N = input()
    S = input()
    count = 0
    if int(N) >= 3 and int(N) <= 50:
      for i in range(1, int(N)-1):
        if S[i-1] + S[i] + S[i+1] == "ABC":
          count += 1
    print(count)

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
count = 0
if int(N) >= 3 and int(N) <= 50:
  for i in range(1, int(N)-1):
    if s[i-1] + s[i] + s[i+1] == "ABC":
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
count = 0
for i in range(1, int(N)-1):
  if s[i-1] + s[i] + s[i+1] == "ABC":
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
for i in range(1, int(N)-1):
    if s[i-1] + s[i] + s[i+1] == "ABC":
        count += 1
print(count)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
S = sum(A)
count = [0]*(10**5+1)
for i in range(len(A)):
  count[A[i]] += 1

A = list(set(A))
for i in range(Q):
  B, C = map(int, input().split())
  S = S - B*count[B] + C*count[B]
  count[C] += count[B]
  count[B] = 0
  print(S)

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

count = [0]*(10**5)
for i in range(len(A)):
  count[A[i]] += 1

A = list(set(A))
for i in range(Q):
  B, C = map(int, input().split())
  count[C] += count[B]
  count[B] = 0
  ans = 0
  for i in range(len(A)):
    ans += count[A[i]] * A[i]
  print(ans)

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

count = [0]*(10**5)
for i in range(len(A)):
  count[A[i]] += 1


for i in range(Q):
  B, C = map(int, input().split())
  if count[B] != 0:
    count[C] += count[B]
    count[B] = 0
  ans = 0
  for i in range(len(A)):
    ans += count[A[i]]*A[i]
  print(ans)
Problem p02837 (python)

Fixed submission:
N = int(input())
x = []
y = []
words = []
for i in range(N):
  A = int(input())
  W = []
  for _ in range(A):
    x, y = map(int, input().split())
    W.append([x-1, y])
  words.append(W)
  
ans = 0
for bit in range(1<<N):
  ok = True
  is_honest = [(bit>>i) & 1 for i in range(N)]
  for i in range(N):
    if not is_honest[i]:
      continue
    for x, y in words[i]:
      if is_honest[x] != y:
        ok = False
  if ok:
    ans = max(ans, sum(is_honest))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = []
y = []
words = []
for i in range(N):
  A = int(input())
  W = []
  for _ in range(A):
    x, y = map(int, input().split())
    W.append([x-1, y])
  words.append(W)
  
ans = 0
for bit in range(1<<n):
  ok = True
  is_honest = [(bit>>i) & 1 for i in range(N)]
  for i in range(N):
    if not is_honest[i]:
      continue
    for x, y in words[i]:
      if is_honest[x] != y:
        ok = False
  if ok:
    ans = max(ans, sum(is_honest))
print(ans)
Problem p02700 (python)

Fixed submission:
k = list(map(int, input().split() ) )
t = 1
while k[0] > 0 and k[2] > 0:
  if t == 1:
    k[2] -= k[1]
    t=2
  else:
    k[0] -= k[3]
    t=1
if t==2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
k = list(map(int,input().split()))
t = k[0]//k[3]
a = k[2]//k[1]
if t >= k:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
k = list(map(int,input().split()))
t = k[0] // k[3]
a = k[2] // k[1]
if t >= k:
  print("Yes")
else:
  print("No")
Problem p02741 (python)

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k - 1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k])
Problem p02760 (python)

Fixed submission:
Bingo = [ list(map(int,input().split())) for i in range(3)]
n = int(input())
num = [int(input()) for i in range(n)]
Bingo.append([Bingo[0][0] , Bingo[1][1],Bingo[2][2] ])
Bingo.append([Bingo[0][2] , Bingo[1][1],Bingo[2][0] ])
for k in range(3):
  Bingo.append([Bingo[0][k] , Bingo[1][k],Bingo[2][k] ])
k=0
re = 'No'
for l in range(len(Bingo)):
  if len(list(set(num) & set(Bingo[l]))) == 3:
    re = 'Yes'
    break
print(re)

Buggy submission (verdict: Runtime Error):
Bingo = [ list(map(int,input().split())) for i in range(3)]
n = int(input())
num = [int(input()) for i in range(n)]
Bingo.append([Bingo[0][0] , Bingo[1][1],Bingo[2][2] ])
Bingo.append([Bingo[0][2] , Bingo[1][1],Bingo[2][0] ])
k=0
re = 'No'
for l in range(n):
  if len(list(set(num) & set(Bingo[l]))) == 3:
    re = 'Yes'
    break
print(re)
Problem p02811 (python)

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

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

if 500* A >= B:
  print("Yes")
else:
  print("No")
Problem p02700 (python)

Fixed submission:
import sys
A,B,C,D = list(map(int,input().split()))

while True:
  C = C - B
  A -= D
  if C <= 0:
    print("Yes")
    sys.exit(0)
  elif A <= 0:
    print("No")
    sys.exit(0)

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

while True:
  C = C - B
  A -= D
  print(C)
  print(A)
  if C <= 0:
    print("Yes")
    sys.exit(1)
  elif A <= 0:
    print("No")
    sys.exit(1)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

c = 0

if S[0] == T[0]:
  c+=1

if S[1] == T[1]:
  c+=1

if S[2] == T[2]:
  c+=1

print(c)

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

if N == 1:
  print(0)
elif N == 2:
  print(1)
else:
  print(int(N * (N-1) // 2))
Problem p02936 (python)

Fixed submission:
n,q = map(int,input().split())
rl = [0] * n
al = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a -1
for j in range(q):
    p,x = map(int,input().split())
    al[p-1] += x
for k in range(n):
    if k == 0:
        pass
    else:
        al[k] += al[rl[k]]
print(*al)

Buggy submission (verdict: Runtime Error):
#標準入力
N,Q = list(map(int,input().split()))
tree = []
for i in range(N-1):
  tmp = [int(i) for i in input().split()]
  tree.append(tmp)

x_list = []
for i in range(Q):
  tmp = [int(i) for i in input().split()]
  x_list.append(tmp)

#print(N)
#print(Q)
#print(tree)
#print(x_list)
#関数

#l:リスト　x:加算値
def saiki(result, chil_list, pos, l, x):
  #print(result)
  if not l:
    result[pos] += x
  else:
    result[pos] += x
    for j in l:
      #print(j)
      saiki(result, chil_list, j, chil_list[j], x)
    

#子リストの作成
children=[]
for i in range(N+1):
  children.append([])
for i in range(N-1):
  children[tree[i][0]].append(tree[i][1])

#print(children)
#結果リストの初期化
result = [0] * (N+1)

for i in range(Q):
  kasan_root = x_list[i][0]
  kasan = x_list[i][1]
  
  if not children[kasan_root]:
    result[kasan_root] += kasan
  else:
    saiki(result, children, kasan_root, children[kasan_root], kasan)
    #result[kasan_root] += kasan
  
result.pop(0)
print(*result)

Buggy submission (verdict: Runtime Error):
#標準入力
N,Q = list(map(int,input().split()))
tree = []
for i in range(N-1):
  tmp = [int(i) for i in input().split()]
  tree.append(tmp)

x_list = []
for i in range(Q):
  tmp = [int(i) for i in input().split()]
  x_list.append(tmp)

#print(N)
#print(Q)
#print(tree)
#print(x_list)
#関数
  
def subtree(subtree, x):
  for node in subtree:
    result[node] += x

#l:リスト　x:加算値
def saiki(result, chil_list, pos, l, x):
  #print(result)
  if not l:
    result[pos] += x
  else:
    result[pos] += x
    for j in l:
      #print(j)
      saiki(result, chil_list, j, chil_list[j], x)
    

#子リストの作成
children=[]
for i in range(N+1):
  children.append([])
for i in range(N-1):
  children[tree[i][0]].append(tree[i][1])

#print(children)
#結果リストの初期化
result = [0] * (N+1)

for i in range(Q):
  kasan_root = x_list[i][0]
  kasan = x_list[i][1]
  
  if not children[kasan_root]:
    result[kasan_root] += kasan
  else:
    saiki(result, children, kasan_root, children[kasan_root], kasan)
    #result[kasan_root] += kasan
  
result.pop(0)
print(*result)
Problem p02971 (python)

Fixed submission:
n=int(input())
l=[int(input()) for i in range(n)]
a=sorted(l)
b=a[-1]
c=a[-2]
for i in l:
  if i!=b:
    print(b)
  else:
    print(c)

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())

A = []
for i in range(N):
  tmp = int(input())
  A.append(tmp)

A_set = set(A)
if len(A_set)==1:
  val = max(A_set)
  for i in range(N):
    print(val)
  sys.exit()

second_max = sorted(A_set)[-2]
#print(A_set)
#print(second_max)
#print('--')

tmp_max = max(set(A))
tmp_max_list = [i for i, x in enumerate(A) if x == tmp_max]
#print(tmp_max_list)
if tmp_max_list > 1:
  for i in range(N):
    print(tmp_max)
  sys.exit()

tmp_list = [tmp_max] * N
tmp_list[A.index(tmp_max)]=tmp_max
#[式 for 任意の変数名 in イテラブルオブジェクト if 条件式]
#l_odd = [i for i in l if not i % 2 == 0]
for i in range(N):
  print(tmp_list[i])

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())

A = []
for i in range(N):
  tmp = int(input())
  A.append(tmp)

A_set = set(A)
if len(A_set)==1:
  val = A[0]
  for i in range(N):
    print(val)
  sys.exit()

else:
  second_max = sorted(A_set)[-2]

tmp_max = max(set(A))
tmp_max_list = [i for i, x in enumerate(A) if x == tmp_max]

tmp_list = [tmp_max] * N
#[式 for 任意の変数名 in イテラブルオブジェクト if 条件式]
#l_odd = [i for i in l if not i % 2 == 0]
for i in len(tmp_max_list):
  tmp_list[tmp_max_list[i]]=second_max

for i in range(N):
  print(tmp_list[i])
Problem p02988 (python)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
  a = p[i]
  b = p[i+1]
  c = p[i+2]
  if b > a and b < c:
    count+=1
  elif b > c and b < a:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
  a = p[i]
  b = p[i+1]
  c = p[i+2]
  if b > a and b < c:
    count+=1
  else b > c and b < a:
    count+=1
print(count)
Problem p02641 (python)

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

if N > 0:
  p = list(map(int, input().split(" ")))
else:
  p = []

go = True
absolute = 1
plus = True

if X not in p:
  print(X)
else:
  while go:
    if plus:
      target = X - absolute
      if target not in p:
        print(target)
        go = False
      plus = False
    else:
      target = X + absolute
      if target not in p:
        print(target)
        go = False
      absolute += 1
      plus = True

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

p = []
for i in range(N):
  p.append(int(input()))

# p = list(map(int, input().split(" ")))

go = True
absolute = 1
plus = True

if X not in p:
  print(X)
else:
  while go:
    if plus:
      target = X - absolute
      if target not in p:
        print(target)
        go = False
      plus = False
    else:
      target = X + absolute
      if target not in p:
        print(target)
        go = False
      absolute += 1
      plus = True
Problem p02706 (python)

Fixed submission:
nm = input().split(' ')

N, M = int(nm[0]), int(nm[1])

A = input().split()

A_sum = 0

for i in A:
    A_sum += int(i)

if A_sum - N <= 0:
    print( N - A_sum )
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import math
 
R = int(input())
 
print(2*math.pi*R)
Problem p02760 (python)

Fixed submission:
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")

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

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

# horizonal
if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
# diagonal
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
# Virtical
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")
Problem p03289 (python)

Fixed submission:
inp = input()

#print(inp.startswith("A"))
#print(inp[2:len(inp)-1].count("C") ==  1)
#print(inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower())
#print(inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower())

if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")

Buggy submission (verdict: Runtime Error):
if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(0, 151)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

if N == 0:
    print(X)
else:
    for i in not_p_list:
        j = abs(i - X)
        ans_list.append(j)

    # print(ans_list)

    ans = min(ans_list)
    minus_ans = -1 * ans

    #print(ans, minus_ans)

    if (minus_ans + X) in not_p_list:
        print(minus_ans + X)
    else:
        print(ans + X)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(1, 101)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

for i in not_p_list:
    j = abs(i - X)
    ans_list.append(j)

# print(ans_list)

ans = min(ans_list)
minus_ans = -1 * ans

#print(ans, minus_ans)

if (minus_ans + X) in not_p_list:
    print(minus_ans + X)
else:
    print(ans + X)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(1, 101)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

for i in not_p_list:
    j = abs(i - X)
    ans_list.append(j)

# print(ans_list)

ans = min(ans_list)
minus_ans = -1 * ans

print(ans, minus_ans)

if (minus_ans + X) in not_p_list:
    print(minus_ans + X)
else:
    print(ans + X)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
ans = int(N)
N_1 = N
N_2 = N
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
    if ans > abs(N):
        ans = abs(N)
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = int(N)
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))
    print(N_1)
    print(N_2)

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)
Problem p02675 (python)

Fixed submission:
N = input()

if int(N[-1]) in [2,4,5,7,9]:
	print('hon')
elif int(N[-1]) in [0,1,6,8]:
	print('pon')
else:
	print('bon')

Buggy submission (verdict: Runtime Error):
import math

a, b, h, m = list(map(int, input().split()))

if m == 0:
	m = 60
if h == 0
	h = 12

if h/12 > m/60:
	k = (h/12 - m/60) * 360
elif h/12 < m/60:
	k = (m/60 - h/12) * 360
else:
	print(0)
	exit()
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(k)))))
Problem p02677 (python)

Fixed submission:
import math

a, b, h, m = list(map(int, input().split()))
rh = (h + m/60) * 30 
rm = m * 6
rd = abs(rh -rm)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(rd)))))

Buggy submission (verdict: Runtime Error):
import math

a, b, h, m = list(map(int, input().split()))

if m == 0:
	m = 60
if h == 0
	h = 12

if h/12 > m/60:
	k = (h/12 - m/60) * 360
elif h/12 < m/60:
	k = (m/60 - h/12) * 360
else:
	print(0)
	exit()
# print(k)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(k)))))

Buggy submission (verdict: Runtime Error):
import math

a, b, h, m = list(map(int, input().split()))


if m == 0:
	m = 60
if h == 0
	h = 12

if h/12 > m/60:
	k = (h/12 - m/60) * 360
elif h/12 < m/60:
	k = (m/60 - h/12) * 360
else:
	print(0)
	exit()
# print(k)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(k)))))
Problem p02681 (python)

Fixed submission:
t,s = [str(input()) for _ in range(2)]
if s[:-1] == t:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
*l, = map(int,input().split())
seenl = [1]
seen = {1}
temp=1
for i in range(k):
  temp=l[temp-1]
  if temp in seen:
    lenloop = len(seenl)-seenl.index(temp)
    r = (k-i-1)%lenloop
    temp = seenl[seenl.index(temp):][r]
    break
  seenl.append(temp)
  seen.add(temp)
print(temp)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
start = 1
seenl = []
seen = set()
for i in range(k):
	start = l[start-1]
	if start in seen:
		loop_len = len(seenl) - seenl.index(start)
		r = (k-i-1)%loop_len
		goal = seenl[seenl.index(start):][r]
		break
	seenl.append(start)
	seen.add(start)
print(goal)

Buggy submission (verdict: Runtime Error):
a, b, c, k = list(map(int, input().split()))
if a > k:
	print(sum(([1] * a)[:k]))
else:
	print(sum([1] * a))