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 |
|---|---|---|---|---|
n = int(input())
sum(sorted([int(x) for x in input().split()] * 2, reverse = True)[1:n]) | n = int(input())
print(sum(sorted([int(x) for x in input().split()] * 2, reverse = True)[1:n])) | [["+", 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 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<long long> A(N);
rep(i, N) cin >> A[i];
sort(A.begin(), A.end(), greater<long long>());
long long ans = A[0];
int times = (N - 2) / 2;
rep(i, times) ans += (2 * A[i + ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<long long> A(N);
rep(i, N) cin >> A[i];
sort(A.begin(), A.end(), greater<long long>());
long long ans = A[0];
int times = (N - 2) / 2;
rep(i, times) ans += (2 * A[i + ... | [["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 143 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
Integer A[] = new Integer[N];
int ans = 0;
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
Arrays.sort(A, Comparator.reverseOrder());
... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
Integer A[] = new Integer[N];
long ans = 0;
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
Arrays.sort(A, Comparator.reverseOrder());
... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 0, 11, 12, 16, 12, 504, 71, 16, 17, 109], ["+", 0, 11, 12, 16, 12, 504, 71, 16, 17, 85]] | 3 | 143 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
if (n == 2) {
cout << arr[0] << endl;
return 0;
}
sort(arr, arr + n, greater<int>());
long long sum = arr[0];
int i = 1;
int rem = n - 2;
while (rem... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
if (n == 2) {
cout << arr[0] << endl;
return 0;
}
sort(arr, arr + n, greater<long long>());
long long sum = arr[0];
int i = 1;
int rem = n - 2;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 2, 63, 346, 3, 347, 0, 77, 39, 40], ["+", 63, 346, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 158 |
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
print(A)
limit = 0
ans = 0
count = 0
lim = 0
t = N - 1
for i in range(N):
lim = 2
if i == 0:
lim = 1
for j in range(lim):
# print(j)
if t > 0:
ans += A[i]
t -= 1
... | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
limit = 0
ans = 0
count = 0
lim = 0
t = N - 1
for i in range(N):
lim = 2
if i == 0:
lim = 1
for j in range(lim):
if t > 0:
ans += A[i]
t -= 1
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 | 119 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vl;
typedef vector<str> vs;
typedef list<ll> listl;
#define min(A, B) min(static_cast<ll>(A), static_cast<... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vl;
typedef vector<str> vs;
typedef list<ll> listl;
#define min(A, B) min(static_cast<ll>(A), static_cast<... | [["+", 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 | 480 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define pb push_back
#define size(v) (int)v.size()
#define fast \
ios_base::sync_with_stdio(false); ... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define pb push_back
#define size(v) (int)v.size()
#define fast \
ios_base::sync_with_stdio(false); ... | [["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 284 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//ループ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//コンテナ
#define ALL(x) (x).begin(... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//ループ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//コンテナ
#define ALL(x) (x).begin(... | [["-", 8, 9, 0, 43, 49, 50, 51, 27, 17, 68], ["+", 8, 9, 0, 43, 49, 50, 51, 27, 17, 29]] | 1 | 656 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
int main() {
cin >> n;
vector<ll> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
sort(v.rbegin(), v.rend());
ll ans = 0, ptr = 0;
for (int i = 0; i + 1 < n; i++) {
ans += v[ptr];
if (ptr % 2 == 0)
ptr++;
}
cout... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
int main() {
cin >> n;
vector<ll> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
sort(v.rbegin(), v.rend());
ll ans = 0, ptr = 0;
for (int i = 0; i + 1 < n; i++) {
ans += v[ptr];
if (i % 2 == 0)
ptr++;
}
cout <... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]] | 1 | 123 |
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <climits>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <functional>
#incl... | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <climits>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <functional>
#incl... | [["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 85], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 242 |
#include <algorithm>
#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 = arr[N - 1];
int j = arr[N - 2];
for (int i = N - 3; i >= 0;) {
ans += arr[j], --i;
if (i >= 0)
ans += ... | #include <algorithm>
#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 = arr[N - 1];
int j = N - 2;
for (int i = N - 3; i >= 0;) {
ans += arr[j], --i;
if (i >= 0)
ans += arr[j... | [["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]] | 1 | 129 |
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reversre=True)
ans = 0
d = deque(A[0])
for x in A[1:]:
ans += d.popleft()
d.append(x)
d.append(x)
print(ans) | from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
d = deque([A[0]])
for x in A[1:]:
ans += d.popleft()
d.append(x)
d.append(x)
print(ans)
| [["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 634, 0, 70], ["+", 12, 652, 3, 4, 0, 634, 0, 206, 0, 73]] | 5 | 81 |
N = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse = True)
if N == 3:
print(a[0] + a[1])
ans1 = 2*sum(a[0:N//2]) - a[0]
if N%2 == 0:
print(ans1)
if N%2 == 1 and N != 3:
print(ans1 + a[(N+1)//2]) | N = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse = True)
if N == 3:
print(a[0] + a[1])
ans1 = 2*sum(a[0:N//2]) - a[0]
if N%2 == 0:
print(ans1)
if N%2 == 1 and N != 3:
print(ans1 + a[N//2]) | [["-", 0, 657, 12, 206, 206, 657, 31, 23, 0, 24], ["-", 12, 206, 206, 657, 31, 23, 0, 657, 17, 72], ["-", 12, 206, 206, 657, 31, 23, 0, 657, 12, 612], ["-", 0, 657, 12, 206, 206, 657, 31, 23, 0, 25]] | 5 | 108 |
#include <bits/stdc++.h>
int main() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; ++i) {
std::cin >> a[i];
}
std::sort(a.begin(), a.end(), std::greater<int>());
int m = n - 1;
long long ans = a[0];
for (int i = 1; i < n; ++i) {
if (m == 0)
break;
if (m % ... | #include <bits/stdc++.h>
int main() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; ++i) {
std::cin >> a[i];
}
std::sort(a.begin(), a.end(), std::greater<int>());
int m = n - 2;
long long ans = a[0];
for (int i = 1; i < n; ++i) {
if (m == 0)
break;
if (m ==... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 159 |
n = int(input())
a = map(int,input().split())
a = sorted(a)
result = 0
spots = [a.pop()]
for i in range(n):
next = a.pop()
result += spots[i]
spots.append(next)
spots.append(next)
print(result) | n = int(input())
a = map(int,input().split())
a = sorted(a)
result = 0
spots = [a.pop()]
for i in range(n-1):
x = a.pop()
result += spots[i]
spots.append(x)
spots.append(x)
print(result) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 77 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a.rbegin(), a.rend());
long long kotae = 0;
for (int i = 1; i < n; i++) {
kotae += a[i - 1];
}
cout << kotae << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a.rbegin(), a.rend());
long long kotae = 0;
for (int i = 1; i < n; i++) {
kotae += a[i / 2];
}
cout << kotae << endl;
} | [["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 85], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]] | 1 | 106 |
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
ll max_total_comfort(vi xs) {
sort(xs.begin(), xs.end(), greater<int>{});
const int sz = xs.size();
ll ans = xs[0];
for (int i = 1; i < sz / 2; ++i)
ans += 2 * xs[i];
if (sz % 2)
ans += xs[sz - 2];
return a... | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
ll max_total_comfort(vi xs) {
sort(xs.begin(), xs.end(), greater<int>{});
const int sz = xs.size();
ll ans = xs[0];
for (int i = 1; i < sz / 2; ++i)
ans += 2 * xs[i];
if (sz % 2)
ans += xs[sz / 2];
return a... | [["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 85]] | 1 | 172 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PP = pair<int, P>;
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rep0(i, n) for (int i = 0; i < (n); i++)
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
retur... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PP = pair<int, P>;
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rep0(i, n) for (int i = 0; i < (n); i++)
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
retur... | [["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 85], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 306 |
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func main() {
sc.Split(bufio.ScanWords)
n := nextInt()
a := make([]int, n)
for i := 0; i < n; i++ {
a[i] = nextInt()
}
a = risort(a)
if n == 2 {
fmt.Println(a[0])
return
}
var ret int
var tmp []in... | package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func main() {
sc.Split(bufio.ScanWords)
n := nextInt()
a := make([]int, n)
for i := 0; i < n; i++ {
a[i] = nextInt()
}
a = risort(a)
if n == 2 {
fmt.Println(a[0])
return
}
var ret int
var tmp []in... | [["-", 64, 196, 0, 1, 0, 2, 63, 438, 439, 22], ["-", 64, 196, 0, 1, 0, 2, 63, 438, 0, 131], ["-", 64, 196, 0, 1, 0, 2, 63, 438, 119, 120], ["-", 64, 196, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 165]] | 7 | 321 |
def resolver(N, A):
A.sort(reverse=True)
ans = 0
for i, _ in enumerate(A):
if i == 0:
continue
elif i == 1:
ans += A[0]
else:
j = (i // 2) +1
ans += A[j]
return ans
def _resolver(N, A):
A.sort(reverse=True)
circle =... |
def resolver(N, A):
A.sort(reverse=True)
ans = 0
for i, _ in enumerate(A):
if i == 0:
continue
elif i == 1:
ans += A[0]
else:
j = (i // 2)
ans += A[j]
return ans
def _resolver(N, A):
A.sort(reverse=True)
circle = [... | [["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 239 |
n = int(input())
a = list(map(int,input().split()));
a.sort(reverse=True)
com = 0;
for k in range(n-1):
kk = n - (k+1) // 2 - 1
com += a[kk]
print(com); | n = int(input())
a = list(map(int,input().split()));
a.sort()
com = 0;
for k in range(n-1):
kk = n - (k+1) // 2 - 1
com += a[kk]
print(com); | [["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146]] | 5 | 72 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fastio ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fastio ... | [["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 307 |
import heapq
n = int(input())
a = list(map(int, input().split))
a.sort(reverse=True)
ans = 0
heap = []
heapq.heappush(heap, -a[0])
for i in range(1, n):
tmp = heapq.heappop(heap)
tmp *= -1
ans += tmp
heapq.heappush(heap, -a[i])
heapq.heappush(heap, -a[i])
print(ans) | import heapq
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
heap = []
heapq.heappush(heap, -a[0])
for i in range(1, n):
tmp = heapq.heappop(heap)
tmp *= -1
ans += tmp
heapq.heappush(heap, -a[i])
heapq.heappush(heap, -a[i])
print(ans) | [["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 105 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
std::vector<int> v;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
std::vector<int> v;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 190 |
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>... | [["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 48]] | 1 | 269 |
N = int(input())
alist = list(map(int, input().split()))
alist.sort(reverse=True)
sumscore=alist[0]
for n in range(1,int(N/2)):
sumscore = sumscore + alist[n]*2
if N%2==1:
sumscore += alist[n]
print(sumscore) | N = int(input())
alist = list(map(int, input().split()))
alist.sort(reverse=True)
sumscore=alist[0]
for n in range(1,int(N/2)):
sumscore = sumscore + alist[n]*2
if N%2==1:
sumscore += alist[n+1]
print(sumscore) | [["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 81 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d\n", &N);
vector<int> A(N);
for (int i = 0; i < N; i++)
cin >> A[i];
sort(A.begin(), A.end(), greater<int>());
int ans = 0;
for (int i = 1; i <= N; i++) {
ans += A[i / 2];
}
printf("%d\n", ans);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d\n", &N);
vector<int> A(N);
for (int i = 0; i < N; i++)
cin >> A[i];
sort(A.begin(), A.end(), greater<int>());
long long ans = 0;
for (int i = 1; i < N; i++) {
ans += A[i / 2];
}
printf("%lld\n", ans);
return 0;
}... | [["-", 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, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 121 |
# -*- coding: utf-8 -*-
n=int(input())
alist=list(map(int,input().split()))
blist=sorted(alist,reverse=True)
total=0
total+=blist[0]
for i in range(1,int(n/2)):
total+=blist[i]*2
if n%2:
total+=blist[int(n/2)+1]
print(total) | # -*- coding: utf-8 -*-
n=int(input())
alist=list(map(int,input().split()))
blist=sorted(alist,reverse=True)
total=blist[0]
for i in range(1,int(n/2)):
total+=blist[i]*2
if n%2:
total+=blist[int(n/2)]
print(total) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 677, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 90 |
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
ans += A[0]
for i in range(1, N - 1):
ans += A[tmp]
if i % 2 == 0:
tmp += 1
print(ans) | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
ans += A[0]
tmp = 1
for i in range(1, N - 1):
ans += A[tmp]
if i % 2 == 0:
tmp += 1
print(ans) | [["+", 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 | 74 |
#include <bits/stdc++.h>
using namespace std;
bool f(int x, int y) { return x > y; }
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end());
int count = 0;
for (int j = 1; j < n; j++) {
count += v[n - int(floor(j / 2))];
}
cout <... | #include <bits/stdc++.h>
using namespace std;
bool f(int x, int y) { return x > y; }
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end(), f);
long long int count = 0;
for (int j = 1; j < n; j++) {
count += v[int(floor(j / 2))];
}... | [["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33]] | 1 | 129 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException {
// Solution sol = new Solution();
BufferedReader br = new BufferedReader(new InputStreamRea... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException {
// Solution sol = new Solution();
BufferedReader br = new BufferedReader(new InputStreamRea... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 511, 0, 512], ["-", 0, 11, 12, 504, 71, 74, 51, 492, 141, 22], ["+", 0, 11, 12, 504, 71, 74, 51, 492, 141, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 110]] | 3 | 219 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int main() {
int n;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(a.rbegin(), a.rend());
long long ans = 0;
int t = n - 1;
rep(i, n) {
int cnt = 2;
if (0 == i)
cn... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(a.rbegin(), a.rend());
long long ans = 0;
int t = n - 1;
rep(i, n) {
int cnt = 2;
if (0 ==... | [["+", 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]] | 1 | 136 |
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = A[0]
if N%2 == 0:
for i in range(1,int((N/2))):
ans += A[i]*2
else:
for i in range(1,int(N/2)):
ans += A[i]*2
ans += A[N-1]
print(ans)
| N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = A[0]
if N%2 == 0:
for i in range(1,int((N/2))):
ans += A[i]*2
else:
for i in range(1,int(N/2)):
ans += A[i]*2
ans += A[int(N/2)]
print(ans)
| [["+", 0, 1, 0, 677, 12, 206, 206, 652, 63, 22], ["+", 0, 677, 12, 206, 206, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612], ["+", 12, 206, 206, 652, 3, 4, 0, 657, 17, 85], ["+", 12, 206, 206, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 677, 12, 206, 206, 65... | 5 | 108 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
ll n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
ll ans = a[0... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
ll n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
ll ans = a[0... | [["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 164 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)
const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)
const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_... | [["-", 0, 11, 12, 69, 341, 342, 0, 16, 31, 13], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72]] | 1 | 462 |
def main():
n = int(input())
friendliness = [int(x) for x in input().split()]
friendliness.sort(reversed=True)
ans = 0
for i in range(n):
ans += friendliness[i // 2 + 1]
print(ans)
if __name__ == '__main__':
main()
| def main():
n = int(input())
friendliness = [int(x) for x in input().split()]
friendliness.sort(reverse=True)
ans = 0
for i in range(1, n):
ans += friendliness[i // 2]
print(ans)
if __name__ == '__main__':
main()
| [["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 74 |
N,*As=map(int,open(0).read().split());As.sort();print(As[-1]+sum(As[-2-i//2]for i in range(N-1))) | N,*As=map(int,open(0).read().split());As.sort();print(As[-1]+sum(As[-2-i//2]for i in range(N-2))) | [["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 59 |
N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
ans = 0
ans += A[0]
if len(A) % 2 == 0:
tmp = 0
for i in range(1, int((N-2)/2)+1):
tmp += A[i] * 2
else:
tmp = 0
for i in range(1, int((N-1)/2)+1):
tmp += A[i] * 2
tmp -= A[int((N-3)/2)]
ans += tmp
print(ans)
| N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
ans = 0
ans += A[0]
if len(A) % 2 == 0:
tmp = 0
for i in range(1, int((N-2)/2)+1):
tmp += A[i] * 2
else:
tmp = 0
for i in range(1, int((N-1)/2)+1):
tmp += A[i] * 2
tmp -= A[int((N-1)/2)]
ans += tmp
print(ans)
| [["-", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612]] | 5 | 142 |
import sys
import numpy as np
readline = sys.stdin.readline
N = int(input())
A = np.array(readline().split(), np.int64)
A_sort = np.sort(A)[::-1] # 降順ソート
count = 0
limit = 1
t = 1
for i in range(N - 1):
if i == 0:
count += A_sort[0]
else:
count += A_sort[limit]
t += 1
if t % ... | import sys
import numpy as np
readline = sys.stdin.readline
N = int(input())
A = np.array(readline().split(), np.int64)
A_sort = np.sort(A)[::-1] # 降順ソート
count = 0
limit = 1
t = 0
for i in range(N - 1):
if i == 0:
count += A_sort[0]
else:
count += A_sort[limit]
t += 1
if t % ... | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 109 |
N = gets.to_i
a = gets.split(" ").map(&:to_i).sort.reverse
ans = a.shift
(N - 2).times do |i|
ans += a[N - 1 - (i/ 2)]
end
puts ans
| N = gets.to_i
a = gets.split(" ").map(&:to_i).sort.reverse
ans = a.shift
(N - 2).times do |i|
ans += a[(i/ 2)]
end
puts ans
| [["-", 0, 755, 12, 742, 0, 738, 31, 738, 31, 743], ["-", 0, 755, 12, 742, 0, 738, 31, 738, 17, 33], ["-", 0, 755, 12, 742, 0, 738, 31, 738, 12, 612], ["-", 8, 736, 0, 755, 12, 742, 0, 738, 17, 33]] | 4 | 58 |
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846 // pi
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;
#define rep(a, n) for (ll ... | #include <bits/stdc++.h>
#define M_PI 3.14159265358979323846 // pi
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;
#define rep(a, n) for (ll ... | [["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 236 |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int com[N];
bool cmp(int a, int b) { return a > b; }
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> com[i];
sort(com + 1, com + 1 + n, cmp);
int ans = com[1];
int cnt = n - 2;
for (int i = 1;; i++) {
if (... | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int com[N];
bool cmp(int a, int b) { return a > b; }
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> com[i];
sort(com + 1, com + 1 + n, cmp);
long long ans = com[1];
int cnt = n - 2;
for (int i = 2;; i++) {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 165 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end(), greater<int>());
long long int sum = 0;
for (int i = 1; i <= n; i++) {
sum += v[i / 2];
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end(), greater<int>());
long long int sum = 0;
for (int i = 1; i < n; i++) {
sum += v[i / 2];
}
cout << sum << endl;
}
| [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]] | 1 | 111 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <clas... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <clas... | [["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46]] | 1 | 262 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <clas... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <clas... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 262 |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF long long int(1e18 + 1)
#define rep(i, n, m) for (int i = n; i < m; i++)
using namespace std;
int main() {
... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF long long int(1e18 + 1)
#define rep(i, n, m) for (int i = n; i < m; i++)
using namespace std;
int main() {
... | [["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107]] | 1 | 167 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long int> v(n);
for (int i = 0; i < n; ++i)
cin >> v[i];
sort(v.begin(), v.end());
long long int total = 0;
int index = n - 1;
int times = 1;
int count = 1;
int loop = 0;
while (count < n) {
int rema... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long int> v(n);
for (int i = 0; i < n; ++i)
cin >> v[i];
sort(v.begin(), v.end());
long long int total = 0;
int index = n - 1;
int times = 1;
int count = 1;
int loop = 0;
while (count < n) {
int rema... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32]] | 1 | 154 |
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INFint = 1e9 + 1;
const ll INFll = (ll)1e18 + 1;
ll MOD = 1e9 + 7;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i(0); i < N; i++) {
cin >> A[i];
}
sort(A.rbegin(), A.rend());
ll ans(0);
for (int i(0); i < N -... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INFint = 1e9 + 1;
const ll INFll = (ll)1e18 + 1;
ll MOD = 1e9 + 7;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i(0); i < N; i++) {
cin >> A[i];
}
sort(A.rbegin(), A.rend());
ll ans(0);
for (int i(0); i < N -... | [["+", 12, 69, 341, 342, 0, 16, 31, 23, 0, 24], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 69, 341, 342, 0, 16, 31, 23, 0, 25], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 85], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 140 |
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
int main() {
int n;
cin >> n;
vi a(n);
rep(i, 0, n) cin >> a[... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
int main() {
int n;
cin >> n;
vi a(n);
rep(i, 0, n) cin >> a[... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 17, 72], ["-", 51, 16, 12, 23, 0, 16, 12, ... | 1 | 156 |
import heapq
def get_tuple(a, b):
if a > b:
a, b = b, a
return a, b
def main(a, N):
a.sort(reverse=True)
h = []
if N == 1:
comfort = 0
else:
comfort = a[0]
heapq.heappush(h, get_tuple(a[0], a[1]))
heapq.heappush(h, get_tuple(a[0], a[1]))
for i ... | import heapq
def get_tuple(a, b):
if a > b:
a, b = b, a
return -a, b
def main(a, N):
a.sort(reverse=True)
h = []
if N == 1:
comfort = 0
else:
comfort = a[0]
heapq.heappush(h, get_tuple(a[0], a[1]))
heapq.heappush(h, get_tuple(a[0], a[1]))
for i... | [["+", 8, 196, 0, 37, 0, 432, 0, 664, 17, 33], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33]] | 5 | 204 |
#include <bits/stdc++.h>
#define rep(i, x) for (ll i = 0; i < (x); i++)
#define chmax(x, a) \
do { \
x = max(x, a); \
} w... | #include <bits/stdc++.h>
#define rep(i, x) for (ll i = 0; i < (x); i++)
#define chmax(x, a) \
do { \
x = max(x, a); \
} w... | [["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78]] | 1 | 197 |
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
#print(A)
if N%2 == 0:
print(sum(A[:N//2]) * 2 - A[0])
if N%2 == 1:
print(sum(A[:N//2+1]) * 2 - A[0] - A[N//2+1]) | N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
#print(A)
if N%2 == 0:
print(sum(A[:N//2]) * 2 - A[0])
if N%2 == 1:
#print(A[:N//2+1],A[N//2+1])
print(sum(A[:N//2+1]) * 2 - A[0] - A[N//2])
| [["-", 3, 4, 0, 657, 12, 206, 206, 657, 17, 72], ["-", 3, 4, 0, 657, 12, 206, 206, 657, 12, 612]] | 5 | 99 |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF 1000000100
#define rep(i, n) for (int i = 0; i < n; i++)
i... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF 1000000100
#define rep(i, n) for (int i = 0; i < n; i++)
i... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 212 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
long long ans = 0;
for (int i = 1; i < N - 1; i++) {
ans += A[N - i / 2];
}
co... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
long long ans = 0;
for (int i = 1; i < N; i++) {
ans += A[N - 1 - i / 2];
}
co... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 12, 13]] | 1 | 116 |
N=int(input())
a=list(map(int,input().split()))
a.sort()
ans=a[-1]
for i in range(N-2):
ans+=a[-i//2-2]
print(ans) | N=int(input())
a=list(map(int,input().split()))
a.sort()
ans=a[-1]
for i in range(N-2):
ans+=a[-(i//2)-2]
print(ans) | [["+", 12, 206, 206, 657, 31, 664, 28, 23, 0, 24], ["+", 12, 206, 206, 657, 31, 664, 28, 23, 0, 25]] | 5 | 62 |
n = int(input())
li_a = list(map(int,input().split()))
li_a.sort(reverse=True)
ans = li_a[0]
if n % 2 == 0:
for i in range(1,n//2):
ans += 2*li_a[i]
else:
for i in range(1,n//2):
ans += 2*li_a[i]
ans += li_a[n//2+1]
print(ans) | n = int(input())
li_a = list(map(int,input().split()))
li_a.sort(reverse=True)
ans = li_a[0]
if n % 2 == 0:
for i in range(1,n//2):
ans += 2*li_a[i]
else:
for i in range(1,n//2):
ans += 2*li_a[i]
ans += li_a[n//2]
print(ans) | [["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 102 |
n = int(input())
li_a = list(map(int, input().split()))
sum_ = 0
li_a.sort()
for i in range(n-1):
sum_ += li_a[n-1-(i)//2]
print(sum_) | n = int(input())
li_a = list(map(int, input().split()))
sum_ = 0
li_a.sort()
for i in range(1, n):
sum_ += li_a[n-1-i//2]
print(sum_)
| [["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 12, 206, 206, 657, 12, 657, 31, 23, 0, 24], ["-", 12, 206, 206, 657, 12, 657, 31, 23, 0, 25]] | 5 | 61 |
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int, int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
con... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int, int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
con... | [["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 314 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
scanf("%d", &n);
long long int a[n];
for (i = 0; i < n; i++) {
scanf("%lld", &a[i]);
}
sort(a, a + n);
if (n == 2) {
printf("%lld", a[1]);
} else {
long long int sum = 0;
i = 1;
sum += a[n - 1];
int j = 2;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
scanf("%d", &n);
long long int a[n];
for (i = 0; i < n; i++) {
scanf("%lld", &a[i]);
}
sort(a, a + n);
if (n == 2) {
printf("%lld", a[1]);
} else {
long long int sum = 0;
i = 1;
sum += a[n - 1];
int j = 2;
... | [["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 33], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]] | 1 | 187 |
N=int(input())
A=list(map(int, input().split()))
A.sort()
if N==2:
print(A[-1])
exit()
ans=0
for i in range(N-1):
ans+=A[(i-2)//2]
print(ans) | N=int(input())
A=list(map(int, input().split()))
A.sort()
if N==2:
print(A[-1])
exit()
ans=0
for i in range(N-1):
ans+=A[(-i-2)//2]
print(ans) | [["+", 206, 657, 31, 23, 0, 657, 31, 664, 17, 33]] | 5 | 75 |
#include <bits/stdc++.h>
using namespace std;
main() {
long long int n, i;
cin >> n;
long long int a[n];
for (i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
long long int sum = 0, j = 0, br = 1;
vector<long long int> v;
v.push_back(a[n - 1]);
for (i = n - 2; i >= 0; i--) {
v.push_back(a[i]);... | #include <bits/stdc++.h>
using namespace std;
main() {
long long int n, i;
cin >> n;
long long int a[n];
for (i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
long long int sum = 0, j = 0, br = 1;
vector<long long int> v;
v.push_back(a[n - 1]);
for (i = n - 2; i >= 0; i--) {
v.push_back(a[i]);... | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]] | 1 | 155 |
#include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647; // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using ... | #include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647; // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using ... | [["+", 12, 69, 341, 342, 0, 16, 31, 23, 0, 25], ["-", 0, 11, 12, 69, 341, 342, 0, 23, 0, 25]] | 1 | 227 |
#include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647; // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using ... | #include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647; // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using ... | [["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 9, 0, 45], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 69, 341, 342, 0, 16, 31, 23, 0, 25], ["-", 0, 11, 12, 69, 341, 342, 0, 23, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46]] | 1 | 227 |
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
long ans = a[n - 1];
... | import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
long ans = a[n - 1];
... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22]] | 3 | 172 |
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)
ans = 0
for i in range(0, n - 1):
ans += A[(i + 1) // 2]
print(ans) | n = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)
ans = 0
for i in range(0, n - 1):
ans += a_list[(i + 1) // 2]
print(ans) | [["-", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22]] | 5 | 64 |
import copy
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)
d = deque()
c = 0
count = 2
ans = 0
if N == 2:
print(A[0])
elif N == 3:
print(A[0] + A[1])
else:
ans = A[0] + A[1]
for i in range(3, N-1):
if c == 0:
ans += A[count... | # coding: utf-8
# Your code here!
import copy
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)
d = deque()
c = 0
count = 2
ans = 0
if N == 2:
print(A[0])
elif N == 3:
print(A[0] + A[1])
else:
ans = A[0] + A[1]
for i in range(3, N-1):
if... | [["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]] | 5 | 145 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template <class T> constexp... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template <class T> constexp... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 174 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
ll n, a[300000], ans = 0;
cin >> n;
rep(i, n) cin >> a[i];
sort(a, a + n);
for (int i = 1; i < n; i++)
ans += a[i];
// rep(i, n) cout << a[i];
cout << ans << endl;
return 0... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
ll n, a[300000], ans = 0;
cin >> n;
rep(i, n) cin >> a[i];
sort(a, a + n);
for (int i = 1; i < n; i++)
ans += a[n - i / 2 - 1];
// rep(i, n) cout << a[i];
cout << ans << endl... | [["+", 12, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 341, 342, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 341, 342, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 96 |
n=int(input())
arr=list(map(int,input().split()))
arr=sorted(ans,reverse=True)
ans=0
for i in range(1,n):
ans+=arr[i//2]
print(ans) | n=int(input())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True)
ans=0
for i in range(1,n):
ans+=arr[i//2]
print(ans) | [["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]] | 5 | 60 |
import math
N = int(input())
Nlist = list(map(int, input().split()))
Nlist.sort(reverse=True)
x = math.ceil(N/2)
ans = sum(Nlist[0:x])*2-Nlist[0]
if N % 2 != 0:
ans -= Nlist[x]
print(ans)
| import math
N = int(input())
Nlist = list(map(int, input().split()))
Nlist.sort(reverse=True)
x = math.ceil(N/2)
ans = sum(Nlist[0:x])*2-Nlist[0]
if N % 2 != 0:
ans -= Nlist[x-1]
print(ans)
| [["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 80 |
// In the name of God //
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
using namespace std;
const int N = 2e5 + 5;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(all(a));
reverse(all... | // In the name of God //
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
using namespace std;
const int N = 2e5 + 5;
void solve() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(all(a));
reverse(all(... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]] | 1 | 198 |
#include <algorithm>
#include <cstring>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int n;
int a[200010];
bool cmp(int a, int b) { return a > b; }
int main() {
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> a[i];
sort(a + 1, a + n + 1, c... | #include <algorithm>
#include <cstring>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int n;
int a[200010];
bool cmp(int a, int b) { return a > b; }
int main() {
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> a[i];
sort(a + 1, a + n + 1, c... | [["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 33], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13]] | 1 | 167 |
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
if N == 2:
ans = A[0]
elif N == 3:
ans = sum(A[:2])
elif N == 4:
ans = sum(A[:2])+A[1]
elif N == 5:
ans = sum(A[:2])+A[1]+A[2]
elif N == 6:
ans = sum(A[:2])+A[1]+A[2]*2
else:
ans = sum(A[:2])+A[1]+A[2]*2
# print(ans)... | N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
if N == 2:
ans = A[0]
elif N == 3:
ans = sum(A[:2])
elif N == 4:
ans = sum(A[:2])+A[1]
elif N == 5:
ans = sum(A[:2])+A[1]+A[2]
elif N == 6:
ans = sum(A[:2])+A[1]+A[2]*2
else:
ans = sum(A[:2])+A[1]+A[2]*2
# print(ans)... | [["-", 0, 677, 12, 657, 12, 206, 206, 657, 17, 72], ["-", 0, 677, 12, 657, 12, 206, 206, 657, 12, 612]] | 5 | 218 |
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int n;
cin >> n;
int a[n], ans = 0;
for (int i = 0; i < n; ++i)
cin >> a[i];
sort(a, a + n, greater<int>());
ans = a[0];
for (int i = 2, j = 1; i < n; ++i) {
ans += a[j];
if (i % 2 == 0)
++j;
}
cou... | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int n;
cin >> n;
int a[n], ans = 0;
for (int i = 0; i < n; ++i)
cin >> a[i];
sort(a, a + n, greater<int>());
ans = a[0];
for (int i = 2, j = 1; i < n; ++i) {
ans += a[j];
if (i & 1)
++j;
}
cout << a... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 120 |
/*input
7
1 1 1 1 1 1 1
*/
#include <bits/stdc++.h>
#include <unistd.h>
#define rep(i, j, n) for (i = j; i < n; i++)
#define repi(i, j, n) for (i = j; i > n; i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<... | /*input
7
1 1 1 1 1 1 1
*/
#include <bits/stdc++.h>
#include <unistd.h>
#define rep(i, j, n) for (i = j; i < n; i++)
#define repi(i, j, n) for (i = j; i > n; i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<... | [["-", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 374 |
/* -*- coding: utf-8 -*-
*
* d.cc: D - Chat in a Circle
*/
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#i... | /* -*- coding: utf-8 -*-
*
* d.cc: D - Chat in a Circle
*/
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#i... | [["+", 12, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 69, 341, 342, 0, 16, 12, 16, 17, 85], ["+", 12, 69, 341, 342, 0, 16, 12, 16, 12, 13]] | 1 | 155 |
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
for i in range(N-1):
ans += A[i+1//2]
print(ans) | N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
for i in range(N-1):
ans += A[(i+1)//2]
print(ans) | [["+", 0, 677, 12, 206, 206, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 206, 206, 657, 31, 23, 0, 25]] | 5 | 60 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, i, j, cou = 0;
cin >> N;
vector<int> A(N);
for (i = 0; i < N; i++)
cin >> A[i];
sort(A.begin(), A.end());
for (i = 1; i < N; i++)
cou += A[N - i / 2];
cout << cou << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, i, j;
long int cou = 0;
cin >> N;
vector<long int> A(N);
for (i = 0; i < N; i++)
cin >> A[i];
sort(A.begin(), A.end());
for (i = 1; i < N; i++)
cou += A[N - i / 2 - 1];
cout << cou << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 101 |
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
for i in range(1,n):
ans += A[i-1]
print(ans) | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
for i in range(1,n):
ans += A[i//2]
print(ans) | [["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 676], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 120 |
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
sort(a.begin(), a.end(), cmp);
long long ans = 0;
for (int i = 0; i < n; ++i) {
ans += a[i / ... | #include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
sort(a.begin(), a.end(), cmp);
long long ans = a[0];
for (int i = 2; i < n; ++i) {
ans += a[i... | [["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 124 |
#include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a.at(i);
multiset<ll> com;
sort(a.rbegin(), a.rend());
com.insert(a.at(0));
// eq.erase(eq.find... | #include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a.at(i);
multiset<ll> com;
sort(a.rbegin(), a.rend());
com.insert(a.at(0));
// eq.erase(eq.find... | [["-", 49, 50, 51, 66, 28, 2, 63, 118, 119, 120], ["+", 49, 50, 51, 66, 28, 2, 63, 118, 119, 120]] | 1 | 169 |
n = int(input())
l = list(map(int,input().split()))
l_sort = sorted(l,reverse=True)
l_len = len(l)
if(l_len%2==0):
ans = sum(l_sort[:(l_len//2)-1])+sum(l_sort[1:(l_len//2)])+l_sort[(l_len//2)]
else:
ans = sum(l_sort[:(l_len//2)])+sum(l_sort[1:(l_len//2)+1])
print(ans)
| n = int(input())
l = list(map(int,input().split()))
l_sort = sorted(l,reverse=True)
l_len = len(l)
if(l_len%2==0):
ans = sum(l_sort[:(l_len//2)-1])+sum(l_sort[1:(l_len//2)])+l_sort[(l_len//2)-1]
else:
ans = sum(l_sort[:(l_len//2)])+sum(l_sort[1:(l_len//2)+1])
print(ans)
| [["+", 0, 662, 12, 657, 12, 206, 206, 657, 17, 33], ["+", 0, 662, 12, 657, 12, 206, 206, 657, 12, 612]] | 5 | 125 |
n=int(input())
l=list(map(int,input().split()))
l.sort()
sum=l[-1]
for i in range(1,n//2):
sum+=2*l[-1-i]
if n%2!=0:
sum+=l[n//2-1]
print(sum) | n=int(input())
l=list(map(int,input().split()))
l.sort()
sum=l[-1]
for i in range(1,n//2):
sum+=2*l[-1-i]
if n%2!=0:
sum+=l[n//2]
print(sum) | [["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 81 |
#include <bits/stdc++.h>
using namespace std;
struct space {
int count;
int score;
};
int main() {
int n;
cin >> n;
vector<int> data(n);
for (int i = 0; i < n; ++i) {
cin >> data[i];
}
sort(data.begin(), data.end(), greater<int>());
long total = 0;
space sp;
sp.count = 1;
sp.score = data[... | #include <bits/stdc++.h>
using namespace std;
struct space {
int count;
int score;
};
int main() {
int n;
cin >> n;
vector<int> data(n);
for (int i = 0; i < n; ++i) {
cin >> data[i];
}
sort(data.begin(), data.end(), greater<int>());
long total = 0;
space sp;
sp.count = 1;
sp.score = data[... | [["+", 64, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 195 |
#include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp... | #include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 339 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int64_t kokochi = 0LL;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
kokochi += a[0];
if ((n - 1) % 2 == 0) { // nが奇数、心地よさの加算はn-1人分(偶数人)
for (int i =... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int64_t kokochi = 0LL;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
kokochi += a[0];
if ((n - 1) % 2 == 0) { // nが奇数、心地よさの加算はn-1人分(偶数人)
for (int i =... | [["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19]] | 1 | 187 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N, 0);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end(), greater<int>());
int out = 0;
for (int i = 1; i < N + 1; i++) {
int index = i / 2;
out += A[index];
}
cout << out << ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> A(N, 0);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end(), greater<int>());
long long out = 0;
for (int i = 1; i < N; i++) {
int index = i / 2;
out += A[index];
}
cout <<... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 118 |
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
if n%2==0:
print(sum(a[:n//2])*2-a[0])
else:
print(sum(a[:n//2])*2+a[n//2+1]-a[0]) | n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
if n%2==0:
print(sum(a[:n//2])*2-a[0])
else:
print(sum(a[:n//2])*2+a[n//2]-a[0]) | [["-", 0, 657, 31, 657, 12, 206, 206, 657, 17, 72], ["-", 0, 657, 31, 657, 12, 206, 206, 657, 12, 612]] | 5 | 90 |
#include <algorithm>
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main() {
int N;
cin >> N;
int A[N];
for (int i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
sort(A, A + N);
long comfort_sum = 0;
int k = 1;
for (int i = 0; i < N; i++) {
comfort_sum += A[N - k]... | #include <algorithm>
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main() {
int N;
cin >> N;
int A[N];
for (int i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
sort(A, A + N);
long comfort_sum = 0;
int k = 1;
for (int i = 0; i < N - 1; i++) {
comfort_sum += A[N ... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 122 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, *A;
long int total = 0;
cin >> N;
A = new int[N];
for (int i = 0; i < N; i++)
cin >> A[i];
sort(A, A + N);
total = A[N - 1];
int i = 0;
for (i = 0; i < (N - 2) / 2; i++)
total += A[N - 2 - i] * 2;
if (N % 2 ==... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, *A;
long int total = 0;
cin >> N;
A = new int[N];
for (int i = 0; i < N; i++)
cin >> A[i];
sort(A, A + N);
total = A[N - 1];
int i = 0;
for (i = 0; i < (N - 2) / 2; i++)
total += A[N - 2 - i] * 2;
if (N % 2 ==... | [["-", 12, 69, 341, 342, 0, 16, 31, 16, 12, 13], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 12, 13]] | 1 | 142 |
def readinput():
n=int(input())
a=list(map(int,input().split()))
return n,a
def main(n,a):
#print(a)
a.sort(reverse=True)
#print(a)
sum=a[0]
j=1
k=1
for i in range(2,n):
sum+=a[k]
j+=1
if j==2:
j=0
k+=1
return sum
if __name__=... | def readinput():
n=int(input())
a=list(map(int,input().split()))
return n,a
def main(n,a):
#print(a)
a.sort(reverse=True)
#print(a)
sum=a[0]
j=0
k=1
for i in range(2,n):
sum+=a[k]
#print(a[k])
j+=1
if j==2:
j=0
k+=1
ret... | [["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]] | 5 | 122 |
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
if N % 2 == 0:
d = int(N/2)
print(A[0] + 2 * sum(A[1:d]))
else:
b = int((N-1)/2)
c = int((N-1)/2)
print(b,c)
print(A[0] + 2 * sum(A[1:b]) + A[c])
| N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
if N % 2 == 0:
d = int(N/2)
print(A[0] + 2 * sum(A[1:d]))
else:
b = int((N-1)/2)
c = int((N-1)/2)
print(A[0] + 2 * sum(A[1:b]) + A[c]) | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 123 |
N = int(input())
s = input().split()
A = []
for i in range(N):
A.append(int(s[i]))
result = 0
A.sort(reverse=True)
result += A[0]
A.pop(0)
if N % 2 == 0:
result += sum(A[:(int(N/2)-1)])*2
else:
result += (sum(A[:(int((N-1)/2)-1)])*2 + A[int((N-1)/2)])
print(result) | N = int(input())
s = input().split()
A = []
for i in range(N):
A.append(int(s[i]))
result = 0
A.sort(reverse=True)
result += A[0]
A.pop(0)
if N % 2 == 0:
result += sum(A[:(int(N/2)-1)])*2
else:
result += (sum(A[:(int((N-1)/2)-1)])*2 + A[int((N-1)/2)-1])
print(result) | [["+", 12, 23, 0, 657, 12, 206, 206, 657, 17, 33], ["+", 12, 23, 0, 657, 12, 206, 206, 657, 12, 612]] | 5 | 139 |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// typedef int ll;
typedef long double ld;
#define int ll
#define pb push_back
#define __bp __builtin_popcount
using vint = vector<int>;
using pii = pair<int, int>;
using pdd = pair<ld, ld>;
using vpii = vector<pii>;
#define F first
#define S second
co... | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// typedef int ll;
typedef long double ld;
#define int ll
#define pb push_back
#define __bp __builtin_popcount
using vint = vector<int>;
using pii = pair<int, int>;
using pdd = pair<ld, ld>;
using vpii = vector<pii>;
#define F first
#define S second
co... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 22]] | 1 | 251 |
import sys
import numpy as np
readline = sys.stdin.readline
read = sys.stdin.read
n = int(input())
a = np.array(readline().split(), dtype=np.int64)
a.sort()
a = a[::-1]
m = -(-n//2)
ans = np.sum(a[:m])*2 - a[0] if n % 2 == 0 else np.sum(a[:m])*2 - a[0] - a[m]
print(ans) | import sys
import numpy as np
readline = sys.stdin.readline
read = sys.stdin.read
n = int(input())
a = np.array(readline().split(), dtype=np.int64)
a.sort()
a = a[::-1]
m = -(-n//2)
ans = np.sum(a[:m])*2 - a[0] if n % 2 == 0 else np.sum(a[:m])*2 - a[0] - a[m-1]
print(ans) | [["+", 12, 41, 0, 657, 12, 206, 206, 657, 17, 33], ["+", 12, 41, 0, 657, 12, 206, 206, 657, 12, 612]] | 5 | 123 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
long long MOD = 1000000000 + 7;
int main() {
cout << setprecision(10);
int N;
cin >> N;
vector<ll> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.rbegin(), A.rend());
int index = 0;
bool... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
long long MOD = 1000000000 + 7;
int main() {
cout << setprecision(10);
int N;
cin >> N;
vector<ll> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.rbegin(), A.rend());
int index = 0;
bool... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 146]] | 1 | 195 |
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = Long.parseLong(sc.next());
List<Long> list = new ArrayList();
long total = 0L;
for (long ... | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = Long.parseLong(sc.next());
List<Long> list = new ArrayList();
long total = 0L;
for (long ... | [["-", 3, 4, 0, 74, 51, 23, 0, 16, 17, 72], ["-", 3, 4, 0, 74, 51, 23, 0, 16, 12, 499]] | 3 | 220 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
ll gcd(ll a, ll b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
ll max(ll a, ll b) {
if (a > b)
return a;
else
return b;
}
ll min(ll a, ll b) {
if (a < ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
ll gcd(ll a, ll b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
ll max(ll a, ll b) {
if (a > b)
return a;
else
return b;
}
ll min(ll a, ll b) {
if (a < ... | [["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 329 |
s=0
N=int(input())
L=list(map(int,input().split()))
L=sorted(L,reverse=True)
if N%2==0:
s+=L[0]
s+=2*sum(L[1:N//2])
else:
s+=L[0]
s+=2*sum(L[1:(N+1)//2])-L[(N+1)//2]
print(s) | s=0
N=int(input())
L=list(map(int,input().split()))
L=sorted(L,reverse=True)
if N%2==0:
s+=L[0]
s+=2*sum(L[1:N//2])
else:
s+=L[0]
s+=2*sum(L[1:(N+1)//2])-L[((N+1)//2)-1]
print(s) | [["+", 206, 657, 31, 23, 0, 657, 31, 23, 0, 24], ["+", 12, 657, 12, 206, 206, 657, 31, 23, 0, 25], ["+", 0, 677, 12, 657, 12, 206, 206, 657, 17, 33], ["+", 0, 677, 12, 657, 12, 206, 206, 657, 12, 612]] | 5 | 108 |
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n); ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007
void solve() {
int n;
cin >> n;
vector<int> v(n);
lp(i, n) cin >> v[i];
sort(all(v));
reverse(all(v));... | #include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n); ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007
void solve() {
int n;
cin >> n;
vector<int> v(n);
lp(i, n) cin >> v[i];
sort(all(v));
reverse(all(v));... | [["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.