akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
#include<numeric>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef long long Int;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5
#define MOD 1000000007
ll gcd(ll a, ll b) {
  return b ? gcd(b, a % b) : a;
}

vector<pair<ll,int>> factorize(ll n){
	vector<pair<ll,int>>res;
	for(ll i=2; i*i<=n; i++){
		if(n%i) continue;
		res.emplace_back(i,0);
		while(n%i==0){
			n/=i;
			res.back().second++;
		}
	}
	if(n!=1) res.emplace_back(n,1);
	return res;
}


int main(){
	ll n;cin>>n;
	vl v(5);
	rep(i,5) cin>>v[i];
	sort(All(v));
	if(n%v[0]==0) cout<<n/v[0]+4<<endl;
	else cout<<n/v[0]+5<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	long long n, ans=0;
	cin >> n;
	vector<long long> v(n-1);
	for (long long i = 0; i < n-1; i++)
		cin >> v[i];

	ans += v[0];

	for (long long i = 1; i < n-1; i++)
	{
		if (v[i - 1] < v[i])
			ans += v[i - 1];
		else
			ans += v[i];
	}

	ans += v[n - 2];
	   
	cout << ans << endl;
}

Measured memory_bytes: 256
c = input().split()

s =  []
for i in c:
    if i == "*":
        y = s.pop(-1)
        x = s.pop(-1)
        s.append(x*y)
    elif i == "-":
        y = s.pop(-1)
        x = s.pop(-1)
        s.append(x-y)
    elif i == "+":
        y = s.pop(-1)
        x = s.pop(-1)
        s.append(x+y)
    else:
        s.append(int(i))

print(s.pop(-1))




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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int64_t n, a, b; cin >> n >> a >> b;
    if((a&1) == (b&1)) cout << (b-a)/2;
    else cout << min(a-1, n-b)+1+(b-a-1)/2;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

int main()
{
    string S, T;
    cin >> S >> T;
    int q;
    cin >> q;
    vector<int> a(q), b(q), c(q), d(q);
    for(int i=0; i<q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; c[i]--;
    }

    vector<int> x(S.size()+1), y(T.size()+1);
    x[0] = 0;
    y[0] = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i] == 'A') x[i+1] = x[i] + 1;
        else x[i+1] = x[i] - 1;
    }
    for(int i=0; i<T.size(); i++){
        if(T[i] == 'A') y[i+1] = y[i] + 1;
        else y[i+1] = y[i] - 1;
    }

    for(int i=0; i<q; i++){
        int u = x[b[i]] - x[a[i]];
        int v = y[d[i]] - y[c[i]];
        if((u-v)%3==0) cout << "YES\n";
        else cout << "NO\n";
    }
}

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

using namespace std;

int main(void) {
  int n, m;
  cin >> n >> m;

  vector<int> a(n), b(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }

  vector<int> cnt(n, 0);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j] > b[i]) continue;
      cnt[j]++;
      break;
    }
  }

  int maxc = 0, ans;
  for (int i = 0; i < n; i++) {
    if (cnt[i] <= maxc) continue;
    maxc = cnt[i];
    ans = i + 1;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
int n, i;
long long z=0, y=0;
scanf("%d", &n);
vector<long long> a;
for(i=0;i<n;i++) {
    long long x;
    cin>>x;
    a.push_back(x);
}
sort(a.begin(), a.end());
for(i=n-1;i>0;i--) {
    if(a[i]==a[i-1]) {
        y = a[i];
        a[i] = 0;
        a[i-1] = 0;
        break;
    }
}
for(i=n-1;i>0;i--) {
    if(a[i]==a[i-1]&&a[i]!=0) {
        z = a[i];
        break;
    }
}
cout<<y*z;
}

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

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORS(i, a, b, c) for(int i = a; i < b; i += c)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;


int main(){
  IO; int S, W; cin >> S >> W;
  if(W>=S)cout<<"unsafe"; else cout << "safe";
}

Measured memory_bytes: 3652
/***************************************** 
****       Solution by SlavicG        ****
*****************************************/
 
#include<bits/stdc++.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm> 
#include <set>
#include <utility>
#include <queue>
#include <map>
#include <assert.h>
#include <stack>
using namespace std;
#define ll long long
#define forn(i,n) for(int i=0;i<n;++i)
#define MX 10000000001
#define pow2(a) ((a)*(a))
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define endl "\n"
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 int longestIncreasingSubsequenceLenghtDP(int a[],int n){
    int dp[n],ans=0;
    for(int k = 0;k<n;k++){
        dp[k] = 1;
        for(int i = 0;i<k;i++){
            if(a[i] <= a[k]){
                dp[k] = max(dp[k],dp[i] + 1);
                ans = max(dp[k],ans);
            }
        }
    }
    return ans;
 }
int result[1000] = {0};
int factDP(int n) 
{
   if (n >= 0) {
      result[0] = 1;
      for (int i = 1; i <= n; ++i) {
         result[i] = i * result[i - 1];
      }
      return result[n];
   }
}
bool checkPrime(int n)
{
    if(n<2) return false;
    for(int x = 2;x*x <=n;x++)
    {
        if(n%x == 0)return false;
    }
    return true;
}
vector<int> primeFactors(int n){
    vector<int> f;
    for(int x = 2;x*x<=n;x++){
        while(n%x==0){
            f.push_back(x);
            n/=x;
        }
    }
    if(n>1)f.push_back(n);
    return f;
}
int binary_Search_Classic(int n, int arr[],int target){
	int l,r,mid;
	l=0;
	r=n-1;
	while(l<=r){
		mid= l+(r-l)/2;
		if(arr[mid] == target){
			return mid;
		}
		if(arr[mid] < target){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return -1;
	
}
int binary_Search_First_Greater(int n, int arr[],int target){
	int l,r,ans,mid;
	l = 0;
	r = n-1;
	ans=-1;
	while(l<=r){
		mid = l + (r-l)/2;
		if(arr[mid] > target){
			ans=mid;
			r=mid-1;
		}else{
			l = mid+1;
		}
	}
	return ans;
}
int countDistinctCharsString(string s) {
    unordered_map<char, int> m; 
    for (int i = 0; i < s.length(); i++) { 
        m[s[i]]++; 
    }
    return m.size(); 
} 
int main()
{
	ll a,b,k;
	cin >> a >> b >> k;
	if(a >= k)
	{
		a-=k;
		k=0;
	}else{
		k-=a;
		a = 0;
	}
	cout << a << " " << max(0LL,b-k) << endl;
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
const int MAX_N=10000;
int n,a,b[100010];

int main(){
	cin >> n;
	int ma=0;
	REP(i,0,n) cin >> a >> b[i],ma=max(ma,a);
	sort(b,b+n);
	
	cout << ma+b[0] << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 1e5 + 123;


void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    int k,x;
    scanf("%d%d", &k, &x);
    int from = x - k + 1;
    int to = x + k - 1;
    for (int i = from; i <= to; i++)
        cout << i << ' ';
    printf("\n");
}

int main()
{
    solve();
    //cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long A, long long B, long long C, long long D, long long E){
    vector<lli> v;
    v.push_back(A);
    v.push_back(B);
    v.push_back(C);
    v.push_back(D);
    v.push_back(E);
    sort(v.begin(),v.end());

    lli ans = INF;
    do{
        lli sum = 0;
        REP(i,0,4){
            sum += ((v[i]-1)/10 +1)*10;
        }
        sum += v[4];
        ans = min(ans,sum);

    }while(next_permutation(v.begin(),v.end()));

    cout<<ans<<endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    long long E;
    scanf("%lld",&E);
    func(A, B, C, D, E);
    return 0;
}


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

int N;
vector<string> arr, ans;

int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  arr.resize(N);
  for(int i =0 ;i < N; i++)
    cin >> arr[i];
  sort(arr.begin(), arr.end());

  int cnt = 1, maxCnt = 1;
  for(int i = 1 ;i < N; i++) {
    if (arr[i-1] == arr[i]) cnt++;
    else {
      if(cnt > maxCnt) {
        ans = {arr[i-1]};
        maxCnt = cnt;
      } else if(cnt == maxCnt) {
        ans.push_back(arr[i-1]);
      }
      cnt = 1;
    }
  }

  if(cnt > maxCnt) {
    ans = {arr[N-1]};
    maxCnt = cnt;
  } else if(cnt == maxCnt) {
    ans.push_back(arr[N-1]);
  }

  sort(ans.begin(), ans.end());
  for(auto s: ans) cout << s << "\n";
}


Measured memory_bytes: 15088
//author: madhur4127/MADHUR CHAUHAN

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

typedef long long int ll;

int main(){
  ios::sync_with_stdio(0);  cin.tie(0);
  //freopen("ip.txt","r",stdin);
  ll x,a,b; cin>>x>>a>>b;
  if(b<=a) cout<<"delicious\n";
  else{
    if(b<=a+x) cout<<"safe\n";
    else cout<<"dangerous\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;

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

int main() {
    string S;
    ll N;
    cin >> S >> N;
    ll s=S.size();
    ll count=1,sum=0,count1=0,count2=0;
    bool same=true;
    bool first=true;
    rep(i,s-1){
        if (S[i]==S[i+1]){
            count++;
        }
        else {
            if (first){
                count1=count;
                first=false;
            }
            sum+=count/2;
            count=1;
        }
        if (i==s-2){
            sum+=count/2;
            count2=count;
            count2/=2;
            rep(j,s-1){
                if (S[(s-1+j)%s]==S[(s+j)%s]){
                    count++;
                }
                else {
                    count/=2;
                    break;
                }
            }
        }
        if (S[i]!=S[i+1]){
            same=false;
        }
    }
    if (same){
        cout << s*N/2 << endl;
    }
    else {
        count1/=2;
        if (S[0]!=S[s-1]){
            cout << sum*N << endl;
        }
        else {
            cout << sum*N+(count-count1-count2)*(N-1) << endl;
        }
    }
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<usize>();
    let m = input::<usize>();
    let nq = input::<usize>();
    let (l, r) = (0..m)
        .map(|_| {
            let l = input();
            let r = input();
            (l, r)
        })
        .unzip::<usize, usize, Vec<usize>, Vec<usize>>();
    let (p, q) = (0..nq)
        .map(|_| {
            let p = input();
            let q = input();
            (p, q)
        })
        .unzip::<usize, usize, Vec<usize>, Vec<usize>>();

    let mut sum = vec![vec![0; n + 1]; n + 1];
    for i in 0..m {
        sum[l[i]][r[i]] += 1;
    }
    for i in 0..n {
        for j in 0..n {
            sum[i + 1][j + 1] += sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
        }
    }

    let out = std::io::stdout();
    let mut buf = std::io::BufWriter::new(out.lock());
    for i in 0..nq {
        let ans =
            sum[q[i]][q[i]] - sum[p[i] - 1][q[i]] - sum[q[i]][p[i] - 1] + sum[p[i] - 1][p[i] - 1];
        writeln!(buf, "{}", ans).unwrap();
    }
}


Measured memory_bytes: 11392
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int f(int a){
	string s;
	stringstream ss;
	ss<<a;
	ss>>s;
	for(int i = 1; i < s.size(); i++){
		if(s[i]!=s[i-1]+1) return -1;
	}
	return a;
}

int main(){
	int n;
	cin>>n;
	vi a(n);
	rep(i, n) cin>>a[i];
	int ans = -1;
	rep(i, n) rep(j, i) ans = max(ans, f(a[i]*a[j]));
	cout<<ans<<endl;
}

Measured memory_bytes: 3216
<?php
$input=trim(fgets(STDIN));
$array_data=array();
while($input<>""){
	$array_data[]=$input;
	$input=trim(fgets(STDIN));
}
$cnt=0;
foreach($array_data as $val){
	if($val==0){
		break;
	}
	$cnt++;
	// print "Case $cnt:" . $val ."\n";
	printf("Case %d: %s\n",$cnt,$val);
}

Measured memory_bytes: 16840
#include <stdio.h>

int insertion_sort(double *v, int n) {
  if (n == 1) {
    return 0;
  }

  double tmp;
  for (int i=1;i<n;i++) {
    tmp = v[i];
    for (int j=i;j>0&&v[j-1]>tmp;j--) {
        v[j] = v[j-1];
        v[j-1] = tmp;
    }
  }

  return 0;
}

double alchemist(double *v, int n) {
  if (n == 1) {
    return v[0];
  }

  double sum = v[0];
  for (int i=1;i<n;i++) {
    sum = (sum + v[i]) / 2;
  }

  return sum;
}

int main(void) {
  // input
  int n;
  scanf("%d", &n);
  
  double v[n];
  for (int i=0;i<n;i++) {
    scanf("%lf", &v[i]);
  }

  insertion_sort(v, n);

  printf("%f", alchemist(v, n));
}

Measured memory_bytes: 128
/*
ID: Barry Wang
LANG: C++11
TASK: 
*/
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
#define X first
#define Y second
#define Chtolly return 0
/*---define types---*/
typedef long long ll;
typedef list<int> li;
typedef queue<int> qi;
typedef deque<int> dqi;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef unsigned int uint;
/*---define variables---*/
const int inf=(1<<29);
int a,b;
string s,t,u; 
/*---define function---*/

/*---main code---*/
int main(){
	cin>>s>>t>>a>>b>>u;
	if(s==u){
		cout<<a-1<<' '<<b<<'\n';
	}
	else{
		cout<<a<<' '<<b-1<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>
#define ALL(V) V.begin(),V.end()
#define f1(a,b) for(int a=1;a<=b;a++)
#define f0(a,b) for(int a=0;a<b;a++)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define de(x) cout<<#x<<": "<<x<<endl
using namespace std;
const LL N=1e6+69, base=1024*1024,mod=1e9+7;
LL d,g,a[N],b[N];
LL test(int mask) {
    //de(mask);
    LL re=g, ile=0;
    f0(i,d) {
        if((1<<i)&mask) re-=b[i]+(i+1)*a[i]*100, ile+=a[i];
    }
    for(int i=d-1;i>=0;i--) {
        if((1<<i)&mask) continue;
        LL zm=re+i*100+99;
        zm/=(i*100+100);
        zm=min(zm,a[i]);
        zm=max(zm,0ll);
        re-=zm*(i+1)*100;
        ile+=zm;
        //de(zm);
        //de(re);
        //de(ile);
    }
    //de(ile);
    if(re<=0) return ile;
}
int32_t main(void) {
    boost;
    cin>>d>>g;
    f0(i,d) {
        cin>>a[i]>>b[i];
    }
    LL wynik=1e18;
    f0(i,(1<<d)) wynik=min(wynik,test(i));
    cout<<wynik;
}


Measured memory_bytes: 2304
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}
void YesNo(bool flag){ cout<<(flag? "Yes":"No");}

ll a,b,c,d,n,x;
vector<ll>v[3];
map<ll,ll>m;
string s,s2;
void input(){
    cin>>s;
}
void src(){
    YesNo(s[0]==s[2]);
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())


def prime_factorize(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


divisors = []
for i in range(2, N + 1):
    divisors.extend(prime_factorize(i))

e = Counter(divisors)
e_list = [e[i] for i in e.keys() if i != 1]


def num(x):
    return len([i for i in e_list if i >= x])


l2 = num(2)
l4 = num(4)
answer = num(74) + \
         num(24) * (l2 - 1) + \
         num(14) * (l4 - 1) + \
         l4 * (l4 - 1) * max(0, (l2 - 2)) // 2
print(answer)

Measured memory_bytes: 3436
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        n: usize,
        a: [u64; n],
    }
    let mut ans = a[0] - 1;
    let mut g = 2;
    for &a in &a[1..] {
        if a > g {
            ans += (a - 1) / g;
        } else if a == g {
            g += 1;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 6396
#include <stdio.h>

void insert(int len, int a[len]);

int main()
{
  int n;
  scanf("%d",&n);
  int a[n];
  int b[n];
  int c[n-1];
  //insert(n, a[n]);
  //insert(n, b[n]);
  //insert(n-1, c[n-1]);
  int i;
  i = 0;
  ///*
  while (i < n)
  {
    scanf("%d",&a[i]);
    //printf("%d",a[i]);
    i++;
  }
  //*/
  i = 0;
  while (i < n)
  {
    scanf("%d",&b[i]);
    i++;
  }
  i = 0;
  while (i < n-1)
  {
    scanf("%d",&c[i]);
    i++;
  }
  ///*
  int satisfaction;
  satisfaction = 0;
  i = 0;
  while (i < n)
  {
    satisfaction += b[a[i] - 1];
    if (i != n-1 && a[i] + 1 == a[i + 1])
    {
      satisfaction += c[a[i] - 1];
    }
    //printf("%d\n",satisfaction);
    i++;
  }
  printf("%d",satisfaction);
  //*/
}

void insert(int len, int a[len])
{
  int i;
  i = 0;
  while (i < len)
  {
    scanf("%d",&a[i]);
    i++;
  }
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] kusi = new int[2 * n];
		for (int i = 0; i < 2 * n; i++) {
			kusi[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(kusi);
		int ans = 0;
		for (int i = 0; i < 2 * n; i += 2) {
			ans += kusi[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22740
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	k := stdin.ReadInt()

	min := 0
	max := 0
	for i := 0; i < k; i++ {
		min += i
		max += n - i
	}

	left := k
	right := n - k

	ans := 0
	for i := k; i <= n+1; i++ {
		ans += max - min + 1
		ans %= 1000000000 + 7
		min += left
		max += right
		left += 1
		right -= 1
	}

	stdout.Println(ans)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

func (s *Stdin) ReadIntSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadInt()
	}
	return a
}

func (s *Stdin) ReadStringSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = s.Read()
	}
	return a
}

func (s *Stdin) ReadFloat64Slice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadFloat64()
	}
	return a
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Measured memory_bytes: 1768
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int answer = a*x + b*y;
  if(c*2 <= a) {
    if(c*2 <= b) {
      answer = max(x, y) * c * 2;
    } else {
      answer = x * c * 2 + max(y-x, 0) * b;
    }
  } else if(c*2 <= b) {
    answer = max(x-y, 0) * a + y * c * 2;
  } else if(c*2 <= a + b) {
    answer -= min(x, y) * (a+b - c*2);
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
M = [list(map(int, input().split())) for _ in range(3)]
#print(M)
A = {i : -1 for i in range(3)}
B = {i : -1 for i in range(3)}

checker =False
for a1 in range(100):
  A[0] = a1
  B[0] = M[0][0] - a1
  B[1] = M[0][1] - a1
  B[2] = M[0][2] - a1
  A[1] = M[1][0] - B[0]
  A[2] = M[2][0] - B[0]
  
  cnt=0
  for i in range(3):
    for j in range(3):
      if M[i][j] == A[i] + B[j]:
        cnt += 1
  if cnt == 9:
    checker =True
    #print("A:{}, B:{}".format(A,B))
    break
  
if checker:
  print('Yes')
else:
  print('No')

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

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

    int N;
    cin >> N;

    vector<string> W(N);
    char last_char;
    string ans = "Yes";

    for (int i = 0; i < N; ++i) {
        cin >> W[i];

        if (i != 0 && last_char != W[i][0]) {
            ans = "No";
        }

        if (find(W.begin(), W.end(), W[i]) != W.begin() + i) {
            ans = "No";
        }

        last_char = W[i].back();
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include "bits/stdc++.h"

typedef long long ll;
using namespace std;

#define FOR(i,n) for(ll i=0;i<n;i++) 
#define RFOR(i,n) for(ll i=n-1;i>=0;--i)
#define COUT(str) cout << str << endl

//入力
int a[3];

int main() {

	FOR(i, 3)cin >> a[i];

	sort(a, a + 3);

	if (a[2] - a[1] == a[1] - a[0])COUT("YES");
	else COUT("NO");
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  int n,t; cin>>n>>t;
  int mn = 100000000;
  //int keiro = 0;
  int k,l;
  //int ans;
  rep (i,n) {
    cin>>k>>l;
    if (l <= t && k < mn) {
      mn = k;
      //ans = k;
    }
  }
  if (mn == 100000000) cout << "TLE" << endl;
  else cout << mn << endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

const int limit = 1 << 26;
int memo[limit];

int main(void){
	string s;
	cin >> s;
	
	const int inf = 1 << 20;
	rep(i,limit) memo[i] = inf;
	memo[0] = 0;

	const int n = s.size();
	int cur = 0,ans = 0;
	
	rep(i,n){
		const int idx = s[i] - 'a';
		cur^=(1<<idx);

		int cmin = memo[cur];
		rep(j,26){
			const int tar = cur^(1<<j);
			cmin = min(cmin,memo[tar]);
		}

		memo[cur] = min(memo[cur],cmin+1);
		ans = memo[cur];
	}

	ans = max(ans,1);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 262660
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        HashMap<Integer, Integer> map = new HashMap<>();
        int[] a = new int[n];

        for(int i = 0; i < n; i++){
            int ai = sc.nextInt();
            a[i] = ai;
            if(map.containsKey(ai)){
                map.put(ai, map.get(ai) + 1);
            }else{
                map.put(ai, 1);
            }
        }

        int ans = 0;

        next:
        for(int i = 0; i < n; i++){
            List<Integer> prime = divisor(a[i]);
            if(map.get(a[i]) > 1){
                continue next;
            }
            for(Integer l : prime){
                if(map.containsKey(l) && l != a[i]){
                    continue next;
                }
            }
            ans++;
        }

        System.out.println(ans);

    }

    static List<Integer> divisor(int n){
        List<Integer> result = new ArrayList<>();
        List<Integer> reverse = new ArrayList<>();
        int i = 0;
        long sqrt = (long)Math.ceil(Math.sqrt(n));
        while(++i < sqrt){
            if(n % i == 0){
                result.add(i);
                reverse.add(n / i);
            }
        }
        if(i * i == n){
            result.add(i);
        }
        Collections.reverse(reverse);
        result.addAll(reverse);
        return result;
    }

}


Measured memory_bytes: 76376
N,K=map(int,input().split())
R,S,P=map(int,input().split())
L=input()
T=[]
for i in range(N):
    T.append(L[i])
for i in range(K,N):
    if T[i]==T[i-K]:
        T[i]="0"
p=0
for i in T:
    if i=="r":
        p+=P
    elif i=="s":
        p+=R
    elif i=="p":
        p+=S
print(p)

Measured memory_bytes: 9968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    ll k, a, b;
    ll ans = 0;
    cin >> k >> a >> b;
    if (k < a)
    {
        cout << k + 1 << endl;
    }
    else
    {
        if ((k - a + 1) % 2 == 0)
        {
            if (a + 1 < b)
            {
                ans = a + (b - a) * (k - a + 1) / 2;
            }
            else
            {
                ans = k + 1;
            }
        }
        else
        {
            if (a + 1 < b)
            {
                ans = a + 1 + (b - a) * (k - a) / 2;
            }
            else
            {
                ans = k + 1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);

ll dp[200010][4];

signed main(){
    string s;cin>>s;

    repi(i,1,200010){
        rep(j,3){
            dp[i][j]=-INF;
        }
    }

    for(int i=0;i <= siz(s);i++)
    {
        for(int j=1;j < 4;j++)
        {
            for(int k=1;k < 4;k++)
            {
                if(i-j>=0 && s.substr(i-j,j)!=s.substr(i,k)){
                    dp[i+k][k]=max(dp[i+k][k],dp[i][j]+1);
                }
                if(i==0){
                    dp[i+k][k]=max(dp[i+k][k],dp[i][j]+1);
                }
            }
        }
    }

    ll ans=-1;
    for(int i=1;i < 4;i++)
    {
        ans=max(ans,dp[siz(s)][i]);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 6788
# coding: utf-8
a = int(input())
b = list(map(int, input().split()))
c = 1
if 0 in b:
    print(0)
else:
  while c < 10 ** 18 and len(b) != 0:
    c = c * b[0]
    del b[0]
  if c > 10 ** 18:
    print(-1)
  else:
    print(c)

Measured memory_bytes: 21648
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int A,B;
    cin>>A>>B;
    int S=__gcd(A,B),S1=S;
    int ans=1;
    for(int i=2;i*i<=S1;i++){
        if(S%i==0){
            ans++;
            while(S%i==0)S/=i;
        }
    }
    if(S!=1)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*
 Abu Jafor Mohammad Saleh
 ios_base :: sync_with_stdio(false);
 cin.tie(NULL);
 */

#include<cstdio>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<limits>
#include <algorithm>
#include <unordered_map>
#include<fstream>
#define f first
#define s second
#define MOD 1000000007

#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define BOUNDARY(i, j) ((i >= 0 && i < rows) && (j >= 0 && j < coloums))
#define mx 6e5 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//#include<bits/stdc++.h>
#define ll long long
const int maxn = 20005;
using namespace std;
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
int rows,coloums;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}


int main()
{
    ll n,k;
    cin>>n>>k;
    ll x = ((n-1) * (n-2))/2;
    
    if(k>x)
    {
        cout<<-1<<endl;
        exit(0);
    }
    
    ll extra = x-k;
    ll total = n-1 + extra;
    
    cout<<total<<endl;
    
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            cout<<i<<' '<<j<<endl;
            total--;
            if(total==0)
            {
                exit(0);
            }
        }
    }
}



Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    if(n<x){
        cout<<t<<endl;
        return 0;
    }
    if(n%x!=0){
        cout<<(n/x+1)*t;
    }else{
        cout<<(n/x)*t;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

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

    int enable = 1;
    int ans = 0;
    while (enable < b) {
        enable += a - 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int a[45];

int fibonacci(int n){
  if(n==0||n==1) return a[n];
  if(a[n]!=-1) return a[n];
  return a[n]=fibonacci(n-1)+fibonacci(n-2);
}

int main(){
  int n,i,ans;
  a[0]=a[1]=1;
  
  scanf("%d",&n);  
  for(i=2;i<45;i++) a[i]=-1;

  ans=fibonacci(n);

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

    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
lli spf[1000001];
lli MAXN = 1000001;

void sieve()
{
    spf[1] = 1;
    for (lli i = 2; i < MAXN; i++)
    {
        spf[i] = i;
    }
    for (lli i = 4; i < MAXN; i += 2)
    {
        spf[i] = 2;
    }
    for (lli i = 3; i * i < MAXN; i++)
    {

        if (spf[i] == i)
        {
            for (lli j = i * i; j < MAXN; j += i)
            {
                if (spf[j] == j)
                {
                    spf[j] = i;
                }
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n;
    cin >> n;
    sieve();
    vector<lli>
        v;
    lli ans = 0;
    for1(c, 1, n)
    {
        lli x = n - c;
        lli p = 1;
        while (x != 1)
        {
            lli y = spf[x];
            lli c1 = 0;
            while (x % y == 0)
            {
                x /= y;
                c1 += 1;
            }
            p *= (c1 + 1);
        }
        // if(p%2)
        // {

        // }
        ans += p;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11456
#include<bits/stdc++.h>
#define ll long long
#define ull long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ll gcd(ll x,ll y)
{
	if(y==0)
		return x;
	return gcd(y,x%y);
}
bool comp(int x,int y)
{
	return x>y;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,i;
	cin>>n;
	vector<int> h(n);
	vector<int> cost(n,INT_MAX);
	for(auto &it : h)
		cin>>it;
	cost[0]=0;
	for(i=2;i<=n;i++)
	{
		cost[i-1]=min(cost[i-1],cost[i-2]+abs(h[i-1]-h[i-2]));
		if(i>2)
			cost[i-1]=min(cost[i-1],cost[i-3]+abs(h[i-1]-h[i-3]));
	}
	cout<<cost[n-1];
	
}


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

int main() {

	const int p = 8;
	int n; cin >> n;
	vector<int> num(p, 0);
	int free = 0;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		for (int j = 0; j < p; j++) {
			if (400 * j <= a && a < 400 * (j + 1)) {
				num[j] = 1;
			}
		}
		if (400 * p <= a) free++;
	}
	int ans = 0;
	for (int i = 0; i < p; i++) {
		if (1 == num[i]) ans++;
	}
	if(ans == 0) cout << 1 << " " << free << endl;
	else cout << ans << " " << ans + free << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
using namespace std;

typedef pair<int, int> P;
#define LINE() cerr<< " (L" << __LINE__ << ")"

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
		int H,W;cin >>H >> W;

		vector<string> board(H);
		for(int y=0;y<H;y++){
			cin >> board[y];
		}

		map<int,int> xmap,ymap;
		for(int y=0;y<H;y++){
			for(int x=0;x<W;x++){
				if(board[y][x]!='.'){
					xmap.insert(make_pair(x,1));
					if(0<x-1 && x-1 <W)xmap.insert(make_pair(x-1,1));
					if(0<x+1 && x+1 <W)xmap.insert(make_pair(x+1,1));

					ymap.insert(make_pair(y,1));
					if(0<y-1 && y-1 <H)ymap.insert(make_pair(y-1,1));
					if(0<y+1 && y+1 <H)ymap.insert(make_pair(y+1,1));

				}
			}
		}
		vector<int> xs,ys;
		for(auto it=xmap.begin();it!=xmap.end();it++){
			xs.push_back(it->first);
		}
		for(auto it=ymap.begin();it!=ymap.end();it++){
			ys.push_back(it->first);
		}
		sort(xs.begin(),xs.end());
		sort(ys.begin(),ys.end());

		int h=ys.size(),w=xs.size();
		int res=0;
		for(int c=0;c<30;c++){
			for(int y=0;y<h;y++)for(int x=0;x<w;x++)if(board[ys[y]][xs[x]]=='.'){
				map<char,vector<pair<int,int>>> ps;
				for(int d=0;d<4;d++){
					int px=x,py=y;
					while( 0<= px && px < w && 0 <=py && py < h  &&   board[ys[py]][xs[px]]=='.'){
						px+=dx[d];py+=dy[d];
					}
					if( 0<= px && px < w && 0 <=py && py < h  && board[ys[py]][xs[px]]!='.'){
						ps[board[ys[py]][xs[px]]].push_back(make_pair(py,px));
					}
				}

				for(auto it=ps.begin();it!=ps.end();it++){
					vector<pair<int,int>> vs=it->second;
					if(it->second.size()==2){
						res+=2;
						board[ys[vs[0].first]][xs[vs[0].second]]='.';
						board[ys[vs[1].first]][xs[vs[1].second]]='.';
					}
				}
			}
		}
		cout << res <<endl;
}

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

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

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

  ll ans = 0;

  if (a >= k) cout << k << '\n';
  else if (a + b >= k) cout << a << '\n';
  else cout << 2*a + b - k << '\n';

  return (0);
}


Measured memory_bytes: 3616
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

ll foo(ll n) {
  if (n == 1) return 1;
  else return foo(n / 2) * 2 + 1;
}

void solve() {
  ll H;
  cin >> H;
  cout << foo(H) << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define ll long long

#define MOD 1000000000000000LL


ll dp[1001][10001];
// dp[i][j]:i番目の魔法でjのHPを削るのに必要な最小MP

using namespace std;

int main(){
  ll h,n;cin>>h>>n;
  vector<ll>a(n),b(n);
  rep(i, n)cin>>a[i]>>b[i];

  fill(dp[0], dp[0]+1001*10001, MOD);

  dp[0][0]=0;
  rep(i, n){
    rep(j, h+1){

      // i番目の魔法で体力jを削りきれるならi番目の魔法の消費MPを記録
      if(j-a[i]<0)dp[i+1][j]=min(dp[i][j], b[i]);
      // 削りきれないなら、その時わかっている最小消費MPと、i番目の魔法を使った時の消費MPを比較する
      else dp[i+1][j] = min( dp[i][j], dp[i+1][j-a[i]]+b[i] );

    }
  }

  cout<<dp[n][h]<<endl;

  //rep(i, n+1){rep(j, h)cout<<dp[i][j]<<' ';cout<<endl;}

  return 0;
}

Measured memory_bytes: 78464
import Data.List
import Control.Monad
import Data.Maybe

main = do
  [n, y] <- map read . words <$> getLine :: IO [Int]
  
  putStrLn . (\(a,b,c)-> show a++" "++show b++" "++show c) . head . catMaybes $ flip map [(a, b, n-(a+b))|a<-[0..n], b<-[0..n-a]] (\(a, b, c) ->
    if 10000*a + 5000*b + 1000*c == y 
        then Just (a, b, c) 
        else Nothing) ++ [Just (-1, -1, -1)]


Measured memory_bytes: 1020