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 KvassAndTheFairNut {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long s = in.nextLong();
long[] kegs = new long[n];
long sum = 0;
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 ... | #_________________ Mukul Mohan Varshney _______________#
#Template
import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt,floor,factorial,gcd,log,ceil
from collections import deque,Counter,defaultdict
from itertools import permut... |
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_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
ll s;
cin >> n >> s;
vector<int> a(n);
ll sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
if (sum < s) {
cout << -1 << '\n';
ret... |
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 ... | first = input()
first = first.split(" ")
second = input()
second = second.split(" ")
n= int(first[0])
s = int(first[1])
v = []
# people_ = people_.split(" ")
for p in second:
v.append(int(p))
if sum(v) < s:
print(-1)
elif sum(v) == s:
print(0)
else:
min_volume = min(v)
sum = 0
v_ = []
for 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 ... | import java.util.*;
public class problem2 {
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.printl... |
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.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringTokenizer;
public class d
{
public static void print(String str,long val){
System.out.println(str+" "+val);
}
public long gcd(long a, long b) {
if (b==0L) return 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 ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long long int s, sum = 0;
cin >> n >> s;
long long int* v = new long long int[n];
for (int i = 0; i < n; i++) {
cin >> v[i];
sum += v[i];
}
if (s > sum)
cout << -1 << endl;
else {
sort(v, v + n);
if (s < (sum - 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 ... | import math
n,q=map(int,input().split())
h=list(map(int,input().split()))
t=0
for i in range (n):
t+=h[i]
if t<q:
print(-1)
exit()
low=min(h)
for i in range (n):
q-=(h[i]-low)
if q<=0:
print(low)
exit()
low-=math.ceil(q/n)
print(low)
|
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 math
from decimal import Decimal
import heapq
def na():
n = int(input())
b = [int(x) for x in input().split()]
return n,b
def nab():
n = int(input())
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
return n,b,c
def dv():
n, m = map(int, input().split())
return n,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 java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Q2 {
public static void main(String[] args) throws IOException{
Reader.init(System.in);
int n = Reader.nextInt();
Long s = Reader.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 ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class gr1 {
static class InputReader {
public BufferedReader br;
public StringTokenizer token;
public InputReader(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 ... | x,s=list(map(int,input().split()))
l=list(map(int,input().split()))
sum=0
for i in l:
sum+=i
if sum<s:
print(-1)
elif sum==s:
print(0)
else:
k=sum-len(l)*min(l)
if k>=s:
print(min(l))
else:
sum-=k
s-=k
ans=s//len(l)
if s%len(l)!=0:
ans+=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 ... | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 15 09:06:15 2018
@author: Arsanuos
"""
def solve():
rd = lambda: list(map(int, input().split()))
n, s = rd()
arr = rd()
k = sum(arr)
if s > k:
print(-1)
return
if s == k:
print(0)
return
arr.sort(reverse=True)
... |
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 ifPoss(arr,v,h):
tot = 0
for i in arr:
tot += (i-h)
return tot>=v
def prog():
n,v = map(int,input().split())
arr = [int(x) for x in input().split()]
minLev = -1
l,h = 0,min(arr)
while(l<=h):
m = int((l+h)/2)
if(ifPoss(arr,v,m)):
minLev = max(minLev... |
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 = 1e6 + 5;
const long long INF = 1e18;
const int M = 1e9 + 7;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << '\n';
err(++it, 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 ... | R = lambda: map(int, input().split())
n, s = R()
v = [*R()]
print(max(-1, min((sum(v) - s) // n, *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.util.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void main(String[] args) throws Exception
{
long startTime = System.nanoTime();
int n = in.nextInt();
long s = in.nextLong();
long [] data = new long[n];
for(int i=0;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 ... | import java.util.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.util.Scanner;
import... |
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(s2) for s2 in input().split(' '))
kegs = [int(s2) for s2 in input().split(' ')]
min_keg = min(kegs)
overflow = sum(keg - min_keg for keg in kegs)
if s <= overflow:
print(min_keg)
else:
remaining = s - overflow
n = int(math.ceil(remaining / len(kegs)))
if n > min_keg:
pr... |
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())
lis=list(map(int,input().split()))
if s>sum(lis):
print(-1)
exit()
lis.sort(reverse=True)
i=0
while i<n and s>0:
if s<(lis[i]-lis[-1]):
print(lis[-1])
exit()
s-=(lis[i]-lis[-1])
lis[i]=lis[-1]
i+=1
if s==0:
print(lis[-1])
elif s%n==0:
print(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.util.*;
import java.io.*;
public class Main{
public static long primeFactors(long n)
{
// Print the number of 2s that divide n
while (n%2 == 0)
{
return 2;
}
// n must be odd at this point. So we can skip
// one element (Note i = i +2)
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.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* Created by Mach on 10.12.2018.
*/
public class round526a {
public static void main(String[] args) {
Reader526a r=new Reader526a();
r.init(System.in);
int 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>
long long int power(long long int x, long long int b) {
long long int p = 1;
while (b > 0) {
if (b & 1) {
p = p * x;
p %= 1000000007;
}
b >>= 1;
x *= x;
x %= 1000000007;
}
return p % 1000000007;
}
using namespace std;
struct lex_compare {
bool operator(... |
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, v[1010], t = 0;
cin >> n >> s;
for (long long i = 0; i < n; ++i) {
cin >> v[i];
t += v[i];
}
if (t < s) {
puts("-1");
return 0;
}
sort(v, v + n);
t = 0;
for (int i = 1; i < n; ++i) {
t += v[i] - 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 ... | // package PCS;
// Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Kvass {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
... |
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 ... | # -*- coding: utf-8 -*-
N, S = map(int, input().split())
aN = list(map(int, input().split()))
if (sum(aN) - S) / N < 0:
print(-1)
else:
print(min((sum(aN) - S) // N, min(aN)))
|
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.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public 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>
using namespace std;
long long a[5000];
int main() {
int n;
long long m;
cin >> n >> m;
long long sum = 0ll;
for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
sort(a + 1, a + 1 + n);
long long fuck = 0ll;
for (int i = 2; i <= n; i++) fuck += a[i] - a[1];
m -= fuck;
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 ... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, s;
cin >> n >> s;
vector<long long> v(n);
long long sum = 0, minimum = 1e9;
for (int i = 0; i < n; i++) {
cin >> v[i];
sum += v[i];
if (v[i] < minimum) minimum = v[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 = map(int, input().split())
k = list(map(int, input().split()))
sumk = sum(k)
mink = min(k)
if sumk < s:
print(-1)
exit()
if sumk-n*mink >= s:
print(mink)
else:
s -= sumk-n*mink
if s%n == 0:
print(mink-s//n)
else:
print(mink-s//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())
l=list(map(int,input().split()))
sa=sum(l)
sa-=s
if sa<0:
print(-1)
else:
sa//=n
if min(l)<sa:
print(min(l))
else:
print(sa)
|
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>
const char dl = '\n';
const long double eps = 0.00000001;
const long long MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
using namespace std;
void debug() { cout << endl; }
template <typename H, typename... T>
void debug(H p, T... t) {
std::cout << p << " ";
debug(t...);
}
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 ... | #!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>
"""
from __future__ import division, print_function
import math
import itertools
import os
import sys
from atexit import register
from io import BytesIO
class dict(dict):
... |
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;
cin >> n;
long long int s;
cin >> s;
long long int arr[n];
long long int sum = 0;
for (int i = 0; i < n; i++) {
cin >> arr[i];
sum += arr[i];
}
sort(arr, arr + n);
if (s > sum) {
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 ... | import sys
input = sys.stdin.readline
import math
def main():
n,s = map(int,input().split())
tab = list(map(int,input().split()))
cost = 0
if sum(tab) < s:
print(-1)
return
m = min(tab)
for x in range(n):
cost += tab[x] - m
if cost >= s:
print(m)
retu... |
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 = tuple(map(int,input().split()))
v = list(map(int,input().split()))
mn = min(v)
total = 0
possible = 0
for vi in v:
possible += vi - mn
total += vi
if total < s:
print(-1)
elif possible >= s:
print(mn)
else:
remain = s-possible
print( mn - (remain+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 ... | def kvas(s, lst):
ss1, ss2 = sum(lst), 0
if ss1 < s:
return -1
a = sorted(lst)
for i in range(len(a)):
ss2 += a[i] - a[0]
if ss2 > s:
return a[0]
return a[0] - (s - ss2 + len(lst) - 1) // len(lst)
N, S = [int(j) for j in input().split()]
b = [int(z) for z in input().spl... |
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=sorted(list(map(int,input().split())))
k=0
mi=a[0]
for i in range(n):
k+=(a[n-i-1]-a[0])
a[n-i-1]-=(a[n-i-1]-a[0])
if k>=s:
exit(print(a[0]))
else:
if sum(a)<(s-k):
exit(print(-1))
else:
r=(-(-(s-k)//n))
print(a[0]-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.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
static class TaskSolver {
public static void solve(MyScanner in, MyWriter out) throws IOException {
... |
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.*;
public class Main {
static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
public static void main(String[] args) throws IOException {
int n = readInt();
long s = readLong();
int minVolume = Integer.MAX_VALUE;
long total = 0;
for (int inde... |
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 python
# -*- coding: utf-8 -*-
# File : b.py
# Author : recurze
# Date : 22:14 10.12.2018
# Last Modified Date: 22:18 10.12.2018
n, s = [int(x) for x in raw_input().split()]
a = list(map(int, raw_input().split()))
su = sum(a)
if su < s:
print -1
else:
m = 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 ... | #include <bits/stdc++.h>
long long int v[1001];
int main() {
int i, j, k, n, t, l;
long long int min = 1000000001;
long long int s, r, d, total = 0;
scanf("%d %lld", &n, &s);
for (int a = 0; a < n; a++) {
scanf("%lld", &v[a]);
if (min > v[a]) min = v[a];
total += v[a];
}
if (s > total)
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 ... | #include <bits/stdc++.h>
using namespace std;
long long n, s;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t;
t = 1;
while (t--) {
cin >> n >> s;
vector<long long> v(n);
long long sum = 0;
long long mini = INT_MAX;
for (long long i = 0; 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;
#pragma GCC optimize("O3")
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n, m, mn, res, sum;
cin >> n >> m;
long long arr[n];
sum = 0;
mn = INT_MAX;
for (int i = 0; i < n; i++) {
cin >> arr[i];
mn = min(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;
bool comp(pair<int, int> &a, pair<int, int> &b) {
if (a.second == b.second)
return a.first < b.first;
else
return a.second < b.second;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int N;
long long S;
cin >> N >> S;
vector<long long> 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 ... | n,s = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
if sum(l)<s:
print(-1)
exit()
cnt = 0
z = l[-1]
for i in range(n):
if s == 0:
break
k = l[i]-z
if s>=k:
s-=k
else:
print(z)
exit()
ka = s//n
ans = z-ka
if s%n == 0:
print(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,k = [int(j) for j in input().split()]
a = [int(j) for j in input().split()]
t = min(a)
summ = 0
for i in range(n):
summ += a[i]
psumm = summ-t*n
ram = (k-psumm)
if ram%n == 0:
ans = t-(ram//n)
else:
ans = t-1-(ram//n)
if k>summ:
print(-1)
elif k<=psumm:
print(t)
else:
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 ... | '''input
3 4
5 3 4
'''
import math
from fractions import gcd
n,s=map(int,raw_input().split())
v=map(int,raw_input().split())
v.sort()
if sum(v)<s:
print -1
else:
for i in range(n):
if v[i]-v[0]>=s:
print v[0]
exit(0)
else:
s-=(v[i]-v[0])
v[i]=v[0]
k=s/n
z=v[0]
z-=k
s-=k*n
if(s==0):
print z
el... |
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(" "))
ar = list(map(int, input().split(" ")))
sm = sum(ar)
if s > sm:
print(-1)
else:
mn = min(ar)
ex = (sm - mn) - ((n-1)*mn)
if ex >= s:
print(mn)
else:
print(mn - math.ceil((s - ex)/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 INF = 0x3f3f3f3f;
const long long int llINF = 0x3f3f3f3f3f3f3f;
long long int n, s;
vector<long long int> v;
bool check(long long int val) {
long long int bebe = 0;
for (auto x : v) {
if (x < val) return false;
bebe += abs(x - val);
}
return bebe >... |
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(' ')]
v.sort()
minV = v[0]
totalV = sum(v)
if totalV < s:
print(-1)
else:
if totalV - minV * n >= s:
print(minV)
else:
remain = totalV - s
print(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 ... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n, ans = 0, acum = 0, s, tonel;
cin >> n >> s >> ans;
acum = ans;
for (int i = 1; i < n; ++i) {
cin >> tonel;
acum += tonel;
ans = min(ans, tonel);
}
if (acum < s)
ans = -1;
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 ... | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class codeforces
{
static class Student{
int a,s,gd,gs;
Student(int 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.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
public class KVASS {
public static void main(String[] args)throws IOException {
BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));
String s[]=ob... |
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;
int v[1005];
long long s, sum;
bool cmp(int x, int y) { return x > y; }
int main() {
scanf("%d %lld", &n, &s);
for (int i = 1; i <= n; i++) scanf("%d", &v[i]), sum += v[i];
if (sum < s) {
printf("-1\n");
return 0;
}
sort(v + 1, v + n + 1, cmp);
fo... |
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())
li=input().split()
for i in range(n):
li[i]=int(li[i])
su=sum(li)
if su<s:
print(-1)
exit(0)
if su-s<n:
print(0)
exit(0)
li.sort()
k=(su-s)/n
k=int(math.floor(k))
if k>li[0]:
k=li[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 ... | n, s = map(int, input().split())
l = [int(i) for i in input().split()]
'''
for i in range(n):
x = max(l) - s // n
l.remove(max(l))
l.append(x)
for i in range(s % n):
x = max(l) - 1
l.remove(max(l))
l.append(x)
if min(l) < 0:
print(-1)
else:
print(min(l))
'''
if sum(l) < s:
print(-1)
else:
print(min( [(sum(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 ... | l = raw_input().split()
n, s = int(l[0]), int(l[1])
l = raw_input().split()
add = 0
m = 10**18
for i in range(n):
l[i] = int(l[i])
add += l[i]
m = min(m, l[i])
if add < s:
print -1
elif add == s:
print 0
else:
excess = 0
for i in range(n):
excess += (l[i]-m)
if excess >= s:
print m
else:
ans = m-(s-exces... |
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 B{
public static void main(String[] args)
{
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int n = fs.nextInt(); long s = fs.nextLong();
long[] arr = new long[n];
long sum = 0;
long min = Long.MAX_VALUE;
for(int i=0;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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Mufaddal Naya
*/
public cl... |
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 ar[1001];
int main() {
long long int n, s;
cin >> n >> s;
for (int i = 1; i <= n; i++) cin >> ar[i];
long long sum = 0;
for (int i = 1; i <= n; i++) sum += ar[i];
if (sum < s) {
cout << -1 << endl;
exit(0);
}
long long m = *min_element(ar +... |
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;
vector<long long> v(1001);
long long check(long long x) {
long long sum = 0;
for (long long i = 0; i < n; i++) {
if (v[i] < x) return 0;
sum += max((long long)0, v[i] - x);
}
return (sum >= s);
}
int main() {
ios::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 sys
input = sys.stdin.readline
n,s=map(int,input().split())
V=list(map(int,input().split()))
MIN=min(V)
SUM=sum(V)
if s>SUM:
print(-1)
sys.exit()
if SUM-MIN*n>=s:
print(MIN)
sys.exit()
print((SUM-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.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class KvassAndTheFairNut {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new 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 ... | /*
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /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 ... | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 11:09:39 2018
@author: pc
"""
from math import ceil
n,s=map(int,input().split())
x=[int(v) for v in input().split()]
t=sum(x)
m=min(x)
if t<s:
print(-1)
else:
if t-n*m>=s:
print(m)
else:
l=ceil((s-t+n*m)/n)
print(m-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 sys
def leastKeg(kegs,s):
if sum(kegs)<s:
return(-1)
kegs.sort()
kegs.reverse()
mini=kegs[-1]
# print(kegs)
for i in xrange(len(kegs)):
if s>0 :
if kegs[i]-mini>=s:
s=0
kegs[i]=kegs[i]-s
return(mini)
else:
s-=(kegs[i]-mini)
kegs[i]=mini
kegs[0]-=s/len(kegs)
s-=len(kegs)*(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.util.Scanner;
public class Codeforces2{
private static int n;
private static long s;
private static int[] arr;
private static Scanner in;
public static long findDoable(){
int min=Integer.MAX_VALUE;
for(int i=0;i<n;i++){
if(arr[i] < min){
min=arr[i];
}
}
long got=0;
long temp=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;
long long n, s, a[1001];
int main() {
while (cin >> n >> s) {
long long maxa = 0, sum = 0, mina = 0x3f3f3f3f;
for (int i = 0; i < n; i++) {
cin >> a[i];
maxa = max(a[i], maxa);
mina = min(mina, a[i]);
sum += a[i];
}
long long l = 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;
bool P(long long r, vector<long long> &v, long long &s) {
int i;
long long sum = 0;
for (i = 0; i < v.size(); i++)
if (v[i] - r >= 0) sum += v[i] - r;
if (sum >= s) return true;
return false;
}
int main() {
long long n, s, i, sum = 0;
cin >> n >> s;
vect... |
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;
inline char gch() {
static char buf[100010], *h = buf, *t = buf;
return h == t && (t = (h = buf) + fread(buf, 1, 100000, stdin), h == t)
? EOF
: *h++;
}
inline void re(long long &x) {
x = 0;
char a;
bool b = 0;
while (!isdigit(a = getch... |
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;
#pragma comment(linker, "/stack:200000000")
long long int t, n, m, j, ans, k, a, b, c, d, e, f, sum, i, sz;
string s, s2, s3, s4;
vector<long long int> v;
int ar[(int)(1e6 + 10)], ar2[(int)(1e6 + 10)];
void brainfuck();
int main() {
ios_base::sync_with_stdio(NULL);
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 ... | n, size = list(map(int, input().split()))
array = list(map(int, input().split()))
if (sum(array) - size) < 0:
print(-1)
else:
print(min(min(array), (sum(array) - size) // 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.*;
import java.math.*;
public
class Main{
//static variable
static final int mod = (int) 1e9 + 7;
static final double eps = 1e-6;
static final double pi = Math.PI;
static final long inf = Long.MAX_VALUE / 2;
// .......static class
static class Pair{
... |
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
def main():
n,s = map(int,input().split())
volume = list(map(int,input().split()))
if s > sum(volume):
print(-1)
return
min_val = min(volume)
for i in range(n):
diff = volume[i]-min_val
if s >= diff:
volume[i] = min_val
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 ... | #include <bits/stdc++.h>
using namespace std;
long long inf = (long long)1e18;
long long mod = 1e9 + 7;
long long max1 = (long long)1e9;
int main() {
long long i, j, k, n, m, ct = 0, t, ans = 0;
cin >> n >> k;
long long sum1 = 0;
long long a[n], min1 = 1e18;
for (i = 0; i < n; i++) {
cin >> a[i];
sum1... |
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())
kvas = list(map(int, input().split()))
if s > sum(kvas):
print(-1)
else:
if s <= sum(kvas) - n*min(kvas):
print(min(kvas))
else:
print(min(kvas) - 1 - (s - sum(kvas) + n*min(kvas) - 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.Scanner;
public class Fairnut2
{
public int findmin(int v[],int n)
{
int min = 0;
for(int i=1;i<n;i++)
{
if (v[i]<v[min])
{
min=i;
}
}
return min;
}
public static void main(String[] args)
{
Fairnut2 ob... |
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 = map(int, raw_input().split())
if sum(l) < s:
print -1
else:
if s <= sum(l)-min(l)*n:
print min(l)
else:
print (sum(l)-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.Scanner;
public class KvassAndTheFairNut
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int numKegs = in.nextInt();
long vol = in.nextLong();
int min = Integer.MAX_VALUE;
for(int i = 0; i < numKegs; 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;
void solve();
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long t;
t = 1;
while (t--) solve();
return 0;
}
void solve() {
long long i, j, n, s;
cin >> n >> s;
vector<long long> a(n);
long long small, tot = 0;
for... |
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 a[n];
long long sumofa = 0;
long long minofa = INT_MAX;
for (long long i = 0; i < n; i++) {
cin >> a[i];
sumofa += a[i];
if (minofa > a[i]) {
minofa = a[i];
}
}
if (sumofa < 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 ... | a,b=map(int,input().split())
z=list(map(int,input().split()))
s=sum(z);r=min(z)
if b>s:print(-1)
else:print(min(r,(s-b)//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 ... | #include <bits/stdc++.h>
using namespace std;
template <typename X>
inline X sqr(const X& a) {
return a * a;
}
int nxt() {
int x;
cin >> x;
return x;
}
int main() {
int n = nxt();
long long s;
cin >> s;
vector<int> a(n);
generate(a.begin(), a.end(), nxt);
if (accumulate(a.begin(), a.end(), 0ll) < 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;
long long num[1005];
int main() {
long long n, k;
while (~scanf("%lld%lld", &n, &k)) {
long long minn = 0x3f3f3f3f, sum = 0;
for (int i = 0; i < n; i++) {
scanf("%lld", &num[i]);
minn = min(minn, num[i]);
sum += num[i];
}
if (sum < 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.*;
import java.io.*;
public class a{
static Scanner sc=new Scanner(System.in);
public static void main(String [] args){
int n=sc.nextInt();
long s=sc.nextLong();
long [] v=new long[n];
long sum=0;
long min=Integer.MAX_VALUE;
long max=Integer.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 ... | #include <bits/stdc++.h>
using namespace std;
long long N, s, v[1010];
int main() {
cin >> N >> s;
long long minval = numeric_limits<long long>::max();
for (int i = 0; i < N; i++) {
cin >> v[i];
minval = min(minval, v[i]);
}
long long starttotal = 0;
for (int i = 0; i < N; i++) {
starttotal += 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, V = map(int, input().split())
s = list(map(int, input().split()))
if sum(s) < V:
print(-1)
else:
s.sort()
summ = 0
m = min(s)
F = False
for el in s[1:]:
summ += el - m
if summ >= V:
F = True
break
if F:
print(m)
else:
ost = V - 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 sys
import math,bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,defaultdict
def I(): return int(sys.stdin.readline())
def neo(): return map(int, sys.stdin.readline().split())
def Neo(): return list(map... |
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 {
static Scanner sc = new Scanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int n = sc.nextInt();
long s = sc.nextLong();
int[] v = new int[n];
int min = 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 ... | n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
k=min(a)
if s<m:
print(-1)
else:
p=s-m
print(min(k,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 ... | n, s = map(int, input().split())
arrv = list(map(int, input().split()))
sumv, minv = sum(arrv), min(arrv)
if sumv < s:
print(-1)
else:
k = (sumv - s) // n
print (min(k, 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 ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1123;
long long v[N];
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long n;
cin >> n;
long long s;
cin >> s;
for (int i = 0; i < n; i++) cin >> v[i];
long long sum = 0, mn = LLONG_MAX;
for (int i = 0; i < n; i++) {
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 ... | # Lets goto the next level
# AIM Specialist at CF *__* asap
# template taken from chaudhary_19
# Remember you were also a novice when you started,
# hence never be rude to anyone who wants to learn something
# Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts
# Donot tr... |
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;
cin >> n >> s;
long long int min = INT_MAX;
unsigned long long int sum = 0;
long long int i;
long long int arr[n];
for (i = 0; i < n; i++) {
cin >> arr[i];
sum += arr[i];
if (arr[i] < min) min = arr[i];
}
if (su... |
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.*;
import java.lang.*;
import static java.lang.Math.*;
public class Cf182 implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCha... |
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 ... | #codeforces _1084B_live
gi = lambda : list(map(int,input().split()))
n,s = gi()
l = gi()
l.sort(reverse=True)
mii = min(l)
cur = 0
while s and cur < n:
s -= (l[cur]-mii)
cur += 1
cur = 0
if s < 0:
print(mii)
exit()
if s > mii * n:
print(-1)
exit()
temp = s//n
if s%n:
temp += 1
print(mii-temp)
|
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,k = map(int,input().split())
l = list(map(int,input().split()))
m , s = min(l) ,sum(l)
if s < k:
print(-1)
else:
print(min(m,(s-k)//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
m,n=map(int,input().split())
li=sorted(list(map(int,input().split())))
l=li[0]
bli=[]
if sum(li)<n:
print(-1)
exit()
for i in range(len(li)):
bli.append(li[i]-li[0])
if sum(bli)>=n:
print(l)
else:
print(l-math.ceil((n-sum(bli))/m))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.