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: Wrong Answer

Solution code:
N = int(input())
res = [0 for i in range(1000)]
res[1] = 2
res[2] = 1
def lucas(N):
	for i in range(3, N):
		res[i] = res[i - 1] + res[i - 2]
	return res[N]

print(lucas(N))

Submission status: Wrong Answer

Solution code:

def lucas(x):
  list = []
  list.append(2)
  list.append(0)
  i = 2
  while i <= x:
    list.append(list[i-1]+list[i-2])
    i += 1
  return list
      
 
if __name__ == '__main__':
  inputstr = input()
  num = int(inputstr)
  list = lucas(num)
  ans = list[num]
  print(ans,flush=True)

Submission status: Wrong Answer

Solution code:
N = int(input())
pre = 0
ans = 0

def luca(n):
  pre = 1
  ans = 3
  if n == 2:
    return 4
  elif n == 1:
    return 1
  elif n == 0:
    return 2
  else:
    for i in range(n - 2):
      temp = ans
      ans = pre + ans
      pre = temp
    return ans

print(luca(N))

Submission status: Wrong Answer

Solution code:
N = int(input())
pre1 = 1
luca = 3
if N == 2:
  print(4)
elif N == 1:
  print(1)
elif N == 0:
  print(2)
else:
  for i in range(N - 2):
    temp = luca
    luca = pre1 + luca
    pre1 = temp
    
  print(luca)

Submission status: Wrong Answer

Solution code:
N = int(input())
pre1 = 1
luca = 3
for i in range(N - 2):
  temp = luca
  luca = pre1 + luca
  pre1 = temp
  
print(luca)

Submission status: Wrong Answer

Solution code:
n = input()
l = [0]*90
l[0] = 2
l[1] = 1
if n == 2 or n == 1:
    print(l[n-1])
else:
    for x in range(2,n+1):
        l[x] = l[x-1] + l[x-2]
        #print(l[x])
    print(l[n])

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    lucas(3, 1, 3, N)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        print (2)
        exit()
    if max_counter == 2:
        print (1)
        exit()
    if counter <= max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        print (a)
        exit()

if __name__ == '__main__':
    N = input()
    if re.match('^[1-9]{1,}$', N):
        solution(int(N))
    exit()

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    lucas(3, 1, 3, N)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        print (2)
        exit()
    if max_counter == 2:
        print (1)
        exit()
    if counter <= max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        print (a)
        exit()

if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))
    exit()

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    
    lucas(3, 1, 3, N)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        print (2)
        exit()
    if max_counter == 2:
        print (1)
        exit()
    if counter < max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        print (a + prev_a)
        exit()

if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))
    exit()

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    
    lucas(3, 1, 3, N)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        print (2)
        exit()
    if max_counter == 2:
        print (1)
        exit()
    if counter < max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        print (a + prev_a)
        exit()
        return (a + prev_a)



if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    
    lucas(3, 1, 3, N)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        return 2
    if max_counter == 2:
        return 1
    if counter < max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        print (a + prev_a)
        exit()
        return (a + prev_a)



if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    
    n = lucas(3, 1, 3, N)
    print (n)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        return 2
    if max_counter == 2:
        return 1
    if counter < max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        return (a + prev_a)



if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))

Submission status: Wrong Answer

Solution code:
import re

def solution(N):
    if (N < 1 or N > 86):
        exit()
    
    n = lucas(3, 1, 3, N)
    # print (n)

def lucas(a, prev_a, counter, max_counter):
    if max_counter == 1:
        return 2
    if max_counter == 2:
        return 1
    if counter < max_counter:
        counter = counter + 1
        ans = a + prev_a
        lucas(ans, a, counter, max_counter)
    else:
        return (a + prev_a)



if __name__ == '__main__':
    N = input()
    if re.match('^[0-9]{1,}$', N):
        solution(int(N))

Submission status: Wrong Answer

Solution code:

L0 = 2
L1 = 1

N = int(input())

L = L1 + L0
for i in range(N - 2):
  
  L0 = L1
  L1 = L
  L = L1 + L0

print(L)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = str, input()
num = int(N[1])

L0 = 2
L1 = 1
x = 0
for i in range(1, num):
    x = L1 + L0
    L0 = L1
    L1 = x

print(x)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = str, input()
num = int(N[1])

L0 = 2
L1 = 1
x = 0
for i in range(2, num):
    x = L1 + L0
    L0 = L1
    L1 = x

print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
l0 = 0
l1 = 0
if N == 1:
    print(2)
elif N == 2:
    print(1)
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: Wrong Answer

Solution code:
a = int(input())
R0 = 3
R1 = 2
R2 = 1
R = int((a-1)/3)
if a == 1:
  print("2")
elif a == 2:
  print("1")
elif a == 3:
  print("3")
else:
  for i in range(R):
    R1 = R2+R0
    R2 = R0+R1
    R0 = R1+R2
  if a%3 == 0:
    R1 = R2+R0
    print(R1)
  elif a%3 == 1:
    print(R2)
  else:
    print(R0)

Submission status: Wrong Answer

Solution code:
a = int(input())
R0 = 2
R1 = 1
R2 = 3
R = int((a-1)/3)
if a == 1:
  print("2")
elif a == 2:
  print("1")
elif a == 3:
  print("3")
else:
  for i in range(R):
    R0 = R1+R2
    R1 = R2+R0
    R2 = R0+R1
  if a%3 == 0:
    print(R0)
  elif a%3 == 1:
    print(R1)
  else:
    print(R2)

Submission status: Wrong Answer

Solution code:

n = int(input()) +1

ans = 4
pre = 1
prepre = 2

if n == 1:
    ans = 1
elif n == 2:
    ans = 3
elif n == 3:
    ans = 4
else:
    for n in range(n - 4):
        ans += pre + prepre
        a = prepre
        prepre = pre
        pre = pre + a

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())


def fibn(a, b, k, n):
    if k < n:
        return fibn(b, a+b, k+1, n)
    else:
        return a+b

print(fibn(2,1,2,N))

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 1:
    print(2)
elif N == 2:
    print(1)
else:
    sub = [2, 1]
    for i in range(N - 3):
        if i % 2:
            sub[0] = sum(sub)
        else:
            sub[1] = sum(sub)
    if N % 2:
        print(sub[0] + 2 * sub[1])
    else:
        print(sub[1] + 2 * sub[0])

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(C)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

N = int(raw_input())

a, b, c = 2, 1, 3

if N == 1:
    print a
elif N == 2:
    print b

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

Submission status: Wrong Answer

Solution code:
a = int(input())
R0 = 2
R1 = 1
R2 = 1
R = int(a/3)
if a == 1:
  print("2")
elif a == 2:
  print("1")
else:
  for i in range(R):
    R2 = R0+R1
    R0 = R1+R2
    R1 = R2+R0
  if a%3 == 0:
    print(R2)
  elif a%3 == 1:
    print(R0)
  else:
    print(R1)

Submission status: Wrong Answer

Solution code:
num = list(map(int, input().split()))
a = [1,2]
for i in range(86):
 temp = a[i] + a[i+1]
 a.append(temp)

ans = int(num[0])
print(a[ans])

Submission status: Wrong Answer

Solution code:
a = int(input())
R0 = 2
R1 = 1
R2 = 1
R = int((a+1)/3)
if a == 1:
  print("2")
elif a == 2:
  print("1")
else:
  for i in range(R):
    R2 = R0+R1
    R0 = R1+R2
    R1 = R2+R0
  if a%3 == 0:
    print(R2)
  elif a%3 == 1:
    print(R0)
  else:
    print(R1)

Submission status: Wrong Answer

Solution code:
num = int(input())

zero = 2
one = 1

res = 0
for i in range(num-1):
    res = zero + one
    zero = one
    one = res
if num < 3:
    print(1 if num ==2 else 2)
else:
    print(res)

Submission status: Wrong Answer

Solution code:
import functools


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

print(f(5))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=input()

L0=2
L1=1
L=0
for i in range(N-1):
	L=L0+L1
	L0=L1
	L1=L

print L

Submission status: Wrong Answer

Solution code:
num = int(input())

zero = 2
one = 1

res = 0
for i in range(num-1):
    res = zero + one
    zero = one
    one = res
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def hoge(L, N):
    a, b = 2, 1
    ans = 0
    for i in range(N-1):
        L.append(L[-1] + L[-2])
    print(L[-1])


N = int(input())
L = [2, 1]
if N < 2:
    print(sum(L[:N+1]))
else:
    hoge(L, N)

Submission status: Wrong Answer

Solution code:
#http://abc079.contest.atcoder.jp/
# -*- coding: utf-8 -*-

n = int(input())

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

print(max(ryuka))

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def p(n):
    d = {0:2,1:1}
    if n in d:
        return d[n]
    d[n]= p(n-1)+p(n-2)
    return d[n]
print(p(n))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def p(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    return p(n-1)+p(n-2)
print(p(n))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
def luca(n):
  if n == 0:
    return 2
  if n == 1:
    return 1
  return luca(n-1) + luca(n-2)
print(luca(n))

Submission status: Time Limit Exceeded

Solution code:
def ryuka(n):
    a = 2
    b = 1
    if n == 0:
        return a
    elif n == 1:
        return b
    else:
        return ryuka(n-1)+ryuka(n-2)
n = int(input())
print(ryuka(n))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
k={}
def y(p):
  if p in k.keys():
    return k[p]
  if p == 0:
    return 2
  elif p == 1:
    return 1
  else:
    return y(p-2)+y(p-1)
print(y(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(lucas(n))

Submission status: Time Limit Exceeded

Solution code:
def luka(i):
    if i==0:
        return 2
    if i==1:
        return 1
    return luka(i-1)+luka(i-2)

N=int(input())
print(luka(N))

Submission status: Time Limit Exceeded

Solution code:
def lucas(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        return lucas(i - 1) + lucas(i - 2)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def ryuka(N):    
    if N == 0:
        return 2
    elif N == 1:
        return 1
    else:
        N = ryuka(N-1) + ryuka(N-2)
        return N

print(ryuka(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = [2, 1]
i = 2
a = 0
while True:
    a = l[i-1]+l[i-2]
    l.append(a)
    if i == n: break
    i+=1
print(a)

Submission status: Time Limit Exceeded

Solution code:
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: Time Limit Exceeded

Solution code:
n = int(input())
l = [2, 1]
i = 0
while i < n:
  l.append(l[-1] + l[-2])
print(l[n-2])

Submission status: Time Limit Exceeded

Solution code:
#ABC-79-B
from functools import lru_cache

n = int(input())

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

print(lucas(n+1))

Submission status: Time Limit Exceeded

Solution code:
def luca(n):
    if n==0:
        return 2
    elif n == 1:
        return 1
    else:
        return luca(n-1)+luca(n-2)

N = int(input())

print(luca(N))

Submission status: Time Limit Exceeded

Solution code:
n =int(input())

def main(i):
  if i == 0:
    return 2
  elif i == 1:
    return 1
  else:
    return main(i-1)+main(i-2)

print(main(n))

Submission status: Time Limit Exceeded

Solution code:
def l_num(n):
  if n==0:
    return 2
  elif n==1:
    return 1
  else :
    return l_num(n-1)+l_num(n-2)


n=int(input())
print(l_num(n))

Submission status: Time Limit Exceeded

Solution code:
# coding:utf-8

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


def main():
    n = int(input())
    print(lucas(n))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def luca(N):
  if N>=2:
    return luca(N-2)+luca(N-1)
  if N==1:
    return 1
  if N==0:
    return 2
  
print(luca(N))

Submission status: Time Limit Exceeded

Solution code:
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: Time Limit Exceeded

Solution code:
N = int(input())

#for i in range(N+1):
    

def L(i):
    if i == 0:
        return 2
    if i == 1:
        return 1
    else:
        return L(i-1) + L(i-2)

print(L(N))

Submission status: Time Limit Exceeded

Solution code:
lu = [2, 1]

def l(x):
  if len(lu) > x:
    return lu[x]
  else:
    return l(x-1) + l(x-2)
  
print(l(int(input())))

Submission status: Time Limit Exceeded

Solution code:
def func(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        return func(i-1)+func(i-2)

n = int(input())
print(func(n))

Submission status: Time Limit Exceeded

Solution code:
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: Time Limit Exceeded

Solution code:
def lucas(n):
    if n>=2:
        return lucas(n-1)+lucas(n-2)
    if n==0:
        return 2
    if n==1:
        return 1
print(lucas(int(input())))

Submission status: Time Limit Exceeded

Solution code:
def reduce(n):
  if n == 0:
    return 2
  
  if n == 1:
    return 1
  
  return reduce(n-1) + reduce(n-2)

print(reduce(int(input())))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(calc_luca(n))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
def Lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    else:
        return Lucas(n-1)+Lucas(n-2)

def main():
    n = int(input())
    print(Lucas(n))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
def l(k):
  if k==1:
    return 1
  elif k==0:
    return 2
  else:
    return l(k-1)+l(k-2)
print(l(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def ryuka(N):
  if N == 1:
    return 1
  if N == 0:
    return 2
  return ryuka(N-1) + ryuka(N-2)


print(ryuka(N))

Submission status: Time Limit Exceeded

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

import sys

# import itertools
# import numpy as np

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


def luner(n):
    if n == 0:
        return 2
    if n == 1:
        return 1

    return luner(n - 1) + luner(n - 2)


N = int(readline())
print(luner(N))

Submission status: Time Limit Exceeded

Solution code:
def a(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return a(n - 1) + a(n - 2)
print(a(int(input())))

Submission status: Time Limit Exceeded

Solution code:
import sys

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

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

def Ryuka(n):
  if n==0:
    return 2
  elif n==1:
    return 1
  else:
    return Ryuka(n-1)+Ryuka(n-2)
print(Ryuka(N))

Submission status: Time Limit Exceeded

Solution code:
def lu(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    n = lu(n - 1) + lu(n - 2)
    return n


print(lu(int(input())))

Submission status: Time Limit Exceeded

Solution code:
def L(i):
  if i == 0:
    return 2
  if i == 1:
    return 1
  return L(i - 1) + L(i - 2)

print(L(int(input())))

Submission status: Time Limit Exceeded

Solution code:
def lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    return lucas(n - 1) + lucas(n - 2)
    
n = int(input())
print(lucas(n))

Submission status: Time Limit Exceeded

Solution code:
def Lucas(L):
    if L == 0:
        return 2
    elif L == 1:
        return 1
    else: return Lucas(L-1)+ Lucas(L-2)

N = int(input())
print(Lucas(N))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
l = [2,1]
i = 2
while True:
  l.append(l[i-2]+l[i-1])
  if(i==N):
    break
  i += 1
print(l[-1])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def Lucas(i):
    if i == 0:
        return 2
    if i == 1:
        return 1
    return Lucas(i-1) + Lucas(i-2)
print(Lucas(n))

Submission status: Time Limit Exceeded

Solution code:
def Lucas(n):
	if n==0:
		return 2
	elif n==1:
		return 1
	else:
		return Lucas(n-1)+Lucas(n-2)

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

Submission status: Time Limit Exceeded

Solution code:
def ryuka(n):
    if n==0:
        return 2
    if n==1:
        return 1
    return ryuka(n-1)+ryuka(n-2)    
print(ryuka(int(input())))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

def luca(n):
	if n==0:
		return 2
	if n==1:
		return 1
	return luca(n-1)+luca(n-2)

print(luca(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
cnt = 1
l = [2, 1]
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: Time Limit Exceeded

Solution code:
def lucas(i):
  if i == 0:
    return 2
  elif i == 1:
    return 1
  else:
    return lucas(i-1) + lucas(i-2)
  
N = int(input())
print(lucas(N))

Submission status: Time Limit Exceeded

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

    return ryuka(n-1) + ryuka(n-2)
print(ryuka(n))

Submission status: Time Limit Exceeded

Solution code:
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: Time Limit Exceeded

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

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

    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: Time Limit Exceeded

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

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

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

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

    print(ans)
    
if __name__ == "__main__":
    solve()

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(1000000000)
N = int(input())

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: Time Limit Exceeded

Solution code:
def lucas(l: int) -> int:
    if l == 0:
        return 2
    elif l == 1:
        return 1
    else:
        return lucas(l-1) + lucas(l-2)
        
N = int(input())
print(lucas(N))

Submission status: Time Limit Exceeded

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 i == 0:
        print(2)
        exit()
    elif i == 1:
        print(1)
        exit()
    else:
        i += 1

Submission status: Time Limit Exceeded

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()
    else:
        i += 1

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


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


print(Lucas(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def f(i):
  if i >= 2:
    li = f(i-1) + f(i-2)
  elif i == 1:
    li = 1
  elif i == 0:
    li = 2
  return li

print(f(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def Luca(x):
    if x==0:
        return 2
    elif x==1:
        return 1
    else:
        return Luca(x-1)+Luca(x-2)

print(Luca(N))

Submission status: Time Limit Exceeded

Solution code:
import sys
from collections import Counter

n = int(input())
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: Time Limit Exceeded

Solution code:
def Luca(n):
  if n == 0:
    return 2
  elif n == 1:
    return 1
  else:
    return Luca(n-1)+Luca(n-2)
N = int(input())
print(Luca(N))

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
def lucas(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return lucas(n-1)+lucas(n-2)

print(lucas(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

print(sol(N))

Submission status: Time Limit Exceeded

Solution code:
#79
def R(n):
    if(n<0):
        return 0
    elif(n==0):
        return 2
    elif(n==1):
        return 1
    else:
        return R(n-1) + R(n-2)

n = int(input())
print(R(n))

Submission status: Time Limit Exceeded

Solution code:
import sys

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

def main():
    input = sys.stdin.readline
    N = int(input())
    print(lucas(N))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def solve(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return solve(n-1)+solve(n-2)
print(solve(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(calcLucas(n))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def calcLucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    return calcLucas(n-1) + calcLucas(n-2)

print(calcLucas(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


def lc():
    l0, l1 = 2, 1
    while 1:
        yield l0 + l1
        l0, l1 = l1, l0 + l1


for i, n in enumerate(lc()):
    if i == N - 2:
        print(n)
        break

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


def rk():
    l0, l1 = 2, 1
    while 1:
        yield l0 + l1
        l0, l1 = l1, l0 + l1


for i, n in enumerate(rk()):
    if i == N - 2:
        print(n)

Submission status: Time Limit Exceeded

Solution code:

num=int(input())

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

print(lucas(num))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def f(i):
    if i==0:
        return 2
    elif i==1:
        return 1
    else:
        return f(i-1)+f(i-2)
print(f(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def LucaNum(j):
	if j == 0:
		return 2
	elif j == 1:
		return 1
	else:
		return LucaNum(j-1)+LucaNum(j-2)
		
print(LucaNum(N))

Submission status: Time Limit Exceeded

Solution code:

N = int(input())
def luca(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return luca(n-1)+luca(n-2)
print(luca(N))

Submission status: Time Limit Exceeded

Solution code:
k = int(input())
def dfs(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return dfs(n-1)+dfs(n-2)
print(dfs(k))

Submission status: Time Limit Exceeded

Solution code:
def ans(N):
    if N==0:
        return 2
    elif N==1:
        return 1
    else:
        return ans(N-1)+ans(N-2)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def Lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        one = Lucas(n-1)
        two = Lucas(n-2)
        return one+two
print(Lucas(N))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def Lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return Lucas(n-1)+Lucas(n-2)
print(Lucas(N))

Submission status: Time Limit Exceeded

Solution code:
def cal(n):
    if n==0:return 2
    elif n == 1:return 1
    else: return cal(n-1)+cal(n-2)
a = int(input())
print(cal(a))

Submission status: Time Limit Exceeded

Solution code:
buf=[-1 for i in range(90)]
def ryuka(N):
    global buf
    if buf[N]!=-1:
        return buf[N]
    else:
        if N==1:
            return 1
        elif N==0:
            return 2
        else:
            return ryuka(N-1)+ryuka(N-2)

N=int(input())
print(ryuka(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def luca(n):
    if n == 0:
        return 2
    elif n ==1:
        return 1
    else:
        a = luca(n-1)
        b = luca(n-2)
        c = a+b
        return c
 
if __name__ == "__main__":
    print(luca(n))

Submission status: Time Limit Exceeded

Solution code:
def luka(n):
  if n==0:
    return 2
  if n==1:
    return 1
  return luka(n-1)+luka(n-2)

n = int(input())
print(luka(n))

Submission status: Time Limit Exceeded

Solution code:
def lucas(n):
  if n == 0:
    return 2
  elif n == 1:
    return 1
  else:
    a = lucas(n-1)
    b = lucas(n-2)
    c = a + b
    return c

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

Submission status: Time Limit Exceeded

Solution code:
def lukas(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return lukas(n-1)+lukas(n-2)
n=int(input())
print(lukas(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

print(Lucas(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l0 = 2
l1 = 1
if n == 0:
    print(l0)
if n == 1:
    print(l1)

l_prev = l0
l_next = l1

i = 2
while True:
    l_new = l_prev + l_next
    if n == i:
        print(l_new)
        break
    l_prev = l_next
    l_next = l_new
    i += 1

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

dp=[-1 for _ in range(N+1)]
def Lu(n):
    if n==0:
        rec=2
    elif n==1:
        rec=1
    elif dp[n]!=-1:
        return dp[n]
    else:
        return Lu(n-1)+Lu(n-2)
    dp[n]=rec
    return rec
print(Lu(N))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

def Lu(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return Lu(n-1)+Lu(n-2)
print(Lu(N))