akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define pq_min priority_queue<ll,vector<ll>,greater<ll>>
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define ld long double
const ll mod=1e9 + 7;
const int N = 2000001; 
ll power(ll a,ll b)
{
	a=a%mod;
	ll ans=1;
	while(b>0)
	{
		if(b%2==1)
		{
			ans=(ans*a)%mod;
		}
		b=b/2;
		a=(a*a)%mod;
	}
	return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand(time(NULL));
    string s;
    cin>>s;
    ll n=s.length();
    ll c=0;
    for(ll i=0;i<n/2;i++)
    {
    	if(s[i]!=s[n-i-1])
    	{
    		c++;
		}
	}
	cout<<c<<endl;
}



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

long double PI = acos(-1);
const int MOD = 1e9 + 7;

int main() {
    long double a, b, h, m;
    cin >> a >> b >> h >> m;

    long double angle_l, angle_s, angle;
    angle_s = h * PI / 6.0 + m * PI / 360.0;
    angle_l = m * PI / 30.0;
    angle = angle_l - angle_s;
    
    long double ans;

    ans = a*a + b*b- 2.0*a*b*cos(angle);
    ans = sqrt(ans);
    cout << setprecision(15) << ans << endl;

    return 0;
}

Measured memory_bytes: 4168
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>

#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }



signed main()
{
	int N;
	cin >> N;
	if (N <= 999)
	{
		cout << "ABC" << endl;
	}
	else
	{
		cout << "ABD" << endl;
	}
}



Measured memory_bytes: 3096
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	ocnt := 0
	for i := 1; i <= n; i++ {
		if i%2 == 1 {
			ocnt++
		}
	}

	fmt.Println(float64(ocnt) / float64(n))
}

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


Measured memory_bytes: 1776
#include <stdio.h>
#include <string.h>
int main(void){
  char S[4];
  scanf("%s",S);
  if((S[0]==S[1])||(S[1]==S[2])||(S[2]==S[3])){
    printf("Bad\n");
  }
  else{
    printf("Good\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
    string s;
    cin>>s;
    vector<int>MOD = {1,10,9,12,3,4};
    vector<vector<ll> >dp(s.size()+1,vector<ll>(13));
    for(int i=0;i<13;++i){
        dp.at(0).at(i)=0;
    }
    dp.at(0).at(0)=1;
    for(int i=1;i<s.size()+1;++i){
        if(s.at(s.size()-i)!='?'){
            for(int j=0;j<13;j++){
                dp.at(i).at(j)=(dp.at(i-1).at(((j-(int)((int)s.at(s.size()-i)-'0')* MOD.at((i-1)%6))+130)%13))%1000000007;
            }
        }
        else{
            for(int j=0;j<13;j++){
                for(int k=0;k<10;k++){
                    dp.at(i).at(j)=(dp.at(i).at(j)+dp.at(i-1).at((j-k * MOD.at((i-1)%6) + 130)%13))%1000000007;
                }
            }
        }
    }
    cout<<dp.at(s.size()).at(5)<<endl;






    return 0;
}


Measured memory_bytes: 13696
#include <stdio.h>
#define MAX_N 200010

int a[MAX_N];

int main(void)
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int t;
        scanf("%d", &t);
        if (n % 2) {
            if (i % 2) a[n / 2 + (i + 1) / 2] = t;
            else a[n / 2 - i / 2] = t;
        }
        else {
            if (i % 2) a[n / 2 - (i + 1) / 2] = t;
            else a[n / 2 + i / 2] = t;
        }
    }
    for (int i = 0; i < n; i++)
        printf("%d ", a[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 2816
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007


int main() {
	int n;
	cin >> n;
	cout << n * n * n;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

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

	auto n = b - a - 1;
	cout << n * (n + 1) / 2 - a << endl;

	return 0;
}


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

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

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<vector<ll>> b(n+1, vector<ll>(2,0));
    for(i = 0;i < n;++i){
        cin >> a.at(i);
        ll tmp1 = i+1+a.at(i);
        ll tmp2 = i+1-a.at(i);
        if(tmp1 <= n){
            ++b.at(tmp1).at(0);
        }
        if(tmp2 >= 1){
            ++b.at(tmp2).at(1);
        }
    }
    ll ans = 0;
    for(i = 1;i <= n;++i){
        ans += b.at(i).at(0)*b.at(i).at(1);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 15560
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}



signed main(){
	
	ll k,x;
	cin >> k >> x;
	
	rep(i,x-k+1,x+k){
		cout << i;
		if(i != x+k-1) cout << " ";
	}
	cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start; i<n; i++)


int main(void){
  int N;
  cin >> N;
  long a[N];
  ll sum = 0;
  rep(i, N) {
    cin >> a[i];
    sum += a[i];
  }
  double sum2 = 0;
  double kyori = 1e+12;
  double kyori_now;
  //cout << "sum" << sum << endl;
  rep(i, N){
    sum2 += a[i];
    kyori_now = (double)((double)sum2-(double)sum/2.0);
    
    if (kyori_now < 0){
      kyori_now = -kyori_now;
    }
    //cout << "kyori_now" << kyori_now << "kyori" << kyori << endl;
  
    //if (kyori_now > kyori) {break;}
    kyori = min(kyori, kyori_now);
  }
  
  cout << (int)(kyori/0.5) << endl;

}


Measured memory_bytes: 1792
def main():
    import sys
    n = int(input())
    A,B = [],[]
    for i in range(n):
        a,b= map(int, input().split())
        A.append(a)
        B.append(b)
    A = sorted(A)
    B = sorted(B)
    if n%2 == 0:
        ma = (A[n//2]+A[n//2-1])/2
        mb = (B[n//2]+B[n//2-1])/2
        ans = int(2*(mb-ma) + 1)
        print(ans)
    else:
        ma = A[n//2]
        mb = B[n//2]
        ans = (mb-ma) + 1
        print(ans)
        
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 27132
#include<iostream>
#include<vector>
int n;
std::vector<int> A,M;
bool solve(int i,int m){
	if(m==0) return true;
	if(i>=n) return false;
	bool res=solve(i+1,m) || solve(i+1,m-A[i]);
	return res;
}

int main(){
	std::cin>>n;
	int x;
	for(int i=0;i<n;i++){
		std::cin>>x;
		A.push_back(x);
	}
	int q;
	std::cin>>q;
	for(int i=0;i<q;i++){
		std::cin>>x;
		M.push_back(x);
	}
	for(int m:M){
		if(solve(0,m)) std::cout<<"yes"<<'\n';
		else std::cout<<"no"<<'\n';
	}
	return 0;
}


Measured memory_bytes: 3116
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: a,b,c,d

    read*, a,b,c,d

    if (abs(a-c) <= d .or. (abs(a-b) <= d .and. abs(b-c) <= d)) then
        print'(a)', 'Yes'
    else
        print'(a)', 'No'
    end if
end program main

Measured memory_bytes: 384
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
a = inpl()
res = 0
for i in range(k+1):
    pick = i; back = k-i
    for j in range(pick+1):
        l = j; r = pick-j
        q = deque(a)
        # print(l,r)
        now = []
        while q and l > 0:
            now.append(q.popleft())
            l -= 1
        while q and r > 0:
            now.append(q.pop())
            r -= 1
        now.sort(); ln = len(now)
        ans = sum(now)
        res = max(res, ans)
        for i in range(back):
            if i >= ln: continue
            ans -= now[i]
            res = max(res, ans)
print(res)

Measured memory_bytes: 69736
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
    int H, W;
    while(cin >> H >> W){
        vector<string> vs(H);
        for(auto& s : vs) cin >> s;
        vector<vector<string>> res(2, vector<string>(H, string(W, '.')));
        for(int i=0;i<2;i++){
            for(int j=0;j<H;j++){
                res[i][j][i==0?0:W-1] = '#';
                for(int k=1;k<W-1;k++){
                    if(j%2 == i || vs[j][k]=='#') res[i][j][k] = '#';
                }
            }
        }
        for(int i=0;i<2;i++){
            for(auto& s : res[i]) cout << s << endl;
            if(i==0) cout << endl;
        }
    }
}

Measured memory_bytes: 1536
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<int,pair<int,int> > dat[1000];
int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c),a+b+c){
		for(int i=0;i<b;i++){
			int d,e,f;
			scanf("%d%d%d",&d,&e,&f);
			dat[i]=make_pair(-d,make_pair(e,f));
		}
		std::sort(dat,dat+b);
		for(int i=0;i<b;i++){
			if(c==dat[i].second.first){
				c=dat[i].second.second;
			}else if(c==dat[i].second.second){
				c=dat[i].second.first;
			}
		}
		printf("%d\n",c);
	}
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (a == 5 && b == 5 && c == 7) {
    cout << "YES" << endl;
  }
  else if (a == 5 && b == 7 && c == 5) {
    cout << "YES" << endl;
  }
  else if (a == 7 && b == 5 && c == 5) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll X, Y , Z;
    in >> X >> Y >> Z;

    // solution here

    out << Z << " " << X << " " << Y << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
/*Stay true to yourself, yet always be open to learn. Work hard, and never give up on your dreams, 
even when nobody else believes they can come true but you. These are not cliches but real tools you 
need no matter what you do in life to stay focused on your path.
*/
 
 /*Pppppppp    UU      UU     CCCCCCCC    CCCCCCCC     HH     HH     UU      UU
   pp    pp    UU      UU     CC          CC           HH     HH     UU      UU
   pp    pp    UU      UU     CC          CC           HHHHHHHHH     UU      UU
   pppppppp    UU      UU     CC          CC           HHHHHHHHH     UU      UU
   pp          UU      UU     CC          CC           HH     HH     UU      UU
   pp          UUUUUUUUUU     CCCCCCCC    CCCCCCCC     HH     HH     UUUUUUUUUU
   */
 
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define ford(i,a,b) for(int i=b;i>=a;i--)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
 int gcd(int a,int b){
 	if(b==0) return a;
 	return gcd(b,a%b);
 }
 

signed main()
{
 
    fast;
    int n,k;
    cin >>n >> k;
    int s[n+1],b[n+1];
    s[0]=0;
    for(int i=1;i<=n;i++) s[i]=s[i-1]+i;
    b[0]=n;
    for(int i=n-1,j=1;i>=0;i--,j++) b[j] = b[j-1]+i;
    // loop(i,n+1) cout<<s[i]<<" ";
    // cout<<endl;
    // loop(i,n+1) cout<<b[i]<<" ";
    // cout<<endl;
    int sum =0;
    for(int i=k-1;i<=n;i++){
    	sum = sum + (b[i]-s[i]+1)%mod;
    	sum = sum%mod;
    }
    cout<<sum<<endl;
    return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int n;
ll a[112345];

ll solve(ll st) {
	ll res = 0;
	bool bef = st > 0; // true:pos, false:neg
	
	ll sum = st;
	
	FOR(i, 1, n) {
		sum += a[i];
		if (sum == 0) {
			if (bef) sum = -1;
			else sum = 1;
			res++;
		}
		else {
			if (bef) {
				if (sum > 0) {
					res += sum + 1;
					sum = -1;
				}
			}
			else {
				if (sum < 0) {
					res += -sum + 1;
					sum = 1;
				}
			}
		}
		
		bef ^= 1;
	}	
	
	
	return res;
}

int main() {
	cin >> n;
	REP(i, n) scanf("%lld", a + i);
	
	ll ans;
	
	if (a[0] == 0) {
		ans = solve(1) + 1;
		
		chmin(ans, solve(-1) + 1);
	}
	else {
		ans = solve(a[0]);
		if (a[0] > 1) chmin(ans, solve(-1) + a[0] + 1);
		else chmin(ans, solve(1) - a[0] + 1);
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k,x,y,a;
    cin>>n>>k>>x>>y;
    if(k>n)
    {
        a=n*x;
    }
    else
    {
        a=k*x+(n-k)*y;
    }
    cout<<a<<endl;
}


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

int main(){
  	int x[5];
  	int m;
  
  	for(int i=0; i<5; i++){
  		cin >> x[i];
      if(x[i]==0){
        m=i+1;
      }
    }

  cout << m<< '\n';
  return 0;
}

Measured memory_bytes: 3540
[l,r]=[int(x) for x in input().split()]

ans=set()
for item in range(l,r+1):
  mod=item%2019
  if mod==0:
    print(0)
    exit()
  else:
    ans.add(mod)
    
ans=list(ans)
length=len(ans)
res=2018**2
for i in range(length-1):
  for j in range(i+1,length):
    res=min(res,(ans[i]*(ans[j]))%2019)
print(res)
    

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define P(s)     cout<<(s)<<endl
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n;
	cin>>n;
  
  	if(n==1){
    	P("Yes");
      	return 0;
    }
	
	vi h(n);
	REP(i,n) cin>>h[i];
	
	for(int i=1;i<n;++i){
		if(h[i-1]>h[i]){
			P("No");
			return 0;
		}else if(h[i-1]==h[i]){
			continue;
		}else{
			h[i]--;
		}
	}
	
	P("Yes");
}

Measured memory_bytes: 640
h, w, K = map(int, input().split())

rows = []
for _ in range(h):
  row = list(input())
  rows.append(row)

hh = 2 ** h
ww = 2 ** w

result = 0
for i in range(hh):
  for j in range(ww):
    i_bin = format(i, '06b')
    j_bin = format(j, '06b')
    counter = 0
    for k in range(h):
      for l in range(w):
        if i_bin[-k-1] == '0' and j_bin[-l-1] == '0':
          if rows[k][l] == '#':
            counter += 1
    if counter == K:
      # print(i_bin, j_bin)
      result += 1
      
print(result)

Measured memory_bytes: 9224
import numpy as np

# 整数の入力
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

time = np.array([a, b, c, d, e])
time_10 = np.ceil(time / 10) * 10
xx0, xx1 = np.meshgrid(time,time_10)

time_set = (1 - np.eye(xx1.shape[0])) * xx1 + np.eye(xx0.shape[0]) * xx0

print(int(np.min(time_set.sum(axis=0))))

Measured memory_bytes: 12508
#include<stdio.h>

int main(){
        int H,W,i,j;

        while(1){
                scanf("%d %d",&H,&W);
                if(H==0 && W==0)break;
                for(i=0;i<W;i++)printf("#");
                printf("\n");

                for(i=0;i<H-2;i++){
                        printf("#");
                        for(j=0;j<W-2;j++){
                                printf(".");
                        }
                        printf("#");
                        printf("\n");
                }

                for(i=0;i<W;i++)printf("#");
                printf("\n");
                printf("\n");
        }

        return 0;
}


Measured memory_bytes: 2052
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def gcd_n(numbers):
    ret = numbers[0]
    for i in range(len(numbers)):
        ret = gcd(ret, numbers[i])
    return ret


def main():
    N, X = map(int, input().split())
    x = [abs(X - int(i)) for i in input().split()]
    print(gcd_n(x))
    return


main()


Measured memory_bytes: 14212
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
typedef long long ll;
//ll mod = 1e9+7;
ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<ll> a_accum(n + 1);
    map<ll, ll> mp; 
    rep(i, n) {
        ll a;
        cin >> a;
        a_accum[i+1] = a_accum[i] + a;
        ++mp[a_accum[i+1]];
    }
    ll ans = 0;
    for ( auto tmp_mp : mp ) {
        if ( tmp_mp.first == 0 ) {
            ans += tmp_mp.second;
        }
        if ( tmp_mp.second >= 2 ) {
            ans += ( tmp_mp.second * ( tmp_mp.second - 1 ) / 2 );
        }
    }
    cout << ans << endl;
    return 0;
}


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

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

namespace NyaGadget
{	// DFSライブラリ

	struct DFSedge
	{
		ll vertex;	// 頂点
		DFSedge(ll v) { vertex = v; }
	};

	struct DFS
	{
		using Graph = vector<vector<DFSedge>>;
		Graph graph;

		DFS(ll size)
		{
			graph.resize(size);
		}

		vector<DFSedge>& operator [](int n) { return graph[n]; }

		void CreateEdge(ll v1, ll v2)
		{
			graph[v1].push_back(DFSedge(v2));
			graph[v2].push_back(DFSedge(v1));
		}
	};

}

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define ceil(a, b) ceil((ld) a / (ld) b);                         // div ceiling
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

using namespace NyaGadget;

/**
@brief 深さ優先探索
@param v 頂点
@param r 根
@param g 処理するグラフ
@param memo 前処理したメモ(加算するべきカウンタの値)
@param ans 出力する答えを格納する配列
@note
 DFSで全てのノードを処理する。
**/
void Solve(ll r, ll v, DFS& dfs, vector<ll>& memo, vector<ll>& ans)
{
	if (r != -1)
		ans[v] = ans[r] + memo[v];

	for (const auto& e : dfs[v])
	{	// 後戻りしないようにする
		if (e.vertex == r)
			continue;

		Solve(v, e.vertex, dfs, memo, ans);
	}
}

int main(void)
{
	ll n, q; cin >> n >> q;

	ll u, v;
	DFS dfs(n);
	rep(ei, 0, n - 1)
	{
		cin >> u >> v;
		--u; --v;
		dfs.CreateEdge(u, v);
	}

	vector<ll> p(q), x(q);
	rep(i, 0, q)
	{
		cin >> p[i] >> x[i];
		p[i]--;
	}

	// 頂点xで加算するべきカウンタの値をメモしておく。
	vector<ll> memo(n);
	rep(i, 0, q)
		memo[p[i]] += x[i];

	vector<ll> ans(n);
	ans[0] = memo[0];
	Solve(-1, 0, dfs, memo, ans);

	for (auto& e : ans)
		cout << e << " ";

	return 0;
}


Measured memory_bytes: 35200
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    unordered_map<char,int> ht;
    
    for(int i=0; i<N; ++i){
        char c; cin >> c;
        ht[ c ]+=1;
    }
    
    cout << (ht.size()==3 ? "Three":"Four") << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
int a[3005],dp[3005],sum[3005];
int main()
{
	int n,s,ans=0;
	scanf("%d%d",&n,&s);
	dp[0]=1;
	for (int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		for (int j=s;j>=a[i];j--)
		dp[j]=(dp[j]+dp[j-a[i]])%mod;
		for (int j=0;j<=s;j++)
		sum[j]=(sum[j]+dp[j])%mod;
	}
	for (int i=0;i<n;i++)
	{
		ans=(ans+sum[s])%mod;
		for (int j=a[i];j<=s;j++)
		sum[j]=(sum[j]-sum[j-a[i]]+mod)%mod;
		sum[0]--;
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

int main() {
    ll A,B;
    cin >> A >> B;
    ll ret = 0;
    for(ll i = 0;i < 40;i++) {
        ll cnt1 = (B + 1) / (2 * Pow(2ll,i)) * Pow(2ll,i) + max((B + 1) % (2 * Pow(2ll,i)) - Pow(2ll,i),0ll);
        ll cnt2 = A / (2 * Pow(2ll,i)) * Pow(2ll,i) + max(A % (2 * Pow(2ll,i)) - Pow(2ll,i),0ll);
        if((cnt1 - cnt2) % 2 == 1) {
            ret += Pow(2ll,i);
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (n-- > 0) {
            boolean[] used = new boolean[14];
            boolean ans = false;
            for (int i = 0; i < 6; i++) {
                used[sc.nextInt()] = true;
            }
            if (used[1] == used[13])
                ans=!used[1];
            else {
                int l = 6, r = 8;
                boolean t=false;
                for (;;) {
                    if (t == used[1]) {
                        if (used[r]^t)
                            r++;
                        else if (used[l]^t)
                            l--;
                    } else  {
                        if (used[l]^t)
                            l--;
                        else if (used[r]^t)
                            r++;
                    }
                    if (r == 13 || l==1) {
                      //  ans= !used[1];
                        ans=used[1]^r==13;
                        break;
                    }
//                    if (l == 1) {
//                        ans=  used[1];
//                        break;
//                    }
                    t = !t;
                }
            }
            System.out.println(ans ? "yes" : "no");
        }
    }
}


Measured memory_bytes: 28324
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long 
#define fi first
#define se second 

using namespace std;

int main() {
    // ifstream cin("tst.in");
    // ofstream cout("tst.out");
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    ll n, m;
    cin >> n >> m;

    ll ans = 0;
    ans += n * (n - 1) / 2ll;
    ans += m * (m - 1) / 2ll;

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,Z,W;
    cin >> N >> Z >> W;
    vec<ll> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    if(N==1) cout << abs(A[0]-W) << "\n";
    else cout << max(abs(A[N-1]-W),abs(A[N-2]-A[N-1])) << "\n";
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll n, a, b;
	cin >> n >> a >> b;

	ll ans = n / (a + b) * a;
	ll r = n % (a + b);

	ans += min(r, a);

	out(ans);

	return 0;
}

Measured memory_bytes: 256
# input
H, W = map(int, input().split())

for i in range(W + 1):
    print('#', end = "")
print('#')
for i in range(H):
    print('#', end = "")
    print(input(), end = "")
    print('#')
for i in range(W + 2):
    print('#', end = "")


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

int main(){
    
    int N;
    cin >> N;
    
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
    }
    
    sort(vec.begin(), vec.end());
    int ans;
    ans=vec.at(N-1)-vec.at(0);
    
    cout << ans <<endl;
}
    

Measured memory_bytes: 256
// 200 jyada le le bas saare test case pass kara de
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define test int t;cin>>t;while(t--)
#define For(i,a,b) for(i=a;i<b;i++)
#define loop(i,b) for(int i=0;i<b;i++)
#define Loop(i,b) for(int i=1;i<=b;i++)
#define ll long long int
#define ld long double
#define pb push_back
#define test int t;cin>>t;while(t--)
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007 
#define bug cout<<"HY"<<endl
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
typedef pair<int,int> P;
#define PI acos(-1.0)
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define vil(vct) vector < ll > vct
#define vis(vct) vector < string > vct
#define vip(vct) vector < pair < ll, ll > > vct
#define pi pair < ll , ll > 
#define pii pair < pair < ll, ll >, ll >
#define Sort(arr) sort(arr.begin(), arr.end())
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];

int main()
{ 
fast;
string s;
  int n=s.size();
  n=6;
  loop(i,n){
    cin>>s[i];}
  
  if(s[2]==s[3] &&s[4]==s[5])
  {
    cout<<"Yes"<<endl;
  }
  else
    cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, h;
  cin >> n >> h;
  // ll n, m, k;
  // cin >> n >> m >> k;
  int wield[n];
  int thro[n];
  fi(0, n) {
    cin >> wield[i] >> thro[i];
  }
  sort(wield, wield + n);
  sort(thro, thro + n);
  int i = n - 1;
  while(h > 0 && thro[i] > wield[n - 1]) {
    ans++;
    h -= thro[i--];
  }

  if(h > 0) {
    ans += (h + wield[n - 1] - 1) / wield[n - 1];
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1024
a,b,c=map(int,input().split())

ans=0
while a%2==0 and b%2==0 and c%2==0:
  if a%2==0 and b%2==0 and c%2==0 and a==b and b==c:
    print(-1)
    exit()
  ta,tb,tc=a,b,c
  a=(tb+tc)/2
  b=(tc+ta)/2
  c=(ta+tb)/2
  ans+=1
print(ans)
  

Measured memory_bytes: 3060
N = int(input())
#N=44852
LIST=[10**9]*(10**7)
LIST[0]=1

i=1
c=1
while(6**i <= N):
    LIST[c]=6**i
    c+=1
    if(9**i <= N):
        LIST[c]=9**i
        c+=1
    i+=1
LIST=LIST[0:c]
LIST=list(sorted(LIST,reverse=True))
MIN=10**10

def calc(L,i,c):
    global MIN
    global N
    if(MIN<c):
        return
    if(N-L >= LIST[i]):
        calc(L+LIST[i],i,c+1)
        if(MIN<c):
            return
    if(len(LIST)-2>=i):
        calc(L,i+1,c)
        if(MIN<c):
            return
    if(N==L):
        MIN=min(MIN,c)
  

calc(0,0,0)
print(MIN)

Measured memory_bytes: 117616
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  while(scanf("%d",&n),n){
    vector<int> v(n);
    for(int i=0;i<n;i++){
      int tmp;
      scanf("%d",&tmp);
      v[i]=tmp;
    }
    double ans=0;
    sort(v.begin(),v.end());
    for(int i=1;i<v.size()-1;i++){
      ans+=(double)v[i];
    }
    printf("%d\n",(int)(ans/(v.size()-2)));
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const int MOD9 = 998244353;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
int f(int x,int m){
	return x%m;
}

signed main(){
	int n,x,m;
	cin>>n>>x>>m;
	
	vi path;

	vi visit(100000,-1);
	int ans=0;
	int now=x;
	int st=-1;
	int len=-1;
	int rest=-1;
	FOR(i,1,n){
		path.pb(now);
		if(visit[now]>-1){
			st=visit[now];
			len=i-visit[now];
			rest=n-i+1;
			
			// cout<<"st="<<st<<endl;
			// cout<<"len="<<len<<endl;
			// cout<<"rest="<<rest<<endl;
			break;
			
		}
		visit[now]=i;
		ans+=now;
		now=f(now*now,m);
	}
	// cout<<"ans1="<<ans<<endl;
	int tot=0;
	FOR(i,st,st+len-1){
		tot+=path[i];
	}
	// cout<<"tot="<<tot<<endl;

	ans+=rest/len*tot;
	// cout<<"ans2="<<ans<<endl;
	
	FOR(i,st,st+(rest%len)-1){
		ans+=path[i-1];
	}
	cout<<ans<<endl;

	// rep(i,path.size()){
	// 	cout<<' '<<path[i];
	// }
	// cout<<endl;

	return 0;
}

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

int main(void){
    string s, ss;
    int flg=0, cnt=0;
    cin >> s;
    if(s[0]!='A') flg=1;
    if(s[1]<'a' || s[1]>'z') flg=1;
    ss = s.substr(2,s.length()-2);
    for(int i=0;i<ss.length();i++){
        if(ss[i]=='C'){
            cnt++;
            continue;
        }else{
            if(ss[i]<'a' || ss[i]>'z') flg=1;
        }
    }
    if(s[s.length()-1]<'a' || s[s.length()-1]>'z') flg=1;
    if(cnt!=1) flg=1;
    if(flg==0) cout << "AC" << endl;
    else cout << "WA" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
const int INF = 100000000;

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    REP(i, n){
        cin >> d[i];
    }

    ll count = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            count += d[i] * d[j];
        }
    }

    cout << count << endl;
}

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

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

Measured memory_bytes: 3936
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

int main()
{
	int32_t N, K;
	cin >> N >> K;

	map<int32_t, int32_t> _map;
	for (int32_t i = 0; i < N; i++) {
		int32_t A;
		cin >> A;
		if (_map.find(A) == _map.end()) {
			_map[A] = 1;
		} else {
			_map[A]++;
		}
	}

	vector<int32_t> counts(_map.size());
	int32_t _index = 0;
	for (auto iter = _map.begin(); iter != _map.end(); iter++) {
		counts[_index++] = iter->second;
	}
	sort(counts.begin(), counts.end(), greater<int32_t>());
	int64_t res = 0;
	for (size_t i = K; i < counts.size(); i++) {
		res += counts[i];
	}

	cout << res << endl;

	return 0;
}

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

using namespace std;
using ll =long long;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << 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; }
//Write From this Line

static const double pi = 3.141592653589793;
int main()
{
	double a, b;
	cin >> a >> b;
	double h, m;
	cin >> h >> m;
	double x = 60*h + m;
	double y = 12*m;
	double rad = (abs(x-y))*2*pi / (60*12);
	
	cout << setprecision(15);
	cout << sqrt(a*a + b*b - 2*a*b*cos(rad)) << endl;
}


Measured memory_bytes: 4224
#define _CRT_SECURE_NO_WARNINGS

#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <map>
#include <functional>
#include <bitset>
#include <complex>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	vi a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	const int inf = 1e9 + 228;
	vi dp(n, inf);
	dp[0] = 0;
	for (int i = 1; i < n; i++) {
		dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]));
		if (i > 1) {
			dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]));
		}
	}
	cout << dp[n - 1];
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N+1, 0);
  for(int i=1;i<N+1;i++){
    cin >> vec.at(i);
  }
  for(int i=1;i<N+1;i++){
    if(vec.at(1)==2){
      cout << i << endl;
      break;
    }
    vec.at(1)=vec.at(vec.at(1));
  }
  
  if(vec.at(1)!=2){
      cout << -1 << endl;
  }
}

Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;




int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	cout << (s[0] == s[1] && s[1] == s[2] ? "No" : "Yes");
}

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

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abst(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
    int p,q;
    cin>>p>>q;
    int s1=0,s2=0;
    for(int i=0;i<q;i++)
    {
        s1=s1*10+p;
    }
    for(int i=0;i<p;i++)
    {
        s2=s2*10+q;
    }
    if(s1>=s2)
     cout<<s1;
     else
      cout<<s2;
      return 0;
    
}

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

int ceiling_div(int a, int b){ // ceiling(a/b)= floor((a+b-1)/b)
  return (a+b-1)/b;
}

int main(){
  int N,D,A;
  cin >> N >> D >> A;

  vector<pair<int, int>> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i).first >> data.at(i).second;
  }
  sort(data.begin(), data.end());

  queue<pair<int,int>> bombs; // 各爆弾の右端,威力を管理するキュー
  int64_t ans= 0;
  int64_t blast= 0; // モンスターiがモンスターiが[0,i)から受ける爆風
  for(auto e:data){
    auto x_edge= e.first;
    auto hp_edge= e.second;
    while(!bombs.empty() && bombs.front().first < x_edge){
      blast-= bombs.front().second;
      bombs.pop();
    }
    hp_edge-= blast;
    if(hp_edge > 0){
      int n_diff= ceiling_div(hp_edge, A);
      ans+= n_diff;
      blast+= A*n_diff;
      bombs.push(make_pair(x_edge+2*D, A*n_diff) );
    }
    else continue;
  }

  cout << ans << endl;
}

Measured memory_bytes: 2688
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] tmp = new int[n];
        
        for(int i=0; i<n-1; i++){
            int j = sc.nextInt();
            tmp[j-1]++;
        }
        
        for(int i : tmp){
            System.out.println(i);
        }
    }
}

Measured memory_bytes: 61540
#include <stdio.h>
#include <string.h>
 
int main()
{
	long a[5] = {0,0,0,0,0};
	int N;
	scanf("%d",&N);
	int k;
	for(k = 0; k < N; k++)
	{
		char s[10];
		scanf("%s",s);
		if(s[0] == 'M')  a[0]++;
		if(s[0] == 'A')  a[1]++;
		if(s[0] == 'R')  a[2]++;
		if(s[0] == 'C')  a[3]++;
		if(s[0] == 'H')  a[4]++;
	}
	long O = 0;
	int u,n,ko;
	for(u=0; u<=2; u++)
	 {for(n=u+1; n<=3; n++)
	   {for(ko=n+1; ko<=4; ko++)
        {O += a[u]*a[n]*a[ko];
	}}}
	printf("%ld", O);
	return 0;
}


Measured memory_bytes: 128