I am working on the python program which gives/takes standard input/output. The first line gives Number of Test Cases T. Second-line gives the size of data N. Third and Fourth line gives space-separated integers respectively of length N. The program arranges Set A and B that Set A has the maximum number of items that are greater than their equally-indexed items in Set B. Below is my code:
def main():
T=int(input())
for ii in range(T):
N=int(input())
revo=list(map(int, input().split()))
star=list(map(int, input().split()))
win=0
for i in range(N):
a=1
for j in range(revo[i]):
b=revo[i]-a
if b in star:
win=win+1
t=star.remove(b)
break
a=a+1
print(win)
main()
The inputs are:
1
10
3 6 7 5 3 5 6 2 9 1
2 7 0 9 3 6 0 6 2 6
The output is 7 because when arranged optimally Set A has 7 items which are greater than in Set B. But when we input large datasets it took long time to produced output. Is there any better functions that I can use to Reduce Run Time?