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
p02631
u207241407
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['def main():\n _ = int(input())\n a = tuple(map(int, input().split()))\n\n res = 0\n for i in a:\n res ^= i\n ans = [res ^ j for j in a]\n for k in ans:\n print(ans)\n\n\nif __name__ == "__main__":\n main()', 'def main():\n _ = int(input())\n a = tuple(map(int, input().split()))\n\n res = 0\n for i in a:\n res ^= i\n ans = tuple(res ^ i for i in a)\n print(*ans)\n\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s603301009', 's696988302']
[158832.0, 31624.0]
[2378.0, 146.0]
[227, 211]
p02631
u216928054
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nAS = list(map(int, input().split()))\nprint(*AS, sep=" ")\n', 'from functools import reduce\nfrom operator import xor\n\nN = int(input())\nAS = list(map(int, input().split()))\ntotal = reduce(xor, AS)\nprint(*[a ^ total for a in AS])\n']
['Wrong Answer', 'Accepted']
['s991608189', 's535065594']
[31428.0, 31880.0]
[122.0, 149.0]
[74, 165]
p02631
u217732870
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\na = list(map(int, input().split()))\n\nb = [0 for i in range(n)]\n\nA = 0\n\nfor i in range(n):\n A = A ^ a[i]\n \nfor i in range(n):\n b[i] = A ^ a[i]\n\nprint(b)', "n = int(input())\na = list(map(int, input().split()))\n\nb = [0 for i in range(n)]\n\nA = 0\n\nfor i in range(n):\n A = A ^ a[i]\n \nfor i in range(n):\n b[i] = A ^ a[i]\n\nprint(' '.join(map(str, b)))"]
['Wrong Answer', 'Accepted']
['s440313724', 's018915266']
[31600.0, 41812.0]
[158.0, 175.0]
[171, 191]
p02631
u228303592
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\narr = list(map(int,input().split()))\nxors = 0\nfor val in arr:\n xors^=val\nans = []\nfor i in range(n):\n ans.append(xros^arr[i])\n \nprint(*ans)', 'n = int(input())\narr = list(map(int,input().split()))\nxors = 0\nfor val in arr:\n xors^=val\nans = []\nfor i in range(n):\n ans.append(xors^arr[i])\n \nprint(*ans)\n']
['Runtime Error', 'Accepted']
['s297565959', 's600472859']
[31448.0, 31588.0]
[92.0, 168.0]
[159, 160]
p02631
u241348301
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = list(map(int, input().split()))\ncount = 0\nfor i in A:\n count ^= x\nfor i in range(len(A)):\n A[i] ^= count\n \n \n \nprint(*A)', 'N = int(input())\nA = list(map(int, input().split()))\ncount = 0\nfor i in A:\n count ^= i\nfor i in range(len(A)):\n A[i] ^= count\n \n \nprint(*A)']
['Runtime Error', 'Accepted']
['s379733800', 's347108023']
[31512.0, 31668.0]
[72.0, 152.0]
[156, 151]
p02631
u271469978
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["N = int(input())\naaa = list(map(int, input().split()))\nbbb = list(aaa[i] ^ aaa[i+1] for i in range(N-1))\nans = [0] * N\nans[0] = 1\nfor i, b in enumerate(bbb):\n ans[i+1] = b ^ ans[i]\nprint(*ans,sep=' ')\n", 'N = int(input())\naaa = list(map(int, input().split()))\na_all = 0\nfor a in aaa:\n a_all ^= a\nprint(*list(a_all ^ a for a in aaa))\n']
['Wrong Answer', 'Accepted']
['s619759418', 's841188627']
[35660.0, 31608.0]
[180.0, 147.0]
[204, 131]
p02631
u278057806
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['from sys import stdin\ninput = stdin.readline\n\nN = int(input())\na = list(map(int, input().split()))\n\nans = []\n\nfor i in range(N - 1):\n ans.append(a[i] ^ a[i + 1])\n\nans.append(a[0] ^ a[N - 1])\n\nprint(*ans)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\na = list(map(int, input().split()))\n\nans = []\n\nfor i in range(N - 1):\n ans.append(a[i] & a[i + 1])\n\nans.append(a[0] & a[N - 1])\n\nprint(*ans)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\n\nxor_all = 0\n\nfor a in A:\n xor_all = xor_all ^ a\n\nans = []\n\nfor a in A:\n ans.append(xor_all ^ a)\n\nprint(*ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s059638760', 's377225230', 's411794002']
[31408.0, 31424.0, 31440.0]
[163.0, 159.0, 178.0]
[207, 207, 215]
p02631
u296150111
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input())\na=list(map(int,input().split()))\np=0\nfor x in a:\n\tp^=x\nans=[]\nfor x in a:\n\tans.append(p^x)\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\np=0\nfor x in a:\n\tp^=x\nans=[]\nfor x in a:\n\tans.append(p^x)\nprint(*ans)']
['Wrong Answer', 'Accepted']
['s214150694', 's463999579']
[31612.0, 31752.0]
[136.0, 158.0]
[116, 117]
p02631
u306033313
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["n = int(input())\nlis = list(map(int, input().split()))\n\ns = 0\nfor i in lis:\n s = s^i\nlis = list(map(lambda x: str(-(-s^x)), lis))\nst = ' '.join(lis)\nprint(st)", "n = int(input())\nlis = list(map(int, input().split()))\n\ns = 0\nfor i in lis:\n s = s^i\nlis = list(map(lambda x: str(s^x), lis))\nst = ' '.join(lis)\nprint(st)"]
['Wrong Answer', 'Accepted']
['s088871030', 's734432343']
[31404.0, 31612.0]
[153.0, 137.0]
[161, 157]
p02631
u307516601
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import sys\nsys.setrecursionlimit(10**6)\n\nn = int(input())\na = list(map(int, input().split()))\n#n, m = map(int, input().split())\n#s = input()\n#s,t = input().split()\n#a = [int(input()) for _ in range(n)]\n#\n#readline = sys.stdin.readline\n\n#ab = [[int(i) for i in readline().split()] for _ in range(n)]\n\nsu = 0\n\nfor i in range(1, n):\n su ^= a[i]\n \nans = [su]\n\nfor i in range(n-1):\n su = su ^ a[i] ^ a[i+1]\n ans.append(su)\n \nprint(*su)', 'import sys\nsys.setrecursionlimit(10**6)\n\nn = int(input())\na = list(map(int, input().split()))\n#n, m = map(int, input().split())\n#s = input()\n#s,t = input().split()\n#a = [int(input()) for _ in range(n)]\n#\n#readline = sys.stdin.readline\n\n#ab = [[int(i) for i in readline().split()] for _ in range(n)]\n\nsu = 0\n\nfor i in range(1, n):\n su ^= a[i]\n \nans = [su]\n\nfor i in range(n-1):\n su = su ^ a[i] ^ a[i+1]\n ans.append(su)\n \nprint(*ans)']
['Runtime Error', 'Accepted']
['s247143352', 's397454447']
[31428.0, 31652.0]
[145.0, 208.0]
[488, 489]
p02631
u314089899
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA_list = [int(e) for e in input().split()]\n\nall_A_xor = A_list[0]\n#print(A_list[0],bin(A_list[0]))\n\nfor i in range(1,N):\n #print(A_list[i],bin(A_list[i]))\n all_A_xor ^= A_list[i]\n\n#print(all_A_xor,bin(all_A_xor))\n\nans = [A^all_A_xor for A in A_list]\nprint(ans)', "N = int(input())\nA_list = [int(e) for e in input().split()]\n\nall_A_xor = A_list[0]\n#print(A_list[0],bin(A_list[0]))\n\nfor i in range(1,N):\n #print(A_list[i],bin(A_list[i]))\n all_A_xor ^= A_list[i]\n\n#print(all_A_xor,bin(all_A_xor))\n\nans = [A^all_A_xor for A in A_list]\nprint(' '.join(map(str, ans)))"]
['Wrong Answer', 'Accepted']
['s999243572', 's378763137']
[31552.0, 41788.0]
[139.0, 156.0]
[283, 303]
p02631
u317423698
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import sys\nfrom collections import Counter\nreadline = sys.stdin.buffer.readline\n\nn = int(readline())\na = list(map(int, readline().split()))\n\nfor j in range(n):\n b = 0\n for i, v in enumerate(a):\n if i != j:\n b ^= v\n print(b)', "import sys\nfrom functools import reduce\nfrom operator import xor\nreadline = sys.stdin.buffer.readline\n\nn = int(readline())\na = tuple(map(int, readline().split()))\n\ns = reduce(xor, a[1:], a[0])\n# print(s)\nb = tuple(str(s ^ v) for v in a)\nprint(' '.join(b))"]
['Time Limit Exceeded', 'Accepted']
['s559124172', 's137170168']
[29412.0, 35960.0]
[2206.0, 135.0]
[234, 255]
p02631
u326278153
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\na_list = list(map(int, input().split()))\nall_xor = 0\nres = []\n\nfor a in a_list:\n all_xor ^= a\n\nfor a in a_list:\n res.append(a ^ all_xor)\n\nprint(res)\n', 'N = int(input())\na_list = list(map(int, input().split()))\nall_xor = 0\nres = []\n\nfor a in a_list:\n all_xor ^= a\n\nfor a in a_list:\n res.append(a ^ all_xor)\n\nprint(*res)\n']
['Wrong Answer', 'Accepted']
['s017367190', 's459454232']
[31548.0, 31400.0]
[126.0, 162.0]
[172, 173]
p02631
u326775883
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\na = list(map(int, input().split()))\nx = 0\nfor i in range(1, n):\n x = x^a[i]\n \nl = [x]\nfor i in range(n-1):\n x = a[i]^a[i+1]\n l.append(l[i]^x)\nprint(l)\n\n', 'n = int(input())\na = list(map(int, input().split()))\nx = 0\nfor i in range(1, n):\n x = x^a[i]\n \nl = [x]\nfor i in range(n-1):\n x = a[i]^a[i+1]\n l.append(l[i]^x)\nprint(*l)\n\n']
['Wrong Answer', 'Accepted']
['s200274295', 's603451519']
[31724.0, 31636.0]
[173.0, 215.0]
[173, 174]
p02631
u327465093
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = list(map(int, input().split()))\n\np = 0\nfor i in range(1, N):\n p ^= A[i]\nprint(p)\n\nans = [str(p)]\nfor i in range(1, N):\n t = A[i-1] ^ A[i]\n p = p ^ t\n ans.append(str(p))\nprint(" ".join(ans))\n', 'N = int(input())\nA = list(map(int, input().split()))\n\np = 0\nfor i in range(1, N):\n p ^= A[i]\n\nans = [str(p)]\nfor i in range(1, N):\n t = A[i-1] ^ A[i]\n p = p ^ t\n ans.append(str(p))\nprint(" ".join(ans))\n']
['Wrong Answer', 'Accepted']
['s462846942', 's672758521']
[35668.0, 35684.0]
[214.0, 212.0]
[223, 214]
p02631
u364774090
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["N = int(input())\nA = list(map(int, input().split()))\n\ns = 0\nfor a in A:\n\ts ^= a\n\tprint(s)\nans = []\n\nfor a in A:\n\tans += [str(a ^ s)]\nprint(' ' .join(ans))", "N = int(input())\nA = list(map(int, input().split()))\n\ns = 0\nfor a in A:\n\ts ^= a\nans = []\n\nfor a in A:\n\tans += [str(a ^ s)]\nprint(' ' .join(ans))"]
['Wrong Answer', 'Accepted']
['s487132298', 's341236944']
[35752.0, 35728.0]
[228.0, 169.0]
[154, 144]
p02631
u365838886
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\na = list(map(int, input().split()))\n\nb = [0]*N\n\nfor i in range(1,N):\n b[i] = b[i-1] ^ a[i-1] ^ a[i]\n\nprint(" ".join(map(str, b)))', 'N = int(input())\na = list(map(int, input().split()))\n\nb = [0]*N\n\nxorsum = 0\nfor i in range(1,N):\n b[i] = b[i-1] ^ a[i-1] ^ a[i]\n xorsum = xorsum ^ b[i]\n\nb[0] = xorsum ^ a[0]\n\nfor i in range(1,N):\n b[i] = b[i-1] ^ a[i-1] ^ a[i]\n\nprint(" ".join(map(str, b)))']
['Wrong Answer', 'Accepted']
['s244763930', 's772131654']
[41028.0, 41652.0]
[161.0, 231.0]
[149, 265]
p02631
u369133448
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input())\na=list(map(int,input().split()))\nwk=0\nfor i in range(0,n,2):\n wk^=a[i]^a[i+1]\nans=[]\nfor i in range(n):\n ans.append(str(wk^a[i]))\nprint(" ".join(list(set(ans))))', 'n=int(input())\na=list(map(int,input().split()))\nwk=0\nfor i in range(0,n,2):\n wk^=a[i]^a[i+1]\nans=[]\nfor i in range(n):\n ans.append(str(wk^a[i]))\nprint(" ".join(ans))']
['Wrong Answer', 'Accepted']
['s271873444', 's113180101']
[43860.0, 35812.0]
[240.0, 172.0]
[178, 167]
p02631
u377989038
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\na = list(map(int, input().split()))\n\nketa = len(bin(max(a))) - 2\ntmp = [0] * keta\nfor i in a:\n for j, k in enumerate(bin(i)[2:][::-1]):\n tmp[j] += int(k)\ntmp = tmp[::-1]\n\nans = [""] * n\nfor i in tmp:\n for j in range(n):\n if i > 0:\n ans[j] += "0"\n i -= 1\n else:\n ans[j] += "1"\n\nans_ = []\nfor i in ans:\n ans_.append(int(i, 2))\nprint(*ans_)', 'n = int(input())\na = list(map(int, input().split()))\n\nxor = 0\nfor i in a:\n xor ^= i\n\nans = []\nfor i in a:\n ans.append(xor ^ i)\nprint(*ans)\n']
['Wrong Answer', 'Accepted']
['s529621098', 's545840934']
[34916.0, 31592.0]
[2207.0, 165.0]
[417, 145]
p02631
u391157755
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input())\na_array=list(map(int,input().split()))\nnext_xor=[0 for _ in range(n-1)]\nfor i in range(n-1):\n next_xor[i]=a_array[i]^a_array[i+1]\nans=[2<<28]\nfor xo in next_xor:\n ans.append(ans[-1]^xo)\nprint(" ".join(map(str,ans)))', 'import math\n\nn=int(input())\na_array=list(map(int,input().split()))\nnext_xor=[0 for _ in range(n-1)]\nmax_dig=math.floor(math.log2(a_array[0]))\nfor i in range(n-1):\n next_xor[i]=a_array[i]^a_array[i+1]\n max_dig=math.floor(math.log2(a_array[i+1]))\nflag_1=True\nans_1=[0]\nans_2=[2<<max_dig]\nSUP=10**9\nfor xo in next_xor:\n if ans_1[-1]^xo >= SUP:\n flag_1=False\n ans_1.append(ans_1[-1]^xo)\n ans_2.append(ans_2[-1]^xo)\nprint(" ".join(map(str,ans_1 if flag_1 else ans_2)))', 'n=int(input())\na_array=list(map(int,input().split()))\nall_xor=0\nfor a in a_array:\n all_xor^=a\nprint(" ".join([str(all_xor^a) for a in a_array]))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s475423785', 's556366044', 's651509127']
[48744.0, 59084.0, 33568.0]
[191.0, 295.0, 143.0]
[236, 485, 147]
p02631
u407702479
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N=int(input())\na=list(map(int,input().split()))\nS=0\nfor i in a:\n S^=i\nprint([i^S for i in a])', 'N=int(input())\na=list(map(int,input().split()))\nS=0\nfor i in a:\n S^=i\na=[S^i for i in a] \nprint(*a)']
['Wrong Answer', 'Accepted']
['s829989746', 's855061600']
[31640.0, 31496.0]
[123.0, 143.0]
[94, 101]
p02631
u426572476
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["import sys\nimport heapq\nimport re\nfrom itertools import permutations\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, deque\nfrom math import factorial, sqrt, ceil, gcd\nfrom functools import lru_cache, reduce\nfrom decimal import Decimal\nINF = 1 << 60\nMOD = 1000000007\nsys.setrecursionlimit(10 ** 7)\n\n# UnionFind\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n\ndef dijkstra_heap(s, edge, n):\n \n d = [10**20] * n\n used = [True] * n \n d[s] = 0\n used[s] = False\n edgelist = []\n for a,b in edge[s]:\n heapq.heappush(edgelist,a*(10**6)+b)\n while len(edgelist):\n minedge = heapq.heappop(edgelist)\n \n if not used[minedge%(10**6)]:\n continue\n v = minedge%(10**6)\n d[v] = minedge//(10**6)\n used[v] = False\n for e in edge[v]:\n if used[e[1]]:\n heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])\n return d\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\n\ndef lcm_list(numbers):\n return reduce(lcm, numbers, 1)\n\n\ndef gcd_list(numbers):\n return reduce(gcd, numbers)\n\n\ndef is_prime(n):\n if n <= 1:\n return False\n p = 2\n while True:\n if p ** 2 > n:\n break\n if n % p == 0:\n return False\n p += 1\n return True\n\n\n\ndef eratosthenes(limit):\n A = [i for i in range(2, limit+1)]\n P = []\n\n while True:\n prime = min(A)\n \n if prime > sqrt(limit):\n break\n \n P.append(prime)\n \n i = 0\n while i < len(A):\n if A[i] % prime == 0:\n A.pop(i)\n continue\n i += 1\n \n for a in A:\n P.append(a)\n \n return P\n\n\ndef permutation_with_duplicates(L):\n\n if L == []:\n return [[]]\n\n else:\n ret = []\n\n \n S = sorted(set(L))\n\n for i in S:\n\n data = L[:]\n data.remove(i)\n\n for j in permutation_with_duplicates(data):\n ret.append([i] + j)\n\n return ret\n\n\n\nn = int(input())\na = list(map(int, input().split()))\ntotal = 10 ** 9\nans = [total^i for i in a]\nprint(*ans)\n ", "import sys\nimport heapq\nimport re\nfrom itertools import permutations\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, deque\nfrom math import factorial, sqrt, ceil, gcd\nfrom functools import lru_cache, reduce\nfrom decimal import Decimal\nINF = 1 << 60\nMOD = 1000000007\nsys.setrecursionlimit(10 ** 7)\n\n# UnionFind\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n\ndef dijkstra_heap(s, edge, n):\n \n d = [10**20] * n\n used = [True] * n \n d[s] = 0\n used[s] = False\n edgelist = []\n for a,b in edge[s]:\n heapq.heappush(edgelist,a*(10**6)+b)\n while len(edgelist):\n minedge = heapq.heappop(edgelist)\n \n if not used[minedge%(10**6)]:\n continue\n v = minedge%(10**6)\n d[v] = minedge//(10**6)\n used[v] = False\n for e in edge[v]:\n if used[e[1]]:\n heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])\n return d\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\n\ndef lcm_list(numbers):\n return reduce(lcm, numbers, 1)\n\n\ndef gcd_list(numbers):\n return reduce(gcd, numbers)\n\n\ndef is_prime(n):\n if n <= 1:\n return False\n p = 2\n while True:\n if p ** 2 > n:\n break\n if n % p == 0:\n return False\n p += 1\n return True\n\n\n\ndef eratosthenes(limit):\n A = [i for i in range(2, limit+1)]\n P = []\n\n while True:\n prime = min(A)\n \n if prime > sqrt(limit):\n break\n \n P.append(prime)\n \n i = 0\n while i < len(A):\n if A[i] % prime == 0:\n A.pop(i)\n continue\n i += 1\n \n for a in A:\n P.append(a)\n \n return P\n\n\ndef permutation_with_duplicates(L):\n\n if L == []:\n return [[]]\n\n else:\n ret = []\n\n \n S = sorted(set(L))\n\n for i in S:\n\n data = L[:]\n data.remove(i)\n\n for j in permutation_with_duplicates(data):\n ret.append([i] + j)\n\n return ret\n\n\n\nn = int(input())\na = list(map(int, input().split()))\ntotal = 0\nfor i in range(n):\n if i == 0:\n total = a[i]\n else:\n total ^= a[i]\nans = [0 for i in range(n)]\nfor i in range(n):\n ans[i] = total ^ a[i]\nprint(*ans)"]
['Wrong Answer', 'Accepted']
['s298417288', 's149898616']
[32776.0, 32624.0]
[150.0, 203.0]
[4068, 4190]
p02631
u432251613
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['def main():\n N = int(input())\n a = list(map(int, input().split()))\n \n ans = a\n for i in range(10):\n c0,c1 = 0,0\n for j in range(N):\n if (a[j]>>i)&1:\n c1+=1\n if c1%2==0:\n ans[j] += (a[j]>>i)*pow(2,i)\n else:\n ans[j] += (((a[j]>>i)+1)%2)*pow(2,i)\n print(*ans)\n\nmain()\n', 'def main():\n N = int(input())\n a = list(map(int, input().split()))\n \n ans = a\n for i in range(10):\n c0,c1 = 0,0\n for j in range(N):\n if (a[j]>>i)&1:\n c1+=1\n if c1%2==0:\n ans[j] += (a[j]>>i)*pow(2,i)\n print(*ans)\n\nmain()\n', 'def main():\n N = int(input())\n a = list(map(int, input().split()))\n \n s = a[0]\n for i in range(1,N):\n s ^= a[i]\n ans = a\n for i in range(N):\n ans[i] ^= s\n print(*ans)\n\nmain()\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s068805515', 's950789725', 's604195066']
[31452.0, 31336.0, 31432.0]
[330.0, 332.0, 151.0]
[412, 349, 266]
p02631
u441100668
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\nxor_arr = list(map(int, input().split()))\nxor_of_xor = 0\nfor elm in xor_arr:\n xor_of_xor = xor_of_xor ^ elm\nscarf_val = [xor_of_xor ^ elm for elm in xor_arr]\n\nprint(scarf_val)', ' n = int(input())\n xor_arr = list(map(int, input().split()))\n xor_of_xor = 0\n for elm in xor_arr:\n xor_of_xor = xor_of_xor ^ elm\n scarf_val = [xor_of_xor ^ elm for elm in xor_arr]\n \n print(" ".join(str(x) for x in scarf_val))', ' n = int(input())\n xor_arr = list(map(int, input().split()))\n xor_of_xor = 0\n for elm in xor_arr:\n xor_of_xor = xor_of_xor ^ elm\n scarf_val = [xor_of_xor ^ elm for elm in xor_arr]\n print(" ".join(str(x) for x in scarf_val))', 'n = int(input())\nxor_arr = list(map(int, input().split()))\nxor_of_xor = 0\nfor elm in xor_arr:\n xor_of_xor = xor_of_xor ^ elm\nscarf_val = [xor_of_xor ^ elm for elm in xor_arr]\n \nprint(" ".join(str(x) for x in scarf_val))']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s705426505', 's854988296', 's876228269', 's364518515']
[31512.0, 8876.0, 8928.0, 41668.0]
[119.0, 25.0, 31.0, 143.0]
[195, 254, 276, 230]
p02631
u442877951
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["N = int(input())\nA = list(map(int,input().split()))\n\nl = [0]*(2**max(A))\nll = []\nfor a in A:\n pattern = bin(a)[2:].zfill(N)\n for i in range(len(pattern)):\n if pattern[i] == '1':\n l[i] += 1\n\nfor a in A:\n ans = ''\n pattern = bin(a)[2:].zfill(N)\n for i in range(len(pattern)):\n if pattern[i] == '1' and int(l[i])%2 == 0:\n ans += '1'\n elif pattern[i] == '0' and int(l[i])%2 != 0:\n ans += '1'\n else:\n ans += '0'\n ll.append(int(ans,2))\nprint(*ll)", 'N = int(input())\nA = list(map(int,input().split()))\nnum = 0\nfor a in A:\n num ^= a\n\nl = []\n\nfor a in A:\n ans = a^num\n l.append(ans)\nprint(*l)']
['Runtime Error', 'Accepted']
['s346910426', 's922532088']
[244128.0, 31644.0]
[2214.0, 180.0]
[478, 143]
p02631
u455408345
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input(""))\na=[]\nans=[1]\nain=input("").split(" ")\nfor i in range(n):\n a+=[int(ain[i])]\ns=a[1]\nfor i in range(n-2):\n s^=a[i+2]\nans[0]=s\nfor i in range(n-1):\n s=s^a[i]\n s^=a[i+1]\n ans+=s\nprint(" ".join(ans))\n\n\n \n', 'n=int(input(""))\na=[]\nans=[1]\nain=input("").split(" ")\nfor i in range(n):\n a+=[int(ain[i])]\ns=a[1]\nfor i in range(n-2):\n s^=a[i+2]\nans[0]=s\nfor i in range(n-1):\n s=s^a[i]\n s^=a[i+1]\n ans+=[s]\nb=[]\nfor i in range(n):\n b+=[str(ans[i])]\nprint(" ".join(b))\n\n\n \n']
['Runtime Error', 'Accepted']
['s490383562', 's949942553']
[31436.0, 57456.0]
[130.0, 267.0]
[233, 278]
p02631
u476674874
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["from functools import reduce\ndef resolver(N, A):\n X = reduce(int.__xor__, A)\n ans = [X^a for a in A]\n \n return ans\n\ndef test():\n pass\n\ndef main():\n\n #test()\n\n N = int(input())\n A = list(map(int, input().split()))\n ans = resolver(N, A)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n main()", 'from functools import reduce\ndef resolver(N, A):\n X = reduce(int.__xor__, A)\n ans = [str(X^a) for a in A]\n \n return ans\n\ndef test():\n pass\n\ndef main():\n\n #test()\n\n N = int(input())\n A = list(map(int, input().split()))\n ans = resolver(N, A)\n\n print(" ".join(ans))\n \n\n\n\nif __name__ == \'__main__\':\n main()']
['Wrong Answer', 'Accepted']
['s939494207', 's238041743']
[31704.0, 36084.0]
[111.0, 127.0]
[318, 338]
p02631
u485979475
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input())\nalist=list(map(int,input().split()))\n\nallh=alist[0]^alist[1]\nfor i in range(n-1):\n allh = allh ^ alist[i+2]\n\noutlist=[]\nfor a in alist:\n outlist.append(str(allh ^ a))\n outlist.append(" ")\noutlist.pop()\nprint("".join(outlist))\n', 'n=int(input())\nalist=list(map(int,input().split()))\n\nallh=alist[0]^alist[1]\nfor i in range(n-1):\n allh = allh ^ alist[i+1]\n\noutlist=[]\nfor a in alist:\n outlist.append(str(allh ^ a))\n outlist.append(" ")\noutlist.pop()\nprint("".join(outlist))\n', 'n=int(input())\nalist=list(map(int,input().split()))\n\nallh=alist[0]^alist[1]\nfor i in range(n-2):\n allh = allh ^ alist[i+2]\n\noutlist=[]\nfor a in alist:\n outlist.append(str(allh ^ a))\n outlist.append(" ")\noutlist.pop()\nprint("".join(outlist))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s828318771', 's882370413', 's559229951']
[31636.0, 37940.0, 37760.0]
[104.0, 189.0, 185.0]
[250, 250, 250]
p02631
u487594898
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['#!/usr/bin/env python3\nimport sys\nimport numpy as np\ninput = sys.stdin.readline\nn=int(input())\nA = list(map(int,input().split()))\nB = []\nans = A[0]\nfor i in range(1,n):\n ans = ans ^ A[i]\n\nfor i in range(n):\n B.append(ans ^ A[i])\nprint(B)\n ', '#!/usr/bin/env python3\nimport sys\nimport numpy as np\ninput = sys.stdin.readline\nn=int(input())\nA = list(map(int,input().split()))\nB = []\nans = A[0]\nfor i in range(1,n):\n ans = ans ^ A[i]\n\n\nfor i in range(n):\n B.append(ans ^ A[i])\nL=[str(a) for a in B]\nL=" ".join(L)\nprint(L)']
['Wrong Answer', 'Accepted']
['s946421102', 's514376022']
[48860.0, 58748.0]
[228.0, 256.0]
[249, 281]
p02631
u501451051
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\nlis = list(map(int, input().split()))\n\nt = lis[0]\nfor i in range(1, n):\n t ^= i\n\nans = [0] * n\nfor i , j in enumerate(lis):\n ans[i] = t ^ j\n\nprint(*ans)', 'n = int(input())\nlis = list(map(int, input().split()))\n\nt = lis[0]\nfor i in range(1, n):\n t ^= lis[i]\n\nans = [0] * n\nfor i , j in enumerate(lis):\n ans[i] = t ^ j\n\nprint(*ans)']
['Wrong Answer', 'Accepted']
['s221349019', 's369310863']
[31440.0, 31416.0]
[159.0, 173.0]
[175, 180]
p02631
u514118270
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\n\nN = i()\na = l()\nA = 0\nfor i in range(N):\n A = A^a[i]\nbit = bin(A)[2:]\nn = len(bit)\nbits = []\nfor i in range(N):\n bits.append(bin(a[i])[2:])\nans = []\nmaxlen = len(bin(max(a))[2:])\nbit = list(bit.zfill(maxlen))[::-1]\nfor i in range(N):\n b = list(bits[i].zfill(maxlen))[::-1]\n num = 0\n print(bit,b)\n for j in range(maxlen):\n if bit[j] != b[j]:\n num += 2**j\n ans.append(num)\nprint(*ans)', 'import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\n\nN = i()\na = l()\nA = 0\nfor i in range(N):\n A = A^a[i]\nbit = bin(A)[2:]\nn = len(bit)\nbits = []\nfor i in range(N):\n bits.append(bin(a[i])[2:])\nans = []\nmaxlen = len(bin(max(a))[2:])\nbit = list(bit.zfill(maxlen))[::-1]\nfor i in range(N):\n b = list(bits[i].zfill(maxlen))[::-1]\n num = 0\n for j in range(maxlen):\n if bit[j] != b[j]:\n num += 2**j\n ans.append(num)\nprint(*ans)']
['Wrong Answer', 'Accepted']
['s248997248', 's275786761']
[93960.0, 45264.0]
[2282.0, 1808.0]
[860, 843]
p02631
u520276780
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import numpy as np\nn=int(input())\n*a,=map(int, input().split())\nx=0\nfor ai in a:\n x^=ai\n\nans=[ai^x for ai in ans]\nprint(*ans)', 'n=int(input())\n*a,=map(int, input().split())\nx=0\nfor ai in a:\n x^=ai\n\na=[ai^x for ai in a]\nprint(*a)']
['Runtime Error', 'Accepted']
['s072456596', 's375896698']
[49436.0, 31760.0]
[173.0, 154.0]
[128, 103]
p02631
u556610039
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['num = int(input())\na_i = list(map(int, input().split()))\ns = 0\nfor x in a_i:\n s ^= x\nans = []\nfor x in a_i:\n ans.append(x ^ s)\nprint(ans)', "num = int(input())\na_i = list(map(int, input().split()))\ns = 0\nfor x in a_i:\n s ^= x\nans = []\nfor x in a_i:\n ans.append(x ^ s)\nprint(' '.join(map(str, ans)))"]
['Wrong Answer', 'Accepted']
['s674176063', 's657757412']
[31524.0, 41600.0]
[134.0, 155.0]
[143, 163]
p02631
u570155187
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import numpy as np\n\nn = int(input())\na = list(map(int, input().split()))\n\nb = [0]*n\nfor i in range(n):\n b[i] = list(map(int, bin(a[i])[2:][::-1]))\n\nl = max(map(len, b))\nb_pad = list(map(lambda x: x + [0]*(l-len(x)), b))\n\nfor j in range(n):\n b_add = (np.sum(b_pad,axis=0) - np.array(b_pad[j])) % 2\n ans = 0\n for k in range(l):\n ans += (2**(k))*b_add[k]\n print(ans,end=" ")', 'n = int(input())\na = list(map(int, input().split()))\n\ns = a[0]\nfor i in range(1,n):\n s ^= a[i]\n\nans = [0]*n\nfor j in range(n):\n ans[j] = s ^ a[j]\n\nprint(*ans)']
['Time Limit Exceeded', 'Accepted']
['s208130756', 's297387293']
[227960.0, 31444.0]
[2210.0, 179.0]
[379, 160]
p02631
u582759840
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["import copy\n\n\nn = int(input())\nlst = list(map(int,input().split(' ')))\n\nfor i in range(n):\n l = copy.deepcopy(lst)\n del l[i]\n buf = 0\n for ll in l:\n buf ^= ll\n print(buf)", "n = int(input())\nlst = list(map(int,input().split(' ')))\n\nx = 0\nfor l in lst:\n x ^= l\nout = ''\nfor l in lst:\n out += ' ' + str(x^l)\nprint(out[1:])"]
['Time Limit Exceeded', 'Accepted']
['s048404340', 's913734041']
[31732.0, 31408.0]
[2206.0, 174.0]
[192, 152]
p02631
u589969467
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\na = list(map(int,input().split()))\nans = []\ntmp = a[0]\nfor i in range(1,n):\n tmp = tmp^a[i]\nfor i in range(n):\n ans.append(tmp^a[i])\nprint(ans)', "n = int(input())\na = list(map(int,input().split()))\nans = []\ntmp = a[0]\nfor i in range(1,n):\n tmp = tmp^a[i]\nans = ''\nfor i in range(n):\n ans += str(int(tmp^a[i]))+' '\nprint(ans[:-1])"]
['Wrong Answer', 'Accepted']
['s294843286', 's600759706']
[31756.0, 31444.0]
[146.0, 194.0]
[166, 189]
p02631
u598296382
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["N = int(input())\na = list(map(int,input().split()))\n#xor_a = [bin(x) for x in a]\n#print(xor_a)\nb = [sum(a) ^ a[x] for x in range(N)]\n\nprint(' '.join(map(str, b))) ", "N = int(input())\na = list(map(int, input().split()))\nb = [sum(a) ^ a[x] for x in range(N)]\nprint(' '.join(map(str, b)))", '#N = int(input())\na = list(map(int,input().split()))\n#xor_a = [bin(x) for x in a]\n#print(xor_a)\n#sum_xor = bin(sum(a))\nb = [sum(a) ^ a[x] for x in range(len(a))]\nprint(b)', "N = int(input())\na = list(map(int,input().split()))\n#xor_a = [bin(x) for x in a]\n#print(xor_a)\nx = 0\nfor i in a:\n x ^= i\nb = [x^y for y in a]\nprint(' '.join(map(str, b))) \n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s605384390', 's706436466', 's871503608', 's256775279']
[31744.0, 31564.0, 9000.0, 41804.0]
[2206.0, 2206.0, 30.0, 140.0]
[283, 119, 170, 320]
p02631
u608755339
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = [int(i) for i in input().split()]\n \nO = [0] * N\n\nfor i in range(N):\n for j in range(N):\n if i == j:\n continue\n O[i] ^= A[j]\n\nprint(O)', 'N = int(input())\nA = [int(i) for i in input().split()]\n \nO = [0] * 4\n\nfor i in range(N):\n for j in range(N):\n if i == j:\n continue\n O[i] ^= A[j]\n\nprint(O)', "N = int(input())\nSUM = 0\nA = []\nO = []\nfor i in input().split():\n i = int(i)\n SUM ^= i\n A.append(i)\n\nfor a in A:\n O.append(SUM ^ a)\n\nprint(' '.join([str(s) for s in O]))"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s396476557', 's814836283', 's789471973']
[31540.0, 31528.0, 41860.0]
[2206.0, 214.0, 173.0]
[167, 167, 173]
p02631
u618251217
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["N = int(input())\nA = list(map(int, input().split()))\n\nlis = []\nfor a in A:\n stra = str(a)\n S = '0b'\n i = 0\n for s in stra:\n s = 0 | (a >> i)\n if i%2 == 0:\n S = s + S\n else:\n if s == '0':\n S = '1' + S\n else:\n S = '0' + S\n i += 1\n lis.append(int(S))\nprint(*S)", 'N = int(input())\nA = list(map(int, input().split()))\n\nlis = []\nfor a in A:\n S = 0\n i = 0\n for i in range(30):\n s = 0 | (a >> i)\n if i%2 == 0:\n if s == 1:\n S += 2**i\n else:\n if s == 0:\n S += 2**i\n i += 1\n lis.append(S)\nprint(*lis)', 'N = int(input())\nA = list(map(int, input().split()))\n\nX = 0\nfor a in A:\n X = X ^ a\n\nlis = []\nfor a in A:\n Y = X ^ a\n lis.append(Y)\nprint(*lis)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s319030672', 's527932469', 's228862636']
[31440.0, 31736.0, 31668.0]
[77.0, 2133.0, 178.0]
[363, 321, 151]
p02631
u647796955
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["import sys\nN = int(sys.stdin.readline().rstrip())\nA = list(map(int, sys.stdin.readline().rstrip().split()))\nS= 0\nfor n in range(N):\n S = S^A[n]\n print(S)\n \nans = ''\nfor n in range(N):\n m = S^A[n]\n ans += str(m) + ' '\n\nprint(ans)", "import sys\nN = int(sys.stdin.readline().rstrip())\nA = list(map(int, sys.stdin.readline().rstrip().split()))\nS= 0\nfor n in range(N):\n S = S^A[n]\n \nans = ''\nfor n in range(N):\n m = S^A[n]\n ans += str(m) + ' '\n\nprint(ans[:-1])"]
['Wrong Answer', 'Accepted']
['s290904496', 's707389583']
[31444.0, 31448.0]
[265.0, 204.0]
[233, 227]
p02631
u678505520
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input())\nA=list(map(int,input().split()))\nA.append(A[0])\nB=[]\nC=[]\n\ndef xor(C):\n total=0\n for i in range(1,len(C)):\n total^=C[i]\n return total\n\nfor i in range(n):\n B.append(A[i]^A[i+1])\n\nfor i in range(1,100000):\n C.append(i)\n p=i\n for j in range(n-1):\n C.append(B[j]^p)\n p^=B[j]\n if xor(C)==A[0]:\n break\n else:\n C.clear()\n\nprint(C)', "def xsum(A):\n total=0\n for i in range(len(A)):\n total^=A[i]\n return total\n\nn=int(input())\nA=list(map(int,input().split()))\nB=[0]*n\ntotal=xsum(A)\nfor i in range(n):\n B[i]=total^A[i]\nB_str=[str(i) for i in B]\nprint(' '.join(B_str))"]
['Wrong Answer', 'Accepted']
['s436709635', 's858157912']
[32316.0, 43932.0]
[2206.0, 163.0]
[362, 248]
p02631
u693173434
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n=int(input())\na=list(map(int,input().split()))\n\nfor i in range(n-1):\n c=a[i]^a[i+1]\n\nans=[0]*n\nfor i in range(n):\n ans[i]=c^a[i]\nL=[str(a) for a in ans]\nL=" ".join(L)\nprint(L)\n', 'n=int(input())\na=list(map(int,input().split()))\n\nc=a[0]\nfor i in range(n-1):\n c=c^a[i+1]\n\nans=[0]*n\nfor i in range(n):\n ans[i]=c^a[i]\nL=[str(a) for a in ans]\nL=" ".join(L)\nprint(L)\n']
['Wrong Answer', 'Accepted']
['s707956885', 's655652202']
[41800.0, 41672.0]
[190.0, 180.0]
[183, 187]
p02631
u708255304
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = list(map(int, input().split()))\nsum_of_A = sum(A)\nans = []\nfor a in A:\n ans.append((sum_of_A-a)^a)\nprint(" ".join(map(str, ans)))\n', 'N = int(input())\nA = list(map(int, input().split()))\nsum_of_A = sum(A)\nans = []\nfor a in A:\n ans.append(sum_of_A^a)\nprint(" ".join(map(str, ans)))\n', 'N = int(input())\nA = list(map(int, input().split()))\nsum_of_A = A[0]\nfor a in A[1:]:\n sum_of_A ^= a\nans = []\nfor a in A:\n ans.append((sum_of_A)^a)\nprint(" ".join(map(str, ans)))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s949782385', 's997951693', 's688703502']
[42540.0, 42708.0, 41644.0]
[162.0, 147.0, 155.0]
[154, 150, 184]
p02631
u731603651
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\na = sorted(list(map(int, input().split())))\nx = 0\nfor i in a:\n x ^= i\nfor i in range(n):\n a[i] ^= x\nprint(*a)', 'n = int(input())\na = list(map(int, input().split()))\nx = 0\nfor i in a:\n x ^= i\nfor i in range(n):\n a[i] ^= x\nprint(*a)']
['Wrong Answer', 'Accepted']
['s780067279', 's110700801']
[31456.0, 31356.0]
[207.0, 158.0]
[132, 124]
p02631
u747703115
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\nA = list(map(int, input().split()))\nans = list()\nfor i in range(n-2):\n for j in range(i+1, n-1):\n for k in range(j+1, n):\n ans.append(A[i]^A[j]^A[k])\nprint(*ans)', 'n = int(input())\nA = list(map(int, input().split()))\nbase = 0\nfor a in A:\n base = base ^ a\nans = [base^a for a in A]\nprint(*ans)']
['Wrong Answer', 'Accepted']
['s862895445', 's792242358']
[400816.0, 31608.0]
[2222.0, 150.0]
[199, 131]
p02631
u749359783
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\na = [int(i) for i in input().split()]\n\nnow = 1\nprint(now)\n\nfor i in range(N-1):\n A = a[i]^a[i+1]\n now = A^now\n print(now)', 'N = int(input())\na = [int(i) for i in input().split()]\n\nall_a = 0\nfor i in range(N):\n all_a = all_a^a[i]\n\nans = []\nfor i in range(N):\n ans.append(all_a^a[i])\nprint(*ans)']
['Wrong Answer', 'Accepted']
['s193296200', 's254705236']
[31432.0, 31560.0]
[188.0, 180.0]
[147, 175]
p02631
u750770975
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\na = input().split(" ")\n\ns = a[0]\n\nfor num in a[1:]:\n\ts^=num\n\nans = [0]*n\n\nfor i, num in enumerate(a):\n\tans[i] = s^num\n\nprint(*ans)\n', 'n = int(input())\na = input().split(" ")\n\ns = a[0]\n\nfor num in a[1:]:\n\ts ^= num\n\nans = [0]*n\n\nfor i, num in enumerate(a):\n\tans[i] = s^num\n\nprint(*ans)', 'n = int(input())\naa = input().split(" ")\na = [int(c) for c in aa]\n\ns = a[0]\n\nfor num in a[1:]:\n\ts ^= num\n\nans = [0]*n\n\nfor i, num in enumerate(a):\n\tans[i] = s^num\n\nprint(*ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s678420890', 's725314358', 's944408017']
[25184.0, 25272.0, 40912.0]
[50.0, 48.0, 168.0]
[148, 149, 175]
p02631
u756609156
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\naa = map(int,input().split())\nx = 0\nfor a in aa:\n x^=a\nprint(" ".join(str(x^a) for a in aa ))', 'n = int(input())\naa = list(map(int,input().split()))\nx = 0\nfor a in aa:\n x^=a\nprint(" ".join([str(x^a) for a in aa ]))']
['Wrong Answer', 'Accepted']
['s054937401', 's416940800']
[25152.0, 33500.0]
[85.0, 134.0]
[111, 119]
p02631
u764956288
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['# import sys\n# readline = sys.stdin.readline\n# generator = (readline().strip() for _ in range(N))\n\n# N, M = map(int, input().split())\n# As = list(map(int, input().split()))\n# queries = (input() for _ in range(N))\n\n\ndef solve():\n N = int(input())\n As = list(map(int, input().split()))\n\n digits = dict()\n for d in range(30):\n digits[d] = 0\n for a in As:\n digits[d] += a >> d & 1\n\n oore = dict()\n for k, v in digits.items():\n oore[k] = v % 2\n\n nums = [0] * N\n\n # for i, a in enumerate(As):\n # for d in range(30):\n # nums[i] += ((a >> d & 1) ^ (oore[d])) << d\n\n return nums\n\n\ndef main():\n print(*solve())\n\n\nif __name__ == "__main__":\n main()\n', '# import sys\n# readline = sys.stdin.readline\n# generator = (readline().strip() for _ in range(N))\n\n# N, M = map(int, input().split())\n# As = list(map(int, input().split()))\n# queries = (input() for _ in range(N))\n\n\ndef solve():\n N = int(input())\n As = list(map(int, input().split()))\n\n digits = dict()\n for d in range(30):\n digits[d] = 0\n for a in As:\n digits[d] += a >> d & 1\n\n oore = 0\n for k, v in digits.items():\n oore += (v % 2) << k\n\n nums = [0] * N\n\n for i, a in enumerate(As):\n nums[i] = a ^ oore\n\n return nums\n\n\ndef main():\n print(*solve())\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s981227415', 's519265509']
[31444.0, 31444.0]
[865.0, 893.0]
[721, 659]
p02631
u768256617
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["import sys\nsys.setrecursionlimit(10**9)\n\ndef mi(): return map(int,input().split())\ndef lmi(): return list(map(int,input().split()))\ndef ii(): return int(input())\ndef isp(): return input().split()\n\n\n\nn=ii()\na=lmi()\nS=0\nfor i in a:\n S=S^i\n\nb=[]\nfor i in a:\n a_=S^i\n b.append(a_)\n\n print(' '.join(map(str,b)))", "n=int(input())\na=list(map(int,input().split()))\n\ns=0\nfor i in a:\n s^=i\n \nt=[]\nfor i in a:\n t_=i^s\n t.append(t_)\n \nprint(' '.join(map(str,t)))\n "]
['Runtime Error', 'Accepted']
['s778501228', 's503032222']
[148184.0, 41788.0]
[2252.0, 151.0]
[310, 148]
p02631
u804800128
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int( input() )\na = list( map(int, input().split()) )\nx = 0\nfor i in a:\n x ^= i\nprint( * list( map( lamda y: x^y , a ) ) )', 'n = int( input() )\na = list( map(int, input().split()) )\nx = 0\nfor i in a:\n x ^= i\nprint( * list( map( lambda y: x^y , a ) ) )']
['Runtime Error', 'Accepted']
['s245303990', 's152744813']
[8996.0, 31312.0]
[28.0, 160.0]
[128, 129]
p02631
u806325134
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
["n = int(input())\na = list(map(int, input().split()))\n\nm = max(a)\nans = [0] * n\nz = 1\nwhile True:\n b = False\n for i in range(n):\n if a[i] & z:\n b = not b\n for i in range(n):\n if b:\n if a[i] & z:\n ans[i] |= z\n else:\n if not (a[i] & z):\n ans[i] |= z\n\n z <<= 1\n if z > m:\n break\n\nprint(' '.join([str(x) for x in ans]))\n", "n = int(input())\na = list(map(int, input().split()))\n\nm = max(a)\nans = [0] * n\nz = 1\nwhile True:\n b = False\n for i in range(n):\n if a[i] & z:\n b = not b\n for i in range(n):\n if not b:\n if a[i] & z:\n ans[i] |= z\n else:\n if not (a[i] & z):\n ans[i] |= z\n\n z <<= 1\n if z > m:\n break\n\nprint(' '.join([str(x) for x in ans]))"]
['Wrong Answer', 'Accepted']
['s862789789', 's345200746']
[41480.0, 41808.0]
[1791.0, 1762.0]
[361, 364]
p02631
u809714729
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = map(int, input().split())\ntotal = 0\nfor a in A:\n total ^= a\nresult = []\nfor a in A:\n result.append(total ^ a)\nprint(*result)', 'N = int(input())\nA = map(int, input().split())\ntotal = 0\nfor a in A:\n total ^= a\nresult = []\nfor a in A:\n result.append(total ^ a)\nprint(result)', 'N = int(input())\nA = list(map(int, input().split()))\ntotal = 0\nfor a in A:\n total ^= a\nresult = []\nfor a in A:\n result.append(total ^ a)\nprint(*result)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s111897718', 's481618938', 's432530458']
[24972.0, 24996.0, 31548.0]
[84.0, 81.0, 160.0]
[147, 146, 153]
p02631
u843135954
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import sys\nstdin = sys.stdin\nsys.setrecursionlimit(10**6)\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnn = lambda: list(stdin.readline().split())\nns = lambda: stdin.readline().rstrip()\n\nn = ni()\na = na()\n\nprint(*a)', 'import sys\nstdin = sys.stdin\nsys.setrecursionlimit(10**6)\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnn = lambda: list(stdin.readline().split())\nns = lambda: stdin.readline().rstrip()\n\nn = ni()\na = na()\nb = 0\nfor i in a:\n b ^= i\n\nfor i in range(n):\n a[i] ^= b\n\nprint(*a)']
['Wrong Answer', 'Accepted']
['s892541313', 's506398153']
[31256.0, 31296.0]
[124.0, 156.0]
[247, 310]
p02631
u845573105
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\na = list(map(int, input().split()))\nans = [0]\nfor i in range(N-1):\n ans.append(ans[-1]^a[i]^a[i+1])\nprint(" ".join(map(str,ans)))', 'N = int(input())\nA = list(map(int, input().split()))\n \nXOR = 0\nfor a in A:\n XOR ^= a\nfor i in range(N):\n A[i] = A[i]^XOR\nprint(*A)']
['Wrong Answer', 'Accepted']
['s205492144', 's954009498']
[40688.0, 31560.0]
[171.0, 156.0]
[147, 132]
p02631
u860038009
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import numpy as np\n\nN = int(input())\na = np.fromstring(input(), sep=" ", dtype=np.int64)\n# b = np.bitwise_xor.reduce(a)\n# c = np.bitwise_xor(a, b)\n# print(*c, sep=" ")\nfor n in range(N):\n print(np.bitwise_xor.reduce(a) ^ a[n])\n', 'import numpy as np\n\nN = int(input())\na = np.fromstring(input(), sep=" ", dtype=np.int64)\nfor n in range(N):\n print(np.bitwise_xor.reduce(a) ^ a[n])\n', 'import numpy as np\n\nN = int(input())\na = np.fromstring(input(), sep=" ", dtype=np.int64)\nb = np.bitwise_xor.reduce(a)\nc = np.bitwise_xor(a, 0)\nprint(*c, sep=" ")\n', 'import numpy as np\n\nN = int(input())\na = np.fromstring(input(), sep=" ", dtype=np.int64)\nb = np.bitwise_xor.reduce(a)\nc = np.bitwise_xor(a, b)\nprint(*c, sep=" ")\n']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s231998094', 's536725292', 's684369907', 's822116426']
[30800.0, 31080.0, 39952.0, 40160.0]
[2206.0, 2206.0, 251.0, 252.0]
[230, 151, 162, 162]
p02631
u871841829
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = list(map(int, input().split()))\nA = A + A\nans = [0] * N\na = 0\nfor i in range(N-1):\n a ^= A[i]\nans[N-1] = a\nW = N - 1\nfor i in range(N-1):\n remove = A[i]\n addition = A[i+W]\n a = remove^a^addition\n ans[i] = a\n\nprint(" ".join([str(i) for i in ans))\n', 'N = int(input())\nA = list(map(int, input().split()))\nA = A + A\nans = [0] * N\na = 0\nfor i in range(N-1):\n a ^= A[i]\nans[N-1] = a\nW = N - 1\nfor i in range(N-1):\n remove = A[i]\n addition = A[i+W]\n a = remove^a^addition\n ans[i] = a\n\nprint(" ".join([str(i) for i in ans]))\n']
['Runtime Error', 'Accepted']
['s960114329', 's850292506']
[9004.0, 43504.0]
[24.0, 204.0]
[282, 283]
p02631
u876438858
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import sys\n\ninput = sys.stdin.readline\n\n\ndef S():\n return input().rstrip()\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\nn = I()\nA = list(MI())\n\ns = 0\nfor a in A:\n s ^= a\n\nans = []\nfor a in A:\n ans.append(str(s ^ a))\n\nprint(" ".join(ans[::-1]))\n', 'import sys\n\ninput = sys.stdin.readline\n\n\ndef S():\n return input().rstrip()\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\nn = I()\nal = list(MI())\n\ns = 0\nfor a in al:\n s ^= a\n\nans = []\nfor a in al:\n ans.append(str(s ^ a))\n\nprint(" ".join(ans[::-1]))\n', 'import sys\n\ninput = sys.stdin.readline\n\n\ndef S():\n return input().rstrip()\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\nn = I()\nA = list(MI())\n\ns = 0\nfor a in A:\n s ^= a\n\nans = []\nfor a in A:\n ans.append(str(s ^ a))\n\nprint(*ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s445733044', 's896255467', 's803368663']
[36764.0, 36484.0, 32536.0]
[176.0, 163.0, 204.0]
[294, 297, 279]
p02631
u902544771
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\nA = list(map(int, input().split()))\n\nxor = 0\nfor a in A:\n xor ^= a\nresult = []\nfor a in A:\n result.append(xor ^ a)\nprint(result)', "n = int(input())\nA = list(map(int, input().split()))\n\nxor = 0\nfor a in A:\n xor ^= a\nresult = []\nfor a in A:\n result.append(str(xor ^ a))\nprint(' '.join(result))"]
['Wrong Answer', 'Accepted']
['s135823620', 's308772580']
[31600.0, 35764.0]
[130.0, 151.0]
[151, 166]
p02631
u945200821
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import sys\nfrom typing import Callable, List, NoReturn\n\nimport numpy as np\n\n\ndef main() -> NoReturn:\n readline: Callable[[], str] = sys.stdin.readline\n n: int = int(readline().rstrip())\n a: np.ndarray = np.array(tuple(int(_) for _ in readline().rstrip().split()))\n\n xor_all: int = 0\n for a_n in a:\n xor_all ^= a_n\n\n values = np.bitwise_xor(a, xor_all)\n print(" ".join(values))\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\nfrom typing import Callable, List, NoReturn\n\nimport numpy as np\n\n\ndef main() -> NoReturn:\n readline: Callable[[], str] = sys.stdin.readline\n n: int = int(readline().rstrip())\n a: np.ndarray = np.array(tuple(int(_) for _ in readline().rstrip().split()))\n\n xor_all: int = 0\n for a_n in a:\n xor_all ^= a_n\n\n values = np.bitwise_xor(a, xor_all)\n print(" ".join(tuple(str(v) for v in values)))\n\n\nif __name__ == \'__main__\':\n main()\n']
['Runtime Error', 'Accepted']
['s108550060', 's770350054']
[49572.0, 49704.0]
[226.0, 345.0]
[445, 469]
p02631
u952656646
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['N = int(input())\nA = map(int, input().split())\nax = 0\nans = []\nfor a in A:\n ax ^= a\nfor a in A:\n ans.append(a^ax)\n \nprint(" ".join(map(str,ans)))', 'N = int(input())\nA = list(map(int, input().split()))\nb = 0\nfor a in A:\n b ^= a\nans = []\nfor a in A:\n ans.append(str(a^b))\nprint(" ".join(ans))']
['Wrong Answer', 'Accepted']
['s314167368', 's360374819']
[25092.0, 35596.0]
[84.0, 154.0]
[148, 148]
p02631
u962718741
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['#!/usr/bin/env python3\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n ans = [None] * n\n for i in range(n - 1):\n allxor = a[i] ^ a[i + 1]\n for i in range(n):\n ans[i] = allxor ^ a[i]\n print(*ans)\n\n\nif __name__ == "__main__":\n main()\n', '#!/usr/bin/env python3\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n ans = [None] * n\n allxor = 0\n for i in range(n):\n allxor ^= a[i]\n for i in range(n):\n ans[i] = allxor ^ a[i]\n print(*ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s752661586', 's477734445']
[31556.0, 31388.0]
[157.0, 158.0]
[288, 289]
p02631
u970082363
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['n = int(input())\nlist = [int(i) for i in input().split()]\ntotal = 0\nans = []\nfor i in range(n):\n total = total ^ list[i]\n\nprint(total)\nfor j in range(n):\n ans.append(str(total^list[j]))\nprint(" ".join(ans))\n', 'n = int(input())\nlist = [int(i) for i in input().split()]\ntotal = 0\nans = []\nfor i in range(n):\n total = total ^ list[i]\n\nfor j in range(n):\n ans.append(str(total^list[j]))\nprint(" ".join(ans))\n']
['Wrong Answer', 'Accepted']
['s513898468', 's007034504']
[35748.0, 35808.0]
[185.0, 188.0]
[213, 200]
p02631
u987164499
2,000
1,048,576
There are N Snuke Cats numbered 1, 2, \ldots, N, where N is **even**. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written. Recently, they learned the operation called xor (exclusive OR). What is xor? For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows: * When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3~\textrm{xor}~5 = 6. They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf. We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i. Using this information, restore the integer written on the scarf of each Snuke Cat.
['import numpy as np\n\nn = int(input())\na = list(map(int,input().split()))\na = np.array(a,dtype=np.int64)\nb = [((a>>i)&1).sum() for i in range(21)]\nli = []\nfor i in a:\n c = np.array([((i>>j)&1) for j in range(21)],dtype=np.int64)\n d = b-c\n point = 0\n for i in range(31):\n if d[i]%2 == 1:\n point += 2**(i)\n li.append(point)\n\nprint(*li)', 'import numpy as np\n\nn = int(input())\na = list(map(int,input().split()))\nnow = 0\nfor i in a:\n now ^= i\nli = []\nfor i in a:\n li.append(i^now)\n\nprint(*li) ']
['Runtime Error', 'Accepted']
['s005825253', 's241475661']
[49776.0, 50152.0]
[194.0, 271.0]
[364, 159]
p02632
u153094838
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['# -*- coding: utf-8 -*-\n"""\nCreated on Wed Jun 24 20:53:22 2020\n\n@author: NEC-PCuser\n"""\n\nif __name__ == \'__main__\':\n K = int(input())\n n = len(input())\n mod = 10**9+7 \n #25 25 a 25 25 25 b 25 25 c 26 26\n cmb = 1\n ans = 0\n for i in range(0, K + 1):\n print(cmb)\n ans1 = (pow(25, i, mod) * cmb)\n ans2 = pow(26, K - i, mod)\n cmb = (cmb * (n + i) // (i + 1)) % mod \n ans = (ans + (ans1 * ans2)) % mod\n \n \n print(ans)', 'n = int(input())\ns = input()\n \nS = len(s)\nmod = 10 ** 9 + 7\n \ntmp_ans = pow(26, n, mod)\ndiv = pow(26, -1, mod)\n \nans = tmp_ans\n \nfor i in range(1, n+1):\n tmp_ans = (tmp_ans * 25 * div) % mod\n tmp_ans = ((tmp_ans * (S-1+i)) * pow(i, -1, mod)) % mod\n ans = (ans + tmp_ans) % mod\n \nans %= mod\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s649482555', 's490918147']
[10828.0, 10940.0]
[2212.0, 1990.0]
[496, 311]
p02632
u221301671
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['k = int(input())\n\n\ns = int(input())\n\nmod = 10 ** 9 + 7\nn = k + s\n\n\ndef _fac_inv(_n, _mod):\n _fac = [1] * (_n + 1)\n _inv = [1] * (_n + 1)\n for i in range(_n):\n _fac[i + 1] = _fac[i] * (i + 1) % _mod\n _inv[_n] = pow(_fac[_n], _mod - 2, _mod)\n for i in range(_n, 0, -1):\n _inv[i - 1] = _inv[i] * i % _mod\n\n return _fac, _inv\n\n\nfac, inv = _fac_inv(n, mod)\n\nn25 = [1]\nn26 = [1]\nfor _ in range(n-s):\n n25.append((n25[-1] * 25) % mod)\n n26.append((n26[-1] * 26) % mod)\n\nans = 0\n\nfor i in range(s, n + 1):\n ans = (ans + fac[i-1] * inv[s-1] * inv[i-s] * n25[i-s] * n26[n-i]) % mod\n\nprint(ans)\n', 'k = int(input())\ns = input()\ns = len(s)\n\nmod = 10 ** 9 + 7\nn = k + s\n\n\ndef _fac_inv(_n, _mod):\n _fac = [1] * (_n + 1)\n _inv = [1] * (_n + 1)\n for i in range(_n):\n _fac[i + 1] = _fac[i] * (i + 1) % _mod\n _inv[_n] = pow(_fac[_n], _mod - 2, _mod)\n for i in range(_n, 0, -1):\n _inv[i - 1] = _inv[i] * i % _mod\n\n return _fac, _inv\n\n\nfac, inv = _fac_inv(n, mod)\n\nn25 = [1]\nn26 = [1]\nfor _ in range(n-s):\n n25.append((n25[-1] * 25) % mod)\n n26.append((n26[-1] * 26) % mod)\n\nans = 0\n\nfor i in range(s, n + 1):\n ans = (ans + fac[i-1] * inv[s-1] * inv[i-s] * n25[i-s] * n26[n-i]) % mod\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s008950088', 's178857336']
[11028.0, 248332.0]
[31.0, 1966.0]
[650, 629]
p02632
u260036763
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += cmb(i+n-1, n-1, mod) * pow(25, i) * pow(26, (K-i))\nprint(ans%mod)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**6 + 7\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += (cmb(i+n-1, n-1, mod)%mod * pow(25, i)%mod * pow(26, (K-i))%mod) % mod\nprint(ans%mod)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**7\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += cmb(i+n-1, n-1, mod) * pow(25, i) * pow(26, (K-i))\nprint(ans%mod)', 'mod = 10**9 + 7\nK = int(input())\nS = input()\nn = len(S)\ntmp = pow(26, K, mod)\nwaru = pow(26, -1, mod)\nans = tmp\nfor i in range(1, K+1):\n tmp = (tmp * 25 // waru)%mod\n tmp = (tmp * (i + n -1) // pow(i, -1, mod))%mod\n ans = (ans+tmp)%mod\nprint(ans%mod)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**6 + 7\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += cmb(i+n-1, n-1, mod) * pow(25, i) * pow(26, (K-i))\nprint(ans%mod)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**6\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += cmb(i+n-1, n-1, mod) * pow(25, i) * pow(26, (K-i))\nprint(ans%mod)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**6 + 7\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += (cmb(i+n-1, n-1, mod) * pow(25, i, mod)%mod * pow(26, (K-i), mod)) % mod\nprint(ans%mod)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**6 + 7\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nK = int(input())\nS = input()\nn = len(S)\nans = 0\nfor i in range(K+1):\n ans += (cmb(i+n-1, n-1, mod) * pow(25, i) * pow(26, (K-i))) % mod\nprint(ans%mod)', 'mod = 10**9 + 7\nK = int(input())\nS = input()\nn = len(S)\ntmp = pow(26, K, mod)\nwaru = pow(26, -1, mod)\nans = tmp\nfor i in range(1, K+1):\n tmp = (tmp * 25 * waru)%mod\n tmp = (tmp * (i + n -1) * pow(i, -1, mod))%mod\n ans = (ans+tmp)%mod\nprint(ans%mod)']
['Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s138856542', 's240537737', 's279256603', 's324200150', 's467840467', 's684531628', 's692449815', 's830952097', 's231709538']
[13156.0, 131224.0, 296672.0, 10924.0, 131720.0, 131808.0, 129536.0, 131184.0, 10892.0]
[2206.0, 2210.0, 2216.0, 1708.0, 2209.0, 2209.0, 2210.0, 2211.0, 1956.0]
[603, 627, 603, 259, 607, 603, 629, 615, 257]
p02632
u347640436
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['\ndef main():\n from builtins import pow\n\n K = int(input())\n S = input()\n\n m = 1000000007\n\n result = 0\n t = pow(26, K, m)\n u = pow(26, m - 2, m) * 25 % m\n l = len(S)\n for i in range(K + 1):\n \n result += t\n result %= m\n t *= u\n t %= m\n t *= (l + i)\n t %= m\n t *= pow(i + 1, m - 2, m)\n t %= m\n print(result)\n', 'K = int(input())\nS = input()\n\nm = 1000000007\n\nresult = 0\nt = pow(26, K, m)\nu = pow(26, -1, m) * 25 % m\nl = len(S)\nfor i in range(K + 1):\n \n result += (result + t) % m\n t = (t * u) % m * (l + i) %m * pow(i + 1, -1, m) % m\nprint(result)\n', '\nK = int(input())\nS = input()\n\nm = 1000000007\n\nl = len(S)\nresult = 0\n\na = pow(26, K, m)\ninv26 = pow(26, -1K, m)\nb = 1\nc = 1\nd = 1\nfor i in range(K + 1):\n \n result += a * (b * pow(c, -1, m)) * d\n result %= m\n a *= inv26\n a %= m\n b *= l + i\n b %= m\n c *= i + 1\n c %= m\n d *= 25\n d %= m\nprint(result)\n', '\ndef main():\n from builtins import len, pow\n\n K = int(input())\n S = input()\n\n m = 1000000007\n\n result = 0\n a = 1\n b = 1\n t = pow(26, K, m)\n u = pow(26, m - 2, m) * 25 % 26\n for i in range(K + 1):\n \n result += t * (a * pow(b, m - 2, m))\n result %= m\n t *= u\n t %= m\n a *= len(S) - 1 + (i + 1)\n a %= m\n b *= i + 1\n b %= m\n print(result)\n\n\nmain()\n', 'K = int(input())\nS = input()\n\nm = 1000000007\n\nresult = 0\nt = pow(26, K, m)\nu = pow(26, -1, m) * 25 % m\nl = len(S)\nfor i in range(K + 1):\n \n result = (result + t) % m\n t = (t * u) % m * (l + i) % m * pow(i + 1, -1, m) % m\nprint(result)\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s316208656', 's590836708', 's785149656', 's965076394', 's122109231']
[9024.0, 10964.0, 8964.0, 11004.0, 10896.0]
[25.0, 2062.0, 31.0, 2206.0, 1880.0]
[498, 316, 432, 541, 316]
p02632
u392319141
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['class Combination:\n def __init__(self, size, MOD):\n self.MOD = MOD\n self.size = size + 2\n\n f = 1\n self.fact = fact = [f]\n for i in range(1, size+1):\n f = f * i % MOD\n fact.append(f)\n f = pow(f, MOD-2, MOD)\n self.factInv = factInv = [f]\n for i in range(size, 0, -1):\n f = f * i % MOD\n factInv.append(f)\n factInv.reverse()\n\n def npr(self, n, r):\n if n < r or n < 0 or r < 0:\n return 0\n return self.fact[n] * self.factInv[n - r] % self.MOD\n\n def ncr(self, n, r):\n if n < r or n < 0 or r < 0:\n return 0\n return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % self.MOD) % self.MOD\n\n def nhr(self, n, r): \n return self.ncr(n + r - 1, n - 1)\n\ndef sol():\n K = int(input())\n N = len(input())\n MOD = 10**9 + 7\n comb = Combination(N + K + 10, MOD)\n\n ans = 0\n n = 1\n for l in range(K + 1):\n r = K - l\n ans += comb.nhr(N, l) * n\n ans %= MOD\n n = n * 25 % MOD\n print(ans)\nsol()', 'MOD = 10**9 + 7\n\nclass Combination:\n def __init__(self, size):\n self.size = size + 2\n\n f = 1\n self.fact = fact = [f]\n for i in range(1, size+1):\n f = f * i % MOD\n fact.append(f)\n f = pow(f, MOD-2, MOD)\n self.factInv = factInv = [f]\n for i in range(size, 0, -1):\n f = f * i % MOD\n factInv.append(f)\n factInv.reverse()\n\n def npr(self, n, r):\n if n < r or n < 0 or r < 0:\n return 0\n return self.fact[n] * self.factInv[n - r] % MOD\n\n def ncr(self, n, r):\n if n < r or n < 0 or r < 0:\n return 0\n return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD\n\n def nhr(self, n, r): \n return self.ncr(n + r - 1, n - 1)\n\nK = int(input())\nS = input()\nN = len(S)\n\ncomb = Combination(N + K + 100)\n\nans = 0\nL = 1\nR = pow(26, K, MOD)\ninv26 = pow(26, MOD - 2, MOD)\nfor l in range(K + 1):\n ans += L * comb.nhr(N, l) * R\n ans %= MOD\n\n L = L * 25 % MOD\n R = R * inv26 % MOD\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s320822772', 's883720967']
[168868.0, 169824.0]
[1522.0, 1914.0]
[1157, 1101]
p02632
u638456847
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['import sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\nMOD = 10**9+7\n\nfac = [1, 1] \nf_inv = [1, 1] \ninv = [0, 1] 計算用テーブル\n\ndef prepare(n, mod):\n for i in range(2, n+1):\n fac.append((fac[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod//i)) % mod)\n f_inv.append((f_inv[-1] * inv[-1]) % mod)\n\ndef modcmb(n, r, mod):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n\n return fac[n] * f_inv[r] * f_inv[n-r] % mod\n\n\ndef main():\n K = int(readline())\n S = readline().strip()\n N = len(S)\n\n prepare(N + K + 10, MOD)\n\n ans = 0\n for i in range(K+1):\n ans += modcmb(N-1+i, i, MOD) * pow(25, i, MOD) * pow(26, K-i, MOD) % MOD\n ans %= MOD\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\nMAX = 2 * 10**6 + 10\nMOD = 10**9+7\n\nfac = [1] * MAX\nf_inv = [1] * MAX\n\ndef prepare(n, mod):\n for i in range(1, n+1):\n fac[i] = (fac[i-1] * i) % mod\n \n f_inv[n] = pow(fac[n], -1, MOD)\n for i in range(n-1, 0, -1):\n f_inv[i] = (f_inv[i+1] * (i+1)) % MOD\n\ndef modcmb(n, r, mod):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n\n return fac[n] * f_inv[r] * f_inv[n-r] % mod\n\n\ndef main():\n K = int(readline())\n S = readline().strip()\n N = len(S)\n\n prepare(N + K + 5, MOD)\n\n inv26 = pow(26, -1, MOD)\n pow26 = pow(26, K, MOD)\n pow25 = 1\n ans = 0\n for i in range(K+1):\n ans += (modcmb(N-1+i, i, MOD) * pow25 * pow26) % MOD\n ans %= MOD\n\n pow25 *= 25\n pow25 %= MOD\n pow26 *= inv26\n pow26 %= MOD\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Time Limit Exceeded', 'Accepted']
['s913830968', 's220920766']
[247524.0, 168080.0]
[2212.0, 1725.0]
[884, 957]
p02632
u726285999
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
["import sys\n\nK = int(sys.stdin.readline())\nS = sys.stdin.readline().rstrip('\\n')\n\n# ## COMBINATION (MOD) ###\nN_MAX = 10**6 \nMOD = 10**9 + 7\n\ninv = [0] * (N_MAX + 2)\ninv[0] = 0 \ninv[1] = 1\n\nfor i in range(2, N_MAX + 2):\n q, r = divmod(MOD, i)\n inv[i] = -inv[r] * q % MOD\n\n\n\nans = 0\n\nln = len(S)\n\np = pow(26, K, MOD)\n\nst = time.time()\nfor i in range(1, K + 2):\n\n ans += p % MOD\n ans %= MOD\n\n # pre\n p = p * (ln + i - 1) * inv[i] * 25 * inv[26] % MOD\n\n \n # s2 = (s2 * inv[26]) % MOD\nen = time.time()\n\nprint(ans)", "import sys\nimport time\n\n\nK = int(sys.stdin.readline())\nS = sys.stdin.readline().rstrip('\\n')\n\n# ## COMBINATION (MOD) ###\nN_MAX = 10**6 \nMOD = 10**9 + 7\n\nst = time.time()\ninv = [0] * (N_MAX + 2)\ninv[0] = 0 \ninv[1] = 1\n\nfor i in range(2, N_MAX + 2):\n q, r = divmod(MOD, i)\n inv[i] = -inv[r] * q % MOD\n\nen = time.time()\nprint(en-st)\n\n\nans = 0\n\nln = len(S)\n\np = pow(26, K, MOD)\n\nst = time.time()\nfor i in range(1, K + 2):\n\n ans += p % MOD\n ans %= MOD\n\n # pre\n p = p * (ln + i - 1) * inv[i] * 25 * inv[26] % MOD\n\n \n # s2 = (s2 * inv[26]) % MOD\nen = time.time()\n\nprint(ans)\nprint(en-st)", "import sys\n\nK = int(sys.stdin.readline())\nS = sys.stdin.readline().rstrip('\\n')\n\n# ## COMBINATION (MOD) ###\nN_MAX = 2*10**6 \nMOD = 10**9 + 7\n\nfac = [1, 1] \nfacinv = [1, 1] \ninv = [0, 1] 計算用テーブル\n\nfor i in range(2, N_MAX + 1):\n fac.append((fac[-1] * i) % MOD)\n inv.append((-inv[MOD % i] * (MOD // i)) % MOD)\n facinv.append((facinv[-1] * inv[-1]) % MOD)\n\n\ndef cmb(n, r):\n if (r < 0 or r > n):\n return 0\n # r = min(r, n-r)\n return fac[n] * facinv[r] * facinv[n - r] % MOD\n\n\nans = 0\n\nln = len(S)\n\nfor i in range(ln, ln+K+1):\n\n # pre\n p = i - 1\n p1 = cmb(p, ln - 1)\n p2 = pow(25, p - (ln - 1), MOD)\n\n \n s = (ln + K) - i\n s2 = pow(26, s, MOD)\n\n ans += p1*p2*s2 % MOD\n ans %= MOD\n\n # print(p, p1,p2, s, s2)\n\nprint(ans)", "import sys\n\nK = int(sys.stdin.readline())\nS = sys.stdin.readline().rstrip('\\n')\n\n# ## COMBINATION (MOD) ###\nN_MAX = 10**6 \nMOD = 10**9 + 7\n\nfac = [1, 1] \nfacinv = [1, 1] \ninv = [0, 1] 計算用テーブル\n\nfor i in range(2, N_MAX + 1):\n fac.append((fac[-1] * i) % MOD)\n inv.append((-inv[MOD % i] * (MOD // i)) % MOD)\n facinv.append((facinv[-1] * inv[-1]) % MOD)\n\n\ndef cmb(n, r):\n if (r < 0 or r > n):\n return 0\n # r = min(r, n-r)\n return fac[n] * facinv[r] * facinv[n - r] % MOD\n\n\nans = 0\n\nln = len(S)\n\nfor i in range(ln,ln+K+1):\n\n # pre\n p = i - 1\n p1 = cmb(p, ln - 1)\n p2 = pow(25, p - (ln - 1), MOD)\n\n \n s = (ln + K) - i\n s2 = pow(26, s, MOD)\n\n ans += p1*p2*s2 % MOD\n ans %= MOD\n\n # print(p, p1,p2, s, s2)\n\nprint(ans)", "import sys\n\nK = int(sys.stdin.readline())\nS = sys.stdin.readline().rstrip('\\n')\n\n# ## COMBINATION (MOD) ###\nN_MAX = 10**6 \nMOD = 10**9 + 7\n\ninv = [0, 1] \nK = max(K, 26)\nfor i in range(2, K + 2):\n inv.append((-inv[MOD % i] * (MOD // i)) % MOD)\n\n\nans = 0\n\nln = len(S)\n\np1 = 1\np2 = 1\ns2 = pow(26, K, MOD)\n\nfor i in range(1, K + 2):\n\n ans += (p1 * p2 * s2) % MOD\n ans %= MOD\n\n # print(p1, p2, s2)\n\n # pre\n p1 = (p1 * (ln + i - 1) * inv[i]) % MOD\n p2 = (p2 * 25) % MOD\n\n \n s2 = (s2 * inv[26]) % MOD\n\nprint(ans)\n", "import sys\n\nK = int(sys.stdin.readline())\nS = sys.stdin.readline().rstrip('\\n')\n\n# ## COMBINATION (MOD) ###\nN_MAX = 10**6 \nMOD = 10**9 + 7\n\ninv = [0] * (N_MAX + 2)\ninv[0] = 0 \ninv[1] = 1\n\nfor i in range(2, N_MAX + 2):\n q, r = divmod(MOD, i)\n inv[i] = -inv[r] * q % MOD\n\n\n\nans = 0\n\nln = len(S)\n\np = pow(26, K, MOD)\n\nfor i in range(1, K + 2):\n\n ans += p % MOD\n ans %= MOD\n\n # pre\n p = p * (ln + i - 1) * inv[i] * 25 * inv[26] % MOD\n\n \n # s2 = (s2 * inv[26]) % MOD\n\nprint(ans)\n"]
['Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s183226531', 's193881362', 's204907233', 's369359116', 's524131726', 's364713326']
[49400.0, 49500.0, 247388.0, 128684.0, 51196.0, 49396.0]
[616.0, 1200.0, 2214.0, 2209.0, 1344.0, 1152.0]
[642, 715, 908, 905, 644, 609]
p02632
u811176339
2,000
1,048,576
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7).
['def calc_inv(n, mod_n):\n inv_li = [0] * (n + 2)\n inv_li[0] = 0\n inv_li[1] = 1\n for i in range(2, n + 2):\n q, r = divmod(mod_n, i)\n inv_li[i] = -inv_li[r] * q % mod_n\n return inv_li\n\n\nMOD = 10**9 + 7\ninv = calc_inv(max(K, 26) + 10, MOD)\n\nK = int(input())\nS = input()\ns_len = len(S)\n\n\nans = 0\np = pow(26, K, MOD)\n\nfor i in range(1, K + 2):\n ans = (ans + p % MOD) % MOD\n p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD\n\nprint(ans)\n', 'def calc_inv(n, mod_n):\n inv_li = [0] * (n + 2)\n inv_li[0] = 0\n inv_li[1] = 1\n for i in range(2, n + 2):\n q, r = divmod(mod_n, i)\n inv_li[i] = -inv_li[r] * q % mod_n\n return inv_li\n\n\nK = int(input())\nS = input()\ns_len = len(S)\n\nMOD = 10**9 + 7\ninv = calc_inv(max(K, 26) + 10, MOD)\n\nans = 0\np = pow(26, K, MOD)\n\nfor i in range(1, K + 2):\n ans = (ans + p % MOD) % MOD\n p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s676040294', 's852982562']
[9064.0, 49496.0]
[29.0, 1026.0]
[469, 468]
p02633
u007074599
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['n = int(input())\nc=360/n\nprint(c)', 'x=input()\nprint(360/x)', 'n = int(input())\nc=180-n\nk=1\nwhile(1):\n if c*k%180==0:\n print(k)\n break\n else:\n k+=1', 'n = int(input())\nimport numpy as np\nx=0\ny=0\nrad=0\nk=1\nwhile(1):\n y+=np.cos(rad*np.pi/180)\n x+=np.sin(rad*np.pi/180)\n if x<0.0001 and y<0.0001:\n print(k)\n break\n else:\n k+=1\n rad+=n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s252475516', 's395479305', 's603629739', 's943110579']
[9144.0, 9076.0, 9056.0, 27200.0]
[30.0, 22.0, 29.0, 124.0]
[33, 22, 95, 196]
p02633
u018679195
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['def times(X):\n if X == int(X):\n if 1<= X <= 179:\n K = 360/X\n if int(K) < K :\n K = int(K) + 1\n print(K)\n else:\n print(int(K))', ' if X == int(X):\n if 1<= X <= 179:\n K = 360/X\n if int(K) < K :\n K = int(int(K) - 1)\n print(K)\n else:\n K = int(K)\n print(K)', 'def times(X):\n if 1<= X <= 179:\n K = 360/X\n print(int(K))\n return K\n else:\n print("please input an integer.")\n\ntimes(90)\ntimes(180)\n', 'def lcm(x, y):\n if x > y:\n greater = x\n else:\n greater = y\n \n while(True):\n if((greater % x == 0) and (greater % y == 0)):\n lcm = greater\n break\n greater += 1\n \n return lcm\nx = int(input())\nif 360%x == 0:\n print(int(360/x))\nelse :\n print(int(lcm(360,x)/x))\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s313188213', 's556077961', 's739789734', 's686902917']
[9088.0, 8796.0, 8952.0, 9100.0]
[25.0, 22.0, 24.0, 28.0]
[212, 225, 166, 315]
p02633
u023229441
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['n=int(input())\nfor i in range(1,361):\n if n**i%360==0:\n print(i)\n ', 'n=int(input())\n\nfor i in range(1,361):\n if (n*i)%360==0:\n print(i);exit()']
['Wrong Answer', 'Accepted']
['s600896202', 's390396983']
[9084.0, 9076.0]
[32.0, 30.0]
[73, 77]
p02633
u033642300
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['def main():\n X = int(input())\n print(360/X)\nmain() ', 'def main():\n X = int(input())\n i = 1\n while True:\n if i * X % 360 == 0:\n print(i)\n break\n i += 1\nmain() ']
['Wrong Answer', 'Accepted']
['s721562491', 's184722499']
[9048.0, 9156.0]
[30.0, 27.0]
[58, 150]
p02633
u054825571
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['a=360/n\nb=a-360//n\nprint(int(n*360/math.gcd(n,360)/n))', 'import math\nprint(360//math.gcd(int(input()),360))']
['Runtime Error', 'Accepted']
['s123636343', 's468889748']
[8992.0, 9072.0]
[23.0, 27.0]
[54, 50]
p02633
u060012100
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x = int(input())\nprint(360/x)\n', 'from math import gcd\ns = int(input())\nprint(360//gcd(360,s))']
['Wrong Answer', 'Accepted']
['s188210282', 's312437088']
[9068.0, 9028.0]
[25.0, 31.0]
[30, 60]
p02633
u066494348
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['n=int(input())\nprint(int(360/math.gcd(n,360)))', 'n=int(input())\nprint(int(360/math.gcd(n,360)))', 'n=int(input())\nprint(360/n)', 'import math\nn=int(input())\nprint(int(360/math.gcd(n,360)))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s242336333', 's546230547', 's569931460', 's001403360']
[9068.0, 9060.0, 9048.0, 9140.0]
[24.0, 27.0, 27.0, 29.0]
[46, 46, 27, 58]
p02633
u067694718
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['print(360 // input())', 'i = 1\nx = int(input())\nwhile True:\n if (360 * i) % x == 0:\n print(360 * i // x)\n break\n i += 1\n']
['Runtime Error', 'Accepted']
['s685860635', 's048077157']
[9140.0, 9148.0]
[25.0, 26.0]
[21, 103]
p02633
u083031094
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['max_test = 100000\nfor i in range(max_test):\n if i * X % 360 == 0:\n break\n\nreturn I+1', 'X= int(input())\nmax_test = 100000\nfor i in range(1,max_test):\n if i * X % 360 == 0:\n break\n\nprint(i)']
['Runtime Error', 'Accepted']
['s984174766', 's990994886']
[8996.0, 9144.0]
[21.0, 34.0]
[88, 104]
p02633
u112629957
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['from math import gcd\nN = int(input())\nprint(N // gcd(360, N))', 'from math import gcd\nX = int(input())\nprint(360 // gcd(360, X))']
['Wrong Answer', 'Accepted']
['s746925045', 's373644013']
[9040.0, 9036.0]
[30.0, 29.0]
[61, 63]
p02633
u130900604
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['45tokabaguruna', 'import math\nn=int(input())\nmi=1/100000000\nx=1\ny=0\npi=math.pi\ncnt=1\nwhile abs(x)>mi or abs(y)>mi:\n x+=math.cos(cnt*n*pi/180)\n y+=math.sin(cnt*n*pi/180)\n cnt+=1\nprint(cnt)\n']
['Runtime Error', 'Accepted']
['s214163636', 's009234401']
[8940.0, 9552.0]
[33.0, 32.0]
[14, 173]
p02633
u132892633
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x = int(input())\na = 1\nwhile True:\n if x % 360 == 0:\n print(a)\n quit()\n x = x * a\n a += 1\n ', '#!/usr/bin/env python3\nfrom math import gcd\nn = int(input())\nprint(360//gcd(360, n))\n']
['Wrong Answer', 'Accepted']
['s187443636', 's213686240']
[9148.0, 9084.0]
[28.0, 29.0]
[117, 85]
p02633
u139441419
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x=int(input())\n\nprint(360/x)', 'x=int(input())\ni=1\n\nwhile (x*i)%180!=0:\n i=i+1\n\nprint(i)', 'x=int(input())\ni=1\n\nwhile (x*i)%360!=0:\n i=i+1\n\nprint(i)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s680659797', 's735667155', 's372848759']
[9148.0, 9152.0, 9064.0]
[28.0, 33.0, 26.0]
[28, 57, 57]
p02633
u163320134
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x=int(input())\nfor i in range(1,361):\n if (i*x)%360==0:\n print(i)', 'x=int(input())\nfor i in range(1,361):\n if (i*x)%360==0:\n print(i)\n break']
['Wrong Answer', 'Accepted']
['s730354187', 's770627013']
[9164.0, 9096.0]
[32.0, 27.0]
[69, 79]
p02633
u164953285
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['import math\n\nk = 1\nx = float(input())\nwhile x*k%360 == 0:\n k += 1\t\nprint(k)\n', 'import math\n\nx = float(input())\n\nif 360%x == 0:\n print(math.floor(k))\nelse:\n print(math.ceil(k))', 'import math\n \nk = 1\nx = float(input())\nwhile x*k%360 != 0:\n k += 1\t\nprint(k)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s015027701', 's632956999', 's058936362']
[8940.0, 9032.0, 8992.0]
[27.0, 23.0, 26.0]
[78, 98, 78]
p02633
u182166469
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x=int(input())\ni=0\nwhile True:\n 360*i%x!=0\n i+=1\n if 360*i%x==0:\n break\nk=360*i/x\nprint(k)\n', 'x=int(input())\ni=0\nwhile True:\n 360*i%x!=0\n i+=1\n if 360*i%x==0:\n break\nk=360*i/x\nprint(int(k))\n']
['Wrong Answer', 'Accepted']
['s604801332', 's237376885']
[9156.0, 8928.0]
[26.0, 27.0]
[97, 102]
p02633
u208882647
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['n=int(input())\n#n*k1=(360)*k2\n#(k1/k2)=(360/n)\nk=1\nwhile((k*n)%360!=0):\n k+=1\n print(k)', 'n=int(input())\nk=1\nwhile((k*n)%360!=0):\n k+=1\nprint(k)\n#We can now regard Takahashi’s move as movingXdegrees on the circle,\n#so the answer is the minimumksuch thatkXis a multiple of 360']
['Wrong Answer', 'Accepted']
['s334450939', 's753580441']
[8868.0, 9160.0]
[27.0, 27.0]
[89, 188]
p02633
u212328220
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x = int(input())\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\nprint(lcm(x, 360)//x)', 'import math\nx = int(input())\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\nprint(lcm(x, 360)//x)\n']
['Runtime Error', 'Accepted']
['s227037378', 's161182881']
[9036.0, 8968.0]
[27.0, 28.0]
[92, 105]
p02633
u216928054
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['import math\nX = 1\nt = 360 - (180 - X)\ng = math.gcd(t, 360)\nprint(360 * t // g // t)\n', 'X = int(input())\nret = 0\ncur = 0\nwhile True:\n ret += 1\n cur += X\n if cur % 360 == 0:\n print(ret)\n break\n']
['Wrong Answer', 'Accepted']
['s195829807', 's439916768']
[9020.0, 9156.0]
[29.0, 27.0]
[84, 127]
p02633
u227085629
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x = int(input())\nfor i in range(1,1000):\n if (360*i)%x == 0:\n print((360*i)//x)', 'x = int(input())\nfor i in range(1,1000):\n if (360*i)%x == 0:\n print((360*i)//x)\n exit()']
['Wrong Answer', 'Accepted']
['s121475615', 's010145840']
[9156.0, 9140.0]
[26.0, 26.0]
[83, 94]
p02633
u232652798
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['X = int(input())\n\nprint(360/X)', 'X = int(input())\n\nfor i in range(1,361):\n if (i*X) % 360 == 0:\n print(i)\n break\n']
['Wrong Answer', 'Accepted']
['s054472515', 's972985265']
[9104.0, 9064.0]
[27.0, 27.0]
[30, 97]
p02633
u243572357
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x = int(input())\nprint((360 -1 // x) + 1)\n', 'a = int(input())\nfor i in range(1, a*360 + 1):\n if i % 360 == 0 and i % a == 0:\n print(i//a)\n break']
['Wrong Answer', 'Accepted']
['s115145637', 's134636975']
[9076.0, 9152.0]
[28.0, 35.0]
[43, 106]
p02633
u244416763
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['print(360/int(input()))', 'x = int(input())\nfor i in range(1,361):\n if (x*i)%360 == 0:\n print(i)\n exit()']
['Wrong Answer', 'Accepted']
['s892930717', 's612994056']
[9124.0, 9128.0]
[26.0, 25.0]
[23, 84]
p02633
u249372595
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['X=int(input())\nif 360%K==0:\n K=360//X\n print(K)\nelif 360%K!=0:\n K=2*360//(180-X)\n print(K)', 'X=int(input())\nif 360%X==0:\n K=360//X\n print(K)\nelif 360%X!=0:\n i=1\n while True:\n if (X*i)%360==0:\n break\n i+=1\n print(i)']
['Runtime Error', 'Accepted']
['s416656289', 's749874747']
[9160.0, 9164.0]
[29.0, 25.0]
[94, 137]
p02633
u254961675
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['# -*- coding: utf-8 -*-\n# get a integer\na = int(input())\n\nm = a\nc = 1\nwhile m % 360 != 0:\n\tm+=a\n\tc+=1\nprint(m)', '# -*- coding: utf-8 -*-\n# get a integer\na = int(input())\n\nm = a\nc = 1\nwhile m % 360 != 0:\n\tm+=a\n\tc+=1\nprint(c)']
['Wrong Answer', 'Accepted']
['s663381808', 's028164506']
[9088.0, 9068.0]
[32.0, 30.0]
[110, 110]
p02633
u257750994
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['import math\nx = int(input())\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\nif x == 1:\n print(360 / x)\nelif x == 45:\n print(360 / x)\nelif x == 90:\n print(360 / x)\nelse:\n z = lcm(x, 360)\n print(math.floor(z / x))\n', 'import math\nx = int(input())\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\nif x == 1:\n print(360 / x)\nelif x == 45:\n print(360 / x)\nelif x == 90:\n print(360 / x)\nelse:\n z = lcm(x, 360)\n print(int(z / x))\n', 'x = int(input())\n\nprint(360 / x)', 'import math\nx = int(input())\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\nif x == 1:\n print(int(360 / x))\nelif x == 45:\n print(int(360 / x))\nelif x == 90:\n print(int(360 / x))\nelse:\n z = lcm(x, 360)\n print(int(z / x))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s157162019', 's231617710', 's456691717', 's515659518']
[9104.0, 9164.0, 9100.0, 9076.0]
[31.0, 28.0, 27.0, 26.0]
[222, 215, 32, 230]
p02633
u272457181
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['x = int(input())\ns = x * 360/ gcd(x,360)\nprint(s/x)', 'x = int(input())\ns = x * 360 / math.gcd(x, 360)\nprint(s/x)', 'import math\nx = int(input())\ns = x * 360 / math.gcd(x, 360)\nprint(int(s//x))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s096723522', 's326880013', 's517388596']
[9144.0, 9088.0, 9212.0]
[28.0, 25.0, 29.0]
[51, 59, 77]
p02633
u306144075
2,000
1,048,576
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
['n=int(input())\np=1\nif 360//n == 0:\n\tprint(360//n)\nelse:\n while true:\n\tif n*p%360 == 0:\n\t\tprint(n)\n \tbreak\n n+=1\n\t', 'n=int(input())\nl=360/n\nprint(l)', 'n=int(input())\np=1\nif 360//n == 0:\n\tprint(360//n)\nelse:\n while true:\n\tif n*p%360 == 0:\n\t\tprint(n)\n \texit()\n n+=1\n\t', 'p = int(input())\nindex = 1\nwhile True:\n if p* index % 360 == 0:\n print(index)\n break\n index += 1']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s331588947', 's424541680', 's773234016', 's248782004']
[9012.0, 9096.0, 8948.0, 9164.0]
[21.0, 29.0, 28.0, 29.0]
[122, 31, 123, 116]