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 ... | import java.util.Arrays;
import java.util.Scanner;
public class Kvass526B {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int kegs = s.nextInt();
long glass = s.nextLong();
long sum =0l;
int arr[] = new int[kegs];
for(int i =0;i<kegs;i++) {
arr[i] = s.nextInt();
... |
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 Main {
public static void main(String []args) {
Scanner input=new Scanner (System.in);
while(input.hasNext()) {
long sum=0;
int a=input.nextInt();
long min=999999999;
long b=input.nextLong();
int w[]=new... |
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 itertools import cycle
if __name__ == '__main__':
n, s = [int(j) for j in input().split(' ')]
V = [int(j) for j in input().split(' ')]
V = sorted(V, reverse=True) + [0]
diffs = [V[i] - V[i+1] for i in range(len(V)-1)]
i = 0
last_i = len(V)-2
for i in range(len(V)-1):
v = 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 ... | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main implements Runnable {
int maxn = (int)1e3+111;
int inf = (int)1e9;
long mod = (long)1e9+7;
int n,m,k;
long a[] = new long[maxn];
void solve() throws Exception {
n = in.iInt();
long s = in.lL... |
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 i, j = 0, k, n, s, sum = 0;
cin >> n >> s;
long long int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
sum = sum + a[i];
}
if (s > sum) {
cout << -1;
return 0;
}
if (s == sum) {
cout << 0;
return 0;
}
sor... |
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
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
from collections import deque
n,k=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)<k:
print(-1)
else:
t=0
m=min(l)
for i in range(n):
t+=l[i]-m
l[i]=m
if t>=k:
print(m)
else:
k-=t
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())
v = [int(x) for x in input().split()]
t = sum(v)
if sum(v) < s:
print(-1)
exit(0)
b = min(v)
kol = t - b * n
s -= kol
if s <= 0:
print(b)
exit(0)
tmp = (s + n - 1) // n
print(b - tmp)
|
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 codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{ int i,j,x;
BufferedReader br=new Buffe... |
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 v[1009], n, s, sum;
long long maxx, minn;
int main() {
minn = 0x3f3f3f3f3f;
sum = 0;
scanf("%lld%lld", &n, &s);
for (int i = 0; i < n; i++) {
scanf("%lld", &v[i]);
sum += v[i];
minn = min(minn, v[i]);
}
if (sum < s) {
printf("-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 java.util.*;
public class waw{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long s = sc.nextLong();
long[] t = new long[n];
long min;
t[0] = sc.nextLong();
min = t[0];
for(int i=1;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.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
long m = sc.nextLong();
long[] arr = new long[n + 1];
long sum = 0;
long min = Integer.MAX_VALUE;
for (int i = 1; i <= n; 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>
using namespace std;
long long int n, s;
long long int kegs[1002];
bool posible(long long int act) {
long long int suma = 0;
for (int i = 1; i <= n; i++) {
if (kegs[i] > act) {
suma += (kegs[i] - act);
} else {
if (kegs[i] < act) return false;
}
}
if (suma >= 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
n, s =list(map(int, input().split()))
keg=list(map(int, input().split()))
keg.sort()
ans=-1
while(s>0):
cmin=keg[0]
if(keg[0]<keg[-1]):
for q in range(len(keg)):
if(s<1):
break
if(keg[q]>cmin):
if(s>keg[q]-cmin):
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=map(int,input().split())
v=list(map(int,input().split()))
if sum(v)<s:
print("-1")
else:
p=min(v)
k=0
for i in v:
if i>p:
k+=i-p
if k>=s:
print(p)
else:
x=s-k
if x%n==0:
print(p-x//n)
else:
print(p-x//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 ... |
no_of_glass , kvass_needed = map(int,input().split())
volume = list(map(int,input().split()))
volume.sort()
temp = list(volume)
kvass_filled = 0
flag = 0
for i in range(1,no_of_glass):
sub = volume[i] - volume[0]
if(kvass_filled >= kvass_needed ):
flag = 1
break
if(kvass_filled + sub... |
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())
arr = [int(x) for x in input().split()]
def get_extra(mn):
global arr, s
ret = 0
for x in arr:
if x > mn :
ret += x-mn
if ret >= s :
return True
else:
return False
if(sum(arr) < s):
print("-1")
exit()
start = 0
en... |
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()))
if s > sum(a):
print(-1)
elif s == sum(a):
print(0)
else:
a = sorted(a)
total = sum(a)
b = [0 for _ in range(len(a))]
b[0] = a[0]
for i in range(1, len(a)):
b[i] = a[i] + b[i-1]
c = [0 for _ in range(len(... |
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())
allCups = list(map(int, input().split()))
sumK = sum(allCups)
minK = min(allCups)
if sumK < s:
print(-1)
else:
if sumK - (minK * n) >= s:
print(minK)
else:
s = s - (sumK - (minK * n))
#print(s)
if s % n == 0:
print(minK - (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
n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
if sum(A) < s:
print(-1)
else:
x = min(A)
y = 0
for k in range(n):
y += (A[k] - x)
if y >= s:
print(x)
else:
a = s - y
print(x - ceil(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 ... | from sys import stdin,stdout
from itertools import combinations
from collections import defaultdict
def listIn():
return list((map(int,stdin.readline().strip().split())))
def stringListIn():
return([x for x in stdin.readline().split()])
def intIn():
return (int(stdin.readline()))
def stringIn():
... |
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, m;
cin >> n >> m;
long a[n];
long long sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
sort(a, a + n, greater<int>());
if (sum < m) {
cout << "-1\n";
} else if (sum == m) {
cout << "0\n";
} els... |
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 =[int(x) for x in raw_input().split()]
v.sort();
su =sum(v)
if su < s:
print -1
else:
df = su-s
df/=n
print min(df,v[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 ... | n,s=map(int,input().split())
a=list(map(int,input().split()))
mini=min(a)
sumi=0
for i in range(n):
sumi+=abs(a[i]-mini)
if(s<=sumi):
print(mini)
else:
if(sumi+n*mini>=s):
rest=s-sumi
if(rest%n==0):
part=rest//n
print(mini-part)
else:
part=rest//n
print(mini-part-1)
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 math, sys, itertools
def mp():
return list(map(int, input().split()))
def main():
n, s = mp()
a = mp()
sm = sum(a)
if sm < s:
print(-1)
return
ans = (sum(a) - s) // n
print(min(ans, min(a)))
deb = 0
if deb:
file = open('input.txt', 'r')
input = file... |
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 a[4];
int main() {
int n, i, j;
long long s, sum = 0, min = 1000000010, v, temp;
cin >> n >> s;
for (i = 0; i < n; i++) {
cin >> v;
if (v < min) min = v;
sum += v;
}
if (sum < s)
cout << -1 << endl;
else {
temp = min * n;
if ((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 ... | values = map(int, raw_input().split())
n, s = values[0], values[1]
arr = map(int, raw_input().split())
arr= sorted(arr)
def get_result(arr, n, s):
if sum(arr) < s:
return -1
mini = min(arr)
for i in range(len(arr)):
s -= arr[i] - mini
arr[i] = mini
if s <= 0:
return 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 ... | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "... |
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 long long N = 1e5 + 5;
long long mod = 1e9 + 7;
vector<long long> v;
long long n, s;
bool check(long long x) {
long long sum = 0;
for (long long i = 0; i < n; i++) {
sum += (v[i] - x);
}
return sum >= s;
}
int main() {
ios_base::sync_with_stdio(0);
cin... |
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
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
n,s=map(int, raw_input().split())
v=[]
v=map(int, raw_input().split())
mini=10000000000000000000000000000
for i in xrange(0,n):
mini=min(mini,v[i])
see=0
sumi=0
for i in xrange(0,n):
see=see+v[i]-mini
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() {
cin.tie(0)->sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
long long n, s;
cin >> n >> s;
vector<long long> v;
long long sum = 0;
for (int i = 1; i <= n; i++) {
long long x;
cin >> x;
v.push_back(x);
sum += x;
}
if (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 ... | from sys import stdin
import math
# main starts
n, s = list(map(int, stdin.readline().split()))
arr = list(map(int, stdin.readline().split()))
arr.sort()
mn = min(arr)
diff = 0
for i in range(1, n):
diff += arr[i] - mn
if diff >= s:
print(mn)
exit()
else:
if diff + mn * n >= s:
s -= diff
... |
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)
else:
x=0
m=min(a)
for i in range(n):
x+=(a[i]-m)
if(s<=x):
print(m)
else:
d=s-x
y=d//n
r=d%n
if(r!=0):
y+=1
print(m-y) |
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 ... | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
private static long MOD = 1000L * 1000L * 1000L + 7;
private static final int[] dx = {0, -1, 0, 1};
private static final int[] dy = {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;
template <class T>
T abs(T x) {
if (x < 0) return -x;
return x;
}
template <class T>
T sqr(T a) {
return a * a;
}
const double pi = acos(-1.0);
const double eps = 1e-8;
long long i, j, mn, x, z, sum, ar[100010], n, s;
int main() {
while (2 == scanf("%lld%lld", &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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(String[] args) {
... |
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 f(a):
return a - MIN
n, s = list(map(int, input().split()))
v = list(map(int, input().split()))
if s > sum(v):
print(-1)
else:
MIN = min(v)
new_v = list(map(f, v))
S = sum(new_v)
if S >= s:
print(MIN)
else:
s -= S
k = (s - 1) // n + 1
print(MIN - 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,c=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
if s<c:
print(-1)
exit(0)
r=0
m=min(a)
for i in a:
r+=(i-m)
if r>=c :
print(m)
else:
print(m-(math.ceil((c-r)/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 ... | #------------------------------what is this I don't know....just makes my mess faster--------------------------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer =... |
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 N = 1000;
int n;
long long int sum, wanted;
int vol[N];
void read() {
cin >> n >> wanted;
for (int i = 0; i < n; i++) cin >> vol[i];
}
void init() {
for (int i = 0; i < n; i++) sum += vol[i];
}
int ans() {
for (int i = 1; i < n; i++) {
int dif = vol[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.math.*;
import java.io.*;
public class ok{
static FastReader scan=new FastReader();
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
static LinkedList<Edge>edges[];
static boolean stdin = true;
static String filein = "input";
static ... |
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() {
long long n, s, sum = 0, m = 9999999999;
scanf("%lld %lld", &n, &s);
for (int i = 0; i < n; i++) {
long long t;
scanf("%lld", &t);
m = m < t ? m : t;
sum += t;
}
if (sum < s)
printf("-1\n");
else
printf("%lld\n", m < (sum - s) / n ? m : (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 ... | n, s = map(int, input().split())
arr = list(map(int, input().split()))
sno = arr[0]
for i in range(0, len(arr)):
if arr[i] < sno:
sno = arr[i]
for i in range(0, len(arr)):
if arr[i]-sno < s:
s -= (arr[i]-sno)
arr[i] = sno
else:
print(sno)
exit()
if s == 0:
print... |
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 N = 1e3 + 5;
const int M = 1e4 + 5;
int n, m, w, vis[N], l[N], r[N];
long long a[N], ans[N], s;
int main() {
cin >> n >> s;
long long sum = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
sum += a[i];
}
if (sum < s) {
cout << -1 << endl;
r... |
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 Sol
{
public static void main(String args[])throws IOException
{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
String t1[]=obj.readLine().split(" ");
long n=Long.parseLong(t1[0]);
long k=Long.parseLong(... |
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 ... | __author__ = 'tanunia'
from sys import stdin
n, s = [int(x) for x in stdin.readline().strip().split()]
v = [int(x) for x in stdin.readline().strip().split()]
if sum(v) < s:
print -1
exit()
min_v = min(v)
for i in xrange(len(v)):
s -= (v[i] - min_v)
v[i] -= min_v
if s <= 0:
print min_v
exit(... |
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()))
if sum(l)<s:
print('-1')
else:
l.sort()
ans=0
val=l[0]
check=0
for i in range(1,n):
ans+=l[i]-val
if n==1:
print(l[0]-s)
elif ans>=s:
print(val)
else:
remain=s-ans
we=remain//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 math
n, s = map(int, input().split())
arr = list(map(int, input().split()))
if sum(arr) < s:
print('-1')
else:
mn = min(arr)
sm = [x-mn for x in arr]
sum_arr = sum(sm)
if sum_arr >= s:
print(mn)
else:
s -= sum_arr
c = s/n
print(mn-math.ceil(c))
|
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 Main {
static long a[]=new long [2000];
public static void main(String args[])
{
//System.out.println(1);
Scanner input=new Scanner(System.in);
int n;long k;
n=input.nextInt();k=input.nextLong();
long sum=0;
for(int i=1;i<=n;i++)
{
a[i]=input.nextLong();sum+=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 ... |
def solve():
n, s = map(int, input().split())
v = list(map(int, input().split()))
sv = sum(v)
if sv < s:
print(-1)
return
mnf = min(v)
top = 0
for x in v:
top += max(0, x - mnf)
if top >= s:
print(mnf)
return
s -= top
mnf -= 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
n,s=map(int,input().split())
a=[int(s) for s in input().split()]
a.sort()
if sum(a)<s:
print(-1)
else:
sum=0
for i in range(n-1,0,-1):
sum+=a[i]-a[0]
if sum>=s:
print(a[0])
else:
print(a[0]-math.ceil((s-sum)/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, v = map(int, input().split())
a = [int(el) for el in input().split()]
a.sort()
mm = 0
for i in range(n):
mm += a[i] - a[0]
v = max(0, v - mm)
d = v // n
k = v % n
a[0] -= d
if k != 0:
a[0] -= 1
if a[0] < 0:
print(-1)
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 java.util.*;
import java.io.*;
import java.lang.*;
public class programA {
public static void merge(long arr[], int l, int m, int r)
{
// Find sizes of two subarrays to be merged
int n1 = m - l + 1;
int n2 = r - m;
/* Create temp arrays */
long L[] = new 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())
list=[int(i) for i in input().split()]
list.sort(reverse=True)
if(sum(list)<s):
print("-1")
exit()
for i in range(n-1):
s-=(list[i]-list[n-1])
list[i]=list[n-1]
if(s<=0):
print(list[n-1])
exit()
if(s<=n):
print(list[0]-1)
exit()
else:
if(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.Arrays;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) throws IOException {
new B().solve();
}
public BufferedReader reader = new BufferedReader... |
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()))
least = min(v)
if sum(v) < s:
print(-1)
else:
for i in v:
s -= (i-least)
if s > 0:
least -= ((s+n-1)/n)
print(math.ceil(least))
|
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;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, k;
cin >> n >> k;
vector<long long> a;
long long x;
for (long long i = 0; i < n; i++) {
cin >> x;
a.push_back(x);
}
long long sum = 0;
for (auto &i : a) sum += 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 ... | # python b.py < b.txt
import sys
from math import ceil
from os.path import isfile
fin, fout = (open("b.in"), open("b.out", "w")) if isfile("b.in") else (sys.stdin, sys.stdout)
def ris(): return map(int, fin.readline().split())
def ri(): return int(fin.readline())
n,s = ris()
v = sorted(ris(), reverse=True)
mn = 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 ... | 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 ... | #########################################################################################################\
#########################################################################################################
###################################The_Apurv_Rathore#####################################################
#... |
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 ... | if __name__ == "__main__":
n, desired_volume = map(int, raw_input().split())
volumes = list(map(int, raw_input().split()))
min_volume = min(volumes)
for v in volumes:
if desired_volume > 0:
desired_volume -= v - min_volume
else:
break
if desired_volume < 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;
const long long N = 100005;
long long A[N];
long long fnc(long long h, long long n) {
long long sum = 0;
for (__typeof((n)) i = (1); i <= (n); i++) {
if (A[i] >= h) sum += A[i] - h;
}
return sum;
}
void solve() {
long long n, k, x;
cin >> n >> k;
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 ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m;
cin >> n >> m;
long long int a[n];
long long int minn = INT_MAX;
long long int sum = 0;
for (long long int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] < minn) minn = a[i];
sum += a[i];
}
long long int x = minn * 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 n, s, i, sum = 0, k = 0, m, d, c = 0;
cin >> n >> s;
long long arr[n];
for (i = 0; i < n; i++) {
cin >> arr[i];
sum += arr[i];
}
if (sum < s)
cout << "-1\n";
else if (sum == s)
cout << "0\n";
else {
sort(arr, 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 ... |
import sys
if __name__ == '__main__':
input = sys.stdin.read()
n, s, *a = list(map(int, input.split()))
a.sort()
minimum = a[0]
sum1 = 0
for i in range(n):
sum1 += a[i] - minimum
if s > sum1 + n *minimum:
print(-1)
elif s <= sum1:
print(minimum)
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 main() {
long long int n, k;
cin >> n >> k;
long long int a[n];
for (long long int i = 0; i < n; i = i + 1) cin >> a[i];
sort(a, a + n);
long long int extra = 0;
long long int sum = a[0];
for (long long int i = n - 1; i > 0; i = i - 1) {
extra += (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 ... | n , s = [int(x) for x in input().split()]
v = [int(x) for x in input().split()]
b = [0 for i in range(n)]
rem = 0
if sum(v) < s:
print(-1)
else:
mn = min(v)
m = mn
for i in range(n):
b[i] = v[i] - mn
sm = sum(b)
if sm >= s:
print(mn)
else:
rem = 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 java.io.*;
import java.util.*;
/**
* @authod Rashedul Hasan Rijul
*/
public class Solution {
FastReader fastReader;
int n;
long s, sum;
long[] v;
public Solution() {
}
public Solution(FastReader fastReader) {
this.fastReader = fastReader;
}
public void solve()... |
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()]
L = [int(x) for x in input().split()]
S = sum(L)
mi = min(L)
equal = S-mi*n
if s > S:
print(-1)
else:
if s <= equal:
print(mi)
else:
print(mi-((s - equal-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 ... | n,s=map(int,input().split())
a=list(map(int,input().split()))
mn=min(a)
#print(sum(a))
if sum(a)<s :
print(-1)
else : print(min(mn,(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 ... |
import java.io.*;
import java.util.*;
public class Main {
final static long mod = 1000000007;
static void debug(Object... args)
{System.out.println(Arrays.deepToString(args));}
public static void main(String[] args) throws Exception {
InputReader sc = new InputReader(System.in);
PrintWr... |
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().strip().split())
v = list(map(int, input().strip().split()))
m = min(v)
for i in v:
if s > 0: s -= i - m
from math import ceil
if m * n < s: print(-1)
elif s <= 0: print(m)
else: print(m - 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 ... |
import java.util.Arrays;
import java.util.Scanner;
public class Substitute {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
long requi = s.nextLong();
long arr[] = new long[n];
long sum = 0;
for (int i = 0; i < 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
n, s = map(int, input().split())
v = list(map(int, input().split()))
V = sum(v)
m = min(v)
if V<s:
answer = -1
else:
v.sort(reverse=True)
V_over = [0]*n
V_over[0] = v[0]-m
for i in range(1,n):
V_over[i] = V_over[i-1] + (v[i]-m)
if V_over[-1]<=s:
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())
v = [int(k) for k in input().split()]
v.sort(reverse=True)
for i in range(n):
s -= v[i] - v[-1]
v[i] = v[-1]
if s <= 0:
print(v[-1])
else:
if s > n * v[0]:
print(-1)
else:
print(v[0] - (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 ... | from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor
from itertools import *
from fractions import Fraction
import string
import copy
import random
import bisect
from decimal import *
from collections import deque
from sys import *
digs = string.digits + string... |
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 code;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.awt.Point;
/**
*
* @author prabhat // use stringbuilder,TreeSet, priorityQueue, x+y=(x&y + x|y);
*/
public class a
{
public static int n,max1=100005,... |
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=[3,14]
# y=[3,4,5]
n,s=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
if s>sum(y):print(-1)
elif s==sum(y):print(0)
else:
m=min(y)
bk=sum([i-m for i in y])
if s<=bk:print(m)#沑ζε¨ε°ζε°ηζζ±
else:
s1=s-bk
m-=s1//n
if s1%n!=0:m-=1
print(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 ... | n, s = list(map(int, input().split()))
v = list(map(int, input().split()))
total_kvass = sum(v)
if total_kvass < s:
print(-1)
exit(0)
r = min((total_kvass - s) // n, sorted(v)[0])
print(r)
|
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;
template <typename T>
void _dbg(const char* _s, T _h) {
cerr << _s << " = " << _h << "\n";
}
template <typename T, typename... Ts>
void _dbg(const char* _s, T _h, Ts... _t) {
int _b = 0;
while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',') cerr << *_s++;
ce... |
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 solve(n, vol, kegs):
if sum(kegs) < vol:
return -1
totalVolume = sum(kegs)
allMin = min(kegs) * n
finalVolume = totalVolume - vol
if finalVolume >= allMin:
return min(kegs)
return int(finalVolume / n)
n, vol = list(map(int, input().split()))
kegs = list(map(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 ... | import java.util.Scanner;
public class KvassAndTheFairNut2 {
static long sum = 0;
static long n = 0;
static long s = 0;
static long[] kegs = new long[1001];
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextLong();
s = in.nextLong();
... |
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 = input()
tokens = line1.split()
n = int(tokens[0])
v = int(tokens[1])
line2 = input()
tokens = line2.split()
lst = []
for j in range(n):
lst.append(int(tokens[j]))
minv = min(lst)
total = sum(lst)
if total < v:
print('-1')
else:
minv = min(int((total - v ) / n), minv)
print(minv)
|
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 test {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
long s,minn=Long.MAX_VALUE,temp=0,ans=-1,tot=0;
int n=sc.nextInt();
s=sc.nextLong();
Long arr[]=new Long[n+5];
for(int i=1;i<=n;i++)
{
arr[i]=sc.nextLong();
minn=Math.min(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 ... | n, s = list(map(int, input().split()))
V = list(map(int, input().split()))
Sum = sum(V)
Min = min(V)
if(Sum < s):
print(-1)
elif(Sum == s):
print(0)
else:
num = 0
for i in range(0, n):
num += V[i]-Min
if(num >= s):
print(Min)
else:
temp = s-num
ans = int(temp/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 ... | def may_get(min_level, need, v):
for i in v:
if i < min_level:
return 0
need -= i - min_level
return need <= 0
def bin_find(l, r, need, v):
while l != r:
mid = (l + r + 1) // 2
if may_get(mid, need, v):
l = mid
else:
r = mid - 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;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n, s;
cin >> n >> s;
vector<ll> v(n);
for (ll i = (0); i < (n); ++i) cin >> v[i];
ll m = *min_element((v).begin(), (v).end());
ll t = 0;
for (ll i = (0); i < (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())
A=list(map(int,input().split()))
a=0
ans=0
if(sum(A)<s):
ans=-1
else:
x=min(A)
for i in range(0,n):
if(A[i]!=x):
a+=A[i]-x
if(a>=s):
ans=x
else:
c=s-a+n-1
c=c//n
ans=x-c
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 ... | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigMod(T p, T e, T M) {
long long ret = 1;
for (; e > 0; e >>= 1) {
if (e & 1) ret = (ret * p) % M;
p = (p * p) % M;
}
return (T)ret;
}
template <class T>
inline T modInverse(T a, T M) {
return bigMod(a, M - 2, M);
}
template <c... |
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<pair<pair<long long int, long long int>,
pair<long long int, long long int>>,
long long int>
pqr;
map<pair<long long int, long long int>, long long int> xyz;
map<long long int, long long int, greater<long long int>> yz;
vector<pair<long long int, string... |
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.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long s = scanner.nextLong();
long array[] = new long[n];
long sum = 0, min = Long.MAX_VALUE;... |
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 ... | #include <bits/stdc++.h>
using namespace std;
void solve() {
long long i, j, flag = 0;
long long n, s;
cin >> n >> s;
long long a[n], sum = 0;
for (i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
if (sum < s) {
cout << "-1\n";
return;
}
sort(a, a + n);
while (s != 0) {
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 ... | import java.io.*;
import java.util.*;
public class Main {
private InputStream is;
private PrintWriter pw;
static char[][] ch;
static int x1, x2, y1, y2, n, m, h, k;
static long dist[][];
static boolean boo[][];
void soln() {
is = System.in;
pw = new PrintWriter(System.out);
long s = System.currentTimeMil... |
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, A[1005], sum = 0;
scanf("%lld", &n), scanf("%lld", &s);
for (int i = 0; i < n; ++i) {
scanf("%lld", &A[i]);
sum += A[i];
}
if (sum < s) {
printf("-1\n");
return 0;
}
sort(A, A + n);
long long int remainSum = 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 ... | //package ;
import java.io.*;
import java.util.*;
public class Problem_1084B
{
public static void main(String[] args) throws IOException
{
Scanner sc = new Scanner();
PrintWriter pw = new PrintWriter(System.out);
int n=sc.nextInt();long s=sc.nextLong();
long[]a=new long[n];
long sum=0;
long lo=0,hi=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 ... | import java.util.*;
public class Kvass
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long n,sum=0;
n=sc.nextLong();
long d=sc.nextLong();
long m=1000000000;
for(long i=0;i<n;i++)
{
long s=sc.nextLong();
... |
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;
void solve() {
long long i, j, flag = 0;
long long n, s;
cin >> n >> s;
long long a[n], sum = 0;
for (i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
if (sum < s) {
cout << "-1\n";
return;
}
sort(a, a + n);
while (s != 0) {
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 ... | #include <bits/stdc++.h>
using namespace std;
long long int n, s, a[111111], sum, minn = 11111111111, m, k;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> s;
for (int i = 0; i < n; i++) {
cin >> a[i];
minn = min(minn, a[i]);
sum += a[i];
}
if (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 ... | #include <bits/stdc++.h>
using namespace std;
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
long long int gcd(long long int x, long long int y) {
if (y == 0) return x;
return gcd(y, x % y);
}
long long int lcm(long long int a, long long int b) {
return (a * b) / gcd(a, b);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.