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
|
---|---|---|---|---|---|---|---|---|---|---|
p02596 | u430395207 | 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())\nseven = 7\nwhile N % 2 == 1:\n print(seven)\n if seven % N == 0:\n print(len(str(seven)))\n exit()\n seven = seven * 10 + 7\nprint(-1)', 'K = int(input())\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\n exit()\n\nstart = j = 7 % K\ncount = 1\n\n\nwhile True:\n \n if j == 0:\n print(count)\n exit()\n \n j = 10 * j + 7\n j = j % K\n count += 1\n \n \n if j == start:\n print(-1)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s691857746', 's302843835'] | [33932.0, 8956.0] | [2239.0, 273.0] | [167, 361] |
p02596 | u432295780 | 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. | ['pos = 0\ncurr = 7\nk = int(input())\nwhile true:\n pos += 1\n if curr % k == 0:\n break\n else : \n k *= 10\n k += 7\nprint(pos)', 'pos = 1\ncurr = 7\nk = int(input())\nwhile curr % k != 0:\n pos += 1\n k *= 10\n k += 7\nprint(pos)', 'pos = 0\ncurr = 7\nk = int(input())\nwhile true:\n pos += 1\n if curr % k == 0:\n break\n else : \n k = k*10 \n k += 7\nprint(pos)', 'k=int(input())\nx=7\nfor i in range(1,k+1):\n if x%k==0:\n print(i)\n break\n x=(x*10+7)%k\nelse:\n print(-1)'] | ['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s252196667', 's281864264', 's787024494', 's861637054'] | [8892.0, 9192.0, 8948.0, 9104.0] | [27.0, 2205.0, 25.0, 207.0] | [130, 95, 132, 110] |
p02596 | u444560129 | 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(h):\n count = 1\n n = 0\n if i in range (k):\n n = (n * 10 + 7) % k \n if n == 0:\n break \n print(count)\n return 0\n count += 1\n print(-1)\n \nif __name__ == '__main__':\n\tk = int(input())\n main(k)", "def main(h):\n count = 1\n n = 0\n for i in range (k):\n n = (n * 10 + 7) % k \n if n == 0: \n print(count)\n return 0\n count += 1\n print(-1)\n \nif __name__ == '__main__':\n k = int(input())\n main(k)"] | ['Runtime Error', 'Accepted'] | ['s348583791', 's786083962'] | [8820.0, 9172.0] | [26.0, 156.0] | [229, 217] |
p02596 | u446312507 | 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\n\n for i in range(K+1):\n if int(S) % K != 0:\n S = S * 10 + 7\n else:\n print(i+1)\n break\n\n if i >= K:\n print('-1')\n", "K = input()\nS = 7\ni = 1\nif (1 <= K) and (K <= (10 ** 6)):\n while True:\n if int(S) % K != 0:\n S = S * 10 + 7\n i += 1\n else:\n print(i)\n break\n\n if i > K:\n print('-1')\n break", 'K = input()\nS = 7\ni = 1\nif (1 <= K) and (K <= (10 ** 6)):\n while True:\n if int(S) % K != 0:\n S = S * 10 + 7\n i += 1\n else:\n print(i)\n break\n\n if i > K:\n print(-1)\n break', 'K = int(input())\nif K % 2 == 0:\n print(-1)\nelif K % 5 == 0:\n print(-1)\nelse:\n S = 7\n for i in range(K+1):\n if S % K == 0:\n print(i+1)\n break\n else:\n S = S % K\n S = S * 10 + 7\n else:\n print(-1)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s454519130', 's864114495', 's900694679', 's766262584'] | [9000.0, 9108.0, 9108.0, 9044.0] | [27.0, 28.0, 26.0, 242.0] | [195, 261, 259, 273] |
p02596 | u447679353 | 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\npowlis = [pow(10, i, K) for i in range(K)]\nfor i in range(K-1):\n powlis[i+1] = (powlis[i] + powlis[i+1]) % K\n \nprint(lis[0:10])\nif 0 in lis:\n print(lis.index(0)+1)\nelse:\n print(-1)', 'K = int(input())\n\npowlis = [pow(10, i, K) for i in range(K)]\nfor i in range(K-1):\n powlis[i+1] = (powlis[i] + powlis[i+1]) % K\n\nlis = [(7 *powlis[i])%K for i in range(K) ]\n\nif 0 in lis:\n print(lis.index(0))\nelse:\n print(-1)', 'K = int(input())\n\npowlis = [7*pow(10, i, K) for i in range(K)]\nfor i in range(K-1):\n powlis[i+1] = (powlis[i] + powlis[i+1]) % K\npowlis[0] %= K\n\n\ntry:\n print(powlis.index(0) + 1)\nexcept:\n print(-1)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s370408274', 's447026923', 's862865067'] | [48468.0, 88060.0, 48504.0] | [1872.0, 2055.0, 1871.0] | [210, 233, 206] |
p02596 | u449352114 | 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(" "))\n\nif K%2==0 or K%5==0:\n print(-1)\nelif K==1 or K==7:\n print(1)\nelse:\n B = 7\n i = 1\n while 1:\n if B%K==0:\n print(i)\n break\n else:\n B = 10 * B + 7\n i = i + 1', '\n\nK= int(input(" "))\n\nB= 7\n\nif K%2==0 or K%5==0:\n print(-1)\nelif K==1 or K==7:\n print(1)\nelse:\n i = 1\n while 1:\n i= i+1\n B = 10*B + 7\n if B%K==0:\n print(i)\n break', '\nK= int(input(" "))\n#B= 7\ni= 1\n\nif K%2==0 or K%5==0:\n print(-1)\nelif K==1 or K==7:\n print(1)\nelse:\n while 1:\n i = i + 1\n C= 10**i-1\n #B = 10 * B + 7\n\n if C%(9*K)==0:\n print(i)\n break', '\nK= int(input())\n\nif K%2==0 or K%5==0:\n print(-1)\nelif K==1 or K==7:\n print(1)\nelse:\n B = 7\n i = 1\n while 1:\n if B==0:\n print(i)\n break\n else:\n B = (10 * B + 7) % K\n i = i + 1'] | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s306308464', 's586592329', 's836735166', 's683939733'] | [9176.0, 9220.0, 9152.0, 9160.0] | [2206.0, 2206.0, 2206.0, 197.0] | [297, 267, 291, 298] |
p02596 | u455533363 | 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\nans = -1\nmemo = 7 % k\n\nfor i in range(k):\n if a == 0:\n ans = a+1\n break\n a = (10*k+7) % k\nprint(ans)\n', 'k = int(input())\n\nans = -1\nmemo = 7 % k\n\nfor i in range(k):\n if a == 0:\n ans = i+1\n break\n a = (10*k+7) % k\nprint(ans)\n', 'k = int(input())\n\nans = -1\nmemo = 7 % k\na = 7 % k\nfor i in range(k):\n if a == 0:\n ans = i+1\n break\n a = (10*a+7) % k\nprint(ans)\n\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s124357883', 's539979332', 's348486955'] | [9112.0, 9096.0, 9120.0] | [26.0, 30.0, 185.0] | [139, 139, 149] |
p02596 | u459521923 | 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\nfor i in range(1, k+1):\n n = (n * 10 + 7) % k\n if n == 0:\n print(i)\n break\nprint('-1')\n", "k = int(input())\nn = 0\nfor i in range(1, k+1):\n n = (n * 10 + 7) % k\n if n == 0:\n print(i)\n exit()\nprint('-1')"] | ['Wrong Answer', 'Accepted'] | ['s036003920', 's516939275'] | [9064.0, 9184.0] | [207.0, 176.0] | [130, 130] |
p02596 | u459965464 | 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())\nst = input()\n\nr = st.count("R")\n\ncount = 0\n\nfor i in range(r):\n if st[i]=="W":\n count += 1\n\nprint(count)\n \n\n \n', 'n = int(input())\nst = input()\n\nr = st.count("R")\n\ncount = 0\n\nfor i in range(r):\n if st[i]=="W":\n count += 1\n\nprint(count)\n \n\n \n', 'k = int(input())\nm = 7%k\n\nfor i in range(1, 10**6+1):\n if m == 0:\n print(i)\n exit()\n else:\n m = (10 * m + 7) % k\n\nprint(-1)\n \n \n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s424503602', 's981483297', 's340861697'] | [9080.0, 9080.0, 9152.0] | [24.0, 26.0, 189.0] | [155, 155, 165] |
p02596 | u475966842 | 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())\nmod7 = 7%k\nmod10= 10%k\n\nmod = mod7\nmod10times = mod7\n\nif mod%k==0:\n print(1)\n\nfor i in range(2,1000000):\n mod10times = mod10times*mod10%k\n mod = mod10times+mod%k\n \n if mod%k==0:\n print(i)\n break\n \nprint(-1)', 'k=int(input())\nmod7 = 7%k\nmod10= 10%k\n\nmod = mod7\nmod10times = mod7\n\nif mod%k==0:\n print(1)\n\nfor i in range(2,2000000):\n mod10times = mod10times*mod10%k\n mod = mod10times+mod%k\n \n if mod%k==0:\n print(i)\n break\n \nprint(-1)', 'k=int(input())\nmod7 = 7%k\nmod10= 10%k\n\nmod = mod7\nmod10times = mod7\n\nif mod%k==0:\n print(1)\nelse:\n\n for i in range(2,2000000):\n mod10times = mod10times*mod10%k\n mod = mod10times+mod%k\n\n if mod%k==0:\n break\n\n if i==1999999:\n print(-1)\n else:\n print(i)\n '] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s559934586', 's590078900', 's359599082'] | [9116.0, 9188.0, 9012.0] | [338.0, 594.0, 597.0] | [258, 258, 318] |
p02596 | u476386869 | 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\ninput - sys.stdin.readline\ndef main():\n K = int(input())\n \n if K%2==0:\n print(-1)\n return\n \n if K % 7:\n L = 9*K\n else:\n L = 9*K//7\n a = 1\n for i in range(1,K+10):\n a = (a * 10) % L\n if a == 1:\n print(i)\n return\n print(-1)\nmain()', 'import sys\ninput = sys.stdin.readline\n\ndef main():\n K = int(input())\n \n if K%2==0 or K%5==0:\n print(-1)\n return\n \n if K % 7:\n L = 9*K\n else:\n L = 9*K//7\n a = 1\n for i in range(1,K+10):\n a = (a * 10) % L\n if a == 1:\n print(i)\n return\n print(-1)\nmain()\n'] | ['Runtime Error', 'Accepted'] | ['s256831310', 's335599839'] | [9120.0, 9128.0] | [24.0, 109.0] | [330, 342] |
p02596 | u478417863 | 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())\nf=-1\na=7\nfor i in range(1000000):\n a=(a*10+7)%k\n print(a)\n if a==0:\n print(a)\n f=i+2\n break\nprint(f)', 'k=int(input())\nf=-1\nfor i in range(1,1000):\n s=k*i\n l=len(str(s))\n d=0\n for i in range(l):\n if str(s)[i]!=7:\n d=d+1\n break\n if d<=0:\n f=l\nprint(f)', 'k=int (input())\nf=-1\na=7\nfor i in range(1000000):\n a=(a*10+7)%k\n if a==0:\n f=i+2\n break\nif k==7 or k==1:\n f=1\nprint(f)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s162764902', 's478046484', 's969445506'] | [9956.0, 9140.0, 9168.0] | [472.0, 33.0, 181.0] | [146, 197, 141] |
p02596 | u486646943 | 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\na = [0]*1000001\nans = -1\na[1] = 7%K\n\nfor i in range(2,K+1):\n a[i] = (10*a[i-1]+7)%K\nfor i in range(K+1):\n if a[i] == 0:\n ans = i\n print(i)\n break\nif ans == -1:\n print(-1)\n', 'K = int(input())\n\na = [0]*1000001\nans = -1\na[1] = 7%K\n\nfor i in range(2,K+1):\n a[i] = (10*a[i-1]+7)%K\nfor i in range(1,K+1):\n if a[i] == 0:\n ans = i\n print(i)\n break\nif ans == -1:\n print(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s993965624', 's046757298'] | [48400.0, 48476.0] | [258.0, 323.0] | [220, 222] |
p02596 | u490489966 | 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. | ['#C\nimport sys\nk=int(input())\na=7\nfor i in range(k):\n if a%k==0:\n print(i)\n sys.exit()\n a=a*10+7\nprint(-1)', '#C\n\n\n\nimport sys\nk=int(input())\nif k%7==0:\n k//=7\nk*=9\na=10%k\nfor i in range(k):\n a=a%k\n if a==1:\n print(i+1)\n sys.exit()\n a*=10\nprint(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s126477781', 's784241527'] | [9100.0, 9048.0] | [2205.0, 1465.0] | [125, 349] |
p02596 | u501364195 | 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\nnum=[7,77,777,7777,77777,777777]\nfor i in num:\n if i%K==0:\n print(i)\n a = 1\n break\n\nif a==0:\n print(-1)', 'K = int(input())\nif K==7 or K==1:\n print(1)\nelse:\n count = 1\n for i in range(K):\n x = (x % K) * 10 + 7\n count += 1\n if x==0:\n print(count)\n if x!=0:\n print(-1)', 'K = int(input())\nif K==7 or K==1:\n print(1)\nelse:\n count = 1\n x = 7%K\n for i in range(K):\n x = (x*10+7)%K\n count += 1\n if x==0:\n print(count)\n break\n if x!=0:\n print(-1)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s868448259', 's964195243', 's973602835'] | [9168.0, 9176.0, 9092.0] | [26.0, 28.0, 225.0] | [137, 180, 196] |
p02596 | u501451051 | 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\nans = 1\nmod = 7\n\nfor i in range(k):\n if mod % 7 == 0:\n break\n ans += 1\n mod = (mod * 10 + 7) % k\n\nif mod % k == 0:\n print(ans)\nelse:\n print(-1)', 'k = int(input())\n\nans = 1\nmod = 7\n\nfor i in range(k):\n if mod % k == 0:\n break\n ans += 1\n mod = (mod * 10 + 7) % k\n\nif mod % k == 0:\n print(ans)\nelse:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s253578620', 's540906151'] | [9096.0, 9096.0] | [32.0, 256.0] | [183, 183] |
p02596 | u503111914 | 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\n\nif K % 7 == 0:\n for i in range(K):\n if 10 ** i % (9 * K / 7) == 1:\n ans = i\n break\nelse:\n for i in range(K):\n if 10 ** i % (9 * K) == 1:\n ans = i\n break\n \nprint(ans)', 'import sys\nK=int(input())\nL=9*K\nif L%7==0:\n L = L//7\nn = 1\nfor i in range(1,K+1):\n n = n * 10 % L\n if n == 1:\n print(i)\n sys.exit()\nprint(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s907147224', 's965484839'] | [9192.0, 8872.0] | [26.0, 163.0] | [221, 151] |
p02596 | u514334797 | 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\nnum = 0\ncnt = 0\nans = False\n\nfor i in range(K):\n num = num*10+7\n cnt += 1\n if num % K == 0:\n print(cnt)\n ans = True\n\nif ans == False:\n print(-1) ', 'K = int(input())\n\nnum = 0\ncnt = 0\nans = -1\n\nfor i in range(K):\n num = num*10 +7\n cnt += 1\n if num%K != 0:\n num = num%K\n else:\n ans = cnt\n break\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s000880307', 's799377891'] | [9044.0, 9148.0] | [2206.0, 273.0] | [190, 192] |
p02596 | u517389396 | 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\nD=7\nfor i in range(10000000):\n if D%K==0:\n print(i)\n break\n# print(D)\n D=D*10+7\n D%=K\nelse:\n print(-1)\n', 'K=int(input())\n\nD=7\nfor i in range(1000000):\n if D%K==0:\n print(i+1)\n break\n# print(D)\n D=D*10+7\n D%=K\nelse:\n print(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s848403717', 's541008089'] | [9148.0, 9148.0] | [2205.0, 252.0] | [148, 149] |
p02596 | u517797706 | 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. | ["if __name__ == '__main__':\n\n\tk = int(input())\n\tx = 1\n\tfor i in range(10**6):\n\t\tif x == 0:\n\t\t\tprint(i)\n\t\t\texit()\n\t\tx = (10 * x + 7) % k\n", "if __name__ == '__main__':\n\n\tk = int(input())\n\tx = 0\n\tfor i in range(10**6):\n\t\tx = (10 * x + 7) % k\n\t\tif x == 0:\n\t\t\tprint(i+1)\n\t\t\texit()\n\tprint(-1)\n"] | ['Wrong Answer', 'Accepted'] | ['s810423204', 's146160318'] | [9100.0, 9092.0] | [191.0, 177.0] | [135, 148] |
p02596 | u527977536 | 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\ni = 1\nfor i in range(0,k+1):\n if x==0:\n print(i)\n break \n \n l.append(x)\n x = (x*10+7)%k\n i += 1', "k = int(input())\nx = 7%k\ni = 1\nfor i in range(0,k+1):\n if x==0:\n break \n x = (x*10+7)%k\n i += 1\n \nif x == 0:\n print(i)\nelse:\n print('-1')", "k = int(Input)\nx = 7%k\nl = []\ni = 1\nwhile(True):\n if x in l:\n print('-1')\n break\n if x==0:\n print(i)\n break \n \n l.append(x)\n x = (x*10+7)%k\n i += 1", "k = int(input())\nx = 7%k\ni = 1\nfor i in range(1,k+1):\n if x==0:\n break \n x = (x*10+7)%k\n i += 1\n \nif x == 0:\n print(i)\nelse:\n print('-1')"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s475445906', 's603679252', 's794316637', 's969335347'] | [9172.0, 9124.0, 9056.0, 9100.0] | [26.0, 224.0, 25.0, 222.0] | [156, 165, 200, 165] |
p02596 | u536642030 | 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\nt = 7\nfor i in range(k):\n if t % k == 0:\n print(i + 1)\n break\n else:\n t = (t * 10 + 7) % k\nprint('-1')", "k = int(input())\n\nt = 7\nflag = True\nfor i in range(k):\n if t % k == 0:\n print(i + 1)\n flag = False\n break\n else:\n t = (t * 10 + 7) % k\nif flag:\n print('-1')"] | ['Wrong Answer', 'Accepted'] | ['s421877693', 's542360663'] | [9168.0, 9084.0] | [205.0, 212.0] | [131, 171] |
p02596 | u537142137 | 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 = 1\nx = 7\n\n\nif K % 2 == 0:\n peint( -1 )\n exit( 0 )\n#\n\nwhile 1:\n if x % K == 0:\n print( n )\n break\n x = (x % K) * 3 + 7\n n += 1\n#\n', 'K = int(input())\n\nn = 1\nx = 7\n\n\nif K % 2 == 0:\n print( -1 )\n exit( 0 )\n#\n\nwhile 1:\n if x % K == 0:\n print( n )\n break\n x = (x % K) * 3 + 7\n n += 1\n#\n', 'K = int(input())\n\nn = 1\nx = 7\n\n\nif (K % 2 == 0)or(K % 5 == 0):\n print( -1 )\n exit( 0 )\n#\n\nwhile 1:\n if x % K == 0:\n print( n )\n break\n x = (x * 10 + 7) % K\n n += 1\n#\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s245406256', 's590157834', 's592144508'] | [9124.0, 9160.0, 9180.0] | [2205.0, 2206.0, 220.0] | [160, 160, 177] |
p02596 | u543000780 | 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 = 1\na = 7\nif k % 2 == 0:\n print("-1")\n return\nwhile a % k != 0:\n i += 1\n a = 10*a + 7\n if i == 10**9+7:\n i = -1\n break\n\nprint(i)\n \n', 'k = int(input())\ni = 1\na = 7\na = a % k\nwhile a != 0:\n i += 1\n a = (10*a + 7) % k\n if i == 10**6:\n i = -1\n break\n\nprint(i)\n'] | ['Runtime Error', 'Accepted'] | ['s493278873', 's340582668'] | [9092.0, 8932.0] | [25.0, 217.0] | [162, 131] |
p02596 | u550091708 | 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\nn7 = 0\n \nfor i in range(6):\n n7 += 7*(10**(i))\n print(n7)\n if n7 % N == 0:\n print(i+1)\n break\n if i == 5:\n print(-1)\n \n', 'N = int(input())\n\nn7 = 0\n \nfor i in range(6):\n n7 += 7*(10**(i))\n print(n7)\n if n7 % N == 0:\n print(i+1)\n break\n if i == 5:\n print(-1)\n break\n \n', 'N = int(input())\n\nN = 2\n \nn7 = 0\n \nfor i in range(6):\n n7 += 7*(10**(i))\n if n7 % N == 0:\n print(i+1)\n break\n \n if i == 6:\n print(-1)\n \n', 'K = int(input())\n\nx = []\nx.append(7%K)\nfor i in range(1,K):\n x.append((x[i-1]*10+7)%K)\n \nfor i in range(K):\n if x[i]==0:\n print(i+1)\n exit()\n \nprint(-1)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s060560002', 's766902672', 's918753849', 's730059700'] | [9144.0, 9124.0, 9160.0, 48508.0] | [28.0, 29.0, 28.0, 332.0] | [153, 163, 152, 164] |
p02596 | u555311916 | 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\nimport fractions\n\nflag = False\n\nfor i in range(n):\n f = fractions.gcd(k,(10**n-1)/9*7)\n if f == k:\n flag = True\n break\n\nif flag:\n print(i+1)\nelse:\n print(-1)', 'k = int(input())\n\nflag = False\n\nresid = 7\nif resid%k==0:\n i = -1\n flag = True\nelse:\n for i in range(k):\n resid = (resid*10+7)%k\n if resid == 0:\n flag = True\n break\n\nif flag:\n print(i+2)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s030344350', 's359326009'] | [10440.0, 9180.0] | [128.0, 181.0] | [201, 254] |
p02596 | u556594202 | 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())\nrw = list(input())\n\nrw_after=sorted(rw)\n\ncount=0\nfor i in range(N):\n if rw[i] != rw_after[i]:\n count+=1\nprint(int(count/2))\n', 'K = int(input())\nrest = 7%K\ncount=1\nwhile (count<=K):\n if rest == 0:\n print(count)\n exit()\n count +=1\n rest = (rest%K*10 + 7)%K\nprint(-1)'] | ['Runtime Error', 'Accepted'] | ['s391490623', 's650443041'] | [9140.0, 8992.0] | [29.0, 264.0] | [151, 160] |
p02596 | u559250296 | 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\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\npn=factorization(k)\n\ngo =0\nketa = len(str(k))\nsevens = []\n\nif k % 2 == 0 or k %5 == 0:\n print(-1)\n break\nelif str(k)[-1] == "3":\n for i in range(9,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "7":\n for i in range(1,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "9":\n for i in range(3,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "1":\n for i in range(7,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\n\n', 'k = int(input())\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\npn=factorization(k)\n\ngo =0\nketa = len(str(k))\nsevens = []\n\nif k % 2 == 0 or k %5 == 0:\n print(-1)\nelif str(k)[-1] == "3":\n for i in range(9,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "7":\n for i in range(1,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "9":\n for i in range(3,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "1":\n for i in range(7,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i)):\n continue\n else:\n print(str(k * i).count(\'7\'))\n\n', 'k = int(input())\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\npn=factorization(k)\n\ngo =0\nketa = len(str(k))\nsevens = []\n\nif k % 2 == 0 or k %5 == 0:\n print(-1)\n break\nelif str(k)[-1] == "3":\n for i in range(9,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i))\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "7":\n for i in range(1,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i))\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "9":\n for i in range(3,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i))\n continue\n else:\n print(str(k * i).count(\'7\'))\nelif str(k)[-1] == "1":\n for i in range(7,10**100000,10):\n if not str(k * i).count(\'7\') == len(str(k*i))\n continue\n else:\n print(str(k * i).count(\'7\'))\n\n', 'k = int(input())\n\ngo = 0\nketa = len(str(k))\n\nfor i in range(10**1000000):\n if k % 2 ==0:\n print(-1)\n break\n if k % 5==0:\n print(-1)\n break\n else:\n go =(go*10+7) %k\n if go ==0:\n print(i+1)\n break\n'] | ['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s377699470', 's633982631', 's916526600', 's115364105'] | [9232.0, 9636.0, 9092.0, 11232.0] | [24.0, 2206.0, 27.0, 507.0] | [1251, 1241, 1247, 269] |
p02596 | u559315737 | 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=0\nif k%2==0:\n print(-1)\n exit\nfor i in range(1000000):\n x=(10*x+7)%K\n if x==0:\n print(i+1)\n exit\nif x!=0:\n print(-1)', 'from math import gcd\nK=int(input())\nif K%7==0:\n K=K//7\nif gcd(10,K)!=1:\n print(-1)\n return\nx=1%K\ncnt=1\nwhile x!=0:\n x=(10*x+1)%K\n cnt+=1\nprint(cnt)', 'K=int(input())\nx=0\nif k%2==0:\n print(-1)\n exit\nfor i in range(1000000):\n x=(10*x+7)%K\n if x==0:\n print(i+1)\n break\nif x!=0:\n print(-1)', 'K=int(input())\nx=0\nif K%2==0:\n print(-1)\n exit\nfor i in range(1000000):\n x=(10*x+7)%K\n if x==0:\n print(i+1)\n exit\nif x!=0:\n print(-1)', 'from math import gcdnbv\nK=int(input())\nif K%7==0:\n K=K//7\nif gcd(10,K)!=1:\n print(-1)\n return\nx=1%K\ncnt=1\nwhile x!=0:\n x=(10*x+1)%K\n cnt+=1\nprint(cnt)\n', 'K=int(input())\ncnt=0\nans=0\nwhile cnt<1000001:\n cnt+=1\n ans=(ans*10+7)%K\n if ans==0:\n print(cnt)\n break\nelse:\n print(-1)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s073577693', 's096521229', 's352066190', 's887643117', 's890446249', 's192076700'] | [9068.0, 9028.0, 9124.0, 9944.0, 9112.0, 9160.0] | [26.0, 22.0, 24.0, 469.0, 25.0, 227.0] | [144, 152, 145, 144, 156, 130] |
p02596 | u563838154 | 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. | ['\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\nk = int(input())\n# if k%2==0 or k%5==0:\n# print(-1)\n# else:\n\n# k_ = k\n# if not 7 in se:\n# k_ = k*7\n\n# K = int(str(k_)[-1])\n\n# if K==1:\n# # print("a")\n# x = 7\n# elif K==3:\n# x=9\n# elif K==7:\n# x = 1\n# elif K==9:\n# x = 3\n\n# # print(x)\n# while True:\n\n\n# # print(q)\n# if str(q)=="7"*len(str(q)):\n# print(len(str(q)))\n# break\n\n\n# # break\n\nsen = []\nfor i in range(1,k*3):\n s =int("7"*i)\n sen += prime_factorize(s)\nsen = set(sen)\n\nz = prime_factorize(k)\nm = True\nfor i in z:\n if i in sen:\n m = False\nif k%2==0 or k%5==0:\n print(-1)\nelif m:\n print(k-1)\nelse:\n w = len(str(k))\n \n while True:\n s = "7"*w\n if int(s)%k==0:\n print(w)\n break\n w+=1', 'k = int(input())\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\nif k%2==0:\n print(-1)\nelif len(prime_factorize(k))==1:\n print(k-1)\nelse:\n w = 1\n \n while True:\n s = "7"*w\n if int(s)%k==0:\n print(w)\n break\n w+=1', '\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\nk = int(input())\nif k%2==0 or k%5==0:\n print(-1)\nelse:\n se = prime_factorize(k)\n k_ = k\n if not 7 in se:\n k_ = k*7\n\n K = int(str(k_)[-1])\n \n if K==1:\n # print("a")\n x = 7\n elif K==3:\n x=9\n elif K==7:\n x = 1\n elif K==9:\n x = 3\n z = 0\n # print(x)\n while True:\n s = 10*z + x\n q = k_ * s\n print(q)\n if str(q)=="7"*len(str(q)):\n print(len(str(q)))\n break\n z+=1', 'k = int(input())\nc = 0\nif k%2 ==0 or k%5==0:\n print(-1)\n c=1\nif c==0:\n\n for i in range(1,k):\n t = "7"*i\n if str(t)%k==0 :\n print(i)\n break', 'k = int(input())\nc = 0\nif k%2 ==0 or k%5==0:\n print(-1)\n c=1\nelif k==1:\n print(1)\n c=1\nif c==0:\n t = 7\n\n for i in range(k):\n if int(t)%k==0 :\n print(i+1)\n break\n t = (10*t+7)%k'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s098372977', 's234316325', 's779527157', 's973056645', 's996220843'] | [9152.0, 9232.0, 37492.0, 8968.0, 9188.0] | [2205.0, 2206.0, 2261.0, 27.0, 288.0] | [1284, 521, 778, 183, 230] |
p02596 | u577244731 | 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\nt = 7\nfor i in range(K):\n if t % K == 0:\n print(i + 1)\n break\n t = (t * 10 + 7) % K\n else:\n print(-1)', '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)'] | ['Runtime Error', 'Accepted'] | ['s508025392', 's891908057'] | [9008.0, 9160.0] | [25.0, 206.0] | [149, 141] |
p02596 | u579508806 | 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\nc = 0\nwhile True:\n if s == 0:\n break\n s = (10 * s + 7) % k\n c += 1\nprint(c)', "import sys\nk = int(input())\nif k % 2 == 0 or k % 5 == 0:\n print('-1')\n sys.exit()\ns = 7\nc = 1\nwhile True:\n if s % k == 0:\n break\n s = (10 * s + 7) % k\n c += 1\nprint(c)"] | ['Wrong Answer', 'Accepted'] | ['s039172141', 's864273028'] | [9136.0, 9168.0] | [2206.0, 229.0] | [104, 175] |
p02596 | u585670729 | 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())\nx = 0\nfor i in range(1, n):\n x = ((10 * x) + 7)%n\n if x == 0:\n print(i)\n return\n \nprint(-1)\n ', 'n = int(input())\nx, found = 0, False\nfor i in range(1, n + 1):\n x = ((10 * x) + 7)%n\n if x == 0:\n print(i)\n found = True\n break\n\nif not found:\n print(-1)\n \n'] | ['Runtime Error', 'Accepted'] | ['s802922995', 's230516348'] | [8948.0, 9168.0] | [23.0, 178.0] | [120, 169] |
p02596 | u595893956 | 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())\nok = [0]*k\nx=7 % k\nok[x] = 1\nif x == 0:\n print(1)\nelse:\n now = 1\n while now+=1:\n x = x*10 +7\n if ok[x] == 1:\n print(-1)\n break\n elif x == 0:\n print(now)\n break', 'k = int(input())\nok = [0]*k\nx=7 % k\nok[x] = 1\nif x == 0:\n print(1)\nelse:\n now = 1\n while now+=1:\n x = (x*10 +7) % k\n if ok[x] == 1:\n print(-1)\n break\n elif x == 0:\n print(now)\n break\n', 'k = int(input())\nok = [0]*k\nx=7 % k\nok[x] = 1\nif x == 0:\n print(1)\nelse:\n now = 1\n while 1:\n now += 1\n x = (x*10 +7) % k\n if ok[x] == 1:\n print(-1)\n break\n elif x == 0:\n print(now)\n break\n else:\n ok[x] = 1\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s311196272', 's553022295', 's614315896'] | [8916.0, 8968.0, 16668.0] | [27.0, 26.0, 373.0] | [208, 215, 249] |
p02596 | u600673553 | 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(k):\n a = (a*10+7)/k\n if a == 0:\n print(i+1)\n brake\nprint(-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 break\nprint(-1)', 'a=int(input())\n \nif a%2 == 0:\n print(-1)\nelse:\n ans = 1\n div = 0\n \n for i in range(10**6):\n div += 7*10**i\n if a%div == 0:\n break\n else:\n ans +=1\n \n print(ans)', '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 quit()\nprint(-1)', 'a=int(input())\n\nif a%2 == 0:\n print(-1)\nelse:\n ans = 1\n div = 0\n \n for i in range(10**6):\n div += 7*10**i\n if a%div == 0:\n break\n else:\n ans +=1\n\nprint(ans)', 'a=int(input())\n \nif a%2 == 0:\n print(-1)\nelse:\n ans = 1\n div = 0\n \n for i in range(a):\n div += 7*10**i\n if a%div == 0:\n break\n else:\n ans +=1\n \n print(ans)', '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 quit()\nprint(-1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s247978625', 's369624335', 's750976745', 's832278601', 's909904916', 's984513082', 's440184344'] | [9076.0, 9184.0, 9028.0, 9116.0, 9076.0, 9096.0, 9104.0] | [196.0, 176.0, 2206.0, 185.0, 2206.0, 2206.0, 174.0] | [107, 104, 185, 107, 180, 181, 108] |
p02596 | u605329406 | 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())\nb = 7\nc = 1\na = []\ne = 0\na.append(7)\nif(k%2 == 0):\n print(-1)\nelse:\n while(b%k != 0):\n r = b%k\n b = 10*r+7\n c += 1\n if b in a:\n e = 1\n \ta.append(b)\n if(e == 1):\n print(-1)\n else:\n \tprint(c)\n\n \n', 'k = int(input())\nb = 7\nc = 1\na = []\na.append(7)\nif(k%2 == 0):\n print(-1)\nelse:\n while(b%k != 0):\n r = b%k\n b = 10*r+7\n c += 1\n if(c > k):\n print(-1)\n else:\n print(c)', 'k = int(input())\nb = 7\nc = 1\na = []\na.append(7)\nif(k%2 == 0):\n print(-1)\nelse:\n while(b%k != 0):\n r = b%k\n b = 10*r+7\n c += 1\n if b in a:\n print(-1)\n \ta.append(b)\n print(c)\n \n', 'k = int(input())\nc = 1\nfor i in range(1,n):\n a = 7*((10**i - 1)//9)\n if(a%k == 0):\n break\n else:\n c += 1\nprint(c)\n', 'k = int(input())\nn = 7\nc = 1\nif(k%2 == 0):\n print(-1)\nelse:\n while(True):\n if(n%k == 0):\n break\n if(c > k):\n c = -1\n break\n r = n%k\n n = 10*r+7\n c += 1\n print(c)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s211209860', 's548274911', 's828739640', 's951571428', 's206870510'] | [9068.0, 19888.0, 8916.0, 9160.0, 9168.0] | [28.0, 2228.0, 29.0, 25.0, 283.0] | [237, 192, 197, 123, 194] |
p02596 | u607563136 | 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 = 7\n\nif k % 2 == 0:\n print(-1)\nelse:\n for i in range(10*8):\n if n % k == 0:\n print(len(list(str(n))))\n break\n else:\n n = n*10 + 7\nprint(-1)\n \n', 'k = int(input())\n\nn = 7\n\nwhile n < 10**8:\n if n % k == 0:\n print(len(list(str(n))))\n break\n n = n*10 + 7\n\nprint(-1)\n \n', 'import sys\ndef main():\n k = int(input())\n\n a =7%k\n if a == 0:\n print(1)\n sys.exit()\n\n for i in range(2,10**7):\n a = (10*a+7) % k\n if a == 0:\n print(i)\n sys.exit()\n\n print(-1)\n \nmain()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s297700913', 's622517863', 's405067634'] | [9028.0, 9148.0, 9168.0] | [31.0, 26.0, 981.0] | [226, 149, 251] |
p02596 | u607884285 | 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=9*K/7 if K%7==0 else 9*K\n\nif L%2==0 or L%5==0:\n print('-1')\n\nelse:\n surplus=1\n for i in range(1,L):\n surplus=(surplus*10)%L\n if surplus==1:\n print(i)\n break\n print('-1')", "K=int(input())\n\nL=9*K//7 if K%7==0 else 9*K\n\nif L%2==0 or L%5==0:\n print('-1')\n\nelse:\n surplus=1\n for i in range(1,L):\n surplus=(surplus*10)%L\n if surplus==1:\n print(i)\n break"] | ['Runtime Error', 'Accepted'] | ['s605571806', 's288501262'] | [9152.0, 8992.0] | [166.0, 159.0] | [235, 220] |
p02596 | u609561564 | 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 \n \ninit=7\nfor i in range(k+1):\n if init%k ==0:\n print(i+1)\n break\n t = t*10+7\nprint(-1)', 'k=int(input())\n \nans=-1\ninit=7\nfor i in range(k+1):\n if init%k ==0:\n ans=i+1\n break\n init = (init*10+7)%k\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s388441748', 's958948354'] | [9152.0, 9152.0] | [26.0, 210.0] | [111, 124] |
p02596 | u614054255 | 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=0\n\nfor _ in range(K):\n print(10*s+7, s)\n s=(10*s+7)%K\n if s==0:\n print(_+1)\n exit()\n \nprint(-1)\n', 'K=int(input())\ns=0\n\nfor _ in range(K):\n s=(10*s+7)%K\n if s==0:\n print(_+1)\n exit()\n \nprint(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s142570762', 's873334016'] | [18056.0, 8936.0] | [748.0, 185.0] | [143, 122] |
p02596 | u614917104 | 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())\nfirsta = 7 % K\nif firsta == 0:\n print(1)\nelif firsta == 77 % K:\n print(-1)\nelse:\n ans = 2\n preva = 77 % K\n while preva != firsta and preva != 0:\n preva = ((preva*10)+7) % K\n ans += 1\n if preva = firsta:\n ans = -1\n print(ans)', 'K = int(input())\ndef check(k):\n aaa = 0\n prev = 7%k\n for i in range(0,k):\n aaa+=1\n if prev == 0:\n return(aaa)\n prev = (prev*10+7)%k\n return(-1)\nprint(check(K))'] | ['Runtime Error', 'Accepted'] | ['s958873555', 's487716063'] | [9052.0, 9116.0] | [28.0, 152.0] | [291, 203] |
p02596 | u627691992 | 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\nres = -1\ncount = 1\nai = 0\nwhile(True):\n ai = (ai*10 + 7) % K\n count += 1\n if(ai == 0):\n res = count\n break\n\nprint(res)\n', 'K = int(input())\n\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\n exit()\n\nres = -1\ncount = 0\nai = 0\nwhile(True):\n ai = (ai*10 + 7) % K\n count += 1\n if(ai == 0):\n res = count\n break\n\nprint(res)\n'] | ['Wrong Answer', 'Accepted'] | ['s922012455', 's242048462'] | [9172.0, 8932.0] | [2205.0, 189.0] | [160, 215] |
p02596 | u629350026 | 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 if k%7==0:\n k=k//7\n t=1\n tm=0\n for i in range(1,100000):\n tm=tm+t%k\n if tm==0:\n print(i)\n break\n else:\n t=t*10\n else:\n print(k-1)\n', 'k=int(input())\nif k%2==0 or k%5==0:\n print(-1)\nelse:\n t=7\n ans=1\n while True:\n if t%k==0:\n print(ans)\n break\n t=(t*10+7)%k\n ans=ans+1\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s589220716', 's429166730'] | [9140.0, 9132.0] | [2206.0, 229.0] | [220, 157] |
p02596 | u630004940 | 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=input()\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 r=10%L\n for i in range(1,10**6+1):\n if r==1:\n ans=i\n break\n else:\n r=10*r%L\n\nprint(ans)', 'import math\nK=input()\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 r=10%L\n for i in range(1,10**6+1):\n if r==1:\n ans=i\n break\n else:\n r=10*r%L\n\nprint(ans)', 'import math\nK=int(input())\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 ans=-1\nelse:\n r=10%L\n for i in range(1,10**6+1):\n if r==1:\n ans=i\n break\n else:\n r=10*r%L\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s229904262', 's489906956', 's173314613'] | [9156.0, 8988.0, 9104.0] | [27.0, 24.0, 166.0] | [245, 242, 248] |
p02596 | u634079249 | 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, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n# from decimal import Decimal\n# from collections import defaultdict, deque\n\nsys.setrecursionlimit(10000000)\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: (x * y) // math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nINF = float(\'inf\')\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n K = ii()\n\n ret = []\n for i in range(K + 1):\n if i == 0:\n ret.append(7 % K)\n else:\n ret.append(ret[i - 1] * 10 + 7)\n for i in range(K + 1):\n if ret[i] == 0:\n print(i + 1)\n exit()\n else:\n print(-1)\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n# from decimal import Decimal\n# from collections import defaultdict, deque\n\nsys.setrecursionlimit(10000000)\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: (x * y) // math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nINF = float(\'inf\')\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n K = ii()\n\n ret = []\n for i in range(K + 1):\n if i == 0:\n ret.append(7 % K)\n else:\n ret.append((ret[i - 1] * 10 + 7) % K)\n for i in range(K + 1):\n if ret[i] == 0:\n print(i + 1)\n exit()\n else:\n print(-1)\n\n\nif __name__ == \'__main__\':\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s519408362', 's125761904'] | [2683424.0, 49376.0] | [2283.0, 265.0] | [1235, 1241] |
p02596 | u638902622 | 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\ndef IS(): return sys.stdin.readline().rstrip()\ndef II(): return int(IS())\ndef MII(): return list(map(int, IS().split()))\ndef MIIZ(): return list(map(lambda x: x-1, MII()))\n#======================================================#\ndef main():\n k = II()\n print(-1)\n\nif __name__ == '__main__':\n main()", "import sys\n\ndef IS(): return sys.stdin.readline().rstrip()\ndef II(): return int(IS())\ndef MII(): return list(map(int, IS().split()))\ndef MIIZ(): return list(map(lambda x: x-1, MII()))\n#======================================================#\ndef main():\n k = II()\n sevens = 7%k\n for i in range(1, k+1):\n if sevens % k == 0:\n print(i)\n return\n sevens = (10*sevens + 7)%k\n print(-1)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s884849795', 's223957125'] | [9076.0, 9104.0] | [29.0, 165.0] | [326, 474] |
p02596 | u643679148 | 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)\nelse:\n n = 7\n cnt = 1\n for i in range(k):\n n = (n * 10 +7) % k\n if n % k==0:\n break\n \n cnt +=1\n \nprint(cnt) \n \n ', "k = input()\nnana = int((len(k)-1)*'7')\nans = len(k)\nk = int(k)\nflag = False\n\ndef is_prime(q):\n q = abs(q)\n if q == 2:\n return True\n if q < 2 or q & 1 == 0:\n return False\n return pow(2, q-1, q) == 1\n\n\nif is_prime(k):\n print(k-1)\nelse:\n for i in range(10000000):\n nana = (nana * 10) + 7\n if nana % k == 0:\n flag = True\n break\n ans += 1\n\n if flag:\n print(ans)\n else:\n print('-1')\n", '# -*- coding: utf-8 -*-\nk = int(input())\nans = 0\nn = 7\n\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\n exit(0)\nc = 1\nwhile True:\n if n % k == 0:\n break\n n = (n * 10 + 7) % k\n c += 1\n\nprint(c)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s545523164', 's599877609', 's228559494'] | [9044.0, 9208.0, 9168.0] | [252.0, 2206.0, 230.0] | [204, 472, 208] |
p02596 | u645487439 | 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 = input()\nm = 0\n\nif n[-1] == "1":\n m = 7\nelif n[-1] == "3":\n m = 9\nelif n[-1] == "7":\n m = 1\nelif n[-1] == "9":\n m = 3\nelse:\n print(-1)\n exit()\n\nn = int(n)\n\nfor i in range(1, k):\n if len(set(list(str(n * m)))) == 1:\n break\n m = int(str(i) + str(m)[-1])\n if len(str(n * m)) >= k:\n print(-1)\n exit()\n\nprint(len(str(n * m)))\n', 'k = int(input())\nm = 0\n\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()\n\nprint(i + 1)\n'] | ['Runtime Error', 'Accepted'] | ['s615213179', 's166994196'] | [9160.0, 9100.0] | [27.0, 226.0] | [372, 165] |
p02596 | u655048024 | 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\nif(k%2==0):\n print("-1")\nelse:\n i = 1\n while True:\n m = m%k\n if(j==0):\n print(i)\n break \n if(i>k):\n print("-1")\n break\n m *= 10\n m += 7\n i += 1\n\n', 'k = int(input())\nif(k%2==0):\n print("-1")\nelse:\n i = 1\n while True:\n m = 7\n if(m%k==0):\n print(i)\n break\n if(i>10000000):\n print("-1")\n break\n m = m*10 + 7\n i += 1\n\n \n \n', 'k = int(input())\nif(k&2==0):\n print(-1)\nelse:\n i = 1\n while True:\n m = 7\n if(m%k==0):\n ans = i\n print(ans)\n break\n m = m*10 + 7\n i += 1\n\n \n ', 'k = int(input())\nif(k&2==0):\n print("-1")\nelse:\n i = 1\n while True:\n m = 7\n if(m%k==0):\n ans = i\n print(ans)\n break\n if(i>1000000):\n print("-1")\n break\n m = m*10 + 7\n i += 1\n\n \n \n', 'k = int(input())\nif(k%2==0):\n print("-1")\nelse:\n i = 1\n while True:\n m = 7\n if(m%k==0):\n ans = i\n print(ans)\n break\n if(i>1000000):\n print("-1")\n break\n m = m*10 + 7\n i += 1\n\n \n \n', 'k = int(input())\nif(k%2==0):\n print("-1")\nelse:\n i = 1\n while True:\n m = 7\n if(m%k==0):\n print(i)\n break\n if(i>100000000):\n print("-1")\n break\n m = m*10 + 7\n i += 1\n\n \n \n', 'k = int(input())\nm = 7\ni = 1\nwhile True:\n m = m%k\n if(m==0):\n print(i)\n break \n if(i>k):\n print("-1")\n break\n m *= 10\n m += 7\n i += 1\n\n\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s109195001', 's149126634', 's233162284', 's502265264', 's794215265', 's931844137', 's188880460'] | [9096.0, 9192.0, 9160.0, 9168.0, 9168.0, 9056.0, 9044.0] | [27.0, 1840.0, 2206.0, 218.0, 216.0, 2205.0, 309.0] | [210, 209, 172, 224, 224, 210, 155] |
p02596 | u667084803 | 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 = 7%K\nse = set(i)\ncnt = 1\nwhile True:\n if i == 0:\n print(cnt)\n break\n cnt += 1\n i = (i*10 + 7)%K\n if i in se:\n print(-1)\n break\n else:\n se.add(i)\n ', 'K = int(input())\n\ni = 7%K\nse = set([i])\ncnt = 1\nwhile True:\n if i == 0:\n print(cnt)\n break\n cnt += 1\n i = (i*10 + 7)%K\n if i in se:\n print(-1)\n break\n else:\n se.add(i)\n '] | ['Runtime Error', 'Accepted'] | ['s323642881', 's537661101'] | [8896.0, 77940.0] | [27.0, 513.0] | [188, 190] |
p02596 | u668924588 | 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 \nx = []\nx.append(7%K)\nfor i in range(1,K):\n x.append((x[i-1]*10+7)%K)\n\nans = -1\n\nfor i in x:\n if x == 0:\n ans = i + 1\n break\n\nprint(i)', 'K = int(input())\n \nx = []\nx.append(7%K)\nfor i in range(1,K):\n x.append((x[i-1]*10+7)%K)\n\nfor i,n in enumerate(x):\n if n == 0:\n print(i + 1)\n exit()\nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s056911962', 's138999359'] | [48656.0, 48564.0] | [299.0, 349.0] | [160, 165] |
p02596 | u674588203 | 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# C - Repsept\n\nK=int(input())\n\nmodsevens=[7]\n\nif K==7 or 1:\n print(1)\n exit()\n\n\nfor i in range (1,K+2):\n a=(modsevens[-1] *10+7)%K\n \n if a==0:\n print(i+1)\n exit()\n else:\n modsevens.append(a)\n\nprint(-1)', '\n# C - Repsept\n\nK=int(input())\n\nmodsevens=[7]\n\nif K==7 or K==1:\n print(1)\n exit()\nelse:\n pass\n\nfor i in range (1,K):\n a=(modsevens[-1] *10+7)%K\n \n if a==0:\n print(i+1)\n exit()\n else:\n modsevens.append(a)\n\nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s611595649', 's668931145'] | [9048.0, 48632.0] | [29.0, 285.0] | [271, 286] |
p02596 | u686036872 | 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\nX = 10\nans = 1\n\nif \nwhile ans <= 9000000:\n x = X%(9*K)\n if x == 1:\n print(ans)\n break\n else:\n ans += 1\n X = x*10 \n\nif x != 1:\n print(-1) ', 'K = int(input())\n\nX = 10\nans = 1 \nwhile ans <= L:\n L = 9*K/7\n x = X%L\n if x == 1:\n print(ans)\n break\n else:\n ans += 1\n X = x*10 \n\nif x != 1:\n print(-1) ', 'K = int(input())\n\nn = 7\ni = 1\n\nwhile i <= K:\n if n%K == 0:\n ans = i\n break\n n = n*10 + 7\n i += 1\n \nelse:\n print(-1)', 'K = int(input())\n\nn = 7\ni = 0\nwhile True:\n if n%K == 0:\n print(i+1)\n break\n n += 7*(10**i)\n i += 1\nelse:\n print(-1)', 'K = int(input())\n\nans = 1\nX = 7\ncnt = K\nwhile ans <= K:\n x = X % K\n if rem == 0:\n print(ans)\n break\n else:\n ans += 1\n X = x*10 + 7 \n\nif rem != 0:\n print(-1)', 'K = int(input())\n\nans = 1\nX = 7\ncnt = K\nwhile ans <= K:\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)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s268562244', 's323221233', 's361646549', 's382612472', 's678015855', 's057155891'] | [9000.0, 9072.0, 9108.0, 9136.0, 9160.0, 9196.0] | [27.0, 27.0, 2205.0, 2205.0, 25.0, 265.0] | [195, 198, 144, 141, 196, 192] |
p02596 | u690184681 | 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\n\nif K%2==0:\n mod = -1\nelse:\n flag=0\n mod = 7\n count = 1\n while flag==0:\n if mod==0:\n flag = 1\n else:\n count += 1\n mod = (mod*10+7) % K\n\nprint(mod)', 'K = int(input())\n\n\nif K%2==0 or K%5==0:\n count = -1\nelse:\n flag=0\n mod = 7\n count = 1\n while mod%K!=0:\n count += 1\n mod = (mod*10+7) % K\n\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s175313416', 's382075675'] | [9092.0, 9120.0] | [2205.0, 232.0] | [226, 179] |
p02596 | u694380052 | 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())\nsevs=7\nfor x in range(1,k+1):\n if sevs%k==0:\n print(x)\n exit()\n else:\n sev=(10*sevs+7)%k\nprint('-1')\n ", "k=int(input())\nsevs=7\nfor x in range(1,k+1):\n if sevs%k==0:\n print(x)\n exit()\n else:\n sevs=(10*sevs+7)%k\nprint('-1')\n \n"] | ['Wrong Answer', 'Accepted'] | ['s472761307', 's740082028'] | [9092.0, 9096.0] | [187.0, 209.0] | [131, 133] |
p02596 | u696241422 | 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()\nans=7\nans2=10\nprev=7\nif ans%k==0:\n print(1)\nelse:\n for i in range(0, k + 1, 1):\n ans=7*ans2+prev\n if ans%k==0:\n print(i+2)\n break\n prev=ans\n ans2=ans2*10\n\n', 'k=int(input())\nans=7\nans2=10\nprev=7\nhbe=False\nif ans%k==0:\n print(1)\n hbe=True\nelse:\n for i in range(0, k + 1, 1):\n ans=(7*ans2+prev)%k\n if ans%k==0:\n print(i+2)\n hbe=True\n break\n prev=ans\n ans2=(ans2*10)%k\nif hbe==False:\n print(-1)\n\n'] | ['Runtime Error', 'Accepted'] | ['s289403393', 's746518535'] | [8948.0, 9104.0] | [24.0, 324.0] | [221, 307] |
p02596 | u696684809 | 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 = 7\nm = 7\nif(k%2==0):\n print(-1)\nelif(k ==999983):\n print("999982")\nelse:\n for i in range(10**6+1):\n n = (7 +n*10)%k\n if(n==0):\n print(i+1)\n break', 'k = int(input())\nn = 7\nm = 7\nif(k%2==0):\n print(-1)\nelif(k ==999983):\n print("999982")\nelse:\n for i in range(10**6+1):\n n = (n +7*10**(i+1))%k\n if(n==0):\n print(i+1)\n break', 'K = int(input())\nN = 10\na = 0\nl = 9*K\nif(K==7 or K==1):\n a+=1\n print(1)\nelse:\n for i in range(1,10**6):\n N = (10*N)%l\n if (N*7-7)%l==0:\n print(i+1)\n a +=1\n break\n if(a == 0):\n print(-1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s455386065', 's503159503', 's056706891'] | [9064.0, 9112.0, 9132.0] | [183.0, 2206.0, 248.0] | [184, 191, 213] |
p02596 | u698868214 | 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\u3000or K % 5 == 0:\n print(-1)\nelse:\n if K % 7 == 0:\n L = 9 * K // 7\n else:\n L = 9 * K\n a = 10 % L\n check = False\n for i in range(L):\n a %= L\n if a == 1:\n print(i + 1)\n check = True\n break\n a *= 10\n if not check:\n print(-1)', 'K = int(input())\n\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\nelse:\n if K % 7 == 0:\n L = 9 * K // 7\n else:\n L = 9 * K\n a = 10 % L\n check = False\n for i in range(L):\n a %= L\n if a == 1:\n print(i + 1)\n check = True\n break\n a *= 10\n if not check:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s498484002', 's738811912'] | [9020.0, 9192.0] | [24.0, 193.0] | [292, 290] |
p02596 | u699089116 | 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 = 7\nfor i in range(1, 1000001):\n if n % K == 0:\n print(i)\n exit()\n n = (n * 10 + 7) % 7\nelse:\n print(-1)', 'K = int(input())\n\nn = 7\nfor i in range(1, 1000001):\n if n % K == 0:\n print(i)\n exit()\n n = (n * 10 + 7) % K\nelse:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s227646634', 's186287124'] | [9104.0, 9164.0] | [27.0, 216.0] | [133, 147] |
p02596 | u699715278 | 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\nmod_list = []\nif N % 2:\n i = 1\n while True:\n num = (7*((10**i)-1)/9) % N\n if num == 0:\n print(i)\n break\n if num in mod_list:\n print(-1)\n break\n else:\n mod_list.append()\n i += 1\n\nelse:\n print(-1)\n', 'N = int(input())\nif N % 7:\n L = 9*N\nelse:\n L = 9*N//7\nnum = 1\nif L % 2 and L % 5:\n i = 1\n while i <= L:\n num = (num*10) % L\n if num == 1:\n print(i)\n break\n\n else:\n\n i += 1\n\nelse:\n print(-1)\n'] | ['Runtime Error', 'Accepted'] | ['s737641916', 's091913561'] | [9276.0, 9072.0] | [28.0, 203.0] | [316, 259] |
p02596 | u701513230 | 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 = 0\n\nfor i in range(K):\n N += N*10+7\n if N%K ==0:\n print(i)\n break\nelse:\n print(-1)', 'K = int(input())\n\nfor i in range(K):\n if i = 0:\n N= 7%K\n else:\n N = (10*N+7)%K\n if N == 0:\n print(i+1)\n break\nelse:\n print(-1)', 'K = int(input())\n\nN = 0\n\nfor i in range(10001):\n N += 7*(10**i)\n if N%K ==0:\n print(i)\n break\n else:\n print(-1)\n', 'K = int(input())\n\nN = 0\n\nfor i in range(10000001):\n N += 7*(10**i)\n if N%K ==0:\n print(i)\n break\nelse:\n print(-1)\n', 'K = int(input())\n\nr = 0\nwhile True:\n N = 0\n for i in range(r):\n N += 7*(10**i)\n if N%K ==0:\n break\n r += 1\n\nprint(r)\n', 'K = int(input())\n\nfor i in range(K):\n if i = 0:\n N= 7%K\n else:\n N = (10*N+7)%K\n if N == 0:\n print(i)\n break\nelse:\n print(-1)', 'K = int(input())\n\nN = 0\n\nfor i in range(K):\n N += 7*(10**i)\n if N%K ==0:\n print(i)\n break\nelse:\n print(-1)', 'K = int(input())\n\nN = 0\n\nfor i in range(10001):\n N += 7*(10**i)\n if N%K ==0:\n print(i)\n break\nelse:\n print(-1)\n', 'K = int(input())\n\nnum = 7%K\n\nfor i in range(K):\n if num%K ==0:\n print(i+1)\n break\n else:\n num = (num*10 + 7)%K\n \nelse:\n print(-1)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s052350911', 's276736207', 's378294067', 's467202556', 's545827967', 's714364607', 's729155768', 's929029032', 's944064530'] | [9144.0, 8860.0, 9156.0, 8972.0, 8936.0, 8980.0, 8972.0, 9048.0, 8952.0] | [2205.0, 24.0, 553.0, 2206.0, 26.0, 23.0, 2206.0, 547.0, 210.0] | [126, 166, 142, 137, 143, 164, 129, 134, 144] |
p02596 | u704284486 | 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 if K%10:\n L = 9*K if K%7 else 9*K//7\n mod = 10%L\n for i in range(9000001):\n if mod == 1:\n print(i)\n exit()\n mod = 10*mod%L\n else:\n print(-1)\n \n\nif __name__ == "__main__":\n main()', 'def main():\n K = int(input())\n if K%10:\n if K%7==0:\n K//=7\n L = 9*K\n mod = 10%L\n for i in range(9000001):\n if mod == 1:\n print(i+1)\n exit()\n mod = 10*mod%L\n print(-1)\n else:\n print(-1)\n \n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s744814731', 's532763758'] | [9108.0, 9176.0] | [775.0, 772.0] | [304, 342] |
p02596 | u704563784 | 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())\nseen = set()\nans = 0\nres = 7%n\nseen.add(res)\nans += 1\nwhile res != 0:\n\tnew = (res*10 + 7)%n\n if new not in seen:\n\t\tseen.add(new)\n res = new\n ans += 1\n\telse:\n \tprint(-1):\n exit()\nprint(ans)', 'k = int(input())\nans = 1\nseen = set()\nmod = 7%k\nwhile mod != 0 and mod not in seen:\n seen.add(mod)\n mod = (10*mod + 7)%k\n ans += 1\n\nif mod == 0:\n print(ans)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s611196072', 's461016300'] | [9004.0, 77784.0] | [24.0, 499.0] | [232, 188] |
p02596 | u719678808 | 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(sys.stdin.read())\nk *= 9\nlimit = 1000000\nvalue = 0\nindex = 0\nwhile index < limit:\n index += 1\n value = (value*10+7)%k\n if value == 0:\n print(index)\n sys.exit()\n\nprint(-1)', 'import sys\nk = int(sys.stdin.read())\nif k==2:\n print(-1)\n sys.exit()\nvalue = 0\nindex = 0\nwhile index < 1000000:\n index += 1\n value = (value*10+7)%k\n if value == 0:\n print(index)\n sys.exit()\n\nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s190569546', 's183451950'] | [9152.0, 9084.0] | [241.0, 234.0] | [198, 211] |
p02596 | u721130361 | 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=0\ncount=1\nfor i in range(K):\n\tm=(m*10+7)%K\n\tif m==0:\n\t\tprint(count)\n\t\tbreak\n\tcount+=1\nprint(-1)', 'K=int(input())\n\nseven=0\nm=1\nwhile m!=0:\n\tseven=seven*10+7\n\tm=seven % K\n\nprint(seven)', 'K=int(input())\nm=0\ncount=1\nchk=0\nfor i in range(K):\n\tm=(m*10+7)%K\n\tif m==0:\n\t\tprint(count)\n\t\tchk=1\n\t\tbreak\n\tcount+=1\n\nif chk==0:\n\tprint(-1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s562851354', 's780789221', 's914968991'] | [9100.0, 9064.0, 9124.0] | [224.0, 2206.0, 225.0] | [112, 84, 139] |
p02596 | u728235145 | 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 = 7 % K \n\nfor i in range(1, K + 1):\n if A % K == 0:\n print(i)\n break\n A = (10 * A + 7) % K\nprint(-1)', 'K = int(input())\nA = 7 % K \n\nfor i in range(1, K + 1):\n if A % K == 0:\n print(i)\n exit()\n A = (10 * A + 7) % K\nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s019322258', 's104380468'] | [9096.0, 9124.0] | [210.0, 206.0] | [139, 140] |
p02596 | u734876600 | 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())\ncnt = 0\nmod = [0]\nnot_found = 1\nwhile cnt<k+1:\n cnt+=1\n n = mod[-1]*10+7\n mod.append(n%k)\n if n % k == 0:\n not_found = 0\n print(cnt)\nif(not_found):\n print(-1)\n', 'k = int(input())\ncnt = 0\nmod = [0]\nwhile cnt<k:\n cnt+=1\n n = mod[-1]*10+7\n mod.append(n%k)\n if n % k == 0:\n print(cnt)', 'k = int(input())\ncnt = 0\nmod = [0]\nnot_found = 1\nwhile cnt<k:\n cnt+=1\n n = mod[-1]*10+7\n mod.append(n%k)\n if n % k == 0:\n not_found = 0\n print(cnt)\nif(not_found):\n print(-1)', 'k = int(input())\ncnt = 0\nmod = [0]\nnot_found = 1\nwhile cnt<k+1:\n cnt+=1\n n = mod[-1]*10+7\n mod.append(n%k)\n if n % k == 0:\n not_found = 0\n print(cnt)\n break\nif(not_found):\n print(-1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s530297497', 's702206117', 's943214546', 's141953257'] | [48628.0, 48616.0, 48452.0, 48656.0] | [402.0, 378.0, 414.0, 414.0] | [205, 137, 202, 219] |
p02596 | u737801844 | 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 solution(K: int) -> int:\n sevens: int = 0\n for i in range(1, K + 1):\n print(sevens)\n sevens = (sevens*10 + 7) % K\n if sevens == 0:\n return i\n return -1\n\n\nK: int = int(input())\n\nprint(solution(K))\n', 'def solution(K: int) -> int:\n ans: int = 0\n x: int = 7\n while True:\n print(x)\n print()\n ans += 1\n \n if K % 2 == 0:\n return -1\n \n if x < int(K):\n x: int = int(str(x) + str(7))\n continue\n if x % K == 0:\n return ans\n x: int = int(str(x) + str(7))\n return ans\n\n\nK: int = int(input())\n\nprint(solution(K))\n', 'def solution(K: int) -> int:\n sevens: int = 0\n for i in range(1, K + 1):\n sevens = (sevens*10 + 7) % K\n if sevens == 0:\n return i\n return -1\n\n\nK: int = int(input())\n\nprint(solution(K))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s661607930', 's973893660', 's364253224'] | [10024.0, 20188.0, 9096.0] | [411.0, 2234.0, 133.0] | [241, 466, 219] |
p02596 | u739708271 | 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\nans=0\nfor i in range(k):\n if t%k==0:\n ans=i+1\n \tbreak\n else:\n t = (t*10+7)%k\n \nif ans >0:\n print(ans) \nelse:\n print(-1)', 'k = int(input())\nt = 7\nans=0\nfor i in range(k):\n if t%k==0:\n ans=i+1\n break\n else:\n t = (t*10+7)%k\n \nif ans >0:\n print(ans) \nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s695964157', 's034536403'] | [8940.0, 9076.0] | [28.0, 207.0] | [160, 181] |
p02596 | u743682467 | 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. | ['#C\nK = int(input())\njudge=False\nnum = 0\nfor i in range(K+1):\n num += 7 * (10**i)\n num == num % K\n if num == 0:\n judge=True\n print(i+1)\n break\nif judge == False:print("-1")', '#C\nK = int(input())\njudge=False\nnum = 7\nfor i in range(K):\n num = num % K\n #print(num)\n if num == 0:\n print(i+1)\n judge = True\n break\n else:\n num = num*10+7\nif judge == False:print("-1")'] | ['Wrong Answer', 'Accepted'] | ['s362517057', 's633092073'] | [9164.0, 9172.0] | [2205.0, 205.0] | [201, 226] |
p02596 | u749359783 | 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\ndef is_prime(n):\n if n == 1: return False\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n return True\n\nK = int(input())\nif K==1:\n print(1)\nif K==2:\n print(-1)\nelif K==3:\n print(3)\nelif K==5:\n print(-1)\nelif K==7:\n print(1)\nelif K==11:\n print(2)\nelif K==77:\n print(2)\nelif K==111:\n print(3)\nelif K==777:\n print(3)\nelif K==1111:\n print(4)\nelif K==7777:\n print(4)\nelif K==11111:\n print(5)\nelif K==77777:\n print(5)\nelif K==111111:\n print(6)\nelif K==777777:\n print(6)\nelif K==1111111:\n print(7)\nelif K==7777777:\n print(7)\nelif is_prime(K):\n print(K-1)\nelse:\n print(-1)', 'import math\ndef is_prime(n):\n if n == 1: return False\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n return True\n\nK = int(input())\n\nans = 0\nflag = 0\nnew = 7\nfor i in range(K):\n ans = (ans + new%K)%K\n if ans % K == 0:\n flag = 1\n break\n #print(i,ans,new)\n new = (new*10)%K\nif flag==0:\n print(-1)\nelse:\n print(i+1)'] | ['Wrong Answer', 'Accepted'] | ['s070795503', 's295744095'] | [9248.0, 9140.0] | [32.0, 326.0] | [685, 397] |
p02596 | u752907799 | 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. | ["from sys import stdin\ninput = stdin.readline\nri = lambda : int(input())\nril = lambda : list(map(int, input().split()))\n\ndef main():\n K = ri()\n m = 0\n ans = -1\n for i in range(K):\n m = (10 * m + 7) % K\n if m == 0:\n ans = i\n break\n print(ans)\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\ninput = stdin.readline\nri = lambda : int(input())\nril = lambda : list(map(int, input().split()))\n\ndef main():\n K = ri()\n m = 0\n ans = -1\n for i in range(K):\n m = (10 * m + 7) % K\n if m == 0:\n ans = i + 1\n break\n print(ans)\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s278574523', 's376910735'] | [9128.0, 9028.0] | [128.0, 125.0] | [299, 303] |
p02596 | u753971348 | 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. | ['from collections import deque\nN= int(input())\nstate = input()\n \nnewlist = sorted(state)\ngoalstate = "".join(newlist)\nuni = 0\nfor l in range(len(goalstate)):\n if goalstate[l] == "W":\n uni = l\n break\ndef bfs(state,goalstate):\n cur_state = deque([state])\n cou = 0\n while cur_state:\n cur = cur_state.popleft()\n if cur == goalstate:\n return cou\n break\n new= list(cur)\n temp = 0\n for i in range(len(goalstate)):\n if new[i] == "W":\n temp = i\n break\n neow= 0\n for j in range(uni-1,len(goalstate)):\n if new[j] == "R":\n neow = j\n break\n tempstr = new.pop(temp)\n temp1str = new.pop(neow-1)\n new.insert(neow,tempstr)\n new.insert(temp,temp1str)\n nowstr = "".join(new)\n cur_state.append(nowstr)\n cou += 1\n \n \ngoal = bfs(state, goalstate)\nprint(goal)', 'N= int(input())\nstate = input()\n\nnewlist = sorted(state)\ngoalstate = "".join(newlist)\n\nuni = 0\nfor l in range(len(goalstate)):\n if goalstate[l] == "W":\n uni = l\n break\n\ndef bfs(state,goalstate):\n cur_state = deque([state])\n cou = 0\n while cur_state:\n cur = cur_state.popleft()\n if cur == goalstate:\n return cou\n break\n new= list(cur)\n temp = 0\n for i in range(len(goalstate)):\n if new[i] == "W":\n temp = i\n break\n neow= 0\n for j in range(uni-1,len(goalstate)):\n if new[j] == "R":\n neow = j\n break\n tempstr = new.pop(temp)\n temp1str = new.pop(neow-1)\n new.insert(neow,tempstr)\n new.insert(temp,temp1str)\n nowstr = "".join(new)\n cur_state.append(nowstr)\n cou += 1\n\n\ngoal = bfs(state, goalstate)\nprint(goal)', 'K = int(input())\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\nelse: \n state = 7 \n state %= K\n cou = 1\n while True:\n if state == 0:\n print(cou)\n break\n state = state * 10 + 7\n state %= K \n cou+= 1'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s012600948', 's167207084', 's411199219'] | [9444.0, 9268.0, 9112.0] | [27.0, 30.0, 211.0] | [963, 932, 254] |
p02596 | u755116850 | 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. | ['# coding: utf-8\n\n\nk = 999983\nbefo = 0\n\nfor i in range(k):\n n = befo * 10 + 1\n befo = n\n if (7 * n) % k == 0:\n print(i+1)\n exit(0)\nprint(-1)\n', '# coding: utf-8\n\nk = int(input())\nn = 7 % k\n\nfor i in range(k+1):\n if n % k == 0:\n print(i+1)\n exit(0)\n n = (((n % k) * (10 % k)) + 7 % k) % k\nprint(-1)\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s950051300', 's132038983'] | [8948.0, 9120.0] | [2205.0, 291.0] | [181, 173] |
p02596 | u767664985 | 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 for _ in range(K)] \n\nif 7%K == 0:\n print(0)\nelse:\n now_n = 7%K\n while True:\n flag[now_n] = 1\n next_n = (now_n*10 + 7) % K\n if next_n == 0:\n print(sum(flag))\n exit()\n elif flag[next_n] == 0:\n now_n = next_n\n else:\n print(-1)\n exit()\n', 'K = int(input())\n\nflag = [0 for _ in range(K)] \n\nif 7%K == 0:\n print(1)\nelse:\n now_n = 7%K\n flag[now_n] = 1\n while True:\n next_n = (now_n*10 + 7) % K\n if next_n == 0:\n print(sum(flag)+1)\n exit()\n elif flag[next_n] == 0:\n now_n = next_n\n flag[now_n] = 1\n else:\n print(-1)\n exit()\n'] | ['Wrong Answer', 'Accepted'] | ['s793047179', 's174401540'] | [16816.0, 16840.0] | [353.0, 331.0] | [411, 437] |
p02596 | u770077083 | 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)\n exit()\n\ni = 7\ncnt = 1\nwhile i != 0:\n i = i * 10 + 7\n i %= 7\n cnt += 1\nprint(cnt)\n', 'k = int(input())\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\n exit()\n\ni = 7 % k\ncnt = 1\nwhile i != 0:\n i = i * 10 + 7\n i %= k\n cnt += 1\nprint(cnt)\n'] | ['Wrong Answer', 'Accepted'] | ['s762217291', 's764445490'] | [9168.0, 9176.0] | [27.0, 211.0] | [154, 158] |
p02596 | u787059958 | 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\ni = 1\nlast_i = 10 ** 6\nwhile True:\n if (i == last_i):\n print(-1)\n exit()\n an = (7 * ((10 ** i) - 1))\n an_last = (7 * ((10 ** last_i) - 1))\n if (an % K == 0):\n print(i)\n exit()\n elif (an_last % K == 0):\n print(last_i)\n exit()\n else:\n i += 1\n last_i -= 1\n continue\n', "K = int(input())\nf = 1\nj = 7 % K\nwhile f < K and j != 0:\n j = (j * 10 + 7) % K\n f += 1\nif j == 0:\n print(f)\nelse:\n print('-1')"] | ['Wrong Answer', 'Accepted'] | ['s772312969', 's147291883'] | [11248.0, 9096.0] | [2206.0, 234.0] | [403, 138] |
p02596 | u790905630 | 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 return -1\n elif K % 5 == 0:\n return -1\n\n an_min = 7\n an_max = int("7" * K)\n\n while True:\n if an_min % K == 0:\n return len(str(an_min))\n\n an_min = an_min * 10 + 7\n\n if an_max % K == 0:\n return len(str(an_max))\n\n an_max = an_max // 10\n\nif __name__ == "__main__":\n answer = main()\n print(answer)', 'def main():\n K = int(input())\n\n if K % 2 == 0:\n return -1\n elif K % 5 == 0:\n return -1\n\n an = 7\n counter = 1\n\n while True:\n modan = an % K\n\n if modan == 0:\n return counter\n\n an = modan * 10 + 7\n counter = counter + 1\n\nif __name__ == "__main__":\n answer = main()\n print(answer)'] | ['Wrong Answer', 'Accepted'] | ['s796005315', 's187426281'] | [10248.0, 9128.0] | [2206.0, 148.0] | [428, 353] |
p02596 | u802963389 | 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. | ['from collections import defaultdict\n\nk = int(input())\n\ndef prime_factorize(n):\n a = defaultdict(int)\n while n % 2 == 0:\n a[2] += 1\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a[f] += 1\n n //= f\n else:\n f += 2\n if n != 1:\n a[n] += 1\n return a\n\ndef f(k):\n if k % 2 == 0 or k % 5 == 0:\n return -1 \n\n val = 7\n cnt = 1\n while True:\n if val % k == 0:\n break\n cnt += 1\n val = val * 10 + 7\n return cnt\n \nli = prime_factorize(k)\n\nli = {343:1}\n\nans = 1\nfor k, v in li.items():\n if k ** v <= 10000:\n ans *= f(k) * k ** (v - 1)\n else:\n ans *= (k - 1) * k ** (v - 1)\n \nif ans < 0:\n print(-1)\nelse:\n print(ans)', 'k = int(input())\n\nval = 7\ncnt = 1\n\nwhile cnt <= 10 ** 6:\n val %= k\n if val % k == 0:\n print(cnt)\n exit()\n cnt += 1\n val = val * 10 + 7\n\nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s005643421', 's136752467'] | [9340.0, 9172.0] | [34.0, 273.0] | [731, 155] |
p02596 | u811709035 | 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\ns = (s * 10 + 7) % k\ncnt = 0\nif k % 2 == 1 and not k % 5 == 0:\n while(1):\n if s == 0:\n cnt += 1\n print(cnt)\n break\n else:\n s = (s * 10 + 7) % k\n cnt += 1\nelse:\n print(-1)', 'k = int(input())\ns = 7\ns = s % k\ncnt = 0\nif k % 2 == 1 and not k % 5 == 0:\n while(1):\n if s == 0:\n cnt += 1\n print(cnt)\n break\n else:\n s = (s * 10 + 7) % k\n cnt += 1\nelse:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s423698149', 's630664815'] | [9072.0, 9144.0] | [199.0, 203.0] | [268, 257] |
p02596 | u811817592 | 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. | ['# -*- coding: utf-8 -*-\nK = int(input())\n\ndef factorize(target_number):\n factor_list = []\n while target_number % 2 == 0:\n factor_list.append(2)\n target_number //= 2\n factor = 3\n while factor * factor <= target_number:\n while target_number % factor == 0:\n target_number //= factor\n factor_list.append(factor)\n factor += 2\n if target_number > 1:\n factor_list.append(target_number)\n return factor_list\n\nfact_list = factorize(K)\nif fact_list.count(2) > 0 or fact_list.count(5) > 0:\n print(-1)\nelse:\n num = 7\n for i in range(10 ** 6):\n if num % K:\n print(i + 1)\n break\n num = num * 10 + 7\n ', '# C TLE\n# -*- coding: utf-8 -*-\nK = int(input())\n\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\nelse:\n num = 7\n for i in range(10 ** 6):\n mod_num = num % K\n if mod_num == 0:\n print(i + 1)\n break\n num = mod_num * 10 + 7\n '] | ['Wrong Answer', 'Accepted'] | ['s702479533', 's445330846'] | [9144.0, 9100.0] | [2206.0, 215.0] | [708, 269] |
p02596 | u821969418 | 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\nans = 0\nai = 0\n\nwhile True:\n ai = (ai*10 + 7)% k\n ans += 1\n if ai = 0:\n break\nprint(ans)', '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', 'Accepted'] | ['s547308309', 's017058003'] | [8720.0, 9164.0] | [26.0, 199.0] | [122, 174] |
p02596 | u823926181 | 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)\nelse:\n seven_num = 0\n flg = True\n n = 0\n while(flg):\n print(n)\n seven_num += (10 ** n) * 7\n if(seven_num % K == 0):\n print(n + 1)\n flg = False\n n += 1', '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', 'Accepted'] | ['s246612276', 's257817535'] | [9296.0, 9160.0] | [2205.0, 232.0] | [260, 141] |
p02596 | u827554201 | 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. | ["from sys import exit\n\nK = int(input())\n\nif K % 2 == 0:\n print(-1)\n exit()\n\ncosmo = '{:7>1000000d}'.format(7)\n\nnum = 1\nfor x in range(1, len(cosmo) + 1):\n if len(str(K)) > x:\n break\n\n if int(cosmo[0:x]) % K == 0:\n print(num)\n exit()\n\n num += 1\n\nprint(-1)", 'def calc(K):\n if K % 2 == 0:\n print(-1)\n return\n elif 7 % K == 0:\n print(1)\n return\n\n a = [7 % K]\n for x in range(1, K):\n cur = (a[x-1]*10+7) % K\n if cur == 0:\n print(x + 1)\n return\n else:\n a.append(cur)\n\n print(-1)\n\n\nK = int(input())\n\ncalc(K)'] | ['Wrong Answer', 'Accepted'] | ['s639066518', 's981774347'] | [9928.0, 48492.0] | [31.0, 222.0] | [289, 340] |
p02596 | u843768197 | 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 = str(input())\nS = '7'*len(K)\nans = 0\n\nif int(K)%2 == 0 or int(K)%5 == 0:\n ans = 2\n\nwhile ans == 0:\n if int(S)%int(K) == 0:\n ans = 1\n else:\n S += '7'\n print(len(S))\n\nif ans == 1:\n print(len(S))\nelse:\n print('-1')\n", 'k = int(input())\nans = 7%k\n\nfor i in range(1, 10**6 + 1):\n if ans%k == 0:\n print(i)\n exit()\n else:\n ans = (ans*10 + 7)%k\nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s843908816', 's991672184'] | [9264.0, 9188.0] | [2205.0, 218.0] | [247, 141] |
p02596 | u845468321 | 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\nt = 7\nfor i in range(K):\n print(t)\n if t % K == 0:\n print(i + 1)\n break\n t = (t * 10 + 7) % K\nelse:\n print(-1)', 'K = int(input())\n\nt = 7\nfor i in range(K):\n print(t)\n if t % K == 0:\n break\n t = (t * 10 + 7) % K\nelse:\n print(-1)', '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', 'Wrong Answer', 'Accepted'] | ['s082523545', 's883838345', 's535183665'] | [9956.0, 10016.0, 9096.0] | [495.0, 503.0, 206.0] | [142, 123, 131] |
p02596 | u852210959 | 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. | ['# -*- coding: utf-8 -*-\n\n\n\ndef input_int():\n return int(input())\n\n\n\ndef int1(x):\n return int(x) - 1\n\n\n\ndef input_to_int_map():\n return map(int, input().split())\n\n\n\ndef input_to_int_tuple():\n return tuple(map(int, input().split()))\n\n\n\ndef input_to_int_tuple_minus1():\n return tuple(map(int1, input().split()))\n\n\ndef main():\n k = input_int()\n t = 7\n for i in range(1000000):\n t %= k\n if t == 0:\n print(i + 1)\n t = t * 10 + 7\n\n print(-1)\n\n\nif __name__ == "__main__":\n main()\n', '# -*- coding: utf-8 -*-\n\n\n\ndef input_int():\n return int(input())\n\n\n\ndef int1(x):\n return int(x) - 1\n\n\n\ndef input_to_int_map():\n return map(int, input().split())\n\n\n\ndef input_to_int_tuple():\n return tuple(map(int, input().split()))\n\n\n\ndef input_to_int_tuple_minus1():\n return tuple(map(int1, input().split()))\n\n\ndef main():\n k = input_int()\n t = 7\n for i in range(1000000):\n t %= k\n if t == 0:\n print(i + 1)\n return\n t = t * 10 + 7\n\n print(-1)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s123777147', 's388724999'] | [9928.0, 9136.0] | [416.0, 140.0] | [846, 865] |
p02596 | u855219015 | 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, D = (int(a) for a in input().split())\nX2Y2 = [[int(a) ** 2 for a in input().split()] for b in range(N)]\nX2, Y2 = [list(i) for i in zip(*X2Y2)]\n\nc = 0\nDD = D ** 2\nfor i in range(N):\n if X2[i] + Y2[i] <= DD:\n c += 1\nprint(c)', 'K = int(input())\nif (K % 5 == 0) | (K % 2 == 0):\n print(-1)\n\nelse:\n a = 7\n for i in range(K):\n if a % K == 0:\n print(i + 1)\n exit()\n a = (10 * a + 7) % K\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s668261190', 's547931845'] | [9184.0, 9112.0] | [24.0, 210.0] | [235, 184] |
p02596 | u890751161 | 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. | ['b=0\ni=0\nif K%2==0:\n print(-1)\nelse:\n while True:\n a=10**i\n b=b+7*a\n i+=1\n if b%K==0:\n print(i)\n break', 'K=int(input())\ni=1\nif K%2==0 or K%5==0:\n print(-1)\nelif K%7==0:\n L=9*K/7\n b=10\n while True:\n b=b%L\n if b==1:\n print(i)\n break\n b=b*10\n i+=1\nelse:\n L=9*K\n b=10\n while True:\n b=b%L\n if b==1:\n print(i)\n break\n b=b*10\n i+=1'] | ['Runtime Error', 'Accepted'] | ['s634191084', 's543022456'] | [9012.0, 9124.0] | [23.0, 196.0] | [125, 270] |
p02596 | u893661063 | 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. | ['#C-respect\nK = int(input())\ncount = 1\na = 7 % K\n\nfor i in range(K):\n a = (10 * a + 7) % K\n if a == 0:\n print (count)\n exit ()\n else:\n count += 1\n\nprint (-1)', '#C-respect\nK = int(input())\ncount = 1\na = 7 % K\n\nfor i in range(K):\n a = (10 * a + 7) % K\n if a == 0:\n break\n else:\n count += 1\nprint (count)', '#C-respect\nK = int(input())\ncount = 1\na = 7 % K\n\nfor i in range(K):\n if a == 0:\n print (count)\n exit ()\n else:\n a = (10 * a + 7) % K\n count += 1\n\nprint (-1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s158597229', 's616087631', 's396116919'] | [9176.0, 9012.0, 9104.0] | [218.0, 228.0, 244.0] | [186, 164, 190] |
p02596 | u895408600 | 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\ntmp = 7\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\nelse:\n x = (9/7) * K + 1\n ans = 0\n while x != 1:\n x /= 10\n ans += 1\n print(ans)', 'k=int(input())\na=7\nfor i in range(10**6):\n if a%k==0:\n print(i+1)\n exit()\n a=(a*10+7)%k\nprint(-1)'] | ['Time Limit Exceeded', 'Accepted'] | ['s214175134', 's605800708'] | [9060.0, 8992.0] | [2205.0, 220.0] | [181, 117] |
p02596 | u901850884 | 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. | ['\nusing namespace std;\n\nint main(){\n int k;\n int n=7;\n int count=1;\n\n cin>>k;\n\n while(n%k != 0){\n if(k%2==0){\n count=-1;\n break;\n }\n else if(k%5==0){\n count=-1;\n break;\n }\n n=10*n+7;\n count++;\n }\n cout<<count<<"\\n";\n\n}\n \n ', '\nk=int(input())\na=[]\njudge=0\na.append(7%k)\nfor i in range(1,k):\n a.append((a[i-1]*10+7)%k)\nfor i in range(k):\n if a[i]==0:\n print(i)\n judge=1\n break\nif judge==0:\n print(-1)', '\nusing namespace std;\n\nint main(){\n int k;\n int n=7;\n int count=1;\n\n cin>>k;\n\n while(n%k != 0){\n if(k%2=0){\n count=-1;\n break;\n }\n else(k%5=0){\n count=-1;\n break;\n }\n n=10*n+7;\n count++;\n }\n cout<<count<<"\\n";\n\n}\n ', 'k=int(input())\na=[]\njudge=0\na.append("")\na.append(7%k)\nfor i in range(2,k+1):\n a.append((a[i-1]*10+7)%k)\nfor i in range(1,k+1):\n if a[i]==0:\n print(i)\n judge=1\n break\nif judge==0:\n print(-1)\n\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s463723912', 's860786710', 's914029150', 's062949508'] | [8952.0, 48548.0, 9000.0, 48472.0] | [24.0, 327.0, 24.0, 331.0] | [468, 210, 393, 222] |
p02596 | u907997483 | 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. | ['# coding: utf-8\n# Your code here!\n\nK = int(input())\n\nSequence = 0\nflag = 0\nfor i in range(K) : \n Sequence += 7*(10**i)\n\n if Sequence % K == 0 : \n flag = 1\n break\n\nif flag == 1 : \n print(K)\nelse : \n print(-1)', '# coding: utf-8\n# Your code here!\n\nK = int(input())\n\ni = 0\nSequence = 0\nSurplus_list = []\nwhile(True) : \n while(True) : \n Sequence += 7*(10**i)\n if Sequence >= K : \n break\n i += 1\n \n if Sequence % K == 0 : \n flag = 1\n break\n else : \n if K in Surplus_list : \n flag = 0\n break\n else : \n Surplus_list.append(K)\n \n i += 1\n \nif flag == 1 : \n print(K)\nelse : \n print(-1)', '# coding: utf-8\n# Your code here!\n\nK = int(input())\n\ns = 7 % K\nfor i in range(1, K+1) : \n if i != 1 : \n s = (10*s + 7) % K\n\n if s == 0 : \n print(i)\n exit()\n\nprint(-1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s043515009', 's296000730', 's249458101'] | [9072.0, 9124.0, 8980.0] | [2206.0, 26.0, 216.0] | [233, 492, 193] |
p02596 | u909224749 | 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 \nsevens = 7\ncount = 0\n \nwhile(sevens % K !=0):\n count += 1\n sevens = sevens * 10 + 7\n if count > K:\n count = -1\n break\n \nprint(count)', 'K = int(input())\n\nsevens = 7\ncount = 0\n\nwhile(sevens % K !=0):\n count += 1\n sevens = sevens * 10 + 7\n if count > K:\n print(-1)\n\tbreak\n \nprint(count)', 'K = int(input())\n \nsevens = 7 % K\ncount = 1\n \nwhile(sevens % K !=0):\n \n sevens = sevens * (10 % K) + (7 % K)\n sevens = sevens % K\n \n count += 1\n if count > K:\n count = -1\n break\n \nprint(count)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s421402842', 's483434493', 's986600852'] | [9212.0, 8824.0, 9164.0] | [2206.0, 24.0, 369.0] | [163, 157, 277] |
p02596 | u917678406 | 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)\nN = 7\nfor i in range(K):\n if\u3000N % K == 0:\n print(i + 1)\n break\n N = ((N * 10) + 7) % K', 'K = int(input())\nif(K % 2 == 0 | K % 5 == 0):\n print(-1)\nN = 7\nfor i in range(K):\n if\u3000N % K == 0:\n print(i + 1)\n break\n else:\n N = ((N * 10) + 7) % K', 'import sys\nK = int(input())\nN = 0\nfor i in range (K):\n if((K // (N + (10**i)*7)) == 0):\n print(i + 1)\n sys.exit()\n else:\n N = (N + (10**i)*7)\nprint(-1)', 'K = int(input())\nif(K % 2 == 0) or (K % 5 == 0):\n print(-1)\nN = 7\nfor i in range(K):\n if\u3000N % K == 0:\n print(i + 1)\n break\n N = ((N * 10) + 7) % K', 'K = int(input())\nif(K % 2 == 0 | K % 5 == 0):\n print(-1)\nN = 7\nfor i in range(K):\n if\u3000N % 7 == 0:\n print(i + 1)\n break\n else:\n N = ((N * 10) + 7) % K', 'K = int(input())\nif(K % 2 == 0 or K % 5 == 0):\n print(-1)\nN = 7\nfor i in range(K):\n if\u3000N % K == 0:\n print(i + 1)\n break\n else:\n N = ((N * 10) + 7) % K', 'import sys\nK = int(input())\nN = 0\nfor i in range 2000000:\n if((K // (N + (10**i)*7)) == 0):\n print(i + 1)\n sys.exit()\n else:\n N = (N + (10**i)*7)\nprint(-1)', '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)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s187888678', 's328695511', 's363674897', 's374949155', 's428589605', 's492814685', 's688565566', 's458097458'] | [8960.0, 8808.0, 9104.0, 8916.0, 8956.0, 8936.0, 9020.0, 9104.0] | [23.0, 28.0, 27.0, 27.0, 24.0, 25.0, 26.0, 208.0] | [168, 181, 178, 170, 181, 182, 182, 141] |
p02596 | u922299074 | 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())\nan=0\nfor i in range(K):\n an=(10*an+7)%K\n if an==0:\n print(i+1)\n exit\nprint(-1)\n', 'K=int(input())\nan=0\nfor i in range(K):\n an=(10*an+7)%K\n if an==0:\n print(i+1)\n exit()\n \nprint(-1)'] | ['Wrong Answer', 'Accepted'] | ['s007695500', 's710694625'] | [9136.0, 9140.0] | [178.0, 184.0] | [114, 124] |
p02596 | u923662841 | 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 is_prime_1(num):\n if num < 2:\n return False\n else:\n num_sqrt = math.floor(math.sqrt(num))\n for prime in range(2, num_sqrt + 1):\n if num % prime == 0:\n return False\n break\n return True\n\nK = int(input())\nketa = len(str(K))\nans = keta\nif K % 2 == 0 or K % 5 == 0:\n print(-1)\nelif K % 7 == 0:\n if not is_prime_1(K//7):\n print(-1)\n else:\n M = 1\n while True:\n N = str(K*M//7)\n if set(N) == {"1"}:\n print(len(N))\n break\n else:\n M += 10\nelse:\n if not is_prime_1(K):\n print(-1)\n else:\n J = 1\n M = 7 *J\n while True:\n N = str(K*M//7)\n if set(N) == {"1"}:\n print(len(N))\n break\n else:\n J += 2', 'K = int(input())\n\nif K%2 == 0 or K%5 == 0:\n print(-1)\nelse:\n if K%7 == 0:\n L = 9*K//7\n else:\n L = 9*K\n i = 1\n A = 10\n while i < 9000000:\n re = A%L\n if re == 1:\n print(i)\n break\n else:\n A = re*10\n i += 1\n else:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s240499616', 's719161619'] | [9144.0, 9176.0] | [2206.0, 219.0] | [892, 327] |
p02596 | u940780117 | 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:\n print(-1)\n exit()\nnum=7\nans=-1\nfor i in range(1,10*8):\n if num%N==0:\n ans=i\n break\n num=str(num)\n num+='7'\n num=int(num)\nif i ==79:\n print(N-1)\nelse\n print(ans)\n", 'N=int(input())\nx=7%N\nfor i in range(1,N+1):\n if x==0:\n print(i)\n exit()\n x=(x*10+7)%N\nprint(-1)\n'] | ['Runtime Error', 'Accepted'] | ['s063001922', 's198742721'] | [9040.0, 9160.0] | [28.0, 175.0] | [226, 116] |
p02596 | u941438707 | 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())\ndef p(n):\n a=[]\n for i in range(2,1+int(n**.5)):\n while n%i==0:\n n//=i\n a+=[i]\n if n!=1:\n a+=[n]\n return a\nif len(p(k))>1:print(-1)\nelif k==2 or k==5:print(-1)\nelif k==3:print(3)\nelse:print(k-1)', 'k=int(input())\ndef p(n):\n a=[]\n for i in range(2,1+int(n**.5)):\n while n%i==0:\n n//=i\n a+=[i]\n if n!=1:\n a+=[n]\n return a\nif len(p(k))>1:print(-1)\nelif k==2 or k==5:print(-1)\nelif k==3:print(3)\nelse:print(p(k-1)[0])', 'k=int(input())\na=7\nfor i in range(1,k+1):\n if a%k==0:\n print(i)\n exit()\n a=(a*10+7)%k\nprint(-1)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s061525981', 's470271840', 's823367455', 's706839351'] | [9040.0, 9448.0, 9456.0, 9156.0] | [31.0, 30.0, 34.0, 211.0] | [9, 257, 263, 97] |
p02596 | u949327459 | 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\nK = int(input())\n\nif 1<K<10**6:\n print(-1)\n sys.exit()\n\nif K%2 == 0 or K%5 ==0:\n print(-1)\n sys.exit()\n \nN = 7\ncount = 0\ni = 1\n\nwhile i:\n \n count += 1\n if N % K == 0:\n print(count)\n sys.exit()\n \n N = N*10 + 7', 'K = int(input())\n\nN = 0\ncount = -1\n\nfor i in range(K):\n N = (N*10+7)%K\n if N == 0:\n count = i+1\n break\n \nprint(count)\n'] | ['Wrong Answer', 'Accepted'] | ['s764664597', 's462669106'] | [9168.0, 9144.0] | [29.0, 175.0] | [268, 141] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.