akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"

int main(){
  ll N; cin>>N;
  ll h;
  ll pre_h=0;
  bool yes = true;
  REP(i,N){
    cin >> h;
    if(h==0){ pre_h = h-1;}
    else{
      if(h<pre_h){
        yes = false; break;
      }else if(h==pre_h){
      }else{
        pre_h = h-1;
      }
    }
  }
  cout << (yes?Liny:Linn);
}

Measured memory_bytes: 256
n = int(input())
s = input()
if n%2==1:
    print("No") 
else:
    s1 = ""
    s2 = ""
    for i in range(0, n//2):
        s1+=s[i]
        s2+=s[n//2 + i]
    if(s1 == s2):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
#define Mod(n) n % 1000000007
const int dx[8] = {1, 0, -1, 0, -1, 1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

int main()
{
    int A,B;
    cin >> A >> B;
    for(double i = 1;i <= 80000;i++)
    {
        if(A == (int)(i * 0.08) && B == (int)(i * 0.10))
        {
            cout << i << '\n';
            return 0;
        }
    }
    cout << "-1\n";
}

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

    const int MOD = 1000000007;
    const double PI = acos(-1); 

    //long long
    using ll = long long;

    //出力系
    #define print(x) cout << x << endl
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数（ll）
    ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

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



  // // 二分探索(最小値を出す問題は疑う)
  // bool C(ll x){
  //     ll res = 0;
  //     for(int i = 0; i < N; ++i){
  // 		res += max(0ll, A[i]-x/F[i]);
  //     }
  //     return res <= K;
  // }

  //   ll binary_search(ll ok, ll ng){
  //     while(abs(ok - ng) > 1){
  //       ll mid = (ok + ng) / 2;
  //       if(C(mid)) ok = mid;
  //       else ng = mid;
  //     }
  //     return ok;
  //   }



  int main(){
    int N;
    cin >> N;
    int A, B;
    cin >> A >> B;
    int first = 0, second = 0, third = 0;
    REP(i, N){
      int p;
      cin >> p;
      if(p <= A) first++;
      else if(p <= B) second++;
      else  third++;
    }
  int ans =min (first, min(second, third));
  print(ans);
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 999999999999
#define F first
#define S second
#define read(x)  freopen("input.txt","r",stdin);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi 2*acos(0.0)
#define ee exp(1)
#define mx 200009
using namespace std;
priority_queue<ll>p,q;
map<ll,ll>m;
int main(){//read(x);
fast;
ll a,b,c,d,e,f,g,h,i,j,k,l=0,n,t;
cin>>n;
for(i=1;i<=n;i++){
    cin>>a;
    m[a]++;
}
for(auto i:m){
    a=i.F;b=i.S;
    if(b>=4)p.push(a);
    if(b>=2)q.push(a);
}
if(p.size()>=1){
    a=p.top();
    l=max(l,a*a);
}
if(q.size()>=2){
    a=q.top();q.pop();
    b=q.top();q.pop();
    l=max(l,a*b);
}

 cout<<l<<endl;

}














Measured memory_bytes: 9804
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

H1,M1,H2,M2,K=get_i
puts (H2-H1)*60+M2-M1-K

Measured memory_bytes: 14376
Scanf.(Array.(
  let n,h,w = scanf " %d %d %d" @@ fun p q r -> p,q,r in
  print_int (
    init n (fun _ ->
      let a,b = scanf " %d %d" @@ fun p q -> p,q in
      if h<=a && w<=b then 1 else 0) |> fold_left (+) 0)))

Measured memory_bytes: 896
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

def Find(x):	#xの根を返す
	global table

	if table[x] == x:
		return x
	else:
		table[x] = Find(table[x])	#親の更新(根を直接親にして参照距離を短く)
		return table[x]

def Unite(x,y):	#xとyを繋げる
	x = Find(x)
	y = Find(y)

	if x == y:
		return

	if rank[x] > rank[y]:
		table[y] = x
	else:
		table[x] = y
		if rank[x] == rank[y]:
			rank[y] += 1

def Check(x,y):
	if Find(x) == Find(y):
		return True
	else:
		return False

N,M = inpl()

table = [i for i in range(N+M)]	#木の親 table[x] == x なら根
rank  = [1 for i in range(N+M)]	#木の長さ

for i in range(N):
	tmp = inpl()
	for k in range(tmp[0]):
		l = tmp[k+1]
		Unite(i,l+N-1)

tmp = Find(0)
for i in range(N):
	if tmp != Find(i):
		print('NO')
		sys.exit()
print('YES')


Measured memory_bytes: 14700
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 A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		
		int max = 0;
		
		max = B/A;
		
		if(max > C){
			System.out.println(C);
		}else{
			System.out.println(max);
		}
	}	

}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
#define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
#define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() 
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    ll n,W;
    cin>>n>>W;
    ll dp[n+1][W+1];
    ll w[n+1];
    ll v[n+1];
    for (int i = 1; i<=n; ++i)
    {
        cin>>w[i];
        cin>>v[i];
    }
    for (int i = 0; i <=n; ++i)
    {
        for (int j = 0; j<=W; ++j)
        {
            dp[i][j]=0;
        }
    }

    for (int i = 1; i <=n; ++i)
    {
        for (int j = 1; j<=W; ++j)
        {
            dp[i][j]=dp[i-1][j];
            if((j-w[i])>=0){
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i]]+v[i]);
            }
        }
    }
    cout<<dp[n][W];

    return 0;
}

Measured memory_bytes: 79232
#include <functional>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            return 0;
        }

        string init;
        string final;
        cin >> init;
        cin >> final;

        auto encode = [](const string& s) {
            int r = 0b0;
            for (int i = 0; i < s.size(); ++i) {
                if (i != 0) {
                    r <<= 1;
                }
                if (s[i] == 'B') {
                    r |= 0b1;
                }
            }
            return r;
        };

        auto target = encode(final);
        auto start = encode(init);

        vector<vector<int>> memo(n, vector<int>(1 << n, -1));
        // p ??????????????´?????¶?????? s ?????¨??????????°???????????????????
        function<int(int, int)> f = [&f, &memo, n, start](int p, int s) -> int {
            if (memo[p][s] != -1) {
                return memo[p][s];
            }

            // ??????????????´????????????
            if (s == 0) {
                return 0;
            }

            int min_ = numeric_limits<int>::max();
            for (int i = 0; i < n; ++i) {
                // i ??????????????§????????´????????????
                if (((s >> i) & 1) == 0) {
                    continue;
                }
                for (int j = 0; j < n; ++j) {
                    if (i == j) {
                        continue;
                    }
                    // j ??????????????§????????´????????????
                    else if ((s >> j & 1) == 0) {
                        continue;
                    }
                    // ?????????????????\????????????????°???????????????????
                    else if ((((start >> i) & 1) ^ ((start >> j) & 1)) == 0) {
                        continue;
                    }
                    else {
                        // p ?????? i ?????§?????£???, i ?????? j ?????§??????
                        auto cost = abs(i - p) + abs(j - i);
                        min_ = min(min_, cost + f(j, s ^ (1 << i) ^ (1 << j)));
                    }
                }
            }
            memo[p][s] = min_;

            return min_;
        };

        int min_ = numeric_limits<int>::max();
        // ????????????????????????????????????
        for (int i = 0; i < n; ++i) {
            min_ = min(min_, f(i, start ^ target));
        }
        cout << min_ << endl;
    }
}

Measured memory_bytes: 7332
#include <iostream>
#include <vector>
#include <tuple>

using namespace std;

const int kInf = (1<<30);

int n, m;

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

pair<int,int> get_max_col(vector<bool>& erased, vector<vector<int>>& a) {
	vector<int> freq(m+1);

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			if (!erased[a[i][j]]) {
				++freq[a[i][j]];
				break;
			}
		}
	}

	int mi = 1;
	for (int i = 1; i <= m; ++i) {
		if (freq[i] > freq[mi])
			mi = i;
	}
	
	return make_pair(mi, freq[mi]);
}

void Solve() {
	cin >> n >> m;
	vector<vector<int>>a(n+1, vector<int>(m+1));

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

	vector<bool> erased(m+1);
	int ans = kInf;
	for (int i = 1; i <= m; ++i) {
		int col, cost;		
		tie(col, cost) = get_max_col(erased, a);
		ans = min(ans, cost);
		erased[col] = true;
	}

	cout << ans << "\n";
}

int main() {

	int tests = 1;
	for (;tests; --tests) {
		Solve();
	}

}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
#define MOD int(1e9 + 7)

int main()
{
    long long N, M;
    long long s = 0;
    vector<long long> A;

    cin >> N >> M;
    for(long long i = 0; i < N; i++){
        long long t;
        cin >> t;
        A.push_back(t);
        s += t;
    }

    long long c = 0;
    for(long long i = 0; i < N; i++)
        if((double)A[i] >= (double)s / (4 * M))
            c++;

    if(c >= M)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <algorithm>
#define mp make_pair
#define fi first
#define se second
#define fzhead EDGE(int _to, int _val, int _next)
#define fzbody to(_to), val(_val), next(_next)
#define mst(x,a) memset(x,a,sizeof(x))
#define For(i,x,y) for( int i=(x); i<=(y); i++)
using namespace std;
const int maxm=2e5+10;
const int maxn=1e5+10;
const int INF=0x3f3f3f3f;
typedef pair<int,int>pa;
struct EDGE
{
    int to,val,next;
    EDGE(){}
    fzhead:fzbody{}
}e[maxm<<1];
int cnt,head[maxn],vis[maxn];
int n,m;
int dis[maxn],sign[maxn];
void add(int bg, int to, int val)
{
    e[++cnt]=EDGE(to,val,head[bg]);
    head[bg]=cnt;
}
void dij(int s)
{
    For(i,1,n)vis[i]=0;
    /*
    queue<int>q;
    dis[s]=0;
    q.push(1);
    while(!q.empty())
    {
        int u=q.front();q.pop();
        for(int i=head[u]; i!=-1; i=e[i],next)
        {
            int v=e[i].to,w=e[i].val;
            if(dis[v]>dis[u]+w)
            {
                dis[v]=dis[u]+w;
                q.push(v);
                vis[v]++;
                if(vis[v])
            }
        }
    }
    */
    priority_queue<pa>q;
    dis[s]=0;q.push(mp(0,s));

    while(!q.empty())
    {
        int u=q.top().se;
        q.pop();
        if(vis[u])continue;
        vis[u]=1;
        for(int i=head[u]; i!=-1; i=e[i].next)
        {
            if(dis[e[i].to]>dis[u]+e[i].val)
            {
                dis[e[i].to]=dis[u]+e[i].val;
                sign[e[i].to]=u;
                q.push(mp(-dis[e[i].to],e[i].to));
            }
        }
    }

}
int main()
{
    mst(dis,0x3f);mst(head,-1);
    scanf("%d%d", &n,&m);
    For(i,1,m)
    {
        int a,b;
        scanf("%d%d", &a,&b);
        add(a,b,1);add(b,a,1);
    }
    dij(1);
    int flag=1;
    For(i,2,n)if(dis[i]==0x3f3f3f3f){flag=0;break;}
    if(flag)
    {
        cout<<"Yes"<<endl;
        For(i,2,n)cout<<sign[i]<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}


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

typedef long long ll;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n,k;
    cin>>n>>k;
    cout<<min(n%k,k-n%k)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
int n = 9;/*配列の要素数*/
int pwo(int x,int y)/*累乗の計算*/
{
    int i,a;
    a = x;
    if(y == 0)
    {
        return 1;
    }
    for(i = 1 ; i < y ; i++)
    {
        x = x*a;

    }
    return x;
}
int ketasu(int x)/*桁数*/
{
    int count = 0;
    while(x > 0)
    {
        x = x / 10;
        count++;
    }
    return count;
}
int narabikae(char a[n])/*数列を大きい順に並び替える(9,8,7,6,5みたいに)*/
{
    int i,j,k;
    for(i = 0 ; i < n ; i++)
    {
        for(j = i ; j < n - 1; j++)
        {
            if(a[i] < a[j+1])
            {
                k = a[i];
                a[i] = a[j+1];
                a[j+1] = k;
            }
        }
    }
    return 0;
}
int main(void)
{
    int i,a;
    scanf("%d",&i);
    a = i % 1000;
    if(a == 0)
    {
        printf("0\n");
        return 0;
    }
    printf("%d\n",1000 - a);
    return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

/* 二項係数 C(n,k) mod p を計算 */
const int MOD = 1000000007;

ll modpow(ll a, ll b, ll m) {
  if (b == 0) return 1;
  ll ret;
  if (b % 2 == 0) {
    ll t = modpow(a, b / 2, m) % m;
    ret = t * t % m;
  } else {
    ll t = modpow(a, (b - 1) / 2, m) % m;
    ret = a * t % m * t % m;
  }
  ret %= m;
  return ret;
}

ll inv(ll a) { return modpow(a, MOD - 2, MOD); }
int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = modpow(2, n, MOD);
  (ans += (MOD - 1) % MOD) %= MOD;
  ll x = 1;
  IFOR(j, n - b + 1, n + 1) { (x *= j * inv(j - n + b) % MOD) %= MOD; }
  (ans += (MOD - x) % MOD) %= MOD;
  x = 1;
  IFOR(j, n - a + 1, n + 1) { (x *= j * inv(j - n + a) % MOD) %= MOD; }
  (ans += (MOD - x) % MOD) %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 256
# ABC 081: B – Shift only
n = int(input())
a = [int(s) for s in input().split()]

m = 0
canDivided = True

while canDivided:
    for i in range(len(a)):
        if a[i] % 2 == 0:
            a[i] //= 2
        else:
            canDivided = False
            break
    else:
        m += 1

print(m)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int math[101],check,mmax=0;
    for(int i=1;i<101;i++)math[i]=0;
    while(scanf("%d",&check)!=EOF){
        math[check]++;
        if(math[check]>mmax)mmax=math[check];
    }
    for(int i=1;i<101;i++){
        if(mmax==math[i])cout<<i<<endl;
    }
}

Measured memory_bytes: 1208
import heapq

K = int(input())
q = [i for i in range(1, 10)]
ans = []
for i in range(K):
  n = heapq.heappop(q)
  ans += [n]
  stn = str(n)
  last = (stn[-1])
  cand1 = int(str(n) + last)
  heapq.heappush(q, cand1)
  if 0 < int(last):
    cand2 = int(str(n) + str(int(last)-1))
    heapq.heappush(q, cand2)
  if int(last) < 9:
    cand3 = int(str(n) + str(int(last)+1))
    heapq.heappush(q, cand3)

print(ans[-1])




Measured memory_bytes: 86192
package main

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

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

var sc = newScanner()

func main() {
	n, k := int64(scanInt()), int64(scanInt())
	m := int64(1000000007)
	ans := int64(0)
	for i := k; i <= n+1; i++ {
		min, max := i*(i-1)/2, n*(n+1)/2-(n-i)*(n-i+1)/2
		ans += max - min + 1
		ans %= m
	}
	fmt.Println(ans)
}



Measured memory_bytes: 1760
N = int(input())
capacity_list = []
for i in range(5):
    capacity_list.append(int(input()))

time = []
time.append(int(N/capacity_list[0])+1 if N%capacity_list[0] != 0 else int(N/capacity_list[0]))
for i in range(0,4):
    if capacity_list[i]>capacity_list[i+1]:
        time.append(int(N/capacity_list[i+1])+1 
        if N%capacity_list[i+1] != 0 
        else int(N/capacity_list[i+1]))
    else:
        time.append(1)
rate_limit = max(time)
print(rate_limit+4)

Measured memory_bytes: 3064
count = 0

length = int(input())
length_list = list(map(int, input().split()))

for i in range(length - 2):
    for j in range(i + 1, length - 1):
        if length_list[i] != length_list[j]:
            for k in range(j + 1, length):
                if length_list[j] != length_list[k] and length_list[k] != length_list[i]:
                    half_length_sum = (length_list[i] + length_list[j] + length_list[k]) / 2
                    if half_length_sum > max(length_list[i], length_list[j], length_list[k]):
                        count += 1
print(count)

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);
    ll X; cin >> X;
    ll ans = X / 11 * 2;
    X %= 11;
    if (X > 0) ans += (X <= 6 ? 1 : 2);
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;

int loc[9][2];

void solve(){
	int n; cin>>n;
	for(int i=0; i<n; i++){
		cin>>loc[i][0]>>loc[i][1];
	}
	float s=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(j != i){
				s += sqrt(abs(loc[i][0] - loc[j][0])*abs(loc[i][0] - loc[j][0]) + abs(loc[i][1] - loc[j][1])*abs(loc[i][1] - loc[j][1]));
			}
		}
	}
	cout<<s/n;
}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout<<fixed<<setprecision(12);
	
	int t =1; 
	//cin>>t;

	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

string s;
LL dp[2][2030],ne[2030][20],ans=0;

int main()
{
	cin>>s;
	rep(i,2019) repn(j,9) ne[i][j]=(i*10+j)%2019;
	dp[0][0]=1;
	rep(i,s.size())
	{
		int tmp=(i&1),tmp2=tmp^1;
		memset(dp[tmp2],0,sizeof(dp[tmp2]));
		dp[tmp2][0]=1;
		rep(j,2020) dp[tmp2][ne[j][s[i]-'0']]+=dp[tmp][j];
		ans+=dp[tmp2][0]-1;
	}
	cout<<ans<<endl;
	return 0;
}

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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

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

#define M 1000000007

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll k;
	cin >> k;
	ll ans = 0;
	REP(i, 1, k+1) {
		REP(j, 1, k+1) {
			REP(x, 1, k+1)
				ans += __gcd(__gcd(i, j), x);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3692
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int x;
    cin >> x;
    bool frg=true;
    for(int i=100;i<=105;i++){ // x>1 よりx%i==0となるiが複数存在することはありえない
        if(x%i==0){
            frg = false;
            cout << 1 << endl;
        }
    }
    bool frg1 = true;
    if(frg){
        int num = x /100;
        if(x%100<=5*num){
            cout << 1 << endl;
            frg1 = false;
        }
        else if(frg1){
            cout << 0 <<endl;
        }
    }
    
}

Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int n;

struct point {
    double x;
    double y;
};

void KOCH(point p1, point p2, int i) {
    if(i < n) {
        point s, t, u;
        s.x = (p2.x - p1.x) / 3 + p1.x;
        s.y = (p2.y - p1.y) / 3 + p1.y;
        t.x = (p2.x - p1.x) * 2 / 3 + p1.x;
        t.y = (p2.y - p1.y) * 2 / 3 + p1.y;
    
        u.x = (t.x - s.x) * cos(M_PI / 3) - (t.y - s.y) * sin(M_PI / 3) + s.x;
        u.y = (t.x - s.x) * sin(M_PI / 3) + (t.y - s.y) * cos(M_PI / 3) + s.y;
    
        KOCH(p1, s, i + 1);
        printf("%.8lf %.8lf\n", s.x, s.y);
        KOCH(s, u, i + 1);
        printf("%.8lf %.8lf\n", u.x, u.y);
        KOCH(u, t, i + 1);
        printf("%.8lf %.8lf\n", t.x, t.y);
        KOCH(t, p2, i + 1);
        
    }
}

int main(void) {
    point p1, p2;
    
    p1.x = 0;
    p1.y = 0;
    p2.x = 100;
    p2.y = 0;
    
    cin >> n;
    
    printf("%.8lf %.8lf\n", p1.x, p1.y);
    KOCH(p1, p2, 0);
    printf("%.8lf %.8lf\n", p2.x, p2.y);
    
    return 0;
}




Measured memory_bytes: 3160
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

// 組合せ
// 返り値に対して、v[n][r]がnCrになる
vector<vector<ll>> comb(ll n) {
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));

    for (ll i = 0; i < v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }

    for (ll j = 1; j < v.size(); j++) {
        for (ll k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
        }
    }
    return v;
}

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

    vector<ll> A(n);
    rep(i, n) cin >> A[i];

    sort(A.begin(), A.end(), greater<int>());

    // vector<vector<ll>> comb_max = comb(A[0]);

    for (ll i = 0; i < 1; i++) {
        ll k = A[i] / 2;

        int lb = -1, ub = n;
        while (ub - lb > 1) {
            int mid = (lb + ub) / 2;
            if (A[mid] < k) {
                ub = mid;
            } else {
                lb = mid;
            }
        }

        if (lb == -1 || ub == n) continue;

        ll idx_comb = -1;
        if (min(A[lb], A[i] - A[lb]) > min(A[ub], A[i] - A[ub])) {
            idx_comb = A[lb];
        } else {
            idx_comb = A[ub];
        }
        cout << A[i] << " " << idx_comb << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
from collections import deque
N,Q=map(int, input().split())

#重複分を引く

class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
        self.el = [0]*(n+1)
        
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # I: idx(base: 1), x: value
    def add(self, i, x):
        # assert i > 0
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
            
    # i<x<=j 
    def get(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.sum(j) - self.sum(i)

query=[]

C=list(map(int, input().split()))
for i in range(Q):
    l, r=map(int, input().split())
    query.append((l,r,i))
query=sorted(query, key=lambda x: -x[1])

state=[-1]*N
seg=BIT(N+1)
ans=[0]*Q

for i in range(N):
    while query and query[-1][1]<i+1:
        l,r,j=query.pop()
        ans[j]=r-l+1-(seg.get(l-1,r))

    c=C[i]
    if state[c-1]==-1:
        state[c-1]=i+1
    else:
        idx=state[c-1]
        seg.add(idx,1)
        state[c-1]=i+1
    while query and query[-1][1]==i+1:
        lq,rq,j=query.pop()
        ans[j]=rq-lq+1-(seg.get(lq-1,rq))
        #print(lq, rq, seg.get(lq-1,rq))



for a in ans:
    print(a)


Measured memory_bytes: 247984
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

map<char,string> m;
map<string,char> mm;

inline char i2c(int i) { return '0'+i; }

string i2bs(int a) {
  string ret;
  while (a > 0) {
    ret += i2c(a % 2);
    a /= 2;
  }
  reverse(ret.begin(), ret.end());
  while (ret.size() < 5) ret = '0' + ret;
  return ret;
}

void init() {
  const string s[] = {
    "101", "000000", "000011", "10010001", "010001", "000001", "100101",
    "10011010", "0101", "0001", "110", "01001", "10011011", "010000",
    "0111", "10011000", "0110", "00100", "10011001", "10011110",
    "00101", "111", "10011111", "1000", "00110", "00111",
    "10011100", "10011101", "000010", "10010010", "10010011",
    "10010000"
  };
  const char c[] = { ' ', '\'', ',', '-', '.', '?' };
  const char cc[] = { ' ', '.', ',', '-', '\'', '?' };
  const int sn = sizeof(s) / sizeof(string);
  const int cn = sizeof(c) / sizeof(char);
  rep(i,sn) {
    if(i<cn) m.insert(make_pair(c[i],s[i]));
    else m.insert(make_pair('A'+(i-cn),s[i]));

    if(i<26) mm.insert(make_pair(i2bs(i),'A'+i));
    else mm.insert(make_pair(i2bs(i),cc[i-26]));
  }
}

int main() {
  init();
  string in;
  while(getline(cin,in)) {
    string tmp;
    rep(i,in.size()) tmp+=m[in[i]];
    while(tmp.size()%5!=0) tmp+='0';
    string out;
    for(int i=0;i<tmp.size();i+=5) {
      //cout << tmp.substr(i,5) << " ";
      out+=mm[tmp.substr(i,5)];
    } //puts("");
    cout<<out<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int ans = max(a - 2*b, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import qualified Data.ByteString.Char8 as C
import Data.List
import qualified Data.Vector.Unboxed as V

main = C.interact $ C.pack . show . sol . get

get = V.tail . V.unfoldr (C.readInt . C.dropWhile (<'0'))

sol = (-) <$> V.maximum <*> V.minimum

Measured memory_bytes: 508
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

int main() {
	int N; cin >> N;
	int mod = 1000000007;

	int p = 1;
	rep(i, 1, N + 1) {
		p = i * p % mod;
	}

	cout << p << endl;

	return 0;
}

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

using namespace std;


template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s)
{
    return '"' + s + '"';
}

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

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

string to_string(vector<bool> v)
{
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
    string res = "";
    for (size_t i = 0; i < N; i++)
    {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out()
{
    cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const long long INF = 1e18;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < s.length(); i++)
    {
        int x = s[i] - '0';
        if (i & 1)
        {
            a += x;
            b += x ^ 1;
        }
        else
        {
            a += x ^ 1;
            b += x;
        }
    }
    cout << min(a, b);
    return 0;
}



Measured memory_bytes: 3732
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int game[] = new int[n];   
		int people[] = new int[m];
		int score[] = new int[n];
		
		for(int i=0; i<n; i++) game[i]=sc.nextInt();
		for(int i=0; i<m; i++) people[i]=sc.nextInt();
		
		for(int i=0; i<m; i++)  //人
			for(int j=0; i<n; j++)   //競技
				if(people[i]>=game[j]){
					score[j]++;
					break;
				}
		
		int result=0;
		for(int i=0; i<n; i++)
			if(score[result]<score[i])
				result=i;
		
		System.out.println(result+1);
		
	}
}
			
	

Measured memory_bytes: 25040
using System;
using System.Linq;

class Program
{
	static void Main()
	{
		Console.ReadLine();
		var a = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => long.Parse(number));

		long sunuke = a[0];
		long kuma = a.Skip(1).Sum();
		long min = Math.Abs(sunuke - kuma);

		for (var i = 1; i < a.Length - 1; ++i) {
			sunuke += a[i];
			kuma -= a[i];
			min = Math.Min(Math.Abs(sunuke - kuma), min);
		}

		Console.WriteLine(min);
	}
}


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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int>count(26,0);
	long long ans = 0;
	for (int i = 0; i < s.length(); i++)count.at(s.at(i) - 'a')++;
	vector<long long>a(26,0);
	a.at(0) = count.at(0);
	for (int i = 1; i < 26; i++) {
		long long res = count.at(i);
		for (int j = 0; j < i; j++)res += a.at(j)*count.at(i);
		a.at(i) = res % 1000000007;
	}
	for (int i = 0; i < 26; i++)ans += a.at(i);
	ans %= 1000000007;
	cout << ans << endl;
}

Measured memory_bytes: 512
# ABC 081 B - Shift only
# https://atcoder.jp/contests/abc081/tasks/abc081_b

# cf. [AtCoder に登録したら解くべき精選過去問 10 問を Crystal で解いてみた](https://qiita.com/tomerun/items/23ce2a2ed6ead291d222)
# 第3問

n = input()
a = list(map(int, input().split()))
# print(a)

count = 0
while all(element % 2 == 0 for element in a):
    a = [element/2 for element in a]
    count += 1
print(count)


Measured memory_bytes: 2940
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string N;
	cin >> N;
	if (N[0] == N[1] && N[1] == N[2]) {
		cout << "Yes" << endl;
	}
	else if (N[1] == N[2] && N[2] == N[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		execute();
	}
 
	private static void execute() {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			
			for(int i=1; i <=9; i++) {
				if(a%i==0) {
					if(a/i<=9) {
						System.out.println("Yes");
						return;
					}
				}
			}
			System.out.println("No");
			
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define emp empty()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
const ll maxx = 2e5 + 5 ;
int main()
{
    ios;
    ll n , k ;
    cin >>n >> k ;
    vl v;
    ll cnt[maxx] ;
    ms(cnt) ;
    forn(i , 1 , n ) {
       ll x;
       cin >> x;
       v.pb(x);
       cnt[x]++;
    }
    vll vv;
    forn(i , 1  , n ) {
       if(cnt[i]){
        vv.pb({cnt[i] , i})  ;
       }
    }
    sort(all(vv)) ;
    reverse(all(vv)) ;
    ll ans = 0 ;
    forn(i , k , ll(vv.sz - 1 )) {
       ans = ans + vv[i].fi  ;
    }
    cout << ans << el;
    ro ;
}































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

#define fi first
#define se second
#define pb push_back
#define ll long long
const int N = 3e5 + 7;

using namespace std;

ll n , m;
ll ans = 1 , sum , cnt , mx;
string s , s1;
ll used[N];
int main()
{
        ios_base::sync_with_stdio(false);
   ll T;
   cin >> s;
   n = s.size() - 1;
   if( s[n] == '2' or s[n] == '4' or s[n] == '5' or s[n] == '7' or s[n] == '9' )
    cout << "hon";
   else if( s[n] == '0' or s[n] == '1' or s[n] == '8' or s[n] == '6' )
    cout << "pon";
   else
    cout << "bon";
}



Measured memory_bytes: 3588
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};


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

	int h, w;
	cin >> h >> w;

	vector<string> mat(h);
	vector<vector<int> > dist(h, vector<int>(w, LINF));
	queue<pii> que;

	rep(i,h){
		cin >> mat[i];
		rep(j,w){
			if(mat[i][j] == '#'){
				dist[i][j] = 0;
				que.emplace(i,j);
			}
		}
	}

	auto inside = [&](int y, int x){
		return (y >= 0 && x >= 0 && y < h && x < w);
	};

	while(!que.empty()){
		int ny, nx;
		tie(ny, nx) = que.front();
		que.pop();
		rep(i,4){
			int y = ny + dy[i];
			int x = nx + dx[i];
			if(inside(y, x) && chmin(dist[y][x], dist[ny][nx] + 1)){
				que.emplace(y, x);
			}
		}
	}	

	int res = 0;
	rep(i,h){
		rep(j,w){
			chmax(res, dist[i][j]);
		}
	}

	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 25524
n = int(raw_input()) 
ais = [int(raw_input()) for _ in range(n)]
r = 0
cumul = 0
m = +float('inf')
for i in range(0, len(ais)):
	cumul += ais[i]
	if ais[i] % 10:
		m = min(m, ais[i])

	if cumul % 10 == 0:
		r = max(r, cumul - m)
	else:
		r = max(r, cumul)

print r

Measured memory_bytes: 64340
#include<bits/stdc++.h>
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
char s[1000003],t[1000003];
int main()
{
    scanf("%s",s);
    scanf("%s",t);
    int n=strlen(s),m=strlen(t),ans=m;
    for(int i=0; i<=n-m; i++)
    {
        int tmp=0;
        for(int j=0; j<m; j++) if(t[j]!=s[i+j]) ++tmp;
        ans=min(tmp,ans);
    } 
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int rem=n%10;
    if(rem==3){
        cout<<"bon"<<endl;
    }
    else if(rem==0||rem==1||rem==6||rem==8)
        cout<<"pon"<<endl;
    else
    {
        cout<<"hon"<<endl;
    }

    
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
const int mod=1e9+7;

double kjri[100001];

void make(){
    kjri[0]=0;
    rep(i,1,100001){
        kjri[i]=kjri[i-1]+log10(i);
    }
}

int main(){
    int n,z,w;cin>>n>>z>>w;
    int a[n];rep(i,n)cin>>a[i];
    if(n==1){
        cout<<abs(a[n-1]-w)<<endl;exit(0);
    }
    cout<<max(abs(a[n-1]-a[n-2]),abs(a[n-1]-w))<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define MOD 1000000007
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }
ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128
ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}
ll inv(ll x){return power(x,MOD-2);}


void __sol(){
    
    ll mx = 1e18;
    ll n; cin >> n;
    vector<ll> v(n); forr(i,n) cin >> v[i];
    sort(all(v));
    ll ans = 1;
    forr(i,n){
        ll x = v[i];
        if(x==0){
            cout << 0;
            return;
        }
        else if( x<=mx/ans ) ans*=x;
        else{
            cout << -1;
            return;
        }
    }
    cout << ans;
    
    return;
}


int main(){
    fastio
    ll tc=1;// cin >> tc;
    while(tc--) __sol();
    return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[10010],B[10010];
int C[10010];
bool F[10010];
vector<int> G[10010];
int S=0;
int R[10010];


void dfs(int s){
	F[s]=true;
	R[s]=C[S];
	S++;
	REP(i,G[s].size()){
		int e=G[s][i];
		if(F[e]==false){
			dfs(e);
		}
	}
}

signed main(){
	cin>>N;
	REP(i,N-1){
		cin>>A[i]>>B[i];
		A[i]--,B[i]--;
		G[A[i]].push_back(B[i]);
		G[B[i]].push_back(A[i]);
	}
	REP(i,N){
		cin>>C[i];
	}
	sort(C,C+N,greater<>());
	dfs(0);
	int ans=0;
	REP(i,N-1){
		ans+=min(R[A[i]],R[B[i]]);
	}
	cout<<ans<<endl;
	REP(i,N){
		cout<<R[i];
		if(i<N-1)cout<<" ";
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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 int inf = 1001001001;
const ll linf = 1001001001001001001;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vi a(n);
    cin >> a;
    rep(i,n) a[i] /= 2;
    vi b(n);
    rep(i,n) {
        int cnt = 0,na = a[i];
        while(na > 0 && !(na&1)) {
            na /= 2;
            cnt++;
        }
        b[i] = cnt;
    }
    rep(i,n-1) if(b[i] != b[i+1]) {
        cout << 0 << endl;
        return 0;
    }
    rep(i,n) rep(_,b[i]) a[i] /= 2;
    ll l = a[0];
    rep2(i,1,n) {
        l = lcm(l,a[i]);
        if(l > m) {
            cout << 0 << endl;
            return 0;
        }
    }
    rep(_,b[0]) {
        l *= 2;
        if(l > m) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << (m-l)/(l*2)+1 << endl;
}


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

string SortString(string s) {

	string s_sort;
	vector<char> tmp(s.size());
	for (int i = 0; i < s.size(); i++) tmp[i] = s[i];
	sort(tmp.begin(), tmp.end());
	for (int i = 0; i < s.size(); i++) s_sort += tmp[i];
	return s_sort;
}

int main()
{
	int n; cin >> n;
	vector<string> c;
	for (int i = 0; i < n; i++) {
		string tmp_s; cin >> tmp_s;
		tmp_s = SortString(tmp_s);
		c.push_back(tmp_s);
	}
	sort(c.begin(), c.end());
	
	ll ans = 0;
	for (int i = 0; i < n - 1; ) {
		ll cnt = 1;
		for (int j = i; j < n - 1; j++) {
			if (c[j] == c[j + 1]) {
				cnt++;
			}
			else {
				break;
			}
		}
		ans += cnt * (cnt - 1) / 2;
		i += cnt;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7284