buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; int main() { int M, N; int sum = 0; int count = 0; cin >> N >> M; vector<int> vec(N); for (int i = 0; i < N; ++i) { cin >> vec.at(i); sum += vec.at(i); } for (int i = 0; i < N; ++i) { if (vec.at(i) >= int(sum / (4 * M))) { count += 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int M, N; int sum = 0; int count = 0; cin >> N >> M; vector<int> vec(N); for (int i = 0; i < N; ++i) { cin >> vec.at(i); sum += vec.at(i); } for (int i = 0; i < N; ++i) { if (vec.at(i) >= double(1.0 * sum / (4 * M))) { coun...
[["-", 0, 57, 15, 339, 51, 16, 12, 2, 63, 40], ["+", 0, 57, 15, 339, 51, 16, 12, 2, 63, 40], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 31, 13], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 48]]
1
145
#include <algorithm> #include <iostream> #include <list> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int n, m, a[100], sum = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } sum /= (4.0 * m); i...
#include <algorithm> #include <iostream> #include <list> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int n, m, a[100], sum = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } double sumd = sum / (...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 90], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
143
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s = 0; int a[100]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; s += a[i]; } float dk = (float)1 / (4 * m); dk *= s; int dem = 0; for (int i = 0; i < n; i++) if (a[i] >= dk) dem++; if (dem >= m) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s = 0; int a[100]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; s += a[i]; } float dk = (float)1 / (4 * m); dk *= s; int dem = 0; for (int i = 0; i < n; i++) if (a[i] >= dk) dem++; if (dem >= m) ...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
134
N, M = map(int,input().split()) A = list(map(int, input().split())) S = sum(A) A_selected = [a for a in A if a >= (S/4/M)] ret = len(A_selected) > M if ret: ret_str = 'Yes' else: ret_str = 'No' print(ret_str)
N, M = map(int,input().split()) A = list(map(int, input().split())) S = sum(A) A_selected = [a for a in A if a >= (S/4/M)] ret = len(A_selected) >= M if ret: ret_str = 'Yes' else: ret_str = 'No' print(ret_str)
[["-", 0, 656, 0, 1, 0, 662, 12, 666, 667, 47], ["+", 0, 656, 0, 1, 0, 662, 12, 666, 667, 20]]
5
85
#!/usr/bin/env python3 N,M =map(int, input().split()) A =list(map(int, input().split())) B = sorted(A, reverse = True) if B[M] >= sum(B)/4/M: print("Yes") else: print("No")
N,M =map(int, input().split()) A =list(map(int, input().split())) B = sorted(A, reverse = True) if B[M-1] >= sum(B)/4/M: print("Yes") else: print("No")
[["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612]]
5
73
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); int sum = 0; for (int i = 0; i < n; i++) { cin >> a.at(i); sum += a.at(i); } int cut = sum / (4 * m); int count = 0; for (int i = 0; i < n; i++) { if (cut <= a.at(i)) count++; }...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<double> a(n); double sum = 0; for (int i = 0; i < n; i++) { cin >> a.at(i); sum += a.at(i); } double cut = sum / (4 * m); int count = 0; for (int i = 0; i < n; i++) { if (cut <= a.at(i)) cou...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
140
#include <bits/stdc++.h> using namespace std; bool cmp(int a, int b) { return a > b; } int main() { int n, m; int tot = 0; int aa[105]; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> aa[i]; tot = tot + aa[i]; } sort(aa + 1, aa + n + 1, cmp); int f = 1; int t = (tot * 1.0) / (4 * m); ...
#include <bits/stdc++.h> using namespace std; bool cmp(int a, int b) { return a > b; } int main() { int n, m; int tot = 0; int aa[105]; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> aa[i]; tot = tot + aa[i]; } sort(aa + 1, aa + n + 1, cmp); int f = 1; double t = (tot * 1.0) / (4.0 * m...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13]]
1
172
#include <iostream> #include <vector> using namespace std; #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int input1, input2, total = 0, temp, count = 0, i; vector<int> x; vector<int>::iterator iter; cin >> input1 >> input2; for (i = 0; i < input1; i++) { ...
#include <iostream> #include <vector> using namespace std; #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); double input1, input2, total = 0, temp, count = 0, i; vector<double> x; vector<double>::iterator iter; cin >> input1 >> input2; for (i = 0; i < input1; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 39, 343, 345, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 343, 345, 344, 3, 347, 0, 77, 39, 40]]
1
174
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; i < (n); i++) #define pb push_back #define fi first #define se second #define ALL(a) (a.begin(), a.end()) using ll = long long; template <typename T> void Out(T x) { cout << x << endl; } const int maxn = 101; int A[maxn]; int main() { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; i < (n); i++) #define pb push_back #define fi first #define se second #define ALL(a) (a.begin(), a.end()) using ll = long long; template <typename T> void Out(T x) { cout << x << endl; } const int maxn = 101; int A[maxn]; int main() { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
195
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; int main() { int n, m; std::vector<int> a{}; cin >> n >> m; a.resize(n); int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } int di = 4 * m; int border = (sum + (di - 1)) / di; std::sort(a.begin()...
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; int main() { int n, m; std::vector<int> a{}; cin >> n >> m; a.resize(n); int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } int di = 4 * m; int border = (sum + (di - 1)) / di; std::sort(a.begin()...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 47], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 20]]
1
166
N, M= list(map(int, input().split())) A= list(map(int, input().split())) A.sort(reverse = True) B = A[0:M] C = B[-1] Sum = sum(A) if C >Sum /(4*M): print("Yes") else: print("No")
N, M= list(map(int, input().split())) A= list(map(int, input().split())) A.sort(reverse = True) B = A[0:M] C = B[-1] Sum = sum(A) if C >=Sum /(4*M): print("Yes") else: print("No")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
90
#include <bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define mod 1000000007 #define qmod 998244353 #define M 1000001 #define endl "\n" #define all(a) (a).begin(), (a).end() #define rep(i, a, b) for (int i = a; i < b; ++i) #define repr(i, a, b) for (...
#include <bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define mod 1000000007 #define qmod 998244353 #define M 1000001 #define endl "\n" #define all(a) (a).begin(), (a).end() #define rep(i, a, b) for (int i = a; i < b; ++i) #define repr(i, a, b) for (...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13]]
1
215
#include <iostream> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; int a[N]; int ava = 0; for (int i = 0; i < N; i++) { cin >> a[i]; ava += a[i]; } float aa = (float)ava / 4.0 / M; int n = 0; for (int i = 0; i < N - M + 1; i++) { if ...
#include <iostream> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; int a[N]; int ava = 0; for (int i = 0; i < N; i++) { cin >> a[i]; ava += a[i]; } float aa = (float)ava / 4.0 / M; int n = 0; for (int i = 0; i < N; i++) { if (a[i] >=...
[["-", 0, 7, 15, 16, 12, 16, 31, 16, 17, 33], ["-", 0, 7, 15, 16, 12, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
154
n, m = map(int, input().split()) A = list(map(int,input().split())) a_sum = sum(A) ans = 0 for i in range(n): if float(A[i]) > a_sum/(4*m): ans += 1 if ans >= m: print("Yes") else: print("No")
n, m = map(int, input().split()) A = list(map(int,input().split())) a_sum = sum(A) ans = 0 for i in range(n): if float(A[i]) >= a_sum/(4*m): ans += 1 if ans >= m: print("Yes") else: print("No")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
89
import sys N,M = map(int, input().split()) A = list(map(int, input().split())) sorted_A = sorted(A, reverse=True) all_A = sum(A) rule = (1/(4*M)) ans = 0 for i in A: if (i / all_A) > rule: ans = ans + 1 else: pass if ans >= M: print("Yes") else: print("No")
import sys N,M = map(int, input().split()) A = list(map(int, input().split())) sorted_A = sorted(A, reverse=True) all_A = sum(A) rule = (1/(4*M)) ans = 0 for i in A: if (i / all_A) >= rule: ans = ans + 1 else: pass if ans >= M: print("Yes") else: print("No")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
106
N, M = [int(t) for t in input().split(" ")] votes = [int(t) for t in input().split(" ")] total = sum(votes) t = total/(4*M) popular = [v for v in votes if v > t] if len(popular) >= M: print("Yes") else: print("No")
N, M = [int(t) for t in input().split(" ")] votes = [int(t) for t in input().split(" ")] total = sum(votes) t = total/(4*M) popular = [v for v in votes if v >= t] if len(popular) >= M: print("Yes") else: print("No")
[["-", 0, 662, 12, 658, 0, 678, 0, 666, 667, 47], ["+", 0, 662, 12, 658, 0, 678, 0, 666, 667, 20]]
5
94
#!/usr/bin/env python3 import sys YES = "Yes" NO = "No" N,M = list(map(int, input().split())) A = list(map(int, input().split())) least = sum(A) / (4 * M) B = sorted(A,reverse=True) cnt = 0 for i in range(N): if B[i] > least: cnt += 1 else: break if cnt >= M: print(YES) else: print...
#!/usr/bin/env python3 import sys YES = "Yes" NO = "No" N,M = list(map(int, input().split())) A = list(map(int, input().split())) least = sum(A) / (4 * M) B = sorted(A,reverse=True) cnt = 0 for i in range(N): if B[i] >= least: cnt += 1 else: break if cnt >= M: print(YES) else: prin...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
111
N,M = map(int,input().split()) A = list(map(int,input().split())) su = sum(A) A.sort(reverse=True) cnt = 0 for i in A: if (i >= int(su / 4 / M)): cnt += 1 if (cnt >= M): print('Yes') else: print('No')
N,M = map(int,input().split()) A = list(map(int,input().split())) su = sum(A) A.sort(reverse=True) cnt = 0 for i in A: if (i >= su / 4 / M): cnt += 1 if (cnt >= M): print('Yes') else: print('No')
[["-", 0, 57, 15, 23, 0, 666, 0, 652, 63, 22], ["-", 15, 23, 0, 666, 0, 652, 3, 4, 0, 24], ["-", 15, 23, 0, 666, 0, 652, 3, 4, 0, 25]]
5
93
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int a[] = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); ...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int a[] = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); ...
[["+", 15, 15, 0, 16, 12, 16, 31, 74, 0, 24], ["+", 0, 16, 12, 16, 31, 74, 39, 511, 0, 512], ["+", 15, 15, 0, 16, 12, 16, 31, 74, 0, 25], ["+", 15, 15, 0, 16, 12, 16, 12, 74, 0, 24], ["+", 0, 16, 12, 16, 12, 74, 39, 511, 0, 512], ["+", 15, 15, 0, 16, 12, 16, 12, 74, 0, 25]]
3
197
N,M=[int(x) for x in input().split()] A=[int(x) for x in input().split()] cnt=0 for i in range(N): if A[i] >= 1/(4*M): cnt+=1 if cnt>=M: print("Yes") else: print("No")
N,M=[int(x) for x in input().split()] A=[int(x) for x in input().split()] cnt=0 for i in range(N): if A[i] >= sum(A)/(4*M): cnt+=1 if cnt>=M: print("Yes") else: print("No")
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 0, 57, 15, 666, 0, 657, 31, 652, 63, 22], ["+", 15, 666, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 15, 666, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 15, 666, 0, 657, 31, 652, 3, 4, 0, 25]]
5
85
N,M=map(int, input().split()) Alist = list(map(int, input().split())) Alist.sort(reverse=True) sumnation = sum(Alist) bordernum = sumnation / (4*M) for i in Alist[:M]: judlist = [] temp = True if i >= bordernum else False judlist.append(temp) judged = all(judlist) if judged: print('yes') else : ...
N,M=map(int, input().split()) Alist = list(map(int, input().split())) Alist.sort(reverse=True) sumnation = sum(Alist) bordernum = sumnation / (4*M) for i in Alist[:M]: judlist = [] temp = True if i >= bordernum else False judlist.append(temp) judged = all(judlist) if judged: print('Yes') else : ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
107
N, M = map(int, input().split()) A = list(map(int, input().split())) sortedA = sorted(A, reverse=True) AA = sum(A) de = AA/(4*M) picA = sortedA[0:M] if (picA[-1] <= de): print("No") else: print("Yes")
N, M = map(int, input().split()) A = list(map(int, input().split())) sortedA = sorted(A, reverse=True) AA = sum(A) de = AA/(4*M) picA = sortedA[0:M] if (picA[-1] < de): print("No") else: print("Yes")
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 19], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 18]]
5
91
import sys, io, os input = sys.stdin.readline inputt = lambda: range(int(input())) inputn = lambda n = 1: range(n) inputi = lambda: map(int, input().split()) inputl = lambda: list(inputi()) from math import * from heapq import * from bisect import * from functools import reduce, lru_cache from collections import Count...
import sys, io, os input = sys.stdin.readline inputt = lambda: range(int(input())) inputn = lambda n = 1: range(n) inputi = lambda: map(int, input().split()) inputl = lambda: list(inputi()) from math import * from heapq import * from bisect import * from functools import reduce, lru_cache from collections import Count...
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 676], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 85]]
5
154
NM = input().split(); N,M = int(NM[0]),int(NM[1]); A = list(map(int, input().split())); A.sort(reverse=True); #先に総得票数を調べる Sum = 0; for i in range(N): Sum = Sum + A[i]; #人気商品とは呼べないボーダー fil = int(Sum / (4 * M)); #全探索 count=0; for j in range(M): if(A[j] >= fil): count+=1; if(count >= M): print(...
NM = input().split(); N,M = int(NM[0]),int(NM[1]); A = list(map(int, input().split())); A.sort(reverse=True); #先に総得票数を調べる Sum = 0; for i in range(N): Sum = Sum + A[i]; #人気商品とは呼べないボーダー fil = Sum / (4 * M); #全探索 count=0; for j in range(M): if(A[j] >= fil): count+=1; if(count >= M): print("Yes"...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
143
#include <bits/stdc++.h> #define INF INT_MAX #define UINF UINT_MAX #define MOD 1000000007 #define REP(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() typedef long long ll; typedef std::pair<int, int> pii; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n...
#include <bits/stdc++.h> #define INF INT_MAX #define UINF UINT_MAX #define MOD 1000000007 #define REP(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() typedef long long ll; typedef std::pair<int, int> pii; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); doubl...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
171
n,m = map(int,input().split()) a_list = list(map(int,input().split())) count = 0 x = sum(a_list)/(4*m) print(x) for i in range(0,n): if a_list[i] >= x : count += 1 if count >= m : print('Yes') else : print('No')
n,m = map(int,input().split()) a_list = list(map(int,input().split())) count = 0 x = sum(a_list)/(4*m) for i in range(0,n): if a_list[i] >= x : count += 1 if count >= m : print('Yes') else : print('No')
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
92
species, num = [int(i) for i in input().split()] votes = [int(i) for i in input().split()] sum_vote = sum(votes) min_rate = sum_vote / 4 / species votes.sort(reverse=True) ans = 'Yes' if votes[num - 1] >= min_rate else 'No' print(ans)
species, num = [int(i) for i in input().split()] votes = [int(i) for i in input().split()] sum_vote = sum(votes) min_rate = sum_vote / 4 / num votes.sort(reverse=True) ans = 'Yes' if votes[num - 1] >= min_rate else 'No' print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
81
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<int> a; for (int i = 0; i < n; i++) { int t; cin >> t; a.push_back(t); } int m_count = 0; int sum = accumulate(a.begin(), a.end(), 0); for (auto vote : a) { if ((double)vote < (double)(sum /...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<int> a; for (int i = 0; i < n; i++) { int t; cin >> t; a.push_back(t); } int m_count = 0; int sum = accumulate(a.begin(), a.end(), 0); for (auto vote : a) { if ((double)vote < ((double)sum /...
[["+", 51, 16, 12, 23, 0, 16, 31, 74, 0, 24], ["-", 15, 339, 51, 16, 12, 74, 51, 23, 0, 24]]
1
149
N, M = map(int, input().split()) A_list = list(map(int, input().split())) A_list.sort(reverse=True) SUM = sum(A_list) if A_list[M-1] >= (SUM//(4*M)) : print("Yes") else: print("No")
N, M = map(int, input().split()) A_list = list(map(int, input().split())) A_list.sort(reverse=True) SUM = sum(A_list) if A_list[M-1] >= (SUM/(4*M)) : print("Yes") else: print("No")
[["-", 0, 57, 15, 666, 0, 23, 0, 657, 17, 676], ["+", 0, 57, 15, 666, 0, 23, 0, 657, 17, 85]]
5
79
n, m = map(int, input().split()) a = list(map(int, input().split())) sum_a = sum(a) # print(n) # print(m) # print(sum_a) # print(sum_a // n) count = 0 for aa in a: # print(aa) if aa >= sum_a // (4 * m): count += 1 # print(count) if count >= m: print('Yes') else: print('No')
n, m = map(int, input().split()) a = list(map(int, input().split())) sum_a = sum(a) # print(n) # print(m) # print(sum_a) # print(sum_a // n) count = 0 for aa in a: # print(aa) if aa >= sum_a / (4 * m): count += 1 # print(count) if count >= m: print('Yes') else: print('No')
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 85]]
5
86
N, M = map(int, input().split()) lists = list(map(int, input().split())) # print(lists) sigma_A = sum(lists) val = 1/(4 * M) * sigma_A count = 0 for i in range(M): if max(lists) > val: count += 1 lists.remove(max(lists)) # print(lists) if count == M: print("Yes") else: print("No")
N, M = map(int, input().split()) lists = list(map(int, input().split())) # print(lists) sigma_A = sum(lists) val = 1/(4 * M) * sigma_A count = 0 for i in range(M): if max(lists) >= val: count += 1 lists.remove(max(lists)) # print(lists) if count == M: print("Yes") else: print("No")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
102
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, M, sum = 0, num = 0, i; cin >> N >> M; int A[N]; for (i = 0; i < N; i++) { cin >> A[i]; sum = sum + A[i]; } for (i = 0; i < N; i++) { if (A[i] >= ceil(sum / (4 * M))) num++; } if (num >= M...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, M, sum = 0, num = 0, i; cin >> N >> M; int A[N]; for (i = 0; i < N; i++) { cin >> A[i]; sum = sum + A[i]; } for (i = 0; i < N; i++) { if (A[i] >= ceil((double)sum / (4 * M))) num++; } if (...
[["+", 12, 2, 3, 4, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 16, 31, 74, 39, 77, 39, 40], ["+", 12, 2, 3, 4, 0, 16, 31, 74, 0, 25]]
1
136
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define ll long long using namespace std; const int N = 1e5; int n, m, a[101]; bool cmp(int x, int y) { return x > y; } int main() { int sum = 0; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i]; sort(a + 1, a ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define ll long long using namespace std; const int N = 1e5; int n, m, a[101]; bool cmp(int x, int y) { return x > y; } int main() { int sum = 0; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i]; sort(a + 1, a ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
145
import sys input = sys.stdin.readline #intの場合 N ,M = map(int,input().split()) intlist = list(map(int, input().split())) newlist = sorted(intlist, reverse=True)[:M] if newlist[M-1] > ( sum(intlist) / (4 * M) ): print ("Yes") else: print ("No")
import sys input = sys.stdin.readline #intの場合 N ,M = map(int,input().split()) intlist = list(map(int, input().split())) newlist = sorted(intlist, reverse=True)[:M] if newlist[M-1] >= ( sum(intlist) / (4 * M)): print ("Yes") else: print ("No")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
92
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; typedef pai...
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; typedef pai...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
288
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> v; int main() { ll m, n, tmp; // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { cin >> tmp; v.push_back(tmp); sum += tmp; } sort(v.begi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> v; int main() { ll m, n, tmp; // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { cin >> tmp; v.push_back(tmp); sum += tmp; } sort(v.begi...
[["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 48], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
201
#include <algorithm> #include <array> #include <deque> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <vector> #define ll long long int #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n) using namespace std...
#include <algorithm> #include <array> #include <deque> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <vector> #define ll long long int #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n) using namespace std...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
154
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int a[105]; for (int i = 0; i < n; i++) { cin >> a[i]; } int sum = 0; for (int i = 0; i < n; i++) { sum += a[i]; } sort(a, a + n, greater<int>()); for (int i = 0; i < m; i++) { if (a[i]...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; double m; cin >> n >> m; int a[105]; for (int i = 0; i < n; i++) { cin >> a[i]; } double sum = 0; for (int i = 0; i < n; i++) { sum += a[i]; } sort(a, a + n, greater<int>()); for (int i = 0; i < m; i++) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
150
#coding:utf-8 import sys n, m = map(int, input().split()) a = list(map(int, input().split())) vote = sum(a) rank = sorted(a, reverse=True) border = vote // (4*m) #print(border, rank) count = 0 for i in range(0, n): if rank[i] >= border: count += 1 if count == m: print('Yes') sys.exit()...
#coding:utf-8 import sys n, m = map(int, input().split()) a = list(map(int, input().split())) vote = sum(a) rank = sorted(a, reverse=True) border = vote / (4*m) #print(border, rank) count = 0 for i in range(0, n): if rank[i] >= border: count += 1 if count == m: print('Yes') sys.exit() ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85]]
5
108
n,m =map(int,(input().split())) a=list(map(int,input().split())) count = 0 total = 0 for i in range(n): total=total+a[i] th=total/(4*m) for i in range(n): if(a[i]>(th)): count=count+1 #print(count) if(count>=m): print("Yes") else: print("No")
n,m =map(int,(input().split())) a=list(map(int,input().split())) count = 0 total = 0 for i in range(n): total=total+a[i] th=total/(4*m) #print(total,th) for i in range(n): if(a[i]>=(th)): count=count+1 #print(count) if(count>=m): print("Yes") else: print("No")
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20]]
5
113
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0, a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } int d = sum / (4 * m); sort(a, a + n); if (a[n - m] >= d) cout << "Yes"; else { cout << "No"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0, a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } float d = sum / (float)(4 * m); sort(a, a + n); if (a[n - m] >= d) cout << "Yes"; else { cout << "No"; } retu...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 12, 74, 0, 24], ["+", 49, 50, 51, 16, 12, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 12, 74, 0, 25]]
1
114
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cer...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cer...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
577
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = 0; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); sum += vec.at(i); } sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); int cnt = 0; for (int i = 0; i < M; i++) ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = 0; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); sum += vec.at(i); } sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); int cnt = 0; for (int i = 0; i < M; i++) ...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
167
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } int res = 0; for (int i = 0; i < n; i++) { if (a[i] >= sum / (4 * m)) res++; } if (res >= m) cout ...
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; double sum = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } int res = 0; for (int i = 0; i < n; i++) { if (a[i] >= sum / (4 * m)) res++; } if (res >= m) co...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
128
#include <bits/stdc++.h> #define ll long long #define br cout << endl; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back const int MOD = 1000 * 1000 * 1000 + 7; const int MAXN = 1000 * 1000 + 10; using namespace std; int main() { int t = 1; // cin >> t ; while (t...
#include <bits/stdc++.h> #define ll long long #define br cout << endl; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back const int MOD = 1000 * 1000 * 1000 + 7; const int MAXN = 1000 * 1000 + 10; using namespace std; int main() { int t = 1; // cin >> t ; while (t...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 338, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
165
#include <algorithm> #include <iostream> #include <stdio.h> #include <string.h> using namespace std; const int N = 110; int a[N]; int n, m; int main() { cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } int k = sum / (4 * m); sort(a, a + n); for (int i = n -...
#include <algorithm> #include <iostream> #include <stdio.h> #include <string.h> using namespace std; const int N = 110; int a[N]; int n, m; int main() { cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } double k = sum / (double)(4 * m); sort(a, a + n); for (...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 12, 74, 0, 24], ["+", 49, 50, 51, 16, 12, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 12, 74, 0, 25]]
1
147
n, m = list(map(int, input().split())) A = list(map(int, input().split())) lmt = sum(A) /(4*m) A.sort(reverse=True) if A[m] >= lmt: print('Yes') else: print('No')
n, m = list(map(int, input().split())) A = list(map(int, input().split())) lmt = sum(A) /(4*m) A.sort(reverse=True) if A[m-1] >= lmt: print('Yes') else: print('No')
[["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612]]
5
78
n,m = gets.split(' ').map(&:to_i) nums = gets.split(' ').map(&:to_i) sum = nums.inject(:+) ok = sum / (4*m) puts m <= nums.count { |i| i >= ok } ? 'Yes' : 'No'
n,m = gets.split(' ').map(&:to_i) nums = gets.split(' ').map(&:to_i) sum = nums.inject(:+) ok = sum.to_f / (4*m) puts m <= nums.count { |i| i >= ok } ? 'Yes' : 'No'
[["+", 0, 493, 0, 662, 12, 738, 31, 652, 17, 131], ["+", 0, 493, 0, 662, 12, 738, 31, 652, 735, 22]]
4
73
def solve(n, m, arr): arr.sort() for i in range(m): if arr[-1 - i] < sum(arr) * (1 / 4 * m): return False return True if __name__ == "__main__": n, m = map(int, input().split(' ')) arr = [int(s) for s in list(input().split())] if solve(n, m, arr): print('Yes') el...
def solve(n, m, arr): arr.sort() for i in range(m): if arr[-1 - i] < sum(arr) * (1 / (4 * m)): return False return True if __name__ == "__main__": n, m = map(int, input().split(' ')) arr = [int(s) for s in list(input().split())] if solve(n, m, arr): print('Yes') ...
[["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
120
def main n = gets.chomp.split.map(&:to_i) m = n[1] a = gets.chomp.split.map(&:to_i).sort.reverse! sum = 0 a.each do |item| sum += item end target = a[m-1] limit = sum / (m * 4) if target >= limit puts "Yes" else puts "No" end end main
def main n = gets.chomp.split.map(&:to_i) m = n[1] a = gets.chomp.split.map(&:to_i).sort.reverse! sum = 0 a.each do |item| sum += item end target = a[m-1] limit = (sum.to_f) / (m * 4) if target >= limit puts "Yes" else puts "No" end end main
[["+", 8, 736, 0, 662, 12, 738, 31, 739, 0, 24], ["+", 0, 662, 12, 738, 31, 739, 0, 652, 17, 131], ["+", 0, 662, 12, 738, 31, 739, 0, 652, 735, 22], ["+", 8, 736, 0, 662, 12, 738, 31, 739, 0, 25]]
4
85
import java.math.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int[] A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); sum += A[i]; }...
import java.math.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int[] A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); sum += A[i]; }...
[["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 85], ["-", 15, 15, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["-", 15, 15, 0, 16, 31, 16, 12, 23, 0, 25], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 48]]
3
160
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A.sort(reverse=True) a=sum(A) count=0 for i in range(M): if A[i]>a/(4*M): count+=1 if count<M: print(NO) else: print(YES) return...
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A.sort(reverse=True) a=sum(A) count=0 for i in range(M): if A[i]>=a/(4*M): count+=1 if count<M: print(NO) else: print(YES) retur...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
182
#include <bits/stdc++.h> #define ll long long #define loop(n) for (ll i = 0; i < n; i++) #define sort(a) sort(a.rbegin(), a.rend()) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, x, votes = 0; cin >> n >> m; vector<int> vote(n); // 1votes, 2id for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> #define ll long long #define loop(n) for (ll i = 0; i < n; i++) #define sort(a) sort(a.rbegin(), a.rend()) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, x, votes = 0; cin >> n >> m; vector<int> vote(n); // 1votes, 2id for (int i = 0; i < n; i++) ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
162
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, total_votes = 0; vector<int> a(1000); cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; total_votes += a[i]; } int bar = total_votes / (4 * m); sort(a.rbegin(), a.rend()); for ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; long long total_votes = 0; vector<int> a(1000); cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; total_votes += a[i]; } double bar = total_votes / (4.0 * m); sort(a.rbegin(), ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13]]
1
153
#!/usr/bin/env python3 import sys #sys.setrecursionlimit(150000) #def my_index_multi(l, x): # return [i for i, _x in enumerate(l) if _x == x] YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A=sorted(A,reverse=True) sa=sum(A) if N==1: print(YES) e...
#!/usr/bin/env python3 import sys #sys.setrecursionlimit(150000) #def my_index_multi(l, x): # return [i for i, _x in enumerate(l) if _x == x] YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A=sorted(A,reverse=True) sa=sum(A) if N==1: print(YES) e...
[["-", 3, 4, 0, 41, 0, 666, 0, 657, 17, 676], ["+", 3, 4, 0, 41, 0, 666, 0, 657, 17, 85], ["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 18], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 19]]
5
176
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; int sum = 0; vector<int> a(n); rep(i, n) { cin >> a[i]; sum += a[i]; }...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ios::sync_with_stdio(false); cin.tie(0); double n, m; cin >> n >> m; double sum = 0; vector<double> a(n); rep(i, n) { cin >> a[i]; sum += ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
150
N, M = gets.chomp.split.map(&:to_i) A = gets.chomp.split.map(&:to_i) sortedA = A.sort.reverse if sortedA[M - 1] < (A.inject(:+))/(4 * M) then puts "No" else puts "Yes" end
N, M = gets.chomp.split.map(&:to_i) A = gets.chomp.split.map(&:to_i) sortedA = A.sort.reverse if sortedA[M - 1] < (A.inject(:+))/(4.0 * M) then puts "No" else puts "Yes" end
[["-", 15, 738, 12, 738, 12, 739, 0, 738, 31, 612], ["+", 15, 738, 12, 738, 12, 739, 0, 738, 31, 531]]
4
68
n,m = gets.split(" ").map(&:to_i) list = gets.split(" ").map(&:to_i) sum = 0 for value in 0...list.length do sum = sum + list[value] end pre = sum / (4 * m) ans = list.select { |num| num >= pre } if ans.length >= m then puts "Yes" else puts "No" end
n,m = gets.split(" ").map(&:to_i) list = gets.split(" ").map(&:to_i) sum = 0 for value in 0...list.length do sum = sum + list[value] end pre = sum / (4.0 * m) ans = list.select { |num| num >= pre } if ans.length >= m then puts "Yes" else puts "No" end
[["-", 0, 662, 12, 738, 12, 739, 0, 738, 31, 612], ["+", 0, 662, 12, 738, 12, 739, 0, 738, 31, 531]]
4
94
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int ara[n + 1]; int sum = 0; for (int i = 1; i <= n; i++) { cin >> ara[i]; sum += ara[i]; } double k = sum / (4.0 * m); sort(ara + 1, ara + n + 1); int bd = 0; for (int i = n; i > 0; i--) { ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int ara[n + 1]; int sum = 0; for (int i = 1; i <= n; i++) { cin >> ara[i]; sum += ara[i]; } double k = sum / (4.0 * m); sort(ara + 1, ara + n + 1); int bd = 0; for (int i = n; i > 0; i--) { ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
151
N,M = map(int,input().split()) A = [int(i) for i in input().split()] A.sort() B = sum(A) if A[M-1] >= B/(4*M): print('Yes') else: print('No')
N,M = map(int,input().split()) A = [int(i) for i in input().split()] A.sort(reverse=True) B = sum(A) if A[M-1] >= B/(4*M): print('Yes') else: print('No')
[["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146]]
5
75
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, a[101], sum = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } sort(a + 1, a + 1 + n); for (int i = n; i >= n - m + 1; ...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, a[101], sum = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } sort(a + 1, a + 1 + n); for (int i = n; i >= n - m + 1; ...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
157
#include <stdio.h> #include <stdlib.h> int int_cmp(const int *a, const int *b) { if (*b > *a) return 1; if (*b < *a) return -1; if (*b == *a) return 0; } int main(void) { int N, M; int A[100]; long all_vote = 0; int i; scanf("%d%d", &N, &M); getchar(); for (i = 0; i < N; i++) { sc...
#include <stdio.h> #include <stdlib.h> int int_cmp(const int *a, const int *b) { if (*b > *a) return 1; if (*b < *a) return -1; if (*b == *a) return 0; } int main(void) { int N, M; int A[100]; long all_vote = 0; int i; scanf("%d%d", &N, &M); getchar(); for (i = 0; i < N; i++) { sc...
[["+", 15, 23, 0, 16, 12, 16, 31, 74, 0, 24], ["+", 0, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 23, 0, 16, 12, 16, 31, 74, 0, 25]]
0
203
import numpy as np n, m = map(int, input().split(" ")) arr = list(map(int, input().split(" "))) arr = np.array(arr) s = np.sum(arr) choosable = len(np.where(4*m*arr >= s)) if m > choosable: print('No') else: print('Yes')
import numpy as np n, m = map(int, input().split(" ")) arr = list(map(int, input().split(" "))) arr = np.array(arr) s = np.sum(arr) choosable = len(np.where(4*m*arr >= s)[0]) if m > choosable: print('No') else: print('Yes')
[["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 73]]
5
95
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pali pair<long long, int> #define pad pair<double, double> #define pb push_back #define mp make_pair #define COUT(v) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pali pair<long long, int> #define pad pair<double, double> #define pb push_back #define mp make_pair #define COUT(v) ...
[["-", 49, 50, 51, 23, 0, 16, 31, 16, 17, 85], ["+", 49, 50, 51, 23, 0, 16, 31, 16, 17, 109]]
1
1,238
//****************************// /********** main *************/ //****************************// #include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #inclu...
//****************************// /********** main *************/ //****************************// #include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #inclu...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
223
nm = input().split(" ") N, M = int(nm[0]), int(nm[1]) # print(N, M) sorted_data = sorted(list(map(int, input().split(" "))), reverse=True) # print(sorted_data[M - 1], sum(sorted_data)) if sorted_data[M - 1] * 4 * M > sum(sorted_data): print("Yes") else: print("No")
nm = input().split(" ") N, M = int(nm[0]), int(nm[1]) # print(N, M) sorted_data = sorted(list(map(int, input().split(" "))), reverse=True) # print(sorted_data[M - 1] * 4 * M , sum(sorted_data)) if sorted_data[M - 1] * 4 * M >= sum(sorted_data): print("Yes") else: print("No")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
91
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) min = a.inject(:+) / 4 / m count = 0 a.each do |aa| count += 1 if aa >= min end if count >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) min = a.inject(:+).to_f / 4.0 / m count = 0 a.each do |aa| count += 1 if aa >= min end if count >= m puts "Yes" else puts "No" end
[["+", 0, 662, 12, 738, 31, 738, 31, 652, 17, 131], ["+", 0, 662, 12, 738, 31, 738, 31, 652, 735, 22], ["-", 0, 493, 0, 662, 12, 738, 31, 738, 12, 612], ["+", 0, 493, 0, 662, 12, 738, 31, 738, 12, 531]]
4
68
#include <iomanip> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; int a[n]; int total = 0; rep(i, n) { cin >> a[i]; total += a[i]; } int target = total / (4 * m) + (t...
#include <iomanip> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; int a[n]; int total = 0; rep(i, n) { cin >> a[i]; total += a[i]; } int target = total / (4 * m) + (t...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
155
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; int sum = 0; for (int i = 0; i < N; i++) sum += A[i]; int is_popular = sum / (4 * M); int num = 0; for (int i = 0; i < N; i++) { if (is_popular...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; double sum = 0; for (int i = 0; i < N; i++) sum += A[i]; double is_popular = sum / (4.0 * M); int num = 0; for (int i = 0; i < N; i++) { if (is...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 31, 13]]
1
146
"use strict"; function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError( "Invalid attempt to destructure non-iterable instance.\nIn order to be iter...
"use strict"; function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError( "Invalid attempt to destructure non-iterable instance.\nIn order to be iter...
[["-", 0, 63, 8, 556, 0, 37, 0, 16, 17, 47], ["+", 0, 63, 8, 556, 0, 37, 0, 16, 17, 20]]
2
656
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { ll N, M; cin >> N >> M; ll sum = 0; ll num = 0; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); sum += A.at(i); } string ans = "Yes"; long double tmp1 = 0; long double tmp2 = 0; for...
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { ll N, M; cin >> N >> M; ll sum = 0; ll num = 0; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); sum += A.at(i); } string ans = "Yes"; long double tmp1 = 0; long double tmp2 = 0; for...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
183
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using pii = pair<int, int>; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int n, m; cin >> n >> m; vector<int> a; int s = 0; rep(i, n) { in...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using pii = pair<int, int>; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int n, m; cin >> n >> m; vector<int> a; int s = 0; rep(i, n) { in...
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 48], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25]]
1
175
#include <algorithm> #include <iostream> using namespace std; bool cmp(const int a, const int b) { return a > b; } int main() { int m, n; int a[202] = {0}; scanf("%d%d", &n, &m); int sum = 0; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); sum += a[i]; } sort(a + 1, a + n + 1, cmp); if (a[m...
#include <algorithm> #include <iostream> using namespace std; bool cmp(const int a, const int b) { return a > b; } int main() { int m, n; int a[202] = {0}; scanf("%d%d", &n, &m); int sum = 0; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); sum += a[i]; } sort(a + 1, a + n + 1, cmp); if (a[m...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
153
n, m = map(int, input().split()) a = input().split() a = [int(i) for i in a] may = max(a) dif = (1 / (4*m)) * may cont = 0 for i in a: cont += (1 if i >= dif else 0) print ('Yes' if cont >= m else 'No')
n, m = map(int, input().split()) a = input().split() a = [int(i) for i in a] s = sum(a) dif = (1 / (4*m)) * s cont = 0 for i in a: cont += (1 if i >= dif else 0) print ('Yes' if cont >= m else 'No')
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
89
# coding: utf-8 n, m = map(int, input().split()) a_list = list(map(int, input().split())) border = sum(a_list) / (4 * m) a_choiced_list = [a for a in a_list if a > border] if len(a_choiced_list) < m: print('No') else: print('Yes')
# coding: utf-8 n, m = map(int, input().split()) a_list = list(map(int, input().split())) border = sum(a_list) / (4 * m) a_choiced_list = [a for a in a_list if a >= border] if len(a_choiced_list) < m: print('No') else: print('Yes')
[["-", 0, 662, 12, 658, 0, 678, 0, 666, 667, 47], ["+", 0, 662, 12, 658, 0, 678, 0, 666, 667, 20]]
5
81
n,m = map(int,input().split()) a = list(map(int,input().split())) sum_a = sum(a) jouken = sum_a / (m * 4) #print(jouken) c = 0 for i in range(n): if a[i] > jouken: c += 1 if c >= m: print("Yes") else: print("No")
n,m = map(int,input().split()) a = list(map(int,input().split())) sum_a = sum(a) jouken = sum_a / (m * 4) #print(jouken) c = 0 for i in range(n): if a[i] >= jouken: c += 1 if c >= m: print("Yes") else: print("No")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
90
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } std::sort(a.begin(), a.end(), std::greater<int>()); int sum = 0; for (int i = 0; i < n; i++) { sum += a.at(i); } if (a.at(m - 1) >= (sum + 3)...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } std::sort(a.begin(), a.end(), std::greater<int>()); int sum = 0; for (int i = 0; i < n; i++) { sum += a.at(i); } if (a.at(m - 1) >= (sum - 1)...
[["-", 51, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
157
N,M=map(int, input().split()) A = list(map(int, input().split())) count =0 s = sum(A) m = s//(4*M) for i in range(N): if A[i] >= m: count += 1 if count >= M: print("Yes") else: print("No")
N,M=map(int, input().split()) A = list(map(int, input().split())) count =0 s = sum(A) m = s/(4*M) for i in range(N): if A[i] >= m: count += 1 if count >= M: print("Yes") else: print("No")
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85]]
5
89
/* Solution by:- --------------Sannidhay Vashal ----------------NIT SRINAGAR */ #include <algorithm> #include <climits> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> #define fio ...
/* Solution by:- --------------Sannidhay Vashal ----------------NIT SRINAGAR */ #include <algorithm> #include <climits> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> #define fio ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 12, 2, 63, 40]]
1
253
#include <bits/stdc++.h> using namespace std; using ll = long long; using vin = vector<int>; using vll = vector<long long>; using vdo = vector<double>; using vvin = vector<vector<int>>; using vvll = vector<vector<long long>>; using vvdo = vector<vector<double>>; using vstr = vector<string>; using vvstr = vector<vector<...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vin = vector<int>; using vll = vector<long long>; using vdo = vector<double>; using vvin = vector<vector<int>>; using vvll = vector<vector<long long>>; using vvdo = vector<vector<double>>; using vstr = vector<string>; using vvstr = vector<vector<...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25], ["-", 8, 9, 0, 57, 64, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 27, 28, 22], ["-", 8,...
1
219
#include <bits/stdc++.h> #include <iostream> #include <queue> #include <stdio.h> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef pair<int, int> pi; int main() { int n, m; ...
#include <bits/stdc++.h> #include <iostream> #include <queue> #include <stdio.h> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef pair<int, int> pi; int main() { int n, m; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
164
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) N,M=nm() A=nl() A.sort() A.reverse() print(A) th=sum(A)/M/4 flag=True for i in range(M): if(A[i]<th)...
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) N,M=nm() A=nl() A.sort() A.reverse() th=sum(A)/M/4 flag=True for i in range(M): if(A[i]<th): ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
149
#include <bits/stdc++.h> using namespace std; int a[101]; int main() { int n, m, ans = 0; double sum = 0.0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } double x = sum / (double)(4 * m); for (int i = 1; i <= n; i++) { if (a[i] > x) ans++; } if (ans >= m) ...
#include <bits/stdc++.h> using namespace std; int a[101]; int main() { int n, m, ans = 0; double sum = 0.0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } double x = (double)sum / (double)(4 * m); for (int i = 1; i <= n; i++) { if (a[i] >= x) ans++; } if (a...
[["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 24], ["+", 49, 50, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
132
n,m=map(int,input().split()) a=list(map(int,input().split())) x=0 for i in range(n): if a[i]<sum(a)*(1/(4*m)): x+=1 if x==m: print("No") else: print("Yes")
n,m=map(int,input().split()) a=list(map(int,input().split())) x=0 for i in range(n): if a[i]>=sum(a)*(1/(4*m)): x+=1 if x>=m: print("Yes") else: print("No")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
87
#include <bits/stdc++.h> using namespace std; int main() { int M, N; cin >> N >> M; int A[N]; int all = 0; for (int i = 0; i < N; i++) { cin >> A[i]; all += A[i]; } sort(A, A + N, greater<int>()); if (A[M - 1] >= all / (4 * M)) cout << "Yes" << endl; else cout << "No" << endl; ret...
#include <bits/stdc++.h> using namespace std; int main() { int M, N; cin >> N >> M; int A[N]; long long all = 0; for (int i = 0; i < N; i++) { cin >> A[i]; all += A[i]; } sort(A, A + N, greater<int>()); if (A[M - 1] >= (double)all / (4 * M)) cout << "Yes" << endl; else cout << "No" ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
117
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string.h> #include <string> #include <vector> #define INF 100000000 const int MOD = 1e9 + 7; typedef long long ll; using namespace std; const ll M = 998244353; int main(void) { int n, cnt = 0, sum...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string.h> #include <string> #include <vector> #define INF 100000000 const int MOD = 1e9 + 7; typedef long long ll; using namespace std; const ll M = 998244353; int main(void) { int n, cnt = 0, sum...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
167
N, M = map(int, input().split(' ')) A = [int(a) for a in input().split(' ')] S = sum(A) thre = S / (4 * M) print(thre) cnt = 0 for a in A: if a >= thre: cnt += 1 if cnt >= M: print("Yes") else: print("No")
N, M = map(int, input().split(' ')) A = [int(a) for a in input().split(' ')] S = sum(A) thre = S / (4 * M) cnt = 0 for a in A: if a >= thre: cnt += 1 if cnt >= M: print("Yes") else: print("No")
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
94
#include <bits/stdc++.h> using namespace std; int main() { int a, m, k = 0; cin >> a >> m; vector<int> b(a); for (int i = 0; i < a; i++) { cin >> b.at(i); k = k + b.at(i); } sort(b.begin(), b.end()); reverse(b.begin(), b.end()); double j = k / (4 * m); if (b.at(m - 1) >= j) { cout << "Yes...
#include <bits/stdc++.h> using namespace std; int main() { int a, m, k = 0; cin >> a >> m; vector<int> b(a); for (int i = 0; i < a; i++) { cin >> b.at(i); k = k + b.at(i); } sort(b.begin(), b.end()); reverse(b.begin(), b.end()); double j = (double)k / (4 * (double)m); if (b.at(m - 1) >= j) { ...
[["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 24], ["+", 49, 50, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 25], ["+", 51, 16, 12, 23, 0, 16, 12, 74, 0, 24], ["+", 12, 23, 0, 16, 12, 74, 39, 77, 39, 40], ["+", 51, 16, 12, 23, 0, 16, 12, 74, 0, 25]]
1
156
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; vector<double> vec(N); double sum = 0; for (int n = 0; n < N; n++) { cin >> vec[n]; sum += vec[n]; } sort(vec.begin(), vec.end(), greater<double>()); if (vec[M - 1] < M) { ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; vector<double> vec(N); double sum = 0; for (int n = 0; n < N; n++) { cin >> vec[n]; sum += vec[n]; } sort(vec.begin(), vec.end(), greater<double>()); if (vec[M - 1] < sum / (...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 15, 339, 51, 16, 12, 16, 12, 23, 0, 24], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 17, 48], ["+", 15, 339, 51, 16, 12, 16, 12, 23, 0, 25]]
1
128
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } int sum = accumulate(a.begin(), a.end(), 0); int cnt = 0; for (int i = 0; i < n; ++i) { if (a[i] * (4 * m) > sum) { ++cnt; } } if (cnt...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } int sum = accumulate(a.begin(), a.end(), 0); int cnt = 0; for (int i = 0; i < n; ++i) { if (a[i] * (4 * m) >= sum) { ++cnt; } } if (cn...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
143
n, m = map(int,input().split()) a = list(map(int,input().split())) total = sum(a) threshold = total / 4 / m num_over = 0 done = False for i in a: if i >= threshold: num_over = num_over + 1 if num_over == m: print('Yes') done = True if not done: print('No')
n, m = map(int,input().split()) a = list(map(int,input().split())) total = sum(a) threshold = total / 4 / m num_over = 0 done = False for i in a: if i >= threshold: num_over = num_over + 1 if num_over == m: print('Yes') done = True break if not done: print('No')
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
91
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int a, b, c, e; cin >> a >> b; vector<int> d(a); c = 0; rep(i, a) { cin >> d.at(i); c += d.at(i); } sort(d.begin(), d.end()); reverse(d.begin(), d.end()); e = 0; rep(i, b) { if (d.at(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int a, b, c, e; cin >> a >> b; vector<int> d(a); c = 0; rep(i, a) { cin >> d.at(i); c += d.at(i); } sort(d.begin(), d.end()); reverse(d.begin(), d.end()); e = 0; rep(i, b) { if (d.at(...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
167
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n - 1; i >= 0; i--) #define MAX(a, b) a = a > b ? a : b #define MIN(a, b) a = a < b ? a : b #define REP(i, x, n) for (int i = x; i < n; i++) #define REPR(i, x, n) for (int i = n - 1; i >= x; i--) #define pb push_back ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n - 1; i >= 0; i--) #define MAX(a, b) a = a > b ? a : b #define MIN(a, b) a = a < b ? a : b #define REP(i, x, n) for (int i = x; i < n; i++) #define REPR(i, x, n) for (int i = n - 1; i >= x; i--) #define pb push_back ...
[["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 16, 31, 74, 0, 24], ["+", 0, 16, 31, 16, 31, 74, 39, 77, 39, 40], ["+", 12, 23, 0, 16, 31, 16, 31, 74, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
220
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int t = 0, num; int n, m, i, sum = 0; int arr[10005]; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) { scanf("%d", &arr[i]); sum += arr[i]; } num = sum / 4 / m; for (i = 0; i < n; i++) { if (arr[i] >= num) { ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int t = 0; double num; int n, m, i, sum = 0; int arr[10005]; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) { scanf("%d", &arr[i]); sum += arr[i]; } num = (double)sum / 4 / m; for (i = 0; i < n; i++) { if (arr[...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 11, 12, 16, 31, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 11, 12, 16, 31, 16, 31, 74, 0, 25]]
1
147
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin(), A.end()); reverse(A.begin(), A.end()); int sum = accumulate(A.begin(), A.end(), 0); bool ans = true; for (int i = 0; i < M; i++...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin(), A.end()); reverse(A.begin(), A.end()); int sum = accumulate(A.begin(), A.end(), 0); bool ans = true; for (int i = 0; i < M; i++...
[["-", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13]]
1
178
#include <bits/stdc++.h> using namespace std; int n, m, ans = 0, a[110], num = 0; bool cmp(int a, int b) { return a > b; } int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) cin >> a[i], ans += a[i]; sort(a + 1, a + 1 + n, cmp); if (a[m] * 4 * m < ans) cout << "NO" << endl; else cout << "Y...
#include <bits/stdc++.h> using namespace std; int n, m, ans = 0, a[110], num = 0; bool cmp(int a, int b) { return a > b; } int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) cin >> a[i], ans += a[i]; sort(a + 1, a + 1 + n, cmp); if (a[m] * 4 * m < ans) cout << "No" << endl; else cout << "Y...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
128
n,m = map(int,input().split(' ')) aa = list(map(int, input().split(' '))) A = sorted(aa, reverse=True) Am = A[:m] for a in Am: if a>(0.25/m)*sum(aa): continue else: print('No') exit(0) print('Yes')
n,m = map(int,input().split(' ')) aa = list(map(int, input().split(' '))) A = sorted(aa, reverse=True) Am = A[:m] for a in Am: if a>=(0.25/m)*sum(aa): continue else: print('No') exit(0) print('Yes')
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
94
#include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int, int> #define F first #define S second #define pb push_back #define pp pop_back const int P = 1000000007; using namespace std; int n, m, x; int a[1010]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >>...
#include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int, int> #define F first #define S second #define pb push_back #define pp pop_back const int P = 1000000007; using namespace std; int n, m; ld x, a[1010]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21]]
1
165
n,m=map(int,input().split()) List=list(map(int,input().split())) count=0 total=0 for i in List: total=total+i for i in List: if i>=total/m/4: count=count+1 else: count=count+0 if count>=m: print("YES") else: print("NO")
n,m=map(int,input().split()) List=list(map(int,input().split())) count=0 total=0 for i in List: total=total+i for i in List: if i>=total/m/4: count=count+1 else: count=count+0 if count>=m: print("Yes") else: print("No")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
94
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { int n, m; cin >> n >> m; int tot = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; tot += a[i]; } int ans = 0; int x = 4 * m; int t = tot / x; // cout<<tot<<" "<<t<<endl; for (int i = 0; i < m; i...
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { int n, m; cin >> n >> m; int tot = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; tot += a[i]; } int ans = 0; int x = 4 * m; float t = (float)tot / x; // cout<<tot<<" "<<t<<endl; for (int i = 0;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 24], ["+", 49, 50, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 25]]
1
165