Problem:


Score : 100 points

Problem Statement

How many ways are there to choose two distinct positive integers totaling N, disregarding the order?

Constraints

1 \leq N \leq 10^6

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.

Sample Input 1

4

Sample Output 1

1

There is only one way to choose two distinct integers totaling 4: to choose 1 and 3. (Choosing 3 and 1 is not considered different from this.)

Sample Input 2

999999

Sample Output 2

499999



Sample input:
4


Sample output:
1

Submission status: Runtime Error

Solution code:
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans%998244353)

Submission status: Runtime Error

Solution code:
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
k = max(A)

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x % 998244353
        x *= x % 998244353
        n //= 2

    return K * x % 998244353


R = [0] * (k + 1)
result = 1
for i in A:
    R[i] += 1

if A[0] != 0 or R[0] != 1:
    print(0)
    exit()

for j in range(k + 1):
    result *= pow_k(R[j], R[j + 1])

    if result == 0:
        print(0)
        exit()

print(result % 998244353)

Submission status: Runtime Error

Solution code:
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
error=0
if num[0]!=1:
    error=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    ans = ans * pow(num[i-1], num[i], 998244353)
    #ans*=num[i-1]**num[i]
    if num[i]==0:
        error=1
if error==0:
    print(ans)
else:
    print(0)

Submission status: Runtime Error

Solution code:
from collections import Counter
import sys
MOD = 998244353

N = int(input())
D = list(map(int, input().split()))

c = Counter(D)
if c[0] != 1 or D[0] != 0:
    print(0)
    exit(0)
d = max(c)
ans = 1
for i in range(d):
    ans *= pow(c[i], c[i+1], MOD)
    ans = ans % MOD

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
D = list(map(int, input().split()))
D = np.array(D)
D = np.sort(D)

if D[0] != 0:
    print(0)
elif sum(D == 0) != 1:
    print(0)
elif sum(np.diff(np.array(list(set(D)))) != 1):
    print(0)
else:
    print(np.prod(D[1:]) % 998244353)

Submission status: Runtime Error

Solution code:
def solve():
    n = int(input())
    d = list(map(int, input().split()))

    print(calc(d, n))


def calc(d, n):
    if d[0] != 0:
        return 0
    else:
        k = max(d)
        a = [0] * (k + 1)
        for i in range(1, n):
            a[d[i]] += 1
        if a[0] > 0:
            return 0
        else:
            r = 1
            for i in range(2, k + 1):
                r *= a[i - 1] ** a[i]
            return r % 998244353


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
# 指定された距離で何個の木を作成することができるかを計算する
import bisect
import itertools
N = int(input())
D = list(map(int, input().split()))
node_dis = [1] # 距離iのノードの個数をi番目の要素として格納したリスト
flag_none = False

# 頂点１から深さは決まっている.深さni毎に前のni-1のノードから重複を許してc_ni個選んでノードに繋げばよい
if not D[0] == 0:
    print(0)
    flag_none = True

else:
    D.sort()  # 昇順でソート
    for i in range(1,N):
        if i == 1 and bisect.bisect_left(D,1) >= 2:  # 0が２つ以上ある場合
            print(0)
            flag_none = True
            break
        else:
            if i ==1:
                del D[0]
            index = bisect.bisect_left(D,i+1)
            new_num = index 
            node_dis.append(new_num)
            del D[:index]
            if index==0: 
                if not D == []:
                    print(0)
                    flag_none = True
                break
if flag_none == False:
    sum = 1
    for (ind, di) in enumerate(node_dis): 
        if ind > 0:
            sum *= node_dis[ind-1] ** di
    print(sum)

Submission status: Runtime Error

Solution code:
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
from time import* 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline
input=sys.stdin.readline
t=time()

def main():
    n,m=map(int,input().split())
    x=[tuple(map(int,input().split()))for i in range(m)]
    y=sorted(x)
    start=set()
    for s,t,r in y:
        if s==1:
            start.add((1,t,r))
    ans=set([-1])
    substart=set()
    while 1:
        while start:
            qp,p,q=start.pop()
            for s,t,r in y:
                if t==n:
                    ans.add(q)
                elif s<=p and p<=t and s!=qp:
                    substart.add((p,t,q+r))
                    
        start=substart
        if time()-t>6:
            if len(ans)!=1:
                print(min(i for i in ans if i!=-1))
            else:
                print(-1)
            exit()
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n=int(input())
listx=list(map(int,input().split()))
listx.sort()
x=1
for i in range(listx[-1]):
  x*=listx.count(int(i+1))+1
if listx[0]!=0:
  x=0
print(x)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
from collections import Counter
from functools import reduce
from operator import mul
M = 998244353
N = int(input())
D = list(map(int, input().split()))
counter = set(D)
if D[0] == 0:
    D[0] = 1
    ans = reduce(mul, D)
    for i, k in enumerate(sorted(counter)):
        if i == k:
            continue
        ans = 0
    print(ans % M)
else:
    print(0)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
a = n/2
print(math,ceil(a)-1)

Submission status: Runtime Error

Solution code:
from collections import Counter
import numpy as np


N = int(input())
D = list(map(int, input().split()))
D = np.array(D)
D = np.sort(D)


if D[0] != 0:
    print(0)
elif sum(D == 0) != 1:
    print(0)
else:
    D_counter = Counter(D)
    count = 1
    next = 1
    for i in range(1, max(D)+1):
        if i != next:
            print(0)
            break
        i = int(i)
        count = count * i**list(D_counter.values())[i]
        next += 1

print(count % 998244353)

Submission status: Runtime Error

Solution code:
from operator import itemgetter
import bisect as bi
import numpy as np
import sys
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a = np.array(a)
b = np.array(b)
b.sort()
ab = np.dstack([a,b])
ab = [flatten for inner in ab for flatten in inner]
ab.sort(key=itemgetter(1))

tmplist = []
#tmp = 0
cnt = 0

for i in range(n):
    if ab[i][0] > ab[i][1]:
        index = bi.bisect_left(b,ab[i][0])
        if index == n:
            print('No')
            sys.exit()
        #tmp = ab[index][0]
        for j in range(index,n):
            tmp = ab[j][0]
            if tmp >= ab[i][1]:
                ab[j][0], ab[i][0] = ab[i][0], ab[j][0]
                break
            elif j == n-1:
                print('No')
                sys.exit()
            #ab[index][0] , ab[i][0] = ab[i][0] , ab[index][0]
        cnt += 1
        if cnt > 2*n:
            print('No')
            sys.exit()
print('Yes')

Submission status: Runtime Error

Solution code:
n = int(input())
d = list(map(int, input().split()))

sum = 1
if d[0] == 0 and d.count(0)==1:
  for i in range(1, n):
    if int(d[i]) >2:
      sum *= int(d[i]) 
  print(sum)
else:
  print("0")

Submission status: Runtime Error

Solution code:
def selectionsort(a,n):
  counter = 0
  for i in range(n-1):
    idx = None
    mi = a[i]
    flag = False
    for x in reversed(range(i,n)):
      if mi > a[x]:
        idx = x
        mi = a[x]
        counter+=1
        flag = True
    if flag:
      a[i],a[idx] = a[idx],a[i]
    if counter > n - 2:
      return a, True
  return a, counter
 
len = int(input())
a = sorted([int(i) for i in input().split(" ")])
b = [int(i) for i in input().split(" ")]
b, counter = selectionsort(b,len)

Flag = True

if counter:
  print("No")


else:
  for i in range(len):
    if a[i] > b[i]:
      print("No")
      Flag = False
      break
      

  if Flag:
    print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int, input().split()))

div_num = 998244353
result = 1
ct_l = []

for i in range(n):
    ct_l.append(0)

for item in l:
    ct_l[item] += 1

#print(ct_l)
prev_v = -1
curr_v = -1
e = n-1

for i, item in enumerate(ct_l):
    if i == 2:
        break
    if i == 0 and item == 1:
        pass
    else:
        e -= item
    if i == 1:
        prev_v = item

for i, item in enumerate(ct_l[2:]):
    #print(prev_v, item, e, result)
    e -= item
    if item == 0:
        break
    curr_v = item
    result *= prev_v**curr_v
    prev_v = curr_v
    #print(prev_v, curr_v, result)

if e < 0:
    print(0)
else:
    print(result%div_num)

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
A = [int(a) for a in input().split()]

if A[0] != 0:
    print(0)
    exit()
if A.count(0) != 1:
    print(0)
    exit()

k = max(A)

R = [1]
result = 1


for i in range(k):
    R.append(A.count(i + 1))

for j in range(k):
    if R[j + 1] % 2 == 0:
        result *= (R[j] ** 2) ** (R[j + 1] // 2)
    else:
        result *= R[j] * (R[j] ** 2) ** (R[j + 1] // 2)
    result %= 998244353

    if result == 0:
        print(0)
        exit()

print(result)

Submission status: Runtime Error

Solution code:
N=int(input())
if n%2==0:
  print((n/2)-1)
else:
  print((n-1)/2)

Submission status: Runtime Error

Solution code:
n = INT()
if n%2 == 0:
    print((n-2)//2)
else:
    print((n-1)//2)

Submission status: Runtime Error

Solution code:
import sys
readline = sys.stdin.readline        

from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
class PMS:
    #1-indexed
    def __init__(self, A, B, issum = False):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        self.X, self.comp = self.compress(B)
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        if issum:
            self.sumtree = [0] * (self.size + 1)
            Ssum = [0] + list(accumulate([CA[self.X[i]]*self.X[i] for i in range(self.size)]))
            for i in range(1, 1+self.size):
                self.sumtree[i] = Ssum[i] - Ssum[i - (i&-i)]
    
    def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
    def leng(self):
        #今入っている個数を取得
        return self.count(self.X[-1])
    
    def count(self, v):
        #v(Bの元)以下の個数を取得
        i = self.comp[v]
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, v, x):
        #vをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[v]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def get(self, i):
        # i番目の値を取得
        if i <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < i:
                s += k
                i -= self.tree[s]
            k //= 2
        return self.X[s]
    
    def gets(self, v):
        #累積和がv以下となる最大のindexを返す
        v1 = v
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.sumtree[s+k] < v:
                s += k
                v -= self.sumtree[s]
            k //= 2
        if s == self.size:
            return self.leng()
        return self.count(self.X[s]) + (v1 - self.countsum(self.X[s]))//self.X[s]
    
    def addsum(self, i, x):
        #sumを扱いたいときにaddの代わりに使う
        self.add(i, x)
        x *= i
        i = self.comp[i]
        while i <= self.size:
            self.sumtree[i] += x
            i += i & -i
    
    def countsum(self, v):
        #v(Bの元)以下のsumを取得
        i = self.comp[v]
        s = 0
        while i > 0:
            s += self.sumtree[i]
            i -= i & -i
        return s
    
    def getsum(self, i):
        #i番目までのsumを取得
        x = self.get(i)
        return self.countsum(x) - x*(self.count(x) - i)


N, K = map(int, readline().split())
C = list(range(K+2*N, K+3*N))
A = list(range(K, K+N))
B = list(range(K+N, K+2*N))
Ans = []
ans = 1

BB = PMS(B, B)
if sum(A) + sum(B) > sum(C):
    ans = -1
else:
    Ao = [A[i] for i in range(N) if A[i]%2]
    Ae = [A[i] for i in range(N) if not A[i]%2]
    if len(Ao) < len(Ae):
        AA = Ae + Ao
    else:
        AA = Ao + Ae
    
    for a, c in zip(AA, C):
        bx = c - a
        k = BB.leq(bx)
        if k == 0:
            ans = -1
            break
        b = BB.get(k)
        Ans.append((a, b, c))
        BB.add(b, -1)

if ans != -1:
    print('\n'.join('{} {} {}'.format(*an) for an in Ans))
else:
    print(ans)

Submission status: Runtime Error

Solution code:
import sys

N=int(input())

a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=[[a[i],i] for i in range(N)]
b=[[b[i],i] for i in range(N)]
aa,bb=sorted(a),sorted(b)

for i in range(N):
    if aa[i][0]>bb[i][0]: print("No"),sys.exit()

for i in range(N-1):
    if aa[i][0]==aa[i+1][0] or bb[i][0]==bb[i+1][0]: print("Yes"),sys.exit()
    if bb[i][0]>=aa[i+1][0]: print("Yes"),sys.exit()


dicb={}
for i in range(N):
    dicb[bb[i][0]]=i
tmp=0
j=0
while tmp<N-2:
    j=dicb[b[j][0]]
    if j==0: print("Yes"),sys.exit()
    tmp+=1
print("No")

Submission status: Runtime Error

Solution code:
import collections

n = int(input())
d = list(map(int, input().split()))
e = collections.Counter(d)

if d[0] != 0:
    print(0)
    exit()

cntsum = 1
judge_cnt = 0

if e[1] == 0:
    print(0)
    exit()

m = max(e)
e2 = dict(sorted(e.items()))
e3 = list(e2.values())
e4 = list(e2.keys())
#print(e2)
#print(e3)
#print(e4)

tmp=0
for i in e4:
    if i-tmp>=2:
        print(0)
        exit()
    tmp=i
    
cntsum = 1
for i in range(1, len(e3)):
    cntsum *= e3[i - 1] ** e3[i]
print(cntsum)

Submission status: Runtime Error

Solution code:
n = int(input())
d = list(map(int,input().split()))
db = [0] * n
MOD = 998244353

#距離iの頂点の数をdb[i]に保存
for i in range(n):
    db[d[i]] += 1

#末尾に連続する0を削除
if (db[n-1] == 0):
    l = n-1
    for i in range(1,n):
        tmp = db[n-i]
        if (tmp == 0) : l = n-i 
        else : break
    
    del db[l:n]


if (d[0] != 0)|(db[0] != 1):
    print(0)
    exit()
if (len(db) <= 2):
    print(len(db)-1)
    exit()

db.append(1)
ans = 1

for i in range(len(db)-1):
    tmp = (db[i]**db[i+1]) % MOD
    ans *= tmp

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2=0:
  print((n/2)-1)
else:
  print((n-1)/2)

Submission status: Runtime Error

Solution code:
N = int(input())
a = []
 
for x in range(1, N):
    y = N-x
    if x == y:
        continue
    a.append([x, y])
 
print(len(a))
N = int(input())
a = []

for x in range(1, N):
    y = N-x
    if x == y:
        continue
    if x > y:
        break
    a.append([x, y])

print(len(a))
提出情報

Submission status: Runtime Error

Solution code:
N = input()
a = []

for x in range(1, N):
    y = N-x
    if x == y:
        continue
    a.append([x, y])

print(len(a))

Submission status: Runtime Error

Solution code:
num1 = input()
num2 = input()
sum = int(num1) + int(num2)
print(sum)

Submission status: Runtime Error

Solution code:
import numpy as np
import collections

N = int(input())
D_seq = input().split()
D_seq = list(map(int, D_seq))

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

c = collections.Counter(D_seq)

N_list = []
if((judge_set == D_seq_set)or(D_seq[0]==0)):
    counts = 1
    for i in range(D_seq_max):
        counts *= pow(c[i], c[i+1])
    if(counts < 998244353):    
        print(counts)
    else:
        print(int(counts%998244353))
        
else:
    print(0)

Submission status: Runtime Error

Solution code:
from collections import defaultdict

N = int(input())
D = list(map(int,input().split()))

if D[0] != 0:
    print(0)
else:
    count = defaultdict(int)
    for d in D:
        count[d] += 1
    if count[0] != 1:
        print(0)
    else:
        maxcount = max(count)
        S = 1
        for i in range(1, maxcount+1):
            S *= count[i-1]**count[i]
        M = int(S % 998244353)
        print(M)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_mat = np.array(A)
B_mat = np.array(B)
C_mat = B_mat - A_mat
C = C_mat.tolist()
x = 10 ** 10
num = 0
for i in range(len(C)):
    if 0 <= C[i] < x:
        x = C[i]
        num = i
if x == 10 ** 10:
    print('No')
else:
    A.pop(num)
    B.pop(num)

    A.sort()
    B.sort()

    A1_mat = np.array(A)
    B1_mat = np.array(B)

    C1_mat = B1_mat - A1_mat
    if np.all(C1_mat >= 0):
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
CONST_DIVSOR = 998244353
N = int(input())
Ds = list(map(int, input().strip().split()))
counter = [0]*N
for D in Ds:
    counter[D] += 1
total = 0
cnt = 0
prenumi = 0
for i in range(N):
    if i == 0:
        if counter[i] == 1:
            total = 1
            prenumi = 1
            cnt = 1
        else:
            break
    else:
        numi = counter[i]
        if numi != 0:
            case = 1
            for j in range(numi):
                case = (case * prenumi) % CONST_DIVSOR
            total = (total * case) % CONST_DIVSOR
            prenumi = numi
            cnt += numi
        else:
            total = 0
            break
    # print(i,total,prenumi,cnt)
    if cnt >= N:
        break

print(total % CONST_DIVSOR)

Submission status: Runtime Error

Solution code:
import sys


def solve():
    MOD = 998244353
    N, *d_l = map(int, open(0).read().split())
    ans = 1
    
    if d_l[0] != 0:
        print(0)
        sys.exit()
    
    d_max = max(d_l)
    count_l = [d_l.count(1)]
    for i in range(2, d_max+1):
        count_l.append(d_l.count(i))
        ans *= count_l[i-2] ** count_l[i-1]
    print(ans%MOD)


if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
import math
import collections

n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
  
#同じ長さの位置に何個頂点があるか
cnt = dict(collections.Counter(d))
#print(cnt)
try:
  if cnt[0]!=0:
    ans = 1
    for i in range(len(dict(cnt))-1):
      val_1 = cnt[i]
      val_2 = cnt[i+1]
      ans *= (val_1**val_2)%MOD

    print(ans%MOD)
except KeyError:
  print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
d=sorted(list(map(int, input().split())))
num=[]

for i in range(max(d)+1):
    count=d.count(i)
    num.append(count)
ans=1
if d[0]!=0:
    print(0)
else:
    for i in range(1, max(d)+1):
        ans*=num[i-1]**num[i]
    print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
D = list(map(int,input().split()))
from collections import Counter
print(0)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
d = list(map(int,input().split()))

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  ans = ans *  math.pow(d_count[i], d_count[i+1])
  ans = ans % 998244353

ans = ans % 998244353

print(int(ans))

Submission status: Runtime Error

Solution code:
N=int(input())
Ds=list(map(int,input().split()))

if min(Ds)!=0 or Ds.count(0)!=1:
    print(0)
else:
    Ans=[0]*(max(Ds)+1)
    Ans[0]=1
    for i in range(1, max(Ds)+1):
        Ans[i]=(Ans[i-1]*(Ds.count(i-1)**Ds.count(i)))

    print(Ans[max(Ds)])%998244353

Submission status: Runtime Error

Solution code:
N=int(input())
distances=list(map(int,input().split()))
maximum=max(distances)

if distances[0]!=0 or distances.count(0)>=2 or maximum>=N:
    print(0)
else:
    count_dist=list(distances.count(i) for i in range(maximum+1))
    if count_dist.count(0) >= 1:
        print(0)
    else:
        count=1
        for i in range(maximum):
            count = count*power_mod(count_dist[i],count_dist[i+1],998244353)%998244353
        print(count)

def power_mod(a, n, mod):
    a=a%mod
    if n==0:
        return 1
    elif n==1:
        return a
    elif n%2==0:
        return power_mod(a,n//2,mod)**2%mod
    else:
        return (power_mod(a,(n-1)//2,mod)**2%mod)*a%mod

Submission status: Runtime Error

Solution code:
N=int(input())
print(rount(N/2)-1)

Submission status: Runtime Error

Solution code:
N=int(input())/2
print(int(N)

Submission status: Runtime Error

Solution code:
a = input()
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

Submission status: Runtime Error

Solution code:
if a < 2:
        print 0
elif a % 2 == 0:
        print int(a / 2 - 1)
else:
        print int(a/2)

Submission status: Runtime Error

Solution code:
N=int(import())
if N==1:
  ans=0
elif N==2:
  ans=0
elif N%2==0:
  ans=(N/2)-1
else:
  ans=N//2  
print(ans)

Submission status: Runtime Error

Solution code:
mod = 998244353
N = int(input())
A = list(map(int,input().split()))
D = [1 for _ in range(max(A)+1)]
if N == 1:
    if A[0] == 0:
        print(1)
        exit()
    else:
        print(0)
        exit()

D[1] = A.count(1)
ans = 1
if A[0] > 0 or D[0] > 1:
    print(0)
else:
    for i in range(2,max(A)+1):
        D[i] = A.count(i)
        ans *= (D[i-1]**D[i])%mod
    print(ans)

Submission status: Runtime Error

Solution code:
N=int(import())
 
if N==1orN==2:
  ans=0
elif N%2==0:
  ans=(N/2)-1
else:
  ans=N//2
  
print(ans)

Submission status: Runtime Error

Solution code:
import math
N=int(import())
ams=0
 
if N==1orN==2:
  ans=0
elif N%2==0:
  ans=(N/2)-1
else:
  ans=N/2
  ans = math.floor(ans)
  
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    if (i in mapping) and (i+1 in mapping):
      ans *= mapping[i]**(mapping[i+1])
    else:
      ans = 0
      break
  print(ans % 998244353)

Submission status: Runtime Error

Solution code:
ans=0
N=int(input())
c=round(N/2)
for i in range(1,c):
    for j in range(c,i,-1):
        cnt=i+j
        if cnt=N:
            ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
num = int(input())
numList = list(range(0, num))
listLength = len(numList)
counter = 0

#print(numList)

m = [0] * 1000000

for i in range(0, listLength):
    m[numList[i]]
    m[numList[i]] += 1

secondCount = 0

for i in range(0, listLength):
    secondCount += m[num - numList[i]]
    if (num - numList[i] == numList[i]):
        secondCount -= 1

print(int(secondCount / 2))

Submission status: Runtime Error

Solution code:

import math
N=int(import())
 
if N==1 or N==2:
  ans=0
elif N%2==0:
  ans=N/2-1
else:
  ans=N/2
  ans = math.floor(ans)
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
if N % 2 == 0:
    print(N/2-1)
else:
    print((N-1)/2)

Submission status: Runtime Error

Solution code:
n=input()

if n%2==0:
  print(n/2-1)
else:
  print(n//2)

Submission status: Runtime Error

Solution code:
from scipy.special import comb
import math
N=int(import())

if N==1 or N==2:
  ans=0
else N%2==0:
  ans=N/2-1
else:
  ans=N/2
  ans = math.floor(ans)
print(ans)

Submission status: Runtime Error

Solution code:
N = 1
N = input()
if N % 2 == 0:
    print(N/2-1)
else:
    print((N-1)/2)

Submission status: Runtime Error

Solution code:
from scipy.special import comb
import math
N=int(import())
 
a = comb(N, 3, exact=True)
if N==1 or N==2:
  ans=0
else N%2==0:
  ans=a/2-1
else:
  ans=a/2
  ans = math.floor(ans)
print(ans)

Submission status: Runtime Error

Solution code:
N=input()
ans=int(round(N/2.0)-1)
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
if N%2 = 0:
    print(N/2-1)
else:
    print((N-1)/2)

Submission status: Runtime Error

Solution code:
ans=0
N=int(input())
c=round(N/2)
for i in range(1,c):
    for j in range(1,c-i):
        cnt=i+j
        if cnt=N:
            ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
count = 0
li = []

for i in range(1, n):
  if n - i == i or i in li:
    continue
    
  else:
    count += 1
    li.append(i)
    li.appned(n - i)
    
print(count)

Submission status: Runtime Error

Solution code:
m = 998244353
def myPow(a,b):
    a %= m
    if b == 1:
        return a%m
    elif b == 0:
        return 1
    if b%2 == 0:
        return myPow(a**2,b//2)%m
    else:
        return (a%m)*myPow(a**2,(b-1)//2)%m

n = int(input())
ngo = [0]*n
d = list(map(int,input().split()))
for i in range(n):
    ngo[d[i]]+=1
if ngo[0] != 1:
    print(0)
    exit(0)
ans = 1
for i in range(n-1):
    ans = (ans*myPow(ngo[i],ngo[i+1])%m)%m
print(ans%m)

Submission status: Runtime Error

Solution code:
n=int(input())
t=tuple(map(int,input().split()))
while True:
  if t[0]!=0:
    print(0)
    break
  m=max(t)
  a=tuple(t.count(i) for i in range(m+1))
  if a[0]!=1:
    print(0)
    break
  s=1
  for i in range(m):
    s=(s*(a[i]**a[i+1]))%998244353
  print(s)
  break

Submission status: Runtime Error

Solution code:
ans=0
N=int(input())
c=round(N/2)
for i in range(1,c):
	for j in range(1,N-c):
    	cnt=i+j
        if cnt=N:
        	ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
from scipy.special import comb
import math
N=int(import())

a = comb(N, 3, exact=True)
if N%2==0:
  ans=a/2-1
else:
  ans=a/2
  ans = math.floor(ans)
print(ans)

Submission status: Runtime Error

Solution code:
import unittest

from A01 import solve
from A01 import parse_input


class TestA01Solve(unittest.TestCase):

    def test_solve(self):

        lines_as_string = """
4
"""
        r = parse_input(lines_as_string)
        print(r)
        print("")
        self.assertEqual(solve(*r), 1)

        lines_as_string = """
999999
"""
        r = parse_input(lines_as_string)
        print(r)
        print("")
        self.assertEqual(solve(*r), 499999)


if __name__ == '__main__':
    unittest.main()

Submission status: Runtime Error

Solution code:
ans=1
N=int(input())
c=int((N-1)/2)
for i in range(c):
	for j in range(c):
    	cnt=i+j
        if cnt=N:
        	ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
ans=1
N=int(input())
for i in range(N-1):
	for j in range(N-1):
    	cnt=i+j
        if cnt=N:
        	ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
int N
if N%2 = 0:
    print(N/2-1)
else:
    print((N-1)/2)

Submission status: Runtime Error

Solution code:
from scipy.special import comb
n = int(input())
if n/2==0:
    print(math.factorial(n)-1)
    
else:
  	print(math.factorial(n))

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 == 1:
    print((int(n - 1) / 2))
else:
    printint((n / 2 - 1))

Submission status: Runtime Error

Solution code:
N ＝ int(input())
if N%2＝＝0:
  print(N//2-1)
else:
  print(N//2)

Submission status: Runtime Error

Solution code:
n = int(input())
ans = math.ceil(n/2)-1
print(ans)

Submission status: Runtime Error

Solution code:
a = input()
if a < 2:
    print(0)
else:
    if a % 2 == 0:
        print(int(a / 2 - 1) )
    else:
        print(int(a/2))

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2==0:
  ans=n//2-1
else:
  ans==n//2

print(ans)

Submission status: Runtime Error

Solution code:
a=input()
n = 0
print(int((a-1)/2))

Submission status: Runtime Error

Solution code:
n = input()

if n % 2 == 0:
    print(n/2)
else:
    n -= 1
    print(n/2)

Submission status: Runtime Error

Solution code:
N = str(input())
print((N-1)//2)

Submission status: Runtime Error

Solution code:
N = int(input())

if N%2 == 0:
    print(int(N/2-1))
else:
    print(int((N+1)/2-1)

Submission status: Runtime Error

Solution code:
using System;
using System.Collections.Generic;

namespace Task
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            HashSet<int> hs = new HashSet<int>();
            int sl = 0;
            for(int i = 1; i < n; ++i)
            {
                if(i == n - i || hs.Contains(i))
                    continue;
                
                hs.Add(i);
                hs.Add(n - i);
                ++sl;
            }

            System.Console.WriteLine(sl);
        }
    }
}

Submission status: Runtime Error

Solution code:
n = int(input())
if n%2 = 0:
  answer = n/2-1
else:
  answer = (n-1)/2
print(answer)

Submission status: Runtime Error

Solution code:
print((int(input()+1)//2-1)

Submission status: Runtime Error

Solution code:
n = int(input())

print(n//2-not(n%2))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
for i in range(n//2):
  ans += 1
printt(ans)

Submission status: Runtime Error

Solution code:
N = int(input)
print(N//2)