submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s465948412 | p03767 | C++ | #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<int> v(3*N);
rep(i, N) cin >> v.at(i);
sort(v.begin(), v.end(), greater<int>());
rep (i, N){
int sum += v.at(2*N);
}
cout << sum << endl;
} | a.cc:5:5: error: cannot declare '::main' to be a global variable
5 | int main{
| ^~~~
a.cc:6:9: error: expected primary-expression before 'int'
6 | int N;
| ^~~
a.cc:6:9: error: expected '}' before 'int'
a.cc:5:9: note: to match this '{'
5 | int main{
| ^
a.cc:7:5: error: 'cin' does not name a type
7 | cin >> N;
| ^~~
a.cc:8:21: error: 'N' was not declared in this scope
8 | vector<int> v(3*N);
| ^
a.cc:3:19: error: expected unqualified-id before 'for'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^~~
a.cc:9:5: note: in expansion of macro 'rep'
9 | rep(i, N) cin >> v.at(i);
| ^~~
a.cc:9:9: error: 'i' does not name a type
9 | rep(i, N) cin >> v.at(i);
| ^
a.cc:3:34: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:9:9: error: 'i' does not name a type
9 | rep(i, N) cin >> v.at(i);
| ^
a.cc:3:48: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:11:9: error: expected constructor, destructor, or type conversion before '(' token
11 | sort(v.begin(), v.end(), greater<int>());
| ^
a.cc:3:19: error: expected unqualified-id before 'for'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^~~
a.cc:12:5: note: in expansion of macro 'rep'
12 | rep (i, N){
| ^~~
a.cc:12:10: error: 'i' does not name a type
12 | rep (i, N){
| ^
a.cc:3:34: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:12:10: error: 'i' does not name a type
12 | rep (i, N){
| ^
a.cc:3:48: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:15:5: error: 'cout' does not name a type
15 | cout << sum << endl;
| ^~~~
a.cc:16:1: error: expected declaration before '}' token
16 | }
| ^
|
s034049640 | p03767 | C++ | #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<int> v(3*N);
rep(i, N) cin >> v.at(i);
sort(v.begin(), v.end(), greater<int>());
rep (i, N){
int sum += v.at(2*N);
}
cout << sum << endl;
} | a.cc:5:5: error: cannot declare '::main' to be a global variable
5 | int main{
| ^~~~
a.cc:6:9: error: expected primary-expression before 'int'
6 | int N;
| ^~~
a.cc:6:9: error: expected '}' before 'int'
a.cc:5:9: note: to match this '{'
5 | int main{
| ^
a.cc:7:5: error: 'cin' does not name a type
7 | cin >> N;
| ^~~
a.cc:8:21: error: 'N' was not declared in this scope
8 | vector<int> v(3*N);
| ^
a.cc:3:19: error: expected unqualified-id before 'for'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^~~
a.cc:9:5: note: in expansion of macro 'rep'
9 | rep(i, N) cin >> v.at(i);
| ^~~
a.cc:9:9: error: 'i' does not name a type
9 | rep(i, N) cin >> v.at(i);
| ^
a.cc:3:34: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:9:9: error: 'i' does not name a type
9 | rep(i, N) cin >> v.at(i);
| ^
a.cc:3:48: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:11:9: error: expected constructor, destructor, or type conversion before '(' token
11 | sort(v.begin(), v.end(), greater<int>());
| ^
a.cc:3:19: error: expected unqualified-id before 'for'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^~~
a.cc:12:5: note: in expansion of macro 'rep'
12 | rep (i, N){
| ^~~
a.cc:12:10: error: 'i' does not name a type
12 | rep (i, N){
| ^
a.cc:3:34: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:12:10: error: 'i' does not name a type
12 | rep (i, N){
| ^
a.cc:3:48: note: in definition of macro 'rep'
3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:15:5: error: 'cout' does not name a type
15 | cout << sum << endl;
| ^~~~
a.cc:16:1: error: expected declaration before '}' token
16 | }
| ^
|
s102333493 | p03767 | C++ | n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
ans += a[-(i+1)*2]
print(ans)
| a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s051286906 | p03767 | C++ | #include <bits/stdc++.h>
#include <vector>
#include <iostream>
using namespace std;
int main() {
int N;
cin >>N;
vector<int> vec(3*N);
for(int i=0;i < 3*N;i++){
cin >>vec[i];
}
int sum =0;
for(int i=0;i < 3*N;i++){
for(int j=0;j < 3*N && i != j;j++){
for(int k=0;k < 3*N && k != i && k != j;k++){
if((vec[i] <= vec[j] && vec[j] <= vec[k]) || (vec[k] <= vec[j] && vec[j] <= vec[i])){
sum += vec[j];
vec.erace(vec.begin()+j);
}
else if ((vec[i] <= vec[k] && vec[k] <= vec[j]) || (vec[j] <= vec[k] && vec[k] <= vec[i])){
sum += vec[k];
vec.erace(vec.begin()+k);
}
else{
sum += vec[i];
vec.erace(vec.begin()+i);
}
}
}
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:19:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
19 | vec.erace(vec.begin()+j);
| ^~~~~
| erase
a.cc:23:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
23 | vec.erace(vec.begin()+k);
| ^~~~~
| erase
a.cc:27:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
27 | vec.erace(vec.begin()+i);
| ^~~~~
| erase
|
s752277674 | p03767 | C++ | #include <bits/stdc++.h>
#include <vector>
using namespace std;
int main() {
int N;
cin >>N;
vector<int> vec(3*N);
for(int i=0;i < 3*N;i++){
cin >>vec[i];
}
int sum =0;
for(int i=0;i < 3*N;i++){
for(int j=0;j < 3*N && i != j;j++){
for(int k=0;k < 3*N && k != i && k != j;k++){
if((vec[i] <= vec[j] && vec[j] <= vec[k]) || (vec[k] <= vec[j] && vec[j] <= vec[i])){
sum += vec[j];
vec.erace(vec.begin()+j);
}
else if ((vec[i] <= vec[k] && vec[k] <= vec[j]) || (vec[j] <= vec[k] && vec[k] <= vec[i])){
sum += vec[k];
vec.erace(vec.begin()+k);
}
else{
sum += vec[i];
vec.erace(vec.begin()+i);
}
}
}
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:18:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
18 | vec.erace(vec.begin()+j);
| ^~~~~
| erase
a.cc:22:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
22 | vec.erace(vec.begin()+k);
| ^~~~~
| erase
a.cc:26:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
26 | vec.erace(vec.begin()+i);
| ^~~~~
| erase
|
s799449529 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >>N;
vector<int> vec(3*N);
for(int i=0;i < 3*N;i++){
cin >>vec[i];
}
int sum =0;
for(int i=0;i < 3*N;i++){
for(int j=0;j < 3*N && i != j;j++){
for(int k=0;k < 3*N && k != i && k != j;k++){
if((vec[i] <= vec[j] && vec[j] <= vec[k]) || (vec[k] <= vec[j] && vec[j] <= vec[i])){
sum += vec[j];
vec.erace(vec.begin()+j);
}
else if ((vec[i] <= vec[k] && vec[k] <= vec[j]) || (vec[j] <= vec[k] && vec[k] <= vec[i])){
sum += vec[k];
vec.erace(vec.begin()+k);
}
else{
sum += vec[i];
vec.erace(vec.begin()+i);
}
}
}
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:17:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
17 | vec.erace(vec.begin()+j);
| ^~~~~
| erase
a.cc:21:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
21 | vec.erace(vec.begin()+k);
| ^~~~~
| erase
a.cc:25:15: error: 'class std::vector<int>' has no member named 'erace'; did you mean 'erase'?
25 | vec.erace(vec.begin()+i);
| ^~~~~
| erase
|
s649737554 | p03767 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
int main() {
int n, a;
cin >> n;
vector<int> input(n*3);
for (int i=0; i<n*3; ++i) {
cin >> a;
input[i] = a;
}
sort(input.begin(), input.end());
ll sum = 0;
for (int i=n; i<n*3; i+=2) {
sum += input[i];
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:11:5: error: 'vector' was not declared in this scope
11 | vector<int> input(n*3);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include<algorithm>
+++ |+#include <vector>
3 |
a.cc:11:12: error: expected primary-expression before 'int'
11 | vector<int> input(n*3);
| ^~~
a.cc:14:9: error: 'input' was not declared in this scope; did you mean 'int'?
14 | input[i] = a;
| ^~~~~
| int
a.cc:16:10: error: 'input' was not declared in this scope; did you mean 'int'?
16 | sort(input.begin(), input.end());
| ^~~~~
| int
|
s160105531 | p03767 | C++ | #include <iostream>
#
using namespace std;
int main(){
int n;
cin>>n;
int a[3*n];
for(int i=0;i<3*n;i++){
cin>>a[i];
}
int sum=0;
for(int i=0;i<n;i++){
sort(a+3*i,a+3*i+2);
sum+=a[3*i+1];
}
cout<<sum<<endl;
}
| a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
15 | sort(a+3*i,a+3*i+2);
| ^~~~
| short
|
s358226221 | p03767 | C++ | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
ll N,A; cin >> N;
ll sum = 0;
vector<ll> array;
for(ll i = 0;i < N*3;i++){
cin >> A;
array.push_back(A);
}
sort(array.begin(),array.end());
for(int i = 1; i < 2*n+1; i += 2) sum += a[i];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:15:26: error: 'n' was not declared in this scope
15 | for(int i = 1; i < 2*n+1; i += 2) sum += a[i];
| ^
a.cc:15:46: error: 'a' was not declared in this scope
15 | for(int i = 1; i < 2*n+1; i += 2) sum += a[i];
| ^
|
s345301329 | p03767 | C++ | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
ll N,A; cin >> N;
ll sum = 0;
vector<ll> array;
for(ll i = 0;i < N*3;i++){
cin >> A;
array.push_back(A);
}
sort(array.begin(),array.end());
for(int i = 1; i < 2*n+1; i += 2) ans += a[i];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:15:26: error: 'n' was not declared in this scope
15 | for(int i = 1; i < 2*n+1; i += 2) ans += a[i];
| ^
a.cc:15:39: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | for(int i = 1; i < 2*n+1; i += 2) ans += a[i];
| ^~~
| abs
a.cc:15:46: error: 'a' was not declared in this scope
15 | for(int i = 1; i < 2*n+1; i += 2) ans += a[i];
| ^
|
s163275036 | p03767 | C++ | N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
sm=[]
count=0
for i in range(3*N):
if count==N:
break
if i%2==1:
sm.append(A[i])
count+=1
ans=sum(sm)
print(ans) | a.cc:1:1: error: 'N' does not name a type
1 | N=int(input())
| ^
|
s076128067 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(),(a).end()
#define elif else if
int low(V<int> &a,int b){
auto c=lower_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
int upp(V<int> &a,int b){
auto c=upper_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
template<class T>
void cou(vector<vector<T>> a){
int b=a.size();
int c=a[0].size();
fo(i,b){
fo(j,c){
cout<<a[i][j];
if(j==c-1)
cout<<endl;
else
cout<<' ';
}
}
}
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int gcm(int a,int b){
if(a%b==0)
return b;
return gcm(b,a%b);
}
bool prime(int a){
if(a<2)
return false;
else if(a==2)
return true;
else if(a%2==0)
return false;
for(int i=3;i<=sqrt(a)+1;i+=2){
if (a%i==0)
return false;
}
return true;
}
struct Union{
vector<int> par;
Union(int a){
par=vector<int>(a,-1);
}
int find(int a){
if(par[a]<0)
return a;
else
return par[a]=find(par[a]);
}
bool same(int a,int b){
return find(a)==find(b);
}
int Size(int a){
return -par[find(a)];
}
void unite(int a,int b){
a=find(a);
b=find(b);
if(a==b)
return;
if(Size(b)>Size(a))
swap<int>(a,b);
par[a]+=par[b];
par[b]=a;
}
};
int ketas(int a){
string b=to_string(a);
int c=0;
fo(i,keta(a)){
c+=b[i]-'0';
}
return c;
}
bool fe(int a,int b){
a%=10;
b%=10;
if(a==0)
a=10;
if(b==0)
b=10;
if(a>b)
return true;
else
return false;
}
int INF=1000000007;
struct edge{int s,t,d; };
V<int> mojisyu(string a){
V<int> b(26,0);
fo(i,a.sz){
b[a[i]-'a']++;
}
return b;
}
int wa2(int a){
if(a%2==1)
return a/2;
return a/2-1;
}
/*signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}
?*/
int nCr(int n,int r){
int a=1;
r=min(r,n-r);
for(int i=n;i>n-r;i--){
a*=i;
a/=n-i+1;
}
return a;
}
/*void sea(int x,int y){
if(x<0||a<=x||y<0||b<=y||c[x][y]=='#')
return;
if(d[x][y])
return;
d[x][y]++;
sea(x+1,y);
sea(x-1,y);
sea(x,y+1);
sea(x,y-1);
}*/
int kaijou(int a){
int b=1;
fo(i,a)
b*=i+1;
return b;
}
int nPr(int a,int b){
if(a<b)
return 0;
if(b==0)
return 1;
int c=1;
for(int i=a;i>a-b;i--){
c*=i;
c%=INF;
}
return c;
}
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
return modpow(a, mod - 2, mod);
}
int lcm(int a,int b){
int c=modinv(gcm(a,b),INF);
return ((a*c)%INF)*(b%INF)%INF;
}
int MOD=INF;
int fac[1000010], finv[1000010], inv[1000010];
void COMinit() {
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for(int i=2;i<1000010;i++){
fac[i]=fac[i-1]*i%MOD;
inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
finv[i]=finv[i-1]*inv[i]%MOD;
}
}
// 二項係数計算
int COM(int n,int k){
if(n<k)
return 0;
if(n<0||k<0)
return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
bool naka(int a,int b,V<V<char>> c){
return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz);
}
V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}};
int inf=1000000000000000007;
/*
signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}*/
V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}};
//最短経路の表 a(全部INFで初期化)
//縦横 x,y
//迷路 f
//スタートsx,sy
//ゴールgx,gy
//文字はgから使おうね
/*int bfs_haba(){
Q<P<int,int>> b;
a[sx][sy]=0;
b.push({sx,sy});
while(!b.empty()){
P<int,int> c=b.front();
b.pop();
if(c.fi==gx&&c.se==gy){
break;
}
fo(i,4){
int d=c.fi+mawari4[i].fi;
int e=c.se+mawari4[i].se;
if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){
b.push({d,e});
a[d][e]=1+a[c.fi][c.se];
}
}
}
return a[gx][gy];
}*/
V<int> onajibubun(string a){
V<int> b(a.sz);
for(int i=1,j=0;i<a.sz;i++){
if(i+b[i-j]<j+b[j])
b[i]=b[i-j];
else{
int c=max<int>(0,j+b[j]-i);
while(i+c<a.sz&&a[c]==a[i+c])
c++;
b[i]=c;
j=i;
}
}
b[0]=a.sz;
return b;
}
int pow_kai(int a, int b){
int c=1;
while(b>0){//bit全部捨てるまで
if(b%2){//一番右のbitが1
c=c*a;
}
a=a*a;
b>>=1;//全体右に1つシフト
}
return c;
}
//12だったら{(2,2),(3,1)}って返してくれるはず
V<P<int,int>> factorize(int n){
V<P<int,int>> res;
for(int i=2; i*i<=n; i++){
if(n%i)
continue;
res.emplace_back(i,0);
while(n%i==0){
n/=i;
res.back().second++;
}
}
if(n!=1)
res.emplace_back(n,1);
return res;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
signed main(){
int n;
cin>>n;
V<int> a(n*3);
fo(i,n*3){
cin>>a[i];
}
Sort(a);
int ans=0;
for(int i=a.size()-2; i>=a.size()-n*2; i-=2;){
ans+=a[i];
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:384:46: error: expected ')' before ';' token
384 | for(int i=a.size()-2; i>=a.size()-n*2; i-=2;){
| ~ ^
| )
a.cc:384:47: error: expected primary-expression before ')' token
384 | for(int i=a.size()-2; i>=a.size()-n*2; i-=2;){
| ^
|
s013553833 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
int i,j=0;k=0;
cin>>N;
vector<int> vec(3*N);
int countA=0;
for(i=0;i<3*N;i++ ){
cin>>vec.at(i);
}
sort(vec.begin(),vec.end());
i=3*N-1;
while(k<N){
if(j%2!=0){
countA+=vec.at(i);
k++;}
i--;
j++;}
cout<<countA<<endl;
}
| a.cc: In function 'int main()':
a.cc:5:15: error: 'k' was not declared in this scope
5 | int i,j=0;k=0;
| ^
|
s604932745 | p03767 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main () {
int N;
cin >> N;
vector<int> a(3 * N, 0);
for (int i=0;i<N*3;++i) {
cin >> a[i];
}
sort(a.begin(), a.end(), greater<int>());
long sum = 0;
for (int i=0;i<N;++i) {
sum += a[2 * i + 1];
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
8 | vector<int> a(3 * N, 0);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
8 | vector<int> a(3 * N, 0);
| ^~~
a.cc:11:12: error: 'a' was not declared in this scope
11 | cin >> a[i];
| ^
a.cc:13:8: error: 'a' was not declared in this scope
13 | sort(a.begin(), a.end(), greater<int>());
| ^
|
s183169369 | p03767 | C++ | #include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000;
using ll = long long;
using namespace std;
int main(){
int n; cin >> n;
int tri=3*n
ll a[tri];
rep(i, tri) cin >> a[i];
sort(a, a+tri);
rep(i, tri) cout << a[i] << endl;
ll power_max=0;
rep(i, n){
power_max += a[n+i];
}
cout << power_max << endl;
} | a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'll'
14 | ll a[tri];
| ^~
a.cc:15:24: error: 'a' was not declared in this scope
15 | rep(i, tri) cin >> a[i];
| ^
a.cc:16:10: error: 'a' was not declared in this scope
16 | sort(a, a+tri);
| ^
|
s533040949 | p03767 | C++ | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
/*using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()*/
int main() {
long long int n, ans = 0;
scanf("%lld", &n);
vector<long long int> a(3 * n);
for (int i = 0; i < 3 * n; i++)
{
scanf("%lld", &a[i]);
}
sort(a.begin(), a.end(), greater<int>());
for (int i = 0; i < n; i++)
{
ans += a[2 * i + 1];
}
printf("%lld", ans);
}
| a.cc: In function 'int main()':
a.cc:15:3: error: 'vector' was not declared in this scope
15 | vector<long long int> a(3 * n);
| ^~~~~~
a.cc:15:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:15:10: error: expected primary-expression before 'long'
15 | vector<long long int> a(3 * n);
| ^~~~
a.cc:19:20: error: 'a' was not declared in this scope
19 | scanf("%lld", &a[i]);
| ^
a.cc:21:10: error: 'a' was not declared in this scope
21 | sort(a.begin(), a.end(), greater<int>());
| ^
a.cc:21:30: error: 'greater' was not declared in this scope; did you mean 'std::greater'?
21 | sort(a.begin(), a.end(), greater<int>());
| ^~~~~~~
| std::greater
In file included from /usr/include/c++/14/string:49,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stl_function.h:353:12: note: 'std::greater' declared here
353 | struct greater;
| ^~~~~~~
a.cc:21:38: error: expected primary-expression before 'int'
21 | sort(a.begin(), a.end(), greater<int>());
| ^~~
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
21 | sort(a.begin(), a.end(), greater<int>());
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
|
s388156739 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> p(3N);
for (int i = 0; i < 3N; i++) {
cin >> p.at(i);
}
sort(p.begin(), p.end());
int Z=0;
for(int i=N;i<2N;i++){
Z+=p.at(i);
}
cout<<Z<<endl;
} | a.cc: In function 'int main()':
a.cc:7:17: error: unable to find numeric literal operator 'operator""N'
7 | vector<int> p(3N);
| ^~
a.cc:8:21: error: unable to find numeric literal operator 'operator""N'
8 | for (int i = 0; i < 3N; i++) {
| ^~
a.cc:13:17: error: unable to find numeric literal operator 'operator""N'
13 | for(int i=N;i<2N;i++){
| ^~
|
s099125267 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int N = 3 * 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++){
int m = 2 * i - 1
ans += a[m];
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'ans'
14 | ans += a[m];
| ^~~
|
s156069723 | p03767 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
usnig namespace std;
int main(){
int N;
cin>>N;
vector<int>a;
for(int i=0;i<3N;i++){
int x;
cin>>x;
a.push_back(x);}
sort(a.begin(),a.end());
int res=0;
for(int i=3N-1;i>2N-1;i--){
res+=a[i];}
cout>>res;
}
| a.cc:4:1: error: 'usnig' does not name a type
4 | usnig namespace std;
| ^~~~~
a.cc: In function 'int main()':
a.cc:7:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin>>N;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:8:1: error: 'vector' was not declared in this scope
8 | vector<int>a;
| ^~~~~~
a.cc:8:1: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:8:8: error: expected primary-expression before 'int'
8 | vector<int>a;
| ^~~
a.cc:9:17: error: unable to find numeric literal operator 'operator""N'
9 | for(int i=0;i<3N;i++){
| ^~
a.cc:12:3: error: 'a' was not declared in this scope
12 | a.push_back(x);}
| ^
a.cc:13:8: error: 'a' was not declared in this scope
13 | sort(a.begin(),a.end());
| ^
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
13 | sort(a.begin(),a.end());
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
a.cc:15:13: error: unable to find numeric literal operator 'operator""N'
15 | for(int i=3N-1;i>2N-1;i--){
| ^~
a.cc:15:20: error: unable to find numeric literal operator 'operator""N'
15 | for(int i=3N-1;i>2N-1;i--){
| ^~
a.cc:17:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
17 | cout>>res;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s426165873 | p03767 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//
void yes(){
cout <<"Yes"<<endl ;
}
void no(){
cout <<"No"<<endl ;
}
//-------------------------------------------------
// メモ
//-------------------------------------------------
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n ;
cin >> n ;
intm = n*3 ;
vector<ll> vec(m) ;
ll ans = 0 ;
REP(i,m){
cin >> vec.at(i) ;
}
sort(ALL(vec)) ;
reverse(ALL(vec)) ;
REP(i,n){
ans += vec.at(i*2+1) ;
}
cout <<ans <<endl ;
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:54:3: error: 'intm' was not declared in this scope; did you mean 'int'?
54 | intm = n*3 ;
| ^~~~
| int
a.cc:55:18: error: 'm' was not declared in this scope
55 | vector<ll> vec(m) ;
| ^
|
s819471910 | p03767 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//
void yes(){
cout <<"Yes"<<endl ;
}
void no(){
cout <<"No"<<endl ;
}
//-------------------------------------------------
// メモ
//-------------------------------------------------
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n ;
cin >> n ;
intm = n*3 ;
vector<ll> vec(m) ;
ll ans = 0 ;
REP(i,m){
cin >> vec.at(i) ;
}
sort(ALL(vec)) ;
reverse(ALL(vec)) ;
REP(i,n){
ans += vec.at(i*2) ;
}
cout <<ans <<endl ;
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:54:3: error: 'intm' was not declared in this scope; did you mean 'int'?
54 | intm = n*3 ;
| ^~~~
| int
a.cc:55:18: error: 'm' was not declared in this scope
55 | vector<ll> vec(m) ;
| ^
|
s849213061 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, sum;
sum = 0;
cin >> N;
vector<int> player(3*N);
for(int i = 0; i < 3*N; i++){
cin >> player.at(i);
}
sort(player.begin(), player.end());
reverse(player.begin(), player.end());
int j = N;
for(int i = 1; i < N, j++){
sum += player.at(i);
i += 2;
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:15:28: error: expected ';' before ')' token
15 | for(int i = 1; i < N, j++){
| ^
| ;
|
s978409744 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, sum;
sum = 0;
cin >> N;
vector<int> player(3*N);
for(int i = 0; i < 3*N; i++){
cin >> player.at(i);
}
sort(player.begin(), player.end());
reverse(player.begin(), player.end());
int j = N;
for(int i = 1; i < N, j++){
sum += player.at(i);
i += 2;
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:15:28: error: expected ';' before ')' token
15 | for(int i = 1; i < N, j++){
| ^
| ;
|
s505589757 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, sum;
sum = 0;
cin >> N;
vector<int> player(3*N);
for(int i = 0; i < 3*N; i++){
cin >> player.at(i);
}
sort(player.begin(), player.end());
reverse(player.begin(), player.end());
int j = N;
for(int i = 1; i < N, i){
sum += player.at(i);
i += 2;
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:15:26: error: expected ';' before ')' token
15 | for(int i = 1; i < N, i){
| ^
| ;
|
s017964261 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, sum;
sum = 0;
cin >> N;
vector<int> player(3*N);
for(int i = 0; i < 3*N; i++){
cin >> player.at(i);
}
sort(player.begin(), player.end());
reverse(player.begin(), player.end());
int j = N;
for(int i = 1; i < N){
sum += player.at(i);
i += 2;
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:15:23: error: expected ';' before ')' token
15 | for(int i = 1; i < N){
| ^
| ;
|
s414310121 | p03767 | C++ | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n ;
int a[3*n] ;
for(int i=0;i<3*n;i++)
cin >> a[i] ;
sort(a,a+3*n,greater<int>) ;
int ans =0;
for(int i=0;i<=2*n;i++){
if(i%2==0)ans+=a[i];
}
cout << ans << endl ;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:28: error: expected primary-expression before ')' token
14 | sort(a,a+3*n,greater<int>) ;
| ^
|
s581877229 | p03767 | C++ | include <bits/stdc++.h>
#define rep(i,c) for(int i = 0; i < (int)c; ++i)
using llint = long long int ;
using namespace std;
int main(){
int N;
cin>>N;
vector<int> a(3);
rep(i,3*N)cin>>a[i];
sort(a.begin(),a.begin()+3*N,greater<int>());
llint ans=0;
for (int i = 1; i < 2*N; )
{
ans+=a[i];
i+=2;
}
cout<<ans<<endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
10 | cin>>N;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | include <bits/stdc++.h>
a.cc:11:5: error: 'vector' was not declared in this scope
11 | vector<int> a(3);
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | include <bits/stdc++.h>
a.cc:11:12: error: expected primary-expression before 'int'
11 | vector<int> a(3);
| ^~~
a.cc:12:20: error: 'a' was not declared in this scope
12 | rep(i,3*N)cin>>a[i];
| ^
a.cc:13:10: error: 'a' was not declared in this scope
13 | sort(a.begin(),a.begin()+3*N,greater<int>());
| ^
a.cc:13:34: error: 'greater' was not declared in this scope
13 | sort(a.begin(),a.begin()+3*N,greater<int>());
| ^~~~~~~
a.cc:13:42: error: expected primary-expression before 'int'
13 | sort(a.begin(),a.begin()+3*N,greater<int>());
| ^~~
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(a.begin(),a.begin()+3*N,greater<int>());
| ^~~~
| short
a.cc:14:5: error: 'llint' was not declared in this scope; did you mean 'int'?
14 | llint ans=0;
| ^~~~~
| int
a.cc:17:9: error: 'ans' was not declared in this scope
17 | ans+=a[i];
| ^~~
a.cc:20:5: error: 'cout' was not declared in this scope
20 | cout<<ans<<endl;
| ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:11: error: 'ans' was not declared in this scope
20 | cout<<ans<<endl;
| ^~~
a.cc:20:16: error: 'endl' was not declared in this scope
20 | cout<<ans<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | include <bits/stdc++.h>
|
s540859650 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
long long ans, res;
long long n, m;
long long a[3e5 + 21];
int main() {
cin >> n;
m = n * 3;
for (int i = 1; i <= m; i++)
cin >> a[i];
for (int i = 2; i <= m; i += 3)
ans += a[i];
for (int i = n + 1; i <= 2 * n; i++)
res += a[i];
cout << max(ans, res) << '\n';
return 0;
} | a.cc:6:17: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
6 | long long a[3e5 + 21];
| ~~~~^~~~
a.cc:6:17: error: could not convert '(3.0e+5 + (double)21)' from 'double' to 'long unsigned int'
6 | long long a[3e5 + 21];
| ~~~~^~~~
| |
| double
a.cc:6:17: error: size of array 'a' has non-integral type 'double'
|
s209224453 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(3*N);
for (int i= 0; i < 3*N; i++) {
cin >> a.at(i);
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
int64 sum = 0;
for (int i = 1; i < 2*N; i+=2) {
sum += a.at(i);
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:14:3: error: 'int64' was not declared in this scope
14 | int64 sum = 0;
| ^~~~~
a.cc:16:5: error: 'sum' was not declared in this scope
16 | sum += a.at(i);
| ^~~
a.cc:18:11: error: 'sum' was not declared in this scope
18 | cout << sum << endl;
| ^~~
|
s725546670 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;cin>>N;long long int x=0;
vector<int>a(3*N);
for(int i=0;i<3*N;i++)cin>>A.at(i);
sort(A.begin(),A.end());
for(int i=N;i<2*N;i++)x+=A.at(i);
cout<<x<<endl;
} | a.cc: In function 'int main()':
a.cc:6:30: error: 'A' was not declared in this scope
6 | for(int i=0;i<3*N;i++)cin>>A.at(i);
| ^
a.cc:7:8: error: 'A' was not declared in this scope
7 | sort(A.begin(),A.end());
| ^
|
s711768891 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0;i<(int)(n);++i)
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n;
cin >> n;
vector<ll> vec(3 * n);
for (ll i = 0; i < 3 * n; ++i) {
cin >> vec[i];
}
sort(vec.begin(), vec.end());
ll ans = 0;
for(long j=3* n-2;n-1<j;j-=2)
ans += a[j];
// debug(ans);
cout << ans << '\n';
}
| a.cc: In function 'int main()':
a.cc:18:12: error: 'a' was not declared in this scope
18 | ans += a[j];
| ^
|
s170027360 | p03767 | C++ | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main() {
int n,ans=0;
vector<int> a(100010);
for(int i=0;i<3*n;i++)cin >> a[i];
sort(a,a+n,);
for(int i=n;i<2*n;i++){
ans+=a[i];
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:10:13: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int')
10 | sort(a,a+n,);
| ~^~
| | |
| | int
| std::vector<int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
10 | sort(a,a+n,);
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: mismatched types 'const _CharT*' and 'std::vector<int>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: mismatched types 'const _CharT*' and 'std::vector<int>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | sort(a,a+n,);
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)'
340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed:
a.cc:10:14: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>'
10 | sort(a,a+n,);
| ^
/usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)'
349 | operator+(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:349:5: note: template argument deduction/substitution faile |
s077332169 | p03767 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
long long N;
cin >> N;
long long N3 = N * 3;
long a[N3];
for (int i = 0; i < N * 3; i++)
{
cin >> a[i];
}
sort(a, a + N3, greater<long long>()); //vectorにするとa+N3ができない。
long long ans = 0;
for (int i = 0; i < N; i++)
{
ans += a[i * 2 + 1];
}
cout << ans << endl;
} | a.cc:17:11: error: extended character is not valid in an identifier
17 | sort(a, a + N3, greater<long long>()); //vectorにするとa+N3ができない。
| ^
a.cc:17:15: error: extended character is not valid in an identifier
17 | sort(a, a + N3, greater<long long>()); //vectorにするとa+N3ができない。
| ^
a.cc: In function 'int main()':
a.cc:17:11: error: 'a\U00003000' was not declared in this scope
17 | sort(a, a + N3, greater<long long>()); //vectorにするとa+N3ができない。
| ^~~
a.cc:17:15: error: '\U00003000N3' was not declared in this scope
17 | sort(a, a + N3, greater<long long>()); //vectorにするとa+N3ができない。
| ^~~~
|
s496623350 | p03767 | C++ | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int a[3*N];
for (int i=0; i < 3*N; i++) cin >> a[i];
sort(a, a+3*N);
int sum=0;
for(int i=N; i<2*N; i++){
sum += a[i];
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:12:1: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a, a+3*N);
| ^~~~
| short
|
s502280483 | p03767 | C++ | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int a[3*N];
for (int i=0; i < 3*N; i++) cin >> a[i];
sort(a, a+3*N, greater<int>());
int sum=0;
for(int i=N; i<2*N; i++){
sum += a[i];
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:12:1: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a, a+3*N, greater<int>());
| ^~~~
| short
|
s012892107 | p03767 | Java | import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long sum = 0;
long[] scoreList = new long[N*3 +100];
for(int i =0; i < N*3; i++)
scoreList[i] = sc.nextLong();
Arrays.sort(scoreList);
for(i = N; i < N*2; i++){
sum += scoreList[i];
}
System.out.println(scoreList);
}
}
| Main.java:13: error: cannot find symbol
for(i = N; i < N*2; i++){
^
symbol: variable i
location: class Main
Main.java:13: error: cannot find symbol
for(i = N; i < N*2; i++){
^
symbol: variable i
location: class Main
Main.java:13: error: cannot find symbol
for(i = N; i < N*2; i++){
^
symbol: variable i
location: class Main
Main.java:14: error: cannot find symbol
sum += scoreList[i];
^
symbol: variable i
location: class Main
4 errors
|
s540422898 | p03767 | Java | import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long sum = 0;
long[] scoreList = new long[N*3 +100];
for(int i =0; i < N*3; i++)
long[i] = sc.nextLong();
Arrays.sort(scoreList);
for(i = N; i < 2N; i++){
sum += scoreList[i];
}
System.out.println(scoreList);
}
} | Main.java:10: error: ']' expected
long[i] = sc.nextLong();
^
Main.java:10: error: ';' expected
long[i] = sc.nextLong();
^
Main.java:13: error: ';' expected
for(i = N; i < 2N; i++){
^
Main.java:13: error: ')' expected
for(i = N; i < 2N; i++){
^
Main.java:13: error: ';' expected
for(i = N; i < 2N; i++){
^
5 errors
|
s929368844 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
long long numTeam = n * 3;
vector<long long> a(numTeam);
long long ans = 0;
for (long long i = 0; i < numTeam; i++) cin >> a.at(i);
sort(a.begin(), a.end());
for (long long i = n + 1; i < 2n + 1; i++){
ans += a.at(i);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:14:35: error: unable to find numeric literal operator 'operator""n'
14 | for (long long i = n + 1; i < 2n + 1; i++){
| ^~
|
s195562647 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int numTeam = n * 3;
vector<long long> a(numTeam);
long long ans = 0;
for (int i = 0; i < numTeam; i++) cin >> a.at(i);
sort(a.begin(), a.end());
for (int i = n + 1; i < 2n + 1; i++){
ans += a.at(i);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:14:29: error: unable to find numeric literal operator 'operator""n'
14 | for (int i = n + 1; i < 2n + 1; i++){
| ^~
|
s618984504 | p03767 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
int n;
cin >> n;
int a[3*n];
for(int i=0;i<n;++i){
cin >> a[i];
}
std::sort(a,a+n,greater<int>());
int sum1=0;
for(int i=0;i<2*n;++i){
if(i%2==1){
sum1 += a[i];
}
cout << sum1 <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:2: error: expected '}' at end of input
20 | }
| ^
a.cc:5:15: note: to match this '{'
5 | int main(void){
| ^
|
s420356183 | p03767 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
int n;
cin >> n;
int a[3*n];
for(int i=0;i<n;++i){
cin >> a[i];
}
std::sort(v,v+n,greater<int>());
int sum1=0;
for(int i=0;i<2*n;++i){
if(i%2==1){
sum1 += a[i];
}
cout << sum1 <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:14: error: 'v' was not declared in this scope
12 | std::sort(v,v+n,greater<int>());
| ^
a.cc:20:2: error: expected '}' at end of input
20 | }
| ^
a.cc:5:15: note: to match this '{'
5 | int main(void){
| ^
|
s386059526 | p03767 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
int n;
cin >> n;
int v[3*n];
for(int i=0;i<n;++i){
cin >> a[i];
}
std::sort(v,v+n,greater<int>());
int sum1=0;
for(int i=0;i<2*n;++i){
if(i%2==1){
sum1 += a[i];
}
cout << sum1 <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:18: error: 'a' was not declared in this scope
10 | cin >> a[i];
| ^
a.cc:16:25: error: 'a' was not declared in this scope
16 | sum1 += a[i];
| ^
a.cc:20:2: error: expected '}' at end of input
20 | }
| ^
a.cc:5:15: note: to match this '{'
5 | int main(void){
| ^
|
s054426233 | p03767 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2019/03/28/014100
int main() {
int N;
cin >> N;
vector<ll> A(3 * N);
REP(i, 3 * N) { cin >> A[i]; }
sort(A.begin(), A.end());
ll ans = 0;
REP(N, 2 * N) { ans += A[i]; }
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:45:30: error: 'i' was not declared in this scope
45 | REP(N, 2 * N) { ans += A[i]; }
| ^
|
s342976133 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<long int> a(3 * n);
for(int i = 0; i < 3 * n; i++){
cin >> a.at(i);
}
sort<a.begin(),a.end()>;
long int out = 0;
for(int i = 0; i < n; i++){
out += a.at(i * 3 + 1);
}
cout << out;
} | a.cc: In function 'int main()':
a.cc:11:15: error: call to non-'constexpr' function 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]'
11 | sort<a.begin(),a.end()>;
| ~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:873:7: note: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]' declared here
873 | begin() _GLIBCXX_NOEXCEPT
| ^~~~~
a.cc:11:23: error: call to non-'constexpr' function 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]'
11 | sort<a.begin(),a.end()>;
| ~~~~~^~
/usr/include/c++/14/bits/stl_vector.h:893:7: note: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]' declared here
893 | end() _GLIBCXX_NOEXCEPT
| ^~~
a.cc:11:3: error: statement cannot resolve address of overloaded function
11 | sort<a.begin(),a.end()>;
| ^~~~~~~~~~~~~~~~~~~~~~~
|
s142103641 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<long int> a(n);
for(int i = 0; i < 3 * n; i++){
cin >> a.at(i);
}
sort<a.begin(),a.end()>;
long int out = 0;
for(int i = 0; i < n; i++){
out += a.at(i * 3 + 1);
}
cout << out;
} | a.cc: In function 'int main()':
a.cc:11:15: error: call to non-'constexpr' function 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]'
11 | sort<a.begin(),a.end()>;
| ~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:873:7: note: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]' declared here
873 | begin() _GLIBCXX_NOEXCEPT
| ^~~~~
a.cc:11:23: error: call to non-'constexpr' function 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]'
11 | sort<a.begin(),a.end()>;
| ~~~~~^~
/usr/include/c++/14/bits/stl_vector.h:893:7: note: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator]' declared here
893 | end() _GLIBCXX_NOEXCEPT
| ^~~
a.cc:11:3: error: statement cannot resolve address of overloaded function
11 | sort<a.begin(),a.end()>;
| ^~~~~~~~~~~~~~~~~~~~~~~
|
s847742023 | p03767 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n; cin >> n;
vector<int>a(3*n); for (auto&& x : a)cin >> x;
sort(a.begin(), a.end());
long long ans = 0;
for (int i = 3 * n - 2, cnt = 0; cnt < n; i -= 2, cnt++) {
ans += a[i];
}
cout << ans << endl;
return 0; | a.cc: In function 'int main()':
a.cc:16:18: error: expected '}' at end of input
16 | return 0;
| ^
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
s540724110 | p03767 | C++ | #include <bits/stdc++.h>
#define REP(i, k, n) for(int i=(k); i<(n); i++)
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> a(3*N);
REP(i, 0, 3*N) cin >> a.at(i);
sort(a.begin(), a.end(), greater<int>);
long long ans = 0;
REP(i, 0, N) ans += a.at(N+i+1);
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:40: error: expected primary-expression before ')' token
10 | sort(a.begin(), a.end(), greater<int>);
| ^
|
s330051673 | p03767 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
int main () {
int N;
std::cin >> N;
std::vector<int> data(3*N);
for (int i=0; i<3*N; i++) {
std::cin >> data.at(i);
}
std::sort(data.begin(), data.rend());
int sum = 0;
for (int i=1; i<2*N+1; i+=2) {
sum += data.at(i);
}
std::cout << sum << std::endl;
} | a.cc: In function 'int main()':
a.cc:12:12: error: no matching function for call to 'sort(std::vector<int>::iterator, std::vector<int>::reverse_iterator)'
12 | std::sort(data.begin(), data.rend());
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed:
a.cc:12:12: note: deduced conflicting types for parameter '_RAIter' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'std::reverse_iterator<__gnu_cxx::__normal_iterator<int*, std::vector<int> > >')
12 | std::sort(data.begin(), data.rend());
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
|
s945181714 | p03767 | Java | package AGC_A;
import java.util.Arrays;
import java.util.Scanner;
public class AtCoderGroupContest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
Long[] a = new Long[N*3];
for(int i = 0; i < N*3 ;i++) {
a[i] = sc.nextLong();
}
Arrays.sort(a);
long ans = 0;
int index = 0;
for(int i = N*3 ; i-2 > index ; i -= 2 ) {
ans += a[i-2];
index++;
}
System.out.println(ans);
}
}
| Main.java:6: error: class AtCoderGroupContest is public, should be declared in a file named AtCoderGroupContest.java
public class AtCoderGroupContest {
^
1 error
|
s735592011 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a[n];
for (int i =0; i < n * 3; ++i) cin >> a[i];
sort(a, a + n, greater<int>());
int cnt = 0;
int cur = n * 3 - 2;
long long ans = 0;
while (cnt < n) {
ans += a[cur]
cnt++;
cur -= 2;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:18: error: expected ';' before 'cnt'
17 | ans += a[cur]
| ^
| ;
18 | cnt++;
| ~~~
|
s571842568 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int vec_sum(vector<int> v){
int n,ans=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
int main() {
int n;
cin>>n;
vector<int> v(n);
rep(i,n*3) cin>>v[i];
rep(i,n){
if(v[i*3]<=v[i*3+1] && v[i*3+1]<=v[i*3+2] || v[i*3+2]<=v[i*3+1] && v[i*3+1] <= v[i*3]){
ans+=v[i*3+1];
}else if(v[i*3+1]<=v[i*3+2] && v[i*3+2]<=v[i*3] || v[i*3]<=v[i*3+2] && v[i*3+2] <= v[i*3+1]){
ans+=v[i*3+2];
}else{
ans+=v[i*3];
}
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:31:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
31 | ans+=v[i*3+1];
| ^~~
| abs
a.cc:33:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
33 | ans+=v[i*3+2];
| ^~~
| abs
a.cc:35:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
35 | ans+=v[i*3];
| ^~~
| abs
a.cc:38:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
38 | cout<<ans<<endl;
| ^~~
| abs
|
s264183129 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
/*FUNCs=================================================*/
/*MAIN==================================================*/
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false); //cin cout 高速化
ll n, cnt = 0; cin >> n;
vll a(3*n);
rep(i,3*n) cin >> a[i];
sort(a.begin(), a.end());
for(int i = n, i < (2*n)-1; i += 2) cnt += a[i];
cout << cnt <<endl;
}
| a.cc: In function 'int main()':
a.cc:26:21: error: expected ';' before '<' token
26 | for(int i = n, i < (2*n)-1; i += 2) cnt += a[i];
| ^~
| ;
a.cc:26:22: error: expected primary-expression before '<' token
26 | for(int i = n, i < (2*n)-1; i += 2) cnt += a[i];
| ^
|
s664874427 | p03767 | C++ | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<double> > vvd;
typedef vector<double> vd;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define len(x) int(x.size())
#define inf (1000000007)
#define ll_inf (1000000000000000007)
#define nil -1
void puts() {
cout << endl;
}
template <class Head, class... Tail>
void puts(Head&& head, Tail&& ... tail) {
cout << head;
if (sizeof...(tail) == 0) {
cout << endl;
}
else {
cout << " ";
puts(forward<Tail>(tail)...);
}
}
void puts(vector<pair<int,int> >& A) {
for (int i = 0; i < A.size(); i++)
{
cout <<"("<< A[i].first<<","<<A[i].second<<")";
if (A.size() - 1 == i) {
cout << endl;
}
else {
cout << " ";
}
}
}
void puts(vector<vector<pair<int,int> > >& A) {
for (int i = 0; i < A.size(); i++)
{
puts(A[i]);
}
}
template <class T>
void puts(vector<T>& A) {
for (int i = 0; i < A.size(); i++)
{
cout << A[i];
if (A.size() - 1 == i) {
cout << endl;
}
else {
cout << " ";
}
}
}
template<class T>
void puts(vector<vector<T> >& A) {
for (int i = 0; i < A.size(); i++)
{
puts(A[i]);
}
}
class disjoint_set {
public:
vi p, rank;
disjoint_set(int size) {
p.resize(size, 0);
rank.resize(size, 0);
for (int i = 0; i < size; i++)makeSet(i);
}
void makeSet(int x) {
p[x] = x;
rank[x] = 0;
}
bool same(int x, int y) {
return findSet(x) == findSet(y);
}
void unite(int x, int y) {
link(findSet(x), findSet(y));
}
void link(int x, int y) {
if (rank[x] < rank[y]) {
p[x] = y;
}
else {
p[y] = x;
if (rank[x] == rank[y]) {
rank[x]++;
}
}
}
int findSet(int x) {
if (x != p[x]) {
p[x] = findSet(p[x]);
}
return p[x];
}
};
int gcd(int a, int b) {//log N
return (b == 0) ? a : gcd(b, a % b);
}
int lcm(int a, int b) {//log N
return (a * b) / gcd(a, b);
}
int extgcd(int a, int b, int& x, int& y) {// log N
int d = a;
if (b == 0) {
x = 1;
y = 0;
}
else {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
}
return d;
}
vi get_primes(int limit) {//N log N
vb A(limit + 1, true);
for (int i = 2; i < A.size(); i++) {
if (!A[i])continue;
for (int j = i * 2; j < A.size(); j += i)A[j] = false;
}
vi B;
for (int i = 2; i < A.size(); i++)
{
if (A[i])B.push_back(i);
}
return B;
}
bool is_prime(int num) {// sqrt(N)
if (num < 2)return false;
for (int i = 2; i <= sqrt(num); i++)
{
if (num % i == 0) {
return false;
}
}
return true;
}
ll merge_count(vi & A) {//N log N
int n = A.size();
if (n <= 1)return 0;
long long count = 0;
int mid = n / 2;
vector<int> B(A.begin(), A.begin() + mid);
vector<int> C(A.begin() + mid, A.end());
count += merge_count(B);
count += merge_count(C);
B.push_back(inf);
C.push_back(inf);
int B_i = 0;
int C_i = 0;
for (int i = 0; i < n; i++) {
if (B[B_i] <= C[C_i]) {
A[i] = B[B_i++];
}
else {
count += (n / 2) - B_i;
A[i] = C[C_i++];
}
}
return count;
}
vvi bit(int size) {//2**N
vvi A;
for (int i = 0; i < (1<<size); i++)
{
vi temp;
for (int j = 0; j < size; j++)
{
if ((i & (1 << (size - j - 1))) > 0) {
temp.push_back(1);
}
else {
temp.push_back(0);
}
}
A.push_back(temp);
}
return A;
}
vvi bit(int size,int min,int max) {//長さがsizeで、1の個数がmin以上max以下のものを全列挙して返す 2**N
vvi A;
for (int i = 0; i < (1 << size); i++)
{
vi temp;
int count = 0;
for (int j = 0; j < size; j++)
{
if ((i & (1 << (size - j - 1))) > 0) {
temp.push_back(1);
count++;
}
else {
temp.push_back(0);
}
}
if(min<=count && count<=max)A.push_back(temp);
}
return A;
}
int main() {
int n;
vi A(n*3);
rep(i, 0, n*3)cin >> A[i];
sort(all(A));
reverse(all(A));
int ans = 0;
for (int i = 0; i < n; i++)
{
ans += A[1 + n * 3];
}
puts(ans);
}
| a.cc:5:13: error: '::main' must return 'int'
5 | #define int ll
| ^~
a.cc:222:1: note: in expansion of macro 'int'
222 | int main() {
| ^~~
|
s068814687 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,a,cnt=0;
vector<int> v;
int main(){
scanf("%d",&n);
for(int i=1;i<3*n;i++){
scanf("%d",&a);
v.push_back(-a);
}
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++){
v[i]=-v[i];
}
for(int i=1;i<=n;i++){
cnt+=[2*i-1];
}
printf("%d",cnt);
} | a.cc: In function 'int main()':
a.cc:16:23: error: expected identifier before numeric constant
16 | cnt+=[2*i-1];
| ^
a.cc: In lambda function:
a.cc:16:29: error: expected '{' before ';' token
16 | cnt+=[2*i-1];
| ^
a.cc: In function 'int main()':
a.cc:16:20: error: no match for 'operator+=' (operand types are 'int' and 'main()::<lambda()>')
16 | cnt+=[2*i-1];
| ~~~^~~~~~~~~
|
s535496107 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>
/////////////////////////////////////////////////////////
class XY{
public:
ll x, y;
XY() {x = y = 0;}
XY(ll u, ll v) {x = u; y = v;}
};
template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}
template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
if(n == 0) return 1;
if(n == 1) return a;
if(n % 2) return a * mypow(a, n - 1);
ll tmp = mypow(a, n / 2);
return tmp * tmp;
}
template<typename T>
int BS(vector<T> V, int left, int right, T key){
int mid = (left + right) / 2;
if(V[mid] <= key) left = mid;
else right = mid;
if(right - mid == 1) return left;
else return BS(V, left, right, key);
}
ll comb(ll n, ll r){
ll res = 1;
rep(i, 0, r){
res *= n - i;
res /= i + 1;
}
return res;
}
/////////////////////////////////////////////////////////
void Main() {
int N; cin >> N;
vector<ll> A(3 * N);
rep(i, 0, 3 * N) cin >> A[i];
sort(all(A), greater<ll>());
ll res = 0:
rep(i, 0, N){
res += A[2 * i + 1];
}
cout << res << endl;
}
/////////////////////////////////////////////////////////
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << std::fixed << std::setprecision(15);
Main();
}
| a.cc: In function 'void Main()':
a.cc:60:13: error: expected ',' or ';' before ':' token
60 | ll res = 0:
| ^
a.cc:61:7: error: 'i' was not declared in this scope
61 | rep(i, 0, N){
| ^
a.cc:4:37: note: in definition of macro 'rep'
4 | #define rep(i, j, n) for (ll i = j; i < n; i++)
| ^
|
s601093958 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>
/////////////////////////////////////////////////////////
class XY{
public:
ll x, y;
XY() {x = y = 0;}
XY(ll u, ll v) {x = u; y = v;}
};
template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}
template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
if(n == 0) return 1;
if(n == 1) return a;
if(n % 2) return a * mypow(a, n - 1);
ll tmp = mypow(a, n / 2);
return tmp * tmp;
}
template<typename T>
int BS(vector<T> V, int left, int right, T key){
int mid = (left + right) / 2;
if(V[mid] <= key) left = mid;
else right = mid;
if(right - mid == 1) return left;
else return BS(V, left, right, key);
}
ll comb(ll n, ll r){
ll res = 1;
rep(i, 0, r){
res *= n - i;
res /= i + 1;
}
return res;
}
/////////////////////////////////////////////////////////
void Main() {
int N; cin >> N;
vector<ll> A(3 * N);
rep(i, 0, 3 * N) cin >> A[i];
sort(all(A), greater<ll>);
ll res = 0:
rep(i, 0, N){
res += A[2 * i + 1];
}
cout << res << endl;
}
/////////////////////////////////////////////////////////
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << std::fixed << std::setprecision(15);
Main();
}
| a.cc: In function 'void Main()':
a.cc:58:27: error: expected primary-expression before ')' token
58 | sort(all(A), greater<ll>);
| ^
a.cc:60:13: error: expected ',' or ';' before ':' token
60 | ll res = 0:
| ^
a.cc:61:7: error: 'i' was not declared in this scope
61 | rep(i, 0, N){
| ^
a.cc:4:37: note: in definition of macro 'rep'
4 | #define rep(i, j, n) for (ll i = j; i < n; i++)
| ^
|
s500705356 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>
/////////////////////////////////////////////////////////
class XY{
public:
ll x, y;
XY() {x = y = 0;}
XY(ll u, ll v) {x = u; y = v;}
};
template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}
template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
if(n == 0) return 1;
if(n == 1) return a;
if(n % 2) return a * mypow(a, n - 1);
ll tmp = mypow(a, n / 2);
return tmp * tmp;
}
template<typename T>
int BS(vector<T> V, int left, int right, T key){
int mid = (left + right) / 2;
if(V[mid] <= key) left = mid;
else right = mid;
if(right - mid == 1) return left;
else return BS(V, left, right, key);
}
ll comb(ll n, ll r){
ll res = 1;
rep(i, 0, r){
res *= n - i;
res /= i + 1;
}
return res;
}
/////////////////////////////////////////////////////////
void Main() {
int N; cin >> N;
vector<ll> A(3 * N);
rep(i, 0, 3 * N) cin >> A[i];
sort(all(A), greater<ll>)
int res = 0:
rep(i, 0, N){
res += A[2 * i + 1];
}
cout << res << endl;
}
/////////////////////////////////////////////////////////
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << std::fixed << std::setprecision(15);
Main();
}
| a.cc: In function 'void Main()':
a.cc:58:27: error: expected primary-expression before ')' token
58 | sort(all(A), greater<ll>)
| ^
a.cc:61:7: error: 'i' was not declared in this scope
61 | rep(i, 0, N){
| ^
a.cc:4:37: note: in definition of macro 'rep'
4 | #define rep(i, j, n) for (ll i = j; i < n; i++)
| ^
a.cc:64:11: error: 'res' was not declared in this scope; did you mean 'rep'?
64 | cout << res << endl;
| ^~~
| rep
|
s531941906 | p03767 | C++ | #include<iostream>
using namespace std ;
void Sort(int length[], int N){
int i,j,k,m ;
for(i=1;i<N;i++){
k=i ;
m=length[i] ;
j=i-1 ;
while(length[j]<m && j>=0){
length[j+1] = length[j] ;
j-- ;
}
length[j+1] = m ;
}
}
int main(){
int N,i,sum=0;
int a[300001] ;
cin >> N ;
for(i=0;i<3*N;i++){
cin >> a[i] ;
}
Sort(a,3*N) ;
for(i=0;3i+1<3*N;i++){
sum = sum + a[3i+1] ;
}
cout << sum ;
}
| a.cc: In function 'int main()':
a.cc:31:15: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<'
31 | for(i=0;3i+1<3*N;i++){
| ^~~~
| |
| int
a.cc:32:18: error: invalid types 'int [300001][__complex__ int]' for array subscript
32 | sum = sum + a[3i+1] ;
| ^
|
s406025632 | p03767 | C++ | #include<iostream>
using namespace std ;
void Sort(int length[], int N){
int i,j,k,m ;
for(i=1;i<N;i++){
k=i ;
m=length[i] ;
j=i-1 ;
while(length[j]<m && j>=0){
length[j+1] = length[j] ;
j-- ;
}
length[j+1] = m ;
}
}
int main(){
int N,i,sum=0;
int a[300001] ;
cin >> N ;
for(i=0;i<3*N;i++){
cin >> a[i] ;
}
Sort(a,3*N) ;
for(i=0;3i+1<3*N;i++){
sum = sum + a[3i+1]
}
cout << sum ;
}
| a.cc: In function 'int main()':
a.cc:31:15: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<'
31 | for(i=0;3i+1<3*N;i++){
| ^~~~
| |
| int
a.cc:32:18: error: invalid types 'int [300001][__complex__ int]' for array subscript
32 | sum = sum + a[3i+1]
| ^
|
s241057426 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
int a[3*n];for(int i=0;i<3*n;i++)cin>>a[i];
sort(a,a+(3*n));
int score = 0;
for(int i=0;i<=2*n;i++){((i%2==0&&i>0)?score+=a[i]:);}
cout<<score<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:54: error: expected primary-expression before ')' token
8 | for(int i=0;i<=2*n;i++){((i%2==0&&i>0)?score+=a[i]:);}
| ^
|
s341319386 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
int a[3*n];for(int i=0;i<3*n;i++)cin>>a[i];
sort(a,a+(3*n));
int score = 0;
for(int i=0;i<3*n;i++){((i%2==0&&i>0)?score+=a[i]:);}
cout<<score<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:53: error: expected primary-expression before ')' token
8 | for(int i=0;i<3*n;i++){((i%2==0&&i>0)?score+=a[i]:);}
| ^
|
s940967687 | p03767 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N; cin>>N;
vector<int> L(3N);
for (int i=0;i<3N;++i){
cin>>L[i];
}
sort(L.begin(),L.end());
int ans=0;
for (int i=N;i<2N;++i){
ans+=L[i];
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:17: error: unable to find numeric literal operator 'operator""N'
8 | vector<int> L(3N);
| ^~
a.cc:9:18: error: unable to find numeric literal operator 'operator""N'
9 | for (int i=0;i<3N;++i){
| ^~
a.cc:14:18: error: unable to find numeric literal operator 'operator""N'
14 | for (int i=N;i<2N;++i){
| ^~
|
s167092440 | p03767 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N; cin>>N;
vector<int> L(3N);
for (int i=0;i<3N;++i){
cin>>L[i];
}
sort(L.begin(),L.end());
int ans=0+
for (int i=N;i<2N;++i){
ans+=L[i];
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:17: error: unable to find numeric literal operator 'operator""N'
8 | vector<int> L(3N);
| ^~
a.cc:9:18: error: unable to find numeric literal operator 'operator""N'
9 | for (int i=0;i<3N;++i){
| ^~
a.cc:14:3: error: expected primary-expression before 'for'
14 | for (int i=N;i<2N;++i){
| ^~~
a.cc:14:16: error: 'i' was not declared in this scope
14 | for (int i=N;i<2N;++i){
| ^
a.cc:14:18: error: unable to find numeric literal operator 'operator""N'
14 | for (int i=N;i<2N;++i){
| ^~
|
s404726664 | p03767 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<int> a(3 * n);
for (int i = 0; i < 3 * n; i++) {
cin >> a[i];
}
ll ans = 0;
sort(a.begin(), a.end());
for (int i = n; i < 3 * n; i+=2) {
ans += a[i];
}
cout << ans << endl;
return 0; | a.cc: In function 'int main()':
a.cc:23:18: error: expected '}' at end of input
23 | return 0;
| ^
a.cc:8:12: note: to match this '{'
8 | int main() {
| ^
|
s546079471 | p03767 | C++ | int main() {
int n;
cin >> n;
vector<int> l(3*n);
for (auto &c:l) {cin >> c;}
sort(l.begin(),l.end());
long long count=0;
for (int i=0;i<n;i++) {count += l[3*n-2-2*i];}
cout << count << endl;
return 0; | a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
3 | cin >> n;
| ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
4 | vector<int> l(3*n);
| ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
4 | vector<int> l(3*n);
| ^~~
a.cc:5:18: error: 'l' was not declared in this scope
5 | for (auto &c:l) {cin >> c;}
| ^
a.cc:6:10: error: 'l' was not declared in this scope
6 | sort(l.begin(),l.end());
| ^
a.cc:6:5: error: 'sort' was not declared in this scope; did you mean 'short'?
6 | sort(l.begin(),l.end());
| ^~~~
| short
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'count'?
10 | cout << count << endl;
| ^~~~
| count
a.cc:10:22: error: 'endl' was not declared in this scope
10 | cout << count << endl;
| ^~~~
a.cc:11:14: error: expected '}' at end of input
11 | return 0;
| ^
a.cc:1:12: note: to match this '{'
1 | int main() {
| ^
|
s331759106 | p03767 | Java | import java.util.*;
class AtCoder_Group_Contest {
public static void main(String[] args) {
Scanner sc = new Scanner("10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000");
int n = Integer.parseInt(sc.nextLine());
String[] a = sc.nextLine().split(" ");
List<String> list = Arrays.asList(a);
list.sort(Comparator.reverseOrder());
String[] tmp = (String[]) list.toArray(new String[list.size()]);
int[] ia = new int[3 * n];
for (int i = 0; i < 3 * n; i++) {
ia[i] = Integer.parseInt(tmp[i]);
}
long ans = 0;
for (int i = 1, j = 0; j < n; i += 2, ++j)
ans += ia[i];
System.out.println(ans);
}
}import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
String[] a = sc.nextLine().split(" ");
List<String> list = Arrays.asList(a);
list.sort(Comparator.reverseOrder());
String[] tmp = (String[]) list.toArray(new String[list.size()]);
int[] ia = new int[3 * n];
for (int i = 0; i < 3 * n; i++) {
ia[i] = Integer.parseInt(tmp[i]);
}
long ans = 0;
for (int i = 1, j = 0; j < n; i += 2, ++j)
ans += ia[i];
System.out.println(ans);
}
} | Main.java:20: error: class, interface, enum, or record expected
}import java.util.*;
^
1 error
|
s937183549 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void){
int n;
cin >> n;
vector<int> v(n * 3);
for(int i = 0; i < (n * 3); i++) {
cin >> v.at(i);
}
sort(v.begin(), v.end(), greater<int>());
long ans = 0;
for(int i = 0; i < n * 2; i++) {
if(i % 2 != 0) {
ans += v.at(i);
}
}
cout << ans << endl;
| a.cc: In function 'int main()':
a.cc:22:23: error: expected '}' at end of input
22 | cout << ans << endl;
| ^
a.cc:4:15: note: to match this '{'
4 | int main(void){
| ^
|
s148472908 | p03767 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> vec(N*3);
for(auto& v : vec){
cin >> v;
}
sort(vec.begin(), vec.end(), greater<int>());
int ans = 0;
int count = N;
bool second = false;
for(auto& v : vec){
if(second == false){
second = true;
}
else{
ans += v;
second = false;
--count;
if(count == 0){
break;
}
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(vec.begin(), vec.end(), greater<int>());
| ^~~~
| short
|
s722889935 | p03767 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> vec(N);
for(auto& v : vec){
cin >> v;
}
sort(vec.begin(), vec.end(), greater<int>());
int ans = 0;
int count = N;
bool second = false;
for(auto& v : vec){
if(second == false){
second = true;
}
else{
ans += v;
second = false;
--count;
if(count == 0){
break;
}
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(vec.begin(), vec.end(), greater<int>());
| ^~~~
| short
|
s357184912 | p03767 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main() {
int n; cin >> n;
vector<int> a(3*n);
rep(i,3*n) cin >> a[i];
sort(a.begin(),a.end());
reverse(a.begin,a.end());
int sum=0;
rep(i,n){
sum+=a[2*i];
}
cout << sum << endl;
} | a.cc: In function 'int main()':
a.cc:10:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::vector<int>::iterator)'
10 | reverse(a.begin,a.end());
| ~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s381742265 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long Int;
int main(){
Int n;
cin >> n;
vector<Int> a(n);
for(Int i = 0; i < 3*n; i++) cin >> a[i];
sort(a,a+3*n);
Int ans = 0;
int cnt = 0;
for(Int i = 3*n-2; i >= 0; i -= 2){
if(cnt == n) break;
ans += a[i];
cnt++;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:17: error: no match for 'operator+' (operand types are 'std::vector<long long int>' and 'Int' {aka 'long long int'})
11 | sort(a,a+3*n);
| ~^~~~
| | |
| | Int {aka long long int}
| std::vector<long long int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'Int' {aka 'long long int'}
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'Int' {aka 'long long int'}
11 | sort(a,a+3*n);
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: mismatched types 'const _CharT*' and 'std::vector<long long int>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'Int' {aka 'long long int'}
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: mismatched types 'const _CharT*' and 'std::vector<long long int>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'Int' {aka 'long long int'}
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
11 | sort(a,a+3*n);
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)'
340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed:
a.cc:11:20: note: |
s628914613 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin >> n;
vector<long long> a(n);
for(long long i = 0; i < 3*n; i++) cin >> a[i];
sort(a.begin(),a.end());
Int ans = 0;
int cnt = 0;
for(long long i = 3*n-2; i >= 0; i -= 2){
if(cnt == n) break;
ans += a[i];
cnt++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'Int' was not declared in this scope; did you mean 'int'?
11 | Int ans = 0;
| ^~~
| int
a.cc:15:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | ans += a[i];
| ^~~
| abs
a.cc:19:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
19 | cout << ans << endl;
| ^~~
| abs
|
s396110561 | p03767 | C++ | int main(){
long long n;
cin >> n;
vector<long long> a(n);
for(long long i = 0; i < 3*n; i++) cin >> a[i];
sort(a.begin(),a.end());
Int ans = 0;
int cnt = 0;
for(long long i = 3*n-2; i >= 0; i -= 2){
if(cnt == n) break;
ans += a[i];
cnt++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
3 | cin >> n;
| ^~~
a.cc:4:9: error: 'vector' was not declared in this scope
4 | vector<long long> a(n);
| ^~~~~~
a.cc:4:16: error: expected primary-expression before 'long'
4 | vector<long long> a(n);
| ^~~~
a.cc:6:51: error: 'a' was not declared in this scope
6 | for(long long i = 0; i < 3*n; i++) cin >> a[i];
| ^
a.cc:7:14: error: 'a' was not declared in this scope
7 | sort(a.begin(),a.end());
| ^
a.cc:7:9: error: 'sort' was not declared in this scope; did you mean 'short'?
7 | sort(a.begin(),a.end());
| ^~~~
| short
a.cc:9:9: error: 'Int' was not declared in this scope; did you mean 'int'?
9 | Int ans = 0;
| ^~~
| int
a.cc:13:17: error: 'ans' was not declared in this scope
13 | ans += a[i];
| ^~~
a.cc:17:9: error: 'cout' was not declared in this scope
17 | cout << ans << endl;
| ^~~~
a.cc:17:17: error: 'ans' was not declared in this scope
17 | cout << ans << endl;
| ^~~
a.cc:17:24: error: 'endl' was not declared in this scope
17 | cout << ans << endl;
| ^~~~
|
s863683299 | p03767 | C++ | int main(){
cin >> n;
vector<long long> a(n);
for(long long i = 0; i < 3*n; i++) cin >> a[i];
sort(a.begin(),a.end());
Int ans = 0;
int cnt = 0;
for(long long i = 3*n-2; i >= 0; i -= 2){
if(cnt == n) break;
ans += a[i];
cnt++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:2:9: error: 'cin' was not declared in this scope
2 | cin >> n;
| ^~~
a.cc:2:16: error: 'n' was not declared in this scope
2 | cin >> n;
| ^
a.cc:3:9: error: 'vector' was not declared in this scope
3 | vector<long long> a(n);
| ^~~~~~
a.cc:3:16: error: expected primary-expression before 'long'
3 | vector<long long> a(n);
| ^~~~
a.cc:5:51: error: 'a' was not declared in this scope
5 | for(long long i = 0; i < 3*n; i++) cin >> a[i];
| ^
a.cc:6:14: error: 'a' was not declared in this scope
6 | sort(a.begin(),a.end());
| ^
a.cc:6:9: error: 'sort' was not declared in this scope; did you mean 'short'?
6 | sort(a.begin(),a.end());
| ^~~~
| short
a.cc:8:9: error: 'Int' was not declared in this scope; did you mean 'int'?
8 | Int ans = 0;
| ^~~
| int
a.cc:12:17: error: 'ans' was not declared in this scope
12 | ans += a[i];
| ^~~
a.cc:16:9: error: 'cout' was not declared in this scope
16 | cout << ans << endl;
| ^~~~
a.cc:16:17: error: 'ans' was not declared in this scope
16 | cout << ans << endl;
| ^~~
a.cc:16:24: error: 'endl' was not declared in this scope
16 | cout << ans << endl;
| ^~~~
|
s577459344 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> a(3*N);
int ans = 0;
int cnt = 0;
for(int i = 0; i < 3*N; i++){
cin >> a[i];
}
sort(a.begin(),a.end());
for(int i = 3N -2; i >= 0 ; i -=2){
if(cnt == N){
break;
}
ans += a[i];
cnt++;
}
} | a.cc: In function 'int main()':
a.cc:16:15: error: unable to find numeric literal operator 'operator""N'
16 | for(int i = 3N -2; i >= 0 ; i -=2){
| ^~
|
s260726443 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> 3*N;
vector<int> a(3*N);
int ans = 0;
int cnt = 0;
for(int i = 0; i < 3*N; i++){
cin >> a[i];
}
sort(a.begin(),a.end(),greater<int>());
for(int i = 0; i < 3*N; i++){
if(i % 2 == 1){
ans += a[i];
cnt++;
}
if(cnt == N){
break;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:6:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
6 | cin >> 3*N;
| ~~~ ^~ ~~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'int'
6 | cin >> 3*N;
| ~^~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int' to 'void*' [-fpermissive]
6 | cin >> 3*N;
| ~^~
| |
| int
a.cc:6:11: error: cannot bind rvalue '(void*)((long int)(3 * N))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
6 | cin >> 3*N;
| ~^~
| |
| int
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive]
6 | cin >> 3*N;
| ~^~
| |
| int
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int' to 'std::ios_base& (*)(std::ios_base&)' [-fpermissive]
6 | cin >> |
s994663296 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> a(N);
int ans = 0;
int cnt = 0;
for(int i = 0; i < N; i++){
cin >> a[i];
}
sort(a.begin(),a.end(),greater<int>());
for(int i = 0; i < N; i++){
if(i % 2 = 1){
ans += a[i];
cnt++;
}
if(cnt == N/3){
break;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:17:10: error: lvalue required as left operand of assignment
17 | if(i % 2 = 1){
| ~~^~~
|
s684271877 | p03767 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int a[3*n];
for (int i=0;i<3*n;++i) cin >> a[i];
sort(a.begin(),a.end());
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:13:16: error: request for member 'begin' in 'a', which is of non-class type 'int [(n * 3)]'
13 | sort(a.begin(),a.end());
| ^~~~~
a.cc:13:26: error: request for member 'end' in 'a', which is of non-class type 'int [(n * 3)]'
13 | sort(a.begin(),a.end());
| ^~~
|
s573849047 | p03767 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(3*n);
for (int i=0;i<3*n;++i) cin >> a[i];
sort(a.begin(),a.end());
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a.begin(),a.end());
| ^~~~
| short
|
s636529477 | p03767 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
vector(int) a(3*n);
for (int i=0;i<3*n;++i) cin >> a[i];
sort(a.begin(),a.end());
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:10:11: error: missing template arguments before '(' token
10 | vector(int) a(3*n);
| ^
a.cc:10:12: error: expected primary-expression before 'int'
10 | vector(int) a(3*n);
| ^~~
a.cc:11:36: error: 'a' was not declared in this scope
11 | for (int i=0;i<3*n;++i) cin >> a[i];
| ^
a.cc:12:14: error: 'a' was not declared in this scope
12 | sort(a.begin(),a.end());
| ^
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a.begin(),a.end());
| ^~~~
| short
|
s332955263 | p03767 | C++ | int main(){
int n;
cin >> n;
vector(int) a(3*n);
for (int i=0;i<3*n;++i) cin >> a[i];
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
3 | cin >> n;
| ^~~
a.cc:4:12: error: expected primary-expression before 'int'
4 | vector(int) a(3*n);
| ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
4 | vector(int) a(3*n);
| ^~~~~~
a.cc:5:36: error: 'a' was not declared in this scope
5 | for (int i=0;i<3*n;++i) cin >> a[i];
| ^
a.cc:7:34: error: 'a' was not declared in this scope
7 | for (int i=1;i<n;++i) sum += a[3*i-2];
| ^
a.cc:8:5: error: 'cout' was not declared in this scope
8 | cout << sum << endl;
| ^~~~
a.cc:8:20: error: 'endl' was not declared in this scope
8 | cout << sum << endl;
| ^~~~
|
s906502253 | p03767 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
int a[1000000000];
for (int i=0;i<3*n;++i) cin >> a[i];
sort(a.begin(),a.end());
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:12:16: error: request for member 'begin' in 'a', which is of non-class type 'int [1000000000]'
12 | sort(a.begin(),a.end());
| ^~~~~
a.cc:12:26: error: request for member 'end' in 'a', which is of non-class type 'int [1000000000]'
12 | sort(a.begin(),a.end());
| ^~~
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a.begin(),a.end());
| ^~~~
| short
|
s482775681 | p03767 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
int a[1000000000];
for (int i=0;i<3*n;++i) cin >> a[i];
a.sort(a.begin(),a.end());
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:12:11: error: request for member 'sort' in 'a', which is of non-class type 'int [1000000000]'
12 | a.sort(a.begin(),a.end());
| ^~~~
a.cc:12:18: error: request for member 'begin' in 'a', which is of non-class type 'int [1000000000]'
12 | a.sort(a.begin(),a.end());
| ^~~~~
a.cc:12:28: error: request for member 'end' in 'a', which is of non-class type 'int [1000000000]'
12 | a.sort(a.begin(),a.end());
| ^~~
|
s565045768 | p03767 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
int a[3*n];
for (int i=0;i<3*n;++i) cin >> a[i];
a.sort(a.begin(),a.end());
int sum = 0;
for (int i=1;i<n;++i) sum += a[3*i-2];
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:12:11: error: request for member 'sort' in 'a', which is of non-class type 'int [(n * 3)]'
12 | a.sort(a.begin(),a.end());
| ^~~~
a.cc:12:18: error: request for member 'begin' in 'a', which is of non-class type 'int [(n * 3)]'
12 | a.sort(a.begin(),a.end());
| ^~~~~
a.cc:12:28: error: request for member 'end' in 'a', which is of non-class type 'int [(n * 3)]'
12 | a.sort(a.begin(),a.end());
| ^~~
|
s808679700 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> tsuyosa(3*n);
for (int i=0; i<3*n; i++){
cin >> tsuyosa.at(i);
}
sort(tsuyosa.begin(), tsuyosa.end(), greater<int>());
int sum = 0;
for(int i = 0; i < 2 * n; i++) {
if (i % 2 == 1) {
sum += tsuyosa(i);
}
}
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:19:21: error: no match for call to '(std::vector<int>) (int&)'
19 | sum += tsuyosa(i);
| ~~~~~~~^~~
|
s690034825 | p03767 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
vector<long long> arr(3 * n);
for(int i = 0; i < 3 * n; i++){
cin >> arr[i];
}
sort(arr.begin(), arr.end());
long long ans = 0;
for(int i = 3 * n - 2; i >= n; i -= 2){
ans += arr[i];
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:5: error: 'vector' was not declared in this scope
11 | vector<long long> arr(3 * n);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vector>
3 |
a.cc:11:12: error: expected primary-expression before 'long'
11 | vector<long long> arr(3 * n);
| ^~~~
a.cc:14:16: error: 'arr' was not declared in this scope
14 | cin >> arr[i];
| ^~~
a.cc:17:10: error: 'arr' was not declared in this scope
17 | sort(arr.begin(), arr.end());
| ^~~
|
s810148701 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef double db;
typedef vector<long long> vecll;
typedef vector<char> vechar;
typedef vector<string> vecst;
int main(){
ll N;
cin >> N;
vecll a(3 * N);
for(auto& i : a) cin >> i;
sort(a.begin(), a.end());
ll ans = 0;
for(ll i = 0; i < N; i++){
ans += a.at(2 * i + N + 1);
}
cout << ans << end;
} | a.cc: In function 'int main()':
a.cc:23:17: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
23 | cout << ans << end;
| ~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char |
s779689961 | p03767 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
long long a[n*3];
for(long long &x:a)cin>>x;
long long sum=0;
for(int i=0;i<(n*3)-1;i+=3){
sort(a+i,a+(i+3));
sum+=a[i+1];
}
cout<<fixed<<setprecision(0)<<sum;
return 0;
| a.cc: In function 'int main()':
a.cc:14:10: error: expected '}' at end of input
14 | return 0;
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s264408861 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main (){
int N ;
cin >> N ;
double a,b;
cin >> a >> b;
vector<double> x (N);
vector<double> y (N);
for(int i=0;i<N;i++){
cin >> x[i] >> y[i] ;
}
vector<double> kirokuX(N);
vector<double> kirokuY(N);
for(int i=0;i<N;i++){
kirokuX[i] = x[i] - a;
kirokuY[i] = y[i] - b;
}
vector<double> derutaX(N-1);
vector<double> derutaY(N-1);
for(int i=0;i<N-1;i++){
derutaX[i] = x[i] -x[i+1];
derutaY[i] = y[i] -y[i+1];
}
vector<double> sokudoX(N-1);
vector<double> sokudoY(N-1);
for(int i=0;i<N-1;i++){
sokudoX[i] = kirokuX[i+1] / 0.05*(i+1) ;
sokudoY[i] = kirokuY[i+1] / 0.05*(i+1) ;
}
for(int i=0;i<N;i++){
cout << kirokuX[i] << " " << kirokuY[i] << endl;
}
cout << << endl;
for(int i=0;i<N-1;i++){
cout << derutaX[i] << " " << derutaY[i] << endl;
}
cout << << endl;
for(int i=0;i<N-1;i++){
cout << sokudoX[i] << " " <<sokudoY[i] << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:39:12: error: expected primary-expression before '<<' token
39 | cout << << endl;
| ^~
a.cc:43:11: error: expected primary-expression before '<<' token
43 | cout << << endl;
| ^~
|
s947457018 | p03767 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;cin>>n;
vector<long long>v(3*n);
for(auto&& w:v)cin>>w;
sort(begin(v),end(v),greater<long long>());
long long ans=0ll;
for(int i=0;i<n;i++){
ans+=v[2*i+1];
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:9:3: error: 'sort' was not declared in this scope; did you mean 'short'?
9 | sort(begin(v),end(v),greater<long long>());
| ^~~~
| short
|
s118107904 | p03767 | C++ | #include <iostream>
using namespace std;
int main(){
int n;cin>>n;
vector<long long>v(3*n);
for(auto&& w:v)cin>>w;
sort(begin(v),end(v),greater<long long>());
long long ans=0ll;
for(int i=0;i<n;i++){
ans+=v[2*i+1];
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'vector' was not declared in this scope
6 | vector<long long>v(3*n);
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include <iostream>
+++ |+#include <vector>
2 | using namespace std;
a.cc:6:12: error: expected primary-expression before 'long'
6 | vector<long long>v(3*n);
| ^~~~
a.cc:7:22: error: 'v' was not declared in this scope
7 | for(auto&& w:v)cin>>w;
| ^
a.cc:8:14: error: 'v' was not declared in this scope
8 | sort(begin(v),end(v),greater<long long>());
| ^
a.cc:8:3: error: 'sort' was not declared in this scope; did you mean 'short'?
8 | sort(begin(v),end(v),greater<long long>());
| ^~~~
| short
|
s995785602 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, i, ans = 0;
cin >> n;
vector<long> a(3 * n);
for(i = 0; i < 3n; i++){
cin >> a.at(i);
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
for(i = 0; i < n; i++){
ans += a.at(2 * i + 1);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:9:18: error: unable to find numeric literal operator 'operator""n'
9 | for(i = 0; i < 3n; i++){
| ^~
|
s593340130 | p03767 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
// AGC 012 A
int main() {
int N;
int a[100000];
cin >> N;
for (int i = 0; i < N; i++) cin >> a[i];
sort(a, a + N, greater<int>());
int sum = 0;
for (int i = 0; i < N; i++) {
if (i % 3 == 1) sum = a[i];
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | cout << ans << endl;
| ^~~
| abs
|
s986144454 | p03767 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N;
int a[3*(10^5)+10];
cin >> N;
for(int i = 0; i < (3*N); i++){
cin >> a[i];
}
sort(a, a+(3*N), greater<int>);
//例で考える 1 2 5 5 5 8
//(125), (558); (128), (555)
//1 2 3 4 5 6 90 91 92
// *
// 気持ち: 一番大きいのをいつ使うかで場合分け
// hoge hoge maxだとして、
// 要は,a[N]+a[N+2]+ ..... +a[3N-1]
long long int ans = 0;
/*
for(int i =0; i< N; i++){
ans = ans + a[N+(2*i)];
}
*/
for(int i = 0; i< N; i++){
ans = ans +a[2*i];
}
cout << ans << endl;
/*
for(int i = 0; i < 3*N; i++){
cout << a[i] << endl;
}
*/
} | a.cc: In function 'int main()':
a.cc:8:16: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
8 | int a[3*(10^5)+10];
| ^
| ---
| 1e
a.cc:8:14: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
8 | int a[3*(10^5)+10];
| ^~
| 0xa
a.cc:14:34: error: expected primary-expression before ')' token
14 | sort(a, a+(3*N), greater<int>);
| ^
|
s203882314 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> A(3*N);
for(int i=0; i < 3*N; i++){
cin>> A.at(i);
}
sort(A.begin(),A.end());
int ans =0;
for(int i=0; i <2N ; i++){
if(i%2 ==0){
ans += A.at(N+i);
}
}
cout<< ans <<endl;
} | a.cc: In function 'int main()':
a.cc:13:19: error: unable to find numeric literal operator 'operator""N'
13 | for(int i=0; i <2N ; i++){
| ^~
|
s501888366 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> A(3*N);
for(int i=0; i < 3*N; i++){
cin>> A.at(i);
}
sort(A.begin(),A.end());
reverse(A.begin(),A.end());
int ans =0;
for(int i=0; i < 2*N; i++){
if(i%2 ==1){
ans += A.(i);
}
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:16:16: error: expected unqualified-id before '(' token
16 | ans += A.(i);
| ^
|
s949247852 | p03767 | C++ | n=gets.to_i/3
puts gets.split[n,2*n].map(&:to_i).each_cons(2){|x,y| x}.inject(&:+) | a.cc:1:1: error: 'n' does not name a type
1 | n=gets.to_i/3
| ^
a.cc:2:57: error: expected unqualified-id before '.' token
2 | puts gets.split[n,2*n].map(&:to_i).each_cons(2){|x,y| x}.inject(&:+)
| ^
|
s380090998 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int M;
vector<int> A(M);
cin >> M;
N = M / 3;
for (int i = 0; i < M; i++) {
cin >> A.at(i);
}
sort(A.begin(), A.end());
reverse(A.begin(), A.end());
int s = 0;
for (int i = 0; i < N; i++) {
s += A.at(i * 2 + 1);
}
cout << s << endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: 'N' was not declared in this scope
8 | N = M / 3;
| ^
|
s313848919 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int M;
vector<int> A(M);
cin >> M;
N = M / 3;
for (int i = 0; i < M; i++) {
cin >> A.at(M);
}
sort(A.begin(), A.end());
reverse(A.begin(), A.end());
int s = 0;
for (int i = 0; i < N; i++) {
s += A.at(i * 2 + 1);
}
cout << s << endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: 'N' was not declared in this scope
8 | N = M / 3;
| ^
|
s701854788 | p03767 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int M;
vector<int> A(M)
cin >> M;
N = M / 3;
for (int i = 0; i < M; i++) {
cin >> A.at(M);
}
sort(A.begin(), A.end());
reverse(A.begin(), A.end());
int s = 0;
for (int i = 0; i < N; i++) {
s += A.at(i * 2 + 1);
}
cout << s << endl;
} | a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'cin'
7 | cin >> M;
| ^~~
a.cc:8:3: error: 'N' was not declared in this scope
8 | N = M / 3;
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.