submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s330589216 | p03841 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int grid[2000000] = {};
map<int, int> geko;
vector<pair<int, int>> wow;
vector<int>x;
int main() {
int n;
cin >> n;
while (true) {
for (int i = 0;i < 500000;++i) grid[i] = 0;
REP(i, n) {
int geko;
cin >> geko;
x.push_back(geko);
wow.push_back(make_pair(geko, i + 1));
if (grid[geko] != 0) {
cout << "No" << endl;
goto ok;
return 0;
}
grid[geko] = i + 1;
}
sort(wow.begin(), wow.end());
//右側に設置
int now_itr = n - 1;
int now_filled = wow[now_itr].second;
if (now_filled == n) {
if (now_itr != 0) {
now_itr--;
now_filled = wow[now_itr].second;
}
}
for (int i = n*n;i >= 1;--i) {
if (grid[i] == false) {
grid[i] = wow[now_itr].second;
now_filled++;
fo2:;
if (now_filled == n) {
if (now_itr == 0) {
break;
}
now_itr--;
now_filled = wow[now_itr].second;
goto fo2;
}
}
}
now_itr = 0;
now_filled = wow[now_itr].second - 1;
if (now_filled == 0) {
if (now_itr != n - 1) {
now_itr++;
now_filled = wow[now_itr].second - 1;
}
}
for (int i = 1;i <= n*n;++i) {
if (grid[i] == false) {
grid[i] = wow[now_itr].second;
now_filled--;
fo1:;
if (now_filled == 0) {
now_itr++;
if (now_itr == n) {
break;
}
now_filled = wow[now_itr].second - 1;
goto fo1;
}
}
}
for (int i = 1;i <= n*n;++i) {
if (grid[i] == 0) {
cout << "No" << endl;
return 0;
}
geko[grid[i]]++;
if (geko[grid[i]] == grid[i]) {
if (i != x[grid[i] - 1]) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
for (int i = 1;i <= n*n;++i) {
cout << grid[i] << " ";
}
cout << endl;
return 0;
ok:;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:125:9: error: jump to label 'ok'
125 | ok:;
| ^~
a.cc:53:38: note: from here
53 | goto ok;
| ^~
a.cc:61:21: note: crosses initialization of 'int now_filled'
61 | int now_filled = wow[now_itr].second;
| ^~~~~~~~~~
a.cc:60:21: note: crosses initialization of 'int now_itr'
60 | int now_itr = n - 1;
| ^~~~~~~
|
s381696101 | p03841 | C++ | import sequtils,strutils,algorithm
type
binaryIndexTree[I:static[int]] = array[I + 1,int] #要素数 <= I 1始まりで BIT[0]は要素数
item = tuple[x, i : int]
proc add(BIT :var binaryIndexTree,i : int, a : int)=
var index = i
while BIT[0] >= index:
BIT[index] += a
index += ((index xor (index - 1)) and index)
proc sum(BIT : binaryIndexTree, i : int):int =
var index = i
while index > 0:
result += BIT[index]
index = (index and (index - 1))
#[
var
BIT : binaryIndexTree[12]
A = stdin.readline.split.map(parseInt)
BIT[0] = 12 #忘れずに書く
for i,a in A:
BIT.add(i + 1,a)
for i in 1..12:
echo BIT.sum(i)
]#
var
N = stdin.readline.parseInt
X = stdin.readline.split.map(parseInt)
A = newSeq[int](N * N)
b : binaryIndexTree[2500]
items = newSeq[item](0)
b[0] = N * N
for i,x in X:
b.add(x, i + 1)
A[x - 1] = i + 1
items.add((x - 1, i + 1))
items = sortedByIt(items, it.x)
var
flag : bool = true
p = 0
j = items[p].i - 1
for i in 1..(N * N):
if b.sum(i) > i:
flag = false
break
if j == 0:
p += 1
if p > items.high:
break
j = items[p].i - 1
if A[i - 1] == 0:
j -= 1
A[i - 1] = items[p].i
if flag:
p -= 1
j = N - items[p].i
#echo A.join(" ")
for i in countdown(N * N, 1):
if A[i - 1] == 0:
j -= 1
A[i - 1] = items[p].i
if j == 0:
p -= 1
if p < 0:
break
j = N - items[p].i
for i in 0..<(N * N):
if A[i] == 0:
flag = false
break
if flag:
echo "Yes"
echo A.join(" ")
else:
echo "No" | a.cc:4:55: error: stray '#' in program
4 | binaryIndexTree[I:static[int]] = array[I + 1,int] #要素数 <= I 1始まりで BIT[0]は要素数
| ^
a.cc:19:2: error: invalid preprocessing directive #[
19 | #[
| ^
a.cc:24:13: error: stray '#' in program
24 | BIT[0] = 12 #忘れずに書く
| ^
a.cc:28:10: error: too many decimal points in number
28 | for i in 1..12:
| ^~~~~
a.cc:30:2: error: stray '#' in program
30 | ]#
| ^
a.cc:49:10: error: too many decimal points in number
49 | for i in 1..(N * N):
| ^~~
a.cc:64:6: error: invalid preprocessing directive #echo
64 | #echo A.join(" ")
| ^~~~
a.cc:74:14: error: too many decimal points in number
74 | for i in 0..<(N * N):
| ^~~
a.cc:1:1: error: 'import' does not name a type
1 | import sequtils,strutils,algorithm
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s303365165 | p03841 | C++ |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
int n, x[500];
int a[100000];
vector<pair<int, int>>col;//first:position,second:value
int main(void)
{
cin >> n;
for (int i = 0; i < n; ++i)
cin >> x[i];
int siz = n * n;
fill(a, a + siz, -1);
for (int i = 0; i < n; ++i)
{
a[x[i] - 1] = i + 1;
col.emplace_back(x[i] - 1, i + 1);
}
sort(col.begin(), col.end());
int gauge = 0;
for (auto& itr = col.begin(); itr != col.end(); ++itr)
{
int umnum = itr->second - 1;
for (int i = 0; i < umnum; ++i)
{
while (a[gauge] >= 0)++gauge;
a[gauge] = itr->second;
if (gauge > itr->first)
{
return 0 * printf("No\n");
}
}
}
gauge = siz - 1;
for (auto& itr = col.rbegin(); itr != col.rend(); ++itr)
{
int umnum = n - itr->second;
for (int i = 0; i < umnum; ++i)
{
while (a[gauge] >= 0)--gauge;
a[gauge] = itr->second;
if (gauge < itr->first)
{
return 0 * printf("No\n");
}
}
}
printf("Yes\n");
for (int i = 0; i < siz; ++i)
{
cout << a[i];
if (i != siz - 1)
{
cout << " ";
}
else
{
cout << "\n";
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:35: error: cannot bind non-const lvalue reference of type '__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >&' to an rvalue of type 'std::vector<std::pair<int, int> >::iterator'
40 | for (auto& itr = col.begin(); itr != col.end(); ++itr)
| ~~~~~~~~~^~
a.cc:54:36: error: cannot bind non-const lvalue reference of type 'std::reverse_iterator<__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > > >&' to an rvalue of type 'std::vector<std::pair<int, int> >::reverse_iterator' {aka 'std::reverse_iterator<__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > > >'}
54 | for (auto& itr = col.rbegin(); itr != col.rend(); ++itr)
| ~~~~~~~~~~^~
|
s726440076 | p03841 | C++ | #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
using namespace std;
#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)
#define shosu(x) fixed<<setprecision(x)
typedef long long ll;
int main(){
int n;
cin>>n;
int tmp;
int m=1;
int M =501;
int flg=0;
loop(i,1,n+1){
cin>>tmp;
int tm=ceil(1.0*tmp/i);
int tM;
if(i!=1)
tM=ceil(((float)tmp)/i);
else
tM=M;
% cout<<tm<<' '<<m<<' '<<tM<<' '<<M<<endl;
if( (tm < m || tm > M) && ((tM < m) || (tM > M)) )
break;
m=max(m,tm);
M=min(M,tM);
if(m>M)
break;
if(i==n)
flg++;
}
if(!flg)
cout<<"No"<<endl;
else{
cout<<"Yes"<<endl;
rep(i,n) rep(j,m){
if(i==0 &&j==0)
cout<<i+1;
else
cout<<' '<<i+1;
}
cout<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:1: error: expected primary-expression before '%' token
28 | % cout<<tm<<' '<<m<<' '<<tM<<' '<<M<<endl;
| ^
|
s722355050 | p03841 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<iomanip>
using namespace std;
int main()
{
int n;cin>>n;
int a[501];
for(int i=1;i<=n;i++)cin>>a[i];
int s[250010];
memset(s,-1,sizeof(s));
int l=0,r=n*n-1;
for(int i=1;i<=n;i++)
{
s[a[i]-1]=i;
for(int c=1;c<i&&l<n*n;)
{
while(s[l]!=-1&&l<n*n)l++;
if(l==n*n)
{
cout<"No"<<endl;
return 0;
}
s[l++]=i;
c++;
}
}
for(int i=n;i>0;i--)
{
for(int c=0;c<n-i&&r>=0;)
{
while(s[r]!=-1&&r>=0)r--;
if(r<0)
{
cout<"No"<<endl;
return 0;
}
s[r--]=i;
c++;
}
}
bool flag=true;
int p[501][501];
memset(p,-1,sizeof(p));
int cou[501];
memset(cou,0,sizeof(cou));
for(int i=0;i<n*n;i++)
{
p[s[i]][cou[s[i]]++]=i;
}
for(int i=1;i<=n;i++)
{
if(p[i][i-1]!=a[i]-1)flag=false;
if(p[i][n-1]==-1)flag=false;
}
if(flag)
{
cout<<"Yes"<<endl;
for(int i=0;i<n*n;i++)cout<<s[i]<<(i==n*n-1?"\n":" ");
}
else cout<<"No"<<endl;
}
| a.cc: In function 'int main()':
a.cc:29:42: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
29 | cout<"No"<<endl;
| ~~~~^~~~~~
a.cc:43:42: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
43 | cout<"No"<<endl;
| ~~~~^~~~~~
|
s598910513 | p03841 | C++ | #include <iostream>
#include <vector>
#include <utility>
#define DEB1(x) std::cout << (x) << std::endl;
int n;
std::pair<int, int> arr[501];
int cntl[501], cntr[501];
int main() {
std::cin >> n;
for(int i = 0; i < n; ++i) {
cntl[i] = i;
cntr[i] = n - i - 1;
std::cin >> arr[i].first;
--arr[i].first;
arr[i].second = i;
}
std::sort(arr, arr + n);
int a = 0, b = 0;
std::vector<int> vec;
vec.reserve(n * n);
for(int i = 0; i < n * n; ++i) {
// DEB1(b)
if(a != n && i == arr[a].first) {
if(cntl[arr[a].second] != 0) {
std::cout << "No" << std::endl;
return 0;
}
vec.push_back(arr[a].second + 1);
++a;
}else if(b < n) {
while(cntl[arr[b].second] == 0) {
++b;
if(n <= b) {
goto SECOND;
}
}
--cntl[arr[b].second];
vec.push_back(arr[b].second + 1);
}else {
SECOND:;
if(b - n >= a) {
std::cout << "No" << std::endl;
return 0;
}
while(cntr[arr[b - n].second] == 0) ++b;
--cntr[arr[b - n].second];
vec.push_back(arr[b - n].second + 1);
}
}
for(int i = 0; i < n; ++i) {
if(cntl[i] != 0 || cntr[i] != 0) {
std::cout << "No" << std::endl;
return 0;
}
}
std::cout << "Yes" << std::endl;
for(int i = 0; i < n * n; ++i) {
std::cout << vec[i] << (i == n * n - 1 ? "\n" : " ");
}
} | a.cc: In function 'int main()':
a.cc:21:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
21 | std::sort(arr, arr + n);
| ^~~~
| qsort
|
s452320190 | p03841 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>
using namespace std;
using namespace std::chrono;
/*
#define trav(a, v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
*/
typedef long long ll;
typedef long double ld;
ll big = 1000000007ll;
ll n,m,k,r;
ll nt;
ll T;
vector<ll> A;
vector<ll> ind;
ll ANS[1000000] = {0};
queue Q2;
bool comp(ll i, ll j){
return A[i] < A[j];
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ll c1,c2,c3,c4,c5,c6;
ll a,b,c,d,e;
cin >> n;
bool fail = 0;
for(c1 = 0; c1 < n; c1++){
cin >> a;
a--;
A.push_back(a);
ind.push_back(c1);
if(ANS[a] != 0)fail = 1;
ANS[a] = c1+1;
}
for(c1 = 1; c1 < n; c1++){
for(c2 = 0; c2 < n-c1; c2++){
Q2.push(c1);
}
}
queue<ll> Q;
for(c1 = n*n; c1 >= 0; c1--){
if(ANS[c1] != 0){
for(c2 = 0; c2 < ANS[c1] - 1; c2++){
Q.push(ANS[c1]);
}
}
else{
if(Q.empty()){
ANS[c1] = Q2.front();
Q2.pop();
}
else{
ANS[c1] = Q.front();
Q.pop();
}
}
}
if(!Q.empty()){
fail = 1;
}
if(fail == 1){
cout << "No\n";
}
else{
cout << "Yes\n";
for(c1 = 0; c1 < n*n; c1++){
cout << ANS[c1] << " ";
}
}
return 0;
}
| a.cc:42:7: error: class template argument deduction failed:
42 | queue Q2;
| ^~
a.cc:42:7: error: no matching function for call to 'queue()'
In file included from /usr/include/c++/14/queue:66,
from a.cc:9:
/usr/include/c++/14/bits/stl_queue.h:195:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(std::queue<_Tp, _Seq>&&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
195 | queue(queue&& __q, const _Alloc& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:195:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const std::queue<_Tp, _Seq>&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
191 | queue(const queue& __q, const _Alloc& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(_Sequence&&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
187 | queue(_Sequence&& __c, const _Alloc& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const _Sequence&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
183 | queue(const _Sequence& __c, const _Alloc& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const _Alloc&)-> std::queue<_Tp, _Sequence>'
179 | queue(const _Alloc& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate: 'template<class _Tp, class _Sequence> queue(_Sequence&&)-> std::queue<_Tp, _Sequence>'
174 | queue(_Sequence&& __c)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate: 'template<class _Tp, class _Sequence> queue(const _Sequence&)-> std::queue<_Tp, _Sequence>'
170 | queue(const _Sequence& __c)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:166:9: note: candidate: 'template<class _Tp, class _Sequence, class _Seq, class _Requires> queue()-> std::queue<_Tp, _Sequence>'
166 | queue()
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note: template argument deduction/substitution failed:
a.cc:42:7: note: couldn't deduce template parameter '_Tp'
42 | queue Q2;
| ^~
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'template<class _Tp, class _Sequence> queue(std::queue<_Tp, _Sequence>)-> std::queue<_Tp, _Sequence>'
96 | class queue
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:344:5: note: candidate: 'template<class _Container, class _Allocator, class> std::queue(_Container, _Allocator)-> queue<typename _Container::value_type, _Container>'
344 | queue(_Container, _Allocator)
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:344:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:340:5: note: candidate: 'template<class _Container, class> std::queue(_Container)-> queue<typename _Container::value_type, _Container>'
340 | queue(_Container) -> queue<typename _Container::value_type, _Container>;
| ^~~~~
/usr/include/c++/14/bits/stl_queue.h:340:5: note: candidate expects 1 argument, 0 provided
|
s677483472 | p03842 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
constexpr ll mod = 1000000007;
vector<ll> fac, inv, facinv;
void modcalc(int modsize) {
fac.resize(modsize); inv.resize(modsize); facinv.resize(modsize);
fac[0] = 1; fac[1] = 1; inv[1] = 1;
facinv[0] = 1; facinv[1] = 1;
for (ll i = 2; i < modsize; i++) {
fac[i] = fac[i - 1] * i % mod;
inv[i] = mod - inv[mod % i] * (mod / i) % mod;
facinv[i] = facinv[i - 1] * inv[i] % mod;
}
}
ll modinv(ll a) {
a %= mod;
if (a == 0) abort();
if (a < (ll)inv.size()) return inv[a];
ll b = mod, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
u %= mod;
if (u < 0) u += mod;
return u;
}
ll modpow(ll a, ll b) {
ll ans = 1;
a %= mod;
while (b) {
if (b & 1) ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
return ans;
}
ll modcomb(ll n, ll k) {
if (n < 0 || k < 0 || n < k) return 0;
return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}
ll modperm(ll n, ll k) {
if (n < 0 || k < 0 || n < k) return 0;
return fac[n] * facinv[n - k] % mod;
}
ll modhom(ll n, ll k) {
if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
if (n == 0 && k == 0) return 1;
return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}
vector<vector<int>> graph(100010, vector<int>());
vector<int> sz(100010), vis(100010), ver(100010), cnt(100010);
void dfs1(int n, int v) {
if (vis[n]) return;
vis[n] = true;
ver[n] = v;
for (int i : graph[n]) {
if (vis[i]) continue;
dfs1(i, v);
}
}
void dfs2(int n, int p, int r, set<int> &s) {
if (n != r) cnt[r]++;
int c = 0; int v;
for (int i : graph[n]) {
if (i == p || s.count(i)) continue;
else {
c++;
v = i;
}
}
if (c > 1) cnt[r] = inf;
if (c == 1) dfs2(v, n, r, s);
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
modcalc(200010);
int n;
cin >> n;
vector<int> p(n);
rep(i, n) {
cin >> p[i];
p[i]--;
graph[i].pb(p[i]);
graph[p[i]].pb(i);
}
rep(i, n) if (!vis[i]) dfs1(i, i);
vector<int> root = ver;
root.resize(n);
sort(all(root)); root.erase(unique(all(root)), root.end());
vector<int> si(n);
rep(i, n) si[ver[i]]++;
vector<int> cycle(n + 1);
ll ans = 1;
rep(i, root.size()) {
int v = root[i];
int now = v;
bool flag = true;
rep(j, si[v]) {
if (j && now == v) flag = false;
now = p[now];
}
if (flag && now == v) cycle[si[v]]++;
else {
set<int> st;
now = v;
int start;
while (true) {
if (st.count(now)) {
start = now;
break;
}
st.insert(now);
now = p[now];
}
vector<int> cyc; cyc.pb(start);
while (p[now] != start) {
cyc.pb(p[now]);
now = p[now];
}
int cycsz = cyc.size();
set<int> cycst;
rep(j, cycsz) cycst.insert(cyc[j]);
vector<int> check;
for (int ve : cyc) {
dfs2(ve, -1, ve, cycst);
if (cnt[ve] >= inf) ans = 0;
check.pb(cnt[ve]);
}
reverse(all(check));
vector<int> nonzero(2 * cycsz + 1);
rep(j, 2 * cycsz) {
nonzero[j + 1] = nonzero[j];
if (check[j % cycsz]) nonzero[j + 1]++;
}
ll pat = 1;
rep(j, cycsz) {
if (!check[j]) continue;
if (check[j] > cycsz) ans = 0;
else {
int x = check[j] - 1;
int pa = 0;
if (nonzero[j + 1] == nonzero[j + x + 1]) pa++;
if (nonzero[j + 1] == nonzero[j + x + 2]) pa++;
if (pa == 0) ans = 0;
else if (pa == 2) {
pat *= 2;
if (pat >= mod) pat -= mod;
}
}
}
ans *= pat; ans %= mod;
}
}
rep(i, n + 1) {
int m = cycle[i];
ll sum = 0;
for (int j = 0; j <= m / 2; j++) sum += fac[m] * facinv[m - 2 * j] % mod * modinv(modpow(2, j)) % mod * modpow(i, j) % mod * modpow((i + 1) / 2, m - 2 * j) % mod;
sum %= mod;
ans *= sum; ans %= mod;
}
assert(0 <= ans && ans < mod);
cout << ans << '\n';
} | cc1plus: error: '::main' must return 'int'
|
s640668585 | p03842 | C++ | #pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vecll>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),(x)))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),(x)))
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
string stin() {string s;cin>>s;return s;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
vec iota(int n){vec a(n);iota(all(a),0);return a;}
void print(){putchar(' ');}
void print(bool a){cout<<a;}
void print(int a){cout<<a;}
void print(long long a){cout<<a;}
void print(char a){cout<<a;}
void print(string &a){cout<<a;}
void print(double a){cout<<a;}
template<class T> void print(const vector<T>&);
template<class T, size_t size> void print(const array<T, size>&);
template<class T, class L> void print(const pair<T, L>& p);
template<class T, size_t size> void print(const T (&)[size]);
template<class T> void print(const vector<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ cout<<" "; print(*i); } cout<<endl;}
template<class T> void print(const deque<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ cout<<" "; print(*i); } }
template<class T, size_t size> void print(const array<T, size>& a){ print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ cout<<" "; print(*i); } }
template<class T, class L> void print(const pair<T, L>& p){ cout<<'(';print(p.first); cout<<","; print(p.second);cout<<')'; }
template<class T, size_t size> void print(const T (&a)[size]){ print(a[0]); for(auto i = a; ++i != end(a); ){ cout<<" "; print(*i); } }
template<class T> void print(const T& a){ cout << a; }
int out(){ putchar('\n'); return 0; }
template<class T> int out(const T& t){ print(t); putchar('\n'); return 0; }
template<class Head, class... Tail> int out(const Head& head, const Tail&... tail){ print(head); putchar(' '); out(tail...); return 0; }
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
vector<pll> factor(ll x){ vector<pll> ans; for(ll i = 2; i * i <= x; i++) if(x % i == 0){ ans.push_back({i, 1}); while((x /= i) % i == 0) ans.back().second++; } if(x != 1) ans.push_back({x, 1}); return ans; }
vector<int> divisor(int x){ vector<int> ans; for(int i=1;i*i<=x;i++)if(x%i==0){ans.pb(i);if(i*i!=x)ans.pb(x/i);} return ans;}
int popcount(ll x){return __builtin_popcountll(x);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n){return uniform_int_distribution<int>(0, n)(rng);}
#define _GLIBCXX_DEBU
#define endl '\n'
#ifdef _MY_DEBUG
#undef endl
#define debug(x) cout<<#x<<": "<<x<<endl
void err(){}
template<class T> void err(const T& t){ print(t); cout<<" ";}
template<class Head, class... Tail> void err(const Head& head, const Tail&... tail){ print(head); putchar(' '); out(tail...); }
#else
#define debug(x)
template<class... T> void err(const T&...){}
#endif
#pragma endregion
template< typename T >
struct edge {
int src, to;
T cost;
edge(int _to, T _cost) : src(-1), to(_to), cost(_cost) {}
edge(int _src, int _to, T _cost) : src(_src), to(_to), cost(_cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;
template< typename G >
struct StronglyConnectedComponents {
const G &g;
UnWeightedGraph gg, rg;
vector< int > comp, order, used;
StronglyConnectedComponents(G &_g) : g(_g), gg(_g.size()), rg(_g.size()), comp(_g.size(), -1), used(_g.size()) {
for(int i = 0; i < _g.size(); i++) {
for(auto e : _g[i]) {
gg[i].emplace_back((int) e);
rg[(int) e].emplace_back(i);
}
}
}
int operator[](int k) {
return comp[k];
}
void dfs(int idx) {
if(used[idx]) return;
used[idx] = true;
for(int to : gg[idx]) dfs(to);
order.push_back(idx);
}
void rdfs(int idx, int cnt) {
if(comp[idx] != -1) return;
comp[idx] = cnt;
for(int to : rg[idx]) rdfs(to, cnt);
}
void build(UnWeightedGraph &t) {
for(int i = 0; i < gg.size(); i++) dfs(i);
reverse(begin(order), end(order));
int ptr = 0;
for(int i : order) if(comp[i] == -1) rdfs(i, ptr), ptr++;
t.resize(ptr);
for(int i = 0; i < g.size(); i++) {
for(auto &to : g[i]) {
int x = comp[i], y = comp[to];
if(x == y) continue;
t[x].push_back(y);
}
}
}
};
const ll MOD=1e9+7;
const int N=1100000;
template <ll Modulus> class modint {
using u64 = ll;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(((x % Modulus) + Modulus)%Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
#define mint modint<MOD>
mint inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
inv[1]=1;
rep2(i,2,N-1){
inv[i]=inv[MOD%i]*(-MOD/i);
}
return;
}
void calc_product(){
prd[0]=prd[1]=1;
invprd[0]=invprd[1]=1;
rep2(i,2,N-1){
prd[i]=prd[i-1]*i;
invprd[i]=inv[i]*invprd[i-1];
}
return ;
}
mint cmb(int a,int b){
if(a<b)return 0;
if(a<0||b<0)return 0;
return {prd[a]*invprd[b]*invprd[a-b]};
}
mint modpow(mint x,ll n){
if(n==0) return 1;
mint res=modpow(x*x,n/2);
if(n&1) res=res*x;
return res;
}
void calc(){calc_inv();calc_product();}
using vmint = vector<mint> ;
ostream& operator<<(ostream& os, mint a){
os << a.a ;
return os;
}
mint solve1(int x,int a){
mint ans,T=1;
rep(i,x/2+1){
ans+=T*modpow(a,i)*invprd[i]*modpow((a>1 and (a&1) ?2:1),x-2*i);
T*=cmb(x-i*2,2);
}
return ans;
}
mint solve2(int x){
vmint dp(x+1);
return accumulate(all(dp),(mint)0);
}
signed main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);cout<<fixed<<setprecision(15);
int n=in();
calc();
vec a;
rep(i,n)a.pb(in()-1);
vector<vec> g(n),h(n);
rep(i,n){
g[i].pb(a[i]);
h[a[i]].pb(i);
}
rep(i,n){
if(h[i].size()>2){
cout<<0<<endl;
return 0;
}
}
StronglyConnectedComponents<UnWeightedGraph> scc(g);
vector<vec> G;
scc.build(G);
vec cnt(n);
rep(i,n)cnt[scc[i]]++;
vec visited(n);
int cnt1=0,cnt2=0;
vec c(n+1);
mint ans=1;
rep(i,n){
if(visited[scc[i]])continue;
if(!(cnt[scc[i]]>1 or g[i][0] == i)) continue;
visited[scc[i]]=1;
vec v;
int now=i;
do{
if(h[now].size()==1){
v.pb(0);
now = g[now][0];
if(now==i)break;
continue;
}
if(scc[now] == scc[h[now][0]]) swap(h[now][0],h[now][1]);
int tail = 1;
int nxt = h[now][0];
while(h[nxt].size()){
if(h[nxt].size()==2){
cout << 0 << endl;
return 0;
}
nxt = h[nxt].front();
tail++;
}
if(tail>2){
assert(0);
cout << 0 << endl;
return 0;
}
v.pb(tail);
now = g[now][0];
}while(now != i);
// if(v==vec(1,0)) { cnt1++; continue;}
// if(v==vec(2,0)) { cnt2++; continue;}
if(v==vec(1,1)) { continue;}
if(v==vec(1,2)) {cout << 0<<endl;return 0;}
if(v==vec(v.size(),0)){
c[v.size()]++;
continue;
}
reverse(v.begin()+1,v.end());
rep(i,v.size()){
if(!v[i])continue;
rep2(j,i,i+v[i]-1)if(v[j%v.size()]){cout<<0;return 0;}
if(!v[(i+j)%v.size()])ans*=2;
}
}
//cout << ans*solve1(cnt1,1)*solve1(cnt2,2)<<endl;
rep2(i,1,n)ans*=solve1(c[i],i);
cout<<ans;
}
| a.cc: In function 'int main()':
a.cc:323:20: error: 'j' was not declared in this scope
323 | if(!v[(i+j)%v.size()])ans*=2;
| ^
|
s746584521 | p03842 | C++ | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define MXN 200005
int d[100005];
int degree[100005];
int Size[100005];
int f[100005];
int mod=1e9+7;
int Find(int x){
if(f[x]==x)return x;
return f[x]=Find(f[x]);
}
int cnt[100005];
LL f_pow(LL a,LL b){
LL res=1,temp=a;
while(b){
if(b&1)res=res*temp%mod;
temp=temp*temp%mod;
b>>=1;
}
return res;
}
LL fra[100005];
LL inv[100005];
void build(){
fra[0]=1;
for(int i = 1;i<100005;i++)
fra[i]=fra[i-1]*i%mod;
inv[100000]=f_pow(fra[100000],mod-2);
for(int i =99999;i>=0;i--)
inv[i]=inv[i+1]*(i+1)%mod;
}
LL C(int a,int b){
return fra[a]*inv[a-b]%mod;
}
vector<int> v[100005];
vector<int> stk;
int circle[100005];
int a[100005];
int vis[100005];
int val[100005];
vector<vector<int> > cir;
void dfs(int x){
// printf("%d ",x);
vis[x]=1;
stk.pb(x);
if(!vis[a[x]])dfs(a[x]);
else{
vector<int> tmp;
while(stk.back()!=a[x]){
circle[stk.back()]=1;
tmp.pb(stk.back());
stk.pop_back();
}
circle[stk.back()]=1;
tmp.pb(stk.back());
stk.pop_back();
stk.clear();
reverse(tmp.begin(),tmp.end());
cir.pb(tmp);
}
}
void dfs2(int x,int sum){
if(circle[x]){
val[x]=sum;
return ;
}
dfs2(a[x],sum+1);
}
int main(){
int n;
scanf("%d",&n);
build();
for(int i = 1;i<=n;i++){
scanf("%d",&a[i]);
degree[a[i]]++;
d[a[i]]++;
Size[i]=1;
f[i]=i;
}
for(int i = 1;i<=n;i++){
int x=Find(i),y=Find(a[i]);
if(x!=y){
f[x]=y;
Size[y]+=Size[x];
degree[y]=max(degree[x],degree[y]);
}
}
LL ans=1;
for(int i = 1;i<=n;i++){
if(f[i]==i&°ree[i]==1){
cnt[Size[i]]++;
// printf("%d\n",Size[i]);
}
if(degree[i]>2)ans=0;
//printf("%d %d %d\n",i,f[i],degree[i]);
if(f[i]==i&°ree[i]>=2){
// printf("%d\n",i);
dfs(i);
}
}
for(int i = 1;i<=n;i++){
if(d[i]==2&&!circle[i]){
printf("0\n");
return 0;
}
}
for(int i = 1;i<=n;i++){
if(d[i]==0)dfs2(i,0);
}
for(auto it:cir){
int st=0;
int cnt=0;
for(int j=0;j<it.size();j++){
// printf("%d ",it[j]);
if(st==0)
it.pb(it[j]);
if(st){
if(val[it[j]]){
if(cnt>=val[it[j]])ans=ans*2%mod;
else if(cnt==val[it[j]]-1);
else ans=0;
cnt=0;
}
else{
cnt++;
}
}
if(val[it[j]]){
st=1;
}
}
}
for(int i = 1 ;i<=n;i++){
LL sum=0;
for(int j=0;j<=cnt[i];j+=2){
if(i!=1&&i%2==1)
sum+=C(cnt[i],j)*f_pow(f_pow(2,j/2),mod-2)%mod*f_pow(i,j/2)%mod*f_pow(2,cnt[i]-j)%mod*inv[j/2]%mod;
else
sum+=C(cnt[i],j)*f_pow(f_pow(2,j/2),mod-2)%mod*f_pow(i,j/2)%mod*inv[j/2]%mod;
sum%=mod;
// printf("%d %d %d %d %d\n",sum,C(cnt[i],j),cnt[i],j,i);
}
ans=ans*sum%mod;
}
printf("%lld\n",ans); | a.cc: In function 'int main()':
a.cc:166:26: error: expected '}' at end of input
166 | printf("%lld\n",ans);
| ^
a.cc:89:11: note: to match this '{'
89 | int main(){
| ^
|
s476480463 | p03842 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = std::int_fast64_t;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 1000000007;
constexpr long double eps = 1e-15;
template<typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> p) {
os << to_string(p.first) << " " << to_string(p.second);
return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
REP(i, v.size()) {
if(i) os << " ";
os << to_string(v[i]);
}
return os;
}
struct modint {
ll n;
public:
modint(const ll n = 0) : n((n % mod + mod) % mod) {}
static modint pow(modint a, int m) {
modint r = 1;
while(m > 0) {
if(m & 1) { r *= a; }
a = (a * a); m /= 2;
}
return r;
}
modint &operator++() { *this += 1; return *this; }
modint &operator--() { *this -= 1; return *this; }
modint operator++(int) { modint ret = *this; *this += 1; return ret; }
modint operator--(int) { modint ret = *this; *this -= 1; return ret; }
modint operator~() const { return (this -> pow(n, mod - 2)); } // inverse
friend bool operator==(const modint& lhs, const modint& rhs) {
return lhs.n == rhs.n;
}
friend bool operator<(const modint& lhs, const modint& rhs) {
return lhs.n < rhs.n;
}
friend bool operator>(const modint& lhs, const modint& rhs) {
return lhs.n > rhs.n;
}
friend modint &operator+=(modint& lhs, const modint& rhs) {
lhs.n += rhs.n;
if (lhs.n >= mod) lhs.n -= mod;
return lhs;
}
friend modint &operator-=(modint& lhs, const modint& rhs) {
lhs.n -= rhs.n;
if (lhs.n < 0) lhs.n += mod;
return lhs;
}
friend modint &operator*=(modint& lhs, const modint& rhs) {
lhs.n = (lhs.n * rhs.n) % mod;
return lhs;
}
friend modint &operator/=(modint& lhs, const modint& rhs) {
lhs.n = (lhs.n * (~rhs).n) % mod;
return lhs;
}
friend modint operator+(const modint& lhs, const modint& rhs) {
return modint(lhs.n + rhs.n);
}
friend modint operator-(const modint& lhs, const modint& rhs) {
return modint(lhs.n - rhs.n);
}
friend modint operator*(const modint& lhs, const modint& rhs) {
return modint(lhs.n * rhs.n);
}
friend modint operator/(const modint& lhs, const modint& rhs) {
return modint(lhs.n * (~rhs).n);
}
};
istream& operator>>(istream& is, modint m) { is >> m.n; return is; }
ostream& operator<<(ostream& os, modint m) { os << m.n; return os; }
#define MAX_N 4040404
long long extgcd(long long a, long long b, long long& x, long long& y) {
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 mod_inverse(long long a, long long m) {
long long x, y;
if(extgcd(a, m, x, y) == 1) return (m + x % m) % m;
else return -1;
}
vector<long long> fact(MAX_N+1, inf);
long long mod_fact(long long n, long long& e) {
if(fact[0] == inf) {
fact[0]=1;
if(MAX_N != 0) fact[1]=1;
for(ll i = 2; i <= MAX_N; ++i) {
fact[i] = (fact[i-1] * i) % mod;
}
}
e = 0;
if(n == 0) return 1;
long long res = mod_fact(n / mod, e);
e += n / mod;
if((n / mod) % 2 != 0) return (res * (mod - fact[n % mod])) % mod;
return (res * fact[n % mod]) % mod;
}
// return nCk
long long mod_comb(long long n, long long k) {
if(n < 0 || k < 0 || n < k) return 0;
long long e1, e2, e3;
long long a1 = mod_fact(n, e1), a2 = mod_fact(k, e2), a3 = mod_fact(n - k, e3);
if(e1 > e2 + e3) return 0;
return (a1 * mod_inverse((a2 * a3) % mod, mod)) % mod;
}
using mi = modint;
mi mod_pow(mi a, ll n) {
mi ret = 1;
mi tmp = a;
while(n > 0) {
if(n % 2) ret *= tmp;
tmp = tmp * tmp;
n /= 2;
}
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
REP(i, n) cin >> a[i];
REP(i, n) a[i]--;
vector<int> w(n, 1);
vector<int> d(n, 0);
vector<int> tmp(n, 0);
REP(i, n) {
d[a[i]]++;
tmp[a[i]]++;
}
queue<int> q;
REP(i, n) if(tmp[i] == 0) q.push(i);
while(!q.empty()) {
int p = q.front();
q.pop();
if(d[p] > 1) {
cout << 0 << endl;
return 0;
}
tmp[a[p]]--;
w[a[p]] += w[p];
if(tmp[a[p]] == 0) q.push(a[p]);
}
mi ans = 1;
vector<int> c(n + 1, 0);
REP(i, n) {
if(tmp[i]) {
deque<int> deq;
int p = i, sum = 0;
while(tmp[p]) {
tmp[p] = 0;
deq.push_back(w[p] - 1);
sum += w[p] - 1;
p = a[p];
}
reverse(ALL(deq));
int m = (int)deq.size();
if(sum > m) {
cout << 0 << endl;
return 0;
}
if(sum == 0) {
c[m]++;
continue;
}
if(m == 1) continue;
while(deq.front() == 0) {
deq.push_back(deq.front());
deq.pop_front();
}
if(sum == deq.front()) {
if(sum == m) ans *= 1;
else ans *= 2;
continue;
}
mi co = 1;
int r = -1;
for(int j = m - 1; j >= 0; j--) {
if(deq[j] == 0) continue;
if(r == -1) {
if(m - j > deq[j]) co *= 2;
} else {
if(r - j > deq[j]) co *= 2;
}
r = j;
}
ans *= co;
}
}
vector<mi> fact(n + 1, 1);
FOR(i, 1, n + 1) fact[i] = fact[i - 1] * i;
if(c[1]) assert(false);
FOR(i, 1, n + 1) {
if(c[i] == 0) continue;
mi co = 0;
for(int j = 0; j <= c[i] / 2; j++) {
mi tmp2 = mod_comb(c[i], 2 * j) * fact[2 * j];
tmp2 *= mod_pow(fact[j] * mod_pow(2, j), mod - 2);
tmp2 *= mod_pow(i, j);
if(i % 2 && i != 1) tmp2 *= mod_pow(2, c[i] - 2 * j);
co += tmp2;
}
ans *= co;
}
cout << ans << endl;
return 0;
}
| a.cc:13:17: error: 'int_fast64_t' in namespace 'std' does not name a type
13 | using ll = std::int_fast64_t;
| ^~~~~~~~~~~~
a.cc:14:16: error: 'll' was not declared in this scope
14 | using P = pair<ll, ll>;
| ^~
a.cc:14:20: error: 'll' was not declared in this scope
14 | using P = pair<ll, ll>;
| ^~
a.cc:14:22: error: template argument 1 is invalid
14 | using P = pair<ll, ll>;
| ^
a.cc:14:22: error: template argument 2 is invalid
a.cc:15:11: error: 'll' does not name a type
15 | constexpr ll inf = 1000000000;
| ^~
a.cc:16:11: error: 'll' does not name a type
16 | constexpr ll mod = 1000000007;
| ^~
a.cc: In function 'std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)':
a.cc:8:26: error: 'll' was not declared in this scope
8 | #define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
| ^~
a.cc:9:19: note: in expansion of macro 'FOR'
9 | #define REP(i, n) FOR(i, 0, n)
| ^~~
a.cc:26:5: note: in expansion of macro 'REP'
26 | REP(i, v.size()) {
| ^~~
a.cc:26:9: error: 'i' was not declared in this scope
26 | REP(i, v.size()) {
| ^
a.cc:8:36: note: in definition of macro 'FOR'
8 | #define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
| ^
a.cc:26:5: note: in expansion of macro 'REP'
26 | REP(i, v.size()) {
| ^~~
a.cc: At global scope:
a.cc:34:5: error: 'll' does not name a type
34 | ll n;
| ^~
a.cc:36:18: error: 'll' does not name a type
36 | modint(const ll n = 0) : n((n % mod + mod) % mod) {}
| ^~
a.cc: In constructor 'modint::modint(int)':
a.cc:36:30: error: class 'modint' does not have any field named 'n'
36 | modint(const ll n = 0) : n((n % mod + mod) % mod) {}
| ^
a.cc:36:37: error: 'mod' was not declared in this scope
36 | modint(const ll n = 0) : n((n % mod + mod) % mod) {}
| ^~~
a.cc: In member function 'modint modint::operator~() const':
a.cc:49:52: error: 'n' was not declared in this scope
49 | modint operator~() const { return (this -> pow(n, mod - 2)); } // inverse
| ^
a.cc:49:55: error: 'mod' was not declared in this scope
49 | modint operator~() const { return (this -> pow(n, mod - 2)); } // inverse
| ^~~
a.cc: In function 'bool operator==(const modint&, const modint&)':
a.cc:51:20: error: 'const struct modint' has no member named 'n'
51 | return lhs.n == rhs.n;
| ^
a.cc:51:29: error: 'const struct modint' has no member named 'n'
51 | return lhs.n == rhs.n;
| ^
a.cc: In function 'bool operator<(const modint&, const modint&)':
a.cc:54:20: error: 'const struct modint' has no member named 'n'
54 | return lhs.n < rhs.n;
| ^
a.cc:54:28: error: 'const struct modint' has no member named 'n'
54 | return lhs.n < rhs.n;
| ^
a.cc: In function 'bool operator>(const modint&, const modint&)':
a.cc:57:20: error: 'const struct modint' has no member named 'n'
57 | return lhs.n > rhs.n;
| ^
a.cc:57:28: error: 'const struct modint' has no member named 'n'
57 | return lhs.n > rhs.n;
| ^
a.cc: In function 'modint& operator+=(modint&, const modint&)':
a.cc:60:13: error: 'struct modint' has no member named 'n'
60 | lhs.n += rhs.n;
| ^
a.cc:60:22: error: 'const struct modint' has no member named 'n'
60 | lhs.n += rhs.n;
| ^
a.cc:61:17: error: 'struct modint' has no member named 'n'
61 | if (lhs.n >= mod) lhs.n -= mod;
| ^
a.cc:61:22: error: 'mod' was not declared in this scope
61 | if (lhs.n >= mod) lhs.n -= mod;
| ^~~
a.cc:61:31: error: 'struct modint' has no member named 'n'
61 | if (lhs.n >= mod) lhs.n -= mod;
| ^
a.cc: In function 'modint& operator-=(modint&, const modint&)':
a.cc:65:13: error: 'struct modint' has no member named 'n'
65 | lhs.n -= rhs.n;
| ^
a.cc:65:22: error: 'const struct modint' has no member named 'n'
65 | lhs.n -= rhs.n;
| ^
a.cc:66:17: error: 'struct modint' has no member named 'n'
66 | if (lhs.n < 0) lhs.n += mod;
| ^
a.cc:66:28: error: 'struct modint' has no member named 'n'
66 | if (lhs.n < 0) lhs.n += mod;
| ^
a.cc:66:33: error: 'mod' was not declared in this scope
66 | if (lhs.n < 0) lhs.n += mod;
| ^~~
a.cc: In function 'modint& operator*=(modint&, const modint&)':
a.cc:70:13: error: 'struct modint' has no member named 'n'
70 | lhs.n = (lhs.n * rhs.n) % mod;
| ^
a.cc:70:22: error: 'struct modint' has no member named 'n'
70 | lhs.n = (lhs.n * rhs.n) % mod;
| ^
a.cc:70:30: error: 'const struct modint' has no member named 'n'
70 | lhs.n = (lhs.n * rhs.n) % mod;
| ^
a.cc:70:35: error: 'mod' was not declared in this scope
70 | lhs.n = (lhs.n * rhs.n) % mod;
| ^~~
a.cc: In function 'modint& operator/=(modint&, const modint&)':
a.cc:74:13: error: 'struct modint' has no member named 'n'
74 | lhs.n = (lhs.n * (~rhs).n) % mod;
| ^
a.cc:74:22: error: 'struct modint' has no member named 'n'
74 | lhs.n = (lhs.n * (~rhs).n) % mod;
| ^
a.cc:74:33: error: 'struct modint' has no member named 'n'
74 | lhs.n = (lhs.n * (~rhs).n) % mod;
| ^
a.cc:74:38: error: 'mod' was not declared in this scope
74 | lhs.n = (lhs.n * (~rhs).n) % mod;
| ^~~
a.cc: In function 'modint operator+(const modint&, const modint&)':
a.cc:78:27: error: 'const struct modint' has no member named 'n'
78 | return modint(lhs.n + rhs.n);
| ^
a.cc:78:35: error: 'const struct modint' has no member named 'n'
78 | return modint(lhs.n + rhs.n);
| ^
a.cc: In function 'modint operator-(const modint&, const modint&)':
a.cc:81:27: error: 'const struct modint' has no member named 'n'
81 | return modint(lhs.n - rhs.n);
| ^
a.cc:81:35: error: 'const struct modint' has no member named 'n'
81 | return modint(lhs.n - rhs.n);
| ^
a.cc: In function 'modint operator*(const modint&, const modint&)':
a.cc:84:27: error: 'const struct modint' has no member named 'n'
84 | return modint(lhs.n * rhs.n);
| ^
a.cc:84:35: error: 'const struct modint' has no member named 'n'
84 | return modint(lhs.n * rhs.n);
| ^
a.cc: In function 'modint operator/(const modint&, const modint&)':
a.cc:87:27: error: 'const struct modint' has no member named 'n'
87 | return modint(lhs.n * (~rhs).n);
| ^
a.cc:87:38: error: 'struct modint' has no member named 'n'
87 | return modint(lhs.n * (~rhs).n);
| ^
a.cc: In function 'std::istream& operator>>(std::istream&, modint)':
a.cc:90:54: error: 'struct modint' has no member named 'n'
90 | istream& operator>>(istream& is, modint m) { is >> m.n; return is; }
| ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, modint)':
a.cc:91:54: error: 'struct modint' has no member named 'n'
91 | ostream& operator<<(ostream& os, modint m) { os << m.n; return os; }
| ^
a.cc: At global scope:
a.cc:109:33: error: 'inf' was not declared in this scope; did you mean 'int'?
109 | vector<long long> fact(MAX_N+1, inf);
| ^~~
| int
a.cc: In function 'long long int mod_fact(long long int, long long int&)':
a.cc:111:19: error: 'inf' was not declared in this scope; did you mean 'int'?
111 | if(fact[0] == inf) {
| ^~~
| int
a.cc:114:13: error: 'll' was not declared in this scope
114 | for(ll i = 2; i <= MAX_N; ++i) {
| ^~
a.cc:114:23: error: 'i' was not declared in this scope
114 | for(ll i = 2; i <= MAX_N; ++i) {
| ^
a.cc:115:41: error: 'mod' was not declared in this scope
115 | fact[i] = (fact[i-1] * i) % mod;
| ^~~
a.cc:120:34: error: 'mod' was not declared in this scope
120 | long long res = mod_fact(n / mod, e);
| ^~~
a.cc: In function 'long long int mod_comb(long long int, long long int)':
a.cc:131:42: error: 'mod' was not declared in this scope
131 | return (a1 * mod_inverse((a2 * a3) % mod, mod)) % mod;
| ^~~
a.cc: At global scope:
a.cc:136:18: error: 'll' has not been declared
136 | mi mod_pow(mi a, ll n) {
| ^~
a.cc: In function 'int main()':
a.cc:8:26: error: 'll' was not declared in this scope
8 | #define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
| ^~
a.cc:9:19: note: in expansion of macro 'FOR'
9 | #define REP(i, n) FOR(i, 0, n)
| ^~~
a.cc:153:5: note: in expansion of macro 'REP'
153 | REP(i, n) cin >> a[i];
| ^~~
a.cc:153:9: error: 'i' was not |
s954192426 | p03842 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_program(s) cout << s <<endl;return 0
int kai_size = 120001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
vel v(3, 2);
return v.at(4);
}
int ru(int a, int r) {
if (r == 0) { return 1; }
int ans = ru(a, r / 2);
ans *= ans; ans %= p;
if (r % 2 == 1) { ans *= a; }
return ans % p;
}
int inv(int a) {
return ru(a, p - 2);
}
void make_kai() {
rep(i, kai_size-1) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
void make_true(vel &a, veb &smt) {
for (int x : a) { smt[x] = true; }
}
void make_false(vel &a, veb &smt) {
for (int x : a) { smt[x] = false; }
}
int com(int n, int r) {
int ans = kai[n] * ink[r];
ans %= p; ans *= ink[n - r]; ans %= p;
return ans;
}
int per(int n, int r) {
int ans = kai[n] * ink[n - r];
ans %= p;
return ans;
}
vel dis(int mid1, vvel &way) {
int n = way.size();
vel dist(n, -1); dist[mid1] = 0;
queue<int> q;
q.push(mid1);
while (!q.empty()) {
int st = q.front(); q.pop();
rep(i, way[st].size()) {
int to = way[st][i];
if (dist[to] == -1) {
dist[to] = dist[st] + 1;
q.push(to);
}
}
}
return dist;
}
vel conected(int st, vvel &way,veb ¬_seen) {
int n = way.size();
not_seen[st] = false;
vel ans(0);
queue<int> q;
q.push(st);
while (!q.empty()) {
int st1 = q.front(); q.pop();
ans.push_back(st1);
rep(i, way[st1].size()) {
int to = way[st1][i];
if (not_seen[to]) {
not_seen[to] = false;
q.push(to);
}
}
}
make_true(ans, not_seen);
return ans;
}
pin most_far(int now, int n, vvel &way) {
vel dist1 = dis(now, way);
pin ans = mkp(-1, 0);
rep(i, n) {
if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
}
return ans;
}
vel find_cycle(int st,vel &a,veb &smt) {
vel root(0);
while (smt[st]) {
root.push_back(st);
smt[st] = false;
st = a[st];
}
vel ans(0);
bool fl = false;
for (int x : root) {
if (x == st) { fl = true; }
if (fl) { ans.push_back(x); }
}
make_true(root, smt);
return ans;
}
int div(int i) {
if (i % 2 == 0) { return i/2; }
else { return (i + p) / 2; }
}
vel pus(vel v) {
vel w = v;
int n = v.size();
rep(i, n) {
w[(i + 1) % n] = v[i];
}
return w;
}
signed main() {
int n; cin >> n;
vel a(n);
vvel inv_a(n);
vvel way(n);
rep(i, n) {
cin >> a[i]; a[i]--; way[i].push_back(a[i]);
inv_a[a[i]].push_back(i);
way[a[i]].push_back(i);
}
veb seen(n, false);
veb smt(n, true);
vel cnt_cy(n+1, 0);
int ans = 1;
rep(i, n) {
if (!seen[i]) {
vel cone = conected(i, way,smt);
vel cy=find_cycle(i, a,smt);
int count_3;
make_false(cy, smt);
for (auto x : cone) {
seen[x] = true;
if (smt[x]) {
if (inv_a[x].size() > 1) { end_program(0); }
}
else {
if (inv_a[x].size() > 2) { end_program(0); }
}
}
if (cone.size() == cy.size()) {cnt_cy[cone.size()]++;}
else {
int mi = i;
while (inv_a[mi].size()!=2) { mi = a[mi]; }
vel count0;
vel count1;
int bk = -1;
for (auto x : inv_a[mi]) { if (smt[x]) { bk = x; } }
int counter = 1;
while (inv_a.at(bk).size() == 1) { counter++; bk = inv_a[bk][0]; }
count0.push_back(counter);
counter = 0;
int now = a[mi];
while (now!=mi) {
if (way[now].size() == 3) {
count1.push_back(counter);
counter = 1;
for (auto x : inv_a[now]) { if (smt[x]) { bk = x; } }
while (inv_a[bk].size() == 1) { counter++; bk = inv_a[bk][0]; }
count0.push_back(counter);
counter = 0;
}
else {
counter++;
}
now = a[now];
}
push(count0);
count1.push_back(counter);
rep(j, count0.size()) {
int mul = count1[j] + 2 - count0[j];
if (mul <= 0) { end_program(0); }
int two = 2;
ans *= min(mul,two); ans %= p;
}
}
make_true(cy, smt);
}
}
make_kai();
for (int i = 1; i <= n; i++) {
int mul = 0;
int cys = cnt_cy[i];
if (cys != 0) {
for (int j = 0; j * 2 <= cys; j++) {
int pl = per(cys, 2 * j);
pl *= ink[j]; pl %= p;
pl *= ru(div(i), j); pl %= p;
if (i % 2 == 1 and i != 1) {
pl *= ru(2, cys - 2 * j); pl %= p;
}
mul += pl;
}
mul %= p;
ans *= mul; ans %= p;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:193:33: error: 'push' was not declared in this scope; did you mean 'pus'?
193 | push(count0);
| ^~~~
| pus
|
s577044749 | p03842 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define P 1000000007
int a[100005],in[100005],col[100005],cnt[100005],n,L[100005];bool cir[100005];long long f[100005],ans=1;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;++i) scanf("%d",&a[i]),++in[a[i]];
for(int i=1;i<=n;++i)
{
if(col[i]) continue;int x=i;for(;!col[x];x=a[x]) col[x]=i;
if(col[x]!=i) continue;for(;!cir[x];x=a[x]) cir[x]=1;
}
for(int i=1;i<=n;++i) if((cir[i]&&in[i]>2)||(!cir[i]&&in[i]>1)) return puts("0"),0;
for(int i=1;i<=n;++i){if(in[i]) continue;int x=i,tmp=0;while(!cir[x]) x=a[x],tmp++;L[x]=tmp;}
for(int i=1;i<=n;++i)
{
if(!cir[i]) continue;int x=i,st=0,fir=0,id=0,len=0;
for(cir[x];x=a[x])
{
++id;cir[x]=0;
if(L[x])
{
if(!fir){st=fir=id;len=L[x];continue;}
else{(ans*=(L[x]<(id-st))+(L[x]<=(id-st)))%=P;if(!ans)return puts("0"),0;st=id;continue;}
}
}
if(fir){(ans*=(len<(id+fir-st))+(len<=(id+fir-st)))%=P;if(!ans)return puts("0"),0;}
else cnt[id]++;
}
for(int i=1;i<=n;++i)
{
f[0]=1;if(!cnt[i]) continue;
if(i>1&&(i%2)) for(int j=1;j<=cnt[i];++j) {f[j]=f[j-1]*2%P;if(j>1) (f[j]+=f[j-2]*(j-1)*i%P)%=P;}
else for(int j=1;j<=cnt[i];++j){f[j]=f[j-1];if(j>1) (f[j]+=f[j-2]*(j-1)*i%P)%=P;}
(ans*=f[cnt[i]])%=P;if(!ans)return puts("0"),0;
}
printf("%lld",ans);
} | a.cc: In function 'int main()':
a.cc:20:34: error: expected ';' before ')' token
20 | for(cir[x];x=a[x])
| ^
| ;
|
s522369307 | p03842 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll dp(int n,int m) {
ll s1=1,s2=0;
for(int i=1;i<=m;i++) {
ll f=(s1*(((n&1)&&n>1)?2LL:1LL)+s2*(i-1)%MOD*n)%MOD;
s2=s1;
s1=f;
}
return s1;
}
int a[100005],sum[100005];
bool vis[100005],cir[100005];
vector <int> son[100005];
int getlen(int x) {
vis[x]=1;
if (!cir[x]&&son[x].size()>=2) {
puts("0");
exit(0);
}
for(int i=0;i<son[x].size();i++)
if (!cir[son[x][i]]) return getlen(son[x][i])+1;
return 1;
}
int now[100005],l[100005],pos[100005];
ll calc(int x) {
do {
vis[x]=1;
x=a[x];
} while (!vis[x]);
int d=0,tot=0;
do {
cir[x]=1;
x=a[x];
} while (!cir[x]);
int t=x;
do {
pos[x]=++d;
l[x]=getlen(x)-1;
if (l[x]) now[++tot]=x;
x=a[x];
} while (x!=t);
if (!tot) {
sum[d]++;
return 1;
}
ll ans=1;
for(int i=1;i<=tot;i++) {
int p=now[i],q=now[i%tot+1];
int dis=(pos[q]-pos[p]+d)%d;
if (!dis) dis=d;
if (dis<l[q]) {
puts("0");
exit(0);
}
if (dis>l[q]) ans=ans*2LL%MOD;
}
return ans;
}
int main() {
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++) {
scanf("%d",&a[i]);
son[a[i]].push_back(i);
if (son[a[i]].size()>2) {
puts("0");
exit(0);
}
}
ll ans=1;
for(int i=1;i<=n;i++)
if (!vis[i]) ans=(ans*calc(i))%MOD;
for(int i=1;i<=n;i++)
if (sum[i]) ans=ans*dp(i,sum[i])%MOD;
printf("%lld\n",ans);
return 0;
} | a.cc:23:1: error: 'vector' does not name a type
23 | vector <int> son[100005];
| ^~~~~~
a.cc: In function 'int getlen(int)':
a.cc:27:16: error: 'son' was not declared in this scope
27 | if (!cir[x]&&son[x].size()>=2) {
| ^~~
a.cc:31:17: error: 'son' was not declared in this scope
31 | for(int i=0;i<son[x].size();i++)
| ^~~
a.cc: In function 'int main()':
a.cc:78:9: error: 'son' was not declared in this scope
78 | son[a[i]].push_back(i);
| ^~~
|
s947231910 | p03842 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))
#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;
const int MAX = 200200;
const int MOD = 1000 * 1000 * 1000 + 7;
VI g[MAX];
VI gr[MAX];
int U[MAX];
int iter;
int L[MAX];
int S[MAX];
int CNT[MAX];
LL DP[MAX];
int dfs1(int x)
{
U[x] = iter;
int to = g[x][0];
if (U[to] == iter) return to;
return dfs1(to);
}
int dfsC(int x)
{
U[x] = iter;
int res = 1;
FOR (i, 0, SZ(gr[x]))
{
int to = gr[x][i];
if (U[to] == iter) continue;
res += dfsC(to);
}
return res;
}
int dfsLen(int x)
{
if (SZ(gr[x]) > 1) return -1;
if (SZ(gr[x]) == 0) return 1;
int res = dfsLen(gr[x][0]);
if (res == -1) return -1;
return res + 1;
}
int sum(int l, int r)
{
if (l > r) return 0;
int res = S[r];
if (l) res -= S[l-1];
return res;
}
int brute(VI a)
{
VI v;
FOR (i, 0, SZ(a))
{
v.PB(i);
}
int res = 0;
do
{
bool ok = true;
FOR (i, 0, SZ(v))
{
if (v[i] != a[i] && v[v[i]] != a[i])
{
ok = false;
break;
}
}
if (ok)
{
res++;
}
}while(next_permutation(ALL(v)));
return res;
}
LL go(int x)
{
iter++;
x = dfs1(x);
VI cycle;
iter++;
while(U[x] != iter)
{
U[x] = iter;
cycle.PB(x);
x = g[x][0];
}
reverse(ALL(cycle));
iter++;
int sz = dfsC(x);
//cout<<x<<endl;
//cout<<sz<<' '<<SZ(cycle)<<endl;
if (sz == SZ(cycle))
{
CNT[sz]++;
return 1;
}
if (sz == 3)
{
int x = cycle[0];
// cout<<"!! "<<x<<' '<<SZ(gr[x])<<endl;
if (SZ(gr[x]) == 3) return 0;
if (g[x][0] == x) return 0;
return 2;
}
if (sz == 2)
{
CNT[2]++;
return 1;
}
//cout<<"---"<<endl;
iter++;
FOR (i, 0, SZ(cycle))
{
U[cycle[i]] = iter;
}
FOR (i, 0, SZ(cycle))
{
int x = cycle[i];
if (SZ(gr[x]) == 1)
{
L[i] = 0;
continue;
}
if (SZ(gr[x]) > 2)
{
return 0;
}
int to = gr[x][0];
if (U[to] == iter) to = gr[x][1];
int len = dfsLen(to);
L[i] = len;
}
FOR (i, SZ(cycle), SZ(cycle) * 2 + 2)
{
L[i] = L[i - SZ(cycle)];
}
FOR (i, 0, SZ(cycle) * 2 + 2)
{
S[i] = L[i];
if (i) S[i] += S[i-1];
}
FOR (i, 0, SZ(cycle) * 2 + 2)
{
DP[i] = 0;
}
DP[0] = 1;
/* FOR (i, 0, SZ(cycle))
{
cout<<cycle[i]<<' '<<L[i]<<endl;
}
cout<<endl;*/
FOR (i, 0, SZ(cycle))
{
int len = L[i];
if (len == 0)
{
DP[i+1] = (DP[i+1] + DP[i]);
if (DP[i+1] >= MOD) DP[i+1] -= MOD;
continue;
}
int to = i + len;
if (to > SZ(cycle) * 2 + 1) continue;
if (sum(i+1, to - 1) == 0)
{
DP[to] += DP[i];
if (DP[to] >= MOD) DP[to] -= MOD;
}
to = i + len + 1;
if (to > SZ(cycle) * 2 + 1) continue;
if (sum(i+1, to - 1) == 0)
{
DP[to] += DP[i];
if (DP[to] >= MOD) DP[to] -= MOD;
}
}
/* FOR (i,0 , SZ(cycle) * 2 + 2)
{
cout<<DP[i]<<' ';
}
cout<<endl;*/
LL res = 0;
FOR (i, SZ(cycle), SZ(cycle) * 2 + 2)
{
res += DP[i];
if (res >= MOD) res -= MOD;
}
return res;
}
LL bpow(LL a, LL b)
{
LL res = 1;
while(b)
{
if (b & 1) res = (res * a) % MOD;
a = (a * a) % MOD;
b /= 2;
}
return res;
}
LL inv(LL a)
{
return bpow(a, MOD - 2);
}
LL F[MAX];
LL IF[MAX];
LL P2[MAX];
LL IP2[MAX];
LL V[MAX];
LL V2[MAX];
LL C(int n, int m)
{
if (m > n) return 0;
LL res = F[n];
res *= IF[m];
res %= MOD;
res *= IF[n-m];
res %= MOD;
return res;
}
int main()
{
//freopen("in.txt", "r", stdin);
//ios::sync_with_Stdio(false); cin.tie(0);
F[0] = 1;
IF[0] = 1;
P2[0] = 1;
IP2[0] = 1;
V[0] = 1;
V2[0] = 1;
FOR (i, 1, MAX)
{
if (i % 2 == 0)
{
V[i] = V[i-2] * (i-1);
V[i] %= MOD;
}
if (i % 3 == 0)
{
V[i] = V[i-3] * (i-1);
if ((i - 1) % 2 == 0) V[i] /= 2;
V[i] %= MOD;
V[i] *= (i-2);
if ((i-2) % 2) == 0) V[i] /= 2;
V[i] %= MOD;
}
F[i] = (F[i-1] * i) % MOD;
IF[i] = inv(F[i]);
P2[i] = (P2[i-1] * 2) % MOD;
IP2[i] = inv(P2[i]);
}
while(true)
{
//cout<<"---------"<<endl;
int n;
scanf("%d", &n);
//n = 8;
FOR (i, 0, n+2)
{
U[i] = 0;
g[i].clear();
gr[i].clear();
CNT[i] = 0;
}
iter = 0;
VI a;
FOR (i, 0, n)
{
int x;
scanf("%d", &x);
x--;
//x = rand() % n;
a.PB(x);
g[i].PB(x);
gr[x].PB(i);
}
LL res = 1;
FOR (i, 0, n)
{
if (U[i]) continue;
res *= go(i);
res %= MOD;
// cout<<"* "<<res<<endl;
}
FOR (i, 0, n+1)
{
if (CNT[i] == 0) continue;
LL mul = 0;
if (i == 1)
{
FOR (j, 0, CNT[i] + 1)
{
if (j * 3 > CNT[i]) continue;
LL cur = C(CNT[i], j*3);
/*cur *= F[j*2];
cur %= MOD;
cur *= IP2[j];
cur %= MOD;*/
cur *= V2[j*3];
cur %= MOD;
cur *= bpow(i, j);
cur %= MOD;
if (i > 1 && (i & 1))
{
cur *= P2[CNT[i] - 3 * j];
cur %= MOD;
}
// cout<<j<<' '<<cur<<endl;
mul += cur;
mul %= MOD;
}
}
FOR (j, 0, CNT[i] + 1)
{
if (j * 2 > CNT[i]) continue;
LL cur = C(CNT[i], j*2);
/*cur *= F[j*2];
cur %= MOD;
cur *= IP2[j];
cur %= MOD;*/
cur *= V[j*2];
cur %= MOD;
cur *= bpow(i, j);
cur %= MOD;
if (i > 1 && (i & 1))
{
cur *= P2[CNT[i] - 2 * j];
cur %= MOD;
}
// cout<<j<<' '<<cur<<endl;
mul += cur;
mul %= MOD;
}
res *= mul;
res %= MOD;
}
cout<<res<<endl;
/* int br = brute(a);
cout<<br<<endl;
if (res != br)
{
cout<<SZ(a)<<endl;
FOR (i, 0, SZ(a))
{
cout<<a[i]<<' ';
}
cout<<endl;
throw -1;
}
cout<<endl;*/
break;
}
}
| a.cc: In function 'int main()':
a.cc:316:40: error: expected primary-expression before '==' token
316 | if ((i-2) % 2) == 0) V[i] /= 2;
| ^~
|
s219327717 | p03842 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
const int N=1e5+100;
int gi() {
int w=0;bool q=1;char c=getchar();
while ((c<'0'||c>'9') && c!='-') c=getchar();
if (c=='-') q=0,c=getchar();
while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
return q? w:-w;
}
int p[N],vis[N],st[N],len[N],tot[N];
int head[N],next[N];
bool rt[N];
int f[N],g[N];
inline int dfs(int k) {
int s=0;
for (int i=head[k];i;i=next[i])
if (!rt[i]) {
if (s) puts("0"),exit(0);
s=dfs(i)+1;
}
return s;
}
int main()
{
const int mod=1e9+7;
int n=gi(),i,k,t,s,cnt=0,top,ans=1,p2=0;
bool is;
for (i=1;i<=n;i++) p[i]=gi(),next[i]=head[p[i]],head[p[i]]=i;
for (i=1;i<=n;i++)
if (!vis[i]) {
++cnt;
for (k=i;!vis[k];k=p[k])
vis[k]=cnt;
if (vis[k]!=cnt) continue;
for (t=k,top=0;st[1]!=t;t=p[t]) rt[st[++top]=t]=true;
reverse(st+1,st+1+top);
is=false;
for (k=1;k<=top;k++)
is|=len[k]=dfs(st[k]);
if (is) {
for (k=1;k<=top;k++)
if (len[k]) {
for (t=k%top+1,s=1;!len[t];t=t%top+1,s++);
if (s<len[k]) return puts("0"),0;
if (s!=len[k]) p2++;
}
} else tot[top]++,p2+=top>1&&(top&1);
}
const int inv2=(mod+1)/2;
for (i=f[0]=f[1]=g[0]=g[1]=1;i<=n;i++) {
f[i+1]=(1LL*f[i-1]*i%mod*inv2+f[i])%mod;
g[i+1]=(2LL*g[i-1]*i+g[i])%mod;
}
for (i=1;i<=n;i++)
ans=1LL*ans*(i==1||i%2==0?g[tot[i]]:f[tot[i]])%mod;
while (p2--) (ans<<=1)%=mod;
printf("%d\n",ans);
return 0;
}
| a.cc: In function 'int dfs(int)':
a.cc:29:32: error: reference to 'next' is ambiguous
29 | for (int i=head[k];i;i=next[i])
| ^~~~
In file included from /usr/include/c++/14/string:47,
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/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:24:13: note: 'int next [100100]'
24 | int head[N],next[N];
| ^~~~
a.cc: In function 'int main()':
a.cc:41:38: error: reference to 'next' is ambiguous
41 | for (i=1;i<=n;i++) p[i]=gi(),next[i]=head[p[i]],head[p[i]]=i;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:24:13: note: 'int next [100100]'
24 | int head[N],next[N];
| ^~~~
|
s933098121 | p03842 | C++ | #include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
if(Bufferhead==Buffertail){
int l=fread(buffer,1,BufferSize,stdin);
if(!l){Terminal=1;return 0;}
Buffertail=(Bufferhead=buffer)+l;
}
return *Bufferhead++;
}
template<class T>inline bool read(T &x){
x=0;char c=Getchar(),rev=0;
while(c<'0'||c>'9'){c=Getchar();rev|=c=='-';if(Terminal)return 0;}
while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
if(c=='.'){
c=Getchar();double t=0.1;
while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
}
x=rev?-x:x;
return 1;
}
template<class T1,class T2> inline bool read(T1 &x,T2 &y){return read(x)&read(y);}
template<class T1,class T2,class T3> inline bool read(T1 &x,T2 &y,T3 &z){return read(x)&read(y)&read(z);}
template<class T1,class T2,class T3,class T4> inline bool read(T1 &x,T2 &y,T3 &z,T4 &w){return read(x)&read(y)&read(z)&read(w);}
inline bool reads(char *x){
char c=Getchar();
while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
while(c>=33&&c<=126) (*x++)=c,c=Getchar();
*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
if(!x){putchar('0');putchar(c);return;}
if(x<0) putchar('-'),x=-x;
int m=0,a[20];
while(x) a[m++]=x%10,x/=10;
while(m--) putchar(a[m]+'0');
putchar(c);
}
//--------------------------------head---------------------------------------------
const int inf=0x3f3f3f3f;
const int N=100005,M=100005,mod=1e9+7;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
int ans=1;
while(y){
if(y&1) ans=(ll)ans*x%mod;
x=(ll)x*x%mod;y>>=1;
}return ans;
}
int fac[N],ifac[N],pw[N];
int n,res,cnt,a[N],du[N],si[N],s[N];
bool vis[N],v[N];
vi g[N];
inline int C(int x,int y){
if(x<y) return 0;
return (ll)fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}
void dfs(int x){
vis[x]=1;cnt++;
if(du[x]==2){
int l=g[x][0],r=g[x][1],p=2;
vi L(0),R(0);L.pb(l);R.pb(r);
while(du[l]&&du[r]){
if(du[l]+du[r]>2){puts("0");exit(0);}
l=g[l][0],r=g[r][0],p+=2,L.pb(l),R.pb(r);
}
if(du[l]) swap(l,r);
for(int j:L) vis[j]=1;
for(int j:R) vis[j]=1;
for(int i=0,j=cnt+2;i<L.size();i++,j+=2)
s[L[i]]=-j;
for(int i=0,j=cnt+2;i<R.size();i++,j+=2)
s[R[i]]=-j;
if(du[r]==2){
for(int j=cnt+1;j<=cnt+p;j++)
v[j]=1;
for(int i=0,j=cnt+1;i<L.size();i++,j+=2)
s[L[i]]=j;
for(int i=0,j=cnt+2;i<R.size();i++,j+=2)
s[R[i]]=j;
cnt+=p-1;dfs(r);
}
else if(du[r]==1){
res++;cnt+=p;
v[cnt+1]=1;s[g[r][0]]=cnt+1;
dfs(g[r][0]);
}
else cnt+=p,res++;
}
else if(du[x]==1){
// debug(x);
v[cnt+1]=1;s[g[x][0]]=cnt+1;
dfs(g[x][0]);
}
}
void dfs2(int x){
vis[x]=1;cnt++;
for(int y:g[x])
if(!vis[y]) dfs2(y);
}
int main(){
#ifdef rqgao2014
freopen("input.txt","r",stdin);
#endif
read(n);
pw[0]=1;
for(int i=1;i<=n;i++) pw[i]=pw[i-1]*2%mod;
fac[0]=1;
for(int i=1;i<=n;i++) fac[i]=(ll)fac[i-1]*i%mod;
ifac[n]=exp(fac[n],mod-2);
for(int i=n;i;i--) ifac[i-1]=(ll)ifac[i]*i%mod;
for(int i=1;i<=n;i++){
read(a[i]);
g[a[i]].pb(i);du[a[i]]++;
}
for(int i=1;i<=n;i++)
if(du[i]>2){puts("0");return 0;}
int ans=1;
for(int i=1;i<=n;i++)
if(!vis[i]&&du[i]>1){
debug(i);
vi tmp=g[a[i]];g[a[i]].clear();
for(int j:tmp) if(j!=i) g[a[i]].pb(j);du[a[i]]--;
cnt=res=0;
v[1]=1;s[i]=1;
dfs(i);
if(abs(s[a[i]])<cnt-1){puts("0");return 0;}
if(s[a[i]]<0&&(v[cnt-1]||v[cnt])) res--;
ans=(ll)ans*pw[res]%mod;
for(int j=1;j<=cnt;j++) v[j]=0;
}
for(int i=1;i<=n;i++)
if(!vis[i]){
cnt=0;dfs2(i);
si[cnt]++;
}
// debug(ans);
for(int i=1;i<=n;i++){
res=0;
gmax(mx,si[i]);
for(int j=0,now=1;j<=si[i]/2;j++){
if(i%2==0||i==1) ch(res,now); else ch(res,(ll)now*pw[si[i]-j*2]);
now=(ll)now*C(si[i]-j*2,2)%mod*i%mod*exp(j+1,mod-2)%mod;
}
ans=(ll)ans*res%mod;
}
print(ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:171:22: error: 'mx' was not declared in this scope; did you mean 'mp'?
171 | gmax(mx,si[i]);
| ^~
| mp
|
s365455669 | p03842 | C++ | // #includes {{{
#include<bits/stdc++.h>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
//#define PB push_back
#define CLEAR(c,d) memset((c),(d),sizeof(c))
#define TO_STRING(VariableName) # VariableName
//#define DB(c) cout<<TO_STRING(c)<<"="<<(c)<<endl
#define EXIST(e,s) ((s).find(e)!=(s).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;
#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;
typedef pair<int,int> pii;
//{{{ io
struct IO{ }io;//dummy
#define endl "\n"
IO& operator>>(IO &io,int &n){scanf("%d",&n);return io;}
IO& operator>>(IO &io,unsigned int &n){scanf("%u",&n);return io;}
IO& operator>>(IO &io,long long &n){scanf("%lld",&n);return io;}
IO& operator>>(IO &io,unsigned long long &n){scanf("%llu",&n);return io;}
IO& operator>>(IO &io,double &n){scanf("%lf",&n);return io;}
IO& operator>>(IO &io,long double &n){scanf("%Lf",&n);return io;}
IO& operator>>(IO &io,char *c){scanf("%s",c);return io;}
IO& operator>>(IO &io,string &s){
char c;s.clear();
while(isspace(c=getc(stdin))){if(c==-1)return io;}
do{
s.push_back(c);
}while(!isspace(c=getc(stdin)));
if(c!=-1)ungetc(c,stdin);
return io;
}
IO& operator<<(IO &io,const int &n){printf("%d",n);return io;}
IO& operator<<(IO &io,const unsigned int &n){printf("%u",n);return io;}
IO& operator<<(IO &io,const long long &n){printf("%lld",n);return io;}
IO& operator<<(IO &io,const unsigned long long &n){printf("%llu",n);return io;}
IO& operator<<(IO &io,const double &n){printf("%lf",n);return io;}
IO& operator<<(IO &io,const long double &n){printf("%Lf",n);return io;}
IO& operator<<(IO &io,const char c[]){printf("%s",c);return io;}
IO& operator<<(IO &io,const string &s){
REP(i,s.size())putc(s[i],stdout);
}
//}}}
// }}}
//{{{ gcd and inverse
#define __GCD_H
Int gcd(Int a, Int b) {
return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
return a / gcd(a, b) *b;
}
// a x + b y = gcd(a, b)
Int extgcd(Int a, Int b, Int &x, Int &y) {
Int g = a; x = 1; y = 0;
if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
return g;
}
Int invMod(Int a, Int m) {
Int x, y;
if (extgcd(a, m, x, y) == 1) return (x + m) % m;
else return 0; // unsolvable
}
//}}}
const int mod = 1000000007;
//{{{ modular algebra
struct Num{
int v;
Num(int n):v(n){}
Num(){}
operator int() const {return v;}
operator long long() const {return v;}
operator =(int n){v=n;}
template<class T>
inline void operator *=(const T &a) {
v = (v*(long long)a)%mod;
}
template<class T>
inline Num operator *(const T &a) {
Num n(*this);n*=a;
return n;
}
template<class T>
inline void operator+=(const T &a){
v+=(int)a;
if(v>=mod)v-=mod;
// assert(0<=v and v<mod);
}
template<class T>
inline Num operator+(const T &a){
Num n(*this);n+=a;
return n;
}
inline Num operator -(){
if(v==0)return v;
else return Num(mod-v);
}
template<class T>
inline void operator -=(const T &a){
v-=a;
if(v<0)v+=mod;
}
template<class T>
inline Num operator -(const T &a){
Num n(*this);n-=a;
return n;
}
#ifdef __GCD_H
inline Num inv(){
return invMod(this->v,mod);
}
template<class T>
inline void operator /=(const T &a){
(*this)*=invMod((int)a,mod);
}
template<class T>
inline Num operator /(const T &a){
Num n(*this);n/=a;
return n;
}
#endif
};
//}}}
//{{{ fact, binom, multinom
inline Num fact(int n,const int &mod = mod){
static vector<Num> __fact(1,1);
while(n>=__fact.size())__fact.push_back(__fact.back()*__fact.size());
return __fact[n];
}
inline Num binom(int n,int r){
if(n<0 or r<0 or n<r)return 0;
return fact(n)/(fact(r)*fact(n-r));
}
inline Num multinom(const vector<int> &v){
Num num(fact(accumulate(ALL(v),0))), denom(1);
REP(i,v.size())denom*=fact(v[i]);
return num/denom;
}
//}}}
//{{{ pow
/* (x^k)%m */
inline Num powMod(Num x, int k){
if(k==0) return 1;
Num res(powMod(x,k/2));
res*=res;
if(k%2)res*=x;
return res;
}
//}}}
int N;
int a[100010];
//{{{ graph
typedef int Weight;
struct Edge {
int src, dst;
Weight weight;
Edge(int src, int dst, Weight weight) :
src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
//}}}
//{{{ strong connected components
void visit(const Graph &g, int v, vector< vector<int> >& scc,
stack<int> &S, vector<bool> &inS,
vector<int> &low, vector<int> &num, int& time) {
low[v] = num[v] = ++time;
S.push(v); inS[v] = true;
FOR(e, g[v]) {
int w = e->dst;
if (num[w] == 0) {
visit(g, w, scc, S, inS, low, num, time);
low[v] = min(low[v], low[w]);
} else if (inS[w])
low[v] = min(low[v], num[w]);
}
if (low[v] == num[v]) {
scc.push_back(vector<int>());
while (1) {
int w = S.top(); S.pop(); inS[w] = false;
scc.back().push_back(w);
if (v == w) break;
}
}
}
void stronglyConnectedComponents(const Graph& g,
vector< vector<int> >& scc) {
scc.clear();
const int n = g.size();
vector<int> num(n), low(n);
stack<int> S;
vector<bool> inS(n);
int time = 0;
REP(u, n) if (num[u] == 0)
visit(g, u, scc, S, inS, low, num, time);
}
//}}}
int main(){
cin>>N;
Graph g(N);
REP(i,N)cin>>a[i],a[i]--,g[a[i]].push_back(Edge(a[i],i,1));
vector<vector<int> > scc;
stronglyConnectedComponents(g,scc);
Num ans = 1;
unordered_map<int,int> circle;
REP(i,scc.size()){
if(scc[i].size()==1 and a[scc[i][0]]!=scc[i][0])continue;
int start_u = -1;
REP(j,scc[i].size()){
if(g[scc[i][j]].size()>=3){
cout<<0<<endl;
return 0;
}else if(g[scc[i][j]].size()==2){
start_u = scc[i][j];
break;
}
}
if(start_u==-1){
circle[scc[i].size()]++;
continue;
}
set<int> st(ALL(scc[i]));
vector<pii> v;
int ct = -1;
vector<pii> dists;
for(int u = start_u;;){
if(g[u].size()==2){
if(ct!=-1){
int s;
s = (st.find(g[u][0].dst)==st.end())?g[u][0].dst:g[u][1].dst;
int len = 1;
for(;g[s].size()>=1;){
if(g[s].size()>=2){
cout<<0<<endl;
return 0;
}
s = g[s][0].dst;
len++;
}
dists.push_back(make_pair(ct,len));
if(u==start_u)break;
}
ct = 0;
}
ct++;
u = a[u];
}
for(auto &a:dists){
if(a.first<a.second){
cout<<0<<endl;
return 0;
}else if(a.first>a.second){
ans*=2;
}
// cerr<<a.first<<" "<<a.second<<endl;
}
}
for(auto &e:circle){
int len = e.first, num = e.second;
Num s = 0;
for(int t=0;;t++){
int u = num-t*2;
if(u<0)break;
Num b = multinom({t,t,u});
b*=fact(t);
b*=powMod(len,t);
b/=powMod(2,t);
if(len>1 and len%2==1){
b*=powMod(2,u);
}
s+=b;
}
ans*=s;
}
// assert(ans!=0);
cout<<(int)ans<<endl;
return 0;
}
| a.cc: In function 'IO& operator<<(IO&, const std::string&)':
a.cc:60:1: warning: no return statement in function returning non-void [-Wreturn-type]
60 | }
| ^
a.cc: At global scope:
a.cc:94:9: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
94 | operator =(int n){v=n;}
| ^~~~~~~~
a.cc: In member function 'int Num::operator=(int)':
a.cc:94:31: warning: no return statement in function returning non-void [-Wreturn-type]
94 | operator =(int n){v=n;}
| ^
|
s246559392 | p03842 | C++ | 10
2 3 4 5 1 7 8 9 10 6
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10
| ^~
|
s587326384 | p03842 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
ll mod=1e9+7;
const int MX=100000;
ll f[MX+1],g[MX+1],inv[MX+1];
void precalc(){
f[0]=1;
rep1(i,MX) f[i]=f[i-1]*i%mod;
inv[1]=1;
for(int i=2;i<=MX;i++) inv[i]=mod-mod/i*inv[mod%i]%mod;
g[0]=1;
rep1(i,MX) g[i]=g[i-1]*inv[i]%mod;
}
ll C(int x,int y){
return f[x]*g[y]%mod*g[x-y]%mod;
}
ll ex(ll x,ll p){
ll a=1;
while(p){
if(p%2) a=a*x%mod;
x=x*x%mod;
p/=2;
}
return a;
}
const int MN=100000;
int N,a[MN];
int ks[MN+1];
bool vis[MN];
vector<int> Gi[MN];
int main(){
precalc();
cin>>N;
rep(i,N){
cin>>a[i],a[i]--;
Gi[a[i]].pb(i);
}
rep(i,N) if(G[i].size()>2){
puts("0");
return 0;
}
rep(i,N) if(Gi[i].empty()){
int to=a[i];
if(Gi[to].size()!=2){
puts("0");
return 0;
}
vis[i]=1;
}
ll ans=1;
rep(i,N) if(!vis[i]){
int c=0;
int v=i;
vector<int> lens;
bool vhas=(Gi[v].size()==2);
int now=0;
while(!vis[v]){
if(Gi[v].size()==2){
now++;
}else{
lens.pb(now);
now=0;
}
vis[v]=1;
v=a[v];
c++;
}
if(v!=i){
puts("0");
return 0;
}
if(!vhas&&now==0&&lens.empty()){
ks[c]++;
continue;
}
if(vhas && lens.empty()){
ans*=2;
continue;
}else if(vhas){
lens[0]+=now;
}
for(int l:lens) ans*=(l+1);
}
ll ans=1;
rep(L,MN+1){
int K=ks[L];
if(K==0) continue;
show(L);
show(K);
ll sum=0;
rep(a,MN+1){
if(2*a>K) break;
ll val=f[K]*g[K-2*a]%mod*ex(inv[2],a)%mod*g[a]%mod*ex(L,a)%mod*ex((L>=3?2:1),K-2*a)%mod;
show(a);
show(val);
sum+=val;
sum%=mod;
}
ans*=sum;
ans%=mod;
}
if(ans<0) ans+=mod;
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:51:21: error: 'G' was not declared in this scope
51 | rep(i,N) if(G[i].size()>2){
| ^
a.cc:97:12: error: redeclaration of 'll ans'
97 | ll ans=1;
| ^~~
a.cc:63:12: note: 'll ans' previously declared here
63 | ll ans=1;
| ^~~
|
s144352535 | p03842 | C++ | #include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int dat[200000];
int ind[200000];
bool flag[200000];
int vtype[200000];//1: circ1 2: circ2 3: edge
vector<int>circ1[200000];
int circ2[200001];
int flen[200000];
#define SIZE 300000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
inv[1] = 1;
for (int i = 2; i <= SIZE; i++)
{
inv[i] = mod - (mod / i)*inv[mod%i] % mod;
}
kai[0] = invkai[0] = 1;
for (int i = 1; i <= SIZE; i++)
{
kai[i] = kai[i - 1] * i%mod;
invkai[i] = invkai[i - 1] * inv[i] % mod;
}
}
ll com(ll a, ll b)
{
if (b < 0 || a < b)return 0;
return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
int main()
{
int num;
scanf("%d", &num);
for (int i = 0; i < num; i++)
{
scanf("%d", &dat[i]);
dat[i]--;
ind[dat[i]]++;
if (ind[dat[i]] >= 3)
{
goto l01;
}
}
for (int i = 0; i < num; i++)
{
if (ind[i] == 0)
{
int now = i;
for (;;)
{
if (flag[now])
{
if (vtype[now] == 0)
{
int t = now;
for (;;)
{
vtype[t] = 1;
circ1[now].push_back(0);
t = dat[t];
if (now == t)break;
}
}
else if (vtype[now] == 3)
{
goto l01;
}
break;
}
flag[now] = true;
now = dat[now];
}
now = i;
int t = 0;
for (;;)
{
if (vtype[now] == 1)
{
flen[now] = t;
break;
}
vtype[now] = 3;
now = dat[now];
t++;
}
}
}
for (int i = 0; i < num; i++)
{
if (!flag[i])
{
int now = i;
int t = 0;
for (;;)
{
if (flag[now])break;
flag[now] = true;
t++;
now = dat[now];
}
circ2[t]++;
}
}
for (int i = 0; i < num; i++)
{
int now = i;
for (int j = 0; j < circ1[i].size(); j++)
{
circ1[i][j] = flen[now];
now = dat[now];
}
}
ll ans = 1;
for (int i = 0; i < num; i++)
{
if (circ1[i].size() >= 1)
{
int x = circ1[i].size();
for (int j = x * 3; j >= 0; j--)
{
if (circ1[i][j%x]>2)
{
if (circ1[i][(j + x - 1) % x] != 0)
{
goto l01;
}
circ1[i][(j + x - 1) % x] = circ1[i][j%x] - 1;
circ1[i][j%x] = 1;
}
}
int r = 1;
for (int j = 0; j < x; j++)
{
if (circ1[i][j] == 1 && circ1[i][(j + 1) % x] == 0)r = r * 2 % mod;
}
ans *= r;
ans %= mod;
}
}
invinit();
for (int i = 1; i <= num; i++)
{
int x = circ2[i];
ll tim = 1;
ll now = 1;
ll r = 0;
for (int j = 0; j <= x / 2; j++)
{
r += com(x, 2 * j)*now%mod*tim%mod;
now = now*(j * 2 + 1) % mod;
tim = tim * i % mod;
}
ans = ans*r%mod;
}
printf("%lld\n", ans);
if (false)
{
l01:;
printf("0\n");
}
} | a.cc: In function 'int main()':
a.cc:165:9: error: jump to label 'l01'
165 | l01:;
| ^~~
a.cc:73:54: note: from here
73 | goto l01;
| ^~~
a.cc:120:12: note: crosses initialization of 'll ans'
120 | ll ans = 1;
| ^~~
a.cc:165:9: error: jump to label 'l01'
165 | l01:;
| ^~~
a.cc:48:30: note: from here
48 | goto l01;
| ^~~
a.cc:120:12: note: crosses initialization of 'll ans'
120 | ll ans = 1;
| ^~~
|
s519108504 | p03842 | C++ | #include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int dat[200000];
int ind[200000];
bool flag[200000];
int vtype[200000];//1: circ1 2: circ2 3: edge
vector<int>circ1[200000];
int circ2[200001];
int flen[200000];
#define SIZE 300000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
inv[1] = 1;
for (int i = 2; i <= SIZE; i++)
{
inv[i] = mod - (mod / i)*inv[mod%i] % mod;
}
kai[0] = invkai[0] = 1;
for (int i = 1; i <= SIZE; i++)
{
kai[i] = kai[i - 1] * i%mod;
invkai[i] = invkai[i - 1] * inv[i] % mod;
}
}
ll com(ll a, ll b)
{
if (b < 0 || a < b)return 0;
return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
int main()
{
int num;
scanf("%d", &num);
for (int i = 0; i < num; i++)
{
scanf("%d", &dat[i]);
dat[i]--;
ind[dat[i]]++;
if (ind[dat[i]] >= 3)goto l01;
}
for (int i = 0; i < num; i++)
{
if (ind[i] == 0)
{
int now = i;
for (;;)
{
if (flag[now])
{
if (vtype[now] == 0)
{
int t = now;
for (;;)
{
vtype[t] = 1;
circ1[now].push_back(0);
t = dat[t];
if (now == t)break;
}
}
else if (vtype[now] == 3)goto l01;
break;
}
flag[now] = true;
now = dat[now];
}
now = i;
int t = 0;
for (;;)
{
if (vtype[now] == 1)
{
flen[now] = t;
break;
}
vtype[now] = 3;
now = dat[now];
t++;
}
}
}
for (int i = 0; i < num; i++)
{
if (!flag[i])
{
int now = i;
int t = 0;
for (;;)
{
if (flag[now])break;
flag[now] = true;
t++;
now = dat[now];
}
circ2[t]++;
}
}
for (int i = 0; i < num; i++)
{
int now = i;
for (int j = 0; j < circ1[i].size(); j++)
{
circ1[i][j] = flen[now];
now = dat[now];
}
}
ll ans = 1;
for (int i = 0; i < num; i++)
{
if (circ1[i].size() >= 1)
{
int x = circ1[i].size();
for (int j = x * 3; j >= 0; j--)
{
if (circ1[i][j%x]>2)
{
if (circ1[i][(j + x - 1) % x] != 0)goto l01;
circ1[i][(j + x - 1) % x] = circ1[i][j%x] - 1;
circ1[i][j%x] = 1;
}
}
int r = 1;
for (int j = 0; j < x; j++)
{
if (circ1[i][j] == 1 && circ1[i][(j + 1) % x] == 0)r = r * 2 % mod;
}
ans *= r;
ans %= mod;
}
}
invinit();
for (int i = 1; i <= num; i++)
{
int x = circ2[i];
ll tim = 1;
ll now = 1;
ll r = 0;
for (int j = 0; j <= x / 2; j++)
{
r += com(x, 2 * j)*now%mod*tim%mod;
now = now*(j * 2 + 1) % mod;
tim = tim * i % mod;
}
ans = ans*r%mod;
}
printf("%lld\n", ans);
if (false)
{
l01:;
printf("0\n");
}
} | a.cc: In function 'int main()':
a.cc:156:9: error: jump to label 'l01'
156 | l01:;
| ^~~
a.cc:68:71: note: from here
68 | else if (vtype[now] == 3)goto l01;
| ^~~
a.cc:114:12: note: crosses initialization of 'll ans'
114 | ll ans = 1;
| ^~~
a.cc:156:9: error: jump to label 'l01'
156 | l01:;
| ^~~
a.cc:46:43: note: from here
46 | if (ind[dat[i]] >= 3)goto l01;
| ^~~
a.cc:114:12: note: crosses initialization of 'll ans'
114 | ll ans = 1;
| ^~~
|
s381297928 | p03843 | C++ | #include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;
const int Maxn = 2e5 + 5;
typedef int arr[Maxn];
//ll Add(ll x, ll y) { return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x); }
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
inline ll read()
{
rg ll res = 0, sign = 1;
rg char ch = getchar();
while (!isdigit(ch))
{
if (ch == '-')
sign = -1;
ch = getchar();
}
do
{
res = (res << 3) + (res << 1) + (ch ^ 48);
ch = getchar();
} while (isdigit(ch));
return res * sign;
}
int n, tot;
arr fa, deep;
int Max[Maxn][2], sum[Maxn];
ll ans;
char s[Maxn];
vector<int> to[Maxn];
void Add(int x, int p)
{
if (deep[p] + 1 > deep[Max[x][1]])
{
if (deep[p] + 1 > deep[Max[x][0]])
{
Max[x][1] = Max[x][0];
Max[x][0] = p;
deep[x] = deep[Max[x][0]] + 1;
}
else
Max[x][1] = p;
}
}
void DFS(int x)
{
for (rg int i = 0, nx; i < to[x].size(); i++)
{
nx = to[x][i];
if (nx == fa[x])
continue;
fa[nx] = x;
DFS(nx);
sum[x] += sum[nx];
Add(x, nx);
}
}
void Solve(int x)
{
if (to[x].size() == 1)
{
ans += (s[x] == '1') * 2;
return;
}
ans += min(deep[x], deep[Max[x][1]] + 2);
if (s[x] == '0')
{
rg int Min = Inf;
for (rg int i = 0, nx; i < to[x].size(); i++)
{
nx = to[x][i];
if (nx == fa[x] || !sum[nx])
continue;
if (deep[nx] < Min)
Min = deep[nx] + 1;
}
ans -= Min;
}
rg int tmp;
for (rg int i = 0, nx; i < to[x].size(); i++)
{
nx = to[x][i];
if (nx == fa[x])
continue;
sum[x] = tot - sum[nx];
tmp = deep[nx];
deep[x] = deep[Max[x][Max[x][0] == nx]] + 1;
Add(nx, x);
Solve(nx);
deep[nx] = tmp;
}
}
int main()
{
rg int a, b, tmp;
cin >> n;
for (int i = 1; i < n; i++)
{
a = read();
b = read();
to[a].push_back(b);
to[b].push_back(a);
}
cin >> s + 1;
if (n == 1)
{
printf("%c\n", s[1]);
return 0;
}
for (int i = 1; i <= n; i++)
tot += sum[i] = s[i] == '1';
DFS(1);
lim[1] = Inf;
Solve(1);
cout << ans + 1 << '\n';
return 0;
}
| a.cc: In function 'll read()':
a.cc:15:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | rg ll res = 0, sign = 1;
| ^~~
a.cc:15:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | rg ll res = 0, sign = 1;
| ^~~~
a.cc:16:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
16 | rg char ch = getchar();
| ^~
a.cc: In function 'void DFS(int)':
a.cc:52:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
52 | for (rg int i = 0, nx; i < to[x].size(); i++)
| ^
a.cc:52:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
52 | for (rg int i = 0, nx; i < to[x].size(); i++)
| ^~
a.cc: In function 'void Solve(int)':
a.cc:73:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
73 | rg int Min = Inf;
| ^~~
a.cc:74:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
74 | for (rg int i = 0, nx; i < to[x].size(); i++)
| ^
a.cc:74:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
74 | for (rg int i = 0, nx; i < to[x].size(); i++)
| ^~
a.cc:84:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
84 | rg int tmp;
| ^~~
a.cc:85:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
85 | for (rg int i = 0, nx; i < to[x].size(); i++)
| ^
a.cc:85:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
85 | for (rg int i = 0, nx; i < to[x].size(); i++)
| ^~
a.cc: In function 'int main()':
a.cc:100:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
100 | rg int a, b, tmp;
| ^
a.cc:100:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
100 | rg int a, b, tmp;
| ^
a.cc:100:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
100 | rg int a, b, tmp;
| ^~~
a.cc:118:9: error: 'lim' was not declared in this scope
118 | lim[1] = Inf;
| ^~~
|
s458260535 | p03843 | C++ | #include <bits/stdc++.h>
#define MAXN 200005
#define INF 0x3f3f3f3f
typedef long long lint;
using namespace std;
struct data {
int next, to;
data(int next = 0, int to = 0):next(next), to(to) {}
}edge[MAXN << 1];
struct node {
int maxd, state;
node(int maxd = 0, int state = 0):maxd(maxd), state(state) {}
bool operator < (const node b) const {
return maxd < b.maxd;
}
};
int n;
int fa[MAXN], state[MAXN], maxd[MAXN], maxu[MAXN], se[MAXN], semaxd[MAXN];
int stated[MAXN], stateu[MAXN], target[MAXN], times[MAXN], deg[MAXN];
int head[MAXN], cnt;
lint ans = 0;
void connect(int u, int v) {
edge[++cnt] = data(head[u], v);
head[u] = cnt;
}
void DFS1(int u, int pre) {
fa[u] = pre;
times[u] = stated[u] = state[u];
for (int i = head[u]; i; i = edge[i].next) {
int v = edge[i].to;
++deg[u];
if (v == pre)
continue;
DFS1(v, u);
stated[u] |= stated[v];
if (stated[v]) {
++times[u];
target[u] = v;
}
if (maxd[v] + 1 > maxd[u]) {
semaxd[u] = maxd[u];
maxd[u] = maxd[v] + 1;
}
else if (maxd[v] + 1 > semaxd[u])
semaxd[u] = maxd[v] + 1;
}
}
void DFS2(int u, int pre) {
if (u != 1) {
if (maxd[fa[u]] == maxd[u] + 1)
maxu[u] = semaxd[fa[u]] + 1;
else
maxu[u] = maxd[fa[u]] + 1;
maxu[u] = max(maxu[u], maxu[fa[u]] + 1);
if ((stated[fa[u]] && times[fa[u]] > 1) || (stated[fa[u]] && !stated[fa[u]]))
stateu[u] = 1;
}
for (int i = head[u]; i; i = edge[i].next) {
int v = edge[i].to;
if (v == pre)
continue;
DFS2(v, u);
}
}
int main() {
int size=256<<20;
//申请空间
char *p=(char*)malloc(size)+size;
__asm__("movl %0,%%esp\n"::"r"(p));
freopen("1_01.txt", "r", stdin);
freopen("a.txt", "w", stdout);
scanf("%d", &n);
for (int i = 1; i < n; ++i) {
int u, v;
scanf("%d%d", &u, &v);
connect(u, v);
connect(v, u);
}
for (int i = 1; i <= n; ++i)
scanf("%1d", &state[i]);
DFS1(1, 0);
DFS2(1, 0);
for (int u = 1; u <= n; ++u) {
if ((maxd[u] < maxu[u] - 1 && stated[u]) || (maxd[u] > maxu[u] - 1 && stateu[u]) || (maxd[u] == maxu[u] - 1 && (stateu[u] || stated[u]))) {
++ans;
// cout << u << " type1\n";
}
int up = 0;
if (maxu[u] > maxd[u])
up = maxd[u];
else
up = max(maxu[u], semaxd[u]);
if (state[u]) {
ans += up + 1;
// cout << u << " type2\n";
}
else {
int down = stateu[u] ? maxu[u] : INF;
for (int i = head[u]; i; i = edge[i].next) {
int v = edge[i].to;
if (v == fa[u])
continue;
if (stated[v])
down = min(down, maxd[v] + 1);
}
// cout << u << " type3\n";
ans += max(0, up - down + 1);
}
// cout << deg[u] << " " << maxd[u] << " " << maxu[u] << endl;
}
printf("%lld\n", ans);
} | a.cc: In function 'void connect(int, int)':
a.cc:31:23: error: reference to 'data' is ambiguous
31 | edge[++cnt] = data(head[u], v);
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:8: note: 'struct data'
10 | struct data {
| ^~~~
|
s298010934 | p03843 | C++ | #include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#define llint long long
#define inf 1000000000
using namespace std;
typedef pair<llint, llint> P;
llint n;
vector<llint> G[200005];
vector<P> E;
string s;
map<P, llint> mp, mp2;
void dfs(int v, int p)
{
for(int i = 0; i < G[v].size(); i++){
int u = G[v][i];
if(u == p) continue;
dfs(u, v);
llint mx = 0, mn = inf;
for(int j = 0; j < G[u].size(); j++){
if(G[u][j] == v) continue;
mx = max(mx, mp[make_pair(u, G[u][j])]);
mn = min(mn, mp2[make_pair(u, G[u][j])]);
}
mp[make_pair(v, u)] = mx + 1;
if(s[u] == '1') mn = 0;
if(s[v] == '1') mn = -1;
mp2[make_pair(v, u)] = mn + 1;
}
}
llint lmx[200005], rmx[200005];
llint lmn[200005], rmn[200005];
void dfs2(int v, int p)
{
for(int i = 0; i < G[v].size(); i++){
int u = G[v][i];
lmx[i] = mp[make_pair(v, u)];
if(i > 0) lmx[i] = max(lmx[i], lmx[i-1]);
lmn[i] = mp2[make_pair(v, u)];
if(i > 0) lmn[i] = min(lmn[i], lmn[i-1]);
}
for(int i = (int)G[v].size()-1; i >= 0; i--){
int u = G[v][i];
rmx[i] = mp[make_pair(v, u)];
if(i < (int)G[v].size()-1) rmx[i] = max(rmx[i], rmx[i+1]);
rmn[i] = mp2[make_pair(v, u)];
if(i < (int)G[v].size()-1) rmn[i] = min(rmn[i], rmn[i+1]);
}
for(int i = 0; i < G[v].size(); i++){
int u = G[v][i];
if(u == p) continue;
llint mx = 0;
if(i > 0) mx = max(mx, lmx[i-1]);
if(i < (int)G[v].size()-1) mx = max(mx, rmx[i+1]);
mp[make_pair(u, v)] = mx + 1;
llint mn = inf;
if(i > 0) mn = min(mn, lmn[i-1]);
if(i < (int)G[v].size()-1) mn = min(mn, rmn[i+1]);
if(s[v] == '0') mn = 0;
if(s[u] == '1') mn = -1;
mp2[make_pair(u, v)] = mn + 1;
}
for(int i = 0; i < G[v].size(); i++){
if(G[v][i] == p) continue;
dfs2(G[v][i], v);
}
}
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
llint u, v;
for(int i = 1; i <= n-1; i++){
cin >> u >> v;
G[u].push_back(v);
G[v].push_back(u);
E.push_back(make_pair(u, v));
}
cin >> s;
s = "#" + s;
dfs(1, -1);
dfs2(1, -1);
/*for(auto it = mp2.begin(); it != mp2.end(); it++){
cout << it->first.first << " " << it->first.second << " " << it->second << endl;
}*/
llint ans = 0;
for(int i = 1; i <= n; i++){
if(s[i] == '1'){
ans++;
vector<llint> vec;
if(G[i].size() <= 1) continue;
for(int j = 0; j < G[i].size(); j++) vec.push_back(mp[make_pair(i, G[i][j])]);
sort(vec.rbegin(), vec.rend());
ans += min(vec[0], vec[1]);
}
else{
vector<llint> vec; set<llint> S;
if(G[i].size() <= 1) continue;
for(int j = 0; j < G[i].size(); j++){
llint dep = mp[make_pair(i, G[i][j])], dep2 = mp2[make_pair(i, G[i][j])];
if(dep <= dep2) S.insert(dep);
vec.push_back(mp[make_pair(i, G[i][j])]);
}
sort(vec.rbegin(), vec.rend());
bool flag = (vec[0] == vec[1]);
vec.erase(unique(vec.begin(), vec.end()), vec.end());
llint mx = vec[0];
for(int j = 0; j < vec.size(); j++){
if(vec[i].first == mx){
if(flag) ans++;
}
else if(vec[i].second == 1) ans++;
}
}
}
for(int i = 0; i < E.size(); i++){
llint u = E[i].first, v = E[i].second;
llint umx = 0, vmx = 0;
for(int j = 0; j < G[u].size(); j++){
if(G[u][j] == v) continue;
umx = max(umx, mp[make_pair(u, G[u][j])]);
}
for(int j = 0; j < G[v].size(); j++){
if(G[v][j] == u) continue;
vmx = max(vmx, mp[make_pair(v, G[v][j])]);
}
llint d = min(umx, vmx);
//cout << d << endl;
bool flag = false;
for(int j = 0; j < G[u].size(); j++){
if(G[u][j] == v) continue;
if(mp[make_pair(u, G[u][j])] <= d && mp2[make_pair(u, G[u][j])] <= d) flag = true;
}
for(int j = 0; j < G[v].size(); j++){
if(G[v][j] == u) continue;
if(mp[make_pair(v, G[v][j])] <= d && mp2[make_pair(v, G[v][j])] <= d) flag = true;
}
if(umx == 0 && s[u] == '1' || vmx == 0 && s[v] == '1') flag = true;
if(flag) ans++;
//cout << u << " " << v << " " << flag << endl;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:126:43: error: request for member 'first' in 'vec.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
126 | if(vec[i].first == mx){
| ^~~~~
a.cc:129:48: error: request for member 'second' in 'vec.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
129 | else if(vec[i].second == 1) ans++;
| ^~~~~~
|
s614689994 | p03843 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <queue>
using namespace std;
#define N 200050
typedef long long ll;
int head[N],to[N<<1],nxt[N<<1],cnt,n,siz[N];
int mx[N],se[N],d[N];ll ans;
char w[N];
inline void add(int u,int v) {
to[++cnt]=v; nxt[cnt]=head[u]; head[u]=cnt;
}
void d1(int x,int y) {
int i;
siz[x]=w[x]-'0'; d[x]=w[x]=='0'?(1<<30):0;
for(i=head[x];i;i=nxt[i]) if(to[i]!=y) {
d1(to[i],x);
siz[x]+=siz[to[i]];
int v=mx[to[i]]+1;
if(v>mx[x]) se[x]=mx[x],mx[x]=v;
else if(v>se[x]) se[x]=v;
if(siz[to[i]]) d[x]=min(d[x],v);
}
}
void d2(int x,int y) {
int i;
if(d[x]<=(inf))ans+=min(se[x]+1,mx[x]-1)-d[x]+1;
for(i=head[x];i;i=nxt[i]) if(to[i]!=y) {
int v=(mx[to[i]]+1==mx[x])?(se[x]+1):(mx[x]+1);
if(v>mx[to[i]]) se[to[i]]=mx[to[i]],mx[to[i]]=v;
else if(v>se[to[i]]) se[to[i]]=v;
if(siz[1]-siz[to[i]]>0) d[to[i]]=min(d[to[i]],v);
d2(to[i],x);
}
}
int main() {
scanf("%d",&n);
int i,x,y;
for(i=1;i<n;i++) scanf("%d%d",&x,&y),add(x,y),add(y,x);
scanf("%s",w+1);
d1(1,0); d2(1,0);
printf("%lld\n",ans+1);
return 0;
}
| a.cc: In function 'void d2(int, int)':
a.cc:29:19: error: 'inf' was not declared in this scope; did you mean 'int'?
29 | if(d[x]<=(inf))ans+=min(se[x]+1,mx[x]-1)-d[x]+1;
| ^~~
| int
|
s810637888 | p03843 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <queue>
using namespace std;
#define N 200050
typedef long long ll;
int head[N],to[N<<1],nxt[N<<1],cnt,n,siz[N];
int mx[N],se[N];ll ans;
char w[N];
inline void add(int u,int v) {
to[++cnt]=v; nxt[cnt]=head[u]; head[u]=cnt;
}
void d1(int x,int y) {
int i;
siz[x]=w[x]-'0';
for(i=head[x];i;i=nxt[i]) if(to[i]!=y) {
d1(to[i],x);
siz[x]+=siz[to[i]];
int v=mx[to[i]]+1;
if(v>mx[x]) se[x]=mx[x],mx[x]=v;
else if(v>se[x]) se[x]=v;
}
}
void d2(int x,int y) {
int i;
ans+=min(se[x]+1,mx[x]-1)+1;
for(i=head[x];i;i=nxt[i]) if(to[i]!=y) {
int v=(mx[to[i]]+1==mx[x])?(se[x]+1):(mx[x]+1);
if(v>mx[to[i]]) se[to[i]]=mx[to[i]],mx[to[i]]=v;
else if(v>se[to[i]]) se[to[i]]=v;
d2(to[i],x);
}
}
int main() {
scanf("%d",&n);
int i,x,y;
for(i=1;i<n;i++) scanf("%d%d",&x,&y),add(x,y),add(y,x);
scanf("%s",w+1);
d1(1,0); d2(1,0);
printf("%lld\n",ans+1);
return ;
}
| a.cc: In function 'int main()':
a.cc:43:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
43 | return ;
| ^~~~~~
|
s361534021 | p03843 | C++ | #include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cassert>
#define ll long long
#define inf 1000000000
using namespace std;
inline int read(){
int re=0,flag=1;char ch=getchar();
while(ch>'9'||ch<'0'){
if(ch=='-') flag=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9') re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
return re*flag;
}
int n,dep[200010],disd[200010],disu[200010],mind[200010],exc[200010],w[200010];
int first[200010],cnte,fa[200010],siz[200010],high[200010],low[200010];
struct edge{
int to,next;
}a[400010];
inline void add(int u,int v){
a[++cnte]=(edge){v,first[u]};first[u]=cnte;
a[++cnte]=(edge){u,first[v]};first[v]=cnte;
}
void dfs(int u,int f){
int i,v;dep[u]=dep[f]+1;disd[u]=0;fa[u]=f;siz[u]=1;
mind[u]=inf;
if(((u==1&&first[u]==-1)||(u!=1&&a[first[u]].next==-1))){
mind[u]=(w[u]?0:inf);return;
}
for(i=first[u];~i;i=a[i].next){
v=a[i].to;if(v==f) continue;
dfs(v,u);
siz[u]+=siz[v];
disd[u]=max(disd[u],disd[v]+1);
mind[u]=min(mind[u],mind[v]+1);
}
if(w[u]) mind[u]=min(mind[u],disd[u]);
// cout<<"finish dfs "<<u<<' '<<f<<' '<<disd[u]<<' '<<mind[u]<<'\n';
}
vector<int>tmp;
void dfs2(int u,int f){
// cout<<"enter "<<u<<' '<<f<<'\n';
int i,v,maxn;tmp.clear();
disu[u]=max(disu[u],(f!=0)+disu[f]);
if(f) exc[u]=max(0,disu[u]-1);
// cout<<"dfs2 "<<u<<' '<<exc[u]<<' '<<disu[u]<<'\n';
maxn=-1;
for(i=first[u];~i;i=a[i].next){
v=a[i].to;if(v==f) continue;
disu[v]=max(disu[v],maxn+1);
maxn=max(maxn,disd[v]+1);
tmp.push_back(v);
}
maxn=-1;
for(i=tmp.size()-1;i>=0;i--){
v=tmp[i];
disu[v]=max(disu[v],maxn+1);
maxn=max(maxn,disd[v]+1);
}
for(i=first[u];~i;i=a[i].next) if((v=a[i].to)!=f) dfs2(v,u);
}
char s[200010];
int main(){
memset(first,-1,sizeof(first));int i,t1,t2,ans=0,u,v;
n=read();
for(i=1;i<n;i++){
t1=read();t2=read();
add(t1,t2);
}
scanf("%s",s);
for(i=0;i<n;i++) w[i+1]=(s[i]=='1');
dfs(1,0);dfs2(1,0);
for(u=1;u<=n;u++){
if(w[u]) low[u]=0;
else low[u]=min(mind[u],(u==1)?inf:disu[u]);
high[u]=max(disu[u],disd[u])-1;
for(i=first[u];~i;i=a[i].next){
v=a[i].to;
if(v==fa[u]) high[u]=min(high[u],disd[u]+1);
else high[u]=min(high[u],exc[v]+1);
}
// cout<<u<<' '<<high[u]<<' '<<low[u]<<'\n';
if(high[u]>=low[u]) ans+=high[u]-low[u]+1;
}
printf("%d\n",ans+1);
} | a.cc:44:1: error: 'vector' does not name a type
44 | vector<int>tmp;
| ^~~~~~
a.cc: In function 'void dfs2(int, int)':
a.cc:47:22: error: 'tmp' was not declared in this scope; did you mean 'tm'?
47 | int i,v,maxn;tmp.clear();
| ^~~
| tm
|
s067363959 | p03843 | C++ | #include<bits/stdc++.h>
using namespace std;
const int N=2e5+100;
int head[N],next[N],to[N],fa[N];
int sum[N],all;bool is[N];
int ans;
int one[N],two[N];
inline void dfs1(int k) {
sum[k]=is[k];
for (int i=head[k];i;i=next[i])
if (to[i]!=fa[k]) {
fa[to[i]]=k;
dfs1(to[i]);
if (one[to[i]]+1>one[k])
two[k]=one[k],one[k]=one[to[i]]+1;
else two[k]=max(two[k],one[to[i]]+1);
sum[k]+=sum[to[i]];
}
}
inline void dfs2(int k,int mx) {
int l=all-sum[k]?mx:1<<30,r,i,One=mx,Two=0;
for (i=head[k];i;i=next[i])
if (to[i]!=fa[k]) {
if (one[to[i]]+1>One)
Two=One,One=one[to[i]]+1;
else Two=max(Two,one[to[i]]+1);
if (sum[to[i]]) l=min(l,one[to[i]]+1);
}
r=One==Two?One-1:(One==Two+1?Two:Two+1);
if (is[k]) ans+=r+1;
else if (l<=r) ans+=r-l+1;
for (i=head[k];i;i=next[i])
if (to[i]!=fa[k])
dfs2(to[i],(one[to[i]]+1==One?Two:One)+1);
}
int main()
{
int n,i,a,b,tot=0;char c;
for (i=1,cin>>n;i<n;i++) {
cin>>a>>b;
to[++tot]=b,next[tot]=head[a],head[a]=tot;
to[++tot]=a,next[tot]=head[b],head[b]=tot;
}
for (i=1;i<=n;all+=is[i++]=c-'0') while ((c=getchar())<'0'||'9'<c);
dfs1(1);
dfs2(1,0);
cout<<ans+1<<endl;
return 0;
}
| a.cc: In function 'void dfs1(int)':
a.cc:10:32: error: reference to 'next' is ambiguous
10 | for (int i=head[k];i;i=next[i])
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:4:13: note: 'int next [200100]'
4 | int head[N],next[N],to[N],fa[N];
| ^~~~
a.cc: In function 'void dfs2(int, int)':
a.cc:22:28: error: reference to 'next' is ambiguous
22 | for (i=head[k];i;i=next[i])
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:4:13: note: 'int next [200100]'
4 | int head[N],next[N],to[N],fa[N];
| ^~~~
a.cc:32:28: error: reference to 'next' is ambiguous
32 | for (i=head[k];i;i=next[i])
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:4:13: note: 'int next [200100]'
4 | int head[N],next[N],to[N],fa[N];
| ^~~~
a.cc: In function 'int main()':
a.cc:41:29: error: reference to 'next' is ambiguous
41 | to[++tot]=b,next[tot]=head[a],head[a]=tot;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:4:13: note: 'int next [200100]'
4 | int head[N],next[N],to[N],fa[N];
| ^~~~
a.cc:42:29: error: reference to 'next' is ambiguous
42 | to[++tot]=a,next[tot]=head[b],head[b]=tot;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:4:13: note: 'int next [200100]'
4 | int head[N],next[N],to[N],fa[N];
| ^~~~
|
s210806208 | p03843 | C++ | #include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
int dp1[200000], dp2[200000];
int len1[200000], len2[200000];
string str;
vector<int>pat[200000];
vector<int>ko[200000];
bool flag[200000];
#define ROOT (num-1)
typedef pair<int, int>pii;
void dfs(int node)
{
if (flag[node])return;
flag[node] = true;
for (int i = 0; i < pat[node].size(); i++)
{
if (!flag[pat[node][i]])
{
ko[node].push_back(pat[node][i]);
dfs(pat[node][i]);
}
}
}
void calc1(int node)
{
for (int i = 0; i < ko[node].size(); i++)calc1(ko[node][i]);
int m1 = 0, m2 = 0, r1 = -1, r2 = -2;
for (int i = 0; i < ko[node].size(); i++)
{
int v = ko[node][i];
if (m1 < len1[v])
{
m2 = m1, r2 = r1;
m1 = len1[v], r1 = i;
}
else if (m2 < len1[v])m2 = len1[v], r2 = i;
}
len1[node] = m1 + 1;
int mini = 1000000000;
for (int i = 0; i < ko[node].size(); i++)
{
if (r1 != i)mini = min(mini, max(dp1[ko[node][i]] - 1, m1));
else mini = min(mini, max(dp1[ko[node][i]] - 1, m2));
}
if (str[node] == '1')mini = min(mini, m1);
dp1[node] = mini;
}
void calc2(int node)
{
vector<pii>m;
vector<int>zd;
for (int i = 0; i < ko[node].size(); i++)
{
m.push_back(make_pair(len1[ko[node][i]], i));
zd.push_back(dp1[ko[node][i]]);
}
if (node != ROOT)
{
m.push_back(make_pair(len2[node], m.size()));
zd.push_back(dp2[node]);
}
sort(m.begin(), m.end());
reverse(m.begin(), m.end());
int x = m.size();
for (int i = 0; i < ko[node].size(); i++)
{
int mini = 1000000000;
for (int j = 0; j < min(3, x); j++)
{
if (i == m[j].second)continue;
int maxi = 0;
for (int k = 0; k < min(3, x); k++)
{
if (i == m[k].second || m[j].second == m[k].second)continue;
maxi = max(maxi, m[k].first);
}
mini = min(mini, max(zd[m[j].second] - 1, maxi));
}
if (str[node] == '1')
{
if (m.size() == 1)mini = 0;
else if (m[0].second != i)mini = min(mini, m[0].first);
else mini = min(mini, m[1].first);
}
dp2[ko[node][i]] = mini;
int maxi = 0;
for (int j = 0; j < min(3, x); j++)
{
if (i == m[j].second)continue;
maxi = max(maxi, m[j].first);
}
len2[ko[node][i]] = maxi + 1;
}
for (int i = 0; i < ko[node].size(); i++)calc2(ko[node][i]);
}
int main()
{
int num;
scanf("%d", &num);
for (int i = 0; i < num - 1; i++)
{
int za, zb;
scanf("%d%d", &za, &zb);
za--, zb--;
pat[za].push_back(zb);
pat[zb].push_back(za);
}
cin >> str;
dfs(ROOT);
calc1(ROOT);
calc2(ROOT);
ll ans = 1;
//for (int i = 0; i < num; i++)printf("%d %d %d %d\n", len1[i], len2[i], dp1[i], dp2[i]);
for (int i = 0; i < num; i++)
{
vector<pii>m, d;
vector<int>zm, zd;
for (int j = 0; j < ko[i].size(); j++)
{
m.push_back(make_pair(len1[ko[i][j]],j));
d.push_back(make_pair(dp1[ko[i][j]],j));
zm.push_back(len1[ko[i][j]]);
zd.push_back(dp1[ko[i][j]]);
}
if (i != ROOT)
{
m.push_back(make_pair(len2[i], m.size()));
d.push_back(make_pair(dp2[i], d.size()));
zm.push_back(len2[i]);
zd.push_back(dp2[i]);
}
sort(m.begin(), m.end());
sort(d.begin(), d.end());
reverse(m.begin(), m.end());
ll ret = 0;
if (m.size() >= 2)if (str[i] == '1')ret += m[1].first;
int mini = 1000000000;
if (m.size() >= 3)
{
for (int j = 0; j < m.size(); j++)
{
vector<int>z;
for (int k = 0; k < 3; k++)
{
if (m[k].second != j)z.push_back(m[k].first);
}
int lb = max(zd[j] - 1, 0), ub = min(z[1] - 1, zm[j] - 1);
ret += max(0, ub - lb + 1);
mini = min(mini, max(lb, zm[j]));
}
if (str[i] == '0')ret += max(0, m[1].first - mini);
}
ll sum = 0;
for (int j = 0; j < m.size(); j++)if (zd[j] == 0)sum++;
ans += ret + sum;
//printf("%d %lld %lld\n", i + 1, ret, sum);
}
printf("%lld\n", ans);
} | a.cc: In function 'void calc2(int)':
a.cc:14:15: error: 'num' was not declared in this scope; did you mean 'enum'?
14 | #define ROOT (num-1)
| ^~~
a.cc:62:21: note: in expansion of macro 'ROOT'
62 | if (node != ROOT)
| ^~~~
|
s769385130 | p03844 | C++ | #include<iostream>
using namespace std;
int main() {
ll a, b;
char op;
cin >> a >> op >> b;
if (op == '+')cout << a + b << endl;
else cout << a - b << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'll' was not declared in this scope
4 | ll a, b;
| ^~
a.cc:6:16: error: 'a' was not declared in this scope
6 | cin >> a >> op >> b;
| ^
a.cc:6:27: error: 'b' was not declared in this scope
6 | cin >> a >> op >> b;
| ^
|
s163120147 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
int A, B;
string op;
cin >> A >> op >> B;
if (op = = "+")
{
cout << A + B << endl;
}
else
{
cout << A - B << endl;
}
} | a.cc: In function 'int main()':
a.cc:10:18: error: expected primary-expression before '=' token
10 | if (op = = "+")
| ^
|
s079686040 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin, s);
if(s.at(2) == "+"){
cout << (int)s.at(0) + (int)s.at(4);
}else{
cout << (int)s.at(0) - (int)s.at(4);
}
} | a.cc: In function 'int main()':
a.cc:7:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
7 | if(s.at(2) == "+"){
| ~~~~~~~~^~~~~~
|
s616697358 | p03844 | Java | import java.util.*;
class Main{
public static void main(String args[]){
Scanner s= new Scanner(System.in);
int a=s.nextInt();
String str=s.next().charAt(0);
//System.out.println(str);
int b=s.nextInt();
if(str=='+'){
System.out.println(a+b);
}else{
System.out.println(a-b);}
}
}
| Main.java:6: error: incompatible types: char cannot be converted to String
String str=s.next().charAt(0);
^
Main.java:10: error: bad operand types for binary operator '=='
if(str=='+'){
^
first type: String
second type: char
2 errors
|
s003554201 | p03844 | Java | import java.util.*;
class Main{
public static void main(String args[]){
Scanner s= new Scanner(System.in);
String str=s.next();
System.out.println(str);
int a=0;
int b=0;
int j=1;
char sym='';
for(int i=0;i<str.length();i++){
if(str.charAt(i)=='+' || str.charAt(i)=='-'){
int j=i;
sym=str.charAt(i);
break;
}
a=a*10+str.charAt(i)-'0';
}
for(int i=j+1;i<str.length();i++){
b=b*10+str.charAt(i)-'0';
}
if(sym=='+'){
System.out.println(a+b);
}else{
System.out.println(a-b);}
}
} | Main.java:10: error: empty character literal
char sym='';
^
1 error
|
s534716566 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int result;
result = 0;
getline(cin, s);
if(s.at(2) == "+"){
result = s.at(0) + s.at(4);
}
if(s.at(2) == "-"){
result = s.at(0) - s.at(4);
}
cout << result << endl;
}
| a.cc: In function 'int main()':
a.cc:10:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s.at(2) == "+"){
| ~~~~~~~~^~~~~~
a.cc:13:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | if(s.at(2) == "-"){
| ~~~~~~~~^~~~~~
|
s267447413 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int result;
getline(cin, s);
if(s.at(2) == '+'){
result = s.at(0) + s.at(4);
}
while{
result = s.at(0) - s.at(4);
}
cout << result << endl;
}
| a.cc: In function 'int main()':
a.cc:11:8: error: expected '(' before '{' token
11 | while{
| ^
| (
a.cc:11:8: error: expected primary-expression before '{' token
a.cc:11:8: error: expected ')' before '{' token
11 | while{
| ^
| )
|
s474310439 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int result;
getline(cin, s);
if(s.at(2) == '+'){
result = s.at(0) + s.at(4)
}
while{
reslt = s.at(0) - s.at(4)
}
cout << result << endl;
}
| a.cc: In function 'int main()':
a.cc:9:31: error: expected ';' before '}' token
9 | result = s.at(0) + s.at(4)
| ^
| ;
10 | }
| ~
a.cc:11:8: error: expected '(' before '{' token
11 | while{
| ^
| (
a.cc:11:8: error: expected primary-expression before '{' token
a.cc:11:8: error: expected ')' before '{' token
11 | while{
| ^
| )
a.cc:12:5: error: 'reslt' was not declared in this scope; did you mean 'result'?
12 | reslt = s.at(0) - s.at(4)
| ^~~~~
| result
|
s326462246 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
string op;
cin >> A >> op >> B;
if (op == "+") {
cout >> A + B >> endl;
els if(op == "-") {
cout >> A - B >> endl;
}
}
} | a.cc: In function 'int main()':
a.cc:10:8: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
10 | cout >> A + B >> endl;
| ~~~~ ^~ ~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:10:8: note: candidate: 'operator>>(int, int)' (built-in)
10 | cout >> A + B >> endl;
| ~~~~~^~~~~~~~
a.cc:10:8: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
from a.cc:1:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:10:3: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
10 | cout >> A + B >> endl;
| ^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)'
1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
| ^~~~~~~~
/usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
In file included from /usr/include/c++/14/istream:1109,
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:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:10:15: required from here
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)'
509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143:
/usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)'
76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)'
106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)'
137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)'
177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
10 | cout >> A + B >> endl;
| ^
/usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setprecision)'
207 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:207:5: note: template argument deduction/substitu |
s697219042 | p03844 | C | #include<stdio.h>
int main()
{
int a,b;
int op;
scanf("%d%c%d",&a,&op,&b);
if(op==+)
printf("%d",a+b);
else
printf("%d",a-b);
return 0;
} | main.c: In function 'main':
main.c:7:11: error: expected expression before ')' token
7 | if(op==+)
| ^
|
s974131599 | p03844 | C++ | #include <bits.stdc++.h>
using namespace std;
int main(){
int A, B;
string op;
cin>>A>>op>>B;
int ans;
if(op=='+'){
ans = A+B;
}
else{
ans = A-B;
}
cout<<ans<<endl;
} | a.cc:1:10: fatal error: bits.stdc++.h: No such file or directory
1 | #include <bits.stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s933320605 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b;
char c;
cin<<a<<c<<b;
if(c=='+')
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
6 | cin<<a<<c<<b;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:6:6: note: candidate: 'operator<<(int, int)' (built-in)
6 | cin<<a<<c<<b;
| ~~~^~~
a.cc:6:6: 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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
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:6:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
6 | cin<<a<<c<<b;
| ^~~
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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: required from here
6 | cin<<a<<c<<b;
| ^
/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)
| ^~~~~~~~
|
s420028400 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
string op;
cin<<a<<op<<b;
if(op=='+')
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
7 | cin<<a<<op<<b;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:7:6: note: candidate: 'operator<<(int, int)' (built-in)
7 | cin<<a<<op<<b;
| ~~~^~~
a.cc:7:6: 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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
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:7:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
7 | cin<<a<<op<<b;
| ^~~
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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<op<<b;
| ^
/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:7:8: required from here
7 | cin<<a<<op<<b;
| ^
/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:9:8: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if(op=='+')
| ~~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: |
s122766728 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
string c;
cin<<a<<c<<b;
if(c=='+')
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
7 | cin<<a<<c<<b;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:7:6: note: candidate: 'operator<<(int, int)' (built-in)
7 | cin<<a<<c<<b;
| ~~~^~~
a.cc:7:6: 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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
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:7:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
7 | cin<<a<<c<<b;
| ^~~
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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: required from here
7 | cin<<a<<c<<b;
| ^
/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:9:7: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if(c=='+')
| ~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument ded |
s349361547 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b;
char c;
cin<<a<<c<<b;
if(c=='+')
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
6 | cin<<a<<c<<b;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:6:6: note: candidate: 'operator<<(int, int)' (built-in)
6 | cin<<a<<c<<b;
| ~~~^~~
a.cc:6:6: 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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
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:6:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
6 | cin<<a<<c<<b;
| ^~~
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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin<<a<<c<<b;
| ^
/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:6:8: required from here
6 | cin<<a<<c<<b;
| ^
/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)
| ^~~~~~~~
|
s590781897 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
string c;
cin<<a<<c<<b;
if(c=="+")
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
7 | cin<<a<<c<<b;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:7:6: note: candidate: 'operator<<(int, int)' (built-in)
7 | cin<<a<<c<<b;
| ~~~^~~
a.cc:7:6: 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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
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:7:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
7 | cin<<a<<c<<b;
| ^~~
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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<c<<b;
| ^
/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:7:8: required from here
7 | cin<<a<<c<<b;
| ^
/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)
| ^~~~~~~~
|
s357737813 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b;
char c;
cout<<a<<c<<b;
if(c=="+")
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:7: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if(c=="+")
| ~^~~~~
|
s596385382 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
string c;
cout<<a<<c<<b;
if(c=='+')
cout<<a+b;
else
cout<<a-b;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:7: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if(c=='+')
| ~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
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:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
9 | if(c=='+')
| ^~~
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:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
9 | if(c=='+')
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(c=='+')
| ^~~
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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
9 | if(c=='+')
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/string_view:644: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>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755: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>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: mismatched types 'const _CharT*' and 'char'
9 | if(c=='+')
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
9 | if(c=='+')
| ^~~
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:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
9 | if(c=='+')
| ^~~
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:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:9:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
9 | if(c=='+')
| ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
from /usr/include/c++/14/bits/allocator.h:46:
/usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<char>&, const __new_allocator<_Tp>&)'
215 | operator==(const __new_allocator&, const __new_allocator<_Up>&)
| ^~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:215:9: note: template argument deduction/substitution failed:
a.cc:9:9: note: mismatched types 'const std::__new_allocator<_Tp>' and 'char'
9 | if(c=='+')
|
s807292766 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main()
{
int A,B;
char C;
cin>>A>>C>>B;
if(C=='+'){
cout<<A+B;
}
else(C=='-'){
cout<<A-B;
}
} | a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before '{' token
12 | else(C=='-'){
| ^
| ;
|
s066575102 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main()
{
int A,B;
char C;
cin>>A>>C>>B;
if(C=='+'){
cout<<A+B;
}
else(C=='-'){
cout<<A-B;
}
} | a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before '{' token
12 | else(C=='-'){
| ^
| ;
|
s344373511 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main()
{
int A,B;
char C;
cin<<A<<C<<B;
if(C=='+'){
cout<<A+B;
}
else(C=='-'){
cout<<A-B;
}
} | a.cc: In function 'int main()':
a.cc:8:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin<<A<<C<<B;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:6: note: candidate: 'operator<<(int, int)' (built-in)
8 | cin<<A<<C<<B;
| ~~~^~~
a.cc:8:6: 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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
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:8:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
8 | cin<<A<<C<<B;
| ^~~
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: required from here
8 | cin<<A<<C<<B;
| ^
/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:12:15: error: expected ';' before '{' token
12 | else(C=='-'){
| ^
| ;
|
s402117117 | p03844 | C++ | #include<iostream>
#include<string>
using namespace std;
int main()
{
int A,B;
char C;
cin<<A<<C<<B;
if(C=="+"){
cout<<A+B;
}
else(C=="-"){
cout<<A-B;
}
} | a.cc: In function 'int main()':
a.cc:8:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin<<A<<C<<B;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:6: note: candidate: 'operator<<(int, int)' (built-in)
8 | cin<<A<<C<<B;
| ~~~^~~
a.cc:8:6: 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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
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:8:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
8 | cin<<A<<C<<B;
| ^~~
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<A<<C<<B;
| ^
/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:8:8: required from here
8 | cin<<A<<C<<B;
| ^
/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:9:7: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(C=="+"){
| ~^~~~~
a.cc:12:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | else(C=="-"){
| ~^~~~~
a.cc:12:15: error: expected ';' before '{' token
12 | else(C=="-"){
| ^
| ;
|
s906057927 | p03844 | C++ | #include <iostream>
#include <string>
using namespace std;
int main () {
int a, op, b;
cin >> a >> op >> b;
if (a == '+')
cout << a + b;
else if (a == "-")
cout << a - b;
} | a.cc: In function 'int main()':
a.cc:11:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | else if (a == "-")
| ~~^~~~~~
|
s965330309 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
char op;
cin >> a >> op >> b;
if(op=='+')
cout << a+b << endl;
elase
cout << a-b <<endl;
} | a.cc: In function 'int main()':
a.cc:9:3: error: 'elase' was not declared in this scope
9 | elase
| ^~~~~
|
s874322245 | p03844 | C++ | #include <bits/stdc++.h>
usng namespace std;
int main(){
int a,b;
char op;
cin >> a >> op >> b;
if(op=='+')
cout << a+b << endl;
elase
cout << a-b <<endl;
} | a.cc:2:1: error: 'usng' does not name a type
2 | usng namespace std;
| ^~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin >> a >> op >> b;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
8 | cout << a+b << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:8:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
8 | cout << a+b << endl;
| ^~~~
| std::endl
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:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:9:3: error: 'elase' was not declared in this scope
9 | elase
| ^~~~~
|
s201516297 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
string op;
cin >> a >> op >> b;
if (op == '+') {
cout << a + b << endl;
}
if (op == '-') {
cout << a - b << endl;
}
}
| a.cc: In function 'int main()':
a.cc:10:12: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
10 | if (op == '+') {
| ~~ ^~ ~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
10 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
10 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
10 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
10 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
10 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
10 | if (op == '+') {
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:10:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
10 | if (op == '+') {
| |
s878000275 | p03844 | C++ | k#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
string op;
cin >> a >> op >> b;
if (op == '+') {
cout << a + b << endl;
}
if (op == '-') {
cout << a - b << endl;
}
}
| a.cc:1:2: error: stray '#' in program
1 | k#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'k' does not name a type
1 | k#include <bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:6:5: error: 'string' was not declared in this scope
6 | string op;
| ^~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
8 | cin >> a >> op >> b;
| ^~~
a.cc:8:17: error: 'op' was not declared in this scope
8 | cin >> a >> op >> b;
| ^~
a.cc:11:9: error: 'cout' was not declared in this scope
11 | cout << a + b << endl;
| ^~~~
a.cc:11:26: error: 'endl' was not declared in this scope
11 | cout << a + b << endl;
| ^~~~
a.cc:15:9: error: 'cout' was not declared in this scope
15 | cout << a - b << endl;
| ^~~~
a.cc:15:26: error: 'endl' was not declared in this scope
15 | cout << a - b << endl;
| ^~~~
|
s877071231 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
char k;
cin>>a>>b>>'k';
if('k'==+){
cout<<a+b<<'\n';
}
if('k'==-){
cout<<a-b<<'\n';
}
return(0);
}
| a.cc: In function 'int main()':
a.cc:6:12: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'char')
6 | cin>>a>>b>>'k';
| ~~~~~~~~~^~~~~
| | |
| | char
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'char'
6 | cin>>a>>b>>'k';
| ^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: invalid conversion from 'char' to 'void*' [-fpermissive]
6 | cin>>a>>b>>'k';
| ^~~
| |
| char
a.cc:6:14: error: cannot bind rvalue '(void*)107' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: invalid conversion from 'char' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
6 | cin>>a>>b>>'k';
| ^~~
| |
| char
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:14: error: invalid conversion from 'char' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive]
6 | cin>>a>>b>>'k';
| ^~~
| |
| char
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^ |
s306845225 | p03844 | C++ | int main() {
int A,B;
char op;
cin >> A >> op >> B;
if(op=='+'){
cout << A + B << endl;
}
if(op=='-'){
cout << A - B << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
4 | cin >> A >> op >> B;
| ^~~
a.cc:6:5: error: 'cout' was not declared in this scope
6 | cout << A + B << endl;
| ^~~~
a.cc:6:22: error: 'endl' was not declared in this scope
6 | cout << A + B << endl;
| ^~~~
a.cc:9:5: error: 'cout' was not declared in this scope
9 | cout << A - B << endl;
| ^~~~
a.cc:9:22: error: 'endl' was not declared in this scope
9 | cout << A - B << endl;
| ^~~~
|
s253614825 | p03844 | C | #include<stdio.h>
int main(){
int a,b;
char op;
scanf("%d%c%d".&a,&op,&b);
int sum;
if(op=='+'){
sum=a+b;
}else{
sum=a-b;
}
printf("%d\n",sum);
return 0;
} | main.c: In function 'main':
main.c:6:20: error: expected identifier before '&' token
6 | scanf("%d%c%d".&a,&op,&b);
| ^
|
s126811921 | p03844 | C | #include<stdio.h>
int main(){
int a,b;
char op;
scanf("%d%c%d".&a,&op,&b);
if(op=='+'){
int sum=a+b;
}else{
int sum=a-b;
}
printf("%d\n",sum);
return 0;
} | main.c: In function 'main':
main.c:6:20: error: expected identifier before '&' token
6 | scanf("%d%c%d".&a,&op,&b);
| ^
main.c:13:19: error: 'sum' undeclared (first use in this function)
13 | printf("%d\n",sum);
| ^~~
main.c:13:19: note: each undeclared identifier is reported only once for each function it appears in
|
s940574820 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
string op;
cin >> A >> op >> B;
int answer;
if (op == '+') {
answer = A + B;
}
else if (op == '-') {
answer = A - B;
}
cout << answer << endl;
// ここにプログラムを追記
} | a.cc: In function 'int main()':
a.cc:11:10: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
11 | if (op == '+') {
| ~~ ^~ ~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
11 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
11 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
11 | if (op == '+') {
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
11 | if (op == '+') {
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
11 | if (op == '+') {
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'te |
s243087390 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
string op;
cin >> A >> op >> B;
int answer;
if (op == '+')
answer = A + B;
else if (op == '-')
answer = A - B;
cout << answer << endl;
// ここにプログラムを追記
} | a.cc: In function 'int main()':
a.cc:11:10: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
11 | if (op == '+')
| ~~ ^~ ~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
11 | if (op == '+')
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
11 | if (op == '+')
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if (op == '+')
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
11 | if (op == '+')
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
11 | if (op == '+')
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:11:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
11 | if (op == '+')
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits |
s064546895 | p03844 | C++ | #include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
int A, B, ans;
string x;
cin >> A >> x >> B;
if (x == "+") {
ans = A + B;
}
else if (x == "-") {
ans = A - B;
}
cout << ans;
} | a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s933663980 | p03844 | C++ | a, op, b = input().split()
if op = '+':
ans = int(a)+int(b)
else:
ans = int(a) - int(b)
print(ans) | a.cc:1:1: error: 'a' does not name a type
1 | a, op, b = input().split()
| ^
|
s617166096 | p03844 | C++ | #include <iostream>
using namespace std;
int A, B;
char op;
cin >> A >> op >> B;
if ( op == '+' ){
cout << A + B << '\n';
} else if ( op == '-' ) {
cout << A - B << '\n';
} | a.cc:6:1: error: 'cin' does not name a type
6 | cin >> A >> op >> B;
| ^~~
a.cc:7:1: error: expected unqualified-id before 'if'
7 | if ( op == '+' ){
| ^~
a.cc:9:3: error: expected unqualified-id before 'else'
9 | } else if ( op == '-' ) {
| ^~~~
|
s263979960 | p03844 | C++ | #include <iostream>
using namespace std;
int A, B;
string op;
cin >> A >> op >> B;
if ( op == "+" ){
cout << A + B << '\n';
} else if ( op == "-" ) {
cout << A - B << '\n';
} | a.cc:6:1: error: 'cin' does not name a type
6 | cin >> A >> op >> B;
| ^~~
a.cc:7:1: error: expected unqualified-id before 'if'
7 | if ( op == "+" ){
| ^~
a.cc:9:4: error: expected unqualified-id before 'else'
9 | } else if ( op == "-" ) {
| ^~~~
|
s561234521 | p03844 | C++ | #include <iostream>
using namespace std;
int A, B;
string op;
cin >> A >> B >> op;
if ( op == "+" ){
cout << A + B << '\n';
} else if ( op == "-" ) {
cout << A - B << '\n';
} | a.cc:6:1: error: 'cin' does not name a type
6 | cin >> A >> B >> op;
| ^~~
a.cc:7:1: error: expected unqualified-id before 'if'
7 | if ( op == "+" ){
| ^~
a.cc:9:4: error: expected unqualified-id before 'else'
9 | } else if ( op == "-" ) {
| ^~~~
|
s817875220 | p03844 | C++ | #include <iostream>
using namespace std;
int A, B;
char op;
cin >> A >> B >> op;
if ( op == '+' ){
cout << A + B << '\n';
} else if ( op == '-' ) {
cout << A - B << '\n';
} | a.cc:6:1: error: 'cin' does not name a type
6 | cin >> A >> B >> op;
| ^~~
a.cc:7:1: error: expected unqualified-id before 'if'
7 | if ( op == '+' ){
| ^~
a.cc:9:4: error: expected unqualified-id before 'else'
9 | } else if ( op == '-' ) {
| ^~~~
|
s238321354 | p03844 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a, b;
char op;
int c = 0
cin >> a >> b;
if(op == '+') c = (a + b);
else if(op == '-') c = (a - b);
cout << c << endl;
}
| a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'cin'
8 | cin >> a >> b;
| ^~~
|
s362877624 | p03844 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a, b;
char op;
int c = 0
cin >> a >> op >> b;
if(op == '+') c = (a + b);
else if(op == '-') c = (a - b);
cout << c << endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'cin'
8 | cin >> a >> op >> b;
| ^~~
|
s035554626 | p03844 | 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
|
s837721813 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b;
char x;
cin>>a>>x>>b;
cout<<axb;
} | a.cc:1:1: error: '\U0000ff03include' does not name a type
1 | #include<iostream>
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin>>a>>x>>b;
| ^~~
a.cc:8:9: error: 'cout' was not declared in this scope
8 | cout<<axb;
| ^~~~
a.cc:8:15: error: 'axb' was not declared in this scope
8 | cout<<axb;
| ^~~
|
s689582499 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b;
char op;
cin>>a>>>>op>>b;
if(op=='+')
cout<<a+b;
else
cout<<a-b;
} | a.cc: In function 'int main()':
a.cc:6:11: error: expected primary-expression before '>>' token
6 | cin>>a>>>>op>>b;
| ^~
|
s141757282 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
char op;
cin >> A >> op >> B;
if (op == "+") {
cout << A + B << endl;
}
else {
cout << A - B << endl;
}
} | a.cc: In function 'int main()':
a.cc:8:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if (op == "+") {
| ~~~^~~~~~
|
s715033404 | p03844 | C++ | #include <iosream>
using namespace std;
int main(){
int a, b;
char op;
cin>> a >> op >> b;
if(op == '+')
cout << a + b << endl;
else cout << a-b << endl;
return 0;
} | a.cc:1:10: fatal error: iosream: No such file or directory
1 | #include <iosream>
| ^~~~~~~~~
compilation terminated.
|
s579734595 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,N) for(int i=0; i<N; i++){ ;
int main() {
int A;
string op;
int B;
cin>>A>>op>>B;
if(op=='+'){
cout<<A+B<<endl;
}
else
{
cout<<A-B<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:10:9: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
10 | if(op=='+'){
| ~~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
10 | if(op=='+'){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
10 | if(op=='+'){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
10 | if(op=='+'){
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
10 | if(op=='+'){
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
10 | if(op=='+'){
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
10 | if(op=='+'){
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_Char |
s877140610 | p03844 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int a,b,res;
char c;
cin>>a>>c>>b;
if(c == '+'){
res = a + b;
cout<<res<<endl;
}
else{
res = a-b;
cout<<res<<endl;
} | a.cc: In function 'int main()':
a.cc:18:4: error: expected '}' at end of input
18 | }
| ^
a.cc:6:1: note: to match this '{'
6 | {
| ^
|
s776555059 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int A , C ;
char B;
cin >> A >> B >> C;
if ( B == '+' ){
cout << A+C << endl;
}else if ( B == '-' ){
cout << A-C << endl;
} | a.cc: In function 'int main()':
a.cc:12:4: error: expected '}' at end of input
12 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s347694414 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int A , C ;
char B;
cin >> A >> B >> C;
int sum ;
if ( B == '+' ){
cout << A+C << endl;
}else if ( B == '-' ){
cout << A-C << endl;
} | a.cc: In function 'int main()':
a.cc:13:4: error: expected '}' at end of input
13 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s510412100 | p03844 | C | #include<cstdio>
using namespace std;
int ans,a,b;
char op,stp1,stp2;
int main(){
scanf("%d",&a);
scanf("%c",&stp1);
scanf("%c",&op);
scanf("%c",&stp2);
scanf("%d",&b);
if (op=='+'){
ans=a+b;
}else if (op=='-'){
ans=a-b;
}
printf("%d",ans);
return 0;} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s665259280 | p03844 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
ll a,b;
char c;
cin>>a>>c>>b;
if(c=='+'){
cout<<a+b<<'\n';
}
else{
cout<<a-b<<'\n';
}
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'll' was not declared in this scope
4 | ll a,b;
| ^~
a.cc:6:14: error: 'a' was not declared in this scope
6 | cin>>a>>c>>b;
| ^
a.cc:6:20: error: 'b' was not declared in this scope
6 | cin>>a>>c>>b;
| ^
|
s326755400 | p03844 | C | #include<bits/stdc++.h>
using namespace std;
int i,j;char c;
int main(){
scanf("%d %c %d",&i,&c,&j);
if (c=='+') printf("%d\n",i+j);
else printf("%d\n",i-j);
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s512175415 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string a,b;
char op;
cin >>a>>op>>b;
if(op=='+')
cout<<a+b<<endl;
else
cout<<a-b<<endl;
}
| a.cc: In function 'int main()':
a.cc:12:12: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
12 | cout<<a-b<<endl;
| ~^~
| | |
| | basic_string<[...]>
| basic_string<[...]>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
12 | cout<<a-b<<endl;
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
12 | cout<<a-b<<endl;
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:12:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
12 | cout<<a-b<<endl;
| ^
|
s976766005 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b; int ans;
char op;
cin>>a>>op>>b;
if( op =="+") ans = a+b;
else if( op =="-") ans = a-b;
cout<<ans;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if( op =="+") ans = a+b;
| ~~~^~~~~
a.cc:9:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | else if( op =="-") ans = a-b;
| ~~~^~~~~
|
s596918211 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b; int ans;
char op;
cin>>a>>op>>b;
if(char op=="+") ans = a+b;
else if(char op=="-") ans = a-b;
cout<<ans:
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:17: error: expected initializer before '==' token
8 | if(char op=="+") ans = a+b;
| ^~
a.cc:8:17: error: expected ')' before '==' token
8 | if(char op=="+") ans = a+b;
| ~ ^~
| )
a.cc:9:23: error: expected initializer before '==' token
9 | else if(char op=="-") ans = a-b;
| ^~
a.cc:9:23: error: expected ')' before '==' token
9 | else if(char op=="-") ans = a-b;
| ~ ^~
| )
a.cc:10:18: error: expected ';' before ':' token
10 | cout<<ans:
| ^
| ;
|
s337300769 | p03844 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b; int ans;
char op;
cin>>a>>op>>b;
if(char=="+") ans = a+b;
else if(char=="-") ans = a-b;
cout<<ans:
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:14: error: expected unqualified-id before '==' token
8 | if(char=="+") ans = a+b;
| ^~
a.cc:9:20: error: expected unqualified-id before '==' token
9 | else if(char=="-") ans = a-b;
| ^~
a.cc:10:18: error: expected ';' before ':' token
10 | cout<<ans:
| ^
| ;
|
s375391005 | p03844 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
int a,b; int ans;
char op;
cin>>a>>op>>b;
if(char=="+") ans = a+b;
if(char=="-") ans = a-b;
if(char=="*") ans = a*b;
if(char=="/") ans = a/b;
cout<<ans:
return 0;
}
| a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s240046340 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
//初期宣言と型の設定
int A, B, C;
string op;
//入力部
cin >> A >> op >> B;
if(op=="+"){
C=A+B;
}
else if(op=="-"){
C=A-B;
}
else{
cout <<"error"<< endl
}
cout << C << endl;
}
| a.cc:7:3: error: extended character is not valid in an identifier
7 | int A, B, C;
| ^
a.cc: In function 'int main()':
a.cc:7:3: error: 'int\U00003000A' was not declared in this scope
7 | int A, B, C;
| ^~~~~~
a.cc:7:11: error: 'B' was not declared in this scope
7 | int A, B, C;
| ^
a.cc:7:14: error: 'C' was not declared in this scope
7 | int A, B, C;
| ^
a.cc:11:10: error: 'A' was not declared in this scope
11 | cin >> A >> op >> B;
| ^
a.cc:20:26: error: expected ';' before '}' token
20 | cout <<"error"<< endl
| ^
| ;
21 | }
| ~
|
s872765841 | p03844 | C++ | eval(input().replace(" ", "")) | a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
1 | eval(input().replace(" ", ""))
| ^
|
s271552999 | p03844 | C++ | /********include********/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
/***/
//#include <iomanip>
//#include <cmath>
#include <bits/stdc++.h>
/********define********/
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define rrep(i,x) for(long long i=x-1;i>=0;i--)
#define rrepn(i,x) for(long long i=x;i>1;i--)
#define REP(i,n,x) for(long long i=n;i<x;i++)
#define REPN(i,n,x) for(long long i=n+1;i<x;i++)
#define pr printf
#define re return
#define mod 1000000007
//#define mod 998244353
#define INF 1e18+5//19桁
const double PI=3.14159265358979323846;
#define fi first
#define se second
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
typedef pair<long long, long long> P;
/********128bit CFではコンパイルNG********/
/*
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
if (s) {
__uint128_t tmp = value < 0 ? -value : value;
char buffer[128];
char *d = std::end(buffer);
do {
--d;
*d = "0123456789"[tmp % 10];
tmp /= 10;
} while (tmp != 0);
if (value < 0) {
--d;
*d = '-';
}
int len = std::end(buffer) - d;
if (dest.rdbuf()->sputn(d, len) != len) {
dest.setstate(std::ios_base::badbit);
}
}
return dest;
}
__int128 parse(string &s) {
__int128 ret = 0;
for (int i = 0; i < s.length(); i++)
if ('0' <= s[i] && s[i] <= '9')
ret = 10 * ret + s[i] - '0';
return ret;
}
*/
/********よく使う関数********/
// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
vector<pair<long long, long long> > res;
for (long long p = 2; p * p <= n; ++p) {
if (n % p != 0) continue;
int num = 0;
while (n % p == 0) { ++num; n /= p; }
res.push_back(make_pair(p, num));
}
if (n != 1) res.push_back(make_pair(n, 1));
return res;
}
// 約数列挙
vector<long long> calc_divisor(long long n) {
vector<long long> res;
for (long long i = 1LL; i*i <= n; ++i) {
if (n % i == 0) {
res.push_back(i);
long long j = n / i;
if (j != i) res.push_back(j);
}
}
sort(res.begin(), res.end());
return res;
}
//最大公約数
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
//最大公約数 複数個
ll gcd(const vector<ll> &v) {
ll ret = v[0];
for (ll i = 1; i < v.size(); i++)
ret = gcd(ret, v[i]);
return ret;
}
//最小公倍数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//最小公倍数 複数個
ll lcm(const vector<ll> &v) {
ll ret = v[0];
for (ll i = 1; i < v.size(); i++)
ret = lcm(ret, v[i]);
return ret;
}
//大文字→小文字
void to_lower(string& x) {
for (ll i = 0; i < x.length(); i++) if ('A' <= x[i] && x[i] <= 'Z') {
x[i] -= 'A' - 'a';
}
}
//小文字→大文字
void to_bigger(string& x) {
for (ll i = 0; i < x.length(); i++) if ('a' <= x[i] && x[i] <= 'z') {
x[i] += 'A' - 'a';
}
}
/********変数宣言********/
//vector<long long> g[200020];
vector<pair<long long,long long>> g[200020];
ll s[200020];
bool used[200020];
//bool dp[100005];
ll A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,V,W,X,Y,Z;
double dA,dB,dC,dH,dK,dM,dN,dQ,dR,dS,dT,dW,dX,dY;
//1000000000000000000 //10^18
//1000000000 //10^9
//ABCDEFGHIJKLMNOPQRSTUVWXYZ //26
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
/********よく使う********/
/*ベクター*/
//std::sort(v.begin(),v.end());//昇順ソート
//sort(all(v));
//std::sort(v.begin(),v.end(),std::greater<long long>());//降順ソート
//v.erase(unique(v.begin(), v.end()), v.end());
//vector<ll> v(N, 0);
/*ペア*/
//vector<pair<long long, long long> > p(N);
//sort(p.begin(), p.end());
//sort(p.begin(), p.end(),greater<pair<long long,long long> >());
/*プライオリティキュー*/
//priority_queue<long long, vector<long long>, greater<long long> > que;
//priority_queue<long long> que;
/*マップ*/
//map<ll, ll, std::greater<ll>> mp;
/*デキュー*/
//deque<long long> dque;
/*文字列*/
//string s;
//wk=(ll)stoi(s);
//string t;
//t=s.substring(0,1);//0文字目から1つ取り出す
//if(s.size()%2==0 && s.substr(0,s.size()/2)==s.substr((s.size())/2))//引数一つの時はその個所から最後まで
//s.insert(0, " ");
//reverse(s.begin(),s.end());
//s+="-AI";
//s+=char('a'+N%26);
//string t;
//t=s.substr(s.size()-2);
//to_bigger(t);//返り値無し
//cout << s.substr(0,s.size()-2)+t << "\n";
/*セット*/
//set<ll> st;
/*スタック*/
//stack<long long> sta;
/*キュー*/
//queue<long long> que;
/*パミュ*/
//do{
//}while(next_permutation(v.begin(),v.end()));
/*でかい数*/
//__int128 aa = 1;
/******初期化***********/
long long ans,ans1,ans2,ans3,ans4;
long long sum,sum1,sum2,sum3,sum4;
long long cnt,cnt1,cnt2,cnt3,cnt4;
long long flg,flg1,flg2,flg3,flg4;
long long wk,wk1,wk2,wk3,wk4;
long long max,max1,max2,max3,max4;
long long min,min1,min2,min3,min4;
ans=ans1=ans2=ans3=ans4=0;
sum=sum1=sum2=sum3=sum4=0;
cnt=cnt1=cnt2=cnt3=cnt4=0;
flg=flg1=flg2=flg3=flg4=0;
wk=wk1=wk2=wk3=wk4=0;
max=max1=max2=max3=max4=0;
min=min1=min2=min3=min4=INF;
double dwk,dwk1,dwk2,dwk3,dwk4;
double dsum,dsum1,dsum2,dsum3,dsum4;
double dans,dans1,dans2,dans3,dans4;
dwk=dwk1=dwk2=dwk3=dwk4=0;
dsum=dsum1=dsum2=dsum3=dsum4=0;
dans=dans1=dans2=dans3=dans4=0;
cin >> A;
string s;
cin >> s;
cin >> B;
if(s=='+'){
pr("%lld",A+B);
}
else{
pr("%lld",A-B);
}
/*
cin >> N;
vector<ll>v(N);
rep(i,N){
cin >> v[i];
}
*/
/******出力関連***********/
//pr("%lld\n",N);
//printf("%lld",(ll)ceil(dB/dA));
//puts("Yes");
//文字列の出力
//std::cout << s << std::endl;
//printf("%.12f\n",ret);
//cout << sum << '\n';
//pr("%02lld:%02lld",wk/60,wk%60);
/******CF***********/
/*
cin >> T;
while(T--){
cin >> N >> K;
std::vector<long long> v(N);
// 配列入力1
/*
for(long long i=0; i<N; i++){
std::cin >> v[i];
}
*/
//cout << sum << '\n';
//文字列の出力
//std::cout << s << std::endl;
/*ラベル
goto end;
end:
*/
//}
//re 0;
/******よく使う***********/
//素因数分解
//1の場合pfは空 5の場合pfはfi=5,se=1
/*
auto pf = prime_factorize(v[i]);
for(auto p:pf){
if(p.se!=wk){
}
}
*/
//約数列挙
/*
vector<long long> div = calc_divisor(M);
// M の約数 d であって、d * N <= M となる最大の d を求める
long long res = 1;
for (auto d : div) {
if (d * N <= M) res = max(res, d);
}
*/
//最小公倍数
/*
std::vector<ll> v(N);
rep(i, N) {
cin >> v[i];
}
cout << lcm(v) << endl;
return 0;
*/
//最小公約数
/*
std::vector<ll> v(N);
rep(i, N) {
cin >> v[i];
}
cout << gcd(v) << endl;
return 0;
*/
//素数判定
/*
for(int i=x; ; i++){
bool dame=0;
for(int j=2; j*j<=i; j++){
if(i%j==0){
dame=1;
break;
}
}
if(!dame){
cout<<i<<endl;
return 0;
}
}
*/
//set典型
/*
std::set<long long> st;
for(long long i=0; i<N; i++){
std::cin >> v[i];
if(st.find(v[i])==st.end()){
st.insert(v[i]);
}
else{s
st.erase(v[i]);
}
}
//整数判定
//if(ceil(sqrt(wk)==floor(sqrt(wk))))
//パミュ
/*
sort(v.begin(),v.end());
do{
}while(next_permutation(v.begin(),v.end()));
*/
//26進数
/*
string s;
while(N>=0){
s+=char('a'+N%26);
N/=26;
N--;
}
reverse(all(s));
*/
/******出力関連***********/
//pr("%lld\n",N);
//printf("%lld",(ll)ceil(dB/dA));
//puts("Yes");
//文字列の出力
//std::cout << s << std::endl;
//printf("%.12f\n",ret);
//cout << sum << '\n';
//pr("%02lld:%02lld",wk/60,wk%60);
re 0;
}
| a.cc: In function 'int main()':
a.cc:259:13: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
259 | if(s=='+'){
| ~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:29:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
259 | if(s=='+'){
| ^~~
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:5:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
259 | if(s=='+'){
| ^~~
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:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
259 | if(s=='+'){
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
259 | if(s=='+'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
259 | if(s=='+'){
| ^~~
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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
259 | if(s=='+'){
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:259:15: note: 'std::__cxx11::basic_string<char>' is not derived f |
s395574376 | p03844 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
String b=sc.next();
int c=sc.nextInt();
if(b.equals("+")) System.out.println(a+c);
else System.out.println(a-b);
}
} | Main.java:10: error: bad operand types for binary operator '-'
else System.out.println(a-b);
^
first type: int
second type: String
1 error
|
s457282630 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,ans;
string op;
cin>>x>>op>>y;
if(op=="+"){
ans=a+b;
}else{
ans=a-b;
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:7:14: error: 'x' was not declared in this scope
7 | cin>>x>>op>>y;
| ^
a.cc:7:21: error: 'y' was not declared in this scope
7 | cin>>x>>op>>y;
| ^
|
s428233670 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a , b ;
char c ;
scanf("%lld %c %lld", &a , &c , &b);
if(c == '+'){
cout << a + b << endl;
return;
}
cout << (a - b) << endl;
} | a.cc: In function 'int main()':
a.cc:11:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
11 | return;
| ^~~~~~
|
s233120479 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
ll a.b;
char op;
cin >> a >> op >> b;
if(op=='+')
{
cout << a+b << endl;
return 0;
}else
{
cout << a-b << endl;
return 0;
}
} | a.cc: In function 'int main()':
a.cc:19:9: error: expected initializer before '.' token
19 | ll a.b;
| ^
a.cc:21:12: error: 'a' was not declared in this scope
21 | cin >> a >> op >> b;
| ^
a.cc:21:23: error: 'b' was not declared in this scope
21 | cin >> a >> op >> b;
| ^
|
s020079572 | p03844 | C++ | #include<bits/stdc++.h>
using namespace std;
int main () {
char A, B;
string op;
cin >> A >> op >> B;
if (op=='+') {
cout << A+B << endl;
}
else {
cout << A-B << endl;
}
}
| a.cc: In function 'int main()':
a.cc:9:11: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if (op=='+') {
| ~~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
9 | if (op=='+') {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
9 | if (op=='+') {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if (op=='+') {
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
9 | if (op=='+') {
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
9 | if (op=='+') {
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:9:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if (op=='+') {
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _C |
s466008736 | p03844 | C++ | #include<bits/stdc++.h>
using namespace std;
int main () {
char A, op, B;
cin >> A >> op >> B;
cout << A op B << endl;
}
| a.cc: In function 'int main()':
a.cc:8:14: error: expected ';' before 'op'
8 | cout << A op B << endl;
| ^~~
| ;
|
s574345349 | p03844 | C++ | #include<bits/stdc++.h>
using namespace std;
int main () {
char A, op, B;
cin >> A >> op >> B;
cout << 'A' 'op' 'B' << endl;
}
| a.cc:8:17: warning: multi-character character constant [-Wmultichar]
8 | cout << 'A' 'op' 'B' << endl;
| ^~~~
a.cc: In function 'int main()':
a.cc:8:16: error: expected ';' before '\x6f70'
8 | cout << 'A' 'op' 'B' << endl;
| ^~~~~
| ;
|
s789250711 | p03844 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b;
string op;
cin >> a >> op >> b;
if(op == '+') a += b;
else a -= b;
cout << a << endl;
} | a.cc: In function 'int main()':
a.cc:9:9: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if(op == '+') a += b;
| ~~ ^~ ~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
9 | if(op == '+') a += b;
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
9 | if(op == '+') a += b;
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(op == '+') a += b;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(op == '+') a += b;
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
9 | if(op == '+') a += b;
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
9 | if(op == '+') a += b;
| ^~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(op == '+') a += b;
| ^~~
/usr/include |
s001984183 | p03844 | C | #include <stdio.h>
#include <string.h>
int main(void){
int A, B;
char op;
scanf("%d %c %d", &A, &op, &B);
if (op == '+'){
printf("%d\n", A+B);
} else if (op == '-'){
printf("%d\n", A-B);
} else {
printf("%s\n", "Invalid!")
}
return 0;
} | main.c: In function 'main':
main.c:13:31: error: expected ';' before '}' token
13 | printf("%s\n", "Invalid!")
| ^
| ;
14 | }
| ~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.