ZhenlongDai/ACPR huggingface dataset:
Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
if 400<=x<599:
    print(8)
elif 600<=x<799:
    print(7)
elif 800<=x<999:
    print(6)
elif 1000<=x<1199:
    print(5)
elif 1200<=x<1399:
    print(4)
elif 1400<=x<1599:
    print(3)
elif 1600<=x<1799:
    print(2)
elif 1800<=x<1999:
    print(1)


Failing test case input:
599

Expected output:
8


Actual output:

Fixed submission (verdict: Accepted):
x=int(input())
if 400<=x<=599:
    print(8)
elif 600<=x<=799:
    print(7)
elif 800<=x<=999:
    print(6)
elif 1000<=x<=1199:
    print(5)
elif 1200<=x<=1399:
    print(4)
elif 1400<=x<=1599:
    print(3)
elif 1600<=x<=1799:
    print(2)
elif 1800<=x<=1999:
    print(1)

Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())

if x>=400 and x<=599:
    print(8)
elif x>=600 and x<=799:
    print(7)
elif x>=800 and x<=999:
    print(6)
elif x>=1000 and x<=1199:
    print(5)
elif x>=1200 and x<=1399:
    print(4)
elif x>=1300 and x<=1499:
    print(3)
elif x>=1500 and x<=1699:
    print(2)
elif x>=1600 and x<=1799:
    print(1)

Failing test case input:
1799

Expected output:
2


Actual output:
1


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

if x>=400 and x<=599:
    print(8)
elif x>=600 and x<=799:
    print(7)
elif x>=800 and x<=999:
    print(6)
elif x>=1000 and x<=1199:
    print(5)
elif x>=1200 and x<=1399:
    print(4)
elif x>=1400 and x<=1599:
    print(3)
elif x>=1600 and x<=1799:
    print(2)
elif x>=1800 and x<=1999:
    print(1)

Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
a=1800
b=1999
for i in range(7):
  if a<=x<=b:
    break
  else:
    a-=200
    b-=200
print(1+i)

Failing test case input:
570

Expected output:
8


Actual output:
7


Fixed submission (verdict: Accepted):
x=int(input())
a=1800
b=1999
for i in range(8):
  if a<=x<=b:
    break
  else:
    a-=200
    b-=200
print(1+i)

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


late_table = [
    [400, 8],
    [600, 7],
    [800, 6],
    [1000, 5],
    [1200, 4],
    [1400, 3],
    [1600, 2],
    [1800, 1]
]


def kyu(late):
    for i in late_table:
        if late < i[0]:
            return i[1] + 1


if __name__ == "__main__":
    late = int(input())
    print(kyu(late))


Failing test case input:
1815

Expected output:
1


Actual output:
None


Fixed submission (verdict: Accepted):


late_table = [
    [400, 8],
    [600, 7],
    [800, 6],
    [1000, 5],
    [1200, 4],
    [1400, 3],
    [1600, 2],
    [1800, 1]
]


def kyu(late):
    for i in late_table:
        if late < i[0]:
            return i[1] + 1
    return 1


if __name__ == "__main__":
    late = int(input())
    print(kyu(late))
Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())

if 400 <= N <= 599:
    print(8)
elif 600 <= N <= 799:
    print(7)
elif 800 <= N <= 999:
    print(6)
elif 1000 <= N <= 1199:
    print(5)
if 1200 <= N <= 1399:
    print(4)
elif 1400 <= N <= 1599:
    print(3)
elif 1600 <= N <= 1799:
    print(2)
else:
    print(1)










Failing test case input:
491

Expected output:
8


Actual output:
8
1


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

if 400 <= N <= 599:
    print(8)
elif 600 <= N <= 799:
    print(7)
elif 800 <= N <= 999:
    print(6)
elif 1000 <= N <= 1199:
    print(5)
elif 1200 <= N <= 1399:
    print(4)
elif 1400 <= N <= 1599:
    print(3)
elif 1600 <= N <= 1799:
    print(2)
else:
    print(1)

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



def kyu(x):
    if x <= 599:
        return 8
    elif x <= 799:
        return 7
    elif x <= 999:
        return 6
    elif x <= 1199:
        return 5
    elif x <= 1399:
        return 3
    elif x <= 1599:
        return 3
    elif x <= 1799:
        return 2
    else:
        return 1


def main():
    x = int(input())
    k = kyu(x)
    print(k)


if __name__ == '__main__':
    main()

Failing test case input:
1303

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):



def kyu(x):
    if x <= 599:
        return 8
    elif x <= 799:
        return 7
    elif x <= 999:
        return 6
    elif x <= 1199:
        return 5
    elif x <= 1399:
        return 4
    elif x <= 1599:
        return 3
    elif x <= 1799:
        return 2
    else:
        return 1


def main():
    x = int(input())
    k = kyu(x)
    print(k)


if __name__ == '__main__':
    main()

Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = int(input())

if 400 <= a <= 599:
  print("8")
if 600 <= a <= 799:
  print("8")
if 800 <= a <= 999:
  print("8")  
if 1000 <= a <= 1199:
  print("8")
if 1200 <= a <= 1399:
  print("8")
if 1400 <= a <= 1599:
  print("8")
if 1600 <= a <= 1799:
  print("8")
if 1800 <= a <= 1999:
  print("8")

Failing test case input:
1303

Expected output:
4


Actual output:
8


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

if 400 <= a <= 599:
    print("8")
if 600 <= a <= 799:
    print("7")
if 800 <= a <= 999:
    print("6")
if 1000 <= a <= 1199:
    print("5")
if 1200 <= a <= 1399:
    print("4")
if 1400 <= a <= 1599:
    print("3")
if 1600 <= a <= 1799:
    print("2")
if 1800 <= a <= 1999:
    print("1")
Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
if 400<=x<599:
  print(8)
elif 600<=x<799:
  print(7)
elif 800<=x<999:
  print(6)
elif 1000<=x<1199:
  print(5)
elif 1200<=x<1399:
  print(4)
elif 1400<=x<1599:
  print(3)
elif 1600<=x<1799:
  print(2)
else:
  print(1)

Failing test case input:
599

Expected output:
8


Actual output:
1


Fixed submission (verdict: Accepted):
x=int(input())
if 400<=x<600:
  print('8')
elif 600<=x<800:
  print('7')
elif 800<=x<1000:
  print('6')
elif 1000<=x<1200:
  print('5')
elif 1200<=x<1400:
  print('4')
elif 1400<=x<1600:
  print('3')
elif 1600<=x<1800:
  print('2')
else:
  print('1')

Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = int(input()) 

if 400 < s < 500:
  print("8")
elif  600 < s <799:
        print("7")
elif  800 < s <999:
        print("6")
elif  1000 < s <1199:
        print("5")
elif  1200 < s <1399:
        print("4")
elif  1400 < s <1599:
        print("3")
elif  1600 < s <1799:
        print("2")
elif  1800 < s <1999:
        print("1")
    
    
    
    

Failing test case input:
570

Expected output:
8


Actual output:

Fixed submission (verdict: Accepted):
s = int(input()) 
 
if 400 <= s <= 599:
  print("8")
elif  600 <= s <=799:
        print("7")
elif  800 <= s <=999:
        print("6")
elif  1000 <= s <=1199:
        print("5")
elif  1200 <= s <=1399:
        print("4")
elif  1400 <= s <=1599:
        print("3")
elif  1600 <= s <=1799:
        print("2")
elif  1800 <= s <=1999:
        print("1")

Problem: p02600
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
if 400<=x<599:
    print(8)
elif 600<=x<799:
    print(7)
elif 800<=x<1199:
    print(6)
elif 1200<=x<1399:
    print(5)
elif 1400<=x<1599:
    print(4)
elif 1600<=x<1799:
    print(2)
elif 1800<=x<1999:
    print(1)


Failing test case input:
1353

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
x=int(input())
if 400<=x<=599:
    print(8)
elif 600<=x<=799:
    print(7)
elif 800<=x<=999:
    print(6)
elif 1000<=x<=1199:
    print(5)
elif 1200<=x<=1399:
    print(4)
elif 1400<=x<=1599:
    print(3)
elif 1600<=x<=1799:
    print(2)
elif 1800<=x<=1999:
    print(1)
Problem: p03559
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import bisect

N= int(input())
a = map(int, input().split(" "))
b = map(int, input().split(" "))
c = map(int, input().split(" "))

a = sorted(a)
b = sorted(b)
c = sorted(c,reverse=True)

result = 0
for i in b:
    ta = bisect.bisect_left(a,i)
    tc = bisect.bisect_right(c,i)
    result += ta*(N-tc)
print(result)

Failing test case input:
6
-5 59 2 -1 -1 111
3 0 1 -4 -1 -1
76 15 0 0 -1 11

Expected output:
46


Actual output:
18


Fixed submission (verdict: Accepted):
import bisect

N= int(input())
a = map(int, input().split(" "))
b = map(int, input().split(" "))
c = map(int, input().split(" "))

a = sorted(a)
b = sorted(b)
c = sorted(c)

result = 0
for i in b:
    ta = bisect.bisect_left(a,i)
    tc = bisect.bisect_right(c,i)
    result += ta*(N-tc)
print(result)

Problem: p03559
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in b:
    x=bisect.bisect_left(a,i)
    y=bisect.bisect_right(c,i)
    ans+=x*(n-y)
print(ans)

Failing test case input:
6
4 43 290 -1 6 27
106 13 11 837 28 8
1103 700 5 8 14 460

Expected output:
69


Actual output:
42


Fixed submission (verdict: Accepted):
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
    x=bisect.bisect_left(a,i)
    y=bisect.bisect_right(c,i)
    ans+=x*(n-y)
print(ans)

Problem: p03559
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A = sorted(A)
B = sorted(B)
C = sorted(C)


import bisect as bis

BSC = [0]*N

for i in range (0, N):
	BSC[i] = N-bis.bisect_right(C, B[i])
    
for i in range (1, N):
	BSC[i] += BSC[i-1]

Failing test case input:
6
-1 59 2 -3 11 101
9 0 1 -1 0 2
74 27 1 -2 -1 924

Expected output:
41


Actual output:

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

A = sorted(A)
B = sorted(B)
C = sorted(C)


import bisect as bis

BSC = [0]*N
ASB = [0]*N

for i in range (0, N):
	BSC[i] = N-bis.bisect_right(C, B[i])

for i in range (0, N):
	ASB[i] = bis.bisect_right(B, A[i])
    
for i in range (1, N):
	BSC[N-1-i] += BSC[N-i]

count = 0
for i in range (0, N):
	if ASB[i] ==N:
		continue
	else:
		count+=BSC[ASB[i]]

print(count)
Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect

N = int(input())
A = sorted([int(i) for i in input().split(" ")])
B = sorted([int(i) for i in input().split(" ")])
C = sorted([int(i) for i in input().split(" ")])

ans = 0
for a in A:
    i = bisect.bisect_left(B, a)
    if i < len(B):
        for b in B[i:]:
            j = bisect.bisect_left(C, b)
            ans += len(C) - j

print(ans)

Failing test case input:
6
3 14 159 2 6 53
58 9 79 323 84 6
2643 383 2 79 50 288

Expected output:
87

Actual output:
97


Fixed submission (verdict: Accepted):
import bisect

N = int(input())
A = sorted([int(i) for i in input().split(" ")])
B = [int(i) for i in input().split(" ")]
C = sorted([int(i) for i in input().split(" ")])

ans = 0
for b in B:
    a = bisect.bisect_left(A, b) 
    c = N - bisect.bisect_right(C, b) 
    ans += a * c  

print(ans)

Problem: p03559
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import bisect
num=0
n=int(input())
top=sorted(list(map(int,input().split())))
mid=sorted(list(map(int,input().split())))
und=sorted(list(map(int,input().split())))
for i in mid:
    a=bisect.bisect_left(top,i)
    c=num-bisect.bisect_right(und,i)
    num+=a*c
print(num)


Failing test case input:
6
3 14 159 2 6 53
58 9 7 323 84 6
2643 383 2 79 50 430

Expected output:
93


Actual output:
-12387


Fixed submission (verdict: Accepted):
import sys
import bisect
input = sys.stdin.readline
num=0
n=int(input())
top=list(map(int,input().split()))
mid=list(map(int,input().split()))
und=list(map(int,input().split()))
top.sort()
mid.sort()
und.sort()
for i in mid:
    a=bisect.bisect_left(top,i)
    c=n-bisect.bisect_right(und,i)
    num+=a*c
print(num)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect

n = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
ans = 0
for i in range(n):
    b = bisect.bisect_left(B, C[i])
    a = bisect.bisect_left(A, B[min(b, n-1)])
    ans += a * b
print(ans)


Failing test case input:
6
20 4 0 0 2 2
1 10 22 1 92 -1
68 -1 1 4 1 -1

Expected output:
19


Actual output:
49


Fixed submission (verdict: Accepted):
import bisect

n = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
ans = 0
L = [0] * n
for i in range(n):
    a = bisect.bisect_left(A, B[i])
    L[i] = a
cum = [0] * (n + 1)
for i in range(n):
    cum[i+1] = cum[i] + L[i]
for i in range(n):
    b = bisect.bisect_left(B, C[i])
    ans += cum[b]
print(ans)
Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
count = 0
import bisect
for i in range(n):
    A = bisect.bisect(a,b[i]-1)
    B = bisect.bisect(c,b[i]+1)
    count += A*(n-B)
print(count)

Failing test case input:
3
0 0 0
2 2 2
3 1 1

Expected output:
9


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
count = 0
import bisect
for i in range(n):
    A = bisect.bisect_right(a,b[i]-1)
    C = bisect.bisect_left(c,b[i]+1)
    count += A*(n-C)
print(count)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort()
B.sort()
C.sort()
ans=0

for b in B: 
    s = bisect.bisect_left(A,b) 
    t = bisect.bisect_right(C,b) 
    print(s,N-t,s*(N-t))
    ans += s*(N-t)
   
print(ans)


Failing test case input:
6
-3 2 -1 -1 0 101
4 2 6 -9 0 -79
24 6 -6 -3 -4 -1

Expected output:
29


Actual output:
0 6 0
0 6 0
3 2 6
4 2 8
5 2 10
5 1 5
29


Fixed submission (verdict: Accepted):
import bisect

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort()
B.sort()
C.sort()
ans=0

for b in B: 
    s = bisect.bisect_left(A,b) 
    t = bisect.bisect_right(C,b) 
    
    ans += s*(N-t)
   
print(ans)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
ans = 0
for i in range(n):
    l = (bisect.bisect_left(a,b[i]))*(n-bisect.bisect_right(c,b[i]))
    ans += 1
print(ans)

Failing test case input:
6
1 14 93 -1 6 96
95 9 38 323 132 5
2643 424 2 30 89 9

Expected output:
68


Actual output:
6


Fixed submission (verdict: Accepted):
import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
ans = 0
for i in range(n):
    l = (bisect.bisect_left(a,b[i]))*(n-bisect.bisect_right(c,b[i]))
    ans += l
print(ans)
Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
  d=bisect.bisect_left(a,b[i])
  e=bisect.bisect_right(c,b[i])
  ans+=d*e
print(ans)


Failing test case input:
6
10 14 448 -1 1 001
4 0 3 -1 0 1
120 27 1 -1 7 2019

Expected output:
38


Actual output:
16


Fixed submission (verdict: Accepted):
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
  d=bisect.bisect_left(a,b[i])
  e=bisect.bisect_right(c,b[i])
  ans+=d*(n-e)
print(ans)

Problem: p03559
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in b:
    x=bisect.bisect_left(a,i)
    y=bisect.bisect_right(c,i)
    ans+=x*(n-y)
    print(x,y)
print(ans)

Failing test case input:
6
11 4 1 0 2 2
1 10 22 1 52 -1
68 -1 4 4 1 -1

Expected output:
23


Actual output:
4 2
6 6
6 6
4 2
6 6
0 2
32


Fixed submission (verdict: Accepted):
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
    x=bisect.bisect_left(a,i)
    y=bisect.bisect_right(c,i)
    ans+=x*(n-y)
print(ans)

Problem: p03559
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import bisect
num=0
n=int(input())
top=list(map(int,input().split()))
mid=list(map(int,input().split()))
und=list(map(int,input().split()))
top.sort()
mid.sort()
und.sort()
for i in mid:
    a=bisect.bisect_left(top,i)
    c=num-bisect.bisect_right(und,i)
    num+=a*c
print(num)

Failing test case input:
6
1 14 159 0 6 96
58 9 10 323 132 6
2643 424 2 30 89 34

Expected output:
74


Actual output:
-10538


Fixed submission (verdict: Accepted):
import sys
import bisect
input = sys.stdin.readline
num=0
n=int(input())
top=list(map(int,input().split()))
mid=list(map(int,input().split()))
und=list(map(int,input().split()))
top.sort()
mid.sort()
und.sort()
for i in mid:
    a=bisect.bisect_left(top,i)
    c=n-bisect.bisect_right(und,i)
    num+=a*c
print(num)
Problem: p03559
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import bisect
import sys
n = int(input())
up = sorted(list(set(map(int, input().split()))))
mid = sorted(list(set(map(int, input().split()))))
low = sorted(list(set(map(int, input().split()))))
ans = 0
for i in range(len(mid)):
    pre = bisect.bisect_left(up, mid[i])
    over = len(low) - bisect.bisect(low, mid[i])
    ans += pre * over

print(ans)


Failing test case input:
6
20 4 0 0 2 2
1 10 22 1 92 -1
68 -1 1 4 1 -1

Expected output:
19


Actual output:
9


Fixed submission (verdict: Accepted):
import bisect
import sys
n = int(input())
up = sorted(list(map(int, input().split())))
mid = sorted(list(map(int, input().split())))
low = sorted(list(map(int, input().split())))
ans = 0
for i in range(len(mid)):
    pre = bisect.bisect_left(up, mid[i])
    over = len(low) - bisect.bisect(low, mid[i])
    ans += pre * over

print(ans)

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

a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))

sum = 0
for i in range(n):
    b = [bi for bi in b if a[i] < bi]
    if len(b) == 0:
        break
    for j in range(len(b)):
        c = [ci for ci in c if b[j] < ci]
        sum += len(c)

print(sum)



Failing test case input:
6
12 23 159 0 6 59
106 9 7 837 28 6
784 700 4 79 77 460

Expected output:
60


Actual output:
23


Fixed submission (verdict: Accepted):
import bisect

n = int(input())

a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))

sum = 0
for i in range(len(b)):
    ai = bisect.bisect_left(a, b[i])
    ci = bisect.bisect_right(c, b[i])
    sum += ai * (n - ci)

print(sum)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
a = int(input())
b = list(map(int, input().split()))
b.sort()
c = list(map(int, input().split()))
d = list(map(int, input().split()))
d.sort()
ans = 0
for i in range(a):
    ans += bisect.bisect_left(b, c[i]) * (a - bisect.bisect_right(d, c[i]))
  

Failing test case input:
6
9 14 159 0 6 53
58 9 7 323 166 7
2643 391 3 79 50 460

Expected output:
86


Actual output:

Fixed submission (verdict: Accepted):
import bisect
a = int(input())
b = list(map(int, input().split()))
b.sort()
c = list(map(int, input().split()))
d = list(map(int, input().split()))
d.sort()
ans = 0
for i in range(a):
    ans += bisect.bisect_left(b, c[i]) * (a - bisect.bisect_right(d, c[i]))
print(ans)
Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect

n=int(input())
a=sorted(map(int,input().split()))
b=sorted(map(int,input().split()))
c=sorted(map(int,input().split()))

ans=0

for i in range(n):
    num1 = bisect.bisect(a,b[i])
    num2 = n - bisect.bisect_left(c,b[i])
    ans += num1*num2

print(ans)

Failing test case input:
2
0 5
2 4
2 3

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
import bisect

n=int(input())
a=sorted(map(int,input().split()))
b=sorted(map(int,input().split()))
c=sorted(map(int,input().split()))

ans=0

for i in range(n):
    num1 = bisect.bisect_left(a,b[i])
    num2 = n - bisect.bisect(c,b[i])
    ans += num1*num2

print(ans)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
  x=a[i]
  y=bisect.bisect_right(b,x)
  if y<n:
    z=bisect.bisect_right(c,b[y])
    ans+=n-z
print(ans)

Failing test case input:
6
11 4 1 0 2 2
1 10 22 1 52 -1
68 -1 4 4 1 -1

Expected output:
23


Actual output:
8


Fixed submission (verdict: Accepted):
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
  x=b[i]
  y=bisect.bisect_left(a,x)
  z=bisect.bisect_right(c,x)
  ans+=(n-z)*y
print(ans)

Problem: p03559
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import bisect

N = int(input())
A = list(set(map(int, input().split())))
B = list(set(map(int, input().split())))
C = list(set(map(int, input().split())))
ans = 0
A.sort()
B.sort()
C.sort()

for b in B:
    a_i = bisect.bisect_left(A, b)
    c_i = bisect.bisect_right(C, b)
    cnt = (a_i) * (N - c_i)
    
    ans += cnt

print(ans)

Failing test case input:
6
10 14 448 -1 1 001
4 0 3 -1 3 1
333 27 1 -4 7 2019

Expected output:
45


Actual output:
25


Fixed submission (verdict: Accepted):
import bisect

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
A.sort()
B.sort()
C.sort()

for b in B:
    a_i = bisect.bisect_left(A, b)
    c_i = bisect.bisect_right(C, b)
    cnt = (a_i) * (N - c_i)
    
    ans += cnt

print(ans)
Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect

N = int(input())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

count = 0

for i in range(len(B)):
    a_b = bisect.bisect_left(A,B[i])
    c_b = bisect.bisect_right(C,B[i])
    count += a_b * (N - c_b)

print(count)

Failing test case input:
6
10 9 298 0 0 66
59 2 5 8 20 0
523 1563 1 0 18 1803

Expected output:
48


Actual output:
40


Fixed submission (verdict: Accepted):
import bisect

N = int(input())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()

count = 0

for i in range(len(B)):
    a_b = bisect.bisect_left(A,B[i])
    c_b = bisect.bisect_right(C,B[i])
    count += a_b * (N - c_b)

print(count)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
cnt = 0
for bb in b:
    anum = bisect.bisect_left(a, bb)
    cnum = bisect.bisect_right(c, bb)
    cnt += (anum * cnum)
print(cnt)

Failing test case input:
6
-17 2 -1 -1 0 101
4 2 3 -9 -1 -79
20 3 -4 -3 -4 -1

Expected output:
26


Actual output:
70


Fixed submission (verdict: Accepted):
import bisect
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
cnt = 0
for bb in b:
    anum = bisect.bisect_left(a, bb)
    cnum = n - bisect.bisect_right(c, bb)
    cnt += (anum * cnum)
print(cnt)

Problem: p03559
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
N=int(input())
A=sorted(set(map(int,input().split())))
B=sorted(set(map(int,input().split())))
C=sorted(set(map(int,input().split())))
s=0
for b in B:
    a=bisect.bisect_left(A,b)
    c=N-bisect.bisect_right(C,b)
    s+=a*c
print(s)

Failing test case input:
3
0 0 -1
2 2 2
1 0 1

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
import bisect
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
s=0
for b in B:
    a=bisect.bisect_left(A,b)
    c=N-bisect.bisect_right(C,b)
    s+=a*c
print(s)
Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]%=m
for i in range(1,n):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
p=0
s=0
for i in range(1,n):
	if a[i]-a[p]:
		p=i-p
		s+=p*(p-1)/2
		p=i
p=n-p
s+=p*(p+1)/2
print(s)

Failing test case input:
13 17
29 7 5 3 18 51 7 13 8 55 42 9 81

Expected output:
4


Actual output:
4.0


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=[0]+list(map(int,input().split()))
a[0]%=m
for i in range(1,n+1):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
p=0
s=0
for i in range(1,n+1):
	if a[i]-a[p]:
		l=a[i]
		p=i-p
		s+=p*(p-1)
		p=i
p=n-p
s+=p*(p+1)
print(int(s/2))

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

s = []
s.append(a[0])
for idx in range(1,len(a)):
  s.append(s[idx-1] + a[idx])

cnt = 0
for l in range(n):
  for r in range(l, n):
    if (s[r] - s[l-1]) % m == 0:
      cnt += 1
print(cnt)


Failing test case input:
13 17
29 7 5 3 18 51 7 13 8 55 8 9 81

Expected output:
4


Actual output:
5


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

s = []
s.append(0)
for idx in range(len(a)):
  s.append((s[idx] + a[idx]) % m)

c = {0:1}
ans = 0
for l in range(1, n+1):
  ans += c.get(s[l],0)
  c[s[l]] = c.get(s[l],0) + 1
print(ans)

Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)

exit()
k = set(R)
dic = {i:0 for i in k}
for item in R:
  dic[item]+=1

ans = (dic[0]*(dic[0]+1))

k_l = list(k)
for i in k_l:
  if i !=0 :
    ans += (dic[i]*(dic[i]-1))

print(ans)

Failing test case input:
13 17
15 9 2 3 1 64 7 13 8 34 8 9 81

Expected output:
6


Actual output:

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

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)



import collections
c = collections.Counter(R)


ans = 0
for key in c:
  if key == 0:
    ans += (c[key]*(c[key]+1))/2
  else:
    ans += (c[key]*(c[key]-1))/2
  



print(int(ans))
Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

from itertools import accumulate, combinations
from collections import defaultdict

n, m = map(int, input().split())
ary = [int(_) for _ in input().split()]

sum_ary = accumulate(ary, lambda x, y: x + y)
mod_table = defaultdict(int)
for mod in [s % m for s in sum_ary]:
    mod_table[mod] += 1
mod_table[ary[0] % m] += 1

print(sum([len(list(combinations(range(v), 2))) for v in mod_table.values()]))


Failing test case input:
13 17
11 9 6 3 34 51 7 13 16 55 8 9 81

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):

from itertools import accumulate
from collections import defaultdict

n, m = map(int, input().split())
ary = [int(_) for _ in input().split()]

sum_ary = list(accumulate(ary, lambda x, y: x + y))
mod_ary = [s % m for s in sum_ary]
mod_table = defaultdict(int)
for mod in mod_ary:
    mod_table[mod] += 1
mod_table[0] += 1

print(sum([mod * (mod - 1)

Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)

exit()
k = set(R)
dic = {i:0 for i in k}
for item in R:
  dic[item]+=1

ans = (dic[0]*(dic[0]+1))
for i in k:
  if i !=0 :
    ans += (dic[i]*(dic[i]-1))

print(ans)


Failing test case input:
13 17
11 5 2 3 44 51 7 13 16 55 8 9 81

Expected output:
8


Actual output:

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

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)



import collections
c = collections.Counter(R)


ans = 0
for key in c:
  if key == 0:
    ans += (c[key]*(c[key]+1))/2
  else:
    ans += (c[key]*(c[key]-1))/2
  



print(int(ans))

Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = map(int, input().split())
a = [0] + list(map(int, input().split()))
acs = [0] * (n + 1)

for i in range(1, n + 1):
    acs[i] = acs[i - 1] + a[i - 1]
cnt = 0

for l in range(n):
    for r in range(l, n):
        if (acs[r] - acs[l - 1]) % m == 0:
            cnt += 1
print(cnt)

Failing test case input:
13 17
29 7 7 3 33 51 7 13 8 55 42 9 81

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = list(map(int, input().split()))
table = {0: 0}
buf = 0
cnt = 0
for i in range(n):
    buf = (buf + a[i]) % m
    if buf in table:
        cnt += table[buf]
        table[buf] += 1
    else:
        table[buf] = 1
print(cnt + table[0])
Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import defaultdict


N, K=map(int, input().split())
A=list(map(int, input().split()))
for i in range(N):
    A[i]-=1
s=[0 for _ in range(N+1)]
for i in range(N):
    s[i+1]=(s[i]+A[i])%K
d=defaultdict(int)
ans=0

for j in range(N+1):
    ans+=d[s[j]]
    d[s[j]]+=1
    
    
        
        
print(ans)

Failing test case input:
13 17
15 9 2 3 34 91 1 13 14 21 8 9 81

Expected output:
9


Actual output:
3


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


N, K=map(int, input().split())
A=list(map(int, input().split()))

    
s=[0 for _ in range(N+1)]
for i in range(N):
    s[i+1]=(s[i]+A[i])%K
d=defaultdict(int)
ans=0

for j in range(N+1):
    ans+=d[s[j]]
    d[s[j]]+=1
    
    
        
        
print(ans)

Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)

exit()
k = set(R)
dic = {i:0 for i in k}
for item in R:
  dic[item]+=1

ans = (dic[0]*(dic[0]+1))
exit()
for i in k:
  if i !=0 :
    ans += (dic[i]*(dic[i]-1))

print(ans)


Failing test case input:
13 17
11 9 2 3 34 51 7 13 8 55 8 9 81

Expected output:
6


Actual output:

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

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)



import collections
c = collections.Counter(R)


ans = 0
for key in c:
  if key == 0:
    ans += (c[key]*(c[key]+1))/2
  else:
    ans += (c[key]*(c[key]-1))/2
  



print(int(ans))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split(' '))
a = map(int, input().split(' '))

d = {0: 1}
asum = 0
for aa in a:
    asum = (asum + aa) % m
    if asum in d:
        d[asum] += 1
    else:
        d[asum] = 1


ans = 0
for v in d.values():
    ans += v * (v - 1) / 2

print(ans)

Failing test case input:
13 17
15 9 1 3 34 64 12 13 8 21 10 9 81

Expected output:
4


Actual output:
4.0


Fixed submission (verdict: Accepted):
n, m = map(int, input().split(' '))
a = map(int, input().split(' '))

d = {0: 1}
asum = 0
for aa in a:
    asum = (asum + aa) % m
    if asum in d:
        d[asum] += 1
    else:
        d[asum] = 1


ans = 0
for v in d.values():
    ans += int(v * (v - 1) / 2)

print(ans)

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))

d = defaultdict(int)
ans = 0
s = 0
d[0] = 1
for i, a in enumerate(A):
    a %= M
    s += a
    ans += d[s%M]
    d[s % M] += 1

print(ans, d)

Failing test case input:
3 1
5 2 6

Expected output:
6


Actual output:
6 defaultdict(<class 'int'>, {0: 4})


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

d = defaultdict(int)
ans = 0
s = 0
d[0] = 1
for i, a in enumerate(A):
    a %= M
    s += a
    ans += d[s%M]
    d[s % M] += 1

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

N, M= [int(x) for x in input().strip().split(' ')]
A = [int(a) for a in input().split()]
A_mod = [A[0] % M]
s = 0
for elem in A:
    A_mod.append((elem+s) % M)
    s += elem

cnt = Counter(A_mod)
c = 0
for k in cnt.keys():
    if cnt[k] != 0.0 and cnt[k] != 1.0:
        c += (cnt[k])*(cnt[k]-1)/2

print(int(c))

Failing test case input:
13 17
29 9 6 3 34 51 7 13 16 55 8 9 81

Expected output:
6


Actual output:
7


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

N, M= [int(x) for x in input().strip().split(' ')]
A = [int(a) for a in input().split()]
A_mod = [0]
s = 0
for elem in A:
    A_mod.append((elem+s) % M)
    s += elem

cnt = Counter(A_mod)
c = 0
for k in cnt.keys():
    if cnt[k] != 1.0:
        c += (cnt[k])*(cnt[k]-1)/2

print(int(c))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int, input().split())
L = list(map(int, input().split()))
import itertools as it
L=[0]+list(map(lambda x : x % M,it.accumulate(L)))
S=sorted(L)

tmp = -1
ans = 0
cnt=0
def nC2(n):
    return int(n*(n-1)/2)
for x in S:
    
    if tmp == x:
        cnt += 1
    else:
        ans += nC2(cnt+1)
        cnt = 0
    tmp = x
print(ans)

Failing test case input:
13 17
29 9 6 3 18 51 7 13 19 55 8 3 81

Expected output:
8


Actual output:
5


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
L = list(map(int, input().split()))
import itertools as it
L=[0]+list(map(lambda x : x % M,it.accumulate(L)))
S=sorted(L)

tmp = -1
ans = 0
cnt=0
def nC2(n):
    return int(n*(n-1)/2)
for i in range(len(S)):
    
    if tmp == S[i]:
        cnt += 1
        if len(S)-1 == i:
            ans += nC2(cnt+1)
    else:
        ans += nC2(cnt+1)
        cnt = 0
    tmp = S[i]

print(ans)

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=[int(i) for i in input().split(" ")]
A=[int(i) for i in input().split(" ")]

_A=[sum(A[:i:])%M for i in range(N+1)]

count=0

_A.sort()
print(_A)

_count=0
for i in range(len(_A)-1):

    if _A[i]==_A[i+1]:
        _count+=1
    else:
        count+=(_count+1)*_count/2
        _count=0

count+=(_count+1)*_count/2
print(int(count))


Failing test case input:
13 17
11 9 6 3 34 51 7 13 16 55 8 9 81

Expected output:
6


Actual output:
[0, 1, 1, 2, 3, 9, 9, 11, 12, 12, 12, 14, 14, 15]
6


Fixed submission (verdict: Accepted):
N,M=[int(i) for i in input().split(" ")]
A=[int(i) for i in input().split(" ")]

_A=[0]
sum=0
d={0:1}
key=[0]
for i in range(N):
    sum=(sum+A[i])%M
    try:
        d[sum]+=1
    except KeyError:
        d[sum]=1
        key.append(sum)

count=0
for i in key:
    _count=d[i]

    count+=(_count-1)*_count/2
print(int(count))
Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))

cnt=0
dic={}
aaa=0
zero=0
for aa in a:
    aaa+=aa
    amod=aa%m
    if amod==0:
        cnt+=1
        zero+=1
    
    if (m-amod)%m in dic:
        cnt+=dic[(m-amod)%m]
    
    if aaa%m in dic:
        dic[aaa%m]+=1+zero
    else:
        dic[aaa%m]=1+zero
    
print(cnt)



Failing test case input:
13 17
29 9 6 3 18 51 7 13 16 55 8 3 81

Expected output:
6


Actual output:
12


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

cnt=0
dic={}
dic[0]=1
aaa=0
for aa in a:
    aaa+=aa

    if aaa%m in dic:
        cnt+=dic[aaa%m]
        dic[aaa%m]+=1
    else:
        dic[aaa%m]=1
            
    
print(cnt)

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]%=m
for i in range(1,n):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
l=0
p=0
s=0
for i in range(0,n):
	if a[i]-l:
		l=a[i]
		p=i-p
		s+=p*(p+1)/2
		p=i
p=n-p
s+=(p+1)*(p+2)/2
print(s/2)

Failing test case input:
13 4
15 9 2 4 34 64 12 13 8 21 10 9 81

Expected output:
24


Actual output:
17.0


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=[0]+list(map(int,input().split()))
a[0]%=m
for i in range(1,n+1):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
p=0
s=0
for i in range(1,n+1):
	if a[i]-a[p]:
		l=a[i]
		p=i-p
		s+=p*(p-1)
		p=i
p=n-p
s+=p*(p+1)
print(int(s/2))

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

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










Asym = []

sym = 0
cnt_zero = 0
for i, A in enumerate(map(int, input().split())):
    sym = (sym + A) % M
    if sym > 0: Asym.append(sym)
    else: cnt_zero += 1
        
ans = cnt_zero * (cnt_zero + 1)






        
print(int(ans / 2))










Failing test case input:
10 400000000
1000100000 1100000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000010 1000000000 1000000000

Expected output:
7


Actual output:
0


Fixed submission (verdict: Accepted):

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

d_sym = {}
sym = 0



ans = 0
for A in map(int, input().split()):
    sym = (sym + A) % M
    
    if sym == 0: ans += 1
    
    if str(sym) in d_sym.keys(): d_sym[str(sym)] += 1
    else: d_sym[str(sym)] = 1

print(int(ans + sum([val * (val - 1) / 2 for val in d_sym.values()])))
Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=0
alist=[]
for i in a:
    sum+=i
    alist.append(sum%m)
alist.sort()
k=-1
n=0
for j in alist:
    n+=1
    if k!=j:
        count+=(n*(n-1)/2)
        n=0
    k=j
print(int(count))

Failing test case input:
10 400000000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

Expected output:
25

Actual output:
10


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=0
alist=[0]
for i in a:
    sum+=i
    alist.append(sum%m)
alist.sort()
k=-1
n=0
for j in alist:
    if k!=j:
        count+=(n*(n-1)/2)
        n=0
    n+=1
    k=j
count+=(n*(n-1)/2)
print(int(count))

Problem: p03287
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)

k = set(R)
dic = {i:0 for i in k}
for item in R:
  dic[item]+=1
exit()
ans = (dic[0]*(dic[0]+1))

for i in k:
  if i !=0 :
    ans += (dic[i]*(dic[i]-1))
    

    
print(ans)


Failing test case input:
13 17
15 9 2 3 1 24 7 13 8 34 8 9 81

Expected output:
4


Actual output:

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

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)



import collections
c = collections.Counter(R)


ans = 0
for key in c:
  if key == 0:
    ans += (c[key]*(c[key]+1))/2
  else:
    ans += (c[key]*(c[key]-1))/2
  



print(int(ans))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=0
alist=[]
for i in a:
    sum+=i
    alist.append(sum%m)
alist.sort()
k=-1
n=0
for j in alist:
    n+=1
    if k!=j:
        count+=(n*(n-1)/2)
        n=0
    k=j
count+=(n*(n-1)/2)
print(int(count))

Failing test case input:
13 17
15 9 2 3 34 64 1 13 8 21 8 9 81

Expected output:
7


Actual output:
5


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=0
alist=[0]
for i in a:
    sum+=i
    alist.append(sum%m)
alist.sort()
k=-1
n=0
for j in alist:
    if k!=j:
        count+=(n*(n-1)/2)
        n=0
    n+=1
    k=j
count+=(n*(n-1)/2)
print(int(count))
Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = [int(x) for x in input().split()]

sum_c = 0
dic = {0:1}
for x in input().split():
    x = int(x)
    sum_c += x
    a = sum_c
    
    if dic.get(a,0) == 0:
        dic[a] = 1
    else:
        dic[a] += 1

ans = 0
ans += dic[0]*(dic[0]-1)

for v in dic.values():
    ans += v*(v-1)

print(ans)

Failing test case input:
10 400000000
1000100000 1100000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000010 1000000000 1000000000

Expected output:
7


Actual output:
0


Fixed submission (verdict: Accepted):
N, M = [int(x) for x in input().split()]

sum_c = 0
dic = {0:1}
for x in input().split():
    x = int(x)
    sum_c += x
    a = sum_c%M
    
    if dic.get(a,0) == 0:
        dic[a] = 1
    else:
        dic[a] += 1

ans = 0
ans += dic[0]*(dic[0]-1)/2
dic.pop(0)
for v in dic.values():
    ans += v*(v-1)/2
print(int(ans))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]%=m
for i in range(1,n):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
l=0
p=0
s=0
for i in range(0,n):
	if a[i]-l:
		l=a[i]
		p=i-p
		s+=p*(p+1)
		p=i
p=n-p
s+=p*(p-1)
print(int(s/2))

Failing test case input:
13 17
29 7 5 7 13 59 7 13 8 90 42 5 81

Expected output:
3


Actual output:
14


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=[0]+list(map(int,input().split()))
a[0]%=m
for i in range(1,n+1):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
p=0
s=0
for i in range(1,n+1):
	if a[i]-a[p]:
		l=a[i]
		p=i-p
		s+=p*(p-1)
		p=i
p=n-p
s+=p*(p+1)
print(int(s/2))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]%=m
for i in range(1,n):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
l=0
p=1
s=0
for i in range(0,n):
	if a[i]-l:
		l=a[i]
		p=i-p
		s+=p*(p-1)
		p=i
p=n-p
s+=p*(p-1)
print(int(s/2))

Failing test case input:
13 17
15 9 2 3 34 64 7 13 8 61 8 9 81

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=[0]+list(map(int,input().split()))
a[0]%=m
for i in range(1,n+1):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
p=0
s=0
for i in range(1,n+1):
	if a[i]-a[p]:
		l=a[i]
		p=i-p
		s+=p*(p-1)
		p=i
p=n-p
s+=p*(p+1)
print(int(s/2))
Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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










for i, A in enumerate(map(int, input().split())):
    if i == 0: Asym = [A % M]
    else: Asym.append((Asym[-1] + A) % M)
print(Asym)
    
ans = Asym.count(0)
for sym in set(Asym):
    
    cnt = Asym.count(sym)
    ans +=  int(cnt * (cnt -  1) / 2)

print(ans)



Failing test case input:
13 17
29 9 10 0 0 51 7 13 19 55 8 3 81

Expected output:
14


Actual output:
[12, 4, 14, 14, 14, 14, 4, 0, 2, 6, 14, 0, 13]
14


Fixed submission (verdict: Accepted):

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

d_sym = {}
sym = 0



ans = 0
for A in map(int, input().split()):
    sym = (sym + A) % M
    
    if sym == 0: ans += 1
    
    if str(sym) in d_sym.keys(): d_sym[str(sym)] += 1
    else: d_sym[str(sym)] = 1

print(int(ans + sum([val * (val - 1) / 2 for val in d_sym.values()])))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=0
alist=[]
for i in a:
    sum+=i
    alist.append(sum%m)
alist.sort()
k=0
n=0
for j in alist:
    n+=1
    if k!=j:
        count+=(n*(n-1)/2)
        n=0
    k=j
print(int(count))

Failing test case input:
13 4
29 7 7 3 33 88 7 13 8 40 42 9 81

Expected output:
26


Actual output:
5


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=0
alist=[0]
for i in a:
    sum+=i
    alist.append(sum%m)
alist.sort()
k=-1
n=0
for j in alist:
    if k!=j:
        count+=(n*(n-1)/2)
        n=0
    n+=1
    k=j
count+=(n*(n-1)/2)
print(int(count))

Problem: p03287
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , M = map(int,input().split())
A =  map(int,input().split())
A = [a for a in A]

partial_sum_list = [0]
partial_sum = 0
res = 0
i = 0
while i < N:
    partial_sum += A[i]
    partial_sum_list.append(partial_sum)
    temp = partial_sum % M
    j = 0
    while j < len(partial_sum_list)-1:
        if temp == (partial_sum_list[j] % M):
            print(A[i])
            res += 1
        j += 1
    i = i + 1

Failing test case input:
13 17
15 9 2 3 34 64 12 13 8 34 8 12 81

Expected output:
5


Actual output:
34
8
34
34
8


Fixed submission (verdict: Accepted):
N , M = map(int,input().split())
A =  map(int,input().split())
A = [a for a in A]

dic = {}
dic[0] = 0
partial_sum = 0
res = 0
i = 0
while i < N:
    partial_sum += A[i]
    a = partial_sum % M
    if a == 0:
        res += 1
    if a in dic:
        dic[a] += 1
        res += dic[a] - 1
    else:
        dic[a] = 1
        res += dic[a] - 1
    
    i = i + 1
print(res)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(A)

A = []
N = int(input())
A = list(map(int,input().split()))

print(A)
insertionSort(A,N)


Failing test case input:
6
5 4 5 7 1 0

Expected output:
5 4 5 7 1 0
4 5 5 7 1 0
4 5 5 7 1 0
4 5 5 7 1 0
1 4 5 5 7 0
0 1 4 5 5 7


Actual output:
[5, 4, 5, 7, 1, 0]
[4, 5, 5, 7, 1, 0]
[4, 5, 5, 7, 1, 0]
[4, 5, 5, 7, 1, 0]
[1, 4, 5, 5, 7, 0]
[0, 1, 4, 5, 5, 7]


Fixed submission (verdict: Accepted):
def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        show(A)
        
     
def show(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i],end=' ')
        else:
            print(nums[i])
A = []
N = int(input())
A = list(map(int,input().split()))

show(A)
insertionSort(A,N)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionsSort(A):
    N = len(A)
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(*A)

N = int(input())
A = list(map(int, input().split()))
insertionsSort(A)

Failing test case input:
6
0 3 3 0 1 -2

Expected output:
0 3 3 0 1 -2
0 3 3 0 1 -2
0 3 3 0 1 -2
0 0 3 3 1 -2
0 0 1 3 3 -2
-2 0 0 1 3 3


Actual output:
0 3 3 0 1 -2
0 3 3 0 1 -2
0 0 3 3 1 -2
0 0 1 3 3 -2
-2 0 0 1 3 3


Fixed submission (verdict: Accepted):
def insertionsSort(A):
    print(*A)
    N = len(A)
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(*A)

N = int(input())
A = list(map(int, input().split()))
insertionsSort(A)

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


input()
seq = input().split()
for i in range(0, len(seq)):
    key = seq[i]
    j = i - 1
    assert isinstance(i, int)
    while j >= 0 and seq[j] > key:
        seq[j + 1] = seq[j]
        j -= 1
    seq[j + 1] = key
    print(' '.join(seq))

Failing test case input:
3
-1 0 -12

Expected output:
-1 0 -12
-1 0 -12
-12 -1 0


Actual output:
-1 0 -12
-1 0 -12
-1 -12 0


Fixed submission (verdict: Accepted):


input()
seq = [int(x) for x in input().split()]
for i in range(0, len(seq)):
    key = seq[i]
    j = i - 1
    assert isinstance(i, int)
    while j >= 0 and seq[j] > key:
        seq[j + 1] = seq[j]
        j -= 1
    seq[j + 1] = key
    print(' '.join(map(str,seq)))