Go: package main

/*
フィボナッチ数列
*/

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}

C++: #include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll n;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vll fib(n + 1, 1);
    for (ll i = 2; i <= n; i++) fib[i] = fib[i - 2] + fib[i - 1];
    cout << fib[n] << '\n';
    return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

int fib(int 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];
  }
  return dp[n];
}

C++: #include <iostream>

using namespace std;

int solve(int n)
{
    int sum[3] = {1, 1, 1};
    if (n < 2)
        return 1;
    for (int i = 1; i < n; i++)
    {
        sum[2] = sum[1] + sum[0];
        sum[0] = sum[1];
        sum[1] = sum[2];
    }
    return sum[2];
}

int main()
{
    int n;
    scanf("%d", &n);
    printf("%d\n", solve(n));
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>
 
#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
 
using namespace std;
 
typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef pair<int,int> PII;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
 
int dp[100] = {1,1};
int a[100] = {1,1};
            
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
     
    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; 
long long n,f[49],x=1;
int main()
{
    cin>>n;
    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;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

//行列は二次元vectorを用いるようにする
typedef vector<int> vec;
typedef vector<vec> mat;

//A*Bの計算
mat mul(mat &A, mat &B){
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++){
        for(int k = 0; k < B.size(); k++){
            for(int j = 0; j < B[0].size(); j++){
                C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
            }
        }
    }
    return C;
}

//A^nの計算
mat pow(mat A, long long n){
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++){
        B[i][i] = 1;
    }
    while(n > 0){//繰り返し二乗法
        if(n & 1) B = mul(B, A);
        A = mul(A, A);
        n >>= 1;
    }
    return B;
}

ll n;

void solve(){
    mat A(2, vec(2));
    A[0][0] = 1; A[0][1] = 1;
    A[1][0] = 1; A[1][1] = 0;
    A = pow(A, n);
    cout << A[0][0] << endl;
}

signed main(){
    cin >> n;
    solve();
}

C++: #include<iostream>

using namespace std;

int main(){

  int n;

  int n0,n1,st;
  //initialize
  n0=0;
  n1=1;
  
  //load number
  cin >>n;
  //fibonacci
  for(int i=1;i<=n;i++){
    st=n0+n1;
    n0=n1;
    n1=st;
  }
  //print
  cout <<st<<endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
static int64_t fib(int32_t n) {
  if (n < 0 || 44ll < n) {
    return -1;
  }
  if (n == 0 || n == 1ll) {
    return 1ll;
  }
  int64_t a = 1ll, b = 1ll;
  for (int32_t i = 2; i <= n; ++i) {
    int64_t t = a + b;
    a = b, b = t;
  }
  return b;
}
int main() {
  int32_t n;
  cin >> n;
  cout << fib(n) << endl;
}

C++: #include <iostream>
#define MAX 45

using namespace std;

int f[MAX];

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

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