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:
N=int(input())
L1=2
L2=1
l=1
for _ in range(N-1):
    l=L1+L2
    L1=L2
    L2=l
print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
dp = [0 for i in range(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])

Submission status: Accepted

Solution code:
def examB():
    N = I()
    ryuca = [0]*87
    ryuca[0] = 2; ryuca[1] = 1
    for i in range(2,87):
        ryuca[i] = ryuca[i-1] + ryuca[i-2]
    print(ryuca[N])

import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

print(ln if n>1 else 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 - 2] + l[i - 1]
print(l[n])

Submission status: Accepted

Solution code:
n=int(input())
x=2
y=1
for i in range(n//2):
    x=x+y
    y=y+x
print(x if n%2==0 else y)

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=[0]*(n+1)
l[0]=2
l[1]=1
for i in range(2,len(l)):
    l[i]=l[i-1]+l[i-2]
print(l[len(l)-1])

Submission status: Accepted

Solution code:
N = int(input())

L = []
L.append(2)
L.append(1)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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())
luca=[2,1]
for i in range(n):
  luca.append(luca[i]+luca[i+1])
print(luca[n])

Submission status: Accepted

Solution code:
n = int(input())
li_2 = 2
li_1 = 1
luca = 0
if n == 0:
    luca = 2
elif n == 1:
    luca = 1
else:
    for i in range(2, n+1):
        luca = li_1 + li_2
        temp = li_2
        li_2 = li_1
        li_1 = luca
print(luca)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

L = [2,1]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = 2
b = 1
if N == 1:
    print(1)
    exit()
for _ in range(N-1):
    tmp = a+b
    a = b
    b = tmp
print(tmp)

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
ll = [0] * 90
ll[0] = 2
ll[1] = 1
for i in range(86):
    ll[i+2] = ll[i+1] + ll[i]
print(ll[n])

Submission status: Accepted

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

Submission status: Accepted

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

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

x, y = 1, 2
for _ in range(N-1):
    x, y = x+y, x
print(x)

Submission status: Accepted

Solution code:
def sol(n):
  if n == 0: return 2
  if n == 1: return 1
  L = [2,1] + [0]*(n-1)
  for i in range(2,n+1):
    L[i] = L[i-2] + L[i-1]
  return L[-1]

print(sol(int(input())))

Submission status: Accepted

Solution code:
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    n = int(sys.stdin.readline().rstrip())
    l = [None] * (n + 1); l[0], l[1] = 2, 1
    for i in range(1, n):
        l[i+1] = l[i] + l[i-1]
    print(l[n])

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

Solution code:
N=int(input())
list=[2,1]
for i in range(86):
    list +=[int(list[i])+int(list[i+1])]
print(list[N])

Submission status: Accepted

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

print(li[n])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(l[n])

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
  print(1)
else:
  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())
i = [0 for _ in range(87)]
i[0]=2
i[1]=1
for s in range(2,87):
    i[s] = i[s-1]+i[s-2]
print(i[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())

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

print(list[n])

Submission status: Accepted

Solution code:
import sys


def solve():
    sys.setrecursionlimit(2000)
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    ls = [0] * (n + 1)
    ls[0] = 2
    ls[1] = 1
    for i in range(2, len(ls)):
        ls[i] = ls[i-1] + ls[i-2]
    print(ls[-1])


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

List = [2,1]

for i in range(N-1):
  List.append(List[i]+List[i+1])

Answer = List[-1]
print(Answer)

Submission status: Accepted

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

for i in range(n-1):
  temp=a+b
  a=b
  b=temp
if n==0:
  print(2)
elif n==1:
  print(1)
else:
  print(b)

Submission status: Accepted

Solution code:
n = int(input())

luc = [2, 1]

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

Submission status: Accepted

Solution code:
N = int(input())

L = [2, 1, 3]

if N <= 2:
  print(L[N])
  exit()

for i in range(3, N+1):
  j = i % 3
  L[j] = sum(L) - L[j]
  
  if i == N:
    print(L[j])

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 _ in range(n-1):
    t = l[1] + l[0]
    l.append(t)
    l.pop(0)
print(l[1])

Submission status: Accepted

Solution code:
n = int(input())
L = [0 for i in range(100)]
L[0] = 2
L[1] = 1
def Lucas(n):
    if L[n] != 0:
        return L[n]
    else:
        L[n - 1] = Lucas(n - 1)
        L[n - 2] = Lucas(n - 2)
        return L[n - 1] + L[n - 2]
print(Lucas(n))

Submission status: Accepted

Solution code:
N=int(input())
memo=[None]*(N+1)
def luca(N):
  if memo[N]!=None:
    return memo[N]
  if N==0:
    memo[N]=2
    return 2
  elif N==1:
    memo[N]==1
    return 1
  else:
    memo[N]=luca(N-1)+luca(N-2)
    return memo[N]
ans=luca(N)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
l=2
r=1
for i in range(N-1):
    tmp=r
    r+=l
    l=tmp
print(r)

Submission status: Accepted

Solution code:
n = int(input())
l_i_1 = 2
l_i_2 = 1
if n >= 2:
  while n>=2:
    l_i = l_i_1 + l_i_2
    n -= 1
    l_i_1= l_i_2
    l_i_2 = l_i
  print(l_i)
elif n==1:
  print(1)
else:
  print(2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

lucas_list = [0] * 90
lucas_list[0] = 2
lucas_list[1] = 1

def lucas_num(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    elif lucas_list[n] == 0:
        lucas_list[n] = lucas_num(n-1) + lucas_num(n-2)
        return lucas_list[n]
    else:
        return lucas_list[n]

print(lucas_num(n))

Submission status: Accepted

Solution code:
n = int(input())

fib = [2] + [1] + [0]*(n-1)

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

print(fib[n])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(b)

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()) - 1
L0 = 2
L1 = 1
for i in range(N):
	temp = L1
	L1 = L0 +L1    #L2
	L0 = temp
print(L1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if N==0:
  print(2)
elif N==1:
  print(1)
else:
  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())
L0 = 2
L1 = 1

if N == 0:
  print(L0)
elif N == 1:
  print(L1)
else:
  for i in range(N - 1):
    L1, L0 = L0 + L1, L1
  print(L1)

Submission status: Accepted

Solution code:
n = int(input())

memo = [0 for i in range(n+1)]


def luca(i):
    if i == 0:
        memo[i] = 2
        return memo[i]
    if i == 1:
        memo[i] = 1
        return memo[i]
    if memo[i] != 0:
        return memo[i]
    memo[i] = luca(i-1) + luca(i-2)
    return memo[i]


print(luca(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#2019/10/12
N = int(open(0).read())
L0 = 2
L1 = 1
L2 = 3
for i in range(N):
    L2 = L1 + L0
    L1, L0 = L2, L1
    #print(i, L2)
print(L0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Lucas Number
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]*100
l[0]=2
l[1]=1
def ryuka(x):
    r = 0
    for i in range(2,x+1):
        l[i]=l[i-1]+l[i-2]
    return l[i]
if n==1:
    print(1)
    exit()
else:
    print(ryuka(n))

Submission status: Accepted

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

for i in range(101):
    luca.append(luca[i]+luca[i+1])

print(luca[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
prev=2
now=1

for i in range(N-1):
  prev,now=now,now+prev
print(now)

Submission status: Accepted

Solution code:
n = int(input())

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

print(memo[n])

Submission status: Accepted

Solution code:
N = int(input())
if N == 1:
    print(1)
else:
    a0 = 2
    a1 = 1
    for n in range(2,N+1):
        a2 = a1 + a0
        a0,a1 = a1,a2
    print(a2)

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:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    lucas_numbers = [2, 1]
    for i in range(2, N+1):
        lucas_numbers.append(lucas_numbers[i-2] + lucas_numbers[-1])
    return lucas_numbers[-1]


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

Solution code:
N=int(input())
def lucasnum(N):
    l=[2,1]
    if N>1:
        for n in range(2, N+1):
            l.append(l[n-1]+l[n-2])
    return print(l[N])
lucasnum(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

if __name__=="__main__":
    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:
d = dict()


def lucas(i: int):
    if i == 0:
        return 2
    if i == 1:
        return 1
    if i in d:
        return d[i]
    val = lucas(i - 1) + lucas(i - 2)
    d[i] = val
    return val


print(lucas(int(input())))

Submission status: Accepted

Solution code:
def FibArray(n):
    FA = [0]*n
    FA[0] = 2
    FA[1] = 1
    for i in range(2,n):
        FA[i] = (FA[i-1]+FA[i-2])
    return(FA)

def Fib(n):
    return(FibArray(n+1)[n])

print(Fib(int(input())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l_0 = 2; l_1 = 1; l_n = 3
for i in range(n):
  l_0, l_1, l_n = l_1, l_n, (l_1 + l_n)
print(l_0)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n =int(input())

L=[]
L.append(2)
L.append(1)


def Lucas(n):
    for i in range(n):
        cnt=len(L)
        tmp=L[cnt-2]+L[cnt-1]
        L.append(tmp)

Lucas(n)

print(L[n])

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())
l0,l1 = 2,1
for i in range(n):
  l0,l1 = l1,(l0+l1)
print(l0)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ls = [0] * (n + 1)
    ls[0] = 2
    ls[1] = 1
    for i in range(2, len(ls)):
        ls[i] = ls[i-1] + ls[i-2]
    print(ls[-1])


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
l0,l1=2,1

for i in range(int(input())):
    l0,l1=l1,l0+l1

print(l0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n = int(input())

l_1, l_2 = 2, 1

for _ in range(n-1):
  l_1, l_2 = l_2, l_1+l_2

print(l_2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L_forward = 2
L_backward = 1
if N == 1:
    print(L_backward)
else:
    for i in range(2, N+1):
        L = L_forward + L_backward
        L_forward = L_backward
        L_backward = L
    print(L)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
input = sys.stdin.readline


def main():
    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])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

for i in range(2,n+1):
    li[i] = li[i-2] + li[i-1]
   # print(li[i],end = " ")
print(li[n])

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

# input
N = int(input())

# solve
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]

# output
print(l[-1])

Submission status: Accepted

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

Submission status: Accepted

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

print(L[int(input())])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
N = int(input())

prepre_L = 2
pre_L = 1
now_L = 0
if N == 0:
    now_L =2
elif N == 1:
    now_L = 1
else:
    for n in range(N - 1):
        now_L = pre_L + prepre_L
        prepre_L = pre_L
        pre_L = now_L

print(now_L)

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]*88

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

L_old1 = 2
L_old2 = 1

if N == 1:
    L_new = L_old2
else:
    for i in range(2,N+1):
         L_new = L_old1 + L_old2
         L_old1 = L_old2
         L_old2 = L_new

print(L_new)

Submission status: Accepted

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

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:
def lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    return lucas(n - 1) + lucas(n - 2)
    
n = int(input())
lucas = [0 for i in range(87)]
lucas[0] = 2
lucas[1] = 1
for i in range(2, n + 1):
    lucas[i] = lucas[i - 1] + lucas[i - 2]
print(lucas[n])

Submission status: Accepted

Solution code:
n = int(input())
ls = [0 for _ in range(n + 1)]
ls[0] = 2
ls[1] = 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())

b, c = 1, 2+1
if N == 1:
    print(b)
if N == 2:
    print(c)
for _ in range(3, N+1):
    b, c = c, c+b
if N not in {1,2}: print(c)

Submission status: Accepted

Solution code:
# ABC079 B - Lucas Number
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())

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:



def main():
    a =2
    b = 1
    k =[2,1]
    n = int(input())

    for _ in range(n):
        k.append(a+b)
        a,b = b,a+b
    print(k[n])


    




if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import lru_cache

N = int(input().strip())

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

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(n-1):
    l[i+2]=l[i+1]+l[i]
print(l[-1])

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

n=int(input())

a=2
b=1

for i in range(n):
	a,b=b,a+b
	
print(a)

Submission status: Accepted

Solution code:
n=int(input())

l =[0 for i in range(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:
ans = [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]

N = int(input())
print(ans[N])

Submission status: Accepted

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

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())
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(2,N+1):
  L.append(L[i-1]+L[i-2])
print(L[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
first = 2
second = 1
total = 0
if n == 0:
    print(first)
elif n == 1:
    print(second)
else:
    for i in range(n - 1):
        total = first + second
        first = second
        second = total
    print(total)

Submission status: Accepted

Solution code:
from functools import*;L=lru_cache()(lambda x:L(x-1)+L(x-2)if x>1else 2-x);print(L(int(input())))

Submission status: Accepted

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

print(res[N])

Submission status: Accepted

Solution code:
n = int(input())
L1, L2 = 2, 1
L3 = 3

for i in range(n):
  L1, L2, L3 = L2, L3, (L2 + L3)
print(L1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  N=int(input())
  l=[2,1]
  if N<2:
    print(1)
    exit()
  else:
    for i in range(N-2):
      l[0],l[1]=l[1],l[0]+l[1]
    print(l[0]+l[1])
      

if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
N = int(input())
dp = [0]*(N+10)

for i in range(N+1):
    if i == 0:
        dp[i] = 2
        continue
    if i == 1:
        dp[i] = 1
        continue
    dp[i] = dp[i-1]+dp[i-2]

print(dp[N])

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[i]+l[i+1])
    print(l[-1])

Submission status: Accepted

Solution code:
n=int(input())
ans=list()
ans.extend([2,1])

for i in range(2,n):
    ans.append(ans[i-2]+ans[i-1])
        
if n==1:
    print(1)
else:
    print(ans[n-2]+ans[n-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())
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())
L = []*N
L.append(2)
L.append(1)
for i in range(2,N+1):
    n = L[i-1]+L[i-2]
    L.append(n)
print(L[N])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
if N == 1:
    print(1)
else:
    a = 2
    b = 1
    for i in range(2, N+1):
        c = a + b
        a = b
        b = c
    print(c)