akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

int main()
{
    vector<int>v;
    int n,k,a,sum=0;
    cin >> n >> k;

    for(int i=0;i<n;i++)
    {
        cin >> a;
        v.push_back(a);
    }

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

    for(int i=0;i<k;i++)
    {
       sum=sum+v[i];

    }

    cout << sum;



    return 0;
}


Measured memory_bytes: 3556
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    vec<ll> A(5);
    int mn = INT_MAX, mn_i = 0;
    int sum = 0;
    REP(i, 5){
        cin >> A[i];
        if(chmin(mn, (int)(A[i]+9)%10)){
            mn_i = i;
        }
        sum += ((A[i]+9)/10)*10;
    }
    sum -= 9 - mn;
    cout << sum << el;
}



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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

int main() {
#ifdef LOCAL
  freopen("f.in", "r", stdin);
  freopen("f.out", "w", stdout);
#endif

  int n;
  scanf("%d", &n);

  vector<int> vals(n);
  for (int i = 0; i < n-1; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    vals[a] ^= c;
    vals[b] ^= c;
  }

  int ans = n;
  int mask = 0;
  for (int i = 0; i < n; i++) {
    if (vals[i] == 0) {
      ans--;
    } else {
      if (mask & (1 << vals[i])) {
        ans--;
      }
      mask ^= (1 << vals[i]);
    }
  }

  const int K = 16;

  vector<int> dp(1 << K);
  for (int i = 1; i < (1 << K); i++) {
    int v = 0;
    for (int j = 0; j < K; j++) {
      if (i & (1 << j)) {
        v ^= j;
      }
    }
    if (!v) {
      dp[i] = 1;
    } else {
      dp[i] = -10000;
    }

    for (int j = i; j; j = (j - 1) & i) {
      dp[i] = max(dp[i], dp[j] + dp[i ^ j]);
    }
  }

  eprintf("ans = %d, mask = %d, dp[mask] = %d\n", ans, mask, dp[mask]);

  ans -= dp[mask];
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;

const int INF = 1e9 + 5;

int min_self(int &a , int b){
    a = min(a , b);
return a;
}

int main (){
    int N , K;
scanf("%d %d" , &N , &K);
    vector<int> h(N) , dp(N , INF);
    for(int &x : h){
        scanf("%d" , &x);
    }
    dp[0] = 0;
    for(int i = 0; i < N; ++i){
        for(int j = i + 1; j <= i + K; ++j){
            if(j < N){
                min_self(dp[j] , dp[i] + abs(h[i] - h[j]));
            }
        }
    }
    printf("%d" , dp[N - 1]);
return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#define max 2000000

int h, c;
int x[max+1];

void hmax(int a){
  int l=2*a,r=2*a+1,largest;
  if(l<=h && x[l]>x[a])largest=l;
  else largest=a;
  if(r<=h && x[r]>x[largest])largest=r;
  if(largest != a){
    c=x[a];
    x[a]=x[largest];
    x[largest]=c;
    hmax(largest);
  }
}

int main(){
  int i;
  scanf("%d",&h);
  for(i=1 ; i<=h ; i++)scanf("%d",&x[i]);
  for(i=h/2 ; i>=1 ; i--)hmax(i);
  for(i=1 ; i<=h ; i++){
    printf(" %d",x[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 3736
package main

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

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()
	x := make([]int, n)
	s := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = nextInt()
		s[i] = x[i]
	}

	sort.Ints(s)

	for i := 0; i < n; i++ {
		if s[n/2] > x[i] {
			fmt.Println(s[n/2])
		} else {
			fmt.Println(s[n/2-1])
		}
	}

	// for i := 0; i < n; i++ {
	// 	if s[1] <= x[i] {
	// 		fmt.Println(s[2])
	// 	} else {

	// 		fmt.Println(s[1])
	// 	}
	// }

}


Measured memory_bytes: 8832
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main() {

	char a;
	cin >> a;
	if (a == 'A') {
		cout << 'T' << endl;
	}
	else if (a == 'G') {
		cout << 'C' << endl;
	}
	else if (a == 'C') {
		cout << 'G' << endl;
	}
	else {
		cout << 'A' << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
//https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035
//https://torus711.hatenablog.com/entry/20150423/1429794075
//勉強させて頂いた記事

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse

int main(){
    string K;
    int D;
    cin>>K>>D;
    int L=K.length();

    //dp[i][j][k] iは桁,jはK以下確定かどうか。もう一つ加える必要がある。
    //k各桁の総和がD倍かどうか　

    int dp[10010][2][100]={0};

    dp[0][0][0]=1;

    for(int i=0;i<L;i++){
        for(int p=0;p<D;p++){
            for(int j=0;j<2;j++){
                for(int d=0;d<=(j? 9:K[i]-'0');d++){
                    dp[i+1][j||d<K[i]-'0'][(p+d)%D]=(dp[i][j][p]+dp[i+1][j||d<K[i]-'0'][(p+d)%D])%INF;
                }
            }
        }
    }

    cout<<(dp[L][0][0]+dp[L][1][0]-1+INF)%INF<<endl;//INFを足すのはなぜだ……？



    return 0;
}

//a=97,z=122

Measured memory_bytes: 8064
from itertools import accumulate
from collections import Counter


def solve(n):
    return n * (n - 1) // 2


s = input()[::-1]
MOD = 2019

# 事前計算
rest = []
for i, x in enumerate(s):
    # 1, 10, 100, 1000...の剰余を順に計算し、各桁までの剰余を計算
    if i == 0:
        tmp = 1
    else:
        tmp = tmp * 10 % MOD
    rest.append(int(x) * tmp % MOD)

result = [x % MOD for x in list(accumulate(rest))]

# 0は単独で2019の倍数
zero = result.count(0)

# 他はコンビネーションの結果
c = Counter(result)
c = list(c.values())

# 足して出力
print(sum([solve(x) for x in c if x >= 2]) + zero)

Measured memory_bytes: 31900
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPE(i,a,n) for(int i=a;i<=n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SRTVG(v) sort(v.begin(),v.end(),greater<>())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T,class U> void cinn(T& n,U a) {REP(i,0,n) cin >> a[i];}

int atcoder(){
    ll n;
    cin >> n;
    ll a[110000];
    map<ll,ll> mp;
    REP(i,0,n){
        cin >> a[i];
        mp[a[i]]++;
    }
    ll ans=0;
    
    for(auto x : mp){
        if(x.second>x.first) ans += (x.second-x.first);
        if(x.second<x.first) ans += x.second;
    }
    
    cout << ans;
    return 0;
    
    return 0;
}

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


Measured memory_bytes: 7040
#include <stdio.h>

int main(void)
{
	int a, b, i;
	
	scanf("%d %d", &a, &b);

	for (i = 0; i <= (int)1e3; i++)
		if ((int)(i * (8.0 / 100.0)) == a && (int)(i / 10.0) == b)
		{
			printf("%d", i);
			return 0;
		}
	puts("-1");
	return 0;
}

Measured memory_bytes: 128
/**
*    created: 27.06.2020 18:35:10
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b, c;
    cin >> a >> b >> c;
    map<int,int> mp;
    int t = 1;
    while (true) {
        int rem = (a * t) % b;
        if (rem == c) {
            cout << "YES" << endl;
            return 0;
        }
        else if (mp[rem] > 0) {
            cout << "NO" << endl;
            return 0;
        }
        else {
            mp[rem]++;
            t++;
        }
    }
    return 0;
}

Measured memory_bytes: 3628
import itertools

n = int(input())

f, p, profits = [], [], []

for _ in range(n):
    tmp = [int(x) for x in input().split()]
    f.append(tmp)

for _ in range(n):
    tmp = [int(x) for x in input().split()]
    p.append(tmp)

a = [0,1]

for x_ in itertools.product(a, repeat=10):
    x = list(x_)
    if sum(x) == 0:
        pass
    else:
        profit = 0
        for i, y in enumerate(f):
            count = 0
            for j,k in zip(x,y):
                if j == 1 and k == 1:
                    count += 1
            profit += p[i][count]
        profits.append(profit)

print(max(profits))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define REP(i, n) for ( int i = 0; i < (n); i++ )
 
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);

  int N;
  cin >> N;

  if ( N%2 ) {
    cout << 0 << endl;
    return 0;
  }

  int now = 5;
  int ans = 0;  
  while ( now <= N ) {
    ans += N/(now*2);    
    now *= 5;    
  }

  cout << ans << endl;  

  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
   ll k,n=0,ans=-1;
   cin>>k;
   rep(i,1000000){
       n+=modpow(10,i,k)*7;
       n=n%k;
       //cout<<n<<endl;
       if(n%k==0){
           ans=i+1;
           break;
       }
   }
   cout<<ans<<endl;
}



Measured memory_bytes: 3632
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int[] A = in.nextIntArray(3);
            String ret = "bust";
            if (Arrays.stream(A).sum() <= 21) {
                ret = "win";
            }
            out.println(ret);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

    }
}



Measured memory_bytes: 26324
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <complex>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define E 1e-6;
void open()
{
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
}
int main()
{
    string str;
    while(cin>>str)
    {
        cout<<str[0]<<str.size()-2<<str[str.size()-1]<<endl;
    }
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main() {
	int n, cnt = 0, i;
	cin >> n;
	for (i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		cnt += (b - a + 1);
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc082/tasks/arc087_b
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int gx, gy;
    cin >> gx >> gy;
    int cnt = 0;
    vector<int> vx, vy;
    s += 'T';
    bool bt = false;
    int fv = -1;
    for (auto &x : s) {
        if (x == 'T') {
            if (bt) {
                vy.push_back(cnt);
            } else {
                if (fv == -1) {
                    fv = cnt;
                } else {
                    vx.push_back(cnt);
                }
            }
            cnt = 0;
            bt = !bt;
        } else {
            cnt++;
        }
    }
    unordered_set<int> px, py, tt;
    px.insert(fv);
    py.insert(0);
    for (auto &a : vx) {
        tt.clear();
        for (auto &x : px) {
            tt.insert(x + a);
            tt.insert(x - a);
        }
        px = tt;
    }
    for (auto &a : vy) {
        tt.clear();
        for (auto &x : py) {
            tt.insert(x + a);
            tt.insert(x - a);
        }
        py = tt;
    }

    if (find(ALL(px), gx) != px.end() && find(ALL(py), gy) != py.end()) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int D[100000];
int main(){
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(D[Lj4PdHRW]);
    }
  }
  sort(D,D+N);
  wt_L(D[N/2]-D[N/2-1]);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190626-1

// --- original code ---
// int N, D[1d5];
// {
//   rd(N,D(N));
//   sort(D,D+N);
//   wt(D[N/2]-D[N/2-1]);
// }


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

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;


struct make{
    int x;
    int y;

}cor[100];

 double compute(int a,int b)
{
    double aa = (cor[a].x*1.0 - cor[b].x*1.0)*1.0*(cor[a].x*1.0 - cor[b].x*1.0)*1.0;
    double bb =  (cor[a].y*1.0 - cor[b].y*1.0)*(cor[a].y*1.0 - cor[b].y*1.0)*1.0;



    return sqrt(aa+bb);
}

int main(void)
{
    //READ_IN

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);



  int n; cin >>n;

  vector<int> ne;

  for(int i=1;i<=n;i++)
  {
      ne.push_back(i);
  }


  for(int i=1;i<=n;i++)
  {
      int x,y;
      cin >> x >> y;

      cor[i].x  = x;
      cor[i].y = y;
  }

  double ans=0;



    for(int i=0;i<n-1;i++)
    {
        for(int j=i;j<n-1;j++){

        ans += compute(ne[i],ne[j+1]) *2.0;

        }

    }


  cout << fixed << setprecision(10)  << ans*1.0/n*1.0 <<  endl;

    return 0;
}


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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;



mat dp;

lli n,m,k;
vll a;
deque<lli> dq;

int main(){
  cin >> n >> m >> k;
  a = vll(n+1);
  for(lli i = 1;i <= n;i++) cin >> a[i];
  dp = mat(k+1,vll(n+1));
  for(lli i = 1;i <= k;i++){
    dq = deque<lli>();
    dq.push_back(i-1);
    for(lli j = i;j <= n;j++){
      while(dq.front() < j-m) dq.pop_front();
      dp[i][j] = dp[i-1][dq.front()]+i*a[j];
      while(dq.size() > 0 && dp[i-1][dq.back()] < dp[i-1][j]) dq.pop_back();
      dq.push_back(j);
      // dp[i][j] = *max_element(dp[i-1].begin()+max(i-1,j-m),dp[i-1].begin()+j-1)+i*a[j];
    }
  }
  cout << *max_element(dp[k].begin(),dp[k].end()) << endl;

}


Measured memory_bytes: 237824
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=3e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
  }
   

int h,w,M;
	
void solve() {
    cin>>h>>w>>M;
    mi mr,mc;
    mii mp;
    vi nax;
    rep(i,0,M) {
		  int x,y;
		  cin>>x>>y;
		  //~ if(x==y) {			    
			    //~ nax.pb(x);
			  //~ }
		  mp[{x,y}]++;	  		   
		  mr[x]++;
		  mc[y]++;
		}
		
		sort(all(nax));
   int mx1=0,mx2=0;
   for(auto to:mr) {
	      mx1=max(mx1,to.se);     
	   }
	   
   vi hx,hy;
   for(auto to:mr) {
	      if(to.se==mx1)  {
			    hx.pb(to.fe);
			  }
	   }	   		
	
   for(auto to:mc) {		      
		  mx2=max(mx2,to.se);			
	   }
   for(auto to:mc) {
	      if(to.se==mx2)  {
			    hy.pb(to.fe);
			  }
	   }
   
   int ans=0,ct=0;
   rep(i,0,sz(hx)) {
	     rep(j,0,sz(hy)) {
			   ct++;
			   ans=max(ans,mx1+mx2-mp[{hx[i],hy[j]}]);
			     
			 }
			 if(ct>2*N) break;
	   }
	   
	  cout<<ans<<endl;	   
		                          
}

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


Measured memory_bytes: 120328
class Dice
	def initialize(labels)
		@labels = labels
		@top    = labels[0]
		@front  = labels[1]
		@right  = labels[2]
		@left   = labels[3]
		@back   = labels[4]
		@bottom = labels[5]
	end
	attr_reader :top, :front, :right

	def roll(op)
		case op
		when "E"
			@t      = @top
			@top    = @left
			@left   = @bottom
			@bottom = @right
			@right  = @t
		when "W"
			@t      = @top
			@top    = @right
			@right  = @bottom
			@bottom = @left
			@left   = @t
		when "N"
			@t      = @top
			@top    = @front
			@front  = @bottom
			@bottom = @back
			@back   = @t
		when "S"
			@t      = @top
			@top    = @back
			@back   = @bottom
			@bottom = @front
			@front  = @t
		when "R" # Roll around front and back
			@f      = @front
			@front  = @left
			@left   = @back
			@back   = @right
			@right  = @f 
		end
	end
end
labels = gets.strip.split(" ").map{|i| i.to_i}
dice = Dice.new(labels)
n = gets.strip.to_i
n.times do
	inputs = gets.strip.split(" ").map{|i| i.to_i}
	top, front = inputs[0], inputs[1]
	count = 0
	until dice.top == top
		dice.roll("E")
		count+=1
		if count > 3
			count = 0
			dice.roll("N")
		end
	end
	count = 0
	until dice.front == front
		dice.roll("R")
		count+=1
	end
	puts dice.right
end



Measured memory_bytes: 8888
// Marcin Knapik
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< int , null_type,less< int >, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define losuj(a, b) uniform_int_distribution<ll>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<vll>             vvll;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vii>             vvii;
#define pll pair<long long, long long>
#define vpll vector<pll>
#define ull unsigned long long

#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return abs(a); }

const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll BIG_INF = 1e18 + 7;
const ll N = 1e6+7;
const ll T = 1<<20;
const ld inf = 1e18;

ll n, m, q, k;

void solve(){
	cin >> n >> k;
	vll tab(n);
	cin >> tab;

	sort(all(tab));
	if((tab[0] < 0 and tab.back() <= 0 and k & 1) or n == k){
		ll ilo = 1;
		reverse(all(tab));
		for(int i = 0; i < k; i++)
			ilo = (ilo * tab[i] % INF + INF) % INF;
		cout << ilo << '\n';
	}
	else{
		ll ilo = 1;
		int it1 = 0;
		int it2 = n - 1;

		while(k >= 2){
			if(tab[it1] * tab[it1 + 1] >= tab[it2] * tab[it2 - 1]){
				ilo = (ilo * tab[it1] % INF * tab[it1 + 1] % INF + INF) % INF;
				it1 += 2;
			}
			else{
				ilo = (ilo * tab[it2] % INF * tab[it2 - 1] % INF + INF) % INF;
				it2 -= 2;
			}
			k -= 2;
		}
		if(k)
			ilo = ilo * tab[it2] % INF;
		cout << ilo << '\n';
	}
}


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

	q = 1;
	// cin >> q;

	while(q--)
		solve();
}	

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

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

	char prev = ' ';
	int cnt = 0;
	bool two = false;
	rep(i, (int)(S.size())){
		if (two == true) two = false;
		else if (S[i] == prev){
			if (i == (int)(S.size()) - 1) break ;
			two = true;
			i++;
		}
		prev = S[i];
		cnt++;
	}
	cout << cnt << endl;
}

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

int H, W, dist[1010][1010], final_res;
char grid[1010][1010];
queue<pair<int, int > > Q;

int mv1[4] = {-1, 1, 0, 0};
int mv2[4] = {0, 0, 1, -1};

int main(){
	//freopen("test.in", "r+", stdin);

	cin >> H >> W;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> grid[i][j];
			dist[i][j] = 1e9;
			if(grid[i][j] == '#'){
				Q.push(make_pair(i, j));
				dist[i][j] = 0;
			}
		}
	}
	while(!Q.empty()){
		int i = Q.front().first;
		int j = Q.front().second;
		Q.pop();

		for(int k = 0; k < 4; k++){
			int ii = i + mv1[k];
			int jj = j + mv2[k];
			if(dist[ii][jj] == 1e9){
				Q.push(make_pair(ii, jj));
				dist[ii][jj] = dist[i][j] + 1;
				final_res = max(final_res, dist[ii][jj]);
			}
		}
	}
	cout << final_res << endl;
}

Measured memory_bytes: 13328
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
char mine[55][55];
int main() {
	int n, m;
	cin >> n >> m;
	ll ans;
	ans = ((n - m) * 100 + m * 1900) * pow(2, m);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]

from itertools import product
ptns = list(product([0,1,2,-1], repeat = n))

ans = 10**9
for i in range(len(ptns)):
    if 0 not in ptns[i] or 1 not in ptns[i] or 2 not in ptns[i]:
        continue
    abc = [0, 0, 0, -30]
    for j in range(n):
        tmp = ptns[i][j]
        if tmp >= 0:
            abc[tmp] += l[j]
            abc[3] += 10

    ans = min(ans, abc[3] + abs(abc[0] - a) + abs(abc[1] - b) + abs(abc[2] - c))

print(ans)

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

using namespace std;

int main(void){
//string S;
int H;
cin >> H;
int N;
cin >> N;
vector<int> a(N);

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

int maxp = 0;
for(int i = 0; i < N; i++){
  maxp += a[i];
}

if(maxp >= H){
   cout << "Yes" << endl;
}else{
  cout << "No" << endl;
}
return 0;
}


Measured memory_bytes: 640
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

#define MAXCHAR 255

using namespace std;

static const double pi = 3.141592653589793;

double Calc(double a, double b, double theta)
{
	double sq = a * a + b * b - 2 * a * b * cos(theta);
	return sqrt(sq);
}

int main()
{
	double A = 0;
	double B = 0;
	double H = 0;
	double M = 0;
	long double theta = 0;
	long double output = 0;

	cin >> A >> B >> H >> M;

	theta = M * pi/30 - (H * pi/6 + M * pi/360);

	output = sqrt(A*A + B*B - 2 * A*B*cos(theta));
	cout.precision(17);
	cout << fixed << output << endl;

	return 0;
}

Measured memory_bytes: 4152
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    int N, MAX = 0;
    cin >> N;
    multiset<int> s;
    FOR(i, 0, pow2(N)) {
        int x;
        cin >> x;
        s.insert(-x);
        MAX = max(MAX, x);
    }
    queue<int> que;
    que.push(MAX);
    s.erase(s.find(-MAX));
    while (s.size()) {
        int f = que.front();
        que.pop();
        auto x = s.upper_bound(-f);
        que.push(f);
        que.push(-*x);
        if (x == s.end()) {
            cout << "No" << endl;
            return 0;
        }
        s.erase(x);
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 15232
//use itertools::Itertools;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        m:usize,
        jobs:[(usize,usize);n]
    }

    let mut day_index = vec![vec![]; 100001];
    // 後ろからバイトを確定させていき、決まったら新しく候補となるバイトをキューにいれる。
    for i in 0..n {
        day_index[jobs[i].0].push(i);
    }

    //println!("{:?}", day_index);

    let mut q = BinaryHeap::new();
    let mut ans = 0;
    for i in (0..m).rev() {
        for j in 0..day_index[m - i].len() {
            q.push(jobs[day_index[m - i][j]].1);
        }

        if q.peek() != None {
            let kyuryo = q.pop().unwrap();
            ans += kyuryo;
        }
    }

    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 7852
#include <iostream>
#include <vector>
using namespace std;
#define ll long long

vector<vector<ll>> Tree;
ll n;
const ll mod = 1e9 + 7;

//return pair {number of ways node can be black, num to be white}
pair<ll, ll> solve(ll node, ll parent){
    ll black = 1, white = 1;

    //to be black: all children must be white
    //so product of ways children are white

    //to be white
    //children can be all white
    //can be all black
    //can be a mix
    //white = white * (black + children white)

    for (ll x : Tree[node]){
        if (x != parent){
            auto p = solve(x, node);

            black *= p.second;
            white *= (p.first + p.second);
            black %= mod;
            white %= mod;
        }
    }

    return {black, white};
}

int main(){
    cin >> n;
    Tree = vector<vector<ll>>(n + 1);
    for (ll i = 1; i < n; i++){
        ll u, v;
        cin >> u >> v;
        Tree[u].push_back(v);
        Tree[v].push_back(u);
    }
    auto ans = solve(1, -1);
    cout << (ans.first + ans.second) % mod;
}

Measured memory_bytes: 12672
import math
T1, T2 = map(int,input().split())
A1, A2 = map(int,input().split())
B1, B2 = map(int,input().split())

if A1*T1+A2*T2 == B1*T1+B2*T2:
    print('infinity')
elif (A1-B1)*T1/((A1-B1)*T1+(A2-B2)*T2) > 0:
    print(0)    
else:
    n = abs((A1-B1)*T1/((A1-B1)*T1+(A2-B2)*T2))
    meet = math.ceil(n) + int(n)
    print(meet)   

Measured memory_bytes: 3064
#include<stdio.h>

#define MAX 100000

int A[MAX],n;

int partition(int p, int r)
{
	int x,i,j,t;
	x=A[r];
	i=p-1;
	for(j=p;j<r;j++){
		if(A[j]<=x){
			i++;
			t=A[i]; A[i]=A[j];A[j]=t;
		}
	}
	t=A[i+1];
	A[i+1]=A[r];
	A[r]=t;
	return i+1;
}

int main(){
	int i,q;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&A[i]);
	
	q=partition(0,n-1);
	for(i=0;i<n;i++){
		if(i) printf(" ");
		if(i==q) printf("[");
		printf("%d",A[i]);
		if(i==q) printf("]");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 3136
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

int main(){
	string s,t;cin>>s>>t;
	ll A,B;
	cin>>A>>B;
	string u;cin>>u;
	if(s==u)A--;
	else B--;
	cout<<A<<" "<<B<<endl;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int N;
string S;

void solve(){
  string temp="No";
  int k=N/2;
  if(N%2==0&&S.substr(0,k)==S.substr(k,k))temp="Yes";
  cout<<temp<<endl;
}
int main(){
  cin>>N>>S;
  solve();
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	string S;
	cin >> S;

	int len = S.size();
	cout << S[0] << len - 2 << S[len - 1] << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

ll N;

ll count_digits(ll x) {
    ll ret = 0;
    while (x > 0) {
        x /= 10;
        ret++;
    }
    return ret;
}

int main() {
    cin >> N;

    ll ans = INF;
    for (ll A = 1; A <= sqrt(N); A++) {
        if (N % A == 0) {
            ll digA = count_digits(A);
            ll digB = count_digits(N / A);
            ll tmp = max(digA, digB);
            if (tmp < ans) ans = tmp;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 100005
char T[N],s[N];
int main()
{
	int n,k,R,S,P,i,ans=0;
	scanf("%d%d%d%d%d",&n,&k,&R,&S,&P);
	scanf("%s",T+1);
	for(i=1;i<=n;i++){
		if(i<=k){
			if(T[i]=='r')
				ans+=P,s[i]='P';
			if(T[i]=='s')
				ans+=R,s[i]='R';
			if(T[i]=='p')
				ans+=S,s[i]='S';
		}
		else{
			if(T[i]=='r'&&s[i-k]!='P')
				ans+=P,s[i]='P';
			if(T[i]=='s'&&s[i-k]!='R')
				ans+=R,s[i]='R';
			if(T[i]=='p'&&s[i-k]!='S')
				ans+=S,s[i]='S';
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 384
book_index = {}
while True:
    try:
        word, page = input().split(' ')
        page = int(page)
        page_list = book_index.get(word)
        if page_list:
            page_list.append(page)
        else:
            book_index[word] = [page]
    except Exception:
        break

for k in sorted(book_index.keys()):
    print(k)
    print(' '.join(map(str, (sorted(book_index.get(k))))))

Measured memory_bytes: 7580
#include <bits/stdc++.h>
using namespace std;
int a[5];
int main(){
	scanf("%d%d%d",&a[1],&a[2],&a[3]);
	sort(a+1,a+4);
	a[2]-=a[1];a[3]-=a[1];a[1]=0;
	int ans=1e9;
	for(int i=0;i<=100;i++){
		int sum=0;
		for(int p=1;p<=3;p++){
			if(a[p]<=i){
				sum+=(i-a[p]+1)/2+(i-a[p]&1);
			}else{
				sum+=a[p]-i;
			}
		}
		ans=min(ans,sum);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define M 500010
int heap[M];
int heapsize;

int parent(int);
int left(int);
int right(int);
void maxheap(int);
void bmaxheap(void);

int main(int argc,char *argv[]){
  int i,n;
  scanf("%d",&n);
  heapsize=n;
  for(i=1;i<=n;i++){
    scanf("%d",&heap[i]);
  }
 
  bmaxheap();
 
  for(i=1;i<=n;i++){
    printf(" %d",heap[i]);
  }
  printf("\n");
  return 0;
}

int parent(int i){
  return i/2;
}
 
int left(int i){
  return 2*i;
}
 
int right(int i){
  return 2*i+1;
}

void maxheap(int i){
  int l,r,largest,tmp;
  l=left(i);
  r=right(i);
  if(l<=heapsize && heap[l]>heap[i]) largest=l;
  else largest=i;
 
  if(r<=heapsize && heap[r]>heap[largest])  largest=r;
   
  if(largest!=i){
    tmp=heap[i];
    heap[i]=heap[largest];
    heap[largest]=tmp;
    maxheap(largest);
  }
}
 
void bmaxheap(void){
  int i;
  for(i=heapsize/2;i>0;i--){
    maxheap(i);
  }
}

Measured memory_bytes: 2552
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

n = input_n

ans = 0
(1..(n + 1)).each do |i|
  num = n / i
  ans += num * (2 * i + (num - 1) * i) / 2
end

puts ans

Measured memory_bytes: 14304
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long double a;
  long double b;
  cin >> a >> b;

  long double c;
  long double x,v;

  c = a * b;
  x = modf(c,&v);
  cout << (long long int)v << endl;

  return 0;
}


Measured memory_bytes: 3788
def gcd(a, b):
    if b > a:
        a, b = b, a
    while b > 0:
        a, b = b, a % b        
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_t(n):
    t = 0
    while n % 2 == 0:
        n //= 2
        t += 1
    return t


def main():
    n, m = map(int, input().split())
    a = [int(i) // 2 for i in input().split()]
    
    t = get_t(a[0])
    l = a[0] // 2**t
    m //= 2**t
    for i in range(1, len(a)):
        count = get_t(a[i])
        if count != t:
            return 0         

        l = lcm(a[i] // 2**t, l)
        if l > m:
            return 0
    
    m //= l
    ans = (m + 1) // 2
    
    return ans       
   

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 15060