Go: package main

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

const max int = 44
var ans []int = make([]int, max+1)

func generateFib() {
	ans[0] = 1
	ans[1] = 1
	for i:=2; i<=max; i++ {
		ans[i] = ans[i-1] + ans[i-2]
	}
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	i := nextInt(scanner)
	generateFib()
	fmt.Printf("%d\n", ans[i])
}

C++: #include <iostream>
using namespace std;
int main(){
	int n, t, a = 1, b = 1;
	cin >> n;
	while (n-- > 1)
		t = a, a = b, b += t;
	cout << b << endl;
}

C++: #include <stdio.h>

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

int main()
{
    int n;
    scanf("%d",&n);
    int a[n+1];
    printf("%d\n",fib(a,n));
}

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

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

int main(){
  int n,fibonacci;
  cin >> n;
  fibonacci = fib(n+1);
  cout << fibonacci << endl;
  return 0;
}

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A
#include <iostream>
using namespace std;

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


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

C++: #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define N 44
lli F[N]={0};

lli 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 n;
	cin >> n;
	cout << fibonacci(n) << endl;
	return 0;
}

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

#if 0
int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

    printf("%d\n", result);

    return 0;
}
#else

int Fibonatch(int num)
{
    int i;
    int result[45];

    result[0] = result[1] = 0;
    for (i = 2; i <= num; i++) {
        result[i] = result[i - 1] + result[i - 2];
    }

    return result[num];
}

int main(void)
{
    int num;
    int result;

    scnaf("%d", &num);

    result = Fibonatch(num);
    printf("%d\n", result);

    return 0;
}

#endif

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int a[55];
    a[0]=a[1]=1;
    rep(i,50)a[i+2]=a[i+1]+a[i];
    int n;cin>>n;
    cout<<a[n]<<endl;
    return 0;
}

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

int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret != 0) {
        if (num > 1) {
            ret = Fibonatch(num - 1) + Fibonatch(num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};

    scanf("%d", &num);
    result = Fibonatch(ret, num);
}

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

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

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

long long int fib(int, long long int*);
int main(){
  int n; cin >> n;
  long long int fibarray[n+1];
  for(int i=0; i<=n; i++) fibarray[i]=-1;
  cout << fib(n, fibarray) << endl;

  return 0;
}

long long int fib(int n, long long int* array){
  if(array[n]>0) return array[n];
  if(n==1 || n==2){
    return array[n]=1;
  }
  else return fib(n-1, array)+fib(n-2, array);
}

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


int main(){

    ll 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;
}

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

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

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

C++: #include<stdio.h>

int dp[50];

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

int main(){
    int n, i;
    for(i=0; i<50; i++) dp[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 fib[50];
    fib[0]=1;fib[1]=1;
    for(int i=2;i<=n;i++)fib[i]=fib[i-1]+fib[i-2];
    cout<<fib[n]<<endl;



return 0;
}

C++: #include<cstdio>

const int MAX_V = 45;
int fib_array[MAX_V]{0};
void make_fib_array(){
  fib_array[0]=1;
  fib_array[1]=1;
  for(int i=2;i<MAX_V;i++)
    fib_array[i]=fib_array[i-1]+fib_array[i-2];
}
int main(){
  make_fib_array();
  int n; scanf("%d",&n);
  printf("%d\n",fib_array[n]);
}

C++: #include<iostream>

using namespace std;

int main (){
  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] << endl;

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
int memo[64],n;
int f(int n){
  if(~memo[n])return memo[n];
  if(n<=1)return 1;
  return memo[n]=f(n-1)+f(n-2);
}
int main(){
  cin>>n;
  memset(memo,-1,sizeof(memo));
  cout<<f(n)<<endl;
  return 0;
}

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

int F[50];

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

    return F[n] = fibonacci(n-1) + fibonacci(n-2);
}
int 
int main (void) {
    int N, i;

    for(i = 0 ; i < 50 ; i ++ ) {
        F[i] = -1;
    }

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

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    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]<<endl;
}