a guest Jan 14th, 2020 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from itertools import combinations as c; from math import gcd
  2. for i in range(int(input())):print(sum([gcd(k,h) for k,h in c((lambda b:[int(j) for j in b][1:int(b[0])+1])(input().split()),2)]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand