submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s507657969 | p03845 | C++ | #include<iostream>
using namespace std;
int main(){
int N,M,T[100],P,X;
int sum=0;
cin>>N;
for(int i=0;i<N;++i){
cin>>T[i];
sum+=T[i];
]
cin>>M;
for(int i=0;i<M;++i){
cin>>P>>X;
sum+=P-T[X-1];
cout<<sum<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:7: error: expected primary-expression before ']' token
11 | ]
| ^
a.cc:19:2: error: expected '}' at end of input
19 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s231229883 | p03845 | C++ | #include <iostream>
using namespace std;
int main() {
int N;
int T[100] = {0};
int M;
int P[100] = {0};
int X[100] = {0};
int sum = 0;
cin >> N;
for (int i = 0; i <= N; i++) {
cin >> T[i]:
sum += T[i];
}
cin >> M;
for (int i = 0; i <= M; i++) {
cin >> P[i] >> X[i];
}
for (int i = 0; i <= M; i++) {
cout << (sum - T[P[i]] + X[i]) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:16: error: expected ';' before ':' token
15 | cin >> T[i]:
| ^
| ;
|
s290593228 | p03845 | C++ | #include <iostream>
using namespace std;
int main() {
int N;
int T[100] = {0};
int M;
int P[100] = {0};
int X[100] = {0};
int sum = 0;
cin >> N;
for (int i == 0; i <= N; i++) {
cin >> T[i]:
sum += T[i];
}
cin >> M;
for (int i == 0; i <= M; i++) {
cin >> P[i] >> X[i];
}
for (int i == 0; i <= M; i++) {
cout << (sum - T[P[i]] + X[i]) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:13: error: expected ';' before '==' token
14 | for (int i == 0; i <= N; i++) {
| ^~~
| ;
a.cc:14:14: error: expected primary-expression before '==' token
14 | for (int i == 0; i <= N; i++) {
| ^~
a.cc:14:26: error: expected ')' before ';' token
14 | for (int i == 0; i <= N; i++) {
| ~ ^
| )
a.cc:14:28: error: 'i' was not declared in this scope
14 | for (int i == 0; i <= N; i++) {
| ^
a.cc:20:13: error: expected ';' before '==' token
20 | for (int i == 0; i <= M; i++) {
| ^~~
| ;
a.cc:20:14: error: expected primary-expression before '==' token
20 | for (int i == 0; i <= M; i++) {
| ^~
a.cc:20:26: error: expected ')' before ';' token
20 | for (int i == 0; i <= M; i++) {
| ~ ^
| )
a.cc:24:13: error: expected ';' before '==' token
24 | for (int i == 0; i <= M; i++) {
| ^~~
| ;
a.cc:24:14: error: expected primary-expression before '==' token
24 | for (int i == 0; i <= M; i++) {
| ^~
a.cc:24:26: error: expected ')' before ';' token
24 | for (int i == 0; i <= M; i++) {
| ~ ^
| )
|
s811683325 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m, sum = 0;
cin >> n;
vector<int> t(n);
for (int i = 0; i < n; i++)
{
cin >> t[i];
sum += t[i];
}
cin >> m;
vector<int> p(m), x(m);
for (i = 0; i < m; ++i)
cin >> p[i] >> x[i];
for (i = 0; i < m; ++i)
{
j = p[i] - 1;
cout << sum - t[j] + x[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:16:10: error: 'i' was not declared in this scope
16 | for (i = 0; i < m; ++i)
| ^
a.cc:18:10: error: 'i' was not declared in this scope
18 | for (i = 0; i < m; ++i)
| ^
a.cc:20:9: error: 'j' was not declared in this scope
20 | j = p[i] - 1;
| ^
|
s759207239 | p03845 | C++ | #include <iostream>
using namespace std;
int main(){
int N, M, ans;
cin >> N;
int T[N];
for(int i=0; i<N, i++){
cin >> T[i];
}
cin >> M;
int P[M], X[M];
for(int j=0; j<M; j++){
cin >> P[j] >> X[j];
}
for(int i=0; i<M; i++){
ans = 0;
for(int j=0; j<N; j++){
ans += i==j ? X[j] : T[i] ;
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:24: error: expected ';' before ')' token
9 | for(int i=0; i<N, i++){
| ^
| ;
|
s162397169 | p03845 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m;
cin >> n;
vector<int> t(n);
for (int a = 0; a < n; a++) {
cin >> t[a];
}
cin >> m;
for (int a = 0; a < m; a++) {
int p, x;
cin >> p >> x;
cout << accumulate(t.begin(), t.end(), 0) + x - t[p-1] << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:25: error: 'accumulate' was not declared in this scope
18 | cout << accumulate(t.begin(), t.end(), 0) + x - t[p-1] << endl;
| ^~~~~~~~~~
|
s527012052 | p03845 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
int t[110];
int p[110];
int x[110];
int n, m, time;
int main() {
cin >> n;
rep(i, n) cin >> t[i];
cin >> m;
rep(i, m) cin >> p[i] >> x[i];
rep(i, m) {
time = 0;
rep(j, n) {
if(j+1 == p[i]) {
time += x[i];
}else {
time += t[j];
}
}
cout << time << endl;
}
return 0;
}
| a.cc:11:11: error: 'int time' redeclared as different kind of entity
11 | int n, m, time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:20:10: error: assignment of function 'time_t time(time_t*)'
20 | time = 0;
| ~~~~~^~~
a.cc:23:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time += x[i];
| ~~~~~^~~~~~~
a.cc:23:14: error: assignment of read-only location 'time'
a.cc:25:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time += t[j];
| ~~~~~^~~~~~~
a.cc:25:14: error: assignment of read-only location 'time'
|
s589486552 | p03845 | Java | import java.util.*
class Main{
public static void main (String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t[] = new int[n];
int sum = 0;
for(int i=0;i<n;i++){
t[i] = sc.nextInt();
sum += t[i];
}
int m = sc.nextInt();
int sumdri;
for(int i=0;i<m;i++){
int p = sc.nextInt();
int x = sc.nextInt();
System.out.println(sum - t[p-1]+x);
}
}
} | Main.java:1: error: ';' expected
import java.util.*
^
1 error
|
s503864458 | p03845 | Java | class Main{
public static void main (String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t[] = new int[n];
int sum = 0;
for(int i=0;i<n;i++){
t[i] = sc.nextInt();
sum += t[i];
}
int m = sc.nextInt();
int sumdri;
for(int i=0;i<m;i++){
int p = sc.nextInt();
int x = sc.nextInt();
System.out.println(sum - t[p-1]+x);
}
}
} | Main.java:5: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:5: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s603141273 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
int main(){
int n; cin >> n;
ll t[n];
ll all_time = 0;
for(int i = 0; i < n; i++){
cin >> t[i];
all_time += t[i];
}
ll ans = all_time;
int m; cin >> m;
int p[m], x[m];
for(int i = 0; i < m; i++){
cin >> p[i] >> x[i];
}
for(int i = 0; i < m; i++){
ans -= t[p[i]];
ans += x[i]
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:20: error: expected ';' before 'cout'
26 | ans += x[i]
| ^
| ;
27 | cout << ans << endl;
| ~~~~
|
s175716467 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
int main(){
int n; cin >> n;
ll t[n];
ll all_time = 0;
for(int i = 0; i < n; i++){
cin >> t[i];
all_time += t[i];
}
ll ans = all_time;
int m; cin >> m;
int p[m], x[m];
for(int i = 0; i < m; i++){
cin >> p[i] >> x[i];
}
for(int i = 0; i < m; i++){
ans -= t[p[i]];
ans += x[i]
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:20: error: expected ';' before 'cout'
26 | ans += x[i]
| ^
| ;
27 | cout << ans << endl;
| ~~~~
|
s540798195 | p03845 | C | #include<stdio.h>
int N, M, T[100], P, X, sum, max, i, j;
int main(){
scanf("%d\n", &N);
for(i=0; i<N; i++){
scanf("%d", &T[i]);
sum+=T[i];
}
scanf("%d\n", &M);
for(i=0; i<M; i++){
scanf("%d%d", &P, &X);
if(T[P]>max+X){max=T[P]-X}
}
printf("%d\n", sum-max;);
}
| main.c: In function 'main':
main.c:12:30: error: expected ';' before '}' token
12 | if(T[P]>max+X){max=T[P]-X}
| ^
| ;
main.c:14:25: error: expected ')' before ';' token
14 | printf("%d\n", sum-max;);
| ~ ^
| )
|
s408107609 | p03845 | C++ | #include <iostream>
using namespace std;
int main(){
int n, m, sum = 0;
int t[101] = {0}, p[101] = {0}, x[101] = {0};
cin >> n;
for ( int i = 1; i <= n; i++ ){
cin >> t[i];
sum += t[i];
}
cin >> m;
for ( int i = 0; i < m, i++ ){
cin >> p[i] >> x[i];
}
for( int i = 0; i < m; i++ ){
cout << sum - t[ p[i] ] + x[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:14:30: error: expected ';' before ')' token
14 | for ( int i = 0; i < m, i++ ){
| ^~
| ;
|
s322844410 | p03845 | C++ | #include <pch.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int A, B;
char op;
int N, M;
int main(){
cin >> N;
vector <int> T(N);
for (int i = 0; i < N; i++) {
cin >> T[i];
}
cin >> M;
vector <int> PX[100];
vector <int> P(N),X(N);
//int P, X;
for (int i = 0; i < M; i++) {
cin >> P[i] >> X[i];
// PX[P[i]].push_back(X[i]);
}
int res = 0;
for (int i = 0; i < M; i++) {
for (int j = 0; j < N;j++) {
if (j+1 == P[i]) {
res += X[i];
}
else res += T[j];
}
cout << res << endl;
res = 0;
}
} | a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include <pch.h>
| ^~~~~~~
compilation terminated.
|
s061848992 | p03845 | C++ | #include <iostream>
#include <numeric>
using namespace std;
int main() {
int n, m;
cin >> n;
int t[n];
for (int i = 0; i < n; i++) { cin >> t[i]; }
cin >> m;
int p[m][m];
for (int i = 0; i < m; i++) { cin >> p[i][i]; }
int sum = accumulate(t[0],t[n-1], 0);
for (int i = 0; i < m; i++) {
sum += p[i][1] - m[i];
cout << res << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:23: error: invalid types 'int[int]' for array subscript
16 | sum += p[i][1] - m[i];
| ^
a.cc:17:13: error: 'res' was not declared in this scope
17 | cout << res << endl;
| ^~~
In file included from /usr/include/c++/14/numeric:62,
from a.cc:2:
/usr/include/c++/14/bits/stl_numeric.h: In instantiation of '_Tp std::accumulate(_InputIterator, _InputIterator, _Tp) [with _InputIterator = int; _Tp = int]':
a.cc:14:23: required from here
14 | int sum = accumulate(t[0],t[n-1], 0);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:141:48: error: invalid type argument of unary '*' (have 'int')
141 | __init = _GLIBCXX_MOVE_IF_20(__init) + *__first;
| ^~~~~~~~
|
s017413403 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std,
int main(){
int n;cin>>n;
int sum=0;
int t[n];for(int i=0;i<n;i++){
cin>>t[i];
sum+=t[i];
}
int m;cin>>m;
int p[m],x[m];
for(int i=0;i<m;i++)cin>>p[i]>>x[i];
int ans[m];
for(int i=0;i<m;i++){
cout<<sum-t[p[i]]+x[i]<<endl;
}
}
| a.cc:2:20: error: expected ';' before ',' token
2 | using namespace std,
| ^
| ;
a.cc:2:20: error: expected unqualified-id before ',' token
a.cc:3:1: error: expected unqualified-id before 'int'
3 | int main(){
| ^~~
|
s965613385 | p03845 | C++ | #include<bots/stdc++.h>
using namespace std,
int main(){
int n;cin>>n;
int sum=0;
int t[n];for(int i=0;i<n;i++){
cin>>t[i];
sum+=t[i];
}
int m;cin>>m;
int p[m],x[m];
for(int i=0;i<m;i++)cin>>p[i]>>x[i];
int ans[m];
for(int i=0;i<m;i++){
cout<<sum-t[p[i]]+x[i]<<endl;
}
}
| a.cc:1:9: fatal error: bots/stdc++.h: No such file or directory
1 | #include<bots/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s046266650 | p03845 | C++ | #include<bit/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int T[N];
for(int i=0;i<N;i++){
cin >> T[i];
}
int M;
cin >> M;
int P[M], X[M];
for (int i = 0; i < M; i++) {
cin >> P[i] >> X[i];
}
int sum = 0;
for(int i = 0; i < N; i++) {
sum += T[i];
}
for (int i = 0; i < M; i++) {
int ans = sum;
ans -= T[P[i] - 1] - X[i];
cout << ans << endl;
}
} | a.cc:1:9: fatal error: bit/stdc++.h: No such file or directory
1 | #include<bit/stdc++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s728598027 | p03845 | C++ | Last login: Thu Oct 18 20:56:45 on console
cd co asanomasakinoMacBook-Pro:~ asanomaki$ cd co
-bash: cd: co: No such file or directory
asanomasakinoMacBook-Pro:~ asanomaki$ cd atcoder/
asanomasakinoMacBook-Pro:atcoder asanomaki$ ls
abc
asanomasakinoMacBook-Pro:atcoder asanomaki$ cd abc/
asanomasakinoMacBook-Pro:abc asanomaki$ ls
a a.out b
asanomasakinoMacBook-Pro:abc asanomaki$ cd b
asanomasakinoMacBook-Pro:b asanomaki$ ls
42.cpp copy.cpp try.cpp
a.out moji.cpp try2.cpp
asanomasakinoMacBook-Pro:b asanomaki$ vim 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ g++ 50.cpp
50.cpp:8:14: warning: variable 'm' is uninitialized when used here
[-Wuninitialized]
int t[n], p[m], x[m];
^
50.cpp:7:10: note: initialize the variable 'm' to silence this warning
int n, m;
^
= 0
50.cpp:8:8: warning: variable 'n' is uninitialized when used here
[-Wuninitialized]
int t[n], p[m], x[m];
^
50.cpp:7:7: note: initialize the variable 'n' to silence this warning
int n, m;
^
= 0
2 warnings generated.
asanomasakinoMacBook-Pro:b asanomaki$ vim 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ g++ 50.cpp
50.cpp:8:8: warning: variable 'n' is uninitialized when used here
[-Wuninitialized]
int t[n], p[m], x[m];
^
50.cpp:7:7: note: initialize the variable 'n' to silence this warning
int n, m;
^
= 0
50.cpp:8:14: warning: variable 'm' is uninitialized when used here
[-Wuninitialized]
int t[n], p[m], x[m];
^
50.cpp:7:10: note: initialize the variable 'm' to silence this warning
int n, m;
^
= 0
2 warnings generated.
asanomasakinoMacBook-Pro:b asanomaki$ vim 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ g++ 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ ./a.out
3
2 1 4
2
1 1
2 3
6
8
asanomasakinoMacBook-Pro:b asanomaki$ vim 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ g++ 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ ./a.out
3
2 1 4
2
1 1
2 3
6
8
asanomasakinoMacBook-Pro:b asanomaki$ vim 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ g++ 50.cpp
asanomasakinoMacBook-Pro:b asanomaki$ ./a.out
3
2 1 4
2
1 1
2 3
6
9
asanomasakinoMacBook-Pro:b asanomaki$ ./a.out
5
7 2 3 8 5
3
4 2
1 7
4 13
19
25
30
asanomasakinoMacBook-Pro:b asanomaki$ vim 50.cpp
cin >> n;
int t[n];
for (int i = 0; i < n; i++) {
cin >> t[i];
}
cin >> m;
int p[m], x[m];
for (int j = 0; j < m; j++) {
cin >> p[j] >> x[j];
}
int sum = 0;
for (int k = 0; k < m; k++) {
sum = 0;
int pre = t[p[k] - 1];
t[p[k] - 1] = x[k];
for (int l = 0; l < n; l++) {
sum += t[l];
}
t[p[k] - 1] = pre;
cout << sum << endl;
}
}
| a.cc:1:1: error: 'Last' does not name a type
1 | Last login: Thu Oct 18 20:56:45 on console
| ^~~~
a.cc:19:21: error: expected unqualified-id before '^' token
19 | ^
| ^
a.cc:22:17: error: expected unqualified-id before '^' token
22 | ^
| ^
a.cc:27:15: error: expected unqualified-id before '^' token
27 | ^
| ^
a.cc:30:14: error: expected unqualified-id before '^' token
30 | ^
| ^
a.cc:38:15: error: expected unqualified-id before '^' token
38 | ^
| ^
a.cc:41:14: error: expected unqualified-id before '^' token
41 | ^
| ^
a.cc:46:21: error: expected unqualified-id before '^' token
46 | ^
| ^
a.cc:49:17: error: expected unqualified-id before '^' token
49 | ^
| ^
a.cc:95:11: error: 'n' was not declared in this scope
95 | int t[n];
| ^
a.cc:96:5: error: expected unqualified-id before 'for'
96 | for (int i = 0; i < n; i++) {
| ^~~
a.cc:96:21: error: 'i' does not name a type
96 | for (int i = 0; i < n; i++) {
| ^
a.cc:96:28: error: 'i' does not name a type
96 | for (int i = 0; i < n; i++) {
| ^
a.cc:99:5: error: 'cin' does not name a type
99 | cin >> m;
| ^~~
a.cc:100:11: error: 'm' was not declared in this scope
100 | int p[m], x[m];
| ^
a.cc:100:17: error: 'm' was not declared in this scope
100 | int p[m], x[m];
| ^
a.cc:101:5: error: expected unqualified-id before 'for'
101 | for (int j = 0; j < m; j++) {
| ^~~
a.cc:101:21: error: 'j' does not name a type
101 | for (int j = 0; j < m; j++) {
| ^
a.cc:101:28: error: 'j' does not name a type
101 | for (int j = 0; j < m; j++) {
| ^
a.cc:105:5: error: expected unqualified-id before 'for'
105 | for (int k = 0; k < m; k++) {
| ^~~
a.cc:105:21: error: 'k' does not name a type
105 | for (int k = 0; k < m; k++) {
| ^
a.cc:105:28: error: 'k' does not name a type
105 | for (int k = 0; k < m; k++) {
| ^
a.cc:115:1: error: expected declaration before '}' token
115 | }
| ^
|
s572419716 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int sum(vector<int> n){
int l = n.size();
int s = 0;
for(int i = 0;i<l;i++){
s += n[i];
}
return s;
}
int main() {
int N;
cin >> N;
vector<int> t(N);
for(int i=0;i<N;i++){
cin >> t[i];
}
int M;
cin >> M;
for(int i=0;i<M;i++){
int p,x;
cin >> p >> x;
t[p-1] = x;
cout << sum(s) << endl;
}
} | a.cc: In function 'int main()':
a.cc:27:17: error: 's' was not declared in this scope
27 | cout << sum(s) << endl;
| ^
|
s520271068 | p03845 | Java | import java.util.Scanner;
public class Mani {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int mondaisuu = sc.nextInt();
int[]mondai = new int [mondaisuu];
for (int i = 0; i < mondaisuu;i ++){
mondai[i] = sc.nextInt();
}
int nomimonosuu = sc.nextInt();
for(int i = 0; i < nomimonosuu; i++){
int int1 = 0;
for(int j = 0; j<nomimonosuu; j++){
int1 += sc.nextInt();
}
int a = mondaisuu - nomimonosuu;
for(int k = 0; k < a;k++){
int1 += mondai[k + nomimonosuu];
}
System.out.println(int1);
}
}
}
| Main.java:3: error: class Mani is public, should be declared in a file named Mani.java
public class Mani {
^
1 error
|
s203896075 | p03845 | C++ | #include <iostream>
#include <vector>
int main() {
int N;
std::cin >> N;
std::vector<int> T(N);
for (int i = 0; i < N; ++i) {
std::cin >> T[i];
}
int M;
std::cin << M;
std::vector<int> P(M);
std::vector<int> X(M);
for (int i = 0; i < N; ++i) {
std::cin >> P[i] >> X[i];
}
for (int i = 0; i < M; ++i) {
int time = 0;
for (int j = 0; j < N; ++j) {
if ( P[i] == j ) time += X[i];
else time += T[i];
}
std::cout << time << std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:12: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
12 | std::cin << M;
| ~~~~~~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:12:12: note: candidate: 'operator<<(int, int)' (built-in)
12 | std::cin << M;
| ~~~~~~~~~^~~~
a.cc:12:12: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:12:8: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
12 | std::cin << M;
| ~~~~~^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:12:15: required from here
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
|
s127350573 | p03845 | C++ | #include <iostream>
#include <vector>
int main() {
int N;
std::cin >> N;
std::vector<int> T(N);
for (int i = 0; i < N; ++i) {
std::cin >> T[i];
}
int M;
std::cin << M;
std::vector<int> P(M);
std::vector<int> X(M);
for (int i = 0; i < N; ++i) {
std::cin >> P[i] >> X[i];
}
for (int i = 0; i < M; ++i) {
int time = 0;
for (int j = 0; j < N; ++j) {
if ( P[i] == j ) time += X[i];
else time += T[i]
}
std::cout << time << std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:12: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
12 | std::cin << M;
| ~~~~~~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:12:12: note: candidate: 'operator<<(int, int)' (built-in)
12 | std::cin << M;
| ~~~~~~~~~^~~~
a.cc:12:12: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:12:8: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
12 | std::cin << M;
| ~~~~~^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:12:15: required from here
12 | std::cin << M;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
a.cc:23:24: error: expected ';' before '}' token
23 | else time += T[i]
| ^
| ;
24 | }
| ~
|
s046284789 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int i,N,array[101],M,array2[101],array3[101],array4[101]={},array5[101],j;
cin>>N;
for(i=0;i<N;i++){
cin>>array[i];
array5[i]=array[i];
}
cin>>M;
for(i=0;i<M;i++){
cin>>array2[i]>>array3[i];
}
for(i=0;i<M;i++){
array[array2[i]-1]=array3[i];
for(int j=0;j<N;j++){
array4[i]+=array[j];
}
cout<<array4[i]<<endl;
array[array2[i]-1]=arrayarray[array2[i]-1];
}
}
| a.cc: In function 'int main()':
a.cc:21:24: error: 'arrayarray' was not declared in this scope
21 | array[array2[i]-1]=arrayarray[array2[i]-1];
| ^~~~~~~~~~
|
s061147276 | p03845 | C | #include<stdio.h>
#dfine MAX 100000
int main(void)
{
int i,j;
int N,M;
int res[M]={};
int T[MAX],P[N],X[MAX];
printf("N : ");
scanf("%d",&N);
printf("Time : \n");
for(i=0;i<N;i++){
scanf("%d",&T[i]);
}
printf("M : ");
scacnf("%d",&M);
printf("P_i , X_i :");
for(i=0;i<M;i++){
scanf("%d",P[i]);
scanf("%d",X[i]);
}
for(i=0;i<M;i++){
for(j=0;j<N;j++){
if(j == i){
res[i] += T[j];
}
else{
res[i] += X[j];
}
}
}
for(i=0;i<M;i++){
printf("%d\n",res[i]);
}
return 0;
} | main.c:2:2: error: invalid preprocessing directive #dfine; did you mean #define?
2 | #dfine MAX 100000
| ^~~~~
| define
main.c: In function 'main':
main.c:9:9: error: 'MAX' undeclared (first use in this function)
9 | int T[MAX],P[N],X[MAX];
| ^~~
main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:3: error: implicit declaration of function 'scacnf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
20 | scacnf("%d",&M);
| ^~~~~~
| scanf
|
s804968422 | p03845 | C++ | #include<iostream>
using namespace std;
int main(){
int N;
cin>>N;
int
for(int i=0;i<N;i++)cin>>PP[i];
int M;
for(int y=0;y<M;y++)cin>>M[y];
for(int p=0;p<N;p++)cin>>pp[p];
y=p;
int x;
cin>>x;
pp[p]=x;
for(int g=0;g<N;g++){
int z;
z=z+pp[g];
cout<<z<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:1: error: expected unqualified-id before 'for'
8 | for(int i=0;i<N;i++)cin>>PP[i];
| ^~~
a.cc:8:13: error: 'i' was not declared in this scope
8 | for(int i=0;i<N;i++)cin>>PP[i];
| ^
a.cc:10:27: error: invalid types 'int[int]' for array subscript
10 | for(int y=0;y<M;y++)cin>>M[y];
| ^
a.cc:11:26: error: 'pp' was not declared in this scope; did you mean 'p'?
11 | for(int p=0;p<N;p++)cin>>pp[p];
| ^~
| p
a.cc:12:1: error: 'y' was not declared in this scope
12 | y=p;
| ^
a.cc:12:3: error: 'p' was not declared in this scope
12 | y=p;
| ^
a.cc:15:9: error: 'pp' was not declared in this scope
15 | pp[p]=x;
| ^~
|
s322673605 | p03845 | C++ | #include <bits/stdc++h>
using namespace std;
int main()
{
int n,m,a,b=0;
cin>>n;
int t[n];
for(int i=0;i<n;i++) cin>>t[i];
cin>>m;
int p[m],x[m];
for(int i=0;i<m;i++) { cin>>p[i]; cin>>x[i];}
for(int i=0;i<m;i++) {
a=t[p[i]];
for(int j=0;j<n;j++){
b+=t[j];
}
cout<<b-a+x[i];
}
return 0;
} | a.cc:1:10: fatal error: bits/stdc++h: No such file or directory
1 | #include <bits/stdc++h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s998606421 | p03845 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int n/*quiz*/;
cin>>n;
int c=0;
int t[100];
for(int i=0;i<n;i++)cin>>t[i];c+=t[i];
int m/*drink*/;
cin>>m;
int p[100],x[100];
for(int i=0;i<m;i++)cin>>p[i]>>x[i];
for(int i=0;i<m;i++){
cout<<c-t[p[i]-1]+x[i]<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:44: error: 'i' was not declared in this scope
11 | for(int i=0;i<n;i++)cin>>t[i];c+=t[i];
| ^
|
s339879813 | p03845 | C++ | #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#if __cplusplus >= 201103
#include <numeric>
#endif
using namespace std;
int main(){
int n;
vector<int> times(n);
for(int i=0;i<n;i++){
cin >> times.at(i);
}
int m;
cin >> m;
vector<int> ps(m), xs(m);
for(int j=0;j<m;j++){
int sum =0;
for(int k=0;k<n;k++){
if(k==ps.at(j)){
sum += xs(j);
}
else sum += times.at(k);
}
cout << sum << endl;
}
} | a.cc: In function 'int main()':
a.cc:34:26: error: no match for call to '(std::vector<int>) (int&)'
34 | sum += xs(j);
| ~~^~~
|
s523967915 | p03845 | C | int n;
int a[100];
scanf("%d", &n);
for (int i = 0;i<n;i++) {
scanf("%d", &a[i]);
}
int m;
int p[100];
int x[100];
scanf("%d", &m);
for (int i = 0;i<m;i++) {
scanf("%d %d", &p[i], &x[i]);
}
int sum;
for (int k = 0;k < m;k++) {
sum = 0;
for (int j = 0;j < n;j++) {
sum += a[j];
}
sum -= a[p[k] - 1];
sum += x[k];
printf("%d\n", sum);
} | main.c:3:15: error: expected declaration specifiers or '...' before string constant
3 | scanf("%d", &n);
| ^~~~
main.c:3:21: error: expected declaration specifiers or '...' before '&' token
3 | scanf("%d", &n);
| ^
main.c:4:9: error: expected identifier or '(' before 'for'
4 | for (int i = 0;i<n;i++) {
| ^~~
main.c:4:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
4 | for (int i = 0;i<n;i++) {
| ^
main.c:4:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
4 | for (int i = 0;i<n;i++) {
| ^~
main.c:10:15: error: expected declaration specifiers or '...' before string constant
10 | scanf("%d", &m);
| ^~~~
main.c:10:21: error: expected declaration specifiers or '...' before '&' token
10 | scanf("%d", &m);
| ^
main.c:11:9: error: expected identifier or '(' before 'for'
11 | for (int i = 0;i<m;i++) {
| ^~~
main.c:11:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
11 | for (int i = 0;i<m;i++) {
| ^
main.c:11:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
11 | for (int i = 0;i<m;i++) {
| ^~
main.c:15:9: error: expected identifier or '(' before 'for'
15 | for (int k = 0;k < m;k++) {
| ^~~
main.c:15:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
15 | for (int k = 0;k < m;k++) {
| ^
main.c:15:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
15 | for (int k = 0;k < m;k++) {
| ^~
|
s408954224 | p03845 | C | #include<iostream>
using namespace std;
int main(){
cout<<"hello";
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s579493969 | p03845 | C | #include <stdio.h>
#include<string.h>
#define ll long long
int main() {
ll a[100010];
ll n , m ,p,q,i;
scanf("%lld",&n);
for ( i = 1; i <=n; i++) {
scanf("%lld",&a[i]);
}
scanf("%lld",&m);
for ( i = 1; i <=m; i++) {
scanf("%lld%lld",&p,&q);
ll temp=a[p];
a[p] = q;
ll t = 0;
for (int j = 1; j<=n; ++j) {
t = t + a[j];
}
printf("%lld",t);
a[p]=temp;
}
| main.c: In function 'main':
main.c:26:5: error: expected declaration or statement at end of input
26 | }
| ^
|
s702294186 | p03845 | C++ | #include<iostream>
using namespace std;
int main(){
int N;
cin>>N;
int data[N];
for (int i=0;i<N;++i){
cin>>data[i];
}
int M=0;
cin>>M;
int P[M];
int sum[M];
int P_time[M];
for (int i=0;i<M;++i){
cin>>P[i];
sum[i]=0;
cin>>P_time[i];
}
int a=sizeof(P_time)/sizeof(*P_time);
for (int i=0;i<M;i++){
for (int j=0;j<N;j++){
if (i==j){
sum[i]+=P_time[i];
}
else {
sum[i]+=data[j];
}
}
}
for (int i=0;i<M;i++){
cout<<sum[i]<<endl;
}
| a.cc: In function 'int main()':
a.cc:50:2: error: expected '}' at end of input
50 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s717991040 | p03845 | C++ | int main() {
int N, M, i, a,b,c;
int ans = 0;
int *T;
cin >> N;
T = new int[N];
for (i = 0; i < N; i++) cin >> T[i];
cin >> M;
for (i = 0; i < M; i++) {
cin >> a >> b;
c = T[a - 1];
T[a - 1] = b;
for (int n = 0; n < N; n++) ans += T[n];
cout << ans << endl;
ans = 0;
T[a - 1] = c;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
5 | cin >> N;
| ^~~
a.cc:14:17: error: 'cout' was not declared in this scope
14 | cout << ans << endl;
| ^~~~
a.cc:14:32: error: 'endl' was not declared in this scope
14 | cout << ans << endl;
| ^~~~
|
s444605691 | p03845 | C++ | #include <iostream>
#include <array>
using namespace std;
int main() {
int N;
int M;
cin >> N;
std::array<int, 100> arrayT;
for_each(arrayT.begin(), arrayT.end(), [](int x) {
std::cin >> x;
});
cin >> M;
std::array<int, 100> arrayP;
std::array<int, 100> arrayX;
for (int i = 0; i < M; ++i) {
cin >> arrayP[i] >> arrayX[i];
}
std::array<int, 100> array_ans;
for (int j = 0; j < M; ++j) {
int arrayT_total = 0;
for (int i = 2; i < arrayT.size(); ++i) {
arrayT_total += arrayT[i];
}
array_ans[j] = arrayP[j] + arrayX[j] + arrayT_total;
cout << array_ans[j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:5: error: 'for_each' was not declared in this scope
13 | for_each(arrayT.begin(), arrayT.end(), [](int x) {
| ^~~~~~~~
|
s338550904 | p03845 | C++ | #include <iostream>
#include <array>
using namespace std;
int main() {
int N;
int M;
cin >> N;
std::array<int, 100> arrayT;
std::for_each(arrayT.begin(), arrayT.end(), [](int x) {
std::cin >> x;
});
cin >> M;
std::array<int, 100> arrayP;
std::array<int, 100> arrayX;
for (int i = 0; i < M; ++i) {
cin >> arrayP[i] >> arrayX[i];
}
std::array<int, 100> array_ans;
for (int j = 0; j < M; ++j) {
int arrayT_total = 0;
for (int i = 2; i < arrayT.size(); ++i) {
arrayT_total += arrayT[i];
}
array_ans[j] = arrayP[j] + arrayX[j] + arrayT_total;
cout << array_ans[j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:10: error: 'for_each' is not a member of 'std'
13 | std::for_each(arrayT.begin(), arrayT.end(), [](int x) {
| ^~~~~~~~
|
s734737385 | p03845 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s576999235 | p03845 | C++ | a
| a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s175262546 | p03845 | C | #include <iostream>
using namespace std;
int main()
{
int n, tn[10^5], sumt=0, m, pm, xm ,result[10^5];
cin>>n; for (int i=0 ; i<n; i++){cin >>tn[i];sumt+=tn[i];}
cin >>m;
for (int i=0 ; i<m; i++){
cin>>pm >>xm;
result [i]= sumt -tn[pm-1]+xm;
}
for (int i=0 ; i<m; i++)cout <<result[i]<<endl;
return 0;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s437753473 | p03845 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nectInt();
int[] t = new int[N];
int sum = 0;
for(int i = 0;i , n;i++){
t[i] = sc.nextInt();
sum += t[i];
}
int[] p = new int[2*M];
for(int i = 0;i < 2*M;i += 2){
p[i] = sc.nextInt();
p[i+1] = sc.nextInt();
System.out.println(sum - t[p[i]] + p[i+1]);
}
}} | Main.java:8: error: ';' expected
for(int i = 0;i , n;i++){
^
Main.java:8: error: illegal start of expression
for(int i = 0;i , n;i++){
^
Main.java:8: error: not a statement
for(int i = 0;i , n;i++){
^
Main.java:8: error: ')' expected
for(int i = 0;i , n;i++){
^
Main.java:8: error: ';' expected
for(int i = 0;i , n;i++){
^
5 errors
|
s959756285 | p03845 | Java |
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] t = new int[n];
for(int i = 0;i < n;i++)t[i] = sc.nextInt();
int m = sc.nextInt();
int[] sum = new int[m];
int[] p = new int[m];
int[] x = new int[m];
for(int i = 0;i < m;i++) {
p[i] = sc.nextInt();
x[i] = sc.nextInt();
}
for(int i = 0;i < m;i++) {
for(int k = 0;k < n;k++) {
if(k == p[i]-1)sum[i] += x[i];
else sum[i] += t[k];
}
System.out.println(sum[i]);
}
}
}
| Main.java:5: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:5: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s725182519 | p03845 | Java |
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] t = new int[n];
for(int i = 0;i < n;i++)t[i] = sc.nextInt();
int m = sc.nextInt();
int[] sum = new int[m];
int[] p = new int[m];
int[] x = new int[m];
for(int i = 0;i < m;i++) {
p[i] = sc.nextInt();
x[i] = sc.nextInt();
}
for(int i = 0;i < m;i++) {
for(int k = 0;k < n;k++) {
if(k == p[k])sum[k] += x[k];
else sum[k] += t[k];
}
System.out.println(sum[i]);
}
}
}
| Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s400004116 | p03845 | C++ | #include <cstdio>
int a[110];
int b[110];
int main()
{
int n , m;
scanf("%d",&n);
for(int i = 1; i <= n; i++)
{
scanf("%d",&a[i]);
b[i] = a[i];
}
scanf("%d",&m);
while(m--)
{
int k , b;
scanf("%d %d",&k,&b);
a[k] = b;
int sum = 0;
for(int i = 1; i <= n; i++)
sum += a[i];
printf("%d\n",sum);
a[k] = b[k];
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:23:41: error: invalid types 'int[int]' for array subscript
23 | a[k] = b[k];
| ^
|
s258173147 | p03845 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
int time[105];
int num1[105];
int main()
{
int N,M,n,m,ans,sum=0;
cin>>N;
for(int i =1;i<=N;i++)
{
cin>>time[i];
sum+=time[i];
}
cin>>M;
for(int i =1;i<=M;i++)
{
cin>>m>>n;
num1[i] = sum-time[i]+n;
}
for(int i =1;i<=M;i++)
cout<<num1[i]<<endl;
return 0;
} | a.cc:4:13: error: 'int time [105]' redeclared as different kind of entity
4 | int time[105];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:12:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
12 | cin>>time[i];
| ^
a.cc:12:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
12 | cin>>time[i];
| ~~~^~~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/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:12:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
12 | cin>>time[i];
| ~~~~~~^
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&'
/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:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
12 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:12:28: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' 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_t |
s563538328 | p03845 | C++ | #include <iostream>
using namespace std;
int main(){
int N, i , j, ans=0;
cin >> N;
int T[N];
for(i=0; i<N; i++){
cin >> T[i];
}
cin >> M;
int P[M], X[M];
for(i=0; i<M; i++){
cin >> P[i] >> X[i];
}
for(i=0; i<M; i++){
int temp = T[P[i]-1];
T[P[i]-1] = X[i];
for(j=0; j<N; j++){
ans += T[j];
}
cout << ans << endl;
T[P[i]-1] = temp;
}
} | a.cc: In function 'int main()':
a.cc:11:16: error: 'M' was not declared in this scope
11 | cin >> M;
| ^
a.cc:14:24: error: 'P' was not declared in this scope
14 | cin >> P[i] >> X[i];
| ^
a.cc:14:32: error: 'X' was not declared in this scope
14 | cin >> P[i] >> X[i];
| ^
a.cc:17:30: error: 'P' was not declared in this scope
17 | int temp = T[P[i]-1];
| ^
a.cc:18:29: error: 'X' was not declared in this scope
18 | T[P[i]-1] = X[i];
| ^
|
s830717944 | p03845 | C++ | #include <iostream>
using namespace std;
int ans(int i, int N, int T[], int P[], int X[]){
int ans=0;
T[P[i]-1]=X[i];
for(int j=0;j<N;i++) ans += T[j]
return ans;
}
int main(){
int N, T[N], M, P[M], X[M], i;
cin >> N;
for(i=0;i<N;i++) cin >> T[i];
cin >> M;
for(i=0;i<M;i++) cin >> P[i] >> X[i];
for(i=0;i<M;i++) cout << ans(i,N,T,P,X)
}
| a.cc: In function 'int ans(int, int, int*, int*, int*)':
a.cc:7:41: error: expected ';' before 'return'
7 | for(int j=0;j<N;i++) ans += T[j]
| ^
| ;
8 | return ans;
| ~~~~~~
a.cc:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
9 | }
| ^
a.cc: In function 'int main()':
a.cc:19:48: error: expected ';' before '}' token
19 | for(i=0;i<M;i++) cout << ans(i,N,T,P,X)
| ^
| ;
20 |
21 | }
| ~
|
s893856967 | p03845 | C++ | #include <iostream>
using namespace std;
int N, T[N], M, P[M], X[M], i;
int ans(i,N,T[],P[],X[]){
int ans=0;
T[P[i]-1]=X[i];
for(int j=0;j<N;i++) ans += T[j]
return ans;
}
int main(){
cin >> N;
for(i=0;i<N;i++) cin >> T[i];
cin >> M;
for(i=0;i<M;i++) cin >> P[i] >> X[i];
for(i=0;i<M;i++) cout << ans(i,N,T,P,X)
}
| a.cc:4:10: error: size of array 'T' is not an integral constant-expression
4 | int N, T[N], M, P[M], X[M], i;
| ^
a.cc:4:19: error: size of array 'P' is not an integral constant-expression
4 | int N, T[N], M, P[M], X[M], i;
| ^
a.cc:4:25: error: size of array 'X' is not an integral constant-expression
4 | int N, T[N], M, P[M], X[M], i;
| ^
a.cc:6:15: error: expected primary-expression before ']' token
6 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:6:19: error: expected primary-expression before ']' token
6 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:6:23: error: expected primary-expression before ']' token
6 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:6:24: error: expression list treated as compound expression in initializer [-fpermissive]
6 | int ans(i,N,T[],P[],X[]){
| ^
a.cc: In function 'int main()':
a.cc:19:37: error: 'ans' cannot be used as a function
19 | for(i=0;i<M;i++) cout << ans(i,N,T,P,X)
| ~~~^~~~~~~~~~~
|
s592320626 | p03845 | C++ | #include <iostream>
using namespace std;
int ans(i,N,T[],P[],X[]){
int ans=0;
T[P[i]-1]=X[i];
for(int j=0;j<N;i++) ans += T[j]
return ans;
}
int main(){
int N, T[N], M, P[M], X[M], i;
cin >> N;
for(i=0;i<N;i++) cin >> T[i];
cin >> M;
for(i=0;i<M;i++) cin >> P[i] >> X[i];
for(i=0;i<M;i++) cout << ans(i,N,T,P,X)
}
| a.cc:4:9: error: 'i' was not declared in this scope
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:11: error: 'N' was not declared in this scope
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:13: error: 'T' was not declared in this scope
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:15: error: expected primary-expression before ']' token
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:17: error: 'P' was not declared in this scope
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:19: error: expected primary-expression before ']' token
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:21: error: 'X' was not declared in this scope
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:23: error: expected primary-expression before ']' token
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc:4:24: error: expression list treated as compound expression in initializer [-fpermissive]
4 | int ans(i,N,T[],P[],X[]){
| ^
a.cc: In function 'int main()':
a.cc:19:37: error: 'ans' cannot be used as a function
19 | for(i=0;i<M;i++) cout << ans(i,N,T,P,X)
| ~~~^~~~~~~~~~~
|
s987989694 | p03845 | C++ | Select Code
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
LL n;
cin>>n;
LL a[n],i,j,k=0,l,m;
for(i=0;i<n;i++) {
cin>>a[i];
k+=a[i];
}
cin>>m;
LL x,y;
for(i=0;i<m;i++) {
cin>>x>>y;
j=k-a[x-1];
j+=y;
cout<<j<<endl;
}
return 0;
} | a.cc:1:1: error: 'Select' does not name a type
1 | Select Code
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| |
s396055656 | p03845 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int M,N,i;
long long int P,X,sum[110],total;
cin>>N;
vector<int> T(N);
for(i=0;i<N;i++){
cin>>T[i];
}
total = accumulate(T.begin(),T.end(),0);
cin>>M;
for(i=0;i<M;i++){
cin>>P>>X;
sum[i] = total -T[P-1] + X;
}
for(i=0;i<M;i++){
cout<<sum[i]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'accumulate' was not declared in this scope
12 | total = accumulate(T.begin(),T.end(),0);
| ^~~~~~~~~~
|
s434831392 | p03845 | C++ | #include<iostream>
#include<numeric>
using namespace std;
int main(){
int M,N,i;
long long int T[110],P,X,sum[110],total;
cin>>N;
for(i=0;i<N;i++){
cin>>T[i];
}
total = accumulate(T.begin(),T.end(),0);
cin>>M;
for(i=0;i<M;i++){
cin>>P>>X;
sum[i] = total -T[P-1] + X;
}
for(i=0;i<M;i++){
cout<<sum[i]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:23: error: request for member 'begin' in 'T', which is of non-class type 'long long int [110]'
11 | total = accumulate(T.begin(),T.end(),0);
| ^~~~~
a.cc:11:33: error: request for member 'end' in 'T', which is of non-class type 'long long int [110]'
11 | total = accumulate(T.begin(),T.end(),0);
| ^~~
|
s732466914 | p03845 | C++ | #include<iostream>
using namespace std;
int main(){
int M,N,i;
long long int T[N],P,X,sum[M],total=0;
cin>>N;
for(i=0;i<N;i++){
cin>>T[i];
total += T[i];
}
cin>>M;
for(i=0;i<M;i++){
cin>>P>>X;
P--;
sum[i] = total -T[P] + X;
}
for(i=0;i<M;i++){
cout<<sum[i];
}
return 0; | a.cc: In function 'int main()':
a.cc:20:19: error: expected '}' at end of input
20 | return 0;
| ^
a.cc:3:19: note: to match this '{'
3 | int main(){
| ^
|
s323137087 | p03845 | C++ | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
//#include<chrono>
//#include<time.h>
//#include<windows.h>
using namespace std;
//#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
//static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
struct edge {int /*from,*/to,cost;};
signed main(){
int n;
int t[114];
int m;
int p[114],x[114];
cin >> n;
int sum = 0;
REP(i,n) {scanf("%d",&t[i]);sum+=s[i];}
cin >> m;
REP(i,m){
int p,tmp;
scanf("%d%d",&p,&tmp);
printf("%d\n",sm+tmp-t[p]);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:70:38: error: 's' was not declared in this scope
70 | REP(i,n) {scanf("%d",&t[i]);sum+=s[i];}
| ^
a.cc:75:23: error: 'sm' was not declared in this scope; did you mean 'sum'?
75 | printf("%d\n",sm+tmp-t[p]);
| ^~
| sum
|
s910333627 | p03845 | C++ | #include <iostream>
using namespace std;
int main() {
int n,m;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int s=0;
for(int h=0;h<n;h++)
s+=a[h];
int m;
cin>>m;
while(m--){
int f,g;
cin>>f>>g;
cout<<s-a[f-1]+g<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:9: error: redeclaration of 'int m'
12 | int m;
| ^
a.cc:4:11: note: 'int m' previously declared here
4 | int n,m;
| ^
|
s120296169 | p03845 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int N, M, tmp=0,sum;
cin >>N;
vector<int> T(N);
for(int i=0;i<N;i++){
cin >>T[i];
}
cin >>M;
vector<int> P(M), X(M);
for(int i=0;i<M;i++){
cin >>P[i];
cin >>X[i];
}
for(int i=0;i<M;i++){
for(int j=0;i<N;j++){
if(P[i]==j){
tmp=T[j];
T[j]==X[i];
for(int k=0;k<N;k++){
sum+=T[k];
}
cout<<sum<<endl;
T[j]=temp;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:22: error: 'temp' was not declared in this scope; did you mean 'tmp'?
34 | T[j]=temp;
| ^~~~
| tmp
|
s048587204 | p03845 | C++ | #include <iostream>
using namespace std;
#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
int T[100];
int P[100];
int X[100];
int main(void)
{
int N, M;
cin >> N >> M;
int ans = 0;
Rep(i, N){
cin >> T[i];
ans += T[i];
}
Rep(i, M){
int p, x;
cin >> p >> x;
p--;
PrintLn(ans + x[p] - T[p]);
}
}
| a.cc: In function 'int main()':
a.cc:23:32: error: invalid types 'int[int]' for array subscript
23 | PrintLn(ans + x[p] - T[p]);
| ^
a.cc:4:28: note: in definition of macro 'PrintLn'
4 | #define PrintLn(X) cout << X << endl
| ^
|
s878692051 | p03845 | C++ | int main(){
int N, M,sumT=0;
int T[1000], P[1000], X[1000],ans[1000];
cin >> N;
for (int i = 0; i < N; i++){
cin >> T[i];
sumT = sumT + T[i];
}
cin >> M;
for (int j = 0; j < M; j++){
cin >> P[j]>> X[j];
ans[j] = sumT - T[P[j] - 1] + X[j];
}
for (int j = 0; j < M; j++){
cout << ans[j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
4 | cin >> N;
| ^~~
a.cc:15:17: error: 'cout' was not declared in this scope
15 | cout << ans[j] << endl;
| ^~~~
a.cc:15:35: error: 'endl' was not declared in this scope
15 | cout << ans[j] << endl;
| ^~~~
|
s459187384 | p03845 | C++ | 5
7 2 3 8 5
3
4 2
1 7
4 13 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5
| ^
|
s580276372 | p03845 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int N,T[100],M,P[100],X[100];
int r;
cin>>N;
for(int i=0;i<N;i++){
cin>>T[i];
}
cin>>M;
for(int i=0;i<M;i++){
cin>>P[i]>>X[i];
}
for(int i=0;i<M;i++){
r=r+T[i]
}
for(int i=0;i<M;i++){
cout<<r-T[ P[i]-1 ]+X[i]<<endl;
}
} | a.cc: In function 'int main()':
a.cc:18:33: error: expected ';' before '}' token
18 | r=r+T[i]
| ^
| ;
19 | }
| ~
|
s759738650 | p03845 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define NMAX 103
#define MMAX 103
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
int N,T[NMAX],M,P[MMAX],X[MMAX],sum = 0;
char C;
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void solve(){
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> N;
for (int i = 0; i < N; ++i)
{
cin >> T[i];
sum += T[i];
}
cin >> M;
for (int i = 0; i < M; ++i)
{
cin >> P[i] >> X[i];
cout << sum-T[P[i]-1]+ X[i] << "\n";
}
return 0;
} | a.cc: In function 'void answer()':
a.cc:40:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
40 | cout << ans << "\n";
| ^~~
| abs
|
s473563072 | p03845 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define NMAX 103
#define MMAX 103
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
typedef pair<int ,int > P;
typedef long long ll;
int N,T[NMAX],M,P[MMAX],X[MMAX],sum = 0;
char C;
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void solve(){
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> N;
for (int i = 0; i < N; ++i)
{
cin >> T[i];
sum += T[i];
}
cin >> M;
for (int i = 0; i < M; ++i)
{
cin >> P[i] >> X[i];
cout << sum-T[P[i]-1]+ X[i] << "\n";
}
return 0;
} | a.cc:28:23: error: 'int P [103]' redeclared as different kind of entity
28 | int N,T[NMAX],M,P[MMAX],X[MMAX],sum = 0;
| ^
a.cc:25:25: note: previous declaration 'typedef struct std::pair<int, int> P'
25 | typedef pair<int ,int > P;
| ^
a.cc: In function 'void answer()':
a.cc:43:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
43 | cout << ans << "\n";
| ^~~
| abs
a.cc: In function 'int main()':
a.cc:56:25: error: expected primary-expression before '[' token
56 | cin >> P[i] >> X[i];
| ^
a.cc:57:32: error: expected primary-expression before '[' token
57 | cout << sum-T[P[i]-1]+ X[i] << "\n";
| ^
|
s494287200 | p03845 | Java | public static void main(String[] args) {
int N = 6;
int P = 3;
int [] time = {1,4,10,2,6,3};
int [] drinktime = {4,2,5,4,3,9};
int sum = 0;
for(int i = 0; i < N; i++){
sum = sum + time[i];
}
for(P = 0; P < drinktime.length; P++){
sum = sum + drinktime[P] - time[P];
System.out.println(sum);
}
} | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
1 error
|
s202954292 | p03845 | Java | import java.util.*;
public Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] t=new int[n];
for(int i=1;i<n;i++){
t[i]=sc.nextInt();
}
int m=sc.nextInt();
int[] p=new int[m],x=new int[m];
for(int i=1;i<m;i++){
p[i]=sc.nextInt();
x[i]=sc.nextInt();
}
int sum=0;
for(int i=0;i<m;i++){
for(int j=0;j<n;i++){
sum+=t[j];
}
sum=sum-t[p[i]]+x[i];
System.out.println(sum);
}
}
} | Main.java:2: error: class, interface, enum, or record expected
public Main {
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
^
(use --enable-preview to enable unnamed classes)
Main.java:25: error: class, interface, enum, or record expected
}
^
3 errors
|
s489245762 | p03845 | Java | import java.util.Scanner;
public class Main {
public static void main (String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int [] t = new int [n];
int sumTime = 0;
for (int i = 0 ; i < n ; i++) {
t [i] = scanner.nextInt();
sumTime += t[i];
}
int m = scanner.nextInt();
for (int i = 0 ; i < m ; i++) {
int p = scanner.Int() - 1;
int sum = sumTime - t[p] + scanner.nextInt();
System.out.println(sum);
}
}
} | Main.java:15: error: cannot find symbol
int p = scanner.Int() - 1;
^
symbol: method Int()
location: variable scanner of type Scanner
1 error
|
s248127387 | p03845 | C++ | package main
import (
"fmt"
)
func main() {
var M, N int
fmt.Scan(&N)
var sum int
t := make([]int, N)
for i := 0; i < N; i++ {
fmt.Scan(&t[i])
sum += t[i]
}
fmt.Scan(&M)
for i := 0; i < M; i++ {
var p, x int
fmt.Scan(&p, &x)
fmt.Println(sum + x - t[p-1])
}
}
| a.cc:1:1: error: 'package' does not name a type
1 | package main
| ^~~~~~~
|
s888226989 | p03845 | C++ | S#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> t(n);
FOR(i, 0, n) {
cin >> t[i];
}
int sumx = accumulate(t.begin(), t.end(), 0);
int diff = 0;
int m;
cin >> m;
// diffmax
int diffi = 0;
FOR(i, 0, m) {
int p, x;
cin >> p >> x;
p--;
cout << sumx - t[p] + x << endl;
}
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | S#include <string>
| ^
a.cc:1:1: error: 'S' does not name a type
1 | S#include <string>
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/deque:62,
from /usr/include/c++/14/queue:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58 |
s477242624 | p03845 | C++ | #include<iostream>
using namespace std;
int main(){
int N;
int T[101];
int sum=0;
cin>>N;
for(int i=1;i<=N;i++){
cin>>T[i]
sum+=T[i];
}
int M;
cin>>M;
for(int i=0;i<M;i++){
int p,x;
cin>>p>>x;
cout<<sum-T[p]+x<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:10: error: expected ';' before 'sum'
10 | cin>>T[i]
| ^
| ;
11 | sum+=T[i];
| ~~~
|
s992395374 | p03845 | C | #include<stdio.h>
int main(void)
{
int temp,goukei[110] = { 0 },mondai, time[110], drink, siyou[110], siyoutime[110], i, n, t;
scanf("%d", &mondai);
for (i = 0; i < mondai; i++)
{
scanf("%d", &time[i]);
}
scanf("%d", &drink);
for (i = 0; i < drink; i++)
{
scanf("%d%d", &siyou[i], &siyoutime[i]);
siyou[i]--;
}
for (i = 0; i < drink; i++)
{
temp = time[siyou[i]];
time[siyou[i]] = siyoutime[i];
for (n = 0; n < mondai; n++)
{
goukei[i] += time[n];
}
time[siyou[i]] = temp;
}
for (i = 0; i < drink; i++)
printf("%d\n",goukei[i] );
return0;
} | main.c: In function 'main':
main.c:28:9: error: 'return0' undeclared (first use in this function)
28 | return0;
| ^~~~~~~
main.c:28:9: note: each undeclared identifier is reported only once for each function it appears in
|
s374872194 | p03845 | C | #include <stdio.h>
int main(){
int N,M;
int T[N],P[M],X[M];
int sum;
scanf("%d",&N);
for(int i=0;i++;i<<N){
scanf("%d",*T[i]);
sum=sum+T[i];
}
scanf("%d",&M);
for(int j=0;j++;j<<M){
scanf("%d%d",*P[j],*X[j]);
printf("%d",sum+X[j]-T[P[j]]);
}
return 0;
} | main.c: In function 'main':
main.c:9:28: error: invalid type argument of unary '*' (have 'int')
9 | scanf("%d",*T[i]);
| ^~~~~
main.c:14:30: error: invalid type argument of unary '*' (have 'int')
14 | scanf("%d%d",*P[j],*X[j]);
| ^~~~~
main.c:14:36: error: invalid type argument of unary '*' (have 'int')
14 | scanf("%d%d",*P[j],*X[j]);
| ^~~~~
|
s509994173 | p03845 | C++ | #include <iostream>
using namespace std;
int main(){
int N = 0, temp = 0, result = 0, M = 0, P = 0, X = 0;
cin >> N;
int *T = new int[N];
for(int i = 0; i < N; i++){
cin >> T[i];
}
cin >> M;
for(int i = 0; i < M; i++){
cin >> P;
cin >> X;
temp = T[i];
T[P] = X;
for(int i = 0; i < N; i++){
result += T[i];
}
cout << result;
resutl = 0;
T[i] = temp;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:5: error: 'resutl' was not declared in this scope; did you mean 'result'?
24 | resutl = 0;
| ^~~~~~
| result
|
s393675994 | p03845 | C++ | #include <iostream>
using namespace std;
int main(){
int N = 0, temp = 0, result = 0;
cin >> N;
int *T = new int[N];
for(int i = 0; i < N; i++){
cin >> T[i];
}
cin >> M;
for(int i = 0; i < M; i++){
cin >> P;
cin >> X;
temp = T[i];
T[P] = X;
for(int i = 0; i < N; i++){
result += T[i];
}
cout << result;
resutl = 0;
T[i] = temp;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:10: error: 'M' was not declared in this scope
12 | cin >> M;
| ^
a.cc:14:12: error: 'P' was not declared in this scope
14 | cin >> P;
| ^
a.cc:15:12: error: 'X' was not declared in this scope
15 | cin >> X;
| ^
a.cc:23:5: error: 'resutl' was not declared in this scope; did you mean 'result'?
23 | resutl = 0;
| ^~~~~~
| result
|
s594515041 | p03845 | C++ | #include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
static const int R = 10000;
int main(){
int n[R],t,m;
int sum = 0;
int k = 0;
int number = 0;
int sec = 0;
cin >> t;
for( int i = 0; i < n; i++)
{
cin >> n[i];
}
cin >> m;
for( int i = 0; i < m; i++)
{
cin >> number >> sec;
n[number - 1] = sec;
for( int i = 0; i < t; i++){
sum += n[i];
cout << sum << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | for( int i = 0; i < n; i++)
| ~~^~~
|
s974549500 | p03845 | C++ | #include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
static const int R = 10000;
int main(){
int n[R],t,m;
int sum = 0;
int k = 0;
int number = 0;
int sec = 0;
cin >> t;
for( int i = 0; i < n; i++) {
cin >> n[i];
}
cin >> m;
for( int i = 0; i < m; i++)
{
cin >> number >> sec;
n[number - 1] = sec;
for( int i = 0; i < t; i++){
sum += n[i];
cout << sum << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | for( int i = 0; i < n; i++) {
| ~~^~~
a.cc:27:10: error: expected '}' at end of input
27 | }
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s162761430 | p03846 | Java | import java.util.*;
public class bz {
public static void main(String[] args) {
Scanner no=new Scanner(System.in);
int n=no.nextInt();
int arr[]=new int[1000000];
int max=0;
boolean t=true;
for(int i=0;i<n;i++){
int r=no.nextInt();
if(r>n||(n%2==0&&r%2==0)||(n%2==1&&r%2==1)){
System.out.println("0");
t=false;
}
if(r>max){
max=r;
}
arr[r]++;
}
if(t){
if(n%2==0){
boolean t1=true;
for(int i=0;i<max;i++){
if(arr[i]>2){
System.out.println("0");
t1=false;
break;
}
}
if(t1){
int o=n/2;
int fin=1;
for(int i=0;i<o;i++){
fin=(fin*2)%1000000007;
}
System.out.println(fin);
}
}
else if(n%2==1){
boolean t1=true;
for(int i=0;i<max;i++){
if(arr[i]>2||arr[0]>1){
System.out.println("0");
t1=false;
break;
}
}
if(t1){
int o=n/2;
int fin=1;
for(int i=0;i<o;i++){
fin=(fin*2)%1000000007;
}
System.out.println(fin);
}
}
}
}
}
| Main.java:2: error: class bz is public, should be declared in a file named bz.java
public class bz {
^
1 error
|
s679575068 | p03846 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 100000;
int p=1000000007;
typedef long long ll;
int main()
{
int n,t,i;
int c[N_MAX];
ll res=1;
cin >> n;
fill(c,c+n-1,0)
for(i=0;i<n;i++){
cin >> t;
if((n+t)%2!=1||(t==0&&c[t]>=1)||c[t]>=2){
cout << "0" << endl;
return 0;
}
c[t]++;
}
for(i=0;i<n;i++)
if(c[i]>0){
res*=c[i];
res%=p;
}
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:18: error: expected ';' before 'for'
13 | fill(c,c+n-1,0)
| ^
| ;
14 | for(i=0;i<n;i++){
| ~~~
a.cc:14:18: error: expected ';' before ')' token
14 | for(i=0;i<n;i++){
| ^
| ;
|
s860468448 | p03846 | C++ | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define ll long long
ll MOD=1e9+7;
ll a[100005];
using namespace std;
int main(){
ll n;
cin>>n;
ll flag=1;//flag
ll ans=1;
if(n%2==0){ // even number
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;//a[7]++
// give data x error
if(x>=n || x%2==0 || a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(a[x]==1)
ans=ans*2%MOD; // a * b %c == a%c * b%c
}
}
else{ //odd
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;
/ / give data x error
if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(x!=0 && a[x]==1)
ans=ans*2%MOD;
}
}
if(flag)
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:46:25: error: expected primary-expression before '/' token
46 | / / give data x error
| ^
a.cc:46:27: error: expected primary-expression before '/' token
46 | / / give data x error
| ^
a.cc:46:29: error: 'give' was not declared in this scope
46 | / / give data x error
| ^~~~
|
s481575232 | p03846 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MOD=1e9+7;
ll a[100005];
using namespace std;
int main(){
ll n;
cin>>n;
ll flag=1;//flag
ll ans=1;
if(n%2==0){ // even number
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;//a[7]++
/ / give data x error
if(x>=n || x%2==0 || a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(a[x]==1)
ans=ans*2%MOD; // a * b %c == a%c * b%c
}
}
else{ //odd
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;
/ / give data x error
if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(x!=0 && a[x]==1)
ans=ans*2%MOD;
}
}
if(flag)
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:25: error: expected primary-expression before '/' token
23 | / / give data x error
| ^
a.cc:23:27: error: expected primary-expression before '/' token
23 | / / give data x error
| ^
a.cc:23:29: error: 'give' was not declared in this scope
23 | / / give data x error
| ^~~~
a.cc:43:25: error: expected primary-expression before '/' token
43 | / / give data x error
| ^
a.cc:43:27: error: expected primary-expression before '/' token
43 | / / give data x error
| ^
a.cc:43:29: error: 'give' was not declared in this scope
43 | / / give data x error
| ^~~~
|
s477217846 | p03846 | C++ | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define ll long long
ll MOD=1e9+7;
ll a[100005];
using namespace std;
int main(){
ll n;
cin>>n;
ll flag=1;//flag
ll ans=1;
if(n%2==0){ // even number
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;//a[7]++
/ / give data x error
if(x>=n || x%2==0 || a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(a[x]==1)
ans=ans*2%MOD; // a * b %c == a%c * b%c
}
}
else{ //odd
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;
/ / give data x error
if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(x!=0 && a[x]==1)
ans=ans*2%MOD;
}
}
if(flag)
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:25: error: expected primary-expression before '/' token
26 | / / give data x error
| ^
a.cc:26:27: error: expected primary-expression before '/' token
26 | / / give data x error
| ^
a.cc:26:29: error: 'give' was not declared in this scope
26 | / / give data x error
| ^~~~
a.cc:46:25: error: expected primary-expression before '/' token
46 | / / give data x error
| ^
a.cc:46:27: error: expected primary-expression before '/' token
46 | / / give data x error
| ^
a.cc:46:29: error: 'give' was not declared in this scope
46 | / / give data x error
| ^~~~
|
s814595985 | p03846 | C | #include <stdio.h>
#include <math.h>
int main(){
int n;
scanf("%d", &n);
int a[100000 + 5] = {0}, b, c; //aの要素を0。それとb、cを定義
for(int i = 0; i < n; i++){
scanf("%d", &b);
a[b]++;
}
for(int i = n - 1; i >= 0; i -= 2){
if(i == 0){
if(a[i] != 1){
printf("0\n");
return 0;
}
else break;
}
if(a[i] != 2){
printf("0\n");
return 0;
}
}
c = (1<<(n/2));
printf("%d\n", c%((1000000000+7));
return 0;
}
| main.c: In function 'main':
main.c:25:37: error: expected ')' before ';' token
25 | printf("%d\n", c%((1000000000+7));
| ~ ^
| )
main.c:26:13: error: expected ';' before '}' token
26 | return 0;
| ^
| ;
27 | }
| ~
|
s738404973 | p03846 | Java | import java.util.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
// warm-up
public class LiningUp {
static Set<Integer> a = new HashSet<Integer>();
static Set<Integer> b = new HashSet<Integer>();
static void solve() {
Scanner sc = new Scanner(System.in);
double mod = 1000000007;
int n=sc.nextInt();
while (n-->0) {
int c = sc.nextInt();
if (c==0) continue;
if (a.contains(c)) b.add(c);
else a.add(c);
}
if (a.size()==b.size()) System.out.println(new DecimalFormat("#").format(Math.pow(2,a.size())%mod));
else System.out.println(0);
sc.close();
}
public static void main(String args[]) {
solve();
}
} | Main.java:5: error: class LiningUp is public, should be declared in a file named LiningUp.java
public class LiningUp {
^
1 error
|
s611002699 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main (){
int N;
cin >> N;
int arr[N];
for (int i = 0; i < N; i ++){
cin >> arr[i];
}
void combine(int arr[], int len, int start, int end){
int tempLen = end - start + 1;
int arr3[tempLen];
int mid = (start + end) / 2;
int pos1 = start;
int pos2 = mid + 1;
int end1 = mid;
int end2 = end;
for (int i = 0; i < tempLen; i ++){
if (pos1 <= end1 && pos2 <= end2){
if (arr[pos1] <= arr[pos2]) {
arr3[i] = arr[pos1];
pos1 ++;
} else {
arr3[i] = arr[pos2];
pos2 ++;
}
} else if (pos1 <= end1) {
arr3[i] = arr[pos1];
pos1 ++;
} else {
arr3[i] = arr[pos2];
pos2 ++;
}
}
for (int i = 0; i < tempLen; i ++){
arr[start + i] = arr3[i];
}
void mergeSort(int arr[], int len, int start, int end){
int mid = (start + end) / 2;
if (mid > start + 1){
mergeSort(arr, len, start, mid);
}
if (end > mid + 1){
mergeSort(arr, len, mid + 1, end);
}
combine(arr, len, start, end);
}
mergeSort(arr, N, 0, N - 1);
/*
for (int i = 0; i < N - 1; i ++){
for (int j = i + 1; j < N; j ++){
if (arr[j] < arr[i]){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
*/
if (N % 2 == 0){
int A[N];
for (int i = 0; i < N; i += 2){
A[i] = i + 1;
A[i + 1] = i + 1;
}
for (int i = 0; i < N; i ++){
if (A[i] != arr[i]){
cout << 0 << '\n';
break;
}
}
cout << pow (2, N / 2) << '\n';
} else {
int A[N];
A[0] = 0;
for (int i = 2; i < N; i += 2){
A[i - 1] = i;
A[i] = i;
}
for (int i = 0; i < N; i ++){
if (A[i] != arr[i]){
cout << 0 << '\n';
break;
}
}
cout << pow (2, (N - 1) / 2) << '\n';
}
}
| a.cc: In function 'int main()':
a.cc:15:55: error: a function-definition is not allowed here before '{' token
15 | void combine(int arr[], int len, int start, int end){
| ^
a.cc:100:2: error: expected '}' at end of input
100 | }
| ^
a.cc:5:12: note: to match this '{'
5 | int main (){
| ^
|
s116920831 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main (){
cout << pow(2, N/2) << '\n';
} | a.cc: In function 'int main()':
a.cc:6:18: error: 'N' was not declared in this scope
6 | cout << pow(2, N/2) << '\n';
| ^
|
s243071944 | p03846 | C++ | #include<bits/stdc++.h>
using namespace std;
#define Bye return 0
void solve(){
int n, res = 1; cin>>n;
int a[n+1];
memset(a, 0, sizeof a);
bool no_solution = false;
for (int i=1; i<=n; i++){ int e; cin>>e; a[e]++;}
int counter = (n%2^0) ? (n-1)/2 : n/2;
for (int i=1; i<=counter; i++) res = (res*2)%MAX;
bool isValid = false;
for (int i=0; i<n; i+=2){
isValid += (i+2<n && a[i+2]^2 && n%2^0) ? true : false;
isValid += (i+1<=n-1 && a[i+1]^2 && !(n%2^0)) ? true : false;
}
cout<<((!isValid) ? res : 0)<<endl;
}
int main()
{
solve();
Bye;
} | a.cc: In function 'void solve()':
a.cc:15:50: error: 'MAX' was not declared in this scope
15 | for (int i=1; i<=counter; i++) res = (res*2)%MAX;
| ^~~
|
s887632608 | p03846 | C++ | #include<bits/stdc++.h>
using namespace std;
#define Bye return 0
#define ll long long
const int MAX = 1e9+7;
const int SIZE = 1e5+1;
void solve(){
int n; cin>>n;
int a[n+1];
memset(a, 0, sizeof a);
bool no_solution = false;
for (int i=1; i<=n; i++){
int e; cin>>e;
a[e]++;
}
int counter = (n%2 == 0) ? n/2 : (n-1)/2;
int res = 1;
for (int i=1; i<=counter; i++)
res = (res*2)%MAX;
cout<<(a[0]>=2 && a[n-1]<=1) ? 0: res)<<endl;
}
int main()
{
solve();
Bye;
} | a.cc: In function 'void solve()':
a.cc:26:42: error: expected ';' before ')' token
26 | cout<<(a[0]>=2 && a[n-1]<=1) ? 0: res)<<endl;
| ^
| ;
|
s055419734 | p03846 | C | #include<bits/stdc++.h>
#define ll long long
using namespace std;
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
return (a.second < b.second&&a.first<b.first);
}
void solve(){
int n,val;
cin>>n;
map<int,int>mp;
for(int i=0;i<n;i++){
cin>>val;
if(mp.find(val)!=mp.end()){
if(val==0||mp[val]==2){
cout<<0;
return;
}
mp[val]++;
}else{
mp[val]=0;
}
}
if(n&1){
cout<<(1<<(n-1)/2);
}else
cout<<(1<<n/2);
}
int main(){
/*int t;
cin>>t;
while(t--)*/
solve();
return 0;
}
//1-(3+5-2+(3+19-(3-1-4+(9-4-(4-(1+(3)-2)-5)+8-(3-5)-1)-4)-5)-4+3-9)-4-(3+2-5)-10
| main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s196883527 | p03846 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<map>
#include<set>
using namespace std;
//c++で整数処理
//mod計算用のクラス
// ModInt a = {1,1000000007}みたいな定義もできる.
//modがデフォルト(1000000007)じゃない場合は(ModInt)a+(int)xみたいなものに注意.左のmodが使われる。デフォルトを書き換えれば大丈夫.
//「各メンバーに対して、コピーコンストラクターあるいは代入演算子を順に呼び出す」 という仕様になっている.
// (int)1 + (ModInt)10 みたいなことは出来ない.非メンバで定義する必要がある(と思う).
class ModInt{
public:
long long int x;
long long int mod;
ModInt(){}
ModInt(long long int _x, long long int _mod = 1000000007){
this->x = ((_x % _mod) + _mod) % _mod;
this->mod = _mod;
}
ModInt operator-() const {
return ModInt(-this->x, this->mod);
}
ModInt operator+(const ModInt &other) const {
return ModInt(this->x + (other.x % this->mod), this->mod);
}
ModInt operator+=(const ModInt &other){
*this = *this + other;
return *this;
}
ModInt operator-(const ModInt &other) const {
long long int res = this->x - (other.x % this->mod);
if (res < 0) return ModInt(res + this->mod, this->mod);
return ModInt(res, this->mod);
}
ModInt operator-=(const ModInt &other) {
*this = *this - other;
return *this;
}
ModInt operator*(const ModInt &other) const {
return ModInt(this->x * (other.x % this->mod),this->mod);
}
ModInt operator*=(const ModInt &other) {
*this = *this * other;
return *this;
}
ModInt operator/(const ModInt &other) const {
return ModInt(*this * other.inv());
}
ModInt operator/=(const ModInt &other) {
*this = *this / other;
return *this;
}
ModInt pow(long long int n) const {
ModInt res(1, this->mod), a(this->x, this->mod);
while (n){
if (n & 1){
res = res * a;
}
n >>= 1;
a = a * a;
}
return res;
}
ModInt inv() const {
return ModInt(this->pow(this->mod - 2));
}
void disp(){
cout << this->x << endl;
}
};
ostream& operator<<(ostream& stream, const ModInt m){
stream << to_string(m.x);
return stream;
}
//mod nCrを返す関数.ModIntが必要.
ModInt modcomb(long long int n, long long int r, long long int _mod = 1000000007){
if(n < r || n < 0)
return 0;
ModInt x(1, _mod), y(1, _mod);
for (long long int i = 0; i < r; i++){
x = x * ModInt(n - i);
y = y * ModInt(i + 1);
}
return x / y;
}
//mod nCrを返す関数.何回も計算するときはこっち.ModIntが必要.
class modcomb{
public:
vector<ModInt> fact;
vector<ModInt> ifact;
modcomb(){}
modcomb(int n){
this->fact.resize(n + 1, ModInt(1));
this->ifact.resize(n + 1, ModInt(1));
for (int i = 1; i <= n;i++)
this->fact[i] = this->fact[i - 1] * i;
this->ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i)
this->ifact[i - 1] = ifact[i] * i;
}
ModInt operator()(int n, int k){
if (k < 0 || k > n)
return 0;
return this->fact[n] * this->ifact[k] * this->ifact[n - k];
}
};
//重複組み合わせ(nHr)を返す.modcomb,ModIntが必要
ModInt H(long long int n, long long int r, long long int _mod = 1000000007){
return modcomb(n + r - 1, r, _mod);
}
//nCrを返す関数.
long long int comb(long long int n, long long int r){
if(n < r || n < 0)
return 0;
long long int x = 1, y = 1;
if (n-r < r) r = n - r;
for (long long int i = 0; i < r; i++)
{
x = x * (n - i);
y = y * (i + 1);
}
return x / y;
}
//繰り返し2乗法を用いたべき乗.x^nを返す.
long long int pow(long long int x,long long int n){
long long int res = 1;
while (n)
{
if (n&1){
res *= x;
}
n >>= 1;
x = x * x;
}
return res;
}
//累積和を返す関数.
vector<int> csum(vector<int> a){
vector<int> res(a.size() + 1, 0);
for (int i = 0; i < a.size(); i++)
{
res[i + 1] = res[i] + a[i];
}
return res;
}
//2次元累積和を返す関数
vector<vector<int>> csum2d(vector<vector<int>> a){
vector<vector<int>> res(a.size() + 1, vector<int>(a[0].size() + 1, 0));
for (int i = 0; i < a.size(); i++)
{
for (int j = 0; j < a[0].size(); j++)
{
res[i + 1][j + 1] = res[i][j + 1] + res[i + 1][j] - res[i][j] + a[i][j];
}
}
return res;
}
//最大公約数を返す関数.
long long int gcd(long long int x, long long int y){
if (x < y) swap(x,y);
while (y > 0){
long long int r = x % y;
x = y;
y = r;
}
return x;
}
//最小公倍数を返す関数.gcdが必要.
long long int lcm(long long int x, long long int y){
return x / gcd(x, y) * y;
}
//素数かどうかを判定する関数.
int isprime(long long int n){
if (n == 1) return 0;
for (long long int i=2;i*i <= n;i++){
if (n % i == 0) return 0;
}
return 1;
}
//nの約数を返す関数.sortされてない.
vector<long long int> divisors(long long int n){
vector<long long int> res;
for (long long int i = 1; i * i <= n;i++){
if (n % i == 0){
res.push_back(i);
if(i * i != n){
res.push_back(n / i);
}
}
}
return res;
}
//aとbの公約数を列挙する.divisors,gcdが必要.sortされていない.
vector<long long int> common_divisors(long long int a, long long int b){
long long int g = gcd(a, b);
return divisors(g);
}
//素因数分解をする関数.
map<long long int, int> prime_factorization(long long int a)
{
map<long long int, int>ans;
for (long long i = 2; i*i <= a; ++i) {
while (a%i == 0) {
ans[i]++;
a /= i;
}
}
if (a != 1)ans[a]++;
return ans;
}
//与えられた配列の最小公倍数を返す.返り値は素因数分解された形.long*longがオーバーフローするときはこっちを使う.aによっては遅い.
//prime_factorizationが必要.
map<long long int,int> lcm(vector<long long int> &a){
int n = a.size();
map<long long int, int> res;
for (long long int i = 0; i < n; i++)
{
map<long long int, int> t = prime_factorization(a[i]);
for (auto x:t){
res[x.first] = max(res[x.first], x.second);
}
}
return res;
}
//オイラーのファイ関数.1からnまででnと互いに素のものを返す.
int totient(long long int n){
map<long long int, int> a = prime_factorization(n);
for (auto x:a)
{
n = n / x.first * (x.first - 1);
}
return n;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s088341716 | p03846 | C++ | #include <iostream>
#include <vector>
#include <set>
#include <math.h>
using namespace std;
int main() {
__int64 n,a,k,p,m = 1000000007;
bool haveZero = false;
vector<long> arr;
cin >> n;
while (n--)
{
cin >> a;
if (a == 0 && haveZero)
{
cout << 0;
return 0;
}
if (a == 0) haveZero = true;
arr.push_back(a);
}
k = set<double>(arr.begin(),arr.end()).size();
if ( (arr.size() % 2 == 0 && k != arr.size() / 2) || (arr.size() % 2 == 1 && k != ceil(arr.size() / 2.0) ) )
{
cout << 0;
return 0;
}
p = pow(2, floor(arr.size() / 2.0));
cout << p % m;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:3: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
7 | __int64 n,a,k,p,m = 1000000007;
| ^~~~~~~
| __ynf64
a.cc:10:10: error: 'n' was not declared in this scope; did you mean 'yn'?
10 | cin >> n;
| ^
| yn
a.cc:13:12: error: 'a' was not declared in this scope
13 | cin >> a;
| ^
a.cc:22:3: error: 'k' was not declared in this scope
22 | k = set<double>(arr.begin(),arr.end()).size();
| ^
a.cc:28:3: error: 'p' was not declared in this scope
28 | p = pow(2, floor(arr.size() / 2.0));
| ^
a.cc:29:15: error: 'm' was not declared in this scope; did you mean 'tm'?
29 | cout << p % m;
| ^
| tm
|
s038509374 | p03846 | C++ | #include<iostream>
using namespace std;
int main()
{
}#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vi> vii;
typedef map<int, int> mp;
typedef multiset<int> mset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
typedef vector<int64> vi64;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define form(i,j,k,l) for(int i=j;i<int(k);i+=l)
#define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l)
#define rep(i, j) for(int i=0;i<int(j);i++)
#define rrep(i, j) for(int i=int(j);i>=0;i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forc(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define INF (int)1e9
#define INF64 (int64)1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define F first
#define S second
const double pie = acos(-1.0);
template <typename T>
T Max(T x, T y)
{
return (x > y) ? x : y;
}
template <typename T>
T Min(T x, T y)
{
return (x > y) ? y : x;
}
int gcd(int n1, int n2)
{
if (n2 != 0) return gcd(n2, n1 % n2);
else return n1;
}
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
clock_t time_p = clock();
void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";}
int binpow(int a, int b, int m) {
a %= m;
int res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
int main()
{ fast;
int n;
cin >> n;
int arr[n];
int count[n] = {0};
for (int i = 0; i < n; i++)
{ cin >> arr[i];
count[arr[i]]++;
}
int ret;
if (n % 2 == 0)
ret = 1;
else
ret = 0;
for (int i = 0; i < n; i++)
{ if (ret == 0 && i % 2 != 0)
continue;
if (ret == 1 && i % 2 == 0)
continue;
if (i != 0 && count[i] != 2)
{ cout << "0";
return 0;
}
if (i == 0)
{ if (count[i] > 1)
{ cout << "0";
return 0;
}
if (count[i] == 1 && n % 2 == 0)
{ cout << "0";
return 0;
}
}
}
int mod=1e9+7;
cout << binpow(2, n / 2,mod);
return 0;
}
| a.cc:5:2: error: stray '#' in program
5 | }#include<bits/stdc++.h>
| ^
a.cc:5:3: error: 'include' does not name a type
5 | }#include<bits/stdc++.h>
| ^~~~~~~
a.cc:8:9: error: 'vector' does not name a type
8 | typedef vector<int> vi;
| ^~~~~~
a.cc:9:9: error: 'vector' does not name a type
9 | typedef vector<string> vs;
| ^~~~~~
a.cc:10:9: error: 'vector' does not name a type
10 | typedef vector<pi> vpi;
| ^~~~~~
a.cc:11:9: error: 'vector' does not name a type
11 | typedef vector<vi> vii;
| ^~~~~~
a.cc:12:9: error: 'map' does not name a type; did you mean 'mp'?
12 | typedef map<int, int> mp;
| ^~~
| mp
a.cc:13:9: error: 'multiset' does not name a type
13 | typedef multiset<int> mset;
| ^~~~~~~~
a.cc:18:9: error: 'vector' does not name a type
18 | typedef vector<int64> vi64;
| ^~~~~~
a.cc:38:20: error: 'acos' was not declared in this scope
38 | const double pie = acos(-1.0);
| ^~~~
a.cc: In function 'void __f(const char*, Arg1&&, Args&& ...)':
a.cc:64:23: error: there are no arguments to 'strchr' that depend on a template parameter, so a declaration of 'strchr' must be available [-fpermissive]
64 | const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
| ^~~~~~
a.cc:64:23: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: At global scope:
a.cc:83:5: error: redefinition of 'int main()'
83 | int main()
| ^~~~
a.cc:3:5: note: 'int main()' previously defined here
3 | int main()
| ^~~~
|
s490906228 | p03846 | C++ | #include<iostream>
using namespace std;
int main()
{
}#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vi> vii;
typedef map<int, int> mp;
typedef multiset<int> mset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
typedef vector<int64> vi64;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define form(i,j,k,l) for(int i=j;i<int(k);i+=l)
#define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l)
#define rep(i, j) for(int i=0;i<int(j);i++)
#define rrep(i, j) for(int i=int(j);i>=0;i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forc(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define INF (int)1e9
#define INF64 (int64)1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define F first
#define S second
const double pie = acos(-1.0);
template <typename T>
T Max(T x, T y)
{
return (x > y) ? x : y;
}
template <typename T>
T Min(T x, T y)
{
return (x > y) ? y : x;
}
int gcd(int n1, int n2)
{
if (n2 != 0) return gcd(n2, n1 % n2);
else return n1;
}
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
clock_t time_p = clock();
void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";}
int binpow(int a, int b) {
if (b == 0)
return 1;
int res = binpow(a, b / 2);
if (b % 2)
return res * res * a;
else
return res * res;
}
int main()
{ fast;
int n;
cin >> n;
int arr[n];
int count[n] = {0};
for (int i = 0; i < n; i++)
{ cin >> arr[i];
count[arr[i]]++;
}
int ret;
if (n % 2 == 0)
ret = 1;
else
ret = 0;
for (int i = 0; i < n; i++)
{ if (ret == 0 && i % 2 != 0)
continue;
if (ret == 1 && i % 2 == 0)
continue;
if (i != 0 && count[i] != 2)
{ cout << "0";
return 0;
}
if (i == 0)
{ if (count[i] > 1)
{ cout << "0";
return 0;
}
if (count[i] == 1 && n % 2 == 0)
{ cout << "0";
return 0;
}
}
}
cout << binpow(2, n / 2);
return 0;
}
| a.cc:5:2: error: stray '#' in program
5 | }#include<bits/stdc++.h>
| ^
a.cc:5:3: error: 'include' does not name a type
5 | }#include<bits/stdc++.h>
| ^~~~~~~
a.cc:8:9: error: 'vector' does not name a type
8 | typedef vector<int> vi;
| ^~~~~~
a.cc:9:9: error: 'vector' does not name a type
9 | typedef vector<string> vs;
| ^~~~~~
a.cc:10:9: error: 'vector' does not name a type
10 | typedef vector<pi> vpi;
| ^~~~~~
a.cc:11:9: error: 'vector' does not name a type
11 | typedef vector<vi> vii;
| ^~~~~~
a.cc:12:9: error: 'map' does not name a type; did you mean 'mp'?
12 | typedef map<int, int> mp;
| ^~~
| mp
a.cc:13:9: error: 'multiset' does not name a type
13 | typedef multiset<int> mset;
| ^~~~~~~~
a.cc:18:9: error: 'vector' does not name a type
18 | typedef vector<int64> vi64;
| ^~~~~~
a.cc:38:20: error: 'acos' was not declared in this scope
38 | const double pie = acos(-1.0);
| ^~~~
a.cc: In function 'void __f(const char*, Arg1&&, Args&& ...)':
a.cc:64:23: error: there are no arguments to 'strchr' that depend on a template parameter, so a declaration of 'strchr' must be available [-fpermissive]
64 | const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
| ^~~~~~
a.cc:64:23: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: At global scope:
a.cc:81:5: error: redefinition of 'int main()'
81 | int main()
| ^~~~
a.cc:3:5: note: 'int main()' previously defined here
3 | int main()
| ^~~~
|
s023371723 | p03846 | C++ | #include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
ll a[100001];
ll ans[100001];
ll cnt[100001];
ll sum=1;
ll fact(ll num){
ll tmp=1;
while(num){
tmp*=(num%mod);
tmp%=mod;
num--;
}
return tmp%mod;
}
int main(){
int mod = 1e9+7;
ll n;
cin >> n;
rep(i,n){
cin >> a[i];
cnt[a[i]]++;
}
sort(a,a+n);
rep(i,n){
if(i%2==0)
ans[i/2]=a[n-i-1];
else
ans[n-(i+1)/2]=a[n-i-1];
}
rep(i,n){
if(ans[i]!=abs(n-2*i-1)){
cout << "0" << endl;
return 0;
}
}
rep(i,n){
if(cnt[i]!=0){
sum*=fact(cnt[i])%mod;
}
}
cout << sum%mod << endl;
} | a.cc: In function 'll fact(ll)':
a.cc:20:27: error: 'mod' was not declared in this scope; did you mean 'modf'?
20 | tmp*=(num%mod);
| ^~~
| modf
a.cc:24:20: error: 'mod' was not declared in this scope; did you mean 'modf'?
24 | return tmp%mod;
| ^~~
| modf
|
s168464706 | p03846 | C++ | #include<iostream>
#include<map>
#include<math.h>
using namespace std;
int main(){
int N;
map<int, int> cnt;
cin >> N;
int require = 1;
if (N & 1 == 1) require--;
for (int i=0; i<N; i++){
int A; cin >> A;
if (A%2 != require){
cout << 0 << endl;
return 0;
}
cnt[A]++;
if (cnt[A] > 2){
cout << 0 <<endl;
return 0;
}
}
if (require == 0){
if (cnt[0] == 1){
cnt.erase(0);
}else{
cout << 0 << endl;
return 0;
}
}
for (auto x : cnt){
if (x != 2){
cout << 0 << endl;
return 0;
}
}
long ans;
if (require == 0){
ans = pow(2, (N-1)/2) % 1000000007;
}else{
ans = pow(2, N/2) % 1000000007;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:33:15: error: no match for 'operator!=' (operand types are 'std::pair<const int, int>' and 'int')
33 | if (x != 2){
| ~ ^~ ~
| | |
| | int
| std::pair<const int, int>
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::fpos<_StateT>'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::allocator<_CharT>'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
33 | if (x != 2){
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
33 | if (x != 2){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
33 | if (x != 2){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
33 | if (x != 2){
| ^
/usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
33 | if (x != 2){
| ^
/usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
33 | if (x != 2){
| ^
/usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
33 | if (x != 2){
| ^
/usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3847 | operator!=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: mismatched types 'const _CharT*' and 'std::pair<const int, int>'
33 | if (x != 2){
| ^
/usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::tuple<_UTypes ...>'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
33 | if (x != 2){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:1557:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1557 | operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1557:5: note: template argument deduction/substitution failed:
a.cc:33:18: note: 'std::pair<const int, int>' is not derived from 'const std::m |
s372493750 | p03846 | C++ |
#include<bits/stdc++.h>
using namespace std;
#define debug(n) cerr << #n << ':' << n << endl;
#define dline cerr << __LINE__ << endl;
using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;
template<class T>
bool ChangeMax(T&a,const T&b){
if(a >= b) return false;
a = b; return true;
}
template<class T>
bool ChangeMin(T&a,const T&b){
if(a <= b) return false;
a = b; return true;
}
template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
fill((U*)a,(U*)(a+N),v);
}
template<class T>
istream& operator >> (istream&is, vector<T>&v){
for(auto&e:v)is >> e;
return is;
}
template<long long mod>
class modint{
private:
long long num;
long long extgcd(long long a, long long b, long long&x, long long&y)const {
long long d = a;
if(b != 0){d = extgcd(b, a%b, y, x); y -= (a/b) * x;}
else{x = 1; y = 0;}
return d;
}
long long modinverse()const{
long long x, y;
extgcd(num, mod, x, y);
return (mod + x%mod)%mod;
}
public:
modint():num(0){}
modint(const long long x):num((x < 0?(x+mod):x)%mod ){}
friend modint operator+(const modint&a, const modint&b)
{ return modint(a.num + b.num); }
friend modint operator-(const modint&a, const modint&b)
{ return modint(a.num - b.num); }
friend modint operator*(const modint&a, const modint&b)
{ return modint(a.num * b.num); }
friend modint operator/(const modint&a, const modint&b)
{ return modint(a*b.modinverse()); }
modint& operator+=(const modint&b)
{ return (*this) = (*this) + b; }
modint& operator-=(const modint&b)
{ return (*this) = (*this) - b; }
modint& operator*=(const modint&b)
{ return (*this) = (*this) * b; }
modint& operator/=(const modint&b)
{ return (*this) = (*this) / b; }
modint& operator++()
{ (*this)+=1; return (*this); }
modint& operator--()
{ (*this)-=1; return (*this); }
modint operator++(int){
modint tmp(*this);
++(*this);
return tmp;
}
modint operator--(int){
modint tmp(*this);
--(*this);
return tmp;
}
modint pow(unsigned long long i){
if(i == 0) return 1;
if(i & 1){
return (*this) * (this->pow(i-1));
}
modint<mod>hpow = (this->pow(i>>1));
return hpow * hpow;
}
friend ostream& operator<<(ostream&os, const modint&a){
os << a.num;
return os;
}
friend istream& operator>>(istream&is, modint&a){
long long x; is >> x;
a = x;
return is;
}
};
using mint = modint<1000000007>;
int main(){
int n; cin >> n;
map<int,int> mp;
for(int i = 0; i < n; ++i){
int x; cin >> x;
mp[x]++;
}
for(auto e:mp){
if(e.first == 0){
if(e.second != 1){
cout << 0 << endl;
return 0;
}
} else if(e.first % 2 == n % 2){
cout << 0 << endl;
return 0;
} else if(e.second != 2){
cout << 0 << endl;
return 0;
} else if(e.first >= n){
cout << 0 << end;
return 0;
}
}
if(mp.size() != (n+1)/2){
cout << 0 << endl;
return 0;
}
cout << mint(2).pow((n-1)/2) << endl;
}
| a.cc: In function 'int main()':
a.cc:129:17: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
129 | cout << 0 << 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:2:
/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>; std::nullptr_t = std::nullptr_t]'
306 | |
s276721710 | p03846 | C++ | #include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;
const int MOD = 1000000007;
int main()
{
ll n;
cin >> n;
ll a[n];
ll cnt[n] = {};
bool judge = true;
for(int i=0; i<n; i++)
cin >> a[i];
if(n%2 == 0){
for(int i=0; i<n; i++){
cnt[a[i]]++;
if(cnt[a[i]] > 0 && a[i] == 0){
judge = false;
break;
}
else if(cnt[a[i]] > 2){
judge = false;
break;
}
}
}
else{
for(int i=0; i<n; i++){
cnt[a[i]]++;
if(cnt[a[i]] > 1 && a[i] == 0){
judge = false;
break;
}
else if(cnt[a[i]] > 2){
judge = false;
break;
}
}
}
if(judge){
cout << pow(2, n/2)%MOD << endl;
}
else{
cout << 0 << endl;
}
}
| a.cc: In function 'int main()':
a.cc:51:28: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const int' to binary 'operator%'
51 | cout << pow(2, n/2)%MOD << endl;
| ~~~~~~~~~~~^~~~
| | |
| | const int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s362170733 | p03846 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> A(n);
for (int i = 0; i < n; i++) {
cin >> A.at(i);
}
map<int, int> cnt;
for (int x : A) {
if (cnt.count(x)) {
cnt.at(x)++;
}
else {
cnt[x] = 1;
}
}
bool ans = true;
if(n%2 == 0){
for (int x : A) {
if(x == 0 && cnt.at(x) > != 0){
ans = false;
break;
}
if(x != 0 && cnt.at(x) != 2){
ans = false;
break;
}
}
}
if(n%2 != 0){
for (int x : A) {
if(x == 0 && cnt.at(0) != 1){
ans = false;
break;
}
if(x != 0 && cnt.at(x) != 2){
ans = false;
break;
}
}
}
if(ans){
int t = n / 2;
int s = 1;
for (int i = 0; i < t; i++) {
s *= 2;
}
int64_t str = s%(1000000000 + 7);
cout << str << endl;
}
else{
cout << 0 << endl;
}
}
| a.cc: In function 'int main()':
a.cc:27:32: error: expected primary-expression before '!=' token
27 | if(x == 0 && cnt.at(x) > != 0){
| ^~
|
s787248843 | p03846 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define MOD = 1e9 + 7;
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define ll long long
#define ld long double
#define lcm(a, b) (a * b) / __gcd(a, b)
#define flu(i, a, b) for (ll i = a; i < b; i++)
#define blu(i, a, b) for (ll i = a; i >= b; i--)
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define Unique(X) (X).erase(unique(all(X)), (X).end())
#define all(v) v.begin(), v.end()
typedef vector<ll> vl;
typedef map<ll, ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
char e = '\n';
ll i, j, le;
int sv(int x)
{
int n = 200000;
// Create a boolean array "prime[0..n]" and initialize
// all entries it as true. A value in prime[i] will
// finally be false if i is Not a prime, else true.
bool prime[n + 1];
memset(prime, true, sizeof(prime));
for (int p = 2; p * p <= n; p++)
{
// If prime[p] is not changed, then it is a prime
if (prime[p] == true)
{
// Update all multiples of p greater than or
// equal to the square of it
// numbers which are multiple of p and are
// less than p^2 are already been marked.
for (int i = p * p; i <= n; i += p)
prime[i] = false;
}
}
if (prime[x])
return 1;
else
return 0;
}
int main()
{
IOS;
int t;
// cin >> t;
t=1;
while (t--)
{
ll n, ans=1, f;
cin>>n;
vl v(n);
ml mp;
flu(i, 0, n)
cin>>v[i], mp[v[i]]++;
if (n%2==0)f=1;
else f=0;
ll c=0;
if (mp[0]>1)c=1;
flu(i, 0, n)
if (v[i]%2!=f && mp[v[i]]>2)
{
c=1;break;
}
if (c==1)cout<<0<<endl;
else {
n/=2;
f=1;
while (n--) {
f=(f*2)%MOD;
}
cout<<f<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:13: error: expected primary-expression before '=' token
6 | #define MOD = 1e9 + 7;
| ^
a.cc:86:25: note: in expansion of macro 'MOD'
86 | f=(f*2)%MOD;
| ^~~
|
s517069967 | p03846 | C++ | //题意:n个人编号1-n站成一排,每个人左边的人数和右边的人数的差的绝对值为Ai,求可能的站的方案数的个数;n范围1e5
//方案数要取模1e9+7,没有这样的方案就输出0
//思路: 看了一下样例,感觉找到了规律啊。如果n是奇数的话,那么一定有一个0(也就是站在中间),2,2,4,4...,(n-1);
//满足的话方案数为(n-1)
//如果n是偶数的话,那么一定有1,1,3,3,5,5,n-1,n-1,满足的话方案数为2*n ;不满足以上条件则为0;
#include <iostream>
#include <cmath>
using namespace std;
const int mod=1e9+7;
typedef long long LL;
const int N=1e5+10;
int n, b[N];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int x;
cin>>x;
b[x]++;
}
if(n==1){
if(b[1]!=0) cout<<0;
else cout<<1;
return 0;
}
if(n%2==0){
bool is_ok=true;
for(int i=0;i<=n-1;i++)
{
if(i%2==0)
{
if(b[i]!=0){
is_ok=false;
break;
}
}
else{
if(b[i]!=2){
is_ok=false;
break;
}
}
}
if(!is_ok) cout<<0;
else cout<<pow(2,n/2)%mod;
}else{
bool is_ok=true;
for(int i=0;i<=n-1;i++)
{
if(i==0){
if(b[i]!=1){
is_ok=false;
break;
}
}
else{
if(i%2==0){
if(b[i]!=2){
is_ok=false;
break;
}
}else{
if(b[i]!=0){
is_ok=false;
break;
}
}
}
}
if(!is_ok) cout<<0;
else cout<<n-1;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:47:38: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const int' to binary 'operator%'
47 | else cout<<pow(2,n/2)%mod;
| ~~~~~~~~~~^~~~
| | |
| | const int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s974734437 | p03846 | C++ | //题意:n个人编号1-n站成一排,每个人左边的人数和右边的人数的差的绝对值为Ai,求可能的站的方案数的个数;n范围1e5
//方案数要取模1e9+7,没有这样的方案就输出0
//思路: 看了一下样例,感觉找到了规律啊。如果n是奇数的话,那么一定有一个0(也就是站在中间),2,2,4,4...,(n-1);
//满足的话方案数为(n-1)
//如果n是偶数的话,那么一定有1,1,3,3,5,5,n-1,n-1,满足的话方案数为2*n ;不满足以上条件则为0;
#include <iostream>
using namespace std;
const int mod=1e9+7;
typedef long long LL;
const int N=1e5+10;
int n, b[N];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int x;
cin>>x;
b[x]++;
}
if(n==1){
if(b[1]!=0) cout<<0;
else cout<<1;
return 0;
}
if(n%2==0){
bool is_ok=true;
for(int i=0;i<=n-1;i++)
{
if(i%2==0)
{
if(b[i]!=0){
is_ok=false;
break;
}
}
else{
if(b[i]!=2){
is_ok=false;
break;
}
}
}
if(!is_ok) cout<<0;
else cout<<pow(2,n/2)%mod;
}else{
bool is_ok=true;
for(int i=0;i<=n-1;i++)
{
if(i==0){
if(b[i]!=1){
is_ok=false;
break;
}
}
else{
if(i%2==0){
if(b[i]!=2){
is_ok=false;
break;
}
}else{
if(b[i]!=0){
is_ok=false;
break;
}
}
}
}
if(!is_ok) cout<<0;
else cout<<n-1;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:46:28: error: 'pow' was not declared in this scope
46 | else cout<<pow(2,n/2)%mod;
| ^~~
|
s708002744 | p03846 | C++ | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define ll long long
ll MOD=1e9+7;
ll a[100005];
using namespace std;
int main(){
ll n;
cin>>n;
ll flag=1;//flag
ll ans=1;
if(n%2==0){ // even number
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;//a[7]++
/ / give data x error
if(x>=n || x%2==0 || a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(a[x]==1)
ans=ans*2%MOD; // a * b %c == a%c * b%c
}
}
else{ //odd
for(ll i=0;i<n;i++){
ll x;
cin>>x;
a[x]++;
/ / give data x error
if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){
flag=0;
cout<<"0"<<endl;
break;
}
//The correct situation
if(x!=0 && a[x]==1)
ans=ans*2%MOD;
}
}
if(flag)
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:25: error: expected primary-expression before '/' token
26 | / / give data x error
| ^
a.cc:26:27: error: expected primary-expression before '/' token
26 | / / give data x error
| ^
a.cc:26:29: error: 'give' was not declared in this scope
26 | / / give data x error
| ^~~~
a.cc:46:25: error: expected primary-expression before '/' token
46 | / / give data x error
| ^
a.cc:46:27: error: expected primary-expression before '/' token
46 | / / give data x error
| ^
a.cc:46:29: error: 'give' was not declared in this scope
46 | / / give data x error
| ^~~~
|
s481511114 | p03846 | C | import java.util.*;
import java.io.*;
public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
static long[] f;
static long mod=(long)1e9+7;
//......................................@uthor_Alx..............................................
public static void main(String[] args) throws IOException{
assign();
int t=1;//int_v(read()),cn=1;
while(t--!=0){
int n=int_v(read());
int[] arr=int_arr();
int[] f=new int[n];
for(int i:arr){f[i]++;}
boolean b=true;
if((n%2==0&&f[0]>0)||f[0]>1){b=false;}
if(n%2==0){
for(int i=1;i<n;i+=2){
if(f[i]!=2){
b=false;break;
}
}
}
if(n%2==1){
for(int i=2;i<n;i+=2){
if(f[i]!=2){
b=false;break;
}
}
}
if(!b){
out.write("0");
}
else{
out.write(Modpow(2l,n/2,mod)+"");
}
}
out.flush();
}
} | main.c:1:1: error: unknown type name 'import'
1 | import java.util.*;
| ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1 | import java.util.*;
| ^
main.c:2:1: error: unknown type name 'import'
2 | import java.io.*;
| ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
2 | import java.io.*;
| ^
main.c:4:2: error: unknown type name 'public'
4 | public class Main{
| ^~~~~~
main.c:4:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
4 | public class Main{
| ^~~~
|
s324828701 | p03846 | C++ | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#define lowbit(x) ((x)&(-x))
#define sc scanf
#define debug1(x) cout<<x<<" "
#define debug2(x) cout<<x<<"\n"
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
typedef long long ll;
const ll inf=1e18;
const int N=1e5+10;
ll mod=1e9+7;
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int arr[N],brr[N];
ll quick_pow(ll a,ll b,ll m)
{
ll ret=1;
while(b)
{
if(b&1)
{
ret*=a;
ret%=m;
}
a*=a;
a%=m;
b>>=1;
}
return ret;
}
int main()
{
int n;
while(cin>>n)
{
memset(brr,0,sizeof(brr));
for(int i=1;i<=n;i++)
{
cin>>arr[i];
brr[arr[i]]++;
}
long long sum=0,i;
if(n%2==0)i=1;
else i=0;
for(;i<n;i+=2)
{
if(brr[i]>2||brr[0]>1)
{
break;
}
sum+=brr[i];
}
if((sum==n))
{
ll ans=quick_pow(2,n/2,mod);
cout<<ans<<"\n";
}
else
cout<<“0”<<"\n";
}
return 0;
} | a.cc:65:23: error: extended character “ is not valid in an identifier
65 | cout<<“0”<<"\n";
| ^
a.cc:65:23: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:65:23: error: '\U0000201c0\U0000201d' was not declared in this scope
65 | cout<<“0”<<"\n";
| ^~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.