Go: package main

import "fmt"

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

	x, y := int64(1), int64(1)

	for i := 0; i < n; i++ {
		x, y = y, x+y
	}

	fmt.Println(x)
}

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

C++: #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long long> fib(n + 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>
using namespace std;

long long fib_(int n,long long a,long long b){
  if(n==2) return a+b;
  return fib_(n-1,b,a+b);
}

long long fib(int n){
  if(n==0) return 1;
  if(n==1) return 1;
  return fib_(n,1,1);
}


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

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){

	int n;
	cin>>n;
	std::vector<int>a(n);
	a[0]=a[1]=1;
	for(int i=2;i<=n;i++)
		a[i]=a[i-1]+a[i-2];

	cout<<a[n]<<endl;
	
	return 0;
}

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

int main()
{
	int fib[45];
	int n,i;
	
	//???????????????
	for(int i=0; i<45; i++){
		fib[i]=0;
	}
	fib[0]=1;
	fib[1]=1;
	
	cin >> n;
	
	if(n!=0||n!=1){
		for(i=2;n>=i;i++){
			fib[i]=fib[i-1]+fib[i-2];
		}
	}
	
	cout << fib[n];
	return 0;
	
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>

using namespace std;


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

	int f1 = 1;
	int f2 = 1;
	int f3 = 0;
	for (int i = 2; i <= n; ++i){
		f3 = f1 + f2;
		f1 = f2;
		f2 = f3;
	}
	if (n == 1){
		cout << 1 << endl;
		return 0;
	}
	if (n == 2){
		cout << 2 << endl;
		return 0;
	}
	cout << f3 << endl;

	return 0;
}

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

int main() {
  int n, fib[50];

  cin >> n;

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

  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

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

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

	return fibarray[n];
}

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

	cout << fib(n) << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
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; }

vector<long long> dp(50, -1);
int fib(int x) {
    if(dp[x] != -1) return dp[x];
    if(x == 0 || x == 1) return dp[x] = 1;
    return dp[x] = fib(x-1) + fib(x-2);
}

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

C++: #include<stdio.h>
#define MAX 44

int FN[MAX+1];

int main() {
    int i, n;
    FN[0] = FN[1] = 1;

    scanf("%d", &n);
    for (i=2; i<=n; i++) {
        FN[i] = FN[i-1] + FN[i-2];
    }

    printf("%d\n", FN[n]);

    return 0;
}

C++: #include<iostream>

using namespace std;

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

int main(void){

int n;

while(cin >> n)cout << fib(n) << endl;

return 0;
}

C++: #include <iostream>
using namespace std;
int memo[50];
int fib(int n)
{
	if(n == 0 || n == 1)	
		memo[n] = 1;
	
	if(memo[n] != 0)
	{
		return memo[n];
	}
	else 
	{
		memo[n] = fib(n - 1) + fib(n - 2);
		return memo[n];
	}
}

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