Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	fmt.Println(fibonacci(num))
}

func fibonacci(num int) int {
	fibs := make([]int, num+1)

	for i := range fibs {
		if i <= 1 {
			fibs[i] = 1
		} else {
			fibs[i] = fibs[i-1] + fibs[i-2]
		}
	}

	return fibs[num]
}

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

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

int main(){
    int n;
    int dp[50];
    memset(dp,-1,sizeof(dp));

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

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 <bits/stdc++.h>
using namespace std;

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main() {
	int n; cin >> n;
	int dp[50];
	dp[0] = 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 fib(int n){
	if(n==0||n==1){
		return 1;
	}
	return fib(n-1) + fib(n-2);
}

int main(){
        ios::sync_with_stdio(false);
        cin.tie(0);
	int n;
	cin>>n;
	
	cout<<fib(n)<<endl;
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using P = pair<int,int>;
const int inf = 1e8;

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

C++:     #include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;
    
    int main() {
   
    int n;
    scanf("%d",&n);
    int ans = 0;
    int second = 0;
    for(int i = 0; i <= n; i++){
    	if(i == 0 || i == 1){	ans = 1;
    	} else{
    		if(i == 2){
    			second = 1;
    		    ans = 1;
    		}
    		int t = second;
    		second = ans;
    		ans = ans + t;
    	}
    }
    	printf("%d\n",ans);
    
     return 0;
    }

C++: #include <bits/stdc++.h>
using namespace std;
int a[45];
int fib(int n)
{
    if(a[n]>0)
        return a[n];
    return a[n]=fib(n-2)+fib(n-1);
}
int main()
{
    a[1]=a[0]=1;
    int n;
    cin>>n;
    cout<<fib(n)<<endl;
    return 0;
}

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

int main(){

    int fib[50];
    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>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
int dp[50];
int main(){
	int n;
	cin>>n;
	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 <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'

//DP法
template <class T>
inline bool chmin(T &a, T b) //change minimum
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) //change max
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

typedef long long ll; //64bit型
using namespace std;

const long long INF = 1LL << 60; //無限大の値
int N;
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;
typedef long long ll;
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 (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    int N; cin >> N;
    vector<int> fib(N + 1);
    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<bits/stdc++.h>
using namespace std;

int f[50];

int fibo(int n)
{
  if(n <= 1) return 1;
  return f[n] = fibo(n-1)+fibo(n-2);
}

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

  cout << fibo(n) << endl;
  return 0;
}

C++: #include <cstdio>
using namespace std;
unsigned long long fib[45];
int main() {
    fib[0] = 1;
    fib[1] = 1;
    int n;
    scanf("%d", &n);
    for (int i = 2; i <= n; i++) {
    	fib[i] = fib[i - 1] + fib[i - 2];
	}
	printf("%lld\n", fib[n]);
    return 0;
}

C++: #include <iostream>
using namespace std;
int F[100];
int Fibonacci(int N) {
  F[0] = 1;
  F[1] = 1;

  for (int i = 2; i <= N; ++i) {
    F[i] = F[i-2] + F[i-1];
  }
  return F[N];
}
int main() {


  int N;
  cin >> N;
  cout << Fibonacci(N)<<endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(n);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
using namespace std;

    vector<long> dp;

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

int main(){

    int n;
    cin>>n;

    dp.assign(n+1,-1);
    cout <<fib(n)<< endl;
   
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, f[50] = {0};
  cin >> n;
  f[0] = f[1] = 1;
  for(int i = 2; i <= n; i++) f[i] = f[i - 1] + f[i - 2];

  cout << f[n] << endl;
}

C++: #include <stdio.h>

int fib(int);

int main()
{
  int n,total=0;

  scanf("%d",&n);

  total=fib(n);

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

 
  return 0;
}    


int fib(int n){

  static int total=0;

  if(n==0) return ++total;
  else if (n==1) total++;
  else fib(n-1)+fib(n-2);
}

C++: #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
#include<map>
#include<set>
#include<list>
#include<unordered_map>
#include<queue>
#define int long long
using namespace std;

signed main(){
	int a; cin >> a;
	int b = 0, c = 1;
	for (int d = 0; d < a; d++) {
		int e = b + c;
		b = c;
		c = e;
	}
	cout << c << endl;
}

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 <iostream>
using namespace std;
int main(){
  int n;
  long long int fib1,fib2,fib3;
  cin>>n;
  fib1=1;
  fib2=1;
  for(int i=0;i<n-1;i++){
    fib3=fib1+fib2;
    fib1=fib2;
    fib2=fib3;
  }
  cout<<fib3<<endl;
}

C++: // Algorithms and Data Structures 1
// Fibonacci Numbers
// Name: Ryuya Asada
// ID: s1260064

#include <iostream>

int fibonacci(int);

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

    std::cout << fibonacci(n) << "\n";

    return 0;
}

int fibonacci(int n) {
    int a(0), b(1), c(1);
    for(int i=1; i <= n; ++i) {
        c = a + b;
        a = b;
        b = c;
    }

    return c;
}