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
from math import factorial h, w, a, b = map(int, input().split()) MOD = 10**9+7 fact = [1] # 累積乗を作る for i in range(1, h+w-1): fact.append(fact[-1] * i % MOD) # 累積乗の逆元 inv_fact = [pow(fact[-1], MOD-2, MOD)] # x^(-1) = x^(10^9+5) % (10^9+7), フェルマーの小定理 for i in range(h+w-2, 0, -1): # xが最大の場合を求め、後ろ向きに計算していく inv...
from math import factorial h, w, a, b = map(int, input().split()) MOD = 10**9+7 fact = [1] # 累積乗を作る for i in range(1, h+w-1): fact.append(fact[-1] * i % MOD) # 累積乗の逆元 inv_fact = [pow(fact[-1], MOD-2, MOD)] # x^(-1) = x^(10^9+5) % (10^9+7), フェルマーの小定理 for i in range(h+w-2, 0, -1): # xが最大の場合を求め、後ろ向きに計算していく inv...
[["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 22], ["+", 36, 36, 0, 656, 0, 14, 54, 54, 0, 22], ["-", 0, 23, 0, 657, 31, 657, 31, 206, 206, 22], ["+", 0, 23, 0, 657, 31, 657, 31, 206, 206, 22], ["-", 0, 23, 0, 657, 31, 657, 12, 206, 206, 22], ["+", 0, 23, 0, 657, 31, 657, 12, 206, 206, 22], ["-", 0, 23, 0, 657, 12, 206, 206...
5
215
#include <cstdio> #define N 100005 #define ll long long #define mod 1000000007 ll inv[N * 2] = {1}; ll s[N * 2]; ll quickPow(ll a, ll b) { a %= mod; ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; } void init() { s[1] = 1; for (int i = ...
#include <cstdio> #define N 100005 #define ll long long #define mod 1000000007 ll inv[N * 2] = {1}; ll s[N * 2]; ll quickPow(ll a, ll b) { a %= mod; ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; } void init() { s[0] = 1; for (int i = ...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 1...
1
357
#include <algorithm> #include <cmath> #include <deque> #include <functional> // std::function<void(int)> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using n...
#include <algorithm> #include <cmath> #include <deque> #include <functional> // std::function<void(int)> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using n...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 33], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 33], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", ...
1
480
high, width, y, x = map(int, input().split()) def nCr(n, r): return (((fact[n]*finv[n-r]%mod)*finv[r])%mod) mod = 10**9 + 7 inv = mod - 2 maxn = high + width - 2 fact = [0] * (maxn+1) finv = [0] * (maxn+1) fact[0] = fact[1] = 1 finv[0] = finv[1] = 1 # 階乗を求める for i in range(2, maxn+1): fact[i] = (fact[i-1] * ...
high, width, y, x = map(int, input().split()) def nCr(n, r): return ((((fact[n]*finv[n-r])%mod)*finv[r])%mod) mod = 10**9 + 7 inv = mod - 2 maxn = high + width - 2 fact = [0] * (maxn+1) finv = [0] * (maxn+1) fact[0] = fact[1] = 1 finv[0] = finv[1] = 1 # 階乗を求める for i in range(2, maxn+1): fact[i] = (fact[i-1] ...
[["+", 0, 657, 31, 23, 0, 657, 31, 23, 0, 24], ["+", 0, 657, 31, 23, 0, 657, 31, 23, 0, 25], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 1, 0, 662, 12, 23, 0, 657, 31, 22], ["-", 0, 1, 0, 662, 12, 23, 0, 657, 17, 72], ["-", 12, 23, 0, 657, 12, 657, 31, 23, 0, 24], ["-"...
5
240
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define pb push_back #define eb ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define pb push_back #define eb ...
[["-", 31, 69, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 31, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 23, 0, 16, 17, 109], ["...
1
384
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> typedef long long ll; #define rep(i, s, t) for (ll i = s; i < t; ++i) #define mod 1000000007 #define maxn 200005 using namespace std; ll fac[maxn], inv[maxn]; int f(ll a, ll b) { ll ans = 1; while (b) { if (b % 2) ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> typedef long long ll; #define rep(i, s, t) for (ll i = s; i < t; ++i) #define mod 1000000007 #define maxn 200005 using namespace std; ll fac[maxn], inv[maxn]; int f(ll a, ll b) { ll ans = 1; while (b) { if (b % 2) ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 9...
1
345
#include <iostream> #include <string.h> using namespace std; #define int long long const int N = 2e5 + 5, MOD = 1e9 + 7; int h, w, a, b; int fac[N + 1], invFac[N + 1], inv[N + 1]; void calcInv() { inv[0] = inv[1] = 1; for (int i = 2; i <= N; i++) { inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD; } } void cal...
#include <iostream> #include <string.h> using namespace std; #define int long long const int N = 2e5 + 5, MOD = 1e9 + 7; int h, w, a, b; int fac[N + 5], invFac[N + 5], inv[N + 5]; void calcInv() { inv[0] = inv[1] = 1; for (int i = 2; i <= N; i++) { inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD; } } void cal...
[["-", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 37, 0, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 16, 31, 23, 0, 25], ["-", 31, 23, 0, 16, 31, 16, 12, 23, 0, 25]]
1
372
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 7; const long long mod = 1e9 + 7; long long w, h, a, b, ans = 0, uu[N]; long long poww(long long a, long long b) { if (!b) return 1; if (b == 1) return a % mod; long long d = poww(a, b / 2); if (b % 2 == 0) return (d * d) % mod;...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 7; const long long mod = 1e9 + 7; long long w, h, a, b, ans = 0, uu[N]; long long poww(long long a, long long b) { if (!b) return 1; if (b == 1) return a % mod; long long d = poww(a, b / 2); if (b % 2 == 0) return (d * d) % mod;...
[["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 17, 48], ["+", 0, 16, 3...
1
418
#include <bits/stdc++.h> #define ll long long #define ld long double #define pr pair<ll, ll> #define loop(i, n) for (ll i = 0; i < n; ++i) #define rep(i, x, n) for (ll i = x; i <= n; ++i) #define iteloop(type, data, name, it) \ for (type<data>::iterator it = name.begin(); it ...
#include <bits/stdc++.h> #define ll long long #define ld long double #define pr pair<ll, ll> #define loop(i, n) for (ll i = 0; i < n; ++i) #define rep(i, x, n) for (ll i = x; i <= n; ++i) #define iteloop(type, data, name, it) \ for (type<data>::iterator it = name.begin(); it ...
[["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 14, 8, 9, 0, 171, 0, 1, 0, 35]]
1
175
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << 0; return 0; } int ans = 0; int A[n]; for (int i = 0; i < n; i++) cin >> A[i]; sort(A, A + n); int i = 0; if (n % 2) i = 1; for (; i < n; i += 2) { ans += A[i]; } cout << a...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; n = 2 * n; int ans = 0; int A[n]; for (int i = 0; i < n; i++) cin >> A[i]; sort(A, A + n); int i = 0; if (n % 2) i = 1; for (; i < n; i += 2) { ans += A[i]; } cout << ans; }
[["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 57, 64, 9...
1
114
#include <bits/stdc++.h> using namespace std; signed main() { int n, l, bbq, ans = 0; vector<int> vec; cin >> n; for (int i = 0; i < n * 2; i++) { cin >> l; vec.push_back(l); } sort(vec.begin(), vec.end()); bbq = vec.size(); for (int i = 0; i < n * 2; i++) cout << vec[i] << ' '; cout <<...
#include <bits/stdc++.h> using namespace std; signed main() { int n, l, bbq, ans = 0; vector<int> vec; cin >> n; for (int i = 0; i < n * 2; i++) { cin >> l; vec.push_back(l); } sort(vec.begin(), vec.end()); bbq = vec.size(); for (int i = 0; i < n * 2; i += 2) ans += min(vec[i], vec[i + 1])...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["-", 0, 7, 8, 1, 0, 16, 31, 16, 31, 22], ["-", 0, 7, 8, 1, 0, 16, 31, 16, 17, 151], ["-", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 16, 3...
1
161
N=int(input()) L=list(map(int,input().split())) L.sort() s=0 for i in range(N): s+=min(L[2i],L[2i+1]) print(s)
N=int(input()) L=list(map(int,input().split())) L.sort() s=0 for i in range(N): s+=L[2*i] print(s)
[["-", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["-", 0, 677, 12, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 677, 12, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 677, 12, 652, 3, 4, 0, 206, 206, 612], ["-", 12, 652, 3, 4, 0, 206, 0, 42, 0, 22], ["-", 0, 677, 12, 652, 3, 4, 0, 206, 0, 73], ["...
5
63
#include <array> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using LL = long long; using ULL = unsigned long long; void solve() { int n; cin >> n; int l[100]; rep(i, n) cin >> l[i]; sort(l, l + n); reverse(l, l + n); int ans = 0; for (int i = 1; i < n;...
#include <array> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using LL = long long; using ULL = unsigned long long; void solve() { int n; cin >> n; int l[200]; rep(i, 2 * n) cin >> l[i]; sort(l, l + 2 * n); reverse(l, l + 2 * n); int ans = 0; for (int i...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, ...
1
128
#include <algorithm> #include <bits/stdc++.h> using namespace std; int main() { int a, b[110], c, d; cin >> a; for (int i = 0; i < 2 * a; i++) cin >> b[i]; sort(b, b + 2 * a); c = 0; for (int i = 0; i < 2 * a; i += 2) { c += b[i]; } cout << c << endl; }
#include <algorithm> #include <bits/stdc++.h> using namespace std; int main() { int a, b[11000], c, d; cin >> a; for (int i = 0; i < (2 * a); i++) cin >> b[i]; sort(b, b + (2 * a)); c = 0; for (int i = 0; i < (2 * a); i += 2) { c += b[i]; } cout << c << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 3...
1
100
#include <stdio.h> #include <string.h> void bubblesort(int *N, int len) { int i, j; int temp; for (i = 0; i < len; i++) { for (j = len - 1; j > i; j--) { if (N[j] < N[j - 1]) { temp = N[j]; N[j] = N[j - 1]; N[j - 1] = temp; } } } } int main(int argc, const char *ar...
#include <stdio.h> void bubblesort(int *N, int len) { int i, j; int temp; for (i = 0; i < len; i++) { for (j = len - 1; j > i; j--) { if (N[j] < N[j - 1]) { temp = N[j]; N[j] = N[j - 1]; N[j - 1] = temp; } } } } int main(int argc, const char *argv[]) { int N = 0...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
226
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define all(X) (X).begin(), (X).end() #define cmp_all(X) (X).begin(), (X).end(), cmp #define B begin() #define E end() #define sz size() #define skip continue #define ppi pair<pair<int, int>, int> #define pii pair<int, int> #def...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define all(X) (X).begin(), (X).end() #define cmp_all(X) (X).begin(), (X).end(), cmp #define B begin() #define E end() #define sz size() #define skip continue #define ppi pair<pair<int, int>, int> #define pii pair<int, int> #def...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
258
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { var n int fmt.Scanf("%d", &n) if n%2 != 0 { panic("input must be even") } var sc = bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) var a []int for i := 0; i < 2*n; i++ { a = append(a, nextInt(sc)) } var num int for ...
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { var n int fmt.Scanf("%d", &n) var sc = bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) var a []int for i := 0; i < 2*n; i++ { a = append(a, nextInt(sc)) } var num int for i := 0; i < n; i++ { _, v1 := popMin(a) _, v...
[["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165], ["-", 0, 434, 0, 435, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 433], ["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 79], ["-", 0, 435, 8, 196, 0, 57, 15, 16, 12,...
7
298
#include <stdio.h> int main() { int N = 0, sum = 0, i = 0; int L[200]; printf("串焼きの個数:"); scanf("%d", &N); for (int x = 0; x < 2 * N; x++) { printf("%d番目の串の長さ:", x + 1); scanf("%d", &L[x]); ++i; } for (int y = 0; y < i + 1; y++) { for (int z = 0; z < i - 1; z++) { if (L[z] < L[z...
#include <stdio.h> int main() { int N = 0, sum = 0, i = 0; int L[200]; scanf("%d", &N); for (int x = 0; x < 2 * N; x++) { scanf("%d", &L[x]); ++i; } for (int y = 0; y < i + 1; y++) { for (int z = 0; z < i - 1; z++) { if (L[z] < L[z + 1]) { sum = L[z]; L[z] = L[z + 1];...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1,...
0
212
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; int l[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> l[i]; sort(l, l + 2 * n); for (int i = 0; i < 2 * n; i += 2) { ans += l[i]; cout << l[i]; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; int l[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> l[i]; sort(l, l + 2 * n); for (int i = 0; i < 2 * n; i += 2) { ans += l[i]; } cout << ans; return 0; }
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 69, 28, 22], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 73], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
105
/* it was worth becoming a chemist */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ld; typedef unsigned int uni; typedef unsigned long long unll; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long long, int> pli; typedef ...
/* it was worth becoming a chemist */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ld; typedef unsigned int uni; typedef unsigned long long unll; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long long, int> pli; typedef ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["-", 8, 9, 0, 7, 15, ...
1
254
#include <algorithm> #include <iostream> using namespace std; signed main() { int n, i; int l[100]; cin >> n; for (i = 0; i < 2 * n; i++) cin >> l[i]; sort(l, l + 2 * n); int ans = 0; for (i = 0; i < 2 * n; i += 2) { ans += l[i]; } cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int n; int l[200]; int main() { int i; cin >> n; for (i = 0; i < 2 * n; i++) cin >> l[i]; sort(l, l + 2 * n); int ans = 0; for (i = 0; i < 2 * n; i += 2) { ans += l[i]; } cout << ans << endl; return 0; }
[["-", 36, 36, 0, 30, 0, 14, 39, 86, 0, 156], ["-", 36, 36, 0, 30, 0, 14, 49, 53, 49, 22], ["-", 0, 30, 0, 14, 49, 53, 54, 55, 0, 24], ["-", 0, 30, 0, 14, 49, 53, 54, 55, 0, 25], ["-", 36, 36, 0, 30, 0, 14, 8, 9, 0, 45], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 14, 8, ...
1
101
package main import ( "bufio" "fmt" "math" "os" "sort" "strconv" "strings" ) var reader = bufio.NewReader(os.Stdin) func readNum() int { var str, _ = reader.ReadString('\n') var trimmed = strings.TrimSpace(str) var i, _ = strconv.Atoi(trimmed) return i } func leadSplit() []string { var str, _ = reader.R...
package main import ( "bufio" "fmt" "os" "sort" "strconv" "strings" ) var reader = bufio.NewReader(os.Stdin) func readNum() int { var str, _ = reader.ReadString('\n') var trimmed = strings.TrimSpace(str) var i, _ = strconv.Atoi(trimmed) return i } func leadSplit() []string { var str, _ = reader.ReadStrin...
[["-", 0, 454, 0, 455, 0, 458, 136, 429, 0, 62], ["-", 36, 36, 0, 434, 0, 454, 0, 455, 0, 165], ["-", 8, 196, 0, 7, 8, 196, 0, 440, 0, 217], ["-", 0, 7, 8, 196, 0, 440, 0, 441, 141, 22], ["-", 0, 7, 8, 196, 0, 440, 0, 441, 0, 32], ["-", 0, 440, 0, 441, 51, 432, 0, 437, 439, 22], ["-", 0, 440, 0, 441, 51, 432, 0, 437, 0...
7
338
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; int L[N]; rep(i, N) { cin >> L[i]; } sort(L, L + N); int ans = 0; for (in...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; int L[2 * N]; rep(i, 2 * N) { cin >> L[i]; } sort(L, L + 2 * N); int ans = 0...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["-", 0, 14, 8, 9, 0, 7, 15,...
1
112
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> using namespace std; long long int gcd(long long int x, long long int y) { return y != 0 ? gcd(y, x % y) : x; } long long int lcm(long long int x, long long int y) { return x * y / gcd(x, y); } long long int factorial(lo...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> using namespace std; long long int gcd(long long int x, long long int y) { return y != 0 ? gcd(y, x % y) : x; } long long int lcm(long long int x, long long int y) { return x * y / gcd(x, y); } long long int factorial(lo...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], [...
1
186
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int n; std::vector<int> l(2 * n); std::cin >> n; for (int i = 0; i < 2 * n; i++) { std::cin >> l[i]; } std::sort(l.begin(), l.end()); int sum = 0; for (int i = 0; i < 2 * n; i += 2) { sum += l[i]; } st...
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int n; std::cin >> n; std::vector<int> l(2 * n); for (int i = 0; i < 2 * n; i++) { std::cin >> l[i]; } std::sort(l.begin(), l.end()); int sum = 0; for (int i = 0; i < 2 * n; i += 2) { sum += l[i]; } st...
[["+", 8, 9, 0, 1, 0, 16, 31, 343, 141, 22], ["+", 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], ["+", 0, 14, 8, 9, 0, 43, 39, 343, 345, 348], ["+", 0, 14, 8, 9, 0, 43, 39, 343, 0, 349], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 1, 0, ...
1
124
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; int L[101]; int tmp, ans = 0; scanf("%d", &n); for (int i = 0; i < n * 2; i++) { scanf("%d", &L[i]); } /* 数値を降順にソート */ for (int i = 0; i < n * 2 - 1; i++) { for (int j = i + 1; j < n * 2; j++) { if (L[i] ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; int L[201]; int tmp, ans = 0; scanf("%d", &n); for (int i = 0; i < (n * 2); i++) { scanf("%d", &L[i]); } /* 数値を降順にソート */ for (int i = 0; i < n * 2; i++) { for (int j = i; j < n * 2; j++) { if (L[i] > L[j]...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43...
0
187
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; N *= 2; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a.at(i); int ans = 0; for (int i = 0; i < N; i += 2) ans += a.at(i); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; N *= 2; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a.at(i); sort(a.begin(), a.end()); int ans = 0; for (int i = 0; i < N; i += 2) ans += a.at(i); cout << ans << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]...
1
90
num_meals = int(input()) skewers = list(map(int, input().split())) skewers.sort() print(skewers) ingredients = 0 for skewer in range(0,(len(skewers) - 1),+2): print(skewers[skewer]) ingredients = ingredients + skewers[skewer] print(ingredients)
num_meals = int(input()) skewers = list(map(int, input().split())) skewers.sort() ingredients = 0 for skewer in range(0,(len(skewers) - 1),+2): ingredients = ingredients + skewers[skewer] print(ingredients)
[["-", 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], ["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 1, 0, 652, ...
5
76
#include <stdio.h> void swap(int *array, int i, int j) { int temp; temp = array[i]; array[i] = array[j]; array[j] = temp; } int main(void) { int n, l[400]; int i, j; scanf("%d", &n); for (i = 0; i < n * 2; i++) { scanf("%d", &l[i]); } for (i = 0; i < 2 * n - 1; i++) { for (j = i + 1; j < 2 ...
#include <stdio.h> void swap(int *array, int i, int j) { int temp; temp = array[i]; array[i] = array[j]; array[j] = temp; } int main(void) { int n, l[400]; int i, j; scanf("%d", &n); for (i = 0; i < n * 2; i++) { scanf("%d", &l[i]); } for (i = 0; i < 2 * n - 1; i++) { for (j = i + 1; j < 2 ...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 23, 0, 24], ["-", 0, 57, 15, 23, 0, 16, 31, 69, 28, 22], ["-", 0, 57, 15, 23, 0, 16, 31, 69, 0, 70], ["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["-", 0, 57, 15, 23, 0, 16, 31, 69, 0, 73], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["-", 0, 57, 15, ...
0
232
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } int answer = 0; sort(vec.begin(), vec.end()); int S = N / 2; for (int i = 0; i < N; i += 2) { answer += vec.at(i)...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> vec(N * 2); for (int i = 0; i < N * 2; i++) { cin >> vec.at(i); } int answer = 0; sort(vec.begin(), vec.end()); int S = N / 2; for (int i = 0; i < N; i++) { answer += vec....
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 48], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 11, 12, 2...
1
116
n=input() a=input().split() a=[int(i) for i in a] a=a.sorted() count=0 ans=0 for i in a: if count%2==0: ans+=i count+=1
n=input() a=input().split() a=[int(i) for i in a] a.sort() count=0 ans=0 for i in a: if count%2==0: ans+=i count+=1 print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 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], ["+...
5
57
#include <bits/stdc++.h> #define F first #define S second #define all(a) a.begin(), a.end() #define setDP(arr) memset(arr, -1, sizeof arr) #define Clear(arr) memset(arr, 0, sizeof arr) #define oo 2000000000 #define inf 1000000000000000000 #define P1 31 #define P2 37 #define M 1000000007 #define M2 1000000009 #define pi...
#include <bits/stdc++.h> #define F first #define S second #define all(a) a.begin(), a.end() #define setDP(arr) memset(arr, -1, sizeof arr) #define Clear(arr) memset(arr, 0, sizeof arr) #define oo 2000000000 #define inf 1000000000000000000 #define P1 31 #define P2 37 #define M 1000000007 #define M2 1000000009 #define pi...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
196
N = int(input()) tmp_lst = input().split() length_lst = [] print(2*N) for i in range(2*N): print(tmp_lst[i]) length_lst.append(int(tmp_lst[i])) length_lst.sort() output = 0 for i in range(0, 2*N, 2): output += length_lst[i] print(output)
N = int(input()) tmp_lst = input().split() length_lst = [] #print(2*N) for i in range(2*N): # print(tmp_lst[i]) length_lst.append(int(tmp_lst[i])) length_lst.sort() output = 0 for i in range(0, 2*N, 2): output += length_lst[i] print(output)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, ...
5
88
#include <algorithm> #include <iostream> using namespace std; const int N = 105; int ar[N]; int main() { int n, i, j, k, l, sum = 0; cin >> n; for (i = 1; i <= n; i++) { cin >> ar[i]; } sort(ar + 1, ar + 1 + n); for (i = n; i > 1; i -= 2) { sum += ar[i - 1]; i -= 2; } cout << sum; }
#include <algorithm> #include <iostream> using namespace std; const int N = 105; int ar[N]; int main() { int n, i, j, k, l, sum = 0; cin >> n; for (i = 1; i <= 2 * n; i++) { cin >> ar[i]; } sort(ar + 1, ar + 1 + 2 * n); for (i = 2 * n; i > 1; i -= 2) { sum += ar[i - 1]; // cout<<sum<<" "<<i<<" "...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 10, 11, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 10, 11, 12, 16, 17, 48], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0...
1
113
n=int(input()) l=list(map(int,input().split())) l.sort(reverse=1) ans=0 for i in range(1,n,2): ans+=l[i] print(ans)
n=int(input()) l=list(map(int,input().split())) l.sort(reverse=1) ans=0 for i in range(n): ans+=l[2*i+1] print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 677, 12, 206, 206, 657, 31, 657, 31, 612], ["+", 0, 677, 12, 206, 206, 657, 31, 657, 17, 48], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
58
#include <iostream> using namespace std; int main(void) { int n; cin >> n; int l[2 * n], tmp; for (int i = 0; i < 2 * n; ++i) cin >> l[i]; for (int i = 0; i < 2 * n - 1; ++i) if (l[i] > l[i + 1]) { tmp = l[i]; l[i] = l[i + 1]; l[i + 1] = tmp; } tmp = 0; for (int i = 0; i < n;...
#include <iostream> using namespace std; int main(void) { int n; cin >> n; int l[2 * n], tmp; for (int i = 0; i < 2 * n; ++i) cin >> l[i]; for (int i = 0; i < 2 * n - 1; ++i) { for (int i = 0; i < 2 * n - 1; ++i) if (l[i] > l[i + 1]) { tmp = l[i]; l[i] = l[i + 1]; l[i + 1...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 8, 9, 0, 7, 8, 9, 0, 7, 0, 88], ["+", 8, 9, 0, 7, 8, 9, 0, 7, 0, 24], ["+", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 7, 10, 43, 0, ...
1
148
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N; vector<int> L(2 * N); int ans = 0; for (int i = 0; i < 2 * N; i++) { cin >> L[i]; } sort(L.begin(), L.end()); for (int j = 0; j < N; j++) { an...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; #define lol long long int main() { int N; cin >> N; vector<int> L(2 * N); int ans = 0; for (int i = 0; i < 2 * N; i++) { cin >> L[i]; } sort(L.begin(),...
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", ...
1
112
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <vector> #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; ll a[114]; signed main() { ll n, ans = 0; cin >> n; rep(i, n) cin >> a[i]; sort(a, a + n); reverse(a, a + n); ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <vector> #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; ll a[114]; signed main() { ll n, ans = 0; cin >> n; rep(i, 2 * n) cin >> a[i]; sort(a, a + 2 * n); reverse(a, a ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48]]
1
121
#include <algorithm> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <utility> #include <vector> using std::cerr; using std::cin; using std::cout; using std::endl; void OutputError(std::string s) { cerr << "\033[93m" << s << "\033[m" << endl; re...
#include <algorithm> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <utility> #include <vector> using std::cerr; using std::cin; using std::cout; using std::endl; void OutputError(std::string s) { cerr << "\033[93m" << s << "\033[m" << endl; re...
[["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0,...
1
208
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() typedef long long ll; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, 0xff, sizeof(a)) #define MEMSET(v, h) memset((v),...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() typedef long long ll; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, 0xff, sizeof(a)) #define MEMSET(v, h) memset((v),...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 31, 13], ["+", 3, 4, 0, 16, 31, 23, 0...
1
263
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define Abs(x) ((x) < 0 ? (x) * -1 : (x)) #define rep(x, y) for ((x) = 0; (x) < (y); (x)++) #define repin(x, y) for ((x) = 0; (x) <= (y); (x)++) #define nep(x, y) for ((x) = (y)-1; 0 <= (x); (x)--) #define nepi(x, y,...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define Abs(x) ((x) < 0 ? (x) * -1 : (x)) #define rep(x, y) for ((x) = 0; (x) < (y); (x)++) #define repin(x, y) for ((x) = 0; (x) <= (y); (x)++) #define nep(x, y) for ((x) = (y)-1; 0 <= (x); (x)--) #define nepi(x, y,...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["+", 8, 9, 0, 43...
1
514
#include <bits/stdc++.h> #define F first #define S second #define MP make_pair #define pb push_back #define endl '\n' using namespace std; typedef long long LL; typedef pair<int, int> P; typedef pair<LL, LL> LP; typedef pair<int, P> iP; typedef pair<P, P> PP; static const int INF = INT_MAX; static const LL LINF = LL...
#include <bits/stdc++.h> #define F first #define S second #define MP make_pair #define pb push_back #define endl '\n' using namespace std; typedef long long LL; typedef pair<int, int> P; typedef pair<LL, LL> LP; typedef pair<int, P> iP; typedef pair<P, P> PP; static const int INF = INT_MAX; static const LL LINF = LL...
[["+", 0, 43, 49, 80, 81, 16, 31, 16, 17, 48], ["+", 0, 43, 49, 80, 81, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["-", ...
1
244
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; template <class T> using V = vector<T>; templ...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; template <class T> using V = vector<T>; templ...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94], ["-", 0, 7, 8, 9, 0...
1
3,692
#include <bits/stdc++.h> using namespace std; int main() { int N, sum = 0; vector<int> L; cin >> N; for (int i = 0; i < 2 * N; i++) { cin >> L.at(i); } sort(L.begin(), L.end()); for (int i = 0; i < N; i++) { sum += L.at(2 * i); } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, sum = 0; cin >> N; vector<int> L(2 * N); for (int i = 0; i < 2 * N; i++) { cin >> L.at(i); } sort(L.begin(), L.end()); for (int i = 0; i < N; i++) { sum += L.at(2 * i); } cout << sum << endl; }
[["+", 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, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 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], ["+", 8, 9, 0, 43, 49, 50, 51, ...
1
104
#include <stdio.h> #include <stdlib.h> static int compare(const void *a, const void *b) { int aNum = *(int *)a; int bNum = *(int *)b; return aNum - bNum; } int main(void) { int n, l[100], i, sum = 0; scanf("%d", &n); for (i = 0; i < 2 * n; i++) { scanf("%d", &l[i]); } qsort(l, 2 * n, sizeof(in...
#include <stdio.h> #include <stdlib.h> static int compare(const void *a, const void *b) { int aNum = *(int *)a; int bNum = *(int *)b; return aNum - bNum; } int main(void) { int n, l[200], i, sum = 0; scanf("%d", &n); for (i = 0; i < 2 * n; i++) { scanf("%d", &l[i]); } qsort(l, 2 * n, sizeof(in...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 2...
0
164
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define fore(i, a) for (auto &i : a) #define all(x) (x).begin(), (x).end() #pragma GCC optimize("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false);...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define fore(i, a) for (auto &i : a) #define all(x) (x).begin(), (x).end() #pragma GCC optimize("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false);...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 2, 3, 4, 0, 2, 63, 346, 141, 22], ["-", 3, 4, 0, 2, 63, 346, 3, 347, 0, 18], ["-", 0, 2, 63, 346, 3, 347, 0, 77, 39, 40], ["-", 3, 4, 0, 2, 63, 346, 3, 347, 0, 47], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0...
1
276
a = input() lst = input().split(" ") lst.sort() ans=0 for i in range(int(len(lst))): ans += lst[len(lst)-2*i-2] print(ans)
a = input() lst = list(map(int,input().split(" "))) lst.sort() ans=0 for i in range(int(len(lst)/2)): ans += lst[len(lst)-2*i-2] print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 12, 652...
5
58
#include <bits/stdc++.h> using namespace std; int main(void) { int N; int get; int counter = 0; vector<vector<int>> a; vector<int> c; cin >> N; for (int i = 0; i < 2 * N; i++) { cin >> get; c.push_back(get); } sort(c.begin(), c.end()); for (int i = 0; i < N; i++) { vector<int> d; ...
#include <bits/stdc++.h> using namespace std; int main(void) { int N; int get; int counter = 0; int COUNTER = 0; vector<vector<int>> a; vector<int> c; cin >> N; for (int i = 0; i < 2 * N; i++) { cin >> get; c.push_back(get); } sort(c.begin(), c.end()); for (int i = 0; i < N; i++) { ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 17, 72], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 12, 22], ["-", 3, 4, 0, 16,...
1
219
N = int(input()) L = list(map(int, input().split())) L.sort() x = 0 for i in range(0, 2*N, 2): print(L[i]) x += L[i] print(x)
N = int(input()) L = list(map(int, input().split())) L.sort() x = 0 for i in range(0, 2*N, 2): x += L[i] print(x)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
64
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); long long ans = 0; for (int i = 0; i < n; i += 2) { if (i >= n) break; ans += arr[i]; } cout << ans; }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n; cin >> n; n = 2 * n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); long long ans = 0; for (int i = 0; i < n; i += 2) { ans += arr[i]; } cout << ans; }
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 33...
1
101
#include <stdio.h> #include <stdlib.h> ///* void sort_N(int *x, int n); int main() { int i, n, *ary; int counter = 0; scanf("%d", &n); ary = (int *)calloc(2 * n, sizeof(int)); if (ary == NULL) { return 0; } for (i = 0; i < 2 * n; i++) { scanf("%d", &ary[i]); } sort_N(ary, 2 * n); for ...
#include <stdio.h> #include <stdlib.h> ///* void sort_N(int *x, int n); int main() { int i, n, *ary; int counter = 0; scanf("%d", &n); ary = (int *)calloc(2 * n, sizeof(int)); if (ary == NULL) { return 0; } for (i = 0; i < 2 * n; i++) { scanf("%d", &ary[i]); } sort_N(ary, 2 * n); for ...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16...
0
289
#include <cstdio> #include <iostream> using namespace std; int main() { int n, a[101]; cin >> n; for (int i = 1; i <= 2 * n; i++) cin >> a[i]; for (int i = 1; i <= 2 * n - 1; i++) for (int j = i + 1; j <= 2 * n; j++) if (a[j] < a[i]) { int tmp = a[i]; a[i] = a[j]; a[j] = ...
#include <cstdio> #include <iostream> #include <math.h> using namespace std; int main() { int n, a[1000]; cin >> n; for (int i = 1; i <= 2 * n; i++) cin >> a[i]; for (int i = 1; i <= 2 * n - 1; i++) for (int j = i + 1; j <= 2 * n; j++) if (a[j] < a[i]) { int tmp = a[i]; a[i] = a[j...
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
168
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int num[1000]; int sum = 0; cin >> n; for (int i = 0; i < 2 * n; i++) cin >> num[i]; sort(num, num + (n * 2)); for (int i = 0; i < 2 * n; i += 2) { sum += min(num[i], num[i + 1]); cout << i << endl; } ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int num[1010]; int sum = 0; cin >> n; for (int i = 0; i < 2 * n; i++) cin >> num[i]; sort(num, num + (n * 2)); for (int i = 0; i < 2 * n; i += 2) { sum += min(num[i], num[i + 1]); } cout << sum << endl; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 7, 8, 9, 0, 1, 0, ...
1
116
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int N, sum = 0; cin >> N; int L[N + 5]; for (int i = 0; i < 2 * N; i++) { cin >> L[i]; } sort(L, L + 2 * N); for (int i = 0; i < 2 * N; i += 2) { sum += L[i]; } cout << sum <...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int N, sum = 0; cin >> N; int L[N * 2]; for (int i = 0; i < 2 * N; i++) { cin >> L[i]; } sort(L, L + 2 * N, greater<int>()); for (int i = 1; i < 2 * N; i += 2) { sum += L[i]; }...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 63, 346, 141, 22], ["+", 3, 4, 0, 2, 63, 346, 3, 347, 0, 18], ["+", 0, 2, 63, 346...
1
105
n = input() l = map(int, input().split()) l = sorted(l) ans = 0 for i in range(len(n)): a = l[2*i] b = l[2*i+1] ans =+ min(a,b) print(ans)
n = int(input()) l = map(int, input().split()) l = sorted(l) ans = 0 for i in range(n): a = l[2 * i] b = l[2 * i + 1] ans = ans + min(a, b) 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, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22]]
5
70
#include <bits/stdc++.h> using namespace std; int main() { int n, arr[101]; cin >> n; assert(n % 2 == 0); for (int i = 1; i <= n; i++) cin >> arr[i]; sort(arr + 1, arr + n + 1); int ans = 0; for (int i = 1; i <= n; i += 2) { ans += arr[i]; } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n, arr[201]; cin >> n; n *= 2; for (int i = 1; i <= n; i++) cin >> arr[i]; sort(arr + 1, arr + n + 1); int ans = 0; for (int i = 1; i <= n; i += 2) { ans += arr[i]; } cout << ans; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 109], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 60], ["-", 0, 1, 0, 2, 3, 4, 0, 16,...
1
100
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; vector<int> kushi; cin >> N; N *= 2; kushi.resize(N); int minNum[2] = {0, 0}; for (int n = 0; n < N; n++) { cin >> kushi[n]; } sort(kushi.begin(), kushi.end()); int sum = 0; for (int n = 0; n ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; vector<int> kushi; cin >> N; N *= 2; kushi.resize(N); int minNum[2] = {0, 0}; for (int n = 0; n < N; n++) { cin >> kushi[n]; } sort(kushi.begin(), kushi.end()); int sum = 0; for (int n = 0; n ...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 31, 16, 31, 16, 31, 16, 12, 69, 28, 22], ["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["-", 0, 1, 0, 16, 31, 16, 31, 16, ...
1
167
#include <bits/stdc++.h> using namespace std; #define maxn 100000 #define int long long int a[maxn]; signed main() { int n, ans = 0; scanf("%lld", &n); n *= 2; for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); for (int i = 1; i <= n; i += 2) ans += a[i]; printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; #define maxn 100000 #define int long long int a[maxn]; signed main() { int n, ans = 0; scanf("%lld", &n); n *= 2; for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); sort(a + 1, a + 1 + n); for (int i = 1; i <= n; i += 2) ans += a[i]; printf("%lld\n", ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72],...
1
107
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> L(2 * N); for (int i = 0; i < 2 * N; i++) { cin >> L.at(i); } int sum = 0; for (int i = 0; i < 2 * N; i += 2) { sum += min(L.at(i), L.at(i + 1)); } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> L(2 * N); for (int i = 0; i < 2 * N; i++) { cin >> L.at(i); } int sum = 0; sort(L.begin(), L.end()); for (int i = 0; i < 2 * N; i += 2) { sum += min(L.at(i), L.at(i + 1)); } cout << sum << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]...
1
108
#include <bits/stdc++.h> using namespace std; int N, a[1000010]; int main() { scanf("%d", &N); for (int i = 1; i <= 2 * N; i++) scanf("%d", &a[i]); int ans = 0; for (int i = 1; i <= 2 * N; i += 2) ans += a[i]; printf("%d\n", ans); }
#include <bits/stdc++.h> using namespace std; int N, a[1000010]; int main() { scanf("%d", &N); for (int i = 1; i <= 2 * N; i++) scanf("%d", &a[i]); int ans = 0; sort(a + 1, a + 2 * N + 1); for (int i = 1; i <= 2 * N; i += 2) ans += a[i]; printf("%d\n", ans); }
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72],...
1
98
#include <bits/stdc++.h> #define ui unsigned int #define ll long long #define db double #define ld long double #define ull unsigned long long #define REP(a, b, c) for (register int a = (b), a##end = (c); a <= a##end; ++a) #define DEP(a, b, c) for (register int a = (b), a##end = (c); a >= a##end; --a) const int MAXN = 2...
#include <bits/stdc++.h> #define ui unsigned int #define ll long long #define db double #define ld long double #define ull unsigned long long #define REP(a, b, c) for (register int a = (b), a##end = (c); a <= a##end; ++a) #define DEP(a, b, c) for (register int a = (b), a##end = (c); a >= a##end; --a) const int MAXN = 2...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, ...
1
483
#include <stdio.h> #include <stdlib.h> #define SKWRCNT 100 int sv, sc, sl[SKWRCNT]; int ic; void read(void) { int i; if (scanf("%d", &sv) != 1) exit(EXIT_FAILURE); for (sc = 2 * sv, i = 0; i < sc; ++i) if (scanf("%d", &sl[i]) != 1) exit(EXIT_FAILURE); } int comp(const void *v0, const void *v1) ...
#include <stdio.h> #include <stdlib.h> #define SRVGCNT 100 #define SKWRCNT (2 * SRVGCNT) int sv, sc, sl[SKWRCNT]; int ic; void read(void) { int i; if (scanf("%d", &sv) != 1) exit(EXIT_FAILURE); for (sc = 2 * sv, i = 0; i < sc; ++i) if (scanf("%d", &sl[i]) != 1) exit(EXIT_FAILURE); } int comp(co...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
0
280
// A.cpp // Created on 2018-09-23 09:29 #include <algorithm> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <vector> #define f(i, st, ed) for (int i = st; i <= ed; i++) #define fd(i, st, ed) for (int i = st; i >= ed; i--) #define mem(a, b) me...
// A.cpp // Created on 2018-09-23 09:29 #include <algorithm> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <vector> #define f(i, st, ed) for (int i = st; i <= ed; i++) #define fd(i, st, ed) for (int i = st; i >= ed; i--) #define mem(a, b) me...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0...
1
256
#include <algorithm> #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int n; cin >> n; int l[n]; for (int i = 0; i < n * 2; i++) { cin >> l[i]; } sort(l, l + n * 2); int sum = 0; for (int k = 0; k < n; k++) { sum = k * 2 + 1; } cout << sum << endl;...
#include <algorithm> #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int n; cin >> n; int l[n * 2]; for (int i = 0; i < n * 2; i++) { cin >> l[i]; } sort(l, l + n * 2); int sum = 0; for (int k = 0; k < n; k++) { sum = sum + l[k * 2]; } cout << sum...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 70], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 8, 9, 0,...
1
102
#include <bits/stdc++.h> using namespace std; const int N = 105; int n, a[N]; int main() { cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; sort(a + 1, a + 1 + n); int ans = 0; for (int i = 1; i <= n; i += 2) ans += a[i]; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 205; int n, a[N]; int main() { cin >> n; for (int i = 1; i <= n * 2; ++i) cin >> a[i]; sort(a + 1, a + 1 + n * 2); int ans = 0; for (int i = 1; i <= n * 2; i += 2) ans += a[i]; cout << ans << endl; return 0; }
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 12, 13]]
1
100
#include <algorithm> #include <cmath> #include <complex> #include <cstdlib> #include <functional> #include <iostream> using namespace std; int main() { int n, l[100], i, s = 0; bool flag[200] = {}; cin >> n; for (i = 0; i < 2 * n; i++) { cin >> l[i]; } sort(l, l + 2 * n); for (i = 0; i < n; i++) { ...
#include <algorithm> #include <cmath> #include <complex> #include <cstdlib> #include <functional> #include <iostream> using namespace std; int main() { int n, l[200], i, s = 0; cin >> n; for (i = 0; i < 2 * n; i++) { cin >> l[i]; } sort(l, l + 2 * n); for (i = 0; i < n; i++) s += l[i * 2]; cout ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 49, 22], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 0, 70], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 0, 73], ["-", 0, 14, 8, 9...
1
117
#include <iostream> using namespace std; int main() { int n; cin >> n; int ans = 0; int arr[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> arr[i]; for (int i = 0; i < 2 * n; i++) { if (i % 2 == 0) ans += arr[i]; } cout << ans << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int ans = 0; int arr[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> arr[i]; sort(arr, arr + 2 * n); for (int i = 0; i < 2 * n; i++) { if (i % 2 == 0) ans += arr[i]; } cout << ans << endl; }
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 0, 14, 8, 9, 0, 7, 8, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 3...
1
94
/////////////////////////////////////////////////////////////// //__________________________________________________________// // \\\\\\\\\\\---------------------------------------------// // // __ __ // // // \\\\\\\\ |. \ / .| ///////// // // ////...
/////////////////////////////////////////////////////////////// //__________________________________________________________// // \\\\\\\\\\\---------------------------------------------// // // __ __ // // // \\\\\\\\ |. \ / .| ///////// // // ////...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
361
count = gets.to_i row = gets.split(" ") puts row.sort!.map!.with_index{|v,i| v.to_i if i.even?}.compact!.inject(0){|i,sum|sum += i}
count = gets.to_i row = gets.split(" ").map!{|i|i.to_i} puts row.sort!.map!.with_index{|v,i| v.to_i if i.even?}.compact!.inject(0){|i,sum|sum += i}
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 0, 493, 0, 662, 12, 652, 196, 196, 0, 45], ["+", 0, 662, 12, 652, 196, 196, 54, 758, 0, 139], ["+", 0, 662, 12, 652, 196, 196, 54, 758, 0, 22], ["+", 12, 652, 196, 196, 8, 734, 0, 652, 486, 22], ["+", 12, 652, 196, ...
4
54
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> a[i]; int sum = 0; for (int i = 0; i < n; i++) sum += a[2 * i]; cout << sum << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> a[i]; int sum = 0; sort(a, a + 2 * n); for (int i = 0; i < n; i++) sum += a[2 * i]; cout << sum << endl; }
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 16,...
1
84
puts $<.read.split.map(&:to_i).drop(1).sort.each_slice(2).inject{|(a,_),s|s+a}
puts $<.read.split.map(&:to_i).drop(1).sort.each_slice(2).inject(0){|s,(a,_)|s+a}
[["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 3, 4, 0, 652, 196, 196, 54, 758, 0, 22], ["+", 3, 4, 0, 652, 196, 196, 54, 758, 0, 21], ["-", 3, 4, 0, 652, 196, 196, 54, 758, 0, 21], ["-", 3, 4, 0, 652, 196, 196, 54, 758, 0, 22]]
4
40
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int n, a[102], cnt = 0; int main() { scanf("%d", &n); for (int i = 1; i <= 2 * n; i++) scanf("%d", &a[i]); sort(a + 1, a + 2 * n + 1); for (int i = 1; i <= 2 * n - 1; i += 2) cnt += a[i]; printf("%d", cnt); return 0; }
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int n, a[202], cnt = 0; int main() { scanf("%d", &n); for (int i = 1; i <= 2 * n; i++) scanf("%d", &a[i]); sort(a + 1, a + 2 * n + 1); for (int i = 1; i <= 2 * n - 1; i += 2) cnt += min(a[i], a[i + 1]); printf("%d", cnt); ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 7, 8, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4,...
1
120
#include <cstdio> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define FOR(i, b, e) for (int i = (b); i <= (int)(e); i++) typedef long long ll; //------------------------------------------------------------------------------ int extgcd(int a, int b, int &x, int &y) { int ret = a; if...
#include <cstdio> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define FOR(i, b, e) for (int i = (b); i <= (int)(e); i++) typedef long long ll; //------------------------------------------------------------------------------ int extgcd(int a, int b, int &x, int &y) { int ret = a; if...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["-", 12, 2, 3, ...
1
426
H, W, A, B = gets.split.map(&:to_i) MOD = 1_000_000_007 def extended_gcd(a, b) r0, r = a.abs, b.abs x, x0, y, y0 = 0, 1, 1, 0 while r != 0 r0, (q, r) = r, r0.divmod(r) x, x0 = x0 - q*x, x y, y0 = y0 - q*y, y end [r0, x0 * (a < 0 ? -1 : 1)] end def mod_inv(n) g, x = extended_gcd(n, MOD) x %...
H, W, A, B = gets.split.map(&:to_i) MOD = 1_000_000_007 def extended_gcd(a, b) r0, r = a.abs, b.abs x, x0, y, y0 = 0, 1, 1, 0 while r != 0 r0, (q, r) = r, r0.divmod(r) x, x0 = x0 - q*x, x y, y0 = y0 - q*y, y end [r0, x0 * (a < 0 ? -1 : 1)] end def mod_inv(n) g, x = extended_gcd(n, MOD) x % M...
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 777], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 70], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 612], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 21], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 73], ["+", 36, 36, 36, 36, 36, 36, 0, 493...
4
327
#include <iostream> using namespace std; const int M = 1e9 + 7; long int power(long int x, long int n, long int M) { long int res = 1; if (n > 0) { res = power(x, n / 2, M); if (n % 2 == 0) res = (res * res) % M; else res = (((res * res) % M) * x) % M; } return res; } int main() { i...
#include <iostream> using namespace std; const int M = 1e9 + 7; long long int power(long long int x, long long int n, long long int M) { long long int res = 1; if (n > 0) { res = power(x, n / 2, M); if (n % 2 == 0) res = (res * res) % M; else res = (((res * res) % M) * x) % M; } return...
[["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, ...
1
316
#include <iostream> #include <string> #define int long long using namespace std; const int MOD = 1e9 + 7; int pot(int x, int p) { if (p == 0) return 1; int z = pot(x, p / 2); z = (z * z) % MOD; if (p % 2) z = (z * x) % MOD; return z; } int inv(int x) { return pot(x, MOD - 2); } int pows[20000 + 10]...
#include <iostream> #include <string> #define int long long using namespace std; const int MOD = 1e9 + 7; int pot(int x, int p) { if (p == 0) return 1; int z = pot(x, p / 2); z = (z * z) % MOD; if (p % 2) z = (z * x) % MOD; return z; } int inv(int x) { return pot(x, MOD - 2); } const int MAX = 10000...
[["+", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", ...
1
319
# Try AtCoder # author: Leonardone @ NEETSDKASU ############################################################ def gs() gets.chomp end def gi() gets.to_i end def gf() gets.to_f end def gss() gs.split end def gis() gss.map(&:to_i) end def nmapf(n,f) n.times.map{ __send__ f } end def ngs(n) nmapf n,:gs end def ngi(n) nmapf...
# AtCoder My Practice # author: Leonardone @ NEETSDKASU ############################################################ def gs() gets.chomp end def gi() gets.to_i end def gf() gets.to_f end def gss() gs.split end def gis() gss.map(&:to_i) end def nmapf(n,f) n.times.map{ __send__ f } end def ngs(n) nmapf n,:gs end def ngi(...
[["+", 0, 662, 12, 652, 3, 4, 0, 742, 500, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 742, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 742, 0, 73], ["+", 0, 662, 12, 738, 31, 739, 0, 738, 17, 48], ["+", 12, 738, 31, 739, 0, 738, 12, 742, 500, 22], ["+", 12, 738, 31, 739, 0, 738, 12, 742, 0, 70], ["+", 12, 738, 31, 739, 0, 738, 1...
4
514
#define q(x, y) (f[x] * h[y] % m * h[(x) - (y)] % m) const z = 2e5, m = 1e9 + 7; long long H, W, A, B, i = 2, f[1 << 18], g[1 << 18], h[1 << 18], r; main() { for (f[1] = g[1] = 1; i < z; i++) f[i] = f[i - 1] * i % m, g[i] = g[m % i] * (m - m / i) % m; for (h[0] = i = 1; i < z; i++) h[i] = h[i - 1] * g[i] % ...
#define q(x, y) (f[x] * h[y] % m * h[(x) - (y)] % m) long long H, W, A, B, i = 2, f[1 << 18], g[1 << 18], h[1 << 18], r, z = 2e5, m = 1e9 + 7; main() { for (f[0] = f[1] = g[1] = 1; i < z; i++) f[i] = f[i - 1] * i % m, g[i] = g[m % i] * (m - m / i) % m; for (h[0] = i = 1; i < z; i++) h[...
[["-", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 36, 36, 0, 30, 0, 43, 39, 78, 0, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["-", 0...
0
244
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <vector> #pragma warning(disable : 4996) #define mod 1000000007 using namespace std; int H, W, A, B, fact[111111], inv[111111], factinv[111111], z[111111]; inline int ncr(int xx, int yy) { if ...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <vector> #pragma warning(disable : 4996) #define mod 1000000007 using namespace std; int H, W, A, B, fact[222222], inv[222222], factinv[222222], z[222222]; inline int ncr(int xx, int yy) { if ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
326
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; sort(a, a + n); for (int i = 0; i < n - 1; i += 2) { ans += min(a[i], a[i + 1]); } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> a[i]; int ans = 0; sort(a, a + 2 * n); for (int i = 0; i < 2 * n; i += 2) { ans += min(a[i], a[i + 1]); } cout << ans; return 0; }
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, ...
1
103
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int n; cin >> n; vector<int> l(n * 2); rep(i, 2 * n) { cin >> l[i]; } int sum = 0; rep(i, 2 * n) { if (i % 2 == 0) sum += l[i]; } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int n; cin >> n; vector<int> l(n * 2); rep(i, 2 * n) { cin >> l[i]; } int sum = 0; sort(l.begin(), l.end()); rep(i, 2 * n) { if (i % 2 == 0) sum += l[i]; } cout << ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]...
1
101
#include <bits/stdc++.h> using namespace std; int n, a[110], s = 0; int main() { cin >> n; for (int i = 1; i <= 2 * n; i++) cin >> a[i]; sort(a + 1, a + 2 * n + 1); for (int i = 1; i <= 2 * n; i += 2) s += a[i]; cout << s; return 0; }
#include <bits/stdc++.h> using namespace std; int a[501] = {}, s = 0, n; int main() { cin >> n; for (int i = 1; i <= 2 * n; i++) cin >> a[i]; sort(a + 1, a + 2 * n + 1); for (int i = 1; i <= 2 * n; i++) if (i % 2 == 1) s += a[i]; cout << s; return 0; }
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 46], ["+", 36...
1
97
n=int(input()) a=map(int,input().split()) ans=0 for i in range(0,2*n,2): ans+=a[i+1] print(ans)
n=int(input()) a=list(map(int,input().split())) a.sort() ans=0 for i in range(0,2*n,2): ans+=a[i] print(ans)
[["+", 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, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 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], ["+"...
5
51
//#pragma GCC optimize "trapv" #include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define debug(x) cout << '>' << #x << ':' << x << endl; #define rep(i, n) for (int i = 0; i < n; i++) #define reps(i, n) for (int i = 1; i <= n; i++) #define make_unique(v) ...
//#pragma GCC optimize "trapv" #include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define debug(x) cout << '>' << #x << ':' << x << endl; #define rep(i, n) for (int i = 0; i < n; i++) #define reps(i, n) for (int i = 1; i <= n; i++) #define make_unique(v) ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 49, 22], ["+", 0, 14, 8, 9, 0, 4...
1
555
n = int(input()) arr = list(map(int, input().split())) arr.sort() res = 0 i=0 while i<n: res+=min(arr[i], arr[i+1]) i+=2 print(res)
n = int(input()) arr = list(map(int, input().split())) arr.sort() res = 0 i=0 l = len(arr) while i<l: res+=min(arr[i], arr[i+1]) i+=2 print(res)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 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, 25], ["-", 36, 36, 0, 656, 0, 52, 15, 666, 0, 22], ["+", 36,...
5
64
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int l[101]; int s = 0; cin >> n; n *= 2; for (int i = 0; i < n; i++) cin >> l[i]; sort(l, (l + n)); for (int i = 0; i < n; i++) if (i & 1 == 0) s += l[i]; cout << s << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; short l[201]; int s = 0; cin >> n; n *= 2; for (int i = 0; i < n; i++) cin >> l[i]; sort(l, (l + n)); for (int i = 0; i < n; i += 2) s += l[i]; cout << s << endl; return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 133], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["-", 0, 14, 8, 9, 0, 7, 8, 57, 0, 121], ["-", 8, 9, 0, 7, 8, 57, ...
1
106
#include <bits/stdc++.h> using namespace std; int x[200], n; int main() { freopen("in.txt", "r", stdin); cin >> n; n *= 2; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); int res = 0; for (int i = n % 2; i < n; i += 2) res += x[i]; cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int x[200], n; int main() { // freopen("in.txt", "r", stdin); cin >> n; n *= 2; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); int res = 0; for (int i = n % 2; i < n; i += 2) res += x[i]; cout << res << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
109
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <map> #include <set> #include <vector> using namespace std; #define mp make_pair #define pb push_back #define x first #define y second typedef long long ll; typedef vector<int> vi; typedef pair<int...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <map> #include <set> #include <vector> using namespace std; #define mp make_pair #define pb push_back #define x first #define y second typedef long long ll; typedef vector<int> vi; typedef pair<int...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
202
#include <bits/stdc++.h> #include <ext/hash_map> using namespace std; using namespace __gnu_cxx; #define oo 1e9 #define ll long long #define sc(x) scanf("%d", &x) #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second #define pi acos(-1) #def...
#include <bits/stdc++.h> #include <ext/hash_map> using namespace std; using namespace __gnu_cxx; #define oo 1e9 #define ll long long #define sc(x) scanf("%d", &x) #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second #define pi acos(-1) #def...
[["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 14, 8, 9, 0, 171, 0, 1, 0, 35]]
1
157
#include <algorithm> #include <cstdio> using namespace std; int arr[222]; int main() { int n; for (int i = 0; i < 2 * n; i++) scanf("%d", arr + i); sort(arr, arr + 2 * n); int ans = 0; for (int i = 0; i < 2 * n; i += 2) ans += arr[i]; printf("%d", ans); }
#include <algorithm> #include <cstdio> using namespace std; int arr[222]; int main() { int n; scanf("%d", &n); for (int i = 0; i < 2 * n; i++) scanf("%d", arr + i); sort(arr, arr + 2 * n); int ans = 0; for (int i = 0; i < 2 * n; i += 2) ans += arr[i]; printf("%d", ans); }
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 3...
1
99
#include <bits/stdc++.h> #define x first #define y second #define y0 hi1 #define y1 hi2 #define ll long long #define mp make_pair #define pb push_back #define sqr(a) (a) * (a) #define ld long double #define all(a) (a).begin(), (a).end() using namespace std; const int inf = 2000000000; const int N = 1; int main() { ...
#include <bits/stdc++.h> #define x first #define y second #define y0 hi1 #define y1 hi2 #define ll long long #define mp make_pair #define pb push_back #define sqr(a) (a) * (a) #define ld long double #define all(a) (a).begin(), (a).end() using namespace std; const int inf = 2000000000; const int N = 1; int main() { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, ...
1
165
#include <bits/stdc++.h> using namespace std; int a[5000]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } sort(a, a + n); reverse(a, a + n); int ans = 0; for (int i = 0; i < n; i += 2) { ans += min(a[i], a[i + 1]); } printf("%d\n", ans); return 0;...
#include <bits/stdc++.h> using namespace std; int a[5000]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n * 2; i++) { scanf("%d", &a[i]); } sort(a, a + n + n); reverse(a, a + n + n); int ans = 0; for (int i = 0; i < n * 2; i += 2) { ans += min(a[i], a[i + 1]); } printf("%d\n", a...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]]
1
130
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> a[i]; int s = 0; sort(a, a + 2 * n); for (int i = 0; i < 2 * n; i++) s = s + ((a[i] > a[i + 1]) ? a[i + 1] : a[i]); cout << s; }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> a[i]; int s = 0; sort(a, a + 2 * n); for (int i = 0; i < 2 * n; i += 2) s = (a[i] > a[i + 1]) ? s + a[i + 1] : s + a[i]; cout << s; }
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 12, 13], ["-", 0, 7, 8, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 7, 8, 1, 0, 11, 12, 16, 17, 72], ["-", 12, 16, 12, 23, 0, 41, 15, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 41, 64, 16, 31, 22], ["+", 8, 1, 0, 11, ...
1
120
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define INF 2000000000 #define LINF 9000000000000000000 #define mod 10...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define INF 2000000000 #define LINF 9000000000000000000 #define mod 10...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["+", 0, 14, 8, 9, 0, 7, 8, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 57, 15, 339, 0, 24], ["+", 8, 57, 15, 339, 51,...
1
246
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; vector<int> v(a, a + n); sort(v.begin(), v.end()); int ans = 0; for (int i = 0; i < n; i += 2) ans += min(v[i], v[i + 1]); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[2 * n]; for (int i = 0; i < 2 * n; i++) cin >> a[i]; vector<int> v(a, a + 2 * n); sort(v.begin(), v.end()); int ans = 0; for (int i = 0; i < 2 * n; i += 2) ans += min(v[i], v[i + 1]); cout << ans << endl; }
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 49, 50, 51, 4, 0, 16, 12, 16, 31, 13], ["+", 49, 50, 51, 4, 0, 16, 12, 16, 17, 48]]
1
117
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int l[105]; for (int i = 0; i < 2 * n; i++) { cin >> l[i]; } sort(l, l + 2 * n); int ans = 0; for (int i = 0; i < 2 * n; i++) { if (i % 2 == 0...
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); int l[210]; for (int i = 0; i < 2 * n; i++) { scanf("%d", &l[i]); } sort(l, l + 2 * n); int ans = 0; for (int i = 0; i < 2 * n; i++) { ...
[["-", 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, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["+",...
1
116
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> #define mod 1000000007 #define pa(a, b) make_pair(a, b) #define LL long long int using namespace std; int main() { int n; cin >> n; int ans = 0; int a[300]; for (int i = 0; i < 2 *...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> #define mod 1000000007 #define pa(a, b) make_pair(a, b) #define LL long long int using namespace std; int main() { int n; cin >> n; n *= 2; int ans = 0; int a[300]; for (int i = ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["-", 10, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["-", 10, 43, 49, 50, ...
1
127
#include <bits/stdc++.h> using namespace std; int main() { int n; int arr[n + 5]; for (int i = 1; i <= 2 * n; ++i) { cin >> arr[i]; } sort(arr + 1, arr + 1 + n); int ans = 0; for (int i = 1; i <= n; ++i) { ans += arr[2 * i - 1]; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[(2 * n) + 5]; for (int i = 1; i <= 2 * n; ++i) { cin >> arr[i]; } sort(arr + 1, arr + 1 + 2 * n); int ans = 0; for (int i = 1; i <= n; ++i) { ans += arr[(2 * i) - 1]; // cout << arr[2 * i - 1]; } cout ...
[["+", 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, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 43, 49, 80, 81, 16, 31, 23, 0, 24], ["+", 49, 80, 81, 16, 31, 23, 0, 16, 31, 13], ["+", 49, 80, 81, 16, 31, 23, 0, 16, 17, 48], ["+", 0, 43, 49, 8...
1
100
#include <bits/stdc++.h> using namespace std; int main() { int A[1000], N, ans; cin >> N; for (int i = 0; i < 2 * N; i++) cin >> A[1000]; sort(A, A + 100); for (int i = 0; i <= N; i++) { ans += A[2 * i]; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int A[1000], N, ans = 0; cin >> N; for (int i = 0; i < 2 * N; i++) cin >> A[i]; sort(A, A + N * 2); for (int i = 0; i < N; i++) ans += A[2 * i]; cout << ans << endl; return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 1, 0, 16, 12, 69, 341, 342, 0, 13], ["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["+", 0, 2, 3, 4, 0,...
1
92
#include <stdio.h> #include <stdlib.h> int cmp(const int *a, const int *b) { return *a - *b; } int main(void) { int a[300]; int n, s = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d%d", &a[i], &a[i + n]); qsort(a, 2 * n, sizeof(int), cmp); for (int i = 0; i < 2 * n; i += 2) s += a[i] + a[...
#include <stdio.h> #include <stdlib.h> int cmp(const int *a, const int *b) { return *a - *b; } int main(void) { int a[300]; int n, s = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d%d", &a[i], &a[i + n]); qsort(a, 2 * n, sizeof(int), cmp); for (int i = 0; i < 2 * n; i += 2) s += a[i]; p...
[["-", 0, 7, 8, 1, 0, 11, 12, 16, 17, 72], ["-", 8, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["-", 8, 1, 0, 11, 12, 16, 12, 69, 0, 70], ["-", 0, 11, 12, 16, 12, 69, 71, 16, 31, 22], ["-", 0, 11, 12, 16, 12, 69, 71, 16, 17, 72], ["-", 0, 11, 12, 16, 12, 69, 71, 16, 12, 13], ["-", 8, 1, 0, 11, 12, 16, 12, 69, 0, 73]]
0
150