description stringlengths 35 9.39k | solution stringlengths 7 465k |
|---|---|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, s;
cin >> n >> s;
long long sum = 0LL, min_vol = INT_MAX;
long long arr[n + 1];
for (int i = 0; i < n; i++) {
cin >> arr[i];
min_vol = min(min_vol, arr[i]);
sum += arr[i];
}
if (sum < s)
cout << "-1" << endl;
else {
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | # back to beginning
import math
n, s = input(). split()
n, s = int(n), int(s)
a = [int(i) for i in input(). split()]
a.sort()
for i in range (n) :
if a[i] > a[0] :
s -= a[i] - a[0]
if s <= 0 :
print(a[0])
break
if a[0] * n < s :
print (-1)
elif s > 0:
print(a[0] - math.ceil(s / n)) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int n;
long long s;
long long v[1005];
bool f(long long x) {
long long sum = 0;
for (int i = 0; i < n; i++) {
if (v[i] > x) {
sum += (v[i] - x);
}
}
return (sum >= s);
}
long long binSearch() {
long long low = 0, high = 1000000001, mid;
for (int i ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from math import ceil
n, s = map(int, input().split())
a = list(map(int, input().split()))
sm = min(a)
diff = 0
if sum(a) < s:
print(-1)
exit(0)
for i in a:
diff += i - sm
# print(diff)
if diff >= s:
print(sm)
else:
rem = s - diff
if diff == 0:
print(a[0] - int(ceil(s/n)))
# pri... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
l = [*map(int, input().split())]
sm = sum(l)
if sm < s:
print(-1)
exit(0)
m = min(l)
s -= sm - m * n
if s <= 0:
print(m)
else:
print(m - (s + n - 1)//n) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=map(int,input().split())
v=list(map(int,input().split()))
a=sum(v)
if a<s:
print(-1)
else:
z=min(v)
a-=s
print(min(z,a//n))
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
{
long long int n, k;
cin >> n >> k;
long long int ar[n];
for (long long int i = 0; i < n; i++) {
cin >> ar[i];
}
sort(ar, ar + n);
long long int mn = ar[0];
long long int sum = 0;
long long int extras = 0;
for (l... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
/* abhi2601 */
public class Q1 implements Runnable{
final static long mod = (long)1e9 + 7;
static class pair{
int a,b;
pair(int a,int b){
this.a=a;
this.b=b;
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n,s=map(int,input().split())
v=list(map(int,input().split()))
x=sum(v)
if s>x:
print(-1)
else:
a=min(v)
if s<x-n*a:
print(a)
else:
b=x-n*a
c=s-b
print(a-math.ceil(c/n)) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s = map(int,raw_input().split())
numbers = list(map(int,raw_input().split()))
total = 0
minimum = 10000000000
for i in numbers:
if i < minimum:
minimum = i
total += i
low = 0
high = minimum
middle = (low + high)>>1
if s <= total:
while (((total - n*middle) < s) or (total - (n*(middle+1) - 1) > s))... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial
n, s = map(int, stdin.readline().split())
values = list(map(int, stdin.readline().split()))
l, r = -1, min(values) + 1
while r - l > 1:
m = (l + r) >> 1
cnt = 0
for v in values:
cnt += v - m
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n, s = map(int, input().split())
arr = list(map(int, input().split()))
m = min(arr)
suum = sum(arr)
if suum >= s:
print(min((suum-s)//n, m))
else:
print(-1) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... |
import java.util.Arrays;
import java.util.Scanner;
/**
* @Created by sbhowmik on 10/12/18
*/
public class KvassAndTheFairNut {
public static void main(String []args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long t = scanner.nextLong();
int i = 0;
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, s, k = 0, m;
cin >> n >> s;
int ar[n];
for (long long j = 0; j < n; j++) {
cin >> ar[j];
k = k + ar[j];
}
m = *min_element(ar, ar + n);
if (k < s)
cout << "-1";
else {
for (long long j = 0; j < n; j++) {
s -= (... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from math import ceil
n, s = map(int, input().split())
l = list(map(int, input().split()))
ans = sum(l)
if n == 1 and s == l[0]:
print(0)
exit(0)
if ans < s:
print(-1)
exit(0)
minimal = min(l)
ans = 0
for i in range(len(l)):
if l[i] > minimal:
if ans + l[i] - minimal >= s:
l[i] ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
summa = sum(a)
if summa < s:
print(-1)
else:
answer = (summa - s)//len(a)
if answer > min(a):
answer = min(a)
print(answer) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
a = list(map(int, input().split()))
if sum(a)<s:
print(-1)
elif (sum(a)-s)//n>min(a):
print(min(a))
else:
print((sum(a)-s)//n) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from math import ceil
def kvass(arr,s):
if sum(arr) < s:
return -1
n = len(arr)
cap = 0
m = min(arr)
for i in xrange(n):
amt = arr[i]-m
cap += amt
arr[i] -= amt
if cap >= s:
return m
extra = s-cap
count = ceil(float(extra)/n)
return int(m-coun... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | //package dec18;
import java.util.Scanner;
public class Kvass1084B {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scn=new Scanner(System.in);
long n=scn.nextLong();
long s=scn.nextLong();
long[] arr=new long[(int)n];
long sum=0;
for(int i=0; i<n; i++)
{
arr[... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
long long ceil(long long x, long long y) {
if (!(x % y)) return (x / y);
return (x / y) + 1;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
;
long long n, m, x, y, b;
long long ans = LONG_MIN;
cin >> n >> m;
long long a[n];
long long mi ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 15;
const long long MOD = 1e9 + 7;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-8;
int _;
using namespace std;
long long num[1005];
long long N, S;
int main() {
ios::sync_with_stdi... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B_526 {
public static void main(String[] args) {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(S... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | ss = 0
n, s = map(int, input().split())
v = list(map(int, input().split()))
m,ss = min(v), sum(v)
if ss < s:
print(-1)
else:
print(min(m, (ss-s)//n)) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, s, sum = 0, minn = 0x3f3f3f3f;
cin >> n >> s;
for (int i = 0; i < n; i++) {
long long int a;
cin >> a;
minn = min(minn, a);
sum += a;
}
if (sum < s) {
cout << "-1" << endl;
} else {
cout << min(minn, (sum - s... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
n, s = mapin()
v = listin()
if sum(v) < s:
print(-1)
elif sum(v) == s:
print(0)
else:
v.sort()
t = sum(v) - v[0]*n
if s <= t:
print(v[0])
else:
s-=t
v... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s = map(int,input().split())
st = list(map(int,input().split()))
a,b = sum(st),min(st)
if a<s:
print(-1)
else:
c = a-n*b
if s<=c:
print(b)
else:
#print(s-c)
print(b-(s-c+n-1)//n)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
const int chartointdiff = 48;
bool isprime(int x) {
for (int i = 2; i <= sqrt(x); i++) {
if (x % i == 0) {
return 0;
}
}
return 1;
}
bool ispossible(long long minn, unsigned long long s,
vector<unsigned long long> arr) {
unsigned long l... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | # ***********************************************
#
# achie27
#
# ***********************************************
def retarray():
return list(map(int, input().split()))
import math
n, s = retarray()
a = retarray()
min_keg = min(a)
acc = 0
for x in a:
acc += (x - min_keg)
if acc >= s:
print(min_keg)
else:... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | line1 = [int(x) for x in input().split()]
line2 = [int(x) for x in input().split()]
n = line1[0]
v = line1[1]
def least_amount(n, v, line2):
total = sum(line2)
amount = min((total - v)//n, min(line2))
return amount if amount >= 0 else -1
print(least_amount(n, v, line2)) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=map(int,input().split())
v=sorted(list(map(int,input().split())))
m=min(v)
ss=sum(v)
if(s>ss):
print(-1)
else:
if(s<=ss-n*m):
print(m)
else:
s=s-ss+n*m
print(m-s//n-int(bool(s%n)))
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from os import path
import sys,time
# mod = int(1e9 + 7)
# import re
from math import ceil, floor,gcd,log,log2 ,factorial
from collections import defaultdict ,Counter , OrderedDict , deque
from itertools import combinations , groupby , zip_longest,permutations
# from string import ascii_lowercase ,ascii_uppercase
from ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.util.*;
import java.math.*;
public class Main {
public static void main(String ards[])
{
Scanner cin = new Scanner(System.in);
long n = cin.nextLong();
long s = cin.nextLong();
long sum = 0, minn = 1000000000;
for(int i = 0; i < n; i++)
{
long x = cin.nextLong();
minn ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | a,b=map(int,input().split())
z=list(map(int,input().split()))
s=sum(z);r=min(z)
if b>s:print(-1)
elif s-r*a>=b:print(r)
else:
f=b-(s-r*a)
print(max(0,(r-(f//a))-(0 if f%a==0 else 1))) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | N,S = map(int, input().split())
L = list(map(int, input().split()))
x = 0
for i in range (N):
x += L[i] - min(L)
if x >= S:
print(min(L))
elif S > sum(L):
print('-1')
else:
y = S - x
if y//N == y/N:
k = y//N
print(min(L) - k)
else:
k = y//N +1
print(min(L) - k) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.util.*;
public class B {
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
long n=sc.nextLong(),s=sc.nextLong();
long sum=0,min=Long.MAX_VALUE;
for(long i=0;i<n;i++){
long vi=sc.nextLong();
sum+=vi;
if(vi<min)
min=vi;
}
sc.close();
System.out.println(s>sum... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, s;
long long dp[1100];
long long sum = 0;
cin >> n >> s;
long long minn = 0x3f3f3f3f;
for (int i = 1; i <= n; i++) {
cin >> dp[i];
sum += dp[i];
minn = min(minn, dp[i]);
}
if (sum < s) {
printf("-1\n");
} else if (... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.*;
import java.math.*;
import java.io.*;
public class hacker
{
/*Fatt Gyi Bhai*/
//Dekh le mera code
public static boolean[] sieve(long n)
{
boolean[] prime = new boolean[(int)n+1];... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
long long n, s, v[1008], all, now, minn = 1000000008;
int main() {
scanf("%lld %lld", &n, &s);
for (long long i = 1; i <= n; i++) {
scanf("%lld", &v[i]);
all += v[i];
if (v[i] < minn) minn = v[i];
}
if (all < s) {
printf("-1\n");
return 0;
}
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
//import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.*;
public class PJ {
static HashMap<Long,Long> hs;
public static void main(St... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
int main(void) {
int n;
long long int s;
scanf("%d %lld", &n, &s);
std::vector<long long int> kvass(n);
for (int i = 0; i < n; i++) scanf("%lld", &kvass[i]);
std::sort(kvass.rbegin(), kvass.rend());
long long int remaining = s;
for (int i = 0; i < n - 1; i++) {
long long int... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n,s = map(int,input().split())
l = list(map(int,input().split()))
if sum(l) < s:
print(-1)
else:
x = min(l)
i = 0
while(i < len(l) and s > 0):
s = s-(l[i]-x)
i += 1
if s == 0 or s < 0:
print(x)
exit()
if s > 0:
print(x-math.ceil(s/n))
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, second;
cin >> n >> second;
vector<int> a(n);
long long mini = numeric_limits<int>::max();
long long sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
mini = min(mini, (long... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
num = list(map(int, input().split()))
x = sum(num)
if x < s:
print(-1)
else:
k = min(num)
for i in range(n):
s -= abs(num[i] - k)
num[i] = k
if s <= 0:
print(k)
else:
q = s // n
k -= q
if s % n == 0:
print(k... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n,s = [int(x) for x in input().split()]
v = [int(x) for x in input().split()]
if(sum(v) < s):
print(-1)
exit()
m = min(v)
for i in range(len(v)):
s -= v[i] - m
if(s <= 0):
print(m)
else:
print(m - (s + n - 1) // n) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import os, sys, bisect
from collections import defaultdict, Counter, deque;
from functools import lru_cache #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
input = lambda: sys.stdin.readline().strip()
imap = lambda: map(in... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
summ = 0
minn = 10000000000
for v in map(int, input().split()):
minn = min(minn, v)
summ += v
if summ < s:
print("-1")
else:
print(min(minn, (summ - s) // n))
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Kvass {
static BufferedReader _in = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer _stk;
static String next() {
try {
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
Outp... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
long long n, s, z;
cin >> n >> s;
for (long long i = 0; i < n; i++) {
cin >> z;
v.push_back(z);
}
sort(v.begin(), v.end());
for (long long i = n - 1; i > 0; i--) {
if (v[i] - v[0] >= s) {
v[i] = v[i] - s;
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
minb=min(b)
if sum(b)-minb*len(b)>=s:
print(minb)
elif sum(b) - minb*len(b)<s:
s-=(sum(b) - minb*len(b))
ot=minb-(s//len(b))
if s%len(b)!=0:
ot-=1
if ot>=0:
print(ot)
else:
print(-1)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
ar = list(map(int, input().split()))
m = min(ar)
x = 0
for i in ar:
x += i - m
if x >= s:
print(m)
else:
left = s - x
print(max(m - ((left - 1) // n + 1), -1))
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int n;
long long s;
long long a[1003];
int main() {
scanf("%d%lld", &n, &s);
for (int i = 1; i <= n; i++) scanf("%lld", a + i);
int flag = 0;
sort(a + 1, a + 1 + n);
long long temp = 0;
for (int i = n; i >= 1; i--) {
temp += a[i];
}
if (temp < s) {
p... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.util.*;
import java.io.*;
public class Solution {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] inp2 = br.readLine().trim().split("\\s");
String inp1[] = br.readLine().trim().split("\... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=list(map(int,input().split()))
a=list(map(int,input().split()))
p=sum(a)
m=min(a)
if(s>p):
print(-1)
elif(p==s):
print(0)
elif(s<=p-(n*m)):
print(m)
else:
s=s-(p-(n*m))
p=n*m
p=p-s
print(p//n)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | line = input()
n, s = [int(x) for x in line.split()]
line = input()
vs = [int(x) for x in line.split()]
sm = sum(vs)
if sm < s:
print(-1)
else:
mn = min(vs)
tot = sum([x - mn for x in vs])
if tot < s:
diff = s - tot
mn -= int(diff/n)
dv = 1 if diff % n > 0 else 0
mn -= dv
print(mn) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n,s=map(int , input().split())
result=[int(i) for i in input().split()]
result.sort(reverse=True)
tot=sum(result)
if tot<s:
print(-1)
elif tot==s:
print(0)
else:
x=tot-(result[-1]*n)
a=n*result[-1]
if s<=x:
print(result[-1])
else:
p=s-x
a=math.ceil(p/n)
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
long long s, k, n, minx = 1e9 + 3, i = 0, t;
int main() {
for (cin >> n >> s; i < n; i++) cin >> k, minx = min(minx, k), t += k;
if (t < s) return cout << -1, 0;
if (t - minx * n < s) return cout << (t - s) / n, 0;
cout << minx;
}
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import sys
from math import ceil
if __name__ == "__main__":
n, s = [int(val) for val in input().split()]
a = [int(val) for val in input().split()]
total = sum(a)
if(total < s):
print("-1")
else:
summ = 0
smallest = min(a)
for i in a:
summ += abs(sm... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, i;
long long s, sum = 0;
cin >> n >> s;
long long v[n];
for (i = 0; i < n; i++) {
cin >> v[i];
sum += v[i];
}
if (sum < s) {
cout << -1 << endl;
return 0... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int n, a[1001], mn = INT_MAX;
long long s, cnt = 0;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> s;
for (int i = 1; i <= n; i++) {
cin >> a[i];
mn = min(mn, a[i]);
}
for (int i = 1; i <= n; i++) {
cnt += a[i] - ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #!/usr/bin/env python3
n, s = map(int, input().split())
l = list(map(int, input().split()))
if sum(l) < s:
print(-1)
else:
print(min((sum(l)-s)//n, min(l)))
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=map(int,raw_input().split())
l=list(map(int,raw_input().split()))
u,a=sum(l),min(l)
if u<s:
print -1
else:
v=u-s
print min(a,v//n) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
map<int, int> m;
void primeFactors(int n) {
while (n % 2 == 0) {
m[2]++;
n = n / 2;
}
for (int i = 3; i <= sqrt(n); i = i + 2) {
while (n % i == 0) {
m[i]++;
n = n / i;
}
}
if (n > 2) m[n]++;
}
long long gcd(long long a, long long b) {
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n,k=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
total=sum(arr)
if(total<k):
print(-1)
elif(total==k):
print(0)
else:
smallest=min(arr)
rem=total-n*smallest
if(rem>=k):
print(smallest)
else:
rem=k-rem
print(smallest-(int)(math.ceil(rem/n))) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
long n = sc.nextLong();
long s = sc.nextLong();
long min = 999999999;
long sum=0;
for(int i=0;i<n;i++) {
long t ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=map(int,input().split())
a=list(map(int,input().split()))
m=min(a)
l=0
if sum(a)<s:
print(-1)
if sum(a)>s:
for i in range(n):
l+=a[i]-m
if l>=s:
print(m)
else:
res=s-l
b=res//n
m-=b
if res%n!=0:
m-=1
print(m)
if sum(a)==s:
print(0) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
long long total = 0;
long long s;
long long arr[10000];
scanf("%lld%lld", &n, &s);
long long mini = 1e9 + 5;
for (int i = 0; i < n; i++) {
scanf("%lld", &arr[i]);
total += arr[i];
if (arr[i] < mini) mini = arr[i];
}
if... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n=input().split()
a=input().split()
for i in range(int(n[0])):
a[i]=int(a[i])
a.sort()
a=a[::-1]
v=int(n[1])
f=0
mi=0
for j in range(int(n[0])):
if a[-1]!=a[j]:
v-=a[j]-a[-1]
a[j]=a[-1]
if v<=0:
print(a[-1]-f)
break
if v>0:
if v>int(n[0])*(a[0]-f):
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.*;
import java.util.*;
import java.math.*;
public class c2
{
static Scanner sc;
static PrintStream ps;
public static void main(String [] args)
{
ps= System.out;
sc= new Scanner(System.in);
int n = sc.nextInt();
long s = sc.nextLong();
long sum = 0;
long min = 1000000000;
long [] ar = n... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
u = list(map(int, input().split()))
mu = min(u)
su = sum(u)
if su < s:
print(-1)
else:
s -= (su - mu * n)
if s <= 0:
print(mu)
else:
k = s // n
if s % n != 0:
k += 1
print(mu - k)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.*;
import java.util.*;
public class Main {
private static final int MAX = Integer.MAX_VALUE;
private static final int MIN = Integer.MIN_VALUE;
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #Winners never quit, quiters never win............................................................................
from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
def factors(n): ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from sys import stdin, stdout
from math import *
from heapq import *
from collections import *
def tryLeastkeg(mink):
i=n-1
k=0
t=0
while(i>=0):
if (v[i]>mink):
t=t+(v[i]-mink)
k=k+1
if (t>=s):
return True
i=i-1
return False
def ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class KvassAndFairNut {
private static final FastReader in = new FastReader();
private static final PrintWriter out = new PrintWriter(System.out);
public... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, raw_input().split())
v = map(int, raw_input().split())
tot = sum(v)
if tot < s:
print -1
else:
lo = 0
hi = max(v)
while lo +1 < hi:
mid = (lo+hi)/2
#print "trying", mid, "hi", hi, "lo", lo
amt = sum(map(lambda vi: max(0, vi-mid), v))
#print "amt",... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | R = lambda: map(int,input().split())
n,m = R()
L = list(R())
if sum(L) < m:
print(-1)
else:
mi = min(L)
for i in range(n):
if m > 0:
m -= (L[i]-mi)
else:
break
if m <= 0:
print(mi)
else:
print(mi-((m+n-1)//n)) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (a == 0 || b == 0) return 0;
if (a == b) return a;
if (a > b) return gcd(a % b, b);
return gcd(a, b % a);
}
long long int max(long long int a, long long int b) {
if (a > b) return a;
return b;
}
long long ... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, raw_input().split())
v = sorted(map(int, raw_input().split()))
total = sum(v)
if total < s:
print '-1'
else:
mx = min(v)
r = total - mx * n
if s <= r:
print mx
else:
ex = (s-r+n-1) // n
print mx - ex
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, s = map(int, input().split())
v = list(map(int, input().split()))
v.sort(key=lambda x:-x)
sm = 0
out = v[-1]
for i in range(n - 1):
sm += v[i] - v[-1]
out += v[i]
if out < s:
print(-1)
exit(0)
if sm >= s:
print(v[-1])
exit(0)
print(v[-1] - (s - sm - 1) // n - 1) |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class _1084B {
public static void main(String[] args) {
InputStream inputStream = System.in;
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long INF = 1e7;
signed main() {
cin.tie(0), ios_base::sync_with_stdio(false);
;
long long n, s;
cin >> n >> s;
vector<long long> arr(n);
long long su = 0, mi = 1e18;
for (long long i... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == n... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1100;
int n;
long long s, v[MAXN];
int main() {
ios::sync_with_stdio(0);
while (cin >> n >> s) {
long long S = 0, maxi = 1, mini = 1e9 + 1;
for (int i = (0); i < (n); i++) {
cin >> v[i];
maxi = max(maxi, v[i]);
mini = min(mini,... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... |
// 526 - Dev 2 - B
import java.io.IOException;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static long calculate() {
int n = sc.nextInt();
long s = sc.nextLong();
long v[] = new long[n];
long sum = 0,min = Integer.MAX_VA... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<long long int> v;
long long int n, s, x, counter = 0, mini = INT_MAX;
cin >> n >> s;
for (int i = 0; i < n; i++) {
cin >> x;
v.push_back(x);
counter += x;
mini = min(mini, x);
}
if (counter - s < 0)
cout << -1 << endl;
e... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n ,m = [int(i) for i in input().split()]
v = [int(i) for i in input().split()]
if sum(v) < m:
print(-1)
else:
st = 0
en = min(v)+1
while(st < en):
mid = (st+en)//2
cnt = 0
for i in v:
cnt += i - mid
if(cnt >= m):
st = mid+1
else:
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
int v[1010];
int main() {
long long n, s;
cin >> n >> s;
long long sum = 0;
long long least = 1e9 + 10;
for (long long i = 0; i < n; i++) {
cin >> v[i];
sum += v[i];
least = min(least, (long long)v[i]);
}
if (sum < s) {
cout << -1 << endl;
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | def inint():
return int(input())
def inlist():
return list(map(int,input().split()))
def main():
n,s=inlist()
a=inlist()
sm=sum(a)
if s>sm:print(-1);return
lst=min(a)
sm1=sm-lst*n
if s<sm1:print(lst)
else:
from math import ceil
print(lst-ceil((s-sm1)/n))
if __na... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n,s=map(int,input().split())
a=list(map(int,input().split()))
before,after,mini=0,0,10**12
for i in range(n):
before+=a[i]
mini=min(mini,a[i])
after=before-s
if after<0:
print("-1")
exit()
each=int(after/n)
if mini<each:
print(mini)
else :
print(each)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n, s = map(int, input().split())
kegs = [int(k) for k in input().split()]
if s > sum(kegs):
print(-1)
exit()
opsleft = s
minimum = min(kegs)
amtleft = 0
for keg in kegs:
amtleft += keg-minimum
if s <= amtleft:
print(minimum)
else:
res = minimum - math.ceil((s - amtleft) / n)
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
using namespace std;
long long n, s, res, a[1001001], mx, mxi, m, req, cur;
int main() {
cin >> n >> req;
for (int i = 0; i < n; i++) {
cin >> a[i];
s += a[i];
}
if (s < req) {
cout << -1;
return 0;
}
sort(a, a + n);
for (int i = 1; i < n; i++) {
cur += (a[i] -... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | #include <bits/stdc++.h>
long long in() {
char ch;
long long x = 0, f = 1;
while (!isdigit(ch = getchar())) (ch == '-') && (f = -f);
for (x = ch ^ 48; isdigit(ch = getchar());
x = (x << 1) + (x << 3) + (ch ^ 48))
;
return x * f;
}
const long long inf = 999999999999999LL;
const int maxn = 1050;
long... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from math import ceil
n,s=list(map(int,input().split()))
liter_li=list(map(int,input().split()))
if sum(liter_li)<s:
print(-1)
else:
if s<=sum(liter_li)-min(liter_li)*n:
print(min(liter_li))
else:
s-=sum(liter_li)-min(liter_li)*n
a=int(ceil(s/n))
print(min(liter_li)-a)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
InputStream... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | n, S = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
def ans():
global S
to_min = sum(A) - n*min(A)
S -= to_min
if S <= 0:
return min(A)
if n*min(A) < S: return -1
return (n*min(A) - S) // n
print(ans())
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import java.util.Arrays;
import java.util.Scanner;
public class B526 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner obj=new Scanner(System.in);
long n=obj.nextInt();
long s=obj.nextLong();
long arr[]=new long[(int) n];
long su=0;
for(long i=0;i<n;i++)
{
arr[(i... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | R=lambda:map(int,raw_input().split())
n,m=R()
a=sorted(R())
s=sum(a)
if s<m:
print -1
elif s-a[0]*n<m:
print (s-m)/n
else:
print a[0] |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n, s = map(int, input().split())
x = list(map(int, input().split()))
cur_min = min(x)
sum_x = sum(x)
ans = 0
if sum_x < s:
print(-1)
else:
ans = sum_x - n * cur_min
if ans < s:
cur_min -= math.ceil((s - ans) / n)
print(cur_min)
|
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | import math
n,k = map(int, input().strip().split(' '))
lst = list(map(int, input().strip().split(' ')))
s=sum(lst)
if s<k:
print(-1)
else:
c=0
m=min(lst)
for i in range(n):
c+=lst[i]-m
lst[i]=m
if c>=k:
print(m)
else:
k-=c
c1=k%n
if c1==0:
... |
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ... | from sys import stdin, stdout
input = stdin.readline
rstr = lambda: input().strip()
rstrs = lambda: [str(x) for x in input().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint = lambda: int(input())
rints = lambda: [int(x) for x in input().split()]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.