WA in WWALK

Continuing the discussion from WWALK - Editorial:

I am getting output in jupyter notebook but in code chef it is showing wrong answer.
for i in range(int(input())):
a = int(input())
b,c = list(map(int,input().split())),list(map(int,input().split()))
d = 0
for j in range(1,a+1):

    if b[j-1] == c[j-1]:
          d = d+(b[j-1])
print(d)

You are only checking if their speed are equal or not. They will cover weird distance only if their starting point is same. eg-
3
1 2 3
1 3 3
Answer should be 1. Read the editorial. You may see this https://www.codechef.com/viewsolution/33446314
Simply calculate the distance they covered till time t and if they are equal then check if they have same speed or not

Thanks bro