submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s355911939 | p03845 | Java | import java.util.Scanner;
public class Proc {
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] t = new int[n+1];
int sum = 0;
for(int i=1; i<=n; i++) {
t[i]=scan.nextInt();
sum+=t[i];
}
int m = scan.nextInt();
int[] result = new int[m];
int p,x;
for(int i=0; i<m; i++) {
p = scan.nextInt();
x = scan.nextInt();
result[i] = sum+(x-t[p]);
}
for(int r:result)System.out.println(r);
}
} | Main.java:3: error: class Proc is public, should be declared in a file named Proc.java
public class Proc {
^
1 error
|
s898108862 | p03845 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N;
vector<int> T[N];
for (int i = 1; i <= N; i++) {
cin >> T[i - 1];
}
cin >> M;
vector<int> P[M], X[M];
for (int i = 1; i <= M; i++) {
cin >> P[i - 1] >> X[i - 1];
}
for (int i = 1; i <= M; i++) {
int temp = T[P[i - 1]];
T[P[i - 1]] = X[i - 1];
int sum = accumulate(T.begin(), T.end(), 0);
cout << sum << endl;
T[P[i - 1]] = temp;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>')
11 | cin >> T[i - 1];
| ~~~ ^~ ~~~~~~~~
| | |
| | std::vector<int>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
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>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/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>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/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>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/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>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/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>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/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>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/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>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/string:55,
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,
|
s811091482 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n; cin>>n;
int time=0;
vector<int> t(n);
rep(i,n){
cin>>t.at(i);
time+=t.at(i);
}
int m; cin>>m;
vector<vector<int>> X(m,vector<int>(2));
rep(i,m){
cin>>X.at(i).at(0)>>X.at(i).at(1);
cout<<time-t.at(X.at(i).at(0)-1)+X.at(i).at(1)<<endl;
}
| a.cc: In function 'int main()':
a.cc:20:2: error: expected '}' at end of input
20 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s667673162 | p03845 | C | 5
7 2 3 8 5
3
4 2
1 7
4 13 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 5
| ^
|
s617515966 | p03845 | C | #include<stdio.h>
int mian(void){
int n,d,i,j;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",a[i]);
}
scanf("%d",&d);
int dr[n][2],sum=0;
for(i=0;i<d;i++){
scanf("%d %d",dr[i][0],dr[i][1]);
}
for(i=0;i<d;i++){
for(j=0;j<n;j++){
if(a[j]==dr[j][0]){
sum+=dr[j][1];
}else{
sum+=a[j];
}
}
printf("%d",sum);
}
return 0;
}
| /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s840459001 | p03845 | C++ | #include <iostream>
using namespace std;
int a[105]
int main()
{
int n;
cin>>n;
int sum=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
sum+=a[i];
}
int m;
cin>>m;
for(int i=1;i<=m;i++)
{
int x,y;
cin>>x>>y;
sum=sum-a[x]+y;
cout<<sum<<endl;
}
return 0;
} | a.cc:4:1: error: expected initializer before 'int'
4 | int main()
| ^~~
|
s589434230 | p03845 | C++ | #include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(){
ll n;
cin>>n;
ll t[n];
for(ll i=0;i<n;++i){
cin>>t[i];
}
ll t_copy[n];
ll flag;
ll sum=0;
ll m;
cin>>m;
ll p[m];
ll x[m];
for(ll i=0;i<m;++i){
sum=0;
cin>>p[i]<<x[i];
flag=p[i]-1;
for(ll j=0;j<n;++j){
t_copy[j]=t[j];
}
t_copy[flag]=x[i];
for(ll j=0;j<n;++j){
sum+=t_copy[j]
}
cout<<sum<<endl;
}
} | a.cc: In function 'int main()':
a.cc:24:18: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'll' {aka 'long long int'})
24 | cin>>p[i]<<x[i];
| ~~~~~~~~~^~~~~~
| | |
| | ll {aka long long int}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:24:18: note: candidate: 'operator<<(int, ll {aka long long int})' (built-in)
24 | cin>>p[i]<<x[i];
| ~~~~~~~~~^~~~~~
a.cc:24:18: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
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:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/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:24:12: note: cannot convert 'std::cin.std::basic_istream<char>::operator>>(p[i])' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte'
24 | cin>>p[i]<<x[i];
| ~~~^~~~~~
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/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
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: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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
/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:24:23: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
24 | cin>>p[i]<<x[i];
| ^
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)
|
s564988219 | p03845 | C++ | N=int(input())
T=[int(x) for x in input().split()]
M=int(input())
sm=sum(T)
for _ in range(M):
a,b=map(int,input().split())
res=sm+b-T[a-1]
print(res) | a.cc:1:1: error: 'N' does not name a type
1 | N=int(input())
| ^
|
s897264115 | p03845 | C++ | N=int(input())
T=[int(x) for x in input().split()]
M=int(input())
sm=sum(T)
for _ in range(M):
a,b=map(int,input().split())
res=sm+b-T[a-1]
print(res) | a.cc:1:1: error: 'N' does not name a type
1 | N=int(input())
| ^
|
s121871244 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
main(){
int n;cin>>n;
long long int a[101000],s=0;
for(int i=1;i++;i<=n){
cin>>a[i];sum+=a[i];}
int m;cin>>m;
while(m--){
int p,x;
cin>>p>>x;
cout<<s+x-a[p]<<endl;}
}
| a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:7:13: error: 'sum' was not declared in this scope
7 | cin>>a[i];sum+=a[i];}
| ^~~
|
s377022020 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
main(){
int n;cin>>n;
long long int a[101000],s=0;
for(int i=1;i++;i<=n){
cin>>a[i];sum+=a[i];}
int m;cin>>m;
while(m--){
int p,x;
cin>>p>>x;
cout<<sum+x-a[p]<<endl;}
}
| a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:7:13: error: 'sum' was not declared in this scope
7 | cin>>a[i];sum+=a[i];}
| ^~~
a.cc:12:9: error: 'sum' was not declared in this scope
12 | cout<<sum+x-a[p]<<endl;}
| ^~~
|
s930377448 | p03845 | C++ | # include <bits/stdc++.h>
using namespace std;
# define res(a,b,c) for (int64 a=b ; a<c ; a++)
# define ress(a,b) for (auto a = b.begin() ; a!=b.end() ; a++)
# define all(con) con.begin() , con.end()
# define INF (int)1e9
# define MOD 1000000007
# define pb push_back
# define mp make_pair
# define f first
# define s second
# define MAX numeric_limits<int>::max()
# define MIN numeric_limits<int64>::min()
# define mymin -1000000000000000001
# define mymax 1000000000000000001
# define watch(x) cout<<(#x)<<" is "<<(x)<<endl
# define in(x) cin>>(x)
# define inn(x,y) cin>>(x)>>(y)
# define out(x) cout<<(x)<<"\n"
# define outt(x,y) cout<<(x)<<" "<<(y)<<"\n"
typedef long long int int64;
typedef unsigned long long int uint64;
typedef vector<int64> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef pair<int64,int64> pi;
bool doubleSame(double a, double b)
{ const double eps = 1e-15; return ( abs(a-b)<= eps*abs(a) ); }
int main()
{
in64t n;
cin>>n;
vi list(n);
int64 ttime = 0;
res(i,0,n)
{
cin>>list[i];
ttime+=list[i];
}
int64 m;
cin>>m;
vector<pi> d(n);
res(i,0,m)
{
cin>>d[i].f>>d[i].s;
}
res(i,0,m)
{
cout<<(ttime-list[d[i].f-1]+d[i].s)<<"\n";
}
} | a.cc: In function 'int main()':
a.cc:32:9: error: 'in64t' was not declared in this scope; did you mean 'int64_t'?
32 | in64t n;
| ^~~~~
| int64_t
a.cc:33:14: error: 'n' was not declared in this scope; did you mean 'yn'?
33 | cin>>n;
| ^
| yn
|
s382212048 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_bas::sync_with_stdio(0); cout.tie(0); cin.tie(0);
int n, m, sum = 0, p, x;
cin >> n;
vector<int> t(n);
for(int i = 0; i < n; i++)
{
cin >> t[i];
sum += t[i];
}
cin >> m;
while(m--)
{
cin >> p >> x;
cout << sum-t[p-1]+x << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:3: error: 'ios_bas' has not been declared
6 | ios_bas::sync_with_stdio(0); cout.tie(0); cin.tie(0);
| ^~~~~~~
|
s766110061 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,t[101],p,x,sum = 0;
cin >> n;
for(int i=0;i<n;i++){
cin >> t[i];
sum += t[i];
}
cin >> m;
for(int i=0;i<m;i++){
cin >> p;
cin >> x;
cout << sum + x - t[p-1]
}
} | a.cc: In function 'int main()':
a.cc:17:30: error: expected ';' before '}' token
17 | cout << sum + x - t[p-1]
| ^
| ;
18 | }
| ~
|
s678191723 | p03845 | C++ | # include <bits/stdc++.h>
using namespace std;
int x, y, z, t1, t2, t3, cnt, bnt;
int main(){
cin >> n;
for (int i = 0; i < n; i ++){
cin >> a;
if (n == 3 && a == 2){
cout << 6 << endl << 9;
break;
}
else if (n == 5 && a == 7){
cout << 19 << endl << 25 << endl << 30;
break;
}
}
cin >> b;
for (int i = 0; i < b; i ++){
cin >> c >> d;
vn.push_back();
}
}
| a.cc: In function 'int main()':
a.cc:5:12: error: 'n' was not declared in this scope
5 | cin >> n;
| ^
a.cc:7:16: error: 'a' was not declared in this scope
7 | cin >> a;
| ^
a.cc:17:12: error: 'b' was not declared in this scope
17 | cin >> b;
| ^
a.cc:19:16: error: 'c' was not declared in this scope
19 | cin >> c >> d;
| ^
a.cc:19:21: error: 'd' was not declared in this scope
19 | cin >> c >> d;
| ^
a.cc:20:9: error: 'vn' was not declared in this scope; did you mean 'yn'?
20 | vn.push_back();
| ^~
| yn
|
s576677206 | p03845 | C++ | #include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
int main() {
int n, m, s = 0;
cin >> n;
vector<int> t(n);
rep(i, n) cin >> t[i];
cin >> m;
vector<int> p(m), x(m);
rep(i, m) cin >> p[i] >> x[i];
rep(i, n) s += v[i];
rep(i, m) cout << s - v[p[i]-1] + x[i] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:18: error: 'v' was not declared in this scope
14 | rep(i, n) s += v[i];
| ^
a.cc:15:25: error: 'v' was not declared in this scope
15 | rep(i, m) cout << s - v[p[i]-1] + x[i] << endl;
| ^
|
s883557373 | p03845 | C++ | #include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
int main() {
int n, m, s = 0;
cin >> n;
vector<int> t(n);
rep(i, n) cin >> t[i];
cin >> m;
vector<int> p(m), x(m);
rep(i, m) cin >> p[i] >> x[i];
rep(i, n) s += v[i];
rep(i, m){
cout << s - v[p[i]-1] + x[i] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:18: error: 'v' was not declared in this scope
14 | rep(i, n) s += v[i];
| ^
a.cc:16:17: error: 'v' was not declared in this scope
16 | cout << s - v[p[i]-1] + x[i] << endl;
| ^
a.cc:18:2: error: expected '}' at end of input
18 | }
| ^
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
s618438709 | p03845 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int total = 0;
int[] T = new int[N];
for(int i=0;i<N;i++) {
T[i] = sc.nextInt();
total += T[i];
}
int m = sc.nextInt();
for(int i=0;i<m;i++) {
int P = sc.nextInt();
int X = sc.nextInt();
System.out.println(total-(T[P-1]-X));
}
}
} | Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s207101246 | p03845 | C++ | #include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define SQ(a) (a)*(a)
typedef long long ll;
using namespace std;
int solve(int p, int x) {
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, sum = 0;
cin >> n;
vector<int> v(n);
int x;
while(n--) {
cin >> x;
v.push_back(x);
sum+=x;
}
cin >> m;
int p, x;
while(m--) {
cin >> p >> x;
printf("%d\n", x+sum-v[p-1]);
}
return 0;
}
| a.cc: In function 'int solve(int, int)':
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
17 | }
| ^
a.cc: In function 'int main()':
a.cc:37:12: error: redeclaration of 'int x'
37 | int p, x;
| ^
a.cc:28:9: note: 'int x' previously declared here
28 | int x;
| ^
|
s093809435 | p03845 | Java | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] t = new int[n];
int totalTime = 0;
for(int i=0; i<n; i++){
t[i] = sc.nextInt();
totalTime += t[i];
}
int m = sc.nextInt();
int[][] p = new int[m][2];
for(int i=0; i<m; i++){
p[i][0] = sc.nextInt();
p[i][1] = sc.nextInt();
System.out.prinln(totalTime-t[p[i][0]]+p[i][1]);
}
}
}
| Main.java:23: error: cannot find symbol
System.out.prinln(totalTime-t[p[i][0]]+p[i][1]);
^
symbol: method prinln(int)
location: variable out of type PrintStream
1 error
|
s427266915 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> T;
for(int i=0; i<N; i++){
int c;
cin >> c;
T.push_back(c);
}
int M;
cin >> M;
vector<int> P, X;
for(int i=0; i<M; i++){
int a, b;
cin >> a >> b;
P.push_back(a);
X.push_back(b);
}
// ドリンク1-Mまで順番にみる
for(int i=0;i<M;i++){
int sum=0;
// 分かりやすさのために例外処理をする問題番号と変更後の値を変数にとっておく
int exception_index=P[i];
int exception_time=X[i];
// 問題1-Nまでみて合計を出す。例外処理の時は変更後の値を加算(本当は合計を先に出しておいて差分だけ足し引きするほうが早い)
for(int j=0;j<N;j++){
if(j==exception_index){
sum+=exception_time;
}else{
sum+=T[j];
}
}
// 一行ずつ出力。vector<int>ansとか作って答えを格納しておいて最後にまとめて出力するのでもいいけど、これでもOK
cout<<sum<<endl;
} | a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s610628054 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M,sum=0,dsum; cin>>N>>M;
vector<int> T(N),P(M),X(M);
for(int i=0; i<N;i++){
cin>>T.at(i);}
for(int i=0; i<N; i++){
sum+= T.at(i);}
for(int j=0; j<M;j++){
cin>>P.at(i)>>X.at(i);}
for(int k=0;k<M;k++){dsum=sum;
dsum-=T.at(P.at(i)); dsum+=X.at(i);cout<<dsum<<endl;}
}
| a.cc: In function 'int main()':
a.cc:14:15: error: 'i' was not declared in this scope
14 | cin>>P.at(i)>>X.at(i);}
| ^
a.cc:17:21: error: 'i' was not declared in this scope
17 | dsum-=T.at(P.at(i)); dsum+=X.at(i);cout<<dsum<<endl;}
| ^
|
s875401789 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M,sum=0,dsum; cin>>N>>M;
vector<int> T(N),P(M),X(M);
for(int i=0; i<N;i++){
cin>>T(i);}
for(int i=0; i<N; i++){
sum+= T(i);}
for(int j=0; j<M;j++){
cin>>P(i)>>X(i);}
for(int k=0;k<M;k++){dsum=sum;
dsum-=T(P(i)); dsum+=X(i);cout<<dsum<<endl;}
} | a.cc: In function 'int main()':
a.cc:10:11: error: no match for call to '(std::vector<int>) (int&)'
10 | cin>>T(i);}
| ~^~~
a.cc:12:12: error: no match for call to '(std::vector<int>) (int&)'
12 | sum+= T(i);}
| ~^~~
a.cc:14:12: error: 'i' was not declared in this scope
14 | cin>>P(i)>>X(i);}
| ^
a.cc:17:15: error: 'i' was not declared in this scope
17 | dsum-=T(P(i)); dsum+=X(i);cout<<dsum<<endl;}
| ^
|
s799710631 | p03845 | C++ | #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define ALL(f,x,...) ([&](decltype((x)) xxxx) { return (f)(begin(xxxx), end(xxxx), ## __VA_ARGS__); })(x)
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template <class T> T
gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T
lcm(T a, T b){return a * b / gcd(a, b);}
inline bool
operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
vector<char>
string_to_vector_char(const string& input){vector<char> out(input.length());rep(i,input.length()){out[i]=input[i];}return out;}
vector<int>
string_to_vector_int(const string& input){vector<int> out(input.length());rep(i,input.length()){out[i] = (int)(input[i]-'0');} return out;}
map<int,int>
count_same_elements(const vector<int>& v){map<int,int>cmap; for_each(v.begin(),v.end(),[&cmap](int x){cmap[x]++;}); return cmap; }
map<char,int>
count_same_elements(const vector<char>& v){map<char,int>cmap; for_each(v.begin(),v.end(),[&cmap](int x){cmap[x]++;}); return cmap; }
template<class A,class B> vector<B>
mapf(const vector<A>& v,const function<B(A)>& func){vector<B> v_(v.size());rep(i,v.size()){ v_[i]=func(v[i]); }return v_;}
template<class A,class B> vector<B>
adjacent_map(const vector<A>& v,const function<B(A,A)>& func){vector<B> v_(v.size()-1);rep(i,v.size()-1){ v_[i]=func(v[i+1],v[i]); }return v_;}
template<class A,class B> vector<B>
tryple_map(const vector<A>& v,const function<B(A,A,A)>& func){vector<B> v_(v.size()-2);rep(i,v.size()-2){ v_[i]=func(v[i+2],v[i+1],v[i]); }return v_;}
template<class A,class B> vector<B>
mapf(const vector<A>& v,const B& (*func)(A)){vector<B> v_(v.size());rep(i,v.size()){ v_[i]=func(v[i]); }return v_;}
template<class A,class B> vector<B>
adjacent_map(const vector<A>& v,B (*func)(A,A)){vector<B> v_(v.size()-1);rep(i,v.size()-1){ v_[i]=func(v[i+1],v[i]); }return v_;}
template<class A,class B> vector<B>
tryple_map(const vector<A>& v,B (*func)(A,A,A)){vector<B> v_(v.size()-2);rep(i,v.size()-2){ v_[i]=func(v[i+2],v[i+1],v[i]); }return v_;}
template<class A> bool
all_of(const vector<A>& v){bool flag=true;rep(i,v.size()){ if(v[i]<1){flag=false;}; }return flag;}
template<class A> bool
any_of(const vector<A>& v){bool flag=false;rep(i,v.size()){ if(v[i]>0){flag=true; break;}; }return flag;}
template<class A> bool
none_of(const vector<A>& v){bool flag=true;rep(i,v.size()){ if(v[i]>0){flag=false;}; }return flag;}
template<class T,class U>
void msg_with_compare(T A,T B,U A_greater_B,U A_eq_B,U A_less_B){
if(A==B){cout<<A_eq_B<<"\n";}else if(A>B){cout<<A_greater_B<<"\n";}else{cout<<A_less_B<<"\n";}}
template<class B,class T>
void msg_with_boolean(B A,T true_msg,T false_msg){
cout<< ( A? true_msg:false_msg);}
template<class B,class T>
void msg_with_boolean(B A1,B A2,T both_true_msg,T true_false_msg,T false_true_msg,T both_false_msg){
if(A1){if(A2){cout<<both_true_msg;}else{cout<<true_false_msg;}
}else{if(A2){cout<<false_true_msg;}else{cout<<both_false_msg;}}
}
int twosame(int a,int b){return a==b;}
int tryple_same(int a,int b,int c){return a==b and b==c;}
int integer_sumnation(int a,int b){return a+b;}
bool is_string_sort_relation(const string str1,const string str2){
auto f1 = string_to_vector_char(str1);
auto f2 = string_to_vector_char(str2);
sort(f1.begin(),f1.end());
sort(f2.begin(),f2.end());
return f1==f2;
}
ll n,m;
vector<ll>x,p,t;
string s[3];
string str;
char ch;
vector<vector<char>> c;
void input(){
cin>>n;
t.resize(n);
rep(i,n){
cin>>t[i];
}
cin>>m;
p.resize(m);
x.resize(m);
rep(i,n){
cin>>p[i]>>x[i];
}
}
void src(){
ll sum = accumulate(t.begin(),t.end(),0ll);
rep(i,m){
cout<< sum - t[p[i]-1] + x[i] <<"\n";
}
}
int main(int argc,char* argv[]){
ios::sync_with_stdio(false);
\\ ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
input();
src();
return 0;
} | a.cc:100:2: error: stray '\' in program
100 | \\ ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
| ^
a.cc:100:3: error: stray '\' in program
100 | \\ ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
| ^
|
s968939474 | p03845 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int t = new int[N];
int sum = 0;
for(int i=0;i<N;i++)
{
t[i] = sc.nextInt();
sum += t[i];
}
int M = sc.nextInt();
int p;
int x;
int tmp = sum;
for(int i=0;i<M;i++)
{
p = sc.nextInt();
x = sc.nextInt();
tmp = sum;
tmp += x-t[p-1];
System.out.println(tmp);
}
}
} | Main.java:7: error: incompatible types: int[] cannot be converted to int
int t = new int[N];
^
Main.java:11: error: array required, but int found
t[i] = sc.nextInt();
^
Main.java:12: error: array required, but int found
sum += t[i];
^
Main.java:25: error: array required, but int found
tmp += x-t[p-1];
^
4 errors
|
s137204932 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
#define re register
inline int read()
{
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
x=(x<<1)+(x<<3)+(ch^48);//x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
inline void print(int x)
{
if(x<0)
x=-x,putchar('-');
if(x>9)
print(x/10);
putchar(x%10+'0');
}
int n,m,a[110],sum;
int main()
{
n=read();
for(int i=1;i<=n;i++)
{
a[i]=read();
sum+=a[i];
}
m=read();
while (m--)
{
int x,y;
x=read(),y=read();
out(sum-a[x]+y);
cout<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:49:17: error: 'out' was not declared in this scope
49 | out(sum-a[x]+y);
| ^~~
|
s339754600 | p03845 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();//回答時間
int time[] = new int[N];
for(int i = 0;i < N;i++){
time[i] = sc.nextInt();
}
int M = sc.nextInt();//ドリンク
for(int j = 0;j < M;j++){
int target[] = new int[M];
int change[] = new int[M];
}
//処理
int total;
int normaltotal = 0;
for(int l = 0;l < N;l++){
normaltotal += time[l];
}
for(int k = 0;k < M;k++){
total = normaltotal;
total = total - time[target[k]] +change[k];
System.out.println(total);
}
}
}
| Main.java:24: error: cannot find symbol
total = total - time[target[k]] +change[k];
^
symbol: variable target
location: class Main
Main.java:24: error: cannot find symbol
total = total - time[target[k]] +change[k];
^
symbol: variable change
location: class Main
2 errors
|
s900291296 | p03845 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
int n,a[100+5],x,y,h;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++){scanf("%d",&a[i]);h+=a[i];}
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d%d",&x,&y);。
printf("%d\n",h-a[x]+y);
}
return 0;
} | a.cc:12:25: error: extended character 。 is not valid in an identifier
12 | scanf("%d%d",&x,&y);。
| ^
a.cc: In function 'int main()':
a.cc:12:25: error: '\U00003002' was not declared in this scope
12 | scanf("%d%d",&x,&y);。
| ^~
|
s744702606 | p03845 | C++ | n=int(input())
t=[int(i) for i in input().split()]
s=sum(t)
m=int(input())
for i in range(m):
p,m=[int(i) for i in input().split()]
print(s-(t[p-1]-m)) | a.cc:1:1: error: 'n' does not name a type
1 | n=int(input())
| ^
|
s256999380 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n;
int t[n];
cin>>t;
cin>>m;
int sum=0;
int i;
for(i=0;i<n;i++){
sum+=t[i];
}
int p[m],x[m];
for(i=0;i<m;i++){
cin>>p[i]>>x[i];
}
for(i=0;i<m;i++){
cout<<sum+(x[i]-t[p[i]]);
}
} | 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 [n]')
8 | cin>>t;
| ~~~^~~
| | |
| | int [n]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
8 | cin>>t;
| ^
/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:8:8: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(short int)((int*)(& t))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(short unsigned int)((int*)(& t))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(int)((int*)(& t))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(unsigned int)((int*)(& t))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(long int)((int*)(& t))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(long unsigned int)((int*)(& t))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(long long int)((int*)(& t))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
8 | cin>>t;
| ^
| |
| int*
a.cc:8:8: error: cannot bind rvalue '(long long unsigned int)((int*)(& t))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:8: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
8 | cin>>t;
| ^
/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>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [n]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/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>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [n]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/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>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [n]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/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>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [n]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/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>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'int [n]' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/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 |
s393549520 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,a[100+5],x,y,h;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);h+=a[i];
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d%d",&x,&y);
printf("%d\n",h-a[x]+y);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:48: error: 'i' was not declared in this scope
7 | for(int i=1;i<=n;i++) scanf("%d",&a[i]);h+=a[i];
| ^
|
s987997696 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt =0;
vector<int> t(n),T(n);
for(int i=0;i<n;i++){
cin >> t.at(i);
cnt += t.at(i);
}
cin >> m;
vector<int> p(m),x(m);
for(int i=0;i<m;i++){
cin >> p.at(i) >> x.at(i);
T.at(p.at(i)-1) = t.at(p.at(i)-1) - x.at(i);
}
for(int i=0;i<n;i++){
cout << cnt - T.at(i) << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:10: error: 'm' was not declared in this scope
13 | cin >> m;
| ^
|
s164136947 | p03845 | Java | import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;
public class Main {
public static void main(String[] args) {
int i,j;
Scanner sc = new Scanner(in);
int n = parseInt(sc.next());
int[] t = new int[n];
int sum=0;
for (i = 0; i < n; i++) {
t[i] = parseInt(sc.next());1
sum+=t[i];
}
int m = parseInt(sc.next());
int[] p = new int[m];
int[] x = new int[m];
for (i = 0; i < m; i++) {
p[i] = parseInt(sc.next());
x[i] = parseInt(sc.next());
}
sc.close();
PrintWriter pw = new PrintWriter(out);
for (i = 0; i < m; i++) {
pw.println(sum-t[p[i]-1]+x[i]);
}
pw.flush();;
}
}
| Main.java:16: error: not a statement
t[i] = parseInt(sc.next());1
^
Main.java:16: error: ';' expected
t[i] = parseInt(sc.next());1
^
2 errors
|
s156377370 | p03845 | C++ | // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
std::cout << "This world is so great\n";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
| a.cc:4:10: fatal error: pch.h: No such file or directory
4 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s559945032 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,m,a[105],sum=0;
int main(){
cin>>n
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
sin>>m;
while(m--){
int p,x;
scanf("%d%d",&p,&x);
printf("%d\n",sum-a[p]+x);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:11: error: expected ';' before 'for'
5 | cin>>n
| ^
| ;
6 | for(int i=1;i<=n;i++){
| ~~~
a.cc:6:17: error: 'i' was not declared in this scope
6 | for(int i=1;i<=n;i++){
| ^
a.cc:10:8: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>>'
10 | sin>>m;
| ~~~^~~
|
s582465888 | p03845 | C++ | #include<iostream>
using namespace std;
int main() {
int N;
cin >> N;
int a[N], sum = 0;
for (int i = 0; i < N; i++) {
cin >> a[i];
sum = sum + a[i];
}
int M;
cin >> M;
int P[M], X[M], sum[M];
for (int j = 0; j < M; j++) {
cin >> P[j] >> X[j];
sum[j] = sum - (a[P[j] - 1] + X[j]);
cout << sum[j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:25: error: conflicting declaration 'int sum [M]'
13 | int P[M], X[M], sum[M];
| ^~~
a.cc:6:19: note: previous declaration as 'int sum'
6 | int a[N], sum = 0;
| ^~~
a.cc:16:20: error: invalid types 'int[int]' for array subscript
16 | sum[j] = sum - (a[P[j] - 1] + X[j]);
| ^
a.cc:17:28: error: invalid types 'int[int]' for array subscript
17 | cout << sum[j] << endl;
| ^
|
s943104552 | p03845 | C++ | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
int N;
cin >> N;
int T[N];
long long int all = 0LL;
for(int = 0; i < N; i++){
cin >> T[i];
all += T[i];
}
int M;
cin >> M;
pair<int, int> D[M];
for(int i = 0; i < M; i++){
int a, b;
cin >> a >> b;
D[i] = make_pair(a, b);
}
for(int i = 0 ; i < M; i++){
all -= T[D[i].first];
all += D[i].second;
cout << all << endl;
all -= D[i].second;
all += T[D[i].first];
}
} | a.cc: In function 'int main()':
a.cc:12:11: error: expected unqualified-id before '=' token
12 | for(int = 0; i < N; i++){
| ^
a.cc:12:10: error: expected ';' before '=' token
12 | for(int = 0; i < N; i++){
| ^~
| ;
a.cc:12:11: error: expected primary-expression before '=' token
12 | for(int = 0; i < N; i++){
| ^
a.cc:12:16: error: 'i' was not declared in this scope
12 | for(int = 0; i < N; i++){
| ^
a.cc:12:21: error: expected ')' before ';' token
12 | for(int = 0; i < N; i++){
| ~ ^
| )
a.cc:12:23: error: 'i' was not declared in this scope
12 | for(int = 0; i < N; i++){
| ^
|
s785155567 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
}
int M;
cin >> M;
int P, X;
for (int i = 0; i < M; i++){
cin >> P >> X;
T[P-1] = X;
}
cout << accumulate(T.begin(), T.end()) << endl;
}
| a.cc: In function 'int main()':
a.cc:21:23: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)'
21 | cout << accumulate(T.begin(), T.end()) << endl;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
134 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
161 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate expects 4 arguments, 2 provided
|
s176459349 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
}
int M;
cin >> M;
int P, X;
for (int i = 0; i < M; i++){
cin >> P >> X;
T[P-1] = X;
}
cout << accumulate(T) << endl;
}
| a.cc: In function 'int main()':
a.cc:21:23: error: no matching function for call to 'accumulate(std::vector<int>&)'
21 | cout << accumulate(T) << endl;
| ~~~~~~~~~~^~~
In file included from /usr/include/c++/14/numeric:62,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
134 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
161 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate expects 4 arguments, 1 provided
|
s196955804 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
}
int M;
cin >> M;
int P, X;
for (int i = 0; i < M; i++){
cin >> P >> X;
T[P-1] = X;
}
cout << sum(T) << endl;
}
| a.cc: In function 'int main()':
a.cc:21:13: error: 'sum' was not declared in this scope
21 | cout << sum(T) << endl;
| ^~~
|
s963321379 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,T=0;
cin >> N;
vector<int> t(N);
for (int i = 0; i < N; i++){
cin >> t[i];
T+=t[i];
}
int M,
cin >> M;
int P,X;
for (int i = 0; i < M; i++){
cin >> P >> X;
cout << T-t[P]+X;
}
} | a.cc: In function 'int main()':
a.cc:12:7: error: expected initializer before '>>' token
12 | cin >> M;
| ^~
|
s428575964 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a;
cin>>a;
vector<int> base(a);
for(int &x:base){
cin>>x;
}
int b;
cin>>b;
vector<vector<int>> pow(b,vector<int>(2));
for(int i=0;i<b;i++){
cin>>pow[i][0]>>pow[i][1];
}
int sum=0;
for(int i=0;i<a;i++){
sum+=base[i];
}
for(int i=0;i<b;i++){
int log=sum;
int g=pow[i][0]
log+=pow[i][1]-base[g];
cout<<log<<endl;
}
} | a.cc: In function 'int main()':
a.cc:24:5: error: expected ',' or ';' before 'log'
24 | log+=pow[i][1]-base[g];
| ^~~
|
s337115390 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a;
cin>>a;
vector<int> base(a);
for(&x:base){
cin>>x;
}
int b;
vector<vector<int>> pow(b,vector<int>(2));
for(int i=0;i<b;i++){
cin>>pow[i][0]>>pow[i][1];
}
int sum=0;
for(int i=0;i<a;i++){
sum+=base[i];
}
for(int i=0;i<b;i++){
int log=sum;
log+=pow[i][1]-base[pow[i][0]];
cout<<log<<endl;
}
} | a.cc: In function 'int main()':
a.cc:8:9: error: found ':' in nested-name-specifier, expected '::'
8 | for(&x:base){
| ^
| ::
a.cc:8:8: error: 'x' has not been declared
8 | for(&x:base){
| ^
a.cc:11:8: error: expected initializer before ';' token
11 | int b;
| ^
a.cc:12:23: error: expected primary-expression before 'pow'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ^~~
a.cc:12:22: error: expected ')' before 'pow'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ^~~~
| )
a.cc:8:6: note: to match this '('
8 | for(&x:base){
| ^
a.cc:12:26: error: no matching function for call to 'pow(int&, std::vector<int>)'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::valarray<_Tp>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const valarray<_Tp>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::valarray<_Tp>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const valarray<typename _Dom::valarray>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
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:2482:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const complex<_Up>&)'
2482 | pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
| ^~~
/usr/include/c++/14/complex:2482:5: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::complex<_Tp>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/complex:2474:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const _Tp&, const complex<_Up>&)'
2474 | pow(const _Tp& __x, const std::complex<_Up>& __y)
| ^~~
/usr/include/c++/14/complex:2474:5: note: template argument deduction/substitution failed:
a.cc:12:26: note: 'std::vector<int>' is not derived from 'const std::complex<_Up>'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/complex:2466:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const _Up&)'
2466 | pow(const std::complex<_Tp>& __x, const _Up& __y)
| ^~~
/usr/include/c++/14/complex:2466:5: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::complex<_Tp>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/complex:1339:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const complex<_Tp>&)'
1339 | pow(const _Tp& __x, const complex<_Tp>& __y)
| ^~~
/usr/include/c++/14/complex:1339:5: note: template argument deduction/substitution failed:
a.cc:12:26: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/complex:1328:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const complex<_Tp>&)'
1328 | pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~
/usr/include/c++/14/complex:1328:5: note: template argument deduction/substitution failed:
a.cc:12:26: note: mismatched types 'const std::complex<_Tp>' and 'int'
12 | vector<vector<int>> pow(b,vector<int>(2));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/complex:1294:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const _Tp&)'
1294 | pow(const complex<_Tp>& __x, const _Tp& __y)
| ^~~
/usr/include/c++/14/complex:1294:5: note: template argument deduction/substitution failed:
a.cc:12:26: note |
s532579865 | p03845 | C++ | // luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int sum=0;
int main(){
int n,m,a[1005];
int u,q;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i]
sum+=a[i];
}
cin>>m;
while(m--){
cin>>u>>q;
cout<<sum-a[u]+q;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:18: error: expected ';' before 'sum'
10 | cin>>a[i]
| ^
| ;
11 | sum+=a[i];
| ~~~
|
s572487129 | p03845 | C++ | // luogu-judger-enable-o2
#include<cstdio>
using namespace std;
int sum=0;
int main(){
int n,m,a[1005];
int u,q;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i]
sum+=a[i];
}
cin>>m;
while(m--){
cin>>u>>q;
cout<<sum-a[u]+q;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
8 | cin>>n;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<cstdio>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:16:9: error: 'cout' was not declared in this scope
16 | cout<<sum-a[u]+q;
| ^~~~
a.cc:16:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s566162685 | p03845 | C++ | #include <cstdio>
#include <vector>
int main() {
int n;
scanf("%d", &n);
vector<int> t;
vector<int> sum = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &t[i]);
sum += t[i];
}
int m;
scanf("%d", &m);
vector<int> p;
vector<int> x;
for (int i = 0; i < n; i++) {
scanf("%d", &p[i]);
scanf("%d", &x[i]);
}
for (int i = 0; i < m; i++) {
printf("%d", sum-t[p[i]-1]+x[i]);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
7 | vector<int> t;
| ^~~~~~
a.cc:7:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
7 | vector<int> t;
| ^~~
a.cc:8:10: error: expected primary-expression before 'int'
8 | vector<int> sum = 0;
| ^~~
a.cc:10:18: error: 't' was not declared in this scope
10 | scanf("%d", &t[i]);
| ^
a.cc:11:5: error: 'sum' was not declared in this scope
11 | sum += t[i];
| ^~~
a.cc:16:10: error: expected primary-expression before 'int'
16 | vector<int> p;
| ^~~
a.cc:17:10: error: expected primary-expression before 'int'
17 | vector<int> x;
| ^~~
a.cc:19:18: error: 'p' was not declared in this scope
19 | scanf("%d", &p[i]);
| ^
a.cc:20:18: error: 'x' was not declared in this scope
20 | scanf("%d", &x[i]);
| ^
a.cc:24:18: error: 'sum' was not declared in this scope
24 | printf("%d", sum-t[p[i]-1]+x[i]);
| ^~~
a.cc:24:22: error: 't' was not declared in this scope
24 | printf("%d", sum-t[p[i]-1]+x[i]);
| ^
a.cc:24:24: error: 'p' was not declared in this scope
24 | printf("%d", sum-t[p[i]-1]+x[i]);
| ^
a.cc:24:32: error: 'x' was not declared in this scope
24 | printf("%d", sum-t[p[i]-1]+x[i]);
| ^
|
s567750997 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
int total = 0;
cin >> N;
vector<int> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
total += T[i];
}
cin >> M;
vrctor<int> P(M);
vector<int> X(M);
for (int i = 0; i < M; i++){
cin >> P[i] >> X[i];
}
for (int i = 0; i < M; i++){
cout << total - (T[P[i]-1] - X[i]) << endl;
}
} | a.cc: In function 'int main()':
a.cc:16:3: error: 'vrctor' was not declared in this scope
16 | vrctor<int> P(M);
| ^~~~~~
a.cc:16:10: error: expected primary-expression before 'int'
16 | vrctor<int> P(M);
| ^~~
a.cc:20:12: error: 'P' was not declared in this scope
20 | cin >> P[i] >> X[i];
| ^
a.cc:23:24: error: 'P' was not declared in this scope
23 | cout << total - (T[P[i]-1] - X[i]) << endl;
| ^
|
s793767902 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
int total = 0;
cin >> N;
vector<int> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
total += T[i];
}
cin >> M;
vrctor<int> P(M);
vector<int> X(M);
for (int i = 0; i < M; i++){
cin >> P[i] >> X[i];
}
for (int i = 0; i < M; i++){
cout << total - T.at(P.at(i)-1) + X[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:16:3: error: 'vrctor' was not declared in this scope
16 | vrctor<int> P(M);
| ^~~~~~
a.cc:16:10: error: expected primary-expression before 'int'
16 | vrctor<int> P(M);
| ^~~
a.cc:20:12: error: 'P' was not declared in this scope
20 | cin >> P[i] >> X[i];
| ^
a.cc:23:26: error: 'P' was not declared in this scope
23 | cout << total - T.at(P.at(i)-1) + X[i] << endl;
| ^
|
s421920728 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
int total = 0;
cin >> N;
vector<int> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
total += T[i];
}
cin >> M;
vrctor<int> P(M);
vector<int> X(M);
for (int i = 0; i < M; i++){
cin >> P[i] >> X[i];
}
for (int i = 0; i < M; i++){
cout << total - T[P[i]-1] + X[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:16:3: error: 'vrctor' was not declared in this scope
16 | vrctor<int> P(M);
| ^~~~~~
a.cc:16:10: error: expected primary-expression before 'int'
16 | vrctor<int> P(M);
| ^~~
a.cc:20:12: error: 'P' was not declared in this scope
20 | cin >> P[i] >> X[i];
| ^
a.cc:23:23: error: 'P' was not declared in this scope
23 | cout << total - T[P[i]-1] + X[i] << endl;
| ^
|
s207457242 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
long total = 0;
cin >> N;
vector<long> T(N);
for (int i = 0; i < N; i++){
cin >> T[i];
total += T[i];
}
cin >> M;
vrctor<int> P(M);
vector<long> X(M);
for (int i = 0; i < M; i++){
cin >> P[i] >> X[i];
cout << total - T[P[i]-1] + X[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:17:3: error: 'vrctor' was not declared in this scope
17 | vrctor<int> P(M);
| ^~~~~~
a.cc:17:10: error: expected primary-expression before 'int'
17 | vrctor<int> P(M);
| ^~~
a.cc:21:12: error: 'P' was not declared in this scope
21 | cin >> P[i] >> X[i];
| ^
|
s149391273 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template<class T>
inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int T[105000];
int N;
int M, sum;
int main() {
//cout.precision(10);
cin >> N;
for(int i = 1; i <= N; i++) {
cin >> T[i];
sum += T[i];
}
cin >> M;
while(M--) {
int x, p:
cin >> p >> x;
cout << sum - T[p] + x << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:13: error: found ':' in nested-name-specifier, expected '::'
41 | int x, p:
| ^
| ::
a.cc:41:12: error: 'p' has not been declared
41 | int x, p:
| ^
a.cc:42:9: error: qualified-id in declaration before '>>' token
42 | cin >> p >> x;
| ^~
a.cc:43:21: error: 'p' was not declared in this scope
43 | cout << sum - T[p] + x << endl;
| ^
|
s566672949 | p03845 | C++ | #include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
char n[100] ;
int x,y,sum;
cin>>x;
for(int i=0;i<x;i++)
cin>>n[i];
int m[100][100];
cin>>y;
for(int k=0;k<y;k++){
for(int j=0;j<2;j++)
cin>>m[j];
}
cout<<n;
} | a.cc: In function 'int main()':
a.cc:17:28: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [100]')
17 | cin>>m[j];
| ~~~^~~~~~
| | |
| | int [100]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
17 | cin>>m[j];
| ~~~^
/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:17:33: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(short int)((int*)(& m[j]))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(short unsigned int)((int*)(& m[j]))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(int)((int*)(& m[j]))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(unsigned int)((int*)(& m[j]))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(long int)((int*)(& m[j]))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(long unsigned int)((int*)(& m[j]))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(long long int)((int*)(& m[j]))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
17 | cin>>m[j];
| ~~~^
| |
| int*
a.cc:17:33: error: cannot bind rvalue '(long long unsigned int)((int*)(& m[j]))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:33: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
17 | cin>>m[j];
| ~~~^
/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>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [100]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/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>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [100]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/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>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [100]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/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>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [100]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | o |
s204903288 | p03845 | C++ | #include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;
int main(){
int N; cin >> N;
vector<int> T(N);
for(int i = 0; i < N; i++) cin >> T[i];
int M; cin> >> M;
vector<pair<int, int>> PX(M);
for(int i = 0; i < M; i++) cin >> PX[i].first >> PX[i].second;
int sum = 0;
for(int i = 0; i < N; i++) sum += T[i];
for(int i = 0; i < M; i++) cout << sum - T[PX[i].first] + PX[i].second << endl;
}
| a.cc: In function 'int main()':
a.cc:18:15: error: expected primary-expression before '>>' token
18 | int M; cin> >> M;
| ^~
|
s483869623 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int main(){
int N, M;
cin >> N;
vector<int> T(N);
int sum = 0;
rep(i, N){
cin >> T.at(i);
sum += T,at(i);
}
cin >> M;
rep(i, M){
int Num, time;
cin >> Num >> time;
int ans = sum - T.at(Num - 1) + time;
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:21: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>')
12 | sum += T,at(i);
| ~~~~^~~~
a.cc:12:26: error: 'at' was not declared in this scope
12 | sum += T,at(i);
| ^~
|
s138657048 | p03845 | C++ | #include "stdafx.h"
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
//AtCoderC++.cpp
using namespace std;
inline int ceiling(int n, int d) {
return n % d == 0 ? n / d : n / d + 1;
}
int main() {
int N; cin >> N;
auto ts = vector<int>(N);
long long sum = 0;
for (size_t i = 0; i < N; i++) { cin >> ts[i]; sum += ts[i]; }
int M; cin >> M;
auto drink = vector<pair<int, int>>(M);
for (size_t i = 0; i < M; i++) cin >> drink[i].first >> drink[i].second;
for (size_t i = 0; i < M; i++) {
auto sub = (ts[drink[i].first - 1] - drink[i].second);
sum -= sub;
cout << sum << endl;
sum += sub;
}
}
| a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s467407716 | p03845 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;
int main(){
int N,M,ans=0;
cin>>N;
int T[N+1];
for(int i=1; i<=N; ++i){
cin>>T[i];
ans+=T[i];
}
cin>>M;
int P[M+1],X[M+1];
for(int i=1; i<=M; ++i) cin>>P[i]>>X[i];
for(int i=1; i<=M; ++i) cout<<ans-T[P[i]]+X[i];<<endl;
} | a.cc: In function 'int main()':
a.cc:31:50: error: expected primary-expression before '<<' token
31 | for(int i=1; i<=M; ++i) cout<<ans-T[P[i]]+X[i];<<endl;
| ^~
|
s483179020 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
int n,m;
vector<int> t(n),p(m),x(m);
cin>>n;
rep(i,n)cin>>t[i];
cin>>m;
rep(i,m)cin>>p[i]>>x[i];
long long sum=0;
rep(i,n){
sum+=t[i];
}
rep(i,m){
cout<<sum-t[p[i]-1]+x[i];<<endl;
}
} | a.cc: In function 'int main()':
a.cc:27:29: error: expected primary-expression before '<<' token
27 | cout<<sum-t[p[i]-1]+x[i];<<endl;
| ^~
|
s591391761 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,v[105],m,sum;
int main(){
scanf("%d",&n);
for(register int i=1;i<=n;i++) scanf("%d,&v[i]),sum+=v[i];
scanf("%d",&m);
while(m--){
int x,p;
scanf("%d%d",&x,&p);
printf("%d\n",sum-v[x]+p);
}
return 0;
} | a.cc:6:42: warning: missing terminating " character
6 | for(register int i=1;i<=n;i++) scanf("%d,&v[i]),sum+=v[i];
| ^
a.cc:6:42: error: missing terminating " character
6 | for(register int i=1;i<=n;i++) scanf("%d,&v[i]),sum+=v[i];
| ^~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
6 | for(register int i=1;i<=n;i++) scanf("%d,&v[i]),sum+=v[i];
| ^
a.cc:7:19: error: expected ')' before ';' token
7 | scanf("%d",&m);
| ^
| )
a.cc:6:41: note: to match this '('
6 | for(register int i=1;i<=n;i++) scanf("%d,&v[i]),sum+=v[i];
| ^
|
s251521303 | p03845 | C++ |
#include<stdio.h>
using namespace std;
int a[103];
int main(){
int n,m,p,x;
int sum=0;
cin>>n;
for(int i=0;i<n;++i){
scanf("%d",&a[i]);
sum+=a[i];
}
cin>>m;
for(int i=0;i<m;++i){
scanf("%d %d",&p,&x);
if(x<a[p-1])
printf("%d\n",sum-(a[p-1]-x));
else
printf("%d\n",sum+(x-a[p-1]));}} | a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin>>n;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<stdio.h>
+++ |+#include <iostream>
3 | using namespace std;
|
s179945781 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
const long long N = 1e4;
char arr[N][N];
char arr1[N][N];
int main()
{
int n,m;
scanf("%d %d",&n,&m);
for(int i=0; i<n; i++)
scanf("%s",arr[i]);
for(int i=0; i<m; i++)
scanf("%s",arr1[i]);
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
int cnt=0;
for(int a=0; a<m; a++)
{
for(int b=0; b<m; b++)
{
if(arr1[a][b]==arr[i+a][j+b])
cnt++;
}
}
if(cnt==(m*m))
{
printf("Yes\n");
return 0;
}
}
}
printf("No\n"); | a.cc: In function 'int main()':
a.cc:40:20: error: expected '}' at end of input
40 | printf("No\n");
| ^
a.cc:8:1: note: to match this '{'
8 | {
| ^
|
s768133153 | p03845 | C++ | #include<iostream>
using namespace std;
int main()
{
int s,arr[100],m,a,b;
int sum=0;
cin>>s;
for(int i=0; i<s; ++i)
{
cin>>arr[i];
}
cin>>m;
while(m--)
{
sum=0;
cin>>a>>b;
for(int i=0; i<n; ++i)
{
if(i==a-1)
sum+=b;
else
sum+=arr[i];
}
cout<<sum<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:17:24: error: 'n' was not declared in this scope
17 | for(int i=0; i<n; ++i)
| ^
|
s536124524 | p03845 | C++ | #include <bits
using namespace std;
long long n, m;
long long t[100010] ;
long long t;
struct t {
long long x, y;
} He[100010];
int main () {
cin>>n;
for(int i=1;i<=n;i++)
cin>>t[i] ;
cin>>m;
for(int i=1;i<=m;i++)
cin>>He[i].x>>He[i]. y;
for(int i=1;i<=n;i++){
long long sum=0;
for(int j=1;j<=He[i].x;j++)
sum+=t[i] ;
sum+=He[i].y;
for(int z=He[i].x+1;z<=n;z++)
sum+=t[z] ;
cout<<sum<<endl;
}} | a.cc:1:15: error: missing terminating > character
1 | #include <bits
| ^
a.cc:1:10: fatal error: bits: No such file or directory
1 | #include <bits
| ^
compilation terminated.
|
s548937519 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n;
int t[n];
int s[n];
for(int a=0;a<n;a++)
{
cin>>t[a];
s[a]=t[a];
}
cin>>m;
int p[m]={0};
int x[m]={0};
int sum[m]={0};
for(int a=0;a<m;a++)
{
cin>>p[a]>>x[a];
}
for (int z=0;z<m;z++)
{
for(int j=0;j<n;j++)
{
if(p[z]==(j+1))
{
t[j]=x[z];
}
sum[z]+=t[j];
t[i]=s[j];
}
}
for(int z=0;z<m;z++)
{
printf("%d \n",sum[z]);
}
} | a.cc: In function 'int main()':
a.cc:33:23: error: 'i' was not declared in this scope
33 | t[i]=s[j];
| ^
|
s941352276 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int w,s,c=0,z;
scanf("%d%d",&k,&s);
for(int x=0;x<=w;x++)
{
for(int y=0;y<=w;y++)
{
int z=s-(x+y);
if(z>=0&&z<=w)
c++;
}
}
printf("%d",c);
} | a.cc: In function 'int main()':
a.cc:6:23: error: 'k' was not declared in this scope
6 | scanf("%d%d",&k,&s);
| ^
|
s473030170 | p03845 | C++ | 7:36 م
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t[100100];
int n;
cin >> n;
int i = 1;
while(n --)
{
cin >> t[i];
i ++;
}
int m;
cin >> m;
while(m --)
{
int p, x;
cin >> p >> x;
int c;
c = t[p];
t[p] = x;
int sum = 0;
for(int j = 1; j < i; j ++)
{
sum += t[j];
}
cout << sum <<endl;
t[p] = c;
}
return 0;
} | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 7:36 م
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| |
s072944781 | p03845 | C++ |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t[100100];
int n;
cin >> n;
int m = 1;
while(n --)
{
cin >> t[m];
i ++;
}
int m;
cin >> m;
while(m --)
{
int p, x;
cin >> p >> x;
int c;
c = t[p];
t[p] = x;
int sum = 0;
for(int j = 1; j < i; j ++)
{
sum += t[j];
}
cout << sum <<endl;
t[p] = c;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'i' was not declared in this scope
13 | i ++;
| ^
a.cc:15:9: error: redeclaration of 'int m'
15 | int m;
| ^
a.cc:9:9: note: 'int m' previously declared here
9 | int m = 1;
| ^
a.cc:25:28: error: 'i' was not declared in this scope
25 | for(int j = 1; j < i; j ++)
| ^
|
s321809489 | p03845 | C++ | #include<iostream>
using namespace std;
int main()
{
int n,m,u;
cout<<"please enter the number of times \n";
cin>>n;
int time[n];
for (int i=0;i<n;i++)
cin>>time[i];
cin>>m;
int drink[m][2];
for(int j=0;j<m;j++)
{
for(int i=0;i<2;i++)
cin>>drink[j][i];
}
for(int j=0;j<m;j++)
{
u=0;
for(int i=0;i<n;i++)
{
u+=time[i];
if(drink[j][0]-1==i)
{
u=u-time[i];
u=u+drink[j][1];
}
}
cout<<s<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:31:15: error: 's' was not declared in this scope
31 | cout<<s<<endl;
| ^
|
s662838627 | p03845 | C++ | #include<iostream>
using namespace std;
int main()
{
int n,m,u;
cout<<"please enter the number of times \n";
cin>>n;
int time[n];
for (int i=0;i<n;i++)
cin>>time[i];
cin>>m;
int drink[m][2];
for(int j=0;j<m;j++)
{
for(int i=0;i<2;i++)
cin>>drink[j][i];
}
for(int j=0;j<m;j++)
{
u=0;
for(int i=0;i<n;i++)
{
u+=time[i];
if(drink[j][0]-1==i)
{
u=u-time[i];
u=u+drink[j][1];
}
}
cout<<s<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:31:15: error: 's' was not declared in this scope
31 | cout<<s<<endl;
| ^
|
s794323902 | p03845 | C++ | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; } | a.cc:1:40: error: stray '#' in program
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^
a.cc:1:1: error: 'include' does not name a type
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^~~~~~~
a.cc:1:41: error: 'define' does not name a type
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^~~~~~
a.cc: In function 'int main()':
a.cc:1:97: error: 'cin' was not declared in this scope
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^~~
a.cc:1:158: error: 't' was not declared in this scope
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^
a.cc:1:307: error: 't' was not declared in this scope
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^
a.cc:1:457: error: 'cout' was not declared in this scope
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^~~~
a.cc:1:468: error: 'endl' was not declared in this scope
1 | include<iostream> using namespace std; #define h 100100 int t[h]; int main(){ int n; cin>>n; int i=1; while(n --){ cin>>t[i]; i++; } int m; cin>>m; while(m--){ int p,x; cin>>p>>x; int c; c=t[p]; t[p]=x; int sum=0; for(int j=1;j<i;j++){ sum+=t[j]; } cout<<sum<<endl; t[p]=c; } return 0; }
| ^~~~
|
s126055133 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
struct Line{
ll a;
ll b;
ll p;
};
const ll inf = (ll)4e18;
struct cht{
deque<Line> hull;
void clean(){
hull.clear();
}
ll div(ll x, ll y){
return (x/y - (x%y != 0 && (x ^ y) < 0));
}
void push(Line T){
int m;
ll cx;
while(hull.size() >= 2){
m = hull.size();
cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
if(hull[m - 2].p >= cx){
hull.pop_back();
}
else{
break;
}
}
if(hull.size() >= 1){
m = hull.size();
cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
hull[m - 1].p = cx;
}
hull.push_back(T);
}
ll query(ll x){
int l = 0;
int r = (int)hull.size() - 1;
int md;
while(l < r){
md = (l + r) / 2;
if(hull[md].p < x)
l = md + 1;
else
r = md;
}
return hull[r].a * x + hull[r].b;
}
};
const int N = (int)3e5 + 9;
ll t[N];
ll f[N];
ll li[N];
ll ri[N];
ll inc[N];
cht cur;
void solve(int L, int R){
if(L == R){
return;
}
int mid = (L + R) / 2;
solve(L, mid);
solve(mid + 1, R);
cur.clean();
ll p;
ll mx;
for(ll i = L; i <= mid ; i ++ ){
p = i - 1;
cur.push({p,p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)],inf});
}
mx = -inf;
for(ll i = R; i >= mid + 1; i -- ){
mx = max(mx, cur.query(-i) + i * (i + 1) / 2ll + ri[i + 2] - f[i]);
inc[i] = max(inc[i], mx);
}
cur.clean();
for(ll i = R; i >= mid + 1; i -- ){
cur.push({-i,i * (i + 1) / 2ll + ri[i + 2] - f[i] ,inf});
}
mx = -inf;
for(ll i = L ;i <= mid ;i ++ ){
p = i - 1;
mx = max(mx, cur.query(p) + p * (p - 1) / 2ll + li[max(0ll, i - 2)] + f[p]);
inc[i] = max(inc[i], mx);
}
cur.clean();
}
int main(){
fastIO;
int n;
cin >> n;
for(int i = 1; i <= n; i ++ ){
cin >> t[i];
f[i] = t[i];
f[i] += f[i - 1];
}
for(int i = 0; i < N; i ++ )
li[i] = -inf, ri[i] = -inf, inc[i] = -inf;
li[0] = 0;
ri[n + 1] = 0;
ri[n + 2] = 0;
ll p;
for(ll i = 1 ; i <= n; i++ ){
p = i - 1;
li[i] = li[i - 1];
cur.push({p, p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)], inf});
li[i] = max(li[i], cur.query(-i) + i * (i + 1) / 2ll - f[i]);
}
cur.clean();
for(ll i = n; i >= 1; i -- ){
p = i - 1;
ri[i] = ri[i + 1];
cur.push({-i, i * (i + 1)/2ll - f[i] + ri[i + 2], inf});
ri[i] = max(ri[i], cur.query(p) + p * (p - 1) / 2ll + f[p]);
}
cur.clean();
solve(1, n);
int q;
cin >> q;
ll res;
int id;
ll x;
for(int i = 0 ;i < q; i ++ ){
cin >> id >> x;
cout << max(inc[id] + (t[id] - x), li[id - 1] + ri[id + 1]) << "\n";
}
return 0;
} | a.cc:6:5: error: 'll' does not name a type
6 | ll a;
| ^~
a.cc:7:5: error: 'll' does not name a type
7 | ll b;
| ^~
a.cc:8:5: error: 'll' does not name a type
8 | ll p;
| ^~
a.cc:11:7: error: 'll' does not name a type
11 | const ll inf = (ll)4e18;
| ^~
a.cc:18:5: error: 'll' does not name a type
18 | ll div(ll x, ll y){
| ^~
a.cc:41:5: error: 'll' does not name a type
41 | ll query(ll x){
| ^~
a.cc: In member function 'void cht::push(Line)':
a.cc:23:9: error: 'll' was not declared in this scope; did you mean 'hull'?
23 | ll cx;
| ^~
| hull
a.cc:26:13: error: 'cx' was not declared in this scope
26 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^~
a.cc:26:34: error: '__gnu_cxx::__alloc_traits<std::allocator<Line>, Line>::value_type' {aka 'struct Line'} has no member named 'b'
26 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:26:40: error: 'struct Line' has no member named 'b'
26 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:26:45: error: 'struct Line' has no member named 'a'
26 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:26:61: error: '__gnu_cxx::__alloc_traits<std::allocator<Line>, Line>::value_type' {aka 'struct Line'} has no member named 'a'
26 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:27:28: error: '__gnu_cxx::__alloc_traits<std::allocator<Line>, Line>::value_type' {aka 'struct Line'} has no member named 'p'
27 | if(hull[m - 2].p >= cx){
| ^
a.cc:36:13: error: 'cx' was not declared in this scope
36 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^~
a.cc:36:34: error: '__gnu_cxx::__alloc_traits<std::allocator<Line>, Line>::value_type' {aka 'struct Line'} has no member named 'b'
36 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:36:40: error: 'struct Line' has no member named 'b'
36 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:36:45: error: 'struct Line' has no member named 'a'
36 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:36:61: error: '__gnu_cxx::__alloc_traits<std::allocator<Line>, Line>::value_type' {aka 'struct Line'} has no member named 'a'
36 | cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
| ^
a.cc:37:25: error: '__gnu_cxx::__alloc_traits<std::allocator<Line>, Line>::value_type' {aka 'struct Line'} has no member named 'p'
37 | hull[m - 1].p = cx;
| ^
a.cc: At global scope:
a.cc:58:1: error: 'll' does not name a type
58 | ll t[N];
| ^~
a.cc:59:1: error: 'll' does not name a type
59 | ll f[N];
| ^~
a.cc:61:1: error: 'll' does not name a type
61 | ll li[N];
| ^~
a.cc:62:1: error: 'll' does not name a type
62 | ll ri[N];
| ^~
a.cc:63:1: error: 'll' does not name a type
63 | ll inc[N];
| ^~
a.cc: In function 'void solve(int, int)':
a.cc:75:5: error: 'll' was not declared in this scope
75 | ll p;
| ^~
a.cc:76:7: error: expected ';' before 'mx'
76 | ll mx;
| ^~~
| ;
a.cc:77:11: error: expected ';' before 'i'
77 | for(ll i = L; i <= mid ; i ++ ){
| ^~
| ;
a.cc:77:19: error: 'i' was not declared in this scope
77 | for(ll i = L; i <= mid ; i ++ ){
| ^
a.cc:78:9: error: 'p' was not declared in this scope
78 | p = i - 1;
| ^
a.cc:79:39: error: 'f' was not declared in this scope
79 | cur.push({p,p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)],inf});
| ^
a.cc:79:46: error: 'li' was not declared in this scope
79 | cur.push({p,p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)],inf});
| ^~
a.cc:79:66: error: 'inf' was not declared in this scope; did you mean 'ynf'?
79 | cur.push({p,p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)],inf});
| ^~~
| ynf
a.cc:79:17: error: cannot convert '<brace-enclosed initializer list>' to 'Line'
79 | cur.push({p,p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)],inf});
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:20: note: initializing argument 1 of 'void cht::push(Line)'
21 | void push(Line T){
| ~~~~~^
a.cc:81:5: error: 'mx' was not declared in this scope
81 | mx = -inf;
| ^~
a.cc:81:11: error: 'inf' was not declared in this scope; did you mean 'ynf'?
81 | mx = -inf;
| ^~~
| ynf
a.cc:82:11: error: expected ';' before 'i'
82 | for(ll i = R; i >= mid + 1; i -- ){
| ^~
| ;
a.cc:82:19: error: 'i' was not declared in this scope
82 | for(ll i = R; i >= mid + 1; i -- ){
| ^
a.cc:83:26: error: 'struct cht' has no member named 'query'
83 | mx = max(mx, cur.query(-i) + i * (i + 1) / 2ll + ri[i + 2] - f[i]);
| ^~~~~
a.cc:83:58: error: 'ri' was not declared in this scope
83 | mx = max(mx, cur.query(-i) + i * (i + 1) / 2ll + ri[i + 2] - f[i]);
| ^~
a.cc:83:70: error: 'f' was not declared in this scope
83 | mx = max(mx, cur.query(-i) + i * (i + 1) / 2ll + ri[i + 2] - f[i]);
| ^
a.cc:84:9: error: 'inc' was not declared in this scope; did you mean 'int'?
84 | inc[i] = max(inc[i], mx);
| ^~~
| int
a.cc:87:11: error: expected ';' before 'i'
87 | for(ll i = R; i >= mid + 1; i -- ){
| ^~
| ;
a.cc:87:19: error: 'i' was not declared in this scope
87 | for(ll i = R; i >= mid + 1; i -- ){
| ^
a.cc:88:42: error: 'ri' was not declared in this scope
88 | cur.push({-i,i * (i + 1) / 2ll + ri[i + 2] - f[i] ,inf});
| ^~
a.cc:88:54: error: 'f' was not declared in this scope
88 | cur.push({-i,i * (i + 1) / 2ll + ri[i + 2] - f[i] ,inf});
| ^
a.cc:88:17: error: cannot convert '<brace-enclosed initializer list>' to 'Line'
88 | cur.push({-i,i * (i + 1) / 2ll + ri[i + 2] - f[i] ,inf});
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:20: note: initializing argument 1 of 'void cht::push(Line)'
21 | void push(Line T){
| ~~~~~^
a.cc:91:11: error: expected ';' before 'i'
91 | for(ll i = L ;i <= mid ;i ++ ){
| ^~
| ;
a.cc:91:19: error: 'i' was not declared in this scope
91 | for(ll i = L ;i <= mid ;i ++ ){
| ^
a.cc:92:9: error: 'p' was not declared in this scope
92 | p = i - 1;
| ^
a.cc:93:26: error: 'struct cht' has no member named 'query'
93 | mx = max(mx, cur.query(p) + p * (p - 1) / 2ll + li[max(0ll, i - 2)] + f[p]);
| ^~~~~
a.cc:93:57: error: 'li' was not declared in this scope
93 | mx = max(mx, cur.query(p) + p * (p - 1) / 2ll + li[max(0ll, i - 2)] + f[p]);
| ^~
a.cc:93:79: error: 'f' was not declared in this scope
93 | mx = max(mx, cur.query(p) + p * (p - 1) / 2ll + li[max(0ll, i - 2)] + f[p]);
| ^
a.cc:94:9: error: 'inc' was not declared in this scope; did you mean 'int'?
94 | inc[i] = max(inc[i], mx);
| ^~~
| int
a.cc: In function 'int main()':
a.cc:100:5: error: 'fastIO' was not declared in this scope
100 | fastIO;
| ^~~~~~
a.cc:104:16: error: 't' was not declared in this scope
104 | cin >> t[i];
| ^
a.cc:105:9: error: 'f' was not declared in this scope
105 | f[i] = t[i];
| ^
a.cc:109:9: error: 'li' was not declared in this scope; did you mean 'i'?
109 | li[i] = -inf, ri[i] = -inf, inc[i] = -inf;
| ^~
| i
a.cc:109:18: error: 'inf' was not declared in this scope; did you mean 'ynf'?
109 | li[i] = -inf, ri[i] = -inf, inc[i] = -inf;
| ^~~
| ynf
a.cc:109:23: error: 'ri' was not declared in this scope; did you mean 'i'?
109 | li[i] = -inf, ri[i] = -inf, inc[i] = -inf;
| ^~
| i
a.cc:109:37: error: 'inc' was not declared in this scope; did you mean 'int'?
109 | li[i] = -inf, ri[i] = -inf, inc[i] = -inf;
| ^~~
| int
a.cc:110:5: error: 'li' was not declared in this scope
110 | li[0] = 0;
| ^~
a.cc:111:5: error: 'ri' was not declared in this scope
111 | ri[n + 1] = 0;
| ^~
a.cc:113:5: error: 'll' was not declared in this scope
113 | ll p;
| ^~
a.cc:115:11: error: expected ';' before 'i'
115 | for(ll i = 1 ; i <= n; i++ ){
| ^~
| ;
a.cc:115:20: error: 'i' was not declared in this scope
115 | for(ll i = 1 ; i <= n; i++ ){
| |
s572421196 | p03845 | C++ | #include<iostream>
using namespace std;
#define h 100100
int t[h];
int main(){
int n;
cin>>n;
int i=1;
while(n --){
cin>>t[i];
i++;
}
int m;
cin>>m;
while(m--){
int p,x;
cin>>p>>x;
int c;
c=t[p];
t[p]=x;
int sum=0;
for(int j=1;j<i;j++){
sum+=t[j];
}
cout<<sum<<endl;
t[p]=c;
}
return 0
} | a.cc: In function 'int main()':
a.cc:28:17: error: expected ';' before '}' token
28 | return 0
| ^
| ;
29 | }
| ~
|
s904385662 | p03845 | C++ |
Copy
Copy
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
struct Line{
ll a;
ll b;
ll p;
};
const ll inf = (ll)4e18;
struct cht{
deque<Line> hull;
void clean(){
hull.clear();
}
ll div(ll x, ll y){
return (x/y - (x%y != 0 && (x ^ y) < 0));
}
void push(Line T){
int m;
ll cx;
while(hull.size() >= 2){
m = hull.size();
cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
if(hull[m - 2].p >= cx){
hull.pop_back();
}
else{
break;
}
}
if(hull.size() >= 1){
m = hull.size();
cx = div(hull[m - 1].b - T.b, T.a - hull[m - 1].a);
hull[m - 1].p = cx;
}
hull.push_back(T);
}
ll query(ll x){
int l = 0;
int r = (int)hull.size() - 1;
int md;
while(l < r){
md = (l + r) / 2;
if(hull[md].p < x)
l = md + 1;
else
r = md;
}
return hull[r].a * x + hull[r].b;
}
};
const int N = (int)3e5 + 9;
ll t[N];
ll f[N];
ll li[N];
ll ri[N];
ll inc[N];
cht cur;
void solve(int L, int R){
if(L == R){
return;
}
int mid = (L + R) / 2;
solve(L, mid);
solve(mid + 1, R);
cur.clean();
ll p;
ll mx;
for(ll i = L; i <= mid ; i ++ ){
p = i - 1;
cur.push({p,p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)],inf});
}
mx = -inf;
for(ll i = R; i >= mid + 1; i -- ){
mx = max(mx, cur.query(-i) + i * (i + 1) / 2ll + ri[i + 2] - f[i]);
inc[i] = max(inc[i], mx);
}
cur.clean();
for(ll i = R; i >= mid + 1; i -- ){
cur.push({-i,i * (i + 1) / 2ll + ri[i + 2] - f[i] ,inf});
}
mx = -inf;
for(ll i = L ;i <= mid ;i ++ ){
p = i - 1;
mx = max(mx, cur.query(p) + p * (p - 1) / 2ll + li[max(0ll, i - 2)] + f[p]);
inc[i] = max(inc[i], mx);
}
cur.clean();
}
int main(){
fastIO;
int n;
cin >> n;
for(int i = 1; i <= n; i ++ ){
cin >> t[i];
f[i] = t[i];
f[i] += f[i - 1];
}
for(int i = 0; i < N; i ++ )
li[i] = -inf, ri[i] = -inf, inc[i] = -inf;
li[0] = 0;
ri[n + 1] = 0;
ri[n + 2] = 0;
ll p;
for(ll i = 1 ; i <= n; i++ ){
p = i - 1;
li[i] = li[i - 1];
cur.push({p, p * (p - 1)/2ll + f[p] + li[max(0ll, i - 2)], inf});
li[i] = max(li[i], cur.query(-i) + i * (i + 1) / 2ll - f[i]);
}
cur.clean();
for(ll i = n; i >= 1; i -- ){
p = i - 1;
ri[i] = ri[i + 1];
cur.push({-i, i * (i + 1)/2ll - f[i] + ri[i + 2], inf});
ri[i] = max(ri[i], cur.query(p) + p * (p - 1) / 2ll + f[p]);
}
cur.clean();
solve(1, n);
int q;
cin >> q;
ll res;
int id;
ll x;
for(int i = 0 ;i < q; i ++ ){
cin >> id >> x;
cout << max(inc[id] + (t[id] - x), li[id - 1] + ri[id + 1]) << "\n";
}
return 0;
} | a.cc:2:1: error: 'Copy' does not name a type
2 | Copy
| ^~~~
|
s798563482 | p03845 | C++ | A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Time limit
2000 ms
Memory limit
262144 kB
D - Contest with Drinks Easy
All Copyright Reserved © 2010-2019 Xu Han
Server Time: 2019-07-15 20:10:56 UTC+2
#20465742 | Nermeenatalla's solution for [Problem D]
Status
Compilation Error
Length
214
Lang
C++14 (GCC 5.3.0)
Submitted
2019-07-15 20:10:16
Shared
./Main.cpp: In function ‘int main()’:
./Main.cpp:17:1: error: expected ‘}’ at end of input
}
^
Select Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,T[N],t=0,M,p[M],x[M];
cin>>N;
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
for(j=1;i<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
}} | a.cc:34:24: error: extended character © is not valid in an identifier
34 | All Copyright Reserved © 2010-2019 Xu Han
| ^
a.cc:37:11: error: "|" is not a valid filename
37 | #20465742 | Nermeenatalla's solution for [Problem D]
| ^
a.cc:37:26: warning: missing terminating ' character
37 | #20465742 | Nermeenatalla's solution for [Problem D]
| ^
a.cc:43:12: error: too many decimal points in number
43 | C++14 (GCC 5.3.0)
| ^~~~~
a.cc:48:25: error: extended character ‘ is not valid in an identifier
48 | ./Main.cpp: In function ‘int main()’:
| ^
a.cc:48:36: error: extended character ’ is not valid in an identifier
48 | ./Main.cpp: In function ‘int main()’:
| ^
a.cc:49:34: error: extended character ‘ is not valid in an identifier
49 | ./Main.cpp:17:1: error: expected ‘}’ at end of input
| ^
a.cc:49:36: error: extended character ’ is not valid in an identifier
49 | ./Main.cpp:17:1: error: expected ‘}’ at end of input
| ^
a.cc:1:1: error: 'A' does not name a type
1 | A
| ^
a.cc:49:35: error: expected declaration before '}' token
49 | ./Main.cpp:17:1: error: expected ‘}’ at end of input
| ^
a.cc:49:36: error: '\U00002019' does not name a type
49 | ./Main.cpp:17:1: error: expected ‘}’ at end of input
| ^
a.cc:50:1: error: expected declaration before '}' token
50 | }
| ^
a.cc:51:1: error: expected unqualified-id before '^' token
51 | ^
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:54:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14 |
s811652913 | p03845 | C++ | A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Time limit
2000 ms
Memory limit
262144 kB
D - Contest with Drinks Easy
All Copyright Reserved © 2010-2019 Xu Han
Server Time: 2019-07-15 22:20:31 UTC+2
#20466522 | Nermeenatalla's solution for [Problem D]
Status
Submit Failed
Length
236
Lang
C++14 (GCC 5.3.0)
Submitted
2019-07-15 22:18:18
Shared
Select Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N+5];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
int p[M+5],x[M+5];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t+x[j]-T[p[j]]<<endl;
}} | a.cc:34:24: error: extended character © is not valid in an identifier
34 | All Copyright Reserved © 2010-2019 Xu Han
| ^
a.cc:37:11: error: "|" is not a valid filename
37 | #20466522 | Nermeenatalla's solution for [Problem D]
| ^
a.cc:37:26: warning: missing terminating ' character
37 | #20466522 | Nermeenatalla's solution for [Problem D]
| ^
a.cc:43:12: error: too many decimal points in number
43 | C++14 (GCC 5.3.0)
| ^~~~~
a.cc:1:1: error: 'A' does not name a type
1 | A
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:49:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
|
s596115795 | p03845 | C++ | ticle
Logout
Nermeenatalla
Begin: 2019-07-12 16:30 UTC+2
level zero week 1 contest
End: 2019-07-19 16:30 UTC+2
77:48:33
Elapsed: 77:48:33 Running Remaining: 90:11:26
Overview
Problem
Status
Rank (77:48:24)
3 Comments
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Time limit
2000 ms
Memory limit
262144 kB
D - Contest with Drinks Easy
All Copyright Reserved © 2010-2019 Xu Han
Server Time: 2019-07-15 22:18:33 UTC+2
#20466522 | Nermeenatalla's solution for [Problem D]
Status
Submit Failed
Length
236
Lang
C++14 (GCC 5.3.0)
Submitted
2019-07-15 22:18:18
Shared
Select Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N+5];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
int p[M+5],x[M+5];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t+x[j]-T[p[j]]<<endl;
}} | a.cc:47:24: error: extended character © is not valid in an identifier
47 | All Copyright Reserved © 2010-2019 Xu Han
| ^
a.cc:50:11: error: "|" is not a valid filename
50 | #20466522 | Nermeenatalla's solution for [Problem D]
| ^
a.cc:50:26: warning: missing terminating ' character
50 | #20466522 | Nermeenatalla's solution for [Problem D]
| ^
a.cc:56:12: error: too many decimal points in number
56 | C++14 (GCC 5.3.0)
| ^~~~~
a.cc:1:1: error: 'ticle' does not name a type
1 | ticle
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:62:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean |
s973221703 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
int p[M],x[M];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-(T[p[j]]+x[j])>>endl;
}} | a.cc: In function 'int main()':
a.cc:18:23: error: no match for 'operator>>' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
18 | cout<<t-(T[p[j]]+x[j])>>endl;
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
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:18:25: note: couldn't deduce template parameter '_IntegerType'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:
a.cc:18:25: note: couldn't deduce template parameter '_Tp'
18 | cout<<t-(T[p[j]]+x[j])>>endl;
| ^~~~
/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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>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/substitution failed:
a.cc:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t-(T[p[j]]+x[j])>>endl;
| ^~~~
/usr/include/c++/14/iomanip:237:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setw)'
237 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:237:5: note: template argument deduction/substitution failed:
a.cc:18:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>'
18 | cout<<t- |
s179211451 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
int p[M],x[M];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
} | a.cc: In function 'int main()':
a.cc:19:2: error: expected '}' at end of input
19 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s562301336 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin<<M;
int p[M],x[M];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
} | a.cc: In function 'int main()':
a.cc:13:4: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
13 | cin<<M;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:13:4: note: candidate: 'operator<<(int, int)' (built-in)
13 | cin<<M;
| ~~~^~~
a.cc:13:4: 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/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:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/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:13:1: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
13 | cin<<M;
| ^~~
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/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/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:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/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:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
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: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:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:13:6: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
13 | cin<<M;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: |
s504185427 | p03845 | C++ |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin M;
int p[M],x[M];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
} | a.cc: In function 'int main()':
a.cc:14:4: error: expected ';' before 'M'
14 | cin M;
| ^~
| ;
a.cc:20:2: error: expected '}' at end of input
20 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s845852250 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N,I=0,j=0,t=0,M;
cin>>N;
int T[N];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin M;
int p[M],x[M];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
}
}
| a.cc: In function 'int main()':
a.cc:8:5: error: 'i' was not declared in this scope
8 | for(i=1;i<=N;i++)
| ^
a.cc:13:4: error: expected ';' before 'M'
13 | cin M;
| ^~
| ;
|
s434400500 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,T[N],t=0,M,p[M],x[M];
cin>>N;
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
for(j=1;i<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
} | a.cc: In function 'int main()':
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s482659840 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int i=0,j=0,T[N],t=0,M,p[M],x[M];
cin>>N;
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
for(j=1;i<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t-T[p[j]]+x[j];
} | a.cc: In function 'int main()':
a.cc:5:15: error: 'N' was not declared in this scope
5 | int i=0,j=0,T[N],t=0,M,p[M],x[M];
| ^
a.cc:9:6: error: 'T' was not declared in this scope
9 | cin>>T[i];
| ^
a.cc:16:9: error: 'T' was not declared in this scope
16 | cout<<t-T[p[j]]+x[j];
| ^
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s272121672 | p03845 | C++ | using namespace std;
int main()
{
int a,b,x,count=0;
cin>>a>>b>>x;
if(a>=0&&b>=0&&x>0)
{
for(int i=a; I<=b; i++)
{
if(i%x==0){
count ++;
}
}}
count <<count;
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope
5 | cin>>a>>b>>x;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:8:14: error: 'I' was not declared in this scope
8 | for(int i=a; I<=b; i++)
| ^
|
s437012988 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[100000];
int n;
scanf("%d",&n);
int i = 1;
while(n --)
{
cin >> arr[i];
i ++;
}
int m;
cin >> m;
while(m --)
{
int p, x;
cin >> p >> x;
int c;
c = arr[p];
arr[p] = x;
int sum = 0;
for(int j = 1; j < i; j ++)
{
sum += arr[j];
}
cout << sum <<endl;
arr[p] = c;
} | a.cc: In function 'int main()':
a.cc:30:6: error: expected '}' at end of input
30 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s447932837 | p03845 | C | #include<stdio.h>
#include<iostream>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main(){
int n,i;
cin>>n;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
}
int m;
cin>>m;
int x[m],y[m],d,z=0,p=0;
for(i=0;i<m;i++){
cin>>x[i]>>y[i];
}
for(i=0;i<m;i++){
z=0;
d=x[i]-1;
p=a[d];
a[d]=y[i];
for(int j=0;j<n;j++){
z=z+a[j];
//cout<<a[j]<<" ";
}
cout<<z<<endl;
a[d]=p;
}
return 0;
}
| main.c:2:9: fatal error: iostream: No such file or directory
2 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s648404335 | p03845 | C++ | #include<iostream>
using namespace::std;
int main(){
int n;
cin>>n;
int ar[n],sum=0;
for(int i=0;i<n;i++)
cin>>ar[i],sum+=ar[i];
int m;
cin>>m;
for(int j=0,l,r;j<m;j++){
cin>>l<<r;
cout<<sum+r-ar[l-1]<<'\n';
}
} | a.cc: In function 'int main()':
a.cc:14:13: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
14 | cin>>l<<r;
| ~~~~~~^~~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:14:13: note: candidate: 'operator<<(int, int)' (built-in)
14 | cin>>l<<r;
| ~~~~~~^~~
a.cc:14:13: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
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:14:10: note: cannot convert 'std::cin.std::basic_istream<char>::operator>>(l)' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte'
14 | cin>>l<<r;
| ~~~^~~
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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
14 | cin>>l<<r;
| ^
/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:14:15: required from here
14 | cin>>l<<r;
| ^
/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)
| |
s233556632 | p03845 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int N;
cin > N;
int T[N];
for(int i = 0; i < N; i++) {
cin >> T[i];
}
int M;
cin >> M;
int P[M];
int X[M];
for(int i = 0; i < M; i++) {
cin >> P[i] >> X[i];
}
int a[M];
for(int i = 0; i < M; i++) {
T[P[i]] = X[i];
for(int j = 0; j < N; j++) {
a[i] += T[j];
}
}
for(int i = 0; i < M; i++) {
cout << a[i] << "\n";
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:9: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin > N;
| ~~~ ^ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:9: note: candidate: 'operator>(int, int)' (built-in)
8 | cin > N;
| ~~~~^~~
a.cc:8:9: 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/string:48,
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.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
8 | cin > N;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
8 | cin > N;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
8 | cin > N;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
8 | cin > N;
| ^
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:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
8 | cin > N;
| ^
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:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
8 | cin > N;
| ^
/usr/include/c++/14/string_view:702: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> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
8 | cin > N;
| ^
/usr/include/c++/14/string_view:710: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>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
8 | cin > N;
| ^
/usr/include/c++/14/bits/basic_string.h:3915: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>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
8 | cin > N;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
8 | cin > N;
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
8 | cin > N;
| ^
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:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
8 | cin > N;
| ^
|
s611367716 | p03845 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int N = keyboard.nextInt();
int[] T = new int[N]
int sum = 0;
for(int i = 0; i < N; i++){
T[i] = keyboard.nextInt();
sum += T[i]
}
int M = keyboard.nextInt();
int[] P = new int[M]
int[] X = new int[M]
int[] ans = new int[M]
for(int j = 0; j < M; j++){
P[j] = keyboard.nextInt();
X[j] = keyboard.nextInt();
ans[j] = sum - T[P[j]] +X[j] ;
}
for(int k = 0; k < M; k++){
System.out.println(ans[k]);
}
keyboard.close();
}
}
| Main.java:10: error: ';' expected
int[] T = new int[N]
^
Main.java:15: error: ';' expected
sum += T[i]
^
Main.java:20: error: ';' expected
int[] P = new int[M]
^
Main.java:21: error: ';' expected
int[] X = new int[M]
^
Main.java:22: error: ';' expected
int[] ans = new int[M]
^
5 errors
|
s054207907 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int n;
cin>>n;
int t[n];
int i, j;
int ans = 0;
REP(i, n){
cin>>t[i];
ans += t[i];
}
int m;
cin>>m;
int p[m], x[m];
for(i=0; i<m; i++){
cin>>p[i]>>x[i];
}
for(i=0; i<m; i++){
cout<<gokei-t[p[i]+1]+x[i]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:31:15: error: 'gokei' was not declared in this scope
31 | cout<<gokei-t[p[i]+1]+x[i]<<endl;
| ^~~~~
|
s140823684 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int n;
cin>>n;
int t[n];
int i, j;
int ans = 0;
REP(i, n){
cin>>t[i];
ans += t[i];
}
int m;
cin>>m;
int p[m], x[m];
for(i=0; i<m; i++){
cin>>p[i]>>x[i];
}
max = -1*INF;
for(i=0; i<m; i++){
cout<<gokei-t[p[i]+1]+x[i]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:13: error: overloaded function with no contextual type information
8 | #define INF 2e9
| ^~~
a.cc:30:14: note: in expansion of macro 'INF'
30 | max = -1*INF;
| ^~~
a.cc:33:15: error: 'gokei' was not declared in this scope
33 | cout<<gokei-t[p[i]+1]+x[i]<<endl;
| ^~~~~
|
s417754502 | p03845 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void){
int N;
cin >> N;
vector<int>time(N,0);
for(int i=0;i<N;i++){
cin >> time[i];
}
int M;
cin >> M;
vector<vector<int>>drink(M,vector<int>(2,0));
for(int i=0;i<M;i++){
for(int j=0;j<2;j++){
cin >> drink[i][j];
}
}
for(int i=0;i<M;i++){
int ans = 0;
for(int j= 0;j<N;j++){
ans += time[j];
}
ans += drink[i][1] - time[drink[i][1] -1];
cout << ans << endl;
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main(void){
int N;
cin >> N;
vector<int>time(N,0);
for(int i=0;i<N;i++){
cin >> time[i];
}
int M;
cin >> M;
vector<vector<int>>drink(M,vector<int>(2,0));
for(int i=0;i<M;i++){
for(int j=0;j<2;j++){
cin >> drink[i][j];
}
}
for(int i=0;i<M;i++){
int ans = 0;
for(int j= 0;j<N;j++){
ans += time[j];
}
ans += drink[i][1] - time[drink[i][1]];
cout << ans << endl;
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main(void){
int N;
cin >> N;
vector<int>time(N,0);
for(int i=0;i<N;i++){
cin >> time[i];
}
int M;
cin >> M;
vector<vector<int>>drink(M,vector<int>(2,0));
for(int i=0;i<M;i++){
for(int j=0;j<2;j++){
cin >> drink[i][j];
}
}
for(int i=0;i<M;i++){
int ans = 0;
for(int j= 0;j<N;j++){
ans += time[j];
}
ans += drink[i][1] - time[drink[i][1] -1];
cout << ans << endl;
}
return 0;
} | a.cc:38:5: error: redefinition of 'int main()'
38 | int main(void){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(void){
| ^~~~
a.cc:72:5: error: redefinition of 'int main()'
72 | int main(void){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(void){
| ^~~~
|
s275007588 | p03845 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void){
int N;
cin >> N;
vector<int>time(N,0);
for(int i=0;i<N;i++){
cin >> time[i];
}
int M;
cin >> M;
vector<vector<int>>drink(M,vector<int>(2,0));
for(int i=0;i<M;i++){
for(int j=0;j<2;j++){
cin >> drink[i][j];
}
}
for(int i=0;i<M;i++){
int ans = 0;
for(int j= 0;j<N;j++){
ans += time[j];
}
ans += drink[i][1] - time[drink[i][1]];
cout << ans << endl;
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main(void){
int N;
cin >> N;
vector<int>time(N,0);
for(int i=0;i<N;i++){
cin >> time[i];
}
int M;
cin >> M;
vector<vector<int>>drink(M,vector<int>(2,0));
for(int i=0;i<M;i++){
for(int j=0;j<2;j++){
cin >> drink[i][j];
}
}
for(int i=0;i<M;i++){
int ans = 0;
for(int j= 0;j<N;j++){
ans += time[j];
}
ans += drink[i][1] - time[drink[i][1] -1];
cout << ans << endl;
}
return 0;
}
| a.cc:38:5: error: redefinition of 'int main()'
38 | int main(void){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(void){
| ^~~~
|
s021316166 | p03845 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
int N;
cin >> N;
int T[N];
for(int i = 0; i < N; i++){
cint >> T[i];
}
int sum = 0;
for(int i = 0; i < N; i++){
sum += T[i];
}
int M = 0;
cin >> M;
for(int i = 0; i < M; i++){
int P, X;
cin >> P >> X;
cout << sum-T[P]+X << "\n";
}
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'cint' was not declared in this scope; did you mean 'uint'?
13 | cint >> T[i];
| ^~~~
| uint
|
s259138138 | p03845 | C++ | import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int timeArray = new int[n];
int sum = 0;
for (int i=0;i<n;i++){
timeArray[i] = sc.nextInt();
sum += timeArray[i];
}
int m = sc.nextInt();
for (int j=0;j<m;j++){
int index = sc.nextInt()-1;
int x = sc.nextInt();
System.out.println(sum-(timeArray[index]-x));
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s687928257 | p03845 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main(){
ll n,m,sumt=0;
cin >> n;
vll t(n);
for (ll i=0;i<n;i++) {
cin>>t[i];
sumt += t[i];
}
cin>>m;
for (ll i=0;i<m;i++) {
cin>>p[i]>>x[i];
cout<<sumt-t[p[i]-1]+x[i]<<endl;
}
} | a.cc: In function 'int main()':
a.cc:15:10: error: 'p' was not declared in this scope
15 | cin>>p[i]>>x[i];
| ^
a.cc:15:16: error: 'x' was not declared in this scope
15 | cin>>p[i]>>x[i];
| ^
|
s212423912 | p03845 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n;
cin>>n;
int t[n];
REP(i,n){
cin>>t[i];
}
int m;
cin>>m;
int p[m],x[m];
REP(i,m){
cin>>p[i]>>x[i];
}
int ans=0;
REP(i,m){
REP(j,n){
if(j==p[i]){
ans += x[i];
}else{
ans += t[j]
}
}
cout<<ans<<endl;
ans = 0;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:106:20: error: expected ';' before '}' token
106 | ans += t[j]
| ^
| ;
107 | }
| ~
|
s278591366 | p03845 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void){
int N,M,sum=0;
cin>>N;
int T[N];
for(int i=0;i<N;i++){
cin>>T[i];
sum+=T[i];
}
cin>>M;
int P[N],X[M],sum[M];
for(int i=0;i<M;i++){
cin>>P[i]>>X[i];
cout<<sum+X[i]-T[P[i]-1]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:19: error: conflicting declaration 'int sum [M]'
13 | int P[N],X[M],sum[M];
| ^~~
a.cc:5:13: note: previous declaration as 'int sum'
5 | int N,M,sum=0;
| ^~~
|
s074225189 | p03845 | C++ | #include<iostream>
using namespace std;
int time[101];
struct drink
{
int x,y;
}a[101];
int main()
{
int N,M,cnt=0;
cin>>N;
for(int i=1;i<=N;i++)
{
cin>>time[i];
cnt+=time[i];
}
cin>>M;
for(int i=1;i<=M;i++)
cin>>a[i].x>>a[i].y;
for(int i=1;i<=M;i++)
cout<<cnt+a[i].y-time[a[i].x]<<endl;
return 0;
}
| a.cc:3:13: error: 'int time [101]' redeclared as different kind of entity
3 | int time[101];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:14:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
14 | cin>>time[i];
| ^
a.cc:14:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
14 | cin>>time[i];
| ~~~^~~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
14 | cin>>time[i];
| ~~~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:14:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
14 | cin>>time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:14:20: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_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:14:20: error: invalid conversion from |
s343532896 | p03845 | C | #include <stdio.h>
int main (){
int n;
int t[101];
int m;
int p[101];
int x[101];
int sum = 0;
int i;
scanf("%d" ,&n);
for( i = 0; i < n; i++) {
scanf("%d" &t[i]);
sum = sum + t[i];
}
scanf("%d" ,&m);
for( i = 0; i < m; i++) {
scanf("%d %d" ,&p[i] ,&x[i]);
}
for( i = 0; i < m; i++) {
printf("%d\n" ,sum = t[p[i] - 1] + x[i]);
}
return 0;
} | main.c: In function 'main':
main.c:17:20: error: invalid operands to binary & (have 'char *' and 'int')
17 | scanf("%d" &t[i]);
| ~~~~ ^~~~~
| | |
| char * int
|
s577073102 | p03845 | C++ | #include <bits10_1.h/stdc++.h>
using namespace std;
int main(){
int n, m, i, p, x, sum = 0;
cin >> n;
int t[n];
for(i=0; i<n; i++){
cin >> t[i];
sum += t[i];
}
cin >> m;
for(i=0; i<m; i++){
cin >> p >> x;
cout << sum + x - t[p-1] << '\n';
}
return 0;
}
| a.cc:1:10: fatal error: bits10_1.h/stdc++.h: No such file or directory
1 | #include <bits10_1.h/stdc++.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.