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

Fixed submission:
MOD = 10**9 + 7
def Mod_Permutation(n, k, mod):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret = ret * i % mod
    return ret
N, M = map(int, input().split())
if abs(N - M) > 1:
    print(0)
elif N == M:
    print(int(Mod_Permutation(N, N, MOD) * (2 * Mod_Permutation(N, M, MOD) % MOD) % MOD))
else:
    if N < M:
        T = N
        N = M
        M = T
    print(int(Mod_Permutation(N, N, MOD) * Mod_Permutation(M, M, MOD) % MOD))

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
def Mod_Permutation(n, k, mod):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret = ret * i % mod
    return ret
N, M = map(int, input().split())
if abs(N - M) > 1:
    print(0)
elif N == M:
    print(int(Mod_Permutation(N, N, MOD) * (2 * Mod_Permutation(N, M, MOD) % MOD) % MOD))
else:
    if N < M:
        swap(N, M)
    print(int(Mod_Permutation(N, N, MOD) * Mod_Permutation(M, M, MOD) % MOD))

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
def Mod_Permutation(n, k, mod):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret = ret * i % mod
    return ret
N, M = map(int, input().split())
print(Mod_Permutation(N, N, MOD) * P(N+1, M, MOD) % MOD)
Problem p03698 (python)

Fixed submission:
s=input()
from collections import Counter
c=Counter(s)
if c.most_common()[0][1]>1:
  print("no")
else:
  print("yes")

Buggy submission (verdict: Runtime Error):
s=input()
from collections import Counter
c=Counter(s)
if most_common(c)[0]>1:
  print("no")
else:
  print("yes")
Problem p03712 (python)

Fixed submission:
h,w=map(int,input().split())
a=['#'*(w+2)]+['#'+input()+'#' for _ in range(h)]+['#'*(w+2)]
for x in a:
  print(x)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=['#'(w+2)]+['#'+input()+'#' for _ in range(h)]+['#'*(w+2)]
for x in a:
  print(x)
Problem p03713 (python)

Fixed submission:
H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:
    print(0)
else:
    ans = min(H, W)
    for h in range(1, H):
        y = (H - h) * W
        x = h * (W // 2)
        z = h * W - x
        ans = min(ans, max(x, y, z) - min(x, y, z))
    t = H
    H = W
    W = t
    for h in range(1, H):
        y = (H - h) * W
        x = h * (W // 2)
        z = h * W - x
        ans = min(ans, max(x, y, z) - min(x, y, z))
    print(ans)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:
    print(0)
elif H % 2 and W % 2:
    ans = float("inf")
    for h in range(1, H):
        y = (H - h) * W
        x = h * (W // 2)
        z = h * W - x
        ans = min(ans, max(a, b, c) - min(a, b, c))
    print(ans)
else:
    if W % 2:
        t = H
        H = W
        W = t
    ans = float("inf")
    for h in range(1, H):
        x = h * W // 2
        y = W * (H - h)
        ans = min(ans, abs(y - x))
    print(ans)
Problem p03720 (python)

Fixed submission:
n, m = map(int, input().split())
es = [[] for _ in range(n)]
for _ in range(m):
  s, t = map(int, input().split())
  es[s-1].append(t-1)
  es[t-1].append(s-1)
for i in range(n):
  print(len(es[i]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
es = [[] for _ in range(n)]
for _ in range(m):
  s, t = map(int, input().split())
  es[s].append(t)
  es[t].append(s)
for i in range(n):
  print(len(list(set(es[i]))))
Problem p03721 (python)

Fixed submission:
from collections import defaultdict
n, k = map(int, input().split())
dic = defaultdict(int)
for _ in range(n):
  a, b = map(int, input().split())
  dic[a] += b
cnt = 0
for key in sorted(dic):
  if cnt + dic[key] < k:
    cnt += dic[key]
  else:
    print(key)
    break

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n, k = map(int, input().split())
dic = defaultdict(int)
for _ in range(n):
  a, b = map(int, input().split())
  dic[a] += b
dic = sorted(dic, key = lambda x: x[0])
cnt = 0
for key in dic:
  if cnt + dic[key] < k:
    cnt += dic[key]
  else:
    print(key)
    break
Problem p03738 (python)

Fixed submission:
a=input()
b=input()
if len(a)>len(b):
  print("GREATER")
elif len(a)<len(b):
  print("LESS")
else:
  i=0
  f=0
  while len(a)>i:
    if int(a[i])>int(b[i]):
      f=1
      break
    elif int(a[i])<int(b[i]):
      f=2
      break
    i+=1
  if f==0:
    print("EQUAL")
  elif f==1:
    print("GREATER")
  else:
    print("LESS")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if len(a)>len(b):
  print("GREATER")
elif len(a)<len(b):
  print("LESS")
else:
  i=0
  while 1:
    if int(a[i])>int(b[i]):
      f=1
      break
    elif int(a[i])<int(b[i]):
      f=2
      break
    i+=1
  if f==1:
    print("GREATER")
  else:
    print("LESS")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if len(a)>len(b):
  print("GREATER")
elif len(a)<len(b):
  print("LESS")
else:
  i=0
  while 1:
    if int(a[i])>int(b[i]):
      f=1
    elif int(a[i]<int(b[i]):
      f=2
    i+=1
  if f==1:
    print("GREATER")
  else:
    print("LESS")
Problem p03760 (python)

Fixed submission:
o=input()
e=input()
j,k,res=0,0,""
for i in range(len(o)+len(e)):
  if i %2:
    res+=e[k]
    k+=1
  else:
    res+=o[j]
    j+=1
print(res)

Buggy submission (verdict: Runtime Error):
o=input()
e=input()
j,k=0,0
for i in range(len(o)+len(e)):
  if i %2:
    res+=e[k]
    k+=1
  else:
    res+=o[j]
    j+=1
print(res)
Problem p03845 (python)

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p,x=[],[]
for _ in range(m):
  _p,_x=map(int,input().split())
  p.append(_p-1)
  x.append(_x)
s=sum(t)
for i in range(m):
  print(s-t[p[i]]+x[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p,x=[],[]
for _ in range(m):
  _p,_x=map(int,input().split())
  p.append(_p)
  x.append(_x)
s=sum(t)
for i in range(m):
  print(s-t[p[i]-1]+x[p[i]-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p,x=[],[]
for _ in range(m):
  _p,_x=map(int,input().split())
  p.append(_p)
  x.append(_x)
s=sum(t)
for i in range(m):
  print(s-t[p[i]]+x[p[i]])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p,x=[],[]
for _ in range(m):
  _p,_x=map(int,input().split())
  p.append(_p)
  x.append(_x)
s=sum(t)
ans=s
for i in range(m):
  ans=min(ans,s-t[p[i]]+x[p[i]])
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p,x=[],[]
for _ in range(m):
  _p,_x=map(int,input().split())
  p.append(_p)
  x.append(_x)
s=sum(t)
ans=s
for i in range(m):
  ans=min(ans,s-t[p[i]]+x[p[i]])
print(ans)
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
x_l, x_r, y_b, y_u = 0, W, 0, H
for _ in range(N):
  x, y, a = map(int, input().split())
  if a == 1:
    x_l = max(x_l, x)
  elif a == 2:
    x_r = min(x_r, x)
  elif a == 3:
    y_b = max(y_b, y)
  else:
    y_u = min(y_u, y)
print(max(x_r - x_l, 0) * max(y_u - y_b, 0))

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
x_b, x_u, y_l, y_r = 0, H, 0, W
for _ in range(N):
  x, y, a = map(int, input().split())
  if a == 1:
    x_l = max(x_l, x)
  elif a == 2:
    x_r = min(x_r, x)
  elif a == 3:
    y_b = max(y_b, y)
  else:
    y_u = min(y_u, y)
print((x_r - x_l) * (y_u - y_b))
Problem p03998 (python)

Fixed submission:
A = list(input())
B = list(input())
C = list(input())
next = A.pop(0)
while 1:
  if next == 'a':
    if len(A) == 0:
      print("A")
      break
    next = A.pop(0)
  elif next == 'b':
    if len(B) == 0:
      print("B")
      break
    next = B.pop(0)
  else:
    if len(C) == 0:
      print("C")
      break
    next = C.pop(0)

Buggy submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())
next = A.pop(0)
while 1:
  if next == 'a':
    next = A.pop(0)
  elif next == 'b':
    next = B.pop(0)
  else:
    next = C.pop(0)
  if len(A) == 0:
    print("A")
    break
  elif len(B) == 0:
    print("B")
    break
  elif len(C) == 0:
    print("C")
    break
Problem p04000 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import defaultdict
H, W, N = map(int, input().split())
cnt = defaultdict(lambda : 0)
for i in range(N):
    a, b = map(lambda x: int(x)-1, input().split())
    for y in range(a-2, a+1):
        for x in range(b-2, b+1):
            if 0 <= y < H-2 and 0 <= x < W-2:
                cnt[(y, x)] += 1
ans = [0] * 10
for key in cnt:
    ans[cnt[key]] += 1
ans[0] += ans[0] + (H-2) * (W-2) - len(cnt)
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]
from collections import defaultdict
H, W, N = map(int, input().split())
square = set()
dot = defaultdict(lambda : 0)
for i in range(N):
    a, b = map(lambda x: int(x)-1, input().split())
    dot[[a, b]] = 1
    for y in range(a-2, a+1):
        for x in range(b-2, b+1):
            if 0 <= y < H-2 and 0 <= x < W-2:
                square.add([y, x])
ans = [0] * 10
for y, x in square:
    c = 0
    for i in range(y, y+3):
        for j in range(x, x+3):
            c += dot[[i, j]]
    ans[c] += 1
ans[0] += ans[0] + (H-2) * (W-2) - len(square)
for i in ans:
    print(i)
Problem p04019 (python)

Fixed submission:
S = set(input())
n = 'N' in S
s = 'S' in S
e = 'E' in S
w = 'W' in S
if n^s or e^w:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
S = set(input())
n = 'N' in S
s = 'S' in S
e = 'E' in S
w = 'W' in S
if n^s or e^w:
    print('No')
else:
    print('Yes')

n = int(input())
l = list(map(int, input().split()))
l.sort()
print(sum([l[i] for i in range(2*n) if i%2==0]))
Problem p02606 (python)

Fixed submission:
L, R, d = map(int, input().split())
count_1 = (R - L) // d 
count_2 = 0
if L % d == 0 or R % d == 0:
    count_2 += 1
ans = count_1 + count_2
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
for i in range(1, N+1):
    count = 0
    for j in range(1, int(np.sqrt(i))+2):
        for k in range(j, int(np.sqrt(i))+2):
            for l in range(k, int(np.sqrt(i))+2):
                n = j*j + k*k + l*l + j*k + k*l + l*j
                #print(i, j, k, l)
                if n == i:
                    if j == k == l:
                        count += 1
                    elif j==k or k==l or l==j:
                        count += 3
                    else:
                        count += 6
    print(count)
Problem p02705 (python)

Fixed submission:
import numpy as np

R = int(input())
print(2 * R * np.pi)

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

Fixed submission:
from math import gcd

def gcd_3(a, b, c):
    g = gcd(a, b)
    return gcd(g, c)

K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd_3(i, j, k)

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

def gcd(a, b, c):
    g = gcd(a, b)
    return gcd(g, c)

K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(i, j, k)

print(ans)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
r = N % K
print(min(r, K-r))

Buggy submission (verdict: Runtime Error):
def abs(n, k):
    if n - k >= 0:
        return n-k
    else:
        return k-n
        
N, K = map(int, input().split())
while N > abs(N-K):
    N, K = abs(N-K), K
print(N)
Problem p02789 (python)

Fixed submission:
N, M = map(int, input().split())
if N == M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
P_list = list(map(int, input().split()))
count_i = 1
for i in range(1, N):
    if P_list[i] <= min(P_list[:i+1]):
        count_i += 1
print(count_i)

Buggy submission (verdict: Runtime Error):
N = int(input())
P_list = list(map(int, input().split()))
count_i = 0
for i in range(N):
    if P_list[i] <= min(P_list[:i+1]):
        count_i += 1
print(count_i)
Problem p02677 (python)

Fixed submission:
import math
s = input()
a,b,h,m = s.split(' ')
a = int(a)
b = (int)(b)
h = int(h)
m = int(m)
t1 = h/6 * math.pi + math.pi/6*m/60
t2 = m/30 * math.pi
dellt = abs(t2 - t1)
ans = b*b + a*a - 2*a*b*math.cos(dellt)
print(ans**0.5)

Buggy submission (verdict: Runtime Error):
import math
a = (int)(input())
b = int(input())
h = int(input())
m = int(input())
t1 = h/6 * math.pi
t2 = m/30 * math.pi
dellt = abs(t2 - t1)
ans = b*b + a*a - 2*a*b*math.cos(dellt)
print(ans**0.5)

Buggy submission (verdict: Runtime Error):
import math
a = float(input())
b = float(input())
h = float(input())
m = float(input())
t1 = h/12 * math.PI
t2 = m/60 * math.PI
dellt = abs(t2 - t1)
ans = b*b + a*a - 2*a*b*math.cos(dellt)
print(ans**0.5)
Problem p02639 (python)

Fixed submission:
# coding: utf-8
X = list(map(int, input().split()))
for i in range(5):
    if X[i] == 0:
        ans = i + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import streams, sequtils, strutils, algorithm, math, future, sets, tables, hashes
proc `ceilDiv`*[T](x, y: T): T = x div y + ord(x mod y != 0)
proc `//=`*(x: var SomeInteger; y: SomeInteger) = x = x div y
proc `%=`*(x: var SomeInteger; y: SomeInteger) = x = x mod y
var
    X = stdin.readLine.split.map(parseInt)
    ans:int
for i in 0..4:
    if X[i] == 0:
        ans = i.int + 1
echo ans
Problem p02642 (python)

Fixed submission:
# coding: utf-8
N = int(input())
li = [True for _ in range(0, 10**6 + 1)]
A = list(map(int, input().split()))
A.sort()
used = {}
for i in range(N):
    if A[i] not in used.keys():
        used[A[i]] = 1
    else:
        used[A[i]] += 1
ans = 0
for k in used.keys():
    if used[k] > 1:
        for j in range(k, 10**6 + 1, k):
            li[j] = False
for i in range(N):
    if li[A[i]] and used[A[i]] == 1:
        ans += 1
    else:
        continue
    for j in range(A[i], 10**6 + 1, A[i]):
        li[j] = False
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
li = [True for _ in range(0, 2*10**5 + 1)]
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(N):
    if li[A[i]]:
        ans += 1
    for j in range(A[i], 2*10**5 + 1, A[i]):
        li[j] = False
ans -= len(A) - len(set(A))
print(max(0, ans))
Problem p02675 (python)

Fixed submission:
# coding: utf-8
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 streams, sequtils, strutils, algorithm, math, future, sets, tables, hashes
proc `ceilDiv`*[T](x, y: T): T = x div y + ord(x mod y != 0)
proc `//=`*(x: var SomeInteger; y: SomeInteger) = x = x div y
proc `%=`*(x: var SomeInteger; y: SomeInteger) = x = x mod y


var
    N = stdin.readLine
    s = parseInt($N[^1])
if s in [2,3,4,7,9]:
    echo "hon"
elif s in [0,1,6,8]:
    echo "pon"
else:
    echo "bon"
Problem p02678 (python)

Fixed submission:
#coding: utf-8
from collections import deque
N, M = map(int, input().split())
dd = {i:[] for i in range(N)}
for i in range(M):
    a, b = map(int, input().split())
    dd[a-1].append(b-1)
    dd[b-1].append(a-1)
ans = [0 for _ in range(N)]
visited = [False for _ in range(N)]
queue = []
for i in range(len(dd[0])):
    queue.append([0, dd[0][i]])
queue = deque(queue)
while queue:
    q = queue.popleft()
    if visited[q[1]]:
        continue
    visited[q[1]] = True
    ans[q[1]] = q[0] + 1
    for v in dd[q[1]]:
        if not visited[v]:
            queue.append([q[1], v])
print("Yes")
print(*ans[1:], sep="\n")

Buggy submission (verdict: Runtime Error):
#coding: utf-8
from collections import deque
N, M = map(int, input().split())
dd = {i:[] for i in range(N)}
for i in range(N):
    d[i][i] = 0
for i in range(M):
    a, b = map(int, input().split())
    dd[a-1].append(b-1)
    dd[b-1].append(a-1)
ans = [0 for _ in range(N)]
visited = [False for _ in range(N)]
queue = []
for i in range(len(dd[0])):
    queue.append([0, dd[0][i]])
queue = deque(queue)
while queue:
    q = queue.popleft()
    if visited[q[1]]:
        continue
    visited[q[1]] = True
    ans[q[1]] = q[0] + 1
    for v in dd[q[1]]:
        if not visited[v]:
            queue.append([q[1], v])
print("Yes")
print(*ans[1:], sep="\n")
Problem p02742 (python)

Fixed submission:
# coding: utf-8
from math import ceil
H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
else:
    ans = 0
    ans += ceil(W / 2) * ceil(H / 2)
    ans += (W // 2) * (H // 2)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sequtils
from strutils import split, parseInt
from math import ceil

let
  HW = map(readLine(stdin).split(), parseInt)

if HW[0] == 1 or HW[1] == 1:
  echo 1
else:
  echo int(ceil(HW[0] * HW[1] / 2))
Problem p02761 (python)

Fixed submission:
# coding: utf-8
N, M = map(int, input().split())
d = {}
ans = ["0" for _ in range(N)]
for i in range(M):
    s, c = map(int, input().split())
    if str(s) not in d.keys():
        d[str(s)] = c
        ans[s-1] = str(c)
    else:
        if d[str(s)] != c:
            print(-1)
            exit()
if N == 1:
    print("".join(ans))
    exit()
if "1" not in d.keys():
    ans[0] = "1"
ans = "".join(ans)
if ans[0] == "0" and N != 1:
    print(-1)
else:
    print(int(ans))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N, M = map(int, input().split())
d = {}
ans = ["0" for _ in range(N)]
for i in range(M):
    s, c = map(int, input().split())
    if s not in d.keys():
        d[s-1] = c
        ans[s-1] = str(c)
    else:
        if d[s-1] != c:
            ans = -1
            print(ans)
            exit()
if ans[0] == "0" and 0 not in d.keys():
    ans[0] = "1"
ans = "".join(ans)
if len(str(int(ans))) != N:
    ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N, M = map(int, input().split())
d = {}
ans = ["0" for _ in range(N)]
for i in range(M):
    s, c = map(int, input().split())
    if s not in d.keys():
        d[s] = c
        ans[s-1] = str(c)
    else:
        if d[s] != c:
            ans = -1
            print(ans)
            exit()
ans = "".join(ans)
if ans[0] == "0" and 1 not in d.keys():
    ans[0] = "1"
if len(str(int(ans))) != N:
    ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N, M = map(int, input().split())
d = {}
ans = ["0" for _ in range(N)]
for i in range(M):
    s, c = map(int, input().split())
    if s not in d.keys():
        d[s] = c
        ans[s-1] = str(c)
    else:
        if d[s] != c:
            ans = -1
            print(ans)
            exit()
ans = "".join(ans)
if ans[0] == "0" and 0 not in d.keys():
    ans[0] = "1"
print(ans)
Problem p02768 (python)

Fixed submission:
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    for i in range(1, r + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
    # return ue * modpow(sita, mod-2, mod)
    return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    # a, b, c = 1, 1, 1
    for i in range(1, n + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
        a = a * i % mod
    for i in range(1, r + 1):
        b = b * i % mod
        c = c * (n - i + 1) % mod
    return a * pow((b * c) % mod, mod-2, mod) % mod
    # return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)
Problem p02843 (python)

Fixed submission:
from math import ceil
N = int(input())
if N < 100:
    print(0)
    exit()
t, s = str(N)[:-2], str(N)[-2:]
if int(t) >= ceil(int(s)/5):
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from math import ceil
N = int(input())
t, s = str(N)[:-2], str(N)[-2:]
# print(t, s)
if int(t) >= ceil(int(s)/5):
    print(1)
else:
    print(0)
Problem p02865 (python)

Fixed submission:
# coding: utf-8
N = int(input())
if N % 2 == 0:
    print(N // 2 - 1)
else:
    print(N // 2)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
D = list(map(int, input().split()))
l = [0] * N
top = max(D)
mod = 998244353

for i in range(N):
    l[D[i]] += 1
# print(*l)
ans = 1
for i in range(1, top+1):
    if l[i] != 0:
        ans *= l[i-1] ** l[i]
    if l[i] == 0:
        print(0)
        exit()
    ans = ans % mod
if D[0] != 0:
    ans = 0
if l[0] != 1:
    ans = 0
    

print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
D = list(map(int, input().split()))
l = [0] * (N-1)
top = max(D)
mod = 998244353

for i in range(N):
    l[D[i]] += 1
# print(*l)
ans = 1
for i in range(1, top+1):
    if l[i] != 0:
        ans *= l[i-1] ** l[i]
    if l[i] == 0:
        print(0)
        exit()
    ans = ans % mod
if D[0] != 0:
    ans = 0
if l[0] != 1:
    ans = 0
    

print(ans)
Problem p02866 (python)

Fixed submission:
# coding: utf-8
import collections

n=int(input())
d=list(map(int,input().split()))
c = collections.Counter(d)
ans = 1
m=max(d)


for i in range(m):
    ans*=c[i]**c[i+1]
    ans = ans%998244353

if c[0]!=1:
    ans=0
if d[0] != 0:
    ans = 0

# print(c)
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
D = list(map(int, input().split()))
l = [0] * (N-1)
top = max(D)
mod = 998244353

for i in range(N):
    l[D[i]] += 1
# print(*l)
ans = 1
for i in range(1, top+1):
    if l[i] != 0:
        ans *= l[i-1] ** l[i]
    if l[i] == 0:
        print(0)
        exit()
    ans = ans % mod
if D[0] != 0:
    ans = 0
if l[0] != 1:
    ans = 0
    

print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
D = list(map(int, input().split()))
l = [0] * (N-1)
top = max(D)
mod = 998244353

for i in range(N):
    l[D[i]] += 1
# print(*l)
ans = 1
for i in range(1, top+1):
    if l[i] != 0:
        ans *= l[i-1] ** l[i]
    if l[i] == 0:
        print(0)
        exit()
if D[0] != 0:
    ans = 0
if l[0] != 1:
    ans = 0
    

print(ans % mod)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import collections

n=int(input())
d=list(map(int,input().split()))
c = collections.Counter(d)
ans = 1
m=max(d)


for i in range(m):
    ans*=c[i]**c[i+1]
    ans = ans%998244353

if c[0]!=1:
    ans=0
if D[0] != 0:
    ans = 0

# print(c)
print(ans)
Problem p02882 (python)

Fixed submission:
# coding: utf-8
import math
a, b, x = map(int, input().split())
if x >= a**2*b/2:
    ans = 90 - math.degrees(math.atan2(a**3, (2*a**2*b-2*x)))
else:
    # ans = 90 - math.degrees(math.atan2(2*x, (a**2*b-2*x)))
    # ans = 90 - math.degrees(math.asin((2*x*a) / (b*math.sqrt(4*x**2 + a**2*b**4))))
    ans = 90 - math.degrees(math.asin(2*x/math.sqrt(a**2*b**4 + 4*x**2)))
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
a, b, x = map(int, input().split())
print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
Problem p02887 (python)

Fixed submission:
# coding: utf-8
N = int(input())
S = input()
ans = 1
for i in range(1, N):
    if S[i-1] != S[i]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
#coding: utf-8
N = int(input())
S = input()
ans = 1
for i in range(1, N-1):
    if S[i-1] != S[i]:
        ans += 1
if S[-2] != S[-1]:
    ans += 1
print(ans)
Problem p02924 (python)

Fixed submission:
# coding: utf-8
N = int(input())
ans = N*(N-1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
ans = sum(list(range(N)))
print(ans)