akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 1000000000000
vector<pair<double,int>> gogo[20000];
double arrival[20000] = {};
int main() {
	pair<int, int> start, goal;
	cin >> start.first >> start.second >> goal.first >> goal.second;
	int n;
	cin >> n;
	vector<double> x, y, r;
	x.push_back(start.first);
	y.push_back(start.second);
	r.push_back(0);
	REP(i, n) {
		int a, b, c;
		cin >> a >> b >> c;
		x.push_back(a);
		y.push_back(b);
		r.push_back(c);
	}
	x.push_back(goal.first);
	y.push_back(goal.second);
	r.push_back(0);
	for (int i = 0;i <= n + 1;++i) {
		for (int q = i + 1;q <= n + 1;++q) {
			double move = max(sqrt((x[q] - x[i])*(x[q] - x[i]) + (y[q] - y[i])*(y[q] - y[i])) - (r[i] + r[q]), (double)0);
			gogo[i].push_back(make_pair(move, q));
			gogo[q].push_back(make_pair(move, i));
		}
	}
	for (int i = 0;i <= n + 1;++i) {
		arrival[i] = LONG_INF;
	}
	//graph made
	priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> next;
	next.push(make_pair(0, 0));
	while (next.empty() == false) {
		pair<double, int> wow = next.top();
		next.pop();
		for (int i = 0;i < gogo[wow.second].size();++i) {
			if (gogo[wow.second][i].first + wow.first < arrival[gogo[wow.second][i].second]) {
				arrival[gogo[wow.second][i].second] = gogo[wow.second][i].first + wow.first;
				next.push(make_pair(gogo[wow.second][i].first + wow.first, gogo[wow.second][i].second));
			}
		}
	}
	cout <<setprecision(20) <<  arrival[n + 1] << endl;
	return 0;
}

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

int main(){
	string s;

	cin >> s;

	if (s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I')
	{
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = 1e9 + 1;
int n, a, dp[100001];

int main() {    
    cin >> n;
    for (int i=0; i<n; ++i) dp[i] = INF;

    for (int i=0; i<n; ++i) {
        cin >> a;
        *lower_bound(dp, dp+n, a) = a;
    }

    cout << lower_bound(dp, dp+n, INF) - dp << endl;
    
    return 0;
}

Measured memory_bytes: 3436
H, W = map(int, input().split())
if (H == 1) or (W == 1):
    print(1)
    exit()
if H%2 == 1:
    if W%2 == 1:
        print(H*W//2 + 1)
        exit()
#     else:
#         print(H*W//2)
# else:
#     if W%2 == 1:
#         print(H*W//2)
#     else:
#         print(H*W//2)
print(H*W//2)

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const ll mod=998244353;
 
 
signed main()
{
  int n,x; cin>>n>>x;
  vi X(n);
  rep(i,n) cin>>X[i];
  int g=abs(x-X[0]);
  reps(i,n-1){
    g=GCD(g,abs(x-X[i]));
  }
  cout<<g<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, a[114514];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	int ma = -1;
	int cnt = 0;
	rep(i, n - 1) {
		cnt += a[i];
		if (cnt * 2 < a[i + 1])ma = i;
	}
	cout << n - ma - 1 << endl;
}


Measured memory_bytes: 1024
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
ll dp[51][2501][2];
ll average(ll a[], ll n, ll av, ll fl)
{
	ll cnt = 0;
	if (av == 0 and fl == 1)
		cnt++;
	if (n == 0)
		return cnt;
	if (dp[n][av][fl] != -1)
		return dp[n][av][fl];
	ll x1 = average(a, n - 1, av + a[n], 1);
	ll y1 = average(a, n - 1, av, 0);
	return dp[n][av][fl] = cnt + x1 + y1;
}
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n, av;
	cin >> n >> av;
	rep(i, 0, 51)rep(j, 0, 2501)  dp[i][j][0] = dp[i][j][1] = -1;
	ll a[n + 1];
	rep(i, 1, n + 1)
	cin >> a[i] , a[i] -= av;
	cout << average(a, n, 0, 0);
	return 0;
}

Measured memory_bytes: 5584
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;
const ll MAX_N = 1e5;

Vec par(MAX_N+1);

void init(ll n){
  repn(i, n) par[i] = i;
}

ll find(ll x){
  if(par[x] == x) return x;
  else return par[x] = find(par[x]);
}

void union_root(ll x, ll y){
  x = find(x);
  y = find(y);
  if(x != y) par[x] = y;
}


int main(void){
	ll n, m;
	cin >> n >> m;
	init(n);
	ll x, y, z;
	rep(i, m){
		cin >> x >> y >> z;
		union_root(x, y);
	}
	ll ans = 0;
	repn(i, n) if(par[i] == i) ans++;
	co(ans);

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
	int a[100]={},i,j,m;
	for(i=0;i<3;i++){
		scanf("%d",&a[i]);
	}
	for(j=0;j<2;j++){
		for(i=0;i<2;i++){
			if(a[i]>a[i+1]){
				m=a[i];
				a[i]=a[i+1];
				a[i+1]=m;
			}
		}
	}
	
	printf("%d %d %d\n",a[0],a[1],a[2]);
	return 0;
}


Measured memory_bytes: 2044
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;

int gunung[10];

int main()
{
	for(int a=0;a<10;a++)
	{
		scanf("%d",&gunung[a]);
	}
	sort(gunung,gunung+10);
	for(int a=9;a>6;a--)
	{
		printf("%d\n",gunung[a]);
	}
	return 0;
}

Measured memory_bytes: 1044
S = int(input())

flag = [0, 0] # [YYMM, MMYY]
l = S // 100
r = S % 100
if 1<=r and r<=12:
  flag[0] += 1
if 1<=l and l<=12:
  flag[1] += 1
if flag == [0, 0]:
  print('NA')
elif flag == [0, 1]:
  print('MMYY')
elif flag == [1, 0]:
  print('YYMM')
elif flag == [1, 1]:
  print("AMBIGUOUS")

Measured memory_bytes: 9184
n, m = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
mod = 10**9+7
L = [i*(m-i)%mod for i in range(1, m)]
u = 0
for i in range(m-1):
    u += (Y[i+1] - Y[i]) * L[i] % mod
    u %= mod
M = [i*(n-i)%mod for i in range(1, n)]
ans = 0
for i in range(n-1):
    ans += u * (X[i+1] - X[i]) % mod * M[i] % mod
    ans %= mod
print(ans)


Measured memory_bytes: 19196
#include<bits/stdc++.h>
#define ll long long 
using namespace std;

ll mod=1000000007;
ll findTheDistance(vector<vector<char>> grid){   
    int h=grid.size(),w=grid[0].size();
    ll dp[h][w];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=1;i<w;i++){
        if(grid[0][i]!='#')
            dp[0][i]=1;
        else
            break;
    }
    for(int i=1;i<h;i++){
        if(grid[i][0]!='#')
            dp[i][0]=1;
        else
            break;
    }
    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(grid[i][j]!='#')
                dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
        }
    }
   
    return dp[h-1][w-1];
}
int main(){
    ll h,w;
    cin>>h>>w;
    vector<vector<char>> grid(h,vector<char> (w));
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            cin>>grid[i][j];
        }
    }
    cout<<findTheDistance(grid);
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,a,b,j,t;
    while(cin>>a>>b)
    {
        int an;
        an=(a/b);
        if(a%b!=0)an=an+1;
        cout<<an<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <bitset>
using namespace std;

#define ll long long int
#define pb push_back
#define FastIO cin.sync_with_stdio(false),cin.tie(NULL)
#define file freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)

ll max(ll a, ll b){
    if(a>b) return a;
    return b;}

ll min(ll a, ll b){
    if(a<b) return a;
    return b;}

const ll N = 1e6 + 5, INF = 1e18, MOD = 1e9 + 7, M = 6000;
int a[N], b[N];
bool c[N];
vector<int> prm;

void f(int n){
	int sq = sqrt(n);
	for(int i = 0; prm[i] <= sq; i++){
		if(n % prm[i] == 0){
			while(n % prm[i] == 0)n /= prm[i];
			b[ prm[i] ]++;
		}
	}
	if(n > 1)b[n]++;
}

int main(){
	//FastIO;
	
	for(int i = 2; i < N; i++){
		if(!c[i]){
			for(int j = i; j < N; j+= i)c[j] = true;
			prm.pb(i);
		}
	}

	int n;
	cin >> n;

	int tp = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(i)tp = __gcd(tp, a[i]);
		else tp = a[i];
	}

	for(int i = 0; i < n; i++)f(a[i]);

	if(*max_element(b, b+N) > 1 && tp == 1) cout << "setwise coprime" << endl;
	else if(tp == 1) cout << "pairwise coprime" << endl;
	else cout << "not coprime" << endl;


	return 0;
}




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

#define ll long long int

int main(){
  string s,t;
  cin >> s>>t;
  ll k=0,n = s.length();
  for (ll i = 0; i < n;i++)
  {
    if(s[i]!=t[i])
      k++;
  }
  cout << k;
}

Measured memory_bytes: 3856
#include<iostream>
#include<math.h>
#include<iomanip>
#include<string.h>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<algorithm>

using namespace std;

class node{
public:
  int parent, left, right;
};

int depth(int id, node t[]){
  int d = 0;
  while(t[id].parent != -1){
    d++;
    id = t[id].parent;
  }
  return d;
}

int main(){

  int n;
  cin >> n;
  node t[n];
  for(int i = 0; i < n; i++){
    t[i].parent = t[i].left = t[i].right = -1;
  }
  for(int i = 0; i < n; i++){
    int id, degree, child;
    cin >> id >> degree;
    for(int j = 0; j < degree; j++){
      cin >> child;
      int tmp;
      t[child].parent = id;
      if(j == 0){
        t[id].left = child;

      }
      else{
        t[tmp].right = child;
      }
      tmp = child;
    }
  }
  for(int i = 0; i < n; i++){
    cout << "node " << i << ": parent = "<< t[i].parent <<", depth = " << depth(i, t) << ", ";
    if(t[i].parent == -1) cout << "root, [";
    else if(t[i].left == -1) cout << "leaf, [";
    else cout << "internal node, [";

    int cur = t[i].left;
    while(cur != -1){
      if(t[cur].right == -1){
        cout << cur;
        break;
      }
    cout << cur << ", ";
    cur = t[cur].right;
  }
  cout << "]";

  cout << endl;
  }
}



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

int main(){
  int n;
  cin >> n;
  int r=0,p;
  
  for(int i=0;i<n;i++){
    int a,b;
    cin >> a >> b;
    if(r<a){
      r=a;
      p=b;
    }
  }
  
  cout << r+p << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int p[400040];

int Find(int x){
	return p[x] == x ? x : p[x] = Find(p[x]);
}

void solve(){
	int n, k, l; scanf("%d%d%d", &n, &k, &l);
	for(int i=1;i<=n+n;i++)p[i] = i;
	rep(i, k){
		int x, y; scanf("%d%d", &x, &y);
		p[Find(x)] = Find(y);
	}
	rep(i, l){
		int x, y; scanf("%d%d", &x, &y);
		p[Find(x+n)] = Find(y+n);
	}
	ll P[200020];
	map <ll, int> M;
	for(int i=1;i<=n;i++)M[P[i] = (ll)Find(i) << 20 | Find(i+n)]++;
	for(int i=1;i<=n;i++)printf("%d ", M[P[i]]);
	
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 15104
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  bool operator< (const Point &p1) const {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;

void input() {
  cin >> N;
}

vector<Int> dp(45, -1);

Int fib(Int n) {
  if (~dp.at(n)) return dp.at(n);
  Int m = fib(n-1) + fib(n-2);
  dp.at(n) = m;
  return m;
}

void solve() {
  dp.at(0) = dp.at(1) = 1;
  cout << fib(N) << endl;
}

int main() {
  input();
  solve();
  return 0;
}



Measured memory_bytes: 3116
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

ans = 0
for i in range(N):
    candies = 0
    for j in range(i + 1):
        candies += A1[j]
    for k in range(i, N):
        candies += A2[k]
    if candies > ans:
        ans = candies

print(ans)


Measured memory_bytes: 3064
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        int min = 0;
        for (int i = 0; i < n; i++) {
            int x = h[i] -1;
            if(h[i] < min){
                min = -1;
                break;
            }else if(min < x){
                min = x;
            }
        }
        System.out.println(min < 0 ? "No" : "Yes");
        sc.close();

    }

}


Measured memory_bytes: 50380
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

typedef vector< vector<int> > graph;
const int MOD = 1000000007;

int root[1000];
int getRoot(int v){ return root[v]==-1 ? v : root[v] = getRoot(root[v]); }
int group[1000];
void visit(int pos, const graph& g, vector<int>& order, int key, bool first){
	if(group[pos] != -1) return;
	group[pos] = key;
	for(int i=0;i<g[pos].size();i++)
		visit(g[pos][i], g, order, key, first);
	if(first) order.push_back(pos);
}

void calcSCC(const graph& g){
	int n = g.size();
	graph h(n);
	for(int i=0;i<n;i++){
		for(int j=0;j<g[i].size();j++)
			h[g[i][j]].push_back(i);
	}
	vector<int> order;
	memset(group, -1, sizeof(group));
	for(int i=0;i<n;i++) visit(i, g, order, i, true);
	memset(group, -1, sizeof(group));
	for(int i=0;i<n;i++) visit(order[n-1-i], h, order, i, false);
}

long long search(const graph& g, int pos){
	long long res = 1;
	for(int i=0;i<g[pos].size();i++){
		res *= search(g, g[pos][i]);
		res %= MOD;
	}
	return res+1;
}

int main(){
	int N, M;
	while(cin >> N >> M){
		graph g(N);
		for(int i=0;i<M;i++){
			int a, b; cin >> a >> b;
			g[a-1].push_back(b-1);
		}
		calcSCC(g);
		memset(root, -1, sizeof(root));
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				if(group[i]==group[j]){
					int p = getRoot(i);
					int q = getRoot(j);
					if(p != q) root[q] = p;
				}
			}
		}
		graph h(N), g2(N);
		for(int i=0;i<N;i++){
			for(int j=0;j<g[i].size();j++){
				int p = getRoot(i);
				int q = getRoot(g[i][j]);
				if(p != q){
					h[q].push_back(p);
					g2[p].push_back(q);
				}
			}
		}
		long long res = 1;
		for(int i=0;i<N;i++){
			if(getRoot(i) == i && g2[i].size() == 0){
				res *= search(h, i);
				res %= MOD;
			}
		}
		cout << res << endl;
	}
}

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

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}
int a, b, c;
void solve() {
  cin >> a >> b >> c;
  if (c >= a && c <= b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
c=[0,0,0,0,0,0,0,0]
d=0
for x in a:
  if x<400 and c[0]==0:
    c[0]+=1
  elif 399<x<800 and c[1]==0:
    c[1]+=1
  elif 799<x<1200 and c[2]==0:
    c[2]+=1
  elif 1199<x<1600 and c[3]==0:
    c[3]+=1
  elif 1599<x<2000 and c[4]==0:
    c[4]+=1
  elif 1999<x<2400 and c[5]==0:
    c[5]+=1
  elif 2399<x<2800 and c[6]==0:
    c[6]+=1
  elif 2799<x<3200 and c[7]==0:
    c[7]+=1
  elif 3199<x:
    d+=1
e=sum(c)
print(max(e,1),e+d)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
long long int saiki(long long int H) {
    if(H == 1) {
        return 1;
    }
    return 2*saiki(H/2) + 1;
}
int main() {
    long long int H;
    cin >> H;
    long long int res = saiki(H);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;

int main(){
	ll n;
	cin >> n;
	for (ll i = 0; i * 4 <= n; i++) {
		if ((n - i * 4) % 7 == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str,str2;
  int n;
  cin >> str;
  str2 = str + str.at(11);
  str2.at(4) = ' ';
  
  for(int i = 0; i < 4; i++){
   str2.at(i) = str.at(i);
  }
 
 for(int i =5; i < 12; i++){
   str2.at(i) = str.at(i - 1) ;

  }
    cout << str2 << endl;
}

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define long long long
#define db double
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template <class T> inline void chmin(T &a, const T& val) { if (a > val) a = val; }
template <class T> inline void chmax(T &a, const T& val) { if (a < val) a = val; }
template <class T> long sqr(T a) { return 1ll * a * a; }
template <class T> void compress(T &a){
  sort(all(a)); a.resize(unique(all(a)) - a.begin());  
}

const db pi = acos(-1.00);
const db eps = 1e-6;
const int INF = 1e9;
const int MOD = 1e9+7;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

const int N = 1e5+1;
int n, m;
vector <int> a[N];

int main()
{
  fastio;
  cin >> n >> m;
  for (int i = 1; i <= m; i++){
    int u, v; cin >> u >> v;
    a[u].push_back(v); 
  }
  vector <int> dp(n + 1, -1);
  function <void(int)> dfs = [&](int u){
    if (dp[u] != -1) return;
    int mx = 0;
    for (int v : a[u]){
      dfs(v);
      chmax(mx, dp[v]);
    }  
    dp[u] = mx + 1;
  };
  for (int i = 1; i <= n; i++){
    if (dp[i] == -1) dfs(i);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) chmax(ans, dp[i] - 1);
  cout << ans;
  return 0;
}

Measured memory_bytes: 13028
# Date [ 2020-09-07 23:55:41 ]
# Problem [ a.py ]
# Author Koki_tkg

import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def Main():
    n, q = read_ints()
    uf = UnionFind(n)
    for _ in range(q):
        t, u, v = read_ints()
        if t == 0:
            uf.union(u, v)
        else:
            if uf.same(u, v):
                print(1)
            else:
                print(0)

if __name__ == '__main__':
    Main()

Measured memory_bytes: 12012
N = int(input())
list = []
result = True
for i in range(N):
    word = input()
    if i > 0:
        chk_word = list[i - 1]
        if chk_word[-1] != word[0]:
            result = False
    list.append(word)
    if list.count(word) > 1:
        result = False
print('Yes' if result else 'No')


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    int N, L;
    cin >> N >> L;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    int ok_idx = -1;
    REP(i, 0, N-1) {
        if (A[i] + A[i+1] >= L) {
            ok_idx = i;
            break;
        }
    }

    if (ok_idx == -1) {
        cout << "Impossible" << endl;
    } else {
        ok_idx++;
        cout << "Possible" << endl;
        for (int i=1; i<ok_idx; i++) cout << i << endl;
        for (int i=N-1; i>=ok_idx; i--) cout << i << endl;
    }
}



Measured memory_bytes: 1152
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.NoSuchElementException;

public class Main {

	void run() {
		FastScanner sc = new FastScanner();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int ans = 0;
		if (X == 1)
			ans += 300000;
		if (Y == 1)
			ans += 300000;
		if (X == 2)
			ans += 200000;
		if (Y == 2)
			ans += 200000;
		if (X == 3)
			ans += 100000;
		if (Y == 3)
			ans += 100000;
		if (X == 1 && Y == 1) {
			ans += 400000;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

char table[10][10] ;
int dx[] = {-1,0,1,-1,1,-1,0,1} ;
int dy[] = {-1,-1,-1,0,0,1,1,1} ;
int dx2[] = {1,0,-1,1,-1,1,0,-1} ;
int dy2[] = {1,1,1,0,0,-1,-1,-1} ;
char p = 'o' , e = 'x' ;

int f( int x , int y ){
	int ans = 0 ;
	for( int k=0 ; k<8 ; k++ ){
		int nx2 = x , ny2 = y , ans2 = 0 ;
		for( int q=0 ; ; q++ ){
			if( table[ny2+dy[k]][nx2+dx[k]] == e ) ans2++ ;
			else if( table[ny2+dy[k]][nx2+dx[k]] == p ){
				ans += ans2 ; break ;
			}
			else break ;
			nx2 += dx[k] ;
			ny2 += dy[k] ;
		}
	}
	return ans+1 ;
}

int main(){
	
	for( int i=0 ; i<10 ; i++ ){
		for( int j=0 ; j<10 ; j++ ){
			if( i==0 || i==9 || j==0 || j==9 ) table[i][j] = '#' ;
			else cin >> table[i][j] ;
		}
	}
	
	int cheak = 0 ;char a ;
	while(1){
		//cin >> a ;
		int nx=0,ny=0,nk=0,cnt=1,cnt2=0 ;
		for( int i=1 ; i<=8 ; i++ ){
			for( int j=1 ; j<=8 ; j++ ){
				if( table[i][j] == '.' ){
					cnt2 = f(j,i) ;
					if( cnt < cnt2 ){ nx = j ; ny = i ; cnt = cnt2 ; }
					else if( cnt == cnt2 ){
						if( p == 'o' ){
							if( ny > i ){ nx = j ; ny = i ; }
							else if( ny == i && nx > j ){ nx = j ; ny = i ; }
						}
						else if( p == 'x' ){
							if( ny < i ){ nx = j ; ny = i ; }
							else if( ny == i && nx < j ){ nx = j ; ny = i ;}
						}
					}
				}
			}
		}
		
		//cout << "end" << nx << " " << ny << " " << p << cnt << endl ;//------------
		if( cnt > 1 ){
			for( int i=0 ; i<8 ; i++ ){
				int nx3 = nx , ny3 = ny ;
				for( int j=0 ; ; j++ ){
					if( table[ny3+dy[i]][nx3+dx[i]] == e ){
						ny3 += dy[i] ; nx3 += dx[i] ;
					}
					else if( j>=0 && table[ny3+dy[i]][nx3+dx[i]] == p ){
						for( ; j>0 ; j-- ){
							table[ny3][nx3] = p ;
							ny3 -= dy[i] ; nx3 -= dx[i] ;
						}
						break ;
					}
					else break ;
				}
			}
			table[ny][nx] = p ;
			cheak = 0 ;
		}
		else cheak++ ;
		/*
		for( int i=0 ; i<=9 ; i++ ){//--------------
			for( int j=0 ; j<=9 ; j++ ){
				cout << table[i][j] ;
			}
			cout << endl ;
		}*/
		
		if( cheak >= 2 ) break ;
		
		swap(p,e) ;
		swap(dx,dx2) ;
		swap(dy,dy2) ;
	}
	
	for( int i=1 ; i<=8 ; i++ ){
		for( int j=1 ; j<=8 ; j++ ){
			cout << table[i][j] ;
		}
		cout << endl ;
	}
	
return 0 ;
}

Measured memory_bytes: 1136
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}

	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] a = new int[n];
		int[] b = new int[m];
		
		int[] x = new int[n*m+2];
		Set<Integer> set = new HashSet<Integer>();
		
		for(int i = 0; i < n ; i++){
			a[i] = sc.nextInt();
			if(set.contains(a[i])){
				x[i] = 0;
			}else{
				x[i] = -a[i];
				set.add(a[i]);
			}
		}

		for(int j = 0; j < m ; j++){
			b[j] = sc.nextInt();
			if(set.contains(b[j])){
				x[n+j] = 0;
			}else{
				x[n+j] = -b[j];
				set.add(b[j]);
			}
		}
		x[n+m] = 0;
		x[n+m+1] = 0;

		Arrays.sort(x);
		
		if(x[0] != -n*m){
			System.out.println(0);
			return;
		}

		int col = 0;
		int row = 0;
		
		int ans = 1;
		
		for(int k = 0; x[k] != 0; k++){
			
			int from = -x[k+1];
			int to = -x[k];
			
//			System.out.println(from +" - "+to);
			int filled = n*m - to;
			
			int c1 = 0;
			int r1 = 0;
			int c2 = 0;
			int r2 = 0;
			for(int i=0; i < n;i++){
				if(a[i] == to) {
					col++;
					c1++;
				}
				if(a[i] > to){
					c2++;
				}
			}
			
			for(int j = 0 ; j < m;j++){
				if(b[j] == to) {
					row++;
					r1++;
				}
				if(b[j] > to){
					r2++;
				}
			}
			
			if(c1 >= 2 || r1 >= 2){
				System.out.println(0);
				return;
			}
			
//			System.out.println("(col,row) :"+col+" "+row);
			
			int rem = col*row - filled -1;
			int toFill = (to - from) - 1;
					
			int pat = nPr(rem ,toFill);
			if(!(c1 == 1 && r1 == 1)){
				if(c1 == 1){
					ans = prod(ans, Math.max(r2,1));					
				}
				if(r1 == 1){
					ans = prod(ans, Math.max(c2,1));										
				}
			}
			ans = prod(ans,pat);			
		}
		System.out.println(ans);
	}
	

	int nPr(int n, int r){
		if(n < r){
			return 0;
		}
		int ans = 1;
		for(int i = n-r+1; i <= n; i++){
			ans = prod(ans,i);
		}
//		System.out.println(n+"P"+r+ " = " + ans);
		return ans;
	}
	
	int mod = 1_000_000_000 + 7;
	int prod(int a,int b){
		return (int)(((long)(a)*(b))%mod);
	}
}


Measured memory_bytes: 32480
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

vi ToDigs(ll w){
  vi res;
  while(w > 0)
    res.pb(w % 10),
    w /= 10;
  reverse(all(res));
  return res;
}

ll FromDigs(const vi& d){
  ll res = 0;
  for(int i = 0;i < sz(d);++i)
    res = res * 10 + d[i];
  return res;
}

int Sum(ll w){
  int res = 0;
  for(int d : ToDigs(w)) res += d;
  return res;
}

bool Better(ll n, ll m){
  return n * Sum(m) > m * Sum(n);
}

ll GetNext(ll to){
  vi digs = ToDigs(to);

  vector<ll> cand = {to};
  for(int i = sz(digs) - 1;i >= 0;--i){
    digs[i] = 9;
    ll val = FromDigs(digs);
    if(val > to) cand.pb(val);
  }

  sort(all(cand));
  cand.erase(unique(all(cand)), cand.end());

  //for(ll e : cand) cout << e << endl;

  for(int i = 0;i < sz(cand);++i){
    bool fine = true;
    for(int j = i + 1;j < sz(cand);++j)
      if(Better(cand[i], cand[j])){
        fine = false;
        break;
      }
    if(fine) return cand[i];
  }
}

int main(){
  int k;
  scanf("%d", &k);

  ll val = 1;
  for(int i = 0;i < k;++i){
    printf("%lld\n", val);
    val = GetNext(val + 1);
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

LLi gcd(LLi a, LLi b) {
	if(a<0) a=b;
	if(b<0) b=a;
    if (b == 0) return a;
    return gcd(b, a%b);
}

LLi lcm(LLi a, LLi b) {
    return a/gcd(a, b)*b;
}

int main(){

	LLi n, m, tw=1;
	vector<LLi> v;

	cin>> n >> m;
	v.resize(n);

	rep(i, n){
      cin >> v[i];
      v[i]/=2;
    }

  	while(1){
      if((v[0]/tw)%2==0) tw*=2;
      else break;
    }
  
	rep(i, n) {
		if ((v[i]/tw)%2!=1 || (v[i]*2/tw)%2!=0){
          cout<< "0" <<endl;
          return 0;
        }
	}
  //PV(v);
  
  	for(int i=0;i<n-1;i++){
      v[i+1]=lcm(v[i], v[i+1]);
    }
  //cout<< v[n-1] <<endl;

	cout<< m/v[n-1]-m/v[n-1]/2 << endl;
 
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	char i,j=3,a[3],k=3;
	scanf("%s",a);
	for(i=0;i<3;i++)
	{
		if(a[i]=='a')
		{
			j--;
			break;
		}
	}
	for(i=0;i<3;i++)
	{
		if(a[i]=='b')
		{
			j--;
			break;
		}
	}
	for(i=0;i<3;i++)
	{
		if(a[i]=='c')
		{
			j--;
			break;
		}
	}
	if(j==0)printf("Yes");
	else printf("No");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

// g:graph, start: start node
// resurt: all distance from start node
vector<long long> dijkstra(vector<vector<pair<ll, ll>>> g, ll start){
    vector<ll> distance(g.size(), INF);
    priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>>> que;
    distance[start] = 0;
    que.push(make_pair(0, start));

    while(!que.empty()){
        pair<long ,long> now = que.top();
        long long now_pos = now.second;
        que.pop();
        if(distance[now_pos] < now.first){
            continue;
        }
        // cost next
        for(long long i = 0; i < g[now_pos].size(); i++){
            pair<long ,long> next = g[now_pos][i];
            long long next_cost = next.first;
            long long next_pos = next.second;
            if(distance[next_pos] > distance[now_pos] + next_cost){
                distance[next_pos] = distance[now_pos] + next_cost;
                que.push(make_pair(distance[next_pos], next_pos));
            }
        }
    }

    // vector<long long>
    return distance;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll v, e, r;
    cin >> v >> e >> r;

    vector<vector<pair<ll, ll>>> g(v);
    
    rep(i, e){
        ll s, t, c; // start, to, cost
        cin >> s >> t >> c;
        g[s].emplace_back(c, t);

    }

    vector<ll> distance;
    distance = dijkstra(g, r);

    rep(i, v){
        if(distance[i] == INF){
            cout << "INF" << endl;
        }else{ 
            cout << distance[i] << endl;
        }
    }

}


Measured memory_bytes: 30856
#include <iostream>
#include <cstdio>
using namespace std;
#define REP0(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define ALL(c) (c).begin(),(c).end()
int main(){
	int d=100000,n;
	scanf("%d",&n);
	REP0(i,n){
		d=d*105/100;
		d=(d+999)/1000*1000;
	}
	printf("%d\n",d);
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n, k;
    cin >> n >> k;
    vint a(n);
    rep(i, n) cin >> a[i];

    vll sum(n+1, 0);
    rep(i, n) sum[i+1] = sum[i] + a[i];

    vll ls;
    rep(i, n) srep(j, i, n) {
        ls.push_back(sum[j+1] - sum[i]);
    }

    for (int i = 40; i >= 0; --i) {
        vll ls2;
        rep(j, ls.size()) {
            if ((1ll << i) & ls[j]) ls2.push_back(ls[j]);
        }
        if (ls2.size() >= k) {
            ls = ls2;
        }
    }

    ll ans = 1;
    rep(i, 40) {
        ans <<= 1;
        ans++;
    }
    rep(i, ls.size()) {
        ans &= ls[i];
    }
    
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define ld long double
#define pr pair<ll,ll>
#define loop(i,n) for(ll i=0 ; i<n ; ++i)
#define rep(i,x,n) for(ll i=x ; i<=n ; ++i)
#define iteloop(type,data,name,it) for(type<data>::iterator it=name.begin() ;it!=name.end() ; ++it)
using namespace std;
const ll N=2e5 + 5;
int n;
int arr[N];
int main(){
    cin.sync_with_stdio(false), cin.tie(0) , cout.tie(0);
#ifndef ONLINE_JUDGE
   // freopen("in.txt", "rt" , stdin);
    // freopen("out.txt", "wt" , stdout);
#endif // ONLINE_JUDGE
    cin>>n;
    n*=2;
    int sum=0;
    loop(i,n){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(int i=0; i<n ; i+=2){
        sum+=arr[i];
    }
    cout<<sum<<endl;
}

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


int main() {
int X,Y,A,B,C;
cin>>X>>Y>>A>>B>>C;
vector<long> a(A);
vector<long> b(B);
vector<long> c(C);
for(int i=0;i<A;i++) cin>>a[i];
for(int i=0;i<B;i++) cin>>b[i];
for(int i=0;i<C;i++) cin>>c[i];

for(int i=0;i<A;i++) a[i]=-a[i];
for(int i=0;i<B;i++) b[i]=-b[i];
for(int i=0;i<C;i++) c[i]=-c[i];

sort(a.begin(),a.end());

sort(b.begin(),b.end());

sort(c.begin(),c.end());


long ans=0;
priority_queue<int> que;
for(int i=0;i<X;i++){
  que.push(a[i]);
}
for(int i=0;i<Y;i++){
  que.push(b[i]);
}

for(int i=0;i<C;i++){
  int s = que.top();
  if(s>c[i]){
  que.pop();
  que.push(c[i]);
}
}


while(!que.empty()){
  int s = que.top();
  ans+=s;
  que.pop();
}
cout<<-ans<<endl;

}


Measured memory_bytes: 3704
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		int n = sc.nextInt();
		sc.nextLine();
		ArrayList<String> us = new ArrayList<String>();
		for(int i = 0; i < n; i++){
			String u = sc.nextLine();
			us.add(u);
		}
		int m = sc.nextInt();
		int open = 0;
		sc.nextLine();
		for(int i = 0; i < m; i++){
			String t = sc.nextLine();
			if(us.contains(t)){
				if(open == 0){
					open = 1;
					System.out.println("Opened by " + t);
				}
				else if(open == 1){
					open = 0;
					System.out.println("Closed by " + t);
				}
			}
			else{
				System.out.println("Unknown " + t);
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 23168
import java.util.Scanner;

class Main{
    public static double mathS(int a,int b,int C){
        double Rad = Math.toRadians(C);
        double S = a * b * Math.sin(Rad) / 2;
        return S;
    }
    
    public static double mathL(int a,int b,int C){
        double Rad = Math.toRadians(C);
        double L = a + b + Math.sqrt(a*a + b*b - 2 * a * b * Math.cos(Rad));
        return L;
    }
    
    public static double mathB(int b , int C){
        double Rad = Math.toRadians(C);
        double B = b * Math.sin(Rad);
        return B;
    }
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int C = sc.nextInt();
        
        System.out.println(mathS(a,b,C));
        System.out.println(mathL(a,b,C));
        System.out.println(mathB(b,C));
        
    }
}


Measured memory_bytes: 26348
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

int main()
{
    std::string S;
    std::cin >> S;
    int siz = S.size();
    int first = (siz - 1) / 2;
    int second = (siz + 3) / 2;
    if(std::equal(S.begin(), S.end(), S.rbegin(), S.rend()) && std::equal(S.begin(), S.begin() + first - 1, S.begin() + second - 1, S.end() - 1))
        std::cout << "Yes";
    else std::cout << "No";
}


Measured memory_bytes: 256