ZhenlongDai/ACPR huggingface dataset:
Problem: p03095
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
n = input()
mod = 10**9+7
s = list(Counter(list(input())).values())
an = 1
for i in s:
  an *= int(i)
print(an-1)

Failing test case input:
4
cbbd

Expected output:
11


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import Counter
n = input()
mod = 10**9+7
s = list(Counter(list(input())).values())
an = 1
for i in s:
  an *= (i+1)%mod
print((an-1)%mod)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10e9 + 7





AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1

for n in range(N):
	if AppearCount[S[n]-ord('a')] != 0:
		ans *= (AppearCount[S[n]-ord('a')]+1)
		if MOD <= ans:
			ans -= MOD

print(ans-1)

Failing test case input:
5
cabaa

Expected output:
15


Actual output:
255


Fixed submission (verdict: Accepted):
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10**9 + 7 




AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1
bFirst = True

for a in AppearCount:
	if a != 0:
		ans *= (a+1)
		while MOD < ans:
			ans -= MOD

ans -= 1

while MOD <= ans:
	ans -= MOD

print(ans)

Problem: p03095
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
s=input()
mod = 1e9+7
ans = [1]*30
for c in s:
    ans[ord(c)-ord('a')]+=1
res = 1
for i in range(29):
    res *= ans[i]
    res %= mod
print((res-1)%mod)

Failing test case input:
4
adca

Expected output:
11


Actual output:
11.0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
mod = 1e9+7
ans = [1]*30
for c in s:
    ans[ord(c)-ord('a')]+=1
res = 1
for i in range(29):
    res *= ans[i]
    res %= mod
print(int((res-1)%mod))

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
mod=10**9+7
ans=1
lets=[1]*26
for i in s:
  lets[ord(i)-97]+=1
for i in range(26):
  ans*=lets[i]
  ans%=mod
print(ans)

Failing test case input:
3
acd

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
mod=10**9+7
ans=1
lets=[1]*26
for i in s:
  lets[ord(i)-97]+=1
for i in range(26):
  ans*=lets[i]
  ans%=mod
print(ans-1)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=list(input())
ans=0
z=list(set(s))
m=len(z)
for i in range(m):
    ans+=s.count(z[i])*(2**(m-1))
print(ans-m+1)

    


Failing test case input:
5
aabbc

Expected output:
17


Actual output:
18


Fixed submission (verdict: Accepted):
n=int(input())
s=list(input())
mod=10**9+7
z=list(set(s))
ans=1

m=len(z)
for i in range(m):   
    ans*=(s.count(z[i])+1)%mod
    ans=ans%mod
print((ans-1)%mod)
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = str(input())
l = []
for x in s:
    if x not in l:
        l.append(x)
ans = 1
for x in l:
    ans = ans*(s.count(x)+1)
ans =- 1
ans %= 10**9 + 7
print(ans)

Failing test case input:
4
cdbe

Expected output:
15


Actual output:
1000000006


Fixed submission (verdict: Accepted):
n = int(input())
s = str(input())
l = []
for x in s:
    if x not in l:
        l.append(x)
ans = 1
for x in l:
    ans = ans*(s.count(x)+1)
ans -= 1
ans = ans%(10**9 + 7)
print(ans)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
s = input()

mod = 10**9+7

scnt = Counter(s).most_common()
ans = 1

for i in range(len(scnt)):
    ans = ans*(scnt[i][1]+1)%mod
ans = (ans - 1 + mod)%mod


Failing test case input:
4
edab

Expected output:
15


Actual output:

Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
s = input()

mod = 10**9+7

scnt = Counter(s).most_common()
ans = 1

for i in range(len(scnt)):
    ans = ans*(scnt[i][1]+1)%mod
ans = (ans - 1 + mod)%mod
print(ans)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input().split())
import collections
s = collections.Counter(s)
s = s.most_common()
ans = 1
for i in s:
  ans *= i[1]
  
print(ans-1)
  

Failing test case input:
5
baaba

Expected output:
11


Actual output:
0


Fixed submission (verdict: Accepted):
n = input()
s = list(input())
import collections
s = collections.Counter(s)
s = s.most_common()
ans = 1
for i in s:
  ans *= i[1]+1
  
print((ans-1)%1000000007)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input().split()
cnt = 1
L = list(set(S))
for k in L:
  cnt *= (S.count(k) + 1)
print(cnt % (10 ** 9 + 7))

Failing test case input:
3
abb

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
N = input()
S = input()
L = list(set(S))
cnt = 1
for k in L:
  cnt *= (S.count(k) + 1)
print((cnt - 1) % (10**9 + 7))
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
str_dict = {}

for s in S:
    if s not in str_dict:
        str_dict[s] = 1
    else:
        str_dict[s] = str_dict[s] + 1

single_char = {k: v for k, v in str_dict.items() if v == 1}
multiple_char = {k: v for k, v in str_dict.items() if v != 1}
single_char_num = len(single_char)

base_permutation = 2 ** single_char_num - 1

all_permutation = base_permutation + 1
for v in multiple_char.values():
    all_permutation = all_permutation * (v + 1)
all_permutation = all_permutation - 1

print(all_permutation % (10 ^ 9 + 7))

Failing test case input:
5
bdacf

Expected output:
31


Actual output:
5


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
str_dict = {}

for s in S:
    if s not in str_dict:
        str_dict[s] = 1
    else:
        str_dict[s] = str_dict[s] + 1

single_char = {k: v for k, v in str_dict.items() if v == 1}
multiple_char = {k: v for k, v in str_dict.items() if v != 1}
single_char_num = len(single_char)

base_permutation = 2 ** single_char_num % (10 ** 9 + 7)

all_permutation = base_permutation
for v in multiple_char.values():
    all_permutation = all_permutation * (v + 1)
all_permutation = all_permutation - 1

print(all_permutation % (10 ** 9 + 7))

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=list(input())
ans=0
mod=10**9+7
z=list(set(s))
m=len(z)
for i in range(m):
    ans+=s.count(z[i])*(pow(2,m-1,mod))%mod
print((ans-m+1)%mod)

    


Failing test case input:
5
aabbb

Expected output:
11


Actual output:
9


Fixed submission (verdict: Accepted):
n=int(input())
s=list(input())
mod=10**9+7
z=list(set(s))
ans=1

m=len(z)
for i in range(m):   
    ans*=(s.count(z[i])+1)%mod
    ans=ans%mod
print((ans-1)%mod)
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]




from collections import Counter
N = ii()
S = input()
l = Counter(S)
mod = 10**9+7

if len(l) == 1:
    print('1')
    exit()

ans = 1
for v in l.values():
    ans *= (v + 1)
    ans %= mod

print((ans-1)%mod)

Failing test case input:
3
aaa

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]




from collections import Counter
N = ii()
S = input()
l = Counter(S)
mod = 10**9+7

if len(l) == 1:
    print(N)
    exit()

ans = 1
for v in l.values():
    ans *= (v + 1)
    ans %= mod

print((ans-1) % mod)

Problem: p03095
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = input()
count = [0]*26
for i in s:
    count[ord(i)-ord("a")] += 1
mod = 10**9+7
ans = 1
for i in count:
    ans *= (i+1)
    ans %= mod
print(ans)

Failing test case input:
5
abbbb

Expected output:
9


Actual output:
10


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
count = [0]*26
for i in s:
    count[ord(i)-ord("a")] += 1
mod = 10**9+7
ans = 1
for i in count:
    ans *= (i+1)
    ans %= mod
print(ans-1)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

D = {}
for s in S :
    if s not in D :
        D[s] = 1
    else :
        D[s] += 1

L = list(D.values())
ans = 1
for i in range(len(L)) :
    if L[i] == 1 :
        ans *= 2
    else :
        ans *= (2**L[i]-1)
ans -= 1
ans %= (10**9+7)
print(ans)

Failing test case input:
5
bbbba

Expected output:
9


Actual output:
29


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

D = {}
for s in S :
    if s not in D :
        D[s] = 1
    else :
        D[s] += 1

L = sorted(list(D.values()))

ans = 1
if N == 1 :
    ans = 1
elif len(L) == 1 :
    ans = L[0]
else :
    for i in range(len(L)) :
        ans *= (1+L[i])
        ans %= (10**9+7)
    ans -= 1
ans %= (10**9+7)
print(ans)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
ret=1
for i in range(97, 97+26):
  x=s.count(chr(i))
  ret*=x+1
print(ret-1)

Failing test case input:
5
abbba

Expected output:
11


Actual output:
0


Fixed submission (verdict: Accepted):
n=input()
s=input()
ret=1
for i in range(97, 97+26):
  x=s.count(chr(i))
  ret*=x+1
  ret%=1000000007
print((ret-1)%1000000007)
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
m=list(set(s))
ans=1
for i in m:
    ans*=s.count(i)-1
print((ans-1)%(10**9+7))

Failing test case input:
5
bbcbb

Expected output:
9


Actual output:
1000000006


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
m=list(set(s))
ans=1
for i in m:
    ans*=s.count(i)+1
print((ans-1)%(10**9+7))

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=list(input())
a=[0]*N
for i in range(N):
    a[i]=ord(S[i])-96
from collections import Counter
b=Counter(a)
c=b.most_common()
if c[0][1]>=2:
    print(2**(N-1)+1)
else:
    print(2**N-1)

Failing test case input:
5
cbaaa

Expected output:
15


Actual output:
17


Fixed submission (verdict: Accepted):
N=int(input())
S=list(input())
a=[0]*N
for i in range(N):
    a[i]=ord(S[i])-96
from collections import Counter
b=Counter(a)
c=b.most_common()
ans=1
for i in range(len(c)):
    ans*=(c[i][1]+1)
print((ans-1)%(10**9+7))

Problem: p03095
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
s=list(input())
s.sort()
cnt=1
cnt_list=[]
if len(s)==1:
    print(1)
    exit()
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
        if i==n-2:
            cnt_list.append(cnt)
    else:
        cnt_list.append(cnt)
        cnt=1
        if i==n-2:
            cnt_list.append(1)
ans=1
print(cnt_list)
for i in range(len(cnt_list)):
    ans=ans*(cnt_list[i]+1)%(10**9+7)
print(ans-1)

Failing test case input:
4
bbbb

Expected output:
4


Actual output:
[4]
4


Fixed submission (verdict: Accepted):
n=int(input())
s=list(input())
s.sort()
cnt=1
cnt_list=[]
if len(s)==1:
    print(1)
    exit()
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
        if i==n-2:
            cnt_list.append(cnt)
    else:
        cnt_list.append(cnt)
        cnt=1
        if i==n-2:
            cnt_list.append(1)
ans=1
for i in range(len(cnt_list)):
    ans=ans*(cnt_list[i]+1)%(10**9+7)
print(ans-1)

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

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

cnt = Counter(S)
ans = 1
for i in cnt.values():
    ans *= (i + 1)
    print(i, ans)
print(ans-1)

Failing test case input:
4
cbcd

Expected output:
11


Actual output:
2 3
1 6
1 12
11


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

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

MOD = 10**9 + 7
cnt = Counter(S)
ans = 1
for i in cnt.values():
    ans *= (i + 1)
    ans %= MOD
print(ans-1)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,s=open(0);a=1
for c in set(s):a*=s.count(c)+1
print(~-a%(10**9+7))

Failing test case input:
3
cad

Expected output:
7


Actual output:
15


Fixed submission (verdict: Accepted):
n,s=open(0);a=1
for c in set(s.strip()):a*=s.count(c)+1
print(~-a%(10**9+7))
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=list(input())
a=[0]*N
for i in range(N):
    a[i]=ord(S[i])-96
from collections import Counter
b=Counter(a)
c=b.most_common()
ans=0
if c[0][1]>=2:
    print((2**(N-1)+1)%(10**9+7))
else:
    ans=1
    for i in range(len(c)):
        ans*=(c[i][1]+1)
    print((ans-1)%(10**9+7))

Failing test case input:
5
aabab

Expected output:
11


Actual output:
17


Fixed submission (verdict: Accepted):
N=int(input())
S=list(input())
a=[0]*N
for i in range(N):
    a[i]=ord(S[i])-96
from collections import Counter
b=Counter(a)
c=b.most_common()
ans=1
for i in range(len(c)):
    ans*=(c[i][1]+1)
print((ans-1)%(10**9+7))

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

MOD = 10**9+7

N = int(input())
s = input()
d = Counter(s)
print(d)
res = 1
for value in d.values():
  res *= value + 1
  res %= MOD
res -= 1
print(res)

Failing test case input:
5
abcba

Expected output:
17


Actual output:
Counter({'a': 2, 'b': 2, 'c': 1})
17


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

MOD = 10**9+7

N = int(input())
s = input()
d = Counter(s)
res = 1
for value in d.values():
  res *= value + 1
  res %= MOD
res -= 1
print(res)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
_=input()
S=input()


obj={}
L=[]
r=1
for i in S:
    if i in L:
        obj[i]+=1
        r=int(r*(1+1/(2**obj[i])))
    else:
        r*=2
        obj[i]=0
        L.append(i)

    if r>(10**9+7):
        r-=(10**9+7)
        
print(r-1)


Failing test case input:
5
aabbb

Expected output:
11


Actual output:
10


Fixed submission (verdict: Accepted):
N=int(input())
S=input()
R=""
L=[]
obj={}
for s in S:
    if s not in L:
        R+=s
        L.append(s)
        obj[s]=1
    else:
        obj[s]+=1

out=1
for a in obj.keys():
    out*=(obj[a]+1)
    if out>10**9+7:
        out=out%(10**9+7)
print(out-1)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=list(input())

mod=10**9+7
z=list(set(s))
m=len(z)
ans=pow(2,m,mod)-1
for i in range(m):
    
    ans+=(s.count(z[i])-1)*(pow(2,m-1,mod))%mod
print((ans)%mod)

    


Failing test case input:
5
baccb

Expected output:
17


Actual output:
15


Fixed submission (verdict: Accepted):
n=int(input())
s=list(input())
mod=10**9+7
z=list(set(s))
ans=1

m=len(z)
for i in range(m):   
    ans*=(s.count(z[i])+1)%mod
    ans=ans%mod
print((ans-1)%mod)
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
str_dict = {}

for s in S:
    if s not in str_dict:
        str_dict[s] = 1
    else:
        str_dict[s] = str_dict[s] + 1

single_char = {k: v for k, v in str_dict.items() if v == 1}
multiple_char = {k: v for k, v in str_dict.items() if v != 1}
single_char_num = len(single_char)

base_permutation = 2 ** single_char_num % (10 ** 9 + 7)
print(base_permutation)

all_permutation = base_permutation
for v in multiple_char.values():
    print(v)
    all_permutation = all_permutation * (v + 1)
    print(all_permutation)
all_permutation = all_permutation - 1

print(all_permutation % (10 ** 9 + 7))

Failing test case input:
4
edaa

Expected output:
11


Actual output:
4
2
12
11


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
str_dict = {}

for s in S:
    if s not in str_dict:
        str_dict[s] = 1
    else:
        str_dict[s] = str_dict[s] + 1

single_char = {k: v for k, v in str_dict.items() if v == 1}
multiple_char = {k: v for k, v in str_dict.items() if v != 1}
single_char_num = len(single_char)

base_permutation = 2 ** single_char_num % (10 ** 9 + 7)

all_permutation = base_permutation
for v in multiple_char.values():
    all_permutation = all_permutation * (v + 1)
all_permutation = all_permutation - 1

print(all_permutation % (10 ** 9 + 7))

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import groupby as gb
n,s=open(0)
n=int(n)
s=sorted(s)
ans=1
mod=10**9+7
for i,x in gb(s):
  ans=ans*(len(list(x))+1)%mod
print(ans-1)

Failing test case input:
4
ebbb

Expected output:
7


Actual output:
15


Fixed submission (verdict: Accepted):
from itertools import groupby as gb
n=int(input())
s=sorted(input())
ans=1
mod=10**9+7
for i,x in gb(s):
  ans=ans*(len(list(x))+1)%mod
print(ans-1)

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import factorial

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

D = {}
for s in S :
    if s not in D :
        D[s] = 1
    else :
        D[s] += 1

L = list(D.values())
ans = 1
for i in range(len(L)) :
    if L[i] == 1 :
        ans *= 2
    else :
        ans *= (2**L[i]-1)
ans -= 1
print(ans)

Failing test case input:
5
babbb

Expected output:
9


Actual output:
29


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

D = {}
for s in S :
    if s not in D :
        D[s] = 1
    else :
        D[s] += 1

L = sorted(list(D.values()))

ans = 1
if N == 1 :
    ans = 1
elif len(L) == 1 :
    ans = L[0]
else :
    for i in range(len(L)) :
        ans *= (1+L[i])
        ans %= (10**9+7)
    ans -= 1
ans %= (10**9+7)
print(ans)
Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
N=int(stdin.readline().rstrip())
S=(stdin.readline().rstrip())
S=list(S)
subete=2**N-1
sa=N-len(set(S))
sasa=2**len(set(S))-1
ans=subete-sa*sasa
print(ans%(10**9+7))

Failing test case input:
4
eabb

Expected output:
11


Actual output:
8


Fixed submission (verdict: Accepted):
from sys import stdin
N=int(stdin.readline().rstrip())
S=(stdin.readline().rstrip())
S=list(S)
ans=1
for i in set(S):
    ans=ans*(S.count(i)+1)
ans-=1
print(ans%(10**9+7))

Problem: p03095
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
Mod = 10**9+7
n = int(input())
s = input()
k = 1
for i in range(97,97+26):
  k = (k * s.count(chr(i))+1)%Mod
print((k-1)%Mod)

Failing test case input:
5
bbbba

Expected output:
9


Actual output:
0


Fixed submission (verdict: Accepted):
Mod = 10**9+7
n = int(input())
s = input()
k = 1
for i in range(97,97+26):
  k = (k * (s.count(chr(i))+1))%Mod
print((k-1)%Mod)
Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a,b=map(int,input().split())
print(int(a/b),a%b,a/b)


Failing test case input:
-39 5

Expected output:
-8 1 -7.800000


Actual output:
-7 1 -7.8


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
print(a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())
print(f'{a/b}')
print(f'{a%b}')
print(f'{a/b:.8f}')



Failing test case input:
-3 -10

Expected output:
0 -3 0.300000


Actual output:
0.3
-3
0.30000000


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
print(f'{a
print(f'{a%b}')
print(f'{a/b:.8f}')

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
x, y = map(int, input().split())
print ('{} {} {}'.format(x+y, x%y, x/y))


Failing test case input:
-35 3

Expected output:
-12 1 -11.666667


Actual output:
-32 1 -11.666666666666666


Fixed submission (verdict: Accepted):
x, y = map(int, input().split())
print ('{} {} {:10.20f}'.format(x

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())
print("%d %d %f"%((a+b), (a%b), (a/b)))

Failing test case input:
-21 5

Expected output:
-5 4 -4.200000


Actual output:
-16 4 -4.200000


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
print("%d %d %f"%((a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a,b=map(int,input().split())
print('{} {} {}'.format(int(a/b),a%b,a/b))


Failing test case input:
-39 5

Expected output:
-8 1 -7.800000


Actual output:
-7 1 -7.8


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
print('{0} {1} {2:.10f}'.format(a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())
print(f'{a/b}')
print(f'{a%b}')
print(f'{a/b:.5f}')



Failing test case input:
11 26

Expected output:
0 11 0.423077


Actual output:
0.4230769230769231
11
0.42308


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
print(f'{a
print(f'{a%b}')
print(f'{a/b:.8f}')

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
ab = input()
ab_num = ab.split()
a = int(ab_num[0])
b = int(ab_num[1])
d = a 
r = a % b
f = a / b
print(d,r,round(f))

Failing test case input:
-16 3

Expected output:
-6 2 -5.333333


Actual output:
-16 2 -5


Fixed submission (verdict: Accepted):
ab = input()
ab_num = ab.split()
a = int(ab_num[0])
b = int(ab_num[1])
print(a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a,b = map(int,input().split())
print('{},{},{:.5f}'.format(int(a/b),a%b,a/b))

Failing test case input:
-2 14

Expected output:
-1 12 -0.142857


Actual output:
0,12,-0.14286


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
print('{} {} {:.5f}'.format(a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
x, y = map(int, input().split())

print(int(x/y), x%y, x/y)




Failing test case input:
-2 14

Expected output:
-1 12 -0.142857


Actual output:
0 12 -0.14285714285714285


Fixed submission (verdict: Accepted):
x, y = map(int, input().split())

print(x
Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
import math

[a, b] = map(int, input().split())

aba = math.floor(a / b)
abb = (a % b)
abc = (a / b)

print('{} {} {}'.format(aba, abb, abc))

Failing test case input:
-3 -10

Expected output:
0 -3 0.300000


Actual output:
0 -3 0.3


Fixed submission (verdict: Accepted):
[a, b] = map(int, input().split())

aba = (a 
abb = (a % b)
abc = (a / b)

print('{0} {1} {2:f}'.format(aba, abb, abc))

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
ab = input()
ab_num = ab.split()
a = int(ab_num[0])
b = int(ab_num[1])
d = a 
r = a % b
f = a / b
print(d,r,f)

Failing test case input:
-39 5

Expected output:
-8 1 -7.800000


Actual output:
-39 1 -7.8


Fixed submission (verdict: Accepted):
ab = input()
ab_num = ab.split()
a = int(ab_num[0])
b = int(ab_num[1])
print(a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a, b = list(map(int, input().split()))

print("{0} {1} {2}".format(a, b, format(a / b, '.5f')))

Failing test case input:
-14 5

Expected output:
-3 1 -2.800000


Actual output:
-14 5 -2.80000


Fixed submission (verdict: Accepted):
a, b = list(map(int, input().split()))

print("{0} {1} {2}".format(a

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):
a,b = map(int,input().split())
d,r = divmod(a,b)
print(d,r,a/b)

Failing test case input:
-35 3

Expected output:
-12 1 -11.666667


Actual output:
-12 1 -11.666666666666666


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
d,r = divmod(a,b)
print("{} {} {:.6f}".format(d,r,a/b))

Problem: p02399
Buggy submission (Python3, verdict: Wrong Answer):

a,b = map(int, input().split())
a1,b2 = float(a),float(b)
print(f"{a/b} {a%b} {a1/b2}")


Failing test case input:
-21 5

Expected output:
-5 4 -4.200000


Actual output:
-4.2 4 -4.2


Fixed submission (verdict: Accepted):

a,b = map(int, input().split())
a1,b2 = float(a),float(b)
print(f"{a
Problem: p03791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
a=b=1
for r in input().split():
    a*=b%(10**9+7)
    if b*2<eval(r+'+2'):b+=1
print(a)

Failing test case input:
13
4 14 4 9 10 12 14 15 16 18 20 65 22

Expected output:
437004793


Actual output:
1437004800


Fixed submission (verdict: Accepted):
input()
a=b=1
for r in input().split():
    a=a*b%(10**9+7)
    if b*2<eval(r+'+2'):b+=1
print(a)

Problem: p03791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
a=b=1
for r in input().split():
    a*=b%(10**+7)
    if b*2<eval(r+'+2'):b+=1
print(a)

Failing test case input:
13
3 16 8 9 10 19 12 24 16 35 20 21 6

Expected output:
353011179


Actual output:
3353011200


Fixed submission (verdict: Accepted):
input()
a=b=1
for r in input().split():
    a=a*b%(10**9+7)
    if b*2<eval(r+'+2'):b+=1
print(a)
Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
c = Counter(a)
if len(c)>2: print("No")
elif len(c)==1:
	if a[0]+1==n or n>=2*a[0]: print("Yes")
	else: print("No")
elif c[a[-1]]>=2*a[0]: print("Yes")
else: print("No")

Failing test case input:
3
4 -1 -1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
c = Counter(a)
if len(c)>2 or a[0]+1<a[-1]: print("No")
elif len(c)==1:
	if a[0]+1==n or n>=2*a[0]: print("Yes")
	else: print("No")
else:
	x,y = c[a[-1]],c[a[0]]
	if y+1<=a[-1]<=x
	else: print("No")

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

A.sort()
v = A[-1] - A[0]
if v >= 2:
    print('No')
elif v == 1:
    if A[0]*2 <= n or A[0] == n-1:
        print('Yes')
    else:
        print('No')
else:
    x = A.index(A[-1])
    y = A[0] - x + 1
    if y > 0 and y*2 <= n-x:
        print('Yes')
    else:
        print('No')


Failing test case input:
4
2 2 2 2

Expected output:
Yes

Actual output:
No


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

A.sort()
v = A[-1] - A[0]
if v >= 2:
    print('No')
elif v == 0:
    if A[0]*2 <= n or A[0] == n-1:
        print('Yes')
    else:
        print('No')
else:
    x = A.index(A[-1])
    y = A[0] - x + 1
    if y > 0 and y*2 <= n-x:
        print('Yes')
    else:
        print('No')

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
m=map(int,input().split())
a=[int(i) for i in m]
d=max(a)-min(a)
if d>1:
    ans=False
elif d==0:
    if max(a)<len(a):
        ans=True
    else:
        ans=False
else:
    max_num=a.count(max(a))
    min_num=a.count(min(a))
    dif=max(a)-min_num
    if (min_num<max(a)):
        if dif*2<=max_num:
            ans=True
        else:
            ans=False
    else:
        ans=False
if ans:
    print("Yes")
else:
    print("No")
        


Failing test case input:
4
2 2 2 2

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
n=input()
m=map(int,input().split())
a=[int(i) for i in m]
d=max(a)-min(a)
if d>1:
    ans=False
elif d==0:
    if (max(a)==len(a)-1 or max(a)*2<=len(a)):
        ans=True
    else:
        ans=False
else:
    max_num=a.count(max(a))
    min_num=a.count(min(a))
    dif=max(a)-min_num
    if (min_num<max(a) and dif*2<=max_num):
            ans=True
    else:
        ans=False
        
if ans:
    print("Yes")
else:
    print("No")
Problem: p03688
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
ca=dict(Counter(a))
if len(ca.keys())>2:
  print('No')
elif len(ca.keys())==1:
  if 2*a[0]<=n:
    print('Yes')
  else:
    print('No')
else:
  c=max(ca.keys())
  d=min(ca.keys())
  if 2*(ca[c]-1)<=n-1 and ca[d]==1:
    print('Yes')
  else:
    print('No')



Failing test case input:
5
3 4 3 4 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
ca=dict(Counter(a))
if len(ca.keys())>2:
  print('No')
elif len(ca.keys())==1:
  if 2*a[0]<=n or a[0]==n-1:
    print('Yes')
  else:
    print('No')
else:
  c=max(ca.keys())
  d=min(ca.keys())
  
  
  if c!=d+1:
    print('No')
  else:
    tmp=c-ca[d]
    
    if tmp>0 and 2*tmp<=ca[c]:
      print('Yes')
    else:
      print('No')

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
a = [int(item) for item in input().split()]

cnt = Counter(a)
if len(cnt) == 1:
    if 1 in cnt or n-1 in cnt:
        print("Yes")
    else:
        print("No")
elif len(cnt) == 2:
    color_num = max(cnt)
    
    if color_num - 1 not in cnt:
        print("No") 
    if cnt[color_num-1] <= color_num - 1 and cnt[color_num-1] >= 2*color_num - n:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Failing test case input:
3
4 -1 -1

Expected output:
No


Actual output:
No
No


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = [int(item) for item in input().split()]

cnt = Counter(a)
if len(cnt) == 1:
    color_num = max(cnt)
    if color_num == n-1 or color_num <= n 
        print("Yes")
    else:
        print("No")
elif len(cnt) == 2:
    color_num = max(cnt)
    
    if color_num - 1 not in cnt:
        print("No") 
        exit()
    if cnt[color_num-1] <= color_num - 1 and cnt[color_num-1] >= 2*color_num - n:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Problem: p03688
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
amax=max(a)
amin=min(a)
if amax-amin>=2:
    print("No")
    exit()
elif amax==amin:
    if amax==n-1:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
ac=a.count(amin)
ad=n-ac
if (amax-ac)*2<=ad:
    print("Yes")
else:
    print("No")

Failing test case input:
5
3 4 3 3 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
amax=max(a)
amin=min(a)
if amax-amin>=2:
    print("No")
    exit()
elif amax==amin:
    if amax==n-1 or amax*2<=n:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
ac=a.count(amin)
ad=n-ac
if amin-ac<0:
    print("No")
    exit()

if (amax-ac)*2<=ad:
    print("Yes")
else:
    print("No")
Problem: p03688
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
mx = max(a)
c = mx + 0
b = 0
s = 0
for i in range(N):
  if abs(a[i] - mx) > 1:
    print("No")
    exit(0)
  if a[i] < mx:
    c = a[i] + 1
    s += 1
  else: b += 1
if c > b: print("No")
elif b % 2 and (c != N - 1): print("No")
else: print("Yes")

Failing test case input:
5
3 4 3 4 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
mx = max(a)
mn = min(a)
c = mx + 0
b = 0
s = 0
if mx == mn and (mx != N - 1):
  mn -= 1
if mx >= N:
  print("No")
  exit(0)
for i in range(N):
  if abs(a[i] - mx) > 1:
    print("No")
    exit(0)
  if a[i] == mn:
    c = a[i] + 1
    s += 1
  else:
    b += 1
if s >= c and (b != 0 and s != 0):
  print("No")
  exit(0)
elif s > c:
  print("No")
  exit(0)
if b == 1:
  print("No")
  exit(0)
if b 
  print("No")
else: print("Yes")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()

count=a.index(a[N-1])
if count+1<=a[N-1] and a[N-1]<=count+int((N-a[count])/2):
  print("Yes")
else:
  print("No")

Failing test case input:
5
3 4 3 4 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()

count=a.index(a[N-1])
if count+1<=a[N-1] and a[N-1]<=count+int((N-count)/2):
  print("Yes")
else:
  print("No")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
if max(a)-min(a)>1:
    print("No")
else:
    b=a.count(max(a))
    c=n-b
    if c==0:
        if max(a)==n-1 or max(a)>=2*b:
            print("Yes")
        else:
            print("No")
    else:
        if c<max(a) and 2*(max(a)-c)<=b:
            print("Yes")
        else:
            print("No")

Failing test case input:
4
2 2 2 2

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
if max(a)-min(a)>1:
    print("No")
else:
    b=a.count(max(a))
    c=n-b
    if c==0:
        if max(a)==n-1 or n>=2*max(a):
            print("Yes")
        else:
            print("No")
    else:
        if c<max(a) and 2*(max(a)-c)<=b:
            print("Yes")
        else:
            print("No")
Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
L = list(map(int, input().split()))
ans = "Yes"

L_max = max(L)
L_min = min(L)

if L_max - L_min >= 2:
    ans = "No"
else:
    num_alone = L.count(L_min)
    not_alone_L = [v-num_alone for v in L if v == L_max]
    if not_alone_L[0] > 0 and len(not_alone_L) < not_alone_L[0]*2:
        ans = "No"
print(ans)


Failing test case input:
5
3 4 3 3 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
L = list(map(int, input().split()))
ans = "Yes"

L_max = max(L)
L_min = min(L)

if L_max - L_min >= 2:
    ans = "No"
elif L_max == L_min:
    if not(N >= L[0]*2 or L[0] == N-1):
        ans = "No"
else:
    num_alone = L.count(L_min)
    not_alone_L = [v-num_alone for v in L if v == L_max]
    if not_alone_L[0] <= 0 or len(not_alone_L) < not_alone_L[0]*2:
        ans = "No"
print(ans)

Problem: p03688
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
min_,max_=min(A),max(A)

def f(n,k):
    return n%k==2 if k>0 else False

ans=None
if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    k=max_
    nk=len([a for a in A if a==max_])
    nk1=N-nk
    ans=f(nk,k-nk1)
else:
    ans=f(N,min_)
print("Yes" if ans is True else "No")


Failing test case input:
4
2 2 2 2

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
min_,max_=min(A),max(A)

def f(n,k):
    return n%k==0 if k>0 else False

ans=None
if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    k=max_
    nk=len([a for a in A if a==max_])
    nk1=N-nk
    ans=f(nk,k-nk1)
else:
    ans=f(N,min_) or f(N,min_+1)

if ans is True:
    print("Yes")
else:
    print("No")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
import collections
l1 = collections.Counter(a).most_common()
l1.sort()
if len(l1) == 1:
    if l1[0][0] * 2 <= n or l1[0][0] == n - 1:
        print("Yes")
    else:
        print("No")
else:
    if n - l1[0][1] >= (l1[1][0] - l1[0][1]) * 2 and l1[1][0] - l1[0][1] > 0:
        print("Yes")
    else:
        print("No")

Failing test case input:
3
3 -4 2

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
import collections
l1 = collections.Counter(a).most_common()
l1.sort()
if len(l1) > 2:
    print("No")
elif len(l1) == 1:
    if l1[0][0] * 2 <= n or l1[0][0] == n - 1:
        print("Yes")
    else:
        print("No")
else:
    if l1[1][0] - l1[0][0] > 1:
        print("No")
    elif l1[1][1] >= (l1[1][0] - l1[0][1]) * 2 and l1[1][0] > l1[0][1]:
        print("Yes")
    else:
        print("No")
Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

res = True
maxvar = max(A)

x = 0
y = 0

for i in range(N):
    if A[i] == maxvar:
        x += 1
    elif A[i] == maxvar - 1:
        y += 1
    else:
        res = False
        break

if (maxvar - y) * 2 + y > N or (maxvar - y) * 2 <= 0:
    res = False

if maxvar == N - 1 and y == 0:
    res = True

print('Yes' if res else 'No')

Failing test case input:
3
-1 -2 2

Expected output:
No


Actual output:
Yes


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

res = True
maxvar = max(A)

x = 0
y = 0

for i in range(N):
    if A[i] == maxvar:
        x += 1
    elif A[i] == maxvar - 1:
        y += 1
    else:
        res = False
        break
else:
    if (maxvar - y) * 2 + y > N or (maxvar - y) * 2 <= 0 or y >= maxvar:
        res = False

    if maxvar == N - 1 and y == 0:
        res = True

print('Yes' if res else 'No')

Problem: p03688
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
mx = max(a)
c = mx + 0
b = 0
s = 0
if mx >= N:
  print("No")
  exit(0)
for i in range(N):
  if abs(a[i] - mx) > 1:
    print("No")
    exit(0)
  if a[i] < mx:
    c = a[i] + 1
    s += 1
  else: b += 1
if c > b: print("No")
elif b % 2 and (c != N - 1): print("No")
else: print("Yes")

Failing test case input:
5
3 4 3 4 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
mx = max(a)
mn = min(a)
c = mx + 0
b = 0
s = 0
if mx == mn and (mx != N - 1):
  mn -= 1
if mx >= N:
  print("No")
  exit(0)
for i in range(N):
  if abs(a[i] - mx) > 1:
    print("No")
    exit(0)
  if a[i] == mn:
    c = a[i] + 1
    s += 1
  else:
    b += 1
if s >= c and (b != 0 and s != 0):
  print("No")
  exit(0)
elif s > c:
  print("No")
  exit(0)
if b == 1:
  print("No")
  exit(0)
if b 
  print("No")
else: print("Yes")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
k=len(set(A))
if k==1:
  if A[0]==n-1 or 2*A[0]<=n:
    print("Yes")
  else:
    print("No")
else:
  ma=min(A)
  ct=0
  for a in A:
    if a==ma:
      ct+=1
  if (ma+1-ct)*2<=n-ct:
    print("Yes")
  else:
    print("No")

Failing test case input:
4
3 5 1 2

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
k=len(set(A))
if k==1:
  if A[0]==n-1 or 2*A[0]<=n:
    print("Yes")
  else:
    print("No")
elif k>2:
  print("No")
else:
  ma=min(A)
  Ma=max(A)
  if Ma-ma>1:
    print("No")
  else:
    ct=0
    for a in A:
      if a==ma:
        ct+=1
    if ma+1>ct and (ma+1-ct)*2<=n-ct:
      print("Yes")
    else:
      print("No")
Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
a = [int(item) for item in input().split()]

cnt = Counter(a)
if len(cnt) == 1:
    if 1 in cnt or n-1 in cnt:
        print("Yes")
    else:
        print("No")
elif len(cnt) == 2:
    color_num = max(cnt)
    
    if color_num - 1 not in cnt:
        print("No") 
        exit()
    if cnt[color_num-1] <= color_num - 1 and cnt[color_num-1] >= 2*color_num - n:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Failing test case input:
4
2 2 2 2

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = [int(item) for item in input().split()]

cnt = Counter(a)
if len(cnt) == 1:
    color_num = max(cnt)
    if color_num == n-1 or color_num <= n 
        print("Yes")
    else:
        print("No")
elif len(cnt) == 2:
    color_num = max(cnt)
    
    if color_num - 1 not in cnt:
        print("No") 
        exit()
    if cnt[color_num-1] <= color_num - 1 and cnt[color_num-1] >= 2*color_num - n:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
fewer = 0
m = min(a)
M = max(a)
if M - m >= 2:
  print("No")
else:
  if m == M:
    if m == n-1:
      print("Yes")
    else:
      if m <= n/2:
        print("Yes")
      else:
        print("No")
  else:
    for i in range(n):
      if a[i] == m:
        fewer += 1
    more = n - fewer
    num_remain = M - fewer
    if num_remain <= more/2:
      print("Yes")
    else:
      print("No")

Failing test case input:
5
3 4 3 3 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
m = min(a)
M = max(a)
num_m = 0
num_M = 0
if M - m >= 2:
  print("No")
else:
  if m == M:
    if m == n-1:
      print("Yes")
    else:
      if m <= n/2:
        print("Yes")
      else:
        print("No")
  else:
    for i in range(n):
      if a[i] == m:
        num_m += 1
    more = n - num_m
    num_remain = M - num_m
    if 0 < num_remain <= more/2:
      print("Yes")
    else:
      print("No")
Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
lists=list(map(int,input().split()))
from collections import Counter
a=dict(Counter(lists))
if len(a)==1:
    if n>=lists[0]*2 or lists[0]==n-1:
        print("Yes")
    else:
        print("No")
    
elif len(a)==2:
    P=list(a.keys())
    Q=list(a.values())
    x,y=min(P),max(P) 
    c,d=a[x],a[y]
    if 2*y-c<=n and c>0 and y>c and d+c==y:
        print("Yes")
    else:
        print("No")

    
else:
    print("No")

Failing test case input:
5
3 4 3 4 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
lists=list(map(int,input().split()))
from collections import Counter
a=dict(Counter(lists))
if len(a)==1:
    if n>=lists[0]*2 or lists[0]==n-1:
        print("Yes")
    else:
        print("No")
    
elif len(a)==2:
    P=list(a.keys())
    Q=list(a.values())
    x,y=min(P),max(P) 
    c,d=a[x],a[y]
    if 2*y-c<=n and c>0 and y>c and y-x==1:
        print("Yes")
    else:
        print("No")

    
else:
    print("No")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())

a=list(map(int,input().split()))
if len(set(a))==1:
    if n>=2*a[0] or n-1==a[0]:print("Yes")
    else:print("No")
elif len(set(a))>=3:print("No")
else:
    s,S=sorted(list(set(a)))
    if 2*n-a.count(s)<=S:print("Yes")
    else:print("No")

Failing test case input:
3
4 -1 -1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())

a=list(map(int,input().split()))
if len(set(a))==1:
    if n>=2*a[0] or n-1==a[0]:print("Yes")
    else:print("No")
elif len(set(a))>=3:print("No")
else:
    s,S=sorted(list(set(a)))
    k=a.count(s)
    if S==s+1 and 2*S-n<=k and S>k:print("Yes")
    else:print("No")

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
k=len(set(A))
if k==1:
  if A[0]==n-1 or 2*A[0]<=n:
    print("Yes")
  else:
    print("No")
else:
  ma=min(A)
  ct=0
  for a in A:
    if a==ma:
      ct+=1
  if ct>1:
    print("No")
  else:
    if ma*2<=n-1:
      print("Yes")
    else:
      print("No")




Failing test case input:
4
1 2 -1 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
k=len(set(A))
if k==1:
  if A[0]==n-1 or 2*A[0]<=n:
    print("Yes")
  else:
    print("No")
elif k>2:
  print("No")
else:
  ma=min(A)
  Ma=max(A)
  if Ma-ma>1:
    print("No")
  else:
    ct=0
    for a in A:
      if a==ma:
        ct+=1
    if ma+1>ct and (ma+1-ct)*2<=n-ct:
      print("Yes")
    else:
      print("No")
Problem: p03688
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
ca=dict(Counter(a))
if len(ca.keys())>2:
  print('No')
elif len(ca.keys())==1:
  if 2*a[0]<=n:
    print('Yes')
  else:
    print('No')
else:
  c=max(ca.keys())
  d=min(ca.keys())
  if 2*(c-1)<=n-1 and ca[d]==1:
    print('Yes')
  else:
    print('No')



Failing test case input:
5
3 4 3 4 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
ca=dict(Counter(a))
if len(ca.keys())>2:
  print('No')
elif len(ca.keys())==1:
  if 2*a[0]<=n or a[0]==n-1:
    print('Yes')
  else:
    print('No')
else:
  c=max(ca.keys())
  d=min(ca.keys())
  
  
  if c!=d+1:
    print('No')
  else:
    tmp=c-ca[d]
    
    if tmp>0 and 2*tmp<=ca[c]:
      print('Yes')
    else:
      print('No')

Problem: p03688
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ma, mi = max(a), min(a)
if ma - mi > 1:
    print(-1)
elif ma - mi == 1:
    z, o = 0, 0
    for i in range(n):
        if a[i] == ma - 1:
            z += 1
        else:
            o += 1
    if z < ma and ma - z <= o / 2:
        print("Yes")
    else:
        print("No")
else:
    if ma == n - 1 or ma <= n / 2:
        print("Yes")
    else:
        print("No")

Failing test case input:
4
6 5 1 2

Expected output:
No


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
ma, mi = max(a), min(a)
if ma - mi > 1:
    print("No")
elif ma - mi == 1:
    z, o = 0, 0
    for i in range(n):
        if a[i] == ma - 1:
            z += 1
        else:
            o += 1
    if z < ma and ma - z <= o / 2:
        print("Yes")
    else:
        print("No")
else:
    if ma == n - 1 or ma <= n / 2:
        print("Yes")
    else:
        print("No")

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




m = len(set(a))
k = min(a)
ans = (
    'Yes' if m == 1 and (N >= 2 * k or N == k + 1) or
    m == 2 and 2 * (k + 1) - N <= sum(x == k for x in a) <= k else
    'No'
)

print(ans)


Failing test case input:
4
2 4 4 2

Expected output:
No


Actual output:
Yes


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




L = min(a)
R = max(a)
ans = (
    'Yes' if R - L == 0 and (N >= 2 * L or N == L + 1) or
    R - L == 1 and 2 * (L + 1) - N <= sum(x == L for x in a) <= L else
    'No'
)

print(ans)