submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s826022851
p03844
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in()) int a = sc.nextInt(); String op = sc.next(); int b = sc.nextInt(); if (op.equals("+")) { System.out.println(a + b); }else if (op.equals("-")) { System.out.println(a - b); }else { } } }
Main.java:4: error: ';' expected Scanner sc = new Scanner(System.in()) ^ 1 error
s947190424
p03844
Java
public class Test002 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String[] N = line.split(" "); int a=Integer.parseInt(N[0]); int b=Integer.parseInt(N[2]); for(int i=0; i<3; i++){ char T = N[i].charAt(0) ; if(N[1].equals("+")){ System.out.println(a+b); break; }else if(N[1].equals("-")){ System.out.println(a-b); break; } } } }
Main.java:3: error: class Test002 is public, should be declared in a file named Test002.java public class Test002 { ^ Main.java:7: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Test002 Main.java:7: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Test002 3 errors
s355979164
p03844
C++
#include<iostream> using namespace std; int main(){ int x,y;char c; cin>>x>>c>>y; if(c=="+"){cout<<x+y<<endl;}else{cout<<x-y<<endl;} return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | if(c=="+"){cout<<x+y<<endl;}else{cout<<x-y<<endl;} | ~^~~~~
s144738541
p03844
C++
#include<bits/stdc++.h> using namespace std; int main() { char a[1000]; int p=0,b=0,sum=0,f=0,i; gets(a); int len=strlen(a); for(i=0;i<len;i++) { if(a[i]!=' '&&a[i]!='+'&&a[i]!='-') { sum=sum+a[i]-48; sum=sum*10; // cout<<sum<<endl; } else if(a[i]=='+') { p=sum; sum=0; f=1; } else if(a[i]=='-') { p=sum; sum=0; f=2; } } p=p/10; sum=sum/10; if(f==1)cout<<p+sum<<endl; else cout<<p-sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s516507335
p03844
C++
#include<bits/stdc++.h> using namespace std; int main() { char d[100]; char *a,b[10]; int p,q; gets(d); a=strtok(d," "); p=atoi(a); for(int i=0;a!=NULL;i++) { if(i==1)strcpy(b,a); if(i==2)q=atoi(a); a=strtok(NULL," "); } if(strcmp(b,"+")==0)cout<<p+q<<endl; else cout<<p-q<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets(d); | ^~~~ | getw
s773213514
p03844
C++
#include<iostream> using namespace std; int main(){ int a,b; char op( cin>>a>>op>>b; if(op=='+'){ cout<<(a+b)<<endl; }else{ cout<<(a-b)<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: expected ')' before ';' token 6 | cin>>a>>op>>b; | ^ | ) a.cc:5:9: note: to match this '(' 5 | char op( | ^
s863694123
p03844
C++
#include <iostream> #include <string> using namespace std; int main(){ int a,b; string op; cin>>a>>op>>b; if(op=='+'){ cout<<a+b<<endl; }else{ cout<<a-b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:14: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 13 | if(op=='+'){ | ~~^~~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:13:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:13:16: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:13:16: note: mismatched types 'const _CharT*' and 'char' 13 | if(op=='+'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:13:16: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:13:16: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 13 | if(op=='+'){ | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46: /usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<char>&, const __new_allocator<_Tp>&)' 215 | operator=
s054545775
p03844
C++
s = input().split() a, b = int(s[0]), int(s[2]); if s[1]== '+': a+=b; print (a) else: a-=b; print (a)
a.cc:1:1: error: 's' does not name a type 1 | s = input().split() | ^ a.cc:3:1: error: expected unqualified-id before 'if' 3 | if s[1]== '+': | ^~ a.cc:5:11: error: expected constructor, destructor, or type conversion before '(' token 5 | print (a) | ^ a.cc:8:11: error: expected constructor, destructor, or type conversion before '(' token 8 | print (a) | ^
s243139277
p03844
Java
public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int A = scan.nextInt(); String op = scan.next(); int B = scan.nextInt(); int res; if(op.equals("+")){ res = A+B; }else{ res = A-B; } System.out.println(res); } }
Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s383127669
p03844
C++
static void Main(string[] args) { try { uint a = uint.Parse(args[0]); var op = args[1]; int b = int.Parse(args[2]); if (op == "+") System.Console.Out.WriteLine(a + b); else if (op == "-") System.Console.Out.WriteLine(a - b); }catch(Exception e) { e.GetBaseException(); } }
a.cc:1:13: error: variable or field 'Main' declared void 1 | static void Main(string[] args) | ^~~~ a.cc:1:18: error: 'string' was not declared in this scope 1 | static void Main(string[] args) | ^~~~~~ a.cc:1:25: error: expected primary-expression before ']' token 1 | static void Main(string[] args) | ^
s845889515
p03844
C++
#include <stdio> int main() { long a,b; char op; scanf("%d %c %d", &a, &op, &b); if(op == '+') printf("%d", a+b); if(op == '-') printf("%d", a-b); }
a.cc:1:10: fatal error: stdio: No such file or directory 1 | #include <stdio> | ^~~~~~~ compilation terminated.
s195957009
p03844
C++
#include <bits/stat.h> using namespace std; int main() { int a,b; char c; cin >> a >> c >> b; if(c == '+') cout << a + b << endl; else cout << a - b << endl; return 0; }
In file included from a.cc:1: /usr/include/x86_64-linux-gnu/bits/stat.h:19:3: error: #error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/stat.h:25: /usr/include/x86_64-linux-gnu/bits/struct_stat.h:20:3: error: #error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead." 20 | # error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead." | ^~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:31:5: error: '__dev_t' does not name a type 31 | __dev_t st_dev; /* Device. */ | ^~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:36:5: error: '__ino_t' does not name a type 36 | __ino_t st_ino; /* File serial number. */ | ^~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:44:5: error: '__nlink_t' does not name a type 44 | __nlink_t st_nlink; /* Link count. */ | ^~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:45:5: error: '__mode_t' does not name a type 45 | __mode_t st_mode; /* File mode. */ | ^~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:47:5: error: '__uid_t' does not name a type 47 | __uid_t st_uid; /* User ID of the file's owner. */ | ^~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:48:5: error: '__gid_t' does not name a type 48 | __gid_t st_gid; /* Group ID of the file's group.*/ | ^~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:52:5: error: '__dev_t' does not name a type 52 | __dev_t st_rdev; /* Device number, if device. */ | ^~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:57:5: error: '__off_t' does not name a type 57 | __off_t st_size; /* Size of file, in bytes. */ | ^~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:61:5: error: '__blksize_t' does not name a type 61 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | ^~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:63:5: error: '__blkcnt_t' does not name a type 63 | __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ | ^~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:81:5: error: '__time_t' does not name a type 81 | __time_t st_atime; /* Time of last access. */ | ^~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:82:5: error: '__syscall_ulong_t' does not name a type 82 | __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ | ^~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:83:5: error: '__time_t' does not name a type 83 | __time_t st_mtime; /* Time of last modification. */ | ^~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:84:5: error: '__syscall_ulong_t' does not name a type 84 | __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ | ^~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:85:5: error: '__time_t' does not name a type 85 | __time_t st_ctime; /* Time of last status change. */ | ^~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:86:5: error: '__syscall_ulong_t' does not name a type 86 | __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ | ^~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/struct_stat.h:89:5: error: '__syscall_slong_t' does not name a type 89 | __syscall_slong_t __glibc_reserved[3]; | ^~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:9:5: error: 'cin' was not declared in this scope 9 | cin >> a >> c >> b; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <bits/stat.h> +++ |+#include <iostream> 2 | a.cc:11:9: error: 'cout' was not declared in this scope 11 | cout << a + b << endl; | ^~~~ a.cc:11:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:11:26: error: 'endl' was not declared in this scope 11 | cout << a + b << endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <bits/stat.h> +++ |+#include <ostream> 2 | a.cc:13:9: error: 'cout' was not declared in this scope 13 | cout << a - b << endl; | ^~~~ a.cc:13:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:13:26: error: 'endl' was not declared in this scope 13 | cout << a - b << endl; | ^~~~ a.cc:13:26: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s205319601
p03844
C++
#include<iostream> #include<string> int main() { std::string input; int a,b; std::cin >> input; a = std::stoi(input[0]); b = std::stoi(input[4]); if(input[2] == "-") { std::cout << a - b << std::endl; } else{ std::cout << a + b << std::endl; } }
a.cc: In function 'int main()': a.cc:8:18: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 8 | a = std::stoi(input[0]); | ~~~~~~~~~^~~~~~~~~~ In file included 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/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:9:18: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 9 | b = std::stoi(input[4]); | ~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:10:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(input[2] == "-")
s638175352
p03844
C++
#include<iostream> #include<string> int main() { std::string input; int a b; std::cin >> input; a = std::stoi(input[0]); b = std::stoi(input[4]); if(input[2] == "-") { std::cout << a - b << std::endl; } else{ std::cout << a + b << std::endl; } }
a.cc: In function 'int main()': a.cc:6:11: error: expected initializer before 'b' 6 | int a b; | ^ a.cc:8:5: error: 'a' was not declared in this scope 8 | a = std::stoi(input[0]); | ^ a.cc:8:18: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 8 | a = std::stoi(input[0]); | ~~~~~~~~~^~~~~~~~~~ In file included 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/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:9:5: error: 'b' was not declared in this scope 9 | b = std::stoi(input[4]); | ^ a.cc:9:18: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 9 | b = std::stoi(input[4]); | ~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:10:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(input[2] == "-")
s699024161
p03844
C++
#include <iostream> #include <vector> using namespace std; int Gets(char *buff,int buffMaxSize) { buff[0]='\0'; if (fgets(buff,buffMaxSize,stdin)==NULL){ return -1; } size_t strLen = strlen(buff); if (strLen>0){ while (buff[strLen-1] == '\r' || buff[strLen-1]=='\n'){//改行コード strLen--; buff[strLen]='\0'; } } return (int)strLen; } int GetData(vector<string> &dataList,char *line,char *deli) { char *p = new char[strlen(line)+1]; strcpy(p,line); char* token = strtok(p, deli); while (token != NULL) { dataList.push_back(token); token = strtok(NULL, deli); } delete[] p; return 0; } int main(int argc, char* argv[]) { char s[1024]; Gets(s,1024); vector<string> dataList; vector<string> opList; GetData(dataList,s,"+-"); GetData(opList,s,"0123456789 "); switch(opList[0].c_str()[0]){ case '+': cout<<atol(dataList[0].c_str())+atol(dataList[1].c_str())<<endl; break; case '-': cout<<atol(dataList[0].c_str())-atol(dataList[1].c_str())<<endl; break; } return 0; }
a.cc: In function 'int Gets(char*, int)': a.cc:10:25: error: 'strlen' was not declared in this scope 10 | size_t strLen = strlen(buff); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <vector> +++ |+#include <cstring> 3 | using namespace std; a.cc: In function 'int GetData(std::vector<std::__cxx11::basic_string<char> >&, char*, char*)': a.cc:21:28: error: 'strlen' was not declared in this scope 21 | char *p = new char[strlen(line)+1]; | ^~~~~~ a.cc:21:28: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:22:9: error: 'strcpy' was not declared in this scope 22 | strcpy(p,line); | ^~~~~~ a.cc:22:9: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:23:23: error: 'strtok' was not declared in this scope; did you mean 'strtoq'? 23 | char* token = strtok(p, deli); | ^~~~~~ | strtoq a.cc: In function 'int main(int, char**)': a.cc:37:28: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 37 | GetData(dataList,s,"+-"); | ^~~~ a.cc:38:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 38 | GetData(opList,s,"0123456789 "); | ^~~~~~~~~~~~~
s499292688
p03844
Java
import java.util.Scanner; public class A050 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String op = sc.next(); String b = sc.next(); sc.close(); if (op.equals("+")) { System.out.println(Integer.valueOf(a) + Integer.valueOf(b));; } else { System.out.println(Integer.valueOf(a) - Integer.valueOf(b));; } } }
Main.java:3: error: class A050 is public, should be declared in a file named A050.java public class A050 { ^ 1 error
s305918423
p03844
Java
package atcoder.beg50; import java.util.Scanner; public class A050 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String op = sc.next(); String b = sc.next(); sc.close(); if (op.equals("+")) { System.out.println(Integer.valueOf(a) + Integer.valueOf(b));; } else { System.out.println(Integer.valueOf(a) - Integer.valueOf(b));; } } }
Main.java:5: error: class A050 is public, should be declared in a file named A050.java public class A050 { ^ 1 error
s231134442
p03844
C++
#incluide<cstdio> void main() { int A, B; char op; scanf("%d%c%d", &A, &op, &B); printf("%d\n", op == '+' ? A + B : A - B); }
a.cc:1:2: error: invalid preprocessing directive #incluide; did you mean #include? 1 | #incluide<cstdio> | ^~~~~~~~ | include a.cc:3:1: error: '::main' must return 'int' 3 | void main() | ^~~~ a.cc: In function 'int main()': a.cc:7:3: error: 'scanf' was not declared in this scope 7 | scanf("%d%c%d", &A, &op, &B); | ^~~~~ a.cc:8:3: error: 'printf' was not declared in this scope 8 | printf("%d\n", op == '+' ? A + B : A - B); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #incluide<cstdio>
s373362139
p03844
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); byte op = sc.nextByte(); int B = sc.nextInt(); int answer; if (op == '+') answer = A + B; else if (op == '-') answer = A - B; System.out.println("" + answer); } }
Main.java:15: error: variable answer might not have been initialized System.out.println("" + answer); ^ 1 error
s752202771
p03844
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); byte op = sc.nextByte(); int B = sc.nextInt(); int answer; if (op == '+') answer = A + B; else if (op == '-') answer = A - B; System.out.print("" + answer); } }
Main.java:15: error: variable answer might not have been initialized System.out.print("" + answer); ^ 1 error
s137836299
p03844
Java
import java.util.Scanner; pubilc class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); byte op = sc.nextByte(); int B = sc.nextInt(); int answer; if (op == '+') answer = A + B; else if (op == '-') answer = A - B; System.out.print("" + answer); } }
Main.java:3: error: class, interface, enum, or record expected pubilc class Main ^ 1 error
s850267320
p03844
C
#include<stdio.h> int main() { int a,b; char op; scanf("%d %c %d",&a,&op,&b); if(op == '-'){ print("%d\n",a-b); } else { print("%d\n",a+b); } return 0; }
main.c: In function 'main': main.c:9:1: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration] 9 | print("%d\n",a-b); | ^~~~~ | printf
s029612523
p03844
C++
#include <iostrem> using namespace std; int main(){ int a,b; char c; cin>>a>>c>>b; if(c=='+') cout<<a+b<<endl; else cout<<a-b<<endl; }
a.cc:1:10: fatal error: iostrem: No such file or directory 1 | #include <iostrem> | ^~~~~~~~~ compilation terminated.
s443398838
p03844
C++
#include <iostream> using namespace std; int main(){ int a,b; char c; cin>>a>>c>>b; if(n=='+') cout<<a+b<<endl; else cout<<a-b<<endl; }
a.cc: In function 'int main()': a.cc:9:5: error: 'n' was not declared in this scope 9 | if(n=='+') cout<<a+b<<endl; | ^
s995975524
p03844
C++
#include <iostrem> using namespace std; int main(){ int a,b; char c; cin>>a>>c>>b; if(n=='+') cout<<a+b<<endl; else cout<<a-b<<endl; }
a.cc:1:10: fatal error: iostrem: No such file or directory 1 | #include <iostrem> | ^~~~~~~~~ compilation terminated.
s164160473
p03844
C
#include<stdio.h> int main(){ int a,b,c,d; a=b=c=d=0; scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); if(c==+){ d=a+b; } if(c==-){ d=a-b; } printf("%d",d); return 0; }
main.c: In function 'main': main.c:8:8: error: expected expression before ')' token 8 | if(c==+){ | ^ main.c:11:8: error: expected expression before ')' token 11 | if(c==-){ | ^
s170521514
p03844
C
#include<stdio.h> int main(){ int a,b,c,d; scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); if(c==+){ d=a+b; } if(c==-){ d=a-b; } printf("%d",d); return 0; }
main.c: In function 'main': main.c:7:8: error: expected expression before ')' token 7 | if(c==+){ | ^ main.c:10:8: error: expected expression before ')' token 10 | if(c==-){ | ^
s026676874
p03844
C++
#include <bits/stdc++.h> using namespace std; int main() { char str[100]; gets(str); long a, b; char op; sscanf(str, "%ld %c %ld", &a, &op, &b); long ans = 0; if (op=='-') ans = a-b; else ans = a+b; cerr << a << ' ' << op << ' ' << b; printf("%ld", ans); return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(str); | ^~~~ | getw
s774028130
p03844
C
#include<stdio.h> int main(){ int a,b,c,d; a=b=c=d=0; scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); if(c==+){ d=a+b; } if(c==-){ d=a-b; } printf("%d",d); return 0; }
main.c: In function 'main': main.c:8:8: error: expected expression before ')' token 8 | if(c==+){ | ^ main.c:11:8: error: expected expression before ')' token 11 | if(c==-){ | ^
s952312798
p03844
C++
#include < bits/stdc++.h> using namespace std; int main(){ int a, b;char c; cin>> a>> c>> b; cout<< a-b << endl; }
a.cc:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include < bits/stdc++.h> | ^~~~~~~~~~~~~~~~ compilation terminated.
s809708324
p03844
C++
#include <bits/stdc++.h> using namespace std; int main() { char str[100]; gets(str); int a, b; char op; sscanf(str, "%d %c %d", &a, &op, &b); int ans = 0; if (op=='-') ans = a-b; else ans = a+b; cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(str); | ^~~~ | getw
s892230618
p03844
C++
#include <IOstream> using namespace std; int main(){ int a,b; char op; cin>>a>>op>>b;
a.cc:1:10: fatal error: IOstream: No such file or directory 1 | #include <IOstream> | ^~~~~~~~~~ compilation terminated.
s676025927
p03844
C++
#include <IOstream> using namespace std; int main(){ int a,b; char op; cin>>a>>op>>b;
a.cc:1:10: fatal error: IOstream: No such file or directory 1 | #include <IOstream> | ^~~~~~~~~~ compilation terminated.
s964499282
p03844
C++
#include <IOstream> using namespace std; int main(){ int a,b; char op; cin>>a>>op>>b;
a.cc:1:10: fatal error: IOstream: No such file or directory 1 | #include <IOstream> | ^~~~~~~~~~ compilation terminated.
s300328004
p03844
Java
import java.util.Scanner; public class main { public static void main(String[] args){ try { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); String b = scan.next(); int c = scan.nextInt(); if (b.equals("+")) { a = a+c; System.out.println(a); } else { System.out.println(b); a= a-c; System.out.println(a); } }catch (Exception e){} } }
Main.java:3: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s295281139
p03844
C
#include <stdio.h> int main(){ int A,B; char c; scanf("%d %c %d",&A,&c,&B); if( c == '+'){ printf("%d\n",A+B); }else if (c == '-'){ printf("%d\n",A-B); } return EXIT_SUCCESS; }
main.c: In function 'main': main.c:12:11: error: 'EXIT_SUCCESS' undeclared (first use in this function) 12 | return EXIT_SUCCESS; | ^~~~~~~~~~~~ main.c:2:1: note: 'EXIT_SUCCESS' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>' 1 | #include <stdio.h> +++ |+#include <stdlib.h> 2 | main.c:12:11: note: each undeclared identifier is reported only once for each function it appears in 12 | return EXIT_SUCCESS; | ^~~~~~~~~~~~
s428064695
p03844
C++
#include <bits/stdc++.h> using namespace std; int main() [ int a,b; char c; cin >> a >> c >> b; if(c == '+')cout << a + b << endl; else cout << a - b << endl; return 0; }
a.cc:5:1: error: expected primary-expression before 'int' 5 | int a,b; | ^~~ a.cc:4:2: error: expected ']' before 'int' 4 | [ | ^ | ] 5 | int a,b; | ~~~ a.cc:7:1: error: 'cin' does not name a type 7 | cin >> a >> c >> b; | ^~~ a.cc:8:1: error: expected unqualified-id before 'if' 8 | if(c == '+')cout << a + b << endl; | ^~ a.cc:9:1: error: expected unqualified-id before 'else' 9 | else cout << a - b << endl; | ^~~~ a.cc:10:1: error: expected unqualified-id before 'return' 10 | return 0; | ^~~~~~ a.cc:11:1: error: expected declaration before '}' token 11 | } | ^
s634091553
p03844
C++
#include <set> #include <cstring> #include <algorithm> #include <iostream> #include <cstdio> #include <cmath> #include <queue> #include <stack> #include <vector> #define mp make_pair #define pb push_back #define X first #define Y second using namespace std; typedef long long LL; const int maxn = 100005; char res[maxn]; int id; void init() { int a,b; char op; scanf("%d%c%d",&a,&c,&b); if(c=='+') cout<<a+b<<endl; else cout<<a-b<<endl; } int main() { #ifdef LOCAL freopen("in.txt", "r", stdin); #endif // LOCAL init(); return 0; }
a.cc: In function 'void init()': a.cc:24:24: error: 'c' was not declared in this scope 24 | scanf("%d%c%d",&a,&c,&b); | ^
s701179513
p03844
C++
/* Sourav Verma IPG_2013 ABV_IIITMG Task @ Codeforces & Atcoder */ #include<bits/stdc++.h> #define ll long long int #define loop(i,a,b) for(int i=(int)a;i<(int)b;++i) #define rloop(i,a,b) for(int i=(int)a;i<=(int)b;++i) #define loopr(i,a,b) for(int i=(int)a;i>=(int)b;--i) #define count_1(n) __builtin_popcountll(n) #define pb push_back #define mset(a,b,c) loop(i,0,b) a[i]=c #define F first #define S second #define mp make_pair #define clr(x) x.clear() #define MOD 1000000007 #define MAX 1e9 #define MIN -1e9 #define itoc(c) ((char)(((int)'0')+c)) #define vi vector<int> #define vvi vector<vi> #define pll pair<ll,ll> #define pii pair<int,int> #define all(p) p.begin(),p.end() #define mid(s,e) (s+(e-s)/2) #define mini INT_MIN #define sv() int t; scanf("%d",&t); while(t--) using namespace std; ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}} ll lcm(int x, int y) { return x * 1ll * y / (int)__gcd(x, y); } ll hcf(ll a, ll b) {if(b>a) return (hcf(b, a)); if(a%b==0) return b; return (hcf(b, a%b));} ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;} void solve(std::istream &in, std::ostream &out){ int a,b; char op; in>>a>>op>>b; if(op=='+') out<<a+b<"\n"; else out<<a-b<<"\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); #ifdef debug freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif solve(std::cin, std::cout); #ifdef debug fprintf(stdout,"\nTIME: %.3lf sec\n", (double)clock()/(CLOCKS_PER_SEC)); #endif return 0; }
a.cc: In function 'void solve(std::istream&, std::ostream&)': a.cc:37:25: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and 'const char [2]') 37 | if(op=='+') out<<a+b<"\n"; | ~~~~~~~~^~~~~ | | | | | const char [2] | std::basic_ostream<char> In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:4: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:37:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:37:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ 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:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/string_view:680: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> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/string_view:688: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>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:37:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 37 | if(op=='+') out<<a+b<"\n"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874: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>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:37:26: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::
s368097604
p03844
C++
#include <iostream> #include<algorithm> #include<math.h> using namespace std; static const int R = 10000; int main(){ int n[R],t,m; int sum = 0; int k = 0; cin >> t; for( int i = 0, i < n, i++) cin >> n[i]; cin >> m; for( int i = 0, i < m, i++) { cin >> number >> sec; n[number - 1] = sec; for( int i = 0, i < t, i++){ sum += n[i]; cout << sum << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: expected ';' before '<' token 12 | for( int i = 0, i < n, i++) cin >> n[i]; | ^~ | ; a.cc:12:27: error: expected primary-expression before '<' token 12 | for( int i = 0, i < n, i++) cin >> n[i]; | ^ a.cc:12:35: error: expected ';' before ')' token 12 | for( int i = 0, i < n, i++) cin >> n[i]; | ^ | ; a.cc:14:26: error: expected ';' before '<' token 14 | for( int i = 0, i < m, i++) { | ^~ | ; a.cc:14:27: error: expected primary-expression before '<' token 14 | for( int i = 0, i < m, i++) { | ^ a.cc:14:35: error: expected ';' before ')' token 14 | for( int i = 0, i < m, i++) { | ^ | ; a.cc:15:24: error: 'number' was not declared in this scope 15 | cin >> number >> sec; | ^~~~~~ a.cc:15:34: error: 'sec' was not declared in this scope 15 | cin >> number >> sec; | ^~~ a.cc:17:42: error: expected ';' before '<' token 17 | for( int i = 0, i < t, i++){ | ^~ | ; a.cc:17:43: error: expected primary-expression before '<' token 17 | for( int i = 0, i < t, i++){ | ^ a.cc:17:51: error: expected ';' before ')' token 17 | for( int i = 0, i < t, i++){ | ^ | ; a.cc:22:10: error: expected '}' at end of input 22 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s277754843
p03844
C++
#include <iostream> #include <vector> #include <cmath> #define rep(a, b) for(int a = 0; a < b; a++) #define repr(a, b) for(int a = b; a >= 0; a++) using namespace std; int main() { int N; cin >> N; int A[N]; rep(i, N) cin >> A[i]; int count[(N + 1) / 2]; rep(i, (N + 1) / 2) count[i] = 0; if (N % 2 == 0) { rep(i, N) { int index = A[i] / 2; count[index] += 1; if (count[index] > 2) { cout << 0 << endl; return 0; } } cout << pow(2, N / 2) << endl; } else { rep(i, N) { int index = A[i] / 2; count[index] += 1; if (index == ((N + 1) / 2)) { if (count[A[i]] > 1) { cout << 0 << endl; return 0; } } if (count[index] > 2) { cout << 0 << endl; return 0; } } cout << pow(2, N / 2) % 1000000007 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:42:31: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 42 | cout << pow(2, N / 2) % 1000000007 << endl; | ~~~~~~~~~~~~~ ^ ~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s820345702
p03844
C++
#include <iostream> using namespace std; typedef unsigned long long uint; int main() { // your code goes here long long a,b; char op; cin>>a>>op>>b; if (op=='+') cout<<a+b<<endl; else cout<<a-b<<endl; return 0; }
a.cc:4:28: error: conflicting declaration 'typedef long long unsigned int uint' 4 | typedef unsigned long long uint; | ^~~~ In file included from /usr/include/stdlib.h:514, from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, 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/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint' 150 | typedef unsigned int uint; | ^~~~
s271953149
p03844
C++
using System; namespace ConsoleApplication { public class A { int a, b; string op; public A() { string[] s = Console.ReadLine().Split(' '); this.a = int.Parse(s[0]); this.b = int.Parse(s[2]); this.op = s[1]; } public void run() { if (op == "+") { System.Console.WriteLine(a+b); } else { System.Console.WriteLine(a-b); } } } public class Program { public static void Main(string[] args) { var a = new A(); a.run(); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:6:5: error: expected unqualified-id before 'public' 6 | public class A | ^~~~~~ a.cc:28:5: error: expected unqualified-id before 'public' 28 | public class Program | ^~~~~~
s534821379
p03844
C++
#include <iostream> int main(){ int a,b,c; std::string s; std::cin >> a; std::cin >> s; std::cin >> b; if(s == '+'){ c = a+b; }else if(s == '-'){ c = a-b; } std::cout << c << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:11:8: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(s == '+'){ | ~ ^~ ~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46, from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<char>&, const __new_allocator<_Tp>&)' 215 | operator==(const __new_allocator&, const __new_allocator<_Up>&) | ^~~~~~~~ /usr/include/c++/14/bits/new_allocator.h:215:9: note: template argument deduction/substitution failed: a.cc:11:11: note: mismatched types 'const std::__new_allocator<_Tp>' and 'char' 11 | if(s == '+'){ | ^~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 11 | if(s == '+'){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(s == '+'){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(s == '+'){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:11:11: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:11:11: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:11:11: note: mismatched types 'const _CharT*' and 'char' 11 | if(s == '+'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:11:11: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 11 | if(s == '+'){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | if(s == '+'){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:11:11: note: 'std::string' {aka 'std::__cxx11::b
s093550448
p03844
C++
#include <cstdio> #include <algorithm> #include <iostream> #include <vector> using namespace std; int main(void){ long long int a,b; char c; scanf("%lld %c %lld",&a,&c.&b); if(c=='+') printf("%lld\n",a+b); else printf("%lld\n",a-b); return 0; }
a.cc: In function 'int main()': a.cc:10:30: error: expected unqualified-id before '&' token 10 | scanf("%lld %c %lld",&a,&c.&b); | ^
s584246630
p03844
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace abc060 { class Program { static void Main(string[] args) { //a string[] s = Console.ReadLine().Split(' '); int a, b; string op; a = int.Parse(s[0]); b = int.Parse(s[2]); op = s[1]; if (op == "+") Console.WriteLine(a + b); else Console.WriteLine(a - b); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.Threading.Tasks; | ^~~~~~ a.cc:11:26: error: 'string' has not been declared 11 | static void Main(string[] args) | ^~~~~~ a.cc:11:35: error: expected ',' or '...' before 'args' 11 | static void Main(string[] args) | ^~~~ a.cc:27:6: error: expected ';' after class definition 27 | } | ^ | ; a.cc: In static member function 'static void abc060::Program::Main(int*)': a.cc:14:13: error: 'string' was not declared in this scope 14 | string[] s = Console.ReadLine().Split(' '); | ^~~~~~ a.cc:14:20: error: expected primary-expression before ']' token 14 | string[] s = Console.ReadLine().Split(' '); | ^ a.cc:16:20: error: expected ';' before 'op' 16 | string op; | ^~ a.cc:18:17: error: expected primary-expression before 'int' 18 | a = int.Parse(s[0]); | ^~~ a.cc:19:17: error: expected primary-expression before 'int' 19 | b = int.Parse(s[2]); | ^~~ a.cc:20:13: error: 'op' was not declared in this scope 20 | op = s[1]; | ^~ a.cc:20:18: error: 's' was not declared in this scope 20 | op = s[1]; | ^ a.cc:23:17: error: 'Console' was not declared in this scope 23 | Console.WriteLine(a + b); | ^~~~~~~ a.cc:25:17: error: 'Console' was not declared in this scope 25 | Console.WriteLine(a - b); | ^~~~~~~
s873727786
p03844
C++
#include <iostream> using namespace std; int main(void) { string s, t, op; int ans = 0; cin >> s >> op >> t; if (op == '+') { ans = stoi(s) + stoi(t); } else { ans = stoi(s) - stoi(t); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:12: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 8 | if (op == '+') { | ~~ ^~ ~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'const _CharT*' and 'char' 8 | if (op == '+') { | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 8 | if (op == '+') { | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46: /usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<char>&, const __new_allocator<_Tp>&)' 215 | operator==(const __new_allocator&, const __new
s347011746
p03844
C++
#include <iostream> using namespace std; int main() { int a, b; char c; cin >> a >> c >> b; cout << (c == '+') ? a + b : a - b << endl; }
a.cc: In function 'int main()': a.cc:9:38: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 9 | cout << (c == '+') ? a + b : a - b << endl; | ~~~~~~^~~~~~~
s090275660
p03844
C++
#include <iostream> int main() { int a, b; char c; cin >> a >> c >> b; cout << (c == '+') ? a + b : a - b << endl; }
a.cc: In function 'int main()': a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin >> a >> c >> b; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:8:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 8 | cout << (c == '+') ? a + b : a - b << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:8:41: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 8 | cout << (c == '+') ? a + b : a - b << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s373511909
p03845
C++
3 2 1 4 2 1 1 2 3
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 | ^
s859576746
p03845
C++
#include <bits/stdc++.h> //#include <atcoder/all> #define ll long long int #define MOD 1000000007 #define P pair<ll,ll> #define INF 1000000000000000000 //using namespace atcoder; using namespace std; int main(void){ ll n; cin >> n; ll sum = 0; vector<ll> t(n); for (int i = 0; i < n; i++){ cin >> t[i]; sum += t[i]; } ll m; cin >> m; for (int i = 0; i < m; i++){ cin >> p >> x; cout << sum - x + t[p] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:12: error: 'p' was not declared in this scope 25 | cin >> p >> x; | ^ a.cc:25:17: error: 'x' was not declared in this scope 25 | cin >> p >> x; | ^
s653206933
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (count == P.at(i)) { total += P.at(i).at(1); } else { total += T.at(count); } count++; } cout << total << endl; } }
a.cc: In function 'int main()': a.cc:30:17: error: no match for 'operator==' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}) 30 | if (count == P.at(i)) { | ~~~~~ ^~ ~~~~~~~ | | | | int __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:30:26: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:30:26: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and 'int' 30 | if (count == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 30 | if (count == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 30 | if (count == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 30 | if (count == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::fpos<_StateT>' and 'int' 30 | if (count == P.at(i)) { | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'const std::allocator<_CharT>' and 'int' 30 | if (count == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:30:26: note: mismatched types 'std::basic_string_view<_CharT, _Tra
s573607542
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { total += T.at(count); } count++; } cout << total << endl; } }
a.cc: In function 'int main()': a.cc:36:13: error: 'total' was not declared in this scope 36 | cout << total << endl; | ^~~~~ a.cc: At global scope: a.cc:38:1: error: expected declaration before '}' token 38 | } | ^
s139162557
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (T.at(count) == P.at(i)) { total += P.at(i).at(1); } else { total += T.at(count); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:30:23: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}) 30 | if (T.at(count) == P.at(i)) { | ~~~~~~~~~~~ ^~ ~~~~~~~ | | | | | __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>} | __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka 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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 |
s509675244
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (T.at(count) == P.at(i)) { total += P.at(i).at(1); } else { total += T.at(count); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:30:23: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}) 30 | if (T.at(count) == P.at(i)) { | ~~~~~~~~~~~ ^~ ~~~~~~~ | | | | | __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>} | __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka 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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (T.at(count) == P.at(i)) { | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 |
s204366160
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (P.at(i) == T.at(count)) { total += T.at(count); } else { total += P.at(i).at(1); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:30:19: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 30 | if (P.at(i) == T.at(count)) { | ~~~~~~~ ^~ ~~~~~~~~~~~ | | | | | __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int} | __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:30:32: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 30 | if (P.at(i) == T.at(count)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::pair<_T1, _T2>' 30 | if (P.at(i) == T.at(count)) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::move_iterator<_IteratorL>' 30 | if (P.at(i) == T.at(count)) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:30:32: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} is not derived from 'const std::move_iterator<_IteratorL>' 30 | if (P.at(i) == T.at(count)) { | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192
s415846978
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (P(i) == T(count)) { total += T(count); } else { total += P.at(i).at(1); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:30:12: error: no match for call to '(std::vector<std::vector<int> >) (int&)' 30 | if (P(i) == T(count)) { | ~^~~ a.cc:30:20: error: no match for call to '(std::vector<int>) (int&)' 30 | if (P(i) == T(count)) { | ~^~~~~~~ a.cc:31:19: error: no match for call to '(std::vector<int>) (int&)' 31 | total += T(count); | ~^~~~~~~ a.cc:40:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 40 | cout >> total >> endl; | ~~~~ ^~ ~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:40:10: note: candidate: 'operator>>(int, int)' (built-in) 40 | cout >> total >> endl; | ~~~~~^~~~~~~~ a.cc:40:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:40:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:40:13: required from here 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>
s959361681
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (T(count) == P(i)) { total += T(count); } else { total += P.at(i).at(1); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:30:12: error: no match for call to '(std::vector<int>) (int&)' 30 | if (T(count) == P(i)) { | ~^~~~~~~ a.cc:30:24: error: no match for call to '(std::vector<std::vector<int> >) (int&)' 30 | if (T(count) == P(i)) { | ~^~~ a.cc:31:19: error: no match for call to '(std::vector<int>) (int&)' 31 | total += T(count); | ~^~~~~~~ a.cc:40:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 40 | cout >> total >> endl; | ~~~~ ^~ ~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:40:10: note: candidate: 'operator>>(int, int)' (built-in) 40 | cout >> total >> endl; | ~~~~~^~~~~~~~ a.cc:40:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:40:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:40:13: required from here 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<c
s548883420
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> T.at(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (count == P(i)) { total += T(count); } else { total += P.at(i).at(1); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:30:21: error: no match for call to '(std::vector<std::vector<int> >) (int&)' 30 | if (count == P(i)) { | ~^~~ a.cc:31:19: error: no match for call to '(std::vector<int>) (int&)' 31 | total += T(count); | ~^~~~~~~ a.cc:40:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 40 | cout >> total >> endl; | ~~~~ ^~ ~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:40:10: note: candidate: 'operator>>(int, int)' (built-in) 40 | cout >> total >> endl; | ~~~~~^~~~~~~~ a.cc:40:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:40:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:40:13: required from here 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> endl; | ^~~~~ /usr/include/
s007606171
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N ; vector<int> T(N); for (int i = 0; i < N; i++) { cin >> vec.T(i); } int M; cin >> M; // int型の2次元配列(M×2要素の)の宣言 vector<vector<int>> P(M, vector<int>(2)); // 入力 (2重ループを用いる) for (int i = 0; i < M; i++) { for (int j = 0; j < 2; j++) { cin >> P.at(i).at(j); } } for (int i = 0; i < M; i++) { int total = 0; //合計 int count = 0; // カウンタ変数 while (count < N) { if (count == P(i)) { total += T(count); } else { total += P.at(i).at(1); } count++; } cout >> total >> endl; } }
a.cc: In function 'int main()': a.cc:11:13: error: 'vec' was not declared in this scope 11 | cin >> vec.T(i); | ^~~ a.cc:30:21: error: no match for call to '(std::vector<std::vector<int> >) (int&)' 30 | if (count == P(i)) { | ~^~~ a.cc:31:19: error: no match for call to '(std::vector<int>) (int&)' 31 | total += T(count); | ~^~~~~~~ a.cc:40:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 40 | cout >> total >> endl; | ~~~~ ^~ ~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:40:10: note: candidate: 'operator>>(int, int)' (built-in) 40 | cout >> total >> endl; | ~~~~~^~~~~~~~ a.cc:40:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:40:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:40:13: required from here 40 | cout >> total >> endl; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 40 | cout >> total >> 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:40:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 's
s733163186
p03845
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int> Q(N); int T=0; for(int i=0; i<N; i++){ cin>>Q.at(i); T+=Q.at(i); } int M; cin>>M; vector<vector<int>> D(M,vector<int>(2)); for(int i=0 ;i<M; i++){ for(int j=0; j<2; j++){ cin>>D.at(i).at(j); } } for(int i=0 ;i<N; i++){ T-=Q.at(D.at(i).at(0)-1)); cout<<T+D.at(i).at(1)<<endl; T+=Q.at(D.at(i).at(0)-1)); } }
a.cc: In function 'int main()': a.cc:19:29: error: expected ';' before ')' token 19 | T-=Q.at(D.at(i).at(0)-1)); | ^ | ; a.cc:21:30: error: expected ';' before ')' token 21 | T+=Q.at(D.at(i).at(0)-1)); | ^ | ;
s896928640
p03845
Java
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> T(N); for (int i = 0; i < N; i++) {cin >> T.at(i);} for (int i = 0; i < M; i++) { vector<int> t(N); for (int j = 0; j < N; j++) {t.at(j) = T.at(j);} int P, X, Y = 0; cin >> P >> X; t.at(P - 1) = X; for (int j = 0; j < N; j++) {Y += t.at(j);} cout << Y << endl; } }
Main.java:1: error: illegal character: '#' #include <bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <bits/stdc++.h> ^ Main.java:5: error: not a statement cin >> N >> M; ^ Main.java:6: error: not a statement vector<int> T(N); ^ Main.java:7: error: not a statement for (int i = 0; i < N; i++) {cin >> T.at(i);} ^ Main.java:9: error: not a statement vector<int> t(N); ^ Main.java:12: error: not a statement cin >> P >> X; ^ Main.java:15: error: not a statement cout << Y << endl; ^ Main.java:3: error: unnamed classes are a preview feature and are disabled by default. int main() { ^ (use --enable-preview to enable unnamed classes) Main.java:6: error: ';' expected vector<int> T(N); ^ Main.java:6: error: ';' expected vector<int> T(N); ^ Main.java:9: error: ';' expected vector<int> t(N); ^ Main.java:9: error: ';' expected vector<int> t(N); ^ 13 errors
s172450844
p03845
C++
#include <bits/stdc++.h> #define rep(i , n) for (int i = 0; i < (int)(n); i++) const int INF = 1<<29; using namespace std; using ll = long long; ll l , a[500001]; int main(){ int n , m , a[111] , b , c , sum = 0; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; sum += a[i]; } cin >> m; while(m--){ cin >> b >> c; cout << sum - a[b] + c << endl; } }
a.cc: In function 'int main()': a.cc:12:18: error: 'i' was not declared in this scope 12 | sum += a[i]; | ^ a.cc: At global scope: a.cc:14:9: error: 'cin' does not name a type 14 | cin >> m; | ^~~ a.cc:15:9: error: expected unqualified-id before 'while' 15 | while(m--){ | ^~~~~ a.cc:19:1: error: expected declaration before '}' token 19 | } | ^
s808977734
p03845
C++
#include <iostream> using namespace std; int main() { int n,m,r; cin>>n; int t[n],p[m],x[m]; for(int i=0;i<n;i++){ cin>>t[i]; } for(int j=0;j<p.length();j++){ cin>>p[j]>>x[j]; } for(int a=0;a<m;a++){ for(int b=0;b<t.length();b++){ if(b==a){ continue; } r+=t[a]; } cout<<r+t[a]<<endl; } }
a.cc: In function 'int main()': a.cc:12:25: error: request for member 'length' in 'p', which is of non-class type 'int [m]' 12 | for(int j=0;j<p.length();j++){ | ^~~~~~ a.cc:16:33: error: request for member 'length' in 't', which is of non-class type 'int [n]' 16 | for(int b=0;b<t.length();b++){ | ^~~~~~
s844502385
p03845
C++
#include <iostream> using namespace std; int main() { int n,m,r; cin>>n; int t[n],p[m],x[m]; for(int i=0;i<n;i++){ cin>>t[i]; } for(int j=0;j<m;j++){ cin>>p[j]>>x[j]; } for(int a=0;a<j;a++){ for(int b=0;b<i;b++){ if(b==a){ continue; } r+=t[a]; } cout<<r+t[a]<<endl; } }
a.cc: In function 'int main()': a.cc:15:23: error: 'j' was not declared in this scope 15 | for(int a=0;a<j;a++){ | ^ a.cc:16:31: error: 'i' was not declared in this scope 16 | for(int b=0;b<i;b++){ | ^
s790339205
p03845
C++
#include <iostream> using namespace std; int main (){ int total = 0; int N, M; int arrT, arrP, arrX; cin >> N >> M; for (int i = 0; i < N; i ++){ cin >> arrT[i]; } for (int i = 0; i < M; i ++){ cin >> arrP[i] >> arrX[i]; for (int j = 0; j < N; j ++){ if (j == arrP[i]){ total += arrX[i]; } else { total += arrT[j]; } } cout << total << '\n'; } }
a.cc: In function 'int main()': a.cc:10:16: error: invalid types 'int[int]' for array subscript 10 | cin >> arrT[i]; | ^ a.cc:13:16: error: invalid types 'int[int]' for array subscript 13 | cin >> arrP[i] >> arrX[i]; | ^ a.cc:13:27: error: invalid types 'int[int]' for array subscript 13 | cin >> arrP[i] >> arrX[i]; | ^ a.cc:15:20: error: invalid types 'int[int]' for array subscript 15 | if (j == arrP[i]){ | ^ a.cc:16:22: error: invalid types 'int[int]' for array subscript 16 | total += arrX[i]; | ^ a.cc:18:22: error: invalid types 'int[int]' for array subscript 18 | total += arrT[j]; | ^
s673925532
p03845
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception{ Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int[] t = new int[n]; for(int i=0; i<n; i++){ a[i] = scn.nextInt(); } int sum = 0; for(int i=0; i<n; i++){ sum += a[i]; } int m = scn.nextInt(); int[] p = new int[m]; int[] x = new int[m]; for(int i=0; i<m; i++){ p[i] = scn.nextInt(); x[i] = scn.nextInt(); } int dif = 0; for(int i=0; i<m; i++){ dif = a[p[i]]-x[i]; System.out.println(sum-dif); } } }
Main.java:9: error: cannot find symbol a[i] = scn.nextInt(); ^ symbol: variable a location: class Main Main.java:13: error: cannot find symbol sum += a[i]; ^ symbol: variable a location: class Main Main.java:24: error: cannot find symbol dif = a[p[i]]-x[i]; ^ symbol: variable a location: class Main 3 errors
s238518604
p03845
C
#include <iostream> #include <array> using namespace std; int main(){ int N, M, k, val, sum = 0, ans; array<int, 100> p; cin >> N; for(int i = 0; i < N; i++){ cin >> p[i]; sum += p[i]; } cin >> M; for(int i = 0; i < M; i++){ cin >> k >> val; cout << sum + val - p[k - 1] << '\n'; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s718017414
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int n ; cin >> n; vector < pair <int , int> > a(n); int sum = 0 ; for ( int i=0 ; i<n ; i++){ int t ; cin >> t; a.at(i) = make_pair ( i, t); sum += t; } int m ; cin >> m; for ( int i=0 ; i<m ; i++) { int p,b,c,t , ans; cin >> p >> b; tie(c,t) = a.at (p-1) ; ans = sum - t + b cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:21:22: error: expected ';' before 'cout' 21 | ans = sum - t + b | ^ | ; 22 | cout << ans << endl; | ~~~~
s846713537
p03845
C++
#include "bits/stdc++.h" using namespace std; int main() { int N; vector<int>T(N); int sum = 0; for (int i = 0; i < N; ++i) { cin >> T[i]; sum + = T[i]; } int M; cin >> M; for (int i = 0; i < M; ++i) { int p, x; cin >> p >> x; cout << sum - T[p - 1] + x << endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:23: error: expected primary-expression before '=' token 10 | sum + = T[i]; | ^
s604902292
p03845
C++
v#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> t(n); for (int i = 0; i < n; i++) cin >> t.at(i); int m; cin >> m; int p, x, ans, temp; for (int i = 0; i < m; i++) { cin >> p >> x; temp = t.at(p-1); t.at(p-1) = x; ans = 0; for (int y : t) ans += y; cout << ans << endl; t.at(p-1) = temp; } }
a.cc:1:2: error: stray '#' in program 1 | v#include <bits/stdc++.h> | ^ a.cc:1:1: error: 'v' does not name a type 1 | v#include <bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ a.cc:8:3: error: 'vector' was not declared in this scope 8 | vector<int> t(n); | ^~~~~~ a.cc:8:10: error: expected primary-expression before 'int' 8 | vector<int> t(n); | ^~~ a.cc:10:12: error: 't' was not declared in this scope 10 | cin >> t.at(i); | ^ a.cc:20:12: error: 't' was not declared in this scope 20 | temp = t.at(p-1); | ^ a.cc:25:5: error: 'cout' was not declared in this scope 25 | cout << ans << endl; | ^~~~ a.cc:25:20: error: 'endl' was not declared in this scope 25 | cout << ans << endl; | ^~~~
s746565840
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N ; cin >> N ; vector <int> a(N); int sum = 0 ; for ( int i=0 ; i<N ; i++){ cin >> a.at(i) ; sum += a.at(i) ; } int M ; cin >> M ; vector <int> d(N,sum) for ( int i=0 ; i<M ; i++){ int b,c; cin >> b >> c ; d.at(i) = d.at(i)-a.at(b) +c; cout << d.at(i) << endl; } }
a.cc: In function 'int main()': a.cc:16:3: error: expected ',' or ';' before 'for' 16 | for ( int i=0 ; i<M ; i++){ | ^~~ a.cc:16:19: error: 'i' was not declared in this scope 16 | for ( int i=0 ; i<M ; i++){ | ^
s381705110
p03845
C++
#include <bits/stdc++.h> #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++) #define pi 3.14159265359 #define all(i) i.begin(),i.end() using namespace std; const long long INF=1e9+7; const string alp="abcdefghijklmnopqrstuvwxyz"; //26 const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; //const ll MOD=998244353LL; //const ll MOD=1777777777LL; int main() { ll N;cin>>N; ll T[N]; ll sum=0; rep(i,N){ cin>>T[N]; ans+=T[i]; } ll M;cin>>M; ll P[M],X[M]; rep(i,N) cin>>P[i]>>X[i]; for(int i=0;i<M;i++){ ll ans=sum; ans-=T[P[i]-1]; ans+=X[i]; cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:25:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | ans+=T[i]; | ^~~ | abs
s706078409
p03845
C++
#include<isotream> using namespace std; int main(){ int n; int arr[n]; for(int i = 0; i < n; ++i){ cin >> arr[i]; } int m; while(m--){ int x, y; cin >> x >> y; int ans = 0; for(int i = 0; i < n; ++i){ if((i + 1) == x) ans += y; else ans += arr[i]; } cout << ans << endl; } }
a.cc:1:9: fatal error: isotream: No such file or directory 1 | #include<isotream> | ^~~~~~~~~~ compilation terminated.
s138183591
p03845
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n; cout<<endl; vector<int>t(n); for(int i=0;i<n;i++){ cin>>t.at(i); } cin>>m; vector<int>p(m); for(int i=0;i<m;i++){ cout<<i; cin>>p.at(i); cout>>endl; } for(int i=0;i<m;i++){ int sum=0; for(int j=0;j<n;j++){ if(j==i){ sum+=p.at(i); }else{ sum+=t.at(j); } } cout<<sum<<endl; } cout<<endl; }
a.cc: In function 'int main()': a.cc:17:13: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 17 | cout>>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:17:15: note: couldn't deduce template parameter '_IntegerType' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout>>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:17:15: note: couldn't deduce template parameter '_Tp' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout>>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:17:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout
s225829596
p03845
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n; cout<<endl; vector<int>t(n); for(int i=0;i<n;i++){ cin>>t.at(i); } cin>>m; vector<int>p(m); for(int i=0;i<m;i++){ cout>>i; cin<<p.at(i); cout>>endl; } for(int i=0;i<m;i++){ int sum=0; for(int j=0;j<n;j++){ if(j==i){ sum+=p.at(i); }else{ sum+=t.at(j); } } cout<<sum<<endl; } cout<<endl; }
a.cc: In function 'int main()': a.cc:15:13: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 15 | cout>>i; | ~~~~^~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:15:13: note: candidate: 'operator>>(int, int)' (built-in) 15 | cout>>i; | ~~~~^~~ a.cc:15:13: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:15:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 15 | cout>>i; | ^~~~ 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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ 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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout>>i; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:15:15: required from here 15 | cout>>i; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ 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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout>>i; | ^ /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:15:15: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_ist
s747862483
p03845
Java
public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[] T = new int[N]; int M = scan.nextInt(); int[] P = new int[M]; int[] X = new int[M]; for(int i = 0; i < N; i++) { T[i] = scan.nextInt(); } for(int i = 0; i < M; i++) { P[i] = scan.nextInt(); X[i] = scan.nextInt(); } for(int i = 0; i < M; i++) { int sum = 0; for(int j = 0; j < N; j++) { sum += T[j]; } int num = T[P[i] - 1] - X[i]; int ans = sum - num; System.out.println(ans); } } }
Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s730944122
p03845
C++
s
a.cc:1:1: error: 's' does not name a type 1 | s | ^
s570331149
p03845
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> T(N); int sum = 0; for (int i = 0; i < N; i++) { cin >> T[i]; sum += T[i]; } for (int i = 0; i < M; i++) { int P, X; cin >> P >> X; P--; cout << sum - T[P] + X << endl; } }
a.cc: In function 'int main()': a.cc:17:23: error: 'M' was not declared in this scope 17 | for (int i = 0; i < M; i++) { | ^
s781296031
p03845
C++
#include <iostream> using namespace std; 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:6:7: error: 'h' was not declared in this scope 6 | int t[h]; | ^ a.cc: In function 'int main()': a.cc:15:16: error: 't' was not declared in this scope 15 | cin >> t[i]; | ^ a.cc:25:13: error: 't' was not declared in this scope 25 | c = t[p]; | ^
s905977683
p03845
Java
import java.util.Scanner; public class Main { private static final long x = (long) Math.pow(10, 18); public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int t[] = new int[n]; int px[][] = new int[m][2]; int sum = 0; for (int i = 0; i < n; i++) { t[i] = sc.nextInt(); sum += t[i]; } int m = sc.nextInt(); for (int i = 0; i < m; i++) { px[i][0] = sc.nextInt(); px[i][1] = sc.nextInt(); } for (int i = 0; i < m; i++) { System.out.println(sum - t[px[i][0] - 1] + px[i][1]); } sc.close(); } }
Main.java:11: error: cannot find symbol int px[][] = new int[m][2]; ^ symbol: variable m location: class Main 1 error
s091683171
p03845
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,M; cin >> N; long T[N],Sum=0; for(int i=1;i<=N;i++){ cin >> T[i]; Sum += T[i]; Tp[i]=0; } cin >> M; long Tp[N]; for(int j=0;j<M;j++){ int p,X; cin >> p; cin >> X; Tp[p]=X; } for(int i=1;i<N;i++){ res = Sum -T[i] + Tp[i]; cout << res << endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'Tp' was not declared in this scope; did you mean 'T'? 11 | Tp[i]=0; | ^~ | T a.cc:22:5: error: 'res' was not declared in this scope 22 | res = Sum -T[i] + Tp[i]; | ^~~
s862725777
p03845
C++
#include<iostream> using namespace std; int main(){ int n; cin>>n;//問題数 int t[]={}; for(int i=0;i<n;i++){ cin>>t[i];//問題を解くのにかかる時間 } int m; cin>>m;//ドリンクの種類 int p,x; for(i=0;i<m;i++){ int ans=0; cin>>p>>x; for(int j=0;j<n;j++){ ans+=t[j]; } cout<<ans; } return 0; }
a.cc: In function 'int main()': a.cc:11:7: error: 'i' was not declared in this scope 11 | for(i=0;i<m;i++){ | ^
s792500248
p03845
C++
#include<map> using namespace std; int main(){ int n; cin >> n; int sum = 0; int T[n]; for(int i=0;i<n;i++){ cin >> T[i]; sum += T[i]; } int m; cin >> m; for(int i=0;i<m;i++){ int p,x; cin >> p >> x; p--; cout << sum - T[p] + x << endl; } }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<map> +++ |+#include <iostream> 2 | using namespace std; a.cc:19:9: error: 'cout' was not declared in this scope 19 | cout << sum - T[p] + x << endl; | ^~~~ a.cc:19:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:19:35: error: 'endl' was not declared in this scope 19 | cout << sum - T[p] + x << endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include<map> +++ |+#include <ostream> 2 | using namespace std;
s590330124
p03845
C++
#include <bits\stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> probs; vector<int> temp; for(int i{}; i<n; i++){ int b; cin >> b; probs.push_back(b); } temp=probs; int m; cin >> m; for(int i{}; i<m; i++){ probs = temp; int p,x; cin >> p >> x; probs[p-1] = x; int sum{}; for(int j{}; j<n; j++){ sum+=probs[j]; } cout << sum << "\n"; } return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s076455769
p03845
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) int main(){ ll N, M; cin >> N; VL T(N); ll sum = 0; rep(i,0,N){ cin >> T[i]; sum += T[i]; } cin >> M; VL P(M), X(M); rep(i,0,M){ cin >> P[i] >> X[i]; } ll ans = sum; rep(i,0,M){ ans = sum; ans += X[i] - T[i]; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'VL' was not declared in this scope 8 | VL T(N); ll sum = 0; | ^~ a.cc:10:16: error: 'T' was not declared in this scope 10 | cin >> T[i]; | ^ a.cc:13:20: error: expected ';' before 'P' 13 | cin >> M; VL P(M), X(M); | ^~ | ; a.cc:15:16: error: 'P' was not declared in this scope 15 | cin >> P[i] >> X[i]; | ^ a.cc:15:24: error: 'X' was not declared in this scope 15 | cin >> P[i] >> X[i]; | ^ a.cc:21:16: error: 'X' was not declared in this scope 21 | ans += X[i] - T[i]; | ^ a.cc:21:23: error: 'T' was not declared in this scope 21 | ans += X[i] - T[i]; | ^
s733415889
p03845
C++
#include <iostream> #include <vector> #include <numeric> using namespace std; int main(){ vector<int> time; int a,b,c,d; cin>>a; for(int i=0;i<a;i++){ cin>>b; time.push_back(b); } cin>>a; d=accumulate(time.begin(),time.end()); for(int i=0;i<a;i++){ cin>>b>>c; cout<<d-time[b]+c<<endl; } }
a.cc: In function 'int main()': a.cc:15:15: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)' 15 | d=accumulate(time.begin(),time.end()); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/numeric:62, from a.cc:3: /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
s192929374
p03845
C++
n=int(input()) T = list(map(int, input().split())) sum=0 for i in range(n): sum+=T[i] m=int(input()) for i in range(m): P,X = map(int,input().split()) print(sum-T[P-1]+X)
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s930569704
p03845
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; int arr[n]; int sum = 0; for(int i=0;i<n;i++){ cin>>arr[i]; sum+=arr[i]; } int m; cin>>m; int p[m],x[m]; for (int i=0;i<m;i++){ cin>>p[i]>>x[i]; } for(int i=0;i<m;i++){ int a=sum-t[p[i]-1]+x[i]; cout<<a<<endl; } }
a.cc: In function 'int main()': a.cc:19:19: error: 't' was not declared in this scope 19 | int a=sum-t[p[i]-1]+x[i]; | ^
s524382201
p03845
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; cin >> n >> m; vector<int> t(n),p(m),x(m); for (int i=0;i<n;++i) cin >> t[i]; for (int j=0;j<m;++j) cin >> p[j] >> x[j]; for (int i=0;i<n;++i){ for (int j=0;j<m;++j){ if (!t[i]==x[j]){ swap(t[i],x[j]); sum+=t[i]; //のりちんの限界
a.cc: In function 'int main()': a.cc:15:9: error: 'sum' was not declared in this scope 15 | sum+=t[i]; | ^~~ a.cc:15:19: error: expected '}' at end of input 15 | sum+=t[i]; | ^ a.cc:13:23: note: to match this '{' 13 | if (!t[i]==x[j]){ | ^ a.cc:15:19: error: expected '}' at end of input 15 | sum+=t[i]; | ^ a.cc:12:26: note: to match this '{' 12 | for (int j=0;j<m;++j){ | ^ a.cc:15:19: error: expected '}' at end of input 15 | sum+=t[i]; | ^ a.cc:11:24: note: to match this '{' 11 | for (int i=0;i<n;++i){ | ^ a.cc:15:19: error: expected '}' at end of input 15 | sum+=t[i]; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s841914092
p03845
C
#include<stdio.h> #include<string.h> int main(){ int N = 0; //問題番号 int M = 0; //ドリンクの番号 scanf("%d",&N); int T[N]; //N番目の問題を解くのにかかる時間 for(int i=0; i<N; i++){ scanf("%d",T[i]); } scanf("%d",&M); int P; //ドリンクの効果が効く、Xに対応する問題 int X; //ドリンクを飲んだ場合に、N番目の問題を解くのにかかる時間 int result[M]; // for(int j=0; i<M; j++){ result = 0; scanf("%d %d",&P,&X); for(int k=0; k<N; k++){ if( k == P ){ result += X; }else{ result += T[k]; } } printf("%d",result); } return 0; }
main.c: In function 'main': main.c:22:22: error: 'i' undeclared (first use in this function) 22 | for(int j=0; i<M; j++){ | ^ main.c:22:22: note: each undeclared identifier is reported only once for each function it appears in main.c:23:24: error: assignment to expression with array type 23 | result = 0; | ^ main.c:27:40: error: assignment to expression with array type 27 | result += X; | ^~ main.c:29:40: error: assignment to expression with array type 29 | result += T[k]; | ^~
s071103064
p03845
C++
#include<bits/stdc++.h> using namespace std; int n,arr[101],array[101],sum,p,x,m,bil; int main(){ cin>>n; for(int i = 1;i <= n;i++){ cin>>bil; sum = sum + bil; arr[i] = bil; } cin>>m; for(int i = 1;i <= m;i++){ cin>>p>>x; sum = sum + x - arr[p]; array[i] = sum; sum = sum - x + arr[p]; } for(int i = 1;i <= m;i++){ cout<<array[i]<<endl; } }
a.cc: In function 'int main()': a.cc:17:17: error: reference to 'array' is ambiguous 17 | array[i] = sum; | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:4:16: note: 'int array [101]' 4 | int n,arr[101],array[101],sum,p,x,m,bil; | ^~~~~ a.cc:21:23: error: reference to 'array' is ambiguous 21 | cout<<array[i]<<endl; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:4:16: note: 'int array [101]' 4 | int n,arr[101],array[101],sum,p,x,m,bil; | ^~~~~
s961119885
p03845
C++
#include<bits/stdc++.h> using namespace std; int n,arr[101],array[101],sum,p,x,m,bil; int main(){ cin>>n; for(int i = 1;i <= n;i++){ cin>>bil; sum = sum + bil; arr[i] = bil; } cin>>m; for(int i = 1;i <= m;i++){ cin>>p>>x; sum = sum + x - arr[p]; array[i] = sum; sum = sum - x + arr[p]; } for(int i = 1;i <= m;i++){ cout<<array[i]<<endl; } }
a.cc: In function 'int main()': a.cc:17:17: error: reference to 'array' is ambiguous 17 | array[i] = sum; | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:4:16: note: 'int array [101]' 4 | int n,arr[101],array[101],sum,p,x,m,bil; | ^~~~~ a.cc:21:23: error: reference to 'array' is ambiguous 21 | cout<<array[i]<<endl; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:4:16: note: 'int array [101]' 4 | int n,arr[101],array[101],sum,p,x,m,bil; | ^~~~~
s269708020
p03845
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>> n; vector<int>t[n]; int sum = 0; for(int i = 0;i < n;i++){ cin>>t[i]; sum += t[i]; } int m; cin >> m; vector<int>p[m]; vector<int>x[m]; for(int i = 0;i < m;i++){ cin >> p[i] >>x[i]; cout << sum -t[p[i]]+x[i] <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:6: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 14 | cin>>t[i]; | ~~~^~~~~~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 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/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:
s992256719
p03845
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>> n; vector<int>t[n]; int sum = 0; for(int i = 0;i < n;i++){ cin>>t[i]; sum += t[i]; } int m; cin >> m; vector<int>p[m]; vector<int>x[m]; for(int i = 0;i < m;i++){ cin >> p[i] >>x[i]; cout << sum -t[p[i]]+x[i] <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 14 | cin>>t[i]; | ~~~^~~~~~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 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/x86_64-linux-gnu/c++/14/bits/stdc++.h:4
s588476862
p03845
C++
#include<iostream> using namespace std; int main() { int n,a[100],m,sum,p,x; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; sum+=a[i]; } cin>>m; for(i=0;i<m;i++) { cin>>p>>x; sum=sum-a[p-1]+x; cout<<sum; } return 0; }
a.cc: In function 'int main()': a.cc:13:7: error: 'i' was not declared in this scope 13 | for(i=0;i<m;i++) | ^
s651148977
p03845
C++
#include<iostream> using namespace std; int main() { int n,a[100],m,sum,p,x; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; sum+=t[i]; } cin>>m; for(i=0;i<m;i++) { cin>>p>>x; sum=sum-a[p-1]+x; cout<<sum; }
a.cc: In function 'int main()': a.cc:10:10: error: 't' was not declared in this scope 10 | sum+=t[i]; | ^ a.cc:13:7: error: 'i' was not declared in this scope 13 | for(i=0;i<m;i++) | ^ a.cc:18:4: error: expected '}' at end of input 18 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s719054735
p03845
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int T[N]; for(int i=0;i<N;i++)cin >> T[i]; int M; cin >> M; int P[M],X[M] for(int i=0;i<M;i++)cin >> P[i] >> X[i]; int total =0; for(int i=0;i<N;i++)total += T[i]; for(int i=0;i<M;i++){ cout << total - T[P[i]] +X[i] << endl; } }
a.cc: In function 'int main()': a.cc:11:5: error: expected initializer before 'for' 11 | for(int i=0;i<M;i++)cin >> P[i] >> X[i]; | ^~~ a.cc:11:17: error: 'i' was not declared in this scope 11 | for(int i=0;i<M;i++)cin >> P[i] >> X[i]; | ^ a.cc:15:34: error: 'X' was not declared in this scope 15 | cout << total - T[P[i]] +X[i] << endl; | ^
s222325102
p03845
C++
#include <iostream> using namespace std; int main() { long long int n,m,t[10^6],p[110],x[10^6],i,s; cin>>n; for(i=1;i<=n;i++) { cin>>t[i]; } cin>>m; for(i=1;i<=m;i++) { cin>>p[i]>>x[i]; } for(i=1;i<=m;i++) { s=0; t[p[i]]=x[i]; for(i=1;i<=n;i++) { s[i]=s[i]+t[i]; } cout<<s<<'\n'; } return 0; }
a.cc: In function 'int main()': a.cc:7:26: warning: result of '10^6' is 12; did you mean '1e6'? [-Wxor-used-as-pow] 7 | long long int n,m,t[10^6],p[110],x[10^6],i,s; | ^ | --- | 1e a.cc:7:24: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10) 7 | long long int n,m,t[10^6],p[110],x[10^6],i,s; | ^~ | 0xa a.cc:7:41: warning: result of '10^6' is 12; did you mean '1e6'? [-Wxor-used-as-pow] 7 | long long int n,m,t[10^6],p[110],x[10^6],i,s; | ^ | --- | 1e a.cc:7:39: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10) 7 | long long int n,m,t[10^6],p[110],x[10^6],i,s; | ^~ | 0xa a.cc:24:13: error: invalid types 'long long int[long long int]' for array subscript 24 | s[i]=s[i]+t[i]; | ^ a.cc:24:18: error: invalid types 'long long int[long long int]' for array subscript 24 | s[i]=s[i]+t[i]; | ^
s233063814
p03845
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する int main(){ int n,m; cin >> n; vector<int> t(n); rep(t,n); cin >> m; vector<int> p(m),x(m); for(int i=0;i<m;i++){cin >> p.at(i) >> x.at(i);} for(int i=0;i<m;i++){ int tmp = t.at(p.at(i)-1); t.at(p.at(i)-1)=x.at(i); ll sum = accumulate(t.begin(), t.end(),0); cout << sum << endl; t.at(p.at(i)-1) = tmp; //初期化 }
a.cc: In function 'int main()': a.cc:20:6: error: expected '}' at end of input 20 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^