Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
result = 1
for i in range(1,len(H)):
  if H[i] < H[i+1]:
    result += 1
  else:
    break
print(result)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
A = H[0]
result = 0
for i in range(len(H)):
  if A <= H[i]:
    result += 1
    A = H[i]
  else:
    None
print(result)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e = map(int,input().split())
if e-a <= int(input()):
    print("Yay!")
else:
    print(":(")

Fixed submission:
A = [int(input()) for i in range(5)]
if A[-1]-A[0] <= int(input()):
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
print("Yes" if N/2 < S.count(R) else "No")

Fixed submission:
N = int(input())
S = input()
print("Yes" if N/2 < S.count("R") else "No")
Buggy python submission (verdict: Runtime Error):
N,M,C = map(int,input().split())
B = list(map(input().split()))
result = 0
for i in range(N):
  C = 0
  A = list(map(input().split()))
  for j in range(M):
    C += B[j]*A[j]
  if sum(C) > 0:
    result += 1
  else:
    None
print(result)

Fixed submission:
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
result = 0
for i in range(N):
  D = 0
  A = list(map(int,input().split()))
  for j in range(M):
    D += B[j]*A[j]
  if D+C> 0:
    result += 1
  else:
    None
print(result)
Buggy python submission (verdict: Runtime Error):
a = list(map(int.input().split()))
if a[1]//a[0] == 0:
  print(0)
elif a[1]//a[0]> a[2]:
  print(a[2])
else:
  print(a[1]//a[0])

Fixed submission:
a = list(map(int,input().split()))
if a[1]//a[0] == 0:
  print(0)
elif a[1]//a[0]> a[2]:
  print(a[2])
else:
  print(a[1]//a[0])

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int.input().split())
if B//A == 0:
  print(0)
elif B//A > C:
  print(C)
else:
  print(B//A)

Fixed submission:
a = list(map(int,input().split()))
if a[1]//a[0] == 0:
  print(0)
elif a[1]//a[0]> a[2]:
  print(a[2])
else:
  print(a[1]//a[0])

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int.input().split())
if B//A < C:
  print(B//A)
else:
  print(C)

Fixed submission:
a = list(map(int,input().split()))
if a[1]//a[0] == 0:
  print(0)
elif a[1]//a[0]> a[2]:
  print(a[2])
else:
  print(a[1]//a[0])
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split(/)))
if a[1] > 4:
  print("TBD")
else:
  print("Heisei")


Fixed submission:
a = list(map(int,input().split("/")))
if a[1] > 4:
  print("TBD")
else:
  print("Heisei")
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 1:
  print("Hello World")
else:
  a,b = map(int,input().split())
  print(a*b)
  

Fixed submission:
N = int(input())
if N % 2 == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy python submission (verdict: Runtime Error):
N = int(input())
b = int(input())
c = int(input())
if N == 1:
  print("Hello World")
elif N == ":
  print(b+c)

Fixed submission:
N = int(input())
if N % 2 == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy python submission (verdict: Runtime Error):
N = int(input())
b = int(input())
c = int(input())
if N == 1:
  print("Hello World")
else:
  print(b+c)

Fixed submission:
N = int(input())
if N % 2 == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
  a,b = map(int,input().split())
  c.append(a)
  t.append(b)
result = []
for j in range(N):
  if T >= t[j]:
    result.append(c[j])
  else:
    None
print(min(result))


Fixed submission:
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
  a,b = map(int,input().split())
  c.append(a)
  t.append(b)
result = []
for j in range(N):
  if T >= t[j]:
    result.append(c[j])
  else:
    None
print(min(result) if len(result) > 0 else "TLE")

Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
  a,b = map(int,input(),split())
  c.append(a)
  t.append(b)
result = []
for j in range(N):
  if T >= t[j]:
    result.append(c[j])
  else:
    None
print(min(result))

Fixed submission:
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
  a,b = map(int,input().split())
  c.append(a)
  t.append(b)
result = []
for j in range(N):
  if T >= t[j]:
    result.append(c[j])
  else:
    None
print(min(result) if len(result) > 0 else "TLE")
Buggy python submission (verdict: Runtime Error):
import math
N,X = map(int,input().split())
A = list(map(int,input().split()))
B = [abs(X-i) for i in A]
ans = B[0]
for j in B:
    ans = math.gcd(ans, j)
print(ans)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
N,X = map(int,input().split())
A = list(map(int,input().split()))
B = [abs(X-i) for i in A]
ans = B[0]
for j in B:
    ans = gcd(ans, j)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
print((N?/2)**2 if N%2==0 else (1+N//2)*(N//2))

Fixed submission:
N = int(input())
print((N//2)**2 if N%2==0 else (1+N//2)*(N//2))
Buggy python submission (verdict: Runtime Error):
import sys
S = input()
K = int(input())
result = [0,0]
for i in len(s):
  if S[i] != 1:
    result[0] = i+1
    result[1] = S[i]
print(1 if K<result[0] else result[1] )


Fixed submission:
import sys
S = input()
K = int(input())
result = [0,""]
for i in S:
  if i != "1":
    result[1] = i
    break
  else:
    result[0] += 1
print(1 if K<=result[0] else result[1] )
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
A = [a,b,c]
A.sort()
print(a[2]-a[0])


Fixed submission:
a,b,c = map(int,input().split())
A = [a,b,c]
A.sort()
print(A[2]-A[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
result = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    result += 1
    if A[i+2]!=A[i+1] :
      A[i+1] = abs(A[i+2]-A[i+1])
    elif A[i+2]==A[i+1] and A[i+1]==1:
      A[i+1] = 2
    else:
      A[i+1] = 1
print(result)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    A[i+1] = -1
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
result = 0
for i in A:
  B = A
  while B % 2 == 0:
    result += 1
    B = B // 2
print(result)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
result = 0
for i in A:
  B = i
  while B % 2 == 0:
    result += 1
    B = B // 2
print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [i for i in str(N)]
result = 0
for j in range(len(A)):
  result += A[j]
if result == 0 and A[0] == 1:
  print(10)
else:
  print(result)

Fixed submission:
N = int(input())
A = [i for i in str(N)]
result = 0
for j in range(len(A)):
  result += int(A[j])
if result == 1 and A[0] == "1":
  print(10)
else:
  print(result)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input(),split())
if abs(a-b) <= d and abs(b-c) <= d:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c,d = map(int,input().split())
if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c) <= d:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
num = list(map(int,input().split()))
K = int(input())
A = max(num)
A.sort()
for i in range(K):
  A *= 2
print(sum(num)-num[-1]+A)

Fixed submission:
num = list(map(int,input().split()))
K = int(input())
A = max(num)
num.sort()
for i in range(K):
  A *= 2
print(sum(num)-num[-1]+A)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
ans = []
for i in range(A,A+K+1):
  if i <= B:
    ans.append(i)
for j in range(B,B-K,-1):
  if A.count(j) == 0 and j >= A:
    ans.append(j)
ans.sort()
for k in ans:
  print(k)

Fixed submission:
A,B,K = map(int,input().split())
ans = []
for i in range(A,A+K):
  if i <= B:
    ans.append(i)
#print(ans)
for j in range(B,B-K,-1):
  #print("j",j)
  if j >= A+K:
    ans.append(j)
ans.sort()
for k in ans:
  print(k)
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
if n == 1:
    if m == 1:
      print(1)
    else:
      print(m - 2)
elif m == 1:
  print(n - 2)
else: 
  print((N-2)*(M-2))


Fixed submission:
N,M = map(int, input().split())
if N == 1: print(1) if M == 1 else print(M - 2)
elif M == 1: print(N - 2)
else: print(N * M - (N + M - 2) * 2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = []
for i in range(0,N,2):
  B.append(A[i])
print(abs(A-sum(B)*2))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
B = []
for i in range(0,N,2):
  B.append(A[i])
print(abs((sum(A)-sum(B))-sum(B)))
Buggy python submission (verdict: Runtime Error):
a = input().split()
print("2018/"+a[1]+"/"+a[2])

Fixed submission:
a = input().split("/")
print("2018/"+a[1]+"/"+a[2])
Buggy python submission (verdict: Runtime Error):
import sys
S = [ord(i) for i in input()]
T = [ord(j) for j in input()]
S.sort()
T = sorted(T, reverse=True)
#print(S,T)
for k in range(len(S)):
  if S[k] > T[k]:
    print("No")
    sys.exit()
  elif S[k] < T[k]:
    print("Yes")
    sys.exit()
  else:
    None
if len(S) <= len(T):
  print("Yes")
else:
  print("No")


Fixed submission:
import sys
S = "".join(sorted(input()))
T = "".join(sorted("".join(sorted(input())), reverse=True))
print("Yes" if S < T else "No")

Buggy python submission (verdict: Runtime Error):
import sys
S = [ord(i) for i in input()]
T = [ord(j) for j in input()]
S.sort()
T.sort()
for k in range(len(S)):
  if S[k] > T[k]:
    print("No")
    sys.exit()
  elif S[k] < T[k]:
    print("Yes")
    sys.exit()
  else:
    None
if len(S) <= len(T):
  print("Yes")
else:
  print("No")


Fixed submission:
import sys
S = "".join(sorted(input()))
T = "".join(sorted("".join(sorted(input())), reverse=True))
print("Yes" if S < T else "No")

Buggy python submission (verdict: Runtime Error):
impport sys
S = [ord(i) for i in input()]
T = [ord(j) for j in input()]
S.sort()
T.sort()
for k in range(len(S)):
  if S[k] > T[k]:
    print("No")
    sys.exit()
  elif S[k] < T[k]:
    print("Yes")
    sys.exit()
  else:
    None
if len(S) <= len(T):
  print("Yes")
else:
  print("No")

Fixed submission:
import sys
S = "".join(sorted(input()))
T = "".join(sorted("".join(sorted(input())), reverse=True))
print("Yes" if S < T else "No")
Buggy python submission (verdict: Runtime Error):
N = input()
X = 0
for i in range(len(N)):
  X += int(N[i])
if N % X == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
N = input()
X = 0
for i in range(len(N)):
  X += int(N[i])
if int(N) % X == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
if len(S) >= 10:
  print("NO")
else:
  if S == "AKIHABARA":
    print("YES")
  elif S == "KIHABARA":
    print("YES")
  elif S == "AKIHBARA":
    print("YES")
  elif S == "AKIHABRA":
    print("YES")
  elif S == "AKIHABR":
    print("YES")
  elif S == "KIHBARA":
    print("YES")
  elif S == "KIHABRA":
    print("YES")
  elif S == "KIHABAR":
    print("YES")
  elif S == "AKIHBRA":
    print("YES")
  elif S == "AKIHABR":
    print("YES")
  elif S == "KIHBRA":
    print("YES")
  elif S == "KIHBAR":
    print("YES")
  elif S == "AKIHBR":
    print("YES")
  elif S == "KIHBR":
    print("YES")
  else:
  print("NO")


Fixed submission:
S=input()

pos={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"}
     
if S in pos:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
S = input()
if len(S) >= 10:
  print("NO")
else:
  if S == "AKIHABARA":
    print("YES")
  elif S == "KIHABARA":
    print("YES")
  elif S == "AKIHBARA":
    print("YES")
  elif S == "AKIHABRA":
    print("YES")
  elif S == "AKIHABR":
    print("YES")
  elif S == "KIHBARA":
    print("YES")
  elif S == "KIHABRA":
    print("YES")
  elif S == "KIHABAR":
    print("YES")
  elif S == "AKIHBRA":
    print("YES")
  elif S == "AKIHABR":
    print("YES")
  elif S == "KIHBRA":
    print("YES")
  elif S == "KIHBAR":
    print("YES")
  elif S == "AKIHBR":
    print("YES")
  elif S == "KIHBR":
    print("YES")
  else;
  print("NO")

Fixed submission:
S=input()

pos={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"}
     
if S in pos:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
result = 0
for i in range(N**0.5):
  if i**2 <= N:
    result = i
  else:
    None
print(result)

Fixed submission:
N = int(input())
result = 0
for i in range(int(N**0.5)+1):
  if i**2 <= N:
    result = i
  else:
    None
print(result**2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
M = 0
m = 10**9
c = 0
for i in range(N):
  a,b = map(int,input().split())
  if m >= a:
    m = a
  if M < a:
    M = a
    c = b + 1
ans = c+M-m
for i in range(m-1):
  ans += 1
print(ans)


Fixed submission:
N = int(input())
M = 0
m = 10**9
c = 0
for i in range(N):
  a,b = map(int,input().split())
  if m >= a:
    m = a
  if M < a:
    M = a
    c = b + 1
ans = c+M-1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = 0
m = 10**9
c = 0
for i in range(N):
  a,b = map(int.input().split())
  if m >= a:
    m = a
  if M < a:
    M = a
    c = b + 1
print(c+m-M)

Fixed submission:
N = int(input())
M = 0
m = 10**9
c = 0
for i in range(N):
  a,b = map(int,input().split())
  if m >= a:
    m = a
  if M < a:
    M = a
    c = b + 1
ans = c+M-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
B = list(set(A))
ans = 0
for i in B:
    if A.count(i) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
import sys
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans = 0
a = A[0]
n = 0
if N == 1:
    print(1)
    sys.exit()
for i in range(N):
    if a == A[i]:
        n += 1
    else:
        if n % 2 == 1:
            ans += 1
        n = 1
        a = A[i]
    #print(A[i],"1",n,n%2,ans)
if A[-1] == A[-2] and n % 2 == 1:
    ans += 1
elif A[-1] != A[-2] and n % 2 == 1:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = A[i] % 4
if A.count(2) % 2 == 0:
    if A.count(4) >= (A.count(1)+A.count(3)):
        print("Yes")
    else:
        print("No")
else:
    if A.count(4) >= (A.count(1)+A.count(3)) + 1:
    print("Yes")                         
else:                                    
    print("No")                          

Fixed submission:
N = int(input())
d4 = 0
d2 = 0
for i in list(map(int,input().split())):
    if i % 4 == 0:
        d4 += 1
    elif i % 2 == 0:
        d2 += 1
    else:
        None
if N <= d4*2 + 1:
    print("Yes")
elif N - d4 * 2 <= d2 :
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 1
a = A.index(1)+1
#print(a)
for i in range(N*2):
    a = A[a-1]
    #print(a)
    if a == 2:
        print(ans)
        sys.exit()
    ans += 1
print(-1)

Fixed submission:
import sys
N = int(input())
A ={}
for i in range(1,N+1):
    A[i] = int(input())
#print(A)
ans = 1
x = 1
for j in range(N):
    if A[x] == 2:
        print(ans)
        sys.exit()
    x = A[x]
    ans += 1
print(-1)
Buggy python submission (verdict: Runtime Error):
word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[1] and word2[-1] == word3[1]:
  print("YES")
else:
  print("NO")

Fixed submission:
word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[0] and word2[-1] == word3[0]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[1] and word1[-1] == word2[1]:
  print("YES")
else:
  print("NO")

Fixed submission:
word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[0] and word2[-1] == word3[0]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
result = 1
for i in range(1,N+1):
  result *= i
print(result%(10**9+7))

Fixed submission:
N = int(input())
result =1
for i in range(1,N+1):
  result *= i
  result %= (10**9+7)
print(result)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if abs(x) == abs(y):
  print(0 if a == b else 1)
elif x < y:
  print(min(y - x,abs(y + x) + 1))
else:
  print(min(abs(y+x),abs(y-x))+ 1 if a * b <= 0 else min(abs(y+x),abs(y-x))+ 2)


Fixed submission:
x,y = map(int,input().split())
if abs(x) == abs(y):
  print(0 if x == y else 1)
elif x < y:
  print(min(y - x,abs(y + x) + 1))
else:
  print(min(abs(y+x),abs(y-x))+ 1 if x * y <= 0 else min(abs(y+x),abs(y-x))+ 2)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
ans = abs(abs(x)-abs(y))
print(ans if X * y > 0 else ans + 1)

Fixed submission:
x,y = map(int,input().split())
if abs(x) == abs(y):
  print(0 if x == y else 1)
elif x < y:
  print(min(y - x,abs(y + x) + 1))
else:
  print(min(abs(y+x),abs(y-x))+ 1 if x * y <= 0 else min(abs(y+x),abs(y-x))+ 2)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
print(min(abs(y-x),abs(x+y)+1)

Fixed submission:
x,y = map(int,input().split())
if abs(x) == abs(y):
  print(0 if x == y else 1)
elif x < y:
  print(min(y - x,abs(y + x) + 1))
else:
  print(min(abs(y+x),abs(y-x))+ 1 if x * y <= 0 else min(abs(y+x),abs(y-x))+ 2)
Buggy python submission (verdict: Runtime Error):
A = map(int,input().split())
A.sort()
if A[0]+A[1] == A[2]:
  print("Yes")
else:
  print("No")

Fixed submission:
A = list(map(int,input().split()))
A.sort()
if A[0]+A[1] == A[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
A = set([i for i in S])
for j in range(len(A)):
  if S.count(A[j]) % 2 == 1:
    print("Yes")
    sys.exit()
  else:
    None
print("No")
   


Fixed submission:
import sys
S = input()
A = set([i for i in S])
for j in A:
  if S.count(j) % 2 == 1:
    print("No")
    sys.exit()
  else:
    None
print("Yes")
Buggy python submission (verdict: Runtime Error):
S = input()
print("No" if (s.count("N") == 0 and s.count("S") > 0)\
		or (s.count("S") == 0 and s.count("N") > 0)\
		or (s.count("W") == 0 and s.count("E") > 0)\
		or (s.count("E") == 0 and s.count("W") > 0)\
		else "Yes")


Fixed submission:
s = input()
print("No" if (s.count("N") == 0 and s.count("S") > 0)\
		   or (s.count("S") == 0 and s.count("N") > 0)\
	       or (s.count("W") == 0 and s.count("E") > 0)\
		   or (s.count("E") == 0 and s.count("W") > 0)\
		   else "Yes")

Buggy python submission (verdict: Runtime Error):
S = input()
print("No" if(s.count("N") == 0 and s.count("S") > 0)\
		or (s.count("S") == 0 and s.count("N") > 0)\
		or (s.count("W") == 0 and s.count("E") > 0)\
		or (s.count("E") == 0 and s.count("W") > 0)\
		else "Yes")


Fixed submission:
s = input()
print("No" if (s.count("N") == 0 and s.count("S") > 0)\
		   or (s.count("S") == 0 and s.count("N") > 0)\
	       or (s.count("W") == 0 and s.count("E") > 0)\
		   or (s.count("E") == 0 and s.count("W") > 0)\
		   else "Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

L = [0] * K
R = [0] * K
for i in range(0, K):
    L[i], R[i] = map(int, input().split())

moves = [0] * N
moves[0] = 1

rui_wa = [0] * N
rui_wa[0] = 1

for i in range(1, N):
    for j in range(0, K):
        l = max(i - L[j], 0)
        r = max(i - R[j], 0)
        if i - L[j] < 0:
            continue

        moves[i] += rui_wa[l] - rui_wa[r - 1]

    rui_wa[i] = moves[i] + rui_wa[i - 1]



print(moves[N - 1] % 998244353)


Fixed submission:
N, K = map(int, input().split())

L = [0] * K
R = [0] * K
for i in range(0, K):
    L[i], R[i] = map(int, input().split())

moves = [0] * N
moves[0] = 1

rui_wa = [0] * N
rui_wa[0] = 1

for i in range(1, N):
    for j in range(0, K):
        l = max(i - L[j], 0)
        r = max(i - R[j], 0)
        if i - L[j] < 0:
            continue

        moves[i] += (rui_wa[l] - rui_wa[r - 1]) % 998244353

    rui_wa[i] = (moves[i] + rui_wa[i - 1])  % 998244353



print(moves[N - 1] % 998244353)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

idou = set()
for i in range(0, K):
    L, R = map(int, input().split())
    idou = idou | set(range(L, R + 1))

idou = list(idou)

moves = [0] * N
moves[0] = 1
for i in range(0, N):
    for j in range(0, len(idou)):
        if i + idou[j] < N:
            moves[i + idou[j]] += moves[i]

print(moves[N - 1] % 998244353)


Fixed submission:
N, K = map(int, input().split())

L = [0] * K
R = [0] * K
for i in range(0, K):
    L[i], R[i] = map(int, input().split())

moves = [0] * N
moves[0] = 1

rui_wa = [0] * N
rui_wa[0] = 1

for i in range(1, N):
    for j in range(0, K):
        l = max(i - L[j], 0)
        r = max(i - R[j], 0)
        if i - L[j] < 0:
            continue

        moves[i] += (rui_wa[l] - rui_wa[r - 1]) % 998244353

    rui_wa[i] = (moves[i] + rui_wa[i - 1])  % 998244353



print(moves[N - 1] % 998244353)
Buggy python submission (verdict: Runtime Error):
N = int(input())

MOD_CONST = 10 ** 9 + 7

res = [1] * N
res[0] = res[1] = 0

for i in range(5, N):
    res[i] = res[i - 4] + res[i - 3] + res[i - 2]

print(res[N-1] % MOD_CONST)

Fixed submission:
N = int(input())

MOD_CONST = 10 ** 9 + 7

if N <= 2:
    print(0)
    exit()

res = [1] * N
res[0] = res[1] = 0

for i in range(5, N):
    res[i] = res[i - 4] + res[i - 3] + res[i - 2]

print(res[N-1] % MOD_CONST)