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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
#動的計画法
 
N = int(input())
Ni_2 = 2
Ni_1 = 1
Ni = 1
Ni_dummy = 0
 
for i in range(2, N + 1):
    Ni = Ni_1 + Ni_2
    Ni_2 = Ni_1
    Ni_1 = Ni
print(Ni)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
#動的計画法

N = int(input())
Ni_2 = 2
Ni_1 = 1
Ni = 1
Ni_dummy = 0

for i in range(2, N + 1):
    Ni = Ni_1 + Ni_2
    Ni_2 = Ni_1
    Ni_1 = Ni
print(Ni)

Submission status: Accepted

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


print(a[n])

Submission status: Accepted

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

Submission status: Accepted

Solution code:


N = int(input())

L = [2,1]

for i in range(N+1):

    if i != 0 and i != 1:

        now = L[i-1] + L[i-2]

        L.append(now)

    if i == N:

        print (L[N])
        break

Submission status: Accepted

Solution code:
n = int(input())

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

def dp(x):
    if x == 0:
        return 2
    elif x == 1:
        return 1
    elif memo[x] != -1:
        return memo[x]
    memo[x] = dp(x-1) + dp(x-2)
    return memo[x]

print(dp(n))

Submission status: Accepted

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

Submission status: Accepted

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

nums=[L0,L1]

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

print(nums[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
dp = [2] * (N+1)
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:
#!/usr/bin/env python3
import sys


def solve(N: int):
    L = []
    L.append(2)
    L.append(1)

    while len(L) < N+1:
        L.append(sum(L[-2:]))

    print(L[N])


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(l[-1])

Submission status: Accepted

Solution code:
n = int(input())

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

tmp = 1
ans = 3
for i in range(2, n):
    next = ans + tmp
    tmp = ans
    ans = next
print(ans)

Submission status: Accepted

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


abc()

Submission status: Accepted

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

def solve():
    N = int(input())

    if N == 1:
        print(1)
        return

    L0 = 2
    L1 = 1
    i = 2
    while True:
        ans = L0 + L1

        if i == N:
            break
        
        L0 = L1
        L1 = ans
        i += 1

    print(ans)

if __name__ == "__main__":
    solve()

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:
# coding: utf-8
# Your code here!
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:
from functools import lru_cache

@lru_cache(maxsize = None)
def Lucas(n):
    if n == 0: return 2
    elif n == 1: return 1
    else: return Lucas(n-1) + Lucas(n-2)
    
N = int(input())
print(Lucas(N))

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
    print(1)
else:
    p=2
    l=1
    for i in range(1,n):
        t=l
        l=p+l
        p=t
    print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#lucas number
n = int(input())


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

#2 1 3 4 7 11 18
def get_lucas(l, n):
    l_n = l[n-2] + l[n-1]

    l.append(l_n)

    return l


for i in range(n + 1):
    if i > 1:
        l = get_lucas(l, i)


print(l[n])

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())

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

print(L[N])

Submission status: Accepted

Solution code:
n = int(input())
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:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
n=int(input())
memo=[0for i in range(n)]
def lucas(n):
    memo = [0]*(n+1)

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

    return _lucas(n)
print(lucas(n))

Submission status: Accepted

Solution code:
N = int(input())

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

answer = L[N]
print(answer)

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())
L = [ 0 ] * 1000000

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())
a, b = 2, 1
if n == 0:
  print(a)
elif n == 1:
  print(b)
else:
  for i in range(n-1):
    a, b = b, a + b
  print(b)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
L = [0]*1000000
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:
import sys
from functools import lru_cache
sys.setrecursionlimit(1000000000)

N = int(input())

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

print(recursive(N))

Submission status: Accepted

Solution code:
import numpy as np
 
def luka(n):
    a,b=1,2
    if n==1:
        pass
    elif n>=1:
        for _ in range(n-1):
            a,b=a+b,a
    
    print(a)
    
 
def main():
    N=int(input())
 
    luka(N)
 
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

def solve(l0,l1,n,i):
    if i == n:
        return print(l1)
    l2 = l1 + l0
    return solve(l1,l2,n,i+1)

solve(2,1,n,1)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():
    num = int(input())
    data = [0 for i in range(num + 1)]
    data[0], data[1] = 2, 1
    for i in range(2, num + 1):
        data[i] = data[i - 1] + data[i -2]
    print(data[num])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    print(L[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

xx = 2
x = 1
for i in range(n-1):
  ans = xx + x
  xx = x
  x = ans

print(ans)

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]
i = 2
while True:
    l.append(l[i-1] + l[i-2])
    if i == n:
        print(l[i])
        exit()
    elif n == 0:
        print(2)
        exit()
    elif n == 1:
        print(1)
        exit()
    else:
        i += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def fib_memo(n):
    memo=["Empty"]*(n+1)
    def _fib(n):
        if n==0:
            return 2
        elif n==1:
            return 1
        elif memo[n] != "Empty":
            return memo[n]
        else:
            memo[n]=_fib(n-1)+_fib(n-2)
            return memo[n]
    return _fib(n)

n=int(input())
result=fib_memo(n)
print(str(result))

Submission status: Accepted

Solution code:
N = int(input())

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

L0 = 2; L1 = 1
for _ in range(2, N+1):
    L2 = L1 + L0
    L1, L0 = L2, L1
print(L2)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int):
    L = [2, 1]
    for _ in range(1, N):
        L = [L[1], L[0]+L[1]]
    print(L[1])
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip().rstrip())
l = [None] * 87
l[0] = 2
l[1] = 1
for itr in range(2,87):
    l[itr] = l[itr - 1] + l[itr - 2]
print(l[N])

Submission status: Accepted

Solution code:
N = int(input())

#L0=2
#L1=1

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

if N==0:
  ans = 2
if N==1:
  ans = 1
else:
  ans_left=2
  ans_right=1
  for i in range(N-1):
    ans = ans_left + ans_right
    ans_left = ans_right
    ans_right = ans
    
print(ans)
#def Lucas(i):
#  if i==0:
#    return 2
#  if i==1:
#    return 1
#  else:
#    return Lucas(i-1)+Lucas(i-2)
  
#print(Lucas(N))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    la = 2
    lb = 1
    for _ in range(N):
        lc = la + lb
        la = lb
        lb = lc
    print(la)


main()

Submission status: Accepted

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

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

print(L[N])

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
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:

Lucas_list = [2,1] + [0 for i in range(86)]

for i in range(85):
  Lucas_list[i+2] = Lucas_list[i] + Lucas_list[i+1]
  
print(Lucas_list[int(input())])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


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

Submission status: Accepted

Solution code:
n = int(input())

a,b = 2,1

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

Submission status: Accepted

Solution code:
n = int(input())

a,b = 2,1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
Li_2 = 2
Li_1 = 1
Li = 0
if N > 1:
    for i in range(2, N+1):
        Li = Li_1 + Li_2
        Li_2 = Li_1
        Li_1 = Li
print(Li) if N !=1 else print(Li_1)

Submission status: Accepted

Solution code:
N = int(input())
pre2,pre1 = 2,1
if N == 1:print(1)
else:
    for i in range(2,N+1):
        l = pre2 + pre1
        pre2,pre1 = pre1,l
    else:print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
L0, L1 = 2, 1
while True:
    if n == 1:
        print(L1)
        exit()
    L0 += L1
    n -= 1
    if n == 1:
        print(L0)
        exit()
    L1 += L0
    n -= 1

Submission status: Accepted

Solution code:
l=[]
l.append(2)
l.append(1)

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

# 入力
N=int(input())

# 出力
print(l[N])

Submission status: Accepted

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

def main():
    N = int(input())
    print(ryuka(N))

memo = {}

def ryuka(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    if n in memo:
        return memo[n]
    res = ryuka(n-1) + ryuka(n-2)
    memo[n] = res
    return res

main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    n = I()
    d = [None for i in range(n+1)]
    d[0] = 2
    d[1] = 1
    for i in range(2,n+1):
        d[i] = d[i-1]+d[i-2]
    print(d[n])
    return

#D
def D():
    x,y,z = LI()
    for i in range(1000000)[::-1]:
        if i*y+(i+1)*z <= x:
            print(i)
            quit()
    return

#E
def E():
    d = [(1,0),(-1,0),(0,1),(0,-1)]
    h,w = LI()
    s = SR(h)
    for i in range(h):
        for j in range(w):
            if s[i][j] == "#":
                su = 0
                for dy,dx in d:
                    y = i+dy
                    x = j+dx
                    if 0 <= y < h and 0 <= x < w:
                        if s[y][x] == "#":
                            su += 1
                if su == 0:
                    print("No")
                    quit()
    print("Yes")
    return

#F
def F():
    a,b,c,X,Y = LI()
    ans = float("inf")
    for z in range(300001):
        if z%2 == 0:
            m = c*z
            x = z//2
            y = z//2
            m += a*max(0,X-x)
            m += b*max(0,Y-y)
            if m < ans:
                ans = m
    print(ans)
    return

#G
def G():
    n = I()
    x = LI()
    f = [(i,x[i]) for i in range(n)]
    f.sort(key = lambda x:x[1])
    g = [(f[i][0],i) for i in range(n)]
    g.sort(key = lambda x:x[0])
    for i in range(n):
        if g[i][1] < n//2:
            print(f[n//2][1])
        else:
            print(f[n//2-1][1])
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    C()

Submission status: Accepted

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

print(lucas[N])

Submission status: Accepted

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

if n == 1:
    print(1)

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

Submission status: Accepted

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

N = int(input())

r = [0 for i in range(87)]
r[0] = 2
r[1] = 1
#print(r)
def ryuka(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        if r[n] != 0:
            return r[n]
        r[n] = ryuka(n-1) + ryuka(n-2)
        return r[n]
#print(r)
print(ryuka(N))

Submission status: Accepted

Solution code:
l = [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(l[int(input())])

Submission status: Accepted

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


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

print(L[-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

memo = [-1]*(N+1)


def ryuka(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        if memo[i-1] != -1:
            ryuka1 = memo[i-1]
        else:
            ryuka1 = ryuka(i-1)
            memo[i-1] = ryuka1

        if memo[i-2] != -1:
            ryuka2 = memo[i-2]
        else:
            ryuka2 = ryuka(i-2)
            memo[i-2] = ryuka2

        return ryuka1 + ryuka2


print(ryuka(N))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
memo =[2,1]
for i in range(2,n+1):
    memo.append( memo[i-1]+memo[i-2] )
print(memo[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:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    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])
    
if __name__ == '__main__':
    main()

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

count=1
sum=1
sum_old=2
sum_k=0

if n==0:
  print(2)
elif n==1:
  print(1)
else:
  while count<n:
    sum_k=sum
    sum+=sum_old
    sum_old=sum_k
    count+=1
  print(sum)

Submission status: Accepted

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

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:
a,b=2,1;exec'a,b=b,a+b;'*input();print a

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = [0] * 100

L[0] = 2
L[1] = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

def memoize(f):
	memo = {}
	def func(n):
		if n not in memo:
			memo[n] = f(n)
		return memo[n]
	return func

@memoize
def lucas(n):
	if n < 2:
		return [2, 1][n]
	return lucas(n-1) + lucas(n-2)

print(lucas(N))

Submission status: Accepted

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

print(lukas[int(input())])

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

a = {}
a[0] = 2
a[1] = 1
def lucas(n):
    if n in a:
        return a[n]
    
    a[n] = lucas(n-1) + lucas(n-2)
    return a[n]



def solve():
    n = f()[0]
    print(lucas(n))



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


def lucas(n, l1, l2):
    if n == 0:
        return l2
    return lucas(n - 1, l2 + l1, l1)

def submit():
    n = read_input()
    print(lucas(n, 1, 2))

if __name__ == '__main__':
    submit()

Submission status: Accepted

Solution code:
N = int(input())

def Luca(k,x,y):
    if k == N:
        return y
    else:
        return Luca(k+1,y,x+y)

print(Luca(1,2,1))

Submission status: Accepted

Solution code:
n = int(input())
arr = [2, 1]
index = 0
while len(arr) <= 86:
    arr.append(arr[index] + arr[index + 1])
    index += 1

print(arr[n])

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

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math


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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC079B - Lucas Number
n = int(input())
def lucas(n, a=2, b=1):
    if n == 0:
        return a
    elif n == 1:
        return b
    else:
        return lucas(n - 1, b, a + b)

print(lucas(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- cooding utf-8 -*-
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
from collections import Counter

n = int(input())
if n == 0:
    print(2)
    sys.exit()
elif n == 1:
    print(1)
    sys.exit()
l_list = [2, 1]
i = 2

while True:
    l_list.append(l_list[i-1] + l_list[i-2])
    if len(l_list) - 1 == n:
        print(l_list[-1])
        sys.exit()
    i += 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:
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[int(input())])

Submission status: Accepted

Solution code:
N = int(input())

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

print(Luca[1])

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)