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
p02595
u924828749
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['n,d = [int(x) for x in input().split()]\nx = []\ny = []\nfor i in range(n):\n x1,y1 = [int(x) for x in input().split()]\n x.append(x1)\n y.append(y1)\nc = 0\nfor i in range(n):\n s = x[i] ** 2 + y[i] ** 2\n if s < d ** 2:\n c += 1\nprint(c)', 'n,d = [int(x) for x in input().split()]\nx = []\ny = []\nfor i in range(n):\n x1,y1 = [int(x) for x in input().split()]\n x.append(x1)\n y.append(y1)\nc = 0\nfor i in range(n):\n s = x[i] ** 2 + y[i] ** 2\n if s <= d ** 2:\n c += 1\nprint(c)']
['Wrong Answer', 'Accepted']
['s592006503', 's629865346']
[24932.0, 24988.0]
[547.0, 537.0]
[236, 237]
p02595
u928784113
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['import itertools\nfrom collections import deque,defaultdict,Counter\nfrom itertools import accumulate\nimport bisect\nfrom heapq import heappop,heappush,heapify\nimport math\nfrom copy import deepcopy\nimport queue\nimport numpy as np\n\nMod = 1000000007\nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1] \nfor i in range(2, 10**5 + 1):\n fact.append((fact[-1] * i) % Mod)\n inv.append((-inv[Mod % i] * (Mod // i)) % Mod)\n factinv.append((factinv[-1] * inv[-1]) % Mod)\n \ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n - r] % p\n \ndef sieve_of_eratosthenes(n):\n if not isinstance(n,int):\n raise TypeError("n is not int")\n if n<2:\n raise ValueError("n is not effective")\n prime = [1]*(n+1)\n for i in range(2,int(math.sqrt(n))+1):\n if prime[i] == 1:\n for j in range(2*i,n+1):\n if j%i == 0:\n prime[j] = 0\n res = []\n for i in range(2,n+1):\n if prime[i] == 1:\n res.append(i)\n return res\n\n \nclass UnionFind:\n def __init__(self,n):\n self.parent = [i for i in range(n+1)]\n self.rank = [0 for i in range(n+1)]\n \n def findroot(self,x):\n if x == self.parent[x]:\n return x\n else:\n y = self.parent[x]\n y = self.findroot(self.parent[x])\n return y\n \n def union(self,x,y):\n px = self.findroot(x)\n py = self.findroot(y)\n if px < py:\n self.parent[y] = px\n else:\n self.parent[px] = py\n \n def same_group_or_no(self,x,y):\n return self.findroot(x) == self.findroot(y)\ndef pow_k(x, n):\n\n if n == 0:\n return 1\n\n K = 1\n while n > 1:\n if n % 2 != 0:\n K *= x\n x *= x\n n //= 2\n\n return K * x\ndef main(): #startline-------------------------------------------\n n, d = map(int, input().split())\n ans = 0\n xy = [list(map(int, input().split())) for i in range(n)]\n for i in range(n):\n if np.sqrt(xy[i][0] ** 2 + xy[i][1] ** 2) < d:\n ans += 1\n print(ans)\nif __name__ == "__main__":\n main() ', 'import itertools\nfrom collections import deque,defaultdict,Counter\nfrom itertools import accumulate\nimport bisect\nfrom heapq import heappop,heappush,heapify\nimport math\nfrom copy import deepcopy\nimport queue\nimport numpy as np\n\nMod = 1000000007\nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1] \nfor i in range(2, 10**5 + 1):\n fact.append((fact[-1] * i) % Mod)\n inv.append((-inv[Mod % i] * (Mod // i)) % Mod)\n factinv.append((factinv[-1] * inv[-1]) % Mod)\n \ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n - r] % p\n \ndef sieve_of_eratosthenes(n):\n if not isinstance(n,int):\n raise TypeError("n is not int")\n if n<2:\n raise ValueError("n is not effective")\n prime = [1]*(n+1)\n for i in range(2,int(math.sqrt(n))+1):\n if prime[i] == 1:\n for j in range(2*i,n+1):\n if j%i == 0:\n prime[j] = 0\n res = []\n for i in range(2,n+1):\n if prime[i] == 1:\n res.append(i)\n return res\n \n \nclass UnionFind:\n def __init__(self,n):\n self.parent = [i for i in range(n+1)]\n self.rank = [0 for i in range(n+1)]\n \n def findroot(self,x):\n if x == self.parent[x]:\n return x\n else:\n y = self.parent[x]\n y = self.findroot(self.parent[x])\n return y\n \n def union(self,x,y):\n px = self.findroot(x)\n py = self.findroot(y)\n if px < py:\n self.parent[y] = px\n else:\n self.parent[px] = py\n \n def same_group_or_no(self,x,y):\n return self.findroot(x) == self.findroot(y)\ndef pow_k(x, n):\n \n if n == 0:\n return 1\n \n K = 1\n while n > 1:\n if n % 2 != 0:\n K *= x\n x *= x\n n //= 2\n \n return K * x\ndef main(): #startline-------------------------------------------\n n, d = map(int, input().split())\n ans = 0\n xy = [list(map(int, input().split())) for i in range(n)]\n for i in range(n):\n if np.sqrt(xy[i][0] ** 2 + xy[i][1] ** 2) <= d:\n ans += 1\n print(ans)\nif __name__ == "__main__":\n main() ']
['Wrong Answer', 'Accepted']
['s304999202', 's006982425']
[75620.0, 75808.0]
[922.0, 956.0]
[2263, 2268]
p02595
u945065638
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['n ,d = map(int,input().split())\n\nans = 0\nfor i in range(n):\n x,y = map(int,input().split())\n if d <= x + y:\n ans += 1\n\nprint(ans)', 'n ,d = map(int,input().split())\n\nans = 0\nfor i in range(n):\n x,y = map(int,input().split())\n if d**2 >= x**2 + y**2 :\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s874912138', 's122216376']
[9180.0, 9188.0]
[362.0, 474.0]
[142, 152]
p02595
u957764821
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['import math\n\nN, D = int(input().split())\nP = []\nfor n in N:\n X_n, Y_n = int(input().split())\n P.append((X_n, Y_n))\n\ndef distance(p:tuple):\n # d_2 = p[0] ** 2 + p[1] ** 2\n # d = math.sqrt(d_2)\n return math.sqrt(p[0] ** 2 + p[1] ** 2)\n\ncount = [p for p in P if distance(p) <= D]\nprint(len(count))', 'import math\n\nN, D = map(int, input().split())\nP = []\nfor n in range(N):\n X_n, Y_n = map(int, input().split())\n P.append((X_n, Y_n))\n\ndef distance(p:tuple):\n return math.sqrt(p[0] ** 2 + p[1] ** 2)\n\ncount = [p for p in P if distance(p) <= D]\nprint(len(count))']
['Runtime Error', 'Accepted']
['s884472660', 's319792026']
[9068.0, 37228.0]
[24.0, 528.0]
[309, 267]
p02595
u960201620
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['from sys import stdin\n\nn, d = stdin.readline().rstrip().split()\n\nn = int(n)\nd = int(d)\n\ndata = [stdin.readline().rstrip().split() for _ in range(n)]\n\ncount = 0\nfor i in range(n):\n if int(data[i][0]) * int(data[i][0]) + int(data[i][1]) * int(data[i][1]) < d + 1:\n count = count + 1\n\nprint(count)\n\n', 'from sys import stdin\nimport math\n\nn, d = stdin.readline().rstrip().split()\n\nn = int(n)\nd = int(d)\n\ndata = [stdin.readline().rstrip().split() for _ in range(n)]\n\ncount = 0\nfor i in range(n):\n if math.sqrt(int(data[i][0]) * int(data[i][0]) + int(data[i][1]) * int(data[i][1])) <= d:\n count = count + 1\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s278774511', 's146211352']
[67644.0, 67656.0]
[425.0, 488.0]
[300, 319]
p02595
u963915126
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['n,d=map(int,input())\ncnt=0\nfor i in range(n):\n x,y =map(int,input())\n if x**2+y**2 <= d**2:\n cnt+=1\nprint(cnt)', 'n,d=map(int,input().split())\ncnt=0\nfor i in range(n):\n x,y =map(int,input().split())\n if x**2+y**2 <= d**2:\n cnt+=1\nprint(cnt)\n']
['Runtime Error', 'Accepted']
['s985951344', 's623678846']
[9128.0, 9172.0]
[25.0, 475.0]
[115, 132]
p02595
u970082363
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['n,d = (int(x) for x in input().split())\ncount = 0\nfor i in range(n):\n x,y = (int(x) for x in input().split())\n if x**2*y**2<=d**2:\n count += 1\nprint(count)', 'n,d = (int(x) for x in input().split())\ncount = 0\nfor i in range(n):\n x,y = (int(x) for x in input().split())\n if x**2+y**2<=d**2:\n count += 1\nprint(count)']
['Wrong Answer', 'Accepted']
['s928850482', 's339792478']
[9100.0, 9136.0]
[500.0, 501.0]
[168, 168]
p02595
u974402118
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['N,D = (int(x) for x in input().split())\ncount = 0\nfor i in range(N):\n x,y = (int(x) for x in input().split())\n sqdist = x**2 + y**2\n if sqdist < D**2:\n count += 1\nprint(count)', 'N,D = (int(x) for x in input().split())\ncount = 0\nfor i in range(N):\n x,y = (int(z) for z in input().split())\n sqdist = x**2 + y**2\n if sqdist < D**2:\n count += 1\nprint(count)', 'N,D = (int(x) for x in input().split())\ncount = 0\nfor i in range(N):\n x,y = (int(z) for z in input().split())\n dist = x**2 + y**2\n if dist <= D**2:\n count += 1\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s095781503', 's468631418', 's092901169']
[9132.0, 9048.0, 9028.0]
[512.0, 506.0, 516.0]
[181, 181, 178]
p02595
u975997984
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['import math\nX, D = map(int, input().split())\nn = 0\nfor i in range(N):\n x, y = map(int, input().split())\n if math.sqrt(x**2+y**2) <= D:\n n += 1\nprint(n)', 'import math\nN, D = map(int, input().split())\nn = 0\nfor i in range(N):\n x, y = map(int, input().split())\n if math.sqrt(x**2+y**2) <= D:\n n += 1\nprint(n)\n']
['Runtime Error', 'Accepted']
['s687566004', 's233287531']
[9076.0, 9192.0]
[28.0, 472.0]
[156, 157]
p02595
u988466483
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['def lineFromPoints(P,Q): \n \n a = Q[1] - P[1] \n b = P[0] - Q[0] \n c = a*(P[0]) + b*(P[1]) \n \n if(b<0): \n print("The line passing through points P and Q is:", \n a ,"x ",b ,"y = ",c ,"\\n") \n else: \n print("The line passing through points P and Q is: ", \n a ,"x + " ,b ,"y = ",c ,"\\n") \n \nif __name__==\'__main__\': \n n = int(input("Enter size of array:")) \n P=[]\n Q=[]\n for i in range(n): \n temp = int(input(\'Enter number to add to P:\\n\')) \n P.append(temp)\n for i in range(n): \n temp = int(input(\'Enter number to add to Q:\\n\')) \n Q.append(temp)\n \n lineFromPoints(P,Q) ', 'import math\nN,D= map(int, input().split(" "))\ncount = 0\nfor i in range(0,N):\n X,Y= map(int, input().split(" "))\n d= math.sqrt(pow(X,2)+pow(Y,2))\n if d<= D:\n count = count+1\nprint(count)']
['Runtime Error', 'Accepted']
['s941272431', 's482518919']
[9208.0, 8920.0]
[29.0, 495.0]
[677, 201]
p02595
u988466682
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['[N, D] = input().split()\ns = 0\nD = int(D)\nfor i in range(N):\n [X, Y] = input().split()\n X = int(X)\n Y = int(Y)\n Z = X**2 + Y**2\n if Z <= D**2:\n s +=1\nprint(s) ', '[N, D] = input().split()\ns = 0\nD = int(D)\nD = D**2\nfor i in range(N):\n [X, Y] = input().split()\n X = int(X)\n Y = int(Y)\n Z = X**2 + Y**2\n if Z <= D:\n s += 1\nprint(s) ', '[N, D] = input().split()\ns = 0\nD = int(D)\nfor i in range(N):\n [X, Y] = input().split()\n X = int(X)\n Y = int(Y)\n Z = X**2 + Y**2\n if Z <= D:\n s +=1\nprint(s) ', '[N, D] = input().split()\ns = 0\nN = int(N)\nD = int(D)\nD = D**2\nfor i in range(N):\n [X, Y] = input().split()\n X = int(X)\n Y = int(Y)\n Z = X**2 + Y**2\n if Z <= D:\n s += 1\nprint(s) ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s349285483', 's710085710', 's784080412', 's251295788']
[9184.0, 9200.0, 9196.0, 9144.0]
[24.0, 24.0, 25.0, 472.0]
[188, 195, 185, 206]
p02595
u990957471
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['i1 = input()\ni2 = int(i1.split(" ")[0])\ni3 = int(i1.split(" ")[1])\ni4 = 0\ni5 = 0\ni6 = 0\nli = []\nfor i in range(i2):\n i4 = input().split(" ")\n i5 = (int(i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5\n if i3 >= abs(i5):\n i6 += 1\nprint(i6)', 'i1 = input()\ni2 = int(i1.split(" ")[0])\ni3 = int(i1.split(" ")[1])\ni4 = 0\ni5 = 0\ni6 = 0\nli = []\nfor i in range(i2):\n i4 = input().split(" ")\n i5 = (int(i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5\n if (i3 >= i5) {\n i6 += 1\n }\nprint(i6)', 'i1 = input()\ni2 = int(i1.split(" ")[0])\ni3 = int(i1.split(" ")[1])\ni4 = 0\ni5 = 0\ni6 = 0\nli = []\nfor i in range(i2):\n i4 = input().split(" ")\n i5 = (int(i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5\n if (i3 >= i5):\n i6 += 1\nprint(i6)', 'i1 = input()\ni2 = int(i1.split(" ")[0])\ni3 = float(i1.split(" ")[1])\ni4 = 0\ni5 = 0\ni6 = 0\nli = []\nfor i in range(i2):\n i4 = input().split(" ")\n i5 = ((i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5\n if (i3 >= i5):\n i6 += 1\nprint(i6)', 'i1 = input()\ni2 = int(i1.split(" ")[0])\ni3 = int(i1.split(" ")[1])\ni4 = 0\ni5 = 0\ni6 = 0\nli = []\nfor i in range(i2):\n i4 = input().split(" ")\n i5 = (float(i4[1]) ** 2 + float(i4[0]) ** 2) ** 0.5\n if i3 >= abs(i5):\n i6 += 1\nprint(i6)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s289337025', 's327139568', 's420742271', 's972798331', 's337086879']
[9652.0, 9044.0, 9524.0, 9208.0, 9620.0]
[572.0, 29.0, 414.0, 29.0, 406.0]
[233, 235, 230, 229, 237]
p02595
u991641236
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['n,d=list(map(int,input().split()))\ncnt=0\nfor i in range(n):\n x,y=list(map(int,input().split()))\n if (x**2+y**2)==d**2:\n cnt+=1\nprint(cnt)\n ', 'n,d=list(map(int,input().split()))\ncnt=0\nfor i in range(n):\n x,y=list(map(int,input().split()))\n if (x**2+y**2)<=d**2:\n cnt+=1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s055329485', 's776244866']
[9072.0, 9116.0]
[504.0, 508.0]
[145, 142]
p02595
u994935583
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['import math\nN,D = map(int,input().split())\n\nans = 0\nfor i in range(N):\n x,y = map(int,input().split())\n d = math.sprt(x**2 + y**2)\n if d <= D:\n ans += 1\nprint(ans)', 'import math\nN,D = map(int,input().split())\n \nans = 0\nfor i in range(N):\n x,y = map(int,input().split())\n d = math.sqrt(x**2 + y**2)\n if d <= D:\n ans += 1\nprint(ans)']
['Runtime Error', 'Accepted']
['s470169453', 's760789021']
[9108.0, 9112.0]
[30.0, 479.0]
[169, 170]
p02595
u995109095
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['I=lambda:list(map(int,input().split()))\nn,d=I()\ndef ch(a,b):\n return a**2+b**2\nans=0\nfor i in range(n):\n x,y=I()\n if ch(x,y)<=d:\n ans+=1\nprint(ans)\n \n ', 'I=lambda:list(map(int,input().spilt()))\nn,d=I()\ndef ch(a,b):\n return a**2+b**2\nans=0\nfor i in range(n):\n x,y=I()\n if ch(x,y)<=d:\n ans+=1\nprint(ans)\n \n ', 'I=lambda:list(map(int,input().split()))\nn,d=I()\ndef ch(a,b):\n return a**2+b**2\nans=0\nfor i in range(n):\n x,y=I()\n if ch(x,y)<=d*d:\n ans+=1\nprint(ans)\n \n ']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s469026138', 's864281534', 's329362231']
[9180.0, 9048.0, 9180.0]
[493.0, 28.0, 519.0]
[173, 173, 175]
p02595
u997036872
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['n,d = map(int,input().split())\nl = []\nfor i in range(n):\n x,y = map(int,input().split())\n l.append([x,y])\nans = 0\nfor j in l:\n if j[0]**2 + j[1]**2 < d**2:\n ans += 1\nprint(ans)', 'n,d = map(int,input().split())\nl = []\nfor i in range(n):\n x,y = map(int,input().split())\n l.append([x,y])\nans = 0\nfor j in l:\n if j[0]**2 + j[1]**2 <= d**2:\n ans += 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s146440073', 's489051187']
[38928.0, 39056.0]
[563.0, 661.0]
[182, 183]
p02595
u998867748
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['\nfor i in range(n):\n x,y = map(int,input().split())\n if x**2 + y**2 <= d**2:\n s += 1\nprint(s)', 'n,d = map(int,input().split())\n\ns = 0\n\nfor i in range(n):\n x,y = map(int,input().split())\n if x**2 + y**2 <= d**2:\n s += 1\nprint(s)']
['Runtime Error', 'Accepted']
['s833623736', 's017159938']
[8968.0, 9204.0]
[28.0, 501.0]
[106, 144]
p02595
u999287037
2,000
1,048,576
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i). Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there? We remind you that the distance between the origin and the point (p, q) can be represented as \sqrt{p^2+q^2}.
['import math\nN, D = map(int, input().split())\nP = [list(map(int, input().split()) for _ in range(N))]\n\ncnt = 0\nfor i in range(N):\n d = math.sqrt(P[0]**2 + P[1]**2)\n if d <= D:\n cnt += 1', 'import math\nN, D = map(int, input().split())\nP = [list(map(int, input().split()) for _ in range(N))]\n\ncnt = 0\nfor i in range(N):\n d = math.sqrt(P[0]**2 + P[1]**2)\n if d <= D:\n cnt += 1\n\nprint(cnt)', 'import math\nN, D = map(int, input().split())\nP = [list(map(int,input().split())) for i in range(N)]\n\ncnt = 0\nfor i in range(N):\n d = math.sqrt(int(P[i][0])**2 + int(P[i][1])**2)\n if d <= D:\n cnt += 1\n\nprint(cnt)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s375553596', 's686376593', 's754399758']
[96124.0, 96080.0, 45432.0]
[762.0, 755.0, 574.0]
[197, 209, 224]
p02596
u023077142
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['def main():\n K = int(input())\n\n if K % 2 == 0:\n v = 7\n for i in range(1, 1000000):\n if v % K == 0:\n print(i)\n return\n\n v = (v * 10 + 7) % K\n \n print(-1)\n\nmain()\n', 'def main():\n K = int(input())\n\n v = 7\n for i in range(1, 1000000):\n if v % K == 0:\n print(i)\n return\n\n v = (v * 10 + 7) % K\n \n print(-1)\n\nmain()\n']
['Wrong Answer', 'Accepted']
['s797959998', 's128072374']
[9160.0, 9172.0]
[152.0, 161.0]
[243, 200]
p02596
u029399657
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['n = int(input())\nif n%2==0 or n%5==0:\n print(-1)\nelse:\n a = 7\n flag = 0\n while flag==0:\n if a%n==0:\n print(count+1)\n flag = 1\n else:\n count+=1\n a = a*10\n a = a+7\n a = a%n', 'n = int(input())\nif n%2==0 or n%5==0:\n print(-1)\nelse:\n a = 7\n flag = 0\n while flag==0:\n if a%n==0:\n print(count)\n flag = 1\n else:\n count+=1\n a = a*10\n a = a+7\n a = a%n', 'k=int(input())\nn=7\nfor i in range(k+1):\n if n%k==0:\n print(i+1)\n exit()\n n=(10*n+7)%k\nprint(-1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s127966254', 's778679325', 's734384161']
[9132.0, 9040.0, 9164.0]
[30.0, 31.0, 220.0]
[210, 208, 115]
p02596
u040660107
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['# # 1 <= K <= 10^6\n# K = int(input())\n\n#\n# import math\n#\n\n\n# math.gcd(101, 7777)\n#\n#\n# row = \'\'\n\n# row = row + \'7\'\n# n_row = int(row)\n# print(n_row)\n#\n# if n_row % K == 0:\n# print(i + 1)\n# break\n\n# print("-1")\n\nk = int(input())\nif k==1 or k==7:\n print(1)\nelif k%2==0:\n print(-1)\nelse:\n cnt = 1\n pre = 7\n while(True):\n surp = (pre*10+7)%k\n print(surp)\n cnt += 1\n if surp==0:\n break\n if cnt>1000000:\n cnt = -1\n break\n pre = surp\n print(cnt)', '# # 1 <= K <= 10^6\n# K = int(input())\n\n#\n# import math\n#\n\n\n# math.gcd(101, 7777)\n#\n#\n# row = \'\'\n\n# row = row + \'7\'\n# n_row = int(row)\n# print(n_row)\n#\n# if n_row % K == 0:\n# print(i + 1)\n# break\n\n# print("-1")\n\nk = int(input())\nif k==1 or k==7:\n print(1)\nelif k%2==0:\n print(-1)\nelse:\n cnt = 1\n pre = 7\n while(True):\n surp = (pre*10+7)%k\n cnt += 1\n if surp==0:\n break\n if cnt>1000000:\n cnt = -1\n break\n pre = surp\n print(cnt)']
['Wrong Answer', 'Accepted']
['s057496176', 's610222592']
[9916.0, 9116.0]
[559.0, 266.0]
[622, 606]
p02596
u050779044
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import math\nimport time\nimport sys\n\nsys.setrecursionlimit(5000)\ndef judge_debisible(K, seven_number):\n gcd_number = math.gcd(K,seven_number)\n elapsed_time = time.time() - start_time\n print(elapsed_time)\n if elapsed_time > 0.1:\n print("-1")\n elif gcd_number == 1 :\n judge_debisible(K, seven_number*10+7)\n else:\n print(len(str(seven_number)))\n\nK = int(input())\nstart_time = time.time()\njudge_debisible(K, 7)', 'K = int(input())\nseven_number = 0\nality = 0\nfor ans in range(1,10**7):\n if ans > K:\n print("-1")\n break\n else:\n seven_number = (seven_number*10+7) % K\n if seven_number ==0:\n print(ans)\n break\n']
['Runtime Error', 'Accepted']
['s060403452', 's075683203']
[19012.0, 9108.0]
[64.0, 224.0]
[444, 280]
p02596
u068538925
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['count = 0\nbefore = 0\nif k%2 == 0 or k%5==0:\n print(-1)\n exit()\n\nai=0\ni=0\nwhile True:\n ai = (ai*10+7)%k\n i += 1\n if ai == 0:\n print(i)\n break', 'k = int(input())\ncount = 0\nbefore = 0\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\n exit()\n\nai = 0\ni = 0\nwhile True:\n ai = (ai*10+7) % k\n i += 1\n if ai == 0:\n print(i)\n break']
['Runtime Error', 'Accepted']
['s279058019', 's739169587']
[9112.0, 9112.0]
[26.0, 202.0]
[169, 198]
p02596
u068862829
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\nans = 1\nX = 7\ncnt = K\nwhile(cnt > 0):\n\n rem = X % K\n if rem == 0:\n print(ans)\n break\n else:\n remlst.append(rem)\n ans += 1\n X = rem*10 + 7 \n cnt -= 1\n\nif rem != 0:\n print(-1)', 'K = int(input())\nans = 1\nX = 7\ncnt = K\nwhile(cnt > 0):\n\n rem = X % K\n if rem == 0:\n print(ans)\n break\n else:\n remlst.append(rem)\n ans += 1\n X = rem*10 + 7 \n cnt -= 1\n\nif cnt == 0:\n print(-1)', 'K = int(input())\nans = 1\nX = 7\ncnt = K\nwhile(cnt > 0):\n\n rem = X % K\n if rem == 0:\n print(ans)\n break\n else:\n ans += 1\n X = rem*10 + 7 \n cnt -= 1\n\nif rem != 0:\n print(-1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s600242692', 's903973556', 's071859952']
[9176.0, 9108.0, 9180.0]
[27.0, 23.0, 306.0]
[277, 277, 250]
p02596
u069699931
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K=int(input())\ncount=0\nresult = -1\nfor i in range(K):\n count =(10*count+7)%K\n if count%K==0:\n result = i+1\nprint(result)', 'K=int(input())\ncount=0\nresult = -1\nfor i in range(K):\n count =(10*count+7)%K\n if count%K==0:\n result = i+1\nprint(result)', 'K=int(input())\n\ncount=0\nresult = -1\nfor i in range(K):\n count =(10*count+7)%K\n if count==0:\n result = i+1\n\nprint(result)', 'K=int(input())\ncount=0\nresult = -1\nfor i in range(K):\n count =(10*count+7)%K\n if count==0:\n result = i+1\nprint(result)', 'K=int(input())\ndef x():\n count=0\n for i in range(K):\n count =(10*count+7)%K\n if count==0:\n return i+1\n return -1 \nprint(x())']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s248290535', 's689288365', 's720310251', 's787635866', 's103675119']
[9108.0, 9172.0, 9008.0, 9148.0, 9084.0]
[208.0, 206.0, 185.0, 178.0, 132.0]
[133, 152, 133, 150, 180]
p02596
u069707486
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['x = int(input())\ni = 1\nn= 0\nif x % 2 or x % 5 == 0:\n print(-1)\nelse:\n for i in range(1, 1000000):\n\n l = 7 * (10**i - 1) // 9\n n+=1\n if l % x == 0:\n break\n print(n)\n', 'k = int(input())\na=0\nfor i in range (1,10**6):\n a=10*a+7\n a%=k\n if a==0:\n ans=i\n break;\n else:\n ans=-1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s705837218', 's916876477']
[9132.0, 9048.0]
[2205.0, 247.0]
[205, 141]
p02596
u072717685
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom math import sqrt\nfrom collections import defaultdict\ndef main():\n k = int(input())\n if k % 2 == 0 or k % 5 == 0:\n print(-1)\n sys.exit()\n p = 7\n plus = 7\n amari = set()\n r = 1\n while p != 0:\n p = p % k\n if p in amari:\n print(r, -1, p)\n sys.exit()\n else:\n amari.add(p)\n plus = (plus * 10) % k\n p += plus\n r += 1\n\n print(r)\n\nif __name__ == '__main__':\n main()\n", "import sys\nread = sys.stdin.read\n\nfrom collections import defaultdict\ndef main():\n k = int(input())\n if k % 2 == 0:\n print(-1)\n sys.exit()\n rems = defaultdict(int)\n n = 7 % k\n next_digit = 70 % k\n r = 1\n while True:\n if n == 0:\n print(r)\n sys.exit()\n elif rems[n]:\n print(-1)\n sys.exit()\n else:\n rems[n] = 1\n n += next_digit\n n = n % k\n next_digit = (next_digit * 10) % k\n r += 1\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s772061011', 's498803064']
[78152.0, 92812.0]
[385.0, 512.0]
[555, 605]
p02596
u075317232
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["import math\n\ndef Repsept():\n \n num = int(input())\n\n seven_yes = num % 7\n eleven_yes = num % 11\n mod_value = 1\n\n count = 1\n \n if num % 2 != 0 and num % 5 != 0:\n \n if not is_prime(num):\n \n while mod_value != 0:\n value = 7*(pow(10, count)-1)/9\n \n mod_value = value % num\n \n if mod_value != 0:\n count = count + 1\n \n print(count)\n \n else:\n \n print(num-1)\n\n else:\n \n print(-1)\n\n\ndef is_prime(n):\n if n == 1: \n return False\n\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n\n return True\n\n\nif __name__ == '__main__':\n Repsept()\n\n", "import math\n\ndef Repsept():\n \n num = int(input())\n\n seven_yes = num % 7\n eleven_yes = num % 11\n mod_value = 1\n\n count = 1\n \n if num % 2 != 0:\n \n if seven_yes == 0 and eleven_yes == 0:\n \n \n while mod_value != 0:\n value = 7*(pow(10, count)-1)/9\n \n mod_value = value % num\n \n if mod_value != 0:\n count = count + 1\n \n print(count)\n \n else:\n \n print(num-1)\n\n else:\n \n print(-1)\n\n\ndef is_prime(n):\n if n == 1: \n return False\n\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n\n return True\n\n\nif __name__ == '__main__':\n Repsept()\n\n", "def Repsept():\n \n num = int(input())\n\n f=0\n n=num\n \n for i in range(10**6+1):\n if n==0:\n f=1\n print(i)\n break\n n=((n*10)+7)%num\n if f==0:\n print(-1)\n\n\nif __name__ == '__main__':\n Repsept()\n\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s014386570', 's111888975', 's917038860']
[9112.0, 9192.0, 9176.0]
[29.0, 37.0, 133.0]
[788, 837, 250]
p02596
u080685822
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nt = 7\nkou = 1\n\nif k % 2 != 0:\n if k % 5 != 0:\n while True:\n kou += 1\n t = 10 * t + 7\n \n if t % k == 0:\n print(kou)\n break\n\nprint(-1)\n', 'k = int(input())\nt = 7\nkou = 1\n\nwhile t % k == 0:\n kou += 1\n t = 10 * t + 7\n \nprint(kou)', 'K = int(input())\n\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\n exit()\n\ni = 0\nai = 0\nwhile True:\n ai = (ai * 10 + 7) % K\n i += 1\n if ai == 0:\n break\nprint(i)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s590217488', 's797904447', 's843363526']
[8932.0, 9116.0, 9100.0]
[25.0, 2205.0, 188.0]
[176, 97, 174]
p02596
u080885857
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import math\nt = int(input())\nif t%2==0 or t%5==0:\n print(-1)\nelse:\n i=1\n s=7%t\n while 1:\n if (s%t)==0:\n print(i)\n break\n i += 1\n\n s = (s * 10 + 7)%t\n print(s)\n continue', 'import math\nt = int(input())\nif t%2==0 or t%5==0:\n print(-1)\nelse:\n i=1\n s=7%t\n while 1:\n if (s%t)==0:\n print(i)\n break\n i += 1\n\n s = (s * 10 + 7)%t\n\n continue']
['Wrong Answer', 'Accepted']
['s063328781', 's810318947']
[9940.0, 9176.0]
[560.0, 238.0]
[237, 221]
p02596
u087118202
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\n\nl=[]\nfor i in range(1,k+1):\n x=7%k\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n \tprint(i)\n break\n if 0 not in l:\n print(-1)', 'import sys\nk=int(input())\nl=[]\nx=7%k\nif x == 0:\n print(1)\nsys.exit()\nfor i in range(2,k+1):\n x=7%k\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n print(i)\n break\nif 0 not in l:\n print(-1)', 'k=int(input())\nl=[]\nfor i in range(1,k+1):\n x=7%k\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n print(i)\n break\nif 0 not in l:\n print(-1)', 'k=int(input())\n\nl=[]\nfor i in range(1,k+1):\n x=7%k\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n \tprint(i)\n break\nif 0 not in l:\n print(-1)', 'import sys\nk=int(input())\nl=[]\nx=7%k\nif x == 0:\n print(1)\n sys.exit()\nfor i in range(2,k+1):\n x=7%k\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n print(i)\n break\nif 0 not in l:\n print(-1)', 'k=int(input())\nl=[]\nx=7%k\nif x == 0:\n print(1)\n break\nfor i in range(2,k+1):\n x=7%k\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n print(i)\n break\nif 0 not in l:\n print(-1)', 'k=int(input())\nx=7%k\nl=[]\nfor i in range(1,k+1):\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n print(i)\n break\nif 0 not in l:\n print(-1)', 'import sys\nk=int(input())\nl=[]\nx=7%k\nif x == 0:\n print(1)\n sys.exit()\nfor i in range(2,k+1):\n num=(x*10+7)%k\n x=num\n l.append(num)\n if num==0:\n print(i)\n break\nif 0 not in l:\n print(-1)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s111602958', 's172380167', 's239676887', 's260082463', 's508914663', 's679844566', 's827234876', 's735748123']
[8928.0, 9120.0, 16896.0, 8960.0, 16956.0, 9032.0, 48628.0, 48572.0]
[23.0, 31.0, 288.0, 33.0, 298.0, 23.0, 300.0, 307.0]
[158, 204, 154, 154, 206, 190, 152, 198]
p02596
u092104621
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nd1 = k % 10\nmae = 0\nsd = [0]*10\ncnt = 0\nif not d1 in (1, 3, 7, 9):\n print(-1)\n exit()\nfor i in range(1,10) :\n sd[d1 * i % 10] = i\nprint(sd)\n\nd2 = 7 - mae % 10\ns = str(sd[d2] * k)\nfor j in range(9):\n print("s1=",s)\n for i in range(len(s)-1, -1, -1):\n print("s[",i,"]=",s[i])\n if (s[i]) == "7":\n cnt += 1\n else:\n s = s[0:i+1]\n# mae = int(s)\n print("s2=",s)\n# d2 = 7 - mae % 10\n\n break\nprint("cnt=",cnt)', 'n,d = list(map(int, input().split()))\nc=0\nd *= d\nfor i in range(n):\n x,y = list(map(int, input().split()))\n x *= x\n y *= y\n y += x\n if y <= d:\n c += 1\nprint(c)', 'k = int(input())\nd1 = k % 10\nmae = 0\nsd = [0]*10\ncnt = 0\nif not d1 in (1, 3, 7, 9):\n print(-1)\n exit()\nfor i in range(1,10) :\n sd[d1 * i % 10] = i\n#print(sd)\n\nfor j in range(999999):\n d2 = 7 - mae % 10\n s = str(sd[d2] * k + mae)\n\n# print("s1=",s)\n for i in range(len(s)-1, -1, -1):\n# print("s[",i,"]=",s[i])\n if (s[i]) == "7":\n cnt += 1\n else:\n s = s[0:i+1]\n mae = int(s)\n# print("s2=",s)\n break\n# print("i= ",i)\n if i == 0 :\n print(cnt)\n exit()']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s233995994', 's591846873', 's784254067']
[9232.0, 9164.0, 9224.0]
[28.0, 24.0, 1017.0]
[487, 167, 538]
p02596
u094191970
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\n\nif k%2==0 or k%5==0:\n print(-1)\n exit()\n\nnum=7\nnum%=k\nans=1\n\nwhile k!=0:\n num=(10*num+7)%k+7\n\nprint(ans)', 'k=int(input())\n\nif k%2==0 or k%5==0:\n print(-1)\n exit()\n\nans=1\nnum=7\nwhile num%k!=0:\n num=10*num+7\n num%=k\n ans+=1\n\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s160544907', 's355383101']
[9084.0, 9092.0]
[2206.0, 247.0]
[123, 131]
p02596
u094213642
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['a = 7\nb = int(inout())\n\nlist = [7]\nfor i in range(b):\n list.append(list[-1]*10 +7)\n\nfor l in range(len(list)):\n if list[l] % b == 0:\n print(l+1)\n exit()\n', 's = 7\na = int(input())\n\nfor i in range(10**6):\n if s%a == 0:\n print(i+1)\n exit()\n s = (s*10+7) % a\nprint(-1)\n']
['Runtime Error', 'Accepted']
['s889340837', 's230738334']
[9064.0, 9072.0]
[26.0, 213.0]
[173, 129]
p02596
u098436028
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import numpy as np\nK=int(input()) \n\nS=""\ncount=-1\n\nfor i in range(K):\n S += "7"\n M = int(S)\n if( M%K == 0):\n count = i\n break\n\nprint(count)', 'import numpy as np\nK=int(input()) \n\nS=""\ncount=-1\n\nfor i in range(K):\n S += "7"\n M = int(S):\n if( M%K == 0):\n count = i+1\n break\n\nprint(count)', 'import numpy as np\nK=int(input()) \n\nS=0\ncount=-1\n\nfor i in range(K):\n S = (S*10)%K\n S = (S+7)%K\n if( S == 0):\n count = i+1\n break\n\nprint(count)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s205395390', 's562221514', 's421146780']
[27148.0, 8892.0, 27136.0]
[2206.0, 22.0, 366.0]
[148, 151, 152]
p02596
u102655885
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["import sys\nk = int(input())\n\nremainders = set()\ncurrent_remainder = 7 % k\nremainders.add(current_remainder)\n\ncounter = 1\nwhile True:\n counter += 1\n remainder = remainder * 10 % k\n if remainder in remainders:\n print('-1')\n sys.exit()\n remainders.add(remainder)\n print(remainders)\n if sum(remainders) % k == 0:\n print(counter)\n sys.exit()", "import sys\nk = int(input())\n\nremainders = set()\nremainder = 7 % k\nremainders.add(remainder)\n\ncounter = 1\nwhile True:\n counter += 1\n remainder = remainder * 10 % k\n if remainder in remainders:\n print('-1')\n sys.exit()\n remainders.add(remainder)\n print(remainders)\n if sum(remainders) % k == 0:\n print(counter)\n sys.exit()", "import sys\nk = int(input())\n\nremainders = set()\ncurrent_remainder = 7 % k\nremainders.add(current_remainder)\n\ncounter = 1\nwhile True:\n counter += 1\n remainder = current_remainder * 10 % k\n if remainder in remainders:\n print('-1')\n sys.exit()\n remainders.add(remainder)\n if sum(remainders) % k == 0:\n print(counter)\n sys.exit()", 'import sys\n\nk = int(input())\nn = 7\ncounter = 1\nremainders = set()\n\nwhile True:\n remainder = n % k\n if remainder == 0:\n print(counter)\n sys.exit()\n if remainder in remainders:\n print(-1)\n sys.exit()\n remainders.add(remainder)\n \n n = remainder * 10 + 7\n counter += 1']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s004276929', 's250721671', 's877827899', 's268116562']
[9184.0, 138916.0, 9116.0, 77748.0]
[36.0, 2842.0, 30.0, 488.0]
[382, 366, 368, 313]
p02596
u104282757
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['def solve(k):\n a_mod = 0\n for i in range(1000000):\n a_mod += 7 * pow(10, i, k)\n a_mod %= k\n if a_mod == 0:\n return i + 1\n return -1\n\n\ndef main():\n k = int(input())\n res = solve(k)\n print(res)\n\n\ndef test():\n assert solve(101) == 4\n assert solve(2) == -1\n assert solve(999983) == 999982\n\n\nif __name__ == "__main__":\n test()\n main()\n', 'def solve(k):\n a_mod = 0\n pow_10 = 7\n for i in range(1000000):\n a_mod += pow_10\n a_mod %= k\n if a_mod == 0:\n return i + 1\n pow_10 *= 10\n pow_10 %= k\n return -1\n\n\ndef main():\n k = int(input())\n res = solve(k)\n print(res)\n\n\ndef test():\n assert solve(101) == 4\n assert solve(2) == -1\n assert solve(999983) == 999982\n\n\nif __name__ == "__main__":\n test()\n main()\n']
['Time Limit Exceeded', 'Accepted']
['s827424219', 's744508981']
[8832.0, 9072.0]
[2206.0, 456.0]
[395, 440]
p02596
u104405612
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\nif K % 2 == 0:\n print(-1)\n\na = 0\nfor i in range(K):\n a = 7 * 10**(i) + a\n if a % K == 0:\n\n print(i)\n break\n\n else:\n continue', 'K = int(input())\n\nif K % 2 == 0:\n print(-1)\n\na = 0\nif K < 900000:\n for i in range(K):\n a = 7 * 10**(i) + a\n if a % K == 0:\n print(i)\n break\nelif K >= 900000:\n print(999982)', 'K = int(input())\n\ndef func(K):\n a = 0\n for i in range(1, K+1):\n a = (a * 10 + 7) % K\n \n if a == 0:\n return i\n return -1\n\nprint(func(K))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s424922330', 's673608850', 's473850950']
[9172.0, 9084.0, 9100.0]
[2205.0, 2205.0, 137.0]
[168, 193, 152]
p02596
u108650331
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['#!/usr/bin/env python3\n\nk = int(input())\n\nif k % 2 == 0:\n print(-1)\n #print("a")\n exit(0)\n\nd1 = k % 10\nprint(d1)\nif d1 != 1 and d1 != 7 and d1 != 3 and d1 != 9:\n print(-1)\n #print("b")\n exit(0)\n\ndef PrimeJudge(n):\n ret = True\n for i in range(2, int(n ** 0.5)+1):\n if n % i == 0:\n ret = False\n break\n return ret\n\nif PrimeJudge(k) == False:\n print(-1)\n #print("c")\n exit(0)\n\ns = 7\nwhile(1):\n i = int(s)\n if i < k:\n s = str(s)+\'7\'\n else:\n if i % k == 0:\n print(len(s))\n exit(0)\n else:\n s = str(s)+\'7\'\n\n\n\n', '#!/usr/bin/env python3\n\nk = int(input())\n\nx = 7%k\nfor i in range(1, k+1):\n if x == 0:\n print(i)\n exit(0)\n x=(10*x+7)%k\n\nprint(-1)\n\n\n\n\n\n']
['Runtime Error', 'Accepted']
['s324611846', 's656264393']
[9320.0, 9156.0]
[2205.0, 191.0]
[646, 172]
p02596
u109632368
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['\nk = int(input())\nans = 0\nai = 7\nfor i in range(k):\n ai = ((ai * 10) + 7) % k\n if ai == 0:\n ans = i\n break\n if i == k:\n ans = -1\n\nprint(ans)\n\n', 'k = int(input())\nans = 0\n\nai = 0\nfor i in range(k+2):\n ai = ((ai * 10) + 7) % k\n if ai == 0:\n ans = i + 1\n print(ans)\n exit()\n\nans = -1\nprint(ans)\n\n\n']
['Wrong Answer', 'Accepted']
['s596978291', 's010076823']
[9056.0, 9060.0]
[208.0, 175.0]
[172, 176]
p02596
u112007848
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\nk *= 9\namari = 63\nfor i in range(1, 10 ** 6 + 1):\n amari %= k\n if amari == 0:\n print(i)\n break\n else:\n amari = amari * 70 + 63\nelse:\n print(-1)', 'k=int(input())\nk *= 9\namari = 63\nfor i in range(1, 10 ** 6 + 1):\n amari %= k\n if amari == 0:\n print(i)\n break\n else:\n amari = amari * 10 + 63\nelse:\n print(-1)']
['Wrong Answer', 'Accepted']
['s493090630', 's441804420']
[8996.0, 9096.0]
[203.0, 207.0]
[171, 171]
p02596
u121799456
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import math\nx = int(input())\nif math.gcd(x, 10) != 1:\n\tprint(-1)\n\texit()\nphi = x\nq = x\nl = q\t\nfor i in range(3, int(math.sqrt(l)) + 1, 2):\n\tif q % i == 0:\n\t\tphi //= i\n\t\tphi *= (i - 1)\n\t\twhile q % i == 0:\n\t\t\tq //= i\nif q != 1:\n\tphi //= q\n\tphi *= (q - 1)\nprint(phi)', 'import math\nx = int(input())\nrem = 7 % x\ncnt = 1\nwhile rem != 0 and cnt <= 1000000:\n\trem = (10 * rem + 7) % x\n\tcnt += 1\nif rem == 0:\n\tprint(cnt)\nelse:\n\tprint(-1)']
['Wrong Answer', 'Accepted']
['s054748127', 's427322621']
[9200.0, 9176.0]
[30.0, 236.0]
[263, 161]
p02596
u123579949
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\nif K%2==0 or K%5==0:\n print(-1)\nelse:\n n = 1\n while True:\n if 7*(10**n-1)/9%K==0:\n print(n)\n break', 'K = int(input())\nif K%2==0 or K%5==0:\n print(-1)\nelse:\n n = 1\n Rem = 7%K\n while Rem!=0:\n Rem = (Rem*10+7)%K\n n+=1\n print(n)']
['Time Limit Exceeded', 'Accepted']
['s926282104', 's488518776']
[9220.0, 9172.0]
[2206.0, 203.0]
[131, 134]
p02596
u125348436
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['N=int(input())\n\ndef waru(N):\n if N%2==0:\n print("-1")\n return\n a="7"\n for i in range(1,100000000):\n ia=int(a)\n if N>ia:\n a+="7"\n continue\n if N%ia==0:\n print(i)\n return\n a+="7"\n\n print("-1")\n\nwaru(N)', 'K=int(input())\ndef waru(K):\n a=[]\n if K%2==0 or K%5==0:\n print("-1")\n return\n a.append(7%K)\n for i in range(1,K):\n a.append((10*a[i-1]+7)%K)\n for i in range(K):\n if a[i]==0:\n print(i+1)\n return\n print(-1)\nwaru(K)']
['Time Limit Exceeded', 'Accepted']
['s500126594', 's091798331']
[9080.0, 48400.0]
[2205.0, 244.0]
[297, 280]
p02596
u137226361
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["k = int(input())\n\nif k%2 ==0:\n print(-1)\n\nfor i in range(1, 10**12):\n n = int(('7'*i))\n print(n)\n if n%k == 0:\n print(i)\n exit(0)\n\nprint(-1)", 'k = int(input())\n\nm = 0\n\nfor i in range(1, 10**6):\n n = m *10 +7\n m = n % k\n if m == 0:\n print(i)\n exit(0)\n\nprint(-1)']
['Wrong Answer', 'Accepted']
['s431728180', 's130255420']
[27884.0, 9100.0]
[2253.0, 215.0]
[166, 140]
p02596
u141419468
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\nmod = []\na[0] = 7%K\nif a[0] == 0:\n print(a[0])\n exit()\nfor i in range(1,K+1):\n a[i] = (a[i-1]*10 + 7)%K\n if a[i] == 0:\n print("%d",a[i])\n break\n\nelse:\n print(-1)', 'K = int(input())\nk = str(K)\nnum = -1\n\nif K % 2 == 0:\n print("-1")\nelse:\n while True:\n num += 1\n zoro = [7] * (len(k)+num)\n zorome = int(\'\'.join(map(str, zoro)))\n print(num)\n\n if zorome % K ==0:\n print(len(k)+num)\n break', 'K = int(input())\nmod = []\na[0] = 7%K\nif a[0] == 0:\n print(a[0])\n exit()\nfor i in range(1,K):\n a[i] = (a[i-1]*10 + 7)%K\n if a[i] == 0:\n print("%d",a[i])\n break\n\nelse:\n print(-1)', 'K = int(input())\nmod = []\na[0] = 7%K\nfor i in range(1,K):\n a[i] = (a[i-1]*10 + 7)%K\n\nfor i in range(K):\n if a[i] == 0:\n print("%d",a[i])\n break\n\nelse:\n print(-1)', 'K = int(input())\n\nn = 0\nfor i in range(1,K+1):\n n = (n*10 + 7)%K\n if n == 0:\n print("%d",i)\n break\n\nelse:\n print(-1)', 'K = int(input())\nmod = []\na[0] = 7%K\nfor i in range(1,K):\n a[i] = (a[i-1]*10 + 7)%K\n \nfor i in range(K):\n if a[i] == 0:\n print(a[i])\n break\n \nelse:\n print(-1)', 'K = int(input())\n\nn = 0\nfor i in range(1,K+1):\n n = (n*10 + 7)%K\n if n == 0:\n print(i)\n break\n\nelse:\n print(-1)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s029262251', 's072388338', 's457330874', 's655190878', 's711099015', 's927353300', 's682113957']
[9152.0, 9696.0, 9100.0, 9116.0, 9148.0, 9176.0, 9116.0]
[26.0, 2206.0, 28.0, 31.0, 178.0, 28.0, 175.0]
[207, 282, 205, 184, 139, 181, 134]
p02596
u152566588
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["def euclid(a, b):\n if b == 0:\n return a\n else:\n return euclid(b, a%b)\n\ndef main():\n\n k = int(input())\n if k % 2 == 0:\n print('-1')\n else:\n for i in range(1, k + 1):\n target = int('1' * i) * 7\n if euclid(target, k) != 1:\n print(target)\n\nif __name__ == '__main__':\n main()", 'k = int(input())\ntarget = 7\nif k % 2 == 0:\n print(-1)\n exit()\nfor i in range(1000000 + 1):\n if target % k == 0:\n print(i + 1)\n exit()\n target *= 10\n target += 7\nprint(-1)', 'k = int(input())\ntarget = 7\nif k % 2 == 0:\n print(-1)\n exit()\n for i in range(1000000 + 1):\n if target % k == 0:\n print(i + 1)\n exit()\n target *= 10\n target += 7\n print(-1)', "def main():\n\n k = int(input())\n a = [0] * (10 ** 6 + 1)\n a[0] = 7 % k\n if a[0] == 0:\n print(1)\n exit()\n for i in range(1, k + 1):\n a[i] = (a[i - 1] * 10 + 7) % k\n if a[i] == 0:\n print(i + 1)\n exit()\n print(-1)\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s248241311', 's267153049', 's458153005', 's661266013']
[27716.0, 9112.0, 9112.0, 48344.0]
[2243.0, 108.0, 29.0, 215.0]
[353, 185, 203, 316]
p02596
u152741807
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k= int(input())\n \nif k % 2 == 0 or k % 5 == 0:\n print("-1")\n \nelse:\n ans = 1\n s = 7\n while True:\n if s % k == 0:\n print(ans)\n break\n else:\n s = (s % k)*10 + 7\n ans += 1', 'k= int(input())\n \nif k % 2 == 0 or k % 5 == 0:\n print("-1")\n \nelse:\n ans = 1\n s = 7\n while True:\n if s % k == 0:\n print(ans)\n break\n else:\n s = (s % k)*10 + 7\n ans += 1\n']
['Runtime Error', 'Accepted']
['s337798828', 's807005958']
[9028.0, 9152.0]
[26.0, 250.0]
[243, 242]
p02596
u155687575
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["def main():\n k = int(input())\n init = 7%k\n an = [init]\n for _ in range(k):\n a = an[-1]\n an.append((10*a+7) % k)\n\n for ind, a in enumerate(an):\n if a==0:\n print(ind)\n return\n print(-1)\nif __name__ == '__main__':\n main()", "def main():\n k = int(input())\n init = 7%k\n an = [init]\n for _ in range(k):\n a = an[-1]\n an.append((10*a+7) % k)\n\n for ind, a in enumerate(an):\n if a==0:\n print(ind+1)\n return\n print(-1)\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s204087587', 's197820999']
[48400.0, 48544.0]
[228.0, 230.0]
[282, 284]
p02596
u158380546
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['i = 0;\nmod = 0;\nwhile True:\n mod = (mod*10 + 7) % k;\n if mod == 0:\n break;\n i += 1;\n if i == k:\n j = -2\n break;\n\nprint(i+1)', 'k = int(input())\n\n\ni = 0;\nmod = 0;\nwhile True:\n mod = (mod*10 + 7) % k;\n print(mod)\n if mod == 0:\n break;\n i += 1;\n if i == k:\n i = -2\n break;\n\nprint(i+1)', 'k = int(input())\n\n\ni = 0;\nmod = 0;\nwhile True:\n mod = (mod*10 + 7) % k;\n if mod == 0:\n break;\n i += 1;\n if i == k:\n i = -2\n break;\n\nprint(i+1)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s794777551', 's831568586', 's506817330']
[9028.0, 9972.0, 9172.0]
[26.0, 527.0, 238.0]
[156, 190, 175]
p02596
u163529815
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import sys\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef main():\n K = int(input())\n x = 0\n if K % 2 == 0 or K % 5 == 0:\n print(-1)\n \n while True:\n x = (x * 10 + 7) % K\n i += 1\n if x == 0:\n print(i + 1)\n break\n\n\n \n\nif __name__ == "__main__":\n main()', 'import sys\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef main():\n K = int(input())\n x = 0\n i = 0\n if K % 2 == 0 or K % 5 == 0:\n print(-1)\n exit()\n \n while True:\n x = (x * 10 + 7) % K\n i += 1\n if x == 0:\n print(i)\n break\n\n\n \n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s774094880', 's333132857']
[9180.0, 9108.0]
[23.0, 135.0]
[328, 351]
p02596
u166340293
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K=int(input())\nm=7\ncount=1\nflag=0\nfor i in range(K):\n if m%K==0:\n flag=1\n break\n else:\n m*=10\n m+=7\n m%=K\n count+=1\nif flag:\n print("-1")\nelse:\n print(count)', 'K=int(input())\nm=7\ncount=1\nflag=0\nfor i in range(K):\n if m%K==0:\n flag=1\n break\n else:\n m*=10\n m+=7\n m%=K\n count+=1\nif not flag:\n print("-1")\nelse:\n print(count)']
['Wrong Answer', 'Accepted']
['s830932168', 's556824241']
[9032.0, 9172.0]
[341.0, 344.0]
[179, 183]
p02596
u167681994
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\n\nif k % 2 == 0:\n print(-1)\n exit()\n\na = [7]\nans = 0\nfor i in a:\n if i % k == 0:\n ans += 1\n break\n else:\n a += [i*10 + 7]\n ans += 1\n ', 'k = int(input())\n\nif k % 2 == 0:\n print(-1)\n exit()\n\na = [7]\nans = 0\nfor i in a:\n if i % k == 0:\n ans += 1\n break\n else:\n a = [i*10 + 7]\n ans += 1\n\n\nprint(ans)\n', 'k = int(input())\n\nif k % 2 == 0:\n print(-1)\n exit()\n\na = [7]\nans = 0\nfor i in a:\n if i % k == 0:\n ans += 1\n break\n else:\n a = [i*10 + 7]\n ans += 1\n print(a)\n\nprint(ans)\n', 'k = int(input())\n\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\n exit()\n\na = 7\nans = 0\nfor i in range(10**7):\n a = a % k\n if a % k == 0:\n ans = i + 1\n break\n else:\n a = a*10 + 7\n ans = i + 1\n\n\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s030392986', 's757491916', 's895290227', 's458789964']
[604096.0, 9172.0, 9168.0, 9116.0]
[2221.0, 28.0, 29.0, 309.0]
[168, 176, 188, 215]
p02596
u171654347
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import copy\n\n# a = get_int()\ndef get_int():\n return int(input())\n\n# a = get_string()\ndef get_string():\n return input()\n\n\ndef get_int_list():\n return [int(x) for x in input().split()]\n\n\ndef get_string_list():\n return input().split()\n\n\ndef get_int_multi(): \n return map(int, input().split())\n\n\ndef get_string_char_list():\n return list(str(input()))\n\n# print("{} {}".format(a, b))\n# for num in range(0, a):\n# a_list[idx]\n# a_list = [0] * a\n\'\'\'\nwhile (idx < n) and ():\n\n idx += 1\n\'\'\'\n\ndef main():\n k = get_int()\n ret = -1\n\n\n for i in range(1,k*5):\n wk = k * i\n strwk = str(wk)\n\n if (strwk.count("7") == len(strwk)):\n ret = wk\n break\n\n print(ret)\n\n\n\n\nif __name__ == \'__main__\':\n main()\n\n\n', 'import copy\n\n# a = get_int()\ndef get_int():\n return int(input())\n\n# a = get_string()\ndef get_string():\n return input()\n\n\ndef get_int_list():\n return [int(x) for x in input().split()]\n\n\ndef get_string_list():\n return input().split()\n\n\ndef get_int_multi(): \n return map(int, input().split())\n\n\ndef get_string_char_list():\n return list(str(input()))\n\n# print("{} {}".format(a, b))\n# for num in range(0, a):\n# a_list[idx]\n# a_list = [0] * a\n\'\'\'\nwhile (idx < n) and ():\n\n idx += 1\n\'\'\'\n\ndef main():\n k = get_int()\n prev = 7 % k\n ret = -1\n\n amari = prev\n\n if amari == 0:\n ret = 1\n else:\n\n for i in range(1, k):\n prev = (prev * 10) % k\n amari = (amari + prev) % k\n\n if amari == 0:\n ret = i+1\n break\n\n print(ret)\n\n\ndef check(bunshi, k):\n return (bunshi % k == 0)\n\n\nif __name__ == \'__main__\':\n main()\n\n\n']
['Wrong Answer', 'Accepted']
['s836139790', 's057112571']
[9348.0, 9260.0]
[1844.0, 183.0]
[898, 1054]
p02596
u192165107
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["K=int(input())\ni=0\nif K%2==0 or K%5==0:\n print('-1')\nelse:\n for d in range(K):\n i=(10*i+7)%K\n if i==0:\n print(i+1)\n break\n", "\nK=int(input())\ni=0\nif K%2==0 or K%5==0:\n print('-1')\n\nelse:\n for d in range(K):\n i=(10*i+7)%K\n if i==0:\n print(d+1)\n break\n"]
['Wrong Answer', 'Accepted']
['s897053527', 's383678832']
[9164.0, 9092.0]
[180.0, 181.0]
[164, 166]
p02596
u193927973
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K=input()\nketa = len(K)\nk=int(K)\nif k%2==0:\n print(-1)\nelse:\n seven = "7"*keta\n s = int(seven)\n ans=0\n while (1):\n ans+=1\n s = s%k\n if s==0:\n print(ans)\n break\n else:\n s = s*10+7', 'k=int(input())\nif k%2==0 or k%5==0:\n print(-1)\nelse:\n s=7\n for i in range(k):\n if s%k==0:\n print(i+1)\n exit()\n else:\n s=(s*10+7)%k\n']
['Wrong Answer', 'Accepted']
['s021364801', 's565705225']
[9212.0, 9000.0]
[2206.0, 215.0]
[210, 155]
p02596
u195355592
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['print(999983 * 7) \nprint(999983 * 17)\nprint(999983 * 817)\nprint(999983 * 5817)\nprint(999983 * 75817)\nprint(999983 * 875817)\nprint(999983 * 3875817)\nprint(999983 * 23875817)\n', 'N = int(input())\n\nmod_first = 7 % N\nmod_next = mod_first * 11 % N\n\nif mod_first == 0:\n print("1")\n exit()\nif mod_next == 0:\n print("2")\n exit()\n\nfor i in range(10000000):\n mod_next = (mod_next * 10 + mod_first) % N\n if mod_next == 0:\n print(i + 3)\n exit()\n\nprint("-1")\n\n']
['Wrong Answer', 'Accepted']
['s931693850', 's284972967']
[9012.0, 9056.0]
[30.0, 1611.0]
[173, 302]
p02596
u228288852
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\ncount=1\nif k%2==0:\n print(-1)\nelse:\n while True:\n if a%k==0:\n print(count)\n break\n else:\n a=a*10+7\n count+=1\n', 'k=int(input())\na=0\nfor i in range(k):\n a=(a*10+7)%k\n if a==0:\n print(i+1)\n exit()\n \nprint(-1)']
['Runtime Error', 'Accepted']
['s592957859', 's095720014']
[9136.0, 9160.0]
[32.0, 179.0]
[152, 104]
p02596
u248996551
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K=int(input())\n\nflag=0\u3000\n\na=7 \ni=0 #index\n\nif (K%2 !=\u30000):\n print(-1)\n\nelse:\n while(flag==0):\n if(a%k==0):\n flag==1\n i += 1\n a=10*a+7\n\n print(i)', 'K=int(input())\n\na=7 \nb=10\ni=0 #index\n\nif (K%7 == 0):\n L = 9*K/7\nelse:\n L = 9*K\n \nif (L%2==0 or L%5==0):\n print(-1)\nelse:\n while(i<=L):\n if (b%L==1):\n break\n else:\n b=10*(b%L)\n i += 1\n print(i+1)']
['Runtime Error', 'Accepted']
['s310805298', 's122471238']
[8932.0, 9196.0]
[27.0, 249.0]
[233, 267]
p02596
u253205825
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\ns = 7\nif k%2 == 0:\n\tprint(-1)\nelif k%5 == 0:\n\tprint(-1)\nelse:\n\twhile s%k != 0:\n\t\ts = 10*s+7\n\t\ts = str(s)\n\tprint(len(s))', 'k = int(input())\nif k%2 == 0:\n\tprint(-1)\nelif k%5 == 0:\n\tprint(-1)\nelse:\n\ts = 7\n\twhile s%k != 0:\n\t\ts = 10*s+7\n\tprint(len(s))', 'k = int(input())\nif k%2 == 0:\n\tprint(-1)\nelif k%5 == 0:\n\tprint(-1)\nelse:\n\ts = 7\n\twhile s%k != 0:\n\t\ts = 10*s+7\n\tprint(len(s))', 'k = int(input())\ns = 7\nif k%2 == 0:\n\tprint(-1)\nelif k%5 == 0:\n\tprint(-1)\nelse:\n\twhile s%k != 0:\n\t\ts = 10*s+7\n\tprint(len(s))', 'k = int(input())\nif k%2 = 0:\n\tprint(-1)\nelif k%5 = 0:\n\tprint(-1)\nelse:\n\ts = 7\n\twhile s%k != 0:\n\t\ts = 10*s+7\n\tprint(len(s))', 'import sys\n\nk = int(input())\n\na = 0\n\nfor i in range(1, k+1):\n\ta = (a*10+7)%k\n\tif a == 0:\n\t\tprint(i)\n\t\tsys.exit()\nprint(-1)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s179738899', 's472631236', 's560686393', 's822590382', 's893122105', 's611059678']
[9168.0, 9200.0, 9180.0, 9196.0, 8940.0, 9164.0]
[34.0, 2206.0, 2205.0, 2206.0, 26.0, 180.0]
[136, 124, 124, 123, 122, 122]
p02596
u264707846
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\nnana = [7,77,777,7777,77777,777777,7777777,77777777,777777777]\nwarikireta = 0\nif K == 2 or K == 5:\n print(-1)\nelse:\n for i in range(9):\n if nana[i] % K == 0:\n warikireta = i + 1\n else:\n pass\nif warikireta != 0:\n print(warikireta)\nelif warikireta == 0:\n if K == 2:\n pass\n elif K == 5:\n pass\n else:\n print(-1)\n', 'import math\nt = int(input())\nif t%2==0 or t%5==0:\n print(-1)\nelse:\n i=1\n s=7\n while 1:\n \n if s%t==0:\n print(i)\n break\n \n else:\n i += 1\n s = (s * 10 + 7) % t\n continue']
['Wrong Answer', 'Accepted']
['s217751072', 's134016549']
[9160.0, 9176.0]
[35.0, 230.0]
[356, 247]
p02596
u268402865
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K=int(input())\namari_list = []\namari = 7%K\namari_list.append(amari)\nfor i in range(1,K):\n amari = (amari * 10 + 7)% K\n if amari == 0:\n print(i+1)\n break\n if amari in amari_list:a\n print(-1)\n break\n if i == (K-1):\n print(-1)\n else:\n amari_list.append(amari)\n ', 'K=int(input())\namari=0\nfor i in range(K):\n amari = (amari * 10 + 7)% K\n if amari == 0:\n print(i+1)\n break\n if i == (K-1):\n print(-1)']
['Runtime Error', 'Accepted']
['s373637637', 's654178819']
[9040.0, 9168.0]
[28.0, 233.0]
[322, 162]
p02596
u273339216
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nx = 7%k\ns = []\nif k%2 == 0:\n print(-1)\n\nelse:\n while s.count(x) == 0:\n s.append(x)\n if x == 0:\n print(len(s))\n break\n x = (10*x + 7)%k\n\n \n if s.count(x) != 0:\n print(-1)', 'k = int(input())\nx = 7%k\ns = []\n\nwhile x not in s:\n if x == 0:\n print(len(s+1))\n break\n s.append(x)\n x = (10*x + 7)%k\n\n \nif s[-1] != 0:\n print(-1)\n', 'k = int(input())\nx = 7%k\ns = set()\nwhile s.count(x) == 0:\n s.append(x)\n x = (10*x + 7)', 'k = int(input())\nx = 7%k\ns = []\nif k%2 == 0:\n print(-1)\n\nelse:\n while s.count(x) == 0:\n s.append(x)\n if x == 0:\n print(len(s))\n break\n s.append(x)\n x = (10*x + 7)%k\n\n \n if s.count(x) != 0:\n print(-1)', 'k = int(input())\nx = 7%k\ns = []\n\nfor i in range(k):\n if x == 0:\n print(len(s+1))\n exit()\n s.append(x)\n x = (10*x + 7)%k\n\n \n \nprint(-1)\n', 'k = int(input())\nx = 7%k\ns = []\n\nfor i in range(k):\n if x == 0:\n print(len(i+1))\n exit()\n s.append(x)\n x = (10*x + 7)%k\n\n \n \nprint(-1)\n', 'k = int(input())\nx = 7%k\ns = []\n\nwhile s.count(x) == 0:\n s.append(x)\n if x == 0:\n print(len(s))\n break\n x = (10*x + 7)%k\n\n \nif s.count(x) != 0:\n print(-1)\n', 'k = int(input())\nx = 7%k\ns = set()\nwhile s.count(x) == 0:\n s.append(x)\n x = (10*x + 7)%k\n\nif s[-1] == 0:\n print(len(s))\nelse:\n print(-1)\n ', 'k = int(input())\nx = 7%k\ns = []\n\nfor i in range(k):\n if x == 0:\n print(i+1)\n exit()\n s.append(x)\n x = (10*x + 7)%k\n\n \n \nprint(-1)\n']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s044784181', 's045017044', 's161034630', 's184711584', 's638818546', 's783060688', 's892378556', 's924233806', 's553439425']
[9620.0, 9644.0, 9072.0, 9732.0, 48420.0, 48604.0, 9604.0, 9108.0, 48552.0]
[2205.0, 2206.0, 28.0, 2206.0, 277.0, 265.0, 2206.0, 27.0, 268.0]
[212, 158, 88, 228, 146, 146, 166, 143, 141]
p02596
u282333488
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\na = [None]*1000001\na[1]=7%k\nn=0\n\nfor i in range(2:k+1):\n a[i]=(a[i-1]*10+7)%k\n if a[i]==0 and n==0:\n print("{}".format(i))\n n=1\nif n==0:\n print("-1")\n', 'k = int(input())\na = [None]*1000001\na[1]=7%k\nn=0\n\nif a[1]==0:\n print("1")\n n=1\n\nfor i in range(2,k+1):\n a[i]=(a[i-1]*10+7)%k\n if a[i]==0 and n==0:\n print("{}".format(i))\n n=1\nif n==0:\n print("-1")\n']
['Runtime Error', 'Accepted']
['s544794260', 's111612892']
[8928.0, 48536.0]
[26.0, 291.0]
[190, 226]
p02596
u283929013
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nlis = []\nc = 0\na = 0\nwhile(True):\n a = (a*10 + 7) & k\n if a == 0:\n print(c+1)\n quit()\n if c > k:\n print(-1)\n quit()\n c += 1', 'k = int(input())\nlis = []\nc = 1\na = 0\nwhile(True):\n a = (a*10 + 7) % k\n if a == 0:\n print(c)\n quit()\n if c > k:\n print(-1)\n quit()\n c += 1']
['Wrong Answer', 'Accepted']
['s035123393', 's164139829']
[9172.0, 9068.0]
[217.0, 221.0]
[180, 178]
p02596
u290886932
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\ni = 0\nret = -1\nif K % 5 != 0 and K % 2 != 0:\n N = 1\n if K % 7 == 0:\n L = K * 9 // 7\n else:\n L = K * 9\n while True:\n if N % L == 1:\n ret = i\n break\n N = (N * 10 )% L\n i += 1\nprint(ret)\n', 'K = int(input())\ni = 1\nret = -1\nif K % 5 != 0 and K % 2 != 0:\n N = 10\n if K % 7 == 0:\n L = K * 9 // 7\n else:\n L = K * 9\n while True:\n if N % L == 1:\n ret = i\n break\n N = (N * 10 )% L\n i += 1\nprint(ret)\n']
['Wrong Answer', 'Accepted']
['s662339895', 's223539080']
[9124.0, 9124.0]
[29.0, 206.0]
[230, 231]
p02596
u290887281
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["k = int(input())\nnum = 0\nans = 0\nseven = ''\n\n\nfor i in range(k):\n seven += '7'\n num = int(seven) % k\n if num == 0:\n ans = i\n break\nprint(ans)", "k = int(input())\nseven = 7\ncount = 0\n\ndef main():\n for i in range(1000000):\n if k % 2 == 0:\n count = -1\n return\n\n elif seven % k == 0:\n count += 1\n print(count)\n return\n else:\n count += 1\n seven = seven * 10 + 7\n print(-1)\n\nif __name__ == '__main__':\n main()", 'k = int(input())\nseven = 7\ncount = 0\n\nwhile True:\n if k % 2 == 0:\n count = -1\n break\n\n elif seven % k == 0:\n count += 1\n break\n else:\n count += 1\n seven = seven * 10 + 7\n\nprint(count)', 'K = int(input())\n\nans = 1\nX = 7\ncnt = K\n\nfor _ in range(1000000):\n x = X % K\n if x == 0:\n print(ans)\n break\n else:\n ans += 1\n X = x*10 + 7\n\nif x != 0:\n print(-1)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s310066924', 's431740594', 's642787414', 's552919178']
[9088.0, 9112.0, 8972.0, 9204.0]
[2206.0, 26.0, 25.0, 262.0]
[164, 365, 236, 201]
p02596
u291460595
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['#200802C\nX = int(input())\nL = len(str(X))\n#print(L)\n\n\n\nfor l in range(L):\n Y += 7*10**l\n \nflag = 0\nfor i in range(10000000):\n Y = Y%X\n #print(i)\n\n if Y == 0:\n ans = L+i\n flag = 1\n break\n else: \n Z = Y * 10 + 7\n if Z == Y:\n break\n else:\n Y = Z\n\nif flag == 0:\n print("-1")\nelse:\n print(ans)\n', '#200802C\nX = int(input())\nL = len(str(X))\n#print(L)\n\n\nY = 0\n\nfor l in range(L):\n Y += 7*10**l\n \nflag = 0\nfor i in range(1000000):\n Y = Y%X\n #print(i)\n\n if Y == 0:\n ans = L+i\n flag = 1\n break\n else: \n Z = Y * 10 + 7\n if Z == Y:\n break\n else:\n Y = Z\n\nif flag == 0:\n print("-1")\nelse:\n print(ans)']
['Runtime Error', 'Accepted']
['s023546571', 's554501469']
[9192.0, 9164.0]
[25.0, 283.0]
[377, 381]
p02596
u301272559
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\n\nn = 17\nfor i in range(n):\n if i == n-1:\n print(-1)\n elif int(7 * (10 ** (i + 1) - 1 ) / 9) % K == 0:\n print(i+1)\n break\nprint (int(7 * (10 ** (i + 1) - 1 ) / 9))', 'K = int(input())\nif K % 2 == 0:\n print(-1)\nelse:\n m = 0\n for i in range(K):\n m = (m * 10 + 7) % K\n if m == 0:\n print(i+1)\n break\n elif i == K-1:\n print(-1)\n break']
['Wrong Answer', 'Accepted']
['s169213624', 's376537984']
[9112.0, 9144.0]
[29.0, 227.0]
[206, 236]
p02596
u309120194
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\n \ni, a = 0, 0\nl = []\nfor i in range(K):\n a = (10*a + 7) % K\n print(a)\n l.append(a)\n \nj, ans = 0, 0\nfor j in range(K):\n if l[j] == 0:\n ans = j\n break\n else: \n ans = -1\n\nprint(ans)', 'K = int(input())\n\ni, a = 0, 0\nl = []\nfor i in range(K):\n a = 10*a + 7\n l.append(a % K)\n \nj, ans = 0, 0\nfor j in range(K):\n if l[j] == 0:\n ans = j\n break\n else: \n ans = -1\n\nprint(ans)', 'K = int(input())\n\n\n\n\n\ni, a = 0, 0\nl = []\nfor i in range(K):\n a = (10*a + 7) % K\n l.append(a)\n\nj, ans = 0, -1\nfor j in range(K):\n if l[j] == 0:\n ans = j + 1\n break\n \nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s217324731', 's379722909', 's217350949']
[49688.0, 11268.0, 48344.0]
[624.0, 2206.0, 312.0]
[210, 196, 487]
p02596
u314089899
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\n\nif K%2 == 0:\n print(-1)\n\nsuretu = 7\ni = 1\nfor i in range(10**7 + 9):\n if suretu%K == 0:\n print(i)\n break\n else:\n i += 1\n suretu *= 10\n suretu += 7', 'K = int(input())\nremainder_set = set()\nsequence = 7\ni = 1\nfor i in range(10**7 + 9):\n if sequence%K == 0:\n print(i+1)\n break\n else:\n if sequence%K in emainder_set:\n print(-1)\n break\n else:\n i += 1\n sequence *= 10\n sequence += 7', 'K = int(input())\n\nif K%2 == 0:\n print(-1)\n\nsuretu = 7\ni = 1\nfor i in range(10**7 + 9)\n if suretu%K == 0:\n print(i)\n break\n else:\n i += 1\n suretu *= 10\n suretu += 7', 'K = int(input())\nremainder_set = set()\nsequence = 7\ni = 1\nfor i in range(K):\n remainder = sequence%K\n #print(sequence,remainder)\n if remainder == 0:\n print(i+1)\n break\n else:\n if remainder in remainder_set:\n print(-1)\n break\n else:\n i += 1\n remainder_set.add(remainder)\n sequence = remainder*10 + 7']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s092499200', 's500706264', 's516523361', 's627548435']
[9172.0, 9080.0, 8992.0, 77752.0]
[2206.0, 28.0, 22.0, 531.0]
[208, 316, 207, 393]
p02596
u314395569
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['def main():\n K = int(input())\n\n crawler = 7\n i = 1\n\n if (K % 2 ==0) or (K % 5 == 0):\n print(-1)\n else:\n a = [0 for i in range (K+1)]\n a[0] = 7\n for i in range (1, K+1):\n a[i] = (a[i-1]*10 + 7) % K\n for i in a:\n if i == 0:\n print(a.index(i) + 1)\n break\n return 0\n print(-1)\n\nmain()', 'K = int(input())\n\ncrawler = 7\ni = 1\n\nif (K % 2 ==0) or (K % 5 == 0):\n print(-1)\nelse:\n a = [0 for i in range (K+1)]\n a[0] = 7\n for i in range (1, K+1):\n a[i] = (a[i-1]*10 + 7) % K\n for i in a:\n if i == 0:\n print(a.index(i) + 1)\n break\nprint(-1)\n', 'def main():\n K = int(input())\n\n crawler = 7\n found = False\n i = 1\n\n if (K % 2 ==0) or (K % 5 == 0):\n print(-1)\n else:\n a = [0 for i in range (K+1)]\n a[0] = 7\n for i in range (1, K+1):\n a[i] = (a[i-1]*10 + 7) % K\n a[0] = a[0] % K\n for i in a:\n if i == 0:\n print(a.index(i) + 1)\n found = True\n break\n if not found:\n print(-1)\n \nmain()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s505833001', 's521298261', 's791210315']
[48448.0, 48460.0, 48308.0]
[236.0, 324.0, 237.0]
[400, 296, 480]
p02596
u327421986
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import sys\n\ninput = sys.stdin.readline\n\n#k = int(input())\nfor k in range(1, 100):\n if k == 7 or k == 1:\n print(k, 1)\n elif k % 2 == 0 or k % 5 == 0: print(k, -1)\n else:\n if k % 7 == 0: k = k // 7\n mod = 9*k\n i = 1;\n result = 10;\n while result != 1:\n result = (result * 10) % mod\n i += 1\n print(k, i)\n\n \n\n \n', 'import sys\n\ninput = sys.stdin.readline\nk = int(input())\nnum = 7%k\nsoln = False\nfor i in range(1, k+1):\n if num == 0: print(i); soln = 1; break\n num = ((((num%k) * (10%k))%k) + (7%k))%k\nif not soln: print(-1)\n \n\n \n']
['Wrong Answer', 'Accepted']
['s722007545', 's317798969']
[9076.0, 9140.0]
[31.0, 285.0]
[396, 229]
p02596
u330661451
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["def main():\n K = int(input())\n l = [False] * K\n ans = 1\n now = 0\n while True:\n now = now * 10 + 7\n now %= 7\n if now == 0:\n print(ans)\n break\n\n if l[now]:\n print(-1)\n break\n \n l[now] = True\n ans += 1\n\nif __name__ == '__main__':\n main()", "def main():\n K = int(input())\n l = [False] * K\n ans = 1\n now = 0\n while True:\n now = now * 10 + 7\n now %= K\n if now == 0:\n print(ans)\n break\n\n if l[now]:\n print(-1)\n break\n \n l[now] = True\n ans += 1\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s903961715', 's013683233']
[16676.0, 16748.0]
[34.0, 206.0]
[345, 345]
p02596
u345621867
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import math\nK = int(input())\nseven = int("7" * int(math.log10(K) + 1))\ncount = 1\nwhile True:\n if seven % K == 0:\n print(count)\n break\n count += 1\n seven = seven * 10 + 7', 'K = int(input())\na = [0] * 1000000000\na[1] = 7 % K\nfor i in range(2,K):\n a[i] = (a[i-1]*10 + 7) % K\nfor i in range(1,K):\n if a[i] == 0:\n print(i)\n exit()\nprint("-1")', 'K = int(input())\na = [0]\na[0] = 7 % K\nfor i in range(K):\n a.append((a[i]*10 + 7) % K)\n if a[i] == 0:\n print(i+1)\n exit()\nprint("-1")']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s721130997', 's811742747', 's088661346']
[9236.0, 8816.0, 48456.0]
[2205.0, 24.0, 284.0]
[192, 185, 152]
p02596
u350491208
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['L = int(input())\n\nfor K in range(1, L + 1, 2):\n \n ans = -1\n a = 0\n\n if K % 2 == 0:\n ans = -1\n elif K % 5 == 0:\n ans = -1\n else:\n for i in range(0, K):\n a = (10 * a + 7) % K\n if a == 0:\n ans = i + 1\n break\n print(ans)', 'L = int(input())\n\nfor K in range(1, L+1,2):\n \n ans = -1\n a = 0\n\n if K % 2 == 0:\n ans = -2\n elif K % 5 == 0:\n ans = -5\n else:\n for i in range(0, K):\n a = (10 * a + 7) % K\n # print("a", a)\n if a == 0:\n ans = i + 1\n break\n print("ans@K=", K, ans)', 'ans = -1\na = 0\nK = int(input())\nif K % 2 == 0:\n ans = -1\nelif K % 5 == 0:\n ans = -1\nelse:\n for i in range(0, K):\n a = (10 * a + 7) % K\n if a == 0:\n ans = i + 1\n break\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s236724992', 's491841385', 's520879649']
[9220.0, 9156.0, 9180.0]
[2206.0, 2206.0, 178.0]
[329, 370, 222]
p02596
u354174235
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['param_k = int(input())\n \n#param_k = 4\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(param_k + 10):\n n = 10*n + 7\n if n % 7 == 0:\n print(i+1)\n break\n if i == param_k + 10 - 1:\n print(-1)', 'param_k = int(input())\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(param_k + 10):\n n = 10*n + 7\n if n % param_k == 0:\n print(i+1)\n break\n else:\n n = n % param_k\n \n print(-1)', 'param_k = int(input())\n \n#param_k = 999983\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(1000000):\n n = 10*n + 7\n print(n)\n if n % param_k == 0:\n print(i+1)\n break\n if i == param_k + 10 - 1:\n print(-1)', 'param_k = int(input())\n\nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(param_k + 10):\n n = 10n + 7\n if n % 7 == 0:\n print(i+1)\n break\n if i == param_k + 10 - 1:\n print(-1)', 'param_k = int(input())\n \n#param_k = 999983\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(param_k + 10):\n n = 10*n + 7\n print(n)\n if n % param_k == 0:\n print(i+1)\n break\n if i == param_k + 10 - 1:\n print(-1)', 'param_k = int(input())\n \n#param_k = 999983\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(1000000):\n n = 10*n + 7\n print(n)\n if n % param_k == 0:\n print(i+1)\n break\n \n # print(-1)\n else:\n print(-1)', 'param_k = int(input())\n \n#param_k = 999983\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(1000000):\n n = 10*n + 7\n print(n)\n if n % param_k == 0:\n print(i+1)\n break\n else:\n n = n % param_k\n \n # print(-1)\n else:\n print(-1)', 'param_k = int(input())\n \nif param_k % 2 == 0:\n print(-1)\n \nelif param_k % 5 == 0:\n print(-1)\n \nelse:\n n=0\n for i in range(param_k + 10):\n n = 10*n + 7\n if n % param_k == 0:\n print(i+1)\n break\n else:\n n = n % param_k\n \n else:\n print(-1)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s044785765', 's272969215', 's378444296', 's409311571', 's553285422', 's630222430', 's707463406', 's718738853']
[9052.0, 9124.0, 35280.0, 8848.0, 33940.0, 35304.0, 10900.0, 8972.0]
[27.0, 225.0, 2241.0, 25.0, 2238.0, 2241.0, 547.0, 272.0]
[271, 263, 290, 250, 295, 314, 346, 273]
p02596
u363421241
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["k = int(input())\n\nif k == 2 or k == 5:\n print(-1)\n exit()\n\nfor i in range(1, 10**6):\n x = int('7'*i)\n if x % k == 0:\n print(i+1)\n exit()\n", 'k = int(input())\n\nmod = 7 % k\nfor i in range(1, 10**6):\n if mod == 0:\n print(i)\n exit()\n mod = (mod * 10 + 7) % k\n\nprint(-1)']
['Wrong Answer', 'Accepted']
['s384679646', 's082388577']
[9148.0, 9172.0]
[2206.0, 185.0]
[163, 144]
p02596
u367965715
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['print(-1)', 'k = int(input())\n\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\nelse:\n i = 1\n m = 7 % k\n while True:\n if m == 0:\n print(i)\n break\n m = (10 * m + 7) % k\n i += 1\n']
['Wrong Answer', 'Accepted']
['s152243576', 's437066723']
[9052.0, 9120.0]
[33.0, 203.0]
[9, 209]
p02596
u369133448
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\nans=-1\ns="7"\ncnt=1\nif k%2!=0 and k%5!=0:\n if k%3!=0:\n ans=k-1\n else:\n while int(s)%k!=0:\n s+="7"\n cnt+=1\n ans=cnt\nprint(ans)', 'k=int(input())\na=0\ncnt=-1\nfor i in range(1,k+1):\n a=(10*a+7)%k\n if a==0:\n cnt=i\n break\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s967751309', 's088341395']
[8940.0, 9168.0]
[2205.0, 182.0]
[160, 105]
p02596
u373047809
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k, R = int(input()), 1\nfor i in range(1, k+10):\n if not R:\n print(i)\n R = (R * 10 % 7 + 7) % k', 'k, R = int(input()), 1\nfor i in range(1, k+10):\n if R % k == 0:\n print(i)\n R = R * 10 + 7', 'k, R, a = int(input()), 7, -1\nfor i in range(1, k+1):\n if not R%k:\n a = i\n break\n R = (R * 10 + 7) % k\nprint(a)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s040190064', 's949208750', 's665868793']
[9104.0, 9192.0, 8960.0]
[171.0, 2206.0, 214.0]
[107, 102, 131]
p02596
u380791283
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['N=int(input())\nnum=0\nif (N%2==0)or(N%5==0):\n print(-1)\nelse:\n for i in range(1,N):\n num+=i*7\n if num%N==0:\n break\n print(i)', 'N=int(input())\nnum = 7\nplus = 70\ni=1\na=[]\nif (N%2==0)or(N%5==0):\n print(-1)\nelse:\n while num%N!=0:\n if num%N in a:\n i=-1\n break\n a.append(num%N)\n num+=plus\n plus*=10\n i+=1\n print(num)\n if i>N:\n i=-1\n break\n print(i)', 'N=int(input())\nnum = 7\nplus = 70\ni=1\na=[]\n\nwhile num%N!=0:\n b=num//N\n print(b*N,num%N)\n if num%N in a:\n i=-1\n break\n a.append(num%N)\n num+=plus\n plus*=10\n i+=1\n if i>N:\n i=-1\n break\nprint(i)', 'N=int(input())\nnum = 7\nplus = 70\ni=1\na=[]\n\nwhile num%N!=0:\n if num%N in a:\n i=-1\n break\n a.append(num%N)\n num+=plus\n plus*=10\n i+=1\n print(num)\n if i>N:\n i=-1\n break\nprint(i)', 'N=int(input())\nnum = 7\nplus = 70\ni=1\nif (N%2==0)or(N%5==0):\n print(-1)\nelse:\n s=str(N)\n array = list(map(int, s))\n keta=sum(array)\n while num%N!=0:\n num+=plus\n plus*=10\n i+=1\n print(num)\n if i>N:\n i=-1\n break\n print(i)', 'N=int(input())\nnum = 7\ni=1\na=[]\nprir1=1\nwhile i<=N:\n xx=num%N\n if xx==0:\n print(i)\n prir1=0\n break\n num=10*xx+7\n i+=1\nif prir1:\n print(-1)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s720520446', 's750547706', 's779033639', 's803432080', 's996936822', 's193677615']
[9140.0, 31096.0, 30528.0, 29936.0, 35276.0, 9168.0]
[228.0, 2235.0, 2234.0, 2237.0, 2241.0, 253.0]
[157, 317, 242, 223, 293, 174]
p02596
u382639013
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['x = int(input())\n\nng = np.array([2,4,5,6,8])\n\nimport numpy as np\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\na = prime_factorize(x)\n\nif len(set(a) & set(ng))>0:\n print(-1)\nelif len(set(a))== 1 and len(str(x))>3:\n nana = "7"*(x)\n while True:\n nana = nana[:len(nana)-1]\n if int(nana)%x ==0:\n break\n print(len(nana))\nelse:\n nana = "7"*(len(str(x)))\n while True:\n nana += "7"\n if int(nana)%x ==0:\n break\n print(len(nana))', 'k = int(input())\nif k==1 or k==7:\n print(1)\nelif k%2==0:\n print(-1)\nelse:\n cnt = 1\n pre = 7\n while(True):\n surp = (pre*10+7)%k\n cnt += 1\n if surp==0:\n break\n if cnt>1000000:\n cnt = -1\n break\n pre = surp\n print(cnt)']
['Runtime Error', 'Accepted']
['s639834042', 's969347190']
[9232.0, 9084.0]
[27.0, 255.0]
[719, 250]
p02596
u388971072
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["K = int(input())\nif(K%2==0):\n print(-1)\n exit()\ncheck=list(str(K))\nif(check[-1]=='5'):\n print(-1)\n exit()\nelse:\n seven=7\n if(int(''.join(['7']*(K-1)))%K==0):\n print(K-1)\n exit()\n while True:\n if(seven%K==0):\n print(len(str(seven)))\n break\n else:\n seven=seven*10+7\n\n", 'k = int(input())\nif(k%2==0 or k%5==0):\n print(-1)\n exit()\nelse:\n i=1\n seven=7%k\n while seven!=0:\n seven = (seven*10+7)%k\n print(seven)\n i+=1\n print(i)', 'k = int(input())\nif(k%2==0 or k%5==0):\n print(-1)\n exit()\nelse:\n i=1\n seven=7%k\n while seven!=0:\n seven = (seven*10+7)%k\n i+=1\n print(i)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s397897673', 's884334315', 's198972529']
[17840.0, 9944.0, 9088.0]
[2206.0, 475.0, 204.0]
[347, 189, 168]
p02596
u395202850
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["\nimport collections\n\n\ndef main():\n k = int(input())\n a = 0\n ans = 0\n for i in range(10000000):\n a = 10 * a + 7\n a %= k\n if a == 0:\n ans = i\n break\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "\nimport collections\n\n\ndef main():\n k = int(input())\n a = 0\n ans = -1\n for i in range(1, 2 * 10 ** 6):\n a = 10 * a + 7\n a %= k\n if a == 0:\n ans = i\n break\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s935315775', 's243553091']
[9428.0, 9452.0]
[1069.0, 237.0]
[257, 264]
p02596
u395672550
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nmo = 7\nmo = mo % k\nfor i in range(k + 1):\n if mo == 0:\n print(i + 1)\n break\n if mo != 0:\n mo = (mo*10 + 7) * k\nelse:\n print(-1)\n \n \n ', 'k = int(input())\nmo = 0\nfor i in range(1, k + 1):\n mo = mo * 10 + 7\n k = mo % k\n if mod == 0:\n print(i)\n break\nelse:\n print(-1)', 'k = int(input())\nmo = 7\nmo = mo % k\nfor i in range(1 , k + 1):\n if mo == 0:\n print(i)\n break\n if mo != 0:\n mo = (mo * 10 + 7) % k\nelse:\n print(-1)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s358859110', 's755922954', 's960128494']
[9556.0, 9112.0, 9120.0]
[2205.0, 22.0, 200.0]
[167, 153, 158]
p02596
u400147727
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nn = 0\nfrag = 0\nsevens = ""\n\nif k%2==1:\n print(-1)\n exit()\n\nwhile frag==0:\n sevens = sevens + "7"\n n+=1\n if int(sevens)%k==0 or n>1000000:\n frag=1\nprint(n)', 'k = int(input())\n\nx = 7\n\nfor i in range(k):\n if x%k==0:\n print(i+1)\n exit()\n x = (x*10 + 7)%k\nprint("-1")']
['Wrong Answer', 'Accepted']
['s141933285', 's521887912']
[9172.0, 9168.0]
[2206.0, 215.0]
[193, 125]
p02596
u402428218
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['num=int(input())\na=7\nflag=0\nfor i in range(num):\n a=(a*10+7)\n if a%num==0:\n print(i)\n flag=1\n break\n \nif flag==0:\n print("-1")', 'num=int(input())\na=7\nflag=0\nfor i in range(num):\n if a%num==0:\n print(i+1)\n flag=1\n break\n a=(a*10+7)%num\nif flag==0:\n print(-1)']
['Wrong Answer', 'Accepted']
['s848605663', 's588069173']
[9124.0, 9104.0]
[2206.0, 207.0]
[159, 158]
p02596
u402629484
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["import sys\nsys.setrecursionlimit(1000000000)\nimport math\nfrom math import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations, chain, product\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\nii = lambda: int(input())\nmis = lambda: map(int, input().split())\nlmis = lambda: list(mis())\nINF = float('inf')\nN1097 = 10**9 + 7\n\ndef meg(f, ok, ng):\n while abs(ok-ng)>1:\n mid = (ok+ng)//2\n if f(mid):\n ok=mid\n else:\n ng=mid\n return ok\n\ndef get_inv(n, modp):\n return pow(n, modp-2, modp)\n\ndef factorials_list(n, modp): # 10**6\n fs = [1]\n for i in range(1, n+1):\n fs.append(fs[-1] * i % modp)\n return fs\n\ndef invs_list(n, fs, modp): # 10**6\n invs = [get_inv(fs[-1], modp)]\n for i in range(n, 1-1, -1):\n invs.append(invs[-1] * i % modp)\n invs.reverse()\n return invs\n\ndef comb(n, k, modp):\n num = 1\n for i in range(n, n-k, -1):\n num = num * i % modp\n den = 1\n for i in range(2, k+1):\n den = den * i % modp\n return num * get_inv(den, modp) % modp\n\ndef comb_from_list(n, k, modp, fs, invs):\n return fs[n] * invs[n-k] * invs[k] % modp\n\n#\n\nclass UnionFindEx:\n def __init__(self, size):\n \n self.roots = [-1] * size\n def getRootID(self, i):\n r = self.roots[i]\n if r < 0: \n return i\n else:\n r = self.getRootID(r)\n self.roots[i] = r\n return r\n def getGroupSize(self, i):\n return -self.roots[self.getRootID(i)]\n def connect(self, i, j):\n r1, r2 = self.getRootID(i), self.getRootID(j)\n if r1 == r2:\n return False\n if self.getGroupSize(r1) < self.getGroupSize(r2):\n r1, r2 = r2, r1\n self.roots[r1] += self.roots[r2] \n self.roots[r2] = r1\n return True\n\nYes = 'Yes'\nNo = 'No'\n\n\n\ndef main():\n K = ii()\n n = 7%K\n s = set()\n for i in range(K+10):\n if n == 0:\n print(i)\n return\n n = (10*n + 7) % K\n if n in s:\n break\n s.add(n)\n print(-1)\n\n\n\n\n\n\nmain()\n\n", "import sys\nsys.setrecursionlimit(1000000000)\nimport math\nfrom math import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations, chain, product\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\nii = lambda: int(input())\nmis = lambda: map(int, input().split())\nlmis = lambda: list(mis())\nINF = float('inf')\nN1097 = 10**9 + 7\n\ndef meg(f, ok, ng):\n while abs(ok-ng)>1:\n mid = (ok+ng)//2\n if f(mid):\n ok=mid\n else:\n ng=mid\n return ok\n\ndef get_inv(n, modp):\n return pow(n, modp-2, modp)\n\ndef factorials_list(n, modp): # 10**6\n fs = [1]\n for i in range(1, n+1):\n fs.append(fs[-1] * i % modp)\n return fs\n\ndef invs_list(n, fs, modp): # 10**6\n invs = [get_inv(fs[-1], modp)]\n for i in range(n, 1-1, -1):\n invs.append(invs[-1] * i % modp)\n invs.reverse()\n return invs\n\ndef comb(n, k, modp):\n num = 1\n for i in range(n, n-k, -1):\n num = num * i % modp\n den = 1\n for i in range(2, k+1):\n den = den * i % modp\n return num * get_inv(den, modp) % modp\n\ndef comb_from_list(n, k, modp, fs, invs):\n return fs[n] * invs[n-k] * invs[k] % modp\n\n#\n\nclass UnionFindEx:\n def __init__(self, size):\n \n self.roots = [-1] * size\n def getRootID(self, i):\n r = self.roots[i]\n if r < 0: \n return i\n else:\n r = self.getRootID(r)\n self.roots[i] = r\n return r\n def getGroupSize(self, i):\n return -self.roots[self.getRootID(i)]\n def connect(self, i, j):\n r1, r2 = self.getRootID(i), self.getRootID(j)\n if r1 == r2:\n return False\n if self.getGroupSize(r1) < self.getGroupSize(r2):\n r1, r2 = r2, r1\n self.roots[r1] += self.roots[r2] \n self.roots[r2] = r1\n return True\n\nYes = 'Yes'\nNo = 'No'\n\n\n\ndef main():\n K = ii()\n n = 7%K\n s = set()\n for i in range(1, K+10):\n if n == 0:\n print(i)\n return\n n = (10*n + 7) % K\n if n in s:\n print(-1)\n return\n s.add(n)\n\n\n\n\n\n\nmain()\n\n"]
['Wrong Answer', 'Accepted']
['s435767241', 's225714994']
[78672.0, 78664.0]
[387.0, 386.0]
[2263, 2275]
p02596
u405534002
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\n\nif k % 2 == 0:\n print(-1)\nelif k % 5 == 0:\n print(-1)\nelse:\n if k % 7 == 0:\n l = k * 9 / 7\n else:\n l = k * 9\n \n tmp = 1\n for i in range(l):\n tmp = tmp * 10 % l\n if tmp == 1:\n flg == 1\n print(i+1)\n break\n \n if flg != 1\n \tprint(-1)', 'k = int(input())\n\nif k % 2 == 0:\n print(-1)\nelif k % 5 == 0:\n print(-1)\nelse:\n if k % 7 == 0:\n l = k * 9 / 7\n else:\n l = k * 9\n \n tmp = 1\n for i in range(l):\n tmp = tmp * 10 % l\n if tmp == 1:\n print(i+1)\n break\n print(-1)', 'K = int(input())\nmod = 7\nindex = 1\nflag = 0\n\nif K % 2 == 0:\n print(-1)\nelif K % 5 == 0:\n print(-1)\nelse: \n while(index<=K):\n mod=mod%K\n if mod==0:\n print(index)\n flag=1\n break\n mod=mod*10+7\n index+=1\n if flag==0:\n print(-1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s010357713', 's842537554', 's144546035']
[8996.0, 9028.0, 9176.0]
[27.0, 166.0, 258.0]
[286, 253, 280]
p02596
u405660020
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\nnum=k%7\nfor i in range(1, 10**7+1):\n if num%k==0:\n print(i)\n exit()\n else:\n num=(num*10+7)%k\nprint(-1)\n', 'k=int(input())\nnum=k%7\nfor i in range(1, 10**6+2):\n if num%k==0:\n print(i)\n exit()\n else:\n num=(num*10+7)%k\nprint(-1)\n', 'k=int(input())\nnum=7%k\nfor i in range(1, 10**7+1):\n if num%k==0:\n print(i)\n exit()\n else:\n num=(num*10+7)%k\nprint(-1)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s078852573', 's531549735', 's489325944']
[9132.0, 9152.0, 9196.0]
[1851.0, 220.0, 1809.0]
[145, 145, 145]
p02596
u406138190
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\ni=k\nif(k%2==0 or k%5==0):\n print(-1)\nwhile(1):\n if(7*(10**i-1)%(9*k)==0):\n break\n i-=1\nprint(i)', 'k=int(input())\ni=1\nwhile(1):\n if(7*(10**i-1)%9k==0):\n break\n i++\nprint(i)', 'K = int(input())\n\nt = 7\nfor i in range(K):\n if t % K == 0:\n print(i + 1)\n break\n t = (t * 10 + 7) % K\nelse:\n print(-1)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s041352392', 's209925515', 's209241348']
[10744.0, 8936.0, 9096.0]
[2206.0, 28.0, 209.0]
[126, 78, 141]
p02596
u408375121
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\nsieve = [True] * 10**6\nfor i in range(2, 10**6):\n if i <= 10**3 and sieve[i]:\n for j in range(i*i, 10**6, i):\n sieve[j] = False\n\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\nelse:\n if k == 7 or k == 1:\n print(1)\n else:\n if k % 7 == 0:\n k //= 7\n if sieve[k]:\n print(k-1)\n else:\n state = 10\n cnt = 1\n while True:\n if state % k == 1:\n print(cnt)\n break\n state *= 10\n cnt += 1\n ', 'k = int(input())\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\nelse:\n state = 7\n state %= k\n cnt = 1\n while True:\n if state == 0:\n print(cnt)\n break\n state = state * 10 + 7\n state %= k\n cnt += 1\n']
['Wrong Answer', 'Accepted']
['s051969315', 's449528174']
[16844.0, 9160.0]
[2206.0, 217.0]
[481, 216]
p02596
u408620326
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
["def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**6)\n K = int(input())\n if K % 2 == 0 or K % 5 == 0:\n print(-1)\n return True\n ans = 1\n K1 = K % 10\n t = K\n while t:\n # print(ans)\n for i in range(10):\n if (t + K1 * i) % 10 == 7:\n break\n else:\n ans = -1\n break\n t = t + K * i\n while t % 10 == 7:\n t //= 10\n ans += 1\n \n print(ans)\n\nif __name__ == '__main__':\n main()", "def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**6)\n K = int(input())\n if K % 2 == 0 or K % 5 == 0:\n print(-1)\n return True\n ans = 0\n K1 = K % 10\n t = K\n while t:\n # print(ans)\n for i in range(10):\n if (t + K1 * i) % 10 == 7:\n break\n else:\n ans = -1\n break\n t = t + K * i\n while t % 10 == 7:\n t //= 10\n ans += 1\n \n print(ans)\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s239697647', 's465936991']
[9132.0, 9108.0]
[755.0, 767.0]
[554, 554]
p02596
u411923565
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = input()\nK = int(K)\n\ndef seven():\n seven_i = 0\n count = 0\n for i in range(K):\n seven_i += (10**i*7)\n seven_i %= K\n count += 1\n print(seven_i)\n if seven_i % K == 0:\n return count\n return -1\n\nprint(seven())', 'K = input()\nK = int(K)\n\ndef seven():\n seven_i = 0\n count = 0\n for i in range(K):\n seven_i = ((10*seven_i) + 7) % K\n count += 1\n if seven_i % K == 0:\n return count\n return -1\n\nprint(seven())']
['Wrong Answer', 'Accepted']
['s800517986', 's208299747']
[9280.0, 9168.0]
[2206.0, 180.0]
[265, 233]
p02596
u413960612
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\nseven = 7\ncount = 0\n\nif(K % 2 == 0 or K % 5 == 0):\n print(-1)\nelse:\n while(seven % K != 0):\n count += 1\n seven += 7 * (10 ** count)\n print(count)\n\n if(count >= 1): \n print(count + 1)', 'K = int(input())\nseven = 0\ncount = 0\n\nif(K % 2 == 0 or K % 5 == 0):\n print(-1)\nelse:\n while(seven % K != 0):\n seven = (seven * 10 + 7) % K\n count += 1\n\n \n # count += 1\n # seven = seven + 7 * (10 ** count)\n\nif(count >= 1): \n print(count)', 'K = int(input())\nseven = 7\ncount = 0\n\nif(K % 2 == 0 or K % 5 == 0):\n print(-1)\nif(K == 7 or K == 1):\n print(1)\nelse:\n for i in range(1,10**6):\n seven = (seven * 10 + 7) % K\n if(seven % K == 0):\n print(i+1)\n break\n\n \n # count += 1\n # seven = seven + 7 * (10 ** count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s709861352', 's936595824', 's602496241']
[9264.0, 9164.0, 9192.0]
[2206.0, 25.0, 208.0]
[236, 351, 403]
p02596
u414050834
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k=int(input())\nans=1\ns_1=7%k\ns_2=10%k\nm=0\nj=0\nif k%2==0 or k%5==0:\n print(-1)\nelif k==1 or k==7:\n print(1)\nelse:\n i=0\n while j==0:\n m=(m+(s_1*(((s_2)**i)%k)))%k\n if m==0:\n j==1\n else:\n ans+=1\n i+=1\n print(ans)', '\nk=int(input())\nans=2\ns_1=7%k\ns_2=10%k\nm=0\nj=0\nif k%2==0 or k%5==0:\n print(-1)\nelif k==1 or k==7:\n print(1)\nelif k%7==0:\n l=9*k/7\n s=10%l\n while j==0:\n m=(m+s_1*(s-1))%l\n if m==0:\n j==1\n else:\n ans+=1\n s=(s*10)%l\n print(ans)\nelse:\n l=9*k\n i=0\n while j==0:\n m=(m+s_1*(s-1))%l\n if m==0:\n j==1\n else:\n ans+=1\n s=(s*10)%l\n print(ans)\n', 'k=int(input())\nans=2\ns_1=7%k\nm=0\nj=0\nif k%2==0 or k%5==0:\n print(-1)\nelif k==1 or k==7:\n print(1)\nelif k%7==0:\n l=9*k/7\n i=0\n while j==0:\n m=(m+s_1*(((s_2**i)%l-1)%l))%l\n if m==0:\n j==1\n else:\n i+=1\n ans+=1\n print(ans)\nelse:\n l=9*k\n s=10%k\n while j==0:\n m=(m+s_1*s)\n if m==0:\n j==1\n else:\n i+=1\n ans+=1\n s=(10*s)%k\n print(ans)\n', 'k=int(input())\nans=1\ns_1=7%k\ns_2=10%k\nm=0\nj=0\nif k%2==0 or k%5==0:\n print(-1)\nelif k==1 or k==7:\n print(1)\nelif k%7==0:\n l=9*k/7\n i=0\n while j==0:\n m=(m+s_1*(((s_2**i)%l-1)%l))%l\n if m==0:\n j==1\n else:\n i+=1\n ans+=1\n print(ans)\nelse:\n l=9*k\n i=0\n while j==0:\n m=(m+s_1*(((s_2**i)%l-1)%l))%l\n if m==0:\n j==1\n else:\n i+=1\n ans+=1\n print(ans)', 'k=int(input())\nm=0\nfor i in range(k):\n m=(m*10+7)%k\n if m==0:\n break\n elif i==k-1:\n print(-1)\n exit()\nprint(i + 1)\n']
['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s295036508', 's497208055', 's525420507', 's552978991', 's818439594']
[9188.0, 9184.0, 9124.0, 9204.0, 9140.0]
[2206.0, 2206.0, 30.0, 2205.0, 233.0]
[238, 388, 390, 397, 127]
p02596
u423389475
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['import sys\nk = int(input())\nfor i in range(k+1):\n d = 7\n d = (10*d) + 7\n d %= k\n if d == 0:\n print(i+1)\n sys.exit()\nprint(-1)', 'k = int(input())\ni = 1\nif a%2 ==1:\n while True:\n s = 0\n for j in range(i):\n s += (10**j)*7\n if s % k == 0:\n print(i)\n break\n i += 1\nelse:\n print(-1)', 'import sys\nk = int(input())\nd = 0\nfor i in range(k+1):\n d = (10*d) + 7\n d %= k\n if d == 0:\n print(i+1)\n sys.exit()\nprint(-1)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s049912364', 's111829527', 's787657331']
[9080.0, 9168.0, 9124.0]
[194.0, 27.0, 210.0]
[135, 215, 133]
p02596
u427231601
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['k = int(input())\na = 0\nfor i in range(10**6):\n a += 7*(10**i)\n if a%k == 0:\n print(i)\n exit()\n\n \nprint(-1)', 'k = int(input())\nmod = 7\ncnt = 1\nfor i in range(k):\n if mod % k == 0:\n break\n cnt += 1\n mod = (10*mod + 7) % k\nif mod % k == 0:\n print(cnt)\nelse:\n print(-1)']
['Wrong Answer', 'Accepted']
['s516882798', 's939840212']
[9168.0, 9172.0]
[2206.0, 269.0]
[127, 178]
p02596
u427623367
2,000
1,048,576
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead.
['K = int(input())\na1 = 7\nai = 0\nfor i in range(K + 1):\n ai = a1 % K\n a1 = (a1 * 10 + 7)\n if ai == 0:\n break\n \nprint(i + 1)', 'K = int(input())\na1 = 7\nai = 0\nfor i in range(K + 1):\n if i == 0:\n ai = a1 % K\n else:\n ai = (ai * 10 + 7) % K\n if ai == 0:\n break\nelse:\n i = -2\nprint(i + 1)']
['Runtime Error', 'Accepted']
['s370723093', 's361722990']
[8936.0, 9080.0]
[27.0, 214.0]
[145, 171]