Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

C++: #include<iostream>
using namespace std;

int main()
{
    int a = 1, b = 1, c = 0, n;
    cin >> n;
    if ( n == 0 || n == 1 ) { cout << a << endl; return 0;}
    else while( n > 1 ) {
        c = a + b;
        a = b;
        b = c;
        n--;
    }
    cout << c << endl;

    return 0;
}

C++: #include <vector>
#include <iostream>
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef long long ll;
//A*Bの計算
mat mul(mat &A,mat &B){
	mat C(A.size(),vec(B[0].size()));
	for(int i =0;i <A.size();i++){
		for(int k =0;k <B.size();k++){
			for(int j =0;j <B[0].size();j++){
				C[i][j] =(C[i][j]+A[i][k]*B[k][j]);
			}
		}
	}
	return C;
}

//A^nの計算
mat pow(mat A,ll n){
	mat B(A.size(),vec(A.size()));
	for(int i =0;i <A.size();i++){
		B[i][i]=1;
	}
	while(n >0){
		if(n&1)B =mul(B,A);
		A =mul(A,A);
		n >>=1;
	}
	return B;
}


int main(){
	int n;
	cin>>n;
	mat A(2,vec(2));
	A[0][0]=1;
	A[0][1]=1;
	A[1][0]=1;
	A[1][1]=0;
	A =pow(A,n);
	cout <<A[1][0]<<endl;
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define INF 1<<20

struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
		for (int i = 0;i < graph[pos].size();i++) {
			int to = graph[pos][i].to;
			int cost = graph[pos][i].cost;
			if (d[pos] + cost < d[to]) {
				d[to] = d[pos] + cost;
				q.push(Node(to, d[to]));
			}

		}
	}
	cout << d[TO] << endl;
}
int partition(int A[],int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
		swap(A[i + 1], A[r]);
		return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q-1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[],int n,int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >=0  ) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n,int* v,int* ww) {
	int W[101][10001];
		for (int j = 0;j <= w;j++) {
			W[0][j] = 0;
		}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++){
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n+1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n+1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int main(){
int n;
cin >> n;
	cout << fib(n) << endl;

	return 0;
	
}

int isPrime(int x) {
	if (x <= 1) return false;
	if (x>2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}

C++: #include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    
    for(int i =2 ; i<=n ; i++){
        F[i] = F[i-1] + F[i-2];
    }
    
    cout << F[n] << endl;
  
    return 0;
}

C++: #include <cstdio>
using namespace std;

int F[50];

int fibonacci(int n) {
    if (n==0||n==1) {
        return F[n] = 1;
    }
    if (F[n] != -1) {
        return F[n];
    }

    return F[n] = fibonacci(n-1) + fibonacci(n-2);
}

int main (void) {
    int N, i;

    for(i = 0 ; i < 50 ; i ++ ) {
        F[i] = -1;
    }

    scanf("%d", &N);
    printf("%d\n", fibonacci(N));

    return 0;
}

C++: #include<iostream>
using namespace std;

int main() {
    int n; cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    for(int i = 2; i <= n; i++) {
        F[i] = F[i-1] + F[i-2];
    }
    
    cout << F[n] << endl;
    
    return 0;
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int dp[45];

int main() {
    int n;
    dp[0] = 1;
    dp[1] = 1;
    cin >> n;
    for(int i = 2; i <= n; i++) {
        dp[i] = fib(i);
    }
    cout << dp[n] << endl;
}

int fib(int n) {
    return dp[n - 1] + dp[n - 2];
}

C++: #include <iostream>
#include <vector>
using namespace std;


void fibonacci(int n){
  vector<int> fib;

  fib.push_back(1);
  fib.push_back(1);

  if(n < 2){
    cout << "1" << endl;
  }else if(n == 2){
    fib.push_back(fib.at(0) + fib.at(1));
    cout << fib.back() << endl;
  }else{
    for(int i = 2;i < n+1;i++){
      fib.push_back(fib.at(i - 2) + fib.at(i - 1));
    }
      cout << fib.back() << endl;
  }

}

int main(){
  int n;
  cin >> n;
  fibonacci(n);

  return 0;
}

C++: #include<iostream>
using namespace std;
int a[10005];
int main()
{
    int n;
    cin>>n;
    a[0]=a[1]=1;
    for(int i=2;i<=n;i++)
        {
            a[i]=a[i-1]+a[i-2];
        }
    cout<<a[n]<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
using namespace std;
long long int S[200010];


int fib(int n){
    if (n==0 || n==1){
        return 1;
    }
    
    else if(S[n]!=-1) {
        return S[n];
    }
    else{
        S[n]=fib(n-1)+fib(n-2);
        return S[n];
        
    }
    
    
}


int main(void){
    // Your code here!
    long long int N,H,W,i,j,k,ans,count,cost,tmp;
    
    long long int Ssum[200010];
    string T;
    bool flag;
    count=0;
    ans=0;
    flag=false;
    cin >>N;
    S[0]=1;
    S[1]=1;
    
    for (i=2;i<1000;i++){
        S[i]=-1;
    } 
    
    ans = fib(N);

    cout<< ans <<endl;
    

    return 0;
    
}

C++: #include <iostream>
using namespace std;

int fib(int n, int a, int b);

int main()
{
	int n;
	cin >> n;
	cout << fib(n - 1, 1, 1) << endl;
	return (0);
}


int fib(int n, int a, int b){
	if (n != 0){
		fib(n - 1, a + b, a);
  }
	return (a);
}

C++: #include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
// 0 -> 1
// 1 -> 1
// 2 -> 2
// 3 -> 3
int main() {
  int n;
  int dp[44] = {};
  cin >> n;
  dp[1] = dp[0] = 1;

  for(int i = 2; i <= n; i++) {
    dp[i] = dp[i-1] + dp[i-2];
  }
  cout << dp[n] << endl;
}

C++: #include "bits/stdc++.h"
using namespace std;
int d;
int dd[50];
int fib(int a){
	if(a==0||a==1)return dd[a]=1;
	if(dd[a]!=-1)return dd[a];
	return fib(a-1)+fib(a-2);
}

int main() {
int c;
cin>>c;
for (int i = 0; i < 50; ++i) {
	dd[i]=-1;
}

cout<<fib(c)<<endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int fib(int n) {
    int a = 1;
    int b = 1;

    for (int i = 0; i < n-1; ++i) {
        int tmp = a;
        a = b;
        b += tmp;
    }
    return b;
}

int main() {
    int n;
    cin >> n;

    cout << fib(n) << endl;

    return 0;
}