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 <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; int A[N]; int sum = 0; for (int n = 0; n < N; n++) { cin >> A[n]; sum += A[n]; } sort(A, A + N, greater<int>()); for (int m = 0; m < M; m++) { ...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; int A[N]; double sum = 0; for (int n = 0; n < N; n++) { cin >> A[n]; sum += A[n]; } sort(A, A + N, greater<int>()); for (int m = 0; m < M; m++) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
143
#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() { 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]; // 総投票数 } int cnt = 0; rep(i, n) {...
#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() { 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]; // 総投票数 } int cnt = 0; rep(i, n) {...
[["+", 12, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 12, 2, 63, 40], ["+", 51, 16, 12, 16, 12, 2, 3, 4, 0, 24]]
1
150
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define arep(x, n) for (int x : n) using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a.at(i); int cnt = 0; int sum = 0; arep(x, a) sum += x; arep(x, a) { if (x < sum / (4 * m)) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define arep(x, n) for (int x : n) using namespace std; int main() { double n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a.at(i); double cnt = 0; double sum = 0; arep(x, a) sum += x; arep(x, a) { if (x < sum / (4 * ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
137
#include <stdio.h> int main() { int n, m, i; int sum = 0; int re = 0; scanf("%d %d", &n, &m); int a[n]; for (i = 0; i < n; i++) { scanf("%d", a[i]); sum = sum + a[i]; } for (i = 0; i < n; i++) { if (a[i] * 4 * m >= sum) re++; } if (re >= m) printf("Yes"); else print...
#include <stdio.h> int main() { int n, m, i; int sum = 0; int re = 0; scanf("%d %d", &n, &m); int a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); sum = sum + a[i]; } for (i = 0; i < n; i++) { if (a[i] * 4 * m >= sum) re++; } if (re >= m) printf("Yes"); else prin...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
135
#include <stdio.h> int main(void) { int a[100]; int N, M, i, all = 0; scanf("%d %d", &N, &M); for (i = 0; i < N; i++) { scanf("%d", &a[i]); all += a[i]; } int les = 0; for (i = 0; i < N; i++) { if (a[i] * 4 * M >= all) ; les++; } if (les >= M) { printf("Yes\n"); } else { ...
#include <stdio.h> int main(void) { int a[100]; int N, M, i; double all = 0; scanf("%d %d", &N, &M); for (i = 0; i < N; i++) { scanf("%d", &a[i]); all += a[i]; } int les = 0; for (i = 0; i < N; i++) { if (a[i] * 4 * M >= all) les++; } if (les >= M) { printf("Yes\n"); } else ...
[["-", 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, 7, 8, 9, 0, 57, 64, 1, 0, 35]]
0
141
#include <stdio.h> int main(void) { int n, m, i, count = 0, sum = 0; scanf("%d %d", &n, &m); int c[n]; for (i = 0; i < n; i++) { scanf("%d", &c[i]); sum += c[i]; } for (i = 0; i < n; i++) { if (sum / (4 * m) <= c[i]) count++; } if (m <= count) puts("Yes"); else puts("No"); ...
#include <stdio.h> int main(void) { int n, m, i, count = 0; double sum = 0; scanf("%d %d", &n, &m); int c[n]; for (i = 0; i < n; i++) { scanf("%d", &c[i]); sum += c[i]; } for (i = 0; i < n; i++) { if (sum / (4 * m) <= c[i]) count++; } if (m <= count) puts("Yes"); else puts...
[["-", 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
135
#include <stdio.h> int main(void) { int N, M, i; int A[100]; int cnt = 0; int sum = 0; scanf("%d %d", &N, &M); for (i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } for (i = 0; i < N; i++) { if (A[i] >= sum / (4 * M)) cnt++; } if (cnt >= M) printf("Yes\n"); else ...
#include <stdio.h> int main(void) { int N, M, i; int A[100]; int cnt = 0; double sum = 0; scanf("%d %d", &N, &M); for (i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } for (i = 0; i < N; i++) { if (A[i] >= sum / (4 * M)) cnt++; } if (cnt >= M) printf("Yes\n"); else...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
0
139
#include <stdio.h> int main(void) { int N, M, i; int wa = 0; int line; int select = 0; int a[100]; scanf("%d", &N); scanf("%d", &M); for (i = 0; i < N; i++) scanf("%d", &a[i]); for (i = 0; i < N; i++) wa = wa + a[i]; line = wa / (4 * M); for (i = 0; i < N; i++) { if (a[i] >= line) ...
#include <stdio.h> int main(void) { int N, M, i; int wa = 0; int line; int select = 0; int a[100]; scanf("%d", &N); scanf("%d", &M); for (i = 0; i < N; i++) scanf("%d", &a[i]); for (i = 0; i < N; i++) wa = wa + a[i]; line = (wa * 100) / (4 * M); for (i = 0; i < N; i++) { if (a[i] * 100...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13]]
0
167
#include "stdio.h" int main(void) { int a; int choose; int i; scanf("%d", &a); int syurui[a]; scanf("%d", &choose); for (i = 0; i < a; i++) { scanf("%d", &syurui[i]); } int max = 0; int k = -1; int count = 0; int j; int max1; int b[a]; for (i = 0; i < a; i++) { b[i] = syurui[i];...
#include "stdio.h" int main(void) { int a; int choose; int i; scanf("%d", &a); int syurui[a]; scanf("%d", &choose); for (i = 0; i < a; i++) { scanf("%d", &syurui[i]); } int max = 0; int k = -1; int count = 0; int j; int max1; int b[a]; for (i = 0; i < a; i++) { b[i] = syurui[i];...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
0
260
#include <stdio.h> int main(void) { int N, M, i; int A[100]; int cnt = 0; int sum = 0; scanf("%d %d", &N, &M); for (i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } for (i = 0; i < N; i++) { if (A[i] >= sum / (4 * M)) { cnt++; } } if (cnt >= M) printf("Yes\n"); ...
#include <stdio.h> int main(void) { int N, M, i; int A[100]; int cnt = 0; double sum = 0; scanf("%d %d", &N, &M); for (i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } for (i = 0; i < N; i++) { if (A[i] >= sum / (4 * M)) { cnt++; } } if (cnt >= M) printf("Yes\n"...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
0
141
#include <stdio.h> int main(void) { int n, m, i, sum = 0, t = 0; int s[100]; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { scanf("%d", &s[i]); sum += s[i]; } for (i = 0; i < n; i++) { if (s[i] >= sum / (4 * m)) t++; } if (t >= m) printf("Yes\n"); else printf("No\n");...
#include <stdio.h> int main(void) { int n, m, i, sum = 0, t = 0; int s[100]; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { scanf("%d", &s[i]); sum += s[i]; } for (i = 0; i < n; i++) { if (s[i] >= (double)sum / (4 * m)) t++; } if (t >= m) printf("Yes\n"); else printf(...
[["+", 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
137
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(); double[] item = new double[n]; double sum = 0; for (int i = 0; i < n; i++) { item[i] = sc.nextDouble(); sum += item[i]; ...
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(); double[] item = new double[n]; double sum = 0; for (int i = 0; i < n; i++) { item[i] = sc.nextDouble(); sum += item[i]; ...
[["-", 49, 200, 51, 16, 12, 23, 0, 16, 31, 499], ["+", 49, 200, 51, 16, 12, 23, 0, 16, 31, 499]]
3
181
x = input().split() a = sorted(list(map(int, input().split())), reverse=True) n = int(x[0]) m = int(x[1]) goukei = 0 count = 0 for i in a: goukei += i for i in a: if goukei/(4*m) < i: count += 1 if count >= m: print('Yes') else: print('No')
x = input().split() a = sorted(list(map(int, input().split())), reverse=True) n = int(x[0]) m = int(x[1]) goukei = 0 count = 0 for i in a: goukei += i for i in a: if goukei/(4*m) <= i: count += 1 if count >= 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, 19]]
5
103
N,M = map(int,input().split()) A = list(map(int,input().split())) total = 0 for i in range(N): if i >= (sum(A) / (4 * M)): total = total + 1 if total >= M: print("Yes") else: print('No')
N,M = map(int,input().split()) A = list(map(int,input().split())) total = 0 for i in A: if i >= (sum(A) / (4 * M)): total = total + 1 if total >= M: print("Yes") else: print('No')
[["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]]
5
84
N, M = map(int, input().split()) Li = list(map(int, input().split())) X = int(sum(Li) / (4*M)) Li.sort(reverse = True) if Li[M - 1] >= X: print('Yes') else: print('No')
N, M = map(int, input().split()) Li = list(map(int, input().split())) X = sum(Li) / (4*M) Li.sort(reverse = True) if Li[M - 1] >= X: print("Yes") else: print("No")
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655]]
5
80
#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>; void solve() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; sort(a.rbegin(), a.rend()); int total = 0; rep(i, n) total += a[i]; if (a[m - ...
#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>; void solve() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; sort(a.rbegin(), a.rend()); int total = 0; rep(i, n) total += a[i]; if (a[m - ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
152
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) border = a.reduce(:+) / (4 * m) c = a.count{ |x| x >= border } c >= m ? print('Yes') : print('No')
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) border = (a.reduce(:+) / (4.0 * m)).ceil c = a.count{ |x| x >= border } c >= m ? print('Yes') : print('No')
[["+", 0, 493, 0, 662, 12, 652, 486, 739, 0, 24], ["-", 0, 662, 12, 738, 12, 739, 0, 738, 31, 612], ["+", 486, 739, 0, 738, 12, 739, 0, 738, 31, 531], ["+", 12, 652, 486, 739, 0, 738, 12, 739, 0, 25], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
82
#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); } int sum = 0.0; for (int i = 0; i < n; ++i) { sum += A.at(i); } int count = 0; for (int i = 0; i < n; ++i) { if (A.at(i) >= sum / (4 * m))...
#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); } double sum = 0.0; for (int i = 0; i < n; ++i) { sum += A.at(i); } int count = 0; for (int i = 0; i < n; ++i) { if (A.at(i) >= sum / (4 * ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
151
N,M = map(int,input().split()) mono = list(map(int,input().split())) l =[0] * N for i in range(N): if mono[i] >= sum(mono)/4*M: l[i] = 1 if l.count(1) >= M: print("Yes") else: print("No")
N,M = map(int,input().split()) mono = list(map(int,input().split())) l =[0] * N for i in range(N): if mono[i] >= sum(mono)/(4*M): l[i] = 1 if l.count(1) >= M: print("Yes") else: print("No")
[["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 24], ["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 25]]
5
93
if __name__ == '__main__': n, m = map(int, input().split()) a = [int(i) for i in input().split()] s = sum(a) a = sorted(a)[::-1] if a[m-1] >= (s / (4 * m)): print("yes") else: print("no")
if __name__ == '__main__': n, m = map(int, input().split()) a = [int(i) for i in input().split()] s = sum(a) a = sorted(a)[::-1] if a[m-1] >= (s / (4 * 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
91
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a[109], total = 0, cnt = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; total += a[i]; }; for (int i = 0; i < n; i++) { if (a[i] >= total / (4 * m)) { cnt++; } } cout << (cnt >= m ? "Yes" : "No") << ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a[109], total = 0, cnt = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; total += a[i]; }; for (int i = 0; i < n; i++) { if (a[i] >= (total - 1) / (4 * m) + 1) { cnt++; } } cout << (cnt >= m ? "Yes" :...
[["+", 51, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 16, 12, 16, 31, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
121
N, M = map(int, input().split()) As = list(map(int, input().split())) s = sum(As) bs = [A*4*M < s for A in As] if bs.count(True) >= M: print("Yes") else: print("No")
N, M = map(int, input().split()) As = list(map(int, input().split())) s = sum(As) bs = [not A*4*M < s for A in As] if bs.count(True) >= M: print("Yes") else: print("No")
[["+", 0, 1, 0, 662, 12, 658, 8, 681, 0, 372]]
5
78
#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 count = 0; double sum1 = sum / (4 * m); for (int i = 0; i < n; ++i) { if (a.at(i) >= sum1) count++; ...
#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 count = 0; double sum1 = sum / (4.0 * m); for (int i = 0; i < n; ++i) { if (a.at(i) >= sum1) count++...
[["-", 49, 50, 51, 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, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
147
import sys #import numpy as np import math from fractions import Fraction import itertools input=sys.stdin.readline n,m=map(int,input().split()) a=list(map(int ,input().split())) s=sum(a) s=int(s/(4*m)) c=0 for i in range(n): if a[i]>=s: c+=1 if c>=m: print("Yes") else: print("No")
import sys #import numpy as np import math from fractions import Fraction import itertools input=sys.stdin.readline n,m=map(int,input().split()) a=list(map(int ,input().split())) s=sum(a) s=s/(4*m) c=0 for i in range(n): if a[i]>=s: c+=1 if c>=m: print("Yes") else: print("No")
[["-", 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
110
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m, i, s, cnt; double inf; s = 0; cnt = 0; cin >> n >> m; vector<int> a(n); for (i = 0; i < n; i++) { cin >> a.at(i); s += a.at(i); } inf = s / (4 * m); for (i = 0; i < n; i++) { if (a.at(i) >= inf) cnt++; } ...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m, i, s, cnt; double inf; s = 0; cnt = 0; cin >> n >> m; vector<int> a(n); for (i = 0; i < n; i++) { cin >> a.at(i); s += a.at(i); } inf = s / (4.0 * m); for (i = 0; i < n; i++) { if (a.at(i) >= inf) cnt++; ...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 13]]
1
152
n, m = map(int, input().split()) a = list(map(int, input().split())) count = 0 a.sort(reverse=True) sum_a = sum(a) thresh = sum_a * (1/(4*m)) for i in range(m): if a[i] > thresh: count += 1 else: break if count < m: print("No") else: print('Yes')
n, m = map(int, input().split()) a = list(map(int, input().split())) count = 0 a.sort(reverse=True) sum_a = sum(a) thresh = sum_a * (1/(4*m)) for i in range(m): if a[i] >= thresh: count += 1 else: break if count < m: print("No") else: print('Yes')
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
104
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int M = Integer.parseInt(sc.next()); List<Integer> s = new Arr...
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int M = Integer.parseInt(sc.next()); List<Integer> s = new Arr...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 85], ["-", 15, 15, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 15, 15, 0, 16, 31, 16, 31, 16, 17, 48], ["-", 15, 15, 0, 16, 12, 16, 12, 23, 0, 25], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+...
3
219
// package atcoder; 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(); // System.out.println(M); int A[] = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); ...
// package atcoder; 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(); // System.out.println(M); int A[] = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 511, 0, 512], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 515]]
3
254
N, M = map(int, input().split()) a = list(map(int, input().split())) sums = sum(a) count = 0 for i in a: #print(i, sum) if i > (sums / ( M * 4 )): count += 1 if count >= M: print('Yes') else: print("No")
N, M = map(int, input().split()) a = list(map(int, input().split())) sums = sum(a) count = 0 for i in a: #print(i, sum) if i >= (sums / ( M * 4 )): count += 1 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
83
(a, b)=list(map(int, input().split())) k = list(map(int, input().split())) ksum= sum(k) k.sort(reverse=True) #print(k) p = 'Yes' for i in range(b): #print(i) if k[i] <= ksum/4/b: p = 'No' break print(p)
(a, b)=list(map(int, input().split())) k = list(map(int, input().split())) ksum= sum(k) k.sort(reverse=True) #print(k) p = 'Yes' for i in range(b): #print(i) if k[i] < ksum/4/b: p = 'No' break print(p)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
89
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { double n, m; cin >> n >> m; vector<double> a(n); rep(i, n) cin >> a[i]; int sum = 0; rep(i, n) sum += a[i]; int res = 0; rep(i, n) { if (a[i] / sum >= i / (4 * m)) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { double n, m; cin >> n >> m; vector<double> a(n); rep(i, n) cin >> a[i]; int sum = 0; rep(i, n) sum += a[i]; int res = 0; rep(i, n) { if (a[i] / sum >= 1 / (4 * m)) { ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
139
N, M = map(int, input().split()) A = list(map(int, input().split())) total = sum(A) bodor = total / (4 * M) cnt = 0 for i in A: if i > bodor: 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) bodor = total / (4 * M) cnt = 0 for i in A: if i >= bodor: 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
83
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]; double Asum = 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]; double Asum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
194
import sys def ILI(): return list(map(int, sys.stdin.readline().rstrip().split())) def ISI(): return map(int, sys.stdin.readline().rstrip().split()) n, m = ISI() l = ILI() cnt = 0 s = sum(l) for a in l: if a > s/(4*m): cnt +=1 if cnt<m:print("No") else:print("Yes")
import sys def ILI(): return list(map(int, sys.stdin.readline().rstrip().split())) def ISI(): return map(int, sys.stdin.readline().rstrip().split()) n, m = ISI() l = ILI() cnt = 0 s = sum(l) for a in l: if a >= s/(4*m): cnt +=1 if cnt<m:print("No") else:print("Yes")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
116
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] str = in.readLine().split(" "); String[] a_str = ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] str = in.readLine().split(" "); String[] a_str = ...
[["+", 0, 57, 15, 15, 0, 16, 31, 74, 0, 24], ["+", 15, 15, 0, 16, 31, 74, 39, 511, 0, 512], ["+", 0, 57, 15, 15, 0, 16, 31, 74, 0, 25], ["+", 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]]
3
234
#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() { int n, m, sum = 0; cin >> n >> m; vector<int> a(n); rep(i, n) { cin >> a[i]; sum += a[i]; } sort(a.begin(), a.end(), greater<int>()); if (a[m...
#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() { int n, m, sum = 0; cin >> n >> m; vector<int> a(n); rep(i, n) { cin >> a[i]; sum += a[i]; } sort(a.begin(), a.end(), greater<int>()); if (a[m...
[["+", 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], ["+", 15, 339, 51, 16, 12, 16, 12, 2, 63, 40]]
1
136
#include <iostream> #include <vector> using namespace std; int main() { int n, m, poll = 0, num = 0; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; poll += a[i]; } for (int i = 0; i < n; i++) { if (a[i] * 4 * m > poll) { num++; } } if (m <= num) { ...
#include <iostream> #include <vector> using namespace std; int main() { int n, m, poll = 0, num = 0; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; poll += a[i]; } for (int i = 0; i < n; i++) { if (a[i] * (4 * m) >= poll) { num++; } } if (m <= num) { ...
[["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
136
n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i).sort s=a.inject(&:+) puts (a[0,m].all?{|x| 4*m*x >= s } ? "Yes" : "No")
n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i).sort.reverse s=a.inject(&:+) puts (a[0,m].all?{|x| 4*m*x >= s } ? "Yes" : "No")
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
66
N, M = map(int, input().split()) A = list(map(int, input().split())) total = sum(A) / 4 * M A.sort(reverse = False) if A[M-1] >= total: print('Yes') else: print('No')
N, M = map(int, input().split()) A = list(map(int, input().split())) total = sum(A) / (4 * M) A.sort(reverse = True) if A[M-1] >= total: 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, 652, 3, 4, 0, 653, 51, 147], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146]]
5
75
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[] a = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); sum += a[i]; } sc.close(...
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[] a = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); sum += a[i]; } sc.close(...
[["+", 0, 16, 12, 16, 31, 74, 39, 511, 0, 512], ["+", 15, 15, 0, 16, 12, 16, 31, 74, 0, 25], ["-", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
3
181
import java.util.*; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); int M = stdIn.nextInt(); int[] A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { A[i] = stdIn.nextInt(); sum += A[i]; } ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); int M = stdIn.nextInt(); int[] A = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { A[i] = stdIn.nextInt(); sum += A[i]; } ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
189
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; int sum = 0; rep(i, n) sum += a[i]; float toku = sum / (m * 4); int count = 0; rep(i, n) { if (a[i] >= toku) { count++...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; int sum = 0; rep(i, n) sum += a[i]; float toku = (float)sum / (m * 4); int count = 0; rep(i, n) { if (a[i] >= toku) { ...
[["+", 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
137
N,M=map(int, input().split()) A=list(map(int,input().split())) C=sum(A)*1/(4*M) count=0 for i in A: if i>C: count+=1 if count>=M: print('Yes') else: print('No')
N,M=map(int, input().split()) A=list(map(int,input().split())) C=sum(A)/(4*M) count=0 for i in A: if i>=C: count+=1 if count>=M: print('Yes') else: print('No')
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
82
N, M = map(int, input().split()) A = list(map(int, input().split())) S = (sum(A)*1.0) / (4 * M) count = 0 for i in A: count += 1 if i >= S else 0 print('Yes' if count > M else 'No')
N, M = map(int, input().split()) A = list(map(int, input().split())) S = (sum(A)*1.0) / (4 * M) count = 0 for i in A: count += 1 if i >= S else 0 print('Yes' if count >= M else 'No')
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20]]
5
80
#include <bits/stdc++.h> #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define all(a) (a).begin(), (a).end() using namespace std; using ll = long long; using ...
#include <bits/stdc++.h> #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define all(a) (a).begin(), (a).end() using namespace std; using ll = long long; using ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
213
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #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() { ll n, m; cin >> n >> m; vector<ll> a(n); ll sum = 0; rep(i, n) { cin >> a.at(i); sum += a.at(i); } long double kijun =...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #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() { long double n, m; cin >> n >> m; vector<ll> a(n); long double sum = 0; rep(i, n) { cin >> a.at(i); sum += a.at(i); } l...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40]]
1
162
import sys input = sys.stdin.readline N, M = map(int, input().rstrip().split()) votes = list(map(int, input().rstrip().split())) ans = [] for i in range(len(votes)): if votes[i] > sum(votes) / (4*M): ans.append(votes[i]) if len(ans) >= M: print('Yes') else: print('No')
import sys input = sys.stdin.readline N, M = map(int, input().rstrip().split()) votes = list(map(int, input().rstrip().split())) ans = [] for i in range(len(votes)): if votes[i] >= sum(votes) / (4*M): ans.append(votes[i]) if len(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
113
import numpy as np n,m = map(int,input().split()) a = list(map(int,input().split())) s = sum(a) x = s*(1/(4*m)) aa = np.array(a) if np.count_nonzero(aa >x) >= m: print("Yes") else: print("No")
import numpy as np n,m = map(int,input().split()) a = list(map(int,input().split())) s = sum(a) x = s*(1/(4*m)) aa = np.array(a) if np.count_nonzero(aa >=x) >= m: print("Yes") else: print("No")
[["-", 15, 666, 0, 652, 3, 4, 0, 666, 667, 47], ["+", 15, 666, 0, 652, 3, 4, 0, 666, 667, 20]]
5
90
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); boolean result = false; int items = scan.nextInt(); int popItems = scan.nextInt(); int[] votes = new int[items]; int count = 0; for (int i = 0; i < items; i++) { ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); boolean result = false; int items = scan.nextInt(); int popItems = scan.nextInt(); int[] votes = new int[items]; int count = 0; for (int i = 0; i < items; i++) { ...
[["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 48], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 8, 196, 0, 7, 15, 16, 12, 509, 500, 22], ["+", 8, 196, 0, 7, 15, 16, 12, 509, 0, 131], ["+", 8, 196, 0, 7, 15, 16, 12, 509, 119, 22]]
3
214
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline n, m = map(int, input().split()) a = list(map(int, input().split())) limit = sum(a) / (4 * m) count = 0 for i in range(n): if a[i] > limit: count += 1 if count >= m: print('Yes') ...
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline n, m = map(int, input().split()) a = list(map(int, input().split())) limit = sum(a) / (4 * m) count = 0 for i in range(n): if a[i] >= limit: count += 1 if count >= m: print('Yes')...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
118
from fractions import Fraction N,M = map(int,input().split()) A = list(map(int,input().split())) ans = 0 for i in range(N): if A[i] > sum(A)*Fraction(1,4*M): ans += 1 if ans >= M: print('Yes') else: print('No')
from fractions import Fraction N,M = map(int,input().split()) A = list(map(int,input().split())) ans = 0 for i in range(N): if A[i] >= sum(A)*Fraction(1,4*M): ans += 1 else: continue 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], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 116, 0, 117]]
5
90
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i))#.sort!.reverse! # if <= products.sum / (4 * m) products_vote_sum = products_vote.sum count = 0 #puts n, m border = products_vote_sum * (1.0 / (4.0 * m)) #puts border (0..n-1).each { |product| if border < products_vote[product] count += 1 ...
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i)).sort.reverse products_vote_sum = products_vote.sum count = 0 border = products_vote_sum * (1.0 / (4.0 * m)) (0..n-1).each { |product| if border <= products_vote[product] count += 1 end # print border, " ",products_vote[product],"\n" } if...
[["+", 0, 493, 0, 662, 12, 652, 486, 652, 17, 131], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["-", 196, 196, 8, 734, 0, 121, 15, 738, 17, 18], ["+", 196, 196, 8, 734, 0, 121, 15, 738, 17, 19]]
4
90
<?php list($N, $M) = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $A = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $target = array_sum($A) / (4 * $M); $is_popular = 0; foreach ($A as $a) { if ($a > $target) { $is_popular += 1; } i...
<?php list($N, $M) = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $A = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $target = array_sum($A) / (4 * $M); $is_popular = 0; foreach ($A as $a) { if ($a >= $target) { $is_popular += 1; } ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
6
141
N, M = map(int,input().split()) l = list(map(int,input().split())) T = sum(l) V = 1/(4*M) * T S = len(list(filter(lambda x: x>=V, l))) > 0 print( "Yes" if S >= M else "No" )
N, M = map(int,input().split()) l = list(map(int,input().split())) T = sum(l) V = 1/(4*M) * T S = len(list(filter(lambda x: x>=V, l)) ) print( "Yes" if S >= M else "No" )
[["-", 0, 656, 0, 1, 0, 662, 12, 666, 667, 47], ["-", 0, 656, 0, 1, 0, 662, 12, 666, 0, 612]]
5
85
#include <bits/stdc++.h> #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define int long long using namespace std; int32_t main() { fio; int n, m; cin >> n >> m; int *a = new int...
#include <bits/stdc++.h> #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define int long long using namespace std; int32_t main() { fio; int n, m; cin >> n >> m; int *a = new int...
[["-", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 31, 13]]
1
148
#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(void) { // Your code here! int n, m; cin >> n >> m; int count = 0; vector<int> A(n); rep(i, n) { cin >> A[i]; count += A[i]; } int sum = 0; r...
#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(void) { // Your code here! int n, m; cin >> n >> m; int count = 0; vector<int> A(n); rep(i, n) { cin >> A[i]; count += A[i]; } int sum = 0; r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
139
n, m = list(map(int, input().split())) a = list(map(int, input().split())) c = 0 for i in range(len(a)): if a[i] >= sum(a) / 4 * m: c += 1 if c >= m: print('Yes') else: print('No')
n, m = list(map(int, input().split())) a = list(map(int, input().split())) c = 0 for i in range(len(a)): if a[i] >= sum(a) / (4 * m): c += 1 if c >= m: print('Yes') else: print('No')
[["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 24], ["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 25]]
5
87
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> V(N); for (int i = 0; i < N; i++) cin >> V.at(i); sort(V.begin(), V.end()); reverse(V.begin(), V.end()); int sum = 0; for (int j = 0; j < N; j++) sum += V.at(j); if (V.at(M - 1) >= sum / (4 * M))...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> V(N); for (int i = 0; i < N; i++) cin >> V.at(i); sort(V.begin(), V.end()); reverse(V.begin(), V.end()); double sum = 0; for (int j = 0; j < N; j++) sum += V.at(j); if (V.at(M - 1) >= sum / (4 * ...
[["-", 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())) m = 0 for a in A: if a>=1/(4*M): m += 1 print('Yes' if m>=M else 'No')
N, M = map(int, input().split()) A = list(map(int, input().split())) m = 0 for a in A: if a>=sum(A)/(4*M): m += 1 print('Yes' if m>=M else '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
69
#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(), greater<int>()); int A_sum = accumulate(A.begin(), A.end(), 0); double line = (A_sum / (4 * M)); for (int i = 0; i < M; ...
#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(), greater<int>()); int A_sum = accumulate(A.begin(), A.end(), 0); double line = (A_sum / (4.0 * M)); for (int i = 0; i < M...
[["-", 51, 23, 0, 16, 12, 23, 0, 16, 31, 13], ["+", 51, 23, 0, 16, 12, 23, 0, 16, 31, 13]]
1
160
#include <bits/stdc++.h> using namespace std; int main() { double N, M; cin >> N >> M; vector<int> A(N); double sum = 0; for (int i = 0; i < N; i++) { cin >> A.at(i); sum += A.at(i); } int cnt = 0; for (int i = 0; i < N; i++) { if ((1 / (4 * M) < (A.at(i) / sum))) cnt++; } if (cnt...
#include <bits/stdc++.h> using namespace std; int main() { double N, M; cin >> N >> M; vector<int> A(N); double sum = 0; for (int i = 0; i < N; i++) { cin >> A.at(i); sum += A.at(i); } int cnt = 0; for (int i = 0; i < N; i++) { if ((1 / (4 * M) <= (A.at(i) / sum))) cnt++; } if (cn...
[["-", 0, 57, 15, 339, 51, 23, 0, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 23, 0, 16, 17, 19]]
1
137
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, m; cin >> n >> m; ll a[n], sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } ll save = sum / (4 * m); int c = 0; for (int i = 0; i < n; i++) { if (a[i] >= save) c++; } if (c >= ...
#include <bits/stdc++.h> using namespace std; #define ll double int main() { int n, m; cin >> n >> m; ll a[n], sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } double save = (sum / (4 * m)); int c = 0; for (int i = 0; i < n; i++) { if (a[i] >= save) c++; } if (c...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 23, 0, 24], ["+", 49, 50, 51, 23, 0, 16, 12, 23, 0, 25]]
1
134
m,n=map(int,input().split()) a=list(map(int,input().split())) b=sum(a)/(4*n) cnt=0 for i in a: if i-b>0: cnt+=1 if cnt>=n: print("Yes") else: print("No")
m,n=map(int,input().split()) a=list(map(int,input().split())) b=sum(a)/(4*n) cnt=0 for i in a: if i-b>=0: cnt+=1 if cnt>=n: 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
82
#include <iostream> using namespace std; typedef long long ll; ll a[200010], dp1[200010][2], dp2[200010][2]; int main() { int i, n; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; dp1[0][0] = dp1[0][1] = 0; dp2[n][0] = dp2[n][1] = 0; for (i = 2; i <= n; i += 2) { dp1[i][0] = dp1[i - 2][0] + a[i - 2]...
#include <iostream> using namespace std; typedef long long ll; ll a[200010], dp1[200010][2], dp2[200010][2]; int main() { int i, n; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; dp1[0][0] = dp1[0][1] = 0; dp2[n][0] = dp2[n][1] = 0; for (i = 2; i <= n; i += 2) { dp1[i][0] = dp1[i - 2][0] + a[i - 2]...
[["-", 31, 2, 3, 4, 0, 69, 28, 69, 28, 22], ["+", 31, 2, 3, 4, 0, 69, 28, 69, 28, 22]]
1
374
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n - 1; i >= 0; i--) const int N = 2e5; int main() { int n; cin >> n; int a[n]; rep(i, n) scanf("%d", &a[i]); if (n % 2 == 0) { ll dp[n]; dp[0] = a[0]; d...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n - 1; i >= 0; i--) const int N = 2e5; int main() { int n; cin >> n; int a[n]; rep(i, n) scanf("%d", &a[i]); if (n % 2 == 0) { ll dp[n]; dp[0] = a[0]; d...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13]]
1
411
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(false), cin.tie(0) #define debug(a) cout << #a ": " << a << endl using namespace std; typedef long long ll; const int N = 2e5 + 7; int a[N], dp[N][2]; int main(void) { IOS; int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; dp[2][0] = a[1],...
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(false), cin.tie(0) #define debug(a) cout << #a ": " << a << endl using namespace std; typedef long long ll; const int N = 2e5 + 7; ll a[N], dp[N][2]; int main(void) { IOS; int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; dp[2][0] = a[1], ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]]
1
327
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; const int N = 2e5 + 5; const int M = 1e9 + 7; #define pi acos(-1) #define INF 1e10 #define INM INT_MIN #define pb(a) push_back(a) #define mk(a, b) make_pair(a, b) #define dbg(x) cout << "now this num is " << x << endl; #defi...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; const int N = 2e5 + 5; const int M = 1e9 + 7; #define pi acos(-1) #define INF 1e10 #define INM INT_MIN #define pb(a) push_back(a) #define mk(a, b) make_pair(a, b) #define dbg(x) cout << "now this num is " << x << endl; #defi...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
476
#include <bits/stdc++.h> using namespace std; const int64_t INF = 1LL << 60; template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int64_t> A(N); for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; const int64_t INF = 1LL << 60; template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int64_t> A(N); for (int i = 0; ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
273
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 206, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 73]]
5
352
#include <algorithm> #include <iostream> #include <random> #include <string> #include <unordered_set> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef unsigned long long ull; using namespace std; #define vll vector<vector<long long>> #define vl vector<long long> #define vi vector<int> #define...
#include <algorithm> #include <iostream> #include <random> #include <string> #include <unordered_set> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef unsigned long long ull; using namespace std; #define vll vector<vector<long long>> #define vl vector<long long> #define vi vector<int> #define...
[["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 85], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
1,247
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <ostream> #...
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <ostream> #...
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
1
917
/* #region Head */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair<ll, ll>; template <class T> using vc = vector<T>; template <class T> using vvc = vc<vc<T>>; using vll = vc<ll>; using vvll = vvc<ll>; using vld = vc<ld>; usin...
/* #region Head */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair<ll, ll>; template <class T> using vc = vector<T>; template <class T> using vvc = vc<vc<T>>; using vll = vc<ll>; using vvll = vvc<ll>; using vld = vc<ld>; usin...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13]]
1
1,556
#include <bits/stdc++.h> using namespace std; const int mn = 4e5 + 6; long long d[mn], f[mn][2]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%lld", &d[i]); f[1][1] = -1e18; for (int i = 2; i <= n; ++i) { f[i][1] = max(f[i - 2][1], f[i - 2][0]) + d[i]; f[i][0] = f[i -...
#include <bits/stdc++.h> using namespace std; const int mn = 4e5 + 6; long long d[mn], f[mn][2]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%lld", &d[i]); f[1][1] = -1e18; for (int i = 2; i <= n; ++i) { f[i][1] = max(f[i - 2][1], f[i - 2][0]) + d[i]; f[i][0] = f[i -...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
241
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; ll INF = 1e15; vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i]; vector<vector<ll>> dp(2, vector<ll>(2, -INF)); dp[0][0] = 0; dp[1][1] = A[0]; for...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; ll INF = 1e15; vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i]; vector<vector<ll>> dp(2, vector<ll>(2, -INF)); dp[0][0] = 0; dp[1][1] = A[0]; for...
[["-", 12, 16, 31, 69, 28, 69, 341, 342, 0, 13], ["+", 12, 16, 31, 69, 28, 69, 341, 342, 0, 13]]
1
464
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); } if (N % 2 == 0) { // long tmp_1 = 0L; // long tmp_2 = 0L; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); } if (N % 2 == 0) { // long tmp_1 = 0L; // long tmp_2 = 0L; ...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499]]
3
738
#include <bits/stdc++.h> using namespace std; #include "string" #define endl '\n' #define pi pair<int, int> #define ff first #define ss second #define int long long #define boost \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #include "string" #define endl '\n' #define pi pair<int, int> #define ff first #define ss second #define int long long #define boost \ ios_base::sync_with_stdio(false); ...
[["-", 0, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
292
# coding: utf-8 import sys from functools import lru_cache sys.setrecursionlimit(10 ** 9) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = lr() # 奇数の時と偶数の時、奇数の場合は真ん中を選ぶかどうか INF = 10 ** 17 @lru_cache(None) def F(index, n): if index >= N: ...
# coding: utf-8 import sys from functools import lru_cache sys.setrecursionlimit(10 ** 9) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = lr() # 奇数の時と偶数の時、奇数の場合は真ん中を選ぶかどうか INF = 10 ** 17 @lru_cache(None) def F(index, n): if index >= N: ...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
174
n=int(input()) a=list(map(int,input().split())) if n%2==1: dp=[[0 for j in range(3)] for i in range(n//2)] dp[0][0]=a[0] dp[0][1]=a[1] dp[0][2]=a[2] for i in range(n//2-1): dp[i+1][0]=(dp[i][0]+a[2*(i+1)]) dp[i+1][1]=max(dp[i][0],dp[i][1])+a[2*(i+1)+1] dp[i+1][2]=max(dp[i])+a...
n=int(input()) a=list(map(int,input().split())) if n%2==1: dp=[[0 for j in range(3)] for i in range(n//2)] dp[0][0]=a[0] dp[0][1]=a[1] dp[0][2]=a[2] for i in range(n//2-1): dp[i+1][0]=(dp[i][0]+a[2*(i+1)]) dp[i+1][1]=max(dp[i][0],dp[i][1])+a[2*(i+1)+1] dp[i+1][2]=max(dp[i])+a...
[["-", 206, 657, 31, 657, 12, 23, 0, 657, 12, 612], ["+", 206, 657, 31, 657, 12, 23, 0, 657, 12, 612]]
5
364
#include <iostream> using namespace std; #include <vector> #define int long long int #define mod 1000000007 int function(int arr[], int initial, int final, int curr, int memo[][3]) { if (initial > final) return 0; if (memo[initial][curr] != -1) { return memo[initial][curr]; } else { if (curr == 0) { ...
#include <iostream> using namespace std; #include <vector> #define int long long int #define mod 1000000007 int function(int arr[], int initial, int final, int curr, int memo[][3]) { if (initial > final) return 0; if (memo[initial][curr] != -1) { return memo[initial][curr]; } else { if (curr == 0) { ...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13]]
1
607
#pragma GCC optimize("Ofast", "unroll-loops") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main() { int N; cin >> N; int n = N / 2; vector<ll> A(N); for (int i = 0; i < N; ++i) cin >> A[i]; vector<ll> acc(N + 1, 0); acc[1] = A[0]; for (int i = 2; ...
#pragma GCC optimize("Ofast", "unroll-loops") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main() { int N; cin >> N; int n = N / 2; vector<ll> A(N); for (int i = 0; i < N; ++i) cin >> A[i]; vector<ll> acc(N + 1, 0); acc[1] = A[0]; for (int i = 2; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
831
import java.io.*; import java.util.*; @SuppressWarnings("unused") public class Main { FastScanner in; PrintWriter out; final static int MOD = (int)1e9 + 7; final static long INF = Long.MAX_VALUE / 2; void solve() { int N = in.nextInt(); long[] A = in.nextLongArray1Index(N); long d = (long)1e9; ...
import java.io.*; import java.util.*; @SuppressWarnings("unused") public class Main { FastScanner in; PrintWriter out; final static int MOD = (int)1e9 + 7; final static long INF = Long.MAX_VALUE / 2; void solve() { int N = in.nextInt(); long[] A = in.nextLongArray1Index(N); long d = (long)1e9; ...
[["+", 8, 498, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 0, 195, 8, 196, 0, 57, 15, 15, 0, 24], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 57, 15, 15, 0, 25]]
3
1,712
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cout << setprecision(10) << fixed; int n; cin >> n; vector<long long> a(n + 1), dp(n + 1, 0), pre(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> a[i]; } pre[1] = a[1]; for (int i = 2; i <= n; ++i) { pre[i] =...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cout << setprecision(10) << fixed; int n; cin >> n; vector<long long> a(n + 1), dp(n + 1, 0), pre(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> a[i]; } pre[1] = a[1]; for (int i = 2; i <= n; ++i) { pre[i] =...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
229
#include <algorithm> #include <bitset> #include <ciso646> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #incl...
#include <algorithm> #include <bitset> #include <ciso646> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #incl...
[["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 13], ["+", 3, 4, 0, 69, 28, 69, 341, 342, 0, 13]]
1
555
#include <algorithm> #include <iostream> using namespace std; int N; long A[2 << 17]; long dp[2 << 17][3]; main() { cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i <= N; i++) for (int j = 0; j < 3; j++) dp[i][j] = -9e18; dp[0][0] = 0; for (int i = 0; i < N; i++) for (int...
#include <algorithm> #include <iostream> using namespace std; int N; long A[2 << 17]; long dp[2 << 17][3]; main() { cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i <= N; i++) for (int j = 0; j < 3; j++) dp[i][j] = -9e18; dp[0][0] = 0; for (int i = 0; i < N; i++) for (int...
[["-", 341, 342, 0, 16, 12, 23, 0, 16, 17, 47], ["+", 341, 342, 0, 16, 12, 23, 0, 16, 17, 60]]
1
273
// >>> TEMPLATES #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using i32 = int32_t; using i64 = int64_t; #define int ll #define double ld #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define repR(i, n) for (int ...
// >>> TEMPLATES #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using i32 = int32_t; using i64 = int64_t; #define int ll #define double ld #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define repR(i, n) for (int ...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 37, 0, 91, 17, 33], ["+", 8, 9, 0, 57, 64, 37, 0, 91, 28, 22]]
1
1,301
N = int(input()) aa = list(map(int, input().split())) if N % 2 == 0: dp = [[[0, 0] for j in range(2)] for i in range(N)] for i, a in enumerate(aa): dp[i][0][1] = dp[i - 1][0][0] + a dp[i][0][0] = dp[i - 1][0][1] dp[i][1][0] = max(dp[i - 1][1][1], dp[i - 1][0][0]) dp[i][1][1] ...
N = int(input()) aa = list(map(int, input().split())) if N % 2 == 0: dp = [[[0, 0] for j in range(2)] for i in range(N)] for i, a in enumerate(aa): dp[i][0][1] = dp[i - 1][0][0] + a dp[i][0][0] = dp[i - 1][0][1] dp[i][1][0] = max(dp[i - 1][1][1], dp[i - 1][0][0]) dp[i][1][1] ...
[["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 3, 4, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 3, 4, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 206, 0, 73]]
5
450
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
637
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; ll a[N], dp[N], sum[N]; int main() { int n; scanf("%d", &n); for (int i = 1, x; i <= n; i++) { scanf("%d", &a[i]); sum[i] = (i > 2 ? sum[i - 2] : 0) + a[i]; } for (int i = 2; i <= n; i++) { if (i & 1) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; ll a[N], dp[N], sum[N]; int main() { int n; scanf("%d", &n); for (int i = 1, x; i <= n; i++) { scanf("%lld", &a[i]); sum[i] = (i > 2 ? sum[i - 2] : 0) + a[i]; } for (int i = 2; i <= n; i++) { if (i & 1) ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
203
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 5; int a[N]; LL f[N][3]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", a + i); for (int i = 0; i <= n; i++) f[i][0] = f[i][1] = f[i][2] = -1e18; f[1][0] = a[1], f[2][1] = a[2], f[3][...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 5; int a[N]; LL f[N][3]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", a + i); for (int i = 0; i <= n; i++) f[i][0] = f[i][1] = f[i][2] = -1e18; f[1][0] = a[1], f[2][1] = a[2], f[3][...
[["-", 12, 11, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 12, 11, 12, 16, 12, 69, 341, 342, 0, 13]]
1
380
MOD = 10 ** 9 + 7 INF = 10 ** 20 import sys input = sys.stdin.readline sys.setrecursionlimit(100000000) from collections import defaultdict dy = (-1,0,1,0) dx = (0,1,0,-1) def main(): n = int(input()) a = list(map(int,input().split())) dp = [{(i - 1)//2: -INF, (i + 1)//2: -INF} for i in range(n + 1)] ...
MOD = 10 ** 9 + 7 INF = 10 ** 20 import sys input = sys.stdin.readline sys.setrecursionlimit(100000000) from collections import defaultdict dy = (-1,0,1,0) dx = (0,1,0,-1) def main(): n = int(input()) a = list(map(int,input().split())) dp = [{(i - 1)//2: -INF, (i + 1)//2: -INF} for i in range(n + 1)] ...
[["-", 12, 432, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 12, 432, 0, 657, 31, 23, 0, 657, 12, 612]]
5
361
/* ______ _______ /\ |``\ | | / | / \ |__/ |____ |/ | / _ _\ | \ | |\ | / \ | \ |______ | \ Dept. of CSE Comilla University */ #include <bits/stdc++.h> #define pi 2 * acos(0.0) #define ll long long #defin...
/* ______ _______ /\ |``\ | | / | / \ |__/ |____ |/ | / _ _\ | \ | |\ | / \ | \ |______ | \ Dept. of CSE Comilla University */ #include <bits/stdc++.h> #define pi 2 * acos(0.0) #define ll long long #defin...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
240
#include <bits/stdc++.h> using namespace std; int main() { long long sum = 0, m, n, c = 0; cin >> n >> m; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec[i]; sum += vec[i]; } for (int i = 0; i < n; i++) { if ((sum + 4 * m - 1) / 4 * m <= vec[i]) c++; } if (c < m) cout ...
#include <bits/stdc++.h> using namespace std; int main() { long long sum = 0, m, n, c = 0; cin >> n >> m; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec[i]; sum += vec[i]; } for (int i = 0; i < n; i++) { if ((sum + 4 * m - 1) / (4 * m) <= vec[i]) c++; } if (c < m) cou...
[["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 25]]
1
130
n, m = map(int, input().split(" ")) m = int(m) A = list(map(int, input().split(" "))) sum = 0 for i in A: sum += int(i) s = int(sum / 4 / m) ans = 0 for i in A: if int(i) >= s: ans += 1 if ans >= m: print('Yes') else: print('No')
n, m = map(int, input().split(" ")) m = int(m) A = list(map(int, input().split(" "))) sum = 0 for i in A: sum += int(i) s = sum / 4 / m ans = 0 for i in A: if int(i) >= s: ans += 1 if ans >= m: print('Yes') else: print('No')
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
107
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n, m, i, sum = 0; cin >> n >> m; vector<int> a(n); rep(i, n) { cin >> a[i]; sum += a[i]; } int count = 0; int sle = sum / (4 * m); if (sum % (4 * m) == 0) sle++; rep(i, n) i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n, m, i, sum = 0; cin >> n >> m; vector<int> a(n); rep(i, n) { cin >> a[i]; sum += a[i]; } int count = 0; int sle = sum / (4 * m); if (sum % (4 * m) != 0) sle++; rep(i, n) i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
146
n,p = map(int,input().split(" ")) l = input().split(" ") s = 0 for i in l: m = int(i) s = s + m t = m/4*p c = 0 for i in l: m = int(i) if m > t: c = c + 1 if c >= p: print("Yes") else: print("No")
n,p = map(int,input().split(" ")) l = input().split(" ") s = 0 for i in l: m = int(i) s = s + m q = s/(4*p) c = 0 for i in l: m = int(i) if m >= q: c = c + 1 if c >= p: print("Yes") else: print("No")
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ...
5
100
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main(int argc, char const *argv[]) { int n, m; cin >> n >> m; vector<int> v; int sum = 0; rep(i, n) { int tmp; cin >> tmp; v.push_back(tmp); sum += tmp; } in...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main(int argc, char const *argv[]) { double n, m; cin >> n >> m; vector<double> v; double sum = 0; rep(i, n) { int tmp; cin >> tmp; v.push_back(tmp); sum += tmp;...
[["-", 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
159
#include <bits/stdc++.h> #define ll long long 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 o = sum / (4 * m); int count = 0; sort(a, a + n); reverse(a, a + n); for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> #define ll long long 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]; } double o = double(sum) / (4 * m); int count = 0; sort(a, a + n); reverse(a, a + n); for (int 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, 2, 63, 40], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 25]]
1
159
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right n,m=map(int,stdin.readline().split()) a=list(map(int,stdin.readline().split())) s=sum(a) ans=0 for i in a: if(i<(s/(4*m))): continue ans+=1 if(ans>=m): print(...
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right n,m=map(int,stdin.readline().split()) a=list(map(int,stdin.readline().split())) s=sum(a) ans=0 for i in a: if(i<(s/(4*m))): continue ans+=1 if(ans>=m): print(...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
113
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m, a[100]; cin >> n >> m; int popu = 0, sum_a = 0; rep(i, n) { int A; cin >> A; a[i] = A; sum_a += a[i]; } rep(i, n) { if (a[i] >= sum_a / (4 * m)...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m, a[100]; cin >> n >> m; int popu = 0; double sum_a = 0; rep(i, n) { int A; cin >> A; a[i] = A; sum_a += a[i]; } rep(i, n) { if (a[i] >= sum_a ...
[["-", 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
135
#include <bits/stdc++.h> using namespace std; int main() { int n, m, c = 0; int sum = 0; cin >> n >> m; int n1[n]; for (int i = 0; i < n; i++) { cin >> n1[i]; sum = sum + n1[i]; } // cout<<sum<<endl; // cout<<sum/(4*m)<<endl; for (int i = 0; i < n; i++) { // cout<<n1[i]<<endl; if (n...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, c = 0; int sum = 0; cin >> n >> m; int n1[n]; for (int i = 0; i < n; i++) { cin >> n1[i]; sum = sum + n1[i]; } // cout<<sum<<endl; // cout<<sum/(4*m)<<endl; for (int i = 0; i < n; i++) { // cout<<n1[i]<<endl; if (n...
[["-", 12, 23, 0, 16, 12, 23, 0, 16, 31, 13], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 31, 13]]
1
135