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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s715978540 | p02549 | u002625175 | 1600546382 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 25988 | 434 |
def main():
n, k = map(int, input().split())
n -= 1
S = sorted({
i
for l, r in [map(int, input().split()) for _ in range(k)]
for i in range(l, r + 1)
})
dp = [None] * (n+1)
dp[0] = 1
def cal(num):
total = 0
for s in S:
if s > num: break
next_num = num - s
total... | Traceback (most recent call last):
File "/tmp/tmpq7504dik/tmpie3ocvka.py", line 35, in <module>
main()
File "/tmp/tmpq7504dik/tmpie3ocvka.py", line 3, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s361072484 | p02549 | u234454594 | 1600546364 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 26080 | 386 | def paths(n,ways,c,s):
if s==n:
c[0]+=1
return
for i in range(len(ways)):
midpath=s+ways[i]
if midpath<=n:
paths(n,ways,c,midpath)
n,k=map(int,input().split())
s=set()
for i in range(k):
a,b=map(int,input().split())
for i in range(a,b+1):
... | Traceback (most recent call last):
File "/tmp/tmp9w2aqkpj/tmpsr5wm71o.py", line 13, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s862396811 | p02549 | u587589241 | 1600546305 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 94308 | 338 | n,k=map(int,input().split())
dp=[0 for i in range(n)]
num=[False for i in range(n)]
dp[0]=1
mod=998244353
for i in range(k):
l,r=map(int,input().split())
for j in range(l,r+1):
num[j]=True
for i in range(n):
for j in range(n-i):
if num[j]:
dp[i+j]+=dp[i]
dp[i+j]%=mod
... | Traceback (most recent call last):
File "/tmp/tmpol3jsy60/tmpnz15rc5w.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s731214988 | p02549 | u587370992 | 1600546300 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 16604 | 606 | import sys
N, K = list(map(int, input().split()))
MOD = 998244353
sys.setrecursionlimit(N + 1)
L = []
R = []
for _ in range(K):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
memo = [None] * (N + 1)
def f(x):
if x < 0:
return 0
if memo[x] is None:
memo[x] = _f(x)... | Traceback (most recent call last):
File "/tmp/tmpbpx1jh2m/tmpilmz9rim.py", line 3, in <module>
N, K = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s334630575 | p02549 | u551857719 | 1600546292 | Python | Python (3.8.2) | py | Runtime Error | 755 | 32488 | 743 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
def std_in():
return sys.stdin.readline().strip()
def get_ints():
return map(int, sys.stdin.readline().strip().split())
def main():
n, m = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(m)]
s = set()
for p... | Traceback (most recent call last):
File "/tmp/tmpt823me12/tmpp416y5h0.py", line 41, in <module>
main()
File "/tmp/tmpt823me12/tmpp416y5h0.py", line 16, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s465831051 | p02549 | u465284486 | 1600546278 | Python | PyPy3 (7.3.0) | py | Runtime Error | 97 | 86580 | 755 | import heapq
N, K = list(map(int, input().split(" ")))
S = []
for _ in range(K):
a, b = list(map(int, input().split(" ")))
S.extend(range(a, b+1))
combinations = [0] * (N + 1)
combinations[1] = 1
S.sort()
next_node = []
for i in S:
next_node.append(i + 1)
combinations[i + 1] += 1
heapq.heapify(n... | Traceback (most recent call last):
File "/tmp/tmp2szorkd4/tmpcuik8ur_.py", line 3, in <module>
N, K = list(map(int, input().split(" ")))
^^^^^^^
EOFError: EOF when reading a line
| |
s988576855 | p02549 | u587370992 | 1600546242 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9168 | 605 | import sys
sys.setrecursionlimit(N + 1)
N, K = list(map(int, input().split()))
MOD = 998244353
L = []
R = []
for _ in range(K):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
memo = [None] * (N + 1)
def f(x):
if x < 0:
return 0
if memo[x] is None:
memo[x] = _f(x)
... | Traceback (most recent call last):
File "/tmp/tmptsqar67y/tmpvi8ye5fh.py", line 2, in <module>
sys.setrecursionlimit(N + 1)
^
NameError: name 'N' is not defined
| |
s121283423 | p02549 | u551857719 | 1600546229 | Python | Python (3.8.2) | py | Runtime Error | 711 | 32492 | 756 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
def std_in():
return sys.stdin.readline().strip()
def get_ints():
return map(int, sys.stdin.readline().strip().split())
def main():
n, m = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(m)]
s = set()
for p... | Traceback (most recent call last):
File "/tmp/tmp7c_wfnu7/tmphf06iamv.py", line 42, in <module>
main()
File "/tmp/tmp7c_wfnu7/tmphf06iamv.py", line 16, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s474944211 | p02549 | u587370992 | 1600546140 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2286 | 1475688 | 601 | import sys
N, K = list(map(int, input().split()))
MOD = 998244353
L = []
R = []
for _ in range(K):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
memo = [None] * (N + 1)
def f(x):
if x < 0:
return 0
if memo[x] is None:
memo[x] = _f(x)
# print(x, memo[x])
r... | Traceback (most recent call last):
File "/tmp/tmp57_4c88q/tmpm15eq0bt.py", line 3, in <module>
N, K = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s552379415 | p02549 | u777800738 | 1600546138 | Python | Python (3.8.2) | py | Runtime Error | 151 | 27208 | 528 | import numpy as np
num=input().split(' ')
count=0
plot=np.zeros([int(num[0]),int(num[0])])
t=[]
for a in range(int(num[1])):
tmp=input().split(' ')
t.append([int(tmp[0])+a for a in range(int(tmp[1])-int(tmp[0])+1)])
for a in range(int(num[0])):
if a==0:
plot[0,0]=1
else:
for posit in np.where(plot[a-1]>... | Traceback (most recent call last):
File "/tmp/tmpzxm20k0g/tmp75eiksqj.py", line 2, in <module>
num=input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s227802089 | p02549 | u503227287 | 1600546114 | Python | PyPy3 (7.3.0) | py | Runtime Error | 177 | 116356 | 1193 | from sys import stdin
class DFS():
def __init__(self,N,S):
self.N = N
self.S = S
self.seen = [False] * self.N
self.cnt = [0] * self.N
def dfs(self, i):
if i == self.N-1:
return 1
elif i > self.N-1:
return 0
elif self.seen[i]:
... | Traceback (most recent call last):
File "/tmp/tmpb9cpxjw0/tmpi0l42lsr.py", line 49, in <module>
main()
File "/tmp/tmpb9cpxjw0/tmpi0l42lsr.py", line 30, in main
N, K = list(map(int, _in[0].split(' '))) # type:list(int)
~~~^^^
IndexError: list index out of range
| |
s109532248 | p02549 | u081060730 | 1600546112 | Python | Python (3.8.2) | py | Runtime Error | 2117 | 18360 | 265 | N,K=map(int,input().split(" "))
a=[]
for k in range(K):
l,r=map(int,input().split(" "))
a+=list(range(l,r+1))
b=[0 for i in range(a[-1]-1)]
b.append(1)
for i in range(N-1):
x=0
for j in a:
x+=b[-j]
b.append(x)
print(b[-1]%998244353)
| Traceback (most recent call last):
File "/tmp/tmpywywzneg/tmpkqas6ume.py", line 1, in <module>
N,K=map(int,input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s835553494 | p02549 | u896726004 | 1600546099 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 68612 | 369 | import numpy as np
mod = 998244353
N, K = map(int, input().split())
LR = []
for _ in range(K):
l, r = map(int, input().split())
LR.append((l, r))
dp = np.array([0] * (N+1))
dp[1] += 1
for i in range(1, N+1):
now = dp[i] % mod
for l, r in LR:
try:
dp[i+l:i+r+1] += now
... | Traceback (most recent call last):
File "/tmp/tmpcud2aq1g/tmpfh5wywmh.py", line 5, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s433698803 | p02549 | u944396627 | 1600546081 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 110548 | 5494 | import sys
sys.setrecursionlimit(250000)
dp = []
syugo = set()
def rec(i):
global syugo
global dp
if i < 0 :
return 0
if i == 0 :
return 1
for j in syugo:
dp[i] = dp[i] + rec(i-j)
return dp[i]
def main():
global syugo
global dp
n, k = map(int, input().s... | Traceback (most recent call last):
File "/tmp/tmpil4mg8oc/tmp7q8st9wy.py", line 43, in <module>
main()
File "/tmp/tmpil4mg8oc/tmp7q8st9wy.py", line 25, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s043940221 | p02549 | u503227287 | 1600546014 | Python | PyPy3 (7.3.0) | py | Runtime Error | 190 | 116560 | 1181 | from sys import stdin
class DFS():
def __init__(self,N,S):
self.N = N
self.S = S
self.seen = [False] * self.N
self.cnt = [0] * self.N
def dfs(self, i):
if i == self.N-1:
return 1
elif i > self.N-1:
return 0
elif self.seen[i]:
... | Traceback (most recent call last):
File "/tmp/tmp61s5p3z1/tmpgjoypdf4.py", line 49, in <module>
main()
File "/tmp/tmp61s5p3z1/tmpgjoypdf4.py", line 30, in main
N, K = list(map(int, _in[0].split(' '))) # type:list(int)
~~~^^^
IndexError: list index out of range
| |
s451670800 | p02549 | u221061152 | 1600546010 | Python | Python (3.8.2) | py | Runtime Error | 205 | 26132 | 458 | N,K=map(int,input().split())
mod = 998244353
div = set()
for _ in range(K):
l,r = map(int,input().split())
for i in range(l,r+1):
div.add(i)
min_step = min(div)
dp = [-1]*N
dp[0] = 1
def calc(i):
if dp[i] >= 0: return dp[i]
#if i < min_step: dp[i]=0; return dp[i]
if i < min_step: return 0
tmp = 0
fo... | Traceback (most recent call last):
File "/tmp/tmp65l9pupq/tmp2x1of31f.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s049190666 | p02549 | u794448346 | 1600545987 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 70412 | 429 | N,K = map(int,input().split())
LR = [list(map(int,input().split())) for i in range(K)]
LR.sort()
mod = 998244353
ma = [0] * N
ma[0] = 1
for i in range(N):
if ma[i] != 0:
for l,r in LR:
for j in range(l,r+1):
if i+j < N:
ma[i+j] += ma[i]
else:
... | Traceback (most recent call last):
File "/tmp/tmpjmnc1c7b/tmpfgfzf9m2.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s452568221 | p02549 | u503227287 | 1600545986 | Python | PyPy3 (7.3.0) | py | Runtime Error | 245 | 134512 | 1194 | from sys import stdin
class DFS():
def __init__(self,N,S):
self.N = N
self.S = S
self.seen = [False] * self.N
self.cnt = [0] * self.N
def dfs(self, i):
if i == self.N-1:
return 1
elif i > self.N-1:
return 0
elif self.seen[i]:
... | Traceback (most recent call last):
File "/tmp/tmph7rgl0ei/tmpaqrolaa0.py", line 50, in <module>
main()
File "/tmp/tmph7rgl0ei/tmpaqrolaa0.py", line 30, in main
N, K = list(map(int, _in[0].split(' '))) # type:list(int)
~~~^^^
IndexError: list index out of range
| |
s721310820 | p02549 | u587370992 | 1600545959 | Python | PyPy3 (7.3.0) | py | Runtime Error | 474 | 122892 | 565 | N, K = list(map(int, input().split()))
MOD = 998244353
L = []
R = []
for _ in range(K):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
memo = [None] * (N + 1)
def f(x):
if x < 0:
return 0
if memo[x] is None:
memo[x] = _f(x)
# print(x, memo[x])
return memo[x... | Traceback (most recent call last):
File "/tmp/tmpnqzsh2gm/tmp9x85npyh.py", line 1, in <module>
N, K = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s515762359 | p02549 | u747602774 | 1600545894 | Python | PyPy3 (7.3.0) | py | Runtime Error | 139 | 75884 | 456 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7
n,k = map(int,readline().split())
LR = [list(map(int,readline().split())) for i in range(k)]
dp = [0]*(2*n+1)
imos = [0]*(2*n+1)
dp[1] = 1
for i in range(1,n+1):
imos[i] = (imos[i-1]+im... | Traceback (most recent call last):
File "/tmp/tmpcqmjn9da/tmpm60ls27o.py", line 9, in <module>
n,k = map(int,readline().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s435249903 | p02549 | u135454978 | 1600545862 | Python | PyPy3 (7.3.0) | py | Runtime Error | 133 | 76032 | 496 | import sys
mod = 998244353
N, K = map(int, sys.stdin.readline().strip().split())
step = []
for _ in range(K):
L, R = map(int, sys.stdin.readline().strip().split())
step.append((L, R))
step.sort()
dp = [False] * (N + 1)
dp[1] = 1
def solve(u):
if u <= 0:
return 0
if dp[u] is not False:
... | Traceback (most recent call last):
File "/tmp/tmphuy1i3w5/tmpwr2f40te.py", line 5, in <module>
N, K = map(int, sys.stdin.readline().strip().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s642730363 | p02549 | u849756457 | 1600545858 | Python | Python (3.8.2) | py | Runtime Error | 398 | 18152 | 461 | MOD = 998244353
N, K = [int(i) for i in input().split()]
k = []
vals = []
for i in range(K):
v = [int(i) for i in input().split()]
vals.extend([*range(v[0], v[1] + 1)])
vals.sort()
d = {}
def helper(n):
if n == 0:
return 1
if n in d:
return d[n]
if n < vals[0]:
return -1
count = 0
for v... | Traceback (most recent call last):
File "/tmp/tmpl4d_4slf/tmp61qpwnpl.py", line 2, in <module>
N, K = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s784324340 | p02549 | u678167152 | 1600545819 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 68664 | 1590 | # Binary Indexed Tree (Fenwick Tree)
class BIT:
def __init__(self, n):
self.n = n
self.bit = [0]*(n+1)
self.el = [0]*(n+1)
def sum(self, i):
s = 0
while i > 0:
s += self.bit[i]
i -= i & -i
return s
def add(self, i, x):
# assert i > 0
self.el[i] += x
while i <= self.... | File "/tmp/tmpxlmtmcex/tmpgymvkfp1.py", line 33
class BIT:
IndentationError: expected an indented block after 'if' statement on line 32
| |
s909056867 | p02549 | u587370992 | 1600545808 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11244 | 542 | N, K = list(map(int, input().split()))
MOD = 998244353
L = []
R = []
for _ in range(K):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
memo = [None] * (N + 1)
def f(x):
if x < 0:
return 0
if memo[x] is None:
memo[x] = _f(x)
# print(x, memo[x])
return memo[x... | Traceback (most recent call last):
File "/tmp/tmp9v89wp09/tmpagpj46tw.py", line 1, in <module>
N, K = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s669355872 | p02549 | u473113960 | 1600545779 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9036 | 196 | def kai(N, X, M):
A_n = [X]
for i in range(1, N):
A_i = (A_n[i-1] **2) % M
A_n.append(A_i)
return A_n, sum(A_n)
N, X, M = map(int, input().split())
print(kai(N, X, M)) | Traceback (most recent call last):
File "/tmp/tmpgws8wo6m/tmpd1rzpu0y.py", line 8, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s054498305 | p02549 | u729972685 | 1600545765 | Python | PyPy3 (7.3.0) | py | Runtime Error | 175 | 74276 | 571 | from sys import stdin
input = stdin.readline
from functools import lru_cache
MOD = 998244353
def solve():
N,K = map(int,input().split())
step = [tuple(map(int,inp.split())) for inp in stdin.read().splitlines()]\
@lru_cache(None)
def dp(n):
if n == 1:
return 1
res = 0
... | Traceback (most recent call last):
File "/tmp/tmph2pknsin/tmpr39guu75.py", line 31, in <module>
solve()
File "/tmp/tmph2pknsin/tmpr39guu75.py", line 10, in solve
N,K = map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s655196771 | p02549 | u697696097 | 1600545734 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 27064 | 1205 | ### ----------------
### ここから
### ----------------
import sys
from io import StringIO
import unittest
#import itertools
#import heapq
#from collections import deque
#d = deque()
def yn(b):
print("Yes" if b==1 else "No")
return
def resolve():
readline=sys.stdin.readline
mod=998244353
dp=[0]*(2*(10... | Traceback (most recent call last):
File "/tmp/tmp0qu85wkd/tmpu2eydekw.py", line 53, in <module>
resolve()
File "/tmp/tmp0qu85wkd/tmpu2eydekw.py", line 22, in resolve
n,k=map(int, readline().rstrip().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s391912221 | p02549 | u587370992 | 1600545661 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10988 | 536 | N, K = list(map(int, input().split()))
MOD = 998244353
L = []
R = []
for _ in range(K):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
memo = [None] * (N + 1)
def f(x):
if x < 0:
return 0
if memo[x] is None:
memo[x] = _f(x)
# print(x, memo[x])
return memo[x... | Traceback (most recent call last):
File "/tmp/tmppe4z9eas/tmpdtar4b3p.py", line 1, in <module>
N, K = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s128444111 | p02549 | u733581231 | 1600545635 | Python | Python (3.8.2) | py | Runtime Error | 433 | 196324 | 968 | #: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
input = sys.stdin.readline
##########... | Exception in thread Thread-1 (solve):
Traceback (most recent call last):
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **... | |
s245866780 | p02549 | u910632349 | 1600545632 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 88020 | 597 | import heapq
n,k=map(int,input().split())
can=[]
you=[0]*(n+1)
for i in range(k):
l,r=map(int,input().split())
you[l],you[r+1]=1,-1
for i in range(n):
you[i+1]+=you[i]
for i in range(n):
if you[i]:
can.append(i)
table=[0]*n
table[0]=1
ka=[0]*(n+1)
ka[0]=1
que=[0]
heapq.heapify(que)
can.sort()
wh... | Traceback (most recent call last):
File "/tmp/tmpcdu_23rj/tmpnrzhbuat.py", line 2, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s656084417 | p02549 | u072717685 | 1600545611 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 114860 | 800 | import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
import numpy as np
from numba import njit
def main():
large_num = 998244353
n, k = map(int, input().split())
n -= 1
dd = [0] * (10**5 * 2)
m = map(int, read().split())
ab = zip(m, m)
for a, b in ab:
for i1 in range(a,... | Traceback (most recent call last):
File "/tmp/tmph3r_kvs8/tmpcj_qxbdr.py", line 35, in <module>
main()
File "/tmp/tmph3r_kvs8/tmpcj_qxbdr.py", line 8, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s873181011 | p02549 | u078085705 | 1600545581 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9168 | 194 | n = int(input())
count=0
for i in range(1,1000):
print(i)
for j in range(1,1000):
print(j)
if (i*j)>=n:
count+=j-1
break
print(count)
| Traceback (most recent call last):
File "/tmp/tmpm3cq_x0_/tmpagcdeu2d.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s945994159 | p02549 | u797106134 | 1600545580 | Python | PyPy3 (7.3.0) | py | Runtime Error | 190 | 74696 | 665 | # 明らかにdp、あるマスに乗っているときそれまでの履歴とかが全く意味をなさないから
# dp[i]: マス目iにいるときのそこまでの移動方法の合計
# dp[i+1] = dp[i]
# 最悪N*K掛かりそうな気がするけどnumpyなら早いんかなぁ?だとしたら簡単すぎる問題な気もするけど。。。?
N,K = map(int,input().split())
L = 998244353
LR = [0] * K
for i in range(K):
l,r = map(int,input().split())
LR[i] = [l,r]
import numpy as np
dp = np.array([0] * ... | Traceback (most recent call last):
File "/tmp/tmpyrl507dq/tmp43z9c6ae.py", line 6, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s190634853 | p02549 | u473113960 | 1600545573 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9112 | 191 | def kai(N, X, M):
A_n = [X]
for i in range(1, N):
A_i = (A_n[i-1] **2) % M
A_n.append(A_i)
return sum(A_n)
N, X, M = map(int, input().split())
print(kai(N, X, M)) | Traceback (most recent call last):
File "/tmp/tmp8e6ob9hy/tmpg2g7jm08.py", line 8, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s223102546 | p02549 | u231570044 | 1600545564 | Python | Python (3.8.2) | py | Runtime Error | 384 | 91780 | 501 | from numba import jit
MOD = 998244353
N, K = list(map(int, input().split()))
dp = np.zeros(N+1, dtype=np.int64)
mv = np.zeros(N+1, dtype=np.int64)
for i in range(K):
l, r = list(map(int, input().split()))
for j in range(l, r+1):
mv[j] = 1
@jit(nopython=True)
def shift_and_add(dp, mv, m, i):
dp +=... | Traceback (most recent call last):
File "/tmp/tmp6re9toe5/tmpv10otjww.py", line 4, in <module>
N, K = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s145087898 | p02549 | u347203174 | 1600545520 | Python | PyPy3 (7.3.0) | py | Runtime Error | 132 | 68644 | 390 | import numpy as np
N, K = map(int, input().split())
MOD = 998244353
mark = [0]*(N+1)
for i in range(K):
l, r = map(int, input().split())
for i in range(l, r+1):
mark[i] = 1
count = [0]*(N+1)
count[1] = 1
for i in range(1, N+1):
for k in range(N+1):
if mark[k] > 0 and (i + k) <= N:
... | Traceback (most recent call last):
File "/tmp/tmpzkvlh1cr/tmp24lpatrf.py", line 2, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s916183045 | p02549 | u072717685 | 1600545489 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 114736 | 794 | import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
import numpy as np
from numba import njit
def main():
large_num = 998244353
n, k = map(int, input().split())
n -= 1
dd = [0] * (n+1)
m = map(int, read().split())
ab = zip(m, m)
for a, b in ab:
for i1 in range(a, b + 1... | Traceback (most recent call last):
File "/tmp/tmp1caijmrj/tmpnlvx4o41.py", line 35, in <module>
main()
File "/tmp/tmp1caijmrj/tmpnlvx4o41.py", line 8, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s921173046 | p02549 | u802180430 | 1600545443 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9060 | 497 | '''go to every index and then run a index - 1 to 1 for it and check whether the proposed number lies somewhere or not'''
n,k = tuple(map(int,input().split()))
boolean = [False]*n
for _ in range(k):
l,r = tuple(map(int,input().split()))
for num in range(l,r+1):
boolean[num] = True;
dp = [0 for _ in range(n+1)]
b... | File "/tmp/tmpwe340y3r/tmpszaf72m1.py", line 14
dp[i] += dp[start]
TabError: inconsistent use of tabs and spaces in indentation
| |
s913413606 | p02549 | u170201762 | 1600545440 | Python | PyPy3 (7.3.0) | py | Runtime Error | 109 | 69892 | 384 | mod = 998244353
N,K = map(int,input().split())
D = [list(map(int,input().split())) for _ in range(K)]
D.sort()
dp = [0]*N
dp[0] = 1
dp[D[0][0]] = 1
for n in range(D[0][0],N-1):
dp[n+1] = dp[n]
for i in range(K):
L,R = D[i]
if n-L+1>=0:
dp[n+1] += dp[n-L+1]
if n-R+1>0:
... | Traceback (most recent call last):
File "/tmp/tmp4r48qe06/tmppue4xbq8.py", line 2, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s664957874 | p02549 | u632131476 | 1600545324 | Python | Python (3.8.2) | py | Runtime Error | 98 | 27736 | 555 | def sum(i):
if nums[i] != -1:
return nums[i]
else:
nums[i] = 0
for k in S:
if i - k > 0:
nums[i] += sum(i - k)
else:
break
return nums[i]
S = set()
temp = []
temp = list(map(int, input().split()))
N = temp[0]
K = temp[1]
... | Traceback (most recent call last):
File "/tmp/tmpbrrjpsmp/tmpzufrl3te.py", line 17, in <module>
temp = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s136479217 | p02549 | u135454978 | 1600545284 | Python | PyPy3 (7.3.0) | py | Runtime Error | 190 | 75936 | 547 | import sys
mod = 998244353
N, K = map(int, sys.stdin.readline().strip().split())
step = []
for _ in range(K):
L, R = map(int, sys.stdin.readline().strip().split())
step.append((L, R))
step.sort()
dp = [False] * N
dp[0] = 1
def solve(u):
# print(f'u :{u}')
if u < 0:
return 0
if dp[u] i... | Traceback (most recent call last):
File "/tmp/tmpsfs12zoe/tmpc4uvi_pl.py", line 5, in <module>
N, K = map(int, sys.stdin.readline().strip().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s957964095 | p02549 | u479475321 | 1600545277 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12896 | 633 | n,k = map(int, input().split())
hani = [0 for i in range(n)]
kumi = [-1 for i in range(n)]
for i in range(k):
l,r = map(int,input().split())
for j in range(l-1,r):
hani[j] = 1
def countt(n,hani,kumi):
if n == 1:
if hani[0] == 1:
kumi[0] = 1
else:
kumi[0] = 0... | Traceback (most recent call last):
File "/tmp/tmpfwnm2oe5/tmp60qrzr3s.py", line 1, in <module>
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s457064626 | p02549 | u611090896 | 1600545214 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 194064 | 336 | n,k = map(int,input().split())
s = []
for i in range(k):
l,r = map(int,input().split())
s.append(l)
s.append(r)
suji = 998244353
_s = set(s)
pos=[]
def dfs(x):
if x > n:
return
if x == n:
pos.append(True)
for i in _s:
dfs(x+i)
dfs(1)
num = pos.count(True)
... | Traceback (most recent call last):
File "/tmp/tmp15u6vl3y/tmpf3caem8q.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s731508281 | p02549 | u022215787 | 1600545149 | Python | Python (3.8.2) | py | Runtime Error | 33 | 18348 | 311 | n, k = map(int,input().split())
l_r = [ list(map(int, input().split())) for _ in range(k) ]
s_l = [ list(range(l,r+1)) for l,r in l_r ]
d = [0] * n
d[0] = 1
for i in range(1, n):
c = 0
for s in s_l:
if s <= i and d[i-s] > 0:
c += d[i-s]
d[i] = c%998244353
print(d[-1]%998244353) | Traceback (most recent call last):
File "/tmp/tmpmtobxoul/tmpaimv42zg.py", line 1, in <module>
n, k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s185779856 | p02549 | u611090896 | 1600545142 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 19116 | 335 | n,k = map(int,input().split())
s = []
for i in range(k):
l,r = map(int,input().split())
s.append(l)
s.append(r)
suji = 998244353
_s = set(s)
pos=[]
def dfs(x):
if x > n:
return
if x == n:
pos.append(True)
for i in _s:
dfs(x+i)
dfs(1)
num = pos.count(True)
... | Traceback (most recent call last):
File "/tmp/tmpm5oaqxic/tmp93ajpudu.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s138039852 | p02549 | u282813849 | 1600545138 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 26080 | 317 | N,K = map(int,input().split())
S = set()
for _ in range(K):
a,b = map(int,input().split())
for i in range(a,b+1):
S.add(i)
def dfs(n):
if n == N:
return 1
elif n > N:
return 0
else:
cnt = 0
for i in S:
cnt += dfs(n+i)
return cnt
ans = dfs(1) % 998244353
print(ans) | Traceback (most recent call last):
File "/tmp/tmpkpsz7gw1/tmp4v1a947v.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s410094852 | p02549 | u910632349 | 1600545091 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 170020 | 473 | import heapq
n,k=map(int,input().split())
can=[]
for i in range(k):
l,r=map(int,input().split())
for j in range(l,r+1):
can.append(j)
table=[0]*n
table[0]=1
que=[0]
heapq.heapify(que)
can.sort()
while que:
now=heapq.heappop(que)
for j in can:
if now+j>n:
break
table[n... | Traceback (most recent call last):
File "/tmp/tmpqh_lid0i/tmpcmqj028c.py", line 2, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s967571090 | p02549 | u954153335 | 1600545084 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 27704 | 293 | n,k=map(int,input().split())
s=[]
for _ in range(k):
l,r=map(int,input().split())
for i in range(l,r+1):
s.append(i)
s=sorted(s)
ans=[0]*(2*(10**5)+100)
ans[0]=1
for i in range(n-1):
ans[i]=ans[i]%998244353
for j in s:
ans[i+j]+=ans[i]
print(ans[n-1]%998244353) | Traceback (most recent call last):
File "/tmp/tmpzlcfus5t/tmp_oxfvmka.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s349501715 | p02549 | u528181687 | 1600545063 | Python | Python (3.8.2) | py | Runtime Error | 125 | 19668 | 575 | def main():
n, k = map(int, input().split())
memo = [-1] * (n+1)
s = []
def calc(n):
if memo[n]>=0:
return memo[n]
c = 0
for v in s:
if v>n:
break
if v==n:
c += 1
else:
c += calc(n-v)... | Traceback (most recent call last):
File "/tmp/tmpoweiet4o/tmpm5bjspt0.py", line 30, in <module>
main()
File "/tmp/tmpoweiet4o/tmpm5bjspt0.py", line 2, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s746276593 | p02549 | u221149873 | 1600544879 | Python | Python (3.8.2) | py | Runtime Error | 2213 | 269480 | 795 | class Rec_memo:
def __init__(self):
self.memo = {}
def solve(self,n,nums):
nums_cleaned = [i for i in nums if i <= n]
if n == 0 or nums_cleaned == []:
return 0
elif n == min(nums_cleaned):
return 1
else:
max_num = max(nums_cleaned)
... | Traceback (most recent call last):
File "/tmp/tmpqxmr0wzm/tmpvlbmnm4t.py", line 20, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s963485907 | p02549 | u958820283 | 1600544805 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11144 | 423 | n,k = map(int,input().split())
s=[]
dp=[0]*n
for i in range(k):
l,r =map(int,input().split())
s.append([l,r])
s.sort()
dp[0]=1
dp[s[0][0]]=1
for i in range(s[0][0]+1,n):
for j in s:
if j[0]>i:
break
for k in range(j[0],j[1]+1):
if i< k:
break
... | Traceback (most recent call last):
File "/tmp/tmpljj28f34/tmptlbs5dvi.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s122217053 | p02549 | u611090896 | 1600544797 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 68672 | 361 | n,k = map(int,input().split())
l,r = [list(map(int,input().split())) for i in range(k)]
suji = 998244353
s = []
for i in l:
s.append(i)
for j in r:
s.append(j)
_s = set(s)
pos=[]
def dfs(x):
if x > n:
return
if x == n:
pos.append(True)
for i in _s:
dfs(x+i)
dfs(1)
... | Traceback (most recent call last):
File "/tmp/tmprn_imrnb/tmp7hnofyji.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s096102322 | p02549 | u954153335 | 1600544785 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 26868 | 296 | n,k=map(int,input().split())
s=[]
for _ in range(k):
l,r=map(int,input().split())
for i in range(l,r+1):
s.append(i)
s=sorted(s)
ans=[0]*(2*(10**5)+10)
ans[0]=1
for i in range(n-1):
for j in s:
ans[i]=ans[i]%998244353
ans[i+j]+=ans[i]
print(ans[n-1]%998244353) | Traceback (most recent call last):
File "/tmp/tmp4u6x2vk3/tmpojt_conw.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s411509454 | p02549 | u297651868 | 1600544766 | Python | PyPy3 (7.3.0) | py | Runtime Error | 172 | 100052 | 416 | n,k= list(map(int, input().split()))
INF=998244353
s=[]
for i in range(k):
j,k=map(int,input().split())
s.append([l for l in range(j,k+1)])
pattern=[0 for i in range(n)]
pattern[0]=1
ls=len(s)
s.sort()
for i in range(1,n):
tmp=0
for j in s:
if i-j[0]<0:
break
else:
... | Traceback (most recent call last):
File "/tmp/tmp47xtyf32/tmpt3ieilrs.py", line 1, in <module>
n,k= list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s702867260 | p02549 | u611090896 | 1600544704 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9200 | 361 | n,k = map(int,input().split())
l,r = [list(map(int,input().split())) for i in range(k)]
suji = 998244353
s = []
for i in l:
s.append(i)
for j in r:
s.append(j)
_s = set(s)
pos=[]
def dfs(x):
if x > n:
return
if x == n:
pos.append(True)
for i in _s:
dfs(x+i)
dfs(1)
... | Traceback (most recent call last):
File "/tmp/tmpw2zohon0/tmpp26ujfwh.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s578013810 | p02549 | u896004073 | 1600544613 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 68648 | 795 | import sys
sys.setrecursionlimit(300000)
N, K = map(int, input().split())
L = 998244353
S_tmp = {}
for _ in range(K):
l, r = map(int, input().split())
S_tmp.update({ l : r })
#S = []
S_ = []
for l, r in sorted(S_tmp.items(), key=lambda x:x[0]):
#S.extend( list(range(l,r+1)) )
S_.append((l,r))
import... | Traceback (most recent call last):
File "/tmp/tmpwh6la2vf/tmpegd40d6n.py", line 4, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s196875721 | p02549 | u589969467 | 1600544579 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 17632 | 339 | def dfs(i):
global ans
if i>n:
return
if i==n:
ans += 1
return
for j in range(len(myList)):
dfs(i+myList[j])
n,k = map(int,input().split())
myList = []
for i in range(k):
l,r = map(int,input().split())
for j in range(l,r+1):
myList.append(j)
myList.sort()
#print(myList)
ans = 0
dfs(1)
p... | Traceback (most recent call last):
File "/tmp/tmp9hns9_ya/tmp9knzl99d.py", line 11, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s363924780 | p02549 | u451122856 | 1600544510 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 19212 | 354 | def coun(x,i):
if dp[i]!=0:
return dp[i]
else:
for j in x:
if (j+i)<=n-1:
dp[i]+=coun(x,i+j)
return dp[i]
n,k=map(int,input().split())
x=[]
for i in range(k):
a,b= map(int,input().split())
for j in range(a,b+1):
x.append(j)
mod=998244353
dp=[0... | Traceback (most recent call last):
File "/tmp/tmpdzbpixko/tmpbmbjxonx.py", line 10, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s600425361 | p02549 | u611090896 | 1600544468 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9136 | 358 | n,k = map(int,input().split())
l,r = [list(map(int,input().split())) for i in range(k)]
suji = 998244353
s = []
for i in l:
s.append(i)
for j in r:
s.append(j)
_s = set(s)
pos=[]
def dfs(x):
if x > n:
return
if x == n:
pos.append(True)
for i in _s:
dfs(x+i)
dfs(1)
... | Traceback (most recent call last):
File "/tmp/tmpf8osi8t6/tmp1b04vpjy.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s162661938 | p02549 | u221061152 | 1600544296 | Python | Python (3.8.2) | py | Runtime Error | 225 | 26076 | 439 | N,K=map(int,input().split())
mod = 998244353
div = set()
for _ in range(K):
l,r = map(int,input().split())
for i in range(l,r+1):
div.add(i)
min_step = min(div)
dp = [-1]*N
dp[0] = 1
def calc(i):
if dp[i] != -1: return dp[i]
if i < min_step: dp[i]=0; return dp[i]
dp[i] = 0
for j in div:
if j > i: ... | Traceback (most recent call last):
File "/tmp/tmp3ndp0i9w/tmp1xeoxj8d.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s517842507 | p02549 | u584790715 | 1600544258 | Python | Python (3.8.2) | py | Runtime Error | 244 | 26496 | 471 | from functools import lru_cache
s = set()
m = 998244353
def main():
n, k = map(int, input().split())
for i in range(k):
l, r = map(int, input().split())
for j in range(l, r + 1):
s.add(j)
# print(s)
# for i in range(n):
# rec(i)
print(rec(n - 1) % m)
@lru_... | Traceback (most recent call last):
File "/tmp/tmpjyhd4en7/tmpaudmd_2i.py", line 30, in <module>
main()
File "/tmp/tmpjyhd4en7/tmpaudmd_2i.py", line 8, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s703966734 | p02549 | u926412290 | 1600544215 | Python | Python (3.8.2) | py | Runtime Error | 2212 | 203036 | 451 | import sys
sys.setrecursionlimit(10**9)
MOD = 998244353
N, K = map(int, input().split())
S = set()
for i in range(K):
l, r = map(int, input().split())
for j in range(l, r + 1):
S.add(j)
dp = [0] * (N + 1)
flag = [0] * (N + 1)
dp[1] = 1
def f(n):
if flag[n]:
return dp[n]
flag[n] = 1
... | Traceback (most recent call last):
File "/tmp/tmpwh0cnxip/tmp8ask5pn0.py", line 6, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s473707700 | p02549 | u926412290 | 1600544176 | Python | Python (3.8.2) | py | Runtime Error | 77 | 27232 | 409 | MOD = 998244353
N, K = map(int, input().split())
S = set()
for i in range(K):
l, r = map(int, input().split())
for j in range(l, r + 1):
S.add(j)
dp = [0] * (N + 1)
flag = [0] * (N + 1)
dp[1] = 1
def f(n):
if flag[n]:
return dp[n]
flag[n] = 1
ret = dp[n]
for step in S:
... | Traceback (most recent call last):
File "/tmp/tmplbsd7e8d/tmpry3baz5_.py", line 2, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s376749521 | p02549 | u736729525 | 1600544159 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11112 | 479 |
MOD = 998244353
def solve(N, LR, memo):
if N == 1:
return 1
if N in memo:
return memo[N]
answer = 0
for l, r in LR:
for d in range(l, r+1):
if N-d > 0:
answer += solve(N-d, LR, memo)
answer %= MOD
memo[N] = answer
return answ... | Traceback (most recent call last):
File "/tmp/tmp05srbjgb/tmpciuqietg.py", line 20, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s791077592 | p02549 | u693592523 | 1600544121 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 19240 | 568 | # import numpy as np
N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(K)]
S = []
for k in range(K):
for i in range(LR[k][0], LR[k][1] + 1):
S.append(i)
memo = [-1 for _ in range(N)]
def move(x):
res = -1
if memo[x] != -1:
res = memo[x]
el... | Traceback (most recent call last):
File "/tmp/tmp1jihqlyq/tmph2_21gik.py", line 3, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s078632224 | p02549 | u285443936 | 1600544114 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2212 | 237628 | 320 | import sys
input = sys.stdin.readline
N,K = map(int,input().split())
S = []
MOD = 998244353
for i in range(K):
l,r = map(int,input().split())
S.append((l,r))
dp = [0]*(N+S[-1][1])
dp[0] = 1
for i in range(0,N):
for l,r in S:
for x in range(l,r+1):
dp[i+x] += dp[i]
print(dp[N-1]%MOD)
| Traceback (most recent call last):
File "/tmp/tmp9kfyaffi/tmpfmpw5v0p.py", line 4, in <module>
N,K = map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s551134230 | p02549 | u735891571 | 1600544105 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9156 | 163 | N = int(input())
ans = 0
for i in range(1, N+1):
for j in range(1, N+1):
if i*j <= N-1:
ans += 1
else:
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmpjued07qn/tmp70gy5udy.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s208312931 | p02549 | u735891571 | 1600544023 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9164 | 163 | N = int(input())
ans = 0
for i in range(1, N+1):
for j in range(1, N+1):
if i*j <= N-1:
ans += 1
else:
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmpk2lgv5yu/tmpc_glrzjo.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s988504820 | p02549 | u625729943 | 1600543991 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 93380 | 712 | # import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10 ** 7)
MOD = 998244353
input = lambda: sys.stdin.readline()[:-1]
pl = la... | Traceback (most recent call last):
File "/tmp/tmpwi9vxge6/tmp3tx7nyr9.py", line 13, in <module>
N, K = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s874144801 | p02549 | u945228737 | 1600543903 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9524 | 777 | # import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, K, LR):
mod = 998244353
S = []
for lr in LR:
S += [i for i in range(lr[0], lr[1] + 1)]
S.sort()
dp = [0] * (N + 1)
dp[1] = 1
... | Traceback (most recent call last):
File "/tmp/tmpyxuwkw84/tmpisyus7cz.py", line 32, in <module>
from func import random_str
ModuleNotFoundError: No module named 'func'
| |
s726850135 | p02549 | u584790715 | 1600543870 | Python | Python (3.8.2) | py | Runtime Error | 226 | 26552 | 457 | from functools import lru_cache
s = set()
def main():
n, k = map(int, input().split())
for i in range(k):
l, r = map(int, input().split())
for j in range(l, r + 1):
s.add(j)
# print(s)
# for i in range(n):
# rec(i)
print(rec(n - 1) % 998244353)
@lru_cach... | Traceback (most recent call last):
File "/tmp/tmpyrw1fpbg/tmpar1oh_bo.py", line 31, in <module>
main()
File "/tmp/tmpyrw1fpbg/tmpar1oh_bo.py", line 7, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s842989103 | p02549 | u225388820 | 1600543806 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 82612 | 367 | import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n, k = map(int, input().split())
a = []
mod = 998244353
for i in range(k):
l, r = map(int, input().split())
for j in range(l, r + 1):
a.append(j)
dp = [0] * (n + 20)
dp[0] = 1
for i in range(n):
for j in a:
dp[i + j] += dp... | Traceback (most recent call last):
File "/tmp/tmp7ecso7ka/tmp52a1t8c0.py", line 4, in <module>
n, k = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s857296870 | p02549 | u503227287 | 1600543650 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 113284 | 956 | from sys import stdin
class DFS():
def __init__(self,N,S):
self.N = N
self.S = S
self.cnt = 0
def dfs(self, i):
if i == self.N-1:
self.cnt += 1
return
elif i > self.N-1:
return
else:
for s in self.S:
... | Traceback (most recent call last):
File "/tmp/tmplpfpumdx/tmp22ip5wvx.py", line 44, in <module>
main()
File "/tmp/tmplpfpumdx/tmp22ip5wvx.py", line 24, in main
N, K = list(map(int, _in[0].split(' '))) # type:list(int)
~~~^^^
IndexError: list index out of range
| |
s360431463 | p02549 | u005788584 | 1600543570 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9120 | 238 | nk=map(int,input().split())
a=[]
for i in range(k):
lr=map(int,input().split())
for i in range(l,r+1):
a.append(i)
a=list(set(a))
dp=[0]*n
dp[0]=1
for i in range(1,n):
for j in a:
if i>=j:
dp[i]+=dp[i-j]
return dp[-1]
| File "/tmp/tmpdgs36k6z/tmpgebmvyfl.py", line 14
return dp[-1]
^^^^^^^^^^^^^
SyntaxError: 'return' outside function
| |
s701677026 | p02549 | u505493564 | 1600543476 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 17920 | 397 | import sys
si = sys.stdin.readline
mod = 998244353
n, k = [int(e) for e in si().split()]
dp, coins = [0 for _ in range(200000+1)], []
while k:
k -= 1
a, b = [int(e) for e in si().split()]
for i in range(a, b+1):
coins.append(i)
dp[1+i] = 1
for i in range(1, n+1):
for coin in coins:
... | Traceback (most recent call last):
File "/tmp/tmpqe81im0n/tmp2gf5bh8m.py", line 5, in <module>
n, k = [int(e) for e in si().split()]
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s757345467 | p02549 | u453683890 | 1600543154 | Python | Python (3.8.2) | py | Runtime Error | 27 | 10444 | 294 | MOD = 998244353
N,K = map(int,input().split())
ran = []
DP = [0]*N+1
DP[1] = 1
for i in range(K):
a,b = map(int,input().split())
ran.extend([x for x in range(a,b+1)])
ran.sort()
for i in range(N+1):
for j in ran:
if j >= i:
break
DP[i] = (DP[i] + DP[i-j]) % MOD
print(DP[N]) | Traceback (most recent call last):
File "/tmp/tmpa3v2o2fg/tmpe6xb56iu.py", line 2, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s963085368 | p02549 | u493130708 | 1600543033 | Python | PyPy3 (7.3.0) | py | Runtime Error | 449 | 85136 | 4234 | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
#############
# Const... | Traceback (most recent call last):
File "/tmp/tmpvg1e0_8e/tmps87i25f5.py", line 151, in <module>
N,K = IL()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s835804204 | p02549 | u493130708 | 1600542955 | Python | PyPy3 (7.3.0) | py | Runtime Error | 479 | 86316 | 4215 | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
#############
# Const... | Traceback (most recent call last):
File "/tmp/tmpzeyzj4pj/tmpj4jviupo.py", line 151, in <module>
N,K = IL()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s682983926 | p02549 | u168578024 | 1600542409 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9028 | 45376 | #pragma region kyopro_template
#define Nyaan_template
#include <immintrin.h>
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define each(x, v) for (auto &x : v)
#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define mem(a, val) memset(a, v... | File "/tmp/tmppk3qu_4d/tmp1yvww9f0.py", line 14
int __VA_ARGS__; \
IndentationError: unexpected indent
| |
s972395048 | p02550 | u803989191 | 1600726184 | Python | Python (3.8.2) | py | Runtime Error | 64 | 13532 | 578 | # -*- coding: utf-8 -*-
n, x, m = map(int, input().split())
a_list = [x]
a = x
i = 1
while (i<n and i < m):
a = (a*a) % m
a_list.append(a)
i += 1
#print(i)
#print(a_list)
if i == n:
ans = sum(a_list)
else:
b = a_list.index(a)
sum1 = sum(a_list[:b+1])
sum2 = sum(a_list[b+1:i])
b... | Traceback (most recent call last):
File "/tmp/tmpaz8_vwuj/tmpssdbuf_p.py", line 3, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s267714920 | p02550 | u525065967 | 1600724404 | Python | Python (3.8.2) | py | Runtime Error | 54 | 13500 | 453 | n, x, m = map(int, input().split())
X = [-1] * m
P = []
sum_p = 0
while X[x] == -1: # preset
X[x] = len(P) # pre length
P.append(sum_p) # pre sum_p
sum_p += x # now sum_p
x = x*x % m
if n < len(P):
print(P[n+1]) # next pre sum_p
exit()
if n == len(P):
print(sum_p) # full sum_p
exit()
c... | Traceback (most recent call last):
File "/tmp/tmp6r3h803i/tmpyynr7r6x.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s023046890 | p02550 | u460745860 | 1600723884 | Python | Python (3.8.2) | py | Runtime Error | 63 | 14024 | 545 | # 繰り返しの始まり + 繰り返し + 途中で終わった繰り返し分
N,X,M = map(int,input().split())
p = [0] * (M+2)
sum = [0] * (M+2)
p[X] = 1
sum[1] = X
repeat_start = 0
repeat_end = 0
for i in range(2,N+1):
X = (X**2) % M
if p[X] != 0:
repeat_start = p[X]
repeat_end = i
break
else:
sum[i] = sum[i-1] + X
p[X] += i
if repea... | Traceback (most recent call last):
File "/tmp/tmpo8zynv5_/tmpn5sxkpn5.py", line 2, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s449391719 | p02550 | u525065967 | 1600723142 | Python | Python (3.8.2) | py | Runtime Error | 57 | 13680 | 445 | n, x, m = map(int, input().split())
X = [-1] * m
P = []
sum_p = 0
while X[x] == -1: # preset
X[x] = len(P) # pre length
P.append(sum_p) # pre sum_p
sum_p += x # now sum_p
x = x*x % m
if n < len(P):
print(P[n+1]) # next pre sum_p
exit()
if n == len(P):
print(sum_p) # full sum_p
exit()
c... | Traceback (most recent call last):
File "/tmp/tmpc0cam4k1/tmpevl9pnd_.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s523339345 | p02550 | u460745860 | 1600722445 | Python | Python (3.8.2) | py | Runtime Error | 64 | 11404 | 508 | N,X,M = map(int,input().split())
cnt = [False] + [1] + [0] * (M-1)
numbers = [X]
ans = 0
if M == 0:
print(0)
exit()
for n in range(N):
X = pow((X % M),2)%M
cnt[X] += 1
if (cnt[X] >= 2) or X == 0:
break
else:
numbers.append(X)
if X == 0:
print(sum(numbers))
exit()
repeat_before = numbers[0:n... | Traceback (most recent call last):
File "/tmp/tmperbkkcne/tmpit1mmmq_.py", line 1, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s157987221 | p02550 | u460745860 | 1600722341 | Python | Python (3.8.2) | py | Runtime Error | 62 | 11572 | 555 | # 繰り返しの始まり + 繰り返し + 途中で終わった繰り返し分
N,X,M = map(int,input().split())
cnt = [False] + [1] + [0] * (M-1)
numbers = [X]
ans = 0
for n in range(N):
X = pow((X % M),2)%M
cnt[X] += 1
if (cnt[X] >= 2) or X == 0:
break
else:
numbers.append(X)
if X == 0:
print(sum(numbers))
exit()
repeat_before = numbers[0:... | Traceback (most recent call last):
File "/tmp/tmp7rzpgtb4/tmpvjqg8axh.py", line 2, in <module>
N,X,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s716550793 | p02550 | u124498235 | 1600710612 | Python | Python (3.8.2) | py | Runtime Error | 66 | 14044 | 412 | n,x,m = map(int, input().split())
chk = [0 for i in range(m)]
a = x
s = x
c = 1
ary = [x]
flg = False
while True:
if c == n:
break
x = (x**2)%m
s += x
c += 1
if chk[x]:
flg = True
break
ary.append(x)
chk[x] = c
if flg == False:
print (s)
exit()
cyc = ary[chk[x]:]
l1 = len(cyc)
ss = ary[:c... | Traceback (most recent call last):
File "/tmp/tmpqhmn9xgn/tmpcfnmn25e.py", line 1, in <module>
n,x,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s383732678 | p02550 | u509150616 | 1600703111 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 80388 | 454 | def gcd(x, y):
x, y = min(x,y), max(x,y)
if y % x == 0:
return x
else:
return gcd(x, y % x)
def SUM(n):
return n*(n+1)//2
N, X, M = map(int, input().split())
count = 0
if gcd(X, M) != 1:
A = X
while A != 0:
count += A
A = A**2 % M
print(count)
else:
p = N ... | Traceback (most recent call last):
File "/tmp/tmpuxk7rx2s/tmp4yqffgz1.py", line 9, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s803419711 | p02550 | u310679274 | 1600697813 | Python | Python (3.8.2) | py | Runtime Error | 217 | 9764 | 342 | def my_func(n, x, m):
if n == 1:
return x
elif n == 2:
b = x ** 2 % m
return b
else:
b = my_func(n-1, x, m) ** 2 % m
return b
if __name__ == "__main__":
n,x,m = (int(k) for k in input().split())
ans = 0
for i in range(1, n+1):
ans += my_func(i... | Traceback (most recent call last):
File "/tmp/tmp6h9rlxye/tmp3a1wjdhc.py", line 14, in <module>
n,x,m = (int(k) for k in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s184780497 | p02550 | u525065967 | 1600697398 | Python | Python (3.8.2) | py | Runtime Error | 67 | 19196 | 944 | n, x, m = map(int, input().split())
mn = min(n, m)
P = [] # (x,pre_sum)
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(mn):
if X[x] > -1:
cyc_len = len(P) - X[x]
pre = P[X[x]][1]
cyc = (sum_p - pre) * ((n - X[x]) // cyc_len)
nxt = P[X[x] + (n - X[x]) % c... | Traceback (most recent call last):
File "/tmp/tmpgb7iq0_r/tmp4qk0fklx.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s108085357 | p02550 | u525065967 | 1600697213 | Python | Python (3.8.2) | py | Runtime Error | 63 | 19132 | 968 | n, x, m = map(int, input().split())
mn = min(n, m)
P = [] # (x,pre_sum)
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(mn):
if X[x] > -1:
cyc_len = len(P) - X[x]
nxt_len = (n - X[x]) % cyc_len
pre = P[X[x]][1]
cyc = (sum_p - pre) * ((n - X[x]) // cyc_len... | Traceback (most recent call last):
File "/tmp/tmp9rt1ykhh/tmpq16hqa9p.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s259019337 | p02550 | u789542708 | 1600695377 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9088 | 597 | N, X, M = map(int, input().split())
a = [X]
start_loop = 0
for n in range(N):
tmp = a[n]*a[n]%M
if(tmp in a):
start_loop = a.index(tmp)
break
a.add(tmp)
if start_loop:
loop_num = len(a) - start_loop
sum_before_loop = sum(a[:start_loop])
... | Traceback (most recent call last):
File "/tmp/tmp7f5yhobr/tmph9fxhznr.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s121384929 | p02550 | u525065967 | 1600676285 | Python | Python (3.8.2) | py | Runtime Error | 53 | 12944 | 442 | n, x, m = map(int, input().split())
mn = min(n, m)
S = set()
A = []
sum_9 = 0 # sum of pre + cycle
for len_9 in range(mn):
if x in S: break
S.add(x)
A.append(x)
sum_9 += x
x = x*x % m
pre_len = A.index(x)
cyc_len = len(A) - pre_len
nxt_len = (n - pre_len) % cyc_len
cyc_num = (n - pre_len) // cyc... | Traceback (most recent call last):
File "/tmp/tmp2so60qf7/tmppu4_duaq.py", line 1, in <module>
n, x, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s289086282 | p02550 | u543000780 | 1600675398 | Python | Python (3.8.2) | py | Runtime Error | 62 | 13260 | 431 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
print(last)
"""if last >= N:
print(sum(ls_mod[:N]))
else:
shou = (N-fast) // diff
... | Traceback (most recent call last):
File "/tmp/tmpb4hn2sau/tmphnepl_bb.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s597678834 | p02550 | u543000780 | 1600674568 | Python | Python (3.8.2) | py | Runtime Error | 53 | 13332 | 419 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
if last >= N:
print(sum(ls_mod[:N]))
"""else:
shou = (N-fast) // diff
amari = (N... | Traceback (most recent call last):
File "/tmp/tmpmif25qet/tmpp6bsoddr.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s853813626 | p02550 | u543000780 | 1600674514 | Python | Python (3.8.2) | py | Runtime Error | 60 | 13700 | 413 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
if fast >= N:
print(sum(ls_mod[:N]))
else:
shou = (N-fast) // diff
amari = (N-fa... | Traceback (most recent call last):
File "/tmp/tmpniiob23t/tmpw99ngjoc.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s230260260 | p02550 | u543000780 | 1600674434 | Python | Python (3.8.2) | py | Runtime Error | 59 | 13720 | 416 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
if last - 1 > N:
print(sum(ls_mod[:N]))
else:
shou = (N-fast) // diff
amari = (N... | Traceback (most recent call last):
File "/tmp/tmppwrjiq53/tmpi4b0mi0y.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s887109070 | p02550 | u543000780 | 1600674375 | Python | Python (3.8.2) | py | Runtime Error | 59 | 13628 | 410 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
if last > N:
print(sum(ls_mod[:N]))
else:
shou = (N-fast) // diff
amari = (N-fas... | Traceback (most recent call last):
File "/tmp/tmpqe8gc7cd/tmpium7eyym.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s098193102 | p02550 | u543000780 | 1600673799 | Python | Python (3.8.2) | py | Runtime Error | 59 | 13748 | 413 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
if last >= N:
print(sum(ls_mod[:N]))
else:
shou = (N-fast) // diff
amari = (N-fa... | Traceback (most recent call last):
File "/tmp/tmpw_1bwrog/tmpaq0w9g9l.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s246428901 | p02550 | u543000780 | 1600673715 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9076 | 399 | N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
if ls[x] == False:
ls_mod.append(x)
ls[x] = m
x = (x**2)%M
else:
last = m
fast = ls[x]
diff = last - fast
break
if last >= N:
print(sum(ls_mod[:N]))
else:
shou = (N-fast) // diff
amari = (N-fa... | File "/tmp/tmp1kzu3hky/tmpjpl4794n.py", line 20
print(sum(ls_mod[:fast])+sum([fast:])*shou+sum([fast:fast+amari]))
^
SyntaxError: invalid syntax
| |
s295944102 | p02550 | u325282913 | 1600645077 | Python | PyPy3 (7.3.0) | py | Runtime Error | 294 | 75328 | 844 | N, X, M = map(int, input().split())
if X <= 1:
print(X*N)
exit()
check = [0]*(M+1)
check[X] += 1
A = X
last_count = 0
while True:
A = (A**2)%M
if check[A] != 0:
last_count = sum(check)
target_value = A
break
check[A] += 1
A2 = X
first_count = 0
while True:
first_count += ... | Traceback (most recent call last):
File "/tmp/tmpp0telcho/tmpym108jl6.py", line 1, in <module>
N, X, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.