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

def fib(x): # xは0以上の整数
    a, b = 2, 1
    for _ in range(x):
        a, b = b, a+b
    return(a)

ans = fib(N)

print(ans)

Submission status: Accepted

Solution code:
# ABC079b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())

memo = {}


def getLuca(nu):
    if (nu == 0):
        return 2
    if (nu == 1):
        return 1
    if (memo.get(nu) != None):
        return memo[nu]
    memo[nu] = getLuca(nu-1)+getLuca(nu-2)
    return memo[nu]


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

l = [2, 1]

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

print(l[-1])

Submission status: Accepted

Solution code:
num = list(range(100))
num[0] = 2
num[1] = 1
n = int(input())

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

print(num[n])

Submission status: Accepted

Solution code:
num = list(range(87))
num[0] = 2
num[1] = 1

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

print(num[int(input())])

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def lucas(n):
    a,b, index = 2,1,0
    while index < n:
        a,b,index = b,a+b,index+1
    return a
print(lucas(int(input())))

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    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])


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
import sys
import  math
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

Submission status: Accepted

Solution code:
a,b=2,1;exec("a,b=b,a+b;"*int(input()));print(a)

Submission status: Accepted

Solution code:
a,b=2,1
for _ in[0]*int(input()):a,b=b,a+b
print(a)

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 = 2
L_1 = 1

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

i = 1
while i < N:
    L = L_1 + L_2
    L_2 = L_1
    L_1 = L
    i += 1
print(L)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
def lucas(n):
    a,b = 2,1
    if n == 0:
        return a
    elif n == 1:
        return b
    for _ in range(n-1):
        a,b = b,a+b
    return b
print(lucas(n))

Submission status: Accepted

Solution code:
n = int(input())
table = [-1] * (n + 1)
table[0] = 2
table[1] = 1
def lucas(i):
    if table[i] != -1:
        return table[i]
    ret = lucas(i-1) + lucas(i-2)
    table[i] = ret
    return ret
print(lucas(n))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

print(L[n])

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

Submission status: Accepted

Solution code:
N = int(input())

pre, cur = 2, 1
while N - 2 >= 0 :
    pre, cur = cur, pre+cur
    N -= 1
print(cur)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n=int(input())

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

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-2]+a[i-1]

print(a[N] )

Submission status: Accepted

Solution code:
N=int(input())

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

for _ in range(1,N):
    L[0],L[1] = L[1],L[1]+L[0]
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:
n = int(input())
Li0 = 2
Li1 = 1
Lnow = 0
if n == 1:
    print(Li1)
else:
    for i in range(2,n+1):
        Lnow = Li1 + Li0
        Li0 = Li1
        Li1 = Lnow
    print(Lnow)

Submission status: Accepted

Solution code:
def main():
    N = int(input())

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    x1 = 1
    x2 = 2
    if n == 1:
        print(1)
    else:
        ans = 0
        for _ in range(n-1):
            ans = x1+x2
            t = x2
            x2 = x1
            x1 = x1 + t
        print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

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


print(lucas[-1])

Submission status: Accepted

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

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())
Ls = [2, 1]
for i in range(1, N):
  L = Ls[i]+Ls[i-1]
  Ls.append(L)
#print(Ls)
r = Ls[N]
print(r)

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

if n < 2:
    print(luc[n])
else:
    for _ in range(n - 1):
        tmp = sum(luc)
        luc = luc[1:] + [tmp]
    print(luc[1])

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:
# -*- coding: utf-8 -*-

N = int(input())
x, y = 2, 1

for i in range(N):
    x, y = y, x + y

print(x)

Submission status: Accepted

Solution code:
# input
N = int(input())

# solution
prev = [2, 1]
if N == 1:
    res = 1
else:
    for i in range(2, N+1):
        prev[0], prev[1] = prev[1], sum(prev)
    res = prev[1]

# output
print(res)

Submission status: Accepted

Solution code:
dp=[0 for _ in range(88)]

dp[0]=2
dp[1]=1

for i in range(88):
	if i>1:
		dp[i]=dp[i-1]+dp[i-2]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    memo = dict()
    def f(i):
        if i not in memo:
            if i == 0:
                memo[i] = 2
            elif i == 1:
                memo[i] = 1
            else:
                memo[i] = f(i-1) + f(i-2)
        return memo[i]
    return f(N)

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = [0] * (N + 1)
L[0] = 2
L[1] = 1

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

print(L[i])

Submission status: Accepted

Solution code:
n = int(input())
l = {}
l[0] = 2
l[1] = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n-1):
    t=b
    b=a+b
    a=t
print(b)

Submission status: Accepted

Solution code:
memo=[-1]*87
def lucas(n):

    if n==0:
        return 2
    if n==1:
        return 1
    if memo[n]!=-1:
        return memo[n]
    else:
        memo[n]=lucas(n-1)+lucas(n-2) 
        return memo[n]
print(lucas(int(input())))

Submission status: Accepted

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

else:
	for i in range(N-1):
		ans = L0 + L1
		L0 = L1
		L1 = ans
print(ans)

Submission status: Accepted

Solution code:
def fib(n):
    a, b = 2, 1
    if n == 0:
        return a
    elif n == 1:
        return b
    else:
        for i in range(n - 1):
            a, b = b, a + b
        return b

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

Submission status: Accepted

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

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:
a,b = 2,1

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

Submission status: Accepted

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


def ryuka(n):
    a, b = 2, 1
    for _ in range(n):
        a, b = b, a+b
    return a


print(ryuka(n))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
def L(n):
  if n==0:
    return 2
  elif n==1:
    return 1
  f = 2
  l = 1
  for _ in range(1,n):
    f,l = l,f+l
  return l
print(L(n),end='\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

Ans = [0] * (N+1)
Ans[0] = 2
Ans[1] = 1
hantei = [False] * (N+1)
hantei[0] = True
hantei[1] = True

def fib(n):
    if hantei[n]:
        return Ans[n]
    else:
        Ans[n] = fib(n-1) + fib(n-2)
        hantei[n] = True
        return Ans[n]

print(fib(N))

Submission status: Accepted

Solution code:
n = int(input())
l_old = 2
l_tmp = 1
l = 2

for i in range(n + 1):
    if i > 1:
        l = l_old + l_tmp
        l_old = l_tmp
        l_tmp = l
    else:
        l = l - i

print(l)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l1 = 2
l2 = 1
ans = 0
if n == 1:
    print(l2)
    exit()
for i in range(1, n):
    ans = l1 + l2
    l1 = l2
    l2 = ans
print(ans)

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())
tb = [0] * max(3, (n + 1))
tb[0] = 2
tb[1] = 1

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

print(tb[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:
import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def combination(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""



if __name__ == "__main__":
    L = [2, 1]
    N = int(sys.stdin.readline())
    if N == 1:
        print(1)
        exit()

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

    print(L[N])

Submission status: Accepted

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

def luca(N,cnt):
  L.append(L[-2]+L[-1])
  if N==cnt:
    print(L[-1])
  else:
    cnt+=1
    luca(N,cnt)
N = int(input())

if N<=1:
  print(L[N])
else:
  N-=2
  cnt=0
  luca(N,cnt)

Submission status: Accepted

Solution code:
n = int(input())
def cal(a,b,count):
    tmp = 0
    while count > 1:
        count -= 1
        su = a+b
        a = b
        b = su
        tmp = su
    return tmp
if n == 1:
    print(1)
else:
    print(cal(2, 1, 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[-1])

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

Submission status: Accepted

Solution code:

n = int(input())
l0 = 2
l1 = 1
count = 2

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

for i in range(2, 86+1):
    li = l1 + l0
    if count == n:
        print(li)
        exit()

    l0, l1 = l1, li
    count += 1

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N=int(input())

ret=[]
def luca(n):
	global ret

	if n==0:
		return 2
	if n==1:
		return 1
	return ret[n-1]+ret[n-2]

for i in range(N+1):
	ret.append(luca(i))

print(ret[-1])

Submission status: Accepted

Solution code:
N=int(input())
res=[2]+[1 for _ in range(N)]

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

print(res[-1])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 1
l = [2, 1]
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    while True:
        cnt += 1
        l.append(l[len(l)-1] + l[len(l)-2])
        if cnt == n:
            print(l[len(l) - 1])
            exit()

Submission status: Accepted

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

Submission status: Accepted

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

l_0 = 2
l_1 = 1
N_array = [2,1]
l_2 = l_0+ l_1  
l_3 = l_1+ l_2
a,b = 2,1
for i in range(N-1):
  c = a+b
  N_array.append(c)
  a = c -a
  b = c 
  #a = 
#  N_array.append(b)
  
  
print(N_array[-1])

Submission status: Accepted

Solution code:
n = int(input())

l0 = 2
l1 = 1

for i in range(n - 1):
    temp = l0
    l0 = l1
    l1 += temp
print(l1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(87):
    num = 0
    num += ryuka[i]+ryuka[i+1]
    ryuka.append(num)
print(ryuka[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[-1])

Submission status: Accepted

Solution code:
N = int(input())

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

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

print(L[N])

Submission status: Accepted

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

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

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

a=2
b=1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

lLst = [0] * (N + 1)

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

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

print(l[-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(dp[N])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC079-B
def luca_memo(n):
    memo = [0] * (n+1)
    
    def luca(n):
        if n == 0:
            return 2
        if n ==1:
            return 1
        if memo[n] != 0:
            return memo[n]
        memo[n] = luca(n-2) + luca(n-1)
        return memo[n]
    return luca(n)
N = int(input())
print(luca_memo(N))

Submission status: Accepted

Solution code:
n=int(input())
a,b=2,1
for _ in [0]*n:a,b=b,a+b
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()


L = [0] * (86 + 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())
ans = 0
a = 2
b = 1
if N < 2:
  print(2 if N==0 else 1)
  exit()
for i in range(2,N+1):
  b,a = a+b,b
  
print(b)

Submission status: Accepted

Solution code:
N = int(input())
L_i2 = 2
L_i1 = 1
if N == 0:
  L_i = L_i2
elif N == 1:
  L_i = L_i1
else:
  for n in range(N-1):
    L_i = L_i1 + L_i2
    L_i2 = L_i1
    L_i1 = L_i
print(L_i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l0 = 2
l1 = 1
if n == 0:
    ans = l0
elif n == 1:
    ans = l1
else:
    for i in range(2, n + 1):
        if i % 2 == 0:
            l0 = l0 + l1
        else:
            l1 = l0 + l1
    ans = max(l0, l1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC79, B - Lucus number

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

Submission status: Accepted

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

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


dp = [-1 for _ in range(90)]

def rec(n):
    if dp[n] != -1:
        return dp[n]
    if n == 0:
        dp[n] = 2
    elif n == 1:
        dp[n] = 1
    else:
        dp[n] = rec(n - 1) + rec(n - 2)
    return dp[n]

print(rec(n))

Submission status: Accepted

Solution code:
def f(i):
    if i == 0:
        return 2

    if i == 1:
        return 1

    A = [2, 1]
    for _ in range(i - 1):
        A[0], A[1] = A[1], A[0] + A[1]
    return A[-1]


N = int(input())
print(f(N))

Submission status: Accepted

Solution code:
n = int(input())


def lucas(n):
    L0 = 2
    L1 = 1
    if n == 0:
        return L0
    if n == 1:
        return L1
    for _ in range(n-1):
        L0, L1 = L1, L0+L1
    return L1

print(lucas(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
i=int(input())
L=[0,1,1]
if i==1:
    A=1
else:
    for j in range(2,i):
        a=L[j-1]+L[j]
        L.append(a)
    A = 2*L[i-1]+L[i]

print(A)

Submission status: Accepted

Solution code:
i=int(input())
L=[0,1,1]

for j in range(2,i):
    a=L[j-1]+L[j]
    L.append(a)
A = 2*L[i-1]+L[i]
print(A)

Submission status: Accepted

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

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]
else:    
    print(l[n])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

lst = [0] * (N + 1)
def calc(N):
    if lst[N] != 0:
        return lst[N]
    if N == 0:
        lst[N] = 2
        return 2
    if N == 1:
        lst[N] = 1
        return 1
    ans = calc(N-1) + calc(N-2)
    lst[N] = ans
    return ans

print (calc(N))

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
    print (1)
else:
    L_s = 2
    L_l = 1
    for i in range(N-1):
        L_s, L_l = L_l, L_s + L_l
    print (L_l)

Submission status: Accepted

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

def lucas(num):
    a, b = 1, 2
    for i in range(num):
        a, b = a+b, a
    return b

print(lucas(n))

Submission status: Accepted

Solution code:
n = int(input())

def lucas(num):
    if n == 1:
        return 1
    else:
        a, b = 1, 2
        for i in range(num-1):
            a, b = a+b, a
        return a

print(lucas(n))

Submission status: Accepted

Solution code:
a = int(input())
b = []

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

Submission status: Accepted

Solution code:
N = int(input())
memo = {}

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

print(lucas(N))

Submission status: Accepted

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