Go: // AOJ ALDS1_10_A: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

package main

import (
	"fmt"
)

func fibonacci(n int) int64 {
	f := []int64{1, 1}
	for i := 2; i <= n; i++ {
		f = append(f, f[i-2] + f[i-1])
	}
	return f[n]
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	fmt.Println(fibonacci(n))
}

C++: /*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int fbc[200000];

int fb(int a)
{
	//if(fbc[a]>0)
	//return fbc[a];
	
	
	if(a<2)
	return 1;
	
	//fbc[a]=fb(a-1)+fb(a-2);
	return fb(a-1)+fb(a-2);
	
}

int main()
{
	//iniarr(fbc,200000);
	int a;
	scd(a);
	printf("%d\n",fb(a));	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int F[50];
    F[0]=1;
    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>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep1(i, s, n) for (int i = (s); i >= (n); i--)
#define print_array(ary, size) cout << ary[0]; rep1(i, 1, size - 1) cout << ' ' << ary[i]; cout << endl;
typedef long long ll;
typedef unsigned long long ull;

int a[45];

int main()
{
	int n;

	a[0] = 1;
	a[1] = 1;
	rep1(i, 2, 44) a[i] = a[i - 1] + a[i - 2];

	cin >> n;
	cout << a[n] << endl;

	return 0;
}

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

// ?????£??????????????°???????±???????
int fibonacci(int n);
int fib[45];

int main()
{
    int num;
    cin >> num;
    int res = 0;

    res = fibonacci(num);
    cout << res << endl;

    //getchar();
    //getchar();

    return 0;
}

int fibonacci(int n)
{
    if(n == 0 || n == 1) { return 1; }
    //return fibonacci(n - 1) + fibonacci(n - 2);
    if(fib[n]) { return fib[n]; }
    return fib[n] = fibonacci(n-1) + fibonacci(n-2);
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

vector<int> f(100, -1);

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

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

C++: =

C++: #include<iostream>

using namespace std;

int n;
int dp[44];

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

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

int main()
{
	int x = 1, y = 1, n, value = 0;
	cin >> n;

	if (n == 0 && n == 1) value = 1;
	else
	{
		while (n > 1)
		{
			value = x + y;
			x = y;
			y = value;
			n--;
		}
	}
	cout << value << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;

int memo[100];

int fibonacci(int n) {
    if (memo[n] != -1) {
        return memo[n];
    }
    if (n == 0) { return 1; }
    if (n == 1) { return 1; }
    memo[n] = fibonacci(n - 1) + fibonacci(n - 2);
    return memo[n];
}

int main() {
    int n;
    cin >> n;
    fill(memo, memo + 100, -1);
    cout << fibonacci(n) << endl;
}

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 <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int A[50];
int fib(int n){
	if(n==1 || n==0) A[n]=1;
	else A[n]=fib(n-1)+fib(n-2);
	return A[n];
}

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

C++: #include <iostream>
#include <string>
#define MAX 44
using namespace std;

int main(int argc, char* argv[]) {
    int n;
    int F[MAX+1];
    cin >> n;
    F[0] = 1;
    F[1] = 1;
    for (int i = 2; i <= n; i++){
        F[i] = F[i-2] + F[i-1];
    }
    cout << F[n] << "\n";
    return 0;
}

C++: #include <iostream>

using namespace std;

#define MAX 45
int array[MAX];

void setNumber(int n) {
  array[0] = 1;
  array[1] = 1;
  for(int i = 2; i < n + 1; i++) {
    array[i] = array[i - 1] + array[i - 2];
  }
}


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

  setNumber(n);
  cout << array[n] << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int n;
int fib(int x) {
    if (x == 0) return 1;
    if (x == 1) return 1;
    return fib(x-1) + fib(x-2);
}
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int dp[50];

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

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

C++: import numpy as np
import sys
f = [-1 for i in range(45)]
f[0] = f[1] = 1

def fib(n):
    global f
    for i in range(2,n+1):
        f[i] = f[i - 1] + f[i - 2]
        #print(i,f[i])
    return f[n]

if __name__ == "__main__":
    n = input("input number: ")
    n = int(n)
    #print(type(n))
    print(fib(n))