Go: package main

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

func fib(n int) int {
	x, y := 1, 1
	for n > 0 {
		x, y = y, x+y
		n--
	}
	return x
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fib(n))
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}

C++: #include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 100000000000000000

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

int fib (int x){
    if(f[x] >= 0){
        return f[x] ;
    }
    if (x <= 1){
        return 1 ;
    }
    else {
        
        return f[x] = fib(x -1) + fib(x - 2) ;
    }

}

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

C++: #include <bits/stdc++.h>
using namespace std;
int dp[50];
int fib(int n){
if (n<=1) return 1;
if (dp[n]) return n;
return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
int n; cin>>n; cout<<fib(n)<<endl;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    u64 f[n + 1];
    f[0] = f[1] = 1;
    rep (i, n - 1)
    {
        f[i + 2] = f[i + 1] + f[i];
    }

    cout << f[n] << "\n";
    return 0;
}

C++: #include <iostream>

using namespace std;

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

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define pb(v) push_back(v)
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
#define print(var)  do{ cout << #var << " : "; view(var); } while(0)
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using P = pair<int ,int>;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;

int memo[50];

int fib(int x) {
    if (x==0 || x==1) return 1;
    int ret1, ret2;
    ret1 = (memo[x-1]==-1) ? (fib(x-1)) : memo[x-1];
    ret2 = (memo[x-2]==-1) ? (fib(x-2)) : memo[x-2];
    memo[x-1] = ret1;
    memo[x-2] = ret2;
    return ret1+ret2;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    rep(i, 50) memo[i] = -1;
    cout << fib(n) << endl;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int fib[100];
  fib[0] = 1;
  fib[1] = 1;
  for(int i = 2;i < 50;i++)fib[i] = fib[i-1] + fib[i-2];
  int n;
  cin >> n;
  cout << fib[n] << endl;
}

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

const int maxn = 50;

int n;
int a[maxn];

int main(){
	a[0] = 1;
	a[1] = 1;
	scanf("%d",&n);
	for(int i = 2;i <= n; i++)a[i] = a[i-1] + a[i-2];
	printf("%d\n",a[n]);
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    ll fib[50];
    rep(i, n+1) {
        if(i == 0 || i == 1) fib[i] = 1;
        else fib[i] = fib[i-1] + fib[i-2];
    }
    cout << fib[n] << endl;
}

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

template <typename T>
T fib(int n){
    std::vector<T> fibs{1, 1}; // using C++11
    for (int i = 2; i <= n; i++){
        fibs.push_back(fibs[i - 2] + fibs[i - 1]);
    }
    return fibs[n];
}

int main(){
    int n;
    std::cin >> n;
    std::cout << fib<int>(n) << std::endl;
}

C++: //By Vlgd
#include<bits/stdc++.h>
using namespace std;
int F[45]={0};
int f(int n){
	if (n==1||n==0) return F[n]=1;
	if (F[n]) return F[n];
	else return F[n]=f(n-1)+f(n-2);
}
main(){
	int n;scanf("%d",&n);
	printf("%d\n",f(n));
}

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

using namespace std;

int main()
{
    int n;
    
    scanf("%d", &n);
    
    vector<long long> dp(n + 1);
    
    dp[1] = dp[0] = 1;
    
    for(int i = 2; i <= n ;i++)
    {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    
    printf("%lld\n", dp[n]);
    
    return 0;
}

C++: #include<stdio.h>
#define MAX 50
int dp[MAX];

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

int main()
{
	for (int i = 0; i < MAX; i++)
	{
		dp[i] = -1;
	}

	int n;
	scanf("%d", &n);

	printf("%d\n", fibonacci(n));
}

C++: #include <iostream>
using namespace std;
 
int main() {
	void fibonacci_1(const int count , int data[]) {
	data[0] = 1;
	if(count == 1) return;
	data[1] = 1;
 
	for( int i = 2; i < count ; i++) {
		data[i] = data[i-1]+data[i-2];
	}
}
	return 0;

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

int fibonacci(int n);

int F[45];

int main(){
	int n; cin>>n;
	cout<<fibonacci(n)<<endl;
}

int fibonacci(int n){
	F[0] = F[1] = 1;
	for(int i=2;i<=n;i++)
		F[i] = F[i-1]+F[i-2];
	return F[n];
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int dp[50];
  dp[0]=dp[1]=1;
  for(int i=2; i<50; i++){
    dp[i] = dp[i-1]+dp[i-2];
  }
  //rep(i,50) cout << dp[i] << " ";
  int n;
  cin >> n;
  cout << dp[n] << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int n;
    
    scanf("%d", &n);
    
    vector<long long> dp(n + 1);
    
    dp[1] = dp[0] = 1;
    
    for(int i = 2; i <= n ;i++)
    {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    
    printf("%lld", dp[n]);
    
    return 0;
}

C++: #include <iostream>
#define MAX 50
using namespace std;
typedef long long ll;

ll dp[MAX];

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

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

C++: #include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>

using namespace std;

int main()
{
    int fib[45] = {};
    fib[0] = fib[1] = 1;

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

    return 0;
}