buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
bool go(vector<ll> &vec, ll n, ll mid, ll k) {
ll p = 0;
for (ll i = 1; i <= n; i++) {
p += ceil((vec[i]) / mid);
if (p > k)
return 0;
}
// cout<<p<<endl;
if (p > k)
return 0;
else
return 1;
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
bool go(vector<ll> &vec, ll n, ll mid, ll k) {
ll p = 0;
for (ll i = 1; i <= n; i++) {
p += ceil((vec[i] - 1) / mid);
if (p > k)
return 0;
}
// cout<<p<<endl;
if (p > k)
return 0;
else
return... | [["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13]] | 1 | 260 |
// om namah shivaay
// faith over fear
// no one wants to die,yet death is the destination we all share
// don't think you are,know you are!!
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define al... | // om namah shivaay
// faith over fear
// no one wants to die,yet death is the destination we all share
// don't think you are,know you are!!
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define al... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 367 |
import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
left, right = 1, np.max(a)
while right - left > 1:
mid = left + (right - left) // 2
if np.sum(np.ceil(a/mid)-1) <= k:
right = mid
else:
left = mid
print(right)
| import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
left, right = 0, np.max(a)
while right - left > 1:
mid = left + (right - left) // 2
if np.sum(np.ceil(a/mid)-1) <= k:
right = mid
else:
left = mid
print(right)
| [["-", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612]] | 5 | 103 |
n, k = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_f)
def check(k, len, arr)
cnt = 0
arr.each do |a|
cnt += (a/len).ceil - 1
end
return cnt <= k
end
prev = -1
l = 0
r = arr.max.to_i + 1
min = 1145148101919
while l < r
len = (l + r) / 2
ok = check(k, len, arr)
#puts "len:#{len} ok:#{ok} l:#... | n, k = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_f)
def check(k, len, arr)
cnt = 0
arr.each do |a|
cnt += (a/len).ceil - 1
end
return cnt <= k
end
prev = -1
l = 0
r = arr.max.to_i + 1
min = 1145148101919
while l < r
len = [(l + r) / 2, 1].max
ok = check(k, len, arr)
#puts "len:#{len} ok:... | [["+", 8, 170, 0, 662, 12, 652, 486, 516, 0, 70], ["+", 8, 170, 0, 662, 12, 652, 486, 516, 0, 21], ["+", 8, 170, 0, 662, 12, 652, 486, 516, 0, 612], ["+", 8, 170, 0, 662, 12, 652, 486, 516, 0, 73], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 17, 131], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22]] | 4 | 135 |
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, k, a[200010];
signed main() {
ios::sync_with_stdio(false);
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> a[i];
int l = 0, r = 1000000000, ans = -1;
while (l <= r) {
int mid = (l + r) / 2;
int cnt = 0ll;
for (int ... | #include <bits/stdc++.h>
#define int long long
using namespace std;
int n, k, a[200010];
signed main() {
ios::sync_with_stdio(false);
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> a[i];
int l = 1, r = 1000000000, ans = -1;
while (l <= r) {
int mid = (l + r) / 2;
int cnt = 0ll;
for (int ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 157 |
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
OK = 10**12
NG = 1
while OK-NG > 1:
mid = (OK+NG)//2
cnt = 0
for a in A:
cnt += (a-1)//mid
if cnt <= K:
OK = mid
else:
NG = mid
# print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))
print(OK)
| N, K = map(int, input().split())
A = [int(i) for i in input().split()]
OK = 10**12
NG = 0
while OK-NG > 1:
mid = (OK+NG)//2
cnt = 0
for a in A:
cnt += (a-1)//mid
if cnt <= K:
OK = mid
else:
NG = mid
# print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))
print(OK)
| [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 93 |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for... | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 394 |
n, k = map(int, input().split())
a = list(map(int, input().split()))
if k == 0:
print(max(a))
exit()
l = 1
u = max(a)
while u > l+1:
# print(l,u)
c = (l + u) // 2
cnt = 0
for i in a:
cnt = cnt + ((i-1)//c)
if cnt <= k:
u = c
else:
l = c
print(u)
| n, k = map(int, input().split())
a = list(map(int, input().split()))
if k == 0:
print(max(a))
exit()
l = 0
u = max(a)
while u > l+1:
# print(l,u)
c = (l + u) // 2
cnt = 0
for i in a:
cnt = cnt + ((i-1)//c)
if cnt <= k:
u = c
else:
l = c
print(u) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 112 |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, x, n) for (int i = x; i < (int)n; i++)
#define rep(i, n) REP(i, 0, n)
#define sp(p) cout << setprecision(16) << fixed << p << endl;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, x, n) for (int i = x; i < (int)n; i++)
#define rep(i, n) REP(i, 0, n)
#define sp(p) cout << setprecision(16) << fixed << p << endl;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 533 |
n, k = map(int, input().split())
a = list(map(int, input().split()))
def c(x):
cnt=0
for i in a:
cnt += i // x
return cnt <= k
l, r = 0, max(a)
while l + 1 < r:
mid = (l + r) // 2
if c(mid):
r = mid
else:
l = mid
print(r) | n, k = map(int, input().split())
a = list(map(int, input().split()))
def c(x):
cnt=0
for i in a:
cnt += (i - 1) // x
return cnt <= k
l, r = 0, max(a)
while l + 1 < r:
mid = (l + r) // 2
if c(mid):
r = mid
else:
l = mid
print(r) | [["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]] | 5 | 100 |
n,k=map(int,input().split())
A=list(map(int,input().split()))
right=10**9
left=1
while right-left>1 :
mid=(left+right)//2
count=0
for a in A :
count+=a//mid
if a%mid==0 :
count-=1
if count<=k :
right=mid
else :
left=mid
print(right) | n,k=map(int,input().split())
A=list(map(int,input().split()))
right=10**9
left=0
while right-left>1 :
mid=(left+right)//2
count=0
for a in A :
count+=a//mid
if a%mid==0 :
count-=1
if count<=k :
right=mid
else :
left=mid
print(right) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 97 |
n,k=map(int,input().split())
A=[int(i) for i in input().split()]
def f(i):
if i<0: return True
if i>= 10**9: return False
x = sum([(a-1)//i for a in A])
if x<=k:
return True
else:
return False
l=-1
r=10**9
while r-l>1:
m = (l+r)//2
if f(m):
r=m
else:
l=m... | n,k=map(int,input().split())
A=[int(i) for i in input().split()]
def f(i):
if i<=0: return False
if i>= 10**9: return True
x = sum([(a-1)//i for a in A])
if x<=k:
return True
else:
return False
l=-1
r=10**9
while r-l>1:
m = (l+r)//2
if f(m):
r=m
else:
l=... | [["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 146], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 147], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 147], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 146]] | 5 | 129 |
n, k = map(int, input().split())
a = list(map(int, input().split()))
result = max(a)
# a = [x * 2 for x in a]
left = 1
right = result
med = left + (right - left) // 2
while left <= right:
counter = sum([x // med for x in a])
if counter <= k:
result = med
right = med - 1
else:
left = ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
result = max(a)
left = 1
right = result
med = left + (right - left) // 2
while left <= right:
counter = sum([(x - 1) // med for x in a])
if counter <= k:
result = med
right = med - 1
else:
left = med + 1
med = l... | [["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 24], ["+", 0, 658, 8, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 658, 8, 657, 31, 23, 0, 657, 12, 612], ["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 25]] | 5 | 111 |
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [x * 2 for x in a]
result = max(a)
left = 1
right = result
med = left + (right - left) // 2
while left <= right:
counter = sum([x // med for x in a])
if counter <= k:
result = med
right = med - 1
else:
left = me... | n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [x * 2 for x in a]
result = max(a)
left = 1
right = result
med = left + (right - left) // 2
while left <= right:
counter = sum([(x - 1) // med for x in a])
if counter <= k:
result = med
right = med - 1
else:
lef... | [["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 24], ["+", 0, 658, 8, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 658, 8, 657, 31, 23, 0, 657, 12, 612], ["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 25]] | 5 | 127 |
#include <bits/stdc++.h>
#define debug(a) cout << #a ": " << a << endl
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;
const double eps = 1e-6;
ll n, k, a[N];
ll calc(double mid) {
ll ans = 0;
for (int i = 1; i <= n; ++i) {
double t = 1.0 * a... | #include <bits/stdc++.h>
#define debug(a) cout << #a ": " << a << endl
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;
const double eps = 1e-6;
ll n, k, a[N];
ll calc(double mid) {
ll ans = 0;
for (int i = 1; i <= n; ++i) {
double t = 1.0 * a... | [["+", 0, 16, 31, 16, 12, 74, 51, 2, 63, 22], ["-", 31, 16, 12, 74, 51, 23, 0, 16, 17, 72], ["-", 31, 16, 12, 74, 51, 23, 0, 16, 12, 13]] | 1 | 202 |
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
print(max(A))
exit()
def f(x):
cnt=0
for i in A:
if i%x==0:
cnt+=i//x-1
else:
cnt+=(i//x)
if cnt<=K:
return True
else:
return False
ok=1
ng=1000000000
for i in range(50):
mid=(ok+ng)//2
if f(mid):
ng... | N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
print(max(A))
exit()
def f(x):
cnt=0
for i in A:
if i%x==0:
cnt+=i//x-1
else:
cnt+=(i//x)
if cnt<=K:
return True
else:
return False
ok=1
ng=1000000000
for i in range(50):
mid=(ok+ng)//2
if f(mid):
ng... | [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 137 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define floop(i, a, n) for (int i = a; i < n; i++)
#define rfloop(i, a, n) for (int i = n - 1; i >= a; i--)
#define mloop(it, x) for (it = x.begin(); it != x.end(); it+... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define floop(i, a, n) for (int i = a; i < n; i++)
#define rfloop(i, a, n) for (int i = n - 1; i >= a; i--)
#define mloop(it, x) for (it = x.begin(); it != x.end(); it+... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 909 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
for (auto &i : A)
cin >> i;
auto ok = [&](auto x) {
long long k = 0;
for (auto &a : A)
k += (a - 1) / x;
return k <= K;
};
int l = -1, h = 1e9;
while (1 < h - l) {
auto m = ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
for (auto &i : A)
cin >> i;
auto ok = [&](auto x) {
long long k = 0;
for (auto &a : A)
k += (a - 1) / x;
return k <= K;
};
int l = 0, h = 1e9;
while (1 < h - l) {
auto m = (... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 138 |
import math
n,k = map(int,input().split())
a_list = list(map(int,input().split()))
min_num = 1
max_num = 10**9+1
while True:
print(min_num)
x = int((min_num+max_num)/2)
if sum([math.ceil(a/x)-1 for a in a_list])>k:
min_num = x
else:
max_num = x
if max_num-min_num<=1:
break
... | import math
n,k = map(int,input().split())
a_list = list(map(int,input().split()))
min_num = 1
max_num = 10**9+1
while True:
#print(min_num)
x = int((min_num+max_num)/2)
if sum([math.ceil(a/x)-1 for a in a_list])>k:
min_num = x
else:
max_num = x
if max_num-min_num<=1:
break
... | [["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 139 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n, dem, res, k;
int a[200010];
int main() {
cin >> n >> k;
int l = 1;
int r = 1;
for (int i = 1; i <= n; i++) {
cin >> a[i];
r = max(r, a[i]);
}
ll mid;
while (l != r) {
mid = (l + r) / 2;
ll s = 0;
for (int i = 1... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int n, dem, res, k;
int a[200010];
int main() {
cin >> n >> k;
int l = 1;
int r = 1;
for (int i = 1; i <= n; i++) {
cin >> a[i];
r = max(r, a[i]);
}
ll mid;
while (l != r) {
mid = (l + r) / 2;
ll s = 0;
for (int i = 1... | [["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]] | 1 | 153 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
ll r = 0;
ll l = 1e10;
while (l - r > 1) {
ll mid = (r + l) / 2; // midは最大の長さ
ll sum = 0; // sumは必要分割数
for (int i = ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
ll r = 0;
ll l = 1e10;
while (l - r > 1) {
ll mid = (r + l) / 2; // midは最大の長さ
ll sum = 0; // sumは必要分割数
for (int i = ... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 147 |
// g++ 7.4.0
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> ar(n);
for (int &i : ar)
cin >> i;
int l = -1;
int h = *max_element(ar.begin(), ar.end());
auto fun = [&](int x) { // want... | // g++ 7.4.0
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> ar(n);
for (int &i : ar)
cin >> i;
int l = 0;
int h = *max_element(ar.begin(), ar.end());
auto fun = [&](int x) { // want ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 208 |
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define COUT(x) cout << (x) << "\n"
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); ... | #include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define COUT(x) cout << (x) << "\n"
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 399 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
void s... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
void s... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 220 |
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int(i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define yn ... | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int(i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define yn ... | [["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125]] | 1 | 217 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using i64 = int64_t;
using P = p... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using i64 = int64_t;
using P = p... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 206 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int ans = 0;
int left = 0, right = n - 1;
while (left < right) {
while (left < n && s[left] == 'R')
left++;
while (right >= 0 ... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int ans = 0;
int left = 0, right = n - 1;
while (left < right) {
while (left < n && s[left] == 'R')
left++;
while (right >= 0 ... | [["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 16, 31, 16, 17, 98], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 31, 22], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 18]] | 1 | 142 |
import sys
import heapq
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
C = list(input())
Wcount=0
Rcount =0
rr =C.count("R")
ww =C.count("W")
for j in range(ww):
if C[j]=="W":
Rcount+=1
for i in range(rr):
if C[-1-i]=... | import sys
import heapq
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
C = list(input())
Wcount=0
Rcount =0
rr =C.count("R")
ww =C.count("W")
for j in range(rr):
if C[j]=="W":
Rcount+=1
for i in range(ww):
if C[-1-i]=... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]] | 5 | 132 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#pragma warn... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#pragma warn... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 271 |
N = int(input())
c = list(input())
print(c)
red=0
for i in c:
if i=="R":
red+=1
count = 0
for i in range(red):
if c[i]=="W":
count+=1
print(count) | N = int(input())
c = list(input())
red=0
for i in c:
if i=="R":
red+=1
count = 0
for i in range(red):
if c[i]=="W":
count+=1
print(count) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 66 |
# -*- coding: utf-8 -*-
n = int(input())
s = list(input())
if s.count("W") == 0:
print(0)
exit()
print(s[:s.count('W')].count("W")) | # -*- coding: utf-8 -*-
n = int(input())
s = list(input())
if s.count("W") == 0:
print(0)
exit()
print(s[:s.count('R')].count("W")) | [["-", 206, 663, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 206, 663, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 58 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
t... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
t... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]] | 1 | 695 |
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <fstream>
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() { return 42; }
using namespace std;
usin... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <fstream>
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() { return 42; }
using namespace std;
usin... | [["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]] | 1 | 258 |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
int n, c1, c2;
char ch[N];
int main() {
scanf("%d%s", &n, ch + 1);
for (int i = 1; i <= n; i++) {
c1 += ch[i] == 'W';
c2 += ch[i] == 'R';
}
int Ans = 0;
for (int i = c1 + 1; i <= n; i++) {
Ans += ch[i] == 'R';
}
cout << Ans... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
int n, c1, c2;
char ch[N];
int main() {
scanf("%d%s", &n, ch + 1);
for (int i = 1; i <= n; i++) {
c1 += ch[i] == 'W';
c2 += ch[i] == 'R';
}
int Ans = 0;
for (int i = c2 + 1; i <= n; i++) {
Ans += ch[i] == 'R';
}
cout << Ans... | [["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22]] | 1 | 125 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
string s;
cin >> s;
int nw = count(s.begin(), s.end(), 'W');
int nwr = count(s.begin(), s.begin() + nw, 'W');
printf("%d\n", nwr);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
string s;
cin >> s;
int nw = count(s.begin(), s.end(), 'W');
int nwr = count(s.begin(), s.end() - nw, 'W');
printf("%d\n", nwr);
return 0;
} | [["-", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["+", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33]] | 1 | 105 |
#include <bits/stdc++.h>
using namespace std;
#define pf printf
#define PF(a) printf("%d\n", (a))
#define PF2(a, b) printf("%d %d\n", (a), (b))
#define PF3(a, b, c) printf("%d %d %d\n", (a), (b), (c))
#define PFL(a) printf("%lld\n", (a))
#define PFL2(a, b) printf("%lld %lld\n", (a), (b))
#define PFL3(a, b, c) printf(... | #include <bits/stdc++.h>
using namespace std;
#define pf printf
#define PF(a) printf("%d\n", (a))
#define PF2(a, b) printf("%d %d\n", (a), (b))
#define PF3(a, b, c) printf("%d %d %d\n", (a), (b), (c))
#define PFL(a) printf("%lld\n", (a))
#define PFL2(a, b) printf("%lld %lld\n", (a), (b))
#define PFL3(a, b, c) printf(... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 508 |
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for (int i =... | #pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for (int i =... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 288 |
#include <iostream>
#include <vector>
using namespace std;
using ll = int64_t;
bool ok(const vector<ll> &A, ll k, ll allowed) {
ll cost = 0;
for (ll i = 0; i < A.size(); i++) {
// smallest K s.t. allowed*K >= A[i]
// cost += K-1
// 1..allowed -> 0
// allowed+1..2*allowed -> 1
cost += (A[i] - 1)... | #include <iostream>
#include <vector>
using namespace std;
using ll = int64_t;
bool ok(const vector<ll> &A, ll k, ll allowed) {
ll cost = 0;
for (ll i = 0; i < A.size(); i++) {
// smallest K s.t. allowed*K >= A[i]
// cost += K-1
// 1..allowed -> 0
// allowed+1..2*allowed -> 1
cost += (A[i] - 1)... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 192 |
// Created by ...
#include <bits/stdc++.h>
#define db1(x) cout << #x << "=" << x << '\n'
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n'
#define db3(x, y, z) \
cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z ... | // Created by ...
#include <bits/stdc++.h>
#define db1(x) cout << #x << "=" << x << '\n'
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n'
#define db3(x, y, z) \
cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 447 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long int ll;
typedef pair<int, int> P;
bool check(int mid, vector<int> &a, int k) {
int n = a.size();
int cnt = 0;
rep(i, n) cnt += a[i] / mid;
return (cnt <= k);
}
int main() {
int n, k;
cin >>... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long int ll;
typedef pair<int, int> P;
bool check(int mid, vector<int> &a, int k) {
int n = a.size();
int cnt = 0;
rep(i, n) cnt += (a[i] - 1) / mid;
return (cnt <= k);
}
int main() {
int n, k;
... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 185 |
N,K=map(int,input().split())
A=list(map(int,input().split()))
l,r=0,10**9+1
while r-l>1:
t=(l+r)//2
k=sum([(a+t-2)//(t-1)-1 for a in A])
if K<k:
l=t
else:
r=t
print(l) | N,K=map(int,input().split())
A=list(map(int,input().split()))
l,r=1,10**9+1
while r-l>1:
t=(l+r)//2
k=sum([(a+t-2)//(t-1)-1 for a in A])
if K<k:
l=t
else:
r=t
print(l) | [["-", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612]] | 5 | 103 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
for (auto &e : A)
cin >> e;
auto OK = [&](int x) -> bool {
int cnt = 0;
for (auto &a : A) {
if (a == x)
continue;
cnt += (a / x);
}
return cnt <= K;
};
int l = -1,... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
for (auto &e : A)
cin >> e;
auto OK = [&](int x) -> bool {
int cnt = 0;
for (auto &a : A) {
if (a == x)
continue;
cnt += (a / x);
}
return cnt <= K;
};
int l = 0, ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 152 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
scanf("%d %d", &n, &k);
vector<int> a(n);
int left = 0, right = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
right = max(right, a[i]);
}
while (left < right) {
int mid = (left + rig... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
scanf("%d %d", &n, &k);
vector<int> a(n);
int left = 1, right = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
right = max(right, a[i]);
}
while (left < right) {
int mid = (left + rig... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 175 |
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
def solve(x): #Trueで切り切れる
cnt = 0
for a in A:
cnt += math.ceil(a / x) - 1
return cnt <= K
left = 0
right = 10 ** 9 + 1
for _ in range(40):
mid = (left + right) / 2
if solve(mid):
right = mid
els... | import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
def solve(x): #Trueで切り切れる
cnt = 0
for a in A:
cnt += math.ceil(a / x) - 1
return cnt <= K
left = 0
right = 10 ** 9 + 1
for _ in range(100):
mid = (left + right) / 2
if solve(mid):
right = mid
el... | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 116 |
def main():
from math import ceil
N, K = map(int, input().split())
*A, = map(int, input().split())
def binary_search(*, ok, ng, func):
for _ in range(40):
mid = (ok + ng) / 2
if func(mid):
ok = mid
else:
ng = mid
retur... | def main():
from math import ceil
N, K = map(int, input().split())
*A, = map(int, input().split())
def binary_search(*, ok, ng, func):
for _ in range(60):
mid = (ok + ng) / 2
if func(mid):
ok = mid
else:
ng = mid
retur... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 164 |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T> using V = vector<T>;
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
const ll inf = (1e18);
const ll mod = 998244353;
// const ll mod=1000000007;
ll GCD(ll a... | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T> using V = vector<T>;
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
const ll inf = (1e18);
const ll mod = 998244353;
// const ll mod=1000000007;
ll GCD(ll a... | [["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]] | 1 | 378 |
def check(A, K, t):
# K回で長さt以下にできるか?(t:整数)
cnt = 0
for a in A:
cnt += a // t
return cnt <= K
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ng, ok = 0, max(A)
while ok - ng > 1:
mid = (ok + ng) // 2
if check(A, K, mid):
... | def check(A, K, t):
# K回で長さt以下にできるか?(t:整数)
cnt = 0
for a in A:
cnt += (a - 1) // t
return cnt <= K
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ng, ok = 0, max(A)
while ok - ng > 1:
mid = (ok + ng) // 2
if check(A, K, mi... | [["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]] | 5 | 127 |
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout << #x << ": " << x << endl;
#define N 300005
#define M 1000000007
#define pii pair<ll, ll>
#define fast \
ios_base::sync_with_stdio(0); \
... | #include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout << #x << ": " << x << endl;
#define N 300005
#define M 1000000007
#define pii pair<ll, ll>
#define fast \
ios_base::sync_with_stdio(0); \
... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 224 |
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
# にぶたん: 答えをx以下にできるか?
ok, ng = 10 ** 9 + 1, -1
while abs(ok - ng) > 1:
x = (ok + ng) // 2
cnt = 0
for a in A:
if a <= x:
continue
cnt += a // x
if cnt > K:
ng = x
... | N, K = map(int, input().split())
A = list(map(int, input().split()))
# にぶたん: 答えをx以下にできるか?
ok, ng = 10 ** 9 + 1, 0
while abs(ok - ng) > 1:
x = (ok + ng) // 2
cnt = 0
for a in A:
if a <= x:
continue
cnt += a // x
if cnt > K:
ng = x
break
else:... | [["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["-", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 0, 1, 0, 662, 12, 432, 0, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 432, 0, 664, 28, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432,... | 5 | 106 |
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define SORT(... | #include <algorithm>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define SORT(... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 605 |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
// typedef tree<int,null_type,less<int
// >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template <class T1, class T2> ostream &operator<<(o... | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
// typedef tree<int,null_type,less<int
// >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template <class T1, class T2> ostream &operator<<(o... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 664 |
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), ... | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), ... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 326 |
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <complex>
#include <numeric>
#include <utility>
#include <i... | // include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <complex>
#include <numeric>
#include <utility>
#include <i... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 406 |
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *A = map(int, read().split())
ng = -1
ok = 10 ** 9
while ok - ng > 1:
mid = (ok + ng) // 2
res = 0
fo... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *A = map(int, read().split())
ng = 0
ok = 10 ** 9
while ok - ng > 1:
mid = (ok + ng) // 2
res = 0
for... | [["-", 8, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]] | 5 | 137 |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define pb push_back
#define pi pair<int, int>
#define l first
#define r second
#define all(x) x.begin(), x.end()
#define fori(a, b, step) for (int i = a; i < b; i += step)
#define forj(a, b, step) for (int j = a; j < b; j += step)
#define int long long
const int ... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define pb push_back
#define pi pair<int, int>
#define l first
#define r second
#define all(x) x.begin(), x.end()
#define fori(a, b, step) for (int i = a; i < b; i += step)
#define forj(a, b, step) for (int j = a; j < b; j += step)
#define int long long
const int ... | [["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 210 |
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll N = 1e6 + 5;
const ll maxn = 5005;
ll m, n, t, T, k, a[N], ans, tong;
string s, ss;
struct dang {
ll pos, val, mn, mx, vtri;
};
bool so(const dang &x, const dang &y) {
return (x.val < y.val) || (x.val == y.val && x.... | #include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll N = 1e6 + 5;
const ll maxn = 5005;
ll m, n, t, T, k, a[N], ans, tong;
string s, ss;
struct dang {
ll pos, val, mn, mx, vtri;
};
bool so(const dang &x, const dang &y) {
return (x.val < y.val) || (x.val == y.val && x.... | [["+", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]] | 1 | 322 |
#include <bits/extc++.h>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using ll = long long;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#def... | #include <bits/extc++.h>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using ll = long long;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#def... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 279 |
n,k=map(int,input().split())
a=list(map(int,input().split()))
def case(L):
result=0
for x in a:
result+=x//L
return result
possible=0
impossible=max(a)
while impossible-possible>1:
M=(impossible+possible)//2
if case(M)>k:
possible=M
else:
impossible=M
print(impossible) | n,k=map(int,input().split())
a=list(map(int,input().split()))
def case(L):
result=0
for x in a:
result+=(x-1)//L
return result
possible=0
impossible=max(a)
while impossible-possible>1:
M=(impossible+possible)//2
if case(M)>k:
possible=M
else:
impossible=M
print(impossible... | [["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]] | 5 | 99 |
#include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define ff first
... | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define ff first
... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 272 |
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vect... | #include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vect... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 283 |
// ____ ____
// /@@@@\ |@@@@| ____
// /@@@@@@\ |@@@@| |@@@@|
// /@@@@@@@@\ |@@@@| __|@@@@|___ ____ ____ ___
// _________ ____ ____ ____________ ___ _________
// ____ ____
// ... | // ____ ____
// /@@@@\ |@@@@| ____
// /@@@@@@\ |@@@@| |@@@@|
// /@@@@@@@@\ |@@@@| __|@@@@|___ ____ ____ ___
// _________ ____ ____ ____________ ___ _________
// ____ ____
// ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 323 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> v(n);
rep(i, n) { cin >> v[i]; }
// lower側がtrue judgeがtrueとなる最もupper側のvalを返す
// lowerboundでもfalseなら-1を返す
auto judge = [&](ll ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> v(n);
rep(i, n) { cin >> v[i]; }
// lower側がtrue judgeがtrueとなる最もupper側のvalを返す
// lowerboundでもfalseなら-1を返す
auto judge = [&](ll ... | [["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]] | 1 | 240 |
/*
* Created by Andrei Arhire 02/08/2020
* Copyright © 2020 Andrei Arhire. All rights reserved.
*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lll long long
#define llf __float128
#define lld long double
using namespace std;
const lll NR = 2e5 + 10,... | /*
* Created by Andrei Arhire 02/08/2020
* Copyright © 2020 Andrei Arhire. All rights reserved.
*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lll long long
#define llf __float128
#define lld long double
using namespace std;
const lll NR = 2e5 + 10,... | [["-", 0, 74, 51, 23, 0, 74, 39, 77, 39, 40], ["+", 0, 74, 51, 23, 0, 2, 63, 23, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 282 |
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define LL long long
int n;
LL k;
LL a[200000];
bool ok(LL st) {
LL cnt = 0;
REP(i, n) {
LL cut = (a[i] - 1) / st;
cnt += cut;
// cer... | #include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define LL long long
int n;
LL k;
LL a[200000];
bool ok(LL st) {
LL cnt = 0;
REP(i, n) {
LL cut = (a[i] - 1) / st;
cnt += cut;
// cer... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 184 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define F first
#define S second
using namespace... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define F first
#define S second
using namespace... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 263 |
# -*- coding: utf-8 -*-
N,K = map(int, input().split())
A = list(map(int, input().split()))
def num_cut(L):
result = 0
for a in A:
result += a//L
if a%L == 0:
result -= 1
return result
m = 1
M = 10**9
while M-m>1:
X = (m+M)//2
if num_cut(X)>K:
m = X
else:
M = X
print(M) | # -*- coding: utf-8 -*-
N,K = map(int, input().split())
A = list(map(int, input().split()))
def num_cut(L):
result = 0
for a in A:
result += a//L
if a%L == 0:
result -= 1
return result
m = 0
M = 10**9
while M-m>1:
X = (m+M)//2
if num_cut(X)>K:
m = X
else:
M = X
print(M) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 109 |
n, k = map(int, input().split())
alst = list(map(int, input().split()))
if k == 0:
print(max(alst))
exit()
l = 0
r = max(alst)
while r != l:
pos = (r + l) // 2
cnt = 0
for a in alst:
cnt += (a - 1) // pos
if cnt <= k:
r = pos
else:
l = pos + 1
print(r) | n, k = map(int, input().split())
alst = list(map(int, input().split()))
if k == 0:
print(max(alst))
exit()
l = 1
r = max(alst)
while r != l:
pos = (r + l) // 2
cnt = 0
for a in alst:
cnt += (a - 1) // pos
if cnt <= k:
r = pos
else:
l = pos + 1
print(r) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 107 |
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define ROF(i, a, b) for (ll i = a; i >= b; i--)
#define per(i, a) ROF(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using ch = char;
typede... | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define ROF(i, a, b) for (ll i = a; i >= b; i--)
#define per(i, a) ROF(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using ch = char;
typede... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 386 |
n, k = map(int, input().split())
arr = list(map(int, input().split()))
l = 1
r = max(arr)
while l + 1 < r:
m = (l + r) // 2
cut = 0
for x in arr:
cut += (x - 1) // m
if cut > k:
l = m
else:
r = m
print(r) | n, k = map(int, input().split())
arr = list(map(int, input().split()))
l = 0
r = max(arr)
while l + 1 < r:
m = (l + r) // 2
cut = 0
for x in arr:
cut += (x - 1) // m
if cut > k:
l = m
else:
r = m
print(r) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 92 |
def bsearch_desc(a, b, &proc)
inverse_proc = -> (n) { proc.call(-n) }
value *= -1 if value = (-a..-b).bsearch(&inverse_proc)
end
INF = 10 ** 9
n, k = gets.split.map(&:to_i)
nums = gets.split.map(&:to_i)
ans = bsearch_desc(INF, 1) { |length|
count = 0
nums.each do |num|
div, mod = num.divmod(length)
di... | def bsearch_desc(a, b, &proc)
inverse_proc = -> (n) { proc.call(-n) }
value *= -1 if value = (-a..-b).bsearch(&inverse_proc)
end
INF = 10 ** 9
n, k = gets.split.map(&:to_i)
nums = gets.split.map(&:to_i)
ans = bsearch_desc(INF, 1) { |length|
count = 0
nums.each do |num|
div, mod = num.divmod(length)
di... | [["-", 36, 36, 0, 493, 0, 662, 12, 738, 17, 72], ["+", 36, 36, 36, 36, 0, 493, 0, 755, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 755, 17, 782], ["+", 36, 36, 36, 36, 0, 493, 0, 755, 12, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 755, 17, 107]] | 4 | 128 |
#include <bits/stdc++.h>
using namespace std;
void Main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
int l = 1, r = 1;
for (int i = 0; i < n; i++) {
cin >> a[i];
r = max(r, a[i]);
}
r++;
while (r - l > 1) {
int kk = 0;
int m = (l + r) / 2;
for (int i = 0; i < n; i++) {
kk +=... | #include <bits/stdc++.h>
using namespace std;
void Main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
int l = 0, r = 1;
for (int i = 0; i < n; i++) {
cin >> a[i];
r = max(r, a[i]);
}
r++;
while (r - l > 1) {
long kk = 0;
int m = (l + r) / 2;
for (int i = 0; i < n; i++) {
kk +... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 25]] | 1 | 197 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define repr1(i, n) for (int i = n; i >= 1; i--)
#define all(v) v.begin(), v.end()
using ll = long long;
using pii = pair<int, i... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define repr1(i, n) for (int i = n; i >= 1; i--)
#define all(v) v.begin(), v.end()
using ll = long long;
using pii = pair<int, i... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 364 |
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include ... | /*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 49, 50, 51, 16, 12, 16, 31, 23, 0, 24], ["+", 51, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 51, 16, 12, 16, 31, 23, 0, 16, 12, 22]] | 1 | 492 |
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define REP(i, p, n) for (ll i = p; i < ll(n... | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define REP(i, p, n) for (ll i = p; i < ll(n... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 218 |
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = 0
r = 10 ** 9
while r-l > 1 :
m = (l+r)//2
b = list(map(lambda x: -(-x//m) - 1 ,a))
ans = sum(b)
if ans <= k :
r = m
else :
l = m
print(l,r)
print(r)
| n,k = map(int,input().split())
a = list(map(int,input().split()))
l = 0
r = 10 ** 9
while r-l > 1 :
m = (l+r)//2
b = list(map(lambda x: -(-x//m) - 1 ,a))
ans = sum(b)
if ans <= k :
r = m
else :
l = m
print(r)
| [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 108 |
import sys
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
print(max(a))
sys.exit()
def check(t):
ans = 0
if t==0:
return False
for aa in a:
if aa > t:
ans += aa//t
return ans <= k
max = 10**9+1
min = 0
while max-min>1:
mid = (max+min)/2
if check(mid... | import sys
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
print(max(a))
sys.exit()
def check(t):
ans = 0
if t==0:
return False
for aa in a:
if aa > t:
ans += aa//t
return ans <= k
max = 10**9+1
min = 0
while max-min>1:
mid = (max+min)//2
if check(mi... | [["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 676]] | 5 | 138 |
#include <cmath>
#include <iostream>
using namespace std;
const int N = 1e6 + 5;
double a[N];
long long n, k;
double round(double r) { return floor(r + 0.5); }
bool Check(double x) {
long long cnt = 0;
for (int i = 1; i <= n; ++i) {
/*cnt += a[i]/x;
if(floor(a[i]/x)*x == a[i]) --cnt;*/
cnt += ceil(a[i] ... | #include <cmath>
#include <iostream>
using namespace std;
const int N = 1e6 + 5;
double a[N];
long long n, k;
double round(double r) { return floor(r + 0.5); }
bool Check(double x) {
long long cnt = 0;
for (int i = 1; i <= n; ++i) {
/*cnt += a[i]/x;
if(floor(a[i]/x)*x == a[i]) --cnt;*/
cnt += ceil(a[i] ... | [["-", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22]] | 1 | 234 |
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;
int n, k, a[N];
bool check(int x) {
... | #include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;
int n, k, a[N];
bool check(int x) {
... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 225 |
N, K = map(int, input().split())
A = list(map(int, input().split()))
def f(x):
return sum((a+x-1)//x - 1 for a in A)
l = 1
r = 10**9+1
while r - l > 1:
mid = (l + r) // 2
if f(mid) <= K:
r = mid
else:
l = mid
print(r) | N, K = map(int, input().split())
A = list(map(int, input().split()))
def f(x):
return sum((a+x-1)//x - 1 for a in A)
l = 0
r = 10**9+1
while r - l > 1:
mid = (l + r) // 2
if f(mid) <= K:
r = mid
else:
l = mid
print(r) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 104 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n";
ll a[200001];
bool is_it_possible(ll val, ll k, ll n) {
ll i, j, l, m, o, p, q, s, flag;
s = 0;
for (i = 0; i < n; i++) {
s += a[i] / val;
}
return s <= k;
}
void solve() {
ll i, j, k, l, m, n, q, s, t;
cin >> n... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n";
ll a[200001];
bool is_it_possible(ll val, ll k, ll n) {
ll i, j, l, m, o, p, q, s, flag;
s = 0;
for (i = 0; i < n; i++) {
s += (a[i] - 1) / val;
}
return s <= k;
}
void solve() {
ll i, j, k, l, m, n, q, s, t;
ci... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 258 |
#include <bits/stdc++.h>
using namespace std;
int a[200005];
bool pos(int x, int k, int n) {
if (x == 0)
return false;
int cuts = 0;
for (int i = 0; i < n; i++) {
int div = a[i] / x;
cuts += div;
}
return (cuts <= k);
}
int main() {
int n, k;
cin >> n >> k;
int lo = 0, high = 0, ans = 0;
... | #include <bits/stdc++.h>
using namespace std;
int a[200005];
bool pos(int x, int k, int n) {
if (x <= 0)
return false;
int cuts = 0;
for (int i = 0; i < n; i++) {
int div = (a[i] - 1) / x;
cuts += div;
}
return (cuts <= k);
}
int main() {
int n, k;
cin >> n >> k;
int lo = 0, high = 0, ans =... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 33], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25]] | 1 | 203 |
#include "algorithm"
#include "bitset"
#include "chrono"
#include "cstring"
#include "ctime"
#include "iomanip"
#include "iostream"
#include "map"
#include "math.h"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "vector"
#include "ext/pb_ds/assoc_contai... | #include "algorithm"
#include "bitset"
#include "chrono"
#include "cstring"
#include "ctime"
#include "iomanip"
#include "iostream"
#include "map"
#include "math.h"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "vector"
#include "ext/pb_ds/assoc_contai... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 577 |
n,k = map(int,input().split())
a = list(map(int,input().split()))
leq,high = 0,1e10
while high-leq > 1:
l = int((leq+high)/2)
cnt = 0
for ai in a:
cnt += int((ai-1)/l)
print(l,cnt)
if cnt>k:
leq = l
else:
high = l
print(high) | n,k = map(int,input().split())
a = list(map(int,input().split()))
leq,high = 0,1e10
while high-leq > 1:
l = int((leq+high)/2)
cnt = 0
for ai in a:
cnt += int((ai-1)/l)
if cnt>k:
leq = l
else:
high = l
print(high) | [["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 102 |
#include "bits/stdc++.h"
// Begin Header {{{
using namespace std;
#ifndef DEBUG
#define dump(...)
#endif
#define all(x) x.begin(), x.end()
#define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i)
#define reps(i, b, e) \
for (intmax_t ... | #include "bits/stdc++.h"
// Begin Header {{{
using namespace std;
#ifndef DEBUG
#define dump(...)
#endif
#define all(x) x.begin(), x.end()
#define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i)
#define reps(i, b, e) \
for (intmax_t ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 1,006 |
import numpy as np
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
#めぐる式二分探索
def is_ok(i):
su = 0
for a in A:
su += math.ceil(n / i) - 1
if su <= K:
return True
else:
return False
def meguru_bisect(ng, ok):
'''
初期値のng,okを受け取り,is_okを満たす最小... | import numpy as np
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
#めぐる式二分探索
def is_ok(i):
su = 0
for a in A:
su += math.ceil(a / i) - 1
if su <= K:
return True
else:
return False
def meguru_bisect(ng, ok):
'''
初期値のng,okを受け取り,is_okを満たす最小... | [["-", 12, 657, 31, 652, 3, 4, 0, 657, 31, 22], ["+", 12, 657, 31, 652, 3, 4, 0, 657, 31, 22]] | 5 | 139 |
from math import floor
m=1
M=10**9+1
N,K=map(int,input().split())
A=list(map(int,input().split()))
def OK(p):
if sum([(a-1)//p for a in A])<=K:
return True
else:
return False
while M-m>1:
p=(m+M)//2
if OK(p):
M=p
else:
m=p
print(M) | from math import floor
m=0
M=10**9+1
N,K=map(int,input().split())
A=list(map(int,input().split()))
def OK(p):
if sum([(a-1)//p for a in A])<=K:
return True
else:
return False
while M-m>1:
p=(m+M)//2
if OK(p):
M=p
else:
m=p
print(M) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 113 |
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int... | #include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 52, 15, 339, 51, 16, ... | 1 | 593 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i))
int main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
sort(A.begin(), A.end(), greater<ll>());
ll l = 0, r = A[0];
ll m = (l + r) / 2;
while (r - l > 0) ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i))
int main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
sort(A.begin(), A.end(), greater<ll>());
ll l = 1, r = 1000000000;
ll m = (l + r) / 2;
while (r - l... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]] | 1 | 195 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m;
cin >> n >> m;
long long int a[n + 5];
for (int i = 0; i < n; i++)
cin >> a[i];
long long int lo = 1;
long long int hi = 1000000000;
long long ans = 0;
while (lo <= hi) {
long long int mid = (lo + hi) / 2;
long lo... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m;
cin >> n >> m;
long long int a[n + 5];
for (int i = 0; i < n; i++)
cin >> a[i];
long long int lo = 1;
long long int hi = 1000000000;
long long ans = 0;
while (lo <= hi) {
long long int mid = (lo + hi) / 2;
long lo... | [["+", 0, 11, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 23, 0, 16, 31, 23, 0, 25]] | 1 | 182 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 100;
ll n, k;
int val[N];
int Check(int len) {
ll res = 0;
for (int i = 1; i <= n; ++i)
res += val[i] / len;
return res <= k;
}
int main() {
scanf("%lld%lld", &n, &k);
int L = 1, R = 1;
for (int i = 1; i <= n; ++... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 100;
ll n, k;
int val[N];
int Check(int len) {
ll res = 0;
for (int i = 1; i <= n; ++i)
res += (val[i] - 1) / len;
return res <= k;
}
int main() {
scanf("%lld%lld", &n, &k);
int L = 0, R = 1;
for (int i = 1; i <=... | [["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 184 |
import math
def main():
_, k = map(int, input().split())
arr = list(map(int, input().split()))
print(arr)
l, r = 1, 1000000000
while l < r:
m = (l + r) // 2
cnt = 0
for val in arr:
cnt += math.ceil(val / m) - 1
if cnt > k:
l = m + 1
el... | import math
def main():
_, k = map(int, input().split())
arr = list(map(int, input().split()))
l, r = 1, 1000000000
while l < r:
m = (l + r) // 2
cnt = 0
for val in arr:
cnt += math.ceil(val / m) - 1
if cnt > k:
l = m + 1
else:
... | [["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 114 |
#include <iostream>
#define exp 1e-6
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn];
int n, k;
bool check(int x) {
int cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > x && x) {
cnt += a[i] / x;
}
if (cnt > k)
return false;
}
return true;
}
int main() {
ios::sync_with_st... | #include <iostream>
#define exp 1e-6
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn];
int n, k;
bool check(int x) {
int cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > x && x) {
cnt += a[i] / x;
}
if (cnt > k)
return false;
}
return true;
}
int main() {
ios::sync_with_st... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 244 |
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll query(ll x, vector<ll> a) {
int n = a.size();
ll res = 0;
rep(i, n) { res += a[i] / x; }
return res;
}
int main() {
int ... | #include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll query(ll x, vector<ll> a) {
int n = a.size();
ll res = 0;
rep(i, n) { res += (a[i] - 1) / x; }
return res;
}
int main() {
... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 234 |
// By Debajit Chakraborty
#include <bits/stdc++.h>
using namespace std;
#define SPEED \
ios::sync_with_stdio(false); \
cin.tie(0); \
co... | // By Debajit Chakraborty
#include <bits/stdc++.h>
using namespace std;
#define SPEED \
ios::sync_with_stdio(false); \
cin.tie(0); \
co... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 354 |
#include <bits/stdc++.h>
using namespace std;
long long v[200010];
int main() {
int n, k;
cin >> n >> k;
for (int i = 0; i < n; ++i)
cin >> v[i];
auto ver = [&](long long dk) {
long long cur = 0;
for (int i = 0; i < n; ++i) {
if (v[i] > dk)
cur += v[i] / dk;
}
return cur <... | #include <bits/stdc++.h>
using namespace std;
long long v[1000010];
int main() {
int n, k;
cin >> n >> k;
for (int i = 0; i < n; ++i)
cin >> v[i];
auto ver = [&](long long dk) {
long long cur = 0;
for (int i = 0; i < n; ++i) {
if (v[i] > dk)
cur += v[i] / dk;
}
return cur... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 169 |
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static BufferedReader in;
static PrintWriter out = new PrintWriter(System.out);
static String file = "../in";
static int test = 10; // 0 for local testing, 1 for std input
static int inf = 1_000_000, mod = 1_000_000_007;
void s... | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static BufferedReader in;
static PrintWriter out = new PrintWriter(System.out);
static String file = "../in";
static int test = 10; // 0 for local testing, 1 for std input
static int inf = 1_000_000, mod = 1_000_000_007;
void s... | [["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499]] | 3 | 1,194 |
n,k=map(int,input().split())
l=list(map(int,input().split()))
#(ng,ok]type
#if k==0:print(max(l));exit()
#(ng,ok]type
ok,ng=10**9+1,-1
def enough(x):
return sum( (i//x) for i in l if i>x)<=k
# [ok,ng)type->eraseng,ok=ok,ng
eps=10**(-3)
while abs(ok-ng)>1:
mid=(ok+ng)//2
if enough(mid):ok=mid
else:ng=mid... | n,k=map(int,input().split())
l=list(map(int,input().split()))
#(ng,ok]type
#if k==0:print(max(l));exit()
#(ng,ok]type
ok,ng=10**9+1,0
def enough(x):
return sum( (i//x) for i in l if i>x)<=k
# [ok,ng)type->eraseng,ok=ok,ng
eps=10**(-3)
while abs(ok-ng)>1:
mid=(ok+ng)//2
if enough(mid):ok=mid
else:ng=mid
... | [["-", 0, 1, 0, 662, 12, 432, 0, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 432, 0, 664, 28, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612]] | 5 | 119 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i <= n; i++)
#define per(i, n, x... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i <= n; i++)
#define per(i, n, x... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 276 |
import sys
input = sys.stdin.readline
N,K=map(int,input().split())
A=list(map(int,input().split()))
OK=10**9
NG=-1
while OK-NG>1:
mid=(OK+NG)//2
ANS=0
for a in A:
ANS+=(a-0.01)//mid
if ANS<=K:
OK=mid
else:
NG=mid
print(OK)
| import sys
input = sys.stdin.readline
N,K=map(int,input().split())
A=list(map(int,input().split()))
OK=10**9
NG=0
while OK-NG>1:
mid=(OK+NG)//2
ANS=0
for a in A:
ANS+=(a-0.01)//mid
if ANS<=K:
OK=mid
else:
NG=mid
print(OK)
| [["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 101 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define int long long
using namespace std;
int INF = 1e16 + 7;
void solve() {
int n, ... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define int long long
using namespace std;
int INF = 1e16 + 7;
void solve() {
int n, ... | [["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25]] | 1 | 195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.