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 <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 99999999999999999;


long long int N,dp[55]={};
int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    dp[0]=1;
    dp[1]=1;
    for(long long int i = 2; i < 50; i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[N]<<endl;
}

C++: #include<stdio.h>

int main(void){
    int i, n, F[45] = {};
    scanf("%d", &n);

    F[0] = 1;
    F[1] = 1;

    for(i=2;i<=n;i++) F[i] = F[i-2] + F[i-1];

    printf("%d\n", F[n]);

    return 0;
}

C++: // input: aldsalds1_10_a.in
#include<iostream>
#define MAX_N 45
#define NIL -1
using namespace std;

int dp[MAX_N];

int fib(int n) {
  if(n == 0 || n == 1)
    return 1;

  if(dp[n] != NIL)
    return dp[n];

  int v = fib(n-1) + fib(n-2);
  dp[n] = v;

  return v;
}

int main() {
  for(int i=0; i<MAX_N; i++)
    dp[i] = NIL;

  int x;
  cin >> x;

  cout << fib(x) << endl;
}

C++: #include<iostream>
#include<set>
#include<queue>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

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

    return 0;
}

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

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A&lang=ja
//Fibonacci Number
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll n; cin>>n;
    vector<ll> dp(max(n+1,2LL));
    dp[0]=1;
    dp[1]=1;    
    FOR(i,2,n+1){
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
    return 0;
}

C++: // #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define vv vector< vector< int > >
#define ll long long
#define ALL(a) (a).begin(), (a).end()
const long long mod = 1000000000 + 7;
const long long INF = 9e18;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b){if (b == 0) return a;return gcd(b, a % b);}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};


int main(){
    int n;
    cin >> n;
    vector<int> dp(n+1);
    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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <climits>

using namespace std;
int T[100];
int fibo(int n) {
    if(T[n] != 0) return T[n];
    T[n] = fibo(n-1) + fibo(n-2);
    return T[n];
}
int main() {
    T[0] = T[1] = 1;
    int n;
    cin >> n;
    cout << fibo(n) << endl;
}

C++: #include <iostream>
#include <vector>

int Fibonacci( int n, std::vector<int>& v ){
    if( !n || n == 1 ){
        if( !v[n] ){
            v[n] = 1;
        }
        return v[n];
    }else{
        if( !v[n] ){
            v[n] = Fibonacci( n-1, v ) + Fibonacci( n-2, v );
        }
        return v[n];
    }
}

int main(){
    int n;
    std::cin.tie(0);
    std::cin >> n;

    std::vector<int> fib(n+1, 0);
    
    std::cout << Fibonacci( n, fib ) << std::endl;
}

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 < 50; i++) f[i] = f[i-1] + f[i-2];
    cout << f[n] << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};
vector<long long> ans(50,-1);
long long fib(int n){
    if(ans[n]!=-1) return ans[n];
    if(n==0 || n==1) return ans[n] = 1;
    return ans[n] = fib(n-1)+fib(n-2);
}
int main(void){
    int n;cin >> n;
    cout << fib(n) << endl;
    return 0;
}

C++: #include <stdio.h>

int fi(int a) {
  return (a == 0 || a == 1) ? 1 : fi(a - 1) + fi(a - 2);
}

int main(void) {
  int n;
  scanf("%d", &n);
  printf("%d\n", fi(n));
  return 0;
}