akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int n,a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(void){
    cin>>n;
    //for(int i=0;i<32;i++)cin>>a[i];
    cout<<a[n-1]<<endl;
}


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

int main() {
  string N;
  cin >> N;
  
  int X = N.size();
  
  int sum = 0;
  
  for(int i=0; i<X; i++){
    sum += N.at(i)-'0';
  }

  if(sum % 9 == 0){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 3696
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int main()
{
	ll n;
	ll m;
	char str1[4] = "hon";
	char str2[4] = "pon";
	char str3[4] = "bon";
	
	cin >> n;

	n = n % 100;
	m = n % 10;

	if (m == 3)
		cout << str3 << endl;
	else if (m == 0 || m == 1 || m == 6 || m == 8)
		cout << str2 << endl;
	else
		cout << str1 << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <stdio.h>
using namespace std;

int main() {
	bool Water_makeable[40] = { false }, Sugar_makeable[4000] = { false };
	int A, B, C, D, E, F, Sugar[4000];
	scanf("%d %d", &A, &B);
	scanf("%d %d", &C, &D);
	scanf("%d", &E);
	scanf("%d", &F);
	Water_makeable[0] = true;
	for (int i = 0; i <= F / 100; i++) {
		if (!Water_makeable[i])
			continue;
		if (i + A <= F / 100)
			Water_makeable[i + A] = true;
		if (i + B <= F / 100)
			Water_makeable[i + B] = true;
	}
	Sugar_makeable[0] = true;
	for (int i = 0; i <= F; i++) {
		if (!Sugar_makeable[i])
			continue;
		if (i + C <= F)
			Sugar_makeable[i + C] = true;
		if (i + D <= F)
			Sugar_makeable[i + D] = true;
	}
	int last;
	for (int i = 0; i <= F; i++) {
		if (Sugar_makeable[i])
			last = i;
		Sugar[i] = last;
	}

	float maxv = 0;
	int Waterv = A * 100, Sugarv = 0;
	for (int i = F / 100; 0 < i; i--) {
		if (!Water_makeable[i])
			continue;
		int Sugara = Sugar[min(F - i * 100, i * E)];
		float wa = ((float)(Sugara * 100)) / ((float)(Sugara + i * 100));
		if (maxv < wa) {
			maxv = wa;
			Waterv = i * 100;
			Sugarv = Sugara;
		}
	}
	printf("%d %d\n", Waterv + Sugarv, Sugarv);
}

Measured memory_bytes: 128
#include <cstdio>

int dig[15];

bool hate( int n ){
    while( n > 0 ){
        if( dig[ n%10 ] )
            return false;
        n /= 10;
    }
    return true;
}

int main(){
    int n,l,t;

    scanf("%d %d",&n,&l);
    for( int i = 0 ; i < l ; ++i ){
        scanf("%d",&t);
        dig[t]++;
    }

    while(  !hate(n) ){
        n++;
    }

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

    return 0;
}


Measured memory_bytes: 128
/*
      author  : nishi5451
      created : 12.08.2020 22:00:31
*/

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


int main(){
    int h,w;
    cin >> h >> w;
    vector<char> a(w);
    rep(i,h) {
        rep(j,w) cin >> a[j];
        rep(repeat,2){
            rep(j,w) cout << a[j];
            cout << endl;
        }
    }

    return 0;
}

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

int main() {
  int N;
  int X;
  cin >> N;
  if (N % 1000 != 0) {
  X = (N / 1000) + 1;
  cout << 1000 * X - N << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		for(int i=t.length(); i>0; i--) {
			String r = s.substring(i)+s.substring(0,i);
			if(r.equals(t)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

int main(void){
    register int i;
    int n,m,a,b;
    scanf("%d%d",&n,&m);
    long h[n];
    _Bool highest[n];
    for(i = 0;i < n;i++){
	scanf("%ld",&h[i]);
	highest[i] = 1;
    }
    for(i = 0;i < m;i++){
        scanf("%d%d",&a,&b);
	a--;b--;
	if(h[a]==h[b]){
	    highest[a] = 0;
	    highest[b] = 0;
	    continue;
	}
	highest[h[a] < h[b] ? a : b] = 0;
    }
    int cnt = 0;
    for(i = 0;i < n;i++)if(highest[i])cnt++;
    printf("%d",cnt);
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, x, n) for(ll i=x; i<(ll)n; ++i)
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()

int main(){
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << ((double)W * (double)H / 2) << " ";
    if(2*x==W && 2*y==H){
        cout << 1 << endl;
    }
    else cout << 0 << endl;
}


Measured memory_bytes: 256
import math
a,b,h,m=map(int,input().split())
a1=(h/12)*360+(m/60)*30
b1=(m/60)*360
if abs(b1-a1)==0:
    print(abs(a-b))
elif abs(b1-a1)<180:
    s=math.radians(abs(b1-a1))
    c=a**2+b**2-2*a*b*math.cos(s)
    print(c**(1/2))
elif abs(b1-a1)==180:
    print(a+b)
else:
    s=math.radians(360-abs(b1-a1))
    c=a**2+b**2-2*a*b*math.cos(s)
    print(c**(1/2))


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int n,t,s;

	cin >> n >> t >> s;

	int a[5000],b[5000];

	int ans = 0;

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

	int dp1[3005][3005];
	for (int i = 0;i <= n;i++){
		for (int j = 0;j <= s;j++){
			dp1[i][j] = 0;
		}
	}

	for (int i = 0;i < n;i++){
		for (int j = 0;j <= s;j++){
			dp1[i+1][j] = max(dp1[i+1][j], dp1[i][j]);
			if(j+b[i] <= s){
				dp1[i+1][j+b[i]] = max(dp1[i+1][j+b[i]], dp1[i][j]+a[i]);
			}
		}
	}
	int memo[4000];
	for (int div = 0; div <= n; div++){
	    int MAX = 0;
		for (int i = 0;i <= s;i++){
			MAX = max(dp1[div][i],MAX);
		}
		memo[div] = MAX;
	}

	for (int i = n;i >= 0;i--){
		for (int j = 0;j <= t-s;j++){
			dp1[i][j] = 0;
		}
	}

	for (int i = n;i > 0;i--){
		for (int j = 0;j <= t-s;j++){
			dp1[i-1][j] = max(dp1[i][j],dp1[i-1][j]);
			int idx = i-1;
			if(j+b[idx] <= t-s){
				dp1[i-1][j+b[idx]] = max(dp1[i-1][j+b[idx]], dp1[i][j]+a[idx]);
			}
		}
	}

	for (int div = 0; div <= n; div++){
	    
	    int MAX = 0;

		for (int i = 0;i <= (t-s);i++){
			MAX = max(MAX, dp1[div][i]);
		}

		int sum = MAX + memo[div];

		//cout << " " << MAX << endl;

		ans = max(ans, sum);

	}

	cout << ans << endl;

	return 0;

}



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

int main(){
  long long int n, k, q;
  cin >> n >> k >> q;
  vector<long long int> sum;
  sum.resize(n);
  rep(i,q,0){
    long long int s;
    cin >> s;
    s--;
    sum[s]++;
  }
  rep(i,n,0){
    if(k-q+sum[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1408
import sys
input = sys.stdin.readline

l, r = map(int, input().split())
if r - l >= 2019:
	print(0)
else:
	ans = 2020
	for i in range(l, r):
		for j in range(i + 1, r + 1):
			ans = min(ans, (i * j) % 2019)
	print(ans)

Measured memory_bytes: 40684
N,K,L = map(int, input().split())

#print(N,K,L,D,T)

class UnionFind:
    def __init__(self, n: int) -> None:
        self.par = [i for i in range(n)]
        self.rank = [0] * n

    def find(self, x: int) -> int:
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x: int, y: int) -> None:
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        
    # 同じ集合に属するか判定
    #def same_check(self, x, y):
    #    return self.find(x) == self.find(y)

uf_D = UnionFind(N)
uf_T = UnionFind(N)

for d0, d1 in (map(int, input().split()) for _ in range(K)):
    uf_D.unite(d0-1, d1-1)
for d0, d1 in (map(int, input().split()) for _ in range(L)):
    uf_T.unite(d0-1, d1-1)

pairs = []
for i in range(N):
    pairs.append((uf_D.find(i), uf_T.find(i)))

pairs_count = {}
for p in pairs:
    if not p in pairs_count:
        pairs_count[p] = 1
    else:
        pairs_count[p] += 1

res = [0] * N
for i in range(N):
    res[i] = pairs_count[pairs[i]]
#print(*(res[i] for i in range(N)))
print(" ".join([str(i) for i in res]))

Measured memory_bytes: 66724
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	for i := 0; i <= n/4; i++ {
		for j := 0; j <= n/7; j++ {
			p := 4*i + 7*j
			if p == n {
				fmt.Println("Yes")
				return
			} else if p > n {
				break
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
n = int(input())
t,a = map(int, input().split())

lis = list(map(int, input().split()))

tmp = 1001001001
ans = 0
for i in range(n):
    ab = t - lis[i]*0.006
    
    if abs(ab - a) < abs(tmp - a):
        ans = i
        tmp = ab
        
print(ans+1)

Measured memory_bytes: 3064
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
i = 1
ans = 0
while i**2<=N:
    if N%i==0:
        ans = (i+(N//i)-2)
    i += 1
print(ans)

Measured memory_bytes: 63064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

void solve()
{
  string s;string t;cin>>s>>t;
  int ans=0;
  for(int i=0;i<s.size();i++)
  {
      if(s[i]!=t[i])
      ans++;
  }
  cout<<ans<<endl;
    
}
int32_t main()
{
    rapido;
    int t;
    //cin>>t;
      t=1;
    while(t--)
    solve();
}

Measured memory_bytes: 3788
#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() {
  ll N, M;
  cin >> N >> M;
  vector<ll> as(M), bs(M), cs(N);
  rep(i, M) cin >> as[i] >> bs[i];

  rep(i, M) {
    if (as[i] == 1) cs[bs[i]]++;
    if (bs[i] == N) cs[as[i]]++;
  }

  string ans = "IMPOSSIBLE";
  rep(i, N) {
    if (cs[i] == 2) {
      ans = "POSSIBLE";
      break;
    }
  }
  cout << ans << endl;
  
}


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


int main(){
  int N,M;
  cin >>N >> M;
  if(N==M)
    cout <<"Yes" <<  endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3520
#include <iostream>
#include <vector>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(void){
  int N, M;
  cin >> N >> M;
  vector<vector<int> > g(N);
  int a, b;
  rep(i, M){
    cin >> a >> b;
    g[a-1].push_back(b);
  }
  //ここまで入力

  int next;
  rep(i, g[0].size() ){
    //島1から辿れる島を次々に見る
    next = g[0][i];
    //島nextの末尾にNがあればよい
    int end = g[next-1].size();
    //島nextからいける島がなければ次へ
    //(配列外アクセスを回避)
    if(end == 0)
      continue;
    else if(g[next-1][end-1] == N){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }

  cout << "IMPOSSIBLE" << endl;
  
  return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll H, W;
    cin >> H >> W;
    vector<string> A(H);
    REP(i,0,H) cin >> A[i];

    vec C(26, 0);
    REP(i,0,H) {
        REP(j,0,W) ++C[A[i][j]-'a'];
    }

    bool f = true;
    if(H % 2 == 0 && W % 2 == 0) {
        REP(i,0,26) {
            if(C[i] % 4 != 0) f = false;
        }
    }
    else if(H % 2 == 0 && W % 2 == 1) {
        ll cnt = H * (W - 1);
        REP(i,0,26) {
            while(C[i] >= 4 && cnt > 0) {
                C[i] -= 4;
                cnt -= 4;
            }
        }
        if(cnt > 0) f = false;
        REP(i,0,26) {
            if(C[i] % 2 != 0) f = false;
        }
    }
    else if(H % 2 == 1 && W % 2 == 0) {
        ll cnt = (H - 1) * W;
        REP(i,0,26) {
            while(C[i] >= 4 && cnt > 0) {
                C[i] -= 4;
                cnt -= 4;;
            }
        }
        if(cnt > 0) f = false;
        REP(i,0,26) {
            if(C[i] % 2 != 0) f = false;
        }
    }
    else {
        ll cnt = (H - 1) * (W - 1);
        REP(i,0,26) {
            while(C[i] >= 4 && cnt > 0) {
                C[i] -= 4;
                cnt -= 4;
            }
        }
        if(cnt > 0) f = false;
        cnt = H + W - 2;
        REP(i,0,26) {
            while(C[i] >= 2 && cnt > 0) {
                C[i] -= 2;
                cnt -= 2;
            }
        }
        if(cnt > 0) f = false;
        cnt = 0;
        REP(i,0,26) cnt += C[i];
        if(cnt != 1) f = false;
    }

    if(f) PR("Yes");
    else PR("No");

    return 0;
}

/*



*/

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

#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <cmath>
#include <limits>

using namespace std;

class edge{
	public:
	int vtx, dist;
	edge(){ vtx=0, dist=0; };
	edge(int a, int b){ vtx=a, dist=b; };
};

using Graph = vector<vector<edge>>;

vector<bool> seen;
vector<int> color;

void dfs(Graph &G, int v){
	seen[v] = true;

	for(auto e : G[v]){
		auto next_v = e.vtx;
		auto dist = e.dist;
		if(seen[next_v]) continue;
		if(dist%2==0){
			color[next_v] = color[v]%2;
		}
		else{
			color[next_v] = (color[v]+1)%2;
		}
		dfs(G, next_v);
	}
}

int main(int argc, char* argv[]){
	int N;
	cin >> N;

	Graph G(N+1);

	for(int i=1; i<N; i++){
		int u, v, w;
		cin >> u >> v >> w;
		G[u].push_back(edge(v, w));
		G[v].push_back(edge(u, w));
	}

	seen.assign(N+1, false);
	color.assign(N+1, -1);
	color[1] = 0;
	dfs(G, 1);

	for(int i=1; i<N+1; i++){
		cout << color[i] << endl ;
	}
	return 0;
}

Measured memory_bytes: 8192
from fractions import gcd
a, b, c, d = map(int, input().split())
lcm = c * d // gcd(c, d)
cnt = b // c + b // d - b // lcm - ((a - 1) // c + (a - 1) // d - (a - 1) // lcm)
print(b - a + 1 - cnt)

Measured memory_bytes: 5688
def comp( y1, x1, y2, x2 )
	if y1 * y1 + x1 * x1 != y2 * y2 + x2 * x2
		y1 * y1 + x1 * x1 < y2 * y2 + x2 * x2 ? [ y1, x1 ] : [ y2, x2 ]
	else
		y1 < y2 ? [ y1, x1 ] : [ y2, x2 ]
	end
end


while ( h, w = gets.strip.split.map( &:to_i ) ) != [ 0, 0 ]
	rh = rw = 150
	for y in 1..150
		for x in y + 1 ..150
			if ( h != y || w != x ) && [ h, w ] == comp( h, w, y, x )
				rh, rw = comp( rh, rw, y, x )
			end
		end
	end

	print rh, " ", rw, "\n"
end

Measured memory_bytes: 6104
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int[] A = new int[N];
		int[] C = new int[N-1];
		Arrays.setAll(A, i->sc.nextInt());
		
		for (int i=0; i<N; i++) {
			ans += sc.nextInt();
		}
		
		Arrays.setAll(C, i->sc.nextInt());
		
		for (int i=0; i<N-1; i++) {
			if (A[i]+1 == A[i+1]) {
				ans += C[A[i]-1];
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<int> div_count(n + 1, 0);
	for (int i = 1; i <= n; ++i) {
		for (int j = i; j <= n; j += i) {
			div_count[j] += 1;
		}
	}
	int res = 0;
	for (int i = 1; i < n; ++i) {
		res += div_count[n - i];
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 7148
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, X;
    cin >> N >> X;
    vi L(N);
    cin >> L;
    int x = 0;
    int ans = 1;
    rep(i, 0, N) {
        x = x + L[i];
        ans += x <= X;
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    int n, m;
    cin >> n >> m;
    int l[100000] = {0}, p, sum  = 0, pen = 0;;
    bool o[100000] = {false};
    string s;
    for(int i = 0; i < m; i++){
        cin >> p >> s;
        if(s == "WA") l[p]++;
        else {
            if(o[p]) continue;
            pen += l[p];
            sum++;
            o[p] = true;
        }
    }
    cout << sum << " " << pen << endl;
    return 0;
}

Measured memory_bytes: 768
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,z,aa[100010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;


int main(){
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
    
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

class CGoHome {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll x;
        in>>x;

        rep(i,50000){
            if(x<=i*(i+1)/2){
                out<<i<<endl;
                return;
            }
        }

	}
};


int main() {
	CGoHome solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
string S;
typedef pair<string,string> P;
map<P,LL>m;
int main(){
	cin>>N>>S;
	REP(i,1<<N){
		string a="";
		string b="";
		REP(j,N){
			if((i>>j)&1){
				a.push_back(S[j]);
			}else{
				b.push_back(S[j]);
			}
		}
		P c=P(a,b);
		m[c]++;
	}
	LL ans=0;
	REP(i,1<<N){
		string a="";
		string b="";
		REP(j,N){
			if((i>>j)&1){
				a.push_back(S[N+j]);
			}else{
				b.push_back(S[N+j]);
			}
		}
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		P c=P(a,b);
		ans+=m[c];
	}
	cout<<ans<<endl;
}

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

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/

ll gd(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}




int main(void){
    const ll M = 1000000007;
    ll n,a,b,c;
    ll ans=0;
    string s;
    cin >> n;
    for(ll i=1;i<=n;i++){
        if(gd(i) %2 == 1)ans++;
    }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/* In the name of Anton */

/*
* Motto :)
*
*
*
*
*
*/

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,a,n) for(int i=a;i<=n;i++)
#define repb(i,a,n) for(int i=a;i>=n;i--)
#define trav(x,a) for(auto &x: a)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
#define vt vector
typedef long double ld;
typedef pair <int,int> pii;
typedef vector <int> vi;
typedef long long ll;

template<class A> void read(vt<A>& v);
template<class T> void read(T& x){
  cin>>x;
}

void read(double &d){
  string t;
  read(t);
  d=stod(t);
}
void read(long double &d){
  string t;
  read(t);
  d=stold(t);
}

template<class H, class... T> void read(H &h, T&...t){
  read(h);
  read(t...);
}

template <class A> void read(vt<A> &x){
  trav(a,x)
    read(a);
}

string to_string(char c){
  return string(1,c);
}

string to_string(bool b){
  return b?"true":"false";
}

string to_string(const char* s){
  return string(s);
}

string to_string(string s){
  return string(s);
}

string to_string(vt<bool> v){
  string res;
  rep(i,sz(v)){
    res+=char('0'+v[i]);
  }
  return res;
}

template<class T> string to_string(T v){
  bool f=1;
  string res;
  trav(x,v){
    if(!f)
      res+=' ';
    f=0;
    res+=to_string(x);
  }
  return res;
}

template<class A> void write(A x){
  cout<<to_string(x);
}

template<class H, class...T> void write(const H& h, const T&...t){
  write(h);
  write(t...);
}

void print(){
  write("\n");
}

template<class H, class...T> void print(const H& h, const T&...t){
  write(h);
  if(sizeof...(t))
    write(' ');
  print(t...);
}

/* -----------------------------------------------------------------------------------------------*/

void pre(){

}

void solve(){
  string s="ACL";
  int k; read(k);

  rep(i,k){
    cout<<s;
  }

  cout<<"\n";
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  pre();
  int t=1;
  // read(t);
  rep(i,t) solve();
  return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,W=0,B=0,R=0,X=100000;
  cin >> a >> b;
  char maps[a][b];
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
      cin >> maps[i][j];
    }
  }
  W=0;
  for(int i=0;i<a-2;i++){
    for(int j=0;j<b;j++){
      if(maps[i][j]!='W'){
	W++;
      }
    }
    B=0;
    for(int j=i+1;j<a-1;j++){
      for(int k=0;k<b;k++){
	if(maps[j][k]!='B'){
	  B++;
	}
      }
      R=0;
      for(int k=j+1;k<a;k++){
	for(int l=0;l<b;l++){
	  if(maps[k][l]!='R'){
	    R++;
	  }
	}
      }
      if(X>W+B+R){
	X=W+B+R;
      }
    }
  }
  cout << X << endl;
  return 0;
}

Measured memory_bytes: 3088
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		Map<String, Integer> map = new TreeMap<String, Integer>();
		for(int i=0; i<N;i++) {
			String s = sc.next();
			if(map.get(s)==null) {
				map.put(s, 1);
			}else {
				map.put(s, map.get(s)+1);
			}
		}
		Object[] values = map.values().toArray();
		int max=0;
		for(Object v :values) {
			max= Integer.max(max, (int) v);
		}
		for (Map.Entry<String,Integer> entry : map.entrySet()) {
			if(entry.getValue()==max) {
				System.out.println(entry.getKey());
			}
		}
		
	}



}


Measured memory_bytes: 91012
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int ab, bc, ca;
    cin >> ab >> bc >> ca;
    cout << ab * bc * ca / (max(ab, max(bc, ca)) * 2);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

typedef long long ll;

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

int main() {
    int A, B; cin >> A >> B;
    if ((A+B)%2 == 0) cout << (A+B)/2 << endl;
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int main() {
 long int cards[3] = {0}, sum = 0, k, turns = 0, adder, break_flag = 0;
 cin >> cards[0] >> cards[1] >> cards[2];
 cin >> k;
 for(int i = 0; i < 3; i++ ){
	 if(i == 0)
	 	adder = 1;
	 else if(i == 1)
	 	adder  = 0;
	 else 
	 	adder = -1;
	for(int j = 0; j < cards[i]; j++){
		if(turns == k){
			break;
			break_flag = 1;
		}
		else{
			sum += adder;
			turns++;
		}
			
	}
	if(break_flag == 1)
		break;
 }
 cout << sum;
 return 0;
}

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

int main(){
    int num = 0;
    string S;

    cin >> S;

    for(int i=0;i<4;i++){
        if(S.at(i) == '+')num ++;
        else if(S.at(i) == '-')num --;
    }

    cout << num << endl;

}

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

int main() {
  vector<vector<int>> A(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
  }
  vector<vector<char>> bingo = {{'x','x','x'},{'x','x','x'},{'x','x','x'}};
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (b.at(i) == A.at(j).at(k)) {
          bingo.at(j).at(k) = 'o';
        }
      }
    }
  }

  //行の判定
  for (int i = 0; i < 3; i++) {
    if (bingo.at(i).at(0) == 'o' && bingo.at(i).at(1) == 'o' && bingo.at(i).at(2) == 'o') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  //列の判定
  for (int i = 0; i < 3; i++) {
    if (bingo.at(0).at(i) == 'o' && bingo.at(1).at(i) == 'o' && bingo.at(2).at(i) == 'o') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  //斜めの判定
  if (bingo.at(0).at(0) == 'o' && bingo.at(1).at(1) == 'o' && bingo.at(2).at(2) == 'o') {
    cout << "Yes" << endl;
    return 0;
  }
  if (bingo.at(2).at(0) == 'o' && bingo.at(1).at(1) == 'o' && bingo.at(0).at(2) == 'o') {
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
}

Measured memory_bytes: 3624
n=int(input())
a = list(map(int, input().split()))
b=[0]*60
ans=0
count=0
mod=10**9+7

for i in range(60):
    for j in range(n):
        if a[j]>>i&1==1:
            count+=1

    b[i]=count
    count=0

for i in range(60):
    ans+=2**i*( b[i]*(n-b[i]) )


print(ans%mod)

Measured memory_bytes: 122936
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
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; }

ll h, w;
vector<ll> dx = { -1, 0, 1, 0 };
vector<ll> dy = { 0, -1, 0, 1 };


bool isInField(ll x, ll y) {
    bool f = x >= 0 && x < w && y >= 0 && y < h;
    return f;
}

bool compare_first(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.first != y.first) {
        return x.first < y.first;
    }
    else {
        return x.second < y.second;
    }
}

bool compare_second(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.second != y.second) {
        return x.second < y.second;
    }
    else {
        return x.first < y.first;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;

    if (u == s) {
        a--;
    }

    if (u == t) {
        b--;
    }

    cout << a << " " << b << "\n";

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#define NIL -1

struct tree{
	int p,l,r;
}T[26];

void pre(int r){
	printf(" %d",r);
	if(T[r].l != NIL) pre(T[r].l);
	if(T[r].r != NIL) pre(T[r].r);
}

void ino(int r){
	if(T[r].l != NIL) ino(T[r].l);
	printf(" %d",r);
	if(T[r].r != NIL) ino(T[r].r);
}

void pos(int r){
	if(T[r].l!=NIL) pos(T[r].l);
	if(T[r].r!=NIL) pos(T[r].r);
	printf(" %d",r);
}

int main(){
	int o,i,n,j,k,v,a,b,c;
	scanf("%d",&o);
	k=o;
	for( i = 0; i < o; i++) T[i].l=T[i].r=T[i].p=NIL;
	while(k--){
		scanf("%d %d %d",&a,&b,&c);
		T[a].l=b;
		T[a].r=c;
		T[b].p=a;
		T[c].p=a;
	}
	for( i = 0; i < o; i++) 
		if(T[i].p==NIL) 
			break;
	printf("Preorder\n");
	pre(i);
	printf("\nInorder\n");
	ino(i);
	printf("\nPostorder\n");
	pos(i);
	printf("\n");
}


Measured memory_bytes: 2692
// B - Palace

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

// bool cmp(int a, int b)
// {
//   return abs(a - c) < abs(b - c);
// }

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  double a, b, t, c, h, k, n, w, ans = 0, count = INF, tmp = 0;
  string s;
  cin >> n;
  cin >> t >> a;
  vector<double> d(n), e(n);
  rep(i, 0, n)
  {
    cin >> d[i];
    // cout << "ans1: " << ans << endl;
    // cout << "d[i]: " << d[i] << endl;
    c = d[i] * 0.006;
    // cout << "c: " << c << endl;
    // cout << "t: " << t << endl;
    ans = 0;
    ans = t - c;
    // cout << "ans: " << ans << endl;
    e[i] = ans;
  }

  rep(i, 0, n)
  {
    // cout << "count: " << count << endl;
    count = min(count, (abs(a - e[i])));
  }
  rep(i, 0, n)
  {
    if (abs(a - e[i]) == count)
    {
      tmp = i + 1;
    }
  }
  cout << tmp << endl;
}

Measured memory_bytes: 256
import copy
d,g=map(int,input().split())
pc=[]
for _ in range(d):
	x,y=map(int,input().split())
	pc.append([x,y])
pcc=copy.deepcopy(pc)
def two(x):
	p=bin(x)
	return "0"*10+p[2:]
q=[]
for i in range(2**d):
	pcc=copy.deepcopy(pc)
	ans=0
	cnt=0
	k=[]
	for j in range(d):
		if two(i)[-j-1]=="1":
			ans+=100*pc[j][0]*(j+1)+pc[j][1]
			cnt+=pc[j][0]
		else:
			k.append(j)
	p=1
	if ans<g:
		while ans<g:
			if p>len(k):
				cnt+=10**15
				break
			if pcc[k[-p]][0]<=1:
				p+=1
			if p>len(k):
				cnt+=10**15
				break
			ans+=(k[-p]+1)*100
			pcc[k[-p]][0]-=1
			cnt+=1
	q.append(cnt)
print(min(q))

	

Measured memory_bytes: 3572
#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, a: "List[int]", b: "List[int]", c: "List[int]", Q: int, K: int, x: "List[int]", y: "List[int]"):
    matrix = dict()

    for i in range(N-1):
        if matrix.get(a[i]) == None:
            matrix[a[i]] = [(b[i],c[i])]
        else:
            matrix[a[i]].append((b[i],c[i]))

        if matrix.get(b[i]) == None:
            matrix[b[i]] = [(a[i],c[i])]
        else:
            matrix[b[i]].append((a[i],c[i]))

    # i = NodeKからnodeiまでの距離
    distance_via_K = [-1]*(N+1)

    queue = deque()
    ## K を頂点として見る
    queue.append((K,0))

    while queue:
        q,cur_distance = queue.pop()
        distance_via_K[q] = cur_distance

        for node,distance in matrix[q]:
            if distance_via_K[node] == -1:
                queue.append((node,cur_distance+distance))

    for j in range(Q):
        print(distance_via_K[x[j]]+distance_via_K[y[j]])

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    c = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
        c[i] = int(next(tokens))
    Q = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    x = [int()] * (Q)  # type: "List[int]"
    y = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, a, b, c, Q, K, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61208
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    C = [complex(*map(int, input().split())) for _ in range(n)]

    res = INF
    for k in range(n):
        p1 = C[k]
        for j in range(k):
            p2 = C[j]
            for i in range(j):
                p3 = C[i]
                a = abs(p2 - p3)
                b = abs(p3 - p1)
                c = abs(p1 - p2)
                numerator = a**2 * (b**2 + c**2 - a**2) * p1 + b**2 * (c**2 + a**2 - b**2) * p2 + c**2 * (a**2 + b**2 - c**2) * p3
                denominator = a**2 * (b**2 + c**2 - a**2) + b**2 * (c**2 + a**2 - b**2) + c**2 * (a**2 + b**2 - c**2)
                if denominator < 0.001:
                    continue
                center = numerator / denominator
                radius = -INF
                for p in C:
                    radius = max(radius, abs(center - p))
                res = min(radius, res)

    for j in range(n):
        for i in range(n):
            center = (C[i] + C[j]) / 2
            radius = -INF
            for p in C:
                radius = max(radius, abs(center - p))
            res = min(radius, res)

    print(res)
resolve()

Measured memory_bytes: 43504
from collections import deque
s = deque(input())
#s = input()
n = int(input())
f = 1
for i in range(n):
  l = list(map(str, input().split()))
  if l[0] == "2":
    tmp = int(l[1])*f
    if tmp == 1 or tmp == -2:
      s.appendleft(l[2])
    else:
      s.append(l[2])
  else:
    f *= -1

if f == -1:
  s.reverse()
print("".join(s))


Measured memory_bytes: 8820
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e2+5;
 
ll w[N],v[N];
map<ll,ll>dp;
int main()
{
    ll n,W;
    scanf("%lld%lld",&n,&W);
    for(int i=1;i<=n;i++){
        scanf("%lld%lld",w+i,v+i);
    }
    if(w[1]<=1e3){
        ll j;
        ll temp=min((w[1]+3)*n,W);
        for(int i=1;i<=n;i++){
            for(j=temp;j>=1;j--){
                if(j>=w[i])
                dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
            }
        }
        cout<<dp[temp]<<endl;
    }
    else{
        ll j;
        ll temp=min(W,(w[1]+3)*n);
        for(int i=1;i<=n;i++){
            for(j=temp;j>=w[1];j-=w[1]){
                if(j>=w[i])
                dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
            }
        }
        cout<<dp[temp]<<endl;
    }
    return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		int a[] = new int[n];
		int c[] = new int[n];
		int index = 0;
		for (int i = 0; i < n; i++)
			c[i] = 1;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(sc.next());
		Arrays.sort(a);
		for (int i = 1; i < n; i++) {
			if (a[i] == a[i - 1])
				c[index]++;
			else
				index++;
		}
		Arrays.sort(c, 0, ++index);
		int ans = 0;
		for (int i = 0; i < index - k; i++) {
			ans += c[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 60064
n, k = map(int, input().split())
l = [0 for i in range(k + 1)]
ans = 0
mod = 1000000007
for i in range(k, 0, -1):
    l[i] = pow(k // i, n, mod)
    tmp = 2 * i
    while tmp <= k:
        l[i] -= l[tmp]
        tmp += i
for i in range(k + 1):
    ans += i * l[i]
    ans %= mod
print(ans)

Measured memory_bytes: 11368
import java.util.Scanner;

public class Main {

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

		if(S.equals(T.substring(0, T.length() - 1)) && T.length() == S.length() + 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 35732
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto abc = readints;
    int a = abc[0], b = abc[1], c = abc[2];

    writeln((a + b + c) - max(a, b, c));
}


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

typedef long long ll;

int main()
{
    ll A, B, K;
    cin >> A >> B >> K;
    for (int i = 0; i < K; ++i)
    {
        if (A % 2 == 1)
        {
            --A;
        }
        B += A / 2;
        A = A / 2;
        ++i;
        if (i >= K)
        {
            break;
        }
        if (B % 2 == 1)
        {
            --B;
        }
        A += B / 2;
        B = B / 2;
    }
    cout << A << " " << B << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    int minus = 0;
    ll a[100007];
    ll least = 1000000007;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ans += abs(a[i]);
        least = min(least, abs(a[i]));
        if(a[i] < 0){
            minus++;
        }
    }
    if(minus % 2 == 0){
        cout << ans << endl;
    }
    else{
        cout << ans - least * 2 << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define M 1000000007
#define all(v) v.begin(), v.end()

bool cmp(pair<ll,ll> x ,pair<ll,ll> y){
    if(x.Y==y.Y)return (x.X > y.X);
    return (x.Y<y.Y);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,k;
  cin>>n>>k;
  ll lm= (n-1)*(n-2);
  lm=lm/2;
  if(lm<k){
      cout<<-1<<el;
      return 0;
  }
  vector<pair<ll,ll>> v;
  for(int i=2;i<=n;i++){ 
        v.pb(mp(1,i));
  }
  ll df= lm-k;
  if(df==0){
              cout<<v.size()<<el;
              for(auto x:v){
                  cout<<x.X<<" "<<x.Y<<el;
              }
              return 0;
          }
  for(int i=2;i<n;i++){
      for(int j=i+1;j<=n;j++){
          v.pb(mp(i,j));
          df--;
          if(df==0){
              cout<<v.size()<<el;
              for(auto x:v){
                  cout<<x.X<<" "<<x.Y<<el;
              }
              return 0;
          }
      }
  }
  return 0;
}


Measured memory_bytes: 512
S = input()
pow10 = [1] * len(S)
for i in range(1,len(S)):
    pow10[i] = (pow10[i-1] * 10) % 2019
#print(pow10)    
smod = [0] * (len(S) + 1)
count = [0] * 2019
for i in range(len(S)):
    smod[i+1] = (smod[i] + int(S[-i-1]) * pow10[i]) % 2019
for i in range(len(S) + 1):
    count[smod[i]] += 1
#print(count)
ans = 0
for i in range(2019):
    ans += count[i] * (count[i] - 1) // 2
    
print(ans)

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

using namespace std;

int H,W;
char gazou[101][101];

int main() {
  cin >> H >> W;

  for(int i = 0; i < H; i++) {
    string S;
    cin >> S;
    for(int j = 0; j < S.length(); j++) {
      gazou[i][j] = S[j];
    }
  }

    for(int i = -1; i <= H; i++) {
      if(i == -1 || i == H) {
	for(int j = -1; j <= W; j++) cout << '#';
	cout << endl;
      }
      else {
      for(int j = -1; j <= W; j++) {
	if(j == -1) cout << '#';
	else if(j == W) cout << '#' <<endl;
	else cout << gazou[i][j];
      }
      }
    }
}


Measured memory_bytes: 256
h,w,k=map(int,input().split())

#c =[list(map(str,input().split())) for l in range(h)]

c=[]
for _ in range(h):
    c.append(input())

ans=0

for i in range(2**h):
    x=format(i, "06b")
    for j in range(2**w):
        y=format(j, "06b")
    
        cnt=0
        for i_i in range(h):
            if x[-1*(i_i+1)]=="1":
                continue
            for j_j in range(w):
                if y[-1*(j_j+1)]=="1":
                    continue
                else:
                    if c[i_i][j_j]=="#":
                        cnt+=1
        if cnt==k:
            ans+=1

print(ans)


Measured memory_bytes: 69072
from itertools import permutations
def read(): return list(map(int, input().split()))


INF = 114514810


def wf(d):
    N = len(d[0])
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
    return d


def calc_dist(p, d):
    dist = 0
    for i in range(len(p) - 1):
        if d[p[i]][p[i + 1]] >= INF:
            return INF
        dist += d[p[i]][p[i + 1]]
    return dist


def main():
    N, M, R = read()
    r = map(lambda x: x - 1, sorted(read()))
    d = [[INF for i in range(N)] for j in range(N)]

    for i in range(M):
        a, b, c, = read()
        a -= 1
        b -= 1
        d[a][b] = d[b][a] = c

    d = wf(d)

    min_dist = INF
    for p in list(permutations(r)):
        min_dist = min(min_dist, calc_dist(p, d))

    print(min_dist)


if __name__ == '__main__':
    main()

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

int main() {

	string S;
	cin >> S;
	int s[4] = { S.at(0) - '0',S.at(1) - '0',S.at(2) - '0' ,S.at(3) - '0' };
	int sum = s[0];
	char op[3];


	for (int bit = 0; bit < (1 << 3); ++bit) {

		for (int i = 0; i < 3; i++) {

			if (bit & (1 << i)) {
				sum += s[i + 1];
				op[i] = '+';
			}
			else {
				sum -= s[i + 1];
				op[i] = '-';
			}

		}

		if (sum == 7) {
			cout << s[0] << op[0] << s[1] << op[1] << s[2] << op[2] << s[3] << "=7" << endl;
			break;
		}

		sum = s[0];
	}


}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
        int a,b;

        scanf("%d%d", &a, &b);

        if( a > b ){
                int t = a;
                a = b;
                b = t;
        }

        for( int i = 0; i < b; i++ ){
                printf("%d", a);
        }
        printf("\n");
}


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

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

    int ans = 0;
    int len = s.length();
    for (int i = 0; i < len/2; i++) {
        if (s[i] != s[len-i-1])
            ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3616