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: Accepted

Solution code:
memo = [int(0) for i in range(87)]
def l(n):
    global memo
    if memo[n]>0:
        return memo[n]
    if n == 0:
        memo[0]=2
        return 2
    elif n == 1:
        memo[1]=1
        return 1
    else:
        memo[n] = l(n-1)+l(n-2)
        return memo[n]
n = int(input())
print(l(n))

Submission status: Accepted

Solution code:
n=int(input())
L0,L1=2,1
for i in range(n-1):
    L0,L1=L1,(L0+L1)
print(L1)

Submission status: Accepted

Solution code:
n = int(input())

def luc(x):
    x1 = 2
    x2 = 1
    if x == 1:
        return x1
    elif x == 2:
        return x2
    else:
        for i in range(x-2):
            x1,x2 = x2, x1 + x2
        return x2

print(luc(n+1))

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
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())
lucas=[2,1]

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

print(lucas[N])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = int(input())
l = [0]*(88)
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())
L = [2, 1]
for i in range(N):
    L.append(L[-2] + L[-1])
print(L[N])

Submission status: Accepted

Solution code:
N = int(input())

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

print(lucas[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1]

for c in range(85):
    Lc = L[-1] + L[-2]
    L.append(Lc)

print(L[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


n = int(input())

if (n == 1):
    print(1)
else:
    l1 = 2
    l2 = 1
    ans = 0
    for i in range(n-1):
        ans = l2 + l1
        l1 = l2
        l2 = ans
    print(ans)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
 
L = [2, 1]
 
if N == 1:
  print(1)
else:
  i = 1
  while i < N:
    L.append(L[i] + L[i-1])
    i += 1
  print(L[-1])

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())


n = inint()

ryuka = [2,1]

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

print(ryuka[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[N])

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[-2]+L[-1])
print(L[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

a,b = 2,1

for _ in range(N):
    a,b = b, a+b

print(a)

Submission status: Accepted

Solution code:
import collections
n,q = int(raw_input()) + 1, collections.deque()
while(n):
	q.append(sum(list(q)) if len(q) == 2 else (2  - len(q)))
	if len(q) == 3: 
		q.popleft()

	n -=1
print q[-1]

Submission status: Accepted

Solution code:
ryuka = [0]*87

ryuka[0]=2
ryuka[1]=1
for i in range(2,87,1):
    ryuka[i]=ryuka[i-1]+ryuka[i-2]

N = int(input())

print(ryuka[N])

Submission status: Accepted

Solution code:
N=int(input())
l=[2,1]
for i in range(2,N+1):
  k=l[i-2]+l[i-1]
  l.append(k)
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:
n=int(input())
l=[2,1]
for i in range(100):
    l.append(l[i]+l[i+1])
    
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 - 2] + dp[i - 1]
    
print(dp[N])

Submission status: Accepted

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

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())
l = 2
l2 = 1

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

for i in range(N - 1):
    if i % 2 == 0:
        l = l + l2
    else:
        l2 = l + l2
    
if i % 2 == 1:
    print(l2)
else:
    print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(input())

lucas = [2, 1]

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

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

ans = lucas[N]
print(ans)

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    vec = [0] * (N + 1)
    vec[0] = 2
    vec[1] = 1

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

    print(vec[N])
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
if n==0:
    print(2)
    exit()
elif n==1:
    print(1)
    exit()
else:
    nu1=2
    nu2=1
    for i in range(n-1):
        nu3=nu1+nu2
        nu1=nu2
        nu2=nu3
print(nu3)

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())

now = 1
last = 2

for i in range(N):
	now, last = last + now, now
	
print(last)

Submission status: Accepted

Solution code:
N=int(input())
a=2
b=1
for x in range(N-1):
  c=b
  b=a+b
  a=c
print(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

print(ans[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
r = [2,1]

for _ in range(N-1):
    r.append(r[-1]+r[-2])
    
print(r[-1])

Submission status: Accepted

Solution code:
def LucasNumber(N):
    if N==0:
        return 2
    elif N==1:
        return 1
    else:
        Li2 = 2
        Li1 = 1
        for T in range(2,N+1):
            Li0 = Li1+Li2
            Li2 = Li1
            Li1 = Li0
        return Li0
      
print(LucasNumber(int(input())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC079 B - Lucas Number

n = int(input())
a=[2,1]
a_tes = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = [2,1]
for i in range(N):
  x = L[i+1] + L[i]
  L.append(x)
print(L[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())
f=[2,1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
L = [0] * 87
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:
def resolve():
    N = int(input())
    lic = [2, 1]
    for i in range(85):
        lic.append(lic[-1]+lic[-2])
    print(lic[N])
resolve()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().strip()


def main():
    n = int(input())
    pre = 2
    now = 1
    for _ in range(n):
        pre, now = now, now + pre
    print(pre)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(L[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
memo = {0:2, 1:1}

n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

from collections import defaultdict
d = defaultdict(lambda: -1)		#初期値を「-1」にする

d[0] = 2
d[1] = 1
def f(n):
  if d[n] == -1:
    a = f(n-1) + f(n-2)
    d[n] = a
  return d[n]

print(f(N))

Submission status: Accepted

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

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:
N = int(input())
if N == 1:
    print(1)
    exit()
a = 2
b = 1
for i in range(1,N):
    a,b = b,a+b
print(b)

Submission status: Accepted

Solution code:
li = [2,1]
for i in range(86):
    li.append(li[i]+li[i+1])
n = int(input())
print(li[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[n])

Submission status: Accepted

Solution code:
s = input()
n = int(s)

lucas = [2, 1]

x = 0

index = 0

while (index < n):
    x = lucas[index] + lucas[index + 1]
    lucas.append(x)
    index += 1

print(lucas[index])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

A = [2,1]

for i in range(2,90):
  temp = A[i-1]+A[i-2]
  A.append(temp)
ans = A[N]
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

print(dp[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
memo = {}
def f(x):
    if x==0:
        return 2
    if x==1:
        return 1
    if x in memo:
        return memo[x]
    memo[x] = f(x-1)+f(x-2)
    return memo[x]
print(f(int(input())))

Submission status: Accepted

Solution code:
n=int(input())
l=[2,1]
for i in range(n-1):
  a=l[i]+l[i+1]
  l.append(a)
print(l[-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())
l = [0]*(n+1)
l[0]=2
l[1]=1
def lucas_number(n):
    global l
    if l[n]!=0:
        return l[n]
    l[n] = lucas_number(n-1)+lucas_number(n-2)
    return l[n]
print(lucas_number(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[-1])

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1]

if N == 1:
  print(L[1])
  exit()
else:
  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())
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())
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:
#47
N = int(input())
l0,l1 = 2,1
l2 = l1
for i in range(N-1):
    l2 = l0 + l1
    l0 = l1
    l1 = l2
    
print(l1)

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:
import sys
def I():
    return int(sys.stdin.readline().rstrip())

N = I()

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

Submission status: Accepted

Solution code:
n = int(input())
l = [0] * 100
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[n]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l_list = [2, 1]
if n < 2 :
    print(l_list[n])
else :
    for i in range(2,n+1) :
        new = l_list[i-1] + l_list[i-2]
        l_list.append(new)
    print(l_list[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[N])

Submission status: Accepted

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







if __name__ == "__main__":
    solve()

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())
R = [2, 1]
if N < 2:
    print(R[N])
    exit()
for i in range(2, N+1):
    R.append(R[i-1] + R[i-2])
print(R[N])

Submission status: Accepted

Solution code:
N = int(input())
R = [None] * (N+1)

R[0] = 2
if N == 0:
    print(R[0])
    exit()
R[1] =1
if N == 1:
    print(R[1])
    exit()
if N >= 2:
    for i in range(2, N+1):
        R[i] = R[i-1] + R[i-2]
    print(R[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
cache = {}

def main():
    def lucas(x):
        if x == 0:
            return 2
        elif x == 1:
            return 1
        elif x in cache:
            return cache[x]
        else:
            cache[x] = lucas(x-1) + lucas(x-2)
            return cache[x]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
L = [0] * 90
L[0] = 2
L[1] = 1
for i in range(2, len(L)):
    L[i] = L[i - 1] + L[i - 2]
# print(f'{L=}')
ans = L[N]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
dp=[0]*100
dp[0]=2
dp[1]=1
for i in range(90):
    dp[i+2]=dp[i]+dp[i+1]
print(dp[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())
L = [2,1,3]
if N >= 3:
  for i in range(N-2):
    L[0] = L[1]
    L[1] = L[2]
    L[2] = L[0] + L[1]
  print(L[2])
else:
  print(L[N])

Submission status: Accepted

Solution code:
l,m=2,1
for _ in range(int(input())): l,m=m,l+m
print(l)

Submission status: Accepted

Solution code:
a=[2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778, 9349, 15127, 24476, 39603, 64079, 103682, 167761, 271443, 439204, 710647, 1149851, 1860498, 3010349, 4870847, 7881196, 12752043, 20633239, 33385282, 54018521, 87403803, 141422324, 228826127, 370248451, 599074578, 969323029, 1568397607, 2537720636, 4106118243, 6643838879, 10749957122, 17393796001, 28143753123, 45537549124, 73681302247, 119218851371, 192900153618, 312119004989, 505019158607, 817138163596, 
1322157322203, 2139295485799, 3461452808002, 5600748293801, 9062201101803, 14662949395604, 23725150497407, 38388099893011, 62113250390418, 100501350283429, 162614600673847, 263115950957276, 425730551631123, 688846502588399, 1114577054219522, 1803423556807921, 2918000611027443, 4721424167835364, 7639424778862807, 12360848946698171, 20000273725560978, 32361122672259149, 52361396397820127, 84722519070079276, 137083915467899403, 221806434537978679, 358890350005878082, 580696784543856761, 939587134549734843, 1520283919093591604]
print(a[int(input())])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = [2, 1]
i = 1
while i < N:
    i += 1
    L[0], L[1] = L[1], L[0]+L[1]
print(L[1])

Submission status: Accepted

Solution code:
N = int(input())

a = 2
b = 1
ans = 0

if N == 1:
  ans = 1
else:
  for i in range(N-1):
    b, a = a + b, b
    ans = b

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
i, a, b = 2, 2, 1
ans = 0
if n==1:
  print(1)
  quit()
while i <= n:
  ans = a + b
  a,b = b, ans
  i += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

from collections import defaultdict
d = {0:2,1:1}

def calc(n):
    if n not in d:
        d[n] = calc(n-1) + calc(n-2)
    return d[n]

for i in range(n):
    calc(i)

print(calc(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    L0, L1 = 2, 1

    for n in range(N):
        L0, L1 = L1, L1 + L0
    print(L0)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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)
print(L[N])

Submission status: Accepted

Solution code:
N = int(input())

def ryuca_memo(n):
    memo = [0]*(n+1)
    def _ryuca(n):
        if n == 1:
            return 1
        elif n == 0:
            return 2
        if memo[n] != 0:
            return memo[n]
        memo[n] = _ryuca(n-1) + _ryuca(n-2)
        return memo[n]
    return _ryuca(n)

print(ryuca_memo(N))

Submission status: Accepted

Solution code:
n = int(input())

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

print(res[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(50000)
def ryuka(n):
    dp = [0]*(n+1)
    
    def ryu(n):
        if n < 2:
            return 2 - n
        if dp[n] != 0:
            return dp[n]
        dp[n] = ryu(n-1)+ryu(n-2)
        return dp[n]

    return ryu(n)
print(ryuka(int(input())))

Submission status: Accepted

Solution code:
N = int(input())
L0 = 2
L1 = 1

if N==1:
  print(1)

else:
  for n in range(N-1):
    L = L0+L1
    L0 = L1
    L1 = L
  print(L)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a, b = 1, 2
for i in range(n-1):
    a, b = a + b, a

print(a)

Submission status: Accepted

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

# リュカ数

#L0 = 2
#L1 = 1
#L2 = 1 + 2 = 3
#L3 = 3 + 1 = 4
#L4 = 4 + 3 = 7
#L5 = 7 + 4 = 11
#L6 = 11 + 7 = 18

N = int(input())

Li_2 = 2
Li_1 = 1
Li = 1

for i in range(2, N + 1):
    Li = Li_1 + Li_2
    Li_2, Li_1 = Li_1, Li

print(Li)

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[-1]+l[-2])

print(l[n])

Submission status: Accepted

Solution code:
def calc(n):
    if res[n] != 0:
        return res[n]
    tmp = calc(n-1) + calc(n-2)
    res[n] = tmp
    return tmp

N = int(input())
res = [0] * 100
res[0] = 2
res[1] = 1
calc(N)
print(res[N])

Submission status: Accepted

Solution code:
N = int(input())
l0 = 2
l1 = 1
for _ in range(2, N+1):
    l0, l1 = l1, l0+l1

print(l1)

Submission status: Accepted

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

print(lst[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
L = [0] * (87)
L[0] = 2
L[1] = 1
for i in range(2,87):
    L[i] = L[i-1] + L[i-2]
print(L[I()])

Submission status: Accepted

Solution code:
def solve():
    ans = 0
    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]
    return dp[-1]
print(solve())

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
l = [2,1]
while len(l) < n+1:
    l.append(l[-1]+l[-2])
print(l[-1])

Submission status: Accepted

Solution code:
memo = {}
def f(i):
    if i==0:
        return 2
    if i==1:
        return 1
    if i in memo:
        return memo[i]
    memo[i] = f(i-1)+f(i-2)
    return memo[i]
print(f(int(input())))

Submission status: Accepted

Solution code:
N = int(input())

dp = [2, 1]

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

print(dp[-1])

Submission status: Accepted

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

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:
n = int(input())

l2 = 1
l1 = 2

if n == 0:
    l2 = l1
elif n == 1:
    pass
else:
    for i in range(n-1):
        l0 = l1
        l1 = l2
        l2 = l1 + l0

print(l2)

Submission status: Accepted

Solution code:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N = iIn()

A = [2, 1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

l = [0] * (n+1)

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

Submission status: Accepted

Solution code:
N = int(input())
L = [2, 1]

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