akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcdEx(ll a, ll b, ll *x, ll *y) {
    if (!a) {*x = 0; *y = 1; return b;}
    ll x1, y1, gcd = gcdEx(b % a, a, &x1, &y1); *x = y1 - (b / a) * x1; *y = x1; return gcd;
}
ll modI(ll b, ll m)      {ll x, y; gcdEx(b, m, &x, &y); return (x % m + m) % m;}
typedef pair<ll, ll>      pii;
typedef vector<ll>         vi;
typedef vector<pii>         vii;
typedef set<ll>            si;
typedef map<string, ll>    msi;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define loop(i,b,n)           for(ll i=b;i<n;i++)
#define loopv(i,b,n,a)         for(ll i=b;i<n;i+=a)
#define loopr(i,b,n)           for(ll i=n;i>=0;i--)

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define start_routine() ll begtime = clock();
#define end_routine() ll endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define mp                  make_pair
#define ff                  first
#define ss                  second
#define pb                  push_back
#define MOD                 1000000007
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(ll)(MOD+((a%MOD)-(b%MOD))%MOD):(ll)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (ll)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)
ll modP(ll x, ll y)         {
    ll r = 1; x %= MOD; while (y > 0) {
        if (y & 1) {r = (r * x) % MOD;}
        y = y >> 1; x = (x * x) % MOD;
    } return r;
}
ll max(ll a, ll b) {return (a > b ? a : b);}
ll min(ll a, ll b) {return (a < b ? a : b);}
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " = " << arg1 << " | "; __f(comma + 1, args...);
}
ll gcd( ll a, ll b )
{
    if (b == 0)
    {
        return a;
    }
    else
    {
        return gcd( b, (a % b) );
    }
}
ll lcm (ll a, ll b)
{
    ll ans = (a  / gcd(a, b)) * b;
    return ans;
}

#define test int t;cin >>t;while(t--)
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a, ans;
    long double b;
    cin >> a >> b;
    ans = a * b;
    cout << ans;
    return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	int x;
	cin >> x;
	
	set<int> power;
	power.insert(1);
	for(int i = 2; i * i <= x; i++){
		if(power.count(i)){
			continue;
		}
		for(int j = i * i; j <= x; j *= i){
			power.insert(j);
		}
	}
	cout << *rbegin(power) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int compere(int x,int K){
	if (K<x){
		int y;
		y=2*(x-K);
		return y;
	}

	if(K>=x){
		if(x<K-x){
			int y=2*x;
			return y;
		}
		if(x>=K-x){
			int y=2*(K-x);
			return y;
		}
	}
}



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

	int i;
	int SUM=0;
	int x;

	for (i=0;i<N;i++){
		scanf("%d",&x);
		int y=compere(x,K);
		SUM+=y;
	}
	printf("%d\n",SUM);
	return 0;
}

Measured memory_bytes: 128
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  long long int n,ans=1000000000100;
  cin>>n;
  long long int s=sqrt(n);
  for(int i=1;i<=s;i++){
    long long int a,b;
    b=i;
    if(n%b==0){
      a=n/b;
      ans=min(ans,a+b-2);
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define ll long long

int main(void)
{
	int n;
	cin >> n;
	vec<ll> a(3 * n);
	rep(i, 3 * n) cin >> a[i];

	priority_queue<ll> r;
	priority_queue<ll, vector<ll>, greater<ll>> l;

	vec<ll> M(n + 1, 0), m(n + 1, 0);
	rep(i, n) {
		M[0] += a[i];
		m[n] += a[2 * n + i];
		l.push(a[i]);
		r.push(a[2 * n + i]);
	}

	rep(i, n) {
		if (l.top() < a[n + i]) {
			M[i + 1] = M[i] - l.top() + a[n + i];
			l.pop();
			l.push(a[n + i]);
		} else M[i + 1] = M[i];
		if (r.top() > a[2 * n - 1 - i]) {
			m[n - 1 - i] = m[n - i] - r.top() + a[2 * n - 1 - i];
			r.pop();
			r.push(a[2 * n - 1 - i]);
		} else m[n - 1 - i] = m[n - i];
	}
	ll ans = - 1e+15;
	rep(i, n + 1) {
		ans = max(ans, M[i] - m[i]);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){

  int a,b,c,d,e,f,g,h,i;
  
  cin>>a>>b>>e;


  for(int s=-(1e6);s<=(1e6);s++){

    h=s-(b+e);

    c=s-(a+b);

    i=s-(a+e);

    f=s-(c+i);

    d=s-(e+f);

    g=s-(c+e);

    if(a+b+c==s&&d+e+f==s&&g+h+i==s&&a+d+g==s&&b+e+h==s&&c+f+i==s&&a+e+i==s&&c+e+g==s){

      cout<<a<<' '<<b<<' '<<c<<endl;
      
      cout<<d<<' '<<e<<' '<<f<<endl;
      
      cout<<g<<' '<<h<<' '<<i<<endl;
      
      return 0;
    }
    
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) const int size = (vec).size(); REP(i,size) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    int A, B;
    cin >> A >> B;
    cout << (A + B) % 24 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n,min,max,i,x;
    long long sum = 0;
    min = 1000000;
    max = -1000000;
    cin >> n;
    for(i = 0;i < n;i++){
        cin >> x;
        sum += x;
        if(x > max) max = x;
        if(x < min) min = x;
    }
    cout << min << " " << max << " " << sum <<endl;
    return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const double INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

const ll MAX_N = 1e5;
ll dp[MAX_N + 5];

void init() {
	for (ll i = 0; i <= MAX_N; i++) {
		dp[i] = INF;
	}
}

int main() {
	ll N, K;
	ll i, j;
	cin >> N >> K;
	vll H(N);
	for (auto& e : H)cin >> e;

	for (i = 1; i < N; i++) {
		ll minc = INF;
		for (j = -1 * min(i, K); j < 0; j++) {
			minc = min(minc, dp[i + j] + abs(H[i + j] - H[i]));
		}
		dp[i] = minc;
	}
	cout << dp[N - 1] << endl;	

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)   for(signed i=0; i<n; i++)
#define yn(b)   cout << ((b)?"Yes":"No") << endl
#define YN(b)   cout << ((b)?"YES":"No") << endl
#define pr(r)   cout << r << endl
int main(void){
    long n;
    cin >> n;
    long k, r;
    k = log10(n);
    r = n/(long)pow(10,k) + 9*k - 1;
    if((n+1)/(long)pow(10,k) > n/(long)pow(10,k)) r++;
    pr(r);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

vector<ll> fac(MAX), finv(MAX), inv(MAX);

int main(){
	string s; cin >> s;
	string fr, ba;
	ll q; cin >> q;
	bool flag = false;
	while(q--){
		ll t; cin >> t;
		if(t==1) flag = !flag;
		else{
			ll f;
			char c; cin >> f >> c; f--;
			if(flag){
				if(f){
					fr.push_back(c);
				}else{
					ba.push_back(c);
				}
			}else{
				if(f){
					ba.push_back(c);
				}else{
					fr.push_back(c);
				}
			}
		}
	}
	reverse(all(fr));
	string ans = fr + s + ba;
	if(flag) reverse(all(ans));
	cout << ans << endl;
}

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

int main() {
	// your code goes here
	int l,r,x;
	cin>>l>>r>>x;
    int val = x;
    int cnt = 0;
    for(int i=1;i<1000;i++){
        val = x;
        int num = val*i;
        if(num<=r && num>=l) cnt++;
        
    }
    cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;

vector<int> ra(MX,0);
vector<int> par(MX,0);
using P = pair<int, int>;
using ll = long long;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x==y) return;
    if(ra[x]<ra[y]) {
        par[x] = y;
    }else {
        par[y] = x;
        if(ra[x]==ra[y]) {
            ra[x]++;
            
        }
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int a[MX];
int c[10][1000];

signed main(){
    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;

    if(10%p==0) {
        ll ans = 0;
        rep(r, n) {
            if((s[r]-'0')%p == 0) ans += r+1;
        }
        cout << ans << endl;
        return 0;
    }

    reverse(s.begin(), s.end());
    int k = 1;
    a[0] = 1;
    FOR(i, 1, n) {
        k *= 10%p;
        k %= p; 
        a[i] = k;
    }



    rep(i, n) {
        a[i] = a[i]*(int)(s[i]-'0')%p;
    }
    //rep(i,n) cout << a[i] << endl;
    FOR(i, 1, n) {
        a[i] = a[i] + a[i-1];
        a[i] %= p;
    }
    //rep(i,n) cout << a[i] << endl;

    vector<int> cnt(p);
    ll ans = 0;
    rep(i,n+1) {
        ans += cnt[a[i]];
        cnt[a[i]]++;
    }
    cout << ans << endl;
    return 0;

}



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

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;

  for (int i = 0; i < 3; i++){
    if (s[i] == t[i]) ans++;
  }

  cout << ans;
}

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

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

	int cnt = 0;


	for( int aa=0 ; aa<=a ; aa++ )
	{
		for( int bb=0 ; bb<=b ; bb++ )
		{
			for( int cc=0 ; cc<=c ; cc++ )
			{
				if( aa*500 + bb*100 + cc*50 == total )
				{
					cnt ++;
				}
			}
		}
	}





	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        String x = sc.next();
        String y = sc.next();

        int ans = 0;

        for (int i = 0; i < x.length(); i++) {
            if  (x.charAt(i) == y.charAt(i)) {

            } else {
                ans++;
            }
        }


        System.out.println(ans);

        sc.close();

    }

}


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

#define int long long
#define MOD 1000000007

int memo[100010];
int no[100010] = {};
int n, m;

int dp(int i){
    if(i == n) return 1;
    if(i > n) return 0;
    if(no[i] == 1) return 0;
    if(memo[i] != -1) return memo[i];
    return memo[i] = (dp(i+1) + dp(i+2)) % MOD;
}

signed main(){
    cin >> n >> m;

    int a;
    for(int i = 0;i < m;i++){
        cin >> a;
        no[a] = 1;
    }

    memset(memo, -1, sizeof(memo));

    cout << dp(0) << endl;
    return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define MOD 1000000007

#define FOR(i, m, n) for (ll i = m; i <= n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)

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

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

    ll ans1 = N / (A + B) * A;
    ll ans2 = N % (A + B);

    cout << ans1 + (ans2 <= A ? ans2 : A) << endl;

    return 0;
}


Measured memory_bytes: 256
# import math
# import statistics
# import itertools
# a=int(input())
# b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
A,B= map(int,input().split())
f = list(map(int,input().split()))
# g = [input().split for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen

okasi=B
f.sort()
ans=0
for i in range(A):
    if B>=f[i]:
        B=B-f[i]
        ans+=1
    else:
        if B==okasi:
            ans=0
        break
    if B>0 and i==A-1:
        ans-=1

    


print(ans)


Measured memory_bytes: 8920
parseInt(x) = parse(Int, x)

function main()
	n = readline() |> parseInt
	a = map(parseInt, split(readline()))
	rate = zeros(Int, 8)
	other = 0
	for i in 1:n
		if 1 <= a[i] <= 399
			rate[1] = 1
		elseif 400 <= a[i] <= 799
			rate[2] = 1
		elseif 800 <= a[i] <= 1199
			rate[3] = 1
		elseif 1200 <= a[i] <= 1599
			rate[4] = 1
		elseif 1600 <= a[i] <= 1999
			rate[5] = 1
		elseif 2000 <= a[i] <= 2399
			rate[6] = 1
		elseif 2400 <= a[i] <= 2799
			rate[7] = 1
		elseif 2800 <= a[i] <= 3199
			rate[8] = 1
		else
			other += 1
		end
	end
	print(max(sum(rate),1), " ", sum(rate)+other)
end

main()

Measured memory_bytes: 112732
package main

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

// AtCoder Functions
var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()

	ret := 0
	for i := 1; i < N; i++ {
		ret += i
	}
	fmt.Println(ret)
}


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

int f(int x1,int y1,int x2,int y2){

  return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}

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

  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x=c-a,y=d-b;
  cout<<c-y<<' '<<d+x<<' '<<a-y<<' '<<b+x<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define int long long
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
int i[111100];
vector<pair<int ,int> > ii;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=1,h=1,j;
  cin >>a;
  i[0]=2,i[1]=1;
  for(int n=2;n<=a;n++){
    i[n]=i[n-1]+i[n-2];
  }
  cout <<i[a]<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int NMAX = 100000;
bool used[NMAX];

void dfs(vector<vector<int> >& edge, int node){
    if(used[node]) return;
    used[node] = true;
    for(auto e : edge[node]){
        if(used[e]) continue;
        dfs(edge, e);
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    int x, y, z;
    vector< vector<int> > edge(n, vector<int>());
    for(int i=0;i<n;i++) used[i] = false;
    for(int i=0;i<m;i++){
        cin >> x >> y >> z;
        --x;--y;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    int ans = 0;
    for(int i=0;i<n;i++){
        if(!used[i]){
            ans++;
            dfs(edge, i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8960
#include <stdio.h>
#include <algorithm>

const int N = 100;
int n, p[N + 1], dp[N + 1][N + 1];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d%d", &p[i - 1], &p[i]);

	for (int i = 1; i <= n; i++)
		dp[i][i] = 0;

	for (int k = 2; k <= n; k++)
	{
		for (int i = 1; i <= n - k + 1; i++)
		{
			int j = i + k - 1;
			dp[i][j] = 1 << 20;
			for (int s = i; s <= j - 1; s++)
				dp[i][j] = std::min(dp[i][j], dp[i][s] + dp[s + 1][j] + p[i - 1] * p[s] * p[j]);
		}
	}
	printf("%d\n", dp[1][n]);

	return 0;
}



Measured memory_bytes: 2760
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;

/*
*/

ll n,ans=0;
struct d{
	string s;
	int p,q;
};
bool operator<(const d &l, const d &r){//全順序を定めないと，{1,0,0}=={1,1,0}
	if(l.s > r.s){
		return true;
	}else if(l.s == r.s){
		return l.p<r.p;
	}
	return false;
}

d dat[110];

void init(){
	cin>>n;
	rep(i,n){
		string a;
		int b;
		cin>>a>>b;
		dat[i]={a,b,i+1};
	}
	sort(dat,dat+n);
}

int main(void){
	init();
	irep(i,n)cout<<dat[i].q<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int a[200000];
int main()
{
	int t;
	scanf("%d",&t);
	int ans=t;
	for(int i=0;i<t;i++)
	{
		scanf("%d",&a[i]);
	}
	std::sort(a,a+t);
	for(int i=0;i<t;)
	{
		if(a[i] == a[i+1])
		{
			ans-=2;
			i+=2;
		}
		else
			i+=1;
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 512
#include<iostream>
#include<stack>
using namespace std;

char NOT(char a)
{
  if(a=='0')return '2';
  if(a=='1')return '1';
  return '0';
}

char OR(char a,char b)
{
  if(a=='0' && b=='0')return '0';
  if(a=='2' || b=='2')return '2';
  return '1';
}

char AND(char a,char b)
{
  if(a=='2' && b=='2')return '2';
  if(a=='0' || b=='0')return '0';
  return '1';
}

char Check(int x,int y,int z,string s)
{
  for(int i=0;i<s.length();i++){
    if(s[i]=='P')s[i]='0'+x;
    if(s[i]=='Q')s[i]='0'+y;
    if(s[i]=='R')s[i]='0'+z;
  }
  char a,b,c;
  stack<char> S;
  for(int i=0;i<s.length();i++){
    if(s[i]=='0' || s[i]=='1' || s[i]=='2'){
      S.push(s[i]);
      while(1){
	if(S.size()==1)break;
	a = S.top();S.pop();
	c = S.top();
	if(c=='('){
	  S.push(a);
	  break;
	}
	S.pop();
        if(c=='+'){
	  b=S.top();S.pop();
	  S.push(OR(b,a));
	}
	else if(c=='*'){
	  b=S.top();S.pop();
	  S.push(AND(b,a));
	}
	else{
	  S.push(NOT(a));
	}
      }
    }
    else if(s[i]==')'){
      while(1){
	a = S.top();S.pop();
        c = S.top();S.pop();
	if(c=='('){
          S.push(a);
	  while(1){
	    if(S.size()==1)break;
	    a = S.top();S.pop();
	    c = S.top();
	    if(c=='('){
	      S.push(a);
	      break;
	    }
	    S.pop();
	    if(c=='+'){
	      b=S.top();S.pop();
	      S.push(OR(b,a));
	    }
	    else if(c=='*'){
	      b=S.top();S.pop();
	      S.push(AND(b,a));
	    }
	    else{
	      S.push(NOT(a));
	    }
	  }
	  break;
	}
        else if(c=='+'){
	  b=S.top();S.pop();
	  S.push(OR(b,a));
	}
	else if(c=='*'){
	  b=S.top();S.pop();
	  S.push(AND(b,a));
	}
	else{
	  S.push(NOT(a));
	}
      }
    }
    else S.push(s[i]);
  }
  return S.top();
}

int main()
{
  string s;
  int ans;
  while(1){
    cin>>s;
    if(s[0]=='.')break;
    ans=0;
    s='('+s+')';
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
	for(int k=0;k<3;k++){
	  if(Check(i,j,k,s)=='2')ans++;
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<math.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a+b+c<=21){
        printf("win\n");
    }
    else{
        printf("bust\n");
    }
    return 0;
}

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

int main() {

	ll n; cin >> n;
	vector<ll> num(n + 1, 0);
	for (ll i = 1; i <= n; i++) {
		for (ll j = i; j <= n; j+=i) {
			num[j]++;
		}
	}
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ans += i * num[i];
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 81396
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int w,h,n;
  cin >> w >> h >> n;
  int lx=0,rx=w,uy=h,dy=0;
  rep(i,n){
    int x,y,a;
    cin >> x >> y >> a;
    if(a==1){
      lx=max(x,lx);
    }
    if(a==2){
      rx=min(x,rx);
    }
    if(a==3){
      dy=max(y,dy);
    }
    if(a==4){
      uy=min(y,uy);
    }
    
  }
  
  int s = max(rx-lx,0)*max(uy-dy,0);
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
typedef unsigned int ui;
 
int main(){
    int n,P,in;
 
    while(cin >> n ,n){
	vector<int> J;
	ui sum = 0;
 
	for(int i = 0 ; i < n ; i++){
	    cin >> P;
	    sum += P;
	}
 
	for(int i = 0 ; i < n-1 ; i++){
	    cin >> in;
	    sum += in;
	    J.push_back(in);
	}
 
	ui ans = 0;
	sort(J.begin(),J.end());
 
	for(int i = 0,j = 1 ; i < n-1 ; i++,j++){
	    ans = max(ans,sum*j);
	    sum -= J[i];
	}
 
	cout << max(ans,sum*n) << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

#define pll pair<ll,ll>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl
#define sz(a) int((a).size())
#define endl '\n' // remove for interactive

const int INF = 1e9;
const ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}



void solve()
{
    int n; cin>>n;
    set<string> s;
    rep(i, n)
    {
        string k; cin>>k;
        s.insert(k);
    }
    cout<<sz(s);
}

int main()
{
    // clock_t start, end;
    // start = clock();
    ios_base::sync_with_stdio(0); //cant use scanf, printf
    cin.tie(0);cout.tie(0); // no longer auto flush cout before each cin, remove for interactive
    int t = 1;
    // cin>>t;
    REP(i, 1, t)
    {
        solve();
        
    }
    // end = clock();
    // double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    // watch(time_taken);
    ll x = INF; x++;
    return 0;
    
}



/*before sub
TEST: 0, 1, equal, -ve, bounds(random and ez)
ERR/WA: loop vars, out of bounds, endl, finish taking inputs, large doubles, larger INF, corr mod, t
RE: double dec, integer overflow(ll or 1LL mult)
*/





Measured memory_bytes: 19164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	int a,b;
	cin >> a >> b;
	cout << max(a+b,max(2*a-1,2*b-1)) << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	double  W, H, x, y;
	cin >> W >> H >> x >> y;
	double ans = W * H / 2;
	if (x == W / 2 && y == H / 2)cout << ans << " " << 1;
	else cout << ans << " " << 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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 main() {
    input! {
        s: String,
        t: String,
    }
    let s: Vec<_> = s.chars().collect();
    let t: Vec<_> = t.chars().collect();

    let mut ans = 0;
    for i in 0..s.len() {
        if s[i] == t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;
 
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			bool result = s.Substring(0, n / 2) == s.Substring(n / 2);
			Console.WriteLine(result ? "Yes" : "No");
		}
	}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <cmath>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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(){
    cin.tie(0);
   	ios::sync_with_stdio(false);

    int A, B;
    cin >> A >> B;

    if(A * B % 2 == 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}


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

int main()
{
	string S, T;
	cin >> S >> T;
	
	int ans = 1005;
	for(int i = 0; i < (int)(S.length()); i++)
	{
		if(i + (int)(T.length()) - 1 >= (int)(S.length()) )
			break;
			
		int changes = 0;
		for(int j = 0; j < (int)(T.length()); j++)
		{
			//printf("S[%d + %d] = %c, T[%d] = %c\n", i, j, S[i + j], j, T[j]);
			if(S[i + j] != T[j])
				changes++;
		}
		
		//printf("%d\n\n", changes);
		ans = min(ans, changes);
	}
	
	printf("%d", ans);
}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 5e3+5;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    string s,t;
    cin >> s >> t;
    t.pop_back();
    if (s==t) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, n,m , M, K,a;

vector<ll> v,w;
int main(){
    cin >> N >> M;
    ll total = 0;
    for(int i = 0; i < M ; ++i){
        cin >> n;
        total += n; 
    }
    if (total < N ) cout << "No";
    else cout << "Yes";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+1;

int n, m, color[N];
vector<int> g[N];

bool dfs(int u, int p) {
	bool ret = true;
	for(int v: g[u]) if(v != p) {
		if(color[v] == -1) color[v] = color[u] ^ 1, ret &= dfs(v, u);
		else if(color[v] == color[u]) return false;
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 0, u, v; i < m; i++) {
		cin >> u >> v; --u; --v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	fill(color, color+n, -1);
	color[0] = 0;
	bool bipartite = dfs(0, -1);
	if(!bipartite) cout << 1ll * n * (n-1) / 2 - m, exit(0);
	int cnt[2] = {0, 0};
	for(int i = 0; i < n; i++) cnt[color[i]]++;
	cout << 1ll * cnt[0] * cnt[1] - m;
}


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

int main() {
    int N; cin >> N;
    ll C; cin >> C;
    vector<ll> x(N);
    vector<ll> v(N);
    vector<ll> xr(N);
    vector<ll> vr(N);
    rep(i, N){
        cin >> x[i] >> v[i];
    }
    rep(i, N){
        xr[i] = C - x[N-1-i];
        vr[i] = v[N-1-i];
    }

    vector<ll> vtotal(N+1);
    vector<ll> vrtotal(N+1);
    rep(i, N){
        vtotal[i+1] = vtotal[i] + v[i];
        vrtotal[i+1] = vrtotal[i] + vr[i];
    }

    vector<ll> f(N+1);
    rep(i, N){
        f[i+1] = vtotal[i+1] - x[i];
    }
    vector<int> fmax(N+1);
    ll now = 0;
    int nownum = 0;
    for (int i = 1; i <= N; i++){
        if(f[i] > now){
            now = f[i];
            nownum = i;
        }
        fmax[i] = nownum;
    }

    vector<ll> fr(N+1);
    rep(i, N){
        fr[i+1] = vrtotal[i+1] - xr[i];
    }
    vector<int> frmax(N+1);
    now = 0;
    nownum = 0;
    for (int i = 1; i <= N; i++){
        if(fr[i] > now){
            now = fr[i];
            nownum = i;
        }
        frmax[i] = nownum;
    }

    ll ans = 0;
    rep(i, N+1){
        if(i == 0){
            ans = max(ans, fr[frmax[N]]);
            //cout << i << " " << now << endl;
            continue;
        }
        ll now = vtotal[i] - x[i-1] * 2;
        //cout << i << " " << now;
        now += fr[frmax[N-i]];
        
        //cout << " " << now2 << " " << now3 << endl;
        ans = max(ans, now);
    }

    rep(i, N+1){
        if(i == 0){
            ans = max(ans, f[fmax[N]]);
            //cout << i << " " << now << endl;
            continue;
        }
        ll now = vrtotal[i] - xr[i-1] * 2;
        //cout << i << " " << now;
        now += f[fmax[N-i]];
        
        //cout << " " << now2 << " " << now3 << endl;
        ans = max(ans, now);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10344
# -*- coding: utf-8 -*-
"""
Hot days
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0579

"""
import sys


def solve(temperatures, clothes):
    points = [[] for _ in range(len(temperatures))]
    for i, t in enumerate(temperatures):
        for c in clothes:
            if c[0] <= t <= c[1]:
                points[i].append(c[-1])
        points[i].sort()

    dp = [[min(points[0]), 0], [max(points[0]), 0]]
    for p in points[1:]:
        dp = [[min(p), max(dp[0][1] + abs(min(p)-dp[0][0]), dp[1][1] + abs(min(p)-dp[1][0]))],
              [max(p), max(dp[0][1] + abs(max(p)-dp[0][0]), dp[1][1] + abs(max(p)-dp[1][0]))]]
    return max(dp[0][1], dp[1][1])


def main(args):
    d, n = map(int, input().split())
    temperatures = [int(input()) for _ in range(d)]
    clothes = [[int(x) for x in input().split()] for _ in range(n)]
    ans = solve(temperatures, clothes)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



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

int main(){
  int n;
  cin >> n;
  
  vector<vector<int>> g(n,vector<int>());

  for (int i = 0; i < n; i++)
  {
    int u,k;
    cin >> u >> k;

    for (int j = 0; j < k; j++)
    {
      int v;
      cin >> v;
      v--;
      g[i].push_back(v);
      // g[v].push_back(i);
    }
  }

  vector<int> dist(n,-1);
  dist[0] = 0;
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    int node = q.front();
    q.pop();
    for(int next:g[node]){
      if(dist[next]!=-1) continue;
      dist[next] = dist[node]+1;
      q.push(next);
    }
  }
  for (int i = 0; i < n; i++)
  {
    cout << i+1 << " " << dist[i] << endl;
  }  
}


Measured memory_bytes: 3148
N=int(input())
A=list(map(int, input().split()))
D=[0]
d=0
for i in A:
  d+=i
  D.append(d)
s=D[-1]
D=D[1:-1]
d=s
import bisect
for i in range(1,len(D)-1):
  a=D[i]/2
  b=(D[i]+s)/2
  l=bisect.bisect_left(D,a)
  r=bisect.bisect_left(D,b)
  L,R=[],[]
  if l-1<i:
    L.append(l-1)
  if r-1<len(D):
    R.append(r-1)
  if l<i:
    L.append(l)
  if r<len(D):
    R.append(r)
  for j in L:
    for k in R:
      mi=min(s-D[k],D[k]-D[i],D[i]-D[j],D[j])
      ma=max(s-D[k],D[k]-D[i],D[i]-D[j],D[j])
      d=min(d,ma-mi)
print(d)

Measured memory_bytes: 31652
#include <iostream> 
#include <cstdio> 
#include <cstdlib>  
#include <algorithm> 
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long ll;


long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}


int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    if (a == b) cout << 1 << endl;
    else if (n == 1) cout << 0 << endl;
    else if (a > b) cout << 0 << endl;
    else if (n == 2) cout << 1 << endl;
    else cout << b * (n - 2) - a * (n - 2) + 1 << endl;

}


Measured memory_bytes: 3628
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli find_max(lli __a,lli __b){return __a^((__a^__b) & -(__a<__b));}
lli add(lli __a,lli __b,lli MOD){lli x = (__a+__b)%MOD; return x; }
lli mul(lli a,lli b,lli MOD){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b,lli MOD){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b,lli MOD){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}
//97->a 122->z
//65-A
int main()
{
	//freopen("testcase.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);	
	cout.precision(20);
	lli t,i,j;
	//cin>>t;
	//memset(dp, -1, sizeof dp);
	t=1;
	lli counter1=0;
	while(t--)
	{
		counter1++;
		string a;
		cin>>a;
		cout<<a[0]<<a.size()-2<<a[a.size()-1]<<endl;
		
		//cout<<"Case #"<<counter1<<" ";
		//cout<<endl;	
	}	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
  int d, g;
  cin >> d >> g;
  vector<int> p(d), c(d);
  for (int i = 0; i < d; ++i)
    cin >> p[i] >> c[i];

  int ret = accumulate(p.begin(), p.end(), 0);
  for (int bits = 0; bits <= (1 << d); ++bits) {
    int point = 0;
    int k = 0;
    for (int b = 0; b < d; ++b) {
      if (((bits >> b) & 1) == 0)
        continue;
      point += (b + 1) * 100 * p[b] + c[b];
      k += p[b];
    }
    for (int b = d - 1; b >= 0; --b) {
      if ((bits >> b) & 1)
        continue;
      int need = (((g - point) / 100) + b) / (b + 1);
      need = max(0, min(need, p[b] - 1));
      k += need;
      point += (b + 1) * 100 * need;
      break;
    }
    if (point >= g)
      ret = min(ret, k);
  }
  cout << ret << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){

    long long int N[3],i;
    
    for(i = 0; i < 3; i++) {
        cin >> N[i];
        if(N[i] % 2 == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    sort(N,N+i);
    
    cout << N[0] * N[1] << endl;
    
    return 0;
}


Measured memory_bytes: 256
import numpy as np
h, w = map(int, input().split())
n = int(input())
x = list(map(int, input().split()))

line = []
for i in range(n):
    for j in range(x[i]):
        line.append(i+1)

aa = np.array(line).reshape(h, w)
for i in range(h):
    if i % 2 == 1:
        aa[i, :] = aa[i, :][::-1]

for i in range(h):
    print(' '.join([str(_) for _ in aa[i]]))

Measured memory_bytes: 14340
#include<bits/stdc++.h> 
using namespace std;
const int maxn=1e5+10;
int a[maxn];
int main() {
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int n=s.length();
	int now=0;
	int pos=0;
	while(pos<n){
		int num1=0;
		int num2=0;
		while(s[pos]=='R')pos++,num1++;
		int pos1=pos-1;
		int pos2=pos;
		while(s[pos]=='L')pos++,num2++;
		a[pos1]=(num1+1)/2+num2/2;
		a[pos2]=num1/2+(num2+1)/2;
	}
	for(int i=0;i<n;i++)cout<<a[i]<<' ';
}

Measured memory_bytes: 1104
#include <iostream>
using namespace std;
int main(){
int w,h,x,y,r;
cin>>w>>h>>x>>y>>r;

if(0<=x+r&&x+r<=w&&0<=y+r&&y+r<=h&&x>=0&&y>=0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}

Measured memory_bytes: 3076
#include<iostream>
#include<cstring>
 
#define fastio()                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll                      long long int
#define ull                     unsigned long long int
#define inp(n)                  ll n; cin >> n
#define inpc(c)                 char c; cin >> c
#define inps(s)                 string s; cin >> s
#define print(x)                cout << x << " "
#define nl                      cout << '\n'
#define pyes                    cout << "YES"
#define pno                     cout << "NO"
#define fr(i,a,b)               for(ll i=a; i<b; ++i)
#define frrev(i,b,a)            for(ll i=b; i<=a; --i)
#define strrev(s)               reverse(s.begin(), s.end())
#define pb(x)                   push_back(x)
#define vin(A, n)               vector<ll> A; fr(i,0,n){ ll x; cin >> x; A.pb(x); }
#define vinc(A, n)              vector<char> A; fr(i,0,n){ char x; cin >> x; A.pb(x); }
#define vpairin(A, n, t1, t2)   vector<pair<t1,t2> > A; fr(i,0,n) {t1 x; t2 y; cin >> x >> y; A.pb(make_pair(x,y));}
#define srt(A)                  sort(A.begin(), A.end())
#define vout(A, n)              fr(i,0,n){ print(A[i]); }
#define vpairout(A, n)          fr(i,0,n){ print(A[i].first); print(A[i].second); nl; }
 
using namespace std;

void solve()
{
	string n;
	cin >> n;
	int marbles = 0;
	for (int i = 0; i < n.length(); ++i)
	{
		/* code */
		if (n[i] == '1')
			marbles++;
	}
	cout << marbles;

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

Measured memory_bytes: 3152
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll n; cin >> n; vvl a(n, vl(n, 0)), b(n, vl(n, 0));
    REP(i, n) REP(j, n) {cin >> a[i][j]; b[i][j] = a[i][j];};
    
    ll ans = 0;
    vvb exist(n, vb(n, true));
    REP(k, n) REP(i, n) FOR(j, i + 1, n){
        if(i == k || j == k) continue;
        if(b[i][j] >= b[i][k] + b[k][j]){
            b[i][j] = b[i][k] + b[k][j];
            exist[i][j] = false;
        }
    }
 
    REP(i, n) FOR(j, i+1, n){
        if(a[i][j] != b[i][j]){
            cout << -1 << endl;
            return 0;
        }
        if(exist[i][j]) ans += b[i][j];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 


void solve(){
	int m, n;
	cin>>m>>n;
	int arr[n+1];
	FOR(i, 0, n) cin>>arr[i];
	vector<int> res;
	int su=0;
	FOR(i, 1, n) res.pb(arr[i]-arr[i-1]);
	res.pb(m - arr[n-1] + arr[0]);
	FOR(i, 0, sz(res)) su+=res[i];
	cout<<su-(*max_element(all(res)))<<endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); 	
	int t=1;
//	cin>>t;
	FOR(i, 1, t+1){	
	//	cout<<"Case #"<<i<<":"<<endl;
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
 
}


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c;
    return 0;
}



Measured memory_bytes: 3604
#include <stdio.h>
#include <string.h>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
#define fill(x,t) memset(x,t,sizeof(x))

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):(v),ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

int main(void) {
	int A=read(),B=read();
	rep(C,1,3) if ((A*B*C)&1) {
		puts("Yes"); return 0;
	}
	puts("No");
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  int counter =0;
  if(s[0] =='1') ++counter;
  if(s[1] =='1') ++counter;
  if(s[2] =='1') ++counter;
  cout << counter << endl;
}


Measured memory_bytes: 3632
import math
a,b,C = map(float,input().split())
c = math.sqrt( (a*a)+(b*b) - 2*a*b*math.cos(C/180 * math.pi))
h = b * math.sin(C/180 * math.pi)
print(h * a /2)
print(a+b+c)
print(h)

Measured memory_bytes: 7680
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = stdIn.nextInt();
		}
		int count = 0;
		while(true) {
			boolean odd = false;
			for(int i = 0; i < N; i++) {
				if(A[i]%2 != 0) odd = true;
			}
			if(odd) break;
			for(int i = 0; i < N; i++) {
				A[i] /= 2;
			}
			count++;
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 23764