ZhenlongDai/ACPR huggingface dataset:
Problem: p02866
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import collections
N=int(input())
D=list(map(int,input().split()))
mod=998244353
D=collections.Counter(D)
if D[0]!=1 or D[0]!=0:
  print(0);exit()
ans=1
l=1
for i in range(len(D)):
  if i==0:
    continue
  
  ans*=pow(l,D[i],mod)
  ans%=mod
  l=D[i]
print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import collections
N=int(input())
D=list(map(int,input().split()))
mod=998244353
if D[0]!=0:
  print(0);exit()

D=collections.Counter(D)
if D[0]!=1:
  print(0);exit()
ans=1
for i in range(1,len(D)): 
  ans*=pow(D[i-1],D[i],mod)
  ans%=mod
print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(s) for s in input().split(' ')]
counts = [0] * n
for i in a:
  counts[i] += 1
ans = 1 if a[0] == 0 else 0
for u, v in zip(counts, counts[1:]):
  ans = ans * u * v % 998244353
print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(s) for s in input().split(' ')]
counts = [0] * n
for i in a:
  counts[i] += 1
ans = 1 if a[0] == 0 and counts[0] == 1 else 0
for u, v in zip(counts, counts[1:]):
  for _ in range(v):
    ans = ans * u % 998244353
print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)


ans = 1
count = 0
for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
    
    
    if i != item[0]:
        ans = 0
        break
    if i == 0 and item[1] != 0:
        break
    else:
        ans *= (count ** item[1]) % MOD
    count = item[1]
print(ans % MOD)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
1


Fixed submission (verdict: Accepted):
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)


if D[0] != 0:
    ans = 0
else:
    ans = 1
    count = 1
    for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
        
        
        if i != item[0]:
            ans = 0
            break
        if item[0] == 0 and item[1] != 1:
            ans = 0
            break

        ans *= (count ** item[1]) % MOD
        count = item[1]
print(ans % MOD)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
L = [int(i) for i in input().split()]
LL = [0 for i in range(pow(10,5)+1)]
 
for i in range(n):
  LL[L[i]] += 1
  
MOD = 998244353
out = 1
for i in range(len(LL)-1):
  out *= pow(LL[i], LL[i+1], MOD) % MOD
 
if L[0] != 0 or LL[0] != 1:
  out = 0
maximum = max(L)
for i in range(maximum):
  if L[i] == 0:
    out = 0
  
print(out)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
L = [int(i) for i in input().split()]
LL = [0 for i in range(pow(10,5)+1)]
 
for i in range(n):
  LL[L[i]] += 1
  
MOD = 998244353
out = 1
maximum = max(L)
for i in range(maximum):
  out = (out * pow(LL[i], LL[i+1], MOD)) % MOD
 
if L[0] != 0 or LL[0] != 1:
  out = 0

for i in range(maximum):
  if L[i+1] == 0:
    out = 0
  
print(out)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
from collections import defaultdict

N = int(input())
D = defaultdict(int)
for i,x in enumerate(input().split()):
    if i == 0 and x != 0:
        print(0)
        exit()
    D[int(x)] += 1
D_len = len(D)

MOD = 998244353

if D[0] != 1:
    print(0)
    exit()

answer = 1
for i in range(1,D_len):
    if D[i] == 0:
        answer = 0
        break
    tmp = 1
    for _ in range(D[i]):
        tmp = (tmp * D[i-1]) % MOD
    answer = (answer * tmp) % MOD

print(answer)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
from collections import defaultdict

N = int(input())
tmp = [int(i) for i in input().split()]
if tmp[0] != 0:
    print(0)
    exit()
D = defaultdict(int)
for i in tmp:
    D[int(i)] += 1
D_len = max(tmp)

MOD = 998244353

if D[0] != 1:
    print(0)
    exit()

answer = 1
for i in range(1,D_len+1):
    if D[i] == 0:
        answer = 0
        break
    tmp = 1
    for _ in range(D[i]):
        tmp = (tmp * D[i-1]) % MOD
    answer = (answer * tmp) % MOD

print(answer)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
D=list(map(int,input().split()))
layer=[0]*N

mx=0
for item in D:
    if item == 0:
        print("GYAAAAAAAAAAAAAA")
    layer[item]+=1
    mx=max(mx,item)

print(layer)
if layer[0]!=1 or D[0]!=0:
    print(0)
    exit()

ans=1
for i in range(mx):
    ans*=(layer[i]**layer[i+1])

print(ans%998244353)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
GYAAAAAAAAAAAAAA
[1, 2, 1, 0]
2


Fixed submission (verdict: Accepted):
N=int(input())
D=list(map(int,input().split()))
layer=[0]*N

mx=0
for item in D:
    layer[item]+=1
    mx=max(mx,item)

if layer[0]!=1 or D[0]!=0:
    print(0)
    exit()

ans=1
for i in range(mx):
    ans*=(layer[i]**layer[i+1])

print(ans%998244353)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')

MOD = 998244353
def main():
    N = int(readline())
    D = list(map(int, readline().split()))
    if D[0]!=0:
        print(0)
        exit()
    node = [0]*(max(D)+1)
    for i in range(N):
        node[D[i]] += 1
    if node[0]>1:
        print(0)
        exit()
    ans = 0
    for i in range(len(node)-1):
        ans *= node[i]**node[i+1]
        ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')

MOD = 998244353
def main():
    N = int(readline())
    D = list(map(int, readline().split()))
    if D[0]!=0:
        print(0)
        exit()
    node = [0]*(max(D)+1)
    for i in range(N):
        node[D[i]] += 1
    if node[0]>1:
        print(0)
        exit()
    ans = 1
    for i in range(len(node)-1):
        ans *= node[i]**node[i+1]
        ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
L = [int(i) for i in input().split()]
LL = [0 for i in range(pow(10,5)+1)]
 
for i in range(n):
  LL[L[i]] += 1
  
MOD = 998244353
out = 1
for i in range(len(LL)-1):
  out *= pow(LL[i], LL[i+1], MOD) % MOD
 
if L[0] != 0 or LL[0] != 1:
  out = 0
maximum = max(L)
print(maximum)
for i in range(maximum):
  if L[i+1] == 0:
    out = 0
  
print(out)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
2
2


Fixed submission (verdict: Accepted):
n = int(input())
L = [int(i) for i in input().split()]
LL = [0 for i in range(pow(10,5)+1)]
 
for i in range(n):
  LL[L[i]] += 1
  
MOD = 998244353
out = 1
maximum = max(L)
for i in range(maximum):
  out = (out * pow(LL[i], LL[i+1], MOD)) % MOD
 
if L[0] != 0 or LL[0] != 1:
  out = 0

for i in range(maximum):
  if L[i+1] == 0:
    out = 0
  
print(out)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import collections


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_dic = collections.Counter(d_l)
    if count_dic[0] != 0:
        print(0)
    
    for i in range(2, d_max+1):
        ans *= count_dic[i-1] ** count_dic[i]
    
    print(ans%MOD)


if __name__ == '__main__':
    solve()

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0
2


Fixed submission (verdict: Accepted):
import sys
import collections


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_dic = collections.Counter(d_l)
    if count_dic[0] != 1:
        print(0)
        sys.exit()
    
    for i in range(2, d_max+1):
        ans *= count_dic[i-1] ** count_dic[i]
    
    print(ans%MOD)


if __name__ == '__main__':
    solve()

Problem: p02866
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter

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

mod = 998244353
c = Counter(D)
m = max(c.keys())

if D[0] == 0 and c[0] == 1:
    ans = 1
    for i in D[1:]:
        ans *= c[i-1]
        ans %= mod
else:
    print(0)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:

Fixed submission (verdict: Accepted):
from collections import Counter

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

mod = 998244353
c = Counter(D)
m = max(c.keys())

if D[0] == 0 and c[0] == 1:
    ans = 1
    for i in D[1:]:
        ans *= c[i-1]
        ans %= mod
    print(ans)
else:
    print(0)

Problem: p02866
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

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

cd = Counter(D)
tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1






for kx in range(1, len(tmp)-2):
    _, p = tmp[kx]
    __, v = tmp[kx+1]
    while v > 0:
        ans *= p%M
        v -= 1

print(ans%M)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

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

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1


for kx in range(1, max(D)+1):
    ans *= pow(cd[kx-1], cd[kx],M)
    ans %= M

print(ans)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
divider = 998244353

num = int(input())
depths = [int(x) for x in input().split()]
max_depth = max(depths)

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

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

nodes = [0] * (max_depth+1)

for depth in depths:
  nodes[depth] += 1

if nodes[0] != 1 or min(nodes) == 0:
  print(0)
  exit(0)

arr = [(nodes[i] - 1) + nodes[i+1] for i in range(0, max_depth)]

ans = 1
for a in arr:
  ans = (ans * a)  % divider

print(ans)
exit(0)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
4


Fixed submission (verdict: Accepted):

divider = 998244353

num = int(input())
depths = [int(x) for x in input().split()]
max_depth = max(depths)

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

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

nodes = [0] * (max_depth+1)

for depth in depths:
  nodes[depth] += 1

if nodes[0] != 1 or min(nodes) == 0:
  print(0)
  exit(0)

arr = [nodes[i] ** nodes[i+1] for i in range(max_depth)]

ans = 1
for a in arr:
  ans = (ans * a)  % divider

print(ans)
exit(0)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
import collections
l=list(map(int,input().split()))
cnt=collections.Counter(l)
if cnt[0] > 1 or l[0] != 0:
   print(0)
   exit()
ans=1
mod=998244353
for i in range(1,max(cnt)):
   ans*=pow(i,cnt[i],mod)
   ans%=mod
print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
1


Fixed submission (verdict: Accepted):
N=int(input())
import collections
l=list(map(int,input().split()))
cnt=collections.Counter(l)
if cnt[0] > 1 or l[0] != 0:
   print(0)
   exit()
ans=1
mod=998244353
for i in range(1,max(cnt)):
   ans*=pow(cnt[i],cnt[i+1],mod)
   ans%=mod
print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
read = lambda: sys.stdin.readline().rstrip()

def counting_tree(N, D):
    tot = 1
    cnt = [0]*N
    
    for i in D:
        cnt[i]+=1
        print(cnt)

    for i in D[1:]:
        tot = tot * cnt[i-1]%998244353
        print(tot)

    return tot if D[0]==0 else 0

def main():
    
    N0 = int(read())
    D0 = tuple(map(int, read().split()))

    res = counting_tree(N0, D0)

    print(res)

if __name__ == "__main__":
    main()

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
[1, 0, 0, 0]
[1, 1, 0, 0]
[1, 2, 0, 0]
[1, 2, 1, 0]
1
1
2
2


Fixed submission (verdict: Accepted):
import sys
read = lambda: sys.stdin.readline().rstrip()

def counting_tree(N, D):
    tot = 1
    
    
    cnt = [0]*N
    for i in D:
        cnt[i]+=1

    for i in D[1:]:
        tot = tot * cnt[i-1]%998244353

    return tot if D[0]==0 else 0

def main():
    
    N0 = int(read())
    D0 = tuple(map(int, read().split()))

    res = counting_tree(N0, D0)

    print(res)

if __name__ == "__main__":
    main()
Problem: p02866
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
MOD = 998244353 
N = int(input())
D = [int(x) for x in input().split()]
zero = 0 
for d in D:
    zero += (d == 0)
if (D[0] != 1 or zero != 1):
    print(0)
else:
    lst = [0] * (N)
    for d in D:
        lst[d] += 1
    first0 = False
    for i in range(N):
        if (lst[i] != 0 and first0):
            print(0)
            exit()
        elif (lst[i] ==0):
            first0 = True
    ans = 1
    for i in range(N-1):
        ans *= lst[i] ** lst[i+1]
        ans %= MOD
    print(ans)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
MOD = 998244353 
N = int(input())
D = [int(x) for x in input().split()]
zero = 0 
for d in D:
    zero += (d == 0)
if (D[0] != 0 or zero != 1):
    print(0)
else:
    lst = [0] * (N)
    for d in D:
        lst[d] += 1
    first0 = False
    for i in range(N):
        if (lst[i] != 0 and first0):
            print(0)
            exit()
        elif (lst[i] ==0):
            first0 = True
    ans = 1
    for i in range(N-1):
        ans *= lst[i] ** lst[i+1]
        ans %= MOD
    print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n=int(input())
d=list(map(int,input().split()))
num_d=[0 for i in range(n)]
if d[0]!=0:
  print(0)
  sys.exit()
for i in range(1,len(d)):
  if i==0:
    print(0)
    sys.exit()
  num_d[d[i]]+=1
max_d=0
ans=1
for i in range(1,n):
  if num_d[i]!=0:
    if max_d!=i-1:
      print(0)
      sys.exit()
    max_d=i
    ans*=num_d[i-1]**num_d[i]
    ans%=998244353
print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import sys
n=int(input())
d=list(map(int,input().split()))
num_d=[0 for i in range(n)]
num_d[0]=1
if d[0]!=0:
  print(0)
  sys.exit()
for i in range(1,len(d)):
  if d[i]==0:
    print(0)
    sys.exit()
  num_d[d[i]]+=1
max_d=0
ans=1
for i in range(1,n):
  if num_d[i]!=0:
    if max_d!=i-1:
      print(0)
      sys.exit()
    max_d=i
    ans*=num_d[i-1]**num_d[i]
    ans%=998244353
print(ans)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)


ans = 1
count = 0
for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
    
    
    if i != item[0]:
        ans = 0
        break
    if item[0] == 0 and item[1] != 1:
        ans = 0
        break
    else:
        ans *= (count ** item[1]) % MOD
    count = item[1]
print(ans % MOD)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)


if D[0] != 0:
    ans = 0
else:
    ans = 1
    count = 1
    for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
        
        
        if i != item[0]:
            ans = 0
            break
        if item[0] == 0 and item[1] != 1:
            ans = 0
            break

        ans *= (count ** item[1]) % MOD
        count = item[1]
print(ans % MOD)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def find(D):
    if D[0]!=0:
        return 0
    
    count=[0 for _ in range(len(D))]
    MAX=max(D)
    
    ans=1
    if count[0]!=1:
        return 0
    
    for i in range(1,MAX+1):
        ans=ans*pow(count[i-1],count[i],998244353)
        ans%=998244353
    return ans
N=int(input())
D=list(map(int,input().strip().split()))
print(find(D))

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
def find(D):
    if D[0]!=0:
        return 0
    
    count=[0 for _ in range(len(D))]
    MAX=max(D)
    
    ans=1
    for x in D:
        count[x]+=1
    
    if count[0]!=1:
        return 0
    
    for i in range(1,MAX+1):
        ans=ans*pow(count[i-1],count[i],998244353)
        ans%=998244353
    return ans
N=int(input())
D=list(map(int,input().strip().split()))
print(find(D))

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
D = [int(x) for x in input().split()]
D = sorted(D)
new_l = [0 for n in range(max(D)+1)]
for n in range(N):
    new_l[D[n]] += 1
res = 1
if new_l[0] == 1 and D[0] == 0:
    for n in range(len(new_l)-2):
        res *= pow(new_l[n],new_l[n+1],998244353)
    print(res%998244353)
else:
    print(0)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
D = [int(x) for x in input().split()]
new_l = [0 for n in range(max(D)+1)]
for n in range(N):
    new_l[D[n]] += 1
if new_l[0] == 1 and D[0] == 0:
    res = 1
    for n in range(max(D)):
        res *= pow(new_l[n],new_l[n+1],998244353)
    print(res%998244353)
else:
    print(0)
Problem: p02866
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
d = list( map(int, input().split()) )
MOD = 998244353

c = Counter(d)

def count(c, iter):
    if c[0] != 1 or d[1] != 0:
        return 0

    res = 1
    for i in range(2, iter+2):
        for _ in range(c[i]):
            res *= c[i-1]%MOD
        res %= MOD
    return res%MOD

res = count(c, max(d))
print(res)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
d = list( map(int, input().split()) )
MOD = 998244353

c = Counter(d)

def count(c, iter):
    if c[0] != 1 or d[0] != 0:
        return 0

    res = 1
    for i in range(2, iter+2):
        for _ in range(c[i]):
            res *= c[i-1]%MOD
        res %= MOD
    return res%MOD

res = count(c, max(d))
print(res)

Problem: p02866
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
import sys
MOD = 998244353


def main():
    n = int(sys.stdin.buffer.readline())
    d = list(map(int, sys.stdin.buffer.readline().split()))
    D = Counter(d)
    if D[0] != 0:
        print(0)
    else:
        ans = 1
        for i in range(1, n + 1):
            ans *= pow(D[i-1], D[i], MOD)
        print(ans % MOD)


if __name__ == '__main__':
    main()


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
from collections import Counter
import sys
MOD = 998244353


def main():
    n, *d =  map(int, sys.stdin.buffer.read().split())
    D = Counter(d)
    if D[0] != 1:
        print(0)
    else:
        ans = 1
        for i in d[1:]:
            ans = ans*D[i-1]%MOD
        print(ans % MOD)


if __name__ == '__main__':
    main()

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n=int(input())
D=list(map(int,input().split()))

mod=998244353
c=collections.Counter(D)

if D[0]!=0 or c[0]!=0:
  print(0)
else:
  ans=c[0]
  node=c[0]
  for i in range(1,n):
    ans*=(c[i-1]**c[i])%mod
    node+=c[i]
    if node==n:
      break
  if node==n:
    print(ans%mod)
  else:
    print(0)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import collections
n=int(input())
D=list(map(int,input().split()))

mod=998244353
c=collections.Counter(D)

if D[0]!=0 or c[0]!=1:
  print(0)
else:
  ans=c[0]
  node=c[0]
  for i in range(1,n):
    ans*=(c[i-1]**c[i])%mod
    node+=c[i]
    if node==n:
      break
  print(ans%mod)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
import operator

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

D_dict = collections.Counter(D)
D_dict_sorted = sorted(D_dict.items(), key=operator.itemgetter(0))






if D[0] == 1:
    ans = 1
    for i in range(len(D_dict_sorted)-1):
        if D_dict_sorted[i][0] + 1 == D_dict_sorted[i+1][0]:
            ans *= D_dict_sorted[i][1] ** D_dict_sorted[i+1][1]
            if ans >= 998244353:
                ans = ans % 998244353
        else:
            ans = 0
else:
    ans = 0

print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import collections
import operator

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

D_dict = collections.Counter(D)
D_dict_sorted = sorted(D_dict.items(), key=operator.itemgetter(0))






if (D[0] == 0) and (D_dict_sorted[0][1] == 1) :
    ans = 1
    for i in range(len(D_dict_sorted)-1):
        if D_dict_sorted[i][0] + 1 == D_dict_sorted[i+1][0]:
            ans *= D_dict_sorted[i][1] ** D_dict_sorted[i+1][1]
            if ans >= 998244353:
                ans = ans % 998244353
        else:
            ans = 0
else:
    ans = 0

print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

N = int(input())
DD = list(map(int, input().split()))
D = sorted(dict(Counter(DD)).items(), key=lambda x:x[0])

ans = 0
if 1 == DD.count(0):
    ans = 1
    for i in range(1, len(D)-1):
        print(D[i][1], D[i+1][1])
        ans *= D[i][1]**D[i+1][1]
    print(ans)
        
else:
    print(ans)
    

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
2 1
2


Fixed submission (verdict: Accepted):
from collections import Counter

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

if DD[0] != 0:
    print(0)
elif D[0] != 1:
    print(0)
else:
    ans = 1
    for i in range(len(D)-1):
        ans *= D[i]**D[i+1]
        ans %= 998244353 
    print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
MOD = 998244353
N = int(input())
*D, = map(int, input().split())
D = sorted(D)
levels = [0 for _ in range(D[-1]+1)]
for d in D:
    levels[d] += 1
if 0 in levels or levels[0] != 1: print(0)
else:
    ans = 1
    for l1, l2 in zip(levels, levels[1:]):
        print(l1, l2)
        ans *= pow(l1, l2, MOD)
        ans % MOD
    print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
1 2
2 1
2


Fixed submission (verdict: Accepted):
MOD = 998244353
N = int(input())
*D, = map(int, input().split())
if D[0] != 0: print(0)
else:
    D = sorted(D)
    levels = [0 for _ in range(D[-1]+1)]
    for d in D:
        levels[d] += 1
    if 0 in levels or levels[0] > 1: print(0)
    else:
        ans = 1
        for l1, l2 in zip(levels, levels[1:]):
            ans = (ans * pow(l1, l2, MOD)) % MOD
        print(ans)
Problem: p02866
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def resolve():
    
    import collections
    N = int(input())
    D = [int(item) for item in input().split()]
    d_dict = collections.Counter(D)
    print(D)
    print(d_dict)

    cnt = 0
    if D[0] != 0:
        pass
    else:
        cnt = 1
        for i in D[1:]:
            cnt *= d_dict[i-1]
            cnt %= 998244353


    print(cnt % 998244353)

if __name__ == "__main__":
    resolve()


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
[0, 1, 1, 2]
Counter({1: 2, 0: 1, 2: 1})
2


Fixed submission (verdict: Accepted):
def resolve():
    
    import collections
    N = int(input())
    D = [int(item) for item in input().split()]
    d_dict = collections.Counter(D)

    cnt = 0
    if D[0] != 0:
        pass
    else:
        cnt = 1
        for i in D[1:]:
            cnt *= d_dict[i-1]
            cnt %= 998244353


    print(cnt % 998244353)

if __name__ == "__main__":
    resolve()

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    length = int(input())
    distance = list(map(int, input().split()))
    count_distance = {}
    for d in distance:
        if d in count_distance:
            count_distance[d] += 1
        else:
            count_distance[d] = 1
    count_distance = sorted(count_distance.items(), key=lambda x: x[0])
    answer = 0
    mod = 998244353
    if distance[0] == 0 and count_distance[0] == 1:
        answer = 1
        for i in range(1, len(count_distance)):
            if count_distance[i][0] == count_distance[i - 1][0] + 1:
                answer = (answer * pow(count_distance[i - 1][1], count_distance[i][1], mod)) % mod
            else:
                answer = 0
                break
    print(answer)


if __name__ == '__main__':
    main()



Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
def main():
    length = int(input())
    distance = list(map(int, input().split()))
    count_distance = {}
    for d in distance:
        if d in count_distance:
            count_distance[d] += 1
        else:
            count_distance[d] = 1
    count_distance = sorted(count_distance.items(), key=lambda x: x[0])
    answer = 0
    mod = 998244353
    if distance[0] == 0 and count_distance[0][1] == 1:
        answer = 1
        for i in range(1, len(count_distance)):
            if count_distance[i][0] == count_distance[i - 1][0] + 1:
                answer = (answer * pow(count_distance[i - 1][1], count_distance[i][1], mod)) % mod
            else:
                answer = 0
                break
    print(answer)


if __name__ == '__main__':
    main()
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
from itertools import tee

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


def pairwise(iterable):
    "s -> (s0,s1), (s1,s2), (s2, s3), ..."
    a, b = tee(iterable)
    next(b, None)
    return zip(a, b)


if D[0] > 0:
    print(0)
else:
    ans = 1
    c = Counter(D[1:])
    print(c)
    edges = [t[1] for t in sorted(c.items())]
    for d, e in pairwise(edges):
        ans *= pow(d, e)
    print(ans % R)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
Counter({1: 2, 2: 1})
2


Fixed submission (verdict: Accepted):
from collections import Counter
from itertools import tee

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


def pairwise(iterable):
    a, b = tee(iterable)
    next(b, None)
    return zip(a, b)


def is_leap(distance):
    cc = Counter(distance)
    for x, y in pairwise(sorted(cc.keys())):
        if y - x > 1:
            return True
    else:
        return False


if D[0] > 0:
    
    print(0)
elif not all(D[1:]):
    
    print(0)
elif is_leap(D):
    print(0)
else:
    ans = 1
    c = Counter(D[1:])
    edges = [t[1] for t in sorted(c.items())]
    for d, e in pairwise(edges):
        ans *= pow(d, e)
    print(ans % R)

Problem: p02866
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import defaultdict

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

MOD = 998244353

p = defaultdict(int)
for d in D:
    p[d] += 1

if p[0] == 1 and D[0] != 0:
    ans = 1
    for i in range(N + 1):
        ans *= p[i] ** p[i + 1]
        ans %= MOD

    print(ans % MOD)

else:
    print(0)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
from collections import defaultdict

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

MOD = 998244353

p = defaultdict(int)
for d in D:
    p[d] += 1

if p[0] == 1 and D[0] == 0:
    ans = 1
    for i in range(N + 1):
        ans *= p[i] ** p[i + 1]
        ans %= MOD

    print(ans % MOD)

else:
    print(0)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ls = list(map(int, input().split(' ')))
n = 100000
ls = [p%4 for p in range(n)]
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
ans = 0 if (ls[0] != 0 or d.get(0) >= 2) else 1
for i in range(1, m+1):
    if i not in d:
        ans = 0
    ans = (ans * (d.get(i-1, 0) ** d.get(i, 0))) % 998244353 
print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
ls = list(map(int, input().split(' ')))
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
ans = 0 if (ls[0] != 0 or d.get(0) >= 2) else 1
for i in range(1, m+1):
    if i not in d:
        ans = 0
    ans = (ans * (d.get(i-1, 0) ** d.get(i, 0))) % 998244353 
print(ans)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys


n = int(input())
d = list(int(x) for x in input().split())

if d[0] != 0:
    print(0)
    sys.exit()
d.sort()
print(d)
ans = 1
key = 1
value = 1
for i in range(1, n):
    if i == 1 and d[i] != 1:
        print(0)
        sys.exit()
    else:
        pass
    if d[i] == d[i-1]:
        key += 1
    else:
        if d[i] == d[i-1] + 1:
            if d[i-1] == 1:
                value = key
                key = 1
            else:
                print(value, key)
                ans *= pow(value, key)
                print(ans)
                value = key
                key = 1
        else:
            print(0)
            sys.exit()
ans *= pow(value, key)
print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
[0, 1, 1, 2]
1 1
1
2


Fixed submission (verdict: Accepted):
import sys


n = int(input())
d = list(int(x) for x in input().split())

if d[0] != 0:
    print(0)
    sys.exit()
d.sort()
ans = 1
key = 1
value = 1
for i in range(1, n):
    if i == 1 and d[i] != 1:
        print(0)
        sys.exit()
    else:
        pass
    if d[i] == d[i-1]:
        key += 1
    else:
        if d[i] == d[i-1] + 1:
            if d[i-1] == 1:
                value = key
                key = 1
            else:
                ans *= pow(value, key)%998244353
                value = key
                key = 1
        else:
            print(0)
            sys.exit()
t = pow(value, key)
ans = ans*t%998244353
print(ans)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import collections


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

cnt = dict(collections.Counter(d))

try:
  if cnt[0]==1:
    ans = 1
    for i in range(len(dict(cnt))-1):
      val_1 = cnt[i]
      val_2 = cnt[i+1]
      
      ans *= (val_1**val_2)
    print(ans%MOD)
  else:
    print(0)
except KeyError:
  print(0)
  


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import collections
 
n = int(input())
d = list(map(int,input().split()))
MOD = 998244353

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

cnt = dict(collections.Counter(d))

if cnt[0]==1:
  m = max(cnt)
  
  for i in range(m):
    if i not in cnt:
      print(0)
      exit()
  ans = 1
  for i in range(m):
    val_1 = cnt[i]
    val_2 = cnt[i+1]
    ans *= (val_1**val_2)%MOD
 
  print(ans%MOD)
else:
  print(0)
Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)


ans = 1
count = 0
for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
    print("ans: {}".format(ans))
    print("i: {}, item: {}".format(i, item))
    if i != item[0]:
        ans = 0
        break
    if i == 0:
        count = item[1]
    else:
        ans *= (count ** item[1]) % MOD
        count = item[1]
print(ans % MOD)


Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
ans: 1
i: 0, item: (0, 1)
ans: 1
i: 1, item: (1, 2)
ans: 1
i: 2, item: (2, 1)
2


Fixed submission (verdict: Accepted):
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)


if D[0] != 0:
    ans = 0
else:
    ans = 1
    count = 1
    for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
        
        
        if i != item[0]:
            ans = 0
            break
        if item[0] == 0 and item[1] != 1:
            ans = 0
            break

        ans *= (count ** item[1]) % MOD
        count = item[1]
print(ans % MOD)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
D=list(map(int,input().split()))

mod=998244353
if D[0]!=0:
  print(0)
else:
  ans=1
  for i in range(2,n):
    if D.count(i)==0:
      print(0)
      exit()
    ans*=(D.count(i-1)**D.count(i))%mod
  print(ans%mod)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
import collections
n=int(input())
D=list(map(int,input().split()))

mod=998244353
c=collections.Counter(D)

if D[0]!=0 or c[0]!=1:
  print(0)
else:
  ans=c[0]
  node=c[0]
  for i in range(1,n):
    ans*=(c[i-1]**c[i])%mod
    node+=c[i]
    if node==n:
      break
  print(ans%mod)

Problem: p02866
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
D = list(map(int, input().split()))

fq = [0] * (N + 10)

for d in D:
    fq[d] += 1

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

ans = 1
for i in range(2, N+1):
    ans = (ans * (fq[i-1] ** fq[i] % 998244353)) % 998244353

print(ans)

Failing test case input:
4
0 1 1 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
D = list(map(int, input().split()))

fq = [0] * (N + 10)

for d in D:
    fq[d] += 1

if not (D[0] == 0 and fq[0] == 1):
    print(0)
    exit()

ans = 1
for i in range(2, N+1):
    ans = (ans * (fq[i-1] ** fq[i] % 998244353)) % 998244353

print(ans)
Problem: p03533
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
b = "AKIHABARA"
def akiba(a, b):
    i = -1
    print('\n')
    print(a, b)
    lenght = len(a)
    for one_b in b:
        i += 1
        if i > lenght-1:
            if one_b == '$':
                return True
            else:
                return False
        print(a[i], b[i])
        if not a[i] == b[i]:
            if not b[i] == 'A':
                return False
            if akiba(a[i:], b[i+1:]):
                return True
            else:
                return False
    return True

if __name__=="__main__":
    a = input("")
    if akiba(a + '$', b + '$'):
        print("YES")
    else:
        print("NO")

Failing test case input:
KIHBR

Expected output:
YES

Actual output:


KIHBR$ AKIHABARA$
K A


KIHBR$ KIHABARA$
K K
I I
H H
B A


BR$ BARA$
B B
R A


R$ RA$
R R
$ A


$ $
$ $
YES


Fixed submission (verdict: Accepted):
b = "AKIHABARA"
def akiba(a, b):
    i = -1
    lenght = len(a)
    for one_b in b:
        i += 1
        if i > lenght-1:
            if one_b == '$':
                return True
            else:
                return False
        if not a[i] == b[i]:
            if not b[i] == 'A':
                return False
            if akiba(a[i:], b[i+1:]):
                return True
            else:
                return False
    return True

if __name__=="__main__":
    a = input("")
    if akiba(a + '$', b + '$'):
        print("YES")
    else:
        print("NO")

Problem: p03533
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = list(input())
n = len(S)

ok = ['AKIHABARA',\
    'KIHABARA','AKIHBARA','AKIHABRA','AKIHABAR',\
    'KIHBARA','KIHABRA','KIHABAR','AKIHBRA','AKIHBAR','AKIHABR',\
    'KIHBRA','KIHBAR','KIHABR','AKIHBR',\
    'KIHBR']

print('YES') if S in ok else print('NO')

Failing test case input:
KIHBR

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()
ok = ['KIHBR', 'KIHBRA', 'KIHBAR', 'KIHBARA', 'KIHABR','KIHABRA', 'KIHABAR', 'KIHABARA', 'AKIHBR', 'AKIHBRA', 'AKIHBAR', 'AKIHBARA', 'AKIHABR', 'AKIHABRA', 'AKIHABAR', 'AKIHABARA']
print('YES') if s in ok else print('NO')

Problem: p03533
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s = list(input())
ok = ['AKIHABARA','KIHABARA','AKIHBARA','AKIHABRA','AKIHABAR','KIHBARA','KIHABRA','KIHABAR','AKIHBRA','AKIHBAR','AKIHABR','KIHBRA','KIHBAR','KIHABR','AKIHBR','KIHBR']
print('YES') if s in ok else print('NO')

Failing test case input:
KIHBR

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()
ok = ['KIHBR', 'KIHBRA', 'KIHBAR', 'KIHBARA', 'KIHABR','KIHABRA', 'KIHABAR', 'KIHABARA', 'AKIHBR', 'AKIHBRA', 'AKIHBAR', 'AKIHBARA', 'AKIHABR', 'AKIHABRA', 'AKIHABAR', 'AKIHABARA']
print('YES') if s in ok else print('NO')
Problem: p03533
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == '__main__':
    s = input()
    l = s.replace('AA', '_').strip('A').split('A')
    if ''.join(l) == 'KIHBR' and l.count('KI') > 0:
        print('YES')
    else:
        print('NO')


Failing test case input:
KIHBR

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    s = input()
    l = s.replace('AA', '_').strip('A').split('A')
    if ''.join(l) == 'KIHBR' and len(l) > 0 and l[0][:3] == 'KIH':
        print('YES')
    else:
        print('NO')

Problem: p03533
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
A=["KIHBR","KIHABR","AKIHBR","KIHBAR","KIHBRA","AKIHABR","AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA"]
s=input()
if s in A:
    print("Yes")
else:
    print("No")

Failing test case input:
KIHBR

Expected output:
YES

Actual output:
Yes


Fixed submission (verdict: Accepted):
A=["KIHBR","KIHABR","AKIHBR","KIHBAR","KIHBRA","AKIHABR","AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA"]
s=input()
if s in A:
    print("YES")
else:
    print("NO")

Problem: p03533
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re

print('Yes' if re.match('A?KIHA?BA?RA?', input()) else 'No')


Failing test case input:
KIHBR

Expected output:
YES

Actual output:
Yes


Fixed submission (verdict: Accepted):
import re

print('YES' if re.match('A?KIHA?BA?RA?$', input()) else 'NO')

Problem: p03533
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

S = input()

can = "KIHBR"
tar = "AKIHABARA"

N = len(S)
i = 0
for c in S:
    if c == can[i]:
        i += 1
        if i == 5: break
    if not c in tar:
        print("NO")
        exit()

if not i == 5:
    print("NO")
    exit()
if "AA" in S or "KA" in S or "IA" in S or "AI" in S:
    print("NO")
    exit()

print("NO")



Failing test case input:
KIHBR

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):

S = input()

can = "KIHBR"
tar = "AKIHABARA"

N = len(S)
i = 0
for c in S:
    if c == can[i]:
        i += 1
        if i == 5: break
    if not c in tar:
        print("NO")
        exit()

if any(S.count(can[i]) != 1 for i in range(4)):
    print("NO")
    exit()
if not i == 5:
    print("NO")
    exit()
if "AA" in S or "KA" in S or "IA" in S or "AI" in S:
    print("NO")
    exit()
print("YES")

Problem: p03533
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

S = input() 
if not S in "AKIHABARA":
	print("NO")
	exit(0)


string =  ""
count = 0

for i in S:
	if i != 'A':
		string += i


if string == "KIHBR":
	print("YES")

else:
	print("NO")


Failing test case input:
KIHBR

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):

S = input() 
if((not S in "AKIHABARA") and (not S in "AKIHBARA") and (not S in "AKIHBRA") and (not S in "AKIHABRA")):
	print("NO")
	exit(0)


string =  ""
count = 0

for i in S:
	if i != 'A':
		string += i


if string == "KIHBR":
	print("YES")

else:
	print("NO")
Problem: p03533
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
 
inputline = list(input()) 
akihabara = list("AKIHABARA")


count = 0

lineLength = len(akihabara) - len(inputline)
for i in range( len(inputline) ):
    if inputline[i] == "A":
      count += 1


if lineLength < 0 or len(inputline)+count < 9 :
    print("NO")

elif lineLength == 0:
    if inputline == akihabara:
        print("YES")
    else:
        print("NO")


else:
    for i in range(9):
        if i == 8 and len(inputline)<9:
            inputline.append("A")
        elif inputline[i] != akihabara[i]:
            inputline.insert(i, "A")
            
    if inputline == akihabara:
        print("YES")
    else:
        print("NO")


Failing test case input:
KIHBR

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):

import sys
 
inputline = list(input()) 
akihabara = list("AKIHABARA")


count = 4

lineLength = len(akihabara) - len(inputline)
for i in range( len(inputline) ):
    if inputline[i] == "A":
      count -= 1


if lineLength < 0 or len(inputline)+count < 9 :
    print("NO")

elif lineLength == 0:
    if inputline == akihabara:
        print("YES")
    else:
        print("NO")


else:
    for i in range(9):
        if i == 8 and len(inputline)<9:
            inputline.append("A")
        elif inputline[i] != akihabara[i]:
            inputline.insert(i, "A")
            
    if inputline == akihabara:
        print("YES")
    else:
        print("NO")
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
from decimal import Decimal

def solve():
    input = sys.stdin.readline
    A, B = map(float, input().split())
    ans = Decimal(A) * Decimal(B)
    print(int(ans))

    return 0

if __name__ == "__main__":
    solve()

Failing test case input:
1000000100000010 9.99

Expected output:
9990000999000099


Actual output:
9990000999000100


Fixed submission (verdict: Accepted):
import sys
from decimal import Decimal

def solve():
    input = sys.stdin.readline
    A, B = map(str, input().split())
    ans = str(Decimal(A) * Decimal(B))
    N = len(ans)
    print(ans[:N-3])

    return 0

if __name__ == "__main__":
    solve()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
from decimal import *
getcontext().prec = 300
a,b = map(float,input().split())
print(math.floor(Decimal(a) * Decimal(b)))

Failing test case input:
1010110100001101 9.99

Expected output:
10090999899010998


Actual output:
10090999899010999


Fixed submission (verdict: Accepted):
import math
from decimal import *
getcontext().prec = 300
a,b = map(Decimal,input().split())
print(math.floor(Decimal(a) * Decimal(b)))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
def LF(): return list(map(float,stdin.readline().rstrip().split()))

tmp = LF()

print(int(tmp[0]*tmp[1]))

Failing test case input:
1010000101000010 9.99

Expected output:
10089901008990099


Actual output:
10089901008990100


Fixed submission (verdict: Accepted):
from decimal import Decimal
from sys import stdin
def LD(): return list(map(Decimal,stdin.readline().rstrip().split()))
 
tmp = LD()
ans = int(tmp[0]*tmp[1])
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
A,B = map(float,input().split())
print(math.floor(A*B))

Failing test case input:
1010000100000010 9.99

Expected output:
10089900999000099


Actual output:
10089900999000100


Fixed submission (verdict: Accepted):
import math
from decimal import Decimal
A,B = map(Decimal,input().split())
print(math.floor(A*B))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

a, b = map(str, input().split())

a = int(a)
b = float(b)
ans = math.floor(a * b)
print(ans)



Failing test case input:
1001001000101010 9.99

Expected output:
9999999991009089


Actual output:
9999999991009090


Fixed submission (verdict: Accepted):
import decimal
import math

a, b = map(str, input().split())

a = decimal.Decimal(a)
b = decimal.Decimal(b)
ans = math.floor(a * b)
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
  A,B=map(float,input().split())
  print(int(A*B))
if __name__ == '__main__':
  main()



Failing test case input:
1001000100010010 9.99

Expected output:
9999990999099999


Actual output:
9999990999100000


Fixed submission (verdict: Accepted):
def main():
  A,B=input().split()
  Bi=100*int(B[0])+10*int(B[2])+int(B[3])
  print(int(A)*Bi
if __name__ == '__main__':
  main()
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B = input().split()
A = int(A)
B = float(B)
print(int(A*B))

Failing test case input:
1000000110000101 9.99

Expected output:
9990001098901008


Actual output:
9990001098901010


Fixed submission (verdict: Accepted):
A, B = input().split()
A = int(A)
B = int(B.replace(".", ""))
print(A * B

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = map(float, input().split())
a = int(a)
print(int(a * int(b)) + int(a * (b - int(b))))

Failing test case input:
1011010001101001 9.99

Expected output:
10099989910998999


Actual output:
10099989910999000


Fixed submission (verdict: Accepted):
from decimal import Decimal
a, b = map(Decimal, input().split())
a = int(a)
print(int(a * b))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):




def main():
    A, B = map(float, input().split())

    A = int(A)
    res = B - int(B)
    s = A * int(B)
    t = A * res
    print(s+int(t))


if __name__ == '__main__':
    main()

Failing test case input:
1010010110000010 9.99

Expected output:
10090000998900099


Actual output:
10090000998900100


Fixed submission (verdict: Accepted):
def main():
    A, B = input().split()

    A = int(A)
    bb = round(float(B)*100)
    ans = A*bb

    print(ans

if __name__ == '__main__':
    main()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a, b = input().split()
a = int(a)
b = float(b)
c = a *b
ans = math.floor(c)
print(int(ans))

Failing test case input:
1010000100000010 9.99

Expected output:
10089900999000099


Actual output:
10089900999000100


Fixed submission (verdict: Accepted):
import math
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
c = a *b
ans = math.floor(c)
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a, b = map(str, input().split())
a = int(a)
b = float(b) * 100
ans = a * b
ans = a * b 
ans = math.floor(round(ans, 3))
print(ans)


Failing test case input:
1000100000100001 9.99

Expected output:
9990999000999009


Actual output:
999099900099901056


Fixed submission (verdict: Accepted):
import math
a, b = map(str, input().split())
a = int(a)
b = float(b)

b = int(b * 1000)

ans = int(a * b 
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def ri():
    return int(input())


def rii():
    return [float(v) for v in input().split()]

A, B = rii()


print(int((A * (B * 100 + 0.01)) / 100))

Failing test case input:
1000000000000001 9.99

Expected output:
9990000000000009


Actual output:
9990100000000010


Fixed submission (verdict: Accepted):

def ri():
    return int(input())


def rii():
    return [str(v) for v in input().split()]

A, B = rii()
A = int(A)
B, F = [int(v) for v in B.split(".")]
B = 100 * B + F

print((A * B)