def fibonacci(n):
    if n == 1:
        return 1
    if n == 0:
        return 0

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

if __name__ == '__main__':
    n = int(input())
    value = fibonacci(n)
    print (value)
#include <stdio.h>

int main(void)
{
	int A = 0;
	int B = 0;
	
	scanf("%d %d", &A, &B);
	
	if (A < 1 or ((B > 10000) and (B <= 0)))
		return 0;
	
	printf("%d\n", A+B);
	printf("%d\n", A-B);
	printf("%d\n", A*B);
	printf("%d\n", A/B);
	printf("%d\n", A%B);
	
	return 0;
}
import sys
from collections import deque

input = sys.stdin.readline
N = int(input())
queue = deque([])

for i in range(N):
    command = input().split()
    
    if command[0] == "push_front":
        queue.appendleft(int(command[1]))
    
    elif command[0] == "push_back":
        queue.append(int(command[1]))
    
    elif command[0] == "pop_front":
        if queue:
            print (queue.popleft())
        else:
            print (-1)

    elif command[0] == "pop_back":
        if queue:
            print (queue.pop())
        else:
            print (-1)
    
    elif command[0] == "size":
        print (len(queue))
    
    elif command[0] == "empty":
        if queue:
            print (0)
        else:
            print (1)

    elif command[0] == "front":
        if queue:
            print (queue[0])
        else:
            print (-1)
        
    elif command[0] == "back":
        if queue:
            print (queue[-1])
        else:
            print (-1)
def dec_to_bin(N):
    global binary
    if N == 0:
        return
    
    Q, R = divmod(N, 2)
    binary.append(str(R))
    dec_to_bin(Q)
    
N = int(input())
binary = []
dec_to_bin(N)
print ("".join(list(reversed(binary))), end='')
import sys
from collections import deque

def push(X) -> None:
    stack.appendleft(X)


def pop() -> None:
    if not stack:
        print (-1)
    else:
        print (stack.popleft())


def size() -> None:
    print (len(stack))


def empty() -> None:
    if not len(stack):
        print (1)
    else:
        print (0)


def top() -> None:
    if not stack:
        print (-1)
    else:
        print (stack[0])
    

if __name__ == "__main__":
    N = int(input())
    stack = deque()

    command_dict = {
        'push': push,
        'pop' : pop,
        'size' : size,
        'empty': empty,
        'top': top
    }
    
    for _ in range(N):
        command = sys.stdin.readline().split()
        if len(command) > 1:
            command_dict[command[0]](int(command[1]))
        else:
            command_dict[command[0]]()
import sys
input = sys.stdin.readline

fibo_nums = [0, 1]
for i in range(10000):
    fibo_nums.append(sum([fibo_nums[-1], fibo_nums[-2]]))
    
n = int(input())
print (fibo_nums[n])
import sys
from itertools import permutations

def get_permutations(): 
    if len(picked) == N:
        _sum = 0
        for i in range(2, len(picked) +1):
            _sum += abs(picked[i-2] - picked[i-1])
        sums.append(_sum)
        return

    for i in range(len(A)):
        if visited[i]:
            continue

        visited[i] = 1
        picked.append(A[i])
        get_permutations()
        picked.pop()
        visited[i] = 0


def get_max_value(A): # Solution 1
    _main = 0
    all_cases = list(permutations(A, len(A)))
    for case in all_cases:
        _sub = 0
        for i in range(2, len(case)+1):
            _sub += abs(case[i-2] - case[i-1])
        _main = max(_sub, _main)
    return _main

if __name__ == "__main__":
    # Common
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))

    # Solution 1
    # _sum = get_max_value(A)
    # print (_sum)

    # Solution 2
    picked, sums = [], []
    visited = [0] * N
    get_permutations()
    print(max(sums))
#include <iostream>

using namespace std;

int main(void)
{
	int N = 0;
	int Max = 0;
	int Min = 0;
	int Temp = 0;
	
	cin >> N;
	
	if (N>=1 and N<=1000000)
	{
		int Array[N] = {0,};
		
		for (int i=0; i<N; i++) // 입력 loop 
		{
			cin >> Array[i];
		}
		
		Max = Array[0];
		Min = Array[0];
		
		for (int j=0; j<N; j++) // Loop for finding Max
		{
			if (Array[j] >= Max)
			{
				Max = Array[j];
			}
		}
		
		for (int k=0; k<N; k++) // Loop for finding Min
		{
			if (Min >= Array[k])
			{
				Min = Array[k];
			}
		}
		
	}
	
	cout << Min << ' ' << Max << endl;
	
	return 0;
}
import sys
input = sys.stdin.readline
A = list(map(int, input().split()))
print (sorted(A)[1])
import sys
input = sys.stdin.readline

N = int(input())
members = []
for _ in range(N):
    age, name = map(str, input().split())
    age = int(age)
    members.append((age, name))

members.sort(key=lambda x: x[0])
for i in members:
    print (*i)

+ Recent posts