def parse(inFile):
return inFile.getInts()[1:]
from fractions import gcd
def solve(numbers):
diffs = [abs(number-numbers[0]) for number in numbers[1:]]
g = reduce(gcd, diffs, 0)
return (-numbers[0]) % g
if __name__ == "__main__":
from GCJ import GCJ
GCJ(parse, solve, "/Users/lpebody/gcj/2010_q/", "b").run()
ZGVmIHBhcnNlKGluRmlsZSk6CiAgICByZXR1cm4gaW5GaWxlLmdldEludHMoKVsxOl0KCmZyb20gZnJhY3Rpb25zIGltcG9ydCBnY2QKCmRlZiBzb2x2ZShudW1iZXJzKToKICAgIGRpZmZzID0gW2FicyhudW1iZXItbnVtYmVyc1swXSkgZm9yIG51bWJlciBpbiBudW1iZXJzWzE6XV0KICAgIGcgPSByZWR1Y2UoZ2NkLCBkaWZmcywgMCkKICAgIHJldHVybiAoLW51bWJlcnNbMF0pICUgZwoKaWYgX19uYW1lX18gPT0gIl9fbWFpbl9fIjoKICAgIGZyb20gR0NKIGltcG9ydCBHQ0oKICAgIEdDSihwYXJzZSwgc29sdmUsICIvVXNlcnMvbHBlYm9keS9nY2ovMjAxMF9xLyIsICJiIikucnVuKCkK