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 <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n;
	cin>>n;
	ll dp[47];
	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 <iostream>
#include <algorithm>
using namespace std;
 
static const int N= 100;
int p[N+1], m[N+1][N+1];
 
int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
      cin >> p[i-1] >> p[i];
    }
    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] = ( 1 << 21);
        for(int k=i; k<=j-1; k++){
          m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
        }
      }
    }
    cout << m[1][n] << endl;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=1e9+7;

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

C++: #include <iostream>
#include <string>
using namespace std;
int main()
{
 int a=1;
 int b=1;
 int n;
 cin >>n;
 if(n%2==0){
   for(int i=0;2*i<n-2;i++){
    a+=b;
    b+=a;
   }
    cout << b << endl;
   }else{
       for(int s=0;2*s<n-1;s++){
           a+=b;
           b+=a;
       }
    cout << a << endl;
   }
}

C++: #include<stdio.h>

int dq[50];

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

int main() {
	int n, i;
	for (i = 0; i < 50; i++) {
		dq[i] = -1;
	}

	scanf("%d", &n);
	printf("%d\n", fib(n));

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n; cin>>n;
	int r[] = {1,1,2};
	if( n<=2 ){
		cout<<r[n]<<endl;
		return 0;
	}
	while( n>0 ){
		int tmp = r[1] + r[2];
		r[0] = r[1]; r[1] = r[2]; r[2] = tmp;
		n = n-1;
	}
	cout<<r[0]<<endl;
	return 0;
}

C++: #include<cstdio>
int F[45];
int n;
int fibonacci(int n){
	if(n == 0 || n == 1){
		return F[n] = 1;
	}
	if(F[n] != 0){
		return F[n];
	}
	return F[n] = fibonacci(n-2) + fibonacci(n-1);
}

int main(){
	int i;
	for(i=0;i<45;i++){
		F[i] = 0;
	}
	scanf("%d",&n);
	printf("%d\n",fibonacci(n));
	return 0;
}

C++: #include<iostream>

using namespace std;

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

	cin >> n;

	cout << fib(n) << endl;

	return 0;
}

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

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

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

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

int makeFibonacci(int n) {
	int a[100];
	a[0] = 1;
	a[1] = 1;

	for (int i = 2;i <= n ;i++) {
		a[i] = a[i - 2] + a[i - 1];
	}

	return a[n];
}


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

	int ans = makeFibonacci(n);

	cout << ans << endl;

	return 0;

}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
#define CLR(a)     memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)    cerr << #x << " = " << (x) << endl;//debug
#define debug(x)   cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define EPS        1e-10//sample:if((double)>=(double)+EPS)
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;
unsigned long long int a[100000]={};
unsigned long long int fib(long long int n){
  if(a[n]!=0)return a[n];
  if(n==0)return 1;
  if(n==1)return 1;
  return a[n]=fib(n-1)+fib(n-2);
}


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

C++: 
//DP-1

#include<iostream>
#include<stdio.h>


using namespace std;


int main()
{
    int i,n;
    //メモ化のための配列
    int dp[50];
    scanf("%d",&n);
    dp[0]=1;
    dp[1]=1;

    for(i=2;i<=n;i++)
    {
        dp[i]=dp[i-1]+dp[i-2];
    }
    printf("%d\n",dp[n]);

}

C++: #include<stdio.h>

int d[50];

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

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

  return 0;
}

C++: #include"iostream"
using namespace std;
int n;
int main()
{
	cin >> n; 
	if (n == 1 || n == 0){
		cout << 1 << endl; return 0;
	}
	long long a=1, b=1,c;
	for (int i = 1; i < n; i++)
	{
		c = a + b;
		a = b;
		b = c;
	}
	cout << c << endl;
	return 0;
}

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