I’m getting WA with the following code:
x = int(input())
spam = []
k = 0
b = 0
add = 0
for i in range(x):{
y = int(input())
for j in range(2):{
z = list(map(int, input().split()))
if j == 0:
z.insert(0,y)
spam.extend(z)
}
}
while k < len(spam):{
a = spam[k]
b = 0
add = 0
while b<a: {
add = add + spam[k+b+1]spam[k+b+a+1]
b = b+1
}
k = k + 2a + 1
print(add)
}
I get the example output while entering the example input, but it looks it fails for some other test cases. Could someone please help me find them? The judge input isn’t shown.