akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <cassert>

using namespace std;

class atC {
public:
    void solve(istream& in, ostream& out) {
        long long N, M;
        in >> N >> M;
        
        long long low = 0, hi = N+M, ans = 0;
        while (low <= hi) {
            long long mid = (low + hi) / 2;
            //cout << "check: " << mid << endl;
    
            long long curN = N, curM = M;
            long long needS = mid, needcc = mid;
            
            needS -= curN;
            curM -= needcc*2;
            if (needS > 0) {
                curM -= needS*2;
            }
            if (curM < 0) {
                hi = mid-1;
            } else {
                ans = mid;
                low = mid+1;
            }
        }
        
        out << ans << "\n";
    }
};


int main() {
	std::ios::sync_with_stdio(false);

	atC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int n;
bool can[100000];
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=0;i<=30;i++){
        for(int j=0;j<=30;j++){
            int sum = 4*i + 7*j;
            can[sum]=true;
        }
    }

    if(can[n])cout<<"Yes\n";
    else cout<<"No\n";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }

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

  ll n,m; cin >> n >> m;
  ll sum = 0;
  rep(i, m) {
    ll tmp; cin >> tmp;
    sum += tmp;
    if(sum > n) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << n - sum << endl;
  return 0;
}


Measured memory_bytes: 3656
from math import sqrt
n = int(input())
arr = list(map(int,input().split()))
x = dict()
y = dict()
for i in range(n):
    key = i+arr[i]
    if(x.get(key,0) == 0):
        x[key] = [i]
    else:
        x[key].append(i)
    key = i - arr[i]
    if (y.get(key, 0) == 0):
        y[key] = [i]
    else:
        y[key].append(i)
ans = 0
for key in x:
    if(y.get(key,0)!=0):
        ans += len(y[key])*len(x[key])
print(ans)






















Measured memory_bytes: 91708
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include<string>
#include<cstring>
#include<complex>
#include<cmath>
using namespace std;
#define rep(i, n)   for(int i = 0; i < (int)(n); i++)
#define rrp(i, n)   for(int i = ((int)(n)); i >=0; i--)
#define mpp(i,j,k)  make_pair((int)(i),make_pair((int)(j),(int)(k)))
typedef pair<int,pair<int,int > > pp;
typedef vector<int> vi;
typedef vector<vi>  vvi;
int n,ma,mb,a,b,c;
vvi e(401,vi(401,1000000));




int main(){

cin>>n>>ma>>mb;
e[0][0]=0;
rep(i,n){cin>>a>>b>>c,e[a][b]=min(e[a][b],c);rrp(j,400-a)rrp(k,400-b){if(!(j==a&&k==b)&&e[j][k]<1000000)e[a+j][b+k]=min(e[a+j][b+k],e[a][b]+e[j][k]);}}
int f=1000000;
rep(i,400/(ma+mb)+1)if(e[i*ma][i*mb]>0)f=min(f,e[i*ma][i*mb]);
if(f<1000000)cout<<f<<endl;
else cout<<-1<<endl;
  return 0;}




Measured memory_bytes: 896
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

s = sum(a2)

a1_c = [0]
a2_c = [0, s]

for ai in a1:
    a1_c.append(a1_c[-1] + ai)

for ai in a2[:-1]:
    a2_c.append(a2_c[-1] - ai)

print(max([a1i + a2i for a1i, a2i in zip(a1_c, a2_c)]))


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

int main()
{
	int a, b, c, d; cin >> a >> b >> c >> d;

	for (;;)
	{
		c -= b;
		if (c <= 0)
		{
			cout << "Yes"s << endl;
			break;
		}

		a -= d;
		if (a <= 0)
		{
			cout << "No"s << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 3596
class NilClass
  def +(i)
    return nil
  end
end
 
def dfs(a, b, c, k)
  
  if k == N
    return nil if [a, b, c].min == 0
    return (A-a).abs + (B-b).abs + (C-c).abs - 10 * 3
  end
  
  x = dfs(a+L[k], b, c, k+1) + 10
  y = dfs(a, b+L[k], c, k+1) + 10
  z = dfs(a, b, c+L[k], k+1) + 10
  w = dfs(a, b, c, k+1)
  
  [x, y, z, w].compact.min
end
 
N, A, B, C = gets.split.map(&:to_i)
 
L = Array.new(N)
N.times{ |i| L[i] = gets.to_i }
 
p dfs(0, 0, 0, 0)

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

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

int main() {
  string X;
  cin >> X;

  int Min = 753;
  
  int A = ctoi(X.at(0));
  int B = ctoi(X.at(1));
  for(int i=2; i<X.size(); i++){
    int C = ctoi(X.at(i));
    int val = abs(753-(A*100+B*10+C));
    
    Min = min(Min,val);
    
    A = B;
    B = C;
  }
  
  cout << Min << endl;
  return 0;
}


Measured memory_bytes: 256
N, M = gets.to_s.split(' ').map(&:to_i)

lm = 1
rm = N

M.times do |m|
  l, r = gets.to_s.split(' ').map(&:to_i)
  lm = l if l > lm
  rm = r if r < rm
end

puts [rm - (lm - 1), 0].max


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

typedef long long ll;
typedef vector<int> vi;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

//グラフの隣接リスト
map<int, vector<int>> g;
//頂点の入次数を管理
int h[100010];

int main()
{
  //頂点数v、辺の数e
  int v, e;
  cin >> v >> e;
  REP(i, e) {
    int s, t;
    cin >> s >> t;
    g[s].push_back(t);
    h[t]++;
  }

  //入次数が0の頂点の集合
  stack<int> st;
  REP(i, v) if(h[i] == 0) st.push(i);

  vi ans;
  
  while(st.size()) { //stがなくなるまでループ
    //stの集合のから一つ取り出す
    int i = st.top(); st.pop();
    ans.push_back(i);
    for(auto& j: g[i]) {
      h[j]--; //隣接する頂点の入次数をマイナス1
      //これによって入次数が0になればstに追加
      if(h[j] == 0) st.push(j);
    }
  }

  for(int i: ans) cout << i << endl; //ans.size() == v であればトポロジカルソートができた -> 閉路なし
  return 0;
}


Measured memory_bytes: 4348
#include <stdio.h>
void CALL(int n){
    int x ;
    int i = 1;
    
    //CHECK_NUM
    do{
        x = i;
        if(x % 3 == 0){
            printf(" %d" , i);
            continue;
        }
        
        //INCLUDE3
        do{
            if(x % 10 == 3){
                printf(" %d" , i);
                break;
            }
            x /= 10;
        }while(x);
    }while(++i <= n);
    printf("\n");
}

int main(void){
    int n;
    scanf("%d" , &n);
    CALL(n);
    return 0;
}


Measured memory_bytes: 2148
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int s = a+b+c+d;
  cout << s/60 << endl << s%60 << endl;


	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    cout << (a * b % 2 == 0 ? "Even" : "Odd") << endl;

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = input().split()
D = {}

for i in range(N):
	if A[i] in D.keys():
		D[A[i]] += 1
	else:
		D[A[i]] = 1

ans = 0
if len(D) > K:
	D = sorted(D.values(),reverse = True)
	ans = sum(D[K:])

print(ans)

Measured memory_bytes: 35616
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)


ans = [0 for _ in range(N + 1)]
out = []
for idx in range(N, 0, -1):
	count = 0
	rep = 1
	while(idx * rep <= N):
		count += ans[idx * rep]
		rep += 1
		
	if A[idx] != count % 2:
		ans[idx] = 1
		out.append(idx)

print(len(out))
if(len(out)>0):
	print(" ".join(map(str, out)))

Measured memory_bytes: 19836
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);



int main() {
    ll n;
    cin >> n;
    vector<ll> v(n);
    vector<ll> m;
    vector<ll> s;
    bool f = true;
    bool t = true;
    bool zero=true;


    rep(i, n) {
        cin >> v[i];
        if (v[i] >= 0)f = false;
        if (v[i] < 0)t = false;
        if(v[i]!=0)zero=false;
        if (v[i] >= 0)s.push_back(v[i]);
        if (v[i] < 0)m.push_back(v[i]);
    }
    //vector<ll> c;
    //sort(c.begin(),c.end());
    sort(v.begin(), v.end());
    sort(s.begin(), s.end());
    sort(m.begin(), m.end());
    vector<pair<ll, ll>> ans;
    if(zero){
        cout<<0<<endl;
        rep(i,n-1){
            cout<<0<<" "<<0<<endl;
        }
        return 0;
    }


    if(n==2){
        cout<<v[1]-v[0]<<endl;
        cout<<v[1]<<" "<<v[0]<<endl;
        return 0;
    }


    if (f) {//負のみ


        ll las = m[m.size() - 1];
       // cout<<las<<endl;
        for (int i = 0; i < m.size()-1 ; i++) {
            ans.push_back({las, m[i]});
            las -= m[i];
        }

        cout << las << endl;

        rep(i, ans.size()) {
            cout << ans[i].first << " " << ans[i].second << endl;
        }



    }else if(t){//正のみ

            ll lass=s[0];
            for(int i=2;i<s.size();i++){
                ans.push_back({lass,s[i]});
                lass-=s[i];
            }
           // cout<<lass<<endl;


            ans.push_back({s[1],lass});
            cout<<s[1]-lass<<endl;
            rep(i,ans.size()){
                cout<<ans[i].first<<" "<<ans[i].second<<endl;
            }

     }else{

        ll las=m[0];
        for(int i=0;i<s.size()-1;i++){
            ans.push_back({las,s[i]});
            las-=s[i];
        }

        ll las2=s[s.size()-1];
        for(int j=1;j<m.size();j++){
            ans.push_back({las2,m[j]});
            las2-=m[j];
        }


        ans.push_back({las2,las});


        cout<<las2-las<<endl;
        rep(i,ans.size()){
            cout<<ans[i].first<<" "<<ans[i].second<<endl;
        }


    }

    return 0;
}


Measured memory_bytes: 5872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b-1; i >= a; i--)
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;

signed main(){
    ll A, B; cin >> A >> B;
    cout << A * B / __gcd(A,B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

vector<long> inputVector(long n)
{
    vector<long> vec(n);
    rep(i, n)
    {
        scanf("%d", &vec.at(i));
    }
    return vec;
}
void printVector(vector<long> l)
{
    for (long i = 0; i < l.size(); i++)
    {
        cout << l.at(i) << endl;
    }
}
int main()
{
    long n;
    cin >> n;
    vector<long> a = inputVector(n - 1);
    vector<long> ans(n, 0);
    rep(i, n - 1)
    {
        ans.at(a.at(i) - 1)++;
    }
    printVector(ans);
    // scanf("%d", &x);
    // printf("%d\n", x * x * x);
}

Measured memory_bytes: 8080
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(x...)
#endif
#define int long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define loop(i,c) for(auto i=(c).begin();i!=(c).end();i++)
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define F first
#define S second
const int mod =  1000000007;

void solving() {
	int n;
	cin >> n;
	int a[n], Xor = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		Xor ^= a[i];
	}
	for (int i = 0; i < n; i++) {
		cout << (Xor ^ a[i]) << " ";
	}
}

int32_t main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// int t{}; cin >> t; while (t--)
	solving();

	return 0;
}

Measured memory_bytes: 5132
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    int n, r;
    cin >> n >> r;

    if (n < 10)
        r += 100 * (10 - n);

    cout << r << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)


def dfs(v, s):
    global origin, cycle
    path[v] = s
    nv = A[v]
    if path[nv] >= 0:
        origin = nv
        cycle = (s + 1) - path[nv]
    else:
        dfs(nv, s + 1)


N, K = map(int, input().split())
A = list(map(lambda x: int(x) - 1, input().split()))
origin = 0
cycle = 0
path = [-1] * N
dfs(0, 0)

if K <= path[origin]:
    for i, s in enumerate(path):
        if s == K:
            print(i + 1)
            break
else:
    rest = K - path[origin]
    rest %= cycle
    for i, s in enumerate(path):
        if s == path[origin] + rest:
            print(i + 1)
            break


Measured memory_bytes: 180304
#include <iostream>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;


int n,m[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
	int v;
	color[u]=GRAY;
	d[u] = ++tt;
	for(v=0;v<n;v++){
		if(m[u][v]&&color[v]==WHITE)
		dfs_visit(v);
	}
	color[u] = BLACK;
	f[u] = ++tt;
	
}

void dfs(){
	int u;
	
	for(u=0;u<n;u++){
		color[u]=WHITE;
	}
	tt=0;
	for(u=0;u<n;u++){
		if(color[u]==WHITE){
			dfs_visit(u);
		}
		}
			for(int i=0;i<n;i++){
			cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
		}
	}



int main(){
	int u,k,v;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			m[i][j]=0;
		}
	}
	for(int i=0;i<n;i++){
		cin>>u>>k;
		u--;
		for(int j=0;j<k;j++){
			cin>>v;
			v--;
			m[u][v]=1;
		}
	}
	
	dfs();
	return 0;
}

Measured memory_bytes: 3104
def main(s):
    head, tail = 0, 0

    for _s in s:
        if _s == 'A':
            break

        head += 1

    for _s in s[::-1]:
        if _s == 'Z':
            break

        tail += 1

    print(len(s) - (head + tail))


if __name__ == '__main__':
    s = input()

    main(s)


Measured memory_bytes: 3512
#include<stdio.h>
int main(){
  
   int S,h,m,s;
     
     h=m=s=0;
  
   scanf("%d",&S);
  
   s = S % 60;
   m = (S / 60) % 60;
   h = S / 3600;
  
   printf("%d:%d:%d\n",h,m,s);
 
 
   return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, k, l[50];
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}

	sort(l, l+n);

	int ans = 0;
	for (int i = n-1; i >= n-k; i--) {
		ans += l[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,x,y) for(int i=(int)x; i<(int)y; ++i)
int main(){
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  if(H%h==0 && W%w==0){
    printf("No\n");
    return 0;
  }
  printf("Yes\n");
  FOR(i,0,H){
    FOR(j,0,W){
      if(i%h==h-1 && j%w==w-1) printf("-999999 ");
      else if(i%h==0 && j%w==0) printf("999998 ");
      else printf("0 ");
    }
    printf("\n");
  }
  return 0;
}


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

//iya

int R;

int main () {
    cin>>R;
    if(R<1200)
        cout<<"ABC"<<endl;
    else{
        if(R<2800)
            cout<<"ARC"<<endl;
        else
            cout<<"AGC"<<endl;
    }
}

Measured memory_bytes: 3568
count = 0
W = input().lower()
T = [0]
while True:
    try:
        if T[0] == "END_OF_TEXT":
            break
        for t in T:
            if W == t:
                count += 1
        T = [x.lower() for x in input().split()]
    except EOFError:
        break
    except IndexError:
        break
print(count)

Measured memory_bytes: 7448
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {

    int N, K;

    int a[1010];  // 最大 100 個ですが余裕をもたせます
    cin >> N;
    cin >> K;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N);
    int sum = 0;

    for (int i = 0; i < K; ++i) {
        sum += a[i];
    }

    cout << sum << endl;




}

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

int main(void)
{
    int a, b;
    cin >> a >> b;

    int result = a * b;
    if (result % 2 == 0)
        cout << "Even" << endl;
    else
        cout << "Odd" << endl;
    return (0);
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    ios::sync_with_stdio(false);
    const double PI = 3.14159265358979323846;

    int r;
    cin >> r;
    cout << (double)(r * 2) * PI << endl;
    return 0;
}


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

typedef vector<int> vi;
typedef vector<string> vs;

class UnionFind {
	private: 
		vi p, rank, t;
	public:
		UnionFind(int N) { 
			rank.assign(N, 0);
			t.assign(N, 1);
			p.assign(N, 0); 
			for (int i = 0; i < N; i++) 
				p[i] = i;
		}
		int findSet(int i) { 
			return (p[i] == i) ? i : (p[i] = findSet(p[i])); 
		}
		bool isSameSet(int i, int j) { 
			return findSet(i) == findSet(j);
		}
		void unionSet(int i, int j) {
			if (!isSameSet(i, j)) {
				int x = findSet(i), y = findSet(j);
				if (rank[x] > rank[y]) {
					p[y] = x;
					t[x] += t[y];
				} else {
					p[x] = y;
					t[y] += t[x];
					if (rank[x] == rank[y])
						rank[y]++;
				}
			}
		}
		int totalSet(int i) {
			return t[findSet(i)];
		}
};

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int h, w, i, j, _max = 0;
	vs mtx;
	string row;
	cin >> h >> w;
	UnionFind UR(h * w), UC(h * w);
	for (i = 0; i < h; i++) {
		cin >> row;
		mtx.push_back(row);
		for (j = 0; j < w; j++) {
			if (row[j] == '.') {
				if (j > 0) {
					if (mtx[i][j - 1] == '.')
						UR.unionSet(w * i + j, w * i + (j - 1));
				}
				if (i > 0) {
					if (mtx[i - 1][j] == '.')
						UC.unionSet(w * i + j, w * (i - 1) + j);
				}
			}
		}
	}
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (mtx[i][j] == '.')
				_max = max(_max, UR.totalSet(w * i + j) + UC.totalSet(w * i + j) - 1);
		}
	}
	cout << _max << endl;
	return 0;
}

Measured memory_bytes: 98048
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		String u = "U",r = "R",d = "D",l = "L";
		for( int i=0; i<ty-sy-1; i++ ){
			u += "U";
		}
		for( int i=0; i<tx-sx-1; i++ ){
			r += "R";
		}
		for( int i=0; i<ty-sy-1; i++ ){
			d += "D";
		}
		for( int i=0; i<tx-sx-1; i++ ){
			l += "L";
		}
		System.out.println(u+r+d+l+"L"+u+"U"+"R"+r+"D"+"R"+d+"D"+"L"+l+"U");
	}
}


Measured memory_bytes: 54612
package main

import "fmt"

func main() {
	var A, B, C, K int
	fmt.Scan(&A, &B, &C, &K)
	if A >= K {
		fmt.Println(K)
	} else if A+B >= K {
		fmt.Println(A)
	} else {
		r := (K - (A + B))

		fmt.Println(A - r)
	}
}


Measured memory_bytes: 1748
s = int(input())
if(s >=1800 and s<2000):
  print(1)
elif(s>=600 and s<800):
  print(7)
elif(s>=800 and s<1000):
  print(6)
elif(s>=1000 and s<1200):
  print(5)
elif(s>=1200 and s<1400):
  print(4)
elif(s>=1400 and s<1600):
  print(3)
elif(s>=1600 and s<1800):
  print(2)
elif(s>=400 and s<600):
  print(8)
else:
  print()



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



using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  
  for(int i=0;i<n;i++){
   cin >> a[i];
  }
 
  for(int i=n-1;i>=0;i-=2)  cout << a[i] << " ";
  
  if(n%2==0){ 
              for(int i=0;i<n;i+=2)  cout << a[i] << " ";
  }
  else       {
              for(int i=1;i<n;i+=2)  cout << a[i] << " ";
  
  }
}

Measured memory_bytes: 2944
// Created by sz
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;

const int N = 5e6 + 5;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;
    double ans = 0;
    for(int i = 0; i<n; i++){
        double x;
        string s;
        cin>>x>>s;
        if(s == "JPY")ans+= x;
        else ans+=  x*380000.0;
    }
    cout<<fixed<<setprecision(6)<<ans<<endl;
    
    return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
double EPS=1e-10;
double EQ(double a,double b){
  return abs(a-b)<EPS;
}
void fast_stream(){
  cin.tie(0);
  std::ios_base::sync_with_stdio(0);
}
template<class T>
string IntToString(T num){
  string res;stringstream ss;ss<<num;
  return ss.str();
}
ll StringToInt(string &str){
  ll res=0;
  for(int i=0;i<(int)str.size();i++)
    res=(res*10+str[i]-'0');
  return res;
}
int N;
ll M;
ll as[101];
double ps[101];

ll gcd(ll a,ll b){
  if(b==0)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}
long double lcm2(ll a,ll b){
  return 1.0*a*b/gcd(a,b);
}

int main(){
  cin>>N>>M;
  for(int i=0;i<N;i++)cin>>as[i];
  for(int i=0;i<N;i++){
    cin>>ps[i];
    ps[i]/=100;
  }
  double res=0;
  for(int i=1;i<(1<<N);i++){
    double per=1;
    int bitCnt=__builtin_popcount(i);
    ll m=1;
    for(int j=0;j<N;j++){
      if((i>>j)&1){
	// Mツづーツ陳エツつヲツつスツづァfin
	double d=lcm2(m,as[j]);
	//cout<<i<<" "<<j<<" "<<m<<" "<<as[j]<<" "<<d<<endl;
	if(lcm2(m,as[j])>M){
	  m=M+1;
	  break;
	}
	//cout<<m<<" "<<as[j]<<endl;
	m=lcm(m,as[j]);
	//cout<<m<<endl;
	per*=ps[j];
      }
    }
    //cout<<res<<" "<<m<<endl;
    if(!(bitCnt%2))res-=per*(M/m);
    else res+=per*(M/m);
  }
  printf("%.10f\n",res);
  return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
#define  ref(i,n) for(int i=0;i<n;i++)
#define INF 10000000
using namespace std;

int h,w,k,ans=10000000,last=0,ju=0;

int a[10][1000];


int main()
{
    cin>>h>>w>>k;
    ref(i,h)
        ref(j,w) {
            char cc;
            cin>>cc;
            if(cc=='1') a[i][j]=1;
            else a[i][j]=0;
    }
    int bb=pow(2,h-1);


    ref(i,bb){

        vector<int>v;
        int num=0;
        v.push_back(0);

        ref(j,h-1){
            if(i>>j&1) v.push_back(j+1);
        }

        int b[10]={0};
        bool c[10]={0};

        ref(j,w){

            ref(s,v.size()){
                int t=v[s];
                do{

                    b[s]+=a[t][j];
                    t++;

                    if (b[s]>k){
                        c[s]=1;
                        if(j==last) {ju=1;}

                        break;
                    }
                    if(t==h) break;

                } while(!(i>>(t-1)&1));
            }
            if(ju) break;

            ref(s,v.size()){
                if(c[s]){
                    ref(t,10) b[t]=0;
                    num++;
                    j--;
                    ref(t,10) c[t]=0;
                    last=j+1;

                    break;
                }
            }

        }
        if(ju){ju=0;continue;}
        if((num+v.size()-1)<ans) {ans=num+v.size()-1;}

    }
    cout<<ans;


        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  int n,i;
  map<char,char> ms,mt;
  cin>>s>>t;
  n=s.length();
  for(i=0;i<n;i++){
    if(!ms.count(s.at(i))) ms[s.at(i)]=t.at(i);
    else if(ms[s.at(i)]!=t.at(i)) break;
    if(!mt.count(t.at(i))) mt[t.at(i)]=s.at(i);
    else if(mt[t.at(i)]!=s.at(i)) break;
  }
  if(i<n) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 3896
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

    string s;
    cin >> s;

    int a_min = (int)s.size();
    int z_max = 0;

    for(int i = 0; i < s.size(); i++){

        if(s[i] == 'A'){
            if(a_min > i) a_min = i;
        }
        if(s[i] == 'Z'){
            z_max = i;
        }
    }
    cout << z_max - a_min + 1 << endl;


}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var N = int.Parse(input[0]);
        var M = int.Parse(input[1]);

        var K = new List<int>();
        var A = new List<List<int>>();
        for(int i = 0; i < N; i++)
        {
            var line = Console.ReadLine().Split(" ");
            K.Add(int.Parse(line[0]));
            var list = new List<int>();
            for (int j = 1; j <= K[i]; j++) 
            {
                list.Add(int.Parse(line[j])); 
            }
            A.Add(list);
        }

        var summary = new int[M];
        foreach(var line in A)
        {
           foreach(var item in line)
            {
                summary[item - 1]++;
            } 
        }

        var count = 0;
        for(int i = 0; i < M; i++)
        {
            if (N == summary[i]) count++;
        }

        Console.WriteLine(count);

    }
}


Measured memory_bytes: 27948
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 998244353;
const int MAXN =(int) 2e5+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------
int N;
int X[MAXN],D[MAXN];
LL ans;
LL dp[MAXN];
vector<int> maxR[MAXN];
int Rmax[MAXN];

struct Node{
    int l,r;
}node[MAXN];
stack< pair<int,int> >st;

bool cmp(const Node& a,const Node& b){
    if(a.l==b.l) return a.r<b.r;
    return a.l<b.l;
}

void work(){
    scanf("%d",&N);
    for(int i=1;i<=N;i++){
        scanf("%d%d",&X[i],&D[i]);
        node[i].l=X[i];
        node[i].r=X[i]+D[i]-1;
    }
    sort(node+1,node+1+N,cmp);
    for(int i=N;i>=1;i--){
        int l=node[i].l,r=node[i].r;
        int next=i+1;
        while(!st.empty()){
            pair<int,int> tmp=st.top();
            if(node[tmp.first].l<=r){
                st.pop();
                next=tmp.second;
            }
            else{
                break;
            }
        }
        st.push(make_pair(i,next));
        Rmax[i]=next;
    }
    dp[N+1]=1;
    for(int i=N;i>=1;i--){
        dp[i]=(dp[i+1]+dp[Rmax[i]])%MOD;
        ans+=dp[i];
    }
    printf("%lld\n",dp[1]%MOD);
}
/*
4
1 3
5 10
6 1
8 12
*/
///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}








Measured memory_bytes: 11264
S = input()

count = 0

if len(S)%2 == 0:
    for i in range(len(S)//2):
        if S[i] != S[-i-1]:
            count += 1
else:
    for i in range(int(len(S)//2)):
        if S[i] != S[-i-1]:
            count += 1
print(count)           

Measured memory_bytes: 3060
#include <iostream>
int main(){
	for (int i = 0; i < 3; ++i){
		int h, m, s, h2, m2, s2;
		std::cin >> h >> m >> s >> h2 >> m2 >> s2;
		int ah = h2 - h;
		int am = m2 - m;
		int as = s2 - s;
		if (as < 0)as += 60, am--;
		if (am < 0)am += 60, ah--;
		std::cout << ah << " " << am << " " << as << std::endl;
	}
	//system("pause");
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using Graph = vector<vector<long>>;
Graph G;
vector<bool> seen;
vector<long> distu, distv;

long dfs(long c, vector<long> &dist, long p = -1) {
    for (auto nc : G[c]) {
        if (nc == p) continue;
        dist[nc] = dist[c] + 1;
        dfs(nc, dist, c);
    }
    return 0;
}


int main()
{
    long n, u, v;
    cin >> n >> u >> v;
    u--, v--;
    G = Graph(n);
    seen = vector<bool>(n, false);
    distu = vector<long>(n, 0);
    distv = distu;

    rep(i, n - 1) {
        long a, b;
        cin >> a >> b;
        a--, b--;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }

    dfs(u, distu);
    dfs(v, distv);

    long dist = 0;
    rep(i, n) {
        if (distu[i] - distv[i] > 0) continue;
        if (dist < distv[i]) {
            dist = distv[i];
        }
        
    }

    cout << dist - 1 << endl;
    return 0;
}

Measured memory_bytes: 12672
/*       _________
        /|______/ \
        ||  _|_|\  |
        || |_|   | /
        ||    _ / |
        ||  _| \\  \    
        ||_|_|\ || |
        |/_|/ | /|_/
              /__/      Written by: Rishabh Roshan
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int            	long long
#define integer        	int32_t
#define mod         	1000000007
#define vint        	vector<int>
#define pint        	pair<int, int>
#define umint        	unordered_map<int, int>
#define mint        	map<integer, integer>
#define in(x)        	int x; cin>>x
#define setbits(x)    	__builtin_popcountll(x)
#define zerobits(x)    	__builtin_ctzll(x)
#define w(x)        	int x; cin>>x; while(x--)
#define sp(x, y)    	fixed<<setprecision(y)<<x
#define poll(x)        	x.front(); x.pop()
#define f(x)        	for(int i=0; i<x; i++)
#define fj(x)			for(int j=0; j<x; j++)
#define fn(n, x)		for(int i=n; i<x; i++)
#define endl         	'\n'
#define inf         	1e9 
#define order_set     	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

void om_shree_ganeshaya_namah(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {

    om_shree_ganeshaya_namah();

    in(n);
    vint arr(n);
    int max=0, ans=0;
    f(n){
        cin>>arr[i];
        if(arr[i]>max)
            max = arr[i];
        if(arr[i]<max)
            ans+=(max-arr[i]);
    }
    cout<<ans;
}

Measured memory_bytes: 4736
#include <cstdio>
#define maxn 100010
int cnt[2][maxn], M[2], Q[2], m[2], q[2];
int n;
int main() {
    scanf("%d", &n);
    for (int i = 1, x, p; i <= n; i++) {
        scanf("%d", &x); p = i % 2;
        cnt[p][x]++;
        if (M[p] < cnt[p][x]) M[p] = cnt[p][x], Q[p] = x;
    }
    if (Q[0] != Q[1]) {
        printf("%d\n", n - M[0] - M[1]);
        return 0;
    }
    for (int i = 1; i <= 100000; i++) {
        if (m[0] < cnt[0][i] && i != Q[0]) m[0] = cnt[0][i], q[0] = i;
        if (m[1] < cnt[1][i] && i != Q[1]) m[1] = cnt[1][i], q[1] = i;
    }
    if (M[0] - m[0] > M[1] - m[1]) printf("%d\n", n - M[0] - m[1]);
    else printf("%d\n", n - m[0] - M[1]);
    return 0;
}

Measured memory_bytes: 2484
import sys
n,m=map(int, input().split())
num=[-1]*n
for i in range(m):
    s,c=map(int, input().split())
    if num[s-1]==-1:
        num[s-1]=c
    else:
        if num[s-1]!=c:
            print('-1')
            sys.exit()

for i in range(n):
    if num[i]==-1:
        if i==0 and n>1:
            num[i]=1
        else:
            num[i]=0

if n>1 and num[0]==0:
    print('-1')
    sys.exit()

num=[str(i) for i in num]
print(''.join(num))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>

int main(){
  std::string str;
  std::cin>>str;
  int count1 = 0;
  int count2 = 0;
    
  for(int i = 0 ; i < (int)str.length() ; i++){
    if(i%2==0){
      if(str[i]!='0') count1++;
    }else{
      if(str[i]!='1') count1++;
    }
  }

  for(int i = 0 ; i < (int)str.length() ; i++){
    if(i%2==0){
      if(str[i]!='1') count2++;
    }else{
      if(str[i]!='0') count2++;
    }
  }

  if(count1<count2){
    std::cout<<count1<<std::endl;
  }else{
    std::cout<<count2<<std::endl;
  }
  return 0;
}


Measured memory_bytes: 512
/*  I love Cara Delevingne */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const ll INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const db EPS = (db) 1e-9;
const db pi = acos(-1.0);
const int MAXN = 1e6 + 5;

int tt;
int n, k;
vector<int> g[2005];
int d[2005][2005];
bitset<2005> s[2005];

void build(int v, int p, int st) {
	for (int i = 0; i < sz(g[v]); i++) {
		int to = g[v][i];
		if (p != to) {
			d[st][to] = d[st][v] + 1;
			build(to, v, st);
		}
	}	
}


void solve() {
	cin >> n >> k;
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}	
	for (int i = 1; i <= n; i++) {
		build(i, 0, i);
	}
	for (int i = 1; i <= n; i++) {
	    for (int j = 1; j <= n; ++j) {
	    	if (d[i][j] > k) {
	    		s[i][j] = 1;
	    	}
	    }
	}
	int res = inf;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (d[i][j] == k) {
				bitset<2005> cur = s[i] | s[j];
				res = min(res, (int)cur.count());
			}
		}
	}
	(res != inf) ? cout << res : cout << 0;
}


int main() {
  
    tt = 1;
	while (tt--) {
		solve();	
	}
	return 0;
}


Measured memory_bytes: 16640
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
using namespace std;

int64_t lucas(int n, vector<int64_t> &memo) {
  //ベースケース1
  if (n == 0) {
    memo[0] = 2LL;
    return memo[0];
  }
  //ベースケース2
  if (n == 1) {
    memo[1] = 1LL;
    return memo[1];
  }
  //メモをチェック
  if (memo[n] != -1) return memo[n];
  //再帰ステップ&memoに記入
  memo[n] = lucas(n-2, memo)+lucas(n-1, memo);
  return memo[n];
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int64_t> memo(87,-1);
  cout << lucas(n, memo) << endl;
}

Measured memory_bytes: 256
A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]
 
dis = []
for i in range(M):
    m = x[i][0]-1
    n = x[i][1]-1
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()
 
dis.append(a[0]+b[0])
 
print(min(dis))

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

ll h[100005];

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    rep(i, n) cin >> h[i];

    ll left = 0, right = 1e10, mid;
    while (right - left > 1)
    {
        mid = (left + right) / 2;
        ll sum = 0;
        rep(i, n)
        {
            if (h[i] - mid * b > 0)
                sum += ceil((double)(h[i] - mid * b) / (a - b));
        }

        if (sum <= mid)
            right = mid;
        else
            left = mid;
    }

    OP(right);

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n;
    cin >> n;
    
    vector<LL> vec(n);

    for(int i = 0; i < n; i++){
        cin >> vec[i];
    }

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

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

    LL cen;

    if(n%2 == 0){
        cen = (vec[n/2] + vec[n/2 - 1])/2;
    }else{
        cen = vec[n/2];
    }

    LL ans = 0;

    for(int i = 0; i < n; i++){
        ans += abs(vec[i] - cen);
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1792
n, p = map(int, input().split())
ps = []
for i in range(n):
  ps.append(input().split())
  ps[i][1] = int(ps[i][1])
t = 0

while len(ps) > 0:
  if ps[0][1] > p:
    ps.append([ps[0][0], ps[0][1]-p])
    t += p
    ps.pop(0)
  else:
    t += ps[0][1]
    print('{0} {1}'.format(ps[0][0], t))
    ps.pop(0)



Measured memory_bytes: 16852
s = input()

if 'E' in s and 'W' in s:
    if 'N' in s and 'S' in s:
        print('Yes')
    elif 'N' in s or 'S' in s:
        print('No')
    else:
        print('Yes')
elif 'E' in s or 'W' in s:
    print('No')
else:
    if 'N' in s and 'S' in s:
        print('Yes')
    elif 'N' in s or 'S' in s:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,S[100000],q,T[50000],c=0,i,i2,toread,cnt;
	cin>>n;
	for(i=0;i<n;i++)cin>>S[i];
	cin>>q;
	for(i=0;i<q;i++)cin>>T[i];
	/*for(i=0;i<n;i++){
		for(i2=0;i2<n;i2++){
			if(S[i]<S[i2]){
				toread=S[i];
				S[i]=S[i2];
				S[i2]=toread;
			}
		}
	}*/
	sort(S,S+n);
	for(i=0;i<q;i++){
		cnt=0;
		toread=n;
		while(toread>1){
			if(toread%2==0)toread/=2;
			else toread=(toread+1)/2;
			if(S[(toread-1)+cnt]<T[i])cnt+=toread;
			else if(S[(toread-1)+cnt]==T[i]){
				c++;
				break;
			}
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 3672
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ba = 0
bb = 0
for i in range(N):
    if a[i] > b[i]:
        ba += a[i] - b[i]
    if b[i] > a[i]:
        bb += (b[i] - a[i])//2

if bb >= ba:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 10516
import sys


class Node():
    def __init__(self,  key=None, prev=None, next=None):
        self.key = key
        self.prev = prev
        self.next = next


class DoublyLinkedList():
    def __init__(self):
        self.head = Node()
        self.head.next = self.head
        self.head.prev = self.head

    def insert(self, x):
        node = Node(key=x, prev=self.head, next=self.head.next)
        self.head.next.prev = node
        self.head.next = node

    def search(self, x):
        node = self.head.next
        while node is not self.head and node.key != x:
            node = node.next
        return node

    def delete_key(self, x):
        node = self.search(x)
        if node is self.head:
            return None
        self._delete(node)

    def _delete(self, node):
        node.prev.next = node.next
        node.next.prev = node.prev

    def deleteFirst(self):
        self._delete(self.head.next)

    def deleteLast(self):
        self._delete(self.head.prev)

    def getKeys(self):
        node = self.head.next
        keys = []
        while node is not self.head:
            keys.append(node.key)
            node = node.next
        return " ".join(keys)


L = DoublyLinkedList()
n = int(input())
for i in sys.stdin:
    if 'insert' in i:
        x = i[7:-1]
        L.insert(x)
    elif 'deleteFirst' in i:
        L.deleteFirst()
    elif 'deleteLast' in i:
        L.deleteLast()
    elif 'delete' in i:
        x = i[7:-1]
        L.delete_key(x)
    else:
        pass
print(L.getKeys())



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

#define ms(s, n) memset(s, n, sizeof(s))
#define f(i, a, b) for (int i = (a); i <=(b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) - 1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
int modulo(int a, int b) { return (a % b + b) % b; }
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

int main()
{
	IOS;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	if (n) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
	// read the stuff at the bottom
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* use int when constraints limits are tight
	* Time taken : global variable < pass by refernce < pass by value
	* It takes significant amt. of time in pass by value
	* Avoid Using endl
*/





























Measured memory_bytes: 3608