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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s427778596 | p02550 | u054514819 | 1600547904 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 79468 | 662 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, sX, mod = mapint()
X = sX
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
for i in range(min(10**5*2+10, N-1)):
X = pow(X, 2, mod)
if X in s:
if X in... | Traceback (most recent call last):
File "/tmp/tmp2ypp0pxn/tmp_43iwozy.py", line 6, in <module>
N, sX, mod = mapint()
^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s552363375 | p02550 | u202560873 | 1600547897 | Python | Python (3.8.2) | py | Runtime Error | 79 | 12636 | 494 | N, X, M = [int(x) for x in input().split()]
copy = M
k = 0
while M % 2 == 0:
k += 1
M = M // 2
L = M
order = 1
if L != 1:
e = 2 % L
while e != 1:
order += 1
e = (2 * e) % L
A = [None] * (k + order)
A[1] = X
for i in range(2, k + order + 1):
A[i] = (A[i - 1] * A[i - 1]) % copy
S =... | Traceback (most recent call last):
File "/tmp/tmp2hdxqa9c/tmpfln133x4.py", line 1, in <module>
N, X, M = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s866095226 | p02550 | u002663801 | 1600547893 | Python | PyPy3 (7.3.0) | py | Runtime Error | 109 | 92888 | 539 | n,x,m = list(map(int,input().split()))
ans = x % m
dic = dict()
dicNum = dict()
dicSum = dict()
for i in range(2,n+1):
b = x
x = x**2 % m
if x in dicNum.keys():
t = i - dicNum[x]
zan = n - i + 1
k = zan // t
ans += (dicSum[i-1] - dicSum[dicNum[x]-1]) * k
if zan% t !... | Traceback (most recent call last):
File "/tmp/tmpg9urz7cq/tmpvp9cqzq5.py", line 1, in <module>
n,x,m = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s846362987 | p02550 | u439063038 | 1600547881 | Python | PyPy3 (7.3.0) | py | Runtime Error | 798 | 69616 | 660 | N, X, M = map(int, input().split())
ans = [X]
a = X
for to in range(1, N):
a = (a**2) % M
if a in ans:
break
else:
ans.append(a)
for fr, tmp in enumerate(ans, 0):
if fr == N-1 and a == tmp:
fr += 1
if a == tmp:
break
ret = 0
if fr != 0:
ret += sum(ans[:fr])
... | Traceback (most recent call last):
File "/tmp/tmpqx50pfmn/tmpm99ltm30.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s225773181 | p02550 | u481187938 | 1600547881 | Python | PyPy3 (7.3.0) | py | Runtime Error | 517 | 73584 | 1848 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline().split()... | Traceback (most recent call last):
File "/tmp/tmpv4iqzpl1/tmpchxf755a.py", line 57, in <module>
main()
File "/tmp/tmpv4iqzpl1/tmpchxf755a.py", line 40, in main
N, X, M = LI()
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s058505032 | p02550 | u397953026 | 1600547881 | Python | PyPy3 (7.3.0) | py | Runtime Error | 757 | 74700 | 411 | n,x,m = map(int,input().split())
st = x
ans = 0
mod = m
num = []
for i in range(n):
ch = st
if st in num:
break
ans += ch
st *= st
st %= mod
if i != 0 and i != 1:
num.append(ch)
le = len(num)
if len(num) == 0:
z = 0
else:
z = n//le
rest = (n-1)%le
if 0 in num:
print(... | Traceback (most recent call last):
File "/tmp/tmp__krz2bi/tmp0ohsiu6y.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s795618395 | p02550 | u618696829 | 1600547872 | Python | Python (3.8.2) | py | Runtime Error | 65 | 13744 | 407 | N,X,M = map(int,input().split( ))
rireki = [0 for _ in range(1,M)]
A = []
i = X
count = 1
while rireki[i] == 0 or count == N:
rireki[i] = count
A.append(i)
i = (i**2)%M
count += 1
one = sum(A)
two = sum(A[rireki[i]-1:])
amari = (N - len(A))%(len(A[rireki[i]-1:]))
sho = (N - len(A))//(len(A[rireki[i]-1:... | Traceback (most recent call last):
File "/tmp/tmp8o97yp1a/tmpzjuf67od.py", line 1, in <module>
N,X,M = map(int,input().split( ))
^^^^^^^
EOFError: EOF when reading a line
| |
s927630340 | p02550 | u913662443 | 1600547859 | Python | PyPy3 (7.3.0) | py | Runtime Error | 487 | 846616 | 381 | n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*(n//100)
lis = [-1]*m
l[0] = x
lis[x] = num
for i in range(1,n):
x = (x*x)%m
num += 1
if lis[x]!=-1:
a = (n-i)//(i-lis[x])
b = (n-i)%(i-lis[x])
ans += a * sum(l[lis[x]:i])
break
l[i] = x
lis[x] = i
ans += ... | Traceback (most recent call last):
File "/tmp/tmphx96lapn/tmp9kjxuk7g.py", line 1, in <module>
n, x, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s011209302 | p02550 | u943057856 | 1600547859 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 71704 | 108 | n,x,m=map(int,input().split())
dp=[0]*n
dp[0]=x
for i in range(n-1):
dp[i+1]=(dp[i]**2)%m
print(sum(dp)) | Traceback (most recent call last):
File "/tmp/tmpftwn4bys/tmp_rtskfqh.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s161316110 | p02550 | u750651325 | 1600547848 | Python | PyPy3 (7.3.0) | py | Runtime Error | 839 | 78396 | 1113 | import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(inpu... | Traceback (most recent call last):
File "/tmp/tmpzuvxnk41/tmp3r137o8y.py", line 26, in <module>
n,x,m = I()
^^^
File "/tmp/tmpzuvxnk41/tmp3r137o8y.py", line 13, in I
def I(): return map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s251851445 | p02550 | u337626942 | 1600547826 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 75764 | 303 | n, x, m=map(int, input().split())
A=[0]*(10**5)
A[1]=x
old=x
for i in range(2, n):
new=(old**2)%m
if new==A[1]:
end=i
break
old=new
loop_sum=0
for k in range(1, end+1):
loop_sum+=A[k]
ans=0
for s in range(1, n%end+1):
ans+=A[s]
ans+=(n//end)*loop_sum
print(ans) | Traceback (most recent call last):
File "/tmp/tmpj085cuht/tmp2cdiew23.py", line 1, in <module>
n, x, m=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s888856626 | p02550 | u086450146 | 1600547819 | Python | PyPy3 (7.3.0) | py | Runtime Error | 796 | 70316 | 403 | N,X,M = map(int,input().split())
List = [X]
for i in range(N-1):
X = X**2 % M
if X in List:
#配列の何番目か
num = i + 1
#同じ数字
key = List.index(X)
break
List.append(X)
ans = sum(List)
loop = (N - len(List)) // (num - key)
add = (N - len(List)) % (num - key)
ans += loop *... | Traceback (most recent call last):
File "/tmp/tmpk5dkgy5k/tmp5tu9gwrp.py", line 1, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s455179858 | p02550 | u133936772 | 1600547817 | Python | PyPy3 (7.3.0) | py | Runtime Error | 95 | 70060 | 259 | n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0 and t<=10**6:
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
print(s[l.index((n-1)%m)])
else:
print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)]) | Traceback (most recent call last):
File "/tmp/tmpzzyzla7x/tmp_m9tjnw4.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s767304552 | p02550 | u618696829 | 1600547815 | Python | Python (3.8.2) | py | Runtime Error | 65 | 13536 | 392 | N,X,M = map(int,input().split( ))
rireki = [0 for _ in range(1,M)]
A = []
i = X
count = 1
while rireki[i] == 0:
rireki[i] = count
A.append(i)
i = (i**2)%M
count += 1
one = sum(A)
two = sum(A[rireki[i]-1:])
amari = (N - len(A))%(len(A[rireki[i]-1:]))
sho = (N - len(A))//(len(A[rireki[i]-1:]))
three = su... | Traceback (most recent call last):
File "/tmp/tmpd1_4uflw/tmp9xy43cnt.py", line 1, in <module>
N,X,M = map(int,input().split( ))
^^^^^^^
EOFError: EOF when reading a line
| |
s947800971 | p02550 | u002663801 | 1600547814 | Python | PyPy3 (7.3.0) | py | Runtime Error | 110 | 92916 | 507 | n,x,m = list(map(int,input().split()))
ans = x % m
dic = dict()
dicNum = dict()
dicSum = dict()
for i in range(2,n+1):
b = x
x = x**2 % m
if x in dicNum.keys():
t = i - dicNum[x]
zan = n - i + 1
k = zan // t
ans += (dicSum[i-1] - dicSum[dicNum[x]-1]) * k
zan = zan %... | Traceback (most recent call last):
File "/tmp/tmphbskkl2_/tmpn3nkttgs.py", line 1, in <module>
n,x,m = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s151367060 | p02550 | u450028885 | 1600547813 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9724 | 474 | n, x, m = map(int, input().split())
num_list = []
num2 = x
for i in range(n) :
num1 = num2 % m
if num1 in num_list :
num = num_list.index(num1)
break
else :
num_list.append(num1)
num2 = num1 ** 2
if num_list == [] :
primt(0)
else :
acc1 = sum(num_list[:num])
acc2 =... | Traceback (most recent call last):
File "/tmp/tmp46522w9_/tmpk55plpjk.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s193254203 | p02550 | u913662443 | 1600547813 | Python | PyPy3 (7.3.0) | py | Runtime Error | 100 | 69348 | 380 | n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*(n//10)
lis = [-1]*m
l[0] = x
lis[x] = num
for i in range(1,n):
x = (x*x)%m
num += 1
if lis[x]!=-1:
a = (n-i)//(i-lis[x])
b = (n-i)%(i-lis[x])
ans += a * sum(l[lis[x]:i])
break
l[i] = x
lis[x] = i
ans += x... | Traceback (most recent call last):
File "/tmp/tmpylh4j0ge/tmp6rgudh1i.py", line 1, in <module>
n, x, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s563324046 | p02550 | u876295560 | 1600547807 | Python | PyPy3 (7.3.0) | py | Runtime Error | 756 | 76504 | 493 | n,x,m=map(int,input().split())
s_list=[]
current=x
index=0
count=0
for i in range(n) :
s_list.append(current)
current=current**2%m
if current in s_list :
index=len(s_list)
break
m=s_list.index(current)
first_sum=sum(s_list[:m])
syuuki=s_list[m:]
syuuki_sum=sum(s_list[m:])
if syuuki_sum==0 :
print(first... | Traceback (most recent call last):
File "/tmp/tmplh2_hv5g/tmpw1x36soy.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s606564143 | p02550 | u054514819 | 1600547802 | Python | PyPy3 (7.3.0) | py | Runtime Error | 95 | 79376 | 691 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, sX, mod = mapint()
X = sX
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
for i in range(min(10**5*2+10, N-1)):
X = pow(X, 2, mod)
if X in s:
if X in... | Traceback (most recent call last):
File "/tmp/tmpywsz_mpe/tmpdc5xxqaf.py", line 6, in <module>
N, sX, mod = mapint()
^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s438869284 | p02550 | u068862829 | 1600547795 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10268 | 364 | N, X, M = map(int, input().split())
A = [0]*(M+1)
A[1] = X
ans = X
for i in range(2, N+1):
A[i] = (A[i-1]*A[i-1])%M
if A[i] == 0:
break
elif A[i] in A[1:i]:
break
ans += A[i]
b = A.index(A[i])
if i != b and A[i] != 0:
ans += sum(A[b:i])*((N-b+1)//(i-b)-1) + sum(A[b:b+(N... | Traceback (most recent call last):
File "/tmp/tmpfls_5v3s/tmp8ouj1hbf.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s718271806 | p02550 | u021814034 | 1600547779 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2223 | 486444 | 2250 |
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
##import operator
input=sys.stdin.readline
import random
##sys.setrecursionlimit(10**6)
##fo=open("output1.txt","w")
##fi=open("input1.txt","w")
mod=10**9+7
def cin():
return map(int,sin().split())
de... | Traceback (most recent call last):
File "/tmp/tmps8p998nh/tmphyvdefcq.py", line 26, in <module>
n,x,m=cin();f=0
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s875312674 | p02550 | u086450146 | 1600547777 | Python | PyPy3 (7.3.0) | py | Runtime Error | 796 | 70200 | 422 | N,X,M = map(int,input().split())
List = [X]
for i in range(N-1):
X = X**2 % M
if X in List:
#配列の何番目か
num = i + 1
#同じ数字
key = List.index(X)
break
List.append(X)
ans = sum(List)
loop = (N - len(List)) // (num - key)
add = (N - len(List)) % (num - key)
ans += loop *... | Traceback (most recent call last):
File "/tmp/tmpnao1wmle/tmp9am9s7s_.py", line 1, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s531126468 | p02550 | u439063038 | 1600547771 | Python | PyPy3 (7.3.0) | py | Runtime Error | 806 | 69728 | 525 | N, X, M = map(int, input().split())
ans = [X]
a = X
for to in range(1, N):
a = (a**2) % M
if a in ans:
break
else:
ans.append(a)
for fr, tmp in enumerate(ans, 0):
if fr == N-1 and a == tmp:
fr += 1
if a == tmp:
break
ret = 0
if fr != 0:
ret += sum(ans[:fr])
... | Traceback (most recent call last):
File "/tmp/tmpek9i4n6q/tmp50co7bbh.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s889878804 | p02550 | u610042046 | 1600547756 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9600 | 437 | n, x, m = map(int, input().split())
a = [x]
for i in range(n-1):
ad = (a[-1]**2) % m
if ad in a:
roop_s = a.index(ad)
roop_e = len(a)
break
else:
a.append(ad)
if i == n-2:
print(sum(a))
exit()
roop_t = (n-roop_s) // (roop_e - roop_s)
left = n - roop_t*(roo... | Traceback (most recent call last):
File "/tmp/tmp3syed0ji/tmpylbeaj28.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s223805975 | p02550 | u983367697 | 1600547745 | Python | PyPy3 (7.3.0) | py | Runtime Error | 820 | 70976 | 309 | n,x,m = map(int,input().split())
def f(x,m):
return x%m
data = [x]
while True:
x = f(x**2,m)
if(x in data):
break
data.append(x)
l = len(data)
k = n//l
s = n%l
if(k!=0):
ans = sum(data)*k
if(0 in data):
print(sum(data))
exit()
ans+=sum(data[:s])
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpezvubfzp/tmpn7y4_t5i.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s909409152 | p02550 | u957796755 | 1600547718 | Python | PyPy3 (7.3.0) | py | Runtime Error | 173 | 142352 | 752 | n, x, m = map(int, input().split())
result = []
result.append(x)
for i in range(1, 1000007):
next_value = (result[-1] ** 2) % m
result.append(next_value)
start = -1
index = 0
for x in result:
if (x ** 2) >= m:
start = (x ** 2) % m
index += 1
break
index += 1
if m == 1:
pr... | Traceback (most recent call last):
File "/tmp/tmpp61aiw0k/tmp80em_pc9.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s660770266 | p02550 | u234582237 | 1600547713 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9540 | 327 | n,x,m=map(int,input().split())
a=[]
a.append(x*x%m)
ind=0
s=0
for i in range(n-2):
t=a[i]*a[i]%m
if a.count(t)==0:
a.append(t)
else:
ind=a.index(t)
break
s=sum(a[ind:])
l=len(a)-ind
answer=(n-1-ind)//l*s
for i in range(n-((n-1-ind)//l)*l-2):
answer+=a[i+ind]
print(answer+x+sum(a[... | Traceback (most recent call last):
File "/tmp/tmpzv69_wvi/tmp1sq21jk1.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s281393128 | p02550 | u810787773 | 1600547696 | Python | Python (3.8.2) | py | Runtime Error | 80 | 21376 | 639 | def main():
N,X,M = map(int,input().split())
dict = {key:0 for key in range(M)}
#print(dict)
if N==1:
return X
dict[X] += 1
cnt = 1
A = [0]*M
A[1] = X
ans = X
tmp = X
for i in range(1,N,1):
tmp = (tmp**2)%M
if dict[tmp] != 0:
break
... | Traceback (most recent call last):
File "/tmp/tmps__opjhq/tmpsq12w_of.py", line 30, in <module>
print(main())
^^^^^^
File "/tmp/tmps__opjhq/tmpsq12w_of.py", line 2, in main
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s136974970 | p02550 | u628285938 | 1600547695 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 78584 | 604 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 22:03:19 2020
@author: liang
"""
N, X, M = map(int,input().split())
mod_set = {X}
mod_lis = [X]
A = [0]*(10**5+1)
A[0] = X
for i in range(1,N):
tmp = A[i-1]**2%M
if tmp in mod_set:
break
A[i] = tmp
mod_set.add(tmp)
mod_lis.append(tmp)
j = ... | Traceback (most recent call last):
File "/tmp/tmpmaamstd9/tmpyizszpnh.py", line 8, in <module>
N, X, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s405644833 | p02550 | u439063038 | 1600547695 | Python | PyPy3 (7.3.0) | py | Runtime Error | 798 | 69660 | 574 | N, X, M = map(int, input().split())
ans = [X]
a = X
for to in range(1, N):
a = (a**2) % M
if a in ans:
break
else:
ans.append(a)
for fr, tmp in enumerate(ans, 0):
if fr == N-1 and a == tmp:
fr += 1
if a == tmp:
break
ret = 0
ret += sum(ans[:fr])
if fr != to:
... | Traceback (most recent call last):
File "/tmp/tmpzomp9fvu/tmp9i6xlhzz.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s153634846 | p02550 | u271210469 | 1600547683 | Python | PyPy3 (7.3.0) | py | Runtime Error | 76 | 74640 | 563 | n,X,m=map(int,input().split())
x=[0]*m
y=[0]*m
y[0]=X
z=[0]*(m+1)
z[X]+=1
for i in range(1,m):
x[i]=(i**2)%m
for i in range(1,m):
y[i]=x[y[i-1]]
z[y[i]]+=1
if z[y[i]]==2:
e=i
q=y[i]
break
for i in range(len(y)):
if y[i]==q:
b=i
break
l=y[b:e]
L=len(l)
s=sum(l)... | Traceback (most recent call last):
File "/tmp/tmp47e4lzlt/tmp76ga802s.py", line 1, in <module>
n,X,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s688754793 | p02550 | u983367697 | 1600547681 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9664 | 309 | n,x,m = map(int,input().split())
def f(x,m):
return x%m
data = [x]
while True:
x = f(x**2,m)
if(x in data):
break
data.append(x)
l = len(data)
k = n//l
s = n%l
if(k!=0):
ans = sum(data)*k
if(0 in data):
print(sum(data))
exit()
ans+=sum(data[:s])
print(ans)
| Traceback (most recent call last):
File "/tmp/tmprlp_wcf5/tmpl3rxcrly.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s664039899 | p02550 | u133936772 | 1600547681 | Python | PyPy3 (7.3.0) | py | Runtime Error | 83 | 70256 | 246 | n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0:
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
print(s[l.index((n-1)%m)])
else:
print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)]) | Traceback (most recent call last):
File "/tmp/tmpeduh6n7o/tmppjf2a3jl.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s686696208 | p02550 | u957796755 | 1600547665 | Python | PyPy3 (7.3.0) | py | Runtime Error | 107 | 73748 | 750 | n, x, m = map(int, input().split())
result = []
result.append(x)
for i in range(1, 100007):
next_value = (result[-1] ** 2) % m
result.append(next_value)
start = -1
index = 0
for x in result:
if (x ** 2) >= m:
start = (x ** 2) % m
index += 1
break
index += 1
if m == 1:
pri... | Traceback (most recent call last):
File "/tmp/tmpfm8g0urx/tmp1qgviift.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s725714340 | p02550 | u397953026 | 1600547657 | Python | PyPy3 (7.3.0) | py | Runtime Error | 793 | 68496 | 374 | n,x,m = map(int,input().split())
st = x
ans = 0
mod = m
num = []
for i in range(n):
ch = st
if st in num:
break
ans += ch
st *= st
st %= mod
if i != 0 and i != 1:
num.append(ch)
le = len(num)
z = n//le
rest = (n-1)%le
if 0 in num:
print(sum(num[:n]) + x + x**2%mod)
else:
... | Traceback (most recent call last):
File "/tmp/tmpunw01kmu/tmpcpe7wje3.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s975660220 | p02550 | u179376941 | 1600547634 | Python | Python (3.8.2) | py | Runtime Error | 65 | 15348 | 820 | n, x, mod = map(int, input().split())
lst = [0, x]
num_set = set([x])
num_lst = [0, x]
flag = False
for i in range(mod - 1):
x = (x * x) % mod
s = x + lst[-1]
if x == 0:
lst.append(s)
break
if x in num_set:
flag = True
break
lst.append(s)
num_set.add(x)
num_lst.append(x)
if i + 2 == n:
... | Traceback (most recent call last):
File "/tmp/tmpkad18sc2/tmpx9qfooym.py", line 1, in <module>
n, x, mod = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s216320766 | p02550 | u021814034 | 1600547632 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2223 | 527276 | 2096 |
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
##import operator
input=sys.stdin.readline
import random
##sys.setrecursionlimit(10**6)
##fo=open("output1.txt","w")
##fi=open("input1.txt","w")
mod=10**9+7
def cin():
return map(int,sin().split())
de... | Traceback (most recent call last):
File "/tmp/tmp2carlckn/tmpy7b372l5.py", line 26, in <module>
n,x,m=cin();f=0
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s676938063 | p02550 | u051843295 | 1600547627 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8956 | 149 | n,x,m=[int(i) for i in input().split()]
tot=x
pres=x
for i in range(n-1):
pres=(pres**2)%m
tot+=pres
if pres=0:
break
print(tot)
| File "/tmp/tmpsqee04c4/tmpapaq3n73.py", line 7
if pres=0:
^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s813901654 | p02550 | u285833393 | 1600547624 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9484 | 352 | N, X, M = map(int, input().split())
s = 0
limit = 0
A = [X]
rec = []
start = 0
for i in range(1, N + 1):
X = (X * X) % M
if X not in A:
A.append(X)
else:
start = A.index(X)
rec = A[start:]
limit = i
break
l = len(rec)
print(sum(A[:limit]) + (N - limit) // l * sum(re... | Traceback (most recent call last):
File "/tmp/tmpqjlr5nt_/tmpl9aamt4s.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s742662676 | p02550 | u711245972 | 1600547619 | Python | PyPy2 (7.3.0) | py | Runtime Error | 81 | 64448 | 463 | n, x, m = map(int,input().split())
ans = 0
a = []
a.append(x%m)
ans += x%m
flg = 0
for _ in range(n-1):
a.append(a[-1]**2%m)
ans += a[-1]
if a[-1] in a[:-1]:
ans -= a[-1]
i = a[:-1].index(a[-1])
h=len(a)-1
one_loop = h-i
loop_list = a[i:-1]
flg= 1
bre... | Traceback (most recent call last):
File "/tmp/tmp3u86vn5i/tmpjt6_ocr7.py", line 1, in <module>
n, x, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s630642866 | p02550 | u444900670 | 1600547613 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9580 | 290 | n,x,m=map(int,input().split())
i=int(2)
a=[x]
while (i <= n):
x=(x**2)%m
if x in a:
goto .abc
else:
a.append(x)
label .abc
if len(a) == n:
print(sum(a))
else:
j=a.index(x)
b=a[0:j]
c=a[j:]
lb=len(b)
lc=len(c)
k=(n-lb)%lc
l=(n-lb)//lc
d=c[0:k]
print(sum(b)+sum(c)*l+sum(d)) | Traceback (most recent call last):
File "/tmp/tmpp0grt1q4/tmpegxc5g7r.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s279474785 | p02550 | u439063038 | 1600547610 | Python | PyPy3 (7.3.0) | py | Runtime Error | 799 | 69968 | 509 | N, X, M = map(int, input().split())
ans = [X]
a = X
for to in range(1, N):
a = (a**2) % M
if a in ans:
break
else:
ans.append(a)
for fr, tmp in enumerate(ans, 0):
if fr == N-1 and a == tmp:
fr += 1
if a == tmp:
break
ret = 0
ret += sum(ans[:fr])
if fr != to:
... | Traceback (most recent call last):
File "/tmp/tmp6fq97_s7/tmp87se5ope.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s422641605 | p02550 | u623231048 | 1600547601 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 73440 | 999 | n,x,m = map(int,input().split())
if x == 0:
print(0)
exit()
li = [-1] * (m+1)
v = [False] * (m+1)
v2 = [False] * (m+1)
v[x] = 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
... | Traceback (most recent call last):
File "/tmp/tmpg87zlwrm/tmp11a3ta84.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s296331383 | p02550 | u442877951 | 1600547593 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 71984 | 163 | N,X,M = map(int,input().split())
er = [0]*N
er[0] = X
MOD = 10**9+7
for i in range(1,N):
er[i] = (er[i-1]**2%M)%MOD
if er[i] == 0:
break
print(sum(er)%MOD) | Traceback (most recent call last):
File "/tmp/tmp7rdnh39h/tmpn2eizs2a.py", line 1, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s653322409 | p02550 | u547608423 | 1600547589 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11244 | 442 | N, X, M = map(int, input().split())
a = X
i = 0
cnt = 0
li = [-1]*M
x = 0
for i in range(min(N, M)):
if li[a] != -1:
break
else:
li[a] = i
cnt += a
a = pow(a, 2, M)
x += 1
# print(cnt)
# print(x, li[a])
if x-li[a] > 1:
s = 0
for i in range(li[a], x):
s +=... | Traceback (most recent call last):
File "/tmp/tmpyjqkx6o1/tmp90wm7pdp.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s778274494 | p02550 | u088989565 | 1600547579 | Python | Python (3.8.2) | py | Runtime Error | 93 | 15596 | 1141 | N,X,M = list(map(int, input().split()))
A = [X]
d = {}
loopflag = 0
d[X] = 1
for i in range(N):
p = (A[i]**2) % M
A.append(p)
if(p in d):
loopflag = 1
break
else:
d[p] = 1
ans = 0
if(loopflag == 1):
lastkey = next(iter(reversed(d)))
keylist = list(d.keys())
for i in range(len(keylist)):
... | Traceback (most recent call last):
File "/tmp/tmpx2_1c8ku/tmpg3a4hzkb.py", line 1, in <module>
N,X,M = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s329971520 | p02550 | u404629709 | 1600547568 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 73796 | 454 | n,x,m=map(int,input().split())
a=x
an=-1
bn=-1
cnt=0
cnt2=0
wa=x
wa2=x
num=[0 for i in range(m+3)]
flag=False
for i in range(m):
cnt+=1
an=(a**2)%m
wa+=an
a=an
num[an]+=1
if num[an]==2:
flag=True
break
a=x
for i in range(m):
cnt2+=1
bn=(a**2)%m
wa2+=bn
a=bn
if bn==an:
break
ans=wa2+(wa... | Traceback (most recent call last):
File "/tmp/tmpafuwd7vw/tmpgo38a5ac.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s291847833 | p02550 | u372102441 | 1600547566 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9848 | 1861 | import sys
input = sys.stdin.readline
#l = list(map(int, input().split()))
#import numpy as np
#arr = np.array([int(i) for i in input().split()])
'''
a,b=[],[]
for i in range(n):
A, B = map(int, input().split())
a.append(A)
b.append(B)'''
import sys
input = sys.stdin.readline
#l = list(map(int, input(... | Traceback (most recent call last):
File "/tmp/tmpa891gtae/tmpbx_i3_d_.py", line 27, in <module>
n,x,m=map(int, input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s236731018 | p02550 | u728200259 | 1600547565 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9628 | 515 | N, X, M = map(int, input().split())
list_mo = []
a_n = X
c = 0
for i in range(M):
a_n_1 = (a_n ** 2) % M
a_n = a_n_1
if a_n_1 not in list_mo:
list_mo.append(a_n_1)
else:
break
initial = X + list_mo[0]
sum_mo = sum(list_mo[1:-1]) + list_mo[-1]
len_loop = len(list_mo... | Traceback (most recent call last):
File "/tmp/tmp0_47lsme/tmpqe4ui43p.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s307004965 | p02550 | u450028885 | 1600547563 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8820 | 473 | n, x, m = map(int, input().split())
num_list = []
num2 = x
for i in range(n) :
num1 = num2 % m
if num1 in num_list :
num = num_list.index(num1)
break
else :
num_list.append(num1)
num2 = num1 ** 2
if num_list = [] :
primt(0)
else :
acc1 = sum(num_list[:num])
acc2 = ... | File "/tmp/tmpia7vavog/tmpc1mlut05.py", line 15
if num_list = [] :
^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s433203910 | p02550 | u628335443 | 1600547555 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 70996 | 501 | N, X, M = map(int, input().split())
if X == 0:
print(0)
exit()
if N == 1:
print(X)
exit()
d = [-1] * (M + 1)
out = [0]
a = X
ans = 0
for i in range(1, N + 1):
ans += a
d[a] = i
out.append(a)
a = a ** 2 % M
if a == 0:
print(ans)
exit()
if d[a] != -1:
lo... | Traceback (most recent call last):
File "/tmp/tmp5xne4nom/tmpjb9tvy52.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s112718198 | p02550 | u133936772 | 1600547541 | Python | PyPy3 (7.3.0) | py | Runtime Error | 99 | 74652 | 245 | n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
print(s[l.index((n-1)%m)])
else:
print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)]) | Traceback (most recent call last):
File "/tmp/tmpejrc2cjm/tmpf6bsoij3.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s299129185 | p02550 | u054514819 | 1600547538 | Python | PyPy3 (7.3.0) | py | Runtime Error | 155 | 79420 | 633 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, X, mod = mapint()
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
for i in range(min(10**5*2+10, N-1)):
X = pow(X, 2, mod)
if X in s:
if X in s_loop:... | Traceback (most recent call last):
File "/tmp/tmp16ig5ab_/tmpgq481yqm.py", line 6, in <module>
N, X, mod = mapint()
^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s041065517 | p02550 | u810787773 | 1600547509 | Python | Python (3.8.2) | py | Runtime Error | 76 | 21512 | 609 | def main():
N,X,M = map(int,input().split())
dict = {key:0 for key in range(M)}
#print(dict)
dict[X] += 1
cnt = 1
A = [0]*M
A[1] = X
ans = X
tmp = X
for i in range(1,N,1):
tmp = (tmp**2)%M
if dict[tmp] != 0:
break
ans += tmp
A[i+1] = A[... | Traceback (most recent call last):
File "/tmp/tmpj83jpf0_/tmp4hr6ba1y.py", line 28, in <module>
print(main())
^^^^^^
File "/tmp/tmpj83jpf0_/tmp4hr6ba1y.py", line 2, in main
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s280768884 | p02550 | u359358631 | 1600547503 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 78608 | 687 | def f(x, m):
return (x ** 2) % m
def main():
n, x, m = map(int, input().split())
lst = [[False, 0] for _ in range((m + 1))]
lst[x] = [True, 1]
res = [x]
for i in range(2, m + 1):
x = f(x, m)
if lst[x][0] == False:
lst[x][0] = True
lst[x][1] = i
... | Traceback (most recent call last):
File "/tmp/tmpco05or_d/tmpn0pggcxz.py", line 31, in <module>
main()
File "/tmp/tmpco05or_d/tmpn0pggcxz.py", line 6, in main
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s807135414 | p02550 | u623231048 | 1600547481 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 76920 | 919 | n,x,m = map(int,input().split())
if x == 0:
print(0)
exit()
li = [-1] * (m+1)
v = [False] * (m+1)
v2 = [False] * (m+1)
v[x] = 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
... | Traceback (most recent call last):
File "/tmp/tmpi0bdc656/tmpvva1lnf2.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s675576055 | p02550 | u054514819 | 1600547467 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 86124 | 605 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, X, mod = mapint()
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
for i in range(min(10**5*2+10, N-1)):
X = pow(X, 2, mod)
if X in s:
if X in s_loop:... | Traceback (most recent call last):
File "/tmp/tmpc9sefp94/tmp80aun157.py", line 6, in <module>
N, X, mod = mapint()
^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s420049994 | p02550 | u271210469 | 1600547448 | Python | PyPy3 (7.3.0) | py | Runtime Error | 156 | 68408 | 533 | n,X,m=map(int,input().split())
x=[0]*m
y=[0]*m
y[0]=X
z=[0]*(m+1)
z[X]+=1
for i in range(1,m):
x[i]=(i**2)%m
for i in range(1,m+1):
y[i]=x[y[i-1]]
z[y[i]]+=1
if z[y[i]]==2:
e=i
q=y[i]
break
for i in range(len(y)):
if y[i]==q:
b=i
break
l=y[b:e]
L=len(l)
s=sum(... | Traceback (most recent call last):
File "/tmp/tmpqpoypt_x/tmpx1184zfz.py", line 1, in <module>
n,X,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s715408469 | p02550 | u994521204 | 1600547446 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 76240 | 1488 | import sys
input = sys.stdin.buffer.readline
n, x, mod = map(int, input().split())
ans = 0
temp = x
num = 1
# while temp < mod:
# temp *= x
# num += 1
A = [0] * (mod + 1)
kouho = {}
if n < mod:
A[1] = x % mod
ans += A[1]
for i in range(2, n + 1):
A[i] = A[i - 1] * A[i - 1] % mod
... | Traceback (most recent call last):
File "/tmp/tmp91ovoceo/tmpebeypix6.py", line 5, in <module>
n, x, mod = map(int, input().split())
^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s992053373 | p02550 | u468510107 | 1600547444 | Python | Python (3.8.2) | py | Runtime Error | 211 | 9776 | 193 | n, x, m = map(int, input().split())
def main(a):
if a == 1:
return x
if a >= 2:
return (main(a-1)**2) % m
ans = 0
for i in range(1, n+1):
ans += main(i)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpznyvk79q/tmpnmmun957.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s673836283 | p02550 | u628335443 | 1600547429 | Python | PyPy3 (7.3.0) | py | Runtime Error | 113 | 70900 | 455 | N, X, M = map(int, input().split())
if X == 0:
print(0)
exit()
if N == 1:
print(X)
exit()
d = [-1] * (M + 1)
out = [0]
a = X
ans = 0
for i in range(1, N + 1):
ans += a
d[a] = i
out.append(a)
a = a ** 2 % M
if d[a] != -1:
loop_num = i + 1 - d[a]
remain = N - i
... | Traceback (most recent call last):
File "/tmp/tmppy6pwsbl/tmpr6ewo511.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s186405336 | p02550 | u133936772 | 1600547428 | Python | PyPy3 (7.3.0) | py | Runtime Error | 81 | 68532 | 243 | n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<=t:
print(s[l.index((n-1)%m)])
else:
print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)]) | Traceback (most recent call last):
File "/tmp/tmp7pdfny8d/tmpckt1mp9d.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s819793525 | p02550 | u359358631 | 1600547424 | Python | PyPy3 (7.3.0) | py | Runtime Error | 84 | 78688 | 631 | def f(x, m):
return (x ** 2) % m
def main():
n, x, m = map(int, input().split())
lst = [[False, 0] for _ in range((m + 1))]
lst[x] = [True, 1]
res = [x]
for i in range(2, m + 1):
x = f(x, m)
if lst[x][0] == False:
lst[x][0] = True
lst[x][1] = i
... | Traceback (most recent call last):
File "/tmp/tmp5qraszck/tmpegg1_znr.py", line 29, in <module>
main()
File "/tmp/tmp5qraszck/tmpegg1_znr.py", line 6, in main
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s511599803 | p02550 | u728050879 | 1600547417 | Python | Python (3.8.2) | py | Runtime Error | 64 | 13972 | 438 | N,X,M = map(int, input().split())
A = [-1]*M
A[0] = X
i = 0
tmpans = 0
flag = False
check = [-1]*(M+1)
slice = -1
while i< N-1:
newa = A[i]**2%M
i+= 1
if check[newa] != -1:
flag = True
slice = check[newa]
break
A[i] = newa
check[newa] = i
if not flag:
print(sum(A[:i+1]... | Traceback (most recent call last):
File "/tmp/tmpoqd5n57e/tmp5o62c56g.py", line 1, in <module>
N,X,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s229731480 | p02550 | u845847173 | 1600547395 | Python | Python (3.8.2) | py | Runtime Error | 2210 | 148824 | 366 | n, x, m = map(int, input().split())
q = 0 #項数の数
a = x #初期値
ans = 0
ans += a
t = []
for i in range(n - 1):
a = a ** 2
y = a % m
t.append(y)
if y == a ** 2:
l = n // q
r = n % q
l = l * ans
for j in range(r):
ans += t[j]
break
ans += y
... | Traceback (most recent call last):
File "/tmp/tmp_3f13fwi/tmp8u6j6zih.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s624590533 | p02550 | u133936772 | 1600547352 | Python | PyPy3 (7.3.0) | py | Runtime Error | 79 | 68488 | 242 | n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<t:
print(s[l.index((n-1)%m)])
else:
print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)]) | Traceback (most recent call last):
File "/tmp/tmpniu_p1oi/tmplg2fur79.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s729732920 | p02550 | u242580186 | 1600547327 | Python | Python (3.8.2) | py | Runtime Error | 71 | 18200 | 1178 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque
def inp():
return int(... | Traceback (most recent call last):
File "/tmp/tmpggxppikb/tmpct0nccig.py", line 24, in <module>
N, X, M = inpl()
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s475337564 | p02550 | u088989565 | 1600547325 | Python | Python (3.8.2) | py | Runtime Error | 90 | 15444 | 989 | N,X,M = list(map(int, input().split()))
A = [X]
d = {}
d[X] = 1
for i in range(N):
p = (A[i]**2) % M
A.append(p)
if(p in d):
break
else:
d[p] = 1
lastkey = next(iter(reversed(d)))
ans = 0
loopflag = 0
keylist = list(d.keys())
for i in range(len(keylist)):
if(keylist[i]**2 >= M):
looplist = keyli... | Traceback (most recent call last):
File "/tmp/tmpmax_dmrg/tmp27u1nh0c.py", line 1, in <module>
N,X,M = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s849493832 | p02550 | u983357959 | 1600547321 | Python | Python (3.8.2) | py | Runtime Error | 459 | 47496 | 129 | n,x,m = map(int,input().split())
ans= [2]*(n)
for i in range(n-1):
ans[i+1] = x**2 % m
x = ans[i+1]
print(str(sum(ans)))
| Traceback (most recent call last):
File "/tmp/tmpmgebnekl/tmps1wjzj1g.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s202932444 | p02550 | u439063038 | 1600547309 | Python | PyPy3 (7.3.0) | py | Runtime Error | 796 | 68896 | 458 | N, X, M = map(int, input().split())
ans = [X]
a = X
for to in range(1, N):
a = (a**2) % M
if a in ans:
break
else:
ans.append(a)
for fr, tmp in enumerate(ans, 0):
if a == tmp:
break
ret = 0
ret += sum(ans[:fr])
if fr != to:
l = (N-fr)//(to-fr)
ret += sum(ans[fr:to]) * l... | Traceback (most recent call last):
File "/tmp/tmpor4r3k0y/tmp000b2m6v.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s980087521 | p02550 | u179376941 | 1600547260 | Python | Python (3.8.2) | py | Runtime Error | 64 | 15376 | 919 | n, x, mod = map(int, input().split())
lst = [0, x]
num_set = set([x])
num_lst = [0, x]
flag = False
for i in range(mod - 1):
x = (x * x) % mod
s = x + lst[-1]
if x == 0:
lst.append(s)
break
if x in num_set:
flag = True
break
lst.append(s)
num_set.add(x)
num_lst.append(x)
if i == n:
... | Traceback (most recent call last):
File "/tmp/tmpvz7oouxi/tmp5l5nfkg4.py", line 1, in <module>
n, x, mod = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s626365651 | p02550 | u093041722 | 1600547227 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2221 | 618412 | 710 | N,X,M = map(int, open(0).read().split())
if N == 1:
print(X)
else:
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))
b = set(B)
for i in range(N-1):
... | Traceback (most recent call last):
File "/tmp/tmpmm9d4jm1/tmpww5q5d5_.py", line 1, in <module>
N,X,M = map(int, open(0).read().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s856163880 | p02550 | u728050879 | 1600547223 | Python | Python (3.8.2) | py | Runtime Error | 69 | 14036 | 430 | N,X,M = map(int, input().split())
A = [-1]*M
A[0] = X
i = 0
tmpans = 0
flag = False
check = [-1]*(M+1)
slice = -1
while i< N-1:
newa = A[i]**2%M
i+= 1
if check[newa] != -1:
flag = True
slice = check[newa]
break
A[i] = newa
check[newa] = i
if not flag:
print(sum(A[:i+1]... | Traceback (most recent call last):
File "/tmp/tmpioibchry/tmpaeq90c8z.py", line 1, in <module>
N,X,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s158601201 | p02550 | u994521204 | 1600547209 | Python | PyPy3 (7.3.0) | py | Runtime Error | 494 | 88180 | 3374 | import sys
input = sys.stdin.buffer.readline
n, x, mod = map(int, input().split())
ans = 0
temp = x
num = 1
# while temp < mod:
# temp *= x
# num += 1
# from kiriさん
def gcd(a, b):
while b:
a, b = b, a % b
return a
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = [2]
for a i... | Traceback (most recent call last):
File "/tmp/tmpczj8r5qx/tmpu97ouf4n.py", line 5, in <module>
n, x, mod = map(int, input().split())
^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s953647383 | p02550 | u133936772 | 1600547185 | Python | PyPy3 (7.3.0) | py | Runtime Error | 80 | 74688 | 234 | n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<t:
print(s[l.index(n-1)])
else:
print(S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T-1)]) | Traceback (most recent call last):
File "/tmp/tmpokdozf9d/tmplzlxii5h.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s083466251 | p02550 | u628335443 | 1600547181 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 71240 | 378 | N, X, M = map(int, input().split())
d = [-1] * (M + 1)
out = [0]
a = X
ans = 0
for i in range(1, N + 1):
ans += a
d[a] = i
out.append(a)
a = a ** 2 % M
if d[a] != -1:
loop_num = i + 1 - d[a]
remain = N - i
break
ans += sum(out[d[a]:d[a] + loop_num]) * (remain // loop_num)
ans... | Traceback (most recent call last):
File "/tmp/tmpimjg0hmd/tmpgssjc4qt.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s544289582 | p02550 | u983357959 | 1600547178 | Python | Python (3.8.2) | py | Runtime Error | 412 | 47412 | 141 | n,x,m = map(int,input().split())
ans= [0]*(n-1)
ans.append(x)
for i in range(n-1):
ans[i] = x**2 % m
x = ans[i]
print(str(sum(ans)))
| Traceback (most recent call last):
File "/tmp/tmpi_0c2bod/tmpucbikvga.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s938732055 | p02550 | u793821463 | 1600547144 | Python | Python (3.8.2) | py | Runtime Error | 70 | 13880 | 453 | N , X , M = map(int,input().split())
flag = [0]*M
S = X
SN = [0]*(M+1)
SN[1] = X
A = X
loop = 1
flag[X%M] = 1
for i in range(N - 1):
A = (A**2)%M
if flag[A] == 0:
flag[A] = loop
else:
loops = flag[A]
break
S += A
SN[loop+1] = S
loop += 1
if loop <N:
ans = 0
ans += SN[loops]
dS = SN[loop] ... | Traceback (most recent call last):
File "/tmp/tmpv4l_fvpg/tmp3wr08lj6.py", line 1, in <module>
N , X , M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s028863671 | p02550 | u194390510 | 1600547107 | Python | PyPy2 (7.3.0) | py | Runtime Error | 480 | 85168 | 499 | n,x,m=map(int,raw_input().split())
i=0
v=[x]
t={x:0}
p=0
start=0
while True:
i+=1
y=(x*x)%m
if y in t:
p+=(i-t[y])
start+=t[y]
break
p[y]=i
v.append(y)
x=y
ans=0
if n<(start):
for i in range(n):
ans+=v[i]
print ans
else:
for i in range(sta... | File "/tmp/tmpbiw7souc/tmpp21ff5mu.py", line 21
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s509885766 | p02550 | u747602774 | 1600547082 | Python | PyPy3 (7.3.0) | py | Runtime Error | 78 | 72348 | 666 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7
n,x,m = map(int,readline().split())
if n == 1:
print(x)
exit()
if n < 10**7:
a = [0]*n
a[0] = x
for i in range(n-1):
a[i+1] = a[i]**2%m
print(sum(a))
exit(... | Traceback (most recent call last):
File "/tmp/tmppsjy26ql/tmp83winb0g.py", line 9, in <module>
n,x,m = map(int,readline().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s206725814 | p02550 | u770018088 | 1600547077 | Python | Python (3.8.2) | py | Runtime Error | 63 | 20056 | 593 | from collections import defaultdict
it = lambda: list(map(int, input().strip().split()))
def solve():
N, X, M = it()
value = defaultdict(int)
history = defaultdict(int)
cur = 0
cnt = 0
for i in range(N):
if X in history:
break
value[X] = cur
history[X] = i
... | Traceback (most recent call last):
File "/tmp/tmpoqvx2xcd/tmpyjo5vdob.py", line 27, in <module>
print(solve())
^^^^^^^
File "/tmp/tmpoqvx2xcd/tmpyjo5vdob.py", line 6, in solve
N, X, M = it()
^^^^
File "/tmp/tmpoqvx2xcd/tmpyjo5vdob.py", line 2, in <lambda>
it = lambda: list(map(... | |
s453958049 | p02550 | u902151549 | 1600547035 | Python | PyPy3 (7.3.0) | py | Runtime Error | 136 | 68708 | 504 | n,x,m=inputintlist()
A=[x]
D=defaultdict(bool)
D[x]=True
kkey=None
for a in range(1,10**5+1000):
num=(A[a-1]**2)%m
if not D[num]:
A.append(num)
D[num]=True
else:
kkey=num
break
if n<=10**5:
print(sum(A[:n]))
else:
i=A.index(kkey)
nl=A[:i]
l=A[i:]
if n<=len... | Traceback (most recent call last):
File "/tmp/tmp2ez8ehp1/tmpbr_6kfek.py", line 1, in <module>
n,x,m=inputintlist()
^^^^^^^^^^^^
NameError: name 'inputintlist' is not defined
| |
s106360763 | p02550 | u271210469 | 1600547022 | Python | PyPy3 (7.3.0) | py | Runtime Error | 102 | 68424 | 527 | n,X,m=map(int,input().split())
x=[0]*m
y=[0]*m
y[0]=X
z=[0]*(m+1)
z[X]+=1
for i in range(1,m):
x[i]=(i**2)%m
for i in range(1,m+1):
y[i]=x[y[i-1]]
z[y[i]]+=1
if z[y[i]]==2:
e=i
q=y[i]
break
for i in range(len(y)):
if y[i]==q:
b=i
break
l=y[b:e]
L=len(l)
s=sum(... | Traceback (most recent call last):
File "/tmp/tmpwzjb13u7/tmpyi8i6vq3.py", line 1, in <module>
n,X,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s357567402 | p02550 | u439063038 | 1600547016 | Python | PyPy3 (7.3.0) | py | Runtime Error | 797 | 68980 | 462 | N, X, M = map(int, input().split())
ans = [X]
a = X
for to in range(1, N):
a = (a**2) % M
if a in ans:
break
else:
ans.append(a)
for fr, tmp in enumerate(ans, 0):
if a == tmp:
break
ret = 0
ret += sum(ans[:fr+1])
if fr != to:
l = (N-fr)//(to-fr)
ret += sum(ans[fr:to]) ... | Traceback (most recent call last):
File "/tmp/tmppjnxwdl3/tmp223evqgj.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s525158059 | p02550 | u747602774 | 1600547008 | Python | PyPy3 (7.3.0) | py | Runtime Error | 77 | 72180 | 630 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7
n,x,m = map(int,readline().split())
if n < 10**7:
a = [0]*n
a[0] = x
for i in range(n-1):
a[i+1] = a[i]**2%m
print(sum(a))
exit()
a = [0]*m
a[0] = x
for i in rang... | Traceback (most recent call last):
File "/tmp/tmpc8_3i9ru/tmpxd1unvu8.py", line 9, in <module>
n,x,m = map(int,readline().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s161662499 | p02550 | u793821463 | 1600547004 | Python | Python (3.8.2) | py | Runtime Error | 65 | 14080 | 449 | N , X , M = map(int,input().split())
flag = [0]*M
S = X
SN = [0]*M
SN[1] = X
A = X
loop = 1
flag[X%M] = 1
for i in range(N - 1):
A = (A**2)%M
if flag[A] == 0:
flag[A] = loop
else:
loops = flag[A]
break
S += A
SN[loop+1] = S
loop += 1
if loop <N:
ans = 0
ans += SN[loops]
dS = SN[loop] - SN... | Traceback (most recent call last):
File "/tmp/tmpzgcxr6yd/tmpykq4ar_z.py", line 1, in <module>
N , X , M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s561760447 | p02550 | u207363774 | 1600547000 | Python | Python (3.8.2) | py | Runtime Error | 136 | 30372 | 287 | N,X,M = map(int,input().split())
d = {X:0}
l = [X]
for i in range(1,N):
l+=[(l[i-1]**2)%M]
if l[i] in d:
dl = l[d[l[i]]+1:]
print(dl)
l += dl*((N-i-1)//len(dl))
if (N-i-1)%len(dl) != 0:
l += dl[0:(N-i-1)%len(dl)]
break
d[l[i]] = i
print(l)
print(sum(l)) | Traceback (most recent call last):
File "/tmp/tmpjpg4laqd/tmp38qesheo.py", line 1, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s421681840 | p02550 | u994521204 | 1600546986 | Python | PyPy3 (7.3.0) | py | Runtime Error | 173 | 74828 | 1414 | import sys
input = sys.stdin.buffer.readline
n, x, mod = map(int, input().split())
ans = 0
temp = x
num = 1
# while temp < mod:
# temp *= x
# num += 1
A = [0] * (mod + 1)
# if temp == mod:
# A[1] = x % mod
# ans += A[1]
# for i in range(2, num + 1):
# A[i] = A[i - 1] * A[i - 1] % mod
# ... | Traceback (most recent call last):
File "/tmp/tmpvmr9o19h/tmpqvb34nwt.py", line 5, in <module>
n, x, mod = map(int, input().split())
^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s225234096 | p02550 | u160204399 | 1600546983 | Python | PyPy3 (7.3.0) | py | Runtime Error | 799 | 69568 | 688 | n, x, m = map(int, input().split())
count=x
now=x
flag=-1
sled=[now]
for i in range(1,n):
now=(now*now)%m
if now==0:
flag=0
break
if now==1:
flag==1
nokori=n-i
break
if now in sled:
start=sled.index(now)
nokori=n-i
flag=2
... | Traceback (most recent call last):
File "/tmp/tmpsdsuapmx/tmpmhks2h0s.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s671911470 | p02550 | u371409687 | 1600546942 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11192 | 481 | n,x,m=map(int,input().split())
tmp=x
L=[x]
cnt_list=[0 for i in range(m+1)]
for i in range(n):
tmp=tmp**2%m
if tmp not in L:
L.append(tmp)
cnt_list[tmp]=i
else:
cnt=cnt_list[tmp]+1
break
if len(L[cnt:])==0:
ans=sum(L)+sum(L[cnt-1])*(n-len(L)+1)
else:
times=(n-len(L[:c... | Traceback (most recent call last):
File "/tmp/tmpfs58335k/tmpgtxmio5l.py", line 1, in <module>
n,x,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s341235471 | p02550 | u450028885 | 1600546928 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9616 | 414 | n, x, m = map(int, input().split())
num_list = []
num2 = x
for i in range(n) :
num1 = num2 % m
if num1 in num_list :
num = num_list.index(num1)
break
else :
num_list.append(num1)
num2 = num1 ** 2
acc1 = sum(num_list[:num])
acc2 = sum(num_list[num:])
num3 = n // len(num_li... | Traceback (most recent call last):
File "/tmp/tmpk80dbpvz/tmp8pmmlsi9.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s104363176 | p02550 | u630554891 | 1600546899 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9592 | 307 | n,x,m=map(int, input().split())
a = x
ans = a
l=[a]
for i in range(1,n):
tmp=(a*a)%m
a=tmp
ans+=tmp
if a in l:
lp = l.index(a)
break
else:
l.append(a)
l2 = l[lp:]
tmp = sum(l2)
b=int((n-len(l))/len(l2))
c=(n-len(l))%len(l2)
ans+=b*tmp+sum(l2[:c])
print(ans) | Traceback (most recent call last):
File "/tmp/tmp69mrppjm/tmpg8diipte.py", line 1, in <module>
n,x,m=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s493480134 | p02550 | u793821463 | 1600546896 | Python | Python (3.8.2) | py | Runtime Error | 68 | 13964 | 449 | N , X , M = map(int,input().split())
flag = [0]*M
S = X
SN = [0]*M
SN[1] = X
A = X
loop = 1
flag[X%M] = 1
for i in range(N):
A = (A**2)%M
if flag[A] == 0:
flag[A] = loop
else:
loops = flag[A]
break
S += A
SN[loop+1] = S
loop += 1
if loop <N:
ans = 0
ans += SN[loops]
dS = SN[loop] - SN[loo... | Traceback (most recent call last):
File "/tmp/tmp6zx7xfrl/tmpujiewi_9.py", line 1, in <module>
N , X , M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s485524059 | p02550 | u809495242 | 1600546887 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10484 | 1000 | N, X, M = map(int,input().split())
A = [X]
Asum = [X]
roopsum = 0
rooptimes = 0
ans = 0
index = 0
flag = 0
def f(x):
global M
global A
global Asum
if x == 1:
return X
else:
A += [A[x-2]**2 % M]
Asum += [Asum[x-2] + (A[x-2]**2 % M)]
return A[x-2]**2 % M
for p in ran... | Traceback (most recent call last):
File "/tmp/tmp5z8hxljx/tmp5o5ac1fu.py", line 1, in <module>
N, X, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s361893059 | p02550 | u107639613 | 1600546874 | Python | PyPy3 (7.3.0) | py | Runtime Error | 106 | 89224 | 875 | import sys
def input(): return sys.stdin.readline().strip()
def main():
n, x, m = map(int, input().split())
if x == 0:
print(0)
return
if x == 1:
print(n)
return
d = {}
d_idx = {}
d_unit = {}
idx = 0
pow_x = x
unit = 0
while idx < n and pow_x not... | Traceback (most recent call last):
File "/tmp/tmp9f4o2ffs/tmpww_6mmvj.py", line 42, in <module>
main()
File "/tmp/tmp9f4o2ffs/tmpww_6mmvj.py", line 5, in main
n, x, m = map(int, input().split())
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s173334540 | p02550 | u589969467 | 1600546874 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9660 | 478 | n,x,m = map(int,input().split())
a = []
a.append(0)
a.append(x)
for i in range(1,n):
#tmp = (a[i]**2)%m
tmp = (a[i]%m)*(a[i]%m)
tmp = tmp%m
if tmp==0:
break
if tmp in a:
break
a.append(tmp)
#print(a)
i = 1
while a[i]!=tmp:
i+=1
kurikaeshi = len(a) - i
goukei = sum(a[i:])
#print(goukei)
tmp=(n-(len... | Traceback (most recent call last):
File "/tmp/tmpggejxpz3/tmpvr4vt2pg.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s733995686 | p02550 | u271210469 | 1600546852 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 68496 | 495 | n,X,m=map(int,input().split())
x=[0]*m
y=[0]*m
y[0]=X
z=[0]*(m+1)
z[X]+=1
for i in range(1,m):
x[i]=(i**2)%m
for i in range(1,m+1):
y[i]=x[y[i-1]]
z[y[i]]+=1
if z[y[i]]==2:
e=i
q=y[i]
break
for i in range(len(y)):
if y[i]==q:
b=i
break
l=y[b:e]
L=len(l)
s=sum(... | Traceback (most recent call last):
File "/tmp/tmp_c66_37e/tmp5jljma2t.py", line 1, in <module>
n,X,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s578535206 | p02550 | u623231048 | 1600546799 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 73452 | 907 | n,x,m = map(int,input().split())
if x == 0:
print(0)
exit()
li = [-1] * m
v = [False] * m
v2 = [False] * m
v[x] = 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
... | Traceback (most recent call last):
File "/tmp/tmpu23ygs0q/tmp5hcqevwj.py", line 1, in <module>
n,x,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s481933147 | p02550 | u170201762 | 1600546795 | Python | PyPy3 (7.3.0) | py | Runtime Error | 97 | 75320 | 435 | from collections import defaultdict
N,X,M = map(int,input().split())
ans = 0
d = defaultdict(lambda:-1)
x = X%M
for n in range(M):
if x in d:
T = n-d[x]
break
else:
d[x] = n
x *= x
x %= M
p = 0
y = x
for m in range(d[x],n):
p += y
y *= y
y %= M
ans = 0
n = N
z = X%M
... | Traceback (most recent call last):
File "/tmp/tmpj2xacncd/tmpd50milu3.py", line 2, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s059626914 | p02550 | u273914730 | 1600546789 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8992 | 210 | S=list(map(int,input().split()))
a=[S[1]]
for i in range(0,S[0]-1):
if a[i]**2>10**9+7:
a.append(((a[i]**2)%(10**9+7))%S[2])
else:
a.append(((a[i]**2)%S[2])
print(sum(a))
| File "/tmp/tmpz74lr9v8/tmp3lpjrxwr.py", line 7
a.append(((a[i]**2)%S[2])
^
SyntaxError: '(' was never closed
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.