akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
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; }
const long long INF = 1LL << 60;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  string s;
  cin>>s; 
  int r,b;
  r=stringcount(s,'0');
  b=stringcount(s,'1');
  cout<<min(r,b)*2<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<iostream>
#define point complex<double>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int N=2e5+10,mod=1e9+7;
ll inf=LONG_LONG_MAX;
int a[N];
int GCD(int a, int b) {
	if(b==0)
    	return a;
	else
    	return GCD(b, a%b);
}



int main()
{
  /* ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);*/
   ll n,k;

   cin>>n>>k;
   map<ll,ll>mp;
   for(int i=0;i<n;i++){
       int x;
   cin>>x;
       mp[x]++;

   }
   vector<ll>val;
   map<ll,ll>::iterator it=mp.begin();
    for(it;it!=mp.end();it++){
            val.push_back(it->second);

       }
       sort(val.begin(),val.end());
   if(val.size()>k){
        ll ans=0;



        for(int i=0;i<val.size()-k;i++){

      ans+=val[i];


       }
    cout<<ans;
    return 0;

   }
   cout<<0;


    return 0;
}


Measured memory_bytes: 17700
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N, Q := getInt(), getInt()
	s := getString()
	ac := make([]int, N+1)
	cnt := 0
	for i := 1; i < N; i++ {
		if s[i] == 'C' && s[i-1] == 'A' {
			cnt++
		}
		ac[i+1] = cnt
	}

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	for i := 0; i < Q; i++ {
		l, r := getInt(), getInt()
		fmt.Fprintln(w, ac[r]-ac[l])
	}

}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define ll long long
#define PI pair<int,int>
#define F first
#define S second
#define all(x) x.begin(),x.end()
using namespace std;
int x,k;
int main(){
    cin >> k >> x;
    for(int i=x-k+1 ; i<=x+k-1 ; ++i)
        cout << i << " ";
    puts("");    
}

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

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while(true){
        int m,f,r;
        cin>>m>>f>>r;
        if(m==-1 && f==-1 && r==-1) break;
        if(m==-1 || f==-1) cout<<"F"<<endl;
        else if(m+f>=80) cout<<"A"<<endl;
        else if(65<=m+f && m+f<80) cout<<"B"<<endl;
        else if(50<=m+f && m+f<65) cout<<"C"<<endl;
        else if(30<=m+f && m+f<50){
            if(r>=50) cout<<"C"<<endl;
            else cout<<"D"<<endl;
        }
        else cout<<"F"<<endl;
    }
    
    
}


Measured memory_bytes: 3140
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var n int
	var intArray []int

	fmt.Scanf("%d", &n)
	intArray = make([]int, 5)
	for i := 0; i < 5; i++ {
		fmt.Scanf("%d", &intArray[i])
	}
	sort.Ints(intArray)
	min := intArray[0]
	waitUntil := int(math.Ceil(float64(n) / float64(min)))
	fmt.Println(waitUntil + 4)
}


Measured memory_bytes: 512
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    int A,B,C,D,E;cin >> A >> B >> C >> D >> E;
    int times = (C-A)*60;
    times += D-B;
    cout << times-E << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

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

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

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

int main() {
	ll N;
	cin >> N;

	ll M = sqrt(2*N);

	if (N != M * (M + 1)/2) { cout << "No"; }
	else {
		cout << "Yes" << endl;

		M++;

		vector<vector<ll>> S(M + 1);

		ll c = 1;

		repn(i, M) {
			for (ll j = i + 1; j <= M; j++) {
				S[i].push_back(c);
				S[j].push_back(c);
				c++;
			}
		}

		cout << M<<endl;

		repn(i, M) {
			cout << S[i].size();

			rep(j, S[i].size()) {
				cout << " " << S[i][j];
			}

			cout << endl;
		}
	}

	system("PAUSE");
}


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

int main(void){
    long long N,M;cin>>N>>M;
    long long A[N],B[N];
    for(long long i=0;i<N;i++){
        cin>>A[i]>>B[i];
    }
    long long C[M],D[M];
    for(long long i=0;i<M;i++){
        cin>>C[i]>>D[i];
    }
    for(long long i=0;i<N;i++){
        long long ans=-2;
        long long dist=4*pow(10,8)+1;
        for(long long j=0;j<M;j++){
            if(dist>abs(A[i]-C[j])+abs(B[i]-D[j])){
                dist=abs(A[i]-C[j])+abs(B[i]-D[j]);
                ans=j+1;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <sstream>
#include <fstream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
#ifdef IDE
    freopen("C:\\file.in", "r", stdin);
    //    freopen("C:\\n.in", "w", stdout);
#endif
    int n; cin >> n;
    int t; cin >> t;
    if (t == 1 || t == 2*n-1) {
        puts("No");
        return 0;
    }
    deque<int> q;
    n = 2*n - 1;
        
    q.push_back(t-1);
    q.push_back(t);
    q.push_back(t+1);
    int it = t-2;
    for (int i = n/2; i > 1; --i) {
        if (it < 1)
            it = n;
        q.push_front(it--);
    }
    
    for (int i = n/2; i > 1; --i) {
        if (it < 1)
            it = n;
        q.push_back(it--);
    }
    puts("Yes");
    for (int v : q) {
        printf("%d\n", v);
    }
    return true & false;
}


Measured memory_bytes: 2304
l = input().split()
N = int(l[0])
Y = int(l[1])

k10 = 0
k5 = 0
k1 = 0

max_k10 = min(N, Y // 10000)
for i in reversed(range(max_k10 + 1)):
    remain10 = Y - i * 10000
    if remain10 == 0 and i == N:
        print(i, 0, 0)
        exit()
    max_k5 = min(N, remain10 // 5000)
    for j in reversed(range(max_k5 + 1)):
        remain5 = remain10 - j * 5000
        if remain5 == 0 and i + j == N:
            print(i, j, 0)
            exit()
        z = N - i - j
        if remain5 - z * 1000 == 0:
            print(i, j, z)
            exit()

print(-1, -1, -1)


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

int main()
{
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i)
        cin >> A[i];

    long long res = 0;
    for (int d = 60; d >= -1; --d)
    { // d = -1 は X = K の場合
        if (d != -1 && !(K & (1LL << d)))
            continue;

        long long tmp = 0;
        for (int e = 60; e >= 0; --e)
        {
            long long mask = 1LL << e;
            int num = 0;
            for (int i = 0; i < N; ++i)
                if (A[i] & mask)
                    ++num;

            if (e > d)
            {
                if (K & mask)
                    tmp += mask * (N - num);
                else
                    tmp += mask * num;
            }
            else if (e == d)
            {
                tmp += mask * num;
            }
            else
            {
                tmp += mask * max(num, N - num);
            }
        }
        res = max(res, tmp);
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
<?php
fscanf(STDIN, "%s", $initial_string);
$length = strlen($initial_string);
$result = '';
$current_count = 0;
for($i = 0; $i < $length; $i++) {
    $char = $initial_string[$i];
    if ($char == '0') {
        $result[] = $char;
    } else if ($char == 'B') {
        $current_count = count($result);
        $pre_index = $current_count - 1 ;
        if (!empty($result)) {
            unset($result[$pre_index]);
            $result = array_values($result);
        }
    } else if ($char == '1') {
        $result[] = $char;
    }
}
echo implode("", $result);
?>

Measured memory_bytes: 3576
#include <stdio.h>

#define N 32
#define Q 256
#define TRUE 1
#define FALSE 0

int n, A[N] = {0};

int solve(int i, int m) {
  int res;
  
  if (m == 0)
    return TRUE;
  if (n <= i)
    return FALSE;
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}

int main(void) {
  int i, q, m;

  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &A[i]);
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d", &m);
    if (solve(0, m) == TRUE)
      printf("yes\n");
    else
      printf("no\n");
  }
  
  return 0;
}

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

using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double EPS = 1e-6;
const int MAX_N = 3e3 + 5;

int N;
ll seq[MAX_N];
ll memo[MAX_N][MAX_N][2];

ll dp(int l, int r, int turn) {
	if (l == r) return turn == 0 ? seq[r] : -seq[r];
	if (memo[l][r][turn] != -1) return memo[l][r][turn];
	if (turn == 0) return memo[l][r][turn] = max(dp(l + 1, r, 1) + seq[l], dp(l, r - 1, 1) + seq[r]);
	else return memo[l][r][turn] = min(dp(l + 1, r, 0) - seq[l], dp(l, r - 1, 0) - seq[r]);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> seq[i];
	}

	memset(memo, -1, sizeof memo);

	cout << dp(0, N - 1, 0) << '\n';

	return 0;
}

Measured memory_bytes: 141568
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC161
{
    class D
    {
        static List<long> res;
        static int k;
        static void Main(string[] args)
        {
            k = int.Parse(Console.ReadLine());
            res = new List<long>();
            BFS("");
            res.Sort();
            //Console.WriteLine(string.Join(",", res));
            res.Sort();
            //Console.WriteLine(res.Count);
            Console.WriteLine(res[k - 1]);
        }

        static void BFS(string s)
        {
            Queue<string> tq = new Queue<string>();
            if (s.Length == 0)
            {
                for (int i = 1; i < 10; i++)
                {
                    tq.Enqueue(i.ToString());
                    res.Add(i);
                }
            }
            else
            {
                tq.Enqueue(s);
                res.Add(long.Parse(s));
            }

            if (10 <= s.Length) { return; }
            while (0 < tq.Count)
            {
                var q = tq.Dequeue();
                var d = (q[q.Length - 1] - '0') - 1;
                var d2 = (q[q.Length - 1] - '0');
                var d3 = (q[q.Length - 1] - '0') + 1;
                if (0 <= d) BFS(q + d);
                BFS(q + d2);
                if (d3 < 10) BFS(q + d3);
            }
        }
    }
}


Measured memory_bytes: 19592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  int N;
  cin >> N;
  map<int, int> mp;
  for(int i=0; i<N; i++){
    ll tmp;
    cin >> tmp;
    if(tmp%4 == 0) mp[2]++;
    else if(tmp%2 == 0) mp[1]++;
    else mp[0]++;
  }
  bool tf = true;
  int now = 2;
  for(int i=0; i<N; i++){
    if(now == 2){    
      if(mp[0] > 0){
        mp[0]--;
        now = 0;    
      }else if(mp[1] > 0){
        mp[1]--;
        now = 1;
      }else if(mp[2] > 2){
        mp[2]--;
        now = 2;
      }
    }else if(now == 1){
      if(mp[1] > 0){
        mp[1]--;
        now = 1;
      }else if(mp[2] > 0){
        mp[2]--;
        now = 2;
      }else if(mp[0] != 0){
        tf = false;
        break;
      }
    }else if(now == 0){
      if(mp[2] > 0){
        mp[2]--;
        now = 2;
      }else if(mp[0] != 0 || mp[1] != 0){
        tf = false;
        break;
      }
    }       
    if(mp[0] == 0 && mp[1] == 0 && mp[2] == 0) break;
  }
  if(tf) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define reg register

const int MAXN=99+5;

int n;
char s[MAXN];

int main(void){
	scanf("%s",s+1);
	n=strlen(s+1);
	bool flag=true;
	for(reg int i=1;i<=n;++i)
		flag&=(s[i]==s[n-i+1]);
	for(reg int i=1;i<=(n-1)/2;++i)
		flag&=(s[i]==s[(n-1)/2-i+1]);
	for(reg int i=1;i+(n+3)/2-1<=n;++i)
		flag&=(s[i+(n+3)/2-1]==s[n-i+1]);
	puts(flag?"Yes":"No");
	return 0;
}

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

int main() {
    long long n, i;
    cin >> n;
    map<long long, long long> lst;
    map<long long,long long> ans;
    map<long long,long long> min;
    map<long long,long long> nor;
    long long preans = 0;
    map<long long,long long> count;
    for(i = 1; i <= n; i++){
        min[i] = 0;
        nor[i] = 0;
    }
    for(i = 0; i < n; i++){
        cin >> lst[i];
    }
    for(i = 0; i < n; i++){
        if(count.count(lst[i])) count[lst[i]]++;
        else count[lst[i]] = 1;
    }
    for(auto k:count){
        auto key = k.first;
        auto val = k.second;
        nor[key] = val*(val-1)/2;
        min[key] = (val-1)*(val-2)/2;
    }
    for(i = 1; i <= n; i++){
        preans += nor[i];
    }
    for(i = 1; i <= n; i++){
        ans[i] = preans - nor[i] + min[i];
    }
    for(i = 1; i <= n; i++){
        cout << ans[lst[i-1]] << endl;
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i=0;i<n;i++) cin >> arr.at(i);
  int sum = 0;
  int min = arr.at(0);
  
  for (int i=0;i<n;i++){
    if (arr.at(i) <= min){
    	sum++;
      	min = arr.at(i);
    }
  }
  cout << sum << endl;
  
}

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

#define lint long long
#define all(it) it.begin(), it.end()
#define FOR(i, n) for(int i = 0; i < n; i++)
#define FORU(i, a, b, s) for(int i = a; i < b; i += s)
#define FORD(i, a, b, s) for(int i = a; i > b; i -= s)
#define endl "\n"
lint INF = 2e18;
lint MOD = 1e9 + 7;

lint i, j, k, t;

struct HashPair {

    //注意 constがいる
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2> &p) const {

        // first分をハッシュ化する
        auto hash1 = hash<T1>{}(p.first);

        // second分をハッシュ化する
        auto hash2 = hash<T2>{}(p.second);

        //重複しないようにハッシュ処理
        size_t seed = 0;
        seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        return seed;
    }
};

pair<lint, lint> div(lint n) {
    pair<int, int> ret = {0, 0};
    while(true) {
        if(n % 2 == 0) {
            ret.first += 1;
            n /= 2;
        } else if(n % 5 == 0) {
            ret.second += 1;
            n /= 5;
        } else {
            break;
        }
    }
    return ret;
}

int main() {

    lint N;
    cin >> N;

    unordered_map<pair<lint, lint>, lint, HashPair> count25;

    FOR(i, N) {
        string s;
        cin >> s;

        string g;
        if(count(s.begin(), s.end(), '.') != 0) {
            while(s.back() != '.') {
                g.push_back(s.back());
                s.pop_back();
            }
            s.pop_back();
            reverse(g.begin(), g.end());
        }
        while((int)g.length() < 9)
            g.push_back('0');

        lint x = stoi(s) * 1000000000LL + stoi(g);
        count25[div(x)] += 1;
    }

    vector<pair<lint, lint>> keys;
    for(const auto &it : count25) {
        keys.emplace_back(it.first);
    }

    lint ans = 0;
    for(auto &k1 : keys) {
        for(auto &k2 : keys) {
            if(k1.first + k2.first >= 18 && k1.second + k2.second >= 18) {
                if(k1.first == k2.first && k1.second == k2.second) {
                    ans += count25[k1] * (count25[k1] - 1);
                } else {
                    ans += count25[k1] * count25[k2];
                }
            }
        }
    }
    ans /= 2;
    cout << ans << endl;
}


Measured memory_bytes: 3640
function main(input) {
  const n = parseInt(input[0]);
  let judge = false;
  let stack = 0;
  for(let i=0;i<n;i++){
    const inputs = input[1+i].trim().split(" ").map(i => parseInt(i));
    
    if(inputs[0]===inputs[1]){
      stack++;
    }else{
      stack=0;
    }
    if(stack>=3){
      judge=true;
      break;
    }
  }
  console.log(judge?"Yes":"No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 29696
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define SZ(x) ((int)(x).size())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int L = 128, Q = 850;

string pw(char x, int ex)
{
	string ret = "";
	while (ex--)
		ret += x;
	return ret;
}

int ask(const string& x)
{
	assert(!x.empty());
	static int ctr = 0;
	
	assert(++ctr < Q - 5);
	
	cout << "? " << x << "\n";
	cout << flush;
	int ret;
	cin >> ret;
	return ret;
}

void ans(const string& x)
{
	assert(!x.empty());
	cout << "! " << x << "\n";
	cout << flush;
	exit(0);
}

int ile[1 << 10], s;
vector <char> A;

bool ok(const string& x)
{
	return s == SZ(x) + ask(x);
}

string go(int a, int b)
{
	if (b - a == 1)
		return pw(A[a], ile[A[a]]);
	int c = (a + b) / 2;
	string x = go(a, c), y = go(c, b), ret = "";
	int j = 0;
	
	FOR(i, 0, SZ(x))
	{
		while (j != SZ(y) and ok(ret + y[j] + x.substr(i)))
			ret += y[j], j++;
		ret += x[i];
	}
	
	for (; j != SZ(y); j++)
		ret += y[j];
		
	return ret;
}

void solve()
{
	FOR(i, 0, 10)
		A.pb('0' + i);
	FOR(i, 0, 26)
		A.pb('a' + i);
	FOR(i, 0, 26)
		A.pb('A' + i);
		
	for (char c : A)
		ile[c] = L - ask(pw(c, L)), s += ile[c];
		
	assert(s <= L);
		
	ans(go(0, SZ(A)));
}

int main()
{
	ios_base::sync_with_stdio(false);
	int t = 1;
	//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}





Measured memory_bytes: 3768
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;

  vector< vector<int> > light(M);
  for (int i = 0; i < M; ++i)
  {
    int k;
    cin >> k;
    light[i].resize(k);

    for (int j = 0; j < k; ++j)
    {
      cin >> light[i][j];
      --light[i][j];
    }
  }

  vector<int> p(M);
  for (int i = 0; i < M; ++i) cin >> p[i];

  int ans = 0;
  for (int i = 0; i < (1 << N); ++i)
  {
    bool ok = true;
    for (int j = 0; j < M; ++j)
    {
      
      int c = 0;
      for (int id : light[j])
      {
        if ((i >> id) & 1) ++c;
      }
      c %= 2;
      if (c != p[j]) ok = false;
    }

    if (ok == true) ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))

max_per = max(As)
ansList = [0 for _ in range(max_per + 10)]

for A in As:
    checkList = [i for i in range(A, max_per+1, A)]
    #print(checkList,As)

    for check in checkList:
        ansList[check] += 1

ans = 0

for A in As:
    if(ansList[A] == 1):
        ans += 1

print(ans)

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

int main(){
    int N,T;
    cin>>N>>T;
    int t[200010];
    for(int i=0;i<N;i++){
        cin>>t[i];
    }
    long long ans=0;
    for(int i=0;i<N-1;i++){
        if(t[i+1]-t[i]<T){
            ans+=t[i+1]-t[i];
        }else{
            ans+=T;
        }
    }
    ans+=T;
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main(void) {
	int i, ans = 0;
	string s, t;
	cin >> s >> t;
	for (i = 0; i < s.size(); i++) {
		if (s[i] == t[i])
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,h,j;
    cin>>h>>n;
    ll a[n],b[n];
    for(i=0;i<n;i++)
        cin>>a[i]>>b[i];
    ll dp[h+1][n+1];
    for(i=0;i<n;i++)
        dp[0][i] = 0;
    for(i=1;i<=h;i++)
        dp[i][0] = ((i+a[0]-1)/a[0])*b[0];
    for(i=0;i<=h;i++)
        for(j=1;j<n;j++)
        {
            dp[i][j] = min(dp[i][j-1], dp[max(i-a[j],0ll)][j]+b[j]);
        }
    cout<<dp[h][n-1];    
    return 0;
}


Measured memory_bytes: 78464
N = int(input())
a = list(map(int, input().split()))
x = 1
ans = 0

for i in range(N):
    if (a[i] == x):
        x += 1
        continue
    ans += 1

# 不可能
if (ans == N):
    print(-1)
else:
    print(ans)

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

int main()
{
  int n;
  int count[100000] = {};
  cin>>n;
  int m1;
  rep(i, n) {
    cin>>m1;
    count[m1]++;
    if (m1 -1 >= 0) {
      count[m1 -1] ++;
    }
    if(m1 +1 < 100000) {
      count[m1 +1] ++;
    }
  }

  int max = 0;
  rep(i, 100000) {
    if (count[i] > max) {
      max = count[i];
    }
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define Pi 3.1415926535
#define MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}

int solve(){
    int n; cin >> n;
    
    repp(i,9){
        if(n <= 111*i && n > 111*(i-1)){
            cout << 111*i << endl;
        }
    }

    return 0;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <limits>
#include <cassert>

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	int sum = 0;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
		sum += int(s[i])-48;
	cout << ((sum%9==0) ? "Yes\n" : "No\n");
	return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;
	int cnt=1;
	for(int i=0; i+1<N; ++i){
	    if(S[i]!=S[i+1]) ++cnt;
	}
	for(int i=0; i<K; ++i){
	    if(cnt==1) break;
	    if(cnt==2) --cnt;
	    else cnt -= 2;
	}
	cout << N-cnt << endl;
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 510
int a[N][N];
int main()
{
    int i,j,k,n,m,q,l,r;
    scanf("%d%d%d",&n,&m,&q);
    for(i=1;i<=m;i++)
    {
        scanf("%d%d",&l,&r);
        a[0][r]++;
        a[l+1][r]--;
    }
    for(i=0;i<=n;i++)
    for(j=i;j<=n;j++)
    {
        a[i+1][j]+=a[i][j];
        a[i][j]+=a[i][j-1];
    }
    for(i=0;i<q;i++)
    {
        scanf("%d%d",&l,&r);
        printf("%d\n",a[l][r]);
    }
    return 0;
}


Measured memory_bytes: 1792
n=int(input())
H=list(map(int, input().split()))

dp = [10**10] * n

dp[0] = 0

dp[1] = abs(H[1] - H[0])

for i in range(2,n):
    
    dp[i] = min(dp[i-1] + abs(H[i] - H[i-1]), dp[i-2] + abs(H[i] - H[i-2]))
    
print(dp[-1])



Measured memory_bytes: 85020
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

void solve(){
    string S;
    cin >> S;
    reverse(S.begin(), S.end());
    map<int, ll> mp;
    ll cur = 0;
    ll ans = 0;
    mp[0]++;
    ll fac = 1;
    REP(i,S.size()){
        cur = (cur + (S[i] - '0') * fac) % 2019;
        fac *= 10;
        fac %= 2019;
        cur %= 2019;
        mp[cur]++;
    }

    for(auto x : mp) ans += x.second * (x.second - 1) / 2;
    cout << ans << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


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

int main(){
  int n,ans=1000000000;
  string s;
  cin>>s;
  for(int i=2;i<s.size();i++){
    n=0;
    n+=s[i]-'0';
    n+=(s[i-1]-'0')*10;
    n+=(s[i-2]-'0')*100;
    ans=min(ans,abs(753-n));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int a[100010], b[100010];
ll c[100010], n, m;

template <typename T>
struct UnionFind{
    vector<T> data;

    UnionFind(int sz){
        data.assign(sz, -1);
    }

    bool connected(T x, T y){
        x = find(x), y = find(y);
        if (x == y) return true;
        else return false;
    }

    bool unite(T x, T y){
        x = find(x), y = find(y);
        if (x == y) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }

    int find(T k){
        if (data[k] < 0) return k;
        return (data[k] = find(data[k]));
    }

    T size(T k){
        return (-data[find(k)]);
    }
};

int main()
{
    cin >> n >> m;
    UnionFind<ll> uf(n);
    for (int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }
    c[m - 1] = n * (n - 1) / 2;
    for (int i = m - 1; i >= 0; i--){
        if (uf.connected(a[i], b[i])) c[i - 1] = c[i];
        else c[i - 1] = c[i] - uf.size(a[i]) * uf.size(b[i]), uf.unite(a[i], b[i]);
    }
    for (int i = 0; i < m; i++){
        cout << c[i] << endl;
    }
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[100005];
	int len=0,sum=0;
	cin.getline(a,100005);
	len=strlen(a);
	for(int i=1;i<len;i++)
	{
		if(a[i]!=a[i-1])sum++;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define All(v) (v).begin(), (v).end()
uniform_int_distribution<> rand26(0, 26);
uniform_int_distribution<> rand365(0, 365);    
const int q = 26;
int d,c[q], s[370][q], last[370][q],res[370];

void set_up()
{
    cin >> d;
    for (int i = 0; i < q; i++)
    {
        cin >> c[i];
    }
    for (int i = 0; i < d; i++)
    {
        for (int j = 0; j < q; j++)
        {
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < d; i++)
    {
        fill(last[i], last[i] + q, 0);
    }
    fill(res,res+d,0);
}

void set_last()
{
    for (int i = 1; i < d; i++)
    {
        for (int j = 0; j < q; j++)
        {
            last[i][j] = max(last[i - 1][j], last[i][j]);
        }
    }
}

int cal()
{
    int ret = 0;
    for (int i = 0; i < d; i++)
    {
        ret += s[i][res[i] - 1];
    }
    for (int i = 0; i < d; i++)
    {
        for (int j = 0; j < q; j++)
        {
            ret -= c[j] * (i + 1 - last[i][j]);
        }
    }
    return ret;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    set_up();
    for (int i = 0; i < d; i++)
    {
        int M = -1;
        int idx = -1;
        for (int j = 0; j < q; j++)
        {
            if (s[i][j] > M)
            {
                M = s[i][j];
                idx = j;
            }
        }
        last[i][idx] = i + 1;
        res[i] = idx + 1;
    }
    set_last();
    int ans = cal();
    random_device rnd;
    for (int A = 0; A < 200; A++)
    {
        int t = rnd() % q;
        int da = rnd() % d;
        int prel=last[da][res[t]];
        int prer=last[da][t];
        last[da][res[t]] = 0;
        last[da][t] = da + 1;
        set_last();
        int tmp = cal();
        if (ans > tmp)
        {
            ans = tmp;
            res[da] = t + 1;
        }else{
            last[da][res[t]]=prel;
            last[da][t]=prer;
            set_last();
        }
    }
    for(int i=0;i<d;i++)cout<<res[i]<<endl;
    
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, N) for(int i = 0; i < int(N); i++)
#define rep1(i, N) for (int i = 1; i <= int(N); i++)
#define fs first
#define sc second
#define pb push_back
#define PB push_back
#define MP make_pair
#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)

int main() {
    int n, k;
    cin >> n >> k;
    V<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    V<ll> list;
    for (int l = 0; l < n; l++) {
        ll sm = 0;
        for (int r = l+1; r <= n; r++) {
            sm += a[r-1];
            list.push_back(sm);
        }
    }

    ll ans = 0;
    for (int lg = 50; lg >= 0; lg--) {
        ll nans = ans | (1LL << lg);
        int cnt = 0;
        for (ll d: list) {
            if ((nans & d) == nans) cnt++;
        }
        if (cnt >= k) ans = nans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6516
from itertools import chain
from bisect import bisect_left

max_n = 50022
primes = {2,3} | {m for n in (5, 7) for m in range(n, max_n, 6)}
du = primes.difference_update
for n in chain(range(5, max_n, 6), range(7, max_n, 6)):
    if n in primes:
        du(range(n*3, max_n, n*2))

primes = tuple(primes)

try:
    while True:
        n = int(input())
        i = bisect_left(primes, n)
        print(primes[i-1], primes[i+(n==primes[i])])
except EOFError:
    exit()


Measured memory_bytes: 7604
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  long long N;
  cin >> N;
  long long ans;
  long long n = sqrt(N);
  rep(i,n+1){
    if(i*i <= N) ans = i;
  }
  cout << ans*ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> v(2000 + 1, vector<long long>(2000 + 1, 0));

void comb(){
    for (int i = 0;i < v.size(); ++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(int j = 1;j < v.size();j++){
        for(int k = 1;k < j;k++){
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]) % (long long)(1e9 + 7);
        }
    }
    return;
} 

int main(){
    int N, K;
    cin >> N >> K;
    comb();
    for(int i = 0;i <= K-1;++i){
        cout << (v[K-1][i] * v[N-K+1][i+1]) % (long long)(1e9 + 7) << endl;
    }
    return 0;
}

Measured memory_bytes: 31616
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

bool fun(const pair<ll, ll>& a, 
               const pair<ll, ll>& b) 
{ 
    return (a.second < b.second); 
} 

ll solve(vector<pair<ll, ll> > list) 
{ 
    ll ans = 1;
    sort(list.begin(), list.end(), fun); 
  
    ll r1 = list[0].second; 
  
    for (ll i = 1; i < list.size(); i++) { 
        ll l1 = list[i].first; 
        ll r2 = list[i].second; 
 
        if (l1 >= r1) { 
            ans++; 
            r1 = r2; 
        } 
    }
    return ans;
}

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

    ll n,x,y;
    cin>>n;
    vector<pll> v;
    ifr(i,0,n) {
        cin>>x>>y;
        v.pb(x-y,x+y);
    }
    // for(auto it:v) cout<<it.ff<<" "<<it.ss<<endl;
    cout<<solve(v)<<endl;
    return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
int main(void){
   int maxdiv,div,x,y,ans;
   int i;
   scanf("%d", &x);
   scanf("%d", &y);
   if(x <= y){
      div = x;
   }
   else if(x > y){
      div = y;
   }
   for(i = div;i > 0;i --){
      if(x % i == 0 && y % i == 0){
         maxdiv = i;
         break;
      }
   }
   x = x + 1;
   y = y + 1;
   maxdiv = maxdiv + 1;
   ans = x + y;
   ans = ans - maxdiv;
   printf("%d\n", ans);
   return 0;
}



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

int main() {
  int N; cin >> N;
  vector<vector<int>> A(N, vector<int>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) cin >> A.at(i).at(j);
  }
  const int MOD = 1000000007;
  // dp[i][S] := i 番目までの男性までで、相性の良い男女ペアを作る方法の総数
  // 集合 S := すでにペアになった (マッチングが完了した) 女性の集合
  vector<vector<long long>> dp(N+1, vector<long long>(1 << N, 0));
  dp.at(0).at(0) = 1;
  for (int i = 0; i < N; i++) {
    for (int S = 0; S < (1 << N); S++) {
      if (__builtin_popcount(S) == i) {
        for (int j = 0; j < N; j++) {
          if (!(S & (1 << j))) {
            if (A.at(i).at(j) == 1) {
              dp.at(i+1).at(S | (1 << j)) += dp.at(i).at(S);
              dp.at(i+1).at(S | (1 << j)) %= MOD;
            }
          }
        }
      }
    }
  }
  cout << dp.at(N).at((1 << N) - 1) << endl;
}

Measured memory_bytes: 377216
n = int(input())

l = []
for i in range(1, int(n**.5)+1):
    if n % i == 0:
        a = len(str(i))
        b = len(str(n // i))
        l.append((a,b))

max_list= []
for j in range(len(l)):
    max_list.append(max(l[j][0], l[j][1]))
print(min(max_list))




Measured memory_bytes: 9444
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define Pi 3.1415926535
#define MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}

int solve(){
    int k,n; cin >> k >> n;
    vint a(n); rep(i,n) cin >> a[i];
    vint b(n);
    b[0] = k-a[n-1] + a[0];
    for(int i = 1; i < n; ++i){
        b[i] = a[i]-a[i-1];
    }

    cout << k - *max_element(all(b)) << endl;



    return 0;
}

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


Measured memory_bytes: 1792
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define range(i,b) rep(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
	char str[101];
	int ans = 0;
	bool inp;

	while(cin >> str){
		inp = true;
		if( strlen(str) == 1){
			ans++;
		}else{
			range(i, strlen(str) / 2){
				if(str[i] != str[ strlen(str) - 1 - i]){
					inp = false;
				}
			}
			if(inp) ans++;
		}
	}
	cout << ans << endl;
}

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

long long p[51], b[51];

long long solve(long long N, long long X) {
    if (N == 0) {
        return X >= 1;
    }
    else if (X <= b[N-1] + 1) {
        return solve(N-1, X-1);
    }
    else {
        return p[N-1] + 1 + solve(N-1, X-2-b[N-1]);
    }
}

int main() {
    long long N, X;
    cin >> N >> X;
    p[0] = b[0] = 1LL;
    for (int i=1; i<=N; i++) {
        p[i] = p[i-1] * 2 + 1;
        b[i] = b[i-1] * 2 + 3;
    }
    cout << solve(N, X) << endl;
    return 0;
}


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

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

  map<string, int> m;
  int maxNum = 0;
  rep(i, N) {
    string s = ss[i];

    if (m.count(s) == 0) {
      m.insert(make_pair(s, 1));
    } else {
      int num = m.at(s);
      m[s] = num+1;

    }
    maxNum = max(m.at(s), maxNum);
  }

  priority_queue<string, vector<string>, greater<string>> q;
  for(auto i = m.begin(); i != m.end(); i++) {
    string str = i -> first;
    int num = i -> second;

    if (num == maxNum) q.push(str);
  }


  while(!q.empty()) {
    string str = q.top();
    cout << str << endl;
    q.pop();
  }
  return 0;
}


Measured memory_bytes: 30448
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
template<typename T> 
T dig_sum(T n){
   if(n < 10)  return n;
   return dig_sum(n/10) + n%10;
}
int main(){
    int N;
    cin >> N;
    vector<ll> L(N + 1);
    L[0] = 2;
    L[1] = 1;
    for(int i = 2; i < N + 1; i++){
        L[i] = L[i - 1] + L[i - 2];
    }
    cout << L[N] << endl;
}


Measured memory_bytes: 3512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ordered_set<ll> ods;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

ll c[200001];

void solve(ll t)
{
    // cout<<"Case #"<<t<<":\n";
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    repf(i,k,n+2)
    {
        ll val1=(i*(i-1))/2;
        ll val2=i*n-val1;
        ll val=val2-val1+1;
        ans=(ans+val)%mod;
    }
    cout<<ans<<endl;
}

int main()
{
    IOS;
    ll t;
    // cin>>t;
    t=1;
    ll tt=1;
    while(t--)
    {
        solve(tt);
        tt++;
    }
}     


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
typedef long long ll;

int main(){
    fastio;
    ll x, num = 100, t = 0;
    cin >> x;
    while(num < x){
        t++;
        num *= 1.01;
    }
    cout << t << "\n";
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
 
const ll MOD = 1e9 + 7;
 
/* Commonly used stuff */
 
ll gcd(ll a, ll b){
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
 
bool isPrime(ll n){
	if(n <= 1)
		return false;
	for(ll i = 2; i <= sqrt(n); ++i){
		if(n % i == 0)
			return false;
	}
	return true;
}
 
ll modExp(ll b, ll e, ll mod){
	ll res = 1;
	while(e > 0){
		if(e & 1)
			res = res * b % mod;
		b = b * b % mod;
		e>>=1;
	}
	return res % mod;
}
 
ll factorial(ll n){
	ll r = 1;
	for(ll i = 1; i <= n; ++i){
		r *= i;
	}
	return r;
}
 
//////////////////////////
/* Put globals here */

int n;
string s;

int main(){
	cin>>n>>s;
	if(s.size() % 2 != 0){
		cout<<"No"<<endl;
		return 0;
	}
	int i = 0, j = n / 2;
	while(j < n){
		if(s[i++] != s[j++]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl; 												
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define pb push_back
using namespace std;
//const int M=50万;
const int N=132;
int n,m,low[N],dep[N];vi v[N];
int dfs(int now,int fa)
{
	low[now]=dep[now];
	int res=0;
	for(int i=0;i<v[now].size();i++)
	{
		int to=v[now][i];
		if(to==fa)continue;
		if(!dep[to])
		{
			dep[to]=dep[now]+1;
			res+=dfs(to,now);
			low[now]=min(low[now],low[to]);
		}else low[now]=min(low[now],dep[to]);
	}
	if(low[now]==dep[now])res++;
	return res;
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--,b--;
		v[a].pb(b);
		v[b].pb(a);
	}
	dep[0]=1;
	cout<<dfs(0,-1)-1<<"\n";
}

Measured memory_bytes: 3624
n = int(input())
s = [str(input()) for i in range(n)]
m = int(input())
t = [str(input()) for i in range(m)]


max_s = 0
max_t = 0
get = 0

for word in s:
    max_s = s.count(word)
    max_t = t.count(word)
    if(get < max_s - max_t):
        get = max_s - max_t

print(get)

Measured memory_bytes: 3064