akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define sz size()
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
int n,m;
int a,b,c;
int ans = 0;
vector<int> v,vec;
int main(){
  cin >> n;
  m = 1;
  while(1){
    m *= 2;
    if(m > n)break;
  }
  if(n == 0)cout << 0 << endl;
  else cout << m/2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main(int argc, char* argv[])
{
  int n;
  cin >> n;

  int m = 55555;
  vector<bool> flag(m+1, true);
  flag[0] = false;
  flag[1] = false;
  for (int i = 2; i <= sqrt(m); i++) {
    if (flag[i]) {
      for (int j = 2; i * (j - 1) < m; j++) {
        flag[i*j] = false;
      }
    }
  }

  vector<int> ans;
  for (int i = 2; i <= m; i++) {
    if (flag[i] && i % 5 == 1) ans.push_back(i);
    if (ans.size() >= n) break;
  }

  rep(i, n) {
    cout << ans[i] << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<math.h>
#include<algorithm>

int main() {
  long int a[4];
  for(int i = 0; i < 4; i++) {
    cin >> a[i];
  }
  long long int pMax = -1000000000000000000, temp;
  for(int i = 0; i < 2; i++) {
    for(int j = 2; j < 4; j++) {
      temp = a[j] * a[i];
      pMax = max(pMax, temp);
    }
  }
  cout << pMax << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  string s;
  cin>>s;
  int ans=0;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()-1-i]) ans++;
  }
  cout<<ans<<endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;

int main()
{
	string s,k;
	cin>>s>>k;
	if(k.substr(0,s.size())==s)re("Yes")
	re("No")
	return 0;}

Measured memory_bytes: 3624
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using static System.Math;

class P
{
    static bool[][] bits =
    {
        new bool[]{ false,false,false },
        new bool[]{ false,false,true },
        new bool[]{ false,true,false },
        new bool[]{ false,true,true },
        new bool[]{ true,false,false },
        new bool[]{ true,false,true },
        new bool[]{ true,true,false },
        new bool[]{ true,true,true }
    };
    static int[] bitCount = { 0, 1, 1, 2, 1, 2, 2, 3 };
    static int[][] transition =
    {
        new int[]{0,1,2,4,5 },//0
        new int[]{0,4 },//1
        new int[]{0},//2
        new int[]{},//3
        new int[]{0,1},//4
        new int[]{0},//5
        new int[]{},//6
        new int[]{}//7
    };
    static bool[][] canPlaceCarry = null;
    static void Main()
    {
        int[] hn = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[][] dp = Enumerable.Repeat(0, hn[0]).Select(_ => new int[8]).ToArray();
        canPlaceCarry = Enumerable.Repeat(0, hn[0] - 1).Select(_ => new bool[3] { true, true, true }).ToArray();
        for (int i = 0; i < hn[1]; i++)
        {
            int[] xy = Console.ReadLine().Split().Select(int.Parse).ToArray();
            setFalse(xy[0], (hn[0] - 1) - xy[1]);
        }
        for (int i = 1; i < hn[0]; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                //移る先を列挙
                foreach (var trans in transition[j])
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (bits[trans][k] && !canPlaceCarry[i - 1][k]) goto elop;
                    }
                    dp[i][trans] = Max(dp[i][trans], dp[i - 1][j] + bitCount[trans]);
                    elop:;
                }
            }
        }
        Console.WriteLine(dp.Last().Max());
    }
    static void setFalse(int x,int y)
    {
        if (y != 0)
        {
            if (x != 0)
            {
                canPlaceCarry[y - 1][x - 1] = false;
            }
            if (x < 3)
            {
                canPlaceCarry[y - 1][x] = false;
            }
        }
        if (y < canPlaceCarry.Length)
        {
            if (x != 0)
            {
                canPlaceCarry[y][x - 1] = false;
            }
            if (x < 3)
            {
                canPlaceCarry[y][x] = false;
            }
        }
    }
}


Measured memory_bytes: 14308
from collections import defaultdict
from math import gcd
C = defaultdict(lambda: 0)
for i in range(int(input())):
    x, y = map(int, input().split())
    g = max(gcd(x, y), 1)
    x, y = x // g, y // g
    if y < 0 or (x == -1 and y == 0):
        x, y = -x, -y
    C[(x, y)] += 1
S = set()
for x, y in C:
    if x > 0 and y >= 0:
        S.add((x, y))
    if x <= 0 and y > 0:
        S.add((y, -x))
ans = 1
p = 10**9 + 7
for x, y in S:
    ans *= pow(2, C[(x, y)], p) + pow(2, C[(-y, x)], p) - 1
    ans %= p
print((ans + C[(0, 0)] - 1) % p)


Measured memory_bytes: 108140
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner (System.in);

		//トッピングの種類の数を入力
		int n = sc.nextInt();

		//生地の値段を入力
		int a = sc.nextInt();

		//トッピングの値段を入力
		int b = sc.nextInt();

		//生地のカロリーを入力
		int c = sc.nextInt();

		//トッピングのカロリーの配列
		int [] d = new int [n];

		//for文用変数
		int i, j;

		//降順ソート用変数
		int temp;

		//カロリーの最大値用変数
		int max = 0;

		//カロリー用変数
		int calorie;

		//トッピングのカロリーを入力
		for (i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}

		//トッピングのカロリーを降順にソート
		for (i = 0; i < n - 1; i++) {
			for (j = i + 1; j < n; j++) {
				if (d[i] < d[j]) {
					temp = d[i];
					d[i] = d[j];
					d[j] = temp;
				}
			}
		}

		//「最高のピザ」のカロリー数を求める
		for (i = 0; i < n; i++) {

			//カロリーの合計用変数を宣言・初期化
			int sum = 0;

			for (j = 0; j < i; j++) {

				//カロリーの合計
				sum += d[j];

				//生地とトッピングの組み合わせのカロリー数の計算
				calorie = (c + sum) / (a + i * b);

				//最大値を求める
				if (max < calorie) {
					max = calorie;
				}
			}
		}

		//「最高のピザ」のカロリー数を出力
		System.out.println(max);

	}

}

Measured memory_bytes: 18132
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll bo[1010][1010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, W;
    cin >> H >> W;
    queue<plglg> que;
    REP(i, 0, H) {
        fill(bo[i], bo[i] + W, -1);
    }
    REP(i, 0, H) {
        string s;
        cin >> s;
        REP(j, 0, W) {
            if (s[j] == '#') {
                bo[i][j] = 0;
                que.push(plglg(i, j));
            }
        }
    }
    while (!que.empty()) {
        plglg p = que.front();
        que.pop();
        ll x = p.first;
        ll y = p.second;
        ll num = bo[x][y];
        REP(i, 0, 4) {
            ll newx = x + dx[i];
            ll newy = y + dy[i];
            if (newx < 0 || newx >= H || newy < 0 || newy >= W) {
                continue;
            }
            if (bo[newx][newy] == -1) {
                bo[newx][newy] = num + 1;
                que.push(plglg(newx, newy));
            }
        }
    }
    ll ans = 0;
    REP(i, 0, H) {
        REP(j, 0, W) {
            ans = max(ans, bo[i][j]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 24500
n,k = map(int,input().split())
h = list(map(int,input().split()))

dp = [10**10]*n
dp[0] = 0

for i in range(n-1):
    for j in range(i+1,min(i+k,n-1)+1):
        dp[j] = min(dp[j],dp[i]+abs(h[j]-h[i]))
        # print(dp)
print(dp[n-1])

Measured memory_bytes: 84720
#include<bits/stdc++.h>
using namespace std ;

int main () {
  int a , b , k ;
  cin >> a ;
  for(int i = 0 ; i< 4 ; i++ ) cin >> b ;
  cin >> k ;
  if(b-a<=k) cout << "Yay!" << endl ;
  else cout << ":(" << endl ;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
#include <random>
using namespace std;
using LL = long long;

int main() {
	string s;
	cin >> s;
	if (s.back() == 's') {
		s.push_back('e');
	}
	s.push_back('s');
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#define MAX(a, b) ((a) < (b) ? (b) : (a))
using namespace std;
typedef pair<int, int> P;
int main()
{
  long x, y;
  cin >> x >> y;
  int ans = 0;
  while (x <= y)
  {
    ans++;
    x <<= 1;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 632
import sys

while True:
    data = sys.stdin.readline().strip().split(' ')
    h = int(data[0])
    w = int(data[1])
    if h == 0 and w == 0:
        break
    
    for i in range(h):
        for j in range(w):
            print('#', end='')
        print('')
        
    print('')

Measured memory_bytes: 9036
#include <bits/stdc++.h>
     
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
     
using namespace std;
     
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vll;
     
int intPower (int a, int b) {
  int ret = 1;
  while (b--) {
    ret *= a;
  }
  return ret;
}

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  ll ans = 0;
  for (int a = 1; a <= 9; a++) {
    for (int b = 1; b <= 9; b++) {
      set <int> left, right;
      if (a == b and a <= n) {
        left.insert(a);
        right.insert(a);
      }
      for (int d = 0; d <= 4; d++) {
        int p = intPower(10, d);
        for (int center = 0; center < p; center++) {
          int num1 = a * 10 * p + 10 * center + b;
          int num2 = b * 10 * p + 10 * center + a;
          if (num1 <= n) left.insert(num1);
          if (num2 <= n) right.insert(num2);
        }
      }
      ans += 1LL * sz(left) * sz(right);
    }
  }
  cout << ans << '\n';
  return (0);
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int inf=1e9;
const double PI=acos(-1);
const double eps=1e-6;
const int mod=1e9+7;
const int maxn=1e5+10;
int a[66];
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	for(int i=1;i<=5;i++){
		cin>>a[i];
	}
	int ans=inf;
	do{
		int t=0;
		for(int i=1;i<=5;i++){
			if(t%10!=0) t+=10-t%10;
			t+=a[i];
		}
		ans=min(ans,t);
	}while(next_permutation(a+1,a+5+1));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return (a/g*b);
}
int main() {
    int n,k,ans = INT_MAX;
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i <= n-k; ++i) {
        int tmp = min(abs(x[i])+abs(x[k-1+i]-x[i]),abs(x[k-1+i])+abs(x[k-1+i]-x[i]));
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
k = int(input())
i = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(i[k-1])

Measured memory_bytes: 38384
from fractions import gcd


def solve():

    N = int(input())
    A = [int(i) for i in input().split()]
    a = A[0]
    for i in range(1, N):
        # 先頭をとって、gcdを繰り返していく
        a = gcd(a, A[i])
    print(a)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 88428
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
	double a,b,x,y;
	double ans = 0, pi = 3.141592653589;
	cin >> a >> b >> x;

	if((a*a*b) == x){
		ans = 0;
	}else if((a*a*b/2) < x){
		y = (2*x - a*a*b)/a/a;
		ans = atan2(b-y, a) * 180 / pi;
	}else if((a*a*b/2) == x){
		ans = 45.0;
	}else{
		y = 2*x/a/b;
		ans = 90 - (atan2(y, b) * 180 / pi);
	}
	cout << std::setprecision(8) << ans;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
#include <utility>

using namespace std;

vector<vector <char>> map;
int h,w;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

#define inf 10000
#define max(a,b) (a > b ? a : b)

int bfs(int sy,int sx,int gy,int gx){
	vector<vector<int>> d;
	d.resize(h);
	for(int i=0;i<h;++i){
		d[i].resize(w);
		for(int j=0;j<w;++j){
			d[i][j] = inf;
		}
	}
	queue<pair<int,int>> que;
	que.push(make_pair(sy,sx));
	d[sy][sx] = 0;
	while(que.size() != 0){
		pair<int,int> p = que.front();
		que.pop();
		if(p.first == gy&&p.second == gx)break;
		for(int i=0;i<4;++i){
			int ny = p.first + dy[i];
			int nx = p.second + dx[i];
 			if(0 <= nx && nx < w && 0 <= ny && ny < h){
				if(map[ny][nx] == '.' && d[ny][nx] == inf){
					que.push(make_pair(ny,nx));
					d[ny][nx] = d[p.first][p.second] + 1;
				}
			}
		}
	}
	return d[gy][gx];
}

int main(){
	int res=0;
	cin >> h >> w;
	map.resize(h);
	for(int i=0;i<h;++i){
		map[i].resize(w);
		for(int j=0;j<w;++j){
			cin >> map[i][j];
		}
	}
	for(int syy=0;syy<h;++syy){
		for(int sxx=0;sxx<w;++sxx){
			for(int gyy=0;gyy<h;++gyy){
				for(int gxx=0;gxx<w;++gxx){
					if(map[syy][sxx]=='.'&&map[gyy][gxx]=='.'){
						res = max(res,bfs(syy,sxx,gyy,gxx));
					}
				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;

int main()
{
    int h,w;
    cin>>h>>w;

    string str[h];
    for ( int i=0; i<h; i++)
        cin>>str[i];

    for ( int i=0; i<h; i++)
        cout<<str[i]<<endl<<str[i]<<endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#define INF 1000000000
#define MOD 1000000007

using namespace std;

int main()
{
    string o, e;

    cin >> o;
    cin >> e;

    for (int i = 0; i < max(o.size(), e.size()); ++i) {
        if (i < o.size()) cout << o[i];
        if (i < e.size()) cout << e[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll n;cin>>n;
	pii a[n];For(i,0,n) cin>>a[i].se>>a[i].fi;

	sort(a,a+n);
	ll t = 0;

	For(i,0,n){
		if(t+a[i].se>a[i].fi){
			cout<<"No"<<endl;
			return 0;
		}else{
			t+=a[i].se;
		}
	}
	cout<<"Yes"<<endl;








	
}

Measured memory_bytes: 3328
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll n;
vector<ll> a;
const ll inv=(MOD+1)/2;

ll mod_pow(ll a,ll x){
    ll ret=1;
    while(x>0){
        if(x&1){(ret*=a)%=MOD;}
        (a*=a)%=MOD;
        x>>=1;
    }
    return ret;
}

pll search(ll l,ll r,ll h){
    pll ret={1,1}; //tate,yoko
    ll mx=0;
    ll mi=E;
    for(ll i=l;i<r;i++){
        mx=max(mx,a[i]-h);
        mi=min(mi,a[i]-h);
    }
    if(r-l==1){return {0,mod_pow(2,mx)};}
    if(mi==mx){return {mod_pow(2,r-l-1),mod_pow(2,mx)};}
    ll L=l;
    ll cnt=0;
    for(ll i=l;i<=r;i++){
        if(i==r || a[i]==mi+h){
            if(L<i){
                pll A=search(L,i,mi+h);
                (ret.S*=A.S)%=MOD;
                (ret.S*=inv)%=MOD;
                (ret.F*=(A.F+A.S*2)%MOD)%=MOD;
            }
            L=i+1;
            if(i!=r){cnt++;}
        }
    }
    (ret.F*=mod_pow(2,cnt))%=MOD;
    (ret.F-=ret.S*4)%=MOD;
    (ret.S*=mod_pow(2,mi))%=MOD;
    (ret.S*=2)%=MOD;
    cout<<l<<" "<<r<<" "<<h<<" "<<ret.F<<" "<<ret.S<<endl;
    return ret;
}

pll search2(ll l,ll r,ll h){
    pll ret={1,1}; //tate,yoko
    ll mx=0;
    ll mi=E;
    for(ll i=l;i<r;i++){
        mx=max(mx,a[i]-h);
        mi=min(mi,a[i]-h);
    }
    if(mi==mx){return {mod_pow(2,r-l)-2,mod_pow(2,mx)};}
    ll L=l;
    ll cnt=0;
    ll k2=1;
    for(ll i=l;i<=r;i++){
        if(i==r || a[i]==mi+h){
            if(L<i){
                pll A=search2(L,i,mi+h);
                (ret.S*=A.S)%=MOD;
                (ret.F*=(A.F+A.S*2)%MOD)%=MOD;
                (k2*=A.S)%=MOD;
            }
            L=i+1;
            if(i!=r){cnt++;}
        }
    }
    (ret.S*=mod_pow(2,mi))%=MOD;
    (ret.F*=mod_pow(2,cnt))%=MOD;
    (ret.F-=k2*2)%=MOD;
    //cout<<l<<" "<<r<<" "<<h<<" "<<ret.F<<" "<<ret.S<<endl;
    return ret;
}



int main(){
    cin>>n;
    a.resize(n);
    for(auto &I:a){cin>>I;}
    pll ans=search2(0,n,0);
    ll A=ans.F+ans.S;
    A%=MOD;
    if(A<0){A+=MOD;}
    cout<<A<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int x[3], y[3];
double a, b, c, S, T, r;

signed main() {
    cin >> x[0] >> y[0];
    cin >> x[1] >> y[1];
    cin >> x[2] >> y[2];
    a = sqrt((x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]));
    b = sqrt((x[0] - x[2]) * (x[0] - x[2]) + (y[0] - y[2]) * (y[0] - y[2]));
    c = sqrt((x[2] - x[1]) * (x[2] - x[1]) + (y[2] - y[1]) * (y[2] - y[1]));
    double s = (a + b + c) / 2;
    S = sqrt(s * (s - a) * (s - b) * (s - c));
    T = max({a, b, c});
    r = 2 * S / (a + b + c);
    cout << setprecision(15) << T / (T / r + 2) << endl;
    return 0;
}

Measured memory_bytes: 256
//Chandigarh University 
//author:- shivamkr21 (pseduo coders)
#include<bits/stdc++.h>
#define endl "\n"
#define lli long long int
#define vint vector<long long int>
#define vvint vector< vector<long long int> >
#define pubk push_back
#define ppbk pop_back
using namespace std;
int main() {
	lli a,b;
	cin>>a>>b;
	lli c=a*b;
	c=c/(__gcd(a,b));
	cout<<c;
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("D.in", "r", stdin);
	freopen ("D.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;

int cnt[N], tot;

int main () {

	File();

	int n = read(), lim = 0;
	For (i, 1, n) {
		int x = read(); chkmax(lim, x); ++ cnt[x];
	}

	int ans = 0;
	For (i, 1, lim) if (cnt[i]) {
		if (cnt[i] & 1) ans += cnt[i] - 1;
		else ans += cnt[i] - 2, ++ tot;
	}

	ans += tot / 2 * 2 + (tot & 1) * 2;
	printf ("%d\n", n - ans);

    return 0;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  vector<pair<int, int>> line(n + 1, make_pair(0, 0));
  for(int i = 0; i < n; ++i){
    if(s[i] == 'W') line[i + 1].first = 1;
    else line[i + 1].second = 1;
  }
  for(int i = 1; i < n + 1; ++i){
    line[i].first += line[i - 1].first;
    line[i].second += line[i - 1].second;
  }
  int min_turn = INF;
  for(int i = 1; i < n + 1; ++i){
    min_turn = min(min_turn, line[i -1].first - line[0].first + line[n].second - line[i].second );
  }
  cout << min_turn << endl;
}

Measured memory_bytes: 3076
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

tmp = -10
li = [a,b,c,d,e]
for i in li:
  tmp += math.ceil(i/10)*10
if a%10 + b%10 + c%10 + d%10 + e%10 == 0:
  print(int(tmp +10))
else:
  li_1 = [a%10,b%10,c%10,d%10,e%10]
  for i in range(5):
    try:
      li_1.remove(0)
    except:
      break
  print(int(tmp + min(li_1)))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 998244353
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll mod_div(ll a,ll b){
  ll tmp=MOD-2,c=b,ret=1;
  while(tmp>0){
    if(tmp&1){
      ret*=c;ret%=MOD;
    }
    c*=c;c%=MOD;tmp>>=1;
  }
  return a*ret%MOD;
}
 
#define MAX_K 2000100
vector<ll> kaijo(MAX_K);
ll combination(ll n, ll r){
  if(n<r||n<0||r<0)
    return 0;
  if(kaijo[0]!=1){
    kaijo[0]=1;
    for(ll i=1;i<MAX_K;i++)kaijo[i]=(kaijo[i-1]*i)%MOD;
  }
  ll ret=kaijo[n];
  long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
  return mod_div(ret,tmp);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,k;cin>>n>>m>>k;
  if(m == 1){

  }
  ll ans = 0;
  vi ho(222222);
  ho[0] = 1;
  for(int i=1;i<222222;i++){
    ho[i] = ho[i-1]*(m-1);
    ho[i]%=MOD;
  }
  for(ll i=0;i<=k;i++){
    ans += ((m*(ho[n-i-1])%MOD)*combination(n-1,i))%MOD;
    ans %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 20624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
struct edge{int from, to;};

int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    for(int i=0;i<n;i++){
        cout<<s[i]<<t[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

string s, a;

int u[12341];

main()
{
    cin >> s;

    for (int i = 0; i < sz(s); i++)
        u[ s[i] ] = i + 1;

    for (char i = 'a'; i <= 'z'; i++)
    {
        if ( !u[i] )
        {
            cout << s << i << endl;
            return 0;
        }
    }
    for (int i = sz(s) - 1; i >= 0; i--)
    {
        for (char j = s[i] + 1; j <= 'z'; j++)
        {
            if ( u[j] - 1 > i )
            {
                for (int o = 0; o < i; o++)
                    cout << s[o];
                cout << j;
                return 0;
            }
        }
    }
    puts("-1");
}


Measured memory_bytes: 256
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll x;
    cin >> x;
    ll g = __gcd(360L, x);
    cout << 360 / g;
}

Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main(void){

    const int dx[4] = {0,1,0,-1};
    const int dy[4] = {1,0,-1,0};
    
    int H,W;
    string S[60];
    
    cin >> H >> W;
    
    for(int h=0;h<H;h++) cin >> S[h];
    
    bool can = true;
    
    for(int h=0;h<H;h++){
        for(int w=0;w<W;w++){
            if(S[h][w]=='#'){
                bool find = false;
                for(int i=0;i<4;i++){
                    int nw = w + dx[i];
                    int nh = h + dy[i];
                    if(nw>=0 and nw<=W and nh>=0 and nh<=H){
                        if(S[nh][nw]=='#') find = true;
                    }
                }
                if(!find) can = false;
            }
        }
    }
    
    if(can) cout << "Yes";
    if(!can) cout << "No";
    
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
 
 
void swap (int *x, int *y) {
  int temp;    
 
  temp = *x;
  *x = *y;
  *y = temp;
}
 
int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }
 
  if(b==0){
    return a;
  }
 
  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }
 
  return b;
}
 
/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
 
 
int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}
 
int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}
 
int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}
 
void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }
 
  return;
}
 
void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }
 
  return;
}
 

int main(void){
  int n,k,q;
  scanf("%d%d%d",&n,&k,&q);
  int a[n+1];
  for(int i=0;i<n;i++){
    a[i]=0;
  }
  for(int i=0;i<q;i++){
    int x;
    scanf("%d",&x);
    a[x-1]++;
  }
  for(int i=0;i<n;i++){
    if(q-a[i]<k){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;

struct xy{
  double x, y;
};

void koch(int n, xy a, xy b){

  if(n == 0) return;

  xy s, t, u;
  double v = M_PI * 60.0/180.0;

  s.x = (a.x*2 + b.x)/3;
  s.y = (a.y*2 + b.y)/3;
  t.x = (a.x + b.x*2)/3;
  t.y = (a.y + (b.y*2))/3;
  u.x = (t.x - s.x)*cos(v) - (t.y - s.y)*sin(v) + s.x;
  u.y = (t.x - s.x)*sin(v) + (t.y - s.y)*cos(v) + s.y;


  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);




}

int main(){

  int n;
  cin >> n;

  xy a, b;
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);



}

Measured memory_bytes: 1196
import itertools
N = int(input())
LX, LY = [], []
RX, RY = [], []
DX, DY = [], []
UX, UY = [], []

for _ in range(N):
  x,y,d = input().split()
  x,y = int(x), int(y)
  if d == 'L':
    LX.append(x)
    LY.append(y)
  elif d == 'R':
    RX.append(x)
    RY.append(y)
  elif d == 'U':
    UX.append(x)
    UY.append(y)
  else:
    DX.append(x)
    DY.append(y)

INF = 10**18
fixed_x = [min(UX + DX + [INF]), max(UX + DX + [-INF])]
fixed_y = [min(LY + RY + [INF]), max(LY + RY + [-INF])]

R_x = [min(RX + [INF]), max(RX + [-INF])]
L_x = [min(LX + [INF]), max(LX + [-INF])]
U_y = [min(UY + [INF]), max(UY + [-INF])]
D_y = [min(DY + [INF]), max(DY + [-INF])]


# 2点が衝突する時刻を除けば1次関数
T = [0]

for x1,x2 in itertools.product(L_x, R_x):
  if x1 in [-INF, INF] or x2 in [-INF, INF]:
    continue
  T.append((x1 - x2) / 2)
for x1,x2 in itertools.product(L_x, fixed_x):
  if x1 in [-INF, INF] or x2 in [-INF, INF]:
    continue
  T.append(x1 - x2)
for x1,x2 in itertools.product(R_x, fixed_x):
  if x1 in [-INF, INF] or x2 in [-INF, INF]:
    continue
  T.append(x2 - x1)
  
for x1,x2 in itertools.product(D_y, U_y):
  if x1 in [-INF, INF] or x2 in [-INF, INF]:
    continue
  T.append((x1 - x2) / 2)
for x1,x2 in itertools.product(D_y, fixed_y):
  if x1 in [-INF, INF] or x2 in [-INF, INF]:
    continue
  T.append(x1 - x2)
for x1,x2 in itertools.product(U_y, fixed_y):
  if x1 in [-INF, INF] or x2 in [-INF, INF]:
    continue
  T.append(x2 - x1)
  
T = sorted(set(t for t in T if t >= 0))
T.append(10 ** 9)

def calc_x(t):
  # t秒後の横幅
  right = fixed_x[1]
  left = fixed_x[0]
  for x in [R_x[1]+t, L_x[1]-t]:
    if right < x:
      right = x
  for x in [R_x[0]+t, L_x[0]-t]:
    if left > x:
      left = x
  return right - left

def calc_y(t):
  # t秒後の横幅
  right = fixed_y[1]
  left = fixed_y[0]
  for y in [U_y[1]+t, D_y[1]-t]:
    if right < y:
      right = y
  for y in [U_y[0]+t, D_y[0]-t]:
    if left > y:
      left = y
  return right - left

def F(x1,x2,y1,y2):
  # x は x1からx2に向かう1次関数
  # y は y1からy2に向かう1次関数
  # t in [0,1] で関数を作る
  # x = (x2-x1)t + x1
  # y = (y2-y1)t + y1
  p,q,r,s = x2-x1, x1, y2-y1, y1
  a,b,c = p*r, p*s + q*r, q*s
  # f(t) = at^2 + bt + c
  if a <= 0:
    # 直線 or 上に凸
    return min(x1*y1, x2*y2)
  t0 = -b/(2*a)
  if t0 < 0 or t0 > 1:
    return min(x1*y1, x2*y2)
  return min(a*t0*t0 + b*t0 + c, a+b+c, c)
  
L = len(T)
X = [calc_x(t) for t in T]
Y = [calc_y(t) for t in T]

answer = 10 ** 18

for i in range(L-1):
  x1, x2 = X[i], X[i+1]
  y1, y2 = Y[i], Y[i+1]
  s = F(x1,x2,y1,y2)
  if answer > s:
    answer = s

print(answer)

Measured memory_bytes: 66520
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    if n>=m:
        print(0)
        return
    X=list(map(int,input().split()))
    X.sort()
    D=[0]*(m-1)
    for i in range(m-1):
        D[i]=(i,X[i+1]-X[i])
    from operator import itemgetter
    D.sort(key=itemgetter(1),reverse=1)
    ans=0
    ppos=0
    for i in range(n-1):
        pos=D[i][0]
        ans+=X[pos]-X[ppos]
        ppos=pos+1
    print(ans+X[-1]-X[ppos])
resolve()

Measured memory_bytes: 59176
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MAXX 1000005
#define PI 3.14159265358979323846264338327950
#define ll signed long long int
using namespace std;
ll t , n, ans = 0;
double f = 0.5;

int main()
{
	cin >> n;
	if(n %2 == 0){
		cout << f;
	}
	else{
		f = double((double(n/2)   + 1)/n);
		cout << f;
	}
    return 0;
    
}

Measured memory_bytes: 256
#include <stdio.h>

void judge_triangle(int side1, int side2, int side3);

int main(void)
{
    int i, j, number;/*submitすると、"code.c: In function ‘main’:
code.c:10:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
code.c:10:5: note: use option -std=c99 or -std=gnu99 to compile your code
code.c:13:14: error: redefinition of ‘i’
code.c:10:14: note: previous definition of ‘i’ was here
code.c:13:5: error: ‘for’ loop initial declarations are only allowed in C99 mode"
と出るのでfor外でi,　jの宣言をしました。*/
    scanf("%d", &number);
    int side1[number], side2[number], side3[number];
    for (i = 0; i < number; i++) {
        scanf("%d %d %d", &side1[i], &side2[i], &side3[i]);
    }
    for (j = 0; j < number; j++) {
        judge_triangle(side1[j], side2[j], side3[j]);
    }
    return 0;
}

void judge_triangle(int side1, int side2, int side3)
{
    int shorter1, shorter2, longest;
    if(side1 <= side2) {
        shorter1 = side1;
        shorter2 = side2;
    } else {
        shorter1 = side2;
        shorter2 = side1;
    }
    if(shorter2 <= side3) {
        longest = side3;
    } else {
        longest = shorter2;
        shorter2 = side3;
    }
    if (longest * longest == shorter1 * shorter1 + shorter2 * shorter2) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return;
}

Measured memory_bytes: 592
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let n: usize = util::get();
    let a: Vec<usize> = util::gets();

    let mut memo = [0; 100_001];

    for &x in &a {
        memo[x] += 1;
        if x + 1 < memo.len() {
            memo[x + 1] += 1;
        }
        if x > 0 {
            memo[x - 1] += 1;
        } 
    }

    println!("{}", memo.iter().max().unwrap());
}


Measured memory_bytes: 6780
import java.util.*;

public class Main{
    public static void main(String[] args){
        int a, b, d, r;
        double f;
        Scanner s = new Scanner(System.in);
        a = s.nextInt();
        b = s.nextInt();
        d = a / b;
        r = a % b;
        f = 1.0 * a / b;
        System.out.println(String.format("%d %d %.5f", d, r, f));
    }
}


Measured memory_bytes: 26572
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

struct Doll{
	int h,r;
	bool operator <(const Doll &a)const{
		return h<a.h;
	}
};

int main(){
	int N,M;
	while(cin>>N,N){
		vector<Doll> d;
		for(int i=0;i<N;i++){
			Doll in; cin>>in.h>>in.r; d.push_back(in);
		}
		cin>>M;
		for(int i=0;i<M;i++){
			Doll in; cin>>in.h>>in.r; d.push_back(in);
		}

		sort(d.begin(),d.end());
		int dp[201][1000] = {}, ans = 0;
		for(int i=0,cnt=0; cnt<d.size(); cnt++){
			if(cnt!=0 && d[cnt-1].h!=d[cnt].h) i++;
			for(int j=0;j<1000;j++){
				dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
				if(j<d[cnt].r)
					ans = max(ans, dp[i+1][d[cnt].r] = max(dp[i+1][d[cnt].r], dp[i][j]+1));
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1992
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
/*#define mem(a) memset(a,0,sizeof(a));
long long f[1005][505];
void fib()
{
	long long i,j;
	mem(f);
	f[0][0]=2;
	f[1][0]=1;
	for(i=2;i<1005;i++)
	{
		for(j=0;j<500;j++)
			f[i][j]=f[i-1][j]+f[i-2][j];
		for(j=0;j<500;j++)
		{
			if(f[i][j]>=10)
			{
				f[i][j+1]+=f[i][j]/10;
				f[i][j]=f[i][j]%10;
			}
		}
	}
}

int main()
{
	long long n,j;
	fib();
	scanf("%lld",&n);
	for(j=499;j>=0;j--)
	{
		if(f[n][j])
		{
			printf("%lld",f[n][j]);
		}
	}
	printf("\n");
	return 0;
}*/
long long f[100];
int main()
{
	long long n;
	long long i;
	scanf("%lld",&n);
	f[0]=2;
	f[1]=1;
	for(i=2;i<=n;i++)
	{
		f[i]=f[i-1]+f[i-2];
	}
	printf("%lld\n",f[n]);
	return 0;
}


	

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, m, x;
	int a[110];
	int l = 0, r = 0;
	cin >> n >> m >> x;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		if (a[i] < x) {
			l++;
		} else {
			r++;
		}
	}
	
	cout << min(l, r) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

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

long double p[n+1];
for(int i=1;i<=n;i++)
{
    cin>>p[i];
}
vector<vector<long double>>dp(n+1);

dp[1].push_back(1-p[1]);
dp[1].push_back(p[1]);
dp[1].push_back(0);
for(int j=2;j<=n;j++)
{
    dp[j].resize(j+2,0);
    dp[j][0]=dp[j-1][0]*(1-p[j]);
    for(int i=1;i<=j;i++)
    {
        dp[j][i]+=( dp[j-1][i] * (1-p[j]) );
        dp[j][i]+=( dp[j-1][i-1] * p[j] );
    }   
}
/*
for(int i=1;i<=n;i++)
{
    for(int j=0;j<=i;j++)
    {
        cout<<dp[i][j]<<" ";
    }
    cout<<endl;
}
*/
long double ans=0;
for(int i=(n/2)+1;i<=n;i++)
{
    ans+=dp[n][i];
}
cout.precision(12);
cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 70784
using System;

namespace arc098_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int ret = 0;
            for (int i = 1; i < n; i++)
            {
                if (s[i] == 'E') ret++;
            }
            int now = ret;
            for (int i = 1; i < n; i++)
            {
                if (s[i - 1] == 'W') now++;
                if (s[i] == 'E') now--;
                ret = Math.Min(ret, now);
            }
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 13216
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long lo;
typedef pair< lo,lo > PII;
 
#define fi first
#define se second
#define int long long
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
 
const lo inf = 200000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
 
int n,m,b[li],a[li],k,flag,t,dp[li],c[li];
int cev;
string s;
vector<int> v;
 
main(void){
	scanf("%lld %lld",&n,&k);
	FOR{
		scanf("%lld %lld",&a[i],&b[i]);
	}
	for(int j=100000;j>=0;j--){
		dp[j]=inf;
	}
	//~ FOR{
		//~ dp[b[i]]=a[i];
	//~ }
	FOR{
		
		for(int j=100000;j>=0;j--){
			if(j-b[i]<0)continue;
			dp[j]=min(dp[j-b[i]]+a[i],dp[j]);
		}
		dp[b[i]]=min(a[i],dp[b[i]]);
	}
	for(int i=0;i<=100000;i++){if(dp[i]<=k)cev=max(cev,i);}
	printf("%lld\n",cev);
	return 0;
}


Measured memory_bytes: 4612
#include <cstdio>
#include <cmath>

#include <algorithm>
#include <functional>

#define FOR( i, l, r) for(int i = (l)    ; i <  (r); i++)
#define FOR1(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define REV( i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define REV1(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define INC( i, n) FOR( i, 0, n)
#define INC1(i, n) FOR1(i, 1, n)
#define DEC( i, n) REV( i, 0, n)
#define DEC1(i, n) REV1(i, 1, n)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, k;
char p[10000][11];
int a[26];

int main() {
	scanf("%d%d", &n, &k);
	INC(i, n) { scanf("%s", p[i]); }
	
	INC(i, n) { a[ p[i][0] - 'A' ]++; }
	std::sort(a, a + 26, std::greater<int>());
	
	int ans = 0;
	bool flag = false;
	while(true) {
		INC(i, k) { if(a[i] == 0) { flag = true; break; } else { a[i]--; } }
		if(flag) { break; }
		std::sort(a, a + 26, std::greater<int>());
		ans++;
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

const double PI = 3.141592653589793;

void solve()
{
	int s,k;
	cin >> k >> s;
	int ans=0;
	for(int i=0;i<=k;i++)
	{
		for(int j=0;j<=k;j++)
		{
			int x = i+j;
			if(x<=s)
			{
				int cur = s-x;
				if(cur <= k) ans++;
			}
		}
	}
	cout << ans ;
}

int32_t main()
{
	FastIO;
	Fast_D;
	solve();
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B;
  cin >> A >> B;

  int c = 0;
  for(int i=A;i<=B;i++){
    if (i/10000 == i%10 && i%10000/1000 == i%100/10) c++;
  }
  cout << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
int N;

struct Node { int parent, left, right; };
int NIL = -1;

// left-child, right-sibling representation;
Node Nodes[MAX_N];

int depth(int i){
	if (Nodes[i].parent == NIL) return 0;
	return depth(Nodes[i].parent) + 1;
}

string attr(int i){
	if (Nodes[i].parent == NIL) return "root";
	if (Nodes[i].left == NIL) return "leaf";
	return "internal node";
}

vint children(int i){
	vint ret;
	int c = Nodes[i].left;
	if (c != NIL){
		ret.push_back(c);
		while (true){
			int s = Nodes[c].right;
			if (s == NIL) break;
			ret.push_back(s);
			c = s;
		}

	}
	return ret;
}

int main() {

	// construct tree
	cin >> N;
	
	rep(i, N){
		Nodes[i].left = NIL;
		Nodes[i].parent = NIL;
		Nodes[i].right = NIL;
	}

	rep(i, N){
		int p; cin >> p;
		int n; cin >> n;
		int c0 = NIL;
		rep(i, n){
			int c; cin >> c;
			if (i == 0){
				Nodes[p].left = c;
				Nodes[c].parent = p;
			}
			else{
				Nodes[c0].right = c;
				Nodes[c].parent = p;
			}
			c0 = c;
		}
	}

	// output
	rep(i, N){

		vint cren = children(i);
		cout << "node " << i << ": parent = " << Nodes[i].parent << ", depth = " << depth(i) << ", " << attr(i) << ", ";
		cout << "[";
		for (vint::iterator it = cren.begin(); it != cren.end(); it++){
			if (it != cren.begin()) cout << ", ";
			cout << *it;
		}
		cout << "]" << endl;
	}

}

Measured memory_bytes: 4464
from collections import deque

n,m=map(int,input().split())
ab=[map(int,input().split()) for i in range(m)]

c=[[] for i in range(n+1)]

for a,b in ab:
  c[a].append(b)
  c[b].append(a)
seen = [float('inf')]*(n+1)
que=deque()
que.append(1)
seen[1] = 0
while que:
  s=que.popleft()
  for i in c[s]:
    if seen[i] == float('inf'):
      que.append(i)
      seen[i] = s
if sum(seen[2:]) == float('inf'):
  print('No')
else:
  print('Yes')
  for i in seen[2:]:
    print(i)

Measured memory_bytes: 105708