akhauriyash/Code-Regression huggingface dataset:
#!venv/bin/python

N, K = [ int(x) for x in input().split() ]
#S = input()

ans = 0.0
for dice in range(1,N+1):
    cnt = 0
    p = dice
    while p < K:
        cnt += 1
        p *= 2
    ans += (1/N) * ((1/2) ** cnt)
print(ans)

Measured memory_bytes: 3060
n = int(input())
c = str(input())

cnt = 0

ans = "".join(sorted(c))
ans_ = list(ans)
ans_[-1] = "R"
ans_ = "".join(ans_)


cnt = 0
for i in range(n-1):
    if c[i] != ans[i]:
        cnt += 1
    
        
print(cnt//2 + cnt%2)

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

int abs(int x) {

    if (x < 0) {
        return -x;
    } else {
        return x;
    }
}

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }
    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum = sum + a.at(i);
    }

    int ans = 100000;
    int memo;
    for (int i = 0; i < N; i++) {
        if (ans > abs(a.at(i)*N-sum)) {
            ans = abs(a.at(i)*N-sum);
            memo = i;
        }
    }
    cout << memo << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var Q, H, S, D int
	var N int
	fmt.Scan(&Q, &H, &S, &D)
	fmt.Scan(&N)
	fmt.Println((N/2)*min(8*Q, 4*H, 2*S, D) + (N%2)*min(4*Q, 2*H, S))
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}


Measured memory_bytes: 512
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// 
int A, B;

int main(){
    cin >> A >> B;

    string ans = "No";
    rep(C, 1, 4){
        if((A*B*C)%2 != 0){
            ans = "Yes";
        }
    }

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




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <set>
#include <iterator>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


//int main()
//{
//	int a, b, c;
//	cin >> a >> b >> c;
//	vector<int> a(n);
//	int max_index=0;
//	int max = 0;
//	int temp_max = 0;
//	rep(i, n) {
//		cin >> a[i];
//		
//		max += a[i];
//		if (i>=k-1) {
//			if (max > temp_max) {
//				max_index = i - k + 1;
//				temp_max = max;
//			}
//			max -= a[i - k + 1];
//		}
//	}
//	//sort(a.rbegin(), a.rend());
//	float sum = 0;
//	rep(i, k) {
//		sum += float(a[max_index+i] + 1) / 2;
//	}
//	cout << sum << endl;
//	return 0;
//}

template<typename A, typename B>
std::pair<B, A> flip_pair(const std::pair<A, B> & p)
{
	return std::pair<B, A>(p.second, p.first);
}

template<typename A, typename B>
std::multimap<B, A, std::greater<ll>> flip_map(const std::map<A, B> & src)
{
	std::multimap<B, A, std::greater<ll>> dst;
	std::transform(src.begin(), src.end(), std::inserter(dst, dst.begin()),
		flip_pair<A, B>);
	return dst;
}


int main()
{
	ll n;
	cin >> n;
	map<string, ll> a;
	rep(i, n) {
		string input;
		cin >> input;
		decltype(a)::iterator it = a.find(input);
		if (it != a.end()) { // 見つかった
			++it->second;
		}
		else {
			a.insert(std::make_pair(input, 1));
		}
	}
	std::multimap<ll, string,std::greater<ll>> dst = flip_map(a);

	ll count = 0;
	std::multimap<string, ll> b;
	for (auto d : dst) {
		if (count == 0) {
			count = d.first;
			b.insert(std::make_pair(d.second,d.first));
		}
		else if (count == d.first) {
			b.insert(std::make_pair(d.second, d.first));
		}
		else {
			break;
		}
	}
	for (auto ans : b) {
		cout << ans.first << endl;
	}
	return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n, m;
    cin >> n >> m;

    cout << (n - 1) * (m - 1) << endl;

    return 0;
}

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

int main() {
  int A,B;
  cin >> A >>B;
  
    cout << (B+A-3)/(A-1)<<endl;
}


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

class Program
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var X = line[0];
        var Y = line[1];
        var Z = line[2];
        var K = line[3];
        var A= Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var B= Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var C = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).OrderByDescending(x=>x).ToArray();
        var array = new long[X * Y];
        var index = 0;
        for (int i=0;i<X;++i)
        {
            for (int j=0;j<Y;++j)
            {
                array[index] = A[i] + B[j];
                index++;
            }
        }
        Array.Sort(array);
        Array.Reverse(array);
        var arrayLength = Math.Min(K, X * Y);
        var arrayAll = new long[arrayLength * Z];
        index = 0;
        for (int i=0;i<arrayLength;++i)
        {
            for (int j=0;j<Z;++j)
            {
                arrayAll[index] = array[i] + C[j];
                index++;
            }
        }
        Array.Sort(arrayAll);
        Array.Reverse(arrayAll);
        index = 0;
        foreach (var ans in arrayAll)
        {
            Console.WriteLine(ans);
            if (K <= ++index) break;
        }
    }
}

Measured memory_bytes: 45152
#include<bits/stdc++.h>
 
using namespace std;
 
int64_t m = 2019;
 
int main()
{
    int64_t l,r;
    cin>>l>>r;
    if(l==0)
    {
        cout<<"0"<<endl;
        return 0;
    }
    int64_t gap= r - l + 1 ;
 
    if(gap>=2019)
    {
        cout<<"0"<<endl;
        return 0;
    }
    else
    {
        int64_t ans=0x3f3f3f3f;
        for(int64_t i=l;i<=r;i++)
        {
            for(int64_t j=i+1;j<=r;j++)
            {
               ans=min(ans,(i*j)%2019);
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int f=0;
  while(n)
  {
    int d=n%10;
    if(d==7)
      f=1;
    n/=10;
  }
  if(f)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<math.h>
int po(long long a){
  long long int b = (int)pow(a,0.5);
  return (long long int)pow(b,2);
}

int main(){
  long long int n,i;
  scanf("%lld",&n);
  for(i = n;i > 0;i--){
    if(i == po(i)){
      printf("%lld",i);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(20000000)
#input = sys.stdin.readline
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    a = i + 0
    b = 1
    while a < k:
        b /= 2
        a*=2
    ans += (1/n)*b
print(ans)

Measured memory_bytes: 39408
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
template<typename T, typename E>
struct SkewHeap{
  typedef function<T(T, E)> F;
  typedef function<E(E, E)> G;
  typedef function<bool(T,T)> C;
  F f;
  G g;
  C c;
  E e;
  SkewHeap(F f,G g,C c,E e):f(f),g(g),c(c),e(e){}

  struct Node{
    Node *l,*r;
    T val;
    E add;
    Node(T val,E add):val(val),add(add){l=r=NULL;}
  };

  void eval(Node *a){
    if(a->add==e) return;
    if(a->l) a->l->add=g(a->l->add,a->add);
    if(a->r) a->r->add=g(a->r->add,a->add);
    a->val=f(a->val,a->add);
    a->add=e;
  }
  
  T top(Node *a){
    return f(a->val,a->add);
  }
  
  Node* push(T v){
    return new Node(v,e);
  }
  
  Node* meld(Node *a,Node *b){
    if(!a) return b;
    if(!b) return a;
    if(c(top(a),top(b))) swap(a,b);
    eval(a);
    a->r=meld(a->r,b);
    swap(a->l,a->r);
    return a;
  }
  
  Node* pop(Node* a){
    eval(a);
    auto res=meld(a->l,a->r);
    free(a);
    return res;
  }
  
};
//END CUT HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  using Heap=SkewHeap<int, int>;
  Heap::F f=[](int a,int b){return a+b;};
  Heap::G g=[](int a,int b){return a+b;};
  Heap::C c=[](int a,int b){return a<b;};

  Heap heap(f,g,c,0);
  auto base=heap.push(0);
  
  string s;
  while(cin>>s,s!="end"){
    int x;
    if(s=="insert"){
      cin>>x;
      base=heap.meld(base,heap.push(x));
    }
    if(s=="extract"){
      x=heap.top(base);
      base=heap.pop(base);
      cout<<x<<endl;
    }
  }
  return 0;
}
/*
  verified on 2018/02/08
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_C&lang=jp
*/



Measured memory_bytes: 34348
#include<iostream>
#include<string>
#include<cctype>
#include<stack>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;

ll s[55];

ll C(int n,int m)
{
    ll c;
    if(n<m)
        c=0;
    else if(n==m||m==0)
        c=1;
    else
    {
        c=1;
        n=n-m+1;
        for(int i=1;i<=m;i++)
        {
            c*=n++;
            c/=i;
        }
    }
    return c;
}

int main()
{
    int n;
    int a,b;
    cin>>n>>a>>b;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    sort(s,s+n,greater<ll>());
    ll ans=0;
    for(int i=0;i<a;i++)
        ans+=s[i];
    ll same=s[a-1];
    ll numa=0;
    for(int i=a-1;i>=0;i--)
        if(same==s[i])
            numa++;
    ll numb=0;
    for(int i=a;i<n;i++)
        if(same==s[i])
            numb++;
    ll lasf=0;
    if(numa==a)
    {
        for(int i=a;i<=b;i++)
        {
            lasf+=C(numa+numb,i);
        }
        printf("%.6f\n%lld\n",ans*1.0/a,lasf);
    }
    else
    {
        lasf+=C(numa+numb,numa);
        printf("%.6f\n%lld\n",ans*1.0/a,lasf);
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (){
  int a,b,c,x;
  x = 0;
  int y = 0;
  scanf("%d %d %d",&a,&b,&c);
  for(int x = a;x <= b;x++){
    if(c % x == 0)y++;
  }
  printf("%d\n",y);
  return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cout << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define inf 1000000000
#define mod 1000000007

const int max_n = 22;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}

int a[max_n][max_n];
int n;

int dp[max_n][(1 << max_n)];
int fun(int index , int mask){
    if(index == n){
        int num = (1 << n) - 1;
        if(num ^ mask == 0)return 1;
        return 0;
    }

    if(dp[index][mask] != -1)return dp[index][mask];
    int sum = 0;
    for(int i = 0 ; i < n ; i++){
        if(!(mask & (1 << i))){
            if(a[index][i]){
                sum = (sum + fun(index + 1 , mask | (1 << i)))%mod;
            }
        }
    }

    return dp[index][mask] = sum;
}
int main()
{
    speed;
    cin >> n;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
            cin >> a[i][j];
    memset(dp , -1 , sizeof(dp));
    cout << fun(0 , 0);
    return 0;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> l(N);
  for (int i = 0; i < N; i++){
    cin >> l.at(i);
  }
  int count = 0;
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());
  for (int i = 0; i < K; i++){
    count += l.at(i);
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

ll dp[MX][MX];
inline void chmax(ll& a, ll b) {
  a = max(a, b);
}

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0; i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main(){
    ll n; cin >> n;
    ll a = 0;
    ll b = 0;
    ll c = 0;
    ll d = 0;
    rep (i,n){
        string s;
        cin >> s;
        if (s == "AC") a++;
        else if (s == "WA") b++;
        else if (s == "TLE") c++;
        else if (s == "RE") d++;
    }
    
    
    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <valarray>
using namespace std;
int main()
{
    int num;
    while(cin>>num)
    {
        if(num==0)
            break;
        double a[num];
        double sum=0,STD=0;
        for(int i=0;i<num;i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        for(int i=0;i<num;i++){
            STD+=(a[i]-sum/num)*(a[i]-sum/num)/num;
        }
        cout<<setiosflags(ios::fixed)<<setprecision(10)<<sqrt(STD)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
ll N;

int main(){

    ll A;
    string S;
    string T;
    cin >> S >> T;

    ll ans = 0;
    if(S[0] == T[0]){
        ans++;
    }
    if(S[1] == T[1]){
        ans++;
    }
    if(S[2] == T[2]){
        ans++;
    }


    cout << ans << endl;
    

}

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

int main() {
  int ans;
  int K;
  
  cin >> K;
  if (K % 2 == 0) cout << K * K / 4 << endl;
  else cout << (K + 1) * (K - 1) / 4 << endl;  
}

Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
print('Yes' if len(set(s)) == 3 else 'No')















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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

class UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<int> size;
    vector<vector<int>> group;
public:
    UnionFind(int n = 1) {
        par.resize(n + 1);
        rank.resize(n + 1);
        size.resize(n + 1);
        group.resize(n + 1);
        for (int i = 0; i <= n; ++i) {
            par[i] = i;
            rank[i] = 0;
            size[i] = 1;
            group[i].push_back(i);
        }
    }

    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            int r = find(par[x]);
            return par[x] = r;
        }
    }

    bool is_same(int x, int y) {
        return find(x) == find(y);
    }

    bool unit(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) {
            return false;
        } else {
            if (rank[x] < rank[y]) {
                swap(x, y);
            }
            if (rank[x] == rank[y]) {
                ++rank[x];
            }
            par[y] = x;
            size[x] += size[y];
            return true;
        }
    }

    int get_size(int x) {
        return size[find(x)];
    }

    void merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (group[x].size() > group[y].size()) {
            swap(x, y);
        }
        copy(group[y].begin(), group[y].end(), back_inserter(group[x]));
        group[y].clear();
        par[y] = x;
    }
};

void Main() {
    ll N, M;
    cin >> N >> M;
    vector<P> items(M);
    rep(i, M) {
        ll u, v;
        cin >> u >> v;
        u--;
        v--;
        items[i] = make_pair(u, v);
    }
    ll ans = 0;
    rep(i, M) {
        UnionFind unionFind(N);
        rep(j, M) {
            if (i == j) continue;
            unionFind.unit(items[j].first, items[j].second);
        }
        bool ok = true;
        rep(j, N) {
            rep(k, N) {
                if (!unionFind.is_same(j, k)) ok = false;
            }
        }
        if (!ok) ans++;
    }
    cout << ans << '\n';
}

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


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

int GetDigitSum(int N) {
  int sum = 0;
  while (N) {
    sum += N % 10;
    N /= 10;
  }
  return sum;
}

int main() {
  
  int N; cin >> N;
  
  int tmp = GetDigitSum(N);
  
  if (N % tmp == 0) cout << "Yes" << endl;
  
  else cout << "No" << endl;
  
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

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

    int a[3];

    cin >> a[0] >> a[1] >> a[2];

    sort(a, a + 3);

    Out(a[2] * 10 + a[1] + a[0]);

    return 0;
}


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

int main(){
	//int a;
	int M_h[10];
	for(int i=0;i<10;++i){
		cin>>M_h[i];
	}
	sort(M_h,M_h+10);
	for(int i=9;i>=7;--i){
		cout<<M_h[i]<<endl;
	}
	//cin>>a;
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
int main(){
string S,T;
  cin>>S>>T;
  int sum=0;
  for(int i=0;i<3;i++)
    if(S.at(i)==T.at(i))
      sum++;
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
n = int(input())

list_p = []
for i in range(1, int(n**0.5)+1):

    j = n / i

    if j.is_integer():
        list_p.append([i, j, i+j])

list_sorted = sorted(list_p, key=itemgetter(2))
print(int(list_sorted[0][0] + list_sorted[0][1] - 2))


Measured memory_bytes: 3700
/*
 Educational Dp Contest Atcoder
 
 */

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define all(x) x.begin(),x.end()

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}

const ll MOD =998244353;
const ll hell=1000000007;
const int INF=1e16;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

const int N=100005;
int dp[N];
int a[101];
void solve()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    //dp[0]=0;
    //dp[0][1]=1;
    for(int i=1;i<=k;i++)
    {
        for(int j=1;j<=n;j++)
            if(a[j]<=i)
            {
                if(!dp[i-a[j]])
                {
                    dp[i]=1;
                    break;
                }
            }
        
    }
    if(dp[k])
    {
        cout<<"First"<<endl;
    }
    else
        cout<<"Second"<<endl;
    
}

int32_t main()
{
    
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

const int N=2e5+10;

int a[N];

inline bool cmp(const int &x, const int &y){
	return x>y;
}

int main(){
	int n; scanf("%d",&n);
	int s=0;
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]),s+=a[i];
	sort(a+1,a+n+1,cmp);
	if (a[n]>0){
		s-=a[n]*2;
		printf("%d\n",s);
		int t=a[n];
		for (int i=2;i<n;i++){
			printf("%d %d\n",t,a[i]);
			t=t-a[i];
		}
		printf("%d %d\n",a[1],t);
	}else if (a[2]<0){
		s=a[1]*2-s;
		printf("%d\n",s);
		int t=a[1];
		for (int i=2;i<=n;i++){
			printf("%d %d\n",t,a[i]);
			t-=a[i];
		}
	}else{
		int k=1;
		while (k<n&&a[k]>=0) k++;
		s=0;
		for (int i=1;i<=n;i++)
			s+=abs(a[i]);
		printf("%d\n",s);
		int t=a[k];
		for (int i=2;i<k;i++){
			printf("%d %d\n",t,a[i]);
			t-=a[i];
		}
		printf("%d %d\n",a[1],t);
		t=a[1]-t;
		for (int i=k+1;i<=n;i++){
			printf("%d %d\n",t,a[i]);
			t-=a[i];
		}
	}
	return 0;
}


Measured memory_bytes: 2304
N = int( input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    if A[i] == B[i] and B[i] == C[i]:
        continue
    if A[i] == B[i] or B[i] == C[i] or C[i] == A[i]:
        ans += 1
    else:
        ans += 2
print( ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string n;
    cin>>n;
    int flag=0;
    for (int i=0;i<n.size();i++) {
        if (n.at(i)=='9') {
            cout<<"Yes"<<endl;
            flag=1;
            break;
        }
    }
    if (flag==0) {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

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

	for (int i = 0; i < a * b; i += a){
		if (i % b == c){
			cout << "YES" << endl;
			return 0;
		}
	}


	cout << "NO" << endl;
}


Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AC_ItoHC
{
    class Program
    {
        static int numType = 26;
        int D;

        static void Main(string[] args) => new Program().Run();

        void Run()
        {
            D = int.Parse(Console.ReadLine());
            var c = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var s = new int[D][];
            for (int i = 0; i < D; i++)
            {
                s[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            }

            //for B
            var t = new int[D];
            for (int i = 0; i < D; i++)
            {
                t[i] = int.Parse(Console.ReadLine());
            }

            var ret = Solve();

            //for B
            Test(c, s, t);
        }

        private int[] Solve()
        {
            var ret = new int[numType];
            var r = new Random();
            for (int i = 0; i < numType; i++)
            {
                ret[i] = r.Next() % D + 1;
            }

            return ret;
        }

        private void Test(int[] c, int[][] s, int[] t)
        {
            var score = 0;
            var lastD = new int[numType];

            //Console.Error.WriteLine();
            for (int d = 0; d < D; d++)
            {
                for (int i = 0; i < numType; i++)
                {
                    lastD[i]++;
                    if (i == t[d] - 1) lastD[i] = 0;
                }

                score += s[d][t[d] - 1];

                for (int i = 0; i < numType; i++)
                {
                    score -= lastD[i] * c[i];
                }

                Console.WriteLine(score);
            }
        }
    }
}


Measured memory_bytes: 28840
#include <iostream>
#include <string>
#include <iomanip>

int main(int argc, char *argv[])
{
    int s, w;

    std::cin >> s >> w;

    if (w >= s) {
        std::cout << "unsafe" << std::endl;
    } else {
        std::cout << "safe" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3640
// atcoder/abc115/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int k, n;
  while (cin >> n >> k) {
    vector<lli> a(n);
    cin >> a;
    sort(a.begin(), a.end());
    lli mn = 1LL << 60;
    for (int i = 0; i + k - 1 < a.size(); ++i) {
      setmin(mn, a[i + k - 1] - a[i]);
    }
    cout << mn << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;
class Main {
    class Node{
        long cost;
        int x;


       public Node(int x,long cost){
           this.x=x;
           this.cost=cost;

       }
    }
    //public static PrintWriter pw;
    public static PrintWriter pw = new PrintWriter(System.out);

    public static  void solve() throws IOException {
        //	pw=new PrintWriter(new FileWriter("C:\\Users\\shree\\Downloads\\small_output_in"));
        FastReader sc = new FastReader();
       char s[]=sc.next().toCharArray();
       int cnt=0;
       for(int i=0;i<s.length;i++) if(s[i]=='1') cnt++;
       pw.println(cnt);
        pw.close();
    }


    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                try {

                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();

    }

    static BufferedReader br;
    static long M = (long) 1e9 + 7;

    static class FastReader {

        StringTokenizer st;

        public FastReader() throws FileNotFoundException {
            //br=new BufferedReader(new FileReader("C:\\Users\\shree\\Downloads\\B-small-practice.in"));
            br = new BufferedReader(new InputStreamReader(System.in));

        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int I() {
            return Integer.parseInt(next());
        }

        long L() {
            return Long.parseLong(next());
        }

        double D() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public boolean hasNext() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return false;
                }
                st = new StringTokenizer(s);
            }
            return true;
        }

    }
}

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

int main(){
    int color[8];
    int any = 0;
    rep(i,8){
        color[i]=0;
    }
    int n;
    cin >> n;
    vi a(n);
    rep(i,n){
        cin >> a[i];
    }

    rep(i,n){
        if(a[i]>=3200) any++;
        else if(a[i]>=2800)color[7] = 1;
        else if(a[i]>=2400)color[6] = 1;
        else if(a[i]>=2000)color[5] = 1;
        else if(a[i]>=1600)color[4] = 1;
        else if(a[i]>=1200)color[3] = 1;
        else if(a[i]>=800)color[2] = 1;
        else if(a[i] >=400) color[1] = 1;
        else color[0] = 1;
        
        
        
        
        
        
        

    }
    int ans = 0;
    rep(i,8){
        ans+=color[i];
    }
    int ans_max = ans+any;
    if(ans==0) ans=1;
    cout<<ans<<" "<<ans_max<<endl;

}

Measured memory_bytes: 256
from heapq import heappop,heappush,heapify
 
N,M = map(int,input().split())
A = [int(x) for x in input().split()]
 
A_minus = [-x for x in A]

# priority queue を使う
# 最小値を取り出す、要素を挿入する
heapify(A_minus)

for _ in range(M):
    tmp_min = heappop(A_minus)
    tmp_min = (-1)*(-tmp_min//2)
    heappush(A_minus,tmp_min)
    
print(-sum(A_minus))

Measured memory_bytes: 14180
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}


static void B_task()
{
	char S[101] = { 0 };

	getstring(S);
	for (int i = 0; S[i] != 0; i++) {
		S[i] = 'x';
	}
	printf("%s\n", S);
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<int,int>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	ll ans = INF;
	REP(i,s.size() - 2) {
		string t = s.substr(i,3);
		ans = min(ans,abs(stol(t) - 753LL));
	}
	cout << ans << endl;
	return 0;
}

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


Measured memory_bytes: 256
N = int(input())
s = list(list(input()) for i in range(N))
for i in range(N):
    s[i].sort()
s.sort()
ans = 0
same = 1
for i in range(1,N):
    if s[i] == s[i-1]:
        ans += same
        same += 1
    else:
        same = 1
print(ans)

Measured memory_bytes: 26308
#include<stdio.h>
int main(){
    char num[1001];
    while(true){
        int sum=0;
        scanf("%s",&num);
        if(num[0]=='0') break;
        for(int i=0;num[i]!='\0';i++){
            sum += num[i]-'0';
        }
        printf("%d\n",sum);
    }
    return 0;
}



Measured memory_bytes: 2664
#include<stdio.h>
#include<stdlib.h>
#include<memory.h>

int main(){
	int n,i,j,r,max=0;
	char* ptr;
	while(scanf("%d",&n)!=EOF){
		ptr=(char*)malloc(sizeof(char)*(n+1));
		memset(ptr,'1',n+1);
		for (i = 2; i * i <= n; i++)  
	    {  
	        if (ptr[i]=='1')  
	        {  
	            for (j = i * i; j <= n; j += i)  
	                ptr[j]='0';
	        }  
	    }  
	    for (i=2,r=0;i<=n;i++){
	    	if(ptr[i]=='1') r+=1;
	    }
		
		free(ptr);

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

	return 0;
}

Measured memory_bytes: 1652
a,b,c,d=map(int,input().split())
if c%b==0:
  tak = c/b
elif c/b<1:
  tak = 1
else:
  tak = c//b +1
if a%d ==0:
  ai = a/d
elif a/d<1:
  ai = 1
else:
  ai=a//d +1
if tak<=ai:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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; }

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

    int N; cin >> N;
    int cnt = 0;
    rep1(i,N+1) {
        string s = to_string(i);
        if(s.size() % 2 == 1) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define F first
#define S second

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;

// Graph problem
using Graph = vector<vector<int>>;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

// solve

int main()
{
    int R;
    cin >> R;
    double ans = 2 * R * M_PI;
    printf("%.6lf\n", ans);
    return 0;
}


Measured memory_bytes: 3760
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
import math

n, d = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]
ans = 0

for j in range(n):
    n = List[j][0]
    m = List[j][1]
    if d >= math.sqrt(math.pow(n, 2) + math.pow(m, 2)):
        ans += 1

print(ans)


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

int main(){
    ll a;
    long double b;
    cin >> a >> b;
    ll bb = round(b*100);
    ll ans = a*bb;
    cout << ans/100 << endl;
    return 0;
}

Measured memory_bytes: 3784
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = Integer.MIN_VALUE;
		int sum = 0;

		for (int i = 0; i < N; i++) {
			int p = sc.nextInt();
			if (max < p) max = p;
			sum += p;
		}

		System.out.println(sum - max / 2);
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, k, a[N];
bool check(int b){
  ll s = 0;
  FOR(i, 0, n) s += a[i]/b;
  return s <= k;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  FOR(i, 0, n) cin >> a[i], a[i]--;
  int ng=0, ok=1e9, mid;
  while(ok-ng > 1){
    mid = (ok+ng)/2;
    (check(mid) ? ok : ng) = mid;
  }
  cout << ok << endl;
}

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

struct UnionFind{
    vector<int> data;

    UnionFind(int N) : data(vector<int>(N,-1)){}

    int root(int x){
        if(data[x] < 0){
            return x;
        }else{
            return data[x] = root(data[x]);
        }
    }

    bool same(int x,int y){
        return root(x) == root(y);
    }

    void unite(int x,int y){
        if(!same(x,y)){
            x = root(x);
            y = root(y);
            if(data[x] < data[y]){
                data[x] += data[y];
                data[y] = x;
            }else{
                data[y] += data[x];
                data[x] = y;
            }
        }
        return;
    }

};

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

void solve(int w,int h){
    swap(w,h);
    int c[w][h];
    for(int i = 0;i < w;i++){
        for(int j = 0;j < h;j++){
            cin >> c[i][j];
        }
    }
    UnionFind uf(w*h);
    for(int i = 0;i < w;i++){
        for(int j = 0;j < h;j++){
            for(int k = 0;k < 8;k++){
                int x = i + dx[k];
                int y = j + dy[k];
                if(0 <= x && x < w && 0 <= y && y < h){
                    if(c[i][j] && c[x][y]){
                        uf.unite(i*h+j,x*h+y);
                    }
                }
            }
        }
    }
    set<int> s;
    for(int i = 0;i < w*h;i++)s.insert(uf.root(i));
    int ans = 0;
    for(auto x:s){
        ans += c[x/h][x%h];
    }
    cout << ans << endl;
}

int main(){
    int w,h;
    while(true){
        cin >> w >> h;
        if(!w && !h)return 0;
        solve(w,h);
    }
}


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

using ll = long long;
using P = pair<int, int>;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int cnt[100010];

int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;

  // 前処理で累積和計算
  for (int i = 1; i < s.size(); i++) {
    cnt[i] = cnt[i-1];
    if (s[i-1] == 'A' && s[i] == 'C') {
      cnt[i]++;
    }
  }

  while (Q--) {
    int l, r;
    cin >> l >> r;

    cout << cnt[r-1] - cnt[l-1] << endl;
  }

  return 0;
}


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

using namespace std;
bool v[200005];
unordered_set<int> r[200005];
int re = 0;

void dfs(int u){
    if(v[u])
        return;
    ++re;
    v[u] = true;
    for(auto it = r[u].begin(); it != r[u].end(); ++it)
        if(!v[*it])
            dfs(*it);
    return;
}

int main(){
    int n, m;
    cin >> n >> m;
    int p, q;
    for(int i = 0; i < m; ++i){
        cin >> p >> q;
        r[p].insert(q);
        r[q].insert(p); 
    }
    int ans = 0;
    for(int i = 1; i <= n; ++i)
        if(!v[i]){
            re = 0;
            dfs(i);
            if(re > ans)
                ans = re;
        }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 39672
def is_ok(line)
  line.size.times do |i|
    i.upto(line.size) do |j|
      s = line[0...i] + line[j..-1]
      if s == 'keyence'
        return true
      end
    end
  end
  return false
end

l = gets.chomp
puts is_ok(l) ? "YES" : "NO"


Measured memory_bytes: 1916
#include<iostream>
#include<queue>
#include<map>
#define LEN 100
#define BASE 25

using namespace std;

int maps[LEN][LEN];
int off[LEN][LEN];

int checker[4];
int ncheck[4];

map<int, int> points[LEN];

class State {
public:
	char where;
	int enemy;
	int budget;
	int check[4];
	State() {check[0]=0;check[1]=0;check[2]=0;check[3]=0;}
	State(char w, int e, int b ) {
		where = w;
		enemy = e;
		budget = b; 
		check[0] = ncheck[0];
		check[1] = ncheck[1];
		check[2] = ncheck[2];
		check[3] = ncheck[3];
	}
};


inline bool operator< ( const State& a, const State& b) {
	if( a.enemy == b.enemy )
		return a.budget > b.budget;
	return a.enemy < b.enemy;
}

inline bool operator> ( const State& a, const State& b) {
	if ( a.enemy == b.enemy )
		return a.budget < b.budget;
	return a.enemy > b.enemy;
}

priority_queue<State, vector<State>, greater<State> > status;

inline void copy ( State now ) {
	checker[0] = now.check[0];
	checker[1] = now.check[1];
	checker[2] = now.check[2];
	checker[3] = now.check[3];
}

inline void ncopy ( ) {
	ncheck[0] = checker[0];
	ncheck[1] = checker[1];
	ncheck[2] = checker[2];
	ncheck[3] = checker[3];
}

inline bool check ( int i ) {
	return 0 == ((1<<(i%25)) & checker[i/BASE]);
}

inline void add ( int i ) {
	ncheck[i/BASE] = ((1<<(i%25)) | checker[i/BASE]);
}

inline void insert ( int i, int e, int b ) {
	
	map<int,int>::iterator itr = points[i].find(e);
	if ( itr == points[i].end() ) {
		points[i][e] = b;
		status.push(State(i,e,b));
	} else if ( (*itr).second < b ) {
		(*itr).second = b;
		status.push(State(i,e,b));
	}
}

int main () {


	while ( true ) {
		int n,m,l;
		cin >> n >> m >> l;

		if ( n == 0 )
			break;

		for ( int i=0; i<n; i++ ) {
			for ( int j=0; j<n; j++ ) {
				maps[i][j] = -1;
				off[i][j] = 0;
			}
			points[i].clear();
		}

		for ( int i=0; i<m; i++ ) {
			int a,b,d,e;
			cin >> a >> b >> d >> e;

			maps[a-1][b-1] = maps[b-1][a-1] = d;
			off[a-1][b-1] = off[b-1][a-1] = e;
		}

		for ( int i=0; i<4; i++ ) {
			ncheck[i] = 0;
			checker[i] = 0;
		}

		priority_queue<State, vector<State>, greater<State> > empty;
		status = empty;

		ncheck[0] = 1;
		status.push(State(0,0,l));
		int count = 0;
		while(!status.empty()) {
			State now = status.top();
			status.pop();
			if ( now.where == n-1 ) {
				cout << now.enemy << endl;
				break;
			}

			copy(now);

			for ( int i=0; i<n; i++ ) {
				if ( maps[now.where][i] > 0 ) {
					if ( check( i ) ) {
						ncopy();
						add(i);
						int e, b;
						if ( off[now.where][i] == 0 ) {
							e = now.enemy;
							b = now.budget;
							insert(i,e,b);
						} else {
							if ( now.budget - maps[now.where][i] >= 0 ) {
								e = now.enemy;
								b = now.budget - maps[now.where][i];
								insert(i,e,b);
							}
							e = now.enemy + off[now.where][i];
							b = now.budget;
							insert(i,e,b);
						}
					}
				}
			}
		}
	}
}

		

Measured memory_bytes: 2356