Problem:


Score : 200 points

Problem Statement

It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.

You are given an integer N. Find the N-th Lucas number.

Here, the i-th Lucas number L_i is defined as follows:

L_0=2

L_1=1

L_i=L_{i-1}+L_{i-2} (i≥2)

Constraints

1≤N≤86

It is guaranteed that the answer is less than 10^{18}.

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the N-th Lucas number.

Sample Input 1

5

Sample Output 1

11

L_0=2

L_1=1

L_2=L_0+L_1=3

L_3=L_1+L_2=4

L_4=L_2+L_3=7

L_5=L_3+L_4=11

Thus, the 5-th Lucas number is 11.

Sample Input 2

86

Sample Output 2

939587134549734843



Sample input:
5


Sample output:
11

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
def lucas(n):
	if n==0:
		return 2
	if n==1:
		return 1
	if n>1:
		return lucas(n-1)+lucas(n-2)
print(lucas(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def ryuka(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return ryuka(n-1) + ryuka(n-2)

print(ryuka(N))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


def lyuca(x):
    if x == 0:
        return 2
    elif x == 1:
        return 1

    return lyuca(x-1) + lyuca(x-2)


print(lyuca(N))

Submission status: Time Limit Exceeded

Solution code:
def lucas(n):
     if n == 0:
         return 2
     elif n == 1:
         return 1
     else:
         return lucas(n-1)+lucas(n-2)
n = int(input().strip())
print(lucas(n))

Submission status: Time Limit Exceeded

Solution code:
def luca(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return luca(n-1) + luca(n-2)

n = int(input())

print(luca(n))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def lucas(s):
    if s == 0:
        return 2
    elif s == 1:
        return 1
    else:
        return lucas(s-1) + lucas(s-2)

print(lucas(n))

Submission status: Time Limit Exceeded

Solution code:
def a(n):
    return 2 if(n == 0)else 1 if(n == 1)else a(n - 1) + a(n - 2)

N = input()
print a(N)

Submission status: Time Limit Exceeded

Solution code:
#-*- coding:utf-8 -*-
N = int(input())

def lucas(M):
    if M > 1:
        return lucas(M-1)+lucas(M-2)
    elif M == 1:
        return 1
    elif M == 0:
        return 2 

print(lucas(N))

Submission status: Time Limit Exceeded

Solution code:
# N < 90なのでテーブルにする必要ある？
def L(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        return L(i- 1) + L(i-2)

s = int(input())
print(L(s))

Submission status: Time Limit Exceeded

Solution code:
#整数Nを入力
x = input()
N = int(x)

#N番目のリュカ数を返す関数を定義
def lucas(N):
  if N == 0:
    return 2
  elif N == 1:
    return 1
  return lucas(N-1) + lucas(N-2)

#N番目のリュカ数を出力
if 1<=N<=86:
    LN = lucas(N)
    print(LN)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
res = [0 for i in range(1000)]
def lucas(N):
	if N == 0:
		return 2
	elif N == 1:
		return 1
	elif res[N] != 0:
		return res[N]
	return lucas(N-1) + lucas(N-2)

print(lucas(N))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
res = [0 for i in range(100000)]
def lucas(N):
	if N == 0:
		return 2
	elif N == 1:
		return 1
	elif res[N] != 0:
		return res[N]
	return lucas(N-1) + lucas(N-2)

print(lucas(N))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
def li(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return li(n-1)+li(n-2)
print(li(N))

Submission status: Time Limit Exceeded

Solution code:
def getLunum(n):
    if(n==0):
        return 2
    elif(n==1):
        return 1
    else:
        return getLunum(n-1)+getLunum(n-2)
a=int(input())
print(getLunum(a))

Submission status: Time Limit Exceeded

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    
    print (lucas(N))

def lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    else:
        return (lucas(n-1) + lucas(n-2))

if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


def lukas(n):
	if n == 1:
		return 2
	if n == 2:
		return 1
	else:
		return lukas(n-1) + lukas(n-2)
		
print(lukas(N+1))

Submission status: Time Limit Exceeded

Solution code:


def ryuka(n):
    if n > 2:
        return ryuka(n - 1) + ryuka(n - 2)
    elif n == 2:
        return 1
    elif n == 1:
        return 2

n = int(input()) +1
print(ryuka(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def ryuka(N):
    if N == 1:
        return 1
    elif N == 0:
        return 2
    return ryuka(N-1) + ryuka(N-2)
print(ryuka(N))

Submission status: Time Limit Exceeded

Solution code:
def lucas(a):
  if a == 0:
    return 2
  if a == 1:
    return 1
  return lucas(a-1)+lucas(a-2)

a = int(input())
b = lucas(a)
print(b)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

def function(N):
    if N == 0:
        return(2)
    elif N == 1:
        return(1)
    else:
        return(function(N-1)+function(N-2))

if __name__ == '__main__':
    N = input()
    print(function(N))

Submission status: Time Limit Exceeded

Solution code:
def luca(N):
    if N == 0:
        return 2
    elif N == 1:
        return 1
    else:
        return luca(N-1) + luca(N-2)

a = int(input())
print(luca(a))

Submission status: Time Limit Exceeded

Solution code:
def luca(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return luca(n-1) + luca(n-2)

print(luca(int(input())))

Submission status: Memory Limit Exceeded

Solution code:
A = []
A.append(2)
A.append(1)
n = int(input())
for i in range(2,100000):
    A.append(A[i-1] + A[i-2])
print(A[n])

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(1)
    exit()
x = 2
y = 1
ans = 0
for i in range(n-1):
    ans = x + y
    x = y
    y = ans
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    dp = [0] * 100

    dp[0] = 2
    dp[1] = 1

    for i in range(2, n+1):
        dp[i] = dp[i-1] + dp[i-2]

    print(dp[n])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

L = [0] * 87
L[0] = 2
L[1] = 1

def cal(N: int):
    n = L[N]
    if n != 0:
        return n
    L[N] = cal(N-1)+ cal(N-2)
    return L[N]

def solve(N: int):
    print(cal(N))

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n = int(input())

if n == 1:
    print(1)
    exit()

a = 2
b = 1
now = 3
count = 2
for i in range(2, n):
    a = b
    b = now
    now = a+b

print(now)

Submission status: Accepted

Solution code:
n = int(input())
lucas = [2,1]
for i in range(2,n+1):
    lucas.append(lucas[-2]+lucas[-1])
print(lucas[-1])

Submission status: Accepted

Solution code:
def answer(n: int) -> int:
    if n == 1:
        return 1

    two_previous_l = 2
    previous_l = 1
    l = 3
    for _ in range(n - 2):
        two_previous_l = previous_l
        previous_l = l
        l = previous_l + two_previous_l

    return l


def main():
    n = int(input())
    print(answer(n))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
l = [2,1]
if n == 0:
  print(2)
elif n == 1:
  print(1)
else:
  for i in range(n-1):
    l.append(l[-1]+l[-2])
  print(l[-1])

Submission status: Accepted

Solution code:
n = int(input())
l =[2,1]
for i in range(2,n+1):
    l.append(l[i-1]+l[i-2])
print(l[n])

Submission status: Accepted

Solution code:
n=int(input())
lst=[2,1]
for i in range(86):
    lst.append(lst[i]+lst[i+1])
print(lst[n])

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1]
if N < 2:
    print(L[N])
else:
    for i in range(2, N+1):
        L.append(L[i-2]+L[i-1])
    print(L[-1])

Submission status: Accepted

Solution code:
n=int(input())
lucas=[2,1]
for i in range(2,n+1):
    lucas.append(lucas[i-1]+lucas[i-2])
print(lucas[-1])

Submission status: Accepted

Solution code:
N = int(input())
L = [0] * (N+1)
L[0] = 2
L[1] = 1
for i in range(2,N+1):
  L[i] = L[i-1] + L[i-2]
print(L[N])

Submission status: Accepted

Solution code:
n=int(input())

dp=[0]*(n+1)
dp[0]=2
dp[1]=1
for i in range(2,n+1):
  dp[i]=dp[i-1]+dp[i-2]
print(dp[n])

Submission status: Accepted

Solution code:
import sys
N = int(input())
if(N==1):
  print(1)
  sys.exit()
ans = 0
L0 = 2
L1 = 1
for i in range(N-1):
  ans = L0 + L1
  L0 = L1
  L1 = ans
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a, b = 2, 1
for i in range(n):
    a, b = b, a+b
print(a)

Submission status: Accepted

Solution code:
n=int(input())
s=[]
s.append(2)
s.append(1)
if n==1:
    print('1')
    exit()
else:
    for i in range(2,87):
        k = s[i-2]+s[i-1]
        s.append(k)
        if i==n:
            print(s[i])
            exit()

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1]

if N <= 1:
   print(L[N])
   exit()
else:
   for i in range(N-1):
      L.append(L[-1] + L[-2])

print(L[-1])

Submission status: Accepted

Solution code:
n = int(input())
l0 = 2
l1 = 1
sum_ = 1
for i in range(n-1):
    sum_ = l0 + l1
    l0 = l1
    l1 = sum_
print(sum_)

Submission status: Accepted

Solution code:
n = int(input())
data = [0]*87
data[0] = 2
data[1] = 1
if n >= 2:
    for i in range(2,n+1):
        data[i] =data[i-1] + data[i-2]
print(data[n])

Submission status: Accepted

Solution code:
lst = list()
lst.append(2)
lst.append(1)

n = int(input())
for i in range(2, n + 1):
    ans = lst[i - 2] + lst[i - 1]
    lst.append(ans)

print(lst[n])

Submission status: Accepted

Solution code:
n = int(input())
calc_r = [0]*(n+1)
calc_r[0] = 2
calc_r[1] = 1

for i in range(2,n+1):
    calc_r[i] = calc_r[i-1] + calc_r[i-2]
ans = calc_r[n]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [0] * 100
L[0] = 2
L[1] = 1
for i in range(2,N + 1):
  L[i] = L[i - 1] + L[i - 2]
print(L[N])

Submission status: Accepted

Solution code:
n=int(input())
ans=[2,1]
if n in [0,1]:
  print(ans[n])
  quit()
for i in range(2,n+1):
  ans.append(ans[i-2]+ans[i-1])
print(ans[-1])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]

for i in range(2, n + 1):
        li = l[i - 1] + l[i - 2]
        l.append(li)
print(l[len(l) - 1])

Submission status: Accepted

Solution code:
n = int(input())

a = [2,1]

for x in range(n-1):
  a.append(a[x] + a[x+1])
  
print(a[-1])

Submission status: Accepted

Solution code:
N = int(input())
l_list = [2,1]
for i in range(2,N+1):
    a = l_list[i-1] + l_list[i-2]
    l_list.append(a)
print(l_list[N])

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[2,1]
    number = int(input())

    for i in range(2,number+1):
        numbers.append(numbers[i-1]+numbers[i-2])
    print(numbers[-1])
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
from functools import lru_cache

@lru_cache
def lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    else:
        return lucas(n-1)+lucas(n-2)

N = int(input())
print(lucas(N))

Submission status: Accepted

Solution code:
n = int(input())
s = [2, 1]
for i in range(n - 1):
    s.append(s[-1] + s[-2])
print(s[-1])

Submission status: Accepted

Solution code:
n = int(input())
import sys
dp = [0]*(n+3)

dp[0]=2
dp[1]=1
if n<=1:
    print(dp[n])
    sys.exit()

for i in range(2,n+1):
    dp[i]=dp[i-1]+dp[i-2]

print(dp[n])

Submission status: Accepted

Solution code:
n = int(input())
l = [0] * (n+1)
l[0] = 2
l[1] = 1

if n == 1:
    ans = l[1]
else:
    for i in range(2, n+1):
        l[i] = l[i-1] + l[i-2]
    ans = l[-1]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l1 = 2
l2 = 1
l = 1
for i in range(n-1):
    l = l1+l2
    l1, l2 = l2, l
print(l)

Submission status: Accepted

Solution code:
n = int(input())

arr = [0 for i in range(n+1)]
arr[0] = 2
arr[1] = 1
for i in range(2,n+1):
    arr[i] = arr[i-1] + arr[i-2]
print(arr[n])

Submission status: Accepted

Solution code:
N=int(input())
L=[2,1]
for _ in range(N-1):
    L.append(L[-1]+L[-2])
print(L[-1])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]

for i in range(85):
  l.append(l[-2]+l[-1])

print(l[n])

Submission status: Accepted

Solution code:
N = int(input())

if N == 0:
  print(2)
elif N == 1:
  print(1)
else:
  
  n_2 = 2
  n_1 = 1
  
  for _ in range(N-1):
    n_0 = n_1 + n_2
    n_2 = n_1
    n_1 = n_0
    
  
  print(n_0)

Submission status: Accepted

Solution code:
#79B
N=int(input())
data=[2]
data.append(1)
for i in range(2,N+1):
    data.append(data[i-1]+data[i-2])
    
print(data[N])

Submission status: Accepted

Solution code:
N = int(input())
ANS = [2, 1]
for i in range(1, N):
    ANS.append(ANS[i]+ANS[i-1])
print(ANS[N])

Submission status: Accepted

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
L=[2,1]
for i in range(N-1):
    L.append(L[i]+L[i+1])

print(L[N])

Submission status: Accepted

Solution code:
n = int(input())

lucas = [2, 1]
for i in range(2, n+1):
    lucas.append(lucas[i-1] + lucas[i-2])

print(lucas[-1])

Submission status: Accepted

Solution code:
N = int(input())
ls = [0] * (N + 1)

ls[0], ls[1] = 2, 1

for i in range(2,N+1):
  ls[i] += ls[i-1] + ls[i-2]
  
print(ls[N])

Submission status: Accepted

Solution code:
N = int(input())
if N == 1:
  print(1)
else:
  L0 = 2
  L1 = 1
  for i in range(1, N):
    Ln = L0 + L1
    L0 = L1
    L1 = Ln
  print(L1)

Submission status: Accepted

Solution code:
a=int(input())
L=[2,1]
for i in range(a-1):
    L.append(L[i]+L[i+1])
print(L[a])

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
  print(1)
  exit(0)

L1 = 1
L0 = 2

for i in range(2,N+1):
  LC = L1 + L0
  L0 = L1
  L1 = LC
  
print(LC)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

dp = [0] * (n + 1)
dp[0] = 2
dp[1] = 1

def l(n):
    if dp[n] != 0:
        return dp[n]
    else:
        dp[n] = l(n-1) + l(n-2)
        return dp[n]

print(l(n))

Submission status: Accepted

Solution code:
n=int(input())
a=2
b=1
i=0
while i<n:
  d=a
  a=b
  b=d+b
  i=i+1
print(a)

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(1)
else:
    x = [2, 1]
    for i in range(2, n+1):
        x.append(x[i-2] + x[i-1])
    print(x[n])

Submission status: Accepted

Solution code:

n = int(input())
a_ = 2
a = 1
for i in range(n-1):
    a, a_ = a + a_, a
print(a)

Submission status: Accepted

Solution code:
N = int(input())
a,b = 2,1
for i in range(N):
  a,b = b,(a+b)
print(a)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    lucas_list = [2, 1]

    for i in range(2, n + 1):
        lucas_list.append(lucas_list[i - 1] + lucas_list[i - 2])

    print(lucas_list[-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = 2
b = 1
for i in range(n-1):
    c=b+a
    a,b=b,c
if n == 0:
    print(a)
elif n == 1:
    print(b)
else:
    print(c)

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1]

for i in range(N-1):
    if i == 0:
        L.append(L[0] + L[1])
    else:
        L.append(L[i] + L[i+1])

print(L[-1])

Submission status: Accepted

Solution code:

N = int(input())
L = [2, 1]
if N == 1:
    print(1)
    exit()

for i in range(2, N+1):
    L[i % 2] = sum(L)
print(L[N % 2])

Submission status: Accepted

Solution code:
n=int(input())
def fibonacci(n):
    fib = [2, 1]
    for i in range(2, n):
        fib.append(fib[i - 2] + fib[i - 1])
        
    return fib[n -1]
print(fibonacci(n+1))

Submission status: Accepted

Solution code:
n = int(input())

a = [0] * (n + 1)
a[0] = 2
a[1] = 1
for i in range(2, n + 1):
    a[i] = a[i - 1] + a[i - 2]

print(a[n])

Submission status: Accepted

Solution code:
N = int(input())
l = [2, 1]
for i in range(2, N+1):
    l0, l1 = l
    l[0] = l1
    l[1] = l1+l0
print(l[1])

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    res = [2, 1]

    for i in range(100):
        cur = res[i] + res[i + 1]
        res.append(cur)

    print(res[N])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]
for _ in range(n - 1):
    l.append(l[-2] + l[-1])
print(l[-1])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]
for i in range(2, n+1):
    l.append(l[i-1] + l[i-2])
print(l[-1])

Submission status: Accepted

Solution code:
N = int(input())
l1 = 2
l2 = 1

for i in range(N-1):
  l1, l2 = l2, l1 + l2
print(l2)

Submission status: Accepted

Solution code:
n = int(input())

num_list = [0]*(n+1)
num_list[0] = 2
num_list[1] = 1
for i in range(2, n+1,1):
  num_list[i] = num_list[i-1] + num_list[i-2]

ans = num_list[n]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lyca = [2,1]
for i in range(2,87):
    lyca.append(lyca[i-1]+lyca[i-2])
print(lyca[n])

Submission status: Accepted

Solution code:

N = int(input())
L = [2, 1] + [0] * (N-1)
for i in range(2, N+1):
    L[i] = L[i-1] + L[i-2]

print(L[N])

Submission status: Accepted

Solution code:
n=int(input())
def ryuka(x):
  return l[x-1]+l[x-2]

l=[2]+[1]+[0]*(n-1)
for i in range(2,n+1):
  l[i]=ryuka(i)
print(l[n])

Submission status: Accepted

Solution code:
n = int(input())
if n == 0:
  print(2)
elif n == 1:
  print(1)
else:
  a = 2
  b = 1
  for i in range(2, n + 1):
    c = b
    b += a
    a = c
  print(b)

Submission status: Accepted

Solution code:
n=int(input())

if n==1:
  print(1)
elif n==2:
  print(3)
else:
  ans=0
  num_1=2
  num_2=1
  for i in range(n-1):
    ans = num_1+num_2
    num_1,num_2 = num_2, ans
  print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[0 for i in range(n+1)]
l[0]=2
l[1]=1
for j in range(2,n+1):
  l[j]=l[j-1]+l[j-2]
print(l[n])

Submission status: Accepted

Solution code:
N = int(input())


def luca(n):
    a = 1
    b = 2
    for i in range(n):
        a, b = a+b, a
    return b


print(luca(N))

Submission status: Accepted

Solution code:
if __name__ == '__main__':

    n = int(input())

    A = [2,1]
    for i in range(2,n+1):
        A.append(A[i-2] + A[i-1])
    print(A[n])

Submission status: Accepted

Solution code:
n = int(input())
luca = [0 for i in range(n+1)]
luca[0] = 2
luca[1] = 1
for j in range(2,n+1):
  luca[j] = luca[j-1] + luca[j-2]
print(luca[n])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]
for i in range(2, 90):
    x = l[i-2] + l[i-1]
    l.append(x)

print(l[n])

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    L0 = 2
    L1 = 1
    if N == 1:
        print(L1)
        exit()
    Li2 = L0
    Li1 = L1
    Li = Li1 + Li2
    for _ in range(N - 2):
        Li2 = Li1
        Li1 = Li
        Li = Li1 + Li2
    print(Li)

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a = 2
b = 1
for i in range(int(input())):
  a, b = b, a + b
print(a)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()

    lucas = [0] * (N + 1)
    lucas[0] = 2
    lucas[1] = 1
    for i in range(N - 1):
        lucas[i+2] = lucas[i] + lucas[i+1]

    print(lucas[-1])

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
l = np.zeros(87,dtype=int)
l[0] = 2
l[1] = 1
for i in range(2,87):
    l[i] = l[i-1] + l[i-2]
print(l[n])

Submission status: Accepted

Solution code:
n = int(input())
a = 2
b = 1
c = 3
for i in range(n):
    c = b + a
    a = b
    b = c
print(a)

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    N = int(input())

    memo = [0 for _ in range(N+1)]
    memo[:2] = [2, 1]

    for i in range(2, N+1):
        memo[i] = memo[i-1] + memo[i-2]

    print(memo[N])

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from functools import lru_cache
N = int(input())
@lru_cache(86)
def lucas(x):
  if x == 0:
    return 2
  if  x ==1:
    return 1
  else:
  
    return lucas(x-1) + lucas(x-2)
print(lucas(N))

Submission status: Accepted

Solution code:
N = int(input())
L = [0] * (N+1)
L[0] = 2
L[1] = 1
for i in range(2,N+1):
    L[i] = L[i-1] + L[i-2]
print(L[N])

Submission status: Accepted

Solution code:
n= int(input())
a,b,c = 2,1,3
for i in range(n):
  a,b,c=b,c,b+c
print(a)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

seen = {}


def luka(n):
    if n == 0:
        return 2
    if n == 1:
        return 1

    if n in seen.keys():
        return seen[n]
    else:
        seen[n] = luka(n-1) + luka(n-2)
        return seen[n]


N = int(input())
print(luka(N))

Submission status: Accepted

Solution code:
n = int(input())
a,b = 2,1
for i in range(n):
    a,b=b,a+b
print(a)

Submission status: Accepted

Solution code:
n = int(input())
luk = [2,1]
for i in range(2,n+1):
    luk.append(luk[i-1]+luk[i-2])
print(luk[-1])

Submission status: Accepted

Solution code:
N = int(input())
dp = [[]for i in range(87)] 
dp[0] = 2
dp[1] = 1

for i in range(2,87):
    dp[i] = dp[i-1]+dp[i-2]
    if i == N:
        print(dp[i])
        break
else:
    print(dp[N])

Submission status: Accepted

Solution code:
N=int(input())
L=[0]*(N+1)
L[0]=2
L[1]=1
if N==1 :
  print(1)
else :
  for i in range(2,N+1) :
    L[i]=L[i-1]+L[i-2]
  print(L[N])

Submission status: Accepted

Solution code:
N=int(input())
if N == 1:
    print(1)
    exit()

l0=2
l1=1
for i in range(2,N+1):
    L = l1 + l0
    l0 = l1
    l1 = L

print(L)

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]
for i in range(n-1):
    L = l[i] + l[i+1]
    l.append(L)
print(l[n])

Submission status: Accepted

Solution code:
n = int(input())
l = [2,1]

for i in range(2,n+1):
    l.append(l[i-2]+l[i-1])

print(l[n])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    L = [2, 1]
    for i in range(1, N):
        L.append(L[i-1]+L[i])
    print(L[-1])
main()

Submission status: Accepted

Solution code:
N=int(input())
s=2
t=1
for i in range(0,N):
    u=s+t
    s,t,u=t,u,s # sの変換をtにした。
    
print(s)

Submission status: Accepted

Solution code:
x,y=2,1
n=int(input())
if(n==1):
    print(1)
elif(n==0):
    print(0)
else:
    for i in range(n-1):
        z=x+y
        x=y
        y=z
    print(z)

Submission status: Accepted

Solution code:
N = int(input())

if N == 0:
    print(2)
    exit()
elif N == 1:
    print(1)
    exit()

L_2 = 2
L_1 = 1
for i in range(N-1):
    L = L_1+L_2
    L_2 = L_1
    L_1 = L
print(L)

Submission status: Accepted

Solution code:
N=int(input())
L=[2,1]
for i in range(N):
    L.append(L[len(L)-1]+L[len(L)-2])
print(L[len(L)-2])

Submission status: Accepted

Solution code:
N = int(input())
MAX = 86
L = [0]*(MAX+1)
L[0] = 2
L[1] = 1
for i in range(2, MAX+1):
    L[i] = L[i-1] + L[i-2]
print(L[N])

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

data = [0 for i in range(100)]

data[0] = 2
data[1] = 1


if n == 1:
    print(1)
else:
    for i in range(2,n+1):
        data[i] = data[i-1] + data[i-2]

    print(data[n])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]

for i in range(n-1):
    l.append(l[i]+l[i+1])

print(l[n])

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
l = [2, 1]

for i in range(n-1):
    l.append(l[i]+l[i+1])

print(l[n])

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1]
for i in range(2, N+1):
    L.append(L[i-2] + L[i-1])

print(L[-1])

Submission status: Accepted

Solution code:
n = int(input())

L0, L1 = 2, 1
if n == 1:
    print(L1)
else:
    for _ in range(n - 1):
        L = L0 + L1
        L0, L1 = L1, L
    print(L)

Submission status: Accepted

Solution code:
N = int (input ())
L1,L2 = 2,1
L3 = 1
x = 1
for i in range (N-1):
  if x == 1:
    L1 = L1+L2
    L3 = L1
    x = 2
  else:
    L2 = L1+L2
    L3 = L2
    x = 1
print (L3)

Submission status: Accepted

Solution code:
N = int(input())
l = [2,1]
if N  == 1 :
    print(l[1])
    exit()
for i in range(2,N+1) :
    l.append(l[i-2] + l[i-1])
print(l[-1])

Submission status: Accepted

Solution code:
N=int(input())
L=[0 for i in range(N+1)]
L[0]=2
L[1]=1

for i in range(2,N+1):
    L[i]+=L[i-1]+L[i-2]
print(L[N])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]
for i in range(n-1):
    l.append(0)

if n >= 2:
    for i in range(2, n+1):
        l[i] = l[i-1] + l[i-2]
print(l[n])

Submission status: Accepted

Solution code:
N = int(input())
L =[0]*(N+1)
L[0]=2
L[1]=1

for i in range(2,N+1):
    L[i]=L[i-1]+L[i-2]
    
print(L[N])

Submission status: Accepted

Solution code:
r = [0]*100
r[0] = 2
r[1] = 1
for i in range(2,90):
    r[i] =r[i-2] + r[i-1]
    
n = int(input())
print(r[n])

Submission status: Accepted

Solution code:
n = int(input())
L = [2, 1]
for i in range(1, n):
    L.append(L[i-1]+L[i])
print(L[-1])

Submission status: Accepted

Solution code:
n = int(input())

l0 = 2
l1 = 1
l2 = 3
if n == 1:
    print(l1)
else:
    for i in range(n-1):
        l2 = l0 + l1
        l0, l1 = l1, l2
    print(l2)

Submission status: Accepted

Solution code:
N = int(input())
l2 = 2
l1 = 1
if N == 1:
  ans = 1
else:
  for i in range(N-1):
    l = l2 + l1
    l2 = l1
    l1 = l
  ans = l
print(ans)

Submission status: Accepted

Solution code:
import copy

n = int(input())
if n == 1:
    print(1)
    exit()

l_2 = 0
l_1 = 2
l_0 = 1
for i in range(2, n+1):
    l_2 = copy.deepcopy(l_1)
    l_1 = copy.deepcopy(l_0)
    l_0 = l_1 + l_2
print(l_0)

Submission status: Accepted

Solution code:
a,b=2,1
for _ in range(int(input())-1): a,b=b,a+b
print(b)

Submission status: Accepted

Solution code:
def check(num,memo={}):
  if num==0:
    return 2
  elif num == 1:
    return 1
  elif num in memo:
    return memo[num]
  else:
    memo[num] = check(num-1,memo) + check(num-2,memo)
    return memo[num]

print(check(int(input())))

Submission status: Accepted

Solution code:
N = int(input())
a, b = 2, 1

for i in range(N-1):
  a, b = b, a+b
print(b)

Submission status: Accepted

Solution code:
n = int(input())

lis = [2, 1]

while len(lis) <= n:
    lis.append(lis[-1] + lis[-2])

print(lis[-1])

Submission status: Accepted

Solution code:
N=int(input())
L=[]
for i in range(N+1):
  if i==0:
    L.append(2)
  elif i==1:
    L.append(1)
  else:
    L.append(L[i-1]+L[i-2])
print(L[N])

Submission status: Accepted

Solution code:
n = int(input())
x = 2
y = 1

for i in range(n):
  if i % 2 == 0:
    x = x + y
  else:
    y = x + y

if n % 2 == 0:
  print(x)
else:
  print(y)

Submission status: Accepted

Solution code:
n = int(input())

l = [2, 1]
for i in range(2, n + 1):
    li = l[i - 1] + l[i -2]
    l.append(li)
print(l[-1])

Submission status: Accepted

Solution code:
n = int(input())

lucas = [2, 1]
for _ in range(n - 1):
    lucas.append(sum(lucas[-2:]))
else:
    print(lucas[-1])

Submission status: Accepted

Solution code:

def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    # s = input().rstrip()

    n = int(input().rstrip())

    if n == 1:
        print(1)
        return

    prev = 2
    ln = 1

    for i in range(2, n+1):
        tmp = prev + ln
        prev = ln
        ln = tmp

    print(ln)





if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

L = [0 for i in range(N+1)]

if N == 1:
  print(1)

else:
  L[0] = 2
  L[1] = 1

  for n in range(2,N+1):
    L[n] = L[n-1] + L[n-2]
    
  print(L[N])

Submission status: Accepted

Solution code:
n = int(input())

L = [2, 1]
for i in range(2, n + 1):
    L.append(L[i - 1] + L[i - 2])
print(L[-1])

Submission status: Accepted

Solution code:
N = int(input())

lucas = [2,1]
for i in range(2,N+1):
    lucas_num = lucas[i-1] + lucas [i-2]
    lucas.append(lucas_num)
print(lucas[-1])

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*87
l[0]+=2
l[1]+=1
if n==1:
  print(1)
else:
  for i in range(2,n+1):
    l[i]=l[i-1]+l[i-2]
  print(l[n])

Submission status: Accepted

Solution code:
n = int(input())
l = [2, 1]
if n == 1:
    print(1)
else:
    for i in range(n):
        l.append(l[i+1]+l[i])
    print(l[n])

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
  print(1)
  exit()

for i in range(N+1):
    if i == 0:
        L_0 = 2
    elif i == 1:
        L_1 = 1
    else:
        L_2 = L_0 + L_1
        L_0 = L_1
        L_1 = L_2
        
print(L_2)

Submission status: Accepted

Solution code:
N=int(input())
k={}
def y(p):
  if p in k.keys():
    return k[p]
  if p == 0:
    return 2
  elif p == 1:
    return 1
  else:
    k[p] = y(p-2)+y(p-1)
    return k[p]
print(y(N))

Submission status: Accepted

Solution code:
n = int(input())
a = 2
b = 1
if n == 1:
    print(1)
else:
    for i in range(2,n+1):
        ans = a + b
        a = b
        b = ans
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
L = [2, 1]
for _ in range(n-1):
    L.append(sum(L[-2:]))
print(L[-1])

Submission status: Accepted

Solution code:
n = int(input())
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    l1 = 2
    l2 = 1
    l3 = 0
    for i in range(n-1):
        l3 = l1
        l1 = l2
        l2 += l3
    print(l2)