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>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

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

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

int main(int argc, char const *argv[])
{
  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] ;

  return 0;
}

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

int F[45];

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

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

C++: #include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vector<int> dp(50, 1);
    for (int i = 2; i < 50; ++i) {
        dp[i] = dp[i-1] + dp[i-2];
    }

    int n;
    cin >> n;
    cout << dp[n] << endl;
}

C++: #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <istream>

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif
	if(n == 0){
		std::cout << "1" << std::endl;
	}
	else if(n == 1){
		std::cout << "1" << std::endl;
	}
	else{
		int pp = 1;
		int p = 1;
		int ans = 0;

		for(int i = 2; i <= n; i++){
			ans = p + pp;

			pp = p;
			p = ans;
		}
		std::cout << ans << std::endl;
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    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;
}

C++: #include <iostream>

using namespace std;

int main()
{
        int n;
        cin >> n;
        if (n <= 1) {
                cout << 1;
                return 0;
        }

        int *fib = new int[n + 1];
        fib[0] = fib[1] = 1;
        for (int i = 2; i <= n; i++) {
                fib[i] = fib[i - 1] + fib[i - 2];
        }
        cout << fib[n];
        delete [] fib;

        return 0;
}

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

int main() {
    int n, dp[45];
    cin >> n;
    dp[0] = dp[1] = 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>

int main()
{
	int n;
	scanf("%d", &n);
	std::vector<int64_t> table(n + 1, 1ll);
	for (int i{2}; i <= n; i++)
		table[i] = table[i - 1] + table[i - 2];
	printf("%lld\n", table[n]);

	return 0;
}

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

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

    int first = 1;
    int second = 1;
    
    for (int i = 2; i < input; ++i) {
        int third = first + second;
        first = second;
        second = third;
    }
    cout << second;
    
    return 0;
}

C++: #include<iostream>
int dp[1000000];
int main(){
	int n;
	std::cin>>n;
	dp[0]=1;
	dp[1]=1;
	for(int i=2;i<=n;i++){
		dp[i]=dp[i-1]+dp[i-2];
	}
	std::cout<<dp[n]<<"\n";
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

using namespace std;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

C++: #include<stdio.h>
#include<cstdlib>

#define MAX 44

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

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

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

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

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

  // n???0???1?????£?????????????????????
  if(n <= 1){ cout << 1 << endl; }
  else{
    // n???2??\????????£??????dp??????
    vector<int> dp(n + 1);
    dp[0] = dp[1] = 1;
    for(int i = 2; i <= n; i++)
      dp[i] = dp[i - 1] + dp[i - 2];

    cout << n << endl;
  }

  return 0;
}

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

int feb(int n){
  int A[n];
  A[0]=A[1]=1;   
    if(n>=2){
      for (int i=2;i<=n;i++){
         A[i]= A[i-1]+A[i-2];
       }
    }
     return A[n];
  }

int main(void){
	int l;
  	cin>>l;
    cout<<feb(l)<<endl;
	return 0;
}

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


int a[50];
using namespace std;


int fibonacci(int n) {
	if (a[n] > 0)
		return a[n];

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


int main() {

	fill(a,a + 50, -1);

	int n;

	cin >> n;

	a[0] =  1;
	a[1] =  1;

	cout << fibonacci(n) << endl;

}

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

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

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

  return 0;
}

C++: #include <stdio.h>
int main(){
int a[50],n;
a[0]=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<iostream>
#include<cstdio>

using namespace std;

int function(int n){
  if(n==0||n==1)return 1;
  return function(n-1)+function(n-2);
}

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

C++: #include <iostream>

using namespace std;

int cache[45];

int fibonacci(int n) {
    if (cache[n] != -1) {
        return cache[n];
    } else {
        int ret = fibonacci(n - 1) + fibonacci(n - 2);
        cache[n] = ret;
        return ret;
    }
}

int main() {
    for (int i = 0; i < 45; ++i)
        cache[i] = -1;
    cache[0] = cache[1] = 1;

    int n;
    cin >> n;
    cout << fibonacci(n) << '\n';
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int memo[1000];

int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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