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 <stdio.h> int main(void) { int n, k; scanf("%d %d", &n, &k); int p[1005]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } int tmp; for (int j = 0; j < n - 1; j++) { for (int i = 0; i < n - j - 1; i++) { if (p[i] > p[i + 1]) { tmp = p[i]; p[i] = p[i + 1]; ...
#include <stdio.h> int main(void) { int n, k; scanf("%d %d", &n, &k); int p[1005]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } int tmp; for (int j = 0; j < n - 1; j++) { for (int i = 0; i < n - j - 1; i++) { if (p[i] > p[i + 1]) { tmp = p[i]; p[i] = p[i + 1]; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
188
#include <stdio.h> int main(void) { int size, reps; scanf("%d", &size); scanf("%d", &reps); int i = 0; int arr[size]; while (i < size) { scanf("%d", &arr[i]); i++; } int sum = 0, min[reps], j = 0, l; printf("\n"); for (i = 0; i < size; i++) { for (l = 0; l < i; l++) { if (arr[i...
#include <stdio.h> int main(void) { int size, reps; scanf("%d", &size); scanf("%d", &reps); int i = 0; int arr[size]; while (i < size) { scanf("%d", &arr[i]); i++; } int sum = 0, min[reps], j = 0, l; printf("\n"); for (i = 0; i < size; i++) { for (l = 0; l < size; l++) { if (ar...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 23, 0, 16, 12, 69, 71, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 69, 71, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 69, 71, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 71, 22], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 64, 9, 0, 1,...
0
194
#include <algorithm> #include <iostream> using namespace std; int main() { int fruits_n, select_n; cin >> fruits_n >> select_n; int fruit[fruits_n]; for (int i = 0; i < fruits_n; i++) cin >> fruit[i]; sort(fruit, fruit + fruits_n); int min = 0; for (int i = 0; i < 3; i++) min += fruit[i]; co...
#include <algorithm> #include <iostream> using namespace std; int main() { int fruits_n, select_n; cin >> fruits_n >> select_n; int fruit[fruits_n]; for (int i = 0; i < fruits_n; i++) cin >> fruit[i]; sort(fruit, fruit + fruits_n); int min = 0; for (int i = 0; i < select_n; i++) { min += fruit...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
93
n, k = map(int, input().split()) p = list(map(int, input().split())) p.sort() x = 0 for i in range(0, k): x = x + p[i] print(p, x)
n, k = map(int, input().split()) p = list(map(int, input().split())) p.sort() x = 0 for i in range(0, k): x = x + p[i] print(x)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21]]
5
65
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; using ld = long double; using lli = long long int; #define PI 3.14159265358979323846264338327950L int main() { int N, K, temp, result = 0; vector<int> price...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; using ld = long double; using lli = long long int; #define PI 3.14159265358979323846264338327950L int main() { int N, K, temp, result = 0; vector<int> price...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 98], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 18], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
147
if __name__ == "__main__": N, K = [int(a) for a in input().split()] P = list(map(int, input().split())) list.sort(P) print(P) ans = sum(P[:K]) print(ans)
if __name__ == "__main__": N, K = [int(a) for a in input().split()] P = list(map(int, input().split())) list.sort(P) ans = sum(P[:K]) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
68
N,K=map(int,input().split()) P=list(map(int,input().split())) P=sorted(P) ans=0 for i in range(K): ans+=P(i) print(ans)
N,K=map(int,input().split()) P=list(map(int,input().split())) P=sorted(P) ans=0 for i in range(K): ans+=P[i] print(ans)
[["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
60
#include <bits/stdc++.h> int main() { int N, K, sum; std::cin >> N >> K; int arr[N]; for (int i = 0; i < K; i++) std::cin >> arr[i]; std::sort(arr, arr + N); sum = 0; for (int i = 0; i < K; i++) sum += arr[i]; std::cout << sum << std::endl; }
#include <bits/stdc++.h> int main() { int N, K, sum; std::cin >> N >> K; int arr[N]; for (int i = 0; i < N; i++) std::cin >> arr[i]; std::sort(arr, arr + N); sum = 0; for (int i = 0; i < K; i++) sum += arr[i]; std::cout << sum << std::endl; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
98
n,k=map(int,input().split()) L=map(int,input().split()) L_2=sorted(L) L_3=L_2[0:k] print(L_3) print(sum(L_3))
n,k=map(int,input().split()) L=map(int,input().split()) L_2=sorted(L) L_3=L_2[0:k] print(sum(L_3))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
55
n, k = map(int, input().split()) p - list(map(int, input().split())) p = sorted(p, key = int) print(sum(p[:2]))
n, k = map(int, input().split()) p = list(map(int,input().split())) p = sorted(p, key = int) print(sum(p[:k]))
[["-", 36, 36, 0, 656, 0, 1, 0, 657, 17, 33], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
54
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> name(3); for (int i = 0; i < N; i++) { cin >> name[i]; } sort(name.begin(), name.end()); int cnt = 0; for (int i = 0; i < K; i++) { cnt += name[i]; } cout << cnt << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> name(N); for (int i = 0; i < N; i++) { cin >> name[i]; } sort(name.begin(), name.end()); int cnt = 0; for (int i = 0; i < K; i++) { cnt += name[i]; } cout << cnt << endl; }
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
104
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n, k, p[1010], i, sum = 0; cin >> n >> k; for (i = 1; i <= n; i++) { ci...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n, k, p[1010], i, sum = 0; cin >> n >> k; for (i = 0; i < n; i++) { cin...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
118
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) def main(): N, K = map(int,input().split()) P = list(map(int,input().split())) P.sort() print(sum(P[0:3])) if __name__ == "__main__": main()
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) def main(): N, K = map(int,input().split()) P = list(map(int,input().split())) P.sort() print(sum(P[0:K])) if __name__ == "__main__": main()
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
82
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, sum = 0; cin >> n >> k; int arr[n] = {}; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); for (int i = 0; i < min(n, 3); i++) { sum += arr[i]; } ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, sum = 0; cin >> n >> k; int arr[n] = {}; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); for (int i = 0; i < min(n, k); i++) { sum += arr[i]; } ...
[["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22]]
1
128
import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int sum = 0; int[] p = new int[n]; for (int i = 0; i < k; i++) { p[i]...
import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int sum = 0; int[] p = new int[n]; for (int i = 0; i < n; i++) { p[i]...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]]
3
151
N, K = map(int, input().split()) P = map(int,input().split()) sum(sorted(P)[:K])
N, K = map(int, input().split()) P = map(int,input().split()) print(sum(sorted(P)[:K]))
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
41
import numpy as np s = list(map(int,input().split())) n=s[0] k=s[1] s = list(map(int, input().split())) s.sort() print(s) s=np.array(s[0:k]) print(np.sum(s))
import numpy as np s = list(map(int,input().split())) n=s[0] k=s[1] s = list(map(int, input().split())) s.sort() s=np.array(s[0:k]) print(np.sum(s))
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
81
N,K = map(int,input().split()) P = list(map(int,input().split())) sum = 0 for i in range(N): sum += sorted(P)[i] print(sum)
N,K = map(int,input().split()) P = list(map(int,input().split())) sum,cnt = 0,0 for i in range(K): sum += sorted(P)[i] print(sum)
[["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 21], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
57
#include <algorithm> #include <iostream> #include <string> #include <vector> #define mod 1000000007 using ll = long long; using namespace std; int main() { int k, n; cin >> k >> n; int ans = 0; vector<int> A(n); for (int i = 0; i < n; i++) { cin >> A[i]; } sort(A.begin(), A.end()); for (int i = 0;...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define mod 1000000007 using ll = long long; using namespace std; int main() { int k, n; cin >> n >> k; int ans = 0; vector<int> A(n); for (int i = 0; i < n; i++) { cin >> A[i]; } sort(A.begin(), A.end()); for (int i = 0;...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
121
n,k=map(int,input().split()) p=list(map(int,input().split())) p=sorted(p) a=0 for i in range(k-1): a+=p[i] print(a)
n,k=map(int,input().split()) p=list(map(int,input().split())) p=sorted(p) a=0 for i in range(k): a+=p[i] print(a)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
62
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> vec(n, 10000000); for (int i = 0; i < n; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); int ans = 0; for (int i = 0; i < n; i++) { ans =...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n, k; cin >> n >> k; vector<int> vec(n, 10000000); for (int i = 0; i < n; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); long long ans = 0; for (int i = 0; i < k; i++)...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
1
116
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Main { public static void main(String[] args) { // code to read values // code to call required method // code to display the result // System.out.println(Math.ceil(2.5)); Scanner ...
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Main { public static void main(String[] args) { // code to read values // code to call required method // code to display the result // System.out.println(Math.ceil(2.5)); Scanner ...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22]]
3
169
N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort() sum = 0 for x in A[0:N]: sum = sum + x print(sum)
N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort() sum = 0 for x in A[0:K]: sum = sum + x print(sum)
[["-", 0, 656, 0, 7, 12, 206, 206, 663, 0, 22], ["+", 0, 656, 0, 7, 12, 206, 206, 663, 0, 22]]
5
60
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll k, n, m; ll i, j; ll ret = 0; cin >> k >> n; vector<int> v(n); for (i = 0; i < k; i++) { cin >> v[i]; } sort(v.begin(), v.end()); for (i = 0; i < n; i++) { ret += v[i]; } cout << ret << endl; ret...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll k, n, m; ll i, j; ll ret = 0; cin >> n >> k; vector<int> v(n); for (i = 0; i < n; i++) { cin >> v[i]; } sort(v.begin(), v.end()); for (i = 0; i < k; i++) { ret += v[i]; } cout << ret << endl; ret...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
117
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long // increase stack size #pragma comment(linker, "/STACK:16777216") ll mxm() { return LLONG_MIN; } template <typename... Args> ll mxm(ll a, Args... args) { return max(a, mxm(args...))...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long // increase stack size #pragma comment(linker, "/STACK:16777216") ll mxm() { return LLONG_MIN; } template <typename... Args> ll mxm(ll a, Args... args) { return max(a, mxm(args...))...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
684
N, K = map(int,input().split()) p = list(map(int,input().split())) p.sort() ls = [] for i in range(K): ls.append(p[i]) print(ls)
N, K = map(int,input().split()) p = list(map(int,input().split())) p.sort() ls = [] for i in range(K): ls.append(p[i]) print(sum(ls))
[["+", 0, 1, 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]]
5
63
N,K = gets.split(" ").map(&:to_i) P = gets.split(" ").map(&:to_i) p = P.sort k = 0 N.times{|i| k = k + p[i] } puts k
N,K = gets.split(" ").map(&:to_i) P = gets.split(" ").map(&:to_i) p = P.sort n = 0 K.times{|i| n = n + p[i] } puts n
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 486, 743], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 486, 743], ["-", 0, 652, 196, 196, 8, 734, 0, 662, 31, 22], ["+", 0, 652, 196, 196, 8, 734, 0, 662, 31, 22], ["-", 196, 196, 8, 734, 0, 66...
4
60
#include <bits/stdc++.h> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> #define endl "\n" #define ll long long #define int long long #define fast \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> #define endl "\n" #define ll long long #define int long long #define fast \ ios_base::sync_with_stdio(false); ...
[["-", 8, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 8, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
204
N,K = map(int, input().split()) P = list(map(int,input().split())) Ans = sorted(P)[0:3:] print(sum(Ans))
N,K = map(int, input().split()) P = list(map(int,input().split())) Ans = sorted(P)[0:K:] print(sum(Ans))
[["-", 0, 1, 0, 662, 12, 206, 206, 663, 0, 612], ["+", 0, 1, 0, 662, 12, 206, 206, 663, 0, 22]]
5
52
n, k = map(int, input().split()) p = [int(e) for e in input().split()] p.sort ans = 0 for i in range(k): ans += p[i] print(ans)
n, k = map(int, input().split()) p = [int(e) for e in input().split()] p.sort() ans = 0 for i in range(k): ans += p[i] print(ans)
[["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
58
#include <stdio.h> int main(void) { int n, k; scanf("%d", &n); scanf("%d", &k); int p[n]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } int min, tmp; for (int i = 0; i < n - 1; i++) { min = p[i]; for (int j = i + 1; j < n; j++) { if (min > p[j]) { min = p[j]; ...
#include <stdio.h> int main(void) { int n, k; scanf("%d", &n); scanf("%d", &k); int p[n]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } int min, tmp; for (int i = 0; i < n - 1; i++) { min = p[i]; tmp = i; for (int j = i + 1; j < n; j++) { if (min > p[j]) { min =...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
196
N,K = map(int,input().split(' ')) P = list(map(int,input().spllit(' '))) if(k==1): print(min(P)) else: res=[] for i in range(K): res[i].append(min(P)) P.remove(min(P)) print(sum(res))
N,K = map(int,input().split(' ')) P = list(map(int,input().split(' '))) if(K==1): print(min(P)) else: res=[] for i in range(K): res.append(min(P)) P.remove(min(P)) print(sum(res))
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["-", 0, 656, 0, 57, 15, 23, 0, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 0, 22], ["-", 0, 1, 0, 652, 63, 319, 500, 206, 0, 70], ["-", 0, 1, 0, 652, 63, 319, 500, 206, 206, 22], ["-", 0, 1, 0, 652, 63, 319, 500, 206, ...
5
95
#include <iomanip> #include <iostream> #include <math.h> using namespace std; int main() { int K, N; int p[1000]; int tmp; long int sum = 0; cin >> K >> N; for (int i = 0; i < N; ++i) { cin >> p[i]; } for (int i = 0; i < N; ++i) { for (int j = 0; j < N - 1; ++j) { if (p[i] > p[i + 1]) ...
#include <iomanip> #include <iostream> #include <math.h> using namespace std; int main() { int K, N; int p[1000]; int tmp; long int sum = 0; cin >> N >> K; for (int i = 0; i < N; ++i) { cin >> p[i]; } for (int i = 0; i < N; ++i) { for (int j = 0; j < N - 1; ++j) { if (p[j] > p[j + 1]) ...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", ...
1
176
a,b=(int(x) for x in input().split()) num_list = list(map(int, input().split())).sort() ans = 0 for i in range(b): ans += num_list[i] print(ans)
a,b=(int(x) for x in input().split()) num_list = list(map(int, input().split())) num_list.sort() ans = 0 for i in range(b): ans += num_list[i] print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22]]
5
62
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int varieties = Integer.parseInt(sc.next()); int buyCount = Integer.parseInt(sc.next()); int[] prices = new int[varieties]; for (int i = 0; i < va...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int varieties = Integer.parseInt(sc.next()); int buyCount = Integer.parseInt(sc.next()); int[] prices = new int[varieties]; for (int i = 0; i < va...
[["-", 8, 196, 0, 1, 0, 492, 500, 509, 119, 22], ["+", 8, 196, 0, 1, 0, 492, 500, 509, 119, 22]]
3
163
n , x = map(int,input().split()) price_list = list(map(int,input().split())) ld = sorted(price_list, reverse=True) sum = 0 for i in range(x): sum += ld[i] print(sum)
n , x = map(int,input().split()) price_list = list(map(int,input().split())) ld = sorted(price_list, reverse=False) sum = 0 for i in range(x): sum += ld[i] print(sum)
[["-", 0, 662, 12, 652, 3, 4, 0, 653, 51, 146], ["+", 0, 662, 12, 652, 3, 4, 0, 653, 51, 147]]
5
64
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N, K; cin >> N >> K; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); int sum = 0; int i = 0; while (i < N) { sum += vec.a...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N, K; cin >> N >> K; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); int sum = 0; int i = 0; while (i < K) { sum += vec.a...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
116
N,K = map(int,input().split()) li = [int(i) for i in input().split()] total = 0 for _ in range(K): total += min(li) li = li.remove(min(li)) print(total)
N,K = map(int,input().split()) li = [int(i) for i in input().split()] total = 0 for _ in range(K): total += min(li) li.remove(min(li)) print(total)
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22]]
5
66
n, k = map(int, input().split()) p = list(map(int, input().split())) ans = 0 p.sort() for i in p[:3]: ans = ans + i print(ans)
n, k = map(int, input().split()) p = list(map(int, input().split())) ans = 0 p.sort() for i in p[:k]: ans = ans + i print(ans)
[["-", 0, 656, 0, 7, 12, 206, 206, 663, 0, 612], ["+", 0, 656, 0, 7, 12, 206, 206, 663, 0, 22]]
5
59
#include <stdio.h> #include <stdlib.h> int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main(void) { int n, k; scanf("%d%d", &n, &k); int p[1001] = {0}; for (int i = 1; i <= n; i++) { scanf("%d", p + i); } qsort(p, n + 1, sizeof(int), compare_int); int sum = 0; f...
#include <stdio.h> #include <stdlib.h> int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main(void) { int n, k; scanf("%d%d", &n, &k); int p[1001] = {0}; for (int i = 0; i < n; i++) { scanf("%d", p + i); } qsort(p, n, sizeof(int), compare_int); int sum = 0; for (i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 11, 12, 69, 71, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 69...
0
155
N,K=map(int,input().split()) price=list(map(int,input().split())) price.sort(reverse=True) price_N=price[:K] j=0 for i in price_K: j+=i print(j)
N,K=map(int,input().split()) price=list(map(int,input().split())) price.sort() price_K=price[:K] j=0 for i in price_K: j+=i print(j)
[["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
63
// // Hiia #include <stdio.h> #include <stdlib.h> //rannsuu, zettaichi(absolute) #include <time.h> // srand((unsigned int) time(0)); #include <math.h> //koudona keisann #include <string.h> //hairetsu #define max(p, q) ((p) > (q) ? (p) : (q)) // yoku wakarannkedo bennrisou #...
// // Hiia #include <stdio.h> #include <stdlib.h> //rannsuu, zettaichi(absolute) #include <time.h> // srand((unsigned int) time(0)); #include <math.h> //koudona keisann #include <string.h> //hairetsu #define max(p, q) ((p) > (q) ? (p) : (q)) // yoku wakarannkedo bennrisou #...
[["+", 0, 7, 15, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
212
a,b = map(int,input().split()) l = map(int,input().split()) l = sorted(l) print(sum(l[:3]))
a,b = map(int,input().split()) l = list(map(int,input().split())) l = sorted(l) print(sum(l[:b]))
[["+", 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, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
47
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 5; int n, k, a[N]; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); long long ans = 0; sort(a + 1, a + 1 + n); for (int i = 1; i <= n; i++) ans += a[i]; printf("%lld\n", ans); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 5; int n, k, a[N]; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); long long ans = 0; sort(a + 1, a + 1 + n); for (int i = 1; i <= k; i++) ans += a[i]; printf("%lld\n", ans); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
125
#n種類からk種類買う n,k = map(int,input().split()) p = list(map(int,input().split())) print(p) #値段を昇順 p.sort() #値段を足す s = 0 for i in range(k): s += p[i] print(s)
#n種類からk種類買う n,k = map(int,input().split()) p = list(map(int,input().split())) #値段を昇順 p.sort() #値段を足す s = 0 for i in range(k): s += p[i] print(s)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
s = input().split() intN = int(s[0]) intK = int(s[1]) inList = list(map(int,input().split())) #print(inList) inList.sort() #print(inList) idx = 0 intCnt = 0 for wInt in inList: if (idx < 3) : intCnt += wInt #print(wInt) #print(intCnt) idx += 1 print(intCnt)
s = input().split() intN = int(s[0]) intK = int(s[1]) inList = list(map(int,input().split())) #print(inList) inList.sort() #print(inList) idx = 0 intCnt = 0 for wInt in inList: if (idx < intK) : intCnt += wInt #print(wInt) #print(intCnt) idx += 1 print(intCnt)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22]]
5
81
N, K=map(int,input().split()) A=map(int,input().split()) AA=list(A) list.sort(AA,reverse=False) print(AA) ans=int(0) for i in range(K): ans += AA[i] print(ans)
N, K=map(int,input().split()) A=map(int,input().split()) AA=list(A) list.sort(AA,reverse=False) ans=int(0) for i in range(K): ans += AA[i] print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
74
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sum = 0; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i <= n - k; i++) { sum = sum + a[i]; } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sum = 0; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < k; i++) { sum = sum + a[i]; } cout << sum << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
101
N, K = list(map(int, input().split())) P = list(map(int, input().split())) P = sorted(P) print(P) P = P[0:K] print(sum(P))
N, K = list(map(int, input().split())) P = list(map(int, input().split())) P = sorted(P) P = P[0:K] print(sum(P))
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
61
N, K = list(map(int, input().split())) p = list(map(int, input().split())) p = sorted(p) print(sum(p[:N]))
N, K = list(map(int, input().split())) p = list(map(int, input().split())) p = sorted(p) print(sum(p[:K]))
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
53
N, K = map(int, input().split()) P = list(map(int, input().split())) print(sum(P[:K]))
N, K = map(int, input().split()) P = list(map(int, input().split())) P.sort() print(sum(P[:K]))
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
44
#include <algorithm> #include <cmath> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> #define fo(i, n) for (int i = 0; i < n; i++) #define fo1(i, n) for (int i = 1; i <= n; i++) #define ll long long ...
#include <algorithm> #include <cmath> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> #define fo(i, n) for (int i = 0; i < n; i++) #define fo1(i, n) for (int i = 1; i <= n; i++) #define ll long long ...
[["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
151
#!/usr/bin/env python """AtCoder Beginner Contest 171: B - Mix Juice https://atcoder.jp/contests/abc17/tasks/abc171_b """ def main(): N, K = list(map(int, input().split())) Ps = list(map(int, input().split())) ans = 0 Ps.sort() for p in Ps[0:3]: ans += p print(ans) if __name__ == '_...
#!/usr/bin/env python """AtCoder Beginner Contest 171: B - Mix Juice https://atcoder.jp/contests/abc17/tasks/abc171_b """ def main(): N, K = list(map(int, input().split())) Ps = list(map(int, input().split())) ans = 0 Ps.sort() for p in Ps[0:K]: ans += p print(ans) if __name__ == '_...
[["-", 8, 196, 0, 7, 12, 206, 206, 663, 0, 612], ["+", 8, 196, 0, 7, 12, 206, 206, 663, 0, 22]]
5
80
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int x, y, sum; cin >> x >> y; vector<int> vec(114514); for (int i = 0; i < x; i++) { cin >> vec.at(i); } sort...
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int x, y; int sum = 0; cin >> x >> y; vector<int> vec(x); for (int i = 0; i < x; i++) { cin >> vec.at(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, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
127
#include <bits/stdc++.h> using namespace std; int tab[1007]; int main() { int n, i, k, w = 0; cin >> n; for (i = 0; i < n; i++) { cin >> tab[i]; } sort(tab, tab + n); for (i = 0; i < k; i++) { w += tab[i]; } cout << w << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; int tab[1007]; int main() { int n, i, k, w = 0; cin >> n >> k; for (i = 0; i < n; i++) { cin >> tab[i]; } sort(tab, tab + n); for (i = 0; i < k; i++) { w += tab[i]; } cout << w << '\n'; return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
97
n,k = map(int,input().split()) p = [int(i) for i in input().split()] p.sort() for i in range(k) : s += p[i] print(s)
n,k = map(int,input().split()) p = [int(i) for i in input().split()] p.sort() s = 0 for i in range(k) : s += p[i] print(s)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
57
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: B # CreatedDate: 2020-06-21 20:42:23 +0900 # LastModified: 2020-06-21 21:09:42 +0900 # import os import sys #import numpy as np #import pandas as pd def main(): n,k = map(int, input().split()) p = list(map(int, input().split())) p.sort() ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: B # CreatedDate: 2020-06-21 20:42:23 +0900 # LastModified: 2020-06-21 21:10:40 +0900 # import os import sys #import numpy as np #import pandas as pd def main(): n,k = map(int, input().split()) p = list(map(int, input().split())) p.sort() ...
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
77
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; int main() { int k, n; cin >> k >> n; vector<int> p(n); rep(i, n) cin >> p[i]; sort(p.begin(), p.end()); int ans = 0; rep(i, k) { ans += p[i]; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; int main() { int k, n; cin >> n >> k; vector<int> p(n); rep(i, n) cin >> p[i]; sort(p.begin(), p.end()); int ans = 0; rep(i, k) { ans += p[i]; } cout << ans << endl; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
101
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); int ans = 0; for (int i = 0; i < 3; i++) { ans += a[i]; } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); int ans = 0; for (int i = 0; i < k; i++) { ans += a[i]; } cout << ans; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
102
n=list(map(int,input().split())) p=list(map(int,input().split())) p.sort() sum(p[:n[1]])
n=list(map(int,input().split())) p=list(map(int,input().split())) p.sort() print(sum(p[:n[1]]))
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
50
#include <bits/stdc++.h> using namespace std; #define ll long long #define tcase \ int _; \ cin >> _; \ while (_...
#include <bits/stdc++.h> using namespace std; #define ll long long #define tcase \ int _; \ cin >> _; \ while (_...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 68], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29]]
1
139
n,k = input().split() num_list = list(map(int,input().split())) num_list.sort() ans = 0 for i in range(k): ans += num_list[i] else: print(ans)
n,k = map(int,input().split()) num_list = list(map(int,input().split())) num_list.sort() ans = 0 for i in range(k): ans += num_list[i] else: print(ans)
[["+", 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, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
56
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define mod 1000000007 #define pi (3.141592653589) #define deb(n) cerr << #n << " = " << (n) << " "; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10); ...
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define mod 1000000007 #define pi (3.141592653589) #define deb(n) cerr << #n << " = " << (n) << " "; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10); ...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
144
n,k=map(int,input().split()) a=[int(v) for v in input().split()] print(sum(a[:k]))
n,k=map(int,input().split()) a=[int(v) for v in input().split()] a.sort() print(sum(a[:k]))
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
45
N, K = map(int, input().split()) p = list(map(int, input().split())) p = sorted(p) ans = 0 for a in p[:K]: ans += a print(a) print(ans)
N, K = map(int, input().split()) p = list(map(int, input().split())) p = sorted(p) ans = 0 for a in p[:K]: ans += a #print(a) print(ans)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
62
n, k =map(int, input().split()) #複数数値入力 list_p=list(map(int, input().split())) #リスト入力 list_p.sort() sum(list_p[:k])
n, k =map(int, input().split()) #複数数値入力 list_p=list(map(int, input().split())) #リスト入力 list_p.sort() print(sum(list_p[:k]))
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
/* * Created on: 21 / 6 / 2020 * Author: Eslam Waheed */ #define _CRT_SECURE_NO_WARNINGS //#define __USE_MINGW_ANSI_STDIO #include <bits/stdc++.h> //#include <bits/BIGINT.h> //#include <bits/Int128.h> using namespace std; #define Eslam__Waheed \ ios...
/* * Created on: 21 / 6 / 2020 * Author: Eslam Waheed */ #define _CRT_SECURE_NO_WARNINGS //#define __USE_MINGW_ANSI_STDIO #include <bits/stdc++.h> //#include <bits/BIGINT.h> //#include <bits/Int128.h> using namespace std; #define Eslam__Waheed \ ios...
[["+", 0, 14, 8, 9, 0, 338, 49, 352, 0, 67]]
1
170
n,k=map(int,input().split()) p=list(map(int,input().split())) pnew=sorted(p) sums=0 for i in range(k): sums=sums+pnew[i] print(pnew) print(sums)
n,k=map(int,input().split()) p=list(map(int,input().split())) pnew=sorted(p) sums=0 for i in range(k): sums=sums+pnew[i] print(sums)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
66
i = list(map(int, input().split())) s = list(map(int, input().split())) out=0 s = sorted(s) for i in range(3): out+=s[i] print(out)
i = list(map(int, input().split())) s = list(map(int, input().split())) out=0 s = sorted(s) for i in range(i[1]): out+=s[i] print(out)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 7, 12, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 206, 0, 73]]
5
61
#! -*- coding: utf-8 -*- n, k = map(int, input().split()) price = list(map(int, input().split())) sorted_price = sorted(price) print(sum(sorted_price[0:3]))
#! -*- coding: utf-8 -*- n, k = map(int, input().split()) price = list(map(int, input().split())) sorted_price = sorted(price) print(sum(sorted_price[0:k]))
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
52
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } reverse(vec.begin(), vec.end()); int s = 0; for (int i = 0; i < k; i++) { s += vec.at(i); } cout << s << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); int s = 0; for (int i = 0; i < k; i++) { s += vec.at(i); } cout << s << endl; }
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
108
#include <bits/stdc++.h> //#define ll long long using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.t...
#include <bits/stdc++.h> //#define ll long long using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.t...
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
153
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using P = pair<int, int>; int main() { int n, k; cin >> n >> k; vector<int> S; rep(i, n) { int a; cin >> a; S.push_back(a); } sort(S.begin(), S.end()); int ans = 0; rep(i, 3...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using P = pair<int, int>; int main() { int n, k; cin >> n >> k; vector<int> S; rep(i, n) { int a; cin >> a; S.push_back(a); } sort(S.begin(), S.end()); int ans = 0; rep(i, k...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
120
a, b = list(map(int, input().split())) c = list(map(int, input().split())) c.sort() n = 0 for i in range(b): n += i print(n)
a, b = list(map(int, input().split())) c = list(map(int, input().split())) c.sort() n = 0 for i in range(b): n += c[i] print(n)
[["+", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
59
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> p(N); for (int &i : p) cin >> i; sort(p.begin(), p.end()); int ans = 0; for (int i = 0; i < 3; i++) ans += p.at(i); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> p(N); for (int &i : p) cin >> i; sort(p.begin(), p.end()); int ans = 0; for (int i = 0; i < K; i++) ans += p.at(i); cout << ans << endl; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
93
n, k = map(int, input().split()) pp = sorted(map(int, input().split()), reverse=True) print(sum(pp[:k]))
n, k = map(int, input().split()) pp = sorted(map(int, input().split())) print(sum(pp[:k]))
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["-", 0, 662, 12, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 662, 12, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 662, 12, 652, 3, 4, 0, 653, 51, 146]]
5
48
N,K = map(int, input().split()) p=sorted(list(map(int,input().split()))) print(sum(p[0:2]))
N,K = map(int, input().split()) p=sorted(list(map(int,input().split()))) print(sum(p[0:K]))
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
48
N, K = [int(n) for n in input().split()] P = sorted([int(n) for n in input().split()]) print(sum(P[0:3]))
N, K = [int(n) for n in input().split()] P = sorted([int(n) for n in input().split()]) print(sum(P[0:K]))
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
53
n,k = map(int,input()) a = [int(i) for i in input().split()] a.sort() s = 0 for i in range(k): s += a[i] print(s)
n,k = map(int,input().split()) a = [int(i) for i in input().split()] a.sort() s = 0 for i in range(k): s += a[i] print(s)
[["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
56
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back using namespace std; void data() { #ifdef NURS freopen("main.in", "r", stdin); freopen("main.out", "w", stdout); #endif } const int N = 1e6 + 200; int main() { data(); int n, k; cin >> n >> k; int a[n + 1];...
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back using namespace std; void data() { #ifdef NURS freopen("main.in", "r", stdin); freopen("main.out", "w", stdout); #endif } const int N = 1e6 + 200; int main() { data(); int n, k; cin >> n >> k; int a[n + 1];...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
158
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, d, n) for (int i = (d); i < (n); ++i) #define rrep(i, n) for (int i = (n - 1); i >= 0; --i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define int long long template <typename T> usin...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, d, n) for (int i = (d); i < (n); ++i) #define rrep(i, n) for (int i = (n - 1); i >= 0; --i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define int long long template <typename T> usin...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
185
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; scanf("%d %d", &n, &k); vector<int> p(n); for (auto &i : p) scanf("%d", &i); sort(p.begin(), p.end()); int r = 0; for (int i = 0; i < k; i++) { r += p[n - i - 1]; } printf("%d\n", r); retur...
/*#include <iostream> int main() { long long n; scanf("%d", &n); }*/ #include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; scanf("%d %d", &n, &k); vector<int> p(n); for (auto &i : p) scanf("%d", &i); sort(p.begin(), p.end()); int r = 0; for (in...
[["-", 12, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["-", 12, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]]
1
121
#include <iostream> #include <queue> using namespace std; int main() { int N, K, tmp; priority_queue<int> Q; cin >> N >> K; for (int i = 0; i < N; i++) { cin >> tmp; Q.push(-tmp); } int ans = 0; for (int i = 0; i < K; i++) { ans += Q.top(); Q.pop(); } cout << ans << "\n"; return 0;...
#include <iostream> #include <queue> using namespace std; int main() { int N, K, tmp; priority_queue<int> Q; cin >> N >> K; for (int i = 0; i < N; i++) { cin >> tmp; Q.push(-tmp); } int ans = 0; for (int i = 0; i < K; i++) { ans -= Q.top(); Q.pop(); } cout << ans << "\n"; return 0;...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 110]]
1
107
#include <bits/stdc++.h> using namespace std; using ll = long long; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int power(int x, int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return r...
#include <bits/stdc++.h> using namespace std; using ll = long long; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int power(int x, int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return r...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
240
def main(): n,k = map(int,input().split()) p = list(map(int,input().split())) p.sort() print(sum(p[:3])) if __name__=='__main__': main()
def main(): n,k = map(int,input().split()) p = list(map(int,input().split())) p.sort() print(sum(p[:k])) if __name__=='__main__': main()
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
64
n, k = list(map(int, input().split())) price_arr = list(map(int, input.split())) price_arr.sort() sum = 0 for i in range(0,k): sum += price_arr[i] print(sum)
n, k = list(map(int, input().split())) price_arr = list(map(int, input().split())) price_arr.sort() sum = 0 for i in range(0,k): sum += price_arr[i] print(sum)
[["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
62
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL) typedef long long ll; typedef long double ld; #define trace(x) cerr << #x << ": " << x << endl; ...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL) typedef long long ll; typedef long double ld; #define trace(x) cerr << #x << ": " << x << endl; ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
129
/* _ __ _ _____ _____ _____ ___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ | / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ / / / / / / / | (__| |_| | |_) | __/ _| | | __/ (_| | < / / / / / / \___|\__,_|_.__/ \___|_| |_| \___|\__,_|_|\_\ ...
/* _ __ _ _____ _____ _____ ___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ | / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ / / / / / / / | (__| |_| | |_) | __/ _| | | __/ (_| | < / / / / / / \___|\__,_|_.__/ \___|_| |_| \___|\__,_|_|\_\ ...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
709
#include <bits/stdc++.h> using namespace std; #define ll long long #define value(x) cout << #x << " " << x << '\n'; #define print_vec(vec) \ for (auto x : vec) \ cout << x << " "; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define value(x) cout << #x << " " << x << '\n'; #define print_vec(vec) \ for (auto x : vec) \ cout << x << " "; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
142
N,K = map(int,input().split()) a = input().split() a = [int(i) for i in a] la = sorted(a) sum(la[:K])
N,K = map(int,input().split()) a = input().split() a = [int(i) for i in a] la = sorted(a) print(sum(la[:K]))
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
51
// warm heart, wagging tail,and a smile just for you! // _ _ _ __ __ __ __ _ _ __ _ _ __ _ __ ____ _ _ _ _ _ _ _ _ // ||__|| || ||\\//|| //__\\ ||\\ || ||__ ||__|| || || // || || || || || // \\ || \\|| ___|| || || \\__// // _ ___ _ _ _ _ _ __ _ _ __ _ __ _ __ _ _ __ ___ __ ...
// warm heart, wagging tail,and a smile just for you! // _ _ _ __ __ __ __ _ _ __ _ _ __ _ __ ____ _ _ _ _ _ _ _ _ // ||__|| || ||\\//|| //__\\ ||\\ || ||__ ||__|| || || // || || || || || // \\ || \\|| ___|| || || \\__// // _ ___ _ _ _ _ _ __ _ _ __ _ __ _ __ _ _ __ ___ __ ...
[["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
391
/* Powered by C++11. Author : Alex_Wei. */ #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize(3) //#define int long long #define ll long long #define pii pair<int, int> #define fi first #define se second #define pb emplace_back #define all(x) x.begin(), x.end() #define sor(x) sort(a...
/* Powered by C++11. Author : Alex_Wei. */ #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize(3) //#define int long long #define ll long long #define pii pair<int, int> #define fi first #define se second #define pb emplace_back #define all(x) x.begin(), x.end() #define sor(x) sort(a...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
549
nm = [int(i) for i in input().split()] n = nm[0] m = nm[1] a = [int(i) for i in input().split()] sorted(a) sum = 0 for i in range(m): sum += a[i] print(sum)
nm = [int(i) for i in input().split()] n = nm[0] m = nm[1] a = [int(i) for i in input().split()] a = sorted(a) sum = 0 for i in range(m): sum += a[i] print(sum)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]]
5
73
#include <algorithm> #include <iostream> #include <vector> #define int long long using namespace std; const int N = 2e5 + 10; int32_t main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n, k; cin >> n >> k; vector<int> v; for (int i = 0; i < n; ++i) cin >> v[i]; sort(v.begin(), v.end()); ...
#include <algorithm> #include <iostream> #include <vector> #define int long long using namespace std; const int N = 2e5 + 10; int32_t main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n, k; cin >> n >> k; vector<int> v(n); for (int i = 0; i < n; ++i) cin >> v[i]; sort(v.begin(), v.end()...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
134
n,m=map(int, input().split()) l=list(map(int, input().split())) ans=0 l.sort() for i in range(k): ans=ans+l[k] print(ans)
n,m=map(int, input().split()) l=list(map(int, input().split())) ans=0 l.sort() for i in range(m): ans=ans+l[i] print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 662, 12, 657, 12, 206, 206, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 206, 206, 22]]
5
61
#include <algorithm> #include <cmath> #include <iostream> #include <limits.h> #include <map> #include <set> #include <utility> #include <vector> using namespace std; using P = pair<int, int>; using ll = long long; constexpr int MOD = 998244353; constexpr int MAX = 510000; int main() { int n, k; cin >> n >> k; vec...
#include <algorithm> #include <cmath> #include <iostream> #include <limits.h> #include <map> #include <set> #include <utility> #include <vector> using namespace std; using P = pair<int, int>; using ll = long long; constexpr int MOD = 998244353; constexpr int MAX = 510000; int main() { int n, k; cin >> n >> k; vec...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
139
n=int(input()) data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ans=[] res=n while res>0: m=res%26 res=res//26 if m==0: ans.append('z') else: ans.append(data[m-1]) ans.reverse() print(*ans,sep='')
n=int(input()) data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ans=[] res=n while res>0: m=res%26 res=(res-1)//26 if m==0: ans.append('z') else: ans.append(data[m-1]) ans.reverse() print(*ans,sep='')
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
178
n = gets.to_i - 1 name = "" alpha = ("a".."z").to_a while n > 0 name = alpha[(n) % 26] + name n = n / 26 - 1 end puts name
n = gets.to_i - 1 name = "" alpha = ("a".."z").to_a while n >= 0 name = alpha[(n) % 26] + name n = n / 26 - 1 end puts name
[["-", 36, 36, 0, 493, 0, 89, 15, 738, 17, 47], ["+", 36, 36, 0, 493, 0, 89, 15, 738, 17, 20]]
4
50
#include <stdio.h> #include <string.h> int main() { long long int n; int index = 0; scanf("%d", &n); char s[50]; while (n > 0) { n--; s[index] = (char)'a' + n % 26; n /= 26; index++; } for (int i = index - 1; i >= 0; i--) { printf("%c", s[i]); } return 0; }
#include <stdio.h> #include <string.h> int main() { long long int n; int index = 0; scanf("%lld", &n); char s[50]; while (n > 0) { n--; s[index] = (char)'a' + n % 26; n /= 26; index++; } for (int i = index - 1; i >= 0; i--) { printf("%c", s[i]); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
103
#include <iostream> #include <stdio.h> using namespace std; typedef long long int ll; char c[100000000]; int main() { long long int n; scanf("%lld", &n); int num = 0; while (n) { c[num++] = (n - 1ll) % 26ll + 'a'; n /= 26ll; } for (int i = num - 1; i >= 0; i--) { printf("%c", c[i]); } prin...
#include <iostream> #include <stdio.h> using namespace std; typedef long long int ll; char c[100000000]; int main() { long long int n; scanf("%lld", &n); int num = 0; while (n--) { c[num++] = (n) % 26ll + 'a'; n /= 26ll; } for (int i = num - 1; i >= 0; i--) { printf("%c", c[i]); } printf("\...
[["+", 8, 9, 0, 52, 15, 339, 51, 27, 17, 68], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13]]
1
114