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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
fib_memo = {}
def fib(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    if not (n in fib_memo):
        fib_memo[n] = fib(n-1) + fib(n-2)
    return fib_memo[n]

N = int(input())
print(fib(N))

Submission status: Accepted

Solution code:
"""
https://abc079.contest.atcoder.jp/tasks/abc079_b
"""
n=int(input())
l=[]
l.append(2)
l.append(1)
for i in range(n-1):
    l.append(l[i]+l[i+1])
print(l[n])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

l0 = 2
l1 = 1
li = 0

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

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 = []
L.append(2)
L.append(1)
if N == 1:
    print(L[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=2
m=1
ans=1

for i in range(1,N):
    ans=l+m
    l=m
    m=ans

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i=int(input())
a=2
b=1
c=0
while i>1:
    c=b
    b=b+a
    a=c
    i-=1
print(b)

Submission status: Accepted

Solution code:
x=int(input())

lis=[-1 for i in range(0,x+1)]
lis[0]=2
lis[1]=1

def lucas(n):
  if lis[n]==-1:
    lis[n]=(lucas(n-1)+lucas(n-2))
  return lis[n]

print(lucas(x))

Submission status: Accepted

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

x=0
while x<85:
    l.append(l[x]+l[x+1])
    x=x+1
print(l[n])

Submission status: Accepted

Solution code:
from itertools import islice

n = int(input())

def Luka():
    a, b = 2, 1
    while True:
        yield a
        a, b = b, a+b

print(next(islice(Luka(), n, None)))

Submission status: Accepted

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

N = int(input())

L0 = 2
L1 = 1

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

for i in range(2, 87):

    Li = L1 + L0
    if N == i:
        print(Li)
        exit()
    else:
        L0 = L1
        L1 = Li

Submission status: Accepted

Solution code:
N=int(input())
L0=2
L1=1
count=1
while count<N:
    L=L1+L0
    L0=L1
    L1=L
    count+=1
if N==1:
    print(1)
else:
    print(L)

Submission status: Accepted

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

print(Lucas[N])

Submission status: Accepted

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

Submission status: Accepted

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

print(l[n])

Submission status: Accepted

Solution code:
import sys
n = int(input())

l = [2, 1]

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

count = 2
while(1):
    l.append(l[count-1] + l[count-2])
    if count == n:
        print(l[count])
        break
    count += 1

Submission status: Accepted

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

for i in range(N):
    c = a + b
    a = b
    b = c

print(a)

Submission status: Accepted

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


def Lucas(n):
    """
    >>> Lucas(5)
    11
    >>> Lucas(86)
    939587134549734843
    """
    if len(L) > n:
        return L[n]
    else:
        L.append(Lucas(n - 1) + Lucas(n - 2))
        return L[n]


print(Lucas(N))

Submission status: Accepted

Solution code:
N=int(input())

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

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

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

Submission status: Accepted

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

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

print(L[N])

Submission status: Accepted

Solution code:

N = int(input())

L = 2
L_ = 1

for i in range(N-1):
    L__ = L + L_
    L = L_
    L_ = L__

print(L_)

Submission status: Accepted

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

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

print(l[n])

Submission status: Accepted

Solution code:
from functools import lru_cache

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

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

Submission status: Accepted

Solution code:
N = int(input())

lst_lucas = [i for i in range(87)]
lst_lucas[0] = 2
lst_lucas[1] = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())


def lyuca(a, b, count):
    count = count - 1
    if count == 0:
        return a + b
    else:
        return lyuca(b, a + b, count)


if N == 0:
    print(2)
elif N == 1:
    print(1)
elif N > 1:
    print(lyuca(2, 1, N - 1))

Submission status: Accepted

Solution code:
memo = [0]*100
memo[0] = 2
memo[1] = 1
def lucas(n):
     if memo[n] != 0:
         return memo[n]
     else:
         memo[n] = lucas(n-1)+lucas(n-2)
         return memo[n] 
n = int(input().strip())
print(lucas(n))

Submission status: Accepted

Solution code:
N = int(input())

memo = dict()

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

print(luca(N))

Submission status: Accepted

Solution code:
#don't use for, while, list
n = int(input())
ans = 0

def ryuka(a,b,count):
    global ans
    c = a + b
    if count == n:
        ans = c
    else:
        count = count + 1
        ryuka(b,c,count)
        
if n == 0 :
    print(2)
elif n == 1:
    print(1)
else:
    ryuka(2,1,2)        
    print(ans)

Submission status: Accepted

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

def ryuka(a,b,count):
    global ans
    c = a + b
    if count == n:
        ans = c
    else:
        count = count + 1
        ryuka(b,c,count)
        
if n == 0 :
    print(2)
elif n == 1:
    print(1)
else:
    ryuka(2,1,2)        
    print(ans)

Submission status: Accepted

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

def ryuka(a,b,count):
    global ans
    c = a + b
    if count == n:
        ans = c
    else:
        count = count + 1
        ryuka(b,c,count)
        
if n == 0 or n ==1 or n == 2:
    l = [2,1,3,4]
    print(l[n])
else:
    ryuka(2,1,2)        
    print(ans)

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())
ans = 0
l0 = 0
l1 = 0
if N == 1:
    print(1)
elif N == 2:
    print(3)
else:
    for i in range(N+1):
        if i == 0:
            ans = 2
        elif i == 1:
            ans = 1
            l0=2
            l1=1
        else:
            ans = l1 + l0
            l0 = l1
            l1 = ans
    print(ans)

Submission status: Accepted

Solution code:
i = int(input())
l = [2,1,3,4,7,11]
if(i <= 5):print(l[i])
else:
    for j in range(5,i+1):l.append(l[j]+l[j-1])
    print(l[i])

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:
N = int(input())
Luca = [2,1] + [0] * 85
for i in range(2, N+1):
    if i <= len(Luca):
        Luca[i] = Luca[i-1] + Luca[i-2]
print(Luca[N])

Submission status: Accepted

Solution code:
def luca(n):
	lst = [2, 1]
	if n == 0: return 2
	elif n == 1: return 1
	else:
		for i in range(1, n):
			tmp = lst[0] + lst[1]
			lst[0] = lst[1]
			lst[1] = tmp
		return lst[1]

print luca(int(raw_input()))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N==1:
        return 1
    else:
        L = [2, 1]
        for i in range(1,N):
            a = L[0] + L[1]
            L[0] = L[1]
            L[1] = a
        return L[1]    

print(main())

Submission status: Accepted

Solution code:
N=int(input())
if N==0: print(2)
elif N==1: print(1)
else:
    Ln_2=0
    Ln_1=2
    Ln=1
    for i in range(N-1):
        Ln_2=Ln_1
        Ln_1=Ln
        Ln=Ln_1+Ln_2
    print(Ln)

Submission status: Accepted

Solution code:
def lucas(n):

    l0 = 2
    l1 = 1
    l2 = 0
    if n == 0:
        return l0
    elif n == 1:
        return l1
    else:
        while n > 1:
            l2 = l0 + l1
            l0 = l1
            l1 = l2
            n -= 1

        return l2

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

Submission status: Accepted

Solution code:
N=int(input())
if N==0: print(2)
elif N==1: print(1)
else:
  Ln_2=0
  Ln_1=2
  Ln=1
  for i in range(N-1):
    Ln_2=Ln_1
    Ln_1=Ln
    Ln=Ln_1+Ln_2
  print(Ln)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import lru_cache
N=int(input())

@lru_cache(None)
def Lucas(i):
    if i==1:
        return(1)
    elif i==0:
        return(2)
    else:
        return(Lucas(i-1)+Lucas(i-2))

print(Lucas(N))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    L = 1
    L_2 = 0
    L_1 = 2
    for i in range(2,N+1):
        L_2 = L_1
        L_1 = L
        L = L_1 + L_2
    return L
        
print(ryuka())

Submission status: Accepted

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

print(L[N])

Submission status: Accepted

Solution code:
l_dict = {}


def lucas(num):
    if num == 0:
        return 2
    elif num == 1:
        return 1
    elif num in l_dict:
        return l_dict[num]
    else:
        lu = lucas(num-1) + lucas(num-2)
        l_dict[num] = lu
        return lu


n = int(input())
print(lucas(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
def lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    prev_prev = 2
    prev = 1
    for i in range(2, n+1):
        current = prev + prev_prev
        prev_prev = prev
        prev = current
    return current
        

if __name__ == '__main__':
    print(lucas(int(input())))

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])

arr=[2,1]

for i in range(2,n+1):

#    print(i)
    
    arr.append(arr[i-2]+arr[i-2+1])
    
print(arr[n])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
li = [2,1]
num = int(raw_input())
for i in range (num-1):
    li.append(li[-1]+li[-2])
print li[-1]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
    print(1)
else:
    l0 = 2
    l1 = 1
    for i in range(1, N):
        l0, l1 = l1, l0 + l1
    print(l1)

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    number = int(input())

    lucas_numbers = [2, 1]

    if number >= 2:
        for i in range(2, number + 1):
            new_value = lucas_numbers[i - 1] + lucas_numbers[i - 2]
            lucas_numbers.append(new_value)

        print(lucas_numbers[number])
    else:
        print(lucas_numbers[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 = {0:2,1:1}
def lucasnumber(i):
    if i in Lucas:
        return Lucas[i]
    else:
        Lucas[i] = lucasnumber(i-1) + lucasnumber(i-2)
        return Lucas[i]
print(lucasnumber(N))

Submission status: Accepted

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

print(L[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    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[n])
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=[0 for x in range(87)]
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())
array=[0 for i in range(87)]
array[0]=2
array[1]=1
for i in range(2, N+1):
  array[i]=array[i-1]+array[i-2]
print(array[N])

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, input())))
    return li

# --------------------------------------------

dp = None

def 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])

main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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:
a = 2
b = 1
for _ in range(int(input())-1):
    b, a = a+b, b

print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
kai= 2
alm=1
alm2=1
for i in range(n-1):
    alm +=  kai
    kai=alm2
    alm2=alm
print(alm)

Submission status: Accepted

Solution code:
import functools

n=int(input())

@functools.lru_cache()
def luca(n):
    if n>=2:
        return luca(n-1) + luca(n-2)
    elif n==1:
        return 1
    else:
        return 2


print(luca(n))

Submission status: Accepted

Solution code:
N = int(input())
L = 2
l = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(L[n])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

b=2
c=1

for i in range (a):
    if i%2==0:
        b=b+c
    else:
        c=c+b

if b >c:
    print(c)
else:
    print(b)

Submission status: Accepted

Solution code:
import time
import sys

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

def main():
    N = input()
    if(int(N) == 0):
        print(2)
        sys.exit()
    elif(int(N) == 1):
        print(1)
        sys.exit()
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def Lucas(n):
    L = [0]*(n+1)
    if n==0:
        return 2
    elif n == 1:
        return 1
    else:
        L[0]=2
        L[1]=1
        i=2
        while i < (n+1):
            L[i] = L[i-1]+L[i-2]
            i += 1
    return L[n]
N=int(input())
print(Lucas(N))

Submission status: Accepted

Solution code:
N = int(input())
a = []
a.append(2) #a[0]
a.append(1) #a[1]

temp = 0
if N >= 2:
    for i in range(2, N+1):
        temp = a[i-1] + a[i-2]
        a.append(temp)
print(a[N])

Submission status: Accepted

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

Submission status: Accepted

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

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

print(L[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Lucas():
    a = 2
    b = 1
    while True:
        yield b
        (a, b) =  (b, a + b)

N = int(input())

for i, x in enumerate(Lucas()):
    if i == N-1:
        print(x)
        break

Submission status: Accepted

Solution code:
n = int(input())
c = 3
v = []

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

a = 2
b = 1

step = int(input()) - 1

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

print(b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

def culc_ryuka(N, ryuka):
    for i in range(2, N+1):
        ryuka[i] = ryuka[i-1]+ryuka[i-2]
        
    return ryuka

ryuka = culc_ryuka(N, ryuka)
print(ryuka[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:
N = int(input())

def luca(n, a, b):
    if n == 0:
        return a
    if n == 1:
        return b
    
    return luca(n - 1, b, a + b)

print(luca(N, 2, 1))

Submission status: Accepted

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

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

print L[n]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
array=[-1]*87
array[0]=2
array[1]=1
def ryuka(n):
    if array[n] != -1: return array[n]
    if(n==0 or n==1): return array[n]
    else:
        array[n]=ryuka(n-1)+ryuka(n-2)
        return array[n]

N = int(input())

print(ryuka(N))

Submission status: Accepted

Solution code:
LC = [0] * 100
LC[0] = 2
LC[1] = 1

for i in range(2, 99):
    LC[i] = LC[i-1] + LC[i-2]
    
N = int(input())

print(LC[N])

Submission status: Accepted

Solution code:
def Lucas(n):
  if n==0: return 2
  if n==1: return 1
  a=2
  b=1
  for i in range(2,n+1):
    a,b=b,a+b
  return b
N=int(input())
print(Lucas(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())

Lx = 2
Ly = 1

if N == 1:
    print(Ly)
else:
    for i in range(N - 1):
        tmp = Lx + Ly
        Lx = Ly
        Ly = tmp
    print(Ly)

Submission status: Accepted

Solution code:
n=int(input())

b=2

e=2
r=1

for i in range(n):
    if b%2==0:
        e=e+r
        b=b+1
    elif b%2==1:
        r=r+e
        b=b+1
    f=e
    g=r

if f>g:
    print(g)
elif f<g:
    print(f)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = ryuka(N)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
luca_tbl = {}
def lucas(X):
    if X in luca_tbl:
        return luca_tbl[X]
    else:
        if X == 0:
            luca_tbl[0] = 2
            return 2
        elif X == 1:
            luca_tbl[1] =1
            return 1
        else:
            luca_tbl[X] = lucas(X-1)+lucas(X-2)
            return lucas(X-1)+lucas(X-2)
            
print(lucas(N))

Submission status: Accepted

Solution code:
N = int(input())
L = [2,1]
def Lucas(n):
    if n < len(L):
        return L[n]
    L.append(Lucas(n-1) + Lucas(n-2))
    return L[n]
print(Lucas(N))

Submission status: Accepted

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

n = int(input())
print(l[n])

Submission status: Accepted

Solution code:
#coding:utf-8                                                                   

L = [2, 1]

N = int(raw_input())

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

print L[N]

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())
n += 1
ln0 = 2
ln1 = 1
if n == 0:
    print(ln0)
elif n==1:
    print(ln1)
else:
    for i in range(n-2):
        now = ln1
        ln1 = ln1+ln0
        ln0 = now
    print(ln1)

Submission status: Accepted

Solution code:
n = int(input())

A = 1
B = 2
C = 0
for i in range(n-1):
    C = A + B
    B = A
    A = C
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    print(C)

Submission status: Accepted

Solution code:
N = int(input())
l_im2, l_im1, l_i = 2, 1, 1
for i in range(2, N + 1):
	l_i = l_im1 + l_im2
	l_im1, l_im2 = l_i, l_im1
print(l_i)

Submission status: Accepted

Solution code:
n = int(input())

lf = 2
ls = 1
for _ in range(n-1):
    lf, ls = ls, lf + ls

print(ls)

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

if N == 1:
  print(1)
else:
  while i <= N:
    c = a + b
    a = b
    b = c
    i = i + 1

  print(c)

Submission status: Accepted

Solution code:
N = int(raw_input())
lis = [None]*87
lis[0] = 2
lis[1] = 1
for i in xrange(85):
	lis[i+2] = lis[i+1] + lis[i]
print lis[N]

Submission status: Accepted

Solution code:
l = [2, 1]
def a(N): 
    global l
    if(N == 0):
        return 2
    if(N == 1):
        return 1
    if(len(l) > N):
        return l[N]
    ans = a(N - 1) + a(N - 2)
    l.append(ans)
    return ans
    
N = input()
print a(N)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__=='__main__':
    main()