s_id
string
p_id
string
u_id
string
date
string
language
string
original_language
string
filename_ext
string
status
string
cpu_time
string
memory
string
code_size
string
code
string
error
string
stdout
string
s143198420
p02550
u098012509
1600546788
Python
Python (3.8.2)
py
Runtime Error
60
18164
1045
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N, X, M = [int(x) for x in input().split()] x = {} ruiseki = [0] * (M + 1) cnt = 1 ans = X c = X ruiseki[1] = ans while cnt < N: next = c ** 2 % M if next in x.keys(): y = ...
Traceback (most recent call last): File "/tmp/tmpd6jygkta/tmp41qviyud.py", line 50, in <module> main() File "/tmp/tmpd6jygkta/tmp41qviyud.py", line 9, in main N, X, M = [int(x) for x in input().split()] ^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s960421997
p02550
u093041722
1600546785
Python
Python (3.8.2)
py
Runtime Error
2207
40188
444
N,X,M = map(int, open(0).read().split()) A = [] A.append(X) B = [] for i in range(N-1): if pow(A[-1],2) < M: A.append(pow(A[-1],2)) else: B.append(pow(A[-1],2,M)) break b = set(B) for i in range(N-1): temp = pow(B[-1],2,M) if temp not in b: B.append(temp) b.add(te...
Traceback (most recent call last): File "/tmp/tmp_8zi3ibo/tmpstepqtos.py", line 1, in <module> N,X,M = map(int, open(0).read().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s621878883
p02550
u469254913
1600546771
Python
Python (3.8.2)
py
Runtime Error
2206
9828
1170
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N,X,M = map(int,input().split()) A = [-1 for i in range(M)] A[0] = X for i in range(1,M): temp = A[i-1] ** 2 temp %= M ...
Traceback (most recent call last): File "/tmp/tmpjmx2d8ja/tmp2zz2kjm2.py", line 69, in <module> main() File "/tmp/tmpjmx2d8ja/tmp2zz2kjm2.py", line 11, in main N,X,M = map(int,input().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s572525237
p02550
u767664985
1600546752
Python
Python (3.8.2)
py
Runtime Error
79
13608
1014
N, X, M = map(int, input().split()) A = [-1 for _ in range(M*2)] # どうせ M 回以内でループに入るので A[0] = X is_seen = [0 for _ in range(M)] # is_seen[i] : i がすでに現れたか is_seen[X] = 1 first_sum = X for i in range(N-1): A[i+1] = A[i]**2 % M first_sum += A[i+1] if A[i+1] == 0: break elif is_seen[A[i+1]]: ...
Traceback (most recent call last): File "/tmp/tmpv6e10_24/tmpd0t5zvgg.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s262727426
p02550
u098012509
1600546736
Python
Python (3.8.2)
py
Runtime Error
70
18036
963
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N, X, M = [int(x) for x in input().split()] x = {} ruiseki = [0] * (M + 1) cnt = 1 ans = X c = X ruiseki[1] = ans while cnt < N: next = c ** 2 % M if next in x.keys(): y = ...
Traceback (most recent call last): File "/tmp/tmpcuu1kaku/tmp2dhfvqfc.py", line 47, in <module> main() File "/tmp/tmpcuu1kaku/tmp2dhfvqfc.py", line 9, in main N, X, M = [int(x) for x in input().split()] ^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s876988917
p02550
u736524428
1600546719
Python
Python (3.8.2)
py
Runtime Error
59
13960
786
N, X, M = map(int, input().split()) A_history = [-1] * M sum_history = [0] * (M + 1) A = X all_sum = A sum_history[0] = A for i in range(M): Anext = (A * A) % M all_sum += Anext sum_history[i + 1] = all_sum if A_history[A] == -1: A_history[A] = i else: break A = Anext if i >=...
Traceback (most recent call last): File "/tmp/tmpo3mb_ful/tmpq8i0_kc5.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s226826358
p02550
u556610039
1600546703
Python
Python (3.8.2)
py
Runtime Error
2206
12744
584
n, x, m = map(int, input().split()) ans = 0 loopList = [0] * 10 ** 5 startcnt = 0 loopcnt = 0 val = x while True: if startcnt >= n: val = 0 break if val >= m: break ans += val startcnt += 1 val **= 2 while True: if val < m and loopcnt == 0: break val %= m if val == loopLi...
Traceback (most recent call last): File "/tmp/tmpclc9jr5w/tmpqt9edpe7.py", line 1, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s853572666
p02550
u693025087
1600546645
Python
PyPy3 (7.3.0)
py
Runtime Error
107
73412
1002
# -*- coding: utf-8 -*- # map(int, input().split()) N,X,M = map(int, input().split()) first_A = [X] mod_M = [False for i in range(M)] mod_M[0] = True mod_M[1] = True is_break = False for i in range(min(N-1,M+1)): A_n1 = pow(first_A[-1],2)%M if mod_M[A_n1]: is_break = True last_num = A_n1 ...
Traceback (most recent call last): File "/tmp/tmpi4wl2rwr/tmp3yh7t6hs.py", line 3, in <module> N,X,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s773445548
p02550
u652907854
1600546621
Python
Python (3.8.2)
py
Runtime Error
89
21192
3507
"""MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:,'..'xXWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .:kOo.,kNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .lNWWo..lXMMMMMMMMMMMM...
Traceback (most recent call last): File "/tmp/tmphcb20f1p/tmpfvwx7_qo.py", line 56, in <module> n, x, m = get_ints() ^^^^^^^^^^ File "/tmp/tmphcb20f1p/tmpfvwx7_qo.py", line 29, in get_ints def get_ints() : return map(int, input().strip().split()) ...
s083291583
p02550
u997036872
1600546504
Python
Python (3.8.2)
py
Runtime Error
408
47492
107
N,X,M = map(int,input().split()) a = [0]*N a[0] = X for i in range(N-1): a[i+1]=a[i]**2%M print(sum(a))
Traceback (most recent call last): File "/tmp/tmpkvhd46h9/tmpuz06njg8.py", line 1, in <module> N,X,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s587906792
p02550
u514390882
1600546497
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
68396
791
N, X, M = map(int, input().split()) ans = 0 roop_init = 0 roop_sum = 0 roop_len = 0 x = X ans += x flug = False # 周期を数えるフラグ for i in range(2, N+1): old_x = x x = old_x**2 % M if x == 0: break if old_x**2 >= M and not flug: # print(old_x, x) flug = True roop_init = x ...
Traceback (most recent call last): File "/tmp/tmpzxjdqdu_/tmpgoy5o59s.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s499885467
p02550
u701017915
1600546491
Python
Python (3.8.2)
py
Runtime Error
62
12016
482
N, X, M = map(int, input().split()) a = [0 for i in range(M+1)] b = [X] a[X-1] = 1 for i in range(min(N, M)): X = X**2%M a[X-1] += 1 b.append(X) if a[X-1] > 1: break if len(b) == N: print(sum(b)) else: ls = b.index(b[-1]) bloop = b[ls:-1] ans = 0 if ls > 0: for i in range(ls): ans += ...
Traceback (most recent call last): File "/tmp/tmptxjum4vq/tmp2rzu3bym.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s414808419
p02550
u476674874
1600546476
Python
Python (3.8.2)
py
Runtime Error
2205
13076
508
def main(): N, X, M = map(int, input().split()) A = [X % M] setA = set(A) while True: a = (A[-1] ** 2) % M if a in setA: break A.append(a) setA.add(a) pre = A.index(a) length = len(A) ans = 0 loop = A[pre:] for i in range(1,N+1): ...
Traceback (most recent call last): File "/tmp/tmp6us9cyyu/tmpck9pkb_d.py", line 28, in <module> main() File "/tmp/tmp6us9cyyu/tmpck9pkb_d.py", line 2, in main N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s810498158
p02550
u767664985
1600546365
Python
Python (3.8.2)
py
Runtime Error
76
12680
1022
N, X, M = map(int, input().split()) A = [-1 for _ in range(M)] # どうせ M 回以内でループに入るので A[0] = X is_seen = [0 for _ in range(M)] # is_seen[i] = i がすでに現れたか is_seen[X] = 1 summation = X loop_length = -1 for i in range(N-1): A[i+1] = A[i]**2 % M summation += A[i+1] if A[i+1] == 0: break elif is_s...
Traceback (most recent call last): File "/tmp/tmpxyldfaor/tmpqi1qd2jt.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s129201059
p02550
u852690916
1600546356
Python
PyPy3 (7.3.0)
py
Runtime Error
86
68580
473
N, X, M = map(int, input().split()) U = [0] * (M + 10) U[X] = 1 S = [0] * (M + 10) S[1] = X v = X l = r = 0 # [l,r) で巡回 cycle_sum = 0 for i in range(2, M + 1): v = (v * v) % M if U[v]: l = U[v] r = i cycle_sum = S[i - 1] + v - S[l] break U[v] = i S[i] = S[i - 1] + v if N...
Traceback (most recent call last): File "/tmp/tmpzo1q5ccv/tmps0suk5dd.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s031595403
p02550
u290886932
1600546353
Python
Python (3.8.2)
py
Runtime Error
2206
9668
381
N, X, M = map(int,input().split()) A = [X] ret = X k = X for i in range(N): k = (k * k) % M ret += k if k in A: A.append(k) break A.append(k) if len(A) == N: print(ret) else: i = A.index(A[-1]) s_rep = sum(A[i:-1]) a_rep = A[i:-1] s_init = sum(A[:i]) k = len(a_rep) l_ = N - i ret = s_...
Traceback (most recent call last): File "/tmp/tmpxcr8ym8t/tmplwa6zs6d.py", line 1, in <module> N, X, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s017298100
p02550
u414050834
1600546353
Python
Python (3.8.2)
py
Runtime Error
2206
9572
378
n,x,m=map(int,input().split()) ans=0 p=0 l=[x] if x%m==0: print(x) else: for i in range(1,n): s=(l[i-1]**2)%m if s==0: p=1 break if s in l: break else: l.append(s) if p==0: t=sum(l[1:]) k=(n-1)//(len(l)-1) #ループ何回回るか j=(n-1)%(len(l)-1) ans=x+t*k+sum(l[1:j+1])...
Traceback (most recent call last): File "/tmp/tmpnzxv6lwc/tmpb49aoyjq.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s323013372
p02550
u711245972
1600546325
Python
PyPy3 (7.3.0)
py
Runtime Error
108
68640
460
n, x, m = map(int,input().split()) ans = 0 a = [] y = [] a.append(x) ans += x y.append(x%m) for _ in range(N-1): a.append(y[-1]**2%m) ans += y[-1]**2%m y.append(a[-1]%m) if y[-1] in y[:-1]: ans -= a[-1] i = y[:-1].index(y[-1]) h=len(y)-1 one_loop = h-i loop_list =...
Traceback (most recent call last): File "/tmp/tmp52gdqolk/tmpd0a_sefu.py", line 1, in <module> n, x, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s792767729
p02550
u767664985
1600546313
Python
Python (3.8.2)
py
Runtime Error
76
12744
1221
N, X, M = map(int, input().split()) A = [-1 for _ in range(M)] # どうせ M 回以内でループに入るので A[0] = X is_seen = [0 for _ in range(M)] # is_seen[i] = i がすでに現れたか is_seen[X] = 1 summation = X loop_length = -1 for i in range(N-1): A[i+1] = A[i]**2 % M summation += A[i+1] if A[i+1] == 0: break elif is_s...
Traceback (most recent call last): File "/tmp/tmpedq05x2m/tmp_i8bj00r.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s202616621
p02550
u371409687
1600546295
Python
Python (3.8.2)
py
Runtime Error
2206
9620
269
n,x,m=map(int,input().split()) tmp=x L=[] for i in range(n): tmp=tmp**2%m if tmp not in L: L.append(tmp) else: break times=(n-2)//(len(L)-1) loss=(n-2)%(len(L)-1) ans=x+L[0]+sum(L[1:])*times for i in range(loss): ans+=L[i+1] print(ans)
Traceback (most recent call last): File "/tmp/tmpjhqv9q3q/tmpofl05y7l.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s718231252
p02550
u852690916
1600546282
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74396
463
N, X, M = map(int, input().split()) U = [0] * (M) U[X] = 1 S = [0] * (M) S[1] = X v = X l = r = 0 # [l,r) で巡回 cycle_sum = 0 for i in range(2, M + 1): v = (v * v) % M if U[v]: l = U[v] r = i cycle_sum = S[i - 1] + v - S[l] break U[v] = i S[i] = S[i - 1] + v if N < l: ...
Traceback (most recent call last): File "/tmp/tmpsk4jmxqm/tmpphck0xgp.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s840324605
p02550
u623231048
1600546279
Python
PyPy3 (7.3.0)
py
Runtime Error
96
79756
887
n,x,m = map(int,input().split()) li = [-1] * m v = [False] * m v2 = [False] * m v[x+1] = True tmp = x ans = x loop = 0 cnt = 0 cnt_l = 0 loop_li = [0] ans_li = [x] for i in range(m): li[i] = i ** 2 % m while True: tmp = li[tmp] ans += tmp v[tmp] = True cnt += 1 ans_li.append(ans_li[-1] + tmp)...
Traceback (most recent call last): File "/tmp/tmp1rc5s41n/tmpj0nf5kpk.py", line 1, in <module> n,x,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s494993622
p02550
u355846758
1600546258
Python
Python (3.8.2)
py
Runtime Error
28
8908
143
r = input() s = r.split(" ") n = int(s[0]) x = int(s[1]) m = int(s[2]) sum = x for i in range(0,n-1): x = (x*x)%m sum = sum + x print(sum)
File "/tmp/tmpoba472b4/tmpuiucc5gt.py", line 9 sum = sum + x ^ IndentationError: unindent does not match any outer indentation level
s424992284
p02550
u517152997
1600546239
Python
PyPy3 (7.3.0)
py
Runtime Error
98
74488
623
# import sys import math import itertools # 整数をいくつか入力 n,x,m = (int(i) for i in input().split()) if n < 100000: b=0 for i in range(n): b += x #print(x) x = (x*x) %m print(b) else: ll=[0]*100000 s=0 for i in range(100000): ll[i]=x s += x x = (x*x)...
File "/tmp/tmpycutl24g/tmpfyrvquyo.py", line 35 print(s%) ^ SyntaxError: invalid syntax
s163877533
p02550
u730257868
1600546229
Python
PyPy3 (7.3.0)
py
Runtime Error
801
70296
326
n,x,m=map(int,input().split()) a=list() ans=0 s=n for i in range(n): ans+=x a.append(x) x=(x**2)%m if x in a: s=a.index(x) break sum=0 if s!=n: for i in range(s, len(a)): sum+=a[i] ans+=sum*(((n-s)//(len(a)-s))-1) z=(n-s)%(len(a)-s) for i in range(z): ans+=a[s+i] print...
Traceback (most recent call last): File "/tmp/tmp947ysz3_/tmpk98yip8z.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s982232158
p02550
u767664985
1600546203
Python
Python (3.8.2)
py
Runtime Error
82
12800
1149
N, X, M = map(int, input().split()) A = [-1 for _ in range(M)] # どうせ M 回以内でループに入るので A[0] = X is_seen = [0 for _ in range(M)] # is_seen[i] = i がすでに現れたか is_seen[X] = 1 summation = X loop_length = -1 for i in range(N-1): A[i+1] = A[i]**2 % M summation += A[i+1] if A[i+1] == 0: break elif is_s...
Traceback (most recent call last): File "/tmp/tmpr7l9d29p/tmpwd2wgl2n.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s776928024
p02550
u469254913
1600546180
Python
Python (3.8.2)
py
Runtime Error
2206
10064
1008
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N,X,M = map(int,input().split()) A = [-1 for i in range(M)] A[0] = X for i in range(1,M): temp = A[i-1] ** 2 temp %= M ...
Traceback (most recent call last): File "/tmp/tmpq6oq1uaw/tmpq2j7jxi1.py", line 57, in <module> main() File "/tmp/tmpq6oq1uaw/tmpq2j7jxi1.py", line 11, in main N,X,M = map(int,input().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s282691623
p02550
u701017915
1600546161
Python
Python (3.8.2)
py
Runtime Error
71
12036
480
N, X, M = map(int, input().split()) a = [0 for i in range(M)] b = [X] a[X-1] = 1 for i in range(min(N, M)): X = X**2%M a[X-1] += 1 b.append(X) if a[X-1] > 1: break if len(b) == N: print(sum(b)) else: ls = b.index(b[-1]) bloop = b[ls:-1] ans = 0 if ls > 0: for i in range(ls): ans += b[...
Traceback (most recent call last): File "/tmp/tmp351rwwy4/tmpsuda4h_p.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s833555342
p02550
u067983636
1600546113
Python
PyPy3 (7.3.0)
py
Runtime Error
126
75844
953
import bisect from collections import deque import copy import heapq import sys import itertools import math import queue input = sys.stdin.readline sys.setrecursionlimit(1000000) # mod = 10 ** 9 + 7 mod = 998244353 def read_values(): return map(int, input().split()) def read_index(): return map(lambda x: int(x) - 1, ...
Traceback (most recent call last): File "/tmp/tmp1gn76mbt/tmpyigxjxcn.py", line 54, in <module> main() File "/tmp/tmp1gn76mbt/tmpyigxjxcn.py", line 22, in main N, X, M = read_values() ^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s277312713
p02550
u492910842
1600546109
Python
PyPy3 (7.3.0)
py
Runtime Error
101
68436
292
n,x,m=map(int,input().split()) a=[0]*(m+2) cnt=[0]*(m+2) a[1],f=x,x cnt[f]=1 for i in range(2,m+1): f=f*f%m a[i]=f if cnt[f]==0: cnt[f]=1 else: break ind=a[1:].index(f)+1 ans=sum(a[:ind])+sum(a[ind:i])*((n-ind+1)//(i-ind)) p=(n-ind+1)%(i-ind) ans+=sum(a[ind:ind+p]) print(ans)
Traceback (most recent call last): File "/tmp/tmptvzj5tz8/tmpdnhohuoe.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s243609613
p02550
u360574092
1600546066
Python
PyPy3 (7.3.0)
py
Runtime Error
126
68424
466
N, X, M = map(int, input().split()) appearance = [0] * (M + 1) cum_sum = [0] A = X appearance[A] = 1 cum_sum.append(A) for a in range(2, N + 1): A = (A**2)%M if appearance[A] != 0: n = a - 1 break appearance[A] = a cum_sum.append(cum_sum[-1] + A) else: n = a k = appearance[A] l = (N - ...
Traceback (most recent call last): File "/tmp/tmp3802gjuc/tmpwjgcifn9.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s600873614
p02550
u730257868
1600546053
Python
PyPy3 (7.3.0)
py
Runtime Error
797
70548
305
n,x,m=map(int,input().split()) a=list() ans=0 for i in range(n): ans+=x a.append(x) x=(x**2)%m if x in a: s=a.index(x) break sum=0 for i in range(s, len(a)): sum+=a[i] ans+=sum*(((n-s)//(len(a)-s))-1) z=(n-s)%(len(a)-s) for i in range(z): ans+=a[s+i] print(ans)
Traceback (most recent call last): File "/tmp/tmptmcv4pcy/tmpd134mp4r.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s927690389
p02550
u290187182
1600545958
Python
Python (3.8.2)
py
Runtime Error
2206
10708
753
if __name__ == '__main__': n, k,x = map(int, input().split()) mod = 998244353 ans = 0 index=0 a= k %x dict={} for i in range(n): if a not in dict.values(): ans += a index += 1 dict[i]=a a = a*a % x else: break k...
Traceback (most recent call last): File "/tmp/tmp97xxobi3/tmp0fnizlf6.py", line 2, in <module> n, k,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s850874076
p02550
u492910842
1600545938
Python
PyPy3 (7.3.0)
py
Runtime Error
80
68548
290
n,x,m=map(int,input().split()) a=[0]*(m+2) cnt=[0]*(m+2) a[1],f=x,x cnt[f]=1 for i in range(2,m): f=f*f%m a[i]=f if cnt[f]==0: cnt[f]=1 else: break ind=a[1:].index(f)+1 ans=sum(a[:ind])+sum(a[ind:i])*((n-ind+1)//(i-ind)) p=(n-ind+1)%(i-ind) ans+=sum(a[ind:ind+p]) print(ans)
Traceback (most recent call last): File "/tmp/tmpyw06cmzr/tmpiq2yvjl7.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s301401032
p02550
u290886932
1600545937
Python
Python (3.8.2)
py
Runtime Error
2206
9736
382
N, X, M = map(int,input().split()) A = [X] ret = X k = X for i in range(N): k = (k * k) % M ret += k if k in A: A.append(k) break A.append(k) if len(A) == N: print(ret) else: i = A.index(A[-1]) s_rep = sum(A[i:]) a_rep = A[i:-1] s_init = sum(A[:i]) k = len(a_rep) l_ = N - i ret = s_in...
Traceback (most recent call last): File "/tmp/tmpgqya5f5q/tmpjl_atart.py", line 1, in <module> N, X, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s242143033
p02550
u469254913
1600545909
Python
Python (3.8.2)
py
Runtime Error
2206
10064
965
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N,X,M = map(int,input().split()) A = [-1 for i in range(M)] A[0] = X for i in range(1,M): temp = A[i-1] ** 2 temp %= M ...
Traceback (most recent call last): File "/tmp/tmpn1r78ane/tmppxg822dr.py", line 56, in <module> main() File "/tmp/tmpn1r78ane/tmppxg822dr.py", line 11, in main N,X,M = map(int,input().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s648810277
p02550
u671211357
1600545897
Python
PyPy3 (7.3.0)
py
Runtime Error
808
71392
392
N,X,M=map(int,input().split()) ans=0 arr=[] now=X def mondai(A): return A%M for i in range(N): ans+=mondai(now) if mondai(now) in arr: break arr.append(mondai(now)) now=mondai(now**2) amari=len(arr[2:]) kari=arr[2:] kaisu=int((N-len(arr))/amari) hasu=(N-len(arr))%amari if kaisu>0: ans+=k...
Traceback (most recent call last): File "/tmp/tmpz5n2sknb/tmph6323med.py", line 1, in <module> N,X,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s930076893
p02550
u758815106
1600545889
Python
Python (3.8.2)
py
Runtime Error
2206
9752
579
#!/usr/bin/env python3 #import #import math #import numpy as np #= int(input()) #= input() N, X, M = map(int, input().split()) def mod(x): return x % M a = X i = 0 ans = 0 last = -1 dic = [] while a != 0 and i < N: ans += a a = mod(a * a) i += 1 if a in dic: last = dic.index(a) ...
Traceback (most recent call last): File "/tmp/tmpsrc5amo2/tmpskolla87.py", line 8, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s122367416
p02550
u290187182
1600545886
Python
Python (3.8.2)
py
Runtime Error
2206
10696
750
if __name__ == '__main__': n, k,x = map(int, input().split()) mod = 998244353 ans = 0 index=0 a= k %x dict={} for i in range(n): if a not in dict.values(): ans += a index += 1 dict[i]=a a = a*a % x else: break ...
Traceback (most recent call last): File "/tmp/tmpig3t5q4_/tmpsk44mwrf.py", line 3, in <module> n, k,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s493294495
p02550
u682672120
1600545849
Python
PyPy3 (7.3.0)
py
Runtime Error
153
74024
466
value_index = dict() n, x, m = map(int, input().split()) a = [0] * (m + 1) s = [0] * (m + 1) for i in range(m+1): a[i] = x % m s[i+1] = s[i] + a[i] if i == n - 1: print(s[i+1]) quit() if a[i] in value_index: break value_index[a[i]] = i x = x * x % m l = value_index[a[i...
Traceback (most recent call last): File "/tmp/tmpfi1wz6v5/tmpk8xo60a_.py", line 3, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s027314041
p02550
u290187182
1600545819
Python
Python (3.8.2)
py
Runtime Error
2206
10580
742
if __name__ == '__main__': n, k,x = map(int, input().split()) mod = 998244353 ans = 0 index=0 a= k %x dict={} for i in range(n): if a not in dict.values(): ans += a index += 1 dict[i]=a a = a*a % x else: break ...
Traceback (most recent call last): File "/tmp/tmpjtm2jffx/tmpfovnlfoj.py", line 3, in <module> n, k,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s256163742
p02550
u920204936
1600545768
Python
PyPy3 (7.3.0)
py
Runtime Error
796
70312
512
def main(): n,x,m = map(int,input().split()) if m == 0: print(0) return t = [x] k = -1 for _ in range(n): x = x**2 % m if x in t: k = x break t.append(x) s = t.index(k) if s == -1: print(sum(t)) return else: ...
Traceback (most recent call last): File "/tmp/tmps7a0k1yh/tmp4m8y06gu.py", line 27, in <module> main() File "/tmp/tmps7a0k1yh/tmp4m8y06gu.py", line 2, in main n,x,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s195835169
p02550
u006883624
1600545748
Python
Python (3.8.2)
py
Runtime Error
66
17496
806
N, X, M = [int(v) for v in input().split()] def f(a): return a * a % M a = X map = {} ary = [a] map[a] = 1 sub = [0, a] last_sub = a def naive(a): total = a ary = [a] for i in range(1, N): a = f(a) ary.append(a) return ary #n_ary = naive(X) #print(n_ary) #print(sum(n_ary))...
Traceback (most recent call last): File "/tmp/tmpsf9ycsi7/tmp_otxxamk.py", line 1, in <module> N, X, M = [int(v) for v in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s278934179
p02550
u406492455
1600545738
Python
Python (3.8.2)
py
Runtime Error
63
15680
344
n,x,m = map(int,input().split()) A = [x] where = {x: 0} for i in range(1, n): a = A[-1]**2 % m if a in where: break where[a] = i A.append(a) perstart = where[a] res = sum(A) rem = n - len(A) per = len(A) - perstart res += rem//per*sum(A[perstart:perstart+per]) res += sum(A[perstart:perstart + ...
Traceback (most recent call last): File "/tmp/tmpzhi4k6zr/tmpvef71w4u.py", line 1, in <module> n,x,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s469482602
p02550
u671211357
1600545710
Python
PyPy3 (7.3.0)
py
Runtime Error
756
74736
370
N,X,M=map(int,input().split()) ans=0 arr=[] now=X def mondai(A): return A%M for i in range(N): ans+=mondai(now) if mondai(now) in arr: break arr.append(mondai(now)) now=mondai(now**2) amari=len(arr[2:]) kari=arr[2:] kaisu=int(N/amari) hasu=N%amari if kaisu>0: ans+=kaisu*sum(kari) if hasu...
Traceback (most recent call last): File "/tmp/tmprnizmsrp/tmpnzlh_w4_.py", line 1, in <module> N,X,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s211139651
p02550
u278057806
1600545710
Python
PyPy3 (7.3.0)
py
Runtime Error
94
76760
583
from sys import stdin input = stdin.readline N, X, M = map(int, input().split()) ls = [] s = set([]) a = X s.add(a) ls.append(a) while True: a = pow(a, 2, M) if a in s: ind = ls.index(a) break elif len(ls) == N: break else: s.add(a) ls.append(a) new_ls = ls[...
Traceback (most recent call last): File "/tmp/tmpib1dgape/tmpr4hjcpy0.py", line 4, in <module> N, X, M = map(int, input().split()) ^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s989017713
p02550
u371409687
1600545660
Python
Python (3.8.2)
py
Runtime Error
2206
9520
384
n,x,m=map(int,input().split()) tmp=x L=[] Flag=False for i in range(n): tmp=tmp**2%m if tmp==0: Flag=True break elif tmp not in L: L.append(tmp) else: break if Flag: ans=x+sum(L) else: times=(n-len(L))//len(L) loss=(n-len(L))%len(L) ans=x+sum(L[cnt:])*time...
Traceback (most recent call last): File "/tmp/tmpsnwd8oxe/tmp3rz00pik.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s154850806
p02550
u566159623
1600545659
Python
PyPy3 (7.3.0)
py
Runtime Error
106
78080
721
from collections import defaultdict dic = defaultdict(int) N, X, M = map(int, input().split()) A = [X] ans = X if N>1: temp = 1 dic[X]=temp for i in range(2, N+1): a = A[-1]*A[-1]%M if dic[a]>0: fir = dic[a] break A.append(a) ans+=a temp+=1 ...
Traceback (most recent call last): File "/tmp/tmpyc9ioqi9/tmp8m3xhy3a.py", line 3, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s047513886
p02550
u290187182
1600545658
Python
Python (3.8.2)
py
Runtime Error
2206
10724
609
if __name__ == '__main__': n, k,x = map(int, input().split()) mod = 998244353 ans = 0 index=0 a= k %x dict={} for i in range(n): if a not in dict.values(): ans += a index += 1 dict[i]=a a = a*a % x else: break ...
Traceback (most recent call last): File "/tmp/tmpsao9mkbt/tmp7bxrghek.py", line 3, in <module> n, k,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s323023919
p02550
u152638361
1600545602
Python
Python (3.8.2)
py
Runtime Error
2206
9748
377
N, X, M = map(int,input().split()) A = [X] for i in range(N): An = A[-1]**2 % M if An in A: Lstart = A.index(An) break else: A.append(An) LenBefL = Lstart LenLoop = len(A) - Lstart if LenLoop > 0: ans = sum(A[:Lstart])+sum(A[Lstart:])*((N-LenBefL)//LenLoop) + sum(A[Lstart:Lstart ...
Traceback (most recent call last): File "/tmp/tmpx_atjczw/tmpekjixq6e.py", line 1, in <module> N, X, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s136853262
p02550
u944390835
1600545587
Python
PyPy3 (7.3.0)
py
Runtime Error
105
75616
442
N,X,M = map(int,input().split()) A = [100001]*(2*(10**5)+100) A[1] = X S = {X} ans = X for i in range(2,min(2*M+1,N)+1): X = X**2 X %= M ans += X A[i] = X if X in S: break S.add(X) #print(i) #[print(A[i]) for i in range(6)] if i == N: print(ans) else: j = A[:i+1].index(A[i]) if i == j: pr...
Traceback (most recent call last): File "/tmp/tmpddlpzrmm/tmptvqi_rcb.py", line 1, in <module> N,X,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s924851458
p02550
u278057806
1600545584
Python
PyPy3 (7.3.0)
py
Runtime Error
87
80204
536
from sys import stdin input = stdin.readline N, X, M = map(int, input().split()) ls = [] s = set([]) a = X s.add(a) ls.append(a) while True: a = pow(a, 2, M) if a in s: ind = ls.index(a) break elif len(ls) == N: break else: s.add(a) ls.append(a) new_ls = ls[...
Traceback (most recent call last): File "/tmp/tmpk5nfsovz/tmpe0slkjlx.py", line 4, in <module> N, X, M = map(int, input().split()) ^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s133843009
p02550
u566159623
1600545582
Python
PyPy3 (7.3.0)
py
Runtime Error
155
77952
605
from collections import defaultdict dic = defaultdict(int) N, X, M = map(int, input().split()) A = [X] ans = X temp = 1 dic[X]=temp for i in range(2, N+1): a = A[-1]*A[-1]%M if dic[a]>0: fir = dic[a] break A.append(a) ans+=a temp+=1 dic[a]=temp T = temp-fir+1#周期 Tsum = ...
Traceback (most recent call last): File "/tmp/tmpoefj6wdn/tmpb0hm_p5s.py", line 3, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s130233188
p02550
u453683890
1600545575
Python
Python (3.8.2)
py
Runtime Error
82
9076
435
N,x,MOD = map(int, input().split()) s = x t_s = 0 for i in range(2,MOD + 1): if N == 1: break x = (x*x)%MOD s += x if i == N: break res = N - i init = x t_s = x cnt = 1 for i in range(MOD): if N == 1: break x = (x*x)%MOD if x == init: break cnt += 1 t_s += x if not N == 1: bai = res ...
Traceback (most recent call last): File "/tmp/tmpcuhpielm/tmp7na1373_.py", line 1, in <module> N,x,MOD = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s886467679
p02550
u414050834
1600545566
Python
Python (3.8.2)
py
Runtime Error
2206
9644
343
n,x,m=map(int,input().split()) ans=0 p=0 l=[x] if x%m==0: print(x) else: for i in range(1,n): s=(l[i-1]**2)%m if s==0: p=1 break if s in l: break else: l.append(s) if p==0: t=sum(l[1:]) k=n//(len(l)-1) j=n%(len(1)-1) ans=x+t*k+sum(l[1:j+1]) print(ans) ...
Traceback (most recent call last): File "/tmp/tmpf3x27b42/tmp99ayqo38.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s795022454
p02550
u920204936
1600545560
Python
PyPy3 (7.3.0)
py
Runtime Error
755
76600
465
def main(): n,x,m = map(int,input().split()) t = [x] k = -1 for _ in range(n): x = x**2 % m if x in t: k = x break t.append(x) s = t.index(k) if s == -1: print(sum(t)) return else: ans = sum(t[0:s]) b = t[s:len(t...
Traceback (most recent call last): File "/tmp/tmpqlgm8fyp/tmpkxlfte_d.py", line 24, in <module> main() File "/tmp/tmpqlgm8fyp/tmpkxlfte_d.py", line 2, in main n,x,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s763321221
p02550
u095094246
1600545558
Python
Python (3.8.2)
py
Runtime Error
67
13672
838
n,x,m=map(int,input().split()) # 一定回数を経ると循環するので最後にかければよい loop=list() app = [0]*m last = -1 a_i = x while 1: a_i = (a_i**2)%m if a_i in (0,1) or app[a_i]: # あまりが0か1になったらそのあとはずっと一緒 # もしくはloopの端にきたらloop開始 last = a_i break else: app[a_i] = len(loop) loop.append(a_i) if len(loop) > n: ...
Traceback (most recent call last): File "/tmp/tmpi0ubxi8_/tmppkip_bnh.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s200257183
p02550
u489691149
1600545556
Python
Python (3.8.2)
py
Runtime Error
54
13968
798
def main(): n,x,m=map(int,input().split()) visited=[0]*m visit_sum=[0]*m i=1 sm=x visited[x]=1 visit_sum[x]=x work=x while i < n: work**=2 work%=m sm+=work i+=1 # print(sm,work) if not visited[work]: visited[work]=i ...
Traceback (most recent call last): File "/tmp/tmpakvrm_1c/tmp10qnxn9_.py", line 37, in <module> main() File "/tmp/tmpakvrm_1c/tmp10qnxn9_.py", line 2, in main n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s753797554
p02550
u279317023
1600545538
Python
PyPy3 (7.3.0)
py
Runtime Error
150
82280
747
n,p,m = list(map(int,input().split())) seen = {} ans = p%m seen[p%m]=1 T = {} T[1] = ans last_p = p%m r = 0 if n==1: print(p%m) else: for i in range(2,m+1000): p = p ** 2 p = p % m if p not in seen: seen[p]=i else: r = i-seen[p] # print(r, i, seen[p], p) last_p = p ...
Traceback (most recent call last): File "/tmp/tmpfp2ix8kt/tmpu77d95sh.py", line 1, in <module> n,p,m = list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s977361993
p02550
u232873434
1600545507
Python
PyPy3 (7.3.0)
py
Runtime Error
792
68608
478
N, X, M = map(int,input().split()) ans_list = [X] for i in range(1,N): ans = ans_list[-1]**2%M if ans in ans_list: break else: ans_list.append(ans) st_index = ans_list.index(ans) if st_index == N-1: print(sum(ans_list)) else: total = sum(ans_list[:st_index]) N -= st_index ...
Traceback (most recent call last): File "/tmp/tmpv6seby8j/tmpgo6wbf7s.py", line 2, in <module> N, X, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s303861583
p02550
u592944963
1600545481
Python
PyPy3 (7.3.0)
py
Runtime Error
86
73064
574
N, X, M = map(int, input().split()) a_i = X seq = [0] * N seq[0] = X memo = {a_i: 0} for i in range(1, N): a_i = (a_i ** 2) % M seq[i] = a_i if a_i in memo: j = memo[a_i] interval = i - j base_sum = sum(seq[:j]) mod = (N - i) % interval if mod == 0: rep...
Traceback (most recent call last): File "/tmp/tmpluvhqlyl/tmpvc5r9xj6.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s532287025
p02550
u995062424
1600545464
Python
Python (3.8.2)
py
Runtime Error
28
9092
644
N, X, M = map(int, input().split()) rec = [] s = set() rec.append(X) s.add(X) r = X idx == -1 idx1 = -1 for i in range(N+1): r = (r**2)%M if(r not in s): rec.append(r) s.add(r) else: rec.append(r) idx = i+1 break for i in range(len(rec)): if(rec[i] == rec[id...
Traceback (most recent call last): File "/tmp/tmprwysayel/tmpvd048al3.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s790180265
p02550
u347502437
1600545445
Python
Python (3.8.2)
py
Runtime Error
2206
9992
483
def main(): N, X, M = map(int, input().split()) NN = N li = [] while X not in li: if N != 0: li = li + [X] X = X ** 2 % M N -= 1 else: print(sum(x for x in li)) break l = len(li) s = li.index(X) T = l - s q = (N...
Traceback (most recent call last): File "/tmp/tmppzagr5la/tmp9a_xvq_7.py", line 22, in <module> main() File "/tmp/tmppzagr5la/tmp9a_xvq_7.py", line 2, in main N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s931132281
p02550
u944390835
1600545442
Python
PyPy3 (7.3.0)
py
Runtime Error
102
74780
436
N,X,M = map(int,input().split()) A = [100001]*(10**5+1) A[1] = X S = {X} ans = X for i in range(2,min(2*M+1,N)+1): X = X**2 X %= M ans += X A[i] = X if X in S: break S.add(X) #print(i) #[print(A[i]) for i in range(6)] if i == N: print(ans) else: j = A[:i+1].index(A[i]) if i == j: print(an...
Traceback (most recent call last): File "/tmp/tmpn_lnj05q/tmp7aph_31n.py", line 1, in <module> N,X,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s533292912
p02550
u678505520
1600545418
Python
Python (3.8.2)
py
Runtime Error
140
14316
531
n, x, m = map(int,input().split()) rem = [0] * m chk = [0] * (m + 1) rem[0] = x for i in range(1,m): rem[i] = (rem[i - 1] ** 2) % m if chk[rem[i - 1] ** 2 % m] > 1: temp1 = (rem[i - 1] ** 2) % m temp2 = i else: temp1 = (rem[i - 1] ** 2) % m temp2 = i for i in range(m): if rem[i] == temp1: t...
Traceback (most recent call last): File "/tmp/tmp4hc4koiv/tmp3r6bx547.py", line 1, in <module> n, x, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s033283057
p02550
u920204936
1600545398
Python
Python (3.8.2)
py
Runtime Error
63
14780
563
from collections import defaultdict def main(): n,x,m = map(int,input().split()) d = defaultdict(bool) t = [x] k = -1 for _ in range(n): x = x**2 % m if d[x]: k = x break else: d[x] = True t.append(x) s = t.index(k) if s == ...
Traceback (most recent call last): File "/tmp/tmpxcbcne30/tmpwwi34px_.py", line 28, in <module> main() File "/tmp/tmpxcbcne30/tmpwwi34px_.py", line 3, in main n,x,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s352025374
p02550
u682672120
1600545384
Python
PyPy3 (7.3.0)
py
Runtime Error
83
74224
459
value_index = dict() n, x, m = map(int, input().split()) a = [0] * m s = [0] * (m + 1) for i in range(m+1): a[i] = x % m s[i+1] = s[i] + a[i] if i == n - 1: print(s[i+1]) quit() if a[i] in value_index: break value_index[a[i]] = i x = x * x % m l = value_index[a[i]] r =...
Traceback (most recent call last): File "/tmp/tmpayu34lzl/tmp2c19ib2m.py", line 3, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s688352487
p02550
u562016607
1600545377
Python
PyPy3 (7.3.0)
py
Runtime Error
148
73272
931
N,X,M=map(int,input().split()) dist=[0 for i in range(M)] A=X loopin=-1 loopout=-1 ans=[0] for i in range(N+1): if dist[A]!=0: loopin=dist[A] loopout=i ans.append(ans[-1]+A) break else: dist[A]=i ans.append(ans[-1]+A) A=(A*A)%M if loopin==-1: print(ans...
Traceback (most recent call last): File "/tmp/tmpidb914zq/tmpvtds4c_i.py", line 1, in <module> N,X,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s167793113
p02550
u248996551
1600545360
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
1723332
222
N,X,M=map(int,input().split()) table=[-1]*(M**2+1) ans=0 for i in range(N): ans += X X = X**2 if table[X] != -1: X = table[X] else: old_x=X X %= M table[old_x]=X print(ans)
Traceback (most recent call last): File "/tmp/tmpu82w809e/tmpuk81gxxb.py", line 1, in <module> N,X,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s107155421
p02550
u469254913
1600545353
Python
Python (3.8.2)
py
Runtime Error
2206
10048
912
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N,X,M = map(int,input().split()) A = [-1 for i in range(M)] A[0] = X for i in range(1,M): temp = A[i-1] ** 2 temp %= M ...
Traceback (most recent call last): File "/tmp/tmpah4gv26b/tmpq8ap5fg6.py", line 53, in <module> main() File "/tmp/tmpah4gv26b/tmpq8ap5fg6.py", line 11, in main N,X,M = map(int,input().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s158715992
p02550
u995062424
1600545302
Python
Python (3.8.2)
py
Runtime Error
69
13196
573
N, X, M = map(int, input().split()) rec = [] s = set() rec.append(X) s.add(X) r = X for i in range(N+1): r = (r**2)%M if(r not in s): rec.append(r) s.add(r) else: rec.append(r) idx = i+1 break for i in range(len(rec)): if(rec[i] == rec[idx]): idx1 =...
Traceback (most recent call last): File "/tmp/tmpm8e9e0lb/tmp6bk06x2u.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s793068870
p02550
u555253039
1600545294
Python
Python (3.8.2)
py
Runtime Error
25
8964
111
n=int(input()) x=int(input()) m=int(input()) a=x sum=x for i in range(2,n+1): a=a*a%m sum=sum+a print(sum)
File "/tmp/tmp5dl98x99/tmpq2s2xncm.py", line 9 print(sum) ^ IndentationError: unindent does not match any outer indentation level
s630534137
p02550
u993790346
1600545275
Python
PyPy3 (7.3.0)
py
Runtime Error
112
74732
367
n=list(map(int,input().split())) import numpy as np b = n[1] z = n[2] a = 0 result = b next_in = b**2 while a<n[0]: if next_in < z: result += next_in next_in = next_in**2 elif next_in > z: next_in = np.mod(next_in,z) result += next_in next_in = next_in**2 else: ...
Traceback (most recent call last): File "/tmp/tmpls4nfa0s/tmpfmzoxau8.py", line 1, in <module> n=list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s646207940
p02550
u371409687
1600545191
Python
Python (3.8.2)
py
Runtime Error
2205
9580
333
n,x,m=map(int,input().split()) tmp=x L=[x] for i in range(n): tmp=tmp**2%m if tmp not in L: L.append(tmp) else: cnt=L.index(tmp) break times=(n-len(L[:cnt]))//len(L[cnt:]) loss=(n-len(L[:cnt]))%len(L[cnt:]) ans=sum(L[:cnt])+sum(L[cnt:])*times for i in range(loss): ans+=L[cnt:][...
Traceback (most recent call last): File "/tmp/tmp152yjnhw/tmplmgomtyh.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s214635393
p02550
u239528020
1600545179
Python
Python (3.8.2)
py
Runtime Error
94
17164
549
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**6) n, x, m = list(map(int, input().split())) data = [-1]*(m) ans = x data[x] = 0 count = 0 num = x flag = 0 while(count < n-1): count += 1 num = (num**2) % m if data[num] == -1 or flag == 1: data[num] = (count, ans) ans += num ...
Traceback (most recent call last): File "/tmp/tmpyujustja/tmp1xedn8z3.py", line 5, in <module> n, x, m = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s527853530
p02550
u944390835
1600545087
Python
PyPy3 (7.3.0)
py
Runtime Error
102
75284
403
N,X,M = map(int,input().split()) A = [100001]*(10**5+1) A[1] = X S = {X} ans = X for i in range(2,min(M+1,N)+1): X = X**2 X %= M ans += X A[i] = X if X in S: break S.add(X) #print(i) #[print(A[i]) for i in range(6)] if i == N: print(ans) else: j = A[:i+1].index(A[i]) k = (N-i)//(i-j) l = (N...
Traceback (most recent call last): File "/tmp/tmpov6_05jo/tmpmg0b3ebn.py", line 1, in <module> N,X,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s276574774
p02550
u413165887
1600545075
Python
Python (3.8.2)
py
Runtime Error
72
14488
596
n, x, m = map(int, input().split()) dp = [-1]*(10**5+2) nums = [-1]*(10**5+2) nums[x] = 1 dp[x] = x bef = x nex = (x**2)%m r = [0, x] while dp[nex] < 0: nums[nex] = nums[bef]+1 dp[nex] = dp[bef]+nex r.append(dp[nex]) nex, bef = (nex**2)%m, nex if nex == 0: x = num[bef] print(r[min(len(r), n)]...
Traceback (most recent call last): File "/tmp/tmpl1x2p0nm/tmp7d4qg9k4.py", line 1, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s500962428
p02550
u995062424
1600545043
Python
Python (3.8.2)
py
Runtime Error
62
13256
624
import sys N, X, M = map(int, input().split()) if(M == 0): print(0) sys.exit() rec = [] s = set() rec.append(X) s.add(X) r = X for i in range(N): r = (r**2)%M if(r not in s): rec.append(r) s.add(r) else: rec.append(r) idx = i+1 break for i in range(le...
Traceback (most recent call last): File "/tmp/tmp_13porf2/tmplic43lo3.py", line 3, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s616025104
p02550
u453683890
1600545034
Python
Python (3.8.2)
py
Runtime Error
78
9204
368
N,x,MOD = map(int, input().split()) s = x t_s = 0 for i in range(2,MOD + 1): x = (x*x)%MOD s += x if i == N: break res = N - i init = x t_s = x cnt = 1 for i in range(MOD): x = (x*x)%MOD if x == init: break cnt += 1 t_s += x bai = res // cnt res = res % cnt s += t_s * bai if res > 0: for i in r...
Traceback (most recent call last): File "/tmp/tmpiqndl0t8/tmpdqpj9kec.py", line 1, in <module> N,x,MOD = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s419950532
p02550
u413165887
1600545017
Python
Python (3.8.2)
py
Runtime Error
77
14476
642
n, x, m = map(int, input().split()) dp = [-1]*(10**5+2) nums = [-1]*(10**5+2) nums[x] = 1 dp[0] = 0 dp[x] = x bef = x nex = (x**2)%m r = [0, x] while dp[nex] < 0: nums[nex] = nums[bef]+1 dp[nex] = dp[bef]+nex r.append(dp[nex]) nex, bef = (nex**2)%m, nex if nex == 0: x = num[bef] if x >= n: ...
Traceback (most recent call last): File "/tmp/tmp1e6tmpqb/tmpq45quldx.py", line 1, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s831841148
p02550
u993790346
1600544982
Python
PyPy3 (7.3.0)
py
Runtime Error
134
68692
424
n=list(map(int,input().split())) import numpy as np b = n[1] z = n[2] result = b next_in = pow(b,2) for i in range(b-1): if next_in < z: result += next_in next_in = pow(next_in,2) continue elif next_in > z: next_in = np.mod(next_in,z) result += next_in next_in = p...
Traceback (most recent call last): File "/tmp/tmpag15hckb/tmpwrdd8ewv.py", line 1, in <module> n=list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s900012392
p02550
u535803878
1600544979
Python
PyPy3 (7.3.0)
py
Runtime Error
182
68792
678
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,x,m = list(map(int, input().split())) v = x seen = [0]*m c = 0 val = 0 count = 0 tmp = 0 if n>m: for i in range(m): if seen[v]==2: break if see...
Traceback (most recent call last): File "/tmp/tmpacgh72hg/tmp7zxmorv7.py", line 7, in <module> n,x,m = list(map(int, input().split())) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s984718833
p02550
u413165887
1600544968
Python
Python (3.8.2)
py
Runtime Error
67
14628
642
n, x, m = map(int, input().split()) dp = [-1]*(10**5+2) nums = [-1]*(10**5+2) nums[x] = 1 dp[0] = 0 dp[x] = x bef = x nex = (x**2)%m r = [0, x] while dp[nex] < 0: nums[nex] = nums[bef]+1 dp[nex] = dp[bef]+nex r.append(dp[nex]) nex, bef = (nex**2)%m, nex if nex == 0: x = num[nex] if x >= n: ...
Traceback (most recent call last): File "/tmp/tmprxlqkd9p/tmp_8zpf2bn.py", line 1, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s044834114
p02550
u963963908
1600544938
Python
Python (3.8.2)
py
Runtime Error
33
9168
103
N,X,M = map(int,input().split()) A = [X] for i in range(1,N): A += [((A[i-1])**2)%m] print(sum(A))
Traceback (most recent call last): File "/tmp/tmpn3pdwap4/tmpijeazwmw.py", line 1, in <module> N,X,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s216447459
p02550
u413165887
1600544922
Python
Python (3.8.2)
py
Runtime Error
70
14500
642
n, x, m = map(int, input().split()) dp = [-1]*(10**5+2) nums = [-1]*(10**5+2) nums[x] = 1 dp[0] = 0 dp[x] = x bef = x nex = (x**2)%m r = [0, x] while dp[nex] < 0: nums[nex] = nums[bef]+1 dp[nex] = dp[bef]+nex r.append(dp[nex]) nex, bef = (nex**2)%m, nex if nex == 0: x = num[nex] if x >= n: ...
Traceback (most recent call last): File "/tmp/tmpt9sf1prc/tmptxt0ymh3.py", line 1, in <module> n, x, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s911316393
p02550
u667024514
1600544860
Python
PyPy3 (7.3.0)
py
Runtime Error
151
69732
455
n,x,m = map(int,input().split()) exist = [0] * (m+1) ans = 0 imamade = [] cnt = 0 for i in range(1,n+1): if exist[x] == 1: break else: ans += x exist[x] = 1 imamade.append(x) x *= x x %= m cnt += 1 if i == n-1: print(ans) exit() num = i...
Traceback (most recent call last): File "/tmp/tmpfavgnwli/tmpbizf367t.py", line 1, in <module> n,x,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s874428789
p02550
u678167152
1600544833
Python
PyPy3 (7.3.0)
py
Runtime Error
85
74852
492
N, X, M = map(int, input().split()) lis = [0]*M lis[0] = X check = [-1]*M check[X] = 0 for i in range(1,M): lis[i] = pow(lis[i-1],2,M) if check[lis[i]]>=0: cyc = i-check[lis[i]] start = check[lis[i]] break check[lis[i]] = i from itertools import groupby, accumulate, product, permutations, combinations...
Traceback (most recent call last): File "/tmp/tmpg2fo34de/tmphlt8cnkc.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s380474413
p02550
u995062424
1600544814
Python
Python (3.8.2)
py
Runtime Error
61
13180
571
N, X, M = map(int, input().split()) rec = [] s = set() rec.append(X) s.add(X) r = X for i in range(N): r = (r**2)%M if(r not in s): rec.append(r) s.add(r) else: rec.append(r) idx = i+1 break for i in range(len(rec)): if(rec[i] == rec[idx]): idx1 = i...
Traceback (most recent call last): File "/tmp/tmpeib616iz/tmpo81j2pea.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s484750038
p02550
u453683890
1600544749
Python
Python (3.8.2)
py
Runtime Error
74
9192
383
N,x,MOD = map(int, input().split()) s = x t_s = 0 for i in range(2,MOD + 1): x = (x*x)%MOD s += x if i == N: break res = N - i init = x t_s = x cnt = 1 for i in range(0,MOD): x = (x*x)%MOD if x == init: break cnt += 1 t_s += x bai = res // cnt res = res % cnt s += t_s * bai if res > 0: for i in...
Traceback (most recent call last): File "/tmp/tmp60je19nw/tmp43nilsd2.py", line 1, in <module> N,x,MOD = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s658184079
p02550
u739843002
1600544745
Python
Python (3.8.2)
py
Runtime Error
44
12224
649
def main(): N, X, M = [int(a) for a in input().split(" ")] used_r = [0] * (M - 1) r = [-1, X] used_r[X] = 1 loop_start_elm = -1 loop_start_n_2 = -1 for i in range(M): A = r[-1] B = (A * A) % M if used_r[B] == 0: r.append(B) used_r[B] = 1 else: loop_start_elm = B loop_start_n_2 = i + 2 brea...
Traceback (most recent call last): File "/tmp/tmp_776q9fy/tmpys8l0452.py", line 28, in <module> main() File "/tmp/tmp_776q9fy/tmpys8l0452.py", line 2, in main N, X, M = [int(a) for a in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s872322016
p02550
u347502437
1600544624
Python
Python (3.8.2)
py
Runtime Error
30
9000
427
X, M = map(int, input().split()) NN = N li = [] while X not in li and N != 0: li = li + [X] X = X ** 2 % M N -= 1 if N == 0: print(sum(x for x in li)) elif N != 0 and X in li: l = len(li) s = li.index(X) T = l - s q = (NN - s) // T r = (NN - s) % T print(sum(li[i] for i in...
File "/tmp/tmprd_gz553/tmpe3aq36nh.py", line 1 X, M = map(int, input().split()) IndentationError: unexpected indent
s483327135
p02550
u779805689
1600544617
Python
PyPy3 (7.3.0)
py
Runtime Error
190
121032
486
N,X,M=map(int,input().split()) F=(N-1).bit_length() A=[[0]*M for _ in range(F)] for x in range(M): A[0][x]=(x*x)%M for d in range(1,F): for x in range(M): A[d][x]=A[d-1][A[d-1][x]] S=[[0]*M for _ in range(F)] for x in range(M): S[0][x]=A[0][x] for d in range(1,F): for x in range(M): ...
Traceback (most recent call last): File "/tmp/tmph8upt5ta/tmp27ufxsv_.py", line 1, in <module> N,X,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s836111626
p02550
u555253039
1600544589
Python
Python (3.8.2)
py
Runtime Error
25
9156
123
n=int(input()) x=int(input()) m=int(input()) a=x sum=x for i in range(2,n+1): a=a*a%m sum=sum+a print(sum)
Traceback (most recent call last): File "/tmp/tmp2i92g1zp/tmpdztohxcf.py", line 1, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s851094854
p02550
u730257868
1600544534
Python
PyPy3 (7.3.0)
py
Runtime Error
803
70436
312
n,x,m=map(int,input().split()) a=list() ans=0 for i in range(n): ans+=x a.append(x) x=(x**2)%m if x in a: s=a.index(x) break sum=0 for i in range(s, len(a)): sum+=a[i] ans+=sum*(((n-s)//(len(a)-s))-1) z=(n-s)%(len(a)-s) for i in range(z): ans+=a[s] s+=1 print(ans)
Traceback (most recent call last): File "/tmp/tmp4d_u5pao/tmp00hzqt8s.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s443418332
p02550
u509368316
1600544478
Python
Python (3.8.2)
py
Runtime Error
63
13500
231
N,X,M=map(int,input().split()) l=[X] p=[-1]*(M+1) p[X]=0 for i in range(N-1): x=(l[-1]**2)%M if p[x]>=0: break l.append(x) p[x]=i+1 x=p[x] y=len(l)-x print(sum(l[:x])+(N-x)//y*sum(l[x:])+sum(l[x:x+(N-x)%y]))
Traceback (most recent call last): File "/tmp/tmpep12n7w0/tmpzfjqgypu.py", line 1, in <module> N,X,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s207378391
p02550
u730257868
1600544461
Python
Python (3.8.2)
py
Runtime Error
2206
9668
312
n,x,m=map(int,input().split()) a=list() ans=0 for i in range(n): ans+=x a.append(x) x=(x**2)%m if x in a: s=a.index(x) break sum=0 for i in range(s, len(a)): sum+=a[i] ans+=sum*(((n-s)//(len(a)-s))-1) z=(n-s)%(len(a)-s) for i in range(z): ans+=a[s] s+=1 print(ans)
Traceback (most recent call last): File "/tmp/tmpigui5h2h/tmpmihn2f32.py", line 1, in <module> n,x,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s271375719
p02550
u678167152
1600544396
Python
PyPy3 (7.3.0)
py
Runtime Error
138
74636
484
N, X, M = map(int, input().split()) lis = [0]*M lis[0] = X check = [-1]*M check[X] = 0 for i in range(1,M): lis[i] = pow(lis[i-1],2,M) if check[lis[i]]>=0: cyc = i-check[lis[i]] start = check[lis[i]] break check[lis[i]] = i from itertools import groupby, accumulate, product, permutations, combinations...
Traceback (most recent call last): File "/tmp/tmpih5mr9mr/tmpoff25u80.py", line 1, in <module> N, X, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s708289117
p02550
u936985471
1600544365
Python
Python (3.8.2)
py
Runtime Error
57
15564
543
import sys readline=sys.stdin.readline N,X,M = map(int,readline().split()) route = [X] dic = {} first = [] loop = [] for i in range(1, N): X = (X ** 2) % M if X in dic: first = route[:dic[X]] loop = route[dic[X]:] break route.append(X) dic[X] = i if N == len(first): print(sum(first)) elif N < le...
Traceback (most recent call last): File "/tmp/tmpdb3asv7e/tmpmij9kyi1.py", line 4, in <module> N,X,M = map(int,readline().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s017178005
p02550
u129019798
1600544335
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
70480
735
def pow(x, n, m): if n == 0: return 1 K = 1 while n > 1: if n % 2 != 0: K *= x K %= m x *= x x %= m n //= 2 return (K * x) % m def main(): import sys st=set() N,X,M=list(map(int,sys.stdin.readline().split())) L=[] a=-...
Traceback (most recent call last): File "/tmp/tmpzvrq6497/tmp0uih50fq.py", line 47, in <module> main() File "/tmp/tmpzvrq6497/tmp0uih50fq.py", line 19, in main N,X,M=list(map(int,sys.stdin.readline().split())) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s074617881
p02550
u936985471
1600544216
Python
Python (3.8.2)
py
Runtime Error
36
9936
575
import sys readline=sys.stdin.readline N,X,M = map(int,readline().split()) route = [X] dic = {} first = [] loop = [] for i in range(1, 10000): X = (X ** 2) % M if X in dic: first = route[:dic[X]] loop = route[dic[X]:] break route.append(X) dic[X] = i #print(first) #print(loop) if N == len(first):...
Traceback (most recent call last): File "/tmp/tmpv1712852/tmplvmxz4m6.py", line 4, in <module> N,X,M = map(int,readline().split()) ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)