Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

d = {}
for ai in a:
  if not ai in d:
    d[ai] = a.count(ai)

cnt = 0
for key, value in d.items():
  if key > value:
    cnt = cnt + value
  elif key < value:
    cnt = cnt + value - key

print(cnt)

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

d = {}
for ai in a:
  if ai in d:
    d[ai] = d[ai] + 1
  else:
    d[ai] = 1

cnt = 0
for key, value in d.items():
  if key > value:
    cnt = cnt + value
  elif key < value:
    cnt = cnt + value - key

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

l = []
cnt = 0
for i in range(n):
  if not a[i] in l:
    tmp = a.count(a[i])
    if a[i] > tmp:
      cnt = cnt + tmp
    elif a[i] < tmp:
      cnt = cnt + tmp - a[i]
    l.append(a[i])
print(cnt)

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

d = {}
for ai in a:
  if ai in d:
    d[ai] = d[ai] + 1
  else:
    d[ai] = 1

cnt = 0
for key, value in d.items():
  if key > value:
    cnt = cnt + value
  elif key < value:
    cnt = cnt + value - key

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
d = {}
for ai in a:
  if not ai in d:
    d[ai] = a.count(ai)

cnt = 0
for key, value in d.items():
  if value > key:
    cnt = cnt + value - key
  elif key > value:
    cnt = cnt + value

print(cnt)
  

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

d = {}
for ai in a:
  if ai in d:
    d[ai] = d[ai] + 1
  else:
    d[ai] = 1

cnt = 0
for key, value in d.items():
  if key > value:
    cnt = cnt + value
  elif key < value:
    cnt = cnt + value - key

print(cnt)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
  dic[i] = a.count(i)

dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
cnt = 0
for i in range(k):
  cnt = cnt + dic[i][1]

print(n - cnt)

Fixed submission:
n, k = map(int, input().split())
d = {}
for i in input().split():
  if i in d:
    d[i] = d[i] + 1 
  else:
    d[i] = 1

l = sorted(d.values())
print(sum(l[:len(l) - k]))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
  dic[i] = a.count(i)

dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
print(dic)
cnt = 0
for i in range(k):
  cnt = cnt + dic[i][1]

print(n - cnt)

Fixed submission:
n, k = map(int, input().split())
d = {}
for i in input().split():
  if i in d:
    d[i] = d[i] + 1 
  else:
    d[i] = 1

l = sorted(d.values())
print(sum(l[:len(l) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
  dic[i] = a.count(i)

dic = sorted(dic.items(), key=lambda x:x[1])
typeCnt = len(seta) - k
cnt = 0
if typeCnt > 0:
  for i in range(typeCnt):
    cnt = cnt + dic[i][1]

print(cnt)

Fixed submission:
n, k = map(int, input().split())
d = {}
for i in input().split():
  if i in d:
    d[i] = d[i] + 1 
  else:
    d[i] = 1

l = sorted(d.values())
print(sum(l[:len(l) - k]))
Buggy python submission (verdict: Time Limit Exceeded):
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 j in range(N):
  target = B[j]
  insert_indexA = bisect.bisect_left(A, target)
  insert_indexC = bisect.bisect_right(C, target)
  cnt = cnt + len(A[:insert_indexA]) * len(C[insert_indexC:])

print(cnt)

Fixed submission:
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 j in range(N):
  target = B[j]
  insert_indexA = bisect.bisect_left(A, target)
  insert_indexC = bisect.bisect_right(C, target)
  cnt = cnt + insert_indexA * (len(C)-insert_indexC)

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

cnt = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if A[i] < B[j] < C[k]:
        cnt = cnt + 1

print(cnt)

Fixed submission:
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 j in range(N):
  target = B[j]
  insert_indexA = bisect.bisect_left(A, target)
  insert_indexC = bisect.bisect_right(C, target)
  cnt = cnt + insert_indexA * (len(C)-insert_indexC)

print(cnt)
Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

maxStrength = 0
ansMass = 100*A
ansSugar = 0
for i in range(100*A, F+1, 100*A):
        for j in range(0, F-i+1, 100*B):
                for k in range(0, F-i-j+1, C):
                        for l in range(0, F-i-j-k+1, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a / 100)*E >= b and mass <= F and mass != 0:
                                        strength = (100*b) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSugar = b

print(ansMass, ansSugar)


Fixed submission:
n = int(input())
a = int(input())

print(n**2 - a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = []
for i in range(N):
	num = int(input())
	if num in l:
		l.remove(num)
	else:
		l.append(num)

print(len(l))

Fixed submission:
N = int(input())
alist = sorted([int(input()) for x in range(N)])

tmpNum = alist[0]
cnt = 1
ans = 0
for i in range(1, N):
	num = alist[i]
	if tmpNum == num:
		cnt = cnt + 1
		if i == N-1 and cnt % 2 != 0:
			ans = ans + 1
	else:
		if cnt % 2 != 0:
			ans = ans + 1
		tmpNum = num
		cnt = 1
		if i == N-1:
			ans = ans + 1

if len(alist) == 1:
	ans = ans + 1


print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = [int(input()) for x in range(N)]
l = []
for num in alist:
        if num in l:
                l.remove(num)
        else:
                l.append(num)

print(len(l))

Fixed submission:
N = int(input())
alist = sorted([int(input()) for x in range(N)])

tmpNum = alist[0]
cnt = 1
ans = 0
for i in range(1, N):
	num = alist[i]
	if tmpNum == num:
		cnt = cnt + 1
		if i == N-1 and cnt % 2 != 0:
			ans = ans + 1
	else:
		if cnt % 2 != 0:
			ans = ans + 1
		tmpNum = num
		cnt = 1
		if i == N-1:
			ans = ans + 1

if len(alist) == 1:
	ans = ans + 1


print(ans)
Buggy python submission (verdict: Runtime Error):
import sympy

N = int(input())
Y = list(map(int,input().split(' ')))


symbols = []
for i in range(N):
    symbols.append(sympy.Symbol('x' + str(i)))

equation = []
for i in range(N):
    i1 = i
    i2 = i + 1 
    if i2 >= N:
        i2 = 0
    equation.append(0.5*symbols[i1] + 0.5*symbols[i2] - Y[i])

for i in range(N):
    print(str(int(sympy.solve(equation)[symbols[i]])) + " " , end="")
print()

Fixed submission:
# -*- coding: utf-8 -*-
 
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])
    
r = map(str, r)
print(" ".join(r))

'''
5
3 8 7 5 5
'''

Buggy python submission (verdict: Runtime Error):
import sympy

N = input()
Y = list(map(int,input().split(' ')))

symbols = []
for i in range(N):
    symbols.append(sympy.Symbol('x' + str(i)))

equation = []
for i in range(N):
    i1 = i
    i2 = i + 1 
    if i2 >= N:
        i2 = 0
    equation.append(0.5*symbols[i1] + 0.5*symbols[i2] - Y[i])

for i in range(N):
    print(str(int(sympy.solve(equation)[symbols[i]])) + " " , end="")
print()

Fixed submission:
# -*- coding: utf-8 -*-
 
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])
    
r = map(str, r)
print(" ".join(r))

'''
5
3 8 7 5 5
'''

Buggy python submission (verdict: Runtime Error):
import sympy

N = 3
Y = list(map(int,input().split(' ')))


symbols = []
for i in range(N):
    symbols.append(sympy.Symbol('x' + str(i)))

equation = []
for i in range(N):
    i1 = i
    i2 = i + 1 
    if i2 >= N:
        i2 = 0
    equation.append(0.5*symbols[i1] + 0.5*symbols[i2] - Y[i])

for i in range(N):
    print(str(int(sympy.solve(equation)[symbols[i]])) + " " , end="")
print()

Fixed submission:
# -*- coding: utf-8 -*-
 
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])
    
r = map(str, r)
print(" ".join(r))

'''
5
3 8 7 5 5
'''
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list1=list(map(int,input().split()))
list2=[]
def calc(n):
    tempsum=0
    for j in range(1,n+1):
        tempsum+=((-1)**(n-j))*list1[j-1]
    return tempsum
list2.append(calc(N))
for i in range(1,N):
    list2.append(2*calc(i)+((-1)**i)*list2[0])
str1=""
for i in range(len(list2)):
    str1+=str(list2[i])
    if i==len(list2)-1:
        print(str1)
    else:
        str1+=" "

Fixed submission:
N=int(input())
list1=list(map(int,input().split()))
list2=[]
def calc(n):
    tempsum=0
    for j in range(1,n+1):
        tempsum+=((-1)**(n-j))*list1[j-1]
    return tempsum
list2.append(calc(N))
for i in range(1,N):
    list2.append(2*list1[i-1]-list2[i-1])
str1=""
for i in range(len(list2)):
    str1+=str(list2[i])
    if i==len(list2)-1:
        print(str1)
    else:
        str1+=" "
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
list1=[int(input()) for i in range(M)]
list2=[1]
if 1 in list1:
    list2.append(0)
else:
    list2.append(1)
for i in range(N-1):
    if i+2 in list1:
        list2.append(0)
    else:
        list2.append((list2[i]+list2[i+1])%1000000007)
print(list2[N])

Fixed submission:
N,M=map(int,input().split())
list1=set([int(input()) for i in range(M)])
list2=[1]+[0]*N
if not 1 in list1:
    list2[1]=1
for i in range(N-1):
    if not i+2 in list1:
        list2[i+2]=(list2[i]+list2[i+1])%1000000007
print(list2[N])

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
list1=[int(input()) for i in range(M)]
list2=[1]
if 1 in list1:
    list2.append(0)
else:
    list2.append(1)
for i in range(N-1):
    if i+2 in list1:
        list2.append(0)
    else:
        list2.append(list2[i]+list2[i+1])
print(list2[N]%1000000007)

Fixed submission:
N,M=map(int,input().split())
list1=set([int(input()) for i in range(M)])
list2=[1]+[0]*N
if not 1 in list1:
    list2[1]=1
for i in range(N-1):
    if not i+2 in list1:
        list2[i+2]=(list2[i]+list2[i+1])%1000000007
print(list2[N])
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
for i in range(Q):
    count=0
    l,r=map(int,input().split())
    for j in range(r-l):
        if S[l-1+j]=="A" and S[l+j]=="C":
            count+=1
    print(count)

Fixed submission:
N,Q=map(int,input().split())
S=input()
list1=[list(map(int,input().split())) for _ in range(Q)]
list2=[0]*(N+1)
count=0
for i in range(N):
    if i>0:
        list2[i+1]=list2[i]
    if i==N-1:
        continue
    elif S[i:i+2]=="AC":
        list2[i+1]+=1
for tmp in list1:
    print(list2[tmp[1]-1]-list2[tmp[0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
for i in range(Q):
    l,r=map(int,input().split())
    print(int((r-l+1-len(S[l-1:r].replace("AC","")))/2))

Fixed submission:
N,Q=map(int,input().split())
S=input()
list1=[list(map(int,input().split())) for _ in range(Q)]
list2=[0]*(N+1)
count=0
for i in range(N):
    if i>0:
        list2[i+1]=list2[i]
    if i==N-1:
        continue
    elif S[i:i+2]=="AC":
        list2[i+1]+=1
for tmp in list1:
    print(list2[tmp[1]-1]-list2[tmp[0]-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[[]]*N
dp=[0]*N
for i in range(1,N):
    tmp=[]
    for j in range(min(i,K)):
        tmp.append(dp[i-j-1]+abs(H[i]-H[i-j-1]))
    else:
        dp[i]=min(tmp)
print(dp[N-1])

Fixed submission:
N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[[]]*N
dp=[0]*N
for i in range(1,N):
    tmp=[]
    for j in range(min(i,K)):
        tmp.append(dp[i-j-1]+abs(H[i]-H[i-j-1]))
    else:
        dp[i]=min(tmp)
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
S = list(str(input()))
import collections
c = collections.Counter(S)
t = c.most_common()
if (t[0][1] == t[1][1] == 2):
    print("Yes")
else:
    print("No")

Fixed submission:
S = list(str(input()))
import collections
c = collections.Counter(S)
t = c.most_common()
if (len(t) > 1 and t[0][1] == t[1][1] == 2):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
W,H,x,y = map(int,input().split())
min_s = H*(W-2*x)
ts = H*x
flag = 0 
for d in range(0,360,0.5):
    if(d == 90 or d == 270):
        continue
    rad = np.deg2rad(d)
    a = np.tan(rad)
    h = a*W - 2*a*x + 2*y
    men = (a*x-y+h/2)*W
    s = round(abs(W*H - 2 * men),9)
    if min_s > s:
        min_s = s
        ts = men
    elif min_s == s:
        flag = 1
    
print(ts,flag)

Fixed submission:
W,H,x,y = map(int,input().split())

flag = 0
if(x == W/2 and y == H/2):
    flag = 1
    
print(W*H/2,flag)

Buggy python submission (verdict: Runtime Error):

import numpy as np
W,H,x,y = map(int,input().split())

min_s = W*H
for i in range(W):
    s = abs(W*H - 2 * (i*H))
    if min_s > s:
        min_s = s
        ts = i*H

min_s2 = W*H
flag = 0 
for d in range(360):
    if(d == 90 or d == 270):
        continue
    rad = np.deg2rad(d)
    a = np.tan(rad)
    h = a*W - 2*a*x + 2*y
    men = (a*x-y+h/2)*W
    s = abs(W*H - 2 * men)
    if min_s2 > s:
        min_s2 = s
        ts2 = men
    elif min_s2 == s:
        flag = 1

flag2 = 0
if ts2 == ts: 
    flag2 = 1
    
if min_s2 > min_s:
    print(ts,flag2)
else:
    print(ts2,flag)

Fixed submission:
W,H,x,y = map(int,input().split())

flag = 0
if(x == W/2 and y == H/2):
    flag = 1
    
print(W*H/2,flag)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())
for i in range(A,B+1):
    if(i < A+K or i > B-K):
        print(i)

Fixed submission:
A,B,K = map(int,input().split())
if(B-A > 1000):
    for i in range(A,A+K):
        print(i)
    for i in range(B+1-K,B+1):
        print(i)
else:
    for i in range(A,B+1):
        if(i < A+K or i > B-K):
            print(i)
Buggy python submission (verdict: Time Limit Exceeded):
H,W,D = map(int,input().split())
A = []
for i in range(H):
    A.append(list(map(int, input().split())))
Q = int(input())
L = []
R = []
for i in range(Q):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)
    
import numpy as np
A = np.array(A)
for i in range(Q):
    MP = 0
    point = L[i]
    aa = np.array(np.where((L[i] <= A) & (A <= R[i]) & ((A - point)%D == 0))).T
    ix = np.argsort(A[aa[:,0],aa[:,1]])
    aa = aa[ix]
    MP = sum([sum(abs(aa[p]-aa[p+1])) for p in range(len(aa)-1)])
    print(MP)

Fixed submission:
import numpy as np
H,W,D = map(int,input().split())
SUM = H*W
px = np.zeros(SUM+1)
py = np.zeros(SUM+1)
for i in range(1,H+1):
    A = list(map(int, input().split()))
    for j in range(len(A)):
        px[A[j]] = i
        py[A[j]] = j + 1

d = np.zeros(SUM+1)
for t in range(D+1,SUM+1):
    d[t] = d[t-D] + abs(px[t] - px[t-D])+ abs (py[t] - py[t-D]);
        
Q = int(input())
L = []
R = []
for i in range(Q): 
    l,r = map(int, input().split())
    print(int(d[r]-d[l]))

Buggy python submission (verdict: Time Limit Exceeded):
H,W,D = map(int,input().split())
A = []
for i in range(H):
    A.append(list(map(int, input().split())))
Q = int(input())
L = []
R = []
for i in range(Q):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)
    
import numpy as np
A = np.array(A)
for i in range(Q):
    MP = 0
    point = L[i]
    for j in range(int((R[i] - L[i]) / D)):
        start = np.array(np.where(A == point)).T.reshape(2)
        end = np.array(np.where(A == (point+D))).T.reshape(2)
        MP += sum(abs(start - end))
        point += D
    print(MP)

Fixed submission:
import numpy as np
H,W,D = map(int,input().split())
SUM = H*W
px = np.zeros(SUM+1)
py = np.zeros(SUM+1)
for i in range(1,H+1):
    A = list(map(int, input().split()))
    for j in range(len(A)):
        px[A[j]] = i
        py[A[j]] = j + 1

d = np.zeros(SUM+1)
for t in range(D+1,SUM+1):
    d[t] = d[t-D] + abs(px[t] - px[t-D])+ abs (py[t] - py[t-D]);
        
Q = int(input())
L = []
R = []
for i in range(Q): 
    l,r = map(int, input().split())
    print(int(d[r]-d[l]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = []
for i in range(N):
    S.append(list(map(int,input().split())))
now = [0,0]
flag = True
for i in range(N):
    dis = abs(S[i][1]-now[0])+abs(S[i][2]-now[1])
    if(dis > S[i][0] or (S[i][0]-time)%2 != dis%2):
        flag = False
        break
    now[0] = S[i][1]
    now[1] = S[i][2]
    time = S[i][0]
    
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
N = int(input())
S = []
for i in range(N):
    S.append(list(map(int,input().split())))
now = [0,0]
time = 0
flag = True
for i in range(N):
    dis = abs(S[i][1]-now[0])+abs(S[i][2]-now[1])
    if(dis > S[i][0] or (S[i][0]-time)%2 != dis%2):
        flag = False
        break
    now[0] = S[i][1]
    now[1] = S[i][2]
    time = S[i][0]
    
if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

import numpy
A = numpy.array(A)
B = numpy.array(B)
AsortA = numpy.sort(A)[::-1]
BsortB = numpy.sort(B)[::-1]

ans = 0
maxattack = AsortA[0]
throw = BsortB[maxattack < BsortB]
if(sum(throw) >= H):
    for i in range(1,len(throw) + 1):
        if(sum(throw[:i]) >= H):
            ans = i
            break
else:
    resH = H - sum(throw)
    ak = int(numpy.ceil(resH/maxattack))
    ans = ak + len(throw)
    
print(ans)

Fixed submission:
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

import numpy
A = numpy.array(A)
B = numpy.array(B)
AsortA = numpy.sort(A)[::-1]
BsortB = numpy.sort(B)[::-1]

ans = 0
maxattack = AsortA[0]
throw = BsortB[maxattack < BsortB]
if(sum(throw) >= H):
    ak = 0
    for i in range(len(throw)):
        ak += throw[i]
        if(ak >= H):
            ans = i+1
            break
else:
    resH = H - sum(throw)
    ak = int(numpy.ceil(resH/maxattack))
    ans = ak + len(throw)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
rS = list(str(input()))
import numpy
S0 = numpy.array(rS).astype(numpy.int32)
S1 = numpy.array(rS).astype(numpy.int32)
lS = len(S0)
def hanten(slist):
    ans = numpy.logical_xor(slist,numpy.ones(len(slist))).astype(int)
    return ans

for i in range(2,lS+1)[::-1]:
    for j in range(lS - i + 1):
        if(S0[j] == 0):
            S0[j:j+i] = hanten(S0[j:j+i])
        if(S1[j] == 1):
            S1[j:j+i] = hanten(S1[j:j+i])
            
    if(sum(S0[:-1]) == len(S0) - 1):
        print(i)
        break;
    if(sum(S1[:-1]) == len(S1) - 1):
        print(i)
        break;

Fixed submission:
A,B,C,D = map(int,input().split())
l = A+B
r = C+D
if(l>r):
    print("Left")
elif(l==r):
    print("Balanced")
elif(l<r):
    print("Right")
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))

from collections import Counter
import numpy as np
c = Counter(A)

no = len(c.most_common())
numlist = []
for label, num in c.most_common():
    numlist.append(num)

diff = no - K
if(diff > 0):
    ans = np.sum(numlist[-diff:])
    
print(ans)

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

from collections import Counter
import numpy as np
c = Counter(A)

no = len(c.most_common())
numlist = []
for label, num in c.most_common():
    numlist.append(num)

diff = no - K
ans = 0
if(diff > 0):
    ans = np.sum(numlist[-diff:])
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
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()

BClist = []
for i in range(N):
    for j in range(N):
        if(B[i] < C[j]):
            BClist.append(N-j)
            break

ans = 0
for k in range(N):
    for i in range(N):
        if(A[k] < B[i]):
            ans += sum(BClist[i:])
            break

print(ans)

Fixed submission:
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 j in range(n):
    ans += bisect.bisect_left(a,b[j])*(n-bisect.bisect_right(c,b[j]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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()

BClist = []
for i in range(N):
    for j in range(N):
        if(B[i] < C[j]):
            BClist.append(N-j)
            break

ans = 0
for k in range(N):
    for i in range(N):
        if(A[k] < B[i]):
            ans += sum(BClist[i:])
            break
            
print(ans)

Fixed submission:
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 j in range(n):
    ans += bisect.bisect_left(a,b[j])*(n-bisect.bisect_right(c,b[j]))
print(ans)
Buggy python submission (verdict: Runtime Error):
S = str(input())
Slist = list(S)
flag = False
for i in range(len(Slist)-1):
    st = Slist[i] + Slist[i+1]
    if(st == "AC" and flag == False):
        prinSSFGt('Yes')
        flag = True
if(flag == False):
    print('No')
        

Fixed submission:
S = str(input())
Slist = list(S)
flag = False
for i in range(len(Slist)-1):
    st = Slist[i] + Slist[i+1]
    if(st == "AC" and flag == False):
        print('Yes')
        flag = True
if(flag == False):
    print('No')
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for i in range(M)]

ans = 0
for it in range(M):
    hoge = list(ab)
    del hoge[it]
    l = [[] for i in range(N)]
    for pi in hoge:
        l[pi[0]-1].append(pi[1]-1)
        l[pi[1]-1].append(pi[0]-1)
    if(N != len(dfs(l, 0))):
        ans += 1
        
print(ans)

Fixed submission:
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for i in range(M)]

def dfs(Graph, Start, Visited=None):
    if (Visited==None):  Visited = []
    Visited.append(Start) 
    for Next in Graph[Start]: 
        if ( Next in Visited ):  
            continue 
        Visited = dfs(Graph, Next, Visited)
    return Visited
 
ans = 0
for it in range(M):
    hoge = list(ab)
    del hoge[it]
    l = [[] for i in range(N)]
    for pi in hoge:
        l[pi[0]-1].append(pi[1]-1)
        l[pi[1]-1].append(pi[0]-1)
    if(N != len(dfs(l, 0))):
        ans += 1
        
print(ans)