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 ...
n,s=map(int,input().split()) sum=0 lists=list(map(int,input().split())) minimum=min(lists) for i in lists: sum=sum+i if sum<s: print("-1") else: print(int(min((sum-s)/n,minimum)))
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
n, s = [int(x) for x in input().split()] a = [int(x) for x in input().split()] total = sum(a) if total < s: print(-1) elif total == s or (total - n) < s: print(0) else: m = min(a) if (total - (m * n)) >= s: print(m) else: s = s - (total - (m * n)) total = m * n 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 ...
from math import ceil [n, K] = [int(i) for i in input().split()] a = [int(i) for i in input().split()] S = sum(a) m = min(a) P = S - n*m if K>S: print(-1) else: if K<=P: print(m) else: K = K - P d = int(ceil(K/n)) print(m-d)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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 (s > sum(v)): print(-1) exit(0) v.sort() m = v[0] for i in range(len(v)): s -= v[i] - m if s <= 0: print(m) exit(0) m -= (s + n - 1) // n 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 ...
import java.util.*; import java.util.ArrayList; public class Main{ static class Pair { int x; int y; Pair(int x, int y){ this.x=x; this.y=y; } } public static void main(String[] args){ Scanner param=new Scanner(Syst...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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, typename U> inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second << '\n'; return _out; } template <typename T, typename U> inline istream &operator>>(istream &_in, pair<T, U> &_p) { _in >> _p.firs...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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) exit() q = sum(l) - min(l) * n if q>=s: print(min(l)) exit() print(min(l)-(s-q+n-1)//n)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
n,s=map(int,input().split()) arr=list(map(int,input().split())) sumx=sum(arr) if(sumx<s): print(-1) else: minval=min(arr) diff1=sumx-(minval)*n if(diff1>=s): print(minval) else: s-=diff1 if(s%n==0): val=s//n else: val=s//n val+=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 ...
def main(): n, s = map(int, input().split()) v = list(map(int, input().split())) minn = min(v) summ = 0 alll = 0 for el in v: alll += el if alll < s: print(-1) return for i in range(n): summ += v[i] - minn s -= summ if s < 0: print(minn) ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
import java.util.*; import java.io.*; public class kvassandthefairnut { public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); StringTokenizer st = new Strin...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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 bisect import math #import itertools def get_line(): return list(map(int, sys.stdin.readline().strip().split())) def in1(): return int(input()) n,s=get_line() a=get_line() t1=min(a) c=0 for i in range(n): c+=a[i]-t1 if c>=s: print(t1) else: t2=(s-c)//n if (s-c)%n==0 and t2<=t1: ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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 * n,s = map(int,input().split()) v = list(map(int,input().split())) m = min(v) s -= (sum(v)-m*n) print(m if s <= 0 else (m-ceil(s/n) if s <= m*n else -1))
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
import java.util.*; public class CodeForces1084B { 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...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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 maxx = 0x3f3f3f3f; int main() { long long int n, k, a, m = maxx, s = 0; cin >> n >> k; for (long long int i = 0; i < n; i++) { cin >> a; m = min(m, a); s += a; } if (s < k) { cout << -1; } else { cout << 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 javafx.scene.layout.Priority; import java.io.*; import java.net.Inet4Address; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class templ implements Runnable { public class pair implements Comparable { int f; int s; pair(in...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
from math import ceil n, s = map(int, input().strip().split()) v = list(map(int, input().strip().split())) if s > sum(v): print(-1) elif s == sum(v): print(0) else: m = min(v) total_min = m*n diff = sum(v) - total_min if diff >= s: print(m) else: d = ceil((s - diff) / 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 Solution { public static void main(String[] args)throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long s = sc.nextLong(); long[] a = new long[n]; long sum = 0; long min = -1; 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 ...
n, s = map(int, input().split()) v = list(map(int, input().split())) if sum(v) < s: print("-1") else: m = min(v) v.sort(reverse=True) for i in range(n): diff = v[i] - m diff = min(diff, s) v[i] -= diff s -= diff if s == 0: break q = s//n for i in range(n)...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
#include <bits/stdc++.h> using namespace std; long long a[1003]; int main() { long long n, s; cin >> n >> s; long long miner = 0x3f3f3f3f3f3f3f3f; long long sumer = 0; for (long long i = 0; i < n; i++) { cin >> a[i]; sumer += a[i]; miner = min(miner, a[i]); } if (sumer < s) { cout << "-1" ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
#include <bits/stdc++.h> using namespace std; long long n, k, l, r, mid, x; vector<long long> a; bool prv(long long mid) { long long sum = 0; for (int i = 0; i < n; i++) { if (a[i] - mid < 0) return false; } for (int i = 0; i < n; i++) { sum += a[i] - mid; } if (sum >= k) return true; 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 java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; import static java.lang.Math.abs; import static java.lang.Math.min; import static java.lang.Math.max; import static java.lang.Math.sqrt; @SuppressWarnings("unchecked") public class P1084B { public void run() throws Exception { ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Hung Vu */ public class Main { public static void main(String[] args) { InputStream 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.lang.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
import java.util.*; public class NutKvass { public static void main(String[] args) { Scanner kb= new Scanner(System.in); long kegs= kb.nextLong(); long liters= kb.nextLong(); long k, sum= 0, min= 2147483647; for (int i= 0; i<kegs; i++) { k= kb.nextLong(); sum+= k; if (k<min) { 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 java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.util.Arrays; import java.util.Scanner; import java.util.OptionalInt; /** * Built using CHelper plug-in * Actual solution is at the top * * @author ky112233...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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.Scanner; import java.util.StringTokenizer; import java.util.*; public class KvassandtheFairNut { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { 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 ...
n,s = map(int,input().split()) mas = list(map(int,input().split())) m = min(mas) e,q=0,0 for i,x in enumerate(mas): e+=x-m q+=x if s>q: print(-1) else: if e>=s: print(m) else: a=s-e b,c=a//n,a%n if c>0: b+=1 print(m-b)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
#include <bits/stdc++.h> using namespace std; long long v[1005], sum, mn; int main() { long long n, s; int i; scanf("%lld%lld", &n, &s); sum = 0; for (i = 0; i < n; i++) { scanf("%lld", &v[i]); } mn = v[0]; for (i = 0; i < n; i++) { mn = min(v[i], mn); sum += v[i]; } if (sum < s) { p...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
n, k = map(int, input().split()) a = [] a = list(map(int, input().split())) mi = min(a) su = sum(a) if su < k: print(-1) else: print(min(mi, (su - 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 java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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())) print(-1 if sum(a) < m else min(min(a), (sum(a) - m) // 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.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; public class Solution{ static InputReader sc; static PrintWriter w; public static void main(String[] args) { sc = new InputReader(System.in); w = new PrintWriter(System.out); ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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(i) for i in input().split()] v.sort() sum_ = 0 for i in range(n): sum_ += v[i] - v[0] if sum_ >= s: print(v[0]) else: print((n * v[0] - s + sum_) // n if (n * v[0] - s + sum_) >= 0 else -1)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
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 - math.ceil((s-ex)/n)) else: print(mn)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (nu...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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 bhaa { InputStream is; PrintWriter o; /////////////////// CODED++ BY++ ++ ++ ++ BHAVYA++ ARORA++ ++ ++ ++ FROM++ JAYPEE++ INSTITUTE++ OF++ INFORMATION++ TECHNOLOGY++ //////////////// ////...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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 MOD = 1e9 + 7; const long long MAXN = 2e5 + 30; const long long MINN = 1e3 + 20; const long long MOD2 = 998244353ll; const long long INF = 74592896151251; const long double EPS = 1e-9; long long gcd(long long a, long long b) { return (b ? gcd(b, a % 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; int n; long long s, sum, mn = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll; int main() { cin >> n >> s; for (int i = 0; i < n; i++) { long long x; cin >> x; mn = min(mn, x); sum += x; } if (sum < s) cout << -1 << endl; else cout << 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.util.Scanner; public class BKvass { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); long s = scn.nextLong(); long[] a = new long[n]; for (int i = 0 ; i < n; i++) a[i] = scn.nextInt(); Sy...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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.PriorityQueue; import java.util.StringTokenizer; import java.util.stream.IntStream; public class B { public static void main(String[] args) throws IOException { try (Input input = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) { 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 ...
n, s = list(map(int, input().split())) cl = list(map(int, input().split())) cl = sorted(cl) mn = cl[0] sm = sum(cl) if sm<s: print(-1) else: t = s-(sm-n*mn) if t<=0: print(mn) else: k = (t-1)//n+1 print(mn-k)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class B { private void work() { Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n = sc.nextInt(); long s = sc.nextLong(); 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 ...
#include <bits/stdc++.h> using namespace std; using lint = long long int; lint liters(int l, vector<int> &arr) { lint sum = 0; for (int k : arr) sum += (lint)(k - l); return sum; } int main() { int n, m = 1000000010; lint s; vector<int> arr; cin >> n >> s; arr.resize(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 ...
n,s=map(int,input().split()) v=list(map(int,input().split())) m=min(v) if s>sum(v): print("-1") exit() v=sorted(v) total=0 for i in v: total+=(i-m) if total>=s: print(m) else: print((sum(v)-s)//n)
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
#include <bits/stdc++.h> using namespace std; long long v[1010]; int main() { long long s; long long n, mn = 1e17, sum = 0; cin >> n >> s; for (int i = 0; i < n; i++) { cin >> v[i]; sum += v[i]; mn = min(v[i], mn); } if (sum < s) { cout << -1; return 0; } 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.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(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 ...
#include <bits/stdc++.h> using namespace std; long long n, s, i, j, a[10001], MIN; long long m_min(long long a, long long b) { if (a < b) return a; else return b; } int main() { scanf("%lld%lld", &n, &s); for (i = 1; i <= n; i++) scanf("%lld", &a[i]); long long sum = 0; MIN = 1e18; for (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 ...
n,s=map(int,input().split()) arr=[int(x) for x in input().split()] arr.sort(reverse=True) #print(arr) flag=0 for i in range(n-1): s-=min(s,arr[i]-arr[-1]) if(s!=0):arr[i]=arr[-1] if(s==0): flag=1 break #print(flag) if(flag==1):print(arr[-1]) else: #print(arr) arr[-1]-=s//n if(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()) v = input().split() mini = math.inf for i in range(n): mini = min(int(v[i]),mini) s += mini*n for i in range(n): s -= int(v[i]) if s < 0: print(mini) elif s > mini*n: print(-1) elif s%n == 0: print(mini-s//n) else: print(mini-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 = [int(x) for x in input().split()] a = [int(x) for x in input().split()] sum = 0 for i in a: sum += i if sum < s: print(-1) exit(0) a.sort() for i in range(len(a)): c = min(s, max(0, a[n - i - 1] - a[0])) s -= c a[n-i-1] -= c if s <= 0: a.sort() print(a[0]) #print(1111) else: #print(s) #p...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, s; cin >> n >> s; long long a[n]; long long sum = 0; for (long long i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } if (sum < s) cout << "-1"; else { long x = sizeof(a) / sizeof(a[0]); sort(a, a + x); 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 ...
#include <bits/stdc++.h> using namespace std; using lld = long long int; int main() { lld n, s; cin >> n >> s; vector<lld> V(n); lld su = 0; for (int i = 0; i < n; i++) { lld x; cin >> x; su += x; V[i] = x; } if (su < s) { cout << -1 << endl; } else { lld fr = 0, mn = *min_elemen...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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, m, i, j, sum, sum1, ans, sub, arr[1000000]; int main() { scanf("%lld %lld", &n, &m); for (i = 0; i < n; i++) { scanf("%lld", &arr[i]); sum = sum + arr[i]; } if (sum < m) { printf("-1\n"); } else if (sum == m) { printf("0\n"); } 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; long long A[2222]; int n; long long kvass(long long c) { long long ans = 0; for (int i = 0; i < (n); i++) ans += A[i] > c ? A[i] - c : 0; return ans; } long long bs(long long lo, long long hi, long long s) { if (lo >= hi) return lo; long long c = (lo + hi) / 2; ...
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter 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())) x = sum(arr) y = min(arr) if x < s: print(-1) else: z = x - y*n if z < s: s -= z if s % n == 0: print(y - s//n) else: print(y - s//n - 1) else: print(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 ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, s, sum = 0; cin >> n >> s; long long a[1001]; for (long long i = 0; i < n; ++i) { cin >> a[i]; sum += a[i]; } if (sum < s) { cout << -1; return 0; } long long mn = *min_element(a, a + n); for (long long 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 ...
#include <bits/stdc++.h> using namespace std; int n; long long s, sum; long long a[1100]; int main() { scanf("%d%I64d", &n, &s); long long r = 2147483646; for (int i = 1; i <= n; i++) { scanf("%I64d", &a[i]); sum += a[i]; r = min(r, a[i]); } if (sum < s) { printf("-1"); return 0; } 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 ...
#!/usr/bin/env python # coding: utf-8 # In[15]: import math ns=list(map(int, input().rstrip().split())) n=ns[0] s=ns[1] data=list(map(int, input().rstrip().split())) # In[16]: data.sort() # In[17]: extras=[i-data[0] for i in data] # In[18]: total=sum(data) extratotal=sum(extras) # In[ ]: # In[19]...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 1000000; int n; long long skill; long long a[MAXN]; int cost[MAXN]; vector<long long> p; long long b[MAXN]; long long c[MAXN]; int nc; vector<int> copt[MAXN]; pair<int, int> ord[...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; namespace io { const int L = (1 << 20) + 1; char buf[L], *S, *T, c; char getchar() { if (__builtin_expect(S == T, 0)) { T = (S = buf) + fread(buf, 1, L, stdin); return (S == T ? EOF : *S++); } return *S++; } int inp() { int x = 0, f = 1; char ch; for (ch...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; namespace Flandre_Scarlet { long long I() { char c = getchar(); long long x = 0; long long f = 1; while (c < '0' or c > '9') f = (c == '-') ? -1 : 1, c = getchar(); while (c >= '0' and c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); return ((f =...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; namespace Flandre_Scarlet { long long I() { char c = getchar(); long long x = 0; long long f = 1; while (c < '0' or c > '9') f = (c == '-') ? -1 : 1, c = getchar(); while (c >= '0' and c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); return ((f =...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (a > 0 && b > 0) { if (a < b) swap(a, b); a %= b; } return a + b; } const int maxN = (int)1e6 + 10; long long a[maxN]; long long k; vector<long long> factor(long long x) { vector<long long> cur; for (int i = ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> std::istream& operator>>(std::istream& i, pair<T, U>& p) { i >> p.first >> p.second; return i; } template <typename T> std::istream& operator>>(std::istream& i, vector<T>& t) { for (auto& v : t) { i >> v; } return i; } templat...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> long long n, k, tot, tem, val[101], cnt, a[1000001], e[1000001], value[10001]; long long f[13][10001]; std::map<long long, std::vector<int> > map; long long gcd(long long a, long long b) { return (!b) ? a : gcd(b, a % b); } int main() { scanf("%d%I64d", &n, &k); for (int i = 1; i <= n; i++)...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T> void rpl(T& a, const T& b) { if (a > b) a = b; } ll gcd(ll a, ll b) { if (a > b) swap(a, b); if (a == 0) return b; return gcd(b % a, a); } using vi = vector<ll>; using i2 = array<int, 2>; const auto cmp = [](const i2& a, cons...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int N = 1000003, M = 1 << 11; const long long INF = 0x3f3f3f3f3f3f3f3f; template <typename T> void read(T &x) { int ch = getchar(); x = 0; for (; ch < '0' || ch > '9'; ch = getchar()) ; for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0'; ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") using namespace std; template <typename T> void uin(T &a, T b) { if (b < a) { ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1.01e9; const long long infll = (long long)1.01e18; const long double eps = 1e-9; const long double pi = acos((long double)-1); mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int x) { return mrand() % x; } void precalc() ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
import java.io.*; import java.util.*; public class A { public static void main (String[] args) { new A(); } long max = (long)1e12; int[] works; long[] primes, powers; long K; public A() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println(""); buil...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int N1 = (int)(1e6 + 0.5); const long long N2 = (long long)(1e12 + 0.5); struct emt { long long a, cost; }; bool cmp(emt u, emt v) { return u.cost < v.cost; } emt e[N1 + 5]; unordered_map<long long, int> CNT; long long gcd(long long x, long long y) { return !x ? y :...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") using namespace std; int a, b, c, d, n, m, tot; long long k; pair<int, long long> mas[1000002]; unordered_map<long long, int> nm; int ex[12001][12]; int len[12001]; vector<pair<long long, int> > pr; int...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; inline char gc() { return getchar(); } template <class T> int read(T &ans) { ans = 0; char ch = gc(); T f = 1; while (!isdigit(ch)) { if (ch == EOF) return -1; if (ch == '-') f = -1; ch = gc(); } while (isdigit(ch)) ans = ans * 10 + ch - '0', ch = gc...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17; const int N = 1000010; struct dat { long long u, e; } a[N]; long long n, k, num = 0; long long dp[12][1 << 11], dp1[12][1 << 11]; long long had1[1 << 11], part[1 << 11], p[20], pk[20]; map<long long, int> had; long long GCD(long long x, long lo...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; } const int MAXN = 1000005; const int MAXM = 12; const int MAXS = 1 << 11; const long long INF = 1e18; int n, m, CNT[MAXS]; map<long long, int> cnt; long long k, prime[MAXM], v[MAXS], f[MAXM][MAXS], g[M...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1.01e9; const long long infll = (long long)1.01e18; const long double eps = 1e-9; const long double pi = acos((long double)-1); mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int x) { return mrand() % x; } void precalc() ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 5; const int M = 2048; int sp[20]; vector<int> msk[M], nmsk[M]; bool gathered[M]; int n; long long kk, gcdd; pair<long long, long long> juds[N]; vector<long long> fac; set<int> candi_maxl_v; map<long long, int> jud_map; vector<int> v_adj[M]; bool va...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int INF = (int)(1e9 + 1e6 + 123); const long long LINF = (long long)(1e18 + 1e9 + 123); const long long MOD = (long long)(1e9 + 7); template <typename A, typename B> void mini(A& x, const B& y) { if (y < x) { x = y; } } void run(); int main() { ios::sync_wit...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
import java.io.*; import java.util.*; public class A { public static void main (String[] args) { new A(); } long max = (long)1e12; int[] works; long[] primes, powers; long K; public A() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println(""); buil...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:512000000") using namespace std; void solve(__attribute__((unused)) bool); void precalc(); clock_t start; int main() { start = clock(); int t = 1; cout.sync_with_stdio(0); cin.tie(0); precalc(); cout.precision(10); cout << fixed; int testNum = 1; ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int INF = (int)(1e9 + 1e6 + 123); const long long LINF = (long long)(1e18 + 1e9 + 123); const long long MOD = (long long)(1e9 + 7); template <typename A, typename B> void mini(A& x, const B& y) { if (y < x) { x = y; } } void run(); int main() { ios::sync_wit...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; long long get() { char ch; while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-') ; if (ch == '-') { long long s = 0; while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0'; return -s; } long long s = ch - '0'; while (ch = getc...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 5; const int M = 2048; int sp[20]; vector<int> msk[M], nmsk[M]; bool gathered[M]; int n; long long kk, gcdd; pair<long long, long long> juds[N]; vector<long long> fac; set<int> candi_maxl_v; map<long long, int> jud_map; vector<int> v_adj[M]; bool va...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 79; int p, n; long long k, g = 0; long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); } void updmin(long long& a, const long long& b) { if (a == -1 || b < a) a = b; } vector<long long> a(maxn), e(maxn), pr; vector<int> v; void ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int MAXP = 13; long long DP[MAXP][1 << MAXP]; const long long INF = 1e16; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int main() { ios_base::sync_with_stdio(0); int N; long long K; cin >> N >> K; vect...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int summax = 45; const int nmax = (1 << 12) + 5; const int prmax = 12; const long long inf = 1LL * 1e15; map<long long, int> m; map<long long, int>::iterator it; vector<int> l[1000 * 1000 + 5]; long long k; long long v[1000 * 1000 + 5], e[1000 * 1000 + 5]; long long p...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17; const int N = 1000010; struct dat { long long u, e; } a[N]; long long n, k, num = 0; long long dp[12][1 << 11], dp1[12][1 << 11]; long long had1[1 << 11], part[1 << 11], p[20], pk[20]; map<long long, int> had; long long GCD(long long x, long lo...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const long long INF = 10000000000000000ll; long long read() { char x = 0; long long ret = 0; while (x < '0' || x > '9') x = getchar(); while (x >= '0' && x <= '9') ret = ret * 10ll + x - '0', x = getchar(); return ret; } long long gcd(long long a, long long b) { r...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-11; template <class T> inline void ckmin(T &a, T b) { if (b < a) a = b; } template <class T> inline void ckmax(T &a, T b) { if (b > a) a = b; } template <class T> inline T sqr(T x) { return x * x; } long long gcd(lon...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; template <typename T> void maxtt(T& t1, T t2) { t1 = max(t1, t2); } template <typename T> void mintt(T& t1, T t2) { t1 = min(t1, t2); } bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = "URDL"; long long ln, lk, lm; void etp(b...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; int n; long long int k; long long int gcd(long long int a, long long int b) { if (a < b) swap(a, b); while (b) { swap(a, b); b %= a; } return a; } long long int ar[1000002]; vector<long long int> pr; bool cost[1 << 11]; vector<long long int> vv; long long in...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Arrays; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; long long a[1000005]; int n, e[1000005]; long long gcd(long long a, long long b) { if (!b) return a; return gcd(b, a % b); } vector<long long> ps; map<long long, vector<pair<int, int> > > mp; long long m, res = (long long)1e18; vector<pair<int, int> > bst[5005]; int T; ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int N1 = (int)(1e6 + 0.5); const long long N2 = (long long)(1e12 + 0.5); struct emt { long long a, cost; }; bool cmp(emt u, emt v) { return u.cost < v.cost; } emt e[N1 + 5]; unordered_map<long long, int> CNT; long long gcd(long long x, long long y) { return !x ? y :...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000101; int n, pt; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long e[maxn], a[maxn], p[100], d, k, cur[1 << 13 | 10], ans[13][1 << 13 | 10]; map<long long, vector<long long> > mp; int main() { scanf("%d%lld", &n, &...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; void Freopen() { freopen( "title" ".in", "r", stdin); freopen( "title" ".out", "w", stdout); } long long read() { long long g = 0, f = 1; char ch = getchar(); while (ch < '0' || '9' < ch) { if (ch == '-') f = -1; ch = ge...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> #pragma warning(disable : 4996) #pragma comment(linker, "/STACK:336777216") using namespace std; int IT_MAX = 1 << 20; const long long MOD = 1000000007; const int INF = 0x3f3f3f3f; const long long LL_INF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1); const double ERR = 1e-10; long long gcd(l...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFF = 0x3f3f3f3f3f3f3f3fll; const long long M = 1e9 + 7; const long long maxn = 1e6 + 107; const double pi = acos(-1.0); const double eps = 0.0000000001; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } t...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { long long int t; while (a > 0) t = b % a, b = a, a = t; return b; } long long int a[1000000]; int e[1000000]; vector<long long int> factors; map<long long int, vector<int> > M; long long int num[12]; long long int ...
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β€” your skill in Cardbluff. Each judge has a number a_i β€” an indicator of uncertainty about ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import ...