problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02712
u937396845
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['a=int(input())\nans = 0\nfor i in range(a+1)\nif a%3 != 0 and a%5 !=0:\n ans += i\nprint(ans)\n \n \n', 'n=int(input())\nans = 0\nfor i in range(n+1):\n\tif a%3 != 0 and a%5 !=0:\n \t\tans += i\nprint(ans)\n \n \n', 'a=int(input())\nans = 0\nwhile i <= a+1\nif a%3 != 0 and a%5 !=0:\n ans += i\nprint(ans)\n \n ', 'n=int(input())\nans = 0\nfor i in range(n+1):\n\tif i%3 != 0 and i%5 !=0:\n \t\tans += i\nprint(ans)\n \n \n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s023185113', 's123172125', 's805271809', 's691536904']
[8924.0, 9120.0, 8840.0, 8972.0]
[22.0, 25.0, 23.0, 164.0]
[96, 100, 90, 100]
p02712
u938224478
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
["for number in range(1, 30 + 1):\n if (number % 3 == 0) and (number % 5 == 0):\n print('FizzBuzz')\n elif number % 3 == 0:\n print('Fizz')\n elif number % 5 == 0:\n print('Buzz')\n else:\n print(str(number))\n\n", "for i in range(1, N + 1):\n if (i % 3 == 0) and (i % 5 == 0):\n print('FizzBuzz')\n elif i % 3 == 0:\n print('Fizz')\n elif i % 5 == 0:\n print('Buzz')\n else:\n print(str(number))\n\n", 'N = int(input())\ntotal = 0\n \nfor i in range(1, N+1):\n if i % 3 != 0 and i % 5 != 0:\n total += i\n \nprint(total)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s252990210', 's634945464', 's417782661']
[9024.0, 9092.0, 9136.0]
[28.0, 24.0, 156.0]
[240, 214, 120]
p02712
u938718404
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n=int(input())\nli=[]\nfor i in range(1,n+1):\n if not i%3==0 or i%5==0:\n li.append(i)\n else:\n li=li\nprint(sum(li))', 'n=int(input())\nli=[]\ni=0\nwhile i<=n:\n if i%3!=0 and i%5!=0:\n li.append(i)\n i+=1\n continue\n else:\n i+=1\n continue\nelse:\n print(sum(li))']
['Wrong Answer', 'Accepted']
['s024621611', 's845033850']
[37868.0, 30124.0]
[182.0, 217.0]
[132, 178]
p02712
u939949527
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
[' = int(input())\nl = [i for i in range(1, n+1)]\nnl = []\n \nfor a in l:\n if a%15 != 0 or a%5 != 0 or a%3 != 0:\n \tnl.append(a)\nprint(sum(nl))\n ', '\nn = int(input())\nl = [i for i in range(1, n+1)\nnl = []\n \nfor a in l:\n if a%15 != 0 or a%5 != 0 or a%3 != 0:\n \tnl.append(a)\nprint(sum(nl))\n ', 'n = int(input())\nl = [i for i in range(1, n+1)]\nnl = []\n \nfor a in l:\n if a%15 != 0 or a%5 != 0 or a%3 != 0:\n \tnl.append(a)\nprint(sum(nl))\n ', 'n = int(input())\nl = [i for i in range(1, n + 1)]\nnl = []\n\nfor a in l:\n if (a % 5 != 0) and (a % 3 != 0):\n nl.append(a)\n\nprint(sum(nl))\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s070799112', 's764936255', 's815303334', 's644390698']
[8940.0, 9004.0, 55664.0, 52376.0]
[19.0, 24.0, 210.0, 223.0]
[151, 152, 152, 146]
p02712
u942356554
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['s=int(input())\nlist=[]\nh=0\nfor i in range(1,s):\n if i%3!=0 or i%5!=0:\n list.append(i)\nfor j in list:\n h=h+j\nprint(h)', 's=int(input())\nlist1=[]\nh=0\nfor i in range(1,s+1):\n if i%3!=0 and i%5!=0:\n list1.append(i)\nfor j in list1:\n h=h+j\nprint(h)']
['Wrong Answer', 'Accepted']
['s362670158', 's871370955']
[45908.0, 29980.0]
[262.0, 210.0]
[129, 135]
p02712
u944886577
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n=int(input())\nsum=0\nfor i in range(1,n+1)\n if i%3!=0 and i%5!=0:\n sum+=i\nprint(sum)', 'n=int(input())\nsum=0\nfor i in range(1,n)\n if i%3!=0 and i%5!=0:\n sum+=i\nprint(sum)', 'n=int(input())\nsum=0\nfor i in range(1,n+1):\n if i%3!=0 and i%5!=0:\n sum+=i\nprint(sum)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s187525164', 's248479495', 's727223705']
[8920.0, 9028.0, 9068.0]
[23.0, 27.0, 158.0]
[87, 85, 88]
p02712
u949234226
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['\nN = int(input())\n\nj = 0\nfor i in range(1, N):\n print(i)\n if i % 15 == 0:\n \n pass\n elif i % 3 == 0:\n \n pass\n elif i % 5 == 0:\n \n pass\n else:\n j = j + i\n\nprint(j)\n', '\nN = int(input())\n\nj = 0\nfor i in range(1, N+1):\n print(i)\n if i % 15 == 0:\n \n pass\n elif i % 3 == 0:\n \n pass\n elif i % 5 == 0:\n \n pass\n else:\n j = j + i\n\nprint(j)\n', '\nN = int(input())\n\nj = 0\nfor i in range(1, N+1):\n if i % 15 == 0:\n \n pass\n elif i % 3 == 0:\n \n pass\n elif i % 5 == 0:\n \n pass\n else:\n j = j + i\n\nprint(j)\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s044844165', 's784306577', 's188301447']
[9748.0, 9800.0, 9164.0]
[464.0, 491.0, 177.0]
[276, 278, 268]
p02712
u949831615
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nn3 = n // 3\nn5 = n // 5\nn15 = n // 15\n\nprint(n*(n+1)/2 + 3*n3*(n3+1)/2 + 5*n5*(n5+1)/2 - 15*n15*(n15+1)/2)', 'n = int(input())\nn3 = n // 3\nn5 = n // 5\nn15 = n // 15\n\nprint(n*(n+1)/2 - 3*n3*(n3+1)/2 - 5*n5*(n5+1)/2 + 15*n15*(n15+1)/2)', 'n = int(input())\n\nn3 = n // 3\nn5 = n // 5\nn15 = n // 15\n\nprint(n*(n + 1)//2 - 3*n3*(n3 + 1)//2 - 5*n5*(n5 + 1)//2 + 15*n15*(n15 + 1)//2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s155421019', 's784013461', 's693139601']
[8996.0, 9168.0, 9124.0]
[24.0, 22.0, 23.0]
[123, 123, 136]
p02712
u953274507
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['\nimport math\n\n\ntext = 0\ncount = 0\n\n\nn = int(input())\n\n\nwhile count < n:\n if (count % 3 != 0) or (count % 5 != 0):\n text = text + count\n count += 1\n\n\nprint(text)\n', '\ntext = 0\ncount = 0\n\n\nn = int(input())\n\n\nwhile count < n:\n count += 1\n if (count % 3 != 0) and (count % 5 != 0):\n text = text + count\n\n\nprint(text)\n']
['Wrong Answer', 'Accepted']
['s736058140', 's743505265']
[9164.0, 9160.0]
[210.0, 206.0]
[257, 213]
p02712
u957872856
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N = int(input())\ntotal = 0\nfor i in range(1, N+1):\n if i%3 and i%5:\n continue\n elif i%3:\n continue\n elif i%5:\n continue\n else:\n total += i\nprint(total)', 'N = int(input())\ntotal = 0\nfor i in range(1, N+1):\n if i%3==0 and i%5==0:\n continue\n elif i%3==0:\n continue\n elif i%5==0:\n continue\n else:\n total += i\nprint(total)\n']
['Wrong Answer', 'Accepted']
['s170197748', 's449528115']
[9176.0, 9100.0]
[133.0, 188.0]
[167, 180]
p02712
u960570220
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nsum = 0\nfor i in range(1 , n + 1 ):\n if (i % 3 != 0) and (i % 5 != 0):\n sum += 1\n\nprint(sum)', 'n = int(input())\nsum = 0\n\nif(1 <= n <= 10 ** 6):\n\n for i in range(1 , n + 1 ):\n if (i % 3 == 0) and (i % 5 == 0):\n n = "FizzBuzz"\n elif (i % 3 == 0):\n n = "Fizz"\n elif (i % 5 == 0):\n n = "ZBuzz"\n else:\n sum += 1\n\nprint(sum)', 'n = int(input())\nsum = 0\nfor i in range(1 , n + 1 ):\n if (i % 3 == 0) and (i % 5 == 0):\n n = "FizzBuzz"\n if (i % 3 == 0):\n n = "Fizz"\n if (i % 5 == 0):\n n = "ZBuzz"\n\nprint(sum)', 'n = int(input())\nsum = 0\nfor i in range(1 , n + 1 ):\n if (i % 3 == 0) and (i % 5 == 0):\n n = "FizzBuzz"\n elif (i % 3 == 0):\n n = "Fizz"\n elif (i % 5 == 0):\n n = "ZBuzz"\n else:\n sum += 1\n\nprint(sum)', 'n = int(input())\nlist = []\n\nfor i in range(1, n + 1):\n if i % 3 and i % 5 == 0:\n print("FizzBuzz")\n elif i % 3 == 0:\n print("Fizz")\n elif i % 5 == 0:\n print("Buzz")\n else:\n print(list.append(i))\nprint(sum(list))', 'n = int(input())\nsum = 0\nfor i in range(1 , n + 1 ):\n if (i % 3 == 0) and (i % 5 == 0):\n n = "FizzBuzz"\n if (i % 3 == 0):\n n = "Fizz"\n if (i % 5 == 0):\n n = "ZBuzz"\n\nprint(sum)', 'n = int(input())\nsum = 0\n\nif(1 <= N <= 10 ** 6):\n\n for i in range(1 , n + 1 ):\n if (i % 3 == 0) and (i % 5 == 0):\n n = "FizzBuzz"\n elif (i % 3 == 0):\n n = "Fizz"\n elif (i % 5 == 0):\n n = "ZBuzz"\n else:\n sum += 1\n\nprint(sum)', 'n = int(input())\nsum = 0\n\nif(1 <= n <= 10 ** 6):\n\n for i in range(1 , n + 1 ):\n if (i % 3 == 0) and (i % 5 == 0):\n n = "FizzBuzz"\n elif (i % 3 == 0):\n n = "Fizz"\n elif (i % 5 == 0):\n n = "ZBuzz"\n else:\n sum += 1\n\nprint(sum)', 'N = int(input())\nlist = []\n\nfor i in range(1, N + 1):\n if i % 3 == 0 and i % 5 == 0:\n print("FizzBuzz")\n elif i % 3 == 0:\n print("Fizz")\n elif i % 5 == 0:\n print("Buzz")\n else:\n print(list.append(i))\nprint(sum(list))', 'N = int(input())\nlist = []\n\nfor i in range(1, N + 1):\n if i % 3 == 0 and i % 5 == 0:\n "FizzBuzz"\n elif i % 3 == 0:\n "Fizz"\n elif i % 5 == 0:\n "Buzz"\n else:\n list.append(i)\nprint(sum(list))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s047531318', 's257532599', 's287641244', 's303069959', 's334270686', 's395993414', 's399275556', 's429704279', 's887290305', 's832844897']
[9152.0, 9188.0, 9196.0, 9168.0, 29852.0, 9148.0, 9172.0, 9172.0, 30136.0, 29988.0]
[152.0, 209.0, 209.0, 209.0, 468.0, 210.0, 27.0, 203.0, 462.0, 216.0]
[119, 263, 206, 237, 251, 206, 263, 263, 256, 228]
p02712
u962175226
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N= int(input())\nsum = 0\nfor i in range(1, N):\n if (i % 3 != 0 and i % 5 != 0 ):\n sum = + i\nprint(sum)\n', 'N= int(input())\n\nsum = 0\nfor i in range(1, N):\n if (i % 3 != 0 and i % 5 != 0 and i % 15 != 0):\n sum = sum + i\n print(sum)', 'N= int(input())\nsum = 0\nfor i in range(1, N+1):\n if (i % 3 != 0 and i % 5 != 0 ):\n sum = + i\nprint(sum)', 'N= int(input())\nsum = 0\nfor i in range(1, N+1):\n if (i % 3 != 0 and i % 5 != 0 ):\n sum =sum + i\nprint(sum)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s012530706', 's664826325', 's787968297', 's025661389']
[9092.0, 9256.0, 9168.0, 9164.0]
[139.0, 362.0, 137.0, 158.0]
[112, 139, 113, 117]
p02712
u962423738
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n=int(input())\n\nans=0\n\nfor i in range(1,n+1):\n\tif i%3!=0 and i%5!=0\n\t\tans+=i\n \nprint(ans)', 'n=int(input())\n \nans=0\n \nfor i in range(1,n+1):\n\tif i%3!=0 and i%5!=0:\n\t\tans+=i\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s476111975', 's550632540']
[8988.0, 9108.0]
[26.0, 174.0]
[94, 97]
p02712
u966207392
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N = int(input())\nA = []\nfor i in range(N+1):\n if i+1 % 3 != 0 and i+1 % 5 != 0:\n A.append(i)\nprint(sum(A))\n', 'N = int(input())\nA = []\nfor i in range(N+1):\n if i+1 % 3 != 0 and i+1 % 5 != 0\n A.append(i)\nprint(sum(A))', 'N = int(input())\nA = []\nfor i in range(N+1):\n if i % 3 != 0 and i % 5 != 0:\n A.append(i)\nprint(sum(A))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s409628733', 's538922345', 's192126198']
[48424.0, 8912.0, 29804.0]
[254.0, 23.0, 181.0]
[117, 115, 113]
p02712
u966891144
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N = int(input())\nans = 0\nfor i in range(1, N):\n if i % 3 == 0 or i % 5 == 0:\n ans += i\nprint(ans)', 'N = int(input())\nans = 0\nfor i in range(1, N+1):\n if not i % 3 == 0 and not i % 5 == 0:\n ans += i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s881430015', 's629184649']
[9168.0, 9120.0]
[150.0, 154.0]
[101, 112]
p02712
u967484343
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N = int(input())\nans = 0\nfor i in range(N):\n if i % 3 != 0 or i % 5 != 0:\n ans += i\nprint(ans)', 'N = int(input())\nans = 0\nfor i in range(N):\n if i+1 % 3 != 0 and i+1 % 5 != 0:\n ans += i+1\nprint(ans)', 'N = int(input())\nans = 0\nfor i in range(N):\n j = i + 1\n if j % 3 != 0 and j % 5 != 0:\n ans += j\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s367160688', 's369622507', 's359034590']
[9096.0, 9096.0, 9056.0]
[164.0, 227.0, 211.0]
[98, 105, 111]
p02712
u968167998
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\n\ndef f(num):\n return num*(num+1)/2\n\nn1 = int(n/3)\nn2 = int(n/5)\nn3 = int(n/15)\n\nsm = f(n)- 3*f(n1)-5*f(n2) + 15*f(n3)\n# f(n)- 3*f(int(n/3))\n\nprint(sm)', 'n = int(input())\n\ndef f(num):\n return num*(num+1)/2\n\nn1 = int(n/3)\nn2 = int(n/5)\nn3 = int(n/15)\n\nsm = f(n)- 3*f(n1)-5*f(n2) + 15*f(n3)\n# f(n)- 3*f(int(n/3))\n\nprint(int(sm))']
['Wrong Answer', 'Accepted']
['s219188490', 's652362325']
[9080.0, 9180.0]
[21.0, 19.0]
[168, 173]
p02712
u969601826
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n=int(input())\nre=0\nfor i in range(1,n+1):\n if (i%3!=0) and (i%5!=0)\n re+=i\nprint(re)', 'n=int(input())\nre=0\nfor i in range(1,n+1):\n if (i%3!=0) and (i%5!=0):\n re+=i\nprint(re)']
['Runtime Error', 'Accepted']
['s675638273', 's596798520']
[8956.0, 9108.0]
[20.0, 159.0]
[86, 87]
p02712
u971124021
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nm = 100000\nans = 0\ncnt3 = 0\ncnt5 = 0\nfor i in range(n):\n if i%3 == 0:\n cnt3 += i//3\n elif i%5 == 0:\n cnt5 += i//5\n\nif n%2 == 0:\n S = (n+1)*n//2\nelse:\n S = (n+1)*n//2 + (n+1)//2\n\nprint(S - cnt3*3 - cnt5*5)\n', 'n = int(input())\n\nans = 0\nfor i in range(1,n+1):\n if i%3 != 0 and i%5 != 0:\n ans += i\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s225893322', 's175388158']
[9124.0, 9076.0]
[162.0, 163.0]
[232, 102]
p02712
u975719989
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nlong sum = 0\nfor i in range(1, n):\n if i % 3 == 0 and i % 5 == 0:\n pass\n elif i % 3 == 0:\n pass\n elif i % 5 == 0:\n pass\n else:\n sum+= i\nprint(sum)', 'n = int(input())\nsum = 0\nfor i in range(1, n + 1):\n if i % 3 != 0 and i % 5 != 0:\n sum += i\nprint(sum)']
['Runtime Error', 'Accepted']
['s280121850', 's428268121']
[9000.0, 9168.0]
[22.0, 155.0]
[203, 112]
p02712
u987326700
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nfizzbuzz = [i for i in range(n+1) if i%5!=0 and i%3!=0]\nprint(sum(fizzbuss))', 'n = int(input())\nfizzbuzz = [i for i in range(n+1) if i%5!=0 and i%3!=0]\nprint(sum(fizzbuzz))']
['Runtime Error', 'Accepted']
['s192535410', 's102127112']
[30008.0, 29848.0]
[119.0, 121.0]
[93, 93]
p02712
u988191897
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N = int(input())\n\nT = 0\nif N == 1:\n\tprint(1)\nelif N == 2:\n\tprint(3)\nelse:\n\tfor i in range(N):\n\t\tif i % 3 != 0 and i % 5 != 0:\n\t\t\tT += i\n\t\tprint(T)', 'N = int(input())\nT = 0\nfor i in range(N+1):\n\tif i % 15 == 0:\n\t\tT += 0\n\telif i % 3 == 0:\n\t\tT += 0\n\telif i % 5 == 0:\n\t\tT += 0\n\telse:\n\t\tT += i\nprint(T)']
['Wrong Answer', 'Accepted']
['s616400456', 's600480472']
[14772.0, 9184.0]
[492.0, 210.0]
[146, 148]
p02712
u989089752
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\ns = []\nfor i in range(n):\n if not i%3==0 and i%5==0:\n s.append(i)\nprint(sum(s))\n \n \n', 'n = int(input())\ns = []\nfor i in range(n):\n if not i%3 and i%5==0:\n s.append(i)\nprint(sum(s))\n \n \n', 'n = int(input())\nans = 0\nfor i in range(n+1):\n if i%3!=0 and i%5!=0:\n ans = ans + i\nprint(ans)\n \n \n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s506596273', 's889368432', 's986833309']
[14016.0, 11624.0, 9084.0]
[133.0, 109.0, 158.0]
[114, 111, 112]
p02712
u994527877
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nsum = 0\nfor i in range(1,n+1):\n if i % 3 == 0 or i % 5 == 0:\n continue\n else: \n sum += i', 'n = int(input())\nsum = 0\nfor i in range(1,n+1):\n if i % 3 == 0 or i % 5 == 0:\n continue\n else: \n sum += i\nprint(sum)']
['Wrong Answer', 'Accepted']
['s161239568', 's301246458']
[9160.0, 9168.0]
[153.0, 151.0]
[113, 124]
p02712
u994935583
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['N = 31\nN_list = [1,3,3,7,7,7,14,22,22,22,33,33,46,60,60]\nN_add15 = [1,2,2,3,3,3,4,5,5,5,6,6,7,8,8]\n\n\nnum_15 = N // 15\n\nn_list = N_list[N%15-1] + 15 * N_add15[N%15-1] * (num_15)\n\nif(N < 16):\n ans = N_list[N-1]\nelse:\n ans = num_15 * num_15 * 60 + n_list\n\nprint(ans)', 'N = int(input())\n\nN_list = [1,3,3,7,7,7,14,22,22,22,33,33,46,60,60]\nN_add15 = [1,2,2,3,3,3,4,5,5,5,6,6,7,8,8]\n\n\nnum_15 = N // 15\n\nn_list = N_list[N%15-1] + 15 * N_add15[N%15-1] * (num_15)\n\nif(N < 16):\n ans = N_list[N-1]\nelse:\n ans = num_15 * num_15 * 60 + n_list\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s509644720', 's926172455']
[9076.0, 9208.0]
[23.0, 22.0]
[269, 281]
p02712
u997036872
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['a = input()\nlists = [i+1 for i in range(a)]\nfor t in lists:\n if t % 5 == 0:\n lists.remove(t)\n elif t % 3 ==0:\n lists.remove(t)\n \nprint(sum(lists))', 'a = int(input())\nlists = [i+1 for i in range(a)]\nfor t in lists:\n if t % 5 == 0:\n lists.remove(t)\n elif t % 3 ==0:\n lists.remove(t)\n \nprint(sum(lists))', 'a = int(input())\nlists = [i+1 for i in range(a) if (i+1)%5!=0 and (i+1)%3!=0]\n\nprint(sum(lists))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s079589828', 's470650533', 's550774379']
[8912.0, 48656.0, 30020.0]
[22.0, 2207.0, 164.0]
[157, 162, 96]
p02712
u997389162
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['ans = 0\nfor i in range(1,int(input())+1):\n if i%15 == 0:\n ans += 8\n elif i%3==0 or i%5 == 0:\n ans += 4\n else:\n ans += i\n \nprint(ans)', 'ans = 0\nfor i in range(1,int(input())+1):\n if i%3 != 0 and i%5!= 0:\n ans+= i\n \n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s320543545', 's747098698']
[9108.0, 9080.0]
[218.0, 160.0]
[169, 111]
p02712
u999750647
2,000
1,048,576
Let us define the **FizzBuzz sequence** a_1,a_2,... as follows: * If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}. * If the above does not hold but 3 divides i, a_i=\mbox{Fizz}. * If none of the above holds but 5 divides i, a_i=\mbox{Buzz}. * If none of the above holds, a_i=i. Find the sum of all numbers among the first N terms of the FizzBuzz sequence.
['n = int(input())\nans = 0\nfor i in range(n):\n if i%3 != 0 or i%5 != 0:\n ans += i\nprint(ans)', 'n = int(input())\nans = 0\nfor i in range(n+1):\n if i%3 != 0 and i%5 != 0:\n ans += i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s192397260', 's431409995']
[9164.0, 9048.0]
[162.0, 157.0]
[100, 103]
p02713
u000349418
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['n = int(input())\ni = 1\nj = 1\nk = 1\nans = 0\nwhile i < n+1:\n j = 1\n while j < n+1:\n k = 1\n p = gcd(i,j)\n while k < n+1:\n if (p-1)*(k-1) == 0:\n ans += 1\n else:\n ans += gcd(k,p)\n k += 1\n j += 1\n i += 1\nprint(ans)', 'def gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y,x%y)\n\nG = []\ni,j = 1,1\nwhile i < 201:\n j = 1\n g0 = []\n while j < 201:\n g0.append(gcd(i,j))\n j += 1\n g0 = tuple(g0)\n G.append(g0)\n i += 1\nn = int(input())\ni = 1\nj = 1\nk = 1\nans = 0\nwhile i < n+1:\n j = 1\n while j < n+1:\n k = 1\n p = G[i-1][j-1]\n while k < n+1:\n ans += G[k-1][p-1]\n k += 1\n j += 1\n i += 1\nprint(ans)']
['Runtime Error', 'Accepted']
['s574236716', 's549729014']
[9196.0, 9540.0]
[19.0, 1845.0]
[308, 480]
p02713
u002459665
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['K = int(input())\n\nfrom fractions import gcd\n\n\nd = {}\nd2 = {}\n\ndef f(x, y, z):\n s = gcd(x, y)\n t = gcd(s, z)\n return t\n\nans = 0\nfor i in range(1, K+1):\n for j in range(i, K+1):\n for k in range(j, K+1):\n if i == j == k:\n ans += f(i, j, k)\n elif i == j or j == k:\n ans += 3 * f(i, j, k)\n else:\n ans += 6 * f(i, j, k)\n\nprint(ans)', 'K = int(input())\n\n# from fractions import gcd\nfrom math import gcd\n\n\n\n# return r\n\nans = 0\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n # ans += f(i, j, k)\n ans += gcd(gcd(i, j), k)\n\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s108034236', 's946872032']
[10576.0, 9172.0]
[2206.0, 1815.0]
[440, 302]
p02713
u004482945
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['a = int(input())\nfrom math import gcd\nb = 0\nfor i in range(1, n + 1):\n for j in range(1, n + 1):\n for k in range(1, n + 1):\n b += gcd(gcd(i, j), k)\n \nprint(b)', 'a = int(input())\nfrom math import gcd\nb = 0\nfor i in range(1, a + 1):\n for j in range(1, a + 1):\n for k in range(1, a + 1):\n b += gcd(gcd(i, j), k)\n \nprint(b)']
['Runtime Error', 'Accepted']
['s341905559', 's724420129']
[9112.0, 9104.0]
[23.0, 1763.0]
[172, 172]
p02713
u006880673
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from functools import reduce\nfrom math import gcd\n\n\nk = int(input())\nl = range(1, k+1)\ns = 0\n\nfor a in l:\n for b in l:\n for c in l:\n l = [a, b, c]\n g = reduce(gcd, l)\n s += g\n \nprint(s)', 'from math import gcd\n\nk = int(input())\nrange(1, k+1)\n\nl1 = range(1, k+1)\ndef loop(s):\n for a in l1:\n for b in l1:\n for c in l1:\n l2 = (a, b, c)\n g1 = gcd(a,b)\n g2 = gcd(g1, c)\n s += g2\n return s\n\nprint(loop(0))']
['Wrong Answer', 'Accepted']
['s780967762', 's719873965']
[9628.0, 9196.0]
[24.0, 1651.0]
[239, 294]
p02713
u009885900
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
[' import math\n\nK = int(input())\ngcd_map = [[[0] * K for i in range(K)] for j in range(K)]\n\nans = 0\n\nfor a in range(1, K+1):\n\tfor b in range(1, K+1):\n\t\tfor c in range(1, K+1):\n\t\t\t\tif gcd_map[a-1][b-1][c-1] == 0:\n\t\t\t\t\tgcd = math.gcd(math.gcd(a,b), c)\n\t\t\t\t\tgcd_map[a-1][b-1][c-1] = gcd\n\t\t\t\t\tgcd_map[a-1][c-1][b-1] = gcd\n\t\t\t\t\tgcd_map[b-1][a-1][c-1] = gcd\n\t\t\t\t\tgcd_map[b-1][c-1][a-1] = gcd\n\t\t\t\t\tgcd_map[c-1][a-1][b-1] = gcd\n\t\t\t\t\tgcd_map[c-1][b-1][a-1] = gcd\n\t\t\t\t\tans += gcd\n\t\t\t\telse:\n\t\t\t\t\tans += gcd_map[a-1][b-1][c-1]\n\nprint(ans)', 'import math\n \nK = int(input())\n \nans = 0\n \nfor a in range(1, K+1):\n\tfor b in range(1, K+1):\n\t\ttmp = math.gcd(a,b)\n\t\tfor c in range(1, K+1):\n\t\t\tans += math.gcd(tmp,c)\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s744868602', 's866339025']
[9028.0, 9184.0]
[22.0, 1387.0]
[524, 178]
p02713
u010870870
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nN = int(input())\nsum = 0\n\nfor i in range(N):\n for j in range(N):\n for k in range(N):\n g = math.gcd(i,j)\n sum += math.gcd(g,k)\n\nprint(sum)', 'import math\n\nN = int(input())\nsum = 0\n\nfor i in range(N):\n for j in range(N):\n g = math.gcd(i+1,j+1)\n for k in range(N):\n sum += math.gcd(g,k+1)\n\nprint(sum)\n']
['Wrong Answer', 'Accepted']
['s874431025', 's180756175']
[9112.0, 9168.0]
[2205.0, 1380.0]
[182, 185]
p02713
u012064151
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nfrom functools import reduce\n\n\ndic = {}\nans = 0\nn = int(input())\nfor i in range(n):\n for j in range(n):\n for k in range(n):\n key=(i+1)*(j+1)*(k+1)\n if key in dic:\n ans = ans+dic[key]\n else:\n val = gcd(gcd(i+1, j+1), k+1)\n dic[key] = val\n ans = ans + val\nprint(ans)', 'from math import gcd\nk = int(input())+1\nans = 0\nfor i in range(1,k):\n for j in range(1,k):\n for l in range(1,k):\n ans+=gcd(gcd(i,j),l)\nprint(ans)']
['Runtime Error', 'Accepted']
['s906318394', 's365227796']
[9576.0, 9180.0]
[25.0, 1951.0]
[379, 166]
p02713
u013629972
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['K = int(input())\n\nans = 0\nfor a in range(1, K+1):\n for b in range(1, K+1):\n for c in range(1, K+1):\n ans += math.gcd(math.gcd(a,b),c)\nprint(ans)\nexit()\n', 'import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nsys.setrecursionlimit(10**7)\nfrom queue import PriorityQueue\nfrom fractions import gcd\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef _I(): return int(sys.stdin.readline())\ndef _F(): return float(sys.stdin.readline())\ndef _pf(s): return print(s, flush=True)\ndef gcd(*numbers):\n return functools.reduce(math.gcd, numbers)\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort(reverse=True)\n return divisors\n\nK = _I()\n\nans = 0\n\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += math.gcd(math.gcd(i,j),k)\nprint(ans)\nexit()\n', 'import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nsys.setrecursionlimit(10**7)\nfrom queue import PriorityQueue\nfrom fractions import gcd\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef _I(): return int(sys.stdin.readline())\ndef _F(): return float(sys.stdin.readline())\ndef _pf(s): return print(s, flush=True)\ndef gcd(*numbers):\n return functools.reduce(math.gcd, numbers)\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort(reverse=True)\n return divisors\n\nK = _I()\n\nans = 0\n\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += gcd(gcd(i,j),k)\nprint(ans)\nexit()\n', 'import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nsys.setrecursionlimit(10**7)\nfrom queue import PriorityQueue\nfrom fractions import gcd\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef _I(): return int(sys.stdin.readline())\ndef _F(): return float(sys.stdin.readline())\ndef _pf(s): return print(s, flush=True)\ndef gcd(*numbers):\n return functools.reduce(math.gcd, numbers)\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort(reverse=True)\n return divisors\n\nK = _I()\n\nans = 0\n\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += gcd(i,j,k)\nprint(ans)\nexit()\n', 'import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nsys.setrecursionlimit(10**7)\nfrom queue import PriorityQueue\nfrom fractions import gcd\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef _I(): return int(sys.stdin.readline())\ndef _F(): return float(sys.stdin.readline())\ndef _pf(s): return print(s, flush=True)\n\n# return functools.reduce(math.gcd, numbers)\n\n\n\n\n\n\n\n\n\n\n\nK = _I()\n\nans = 0\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += math.gcd(math.gcd(i,j),k)\nprint(ans)\nexit()\n', 'import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nsys.setrecursionlimit(10**7)\nfrom queue import PriorityQueue\nfrom fractions import gcd\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef _I(): return int(sys.stdin.readline())\ndef _F(): return float(sys.stdin.readline())\ndef _pf(s): return print(s, flush=True)\n\n# return functools.reduce(math.gcd, numbers)\n\n\n\n\n\n\n\n\n\n\n\nK = _I()\n\nans = 0\nfor a in range(1, K+1):\n for b in range(1, K+1):\n for c in range(1, K+1):\n ans += math.gcd(math.gcd(a,b),c)\nprint(ans)\nexit()\n', 'from math import gcd\nK = int(input())\n\nans = 0\nfor a in range(1, K+1):\n for b in range(1, K+1):\n for c in range(1, K+1):\n ans += gcd(gcd(a,b),c)\nprint(ans)\nexit()\n']
['Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s113364761', 's161735517', 's220041757', 's369001651', 's479228029', 's818438712', 's104240757']
[9104.0, 11204.0, 11220.0, 11236.0, 11228.0, 11160.0, 9164.0]
[22.0, 2206.0, 2206.0, 2206.0, 2206.0, 2206.0, 1894.0]
[173, 1225, 1215, 1210, 1257, 1257, 184]
p02713
u016901717
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['k=int(input())\nimport math\n\nfor p in range(1,k+1):\n for q in range(1,k+1):\n for r in range(1,k+1):\n ans=p\n ans = math.gcd(ans, q)\n ans = math.gcd(ans, r)\n sum_g+=ans\n ans=0\nprint(sum_g)\n', 'k=int(input())\nimport fractions\nsum_g=0\nfor p in range(1,k+1):\n for q in range(1,k+1):\n for r in range(1,k+1):\n ans=p\n ans = fractions.gcd(ans, q)\n ans = fractions.gcd(ans, r)\n sum_g+=ans\n ans=0\nprint(sum_g)', 'k=int(input())\nimport fractions\n\nfor p in range(1,k+1):\n for q in range(1,k+1):\n for r in range(1,k+1):\n ans=p\n ans = fractions.gcd(ans, q)\n ans = fractions.gcd(ans, r)\n sum_g+=ans\n ans=0\nprint(sum_g)\n', 'k=int(input())\nimport fractions\nimport itertools\nsum_g=0\nl=list(itertools.product([i for i in range(1,k+1)], repeat=3))\nfor p,q,r in l:\n ans=p\n ans = fractions.gcd(ans, q)\n ans = fractions.gcd(ans, r)\n sum_g+=ans\n ans=0\nprint(sum_g)\n', 'import math\n\nK=int(input())\nsum=0\n\n\nfor i in range(1,K+1):\n for j in range(1,K+1):\n a=math.gcd(i,j)\n for k in range(1,K+1):\n b=math.gcd(a, k)\n sum = sum + b\n\nprint(sum)\n']
['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s130024691', 's404611789', 's571087982', 's635370508', 's590633140']
[9124.0, 10620.0, 10640.0, 580788.0, 9176.0]
[23.0, 2206.0, 32.0, 2223.0, 1513.0]
[251, 272, 266, 248, 208]
p02713
u017415492
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import fractions\nk=int(input())\nans=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n for l in range(1,k+1):\n a=fractions.gcd(i,j)\n a=fractions.gcd(a,l)\n ans+=a\nprint(ans)', 'import math\nk=int(input())\nans=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n b=math.gcd(i,j)\n for l in range(1,k+1):\n a=math.gcd(b,l)\n ans+=a\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s157852698', 's606818392']
[10640.0, 9120.0]
[2206.0, 1586.0]
[190, 173]
p02713
u021916304
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nk = int(input())\nans = 0\n\nfor i in range(1,k+1):\n\tfor j in range(1,k+1):\n \tfor k in range(1,k+1):\n \tans += math.gcd(i,math.gcd(j,k))\nprint(ans)\n', 'import math\nk = int(input())\nans = 0\n\nfor i in range(1,k+1):\n\tfor j in range(1,k+1):\n \tfor n in range(1,k+1):\n \tans += math.gcd(i,math.gcd(j,n))\nprint(ans)\n', 'import math\nk = int(input())\nans = 0\n\nfor i in range(1,k+1):\n\tfor j in range(i+1,k+1):\n \tfor k in range(j+1,k+1):\n \tans += math.gcd(i,math.gcd(j,k))\nprint(ans)', "import math\nk = int(input())\nans = 0\nif k < 3:\n for i in range(1,k+1):\n for j in range(1,k+1):\n for n in range(1,k+1):\n ans += math.gcd(i,math.gcd(j,n))\nelse: \n #i*j\n for n in range(1,k+1):\n for i in range(1,k+1):\n ans += math.gcd(n,i)\n for j in range(i+1,k+1): \n ans += 2*(math.gcd(math.gcd(i,j),n))\n\n '''\n for i in range(1,k+1):\n for j in range(i+1,k+1):\n for k in range(j+1,k+1):\n ans += math.gcd(i,math.gcd(j,k))\n '''\nprint(ans)"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s898934285', 's909329376', 's954210072', 's802360497']
[8988.0, 8964.0, 8956.0, 9240.0]
[21.0, 24.0, 21.0, 1237.0]
[170, 170, 173, 587]
p02713
u026862065
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nk = int(input())\nsum = 0\nfor i in range(1, k):\n for j in range(1, k):\n for m in range(1, k):\n sum += math.gcd(math.gcd(i, j), m)\nprint(sum)\n\n', 'import math\n\nk = int(input())\nsum = 0\nfor i in range(1, k):\n for j in range(1, k):\n for m in range(1, k):\n sum += math.gcd(math.gcd(i, j), m)\nprint(sum)', 'from math import gcd\n\nk = int(input())\nsum = 0\nfor i in range(1, k + 1):\n for j in range(1, k + 1):\n for m in range(1, k + 1):\n sum += gcd(gcd(i, j), m)\nprint(sum)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s282788454', 's987103810', 's005925067']
[9164.0, 9072.0, 9180.0]
[2205.0, 2205.0, 1837.0]
[175, 173, 184]
p02713
u031115006
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nfrom functools import reduce\nK=int(input())\ni=1\nr=0\nfor i in range(K+1):\n j=1\n for j in range(K+1):\n k=1\n for k in range(K+1):\n if(i==1 or j==1 or k==1):\n r+=1\n elif(i==j and j==k):\n r+=i\n else:\n r+=math.gcd(i, math.gcd(j, k))\n k+=1\n j+=1\n i+=1\nprint(r)', 'import math\n\nK=int(input())\nr=0\n\nfor i in range(1,K+1):\n for j in range(1,K+1):\n a=math.gcd(i,j)\n for k in range(K+1):\n b=math.gcd(a,k)\n r+=b\nprint(r)', 'mport math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nK=int(input())\n\ni=1\nj=1\nk=1\nr=0\nlist=[2,3,5,7,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199]\n\nwhile(i<K+1):\n j=1\n f=0\n if(i in list == True):\n f=1\n while(j<K+1):\n k=1\n g=0\n if(j in list == True):\n g=1\n while(k<K+1):\n h=0\n if(k in list == True):\n h=1\n if(i==1 or j==1 or k==1):\n r+=1\n elif(f==1 and g==1 and h==1):\n if(i==j and j==k):\n r+=i\n else:\n r+=1\n else:\n r+=gcd(i, j, k)\n k+=1\n j+=1\n i+=1\n\nprint(r)\n', 'import math\n\nK=int(input())\nr=0\n\nfor i in range(1,K+1):\n for j in range(1,K+1):\n a=math.gcd(i,j)\n for k in range(1,K+1):\n b=math.gcd(a,k)\n r+=b\nprint(r)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s428907738', 's548342649', 's981493167', 's518201817']
[9512.0, 9176.0, 9012.0, 9180.0]
[2205.0, 1666.0, 23.0, 1611.0]
[318, 167, 712, 169]
p02713
u035445296
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\nfrom functools import reduce\nk = int(input())\ndef GCD(*numbers):\n return reduce(gcd, numbers)\nans = 0 \nfor i in range(1, k+1):\n for j in range(1, k+1):\n for l in range(1, k+1):\n ans += GCD(i, j ,l)\nprint(ans)', 'from math import gcd\nans = 0\nk = int(input())\nfor i in range(1, k+1):\n for j in range(1, k+1):\n GCD = gcd(i, j)\n for l in range(1, k+1):\n ans += gcd(GCD, l)\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s379155846', 's026113965']
[10700.0, 9112.0]
[2206.0, 1155.0]
[246, 179]
p02713
u038408819
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\ndef multi_gcd(a):\n ans = a[0]\n for i in range(1, len(a)):\n ans = fractions.gcd(ans, a[i])\n #print(ans)\n return ans\nK = int(input())\nsum_ = 0\nfor i in range(1, K + 1):\n for j in range(1, K + 1):\n for k in range(1, K + 1):\n sum_ += multi_gcd([i, j, k])\nprint(sum_)', 'import math\nk = int(input())\nans = 0\nfor i in range(1, k + 1):\n for j in range(1, j + 1):\n gcd1 = math.gcd(i, j)\n for l in range(1, l + 1):\n gcd2 = math.gcd(gcd1, l)\n ans += gcd2\nprint(ans)', 'import math\nk = int(input())\nans = 0\nfor i in range(1, k + 1):\n for j in range(1, k + 1):\n gcd1 = math.gcd(i, j)\n for l in range(1, k + 1):\n gcd2 = math.gcd(gcd1, l)\n ans += gcd2\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s193209293', 's693780528', 's158337730']
[9204.0, 9188.0, 9124.0]
[23.0, 21.0, 1516.0]
[314, 228, 228]
p02713
u038887660
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\ncount=0\nfor p in range(1,k+1):\n for q in range(1,k+1):\n for r in range(1,k+1):\n count+=math.gcd(math.gcd(p,q), r)\n \nprint(count)', 'import math\nk = int(input())\ncount=0\nfor p in range(1,k+1):\n for q in range(p,k+1):\n for r in range(q,k+1):\n if p == q == r:\n count+=math.gcd(math.gcd(p,q), r)\n elif p == q:\n count+=math.gcd(math.gcd(p,q), r)*3\n elif q == r:\n count+=math.gcd(math.gcd(p,q), r)*3\n elif p == r:\n count+=math.gcd(math.gcd(p,q), r)*3\n else:\n count+=math.gcd(math.gcd(p,q), r)*6\nprint(count)']
['Runtime Error', 'Accepted']
['s524510965', 's670767437']
[9052.0, 9208.0]
[22.0, 660.0]
[172, 509]
p02713
u042497514
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\nimport math\nK = int(input())\nSum = 0\nfor i in range(K):\n for j in range(K):\n for k in range(K):\n x = math.gcd(i + 1, j + 1)\n y = math.gcd(i + 1, k + 1)\n Sum = Sum + math.gcd(x, y)\nprint(Sum)', 'import math\nK = int(input())\nSum = 0\nfor i in range(K):\n for j in range(i + 1):\n x = math.gcd(i + 1, j + 1)\n for k in range(j + 1):\n y = math.gcd(j + 1, k + 1)\n if (i == j) and (i == k):\n Sum = Sum + math.gcd(x, y)\n elif (i == j) or (i == k) or (j == k):\n Sum = Sum + 3 * math.gcd(x, y)\n else:\n Sum = Sum + 6 * math.gcd(x, y)\nprint(Sum)']
['Time Limit Exceeded', 'Accepted']
['s130517091', 's481558347']
[10392.0, 9200.0]
[2205.0, 664.0]
[235, 384]
p02713
u042558137
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nK = int(input()) + 1\nd = 0\n\nfor i in range(1, K):\n for j in range(1, K):\n for k in range(1, K):\n d = gcd(i, j, k) + d\nprint(d)', 'from math import gcd\n\nK = int(input()) + 1\nd = 0\n\nfor i in range(1, K):\n for j in range(1, K):\n for k in range(1, K):\n d = gcd(gcd(i, j), k) + d\nprint(d)']
['Runtime Error', 'Accepted']
['s468605833', 's881523833']
[9148.0, 9168.0]
[22.0, 1834.0]
[160, 174]
p02713
u046158516
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nK=200\nans=0\nfor a in range(1,K+1):\n for b in range(1,K+1):\n for c in range(1,K+1):\n tempgcd=math.gcd(a,b)\n ans=ans+math.gcd(tempgcd,c)\nprint(ans)', 'import math\nK=200\nans=0\nfor a in range(1,K+1):\n for b in range(a,K+1):\n for c in range(b,K+1):\n tempgcd=math.gcd(a,b)\n if a==b or b==c or a==c:\n if a==b and b==c:\n ans=ans+math.gcd(tempgcd,c)\n else:\n ans=ans+3*math.gcd(tempgcd,c)\n else:\n ans=ans+6*math.gcd(tempgcd,c)\n \nprint(ans)', 'import math\nK=int(input())\nans=0\nfor a in range(1,K+1):\n for b in range(a,K+1):\n for c in range(b,K+1):\n tempgcd=math.gcd(a,b)\n if a==b or b==c or a==c:\n if a==b and b==c:\n ans=ans+math.gcd(tempgcd,c)\n else:\n ans=ans+3*math.gcd(tempgcd,c)\n else:\n ans=ans+6*math.gcd(tempgcd,c)\n \nprint(ans)\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s690429077', 's972425940', 's618760642']
[8948.0, 9072.0, 9200.0]
[2205.0, 635.0, 610.0]
[189, 403, 413]
p02713
u047023156
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import sys\nfrom fractions import gcd\ninput = sys.stdin.readline\n\nK = int(input())\nans = 0\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += gcd(gcd(i, j), k)\n\nprint(ans)\n', 'import sys\nfrom math import gcd\ninput = sys.stdin.readline\n\nK = int(input())\nans = 0\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += gcd(gcd(i, j), k)\n\nprint(ans)\n']
['Time Limit Exceeded', 'Accepted']
['s454717255', 's206134892']
[10652.0, 9176.0]
[2206.0, 1886.0]
[223, 218]
p02713
u047719604
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\nk = int(input())\nsum = 0\nfor a in range(1,k+1):\n for b in range(1,k+1):\n for c in range(1,k+1):\n sum += gcd(gcd(a,b),c)\nprint(sum) ', 'from fractions import gcd\nk = int(input())\nsum = 0\nfor a in range(1,k+1):\n for b in range(1,k+1):\n for c in range(1,k+1):\n sum += gcd(gcd(a,b),c)\nprint(sum) \n ', 'from math import gcd\nk = int(input())\nsum = 0\nlst = []\nfor a in range(1,k+1):\n for b in range(1,k+1):\n g = gcd(a,b)\n lst.append(g)\nfor c in range(1,k+1):\n for i in range(len(lst)):\n sum += gcd(lst[i],c) \nprint(sum) ']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s220333693', 's463013016', 's176117318']
[10472.0, 10548.0, 9224.0]
[2206.0, 2206.0, 1433.0]
[171, 182, 245]
p02713
u050641473
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nK = int(input())\nans = 0\n\nfor i in range(1,K+1):\n for j in range(1,K+1):\n ab = math.gcd(a, b)\n for k in range(1,K+1):\n ans += math.gcd(ab, c)\n\nprint(ans)', 'import math\n\nK = int(input())\nans = 0\n\nfor i in range(1,K+1):\n for j in range(1,K+1):\n ij = math.gcd(i, j)\n for k in range(1,K+1):\n ans += math.gcd(ij, k)\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s949538301', 's877930093']
[9188.0, 9076.0]
[25.0, 1317.0]
[178, 178]
p02713
u051928503
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import fractinons\nK=int(input())\nans=0\nfor a in range(1,K+1):\n\tfor b in range(1,K+1):\n\t\tfor c in range(1,K+1):\n\t\t\tans+=fractions.gcd(fractions.gcd(a,b),c)\nprint(ans)', 'import math\nK=int(input())\nans=0\nfor a in range(1,K+1):\n\tfor b in range(a,K+1):\n\t\tfor c in range(b,K+1):\n\t\t\tA=math.gcd(math.gcd(a,b),c)\n\t\t\tif a==b and b==c:\n\t\t\t\tans+=A\n\t\t\telif a==b or b==c:\n\t\t\t\tans+=(A*3)\n\t\t\telse:\n\t\t\t\tans+=(A*6)\nprint(ans)\n\n']
['Runtime Error', 'Accepted']
['s156532925', 's033788355']
[9108.0, 9132.0]
[25.0, 571.0]
[165, 241]
p02713
u054729397
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\n\nK=int(input())+1\nsum=0\n\nfor i in range(1,K):\n for j in range(1,K):\n for k in range(1,K):\n sum+=gcd(gcd(1,j),k) \nprint(sum)', 'from math import gcd\n\nK=int(input())+1\nsum=0\n\nfor i in range(1,K):\n for j in range(1,K):\n for k in range(1,K):\n sum+=gcd(gcd(i,j),k) \nprint(sum)']
['Wrong Answer', 'Accepted']
['s198552006', 's091668805']
[9168.0, 9176.0]
[1492.0, 1851.0]
[157, 157]
p02713
u057993957
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['k = int(input())\n\nfrom functools import reduce\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\ntotal = 0\nfor i in range(1, k+1):\n for j in range(i, k+1):\n for k in range(j, k+1):\n if i == j and j == k and i == k:\n x = 1\n elif i != j and i != k and j != k:\n x = 6\n else:\n x = 3\n \n total += x * gcd_list([i, j, k])\nprint(total)', 'from itertools import combinations\nimport math\nfrom functools import reduce\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\nn = int(input())\n\ntotal = 0\nfor i in range(1, n+1):\n for j in range(i, n+1):\n for k in range(j, n+1):\n if i == j and j == k and i == k:\n x = 1\n elif i != j and j != k and i != k:\n x = 6\n else:\n x = 3\n \n total += x * gcd_list([i, j, k])\n \nprint(total)']
['Runtime Error', 'Accepted']
['s800859618', 's001147410']
[9508.0, 9596.0]
[24.0, 911.0]
[388, 506]
p02713
u062484507
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nk = int(read())\nans = 0\nfor a in range(1, n+1):\n for b in range(1, n + 1):\n n = math.gcd(a, b)\n for c in range(1, n+1):\n ans += math.gcd(n, c)\nprint(ans)', 'import math\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nk = int(read())\nans = 0\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n n = math.gcd(a, b)\n for c in range(1, k + 1):\n ans += math.gcd(n, c)\nprint(ans)']
['Runtime Error', 'Accepted']
['s196333548', 's848698630']
[9204.0, 9164.0]
[23.0, 1567.0]
[310, 314]
p02713
u062808720
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nK = int(input())\n\nsum = 0\nfor a in range(1, K+1) :\n for b in range(1 , K+1) :\n tmp = math.gcd(a, b)\n for c in range(1 , K+1) :\n sum = sum + math.gcd(a, tmp)\n\nprint(sum)\n', 'import math\n\nK = int(input())\n\nsum = 0\nfor a in range(1, K+1) :\n for b in range(1 , K+1) :\n tmp = math.gcd(a, b)\n for c in range(1 , K+1) :\n sum = sum + math.gcd(tmp, c)\n\nprint(sum)\n']
['Wrong Answer', 'Accepted']
['s560290546', 's831601282']
[9076.0, 9176.0]
[1215.0, 1389.0]
[210, 210]
p02713
u067694718
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nk = int(input())\nsum = 0\nfor a in range(1, k):\n for b in range(1, k):\n tmp = gcd(a,b)\n for c in range(1, k):\n sum += gcd(tmp, c)\nprint(sum)', 'from math import gcd\nk = int(input())\nsum = 0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n tmp = gcd(a,b)\n for c in range(1, k+1):\n sum += gcd(tmp, c)\nprint(sum)\n']
['Wrong Answer', 'Accepted']
['s050163938', 's822918573']
[9176.0, 9172.0]
[1180.0, 1149.0]
[172, 179]
p02713
u068844030
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nk = int(input())\nans = 0\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n for c in range(1, k + 1):\n ans = gcd(gcd(a,b),c)\nprint(ans)\n', 'from math import gcd\nk = int(input())\nans = 0\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n for c in range(1, k + 1):\n ans += gcd(gcd(a,b),c)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s765195511', 's000133790']
[9156.0, 9084.0]
[1709.0, 1918.0]
[181, 182]
p02713
u072717685
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
["def main():\n k = int(input())\n r = 0\n for ia in range(1, k + 1):\n for ib in range(1, k + 1):\n for ic in range(1, k + 1):\n t1 = gcd(ib, ic)\n r += gcd(t1,ia)\n print(r)\n\nif __name__ == '__main__':\n main()", "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\ndef main():\n n = int(input())\n s = input()\n\n rr = [i for i, c in enumerate(s) if c == 'R']\n g = [i for i, c in enumerate(s) if c == 'G']\n b = [i for i, c in enumerate(s) if c == 'B']\n\n r = len(rr) * len(g) * len(b)\n for rre in rr:\n for ge in g:\n for be in b:\n r -= rre * 2 == ge + be\n r -= ge * 2 == rre + be\n r -= be * 2 == ge + rre\n print(r)\n\nif __name__ == '__main__':\n main()\n", "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nimport numpy as np\ndef main():\n k = int(input())\n\n k2 = np.arange(1, k+1)\n k2gcd = np.gcd.outer(k2, np.gcd.outer(k2, k2))\n print(k2gcd.sum())\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s057405794', 's711053557', 's273421285']
[9204.0, 9004.0, 89564.0]
[22.0, 25.0, 304.0]
[264, 535, 257]
p02713
u077003677
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
["import sys\nimport os\nimport fractions\nimport itertools\n\ndef file_input():\n f = open('Beginner_Contest_162/input.txt', 'r')\n sys.stdin = f\n\ndef main():\n #file_input()\n K=int(input())\n # map(int, input().split())\n sum=0\n\n combi_l = itertools.combinations_with_replacement(range(1,K+1),3)\n # print(combi_l)\n\n for combi in combi_l:\n # print(combi)\n if combi[0]==combi[1]==combi[2]:\n sum+=fractions.gcd(fractions.gcd(combi[0],combi[1]),combi[2])\n elif combi[0]==combi[1] or combi[1]==combi[2] or combi[2]==combi[0]:\n sum+=3*fractions.gcd(fractions.gcd(combi[0],combi[1]),combi[2])\n else:\n sum+=6*fractions.gcd(fractions.gcd(combi[0],combi[1]),combi[2])\n\n # for a in range(1,K+1):\n # for b in range(1,K+1):\n # tmp=fractions.gcd(a,b)\n # for c in range(1,K+1):\n # sum+=fractions.gcd(tmp,c)\n\n print(sum)\n\nif __name__ == '__main__':\n main()\n", "import sys\nimport os\nimport fractions\n\ndef file_input():\n f = open('Beginner_Contest_162/input.txt', 'r')\n sys.stdin = f\n\ndef main():\n #file_input()\n K=int(input())\n # map(int, input().split())\n sum=0\n\n for a in range(1,K+1):\n for b in range(1,K+1):\n tmp=fractions.gcd(a,b)\n for c in range(1,K+1):\n sum+=fractions.gcd(tmp,c)\n\n print(sum)\n\nif __name__ == '__main__':\n main()\n", "import sys\nimport os\nimport itertools\n\ndef file_input():\n f = open('Beginner_Contest_162/input.txt', 'r')\n sys.stdin = f\n\ndef gcd(a,b):\n if b==0: return a\n else: return gcd(b,a%b)\n\ndef main():\n #file_input()\n K=int(input())\n # map(int, input().split())\n sum=0\n\n combi_l = itertools.combinations_with_replacement(range(1,K+1),3)\n # print(combi_l)\n\n for combi in combi_l:\n # print(combi)\n if combi[0]==combi[1]==combi[2]:\n sum+=gcd(gcd(combi[0],combi[1]),combi[2])\n elif combi[0]==combi[1] or combi[1]==combi[2] or combi[2]==combi[0]:\n sum+=3*gcd(gcd(combi[0],combi[1]),combi[2])\n else:\n sum+=6*gcd(gcd(combi[0],combi[1]),combi[2])\n\n # for a in range(1,K+1):\n # for b in range(1,K+1):\n # tmp=fractions.gcd(a,b)\n # for c in range(1,K+1):\n # sum+=fractions.gcd(tmp,c)\n\n print(sum)\n\nif __name__ == '__main__':\n main()\n"]
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s328526023', 's740898813', 's654395526']
[10724.0, 10568.0, 9240.0]
[2206.0, 2206.0, 1427.0]
[972, 445, 960]
p02713
u077229945
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['k = int(input())\ntotal = 0\n\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n if gcd(a, b) == 1:\n total += 1 * k\n continue\n else:\n for c in range(1, k + 1):\n total += gcd(a, b, c)\nprint(total)', 'import math\nfrom functools import reduce\n\nk = int(input())\ntotal = 0\n\ndef gcd(*numbers):\n numbers = numbers\n return reduce(math.gcd, numbers)\n\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n if gcd(a, b) == 1:\n total += 1 * k\n continue\n else:\n for c in range(1, k + 1):\n total += gcd(a, b, c)\nprint(total)']
['Runtime Error', 'Accepted']
['s811477482', 's542133069']
[9192.0, 9632.0]
[25.0, 1438.0]
[261, 382]
p02713
u078816252
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nN = int(input())\nans = (1+N)*N/2\nfor i in range(1,N+1):\n for j in range(1,i):\n ans += math.gcd(i,j)*3\nfor i in range(!,N+1):\n for j in range(1,i):\n if i== j:\n break\n for k in range(1,j):\n if i == k or j == k:\n break\n else:\n ans += math.gcd(i,j,k)*6\nprint(ans)', 'import math\nN = int(input())\nans = (1+N)*N/2\nfor i in range(1,N+1):\n for j in range(1,i):\n ans += math.gcd(i,j)*6\nfor i in range(1,N+1):\n for j in range(1,i):\n if i== j:\n break\n for k in range(1,j):\n if i == k or j == k:\n break\n else:\n ans += math.gcd(k,math.gcd(i,j))*6\nprint(int(ans))']
['Runtime Error', 'Accepted']
['s476146296', 's171003064']
[8964.0, 9204.0]
[23.0, 511.0]
[311, 326]
p02713
u080364835
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nans = 0\nans += 0.5*k*(k+1)\n# print(ans)\n\nfor a in range(1, k):\n for b in range(a+1,k+1):\n n = math.gcd(a, b)\n ans += n*6\n # print(a, b, n)\n\nfor i in range(1, k-1):\n for j in range(i+1, k):\n for k in range(j+1, k+1):\n d = math.gcd(i, j)\n ans += math.gcd(d, k)*6\n # print(i, j, k)\n\n #\n #\n # for c in range(b+1, k+1):\n # ans += math.gcd(n, c)*3\n # print(a, b, c)\n\nprint(int(ans))', 'k = int(input())\n\nimport math\n\nans = 0\nans += 0.5*k*(k+1)\n# print(ans)\n\nfor a in range(1, k):\n for b in range(a+1,k+1):\n n = math.gcd(a, b)\n ans += n*6\n for c in range(b+1, k+1):\n if c != b:\n ans += math.gcd(n, c)*6\n\n\n# for j in range(i+1, k):\n# for k in range(j+1, k+1):\n# d = math.gcd(i, j)\n# ans += math.gcd(d, k)*6\n\nprint(int(ans))']
['Runtime Error', 'Accepted']
['s676145025', 's019329931']
[9136.0, 9192.0]
[24.0, 388.0]
[495, 446]
p02713
u083960235
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
["import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import gcd, ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n \ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\n \nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\nc = 0\nK = INT()\nans = 0\n \nfor i in range(1, K + 1):\n for j in range(1, K + 1):\n a = gcd(i, j)\n for k in range(1, K + 1):\n b = gcd(a, k)\n ans += b\nprint(ans) \n ", "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import gcd, ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\n# from fractions import gcd\n \ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\n \nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\nc = 0\nK = INT()\nans = 0\n \nfor i in range(1, K + 1):\n for j in range(1, K + 1):\n a = gcd(i, j)\n for k in range(1, K + 1):\n b = gcd(a, k)\n ans += b\nprint(ans) \n "]
['Time Limit Exceeded', 'Accepted']
['s964234914', 's521681695']
[10796.0, 10044.0]
[2206.0, 1386.0]
[919, 921]
p02713
u085329544
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\n\nk = int(input())\nans = 0\n\nfor a in range(k+1):\n for b in range(k+1):\n for c in range(k+1):\n ans += gcd(gcd(a,b),c)\n\nprint(ans)', 'from math import gcd\n\nk = int(input())\nans = 0\n\nfor a in range(1,k+1):\n for b in range(1,k+1):\n for c in range(1,k+1):\n ans += gcd(gcd(a,b),c)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s476082613', 's781002529']
[9164.0, 9184.0]
[1912.0, 1922.0]
[157, 163]
p02713
u088115428
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\nn = int(input())\ng = 0\nfor i in range (1, n+1):\n for j in range (1, n+1):\n for k in range (1, n+1):\n g += gcd(gcd(i,j),k)\nprint(g)\n\n', 'import functools\nfrom fractions import gcd\nn = int(input())\n@functools.lru_cache(None)\ndef main(n):\n g=0\n for i in range (1, n+1):\n for j in range (1, n+1):\n for k in range (1, n+1):\n g += gcd(gcd(i,j),k)\n return (g)\nprint(main(n))', 'from fractions import gcd\nn = int(input())\ngcdf = 0\nfor i in range (1, n+1):\n for j in range (1, n+1):\n for k in range (1, n+1):\n gcdf = gcdf + gcd(i,gcd(j,k))\n \nprint(gcdf)', 'from fractions import gcd\nn = int(input())\ngcdf = 0\nfor i in range (1, n+1):\n for j in range (1, n+1):\n for k in range (1, n+1):\n gcdf += gcd(gcd(i,j),k)\n \nprint(gcdf)', 'from fractions import gcd\nn = int(input())\nans = 0\nfor i in range (1, n+1):\n for j in range (1, n+1):\n gcd1 = gcd(i,j)\n \n for k in range (1, n+1):\n \n gcdf = gcd(gcd1,k)\n ans = ans+gcdf\nprint(ans)', 'import functools\nfrom math import gcd\nn = int(input())\n@functools.lru_cache(None)\ndef main(n):\n g=0\n for i in range (1, n+1):\n for j in range (1, n+1):\n for k in range (1, n+1):\n g += gcd(gcd(i,j),k)\n return (g)\nprint(main(n))']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s202830508', 's281034844', 's551241544', 's791996203', 's824275954', 's976315697']
[10596.0, 10740.0, 10680.0, 10652.0, 10588.0, 9572.0]
[2205.0, 2205.0, 2205.0, 2206.0, 2206.0, 1347.0]
[168, 250, 188, 182, 221, 245]
p02713
u089504174
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['k=int(input())\nimport fractions\nx=0\nc=0\nd=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for k in range(j,k+1):\n d=fractions.gcd(i,j)\n c=fractions.gcd(d,k)\n if i!=j and j!=k and k!=i:\n x+=6*c\n elif (i!=j and j==k) or (j!=k and k==i) or (k!=i and i==j):\n x+=3*c\n else:\n x+=c\nprint(x)', 'k=int(input())\nimport fractions\nx=0\nc=0\nd=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for k in range(j,k+1):\n d=fractions.gcd(i,j)\n c=fractions.gcd(d,k)\n if i!=j and j!=k:\n x+=6*c\n elif i==j==k:\n x+=c\n else:\n x+=3*c\nprint(x)', 'k=int(input())\nimport fractions\nx=0\nc=0\nd=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for k in range(j,k+1):\n d=fractions.gcd(i,j)\n c=fractions.gcd(d,k)\n if i!=j and j!=k:\n x+=6*c\n elif (i!=j and j==k) or (k!=i and i==j):\n x+=3*c\n else:\n x+=c\nprint(x)', 'k=int(input())\nimport math\nx=0\nc=0\nd=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for k in range(j,k+1):\n d=math.gcd(i,j)\n c=math.gcd(d,k)\n if i!=j and j!=k:\n x+=6*c\n elif (i!=j and j==k) or (k!=i and i==j):\n x+=3*c\n else:\n x+=c\nprint(x)']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s005874216', 's689415628', 's975553125', 's483126448']
[10572.0, 10540.0, 10680.0, 9204.0]
[2206.0, 2206.0, 2206.0, 550.0]
[335, 280, 307, 292]
p02713
u090406054
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nk=int(input())\ncnt=0\nfor i in range(k):\n for p in range(k):\n for q in range(k):\n cnt+=gcd(i,p,q)\n \nprint(cnt)\n ', 'from math import gcd\nk=int(input())\ncnt=0\nfor i in range(1,k+1):\n for p in range(1,k+1):\n for q in range(1,k+1):\n gcd1=gcd(i,p)\n \n cnt+=gcd(gcd1,q)\n\n \nprint(cnt)\n \n\n']
['Runtime Error', 'Accepted']
['s328833976', 's415123919']
[9044.0, 9152.0]
[25.0, 1998.0]
[147, 190]
p02713
u090972687
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\n\nk = int(input())\n\nresult = 0\n\nfor a in range(1, k+1):\n for b in range(1, k+1):\n for c in range(1, k+1):\n n = gcd(a, b)\n m = gcd(n, c)\n result += n\n\nprint(result)', 'import fractions\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\n\nk = int(input())\n\nresult = 0\n\nfor a in range(1, k+1):\n for b in range(1, k+1):\n for c in range(1, k+1):\n result += gcd(a, b, c)\n\nprint(result)', 'import math\nimport itertools\n\nk = int(input())\nresult = 0\n\nfor a in range(1, k+1):\n for b in range(a+1, k+1):\n for c in range(b+1, k+1):\n r = math.gcd(math.gcd(a, b), c)\n r *= 6\n result += r\n\nfor a in range(1, k+1):\n for b in range(a+1, k+1):\n r = math.gcd(a, b)\n r *= 6\n result += r\n \nfor a in range(1, k+1):\n result += a\n\nprint(result)']
['Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s185399922', 's972087515', 's823363835']
[10680.0, 10684.0, 9220.0]
[2206.0, 2206.0, 526.0]
[207, 260, 370]
p02713
u091307273
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['k = int(input())\n\ngcache = { }\ns = 0\n\nfor a in range(1, k+1):\n for b in range(1, k+1):\n tup = (min(a, b), max(a, b))\n if tup not in gcache:\n gc = math.gcd(tup[0], tup[1])\n gcache[tup] = gc\n gc = gcache[tup]\n for c in range(1, k+1):\n tup = (min(c, gc), max(c, gc))\n if tup not in gcache:\n gc = math.gcd(tup[0], tup[1])\n gcache[tup] = gc\n gc = gcache[tup]\n s += gc\n\nprint(s)\n', 'k = int(input())\n\nfrom math import gcd\n\ns = 0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n g = gcd(a, b)\n for c in range(1, k+1):\n s += gcd(g, c)\n\nprint(s)\n']
['Runtime Error', 'Accepted']
['s236256492', 's982627561']
[9064.0, 9140.0]
[26.0, 1099.0]
[430, 173]
p02713
u094191970
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\n \nk=int(input())\n \nans=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n for l in range(1, k+1):\n ans+=gcd(gcd(i,j),l)\n \nprint(ans)', 'from math import gcd\n\nk=int(input())\n\nans=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n for l in range(1,k+1):\n ans+=gcd(gcd(i,j),l)\n\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s791772970', 's399207536']
[10620.0, 9180.0]
[2206.0, 1836.0]
[166, 157]
p02713
u101680358
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import fractions\n\nK = int(input())\n\nans = 0\na=[]\nfor i in range(1,K+1):\n\tfor j in range(1, K+1):\n\t\ttmp = fractions.gcd(i,j)\n\t\tfor k in range(1, K+1):\n\t\t\tans+=fractions.gcd(tmp,k)\n\nprint(ans)', 'import math\nK = int(input())\n\nans = 0\na=[]\nfor i in range(1,K+1):\n\tfor j in range(1, K+1):\n\t\ttmp = math.gcd(i,j)\n\t\tfor k in range(1, K+1):\n\t\t\tans+=math.gcd(tmp,k)\n\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s301582854', 's107404489']
[10528.0, 9148.0]
[2206.0, 1333.0]
[190, 174]
p02713
u102223485
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['# coding: utf-8\nimport math\nfrom functools import reduce\n\nK = int(input())\ntmp = []\n\nc = 0\nfor i in range(K):\n for j in range(K):\n tmp.append(math.gcd(i + 1, j + 1))\n c = c + 1\n\ntmp2 = []\nfor k in tmp:\n for m in range(K):\n tmp2.append(math.gcd(k, m+1))\n\nprint("sum:",sum(tmp2))', '# coding: utf-8\nimport math\nfrom functools import reduce\n\nK = int(input())\ntmp = []\n\nc = 0\nfor i in range(K):\n for j in range(K):\n tmp.append(math.gcd(i + 1, j + 1))\n c = c + 1\n\ntmp2 = []\nfor k in tmp:\n for m in range(K):\n tmp2.append(math.gcd(k, m+1))\n\nprint(sum(tmp2))']
['Wrong Answer', 'Accepted']
['s495601092', 's925681248']
[72024.0, 72028.0]
[1579.0, 1597.0]
[304, 297]
p02713
u102461423
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\nK = int(read())\n\nx = np.arange(1, K + 1)\nnums = np.gcd.outer(x, x, x)\nprint(nums.sum())\n', 'import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\nK = int(read())\n\nx = np.arange(1, K + 1)\nnums = np.gcd.outer(np.gcd.outer(x, x), x)\nprint(nums.sum())\n']
['Runtime Error', 'Accepted']
['s259138247', 's420806892']
[27112.0, 89332.0]
[102.0, 209.0]
[224, 238]
p02713
u103208639
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nk=200\nans=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for k in range(j,k+1):\n s=len(set([i,j,k]))\n if s==1:\n p=1\n elif s==2:\n p=3\n elif s==3:\n p=6\n tmp=gcd(i,j)\n tmp= p*gcd(tmp,k)\n ans+=tmp\nprint(ans)', 'from math import gcd\nk=int(input())\nans=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for k in range(j,k+1):\n s=len(set([i,j,k]))\n if s==1:\n p=1\n elif s==2:\n p=3\n elif s==3:\n p=6\n tmp=gcd(i,j)\n tmp= p*gcd(tmp,k)\n ans+=tmp\nprint(ans)']
['Wrong Answer', 'Accepted']
['s589381403', 's282085108']
[9140.0, 9236.0]
[1025.0, 964.0]
[359, 368]
p02713
u104005543
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['n = int(input())\nans = 0\n\ndef gcd(x, y):\n if x / y == 0: return y\n return gcd(y, x % y)\n\nfor i in range(1, n + 1):\n for j in range(1, n + 1):\n for k in range(1, n + 1):\n ans += gcd(gcd(i, j), k)\nprint(ans)', 'import math\nn=int(input())\nans=0\nfor i in range(1,n+1):\n for j in range(1,n+1):\n for k in range(1,n+1):\n ans+=gcd(gcd(i,j),k)\nprint(ans)', 'from math import gcd\nn = int(input())\nans = 0\nfor i in range(1, n + 1):\n for j in range(1,n+1):\n for k in range(1, n + 1):\n ans += gcd(gcd(i, j), k)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s428271955', 's888230858', 's364336400']
[9192.0, 9180.0, 9172.0]
[24.0, 25.0, 1851.0]
[232, 157, 180]
p02713
u104931745
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nk = int(imput())\nn = 0\n\nfor i in range(1,k+1)\n for j in range(1,k+1)\n a=math.gcd(i,j)\n for l in range(1,k+1)\n b=math.gcd(a,l)\n n += b\n\nprint(n)', 'import math\n\nk = int(input())\nn = 0\n\nfor i in range(1,k+1):\n for j in range(1,k+1):\n a = math.gcd(i,j)\n for l in range(1,k+1):\n b = math.gcd(a,l)\n n += b\n\nprint(n)']
['Runtime Error', 'Accepted']
['s250185442', 's522909181']
[8996.0, 9160.0]
[23.0, 1575.0]
[195, 202]
p02713
u105290050
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['k=int(input())\nl=list(range(1, k+1))\nimport itertools\nimport math\nfrom functools import reduce\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\nans=0\nfor v in itertools.combinations_with_replacement(l, 3):\n ans+=gcd(*v)\nprint(ans)', 'k=int(input())\nl=list(range(1, k+1))\nimport itertools\nimport math\nfrom functools import reduce\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\nans=0\nfor v in itertools.combinations_with_replacement(l, 3):\n if v[0]==v[1]==v[2]:\n ans+=gcd(*v)\n elif v[0]==v[1]:\n ans+=gcd(*v)*3\n elif v[1]==v[2]:\n ans+=gcd(*v)*3\n elif v[0]==v[2]:\n ans+=gcd(*v)*3\n else:\n ans+=gcd(*v)*6\nprint(ans)']
['Wrong Answer', 'Accepted']
['s331828348', 's652073454']
[9544.0, 9488.0]
[590.0, 1079.0]
[236, 402]
p02713
u112007848
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n#import itertools\nnum = (int)(input())\ntotal = 0\n\n\n#print(total)\nfor i in range(2, num + 1):\n for j in range(2, num + 1):\n for k in range(2, num + 1):\n total += math.gcd(math.gcd(i, j), k)\nprint(total)', 'import math\nnum = (int)(input())\ntotal = 0\n\nfor i in range(1, num + 1):\n for j in range(1, num + 1):\n sub = math.gcd(i, j)\n for k in range(1, num + 1):\n total += math.gcd(sub, k)\nprint(total)']
['Wrong Answer', 'Accepted']
['s697803351', 's685472926']
[9044.0, 9184.0]
[2205.0, 1392.0]
[370, 203]
p02713
u112266373
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import itertools as it\nimport fractions\n\nK = int(input())\n\ngcd_list = []\nfor i, j, k in it.product(range(1, K+1), range(1, K+1), range(1, K+1)):\n gcd_ = fractions.gcd(fractions.gcd(i, j), k)\n gcd_list.append(gcd_)\nprint(sum(gcd_list))\n', 'import itertools as it\nimport math\n\nK = int(input())\n\nitr = range(1, K+1)\ngcd_ = sum([math.gcd(math.gcd(i, j), k)\n for i, j, k in it.product(itr, itr, itr)])\nprint(gcd_)\n']
['Time Limit Exceeded', 'Accepted']
['s599116804', 's813655750']
[20652.0, 71720.0]
[2206.0, 1821.0]
[241, 181]
p02713
u114366889
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import fractions\nK = int(input())\nans = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n ab = fractions.gcd(i,j)\n if ab == 0:\n continue\n for k in range(1,K+1):\n ans += fractions.gcd(ab,k)\n\nprint(ans)', 'from math import gcd\nK = int(input())\nans = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n ab = gcd(i,j)\n if ab == 0:\n continue\n for k in range(1,K+1):\n ans += gcd(ab,k)\n\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s732265692', 's388491704']
[10644.0, 9184.0]
[2206.0, 1089.0]
[246, 230]
p02713
u115877451
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nfrom functools import reduce\n\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\nn=int(input())\nl1=range(1,n+1)\nl2=range(1,n+1)\nl3=range(1,n+1)\n\ncount=0\n\nfor i in l1:\n for j in l2:\n te=gcd(i,j)\n for k in l3:\n count+=(te,k)\n\nprint(count)', 'import math\nfrom functools import reduce\n\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\nn=int(input())\nl1=range(1,n+1)\nl2=range(1,n+1)\nl3=range(1,n+1)\n\ncount=0\n\nfor i in l1:\n for j in l2:\n te=math.gcd(i,j)\n for k in l3:\n count+=math.gcd(te,k)\n\nprint(count)']
['Runtime Error', 'Accepted']
['s236187553', 's550424439']
[9580.0, 9580.0]
[26.0, 1562.0]
[287, 300]
p02713
u118995404
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from Math import gcd\n\nK = int(input())\n\nresult = 0\nfor a in range(1, K + 1):\n for b in range(1, K + 1):\n for c in range(1, K + 1):\n result += gcd(c, gcd(a, b))\n \nprint(result)', 'from math import gcd\n \nK = int(input())\n \nresult = 0\nfor a in range(1, K + 1):\n for b in range(1, K + 1):\n for c in range(1, K + 1):\n result += gcd(c, gcd(a, b))\n \nprint(result)']
['Runtime Error', 'Accepted']
['s598029269', 's582691100']
[9008.0, 9104.0]
[23.0, 1747.0]
[189, 191]
p02713
u119655368
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['n = int(input())\nans = 0\nfor i in range(1,n + 1):\n for j in range(1, n + 1):\n f = fractions.gcd(i, j)\n for k in range(1, n + 1):\n ans += fractions.gcd(f, k)\nprint(ans)', 'import fractions\nn = int(input())\nans = 0\nfor i in range(1,n + 1):\n for j in range(1, n + 1):\n f = fractions.gcd(i, j)\n for k in range(1, n + 1):\n ans += fractions.gcd(f, k)\nprint(ans)', 'from math import gcd\nn = int(input())\nans = 0\nfor i in range(1,n + 1):\n for j in range(1, n + 1):\n f = gcd(i, j)\n for k in range(1, n + 1):\n ans += gcd(f, k)\nprint(ans)']
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s572664949', 's699364572', 's330813160']
[9200.0, 10676.0, 9176.0]
[26.0, 2206.0, 1120.0]
[195, 212, 196]
p02713
u119982001
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['N = int(input())\nN = N+1\nsum = 0\n\nimport math\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nfor i in range(1, N):\n for j in range(1, N):\n for k in range(1, N):\n sum += (gcd(gcd(i, j), k)\n\nprint( sum )\n', 'N = int(input())\nN = N+1\nsum = 0\n\nimport math\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nfor i in range(1, N):\n for j in range(1, N):\n for k in range(1, N):\n sum += gcd(gcd(i, j), k)\n\nprint( sum )\n', 'from math import gcd as gcd\n\nK = int(input())\n\nans = 0\n\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n ans += gcd(gcd(j, k), i)\n\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s228834141', 's796498530', 's181228849']
[9048.0, 9180.0, 9100.0]
[21.0, 20.0, 2000.0]
[234, 233, 189]
p02713
u121192152
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nK = int(input())\n\nans = 0\n\nfor i in range(K):\n for j in range(K):\n t = gcd(i, j)\n for k in range(K):\n ans += gcd(t, k)\n\nprint(ans)\n', 'from math import gcd\nK = int(input())\n\nans = 0\n\nfor i in range(1, K+1):\n for j in range(1, K+1):\n t = gcd(i, j)\n for k in range(1, K+1):\n ans += gcd(t, k)\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s790608063', 's902534399']
[9192.0, 9168.0]
[1124.0, 1298.0]
[180, 195]
p02713
u122994151
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n \nK = input()\n \nfor i in range(1, K+1):\n\tfor j in range(1,K+1):\n \t\tfor k in range(1,K+1):\n \t\tans += math.gcd(math.gcd(i,j), k)\n \nprint(ans)', 'import math\nans = 0\nK = int(input())\n \nfor i in range(1, K+1):\n\tfor j in range(1,K+1):\n \t\tfor k in range(1,K+1):\n ans = ans + math.gcd(math.gcd(i,j), k)\n \nprint(ans)', 'from math import gcd\nans = 0\nK = int(input())\n \nfor i in range(1, K+1):\n\tfor j in range(1,K+1):\n \t\tfor k in range(1,K+1):\n \t\tans = ans + gcd(gcd(i,j), k)\n \nprint(ans)', 'import math\n \nans = 0\nK = int(input())\n \nfor i in range(1, K+1):\n\tfor j in range(1,K+1):\n \t\tfor k in range(1,K+1):\n \t\tans += math.gcd(math.gcd(i,j), k)\n \nprint(ans)', 'import math\n \nK = int(input())\n \nfor i in range(1, K+1):\n\tfor j in range(1,K+1):\n \t\tfor k in range(1,K+1):\n \t\tans += math.gcd(math.gcd(i,j), k)\n \nprint(ans)', 'import math\nans = 0\nK = int(input())\n \nfor i in range(1, K+1):\n\tfor j in range(1,K+1):\n \t\tfor k in range(1,K+1):\n \t\tans = ans + math.gcd(math.gcd(i,j), k)\n \nprint(ans)', 'from math import gcd\nans = 0\nK = int(input())\n \nfor i in range(1, K+1):\n for j in range(1,K+1):\n for k in range(1,K+1):\n ans = ans + gcd(gcd(i,j), k)\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s336081442', 's595229139', 's606852942', 's615766759', 's925909551', 's975268523', 's577716875']
[9020.0, 8960.0, 9032.0, 9028.0, 9024.0, 8940.0, 9180.0]
[23.0, 23.0, 22.0, 19.0, 23.0, 21.0, 1907.0]
[160, 180, 175, 173, 165, 176, 176]
p02713
u123745130
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['n=int(input())\n# a,b,c=map(int,input().split())\ncnt=0\ndef gcd(a,b):\n if a==0: return b\n else: return gcd(b%a,a)\n# print(gcd(a,b))\n\ndef gcd_3(a,b,c):\n if gcd(a,b)==0: return c\n else: return gcd(c % gcd(a,b),gcd(a,b))\n\nfor i in range(1,n+1):\n for j in range ( 1 , n + 1 ):\n for k in range ( 1 , n + 1 ):\n # cnt+=gcd_3(i,j,k)\n cnt+=1\n\n\nprint(cnt)', 'def main():\n from math import gcd\n\n K = int(input())\n\n result = 0\n for a in range(1, K + 1):\n for b in range(1, K + 1):\n t = gcd(a, b)\n for c in range(1, K + 1):\n result += gcd(t, c)\n print(result)', 'def main():\n from math import gcd\n\n K = int(input())\n\n result = 0\n for a in range(1, K + 1):\n for b in range(1, K + 1):\n t = gcd(a, b)\n for c in range(1, K + 1):\n result += gcd(t, c)\n print(result)\n\n\nmain()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s189372620', 's332048705', 's043423379']
[9112.0, 9052.0, 9120.0]
[617.0, 20.0, 676.0]
[387, 256, 265]
p02713
u124498235
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['n = int(input())\nimport math\nfrom fractions import gcd\ns = 0\nfor i in range(1,n+1):\n\tfor j in range(1,n+1):\n\t\tfor k in range(1,n+1):\n\t\t\ts += math.gcd(math.gcd(i,j),k)\nprint (s)', 'from math import gcd\nn = int(input())\ns = 0\nfor i in range(1,n+1):\n\tfor j in range(1,n+1):\n\t\tx = gcd(i,j)\n\t\tfor k in range(1,n+1):\n\t\t\ts += gcd(x,k)\nprint (s)']
['Time Limit Exceeded', 'Accepted']
['s340616774', 's575113461']
[10424.0, 9184.0]
[2206.0, 1169.0]
[176, 157]
p02713
u125799132
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['[N, K] = [int(i) for i in input().split()]\nprint(min(N%K, -N%K))', 'import math\nK = int(input())\nans = 0\n\nfor a in range(1, K+1):\n for b in range(a, K+1):\n for c in range(b, K+1):\n s = math.gcd(a, b)\n t = math.gcd(s, c)\n if a == c:\n ans += t\n elif (a == b or b == c) and a != c:\n ans += 3*t\n else:\n ans += 6*t\nprint(ans)']
['Runtime Error', 'Accepted']
['s328757820', 's159753032']
[9016.0, 9192.0]
[27.0, 637.0]
[64, 362]
p02713
u129898499
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n \nK = int(input())\ncount = 0\nfor i in range(1,K+1):\n for j in range(i+1,K+1):\n for k in range(j+1,K+1):\n count += 6*(gcd(i,j,k))\n \nfor i in range(1,K+1):\n for j in range(i+1,K+1):\n count += 3*(gcd(i,j))\n\nfor i in range(1,K+1):\n count += i\n \nprint(count)', 'import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n \nK = int(input())\ncount = 0\nfor i in range(1,K-1):\n for j in range(i+1,K):\n for k in range(j+1,K+1):\n count += 6*(gcd(i,j,k))\n \nfor i in range(1,K):\n for j in range(i+1,K+1):\n count += 6*(gcd(i,j))\n\nfor i in range(1,K+1):\n count += i\n \nprint(count)']
['Wrong Answer', 'Accepted']
['s313043527', 's348062831']
[9584.0, 9640.0]
[658.0, 637.0]
[376, 372]
p02713
u130900604
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nk=map(int,input())\nr=range(1,k+1)\nans=0\nfor i in r:\n for j in r:\n for k in r:\n ans+=gcd(k,gcd(i,j))\nprint(ans)\n\n', '# coding: utf-8\n# Your code here!\n\ndef MI():return map(int,input().split())\ndef LI():return list(MI())\n\nn=int(input())\n\nimport math\nfrom collections import Counter\n\n\n # return reduce(math.gcd, numbers)\n\nans=0\nt=[]\nfor i in range(1,n+1):\n for j in range(1,n+1):\n t.append(math.gcd(i,j))\n \nc=Counter(t).items()\n\nfor (i,j) in c:\n for k in range(1,n+1):\n ans+=math.gcd(i,k)*j\n # p\\rint(c)\nprint(ans)']
['Runtime Error', 'Accepted']
['s266719398', 's037955621']
[9112.0, 9776.0]
[24.0, 43.0]
[180, 452]
p02713
u131411061
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\n\nK = int(input())\n\nres = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n for k in range(1,K+1):\n res += gcd(gcd(i,j),k)\nprint(res)\n', 'from fractions import gcd\n\nK = int(input())\n\ntmp = 0\nres = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n print(i,j)\n for k in range(1,K+1):\n res += gcd(gcd(i,j),k)\nprint(res)', 'from fractions import gcd\n\nK = int(input())\n\nres = 0\ntmp = 0\nd = []\nfor i in range(1,K+1):\n for j in range(1,K+1):\n for k in range(1,K+1):\n if i == j and j == k:\n res += i\n elif i == j:\n res += gcd(i,k)\n elif i == k:\n res += gcd(j,k)\n elif j == k:\n res += gcd(i,j)\n else:\n res += gcd(gcd(i,j),k)\nprint(res)', 'from math import gcd\n\nK = int(input())\n\nres = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n tmp = gcd(i,j)\n for k in range(1,K+1):\n res += gcd(tmp,k)\nprint(res)']
['Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s382953018', 's851800521', 's886780600', 's795792451']
[10648.0, 10732.0, 10672.0, 9180.0]
[2205.0, 2206.0, 2206.0, 1243.0]
[180, 206, 446, 192]
p02713
u135116520
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math \nfrom itertools import product\nfrom functools import reduce\ndef gcd(*numbers):\n return reduce(math.gcd,numbers)\nK=int(input())\nA=[]\nas=range(1,K+1)\nbs=range(1,K+1)\ncs=range(1,K+1)\nfor a,b,c in product(as,bs,cs):\n s=gcd(a,b,c)\n A.append(s)\nprint(sum(A))\n \n \n A.append(s)\nprint(sum(A))', 'import math \nfrom functools import reduce\ndef gcd(*numbers):\n return reduce(math.gcd,numbers)\nK=int(input())\nA=[]\nfor i in range(K):\n for j in range(K):\n for k in range(K):\n s=gcd(i,j,k)\n A.append(s)\nprint(sum(A))', 'import math \nK=int(input())\nA=[]\nfor i in range(K):\n for j in range(K):\n for k in range(K):\n s=gcd(i,j,k)\n A.append(s)\nprint(sum(A)\n', 'import math\nK=int(input())\nans=0\nfor a in range(1,K+1):\n for b in range(1,K+1):\n ans_=math.gcd(a,b)\n for c in range(1,K+1):\n ans+=math.gcd(ans_,c)\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s219757556', 's355112735', 's521362629', 's257563503']
[8960.0, 46860.0, 8992.0, 9120.0]
[21.0, 2206.0, 22.0, 1387.0]
[307, 228, 146, 169]
p02713
u135961419
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nk = int(input())\nsum = 0\n\nfor a in range(k):\n for b in range(k):\n for c in range(k):\n sum += math.gcd(a, math.gcd(b, c))\n \nprint(sum)', 'import math\n \nk = int(input())\nsum = 0\n \nfor a in range(k - 2):\n for b in range(a + 1, k - 1):\n for c in range(b + 1, k):\n sum += 6 * math.gcd(a + 1, math.gcd(b + 1, c + 1))\n \nfor a in range(k - 1):\n for b in range(a + 1, k):\n sum += 3 * math.gcd(a + 1, b + 1)\n \nsum += k * (k + 1) // 2\n \nprint(sum)', 'import math\n \nk = int(input())\nsum = 0\n \nfor a in range(k - 2):\n for b in range(a + 1, k - 1):\n for c in range(b + 1, k):\n sum += 6 * math.gcd(a + 1, math.gcd(b + 1, c + 1))\n \nfor a in range(k - 1):\n for b in range(a + 1, k):\n sum += 6 * math.gcd(a + 1, b + 1)\n \nsum += k * (k + 1) // 2\n \nprint(sum)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s449281177', 's544013153', 's380417918']
[9176.0, 9204.0, 9204.0]
[2205.0, 478.0, 459.0]
[160, 325, 325]
p02713
u136451021
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\n\nK = int(sys.stdin.readline())\nans = 0\n\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n math_gcd_jk = math.gcd(j, k)\n math_gcd_ijk = math.gcd(math_gcd_jk, i)\n ans = ans + math_gcd_ijk\n\nprint(ans)', 'import math\nK = int(input())\nans = 0\n\n#i<j<k\nfor i in range(1, K-1):\n for j in range(i+1, K):\n for k in range(j+1, K+1):\n gcd_ij_1 = math.gcd(i, j)\n gcd_ijk_1 = math.gcd(gcd_ij_1, k)\n ans += gcd_ijk_1 * 6\n\nfor l in range(1, K):\n for m in range(l+1, K+1):\n gcd_lm_1 = math.gcd(l,m)\n ans += gcd_lm_1 * 6\n\nfor n in range(1, K+1):\n ans += n\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s836831486', 's003505735']
[9120.0, 9208.0]
[22.0, 488.0]
[277, 412]
p02713
u140191608
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from fractions import gcd\nN = int(input())\n\nll = [i for i in range(1,N+1)] \nans = 0\n\ndef aaa(a):\n d = gcd(a[0],a[1])\n return gcd(d,a[2])\n\nlll = []\nfor i in ll:\n for j in ll:\n for k in ll:\n lll.append((i ,j, k))\n\nfor ii in lll:\n ans += aaa(ii)\nprint(ans)', 'from fractions import gcd\nN = int(input())\n\nll = [i for i in range(1,N+1)] \nans = 0\n\ndef aaa(a):\n d = gcd(a[0],a[1])\n return gcd(d,a[2])\n\nlll = []\nfor i in ll:\n for j in ll:\n for k in ll:\n lll.append((i ,j, k))\n\nfor ii in lll:\n ans += aaa(ii)\nprint(ans)', 'from fractions import gcd\nN = int(input())\n\nll = [i for i in range(1,N+1)] \nans = 0\n\nfor i in ll:\n for j in ll:\n s = gcd(i,j)\n for k in ll:\n ans += gcd(s,k)\nprint(ans)', 'K = int(input())\nans = 0\nfrom math import gcd\nfor i in range(1,K+1):\n for k in range(1,K+1):\n for j in range(1,K+1):\n ans += gcd(gcd(i, k),j)\n \nprint(ans)']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s441501799', 's625742665', 's918369727', 's033426011']
[580804.0, 580724.0, 10668.0, 9056.0]
[2222.0, 2227.0, 2206.0, 1857.0]
[285, 285, 197, 186]
p02713
u141574039
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import fractions\nx=0\nK=int(input())\nfor i in range(1,K+1):\n for j in range(1,K+1):\n for h in range(1,K+1):\n if i==j and j==h:\n x=x+i\n elif i==j or j==h:\n x=x+fractions.gcd(i,h)\n else:\n x=x+fractions.gcd(i,fractions.gcd(j,h))\nprint(x)', 'import math\nx=0;y=0\nK=int(input())\nfor i in range(1,K+1):\n for j in range(1,K+1):\n y=math.gcd(i,j)\n for h in range(1,K+1):\n x=x+math.gcd(y,h)\nprint(x)']
['Time Limit Exceeded', 'Accepted']
['s213833344', 's838360472']
[10608.0, 9136.0]
[2205.0, 1342.0]
[273, 162]
p02713
u143322814
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['def main():\n n = input()\n print(\'Yes\') if \'7\' in n else print(\'No\')\n\nif __name__ == "__main__":\n main()', 'import math\n \ndef main():\n n = int(input())\n ans = 0\n for i in range(1,n+1):\n for j in range(1,n+1):\n tmp = math.gcd(i,j)\n for k in range(1,n+1):\n ans += math.gcd(tmp,k)\n \n print(ans)\n \nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s889705113', 's824554781']
[9056.0, 9192.0]
[21.0, 886.0]
[112, 279]
p02713
u145600939
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['from math import gcd\nk = int(input())\nans = 0\nfor a in range(1,k+1):\n for b in range(a,k+1):\n ab = gcd(a,b)\n for c in range(c,k+1):\n g = gcd(ab,c)\n if a == b == c:\n ans += g\n elif a!=b!=c!=a:\n ans += g*6\n else:\n ans += g*3\nprint(ans)\n', 'import sys\nstdin = sys.stdin\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnn = lambda: list(stdin.readline().split())\nns = lambda: stdin.readline().rstrip()\n\nimport math\n\nk = ni()\nans = 0\n\nfor i in range(1,k+1):\n for j in range(1,k+1):\n a = math.gcd(i,j)\n for p in range(1,k+1):\n ans += math.gcd(a,p)\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s449137441', 's651226397']
[9196.0, 9116.0]
[20.0, 1386.0]
[282, 373]
p02713
u146057001
2,000
1,048,576
Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
['import math\nk = int(input())\nans = 0\n\nfor a in range(k):\n for b in range(k):\n d = math.gcd(a + 1, b + 1)\n for c in range(k):\n ans += math(d, c + 1)\n\nprint(ans)\n', 'import math\nk = int(input())\nans = 0\n\nfor a in range(k):\n for b in range(k):\n d = math.gcd(a + 1, b + 1)\n for c in range(k):\n ans += math.gcd(d, c + 1)\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s321209057', 's552770882']
[9112.0, 9056.0]
[21.0, 1464.0]
[188, 192]