Create a new list for each number in the first list without repeating itself, containing the number and the sum of the second list in case the index of the first list matches its number, minus the sum of the numbers in the third list in case the index of the first list matches its number.
The result should be:
(1 500) //explanation (240+270) - (1+9)
(2 485) //explanation (54+300+155)-(7+5+12)
(3 458) //explanation (158+320)-(18+2)
from the developer @The_K_Studio, to whom I send my thanks.
To start, I have a list of lists:
((2 2 2 3 3 1 1) (54.12 300 155 158 320 240 270) (7 5 12 18 2 1 9))
I select the unique numbers from the first list
I group the results of the 3 lists based on the coincidence of the next 2 lists with the index of the first list and create a list with this grouping ((1 2 3) (4 5) (6 7))
For each 1 of the numbers in the first list, I add the indexes of the second and third lists and subtract the indexes between them.