Go: package main

import (
	"fmt"
)

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

	return fmt.Sprintf("%d", f[n])
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(answer(n))
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int MAX_N = 45;

int fib[MAX_N];
int n;

void init(){
    rep(i,MAX_N) fib[i] = -1;
}

int calc_fib(int _n){
    int fib1, fib2;
    if(fib[_n-1] != -1) fib1 = fib[_n-1];
    else fib1 = calc_fib(_n-1);
    if(fib[_n-2] != -1) fib2 = fib[_n-2];
    else fib2 = calc_fib(_n-2);
    return fib[_n] = fib1 + fib2;
}

int main()
{
    cin >> n;
    init();
    fib[0] = fib[1] = 1;
    cout << calc_fib(n) << endl;
}

C++: #include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  int n;
  cin >> n;
  vi fib(50, -1);
  fib.at(0) = 1;
  fib.at(1) = 1;

  for(int i = 2; i <= n; i++){
    fib.at(i) = fib.at(i-1) + fib.at(i-2);
  }
  cout << fib.at(n) << endl;
}

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

const int N = 102;

long m[N][N], p[N+1];

int matrixChainOrder(int n){

  for(int i=1; i<n; i++){ m[i][i] = 0; }

  for(int l=2; l<n; l++){
    for(int i=1; i < n - l + 1; i++){
      int j = i+l-1;
      m[i][j] = std::numeric_limits<long>::max();
      for(int k=i; k<=j-1; k++){
        m[i][j] = std::min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
      }
    }
  }
  return m[1][n - 1];
}

int main(){
  int n ;
  std::cin >> n; //number of matrix

  for(int i=1; i<=n; i++){
    std::cin >> p[i-1] >> p[i];
  }
  // for (int i = 0; i <=n; ++i) std::cout << p[i] << std::endl;
  std::cout << matrixChainOrder(n + 1) << std::endl;

  return 0;
}

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

int n;
int dp[44];

int fibo(int i){
  if(dp[i] != 0) return dp[i];
  else if(i == 0 || i == 1) return 1;
  else{
    return dp[i] = fibo(i-1) + fibo(i-2);
  }
}

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

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

ll F[45];
ll fibonacci(ll n) {
  if(n < 2)
    return F[n] = 1;
  if(F[n])
    return F[n];
  return F[n] = fibonacci(n-1) + fibonacci(n-2);
}
int main() {
  ll n;
  cin >> n;
  cout << fibonacci(n) << endl;
}

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

int main(int argc,char* argv[]){
  int a=1,b=1,x,n;
  cin>>n;

  for(int i=2;i<=n;i++){
    x=a+b;
    a=b;
    b=x;
  }
  cout<<x<<endl;
  return 0;
}

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

int main(void) {
    cin >> num;
    int array[num] = {};
    array[0] = 1;
    array[1] = 1;
    for (int i= 2; i <= num; i++) {
        array[i] = array[i - 1] + array[i - 2];
    }
    cout << array[num] << endl;
}

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

#define MAX 50

int dp[MAX];

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

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

  cout << fib(n) << endl;

  return 0;
}

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

int main(){
	int fib[45];
	int n;

	cin >>n;

	fib[0] = 1;
	fib[1] = 1;

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

C++: #inclue<stdio>
#include<stream>
using namespace std;

int fibo(int x) {
  int a;
  if ( x == 0 ) return 1;
  if ( x == 1 ) return 1;
  a = fibo(x-1) + fibo(x-2);
  return a;
}

int main() {
  int x, y;

  cin >> x;

  y = fibo(x);

  cout << y << endl;

  return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
#define MAX_N 45
int dp[MAX_N];

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

C++: #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;



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

C++: #include <iostream>

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

    int r1 = 1;
    int r2 = 1;
    int result = 1;

    if (n == 1) {
        std::cout << 1 << std::endl;
    } else {
        for (int i = 1; i < n; i++) {
            int tmp = r1;
            r1 = r2;
            r2 = result;
            result += r1;
        }
        std::cout << result << std::endl;
    }
}

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

int main(){
  int f[45];

  f[0] = 1;
  f[1] = 1;
  for( int i = 2; i < 45; i++ ){
    f[i] = f[i - 1] + f[i - 2];
  }

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

C++: #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <functional>
#include <stack>
#define PI 3.1415926535
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

long long int n;

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

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

C++: #include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	int oold = 1;
	int old = 1;
	int neww;

	if (n == 0 || n == 1) { cout << 1 << endl; return 0; }

	for (int i = 2; i <= n; i++) {
		neww = old + oold;
		oold = old;
		old = neww;
	}

	cout << neww << endl;

	return 0;

}

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

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

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)

int main(void) {
  int n; cin >> n;
  int dp[n];
  dp[0] = 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>
using namespace std;

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