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; #define REP(i, n) for (int i = 0; i < (int)n; i++) #define REPR(i, n) for (int i = (int)n - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++) #define FORR(i, m, n) for (int i = (int)m - 1; i >= (int)n; i--) #define ALL(x) (x).begin(), (x).end() #def...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; i++) #define REPR(i, n) for (int i = (int)n - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++) #define FORR(i, m, n) for (int i = (int)m - 1; i >= (int)n; i--) #define ALL(x) (x).begin(), (x).end() #def...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
510
#pragma region RegionDefs #include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, l, r) for (int i = (l), i##_len = (r); i < i##_len; ++i) #define all(x) begin(x), end(x) using namespace std; const int INF = 1e9; template <class T = int> using V = vector<T>; template ...
#pragma region RegionDefs #include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, l, r) for (int i = (l), i##_len = (r); i < i##_len; ++i) #define all(x) begin(x), end(x) using namespace std; const int INF = 1e9; template <class T = int> using V = vector<T>; template ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
410
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a; int temp; int all = 0; for (int i = 0; i < n; i++) { cin >> temp; all += temp; a.push_back(temp); } int num = 0; for (int i = 0; i < n; i++) { if (all ...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a; int temp; double all = 0; for (int i = 0; i < n; i++) { cin >> temp; all += temp; a.push_back(temp); } int num = 0; for (int i = 0; i < n; i++) { if (a...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
139
#include <iostream> using namespace std; int main(int argc, char const *argv[]) { long long int n, m, x = 0, count = 0; cin >> n >> m; long long int arr[n + 5]; for (long long int i = 0; i < n; i++) { cin >> arr[i]; x = x + arr[i]; } for (long long int i = 0; i < n; i++) { if (x * (1 / (4 * m)) ...
#include <iostream> using namespace std; int main(int argc, char const *argv[]) { long long int n, m, x = 0, count = 0; cin >> n >> m; long long int arr[n + 5]; for (long long int i = 0; i < n; i++) { cin >> arr[i]; x = x + arr[i]; } for (long long int i = 0; i < n; i++) { if (x * (1.0 / (4 * m)...
[["-", 51, 16, 31, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 31, 13]]
1
156
N,M = [int(i) for i in input().split(" ")] A = [int(i) for i in input().split(" ")] cnt = 0 sum1 = sum(A) p = 1/(4*M) for i in range(len(A)): A[i] = A[i]/sum1 for i in A: if i >= p: cnt = cnt + 1 if cnt > M: print('Yes') else: print('No')
N,M = [int(i) for i in input().split(" ")] A = [int(i) for i in input().split(" ")] cnt = 0 sum1 = sum(A) p = 1/(4*M) for i in range(len(A)): A[i] = A[i]/sum1 for i in A: if i >= p: cnt = cnt + 1 if cnt >= 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
118
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, a, b) for (int i = (int)(a); (i) < (int)(b); i++) typedef unsigned long long ull; typedef long long ll; const int INF = 1001001001; int main() { int n, m; cin >> n >> m; vector<int> products(n); ll ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, a, b) for (int i = (int)(a); (i) < (int)(b); i++) typedef unsigned long long ull; typedef long long ll; const int INF = 1001001001; int main() { int n, m; cin >> n >> m; vector<double> products(n); ...
[["-", 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, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 51, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
163
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int a[N]; for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { if (a[i] < a[j]) { int tmp = a[i]; a[i] = a[j]; a[j] = tmp; ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int a[N]; for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { if (a[i] < a[j]) { int tmp = a[i]; a[i] = a[j]; a[j] = tmp; ...
[["-", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13]]
1
194
#include <stdio.h> int main() { int n, m, k = 0, vote = 0; int check; scanf("%d%d", &n, &m); int arr[n + 1]; for (int i = 1; i <= n; i++) { scanf("%d", &arr[i]); vote = vote + arr[i]; } if ((vote % (4 * m)) == 0) check = vote / (4 * m); else check = (vote / (4 * m)) + 1; for (int i = ...
#include <stdio.h> int main() { int n, m, k = 0, vote = 0; int check; scanf("%d%d", &n, &m); int arr[n + 1]; for (int i = 1; i <= n; i++) { scanf("%d", &arr[i]); vote = vote + arr[i]; } if ((vote % (4 * m)) == 0) check = vote / (4 * m); else check = (vote / (4 * m)) + 1; for (int i = ...
[["-", 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]]
0
176
#include <math.h> #include <stdio.h> int main(void) { int all; int pickup; scanf("%d %d", &all, &pickup); int value[all]; int all_value = 0; for (int i = 0; i < all; i++) { scanf("%d", &value[i]); all_value += value[i]; } float judge = (float)all_value / (4 * pickup); int cnt = 0; for ...
#include <math.h> #include <stdio.h> int main(void) { int all; int pickup; scanf("%d %d", &all, &pickup); int value[all]; int all_value = 0; for (int i = 0; i < all; i++) { scanf("%d", &value[i]); all_value += value[i]; } float judge = (float)all_value / (4 * pickup); int cnt = 0; for ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
157
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <sstream> #include <stdio.h> #include <string> #include <valarray> #include <vector> using namespace std; vector<int> Data; int main(void) { int n, m; cin >> n >> m; Data.resize(n); int Sum = 0; for (auto &Target : Data) {...
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <sstream> #include <stdio.h> #include <string> #include <valarray> #include <vector> using namespace std; vector<int> Data; int main(void) { int n, m; cin >> n >> m; Data.resize(n); int Sum = 0; for (auto &Target : Data) {...
[["+", 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
143
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); int total = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; total += a[i]; } string res; int count = 0; // sort(a.begin(), a.end(), greater<int>()); for (int i = 0; i < n; ++i) if (a[i] ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); int total = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; total += a[i]; } string res; int count = 0; for (int i = 0; i < n; ++i) if (a[i] >= float(total) / (4 * m)) ++count; i...
[["-", 0, 7, 8, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 17, 20], ["+", 15, 339, 51, 16, 12, 16, 31, 2, 63, 40], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
134
#include <algorithm> #include <iostream> #include <list> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; int A[N]; int SUM = 0; for (int i = 0; i < N; i++) { cin >> A[i]; SUM += A[i]; } string ans = "No"; int count = 0; double perA = SUM / (4 * M); for (int a ...
#include <algorithm> #include <iostream> #include <list> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; int A[N]; int SUM = 0; for (int i = 0; i < N; i++) { cin >> A[i]; SUM += A[i]; } string ans = "No"; int count = 0; double perA = (double)SUM / (4 * M); for ...
[["+", 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
136
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef vector<pii> vii; #define ll long long #define ff first #define ss second #define pb push_back #define mkp make_pair #define sz size() #define forf(a, b, c) for (int i = a; i <= b; i...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef vector<pii> vii; #define ll long long #define ff first #define ss second #define pb push_back #define mkp make_pair #define sz size() #define forf(a, b, c) for (int i = a; i <= b; i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 31, 13], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 48], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 12, 22], ["+", 49, 50, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 51, 22]]
1
359
def swap(a,b): return b,a n,m = map(int,input().split()) arr = list(map(int,input().split())) sum = 0 for i in arr: sum += i sum = sum//(4*m) count=0 for i in arr: if (i>=sum): count+=1 if (count>=m): print("Yes") else: print("No")
def swap(a,b): return b,a n,m = map(int,input().split()) arr = list(map(int,input().split())) sum = 0 for i in arr: sum += i sum = sum/(4*m) count=0 for i in arr: if (i>=sum): 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
104
#include <bits/stdc++.h> //#define cin (type == 0?cin:fin) //#define cout (type == 0?cout:fout) #define tcn cin.tie(0); #define tct cout.tie(0); #define r_0 return 0 #define ll long long #define TIME ios_base::sync_with_stdio(0); using namespace std; const long long N = 2e3 + 7; const long long MrBeast = 1e9; ll T = ...
#include <bits/stdc++.h> //#define cin (type == 0?cin:fin) //#define cout (type == 0?cout:fout) #define tcn cin.tie(0); #define tct cout.tie(0); #define r_0 return 0 #define ll long long #define TIME ios_base::sync_with_stdio(0); using namespace std; const long long N = 2e3 + 7; const long long MrBeast = 1e9; ll T = ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40]]
1
199
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[n]; int count1 = 0; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } for (int i = 0; i < n; i++) { double s = (double)(a[i]); double d = (double)((1 / (4 * m)) * sum); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; double m; cin >> n >> m; double a[n]; double count1 = 0; double sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } for (int i = 0; i < n; i++) { double s = (double)(a[i]); double d = (double)((1 / (4...
[["-", 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
152
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc *bufio.Scanner func init() { // 100MB bufsize := 100 * 1024 * 1024 sc = bufio.NewScanner(os.Stdin) sc.Buffer(make([]byte, bufio.MaxScanTokenSize), bufsize) sc.Split(bufio.ScanWords) } func readInt() int { return readIntArray(1)...
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc *bufio.Scanner func init() { // 100MB bufsize := 100 * 1024 * 1024 sc = bufio.NewScanner(os.Stdin) sc.Buffer(make([]byte, bufio.MaxScanTokenSize), bufsize) sc.Split(bufio.ScanWords) } func readInt() int { return readIntArray(1)...
[["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 18]]
7
538
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <unordered_set> #include <vector> using namespace std; // int x=atoi(s.c_str()); s_to_in; int dx[] = {-1, 0, 0}; int...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <unordered_set> #include <vector> using namespace std; // int x=atoi(s.c_str()); s_to_in; int dx[] = {-1, 0, 0}; int...
[["-", 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], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
442
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int total = 0; int cnt = 0; cin >> n >> m; vector<int> vote(120); for (int i = 0; i < n; i++) { cin >> vote.at(i); } for (int i = 0; i < n; i++) { total += vote[i]; } for (int i = 0; i < n; i++) { if (vote[i] >= total ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; double total = 0; int cnt = 0; cin >> n >> m; vector<int> vote(120); for (int i = 0; i < n; i++) { cin >> vote.at(i); } for (int i = 0; i < n; i++) { total += vote[i]; } for (int i = 0; i < n; i++) { if (vote[i] >= tot...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 12, 16, 12, 23, 0, 16, 31, 74, 0, 24], ["+", 12, 23, 0, 16, 31, 74, 39, 77, 39, 40], ["+", 12, 16, 12, 23, 0, 16, 31, 74, 0, 25]]
1
151
def num(): n,m=map(int,input().split()) a=list(map(int,input().split())) a=sorted(a,reverse=True) for i in range(m): if a[i]<sum(a)/4*m: return "No" return "Yes" print(num())
def num(): n,m=map(int,input().split()) a=list(map(int,input().split())) a=sorted(a,reverse=True) for i in range(m): if a[i]<(sum(a)/(4*m)): # print(sum(a)/12) return "No" return "Yes" print(num())
[["+", 8, 196, 0, 57, 15, 666, 0, 23, 0, 24], ["+", 15, 666, 0, 23, 0, 657, 12, 23, 0, 24], ["+", 15, 666, 0, 23, 0, 657, 12, 23, 0, 25], ["+", 8, 196, 0, 57, 15, 666, 0, 23, 0, 25]]
5
85
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPM(i, n) for (ll i = (n - 1); 0 = < i; i--) #define VI vector<int> #define VS vector<string> #define V_SORT_U(x) sort(x.begin(), x.end()); #define V_SORT_D(x) sort(x.begin(), x.end(), greate...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPM(i, n) for (ll i = (n - 1); 0 = < i; i--) #define VI vector<int> #define VS vector<string> #define V_SORT_U(x) sort(x.begin(), x.end()); #define V_SORT_D(x) sort(x.begin(), x.end(), greate...
[["-", 15, 339, 51, 16, 12, 74, 51, 23, 0, 24], ["-", 12, 74, 51, 23, 0, 16, 12, 23, 0, 25]]
1
225
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(n) begin(n), end(n) int main() { int n, m; cin >> n >> m; ll sum = 0; int tmp; vector<int> a(n); REP(i, n) { cin >> tmp; a[i] = tmp; sum += tmp; } long double thres...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(n) begin(n), end(n) int main() { int n, m; cin >> n >> m; ll sum = 0; int tmp; vector<int> a(n); REP(i, n) { cin >> tmp; a[i] = tmp; sum += tmp; } long double thres...
[["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 24], ["+", 51, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 51, 16, 31, 74, 39, 77, 39, 86, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 74, 0, 25]]
1
178
n,m=map(int,input().split()) List=[int(i) for i in input().split()] s=sum(List) for i in range(m): a=max(List) if a>s*(1/(4*m)): del List[List.index(a)] a=1 else: a=0 print('Yes' if a==1 else 'No')
n,m=map(int,input().split()) List=[int(i) for i in input().split()] s=sum(List) for i in range(m): a=max(List) if a>=s*(1/(4*m)): del List[List.index(a)] a=1 else: a=0 print('Yes' if a==1 else 'No')
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
101
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, m, c = 0, s = 0, y, z; cin >> n >> m; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; s = s + a[i]; } float x = s * (float)1 / (4 * m); for (j = 0; j < n; j++) { if (a[j] > x) { c++; } } if (c >= m) { co...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, m, c = 0, s = 0, y, z; cin >> n >> m; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; s = s + a[i]; } float x = s * (float)1 / (4 * m); for (j = 0; j < n; j++) { if (a[j] >= x) { c++; } } if (c >= m) { c...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
142
n,m=list(map(int, input().split())) a=list(map(int, input().split())) a.sort(reverse=True) if a[m-1]<=sum(a)//(4*m): print("No") else:print("Yes")
n,m=list(map(int, input().split())) a=list(map(int, input().split())) a.sort(reverse=True) if a[m-1]>=sum(a)/(4*m): print("Yes") else:print("No")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 85], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
77
#import math n,m = map(int, input().split()); l = list(map(int, input().split())) #print(m) #print(n) #print(l) num = 0; th = sum(l)/(4*m); print(th); for i in range(len(l)): if l[i] >= th: num += 1; if num >= m: print('Yes'); else: print('No');
n,m = map(int, input().split()); l = list(map(int, input().split())) num = 0; th = sum(l)/(4*m); for i in range(len(l)): if l[i] >= th: num += 1; if num >= 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], ["-", 36, 36, 36, 36, 36, 36, 0, 656, 0, 35]]
5
104
#include <iostream> using namespace std; int main() { long long int N, M, all, tmp, k, l; long long int A[100]; double max; all = 0; cin >> N >> M; for (long long int i = 0; i < N; i++) { cin >> A[i]; } for (long long int j = 0; j < N; j++) { all = all + A[j]; } max = all / (4 * M); for (k...
#include <iostream> using namespace std; int main() { long long int N, M, tmp, k, l; long long int A[100]; double max, all; all = 0; cin >> N >> M; for (long long int i = 0; i < N; i++) { cin >> A[i]; } for (long long int j = 0; j < N; j++) { all = all + A[j]; } max = all / (4 * M); for (k...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]]
1
215
n = input().split() m = input().split() a = len(m) sum = 0 for i in range(a): sum += int(m[i]) item2 = [] for i in range(a): item2.append(int(m[i]) / sum) ans = 1 / (4 * int(n[1])) item3 = [] for i in range(a): if item2[i] >= ans: item3.append(item2[i]) if int(n[1]) == int(len(item3)): print('Yes') els...
n = input().split() m = input().split() a = len(m) sum = 0 for i in range(a): sum += int(m[i]) item2 = [] for i in range(a): item2.append(int(m[i]) / sum) ans = 1 / (4 * int(n[1])) item3 = [] for i in range(a): if item2[i] >= ans: item3.append(item2[i]) if int(n[1]) <= int(len(item3)): print('Yes') els...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
145
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, m; vector<long long> votes; ll votes_s; ll sum = 0; ll contor = 0; set<ll> nums; cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> votes_s; nums.insert(votes_s); votes.push_back(votes_s); sum +...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, m; vector<long long> votes; ll votes_s; ll sum = 0; ll contor = 0; set<ll> nums; cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> votes_s; nums.insert(votes_s); votes.push_back(votes_s); sum +...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
142
n, m = (int(x) for x in input().split()) a_list = list(map(int, input().split())) border = sum(a_list) / (4 * m) # print('border') # print(border) count = 0 for i in range(len(a_list)): # print('a_list') # print(a_list[i]) if border < a_list[i] : count = count + 1 if m <= count : print('...
n, m = (int(x) for x in input().split()) a_list = list(map(int, input().split())) border = sum(a_list) / (4 * m) # print('border') # print(border) count = 0 for i in range(len(a_list)): # print('a_list') # print(a_list[i]) if border <= a_list[i] : # print('カウント!') count = count + 1 i...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
99
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); sum += arr[i]; } bool...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); sum += arr[i]; } bool...
[["-", 31, 23, 0, 16, 12, 23, 0, 16, 31, 515], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 31, 515], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 0, 57, 64, 196, 0, 57, 64, 196, 0, 46]]
3
190
#include <stdio.h> using namespace std; int main() { int n, m, sum = 0, count = 0; scanf("%d %d", &n, &m); int a[n]; for (int i = 0; i < n; i++) { int v; scanf("%d", &v); sum += v; a[i] = v; } for (int i = 0; i < n; i++) { double c = sum / (4 * m); if (a[i] < c) { count++; ...
#include <stdio.h> using namespace std; int main() { int n, m, sum = 0, count = 0; scanf("%d %d", &n, &m); int a[n]; for (int i = 0; i < n; i++) { int v; scanf("%d", &v); sum += v; a[i] = v; } for (int i = 0; i < n; i++) { double c = (double)sum / (4 * m); if (a[i] < c) { coun...
[["+", 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
155
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll n, m, sum = 0; cin >> n >> m; vec...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll n, m, sum = 0; cin >> n >> m; vec...
[["+", 0, 41, 15, 16, 12, 16, 31, 74, 0, 24], ["+", 15, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 41, 15, 16, 12, 16, 31, 74, 0, 25]]
1
174
#include <algorithm> #include <iostream> #include <vector> #define endl '\n' using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; int arr[101]; int sum = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; }...
#include <algorithm> #include <iostream> #include <vector> #define endl '\n' using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; int arr[101]; int sum = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; }...
[["-", 15, 339, 51, 16, 12, 74, 51, 23, 0, 24], ["+", 51, 16, 12, 16, 12, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 12, 74, 0, 25], ["+", 51, 16, 12, 16, 12, 74, 51, 23, 0, 24], ["-", 12, 74, 51, 23, 0, 16, 12, 23, 0, 25]]
1
171
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sm = 0, mx = 0; cin >> n >> m; vector<int> a; for (int i = 0; i < n; ++i) { int x; cin >> x; a.push_back(x); sm += a[i]; } sort(a.begin(), a.end(), greater<int>()); if (a[m - 1] < sm / (4 * m)) { cout << "No" << en...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sm = 0, mx = 0; cin >> n >> m; vector<int> a; for (int i = 0; i < n; ++i) { int x; cin >> x; a.push_back(x); sm += a[i]; } sort(a.begin(), a.end(), greater<int>()); if (a[m - 1] * 4 * m < sm) { cout << "No" << endl...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 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], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48], ["-", 15, 339, 51, 16, 12, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17...
1
134
#include <bits/stdc++.h> using namespace std; char s[10]; int a[1005]; int main() { int n, m; int sum = 0; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> a[i]; sum += a[i]; } int av = sum * (1.0 / (4.0 * m)); int cnt = 0; for (int i = 1; i <= n; ++i) { if (a[i] >= av) cnt++; } ...
#include <bits/stdc++.h> using namespace std; char s[10]; double a[1005]; int main() { double n, m; double sum = 0; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> a[i]; sum += a[i]; } double av = sum * (1.0 / (4.0 * m)); int cnt = 0; for (int i = 1; i <= n; ++i) { if (a[i] >= av) ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
142
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]; } int check = sum /...
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]; } float check = (fl...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 511, 0, 531], ["+", 0, 503, 49, 200, 51, 16, 31, 74, 0, 24], ["+", 49, 200, 51, 16, 31, 74, 39, 511, 0, 531], ["+", 0, 503, 49, 200, 51, 16, 31, 74, 0, 25]]
3
175
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); int sum = 0; for (int i = 0; i < n; i++) sum += v[i]; for (int i = 0; i < m...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); int sum = 0; for (int i = 0; i < n; i++) sum += v[i]; for (int i = 0; i < m...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
153
m,n = (int(x) for x in input().split()) list = (input().split()) for i in range(len(list)): list[i] = int(list[i]) la = sorted(list, reverse=True) sum = 0 for i in range(len(list)): sum += list[i] if la[n-1]<sum/(4*m): print('No') else: print('Yes')
n,m = (int(x) for x in input().split()) list = (input().split()) for i in range(len(list)): list[i] = int(list[i]) la = sorted(list, reverse=True) sum = 0 for i in range(len(list)): sum += list[i] if la[m-1]<sum/(4*m): print('No') else: print('Yes')
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22]]
5
114
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; const int INF = 1 << 29; // 十分大きい値にする, INT_MAX にしないのはオーバーフロー対策 templa...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; const int INF = 1 << 29; // 十分大きい値にする, INT_MAX にしないのはオーバーフロー対策 templa...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
270
#include <iostream> using namespace std; int main() { int M, N; cin >> N >> M; int *A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { cin >> A[i]; sum += A[i]; } int temp = 0; for (int i = 0; i < N; i++) { if (A[i] >= (sum / (4 * M))) { temp++; } if (temp >= M) { ...
#include <iostream> using namespace std; int main() { int M, N; cin >> N >> M; int *A = new int[N]; float sum = 0; for (int i = 0; i < N; i++) { cin >> A[i]; sum += A[i]; } int temp = 0; for (int i = 0; i < N; i++) { if (A[i] >= (sum / (4 * M))) { temp++; } if (temp >= M) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
141
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; typedef std::pair<int, int> ipair; int main() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; int sum; sort(a.rbegin(), a.rend()); sum = accumulate(a.begin(), a.end(), ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; typedef std::pair<int, int> ipair; int main() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; float sum; sort(a.rbegin(), a.rend()); sum = accumulate(a.begin(), a.end()...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
149
n, m = map(int, input().split()) a = list(map(int, input().split())) c = sum(a)//(4*m) ans = sorted(a, reverse=True) ans_0 = ans[:m] if min(ans_0) < c:print('No') else:print('Yes')
n, m = map(int, input().split()) a = list(map(int, input().split())) c = sum(a)/(4*m) ans = sorted(a, reverse=True) ans_0 = ans[:m] if min(ans_0) < c:print('No') else:print('Yes')
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85]]
5
84
N,M=map(int,input().split()) A=list(map(int,input().split())) S=sum(A) c=0 for i in A: if (1/(M*4))-(i/S) < 0: c+=1 print("Yes" if M<=c else "No")
N,M=map(int,input().split()) A=list(map(int,input().split())) S=sum(A) c=0 for i in A: if (1/(M*4)) <= (i/S): c+=1 print("Yes" if M<=c else "No")
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
83
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i, j, count, sum; int n, m; scanf("%d %d", &n, &m); int A[n]; sum = 0; for (i = 0; i < n; i++) { scanf("%d", &A[i]); sum += A[i]; } count = 0; for (i = 0; i < n; i++) { if (((double)A[i] / sum) > (1.0 / (4 * m)))...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i, j, count, sum; int n, m; scanf("%d %d", &n, &m); int A[n]; sum = 0; for (i = 0; i < n; i++) { scanf("%d", &A[i]); sum += A[i]; } count = 0; for (i = 0; i < n; i++) { if (((double)A[i] / sum) >= (1.0 / (4 * m))...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
162
#include <algorithm> #include <iostream> int main() { int M, N, *A, X = 0; std::cin >> N >> M; A = new int[N]; for (int i = 0; i < N; i++) { std::cin >> A[i]; X += A[i]; } std::sort(A, A + N); if (A[N - M] < X / 4 / M) { std::cout << "No"; } else { std::cout << "Yes"; } delete[] A; ...
#include <algorithm> #include <iostream> int main() { int M, N, *A, X = 0; std::cin >> N >> M; A = new int[N]; for (int i = 0; i < N; i++) { std::cin >> A[i]; X += A[i]; } std::sort(A, A + N); if (A[N - M] < 1.0 * X / 4 / M) { std::cout << "No"; } else { std::cout << "Yes"; } delete...
[["+", 51, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 17, 48]]
1
122
#include <bits/stdc++.h> using namespace std; void Main() { int64_t N, M; cin >> N >> M; vector<int64_t> A(N); int64_t sum = 0; for (int64_t i = 0; i < N; ++i) { cin >> A[i]; sum += A[i]; } sort(A.begin(), A.end(), greater<int64_t>()); if (A[M - 1] >= sum / (4 * M)) { cout << "Yes" << endl...
#include <bits/stdc++.h> using namespace std; void Main() { int64_t N, M; cin >> N >> M; vector<int64_t> A(N); double sum = 0; for (int64_t i = 0; i < N; ++i) { cin >> A[i]; sum += A[i]; } sort(A.begin(), A.end(), greater<int64_t>()); if (A[M - 1] >= sum / (4 * M)) { cout << "Yes" << endl;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
137
n,m=map(int,input().split()) a=[int(x) for x in input().split()] b=sorted(a, reverse=True) if b[1] >= sum(a)/(4*m): print('Yes') else: print('No')
n,m=map(int,input().split()) a=[int(x) for x in input().split()] b=sorted(a, reverse=True) if b[m-1] >= sum(a)/(4*m): print('Yes') else: print('No')
[["+", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33]]
5
75
import java.util.ArrayList; import java.util.Comparator; import java.util.List; 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 count = 0; List<Integer> list = new ArrayLis...
import java.util.ArrayList; import java.util.Comparator; import java.util.List; 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 count = 0; List<Integer> list = new ArrayLis...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
224
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s = 0; cin >> n >> m; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; s += a[i]; } sort(a + 1, a + n + 1); if (a[n - m + 1] >= s / (4 * m)) cout << "Yes"; else cout << "No"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; float s = 0; cin >> n >> m; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; s += a[i]; } sort(a + 1, a + n + 1); if (a[n - m + 1] >= s / (4 * m)) cout << "Yes"; else cout << "No"; return 0; }
[["-", 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]]
1
113
#include <bits/stdc++.h> using namespace std; int main() { int N, M, c; int sum = 0; vector<int> a; cin >> N >> M; for (int i = 0; i < N; i++) { cin >> c; a.push_back(c); sum += c; } sort(a.begin(), a.end(), greater<int>()); if (a[M - 1] < sum / (M * 4)) cout << "No" << endl; else ...
#include <bits/stdc++.h> using namespace std; int main() { double N, M, c; double sum = 0; vector<double> a; cin >> N >> M; for (int i = 0; i < N; i++) { cin >> c; a.push_back(c); sum += c; } sort(a.begin(), a.end(), greater<double>()); if (a[M - 1] < sum / (M * 4)) cout << "No" << endl;...
[["-", 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], ["-", 0, 2, 63, 346, 3, 347, 0, 77, 39, 40], ["+", 0, 2, 63, 346, 3, 347, 0, 77, 39, 40]]
1
123
#include <bits/stdc++.h> using namespace std; #define FOR(i, o, n) for (long long i = o; i < n; i++) #define oneforall \ ios::sync_with_stdio(false); \ cin.tie(0); #define all(v) (v).begin(), (v).end() #def...
#include <bits/stdc++.h> using namespace std; #define FOR(i, o, n) for (long long i = o; i < n; i++) #define oneforall \ ios::sync_with_stdio(false); \ cin.tie(0); #define all(v) (v).begin(), (v).end() #def...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
333
n, m = map(int, input().split()) a = list(map(int, input().split())) s = sum(a) cnt = 0 for i in a: if (i * 4 * m) > s: cnt += 1 if cnt >= m: print("Yes") else: print("No")
n, m = map(int, input().split()) a = list(map(int, input().split())) s = sum(a) cnt = 0 for i in a: if (i * 4 * m) >= s: cnt += 1 if cnt >= 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
80
#include <bits/stdc++.h> using namespace std; int main() { int M, N; 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()); if (A.at(M - 1) >= accumulate(A.begin(), A.end(), 0) / (4 * M)) { cout << "Yes" << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int M, N; 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()); if (A.at(M - 1) >= float(accumulate(A.begin(), A.end(), 0)) / float((4 * M))) { cout...
[["+", 15, 339, 51, 16, 12, 16, 31, 2, 63, 40], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 15, 339, 51, 16, 12, 16, 12, 2, 63, 40], ["+", 51, 16, 12, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 16, 12, 2, 3, 4, 0, 23, 0, 25]]
1
142
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int n, m; std::string s; std::vector<int> v; std::cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { int tmp; std::cin >> tmp; sum += tmp; v.push_back(tmp); } std::sort(v.rbegin(), v.rend()...
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int n, m; std::string s; std::vector<int> v; std::cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { int tmp; std::cin >> tmp; sum += tmp; v.push_back(tmp); } std::sort(v.rbegin(), v.rend()...
[["-", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13]]
1
144
#include <bits/stdc++.h> using namespace std; #define int long long #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.ti...
#include <bits/stdc++.h> using namespace std; #define int long long #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.ti...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
217
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int M = scan.nextInt(); int[] A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { A[i] = scan.nextInt();...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int M = scan.nextInt(); int[] A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { A[i] = scan.nextInt();...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 147], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 146], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 146], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 147]]
3
236
#include <bits/stdc++.h> int main() { int n, m; int A[1010]; scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) { scanf("%d", &A[i]); } std::sort(A, A + n); int sum = 0; sum = std::accumulate(A, A + n, sum); // printf("%d", sum); int lower = sum / (4 * m); int i; for (i = 0; i < n; i++) {...
#include <bits/stdc++.h> int main() { int n, m; int A[1010]; scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) { scanf("%d", &A[i]); } std::sort(A, A + n); int sum = 0; sum = std::accumulate(A, A + n, sum); // printf("%d", sum); double lower = (double)sum / (4 * m); int i; for (i = 0; i ...
[["-", 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
168
N, M = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) n = M - 1 K = sum(A) if A[n] < K // (4 *M): print('No') else: print('Yes')
N, M = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) n = M - 1 K = sum(A) if A[n] < K / (4 *M): print('No') else: print('Yes')
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 85]]
5
80
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> int main() { long N, M; std::cin >> N >> M; std::vector<long> A; long sum = 0; for (long i = 0; i < N; i++) { long temp; std::cin >> temp; A.push_ba...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> int main() { long N, M; std::cin >> N >> M; std::vector<long> A; long sum = 0; for (long i = 0; i < N; i++) { long temp; std::cin >> temp; A.push_ba...
[["+", 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], ["+", 15, 339, 51, 16, 12, 16, 12, 74, 0, 24], ["+", 51, 16, 12, 16, 12, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 12, 74, 0, 25]]
1
185
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> goods(n); for (int i = 0; i < n; i++) { cin >> goods.at(i); }; int sum = 0; for (int i = 0; i < n; i++) { sum = sum + goods.at(i); }; sort(goods.begin(), goods.end(), std::greater<int>()); int a ...
#include <bits/stdc++.h> using namespace std; int main() { double n, m; cin >> n >> m; vector<int> goods(n); for (int i = 0; i < n; i++) { cin >> goods.at(i); }; double sum = 0; for (int i = 0; i < n; i++) { sum = sum + goods.at(i); }; sort(goods.begin(), goods.end(), std::greater<int>()); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
162
#include <stdio.h> int main() { int N, M; scanf("%d %d", &N, &M); int A[N], sum = 0; for (int i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } int cnt = 0; for (int i = 0; i < N; i++) { if (sum <= 4 * M * A[i]) { cnt++; } } if (M == cnt) { printf("Yes\n"); } else ...
#include <stdio.h> int main() { int N, M; scanf("%d %d", &N, &M); int A[N], sum = 0; for (int i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } int cnt = 0; for (int i = 0; i < N; i++) { if (sum <= 4 * M * A[i]) { cnt++; } } if (M <= cnt) { printf("Yes\n"); } else ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
141
#include <stdio.h> int main(void) { int i, j, N, M; int all = 0; j = 0; scanf("%d %d", &N, &M); int A[N]; for (i = 0; i <= N - 1; i++) { scanf("%d", &A[i]); all += A[i]; } all = all / (4 * M); for (i = 0; i <= N - 1; i++) { if (A[i] >= all) { j++; } } if (j >= M) { printf...
#include <stdio.h> int main(void) { int i, j, N, M; double all = 0; j = 0; scanf("%d %d", &N, &M); int A[N]; for (i = 0; i <= N - 1; i++) { scanf("%d", &A[i]); all += A[i]; } // printf("all=%f\n",all); all = all / (4 * M); // printf("all=%f\n",all); for (i = 0; i <= N - 1; i++) { if (A...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
0
154
N, M = map(int, input().split()) A = list(map(int, input().split())) zenbu = sum(A) waruno = 4 * M joken = zenbu / waruno ninki = sum( i > joken for i in A) if ninki >= M: print('Yes') else: print('No')
N, M = map(int, input().split()) A = list(map(int, input().split())) zenbu = sum(A) waruno = 4 * M joken = zenbu / waruno ninki = sum( i >= joken for i in A) if ninki >= M: print('Yes') else: print('No')
[["-", 0, 662, 12, 652, 3, 668, 8, 666, 667, 47], ["+", 0, 662, 12, 652, 3, 668, 8, 666, 667, 20]]
5
80
import numpy as np n, m = list(map(int,(input().split()))) a = np.array(list(map(int,(input().split())))) all_b = sum(a) t = 1/(4*m)*all_b #all_t =a*t ans = np.where(a>t) #print(ans) #print(all_b[all_b >t]) #print(all_b,t) #print(len(ans[0])) if len(ans[0]) >= m: print('Yes') else: print('No')
import numpy as np n, m = list(map(int,(input().split()))) a = np.array(list(map(int,(input().split())))) all_b = sum(a) t = 1/(4*m)*all_b #all_t =a*t ans = np.where(a>=t) #print(ans) #print(all_b[all_b >t]) #print(all_b,t) #print(len(ans[0])) if len(ans[0]) >= m: print('Yes') else: print('No')
[["-", 0, 662, 12, 652, 3, 4, 0, 666, 667, 47], ["+", 0, 662, 12, 652, 3, 4, 0, 666, 667, 20]]
5
106
#include <bits/stdc++.h> using namespace std; int main() { int n, m, p; int l = 0; cin >> n >> m; p = m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); l += a.at(i); } for (int i = 0; i < n; i++) { if (a.at(i) > (l + (m * 4) - 1) / (m * 4)) { p--; } if (p == 0)...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, p; int l = 0; cin >> n >> m; p = m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); l += a.at(i); } for (int i = 0; i < n; i++) { if (a.at(i) >= (l + (m * 4) - 1) / (m * 4)) { p--; } if (p == 0...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
152
#include <bits/stdc++.h> using namespace std; int main() { double shurui, ninki; cin >> shurui >> ninki; vector<int> touhyousu(shurui); for (int i = 0; i < shurui; i++) { cin >> touhyousu.at(i); } sort(touhyousu.begin(), touhyousu.end()); double allcount; allcount = 0; for (int i = 0; i < shu...
#include <bits/stdc++.h> using namespace std; int main() { double shurui, ninki; cin >> shurui >> ninki; vector<int> touhyousu(shurui); for (int i = 0; i < shurui; i++) { cin >> touhyousu.at(i); } sort(touhyousu.begin(), touhyousu.end()); double allcount; allcount = 0; for (int i = 0; i < shu...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
162
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); int sum = accumulate(vec.begin(), vec.end(), 0); if (vec.at(n - m - 1) >= sum / (4 * m)) { cout << "Yes" << e...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); double sum = accumulate(vec.begin(), vec.end(), 0); if (vec.at(n - m) >= sum / (4 * m)) { cout << "Yes" << en...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
132
nm = list(map(int,input().split())) A = list(map(int,input().split())) A.sort(reverse=True) s = sum(A) if A[nm[1]-1] > s/4/nm[1]: print("Yes ") else: print("No ")
nm = list(map(int,input().split())) A = list(map(int,input().split())) A.sort(reverse=True) s = sum(A) if A[nm[1]-1] >= s/4/nm[1]: 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
82
#coding: utf-8 A = list(map(int, input().split())) B = list(map(int, input().split())) num = A[0] jud = A[1] all = sum(B) n = 0 C = 0 AN = 0 while n < num-1 : AN = B[n] n += 1 if AN < all / (jud*4): continue else: C += 1 if C >= jud: print("Yes") else: print("No")
#coding: utf-8 A = list(map(int, input().split())) B = list(map(int, input().split())) num = A[0] jud = A[1] all = sum(B) n = 0 C = 0 AN = 0 while n < num : AN = B[n] n += 1 if AN < all / (jud*4): continue else: C += 1 if C >= jud: print("Yes") else: print("No")
[["-", 0, 656, 0, 52, 15, 666, 0, 657, 17, 33], ["-", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612]]
5
114
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int sum = 0; for (int i = 0; i < n; i++) { sum = sum + a[i]; } int p = 0; sort(a, a + n); for (int i = n - 1; i > n - m - 1; i--) { // cout<<a[i]...
#include <bits/stdc++.h> using namespace std; int main() { int n; double m; cin >> n >> m; double a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } double sum = 0; for (int i = 0; i < n; i++) { sum = sum + a[i]; } int p = 0; sort(a, a + n); for (int i = n - 1; i > n - m - 1; 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
160
N, M = map(int, input().split()) A = sorted(map(int, input().split()), reverse=True) # print(A) v_min = sum(A) / (4 * M) # print(v_min) cnt = 0 for item in A: if item > v_min: cnt += 1 else: break if cnt >= M: print('Yes') else: print('No')
N, M = map(int, input().split()) A = sorted(map(int, input().split()), reverse=True) # print(A) v_min = sum(A) / (4 * M) # print(v_min) cnt = 0 for item in A: if item >= v_min: cnt += 1 else: break if cnt >= 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
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define ll...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define ll...
[["+", 15, 339, 51, 16, 12, 16, 12, 2, 63, 40]]
1
246
import numpy as np l_input = [int(e) for e in input().split()] A = [int(e) for e in input().split()] A = np.array(A) N = l_input[0] M = l_input[1] A_dash = A-1/(4*M)*sum(A) cnt = 0 for i in A_dash: if i >0: cnt += 1 if cnt >= M: print('Yes') else: print('No')
import numpy as np l_input = [int(e) for e in input().split()] A = [int(e) for e in input().split()] A = np.array(A) N = l_input[0] M = l_input[1] A_dash = A-1/(4*M)*sum(A) cnt = 0 for i in A_dash: if i >=0: cnt += 1 if cnt >= 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
111
NM = input().split() N = int(NM[0]) M = int(NM[1]) A = [] kosuu = 0 tmp = input().split() for i in range(N): A.append(int(tmp[i])) tmp = sum(A)//4*M for i in A: if i >= tmp: kosuu += 1 if kosuu >= M: print("Yes") else: print("No")
NM = input().split() N = int(NM[0]) M = int(NM[1]) A = [] kosuu = 0 tmp = input().split() for i in range(N): A.append(int(tmp[i])) tmp = sum(A)/(4*M) for i in A: if i >= tmp: kosuu += 1 if kosuu >= M: print("Yes") else: print("No")
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
105
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; float m; cin >> m; int arr[n] = {0}; long long int sum = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } float total_votes1 = 1 / (4 * m); long long int total_votes = total_votes1 * ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; float m; cin >> m; int arr[n] = {0}; long long int sum = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } float total_votes1 = 1 / (4 * m); float total_votes = total_votes1 * sum; ...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
157
a,b = map(int,input().split()) aaa = list(map(int,input().split())) aaa.sort(reverse=True) result = [0]*b for i in range(b): h = aaa[i] j = sum(aaa) / (4*b) if h > j: result[i] = 1 else: result[i] = 0 if result.count(1) >= b: ans = "yes" else: ans = "no" print(ans)
a,b = map(int,input().split()) aaa = list(map(int,input().split())) aaa.sort(reverse=True) result = [0]*b for i in range(b): h = aaa[i] j = sum(aaa) / (4*b) if h >= j: result[i] = 1 else: result[i] = 0 if result.count(1) >= b: ans = "Yes" else: ans = "No" print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["-", 64, 196, 0, 1, 0, 662, 12, 557, 0, 6], ["+", 64, 196, 0, 1, 0, 662, 12, 557, 0, 6], ["-", 8, 196, 0, 1, 0, 662, 12, 557, 0, 6], ["+", 8, 196, 0, 1, 0, 662, 12, 557, 0, 6]]
5
119
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) if a.sort.reverse[m - 1] >= a.reduce(:+) / (4 * m) puts 'Yes' else puts 'No' end
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) if a.sort.reverse[m - 1] >= a.reduce(:+).to_f / (4 * m) puts 'Yes' else puts 'No' end
[["+", 0, 121, 15, 738, 12, 738, 31, 652, 17, 131], ["+", 0, 121, 15, 738, 12, 738, 31, 652, 735, 22]]
4
58
N, M=input().split() A=list(map(int,input().strip().split())) ls=[] for Ai in A: if int(Ai)>(1/(4*int(M)))*sum(A): ls.append(Ai) if len(ls)>=int(M): print('Yes') else: print('No')
N, M=input().split() A=list(map(int,input().strip().split())) ls=[] for Ai in A: if int(Ai)>=(1/(4*int(M)))*sum(A): ls.append(Ai) if len(ls)>=int(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
96
#include <bits/stdc++.h> using namespace std; int a[105]; int main() { int m, n, sum = 0, k = 0; cin >> m >> n; for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } for (int i = 0; i < m; i++) { if (a[i] >= 1.0 / 4 / m * sum) k++; } if (k >= n) cout << "Yes" << endl; else ...
#include <bits/stdc++.h> using namespace std; int a[105]; int main() { int m, n, sum = 0, k = 0; cin >> m >> n; for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } for (int i = 0; i < m; i++) { if (a[i] >= 1.0 / 4 / n * sum) k++; } if (k >= n) cout << "Yes" << endl; else ...
[["-", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22]]
1
127
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int A[N]; int num_over = 0; int sum = 0; for (int i = 0; i < N; i++) { cin >> A[i]; sum += A[i]; // num_over++; } for (int i = 0; i < N; i++) { if (sum / (4 * M) <= A[i]) { num_over++; } } ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int A[N]; int num_over = 0; float sum = 0.0; for (int i = 0; i < N; i++) { cin >> A[i]; sum += A[i]; // num_over++; } for (int i = 0; i < N; i++) { // cout << float(sum/(4*M)); if (float(sum / (4 *...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 40], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
1
129
n=input().split() N=int(n[0]) M=int(n[1]) a=input().split() #print(a) a = [int(i) for i in a] b=sum(a)/4*M c=sorted(a)[N-M] if b<=c : print("Yes") else: print("No")
n=input().split() N=int(n[0]) M=int(n[1]) a=input().split() #print(a) a = [int(i) for i in a] b=sum(a)/(4*M) c=sorted(a)[M*-1] if b <= c : print("Yes") else: print("No")
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["-", 0, 1, 0, 662, 12, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 12, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 12, 206, 206, 657, 17, 48], ["-", 0, 1, 0, 662, 12, 206, 206, 657, 12, 22], ["+", 0, 662, 12, 206, 206, 657, 12, ...
5
89
N, M = map(int, input().split()) A = list(map(int, input().split())) total = sum(A) cnt = 0 for i in range(0, N): if A[i] < (total//(4*M)): continue cnt += 1 if cnt >= M: print('Yes') else: print('No')
N, M = map(int, input().split()) A = list(map(int, input().split())) total = sum(A) cnt = 0 for i in range(0, N): if A[i] < (total/(4*M)): continue cnt += 1 if cnt >= 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
91
N, M = input().split() N= int(N) M = int(M) itemList = list(map(int, input().split())) itemList.sort() index = -1 answer = True for i in range(M): if itemList[index] < (N*(1/(4*M))): answer = False break index -= 1 if answer: print("Yes") else: print("No")
N, M = input().split() N= int(N) M = int(M) itemList = list(map(int, input().split())) itemList.sort() index = -1 answer = True for i in range(M): if itemList[index] < (sum(itemList)*(1/(4*M))): answer = False break index -= 1 if answer: print("Yes") else: print("No")
[["-", 0, 57, 15, 666, 0, 23, 0, 657, 31, 22], ["+", 15, 666, 0, 23, 0, 657, 31, 652, 63, 22], ["+", 0, 23, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 0, 23, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 23, 0, 657, 31, 652, 3, 4, 0, 25]]
5
104
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> #define R(i, n) for (int i = 0; i < n; i++) #define S(a) scanf("%d", &a) #define S2(a, b) scanf("%d%d", &a, &b) #define S3(a, b, c) scanf("%d%d%d", &a, &b, &c) #define P(a) pri...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> #define R(i, n) for (int i = 0; i < n; i++) #define S(a) scanf("%d", &a) #define S2(a, b) scanf("%d%d", &a, &b) #define S3(a, b, c) scanf("%d%d%d", &a, &b, &c) #define P(a) pri...
[["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 24], ["+", 15, 339, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 25], ["+", 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
187
import sys def main(argv): n, m = [int(i) for i in sys.stdin.readline().rstrip("\n").split(" ")] a = [int(i) for i in sys.stdin.readline().rstrip("\n").split(" ")] s = sum(a) items = list(filter(lambda i: True if i > s / (4 * m) else False, a)) print("Yes" if len(items) >= m else "No") return ...
import sys def main(argv): n, m = [int(i) for i in sys.stdin.readline().rstrip("\n").split(" ")] a = [int(i) for i in sys.stdin.readline().rstrip("\n").split(" ")] s = sum(a) items = list(filter(lambda i: True if i >= s / (4 * m) else False, a)) print("Yes" if len(items) >= m else "No") return...
[["-", 3, 4, 0, 670, 8, 41, 0, 666, 667, 47], ["+", 3, 4, 0, 670, 8, 41, 0, 666, 667, 20]]
5
143
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double N = sc.nextDouble(); double M = sc.nextDouble(); ArrayList<Double> A = new ArrayList<>();...
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double N = sc.nextDouble(); double M = sc.nextDouble(); ArrayList<Double> A = new ArrayList<>();...
[["-", 15, 15, 0, 91, 439, 23, 0, 16, 17, 47], ["+", 15, 15, 0, 91, 439, 23, 0, 16, 17, 20]]
3
208
// +build ignore package main import ( "bufio" "fmt" "io" "os" "strconv" ) // I/O type Scanner struct { sc *bufio.Scanner } func NewScanner() *Scanner { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Buffer(make([]byte, 1024), int(1e+9)) return &Scanner{sc} } func (s *Scanner) nextStr() str...
// +build ignore package main import ( "bufio" "fmt" "io" "os" "strconv" ) // I/O type Scanner struct { sc *bufio.Scanner } func NewScanner() *Scanner { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Buffer(make([]byte, 1024), int(1e+9)) return &Scanner{sc} } func (s *Scanner) nextStr() str...
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20]]
7
541
function Main(input) { var tmp = input.split("\n"); var NM = tmp[0].split(" "); var MarI = tmp[1].split(" "); var N = NM[0]; var M = NM[1]; function numberorder(a, b) { return b - a } MarI.sort(numberorder); var sum = 0 for (var i = 0; i < MarI.length; i++) { sum = sum + parseInt(MarI[i], 10);...
function Main(input) { var tmp = input.split("\n"); var NM = tmp[0].split(" "); var MarI = tmp[1].split(" "); var N = NM[0]; var M = NM[1]; function numberorder(a, b) { return b - a } MarI.sort(numberorder); var sum = 0 for (var i = 0; i < MarI.length; i++) { sum = sum + parseInt(MarI[i], 10);...
[["-", 0, 1, 0, 2, 3, 3, 0, 557, 0, 491], ["+", 0, 1, 0, 2, 3, 3, 0, 557, 0, 491]]
2
195
#include <bits/stdc++.h> using namespace std; int main() { int N; double M, sum, wariai, kijun; cin >> N >> M; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); sum = 0; for (int j = 0; j < N; j++) { sum = s...
#include <bits/stdc++.h> using namespace std; int main() { int N; double M, sum, wariai, kijun; cin >> N >> M; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); sum = 0; for (int j = 0; j < N; j++) { sum = s...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
177
N, M = gets.chomp.split.map(&:to_i) a = gets.chomp.split.map(&:to_i) all_votes = a.inject(:+) all_votes /= (4 * M) p all_votes counter = 0 a.each do |val| counter += 1 if val >= all_votes end if counter >= M puts "Yes" else puts "No" end
N, M = gets.chomp.split.map(&:to_i) a = gets.chomp.split.map(&:to_i) all_votes = a.inject(:+) all_votes /= (4 * M).to_f # p all_votes counter = 0 a.each do |val| counter += 1 if val >= all_votes end if counter >= M puts "Yes" else puts "No" end
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["+", 36, 36, 0, 493, 0, 755, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 755, 12, 652, 735, 22]]
4
77
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (int)(b); i++) #define FORD(i, a, b) for (int i = a; i > (int)(b); i--) #define PPC(x) __builtin_popcount(x) #define SZ(x) ((int)(x).size()) #define pb push_back #define ALL(x) (x).begin(), (x).end() #define ithBit(m, i) (...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (int)(b); i++) #define FORD(i, a, b) for (int i = a; i > (int)(b); i--) #define PPC(x) __builtin_popcount(x) #define SZ(x) ((int)(x).size()) #define pb push_back #define ALL(x) (x).begin(), (x).end() #define ithBit(m, i) (...
[["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151]]
1
236
#include <iostream> #include <string> using namespace std; int main(void) { // Your code here! int N, M, i, j; int flag; int sumtotalvotes; int vote[256]; std::string str, ans; cin >> N >> M; sumtotalvotes = 0; for (i = 0; i < N; i++) { cin >> vote[i]; sumtotalvotes = sumtotalvotes + vote...
#include <iostream> #include <string> using namespace std; int main(void) { // Your code here! int N, M, i, j; int flag; int sumtotalvotes; int vote[256]; std::string str, ans; cin >> N >> M; sumtotalvotes = 0; for (i = 0; i < N; i++) { cin >> vote[i]; sumtotalvotes = sumtotalvotes + vote...
[["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 24], ["+", 15, 339, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 25], ["-", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13]]
1
201
#include <algorithm> //sort,reverse #include <deque> //double_ended queue #include <iostream> #include <map> //map #include <queue> //queue,priority_queue #include <string> #include <utility> //pair #include <vector> using namespace std; typedef long long LL; typedef pair<LL, LL> P; // Pでpair<-,->を表す。 const LL MA...
#include <algorithm> //sort,reverse #include <deque> //double_ended queue #include <iostream> #include <map> //map #include <queue> //queue,priority_queue #include <string> #include <utility> //pair #include <vector> using namespace std; typedef long long LL; typedef pair<LL, LL> P; // Pでpair<-,->を表す。 const LL MA...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
227
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, m, sum = 0; cin >> n >> m; ll arr[n + 5]; for (ll i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } ll x = ceil((sum / (4.0 * m))); for (ll i = 0; i < n; i++) { if (arr[i] > x) m--; if (m == 0) {...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, m, sum = 0; cin >> n >> m; ll arr[n + 5]; for (ll i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } ll x = ceil((sum / (4.0 * m))); for (ll i = 0; i < n; i++) { if (arr[i] >= x) m--; if (m == 0) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
137
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<int> vote; int sum = 0; int value = 0; int i, counter = 0; for (i = 0; i < n; i++) { cin >> value; vote.push_back(value); sum = sum + value; } sort(vote.begin(), vote.end(), greater<int>())...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<int> vote; int sum = 0; int value = 0; int i, counter = 0; for (i = 0; i < n; i++) { cin >> value; vote.push_back(value); sum = sum + value; } sort(vote.begin(), vote.end(), greater<int>())...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
181
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N, 0); int sum = 0; int sum_4 = 0; for (int i = 0; i < N; i++) { cin >> A[i]; sum = sum + A[i]; // cout << A[i] <<endl; } sort(A.begin(), A.end()); reverse(A.begin(), A.end()); sum_4 =...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N, 0); int sum = 0; float sum_4 = 0; for (int i = 0; i < N; i++) { cin >> A[i]; sum = sum + A[i]; // cout << A[i] <<endl; } // cout << A[M-1] << endl; sort(A.begin(), A.end()); // co...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13]]
1
150
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <vector> int b() { int n, m; std::cin >> n >> m; std::vector<int> vote(n); int sum = 0; for (int i = 0; i < n; i++) { int temp; std::cin >> temp; vote[i] = temp; sum += temp; } std::sort(vote.begin(), ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <vector> int b() { int n, m; std::cin >> n >> m; std::vector<int> vote(n); int sum = 0; for (int i = 0; i < n; i++) { int temp; std::cin >> temp; vote[i] = temp; sum += temp; } std::sort(vote.begin(), ...
[["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 24], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 17, 48], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 25], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68]]
1
188
n,m = (int(i)for i in input().split()) l = [int(i)for i in input().split()] lim = sum(l)//(4*m) cnt=0 for i in range(n): if l[i]>=lim: cnt+=1 if cnt>=m:print("Yes") else:print("No")
n,m = (int(i)for i in input().split()) l = [int(i)for i in input().split()] lim = (sum(l))/(4*m) # ~ print("lim ",lim) cnt=0 for i in range(n): if l[i]>=lim: cnt+=1 # ~ print("cnt = ",cnt) if cnt>=m:print("Yes") else:print("No")
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85]]
5
91
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (long long int i = a; i < b; i++) #define REP(i, n) rep(i, 0, n) int main() { int m, n; cin >> n >> m; vector<int> a(n); REP(i, n) { cin >> a[i]; } int sum = std::accumulate(a.begin(), a.end(), 0); double thr = (double)sum / (4.0 * m); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (long long int i = a; i < b; i++) #define REP(i, n) rep(i, 0, n) int main() { int m, n; cin >> n >> m; vector<int> a(n); REP(i, n) { cin >> a[i]; } int sum = std::accumulate(a.begin(), a.end(), 0); double thr = (double)sum / (4.0 * m); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
161