jiahuimbzuai/CoQuIR huggingface dataset:
//  [c]
#include <stdio.h>
int main(void){
char s[20];
  int count;
  int kazoe=0;
  int max=0;
  scanf("%s",&s);
  for(count=0;s[count]!='\0';count++){
  if(s[count]=='A'||s[count]=='C'||s[count]=='G'||s[count]=='T'){kazoe++;}
    else if(kazoe>=max){max=kazoe;kazoe=0;}
    else{kazoe=0;}
  }
  if(kazoe>=max){max=kazoe;kazoe=0;}
  printf("%d",max);
return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
	char s[11];
	int i = 0, cnt = 0, max = 0;
	
	scanf("%s", s);
	
	while (s[i]) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G')
			cnt++;
		else {
			if (cnt > max)
				max = cnt;
			cnt = 0;
		}
		i++;
	}
		
	if (cnt > max)
		max = cnt;
	
	printf("%d", max);
		
	return 0;
}
//  [c]
#include<stdio.h>
int main(){
  int i,c=0,m=0;
  char s[5]={"ACGT"};
  while(~scanf("%c",&s[4])){
    for(i=0;s[4]-s[i];i++);
    if(i==4)c=0;
    else    c++;
    if(m<c)m=c;
  }
  printf("%d\n",m);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int ans = 0;

void a(int count){
    if (count > ans){
        ans = count;
    }
}

int main(){
    char str[12];
    
    scanf("%s", &str);
    
    int idx = 0;
    
    int count = 0;

    while(str[idx] != '\0'){
        switch(str[idx]){
            case 'A':
            case 'C':
            case 'T':
            case 'G':
                count++;
                break;
            default:
                a(count);
                count = 0;
        }
        idx++;
    }
    
    if (count > ans){
        ans = count;
    }
    
    printf("%d", ans);
        
    return 0;
}
//  [c]
#include <stdio.h>

int main(void) {
    char s[11];
    int len = 0;
    int max_len = 0;

    scanf("%s", s);

    for (int i = 0; i <= 10; ++i) {
        switch (s[i]) {
            case 'A':
            case 'C':
            case 'G':
            case 'T':
                len = 1;
                for (int j = i + 1; j <= 10; ++j) {
                    switch (s[j]) {
                        case 'A':
                        case 'C':
                        case 'G':
                        case 'T':
                            len++;
                            break;
                        default:
                            if (len > max_len) {
                                max_len = len;
                            }
                            len = 0;
                            break;
                    }
                    if (len == 0) break;
                }
                break;
            default:
                break;
        }
    }

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

    return 0;
}
//  [c]
/* ex 5_4
   TKC001 */

#include <stdio.h>
#include <string.h>

int main(void){

    char str[11], *p_str;
    int max = 0, len, i, j;
    //入力
    scanf("%s", &str[0]);

    p_str = str;

    while (*p_str != 0){
        //strのx文字目かからの文字列の長さ(xは繰り返しの回数)
        len = strlen(p_str);

        for (i = len; i > 0; i--){
            //x文字目からi-1文字目までがすべてATGCで構成されているか調べる。
            for (j = 0; j < i; j++){
                if(*(p_str+j) != 'A' && *(p_str+j) != 'T' && *(p_str+j) != 'G' && *(p_str+j) != 'C') break;
                if(j+1 > max) max = j+1;//breakされないときはx文字目からj文字目まで全てATGCで構成されている。
                }            
        }
        //xを増やす
        p_str++;
    }
    
    //出力
    printf("%d", max);

    return 0;
}
//  [javascript]
'use strict';
console.log(function(args){
  const S = args.trim();
  let count = 0, max = 0;
  for ( let i = S.length-1; i >= 0; i-- ) {
    switch( S[i] ) {
      case 'A':
      case 'C':
      case 'G':
      case 'T':
        max = Math.max(++count,max);
        break;
      default:
        count = 0;
    }
  }
  return max.toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    var s = input[0];
       var acgt='ACGT';
      var cnt = 0;cnt2 = 0;
    for(i=0;i<s.length;i++){
      　　var q =s.substr(i,1)
         var result = acgt.indexOf(q);
                if(result >=0){cnt = cnt+1;
                        }
           else if(cnt>cnt2){var cnt2=cnt;var cnt = 0;
                              }
                       else{ var cnt = 0;}
                   }
       
        if(cnt>cnt2){var cnt2=cnt;};      
        console.log(cnt2) ;
   
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    s = input[0];
    var i,k,count,ans=0;
    for(i=0; i<s.length; i++) {
        count=0
        for(k=i; k<s.length; k++) {
            if(s[k]=='A'||s[k]=='C'||s[k]=='G'||s[k]=='T')count++;
            else break;
        }
        ans=Math.max(ans,count);
    }
    console.log(ans);
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));
//  [javascript]
S = require('fs').readFileSync('/dev/stdin', 'utf8');
N = M = 0;

S.split('').map(char => {
	if ('ACGT'.includes(char)) {
		N ++;
	} else {
		if (N > M) M = N;
		N = 0;
	}
});

console.log(M);
//  [javascript]
input = require("fs").readFileSync("/dev/stdin", "utf8");
ans = 0;
input = input.split("");
ACGT = ['A','C','G','T'];
kar = 0;
for(i = 0; i < input.length; i++){
    t = true;
    for(j = 0; j < 4; j++){
        if(input[i] === ACGT[j]){
            kar++;
            t = false;
            break;
        }
    }
    if(t){
        ans = Math.max(kar,ans);
        kar = 0;
    }
}
console.log(ans);
//  [javascript]
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};module.exports=I;

function main(input) {
  const o = new I(input, String);

  const S = o.a();

  let largest = 0;
  let count = 0;
  for (let i = 0; i < S.length; i++) {
    let cur = S[i];
    if ("ATCG".includes(cur)) {
      count += 1;
    } else {
      if (count > largest) {
        largest = count;
      }
      count = 0;
    }
  }

  if (count > largest) {
    largest = count;
  }

  console.log(largest);
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import "fmt"

func main() {
	var S string
	fmt.Scanf("%s", &S)
	N := len(S)
	flags := make([]bool, N)
	for i := range flags {
		if S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T' {
			flags[i] = true
		}
	}

	maxLen := 0
	ll := 0
	for _, v := range flags {
		if v {
			if ll != 0 {
				ll++
			} else {
				ll = 1
			}
			if ll > maxLen {
				maxLen = ll
			}
		} else {
			ll = 0
		}
	}
	fmt.Println(maxLen)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	res, cnt := 0, 0
	for _, c := range s {
		if c == 'A' || c == 'C' || c == 'G' || c == 'T' {
			cnt += 1
			if cnt > res {
				res = cnt
			}
		} else {
			cnt = 0
		}
	}

	fmt.Println(res)
}
//  [go]
package main

import (
	"bufio"
	"errors"
	"fmt"
	"os"
	"strings"
)

func lib_MaxInt(values ...int) (max int, err error) {
	if len(values) == 0 {
		return 0, errors.New("empty slice is given")
	}
	max = values[0]
	for _, value := range values {
		if max < value {
			max = value
		}
	}
	return
}
func lib_MustMaxInt(values ...int) (max int) {
	max, err := lib_MaxInt(values...)
	if err != nil {
		panic(err)
	}
	return max
}
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var S string
	scanner.Scan()
	S = scanner.Text()
	fmt.Println(solve(S))
}
func solve(S string) int {
	maxCnt := 0
	for i, s := range S {
		cnt := 0
		if !strings.ContainsRune("ACGT", s) {
			continue
		}
		for _, s2 := range S[i:] {
			if strings.ContainsRune("ACGT", s2) {
				cnt++
			} else {
				break
			}
		}
		maxCnt = lib_MustMaxInt(maxCnt, cnt)
	}
	return maxCnt
}
//  [go]
package main

import (
        "fmt"
)

func solution(s string) int {
        l := len(s)
        out := 0
        for i := 0; i <= l; i++ {
                for j := i + 1; j <= l; j++ {
                        t := s[i:j]
                        if isACGT(t) {
                                out = max(out, len(t))
                        }
                }
        }
        return out
}

func max(x, y int) int {
        if x > y {
                return x
        }
        return y
}

func isACGT(s string) bool {
        for _, r := range s {
                if r == 'A' || r == 'C' || r == 'G' || r == 'T' {
                        continue
                } else {
                        return false
                }
        }
        return true
}

func main() {
        var s string
        fmt.Scan(&s)
        fmt.Println(solution(s))
}
//  [go]
package main

import (
        "fmt"
)

func solution(s string) int {
        max := func(x, y int) int {
                if x > y {
                        return x
                }
                return y
        }

        isACGT := func(s string) bool {
                for _, r := range s {
                        if !(r == 'A' || r == 'C' || r == 'G' || r == 'T') {
                                return false
                        }
                }
                return true
        }

        l := len(s)
        out := 0
        for i := 0; i <= l; i++ {
                for j := i + 1; j <= l; j++ {
                        t := s[i:j]
                        if isACGT(t) {
                                out = max(out, len(t))
                        }
                }
        }
        return out
}

func main() {
        var s string
        fmt.Scan(&s)
        fmt.Println(solution(s))
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	var n = len(s)
	var t = []byte{'A', 'G', 'C', 'T'}
	var cnt = 0
	var ans = 0
	for i := 0; i < n; i++ {
		if contains(s[i], t) {
			cnt++
		} else {
			ans = max(ans, cnt)
			cnt = 0
		}
	}
	ans = max(ans, cnt)
	fmt.Print(ans)
}

func max(a int, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func contains(b byte, t []byte) bool {
	for i := range t {
		if b == t[i] {
			return true
		}
	}
	return false
}
//  [ruby]
S = gets.chomp.scan(/[ACGT]+/)
max = 0

if S.length.zero?
  puts 0
else
  S.each do |s|
    max = s.length if s.length > max
  end
  
  puts max
end
//  [ruby]
S = gets.chomp
n = S.length
a = 0
b = 0

for i in 0..n do
  if S[i] == "A" || S[i] == "T" || S[i] == "G" || S[i] == "C"
    a += 1
  else
    if a > b
      b = a
      a = 0
    end
  end
end
puts b
//  [ruby]
S = gets.chomp!

max_num = 0
count = 0
S.chars {|ch|
  case ch
  when 'A','T','G','C' then
    count += 1
  else
    max_num = [max_num, count].max
    count = 0
  end
}

max_num = [max_num, count].max
print max_num
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

max_count = 0
count = 0
S.split('') do |s|
  if ['A', 'C', 'G', 'T'].include?(s)
    count += 1
    max_count = count if count > max_count
  else
    count = 0
  end
end

puts max_count
//  [ruby]
def main
  s = gets.chomp
  i = 0
  j = 0
  cnt = 0
  max = 0
  until s[j].nil?
    if ['A', 'T', 'G', 'C'].include? s[j]
      cnt += 1
      max = cnt if cnt > max
      j += 1
    else
      i = j + 1
      j = j + 1
      cnt = 0
    end
  end
  puts max
end

main
//  [ruby]
s=gets.chomp

n=s.length
n.downto(1) do |i|
    (n-i+1).times do |j|
        if s[j,i].count("ACGT")==i
            puts i
            return
        end
    end
end
puts 0
//  [rust]
fn solve(s: String) -> u8 {
    let mut tmp = 0;
    let mut result = 0;
    let v = vec!('A', 'C', 'G', 'T');

    for c in s.chars() {
        if v.contains(&c) {
            tmp += 1;
        } else {
            result = std::cmp::max(result, tmp);
            tmp = 0;
        }
    }

    std::cmp::max(result, tmp)
}

fn main() {
    let s = read_1();

    println!("{}", solve(s));
}

fn read_1() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}
//  [rust]
use std::io;

fn atcgsize(s: &String, i: usize) -> usize {
    let mut len = 0;
    for c in s.chars().skip(i) {
        if c == 'A' || c == 'T' || c == 'C' || c == 'G' {
            len += 1;
        } else {
            break;
        }
    }
    len
}

fn solve(s: &String) -> usize {
    (0..s.len()).map(|i| atcgsize(s, i)).max().unwrap()
}

#[test]
fn test_solve() {
    assert_eq!(solve(&String::from("ATCODER")), 3);
    assert_eq!(solve(&String::from("HATAGAYA")), 5);
    assert_eq!(solve(&String::from("SHINJUKU")), 0);
}

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    println!("{}", solve(&input));
}
//  [rust]
use std::collections::HashSet;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let t: Vec<char> = s.trim().chars().collect();

    let mut set = HashSet::new();
    for c in "ACGT".chars(){
        set.insert(c);
    }

    let ans = t
        .split(|c| !set.contains(c))
        .map(|x| x.len())
        .max()
        .unwrap();
    println!("{}", ans);
}
//  [rust]
use proconio::{fastout, input, marker::Chars};

#[fastout]
fn main() {
    input!(s: Chars);

    let sss = vec!['A', 'C', 'G', 'T'];

    let mut count = 0;
    let mut count_max = 0;
    for v in &s {
        if sss.contains(v) {
            count += 1;
        } else {
            count_max = std::cmp::max(count_max, count);
            count = 0;
        }
    }
    count_max = std::cmp::max(count_max, count);

    println!("{}", count_max);
}
//  [rust]
use proconio::input;
use std::cmp::max;

fn main() {
    input! {
        s: String,
    }

    let mut res = 0;
    for i in 0..s.len() {
        for j in i + 1..s.len() + 1 {
            let mut f = true;
            for k in i..j {
                f = f
                    && match &s.chars().nth(k).unwrap() {
                        'A' => true,
                        'T' => true,
                        'G' => true,
                        'C' => true,
                        _ => false,
                    }
            }
            if f {
                res = max(res, j - i);
            }
        }
    }
    println!("{}", res);
}
//  [rust]
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        s: String
    }
    let acgt = ['A', 'C', 'G', 'T'];
    let mut max_len = 0;
    for i in 0..s.len() {
        let first = i;
        for k in 0..s.len() - i {
            let last = s.len() - k;

            let mut is_acgt = true;
            for idx in first..last {
                let elem = s.chars().nth(idx).unwrap();
                let mut has_acgt = false;
                for c in &acgt {
                    if elem == *c {
                        has_acgt =true;
                        break;
                    }
                }
                if !has_acgt {
                    is_acgt = false;
                    break;
                }
            }

            if is_acgt {
                let len = last - first;
                max_len = max_len.max(len);
            }
        }
    }
    println!("{}", max_len);
}
//  [swift]
import Foundation

extension String {
    func split(separator: String) -> [Int] {
        return self.componentsSeparatedByString(separator).map { Int($0)! }
    }
}

let S = readLine()!

var ans: [Int] = [0]
var i = 0
for c in S.characters {
    if c == "A" || c == "C" || c == "G" || c == "T" {
        ans[i] += 1
    } else {
        ans.append(0)
        i += 1
    }
}


print(ans.maxElement()!)
//  [typescript]
const main = (input) => {
  const strList = input.split('');
  const atcoderStrList = ['A', 'C', 'G', 'T'];
  let matchedNum = 0;
  let maxNum = 0

  strList.forEach(str => {
    if (atcoderStrList.indexOf(str) >= 0) {
      matchedNum += 1;
    } else {
      maxNum = Math.max(maxNum, matchedNum);
      matchedNum = 0;
    }
  });

  console.log(maxNum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
export class Main {
  static main(input): string {
    const s: string = input.split("\n")[0];
    let count: number = 0;
    let result: number = 0;
    let boo: boolean = false;
    for (let i = 0, len = s.length; i < len; i++) {
      const t: string = s.charAt(i);
      if (t == "A" || t == "C" || t == "G" || t == "T") {
        if (boo) {
          count++;
        } else {
          boo = true;
          count = 1;
        }
      } else {
        if (boo) {
          boo = false;
          if (count > result) {
            result = count;
          }
        }
      }
    }
    if (boo) {
      boo = false;
      if (count > result) {
        result = count;
      }
    }
    return `${result}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
import { readFileSync } from 'fs'


function main(input: string) {
  const list = input.split(/[^ACGT]+/g)

  console.log(Math.max(...list.map(v => v.length)))
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
namespace Coder {
  class Scanner {
    private buffer: string = '';
    private stdinQueue: any = [];

    constructor() {
      process.stdin.resume();
      process.stdin.setEncoding('utf8');
      process.stdin.on(
        'data',
        (chunk): void => {
          this.buffer += chunk;
          while (this.stdinQueue.length > 0) {
            const i = this.buffer.indexOf('\n');
            if (i < 0) {
              break;
            }
            let line = this.buffer.substr(0, i);
            if (line.endsWith('\r')) {
              line = line.slice(0, -1);
            }
            this.buffer = this.buffer.substr(i + 1);
            this.stdinQueue.shift()(line);
          }
        },
      );
    }
    public getLine(): Promise<string> {
      return new Promise((resolve, reject) => {
        const i = this.buffer.indexOf('\n');
        if (i >= 0 && this.stdinQueue.length === 0) {
          let line = this.buffer.substr(0, i);
          if (line.endsWith('\r')) {
            line = line.slice(0, -1);
          }
          this.buffer = this.buffer.substr(i + 1);
          resolve(line);
        } else {
          this.stdinQueue.push(resolve);
        }
      });
    }

    public close(): void {
      process.stdin.pause();
    }
  }

  async function solve() {
    const sc = new Scanner();
    const S = await sc.getLine();
    let ans = 0;
    for (let i = 0; i < S.length; i += 1) {
      for (let j = i; j < S.length; j += 1) {
        const t = S.substr(i, S.length - j);
        if (t.match(/[^AGCT]/) === null) {
          ans = Math.max(ans, t.length);
        }
      }
    }
    console.log(ans);
    sc.close();
  }

  solve();
}
//  [typescript]
  type Helix = "A" | "C" | "G" | "T";
  const HelixCouple: Helix[] = ["A", "T", "C", "G"];
  const HelixRegexp = new RegExp(`[${HelixCouple.join("")}]+`, "g");

  const entryPoint = function(args: string[]) {
    let maximamSize = 0;
    let matched: any[];
    while((matched = HelixRegexp.exec(args[0])) != null) {
      if (matched[0].length > maximamSize) maximamSize = matched[0].length;
    }
    console.log(maximamSize);
  }

  const getStandardInput = function() {
    process.stdin.resume();
    process.stdin.setEncoding('utf8');
    let inputString = '';
    process.stdin.on('data', function(chunk) {
        inputString += chunk;
    });
    process.stdin.on('end', () => entryPoint(inputString.split("\n")));
  }();
//  [typescript]
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const input = stdin.split('\n')[0]

const arr = input.split('')

let count = 0
let res = 0

arr.map(el => {
  if (el === 'A' || el === 'C' || el === 'G' || el === 'T') {
    count++
  } else {
    count = 0
  }

  if (count > res) {
    res = count
  }
})

console.log(res)
//  [python]
# coding: utf-8

def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    A = tuple(map(int, args[1].split()))

    l, r = 1, max(A)
    while 0.1 < r-l:
        m = (l+r)/2
        cnt = 0
        for a in A:
            cnt += -int(-a//m)-1

        if k < cnt:
            l = m
        else:
            r = m

    return str(-int(-l//1))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
//  [python]
from math import *

def trycut(val):
	ret = 0
	for i in range(n):
		ret += ceil(a[i]/val)-1
	return ret 

n,k=map(int,input().split())
a = [int(i) for i in input().split()]

low = 0
high = 1000000000
ans  =-1

while low <= high:
	mid = (low + high)/2
	cut = trycut(mid)
	# ~ print("low=",low, "high=", high,"val = ",mid,"ret = ",cut)
	if cut <= k:
		high = mid-0.0000001
		ans = mid
	else:
		low =  mid+0.0000001
	# ~ if low < high: print(low, high, "je reviens")
ans = int(ans*1000000)/1000000
# ~ print(ans)
print(int(ceil(ans)))
//  [python]
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

def possible(x):
    count = 0
    for a in A:
        if a <= x:
            return True
        count += int(ceil(a/x)) - 1
        if count > K:
            return False
    return True

def solve():
    lo, hi = 0, A[0]
    while lo < hi-1:
        mi = (hi + lo) // 2
        if possible(mi):
            hi = mi
        else:
            lo = mi
    return hi

if __name__ == "__main__":
    print(solve())
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// Shojin
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			long k = sc.nextLong();
			Long[] A = new Long[n];
			long tmp = 0;
			for (int i = 0; i < n; i++) {
				long next = sc.nextLong();
				A[i] = next;
				tmp += next;
			}
			final long sum = tmp;
			Arrays.sort(A, (x, y) -> x / ((x * k / sum) + 1) > y / ((y * k / sum) + 1) ? 1 : -1);
			if (k == 0) {
				System.out.println(A[n - 1]);
				return;
			}
			int[] cutCnt = new int[n];
			int cutCntSum = 0;
			for (int i = 0; i < n; i++) {
				long cnt = A[i] * k / sum;
				cutCnt[i] = (int) cnt;
				cutCntSum += (int) cnt;
			}
			long ans = 0;
			for (int i = n - 1; i >= 0; i--) {
				if (cutCntSum < k) {
					cutCnt[i]++;
					cutCntSum++;
				}
				if (cutCnt[i] == 0) {
					ans = Math.max(ans, A[i]);
					continue;
				}
				if (A[i] % cutCnt[i] == 0) {
					ans = Math.max(ans, A[i] / (cutCnt[i] + 1));
				} else {
					ans = Math.max(ans, A[i] / (cutCnt[i] + 1) + 1);
				}
			}
			System.out.println(ans);
		}
	}
}
//  [java]
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    List<Integer> logs = new ArrayList<>();
    //PriorityQueue<Double> logs = new PriorityQueue<>(Comparator.reverseOrder());
    for (int i = 0; i < n; i++) {
      logs.add(Integer.parseInt(sc.next()));
    }
    Collections.sort(logs);
    if (k == 0) {
      pw.println(logs.get(logs.size() - 1));
      return;
    }
    int max = logs.get(logs.size() - 1);
    int l = 0;
    int r = max;
    while (r - l > 1) {
      int m = (l + r) / 2;
      int kCandidate = 0;
      for (int j = 0; j < n; j++) {
        int a = logs.get(j);
        kCandidate += Math.ceil((double) a / m) - 1;
      }
      if (k >= kCandidate) {
        r = m;
      } else {
        l = m;
      }
    }
    pw.println(r);
  }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	long long K;
	cin >> N >> K;
	priority_queue<long long> que;
	for( int i = 0; i < N; i++ ) {
		long long A;
		cin >> A;
		que.push( A );
	}

	auto f = [&]( double t, priority_queue<long long> q )
	{
		long long k = 0;
		for( int i = 0; i < N; i++ ) {
			long long A = q.top();
			q.pop();
			long long n = ceil( A / t );
			k += n - 1;
		}
		return k;
	};
	double l = 0;
	double r = que.top();
	for( int i = 0; i < 100; i++ ) {
		double m = (l + r) / 2;
		long long k = f( m, que );
		if( k <= K ) r = m;
		else l = m;
	}
	long long ans = ceil( r );

	cout << ans << endl;
}
//  [cpp]
#include <bits/stdc++.h>

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x)(x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;

int solve(int k, set<int, std::greater<int>> st, map<int, int> ma){
  priority_queue<int> que;
  for(auto e : st) que.push(e);
  int e = que.top();
  while(!que.empty()){
    e = que.top(), que.pop();
    if(ma[e] == 0) continue;
    if(k < ma[e])  break;
    int half = e / 2 + e % 2;
    ma[half] += 2*ma[e];
    k -= ma[e];
    ma[e] = 0;
    que.push(half);
  }
  
  return e;
}

bool check(int m, set<int, std::greater<int>>& st, map<int, int>& ma, int k){
  int kk = 0;
  for(auto e : st) kk += ((e - 1) / m) * ma[e];
  return kk <= k;
}

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));

  map<int, int> ma;
  set<int, std::greater<int>> st;
  rep(i, n){
    ma[a[i]]++;
    st.insert(a[i]);
  }
  
  int l = 1;
  int r = solve(k, st, ma);

  while(l != r){
    int m = (l+r) / 2;
    if(check(m, st, ma, k)) r = m;
    else                    l = m;
    if(l+1 == r) break;
  }

  
  cout << ((check(l, st, ma, k))? l:r) << endl;

  return 0;
}
//  [cpp]
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 1;

#include <unistd.h>

bool test(int64_t tgt, vector<int64_t>& A, int64_t K) {
  int64_t c_tgt = tgt;
  auto gt_idx = A.begin();
  while (K >= 0) {
    gt_idx = upper_bound(gt_idx, A.end(), c_tgt);
    int64_t gt_tgt = A.end() - gt_idx;
    //cout << tgt << "," << gt_tgt << "," << K << "," << c_tgt << endl;
    if (gt_tgt == 0) break;
    K -= gt_tgt;
    c_tgt += tgt;
  }
  if (K >= 0) return true;
  else return false;
}

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

  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (auto& a : A) {
    cin >> a;
  }
  sort(A.begin(), A.end());
  int64_t tgt_min = 0;
  int64_t tgt_max = A[N-1];
  int64_t tgt_mid = tgt_max;
  int64_t res = tgt_mid;
  while (tgt_min < tgt_mid) {
    if (test(tgt_mid, A, K)) {
      res = min(res, tgt_mid);
      tgt_max = tgt_mid;
      //cout << tgt_mid << " is ok " << endl;
    } else {
      //cout << tgt_mid << " is NG " << endl;
      tgt_min = tgt_mid;
    }
    tgt_mid = (tgt_max + tgt_min) / 2;
  }
  
  cout << res << endl;

  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define MOD 1000000007
int n, k, a[200009];
LL check(int x) {
	LL ret = 0;
	rep(i, n)ret += (LL)ceill((Lf)a[i] / (Lf)x) - 1;
	return ret;
}

int main(void) {
	in("%d%d", &n, &k);
	rep(i, n)in("%d", &a[i]);
	int p = 0, q = MOD / 2, r = MOD, ans = n;
	while (r - p > 1) {
		if (check(q) <= (LL)k) r = q;
		else p = q;
		q = (p + r) / 2;
	}
	if (check(r) <= k)ans = r;
	if (check(q) <= k)ans = q;
	if (check(p) <= k)ans = p;
	printf("%d\n", ans ? ans : 1);
	return 0;
}
//  [c]
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x=n,i,j,c=0;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
LL nibtan(LL* a,LL n,LL x){LL p=0,q=n/2,r=n-1;while(r-p>1){if(x>=a[q])p=q;if(x<=a[q])r=q;q=(p+r)/2;}return a[p]==x?p:r;}
//snippet

#define N 200009

int n, k, a[N];

LL check(int x) {
	LL ret = 0;
	rep(i, n)ret += (LL)ceill((Lf)a[i] / (Lf)x) - 1;
	return ret;
}

void run(void) {
	//saw editorial
	in("%d%d", &n, &k);
	rep(i, n)in("%d", &a[i]);

	int p = 0, q = MOD / 2, r = MOD, ans = n;
	while (r - p > 1) {
		if (check(q) <= (LL)k) r = q;
		else p = q;
		q = (p + r) / 2;
	}
	if (check(r) <= k)ans = r;
	if (check(q) <= k)ans = q;
	if (check(p) <= k)ans = p;
	printf("%d\n", ans ? ans : 1);
}

int main(void) {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
	}
	return 0;
}
//  [c]
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x=n,i,j,c=0;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
LL nibtan(LL* a,LL n,LL x){LL p=0,q=n/2,r=n-1;while(r-p>1){if(x>=a[q])p=q;if(x<=a[q])r=q;q=(p+r)/2;}return a[p]==x?p:r;}
//snippet

#define N 200009

int n, k, a[N];

LL check(int x) {
	LL ret = 0;
	rep(i, n)ret += (LL)ceill((Lf)a[i] / (Lf)x) - 1;
	return ret;
}

void run(void) {
	//saw editorial
	in("%d%d", &n, &k);
	rep(i, n)in("%d", &a[i]);

	int p = 0, q = MOD / 2, r = MOD, ans = n;
	while (r - p > 1) {
		if (check(q) <= (LL)k) r = q;
		else p = q;
		q = (p + r) / 2;
	}
	if (check(r) <= k)ans = r;
	if (check(p) <= k)ans = p;
	if (!ans)ans = 1;
	printf("%d\n", ans);
}

int main(void) {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
	}
	return 0;
}
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf-8');
 
let inputString = '';
let currentLine = 0;
 
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
 
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    
    main();    
});
 
function readLine() {
    return inputString[currentLine++];
}

function main() {
  const [n, k] = readLine().split(/\s/).map(Number)
  const as = readLine().split(/\s/).map(Number)
  const sum = as.reduce((a, b) => a + b)
  const avg = Math.ceil(sum / (k + 1))
  console.log(binarySearch(
    v => {
      const count = as.reduce((acc, a) => acc + Math.ceil(a / v) - 1, 0)
      return count > k
    },
    avg
  ))
}

function binarySearch(compare, r, l = 1) {
  while (l < r) {
    const m = Math.floor((l + r) / 2)
    if (compare(m - 1)) {
      if (!compare(m)) {
        return m
      }
      l = m + 1
      continue
    }
    r = m
  }
  return compare(l) ? l - 1 : l
}
//  [javascript]
(async () => {
    let input = '';
    for await (const chunk of process.stdin) input += chunk;
    const lines = input.split(/\n/);
    const [n, k] = lines.shift().split(/\s/).map(v => +v);
    let a = lines[0].split(/\s/).slice(0, n).map(v => +v);

    let min = 0;
    let max = 1e9;
    while(Math.abs(max - min) > 1){
        const mid = Math.ceil((max + min) / 2);
        if(a.reduce((count, a) => count + Math.ceil(a / mid) - 1, 0) <= k){
            max = mid;
        }else{
            min = mid;
        }
    }
    console.log(Math.ceil(max));
})()
//  [javascript]
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

function lowerBound(ary,v,l=0,r=ary.length){--l;for(var c;1<r-l;)ary[c=l+r>>1]<v?l=c:r=c;return r;}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var k = next();
  var a = nexts(n);
  var ok = 1e9, ng = 0;
  while(ok-ng > 1){
    var m = ok+ng >>> 1;
    var sum = 0;
    for(var i = 0; i < n && sum <= k; i++){
      sum += Math.ceil(a[i]/m)-1;
    }
    if(sum <= k)ok = m;
    else ng = m;
  }
  return ok;
}
//  [go]
package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	var n, k int
	Fscan(in, &n, &k)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	Print(sort.Search(1e9, func(l int) bool {
		if l == 0 {
			return false
		}
		c := 0
		for _, v := range a {
			c += (v - 1) / l
		}
		return c <= k
	}))
}
//  [go]
package main

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

func main() {
	N, K := ReadInt(), ReadInt()
	A := ReadInts(N)
	max := -1
	for _, a := range A {
		if a > max {
			max = a
		}
	}
	if K == 0 {
		fmt.Println(max)
		return
	}

	l := 0
	r := max
	for r-l > 1 {
		c := (r + l) / 2
		k := 0
		for _, a := range A {
			if a > c {
				k += ((a + c - 1) / c) - 1
				if k > K {
					break
				}
			}
		}
		if k <= K {
			r = c
		} else {
			l = c
		}
	}
	fmt.Println(r)
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [go]
package main

// Solution for https://atcoder.jp/contests/abc174/tasks/abc174_e

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}
func (con *contest) main() error {
	var n, k int
	con.Scan(&n, &k)
	a := make([]int, n)
	lo := 1
	hi := 0
	for i := 0; i < n; i++ {
		con.Scan(&a[i])
		if a[i] > hi {
			hi = a[i]
		}
	}
	for lo < hi {
		mid := (lo + hi) / 2
		c := 0
		for i := 0; i < n; i++ {
			c += (a[i] - 1) / mid
		}
		if c <= k {
			hi = mid
		} else if lo == mid {
			lo++
		} else {
			lo = mid
		}
	}
	con.Println((lo + hi) / 2)
	return nil
}
//  [ruby]
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

l = 1
r = a.max
while l < r
    m = (l + r) / 2

    sum = 0
    a.each {|e| sum += (e.fdiv(m) - 1).ceil}
    sum > k ? l = m + 1 : r = m
end

p l
//  [ruby]
n, k = gets.split.map { |e| e.to_i }
a    = gets.split.map { |e| e.to_i }.sort.reverse

ans = (0.0 .. a[0]).bsearch do |t|
  
  i   = 0
  cnt = 0
  while (i < n && a[i] > t) && cnt <= k
    cnt += (a[i] / t).ceil - 1
    i += 1
  end
  
  cnt <= k
end.ceil

puts ans
//  [ruby]
# frozen_string_literal: true

n, k = gets.split.map(&:to_i)
@a = gets.split.map(&:to_f)

min = @a.min
max = @a.max

def count(x)
  c = 0
  @a.each do |e|
    c += (e / x).floor
  end
  c
end

c = (0.0..max).bsearch { |e| count(e) < k + 1 }

if c
  puts @a.map { |e| (e / (e / c).ceil).ceil }.max
else
  puts max.to_i
end
//  [rust]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let K: usize = sc.get();
    let A: Vec<usize> = sc.vec(N);
    let mut ok = 1000000000;
    let mut ng = 0;
    while ok - ng > 1 {
        let mid = (ok + ng) / 2;
        let mut cnt = 0;
        for i in 0..N {
            if A[i] > mid {
                let mut ok = 1000000000;
                let mut ng = 0;
                while ok - ng > 1 {
                    let t = (ok + ng) / 2;
                    if A[i] <= mid * t {
                        ok = t;
                    } else {
                        ng = t;
                    }
                }
                cnt += ok - 1;
            }
        }
        if cnt <= K {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    println!("{}", ok);
}
//  [rust]
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub fn bsearch<F>(ok: i64, ng: i64, pred: F) -> Option<i64>
where
    F: Fn(i64) -> bool,
{
    let orig_ok = ok;
    let mut ok = ok;
    let mut ng = ng;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if pred(mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    if ok == orig_ok {
        None
    } else {
        Some(ok)
    }
}

// fn dfs(k: usize, av: &av, dp: &mut HashMap::new()) -> isize {
//     if dp[usize]
// }

fn solve() {
    input! {
        n: usize, k: usize,
        av: [f64; n]
    };

    let res = bsearch(10_i64.pow(9) + 1, 0 as i64, |x| {
        let max = x as f64;
        let mut count = 0_usize;
        for &a in &av {
            let n = (a / max) as usize;
            count += if a % max == 0.0 { n - 1 } else { n };
        }
        count <= k
    });
    let res = res.unwrap();
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}
//  [python]
x,n= list(map(int, input().split()))
p = list(map(int, input().split())) 
import numpy as np

if x not in p:
    print(x)
else:
    t = [i for i in range(-101,201)]
    for i in range(n):    
        t.remove(p[i])
#         print(t)

    res = 100
    s = 1000
    for i in range(len(t)):
#         print(t[i])
        if s >= abs (x - t[len(t)-1-i]):
            s = abs (x - t[len(t)-1-i])
            res = t[len(t)-1-i]
    print(res)
//  [python]
X, N = map(int, input().split())

if N == 0:
  print(X)
  exit()

import numpy as np
p = np.array(list(map(int, input().split())))
p = p-X

for i in range(100):
  if i in p and -1*i in p:
    continue
  if -1*i not in p:
    print(X-i)
    break
  else:
    print(X+i)
    break
//  [python]
X,N = map(int,input().split())
if N == 0 :
    print(X)
else :
    P = list(map(int,input().split()))
    a = list(range(10000000))
    ab = 101
    an = []
    for i in range(N):
        a.remove(P[i])
        a = a
    for j in range(0,102):
        ab = min(ab,abs(X - a[j]))
    if X - ab in a :
        print(X - ab)
    elif X + ab in a:
        print(X + ab)
//  [java]

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int x = Integer.parseInt(scan.next());
        int n = Integer.parseInt(scan.next());

        if (n == 0) {
            System.out.println(x);
            scan.close();
            return;
        }

        Set<Integer> set = new HashSet<Integer>();
        for (int i = 0; i < n; i++) {
            set.add(Integer.parseInt(scan.next()));
        }
        scan.close();

        int a = x;
        int b = x;
        while (true) {
            if (!set.contains(b)) {
                System.out.println(b);
                return;
            }
            if (!set.contains(a)) {
                System.out.println(a);
                return;
            }
            a++;
            b--;
        }

    }
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);

		int x = in.nextInt();
		int n = in.nextInt();
		Integer a[] = new Integer[n];

		for(int i=0;i<n;i++) {
			a[i] = in.nextInt();
		}

		int c = 0;


		while(true) {
			if(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {
				c++;
				continue;
			}else {
				break;
			}
		}

		if(Arrays.asList(a).contains(x-c)) {
			System.out.println(x+c);
		}else {
			System.out.println(x-c);
		}


	}

}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i=0; i<n; i++) {
            p[i] = sc.nextInt() - x;
        }
        Arrays.sort(p, (a, b) -> {
            int sub = Math.abs(a) - Math.abs(b);
            return sub == 0 ? a : sub;
        });
        int sub = 0;
        if (n != 0) {
            if (p[0] == 0) {
                sub--;
                for (int i=1; i<n; i=i+2) {
                    if (p[i] != sub) {
                        break;
                    }
                    if (i+1 >= n || p[i+1] != -1 * sub){
                        sub = -1 * sub;
                        break;
                    }
                    sub--;
                }
            }
        }
        System.out.println(x + sub);
    }
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(){
        int i, x, n, left=103, right=103;
        scanf("%d %d", &x, &n);

        if(n==0){
                printf("%d", x);
                return 0;
        }

        int p[105]={0};
        int pp;

        for(i=0; i<n; i++){
                scanf("%d", &pp);
                p[pp]=1;
        }

        int count=0;

        for(i=0; i<101; i++){
                if(p[x+i]!=1){
                        right=x+i;
                        count++;
                }
                if(p[x-i]!=1){
                        left=x-i;
                        count++;
                }

                if((count!=0)&&(left>right)){
                        printf("%d", right);
                        return 0;
                }else if((count!=0)&&(right>=left)){
                        printf("%d", left);
                        return 0;
                }

        }

        return 0;
}