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())
import collections
d=collections.defaultdict(int)

def luca(n):
    if n in d:
        return d[n]
    
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        tmp=luca(n-1)+luca(n-2)
        d[n]=tmp
        return tmp

print(luca(n))

Submission status: Accepted

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

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

print(ans[-1])

Submission status: Accepted

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

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

print(dic[-1])

Submission status: Accepted

Solution code:
n = int(input())
li1 = 1
li2 = 2
luca = 0
if n == 1:
    print(li1)
    quit()
for i in range(n-1):
    luca = li1 + li2
    li2 = li1
    li1 = luca
print(luca)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())
memo = [0]*(n+1)
print(luca(n))

Submission status: Accepted

Solution code:
import sys
n = int(input())
m = [2,1]

if n == 1:
    print(1)
    sys.exit()
    
for i in range(1,n):
    x = sum(m)
    m.append(x)
    del m[0]
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ryuka = [0] * 100
ryuka[0] = 2
ryuka[1] = 1

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


print(ryuka[N])

Submission status: Accepted

Solution code:
import sys

n=int(input())
list=[]
if n==1:
	print(1)
	sys.exit()
list.append(2)
list.append(1)
for i in range(2,87):
	list.append(list[i-1]+list[i-2])
	if n==i:
		print(list[-1])
		sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    l=[]
    l.append(2)
    l.append(1)
    for i in range(85):
        l.append(l[-1]+l[-2])
    print(l[n])
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
def luc(s,n,l1,l2):
    if(n==s+1):
        print(l1+l2)
        return
    luc(s,n+1,l2,l1+l2)
a=int(input())
if a==1:print(1)
else:luc(a,3,2,1)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0

def lucas(n, ans1, ans2):
    if(n >= 2):
        for _ in range(n-1):
            ans = ans1 + ans2
            ans1 = ans2
            ans2 = ans
        return ans
            
    elif(n == 0):
        return 2
    elif(n == 1):
        return 1

print(lucas(n, 2, 1))

Submission status: Accepted

Solution code:
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
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:
L = [2, 1]
for _ in range(2, 86 + 1):
  L.append(L[-1] + L[-2])

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

Submission status: Accepted

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

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)
print(a[n])

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

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

L=[2,1]
for _ in range(90):
    L.append(L[-1]+L[-2])
N = int(readline())
print(L[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:
def f(n):
  a, b = 2, 1
  if n == 0:
    return a
  if n == 1:
    return b
  for _ in range(n - 1):
    a, b = b, a + b
  return b
print(f(int(input())))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2000)

N = int(input())

# def Lucas(x):
#     if x == 2:
#         return 1
#     if x == 1:
#         return 2
#     return Lucas(x - 1) + Lucas(x - 2)
# answer = Lucas(N)

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:
#!/usr/bin/env python3
n = int(input())
luca = [0] * 88
luca[0] = 2
luca[1] = 1
for i in range(2,87):
    luca[i] = luca[i-1] + luca[i-2]
    #print(luca[i],i)
print(luca[n])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

lucas = 0
prepre = 2
pre = 1

for i in range(n-1):
    lucas = prepre + pre
    prepre, pre = pre, lucas

if n == 1:
    lucas = 1

print(lucas)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = []
L.append(2)
L.append(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())
L0 = 2
L1 = 1

if N == 0:
    print(L0)
elif N == 1:
    print(L1)
else:
    for _ in range(2, N+1):
        L2 = L0 + L1
        L0, L1 = L1, L2
    print(L2)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
l = []
l.append(2)
l.append(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())
l = [0]*100
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())
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[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
x0=2
x1=1

x=0

if N==1:
    x=1
else:
    for i in range(N-1):
        x=x1+x0
        x0=x1
        x1=x

print(x)

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

Submission status: Accepted

Solution code:
def lucas(n):
    l=[2,1]
    i=2
    while(i<=n):
        l.append(l[i-1]+l[i-2])
        i+=1
    return l[-1]

n=int(input())
print(lucas(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(2,n+1):
    l.append(l[i-1]+l[i-2])
print(l[n])

Submission status: Accepted

Solution code:
n = int(input())

if n == 0:
  print(2)
elif n == 1:
  print(1)
else:

    l0 = 2
    l1 = 1
    result = 0
    for i in range(n-1):
      result = l0+l1
      l0 = l1
      l1 = result

    print(result)

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

if N == 1:
    print(1)
else:
    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:


import numpy as np

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

print(dp[int(input())])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

l_nums = [2, 1]

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

print(l_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[-1])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def Luka(N) :
    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]
    return L[N]
N = int(input())
print(Luka(N))

Submission status: Accepted

Solution code:
n = int(input())
lucas = []

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

print(lucas[n])

Submission status: Accepted

Solution code:
n = int(input())
l_2 = 2
l_1 = 1
l_now = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

print(L[n])

Submission status: Accepted

Solution code:
l = []
l.append(2)
l.append(1)
def lyuca(n):
  for i in range(n):
    l.append(l[i]+l[i+1])
  return l[n]

print(lyuca(int(input())))

Submission status: Accepted

Solution code:
N = int(input())
mylist=[]

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -coding: utf-8 -

n = int(input())

ryuka = [2, 1]

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

print(ryuka[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
N = int(input())

dp = [0 for _ in range(N+1)]
dp[0] = 2
dp[1] = 1
#print(dp)

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

print (dp[N])

Submission status: Accepted

Solution code:

import functools
@functools.lru_cache()

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
lst = [2]

if n==1:
    print(1)
else:
    lst.append(1)
    for _ in range(n-2):
        lst.append(lst[-1]+lst[-2])
    print(lst[-1]+lst[-2])

Submission status: Accepted

Solution code:

n = int(input())
l = [2,1]
i = 2

while i <= n:
    l.append(l[i-1] + l[i-2])
    i += 1
#    print(l)

print(l[-1])

Submission status: Accepted

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

ans = luca[-1]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

lucas = [2,1]

for i in range(n+1):
    if i < 2:
        continue
    else:
        lucas.append(lucas[i-1]+lucas[i-2])

print(lucas.pop())

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

L = [0]*(N+1)
L[0]=2
L[1]=1

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

print(L[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:
def main():
    n=int(input())
    if n==0:
        print(2)
    elif n==1:
        print(1)
    else:
        a=2
        b=1
        for i in range(n-1):
            ans = a + b
            a = b
            b = ans
        print(ans)
main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
a0 = 2
a1 = 1

if n == 1:
    print(1)
else:
    for i in range(n-1):
        a0,a1 = a1,(a0+a1)
    print(a1)

Submission status: Accepted

Solution code:
n = int(input())

d = [2] * (n + 1)

d[1] = 1

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

print(d[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())
l=[2,1]+(n-1)*[0]

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

Submission status: Accepted

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))


n = int(input())
li = [0 for i in range(100)]
li[0]=2
li[1]=1

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

print(li[n])
#print(li)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

lucas_nums = [None] * 101
lucas_nums[0] = 2
lucas_nums[1] = 1
for i in range(2, 101):
    lucas_nums[i] = lucas_nums[i-2] + lucas_nums[i-1]

n = int(sys.stdin.readline().rstrip())

def main():
    return lucas_nums[n]

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

prev = 2
ans = 1
for i in range(1, n):
    ans, prev = ans + prev, ans
print(ans)

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

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

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())
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:
from functools import lru_cache as cache

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

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

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:
L = [2, 1]

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

print(L[-1])

Submission status: Accepted

Solution code:
def Lucas(n):
    a0, a1 = 2, 1
    if n == 0:
        return a0
    elif n == 1:
        return a1
    else:
        for _ in range(n - 1):
            a1, a0 = a0 + a1, a1
        return a1


print(Lucas(int(input())))

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

Submission status: Accepted

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

Submission status: Accepted

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

i0 = 2
i1 = 1
if n>1:
    for i in range(n-1):
        ans = i0+i1
        i0 = i1
        i1  = ans
if n==0:
    print(2)
elif n==1:
    print(1)
else:
    print(ans)

Submission status: Accepted

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

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

ans = Num[n]
print(ans)

Submission status: Accepted

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

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

print(r)

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())
L=[2,1]
for _ in range(N-1):
  L.append(L[-1]+L[-2])
  L.pop(0)
print(L[-1])

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

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:
n = int(input())
l = [None] * 87
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:
dp=[-1]*100
dp[0]=2;dp[1]=1
for i in range(2,100):
  dp[i]=dp[i-1]+dp[i-2]

print(dp[int(input())])
#939587134549734843

Submission status: Accepted

Solution code:
n = int(input())
l0 = 2
l1 = 1
lis = []
lis.append(l0)
lis.append(l1)

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

print(lis[n])

Submission status: Accepted

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

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())
L=[0 for _ 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())

ls_l = [2, 1]

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5)
from functools import lru_cache
N = int(input())

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

print(lucas(N))

Submission status: Accepted

Solution code:
n = int(input())
dic = {0:2,1:1}

def luca(num):
  if num in dic:
    return dic[num]
  else:    
    dic[num] = luca(num-1) + luca(num-2)
    return dic[num]
  
print(luca(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import lru_cache

@lru_cache(maxsize=1000)
def add(a,b):
  return a + b ;

N = int(input())

ans = [0] * (N+2)
ans[0] = 2
ans[1] = 1

for i in range(N):
    ans[i+2] = add(ans[i],ans[i+1])

print(ans[N])

Submission status: Accepted

Solution code:
N = int(input())

ans = [0] * (N+2)
ans[0] = 2
ans[1] = 1

for i in range(N):
    ans[i+2] = ans[i] + ans[i+1]

print(ans[N])

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

print(L[-1])

Submission status: Accepted

Solution code:
n = int(input())

l1 = 2
l2 = 1

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

Submission status: Accepted

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

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

print(l[N])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

a = 2
b = 1

if N == 0:
    print(2)
elif N == 1:
    print(1)
else:
    for _ in range(N - 1):
        c = a + b
        a, b = b, c

    print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def luca(n):
    memo =[0 for _ in range(100)]
    
    memo[0] = 2
    memo[1] = 1
    
    for i in range(n):
        memo[i+2] = memo[i] + memo[i+1]
    
    return memo


n = int(input())
ans = luca(n)

print(ans[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]

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

print(L[-1])

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:
# atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7

# main
N = int(input())

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

print(num[N])

Submission status: Accepted

Solution code:
##### 解けた #####

N=int(input())
L=[2,1]+[0]*max(0,N-1)

# 1より大きい場合
if N>1:
    for n in range(2,N+1): # 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,87):
  L_i = L[i-2] + L[i-1]
  L.append(L_i)

print(L[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc_lucas_num(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1

    cache = [2, 1]
    lucas_num = 0

    for _ in range(1, n):
        lucas_num = cache[1] + cache[0]
        cache[0], cache[1] = cache[1], lucas_num

    return lucas_num

N = int(input())

print(calc_lucas_num(N))

Submission status: Accepted

Solution code:
a,b = 2,1

n = int(input())

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

print(b)

Submission status: Accepted

Solution code:
import sys

lucas_nums = [None] * 100
def lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    if lucas_nums[n]:
        return lucas_nums[n]
    lucas_nums[n] = lucas(n-2) + lucas(n-1)
    return lucas_nums[n]

def main():
    n = int(sys.stdin.readline().rstrip())
    print(lucas(n))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

lucas_nums = [None] * 100
lucas_nums[0], lucas_nums[1] = 2, 1
for i in range(2, 100):
    lucas_nums[i] = lucas_nums[i-2] + lucas_nums[i-1]

def main():
    n = int(sys.stdin.readline().rstrip())
    print(lucas_nums[n])

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()

    lucas = [2,1]
    for i in range(2,N+1):
        lucas.append(lucas[-1]+lucas[-2])
    print(lucas[-1])
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
pre=2
post=1
num=3
if n==1:
  print(1)
else:
  for i in range(1,n):
    num=pre+post
    pre=post
    post=num
  print(num)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    L=[2,1]
    n=int(input())
    for x in range(2,n+1):
        L.append(L[x-1]+L[x-2])
    print(L[n])

main()

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

print(a[n])

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())

li = [0]*87

li[0] = 2
li[1] = 1

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

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

Submission status: Accepted

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

print(LLL[N])

Submission status: Accepted

Solution code:
l_0 = 2
l_1 = 1
A = int(input())
if A == 0:
  print(l_0)
elif A == 1:
  print(l_1)
else:
  for i in range(A-1):
    if i%2 != 0:
      p = l_1
      l_1 = l_0 + l_1
      l_0 = p
    else:
      p = l_1
      l_1 = l_0 + l_1
      l_0 = p
  print(max(l_0,l_1))

Submission status: Accepted

Solution code:
N = int(input())
mi = 2
ni = 1
ans = 1
if ans==N:
    print(ni)
    exit()
for i in range(2,N+1):
    ans += 1
    num = ni + mi
    mi = ni
    ni = num
    if ans == N:
        print(num)
        exit()

Submission status: Accepted

Solution code:
n = int(input())
if n == 1 :
    print(1)
else :
    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())
l0,l1 = 2,1
if n == 1:
    ans = l1
elif n == 2:
    ans = l0 + l1
else:
    for i in range(1,n):
        ans = l0 + l1
        l0 = ans
        l0,l1 = l1,l0
print(ans)