submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s344714895 | p03944 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
int w = sc.nextInt();
// スペース区切りの整数の入力
int h = sc.nextInt();
int n = sc.nextInt();
// 文字列の入力
int x[] = new int[n];
int y[] = new int[n];
int a[] = new int[n];
int maxx = w;
int maxy = h;
int minx = 0;
int miny = 0;
for(int i=0; i++ i<n){
x[i] = sc.nextInt();
y[i] = sc.nextInt();
a[i] = sc.nextInt();
switch (a[i]){
case 1:
if(minx > x[i]){
minx = x[i];
}
break;
case 2:
if(maxx < x[i]){
maxx = x[i];
}
break;
case 3:
if(miny > y[i]){
miny = y[i];
}
break;
case 4:
if(maxy < y[i]){
maxy = y[i];
}
break;
}
}
int answer = (maxx - minx) * (maxy - miny);
System.out.println(answer);
}
} | Main.java:18: error: ';' expected
for(int i=0; i++ i<n){
^
Main.java:18: error: not a statement
for(int i=0; i++ i<n){
^
2 errors
|
s650740599 | p03944 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int W, H, N;
cin >> W >> H >> N;
vector<vector<int>> b(H, vector<int>(W, 0));
for (int i = 0; i < N; ++i) {
int x, y, a;
cin >> x >> y >> a;
int x1 = 0;
int y1 = 0;
int x2 = W;
int y2 = H;
if (a == 1) {
x2 = x;
}
else if (a == 2) {
x1 = x;
}
else if (a == 3) {
y2 = y;
}
else if (a == 4) {
y1 = y;
}
else {
throw std::exception("oops!");
}
for (int i = y1; i < y2; ++i) {
for (int j = x1; j < x2; ++j) {
b[i][j] = 1;
}
}
}
int ans = 0;
for (auto &row : b) {
ans += count(row.begin(), row.end(), 0);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:33:53: error: no matching function for call to 'std::exception::exception(const char [6])'
33 | throw std::exception("oops!");
| ^
In file included from /usr/include/c++/14/exception:36,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/exception.h:67:5: note: candidate: 'constexpr std::exception::exception(std::exception&&)'
67 | exception(exception&&) = default;
| ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:67:15: note: no known conversion for argument 1 from 'const char [6]' to 'std::exception&&'
67 | exception(exception&&) = default;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/exception.h:65:5: note: candidate: 'constexpr std::exception::exception(const std::exception&)'
65 | exception(const exception&) = default;
| ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:65:15: note: no known conversion for argument 1 from 'const char [6]' to 'const std::exception&'
65 | exception(const exception&) = default;
| ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/exception.h:62:5: note: candidate: 'std::exception::exception()'
62 | exception() _GLIBCXX_NOTHROW { }
| ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:62:5: note: candidate expects 0 arguments, 1 provided
|
s895003832 | p03945 | C++ | #incldue<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int ans=0;
for(int i=0;i<s.size()-1;++i)
{
if(s.at(i)!=s.at(i+1)) ans++;
}
cout << ans;
return 0;} | a.cc:1:2: error: invalid preprocessing directive #incldue; did you mean #include?
1 | #incldue<bits/stdc++.h>
| ^~~~~~~
| include
a.cc: In function 'int main()':
a.cc:5:1: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | #incldue<bits/stdc++.h>
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin >> s;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incldue<bits/stdc++.h>
a.cc:6:10: error: 's' was not declared in this scope
6 | cin >> s;
| ^
a.cc:12:3: error: 'cout' was not declared in this scope
12 | cout << ans;
| ^~~~
a.cc:12:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s374094560 | p03945 | Java | mport java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner in = new Scanner(System.in)) {
String S = in.next();
StringBuilder WB = new StringBuilder();
WB.append(S.charAt(0));
for (int i = 1; i < S.length(); i++) {
if (S.charAt(i) == S.charAt(i - 1)) {
continue;
} else {
WB.append(S.charAt(i));
}
}
System.out.println(WB.length() - 1);
}
}
}
| Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
1 error
|
s890233353 | p03945 | C++ | using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
string s;
cin>>s;
ll n=s.length();
ll ans=0;
rep(1,i,n)if(s[i]!=s[i-1])++ans;
cout<<ans;
}
| a.cc: In function 'int main()':
a.cc:5:5: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | using namespace std;
a.cc:6:5: error: 'cin' was not declared in this scope
6 | cin>>s;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:6:10: error: 's' was not declared in this scope
6 | cin>>s;
| ^
a.cc:10:5: error: 'cout' was not declared in this scope
10 | cout<<ans;
| ^~~~
a.cc:10:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s184089778 | p03945 | C++ | #include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main() {
//input
string s; cin >> s;
int n;
n = s.size();
int counter = 0;
//compute
for(int i = 0;i < n; i++) {
if(s.at[i] == s.at[i+1]){
counter += 1;
}
}
//output
cout << counter << endl;
}
| a.cc: In function 'int main()':
a.cc:16:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
16 | if(s.at[i] == s.at[i+1]){
| ^
a.cc:16:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
16 | if(s.at[i] == s.at[i+1]){
| ^
|
s432485508 | p03945 | C++ | #include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main() {
//input
string s; cin >> s;
int n;
n = s.size();
int counter = 0;
//compute
for(int i = 0;i < n; i++) {
if(s.at[i] <= s.at[i+1]){
counter += 1;
}
}
//output
cout << counter << endl;
}
| a.cc: In function 'int main()':
a.cc:16:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
16 | if(s.at[i] <= s.at[i+1]){
| ^
a.cc:16:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
16 | if(s.at[i] <= s.at[i+1]){
| ^
|
s027421404 | p03945 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
srting s;
cin>>s;
int ans=0;
for(int i=1;i<s.size();i++)
{
if(s[i]!-s[i-1])
{
ans++;
}
}
cout<<ans;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:5: error: 'srting' was not declared in this scope
8 | srting s;
| ^~~~~~
a.cc:9:10: error: 's' was not declared in this scope
9 | cin>>s;
| ^
a.cc:13:16: error: expected ')' before '!' token
13 | if(s[i]!-s[i-1])
| ~ ^
| )
|
s669545572 | p03945 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
int n = s.size();
int cnt = 0;
for(int i = 1; i < s; ++i)
{
if(s[i-1] != s[i]) cnt++;
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:20: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
11 | for(int i = 1; i < s; ++i)
| ~ ^ ~
| | |
| int std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h: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:11:22: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/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:11:22: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/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:11:22: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/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:11:22: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
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: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:11:22: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
11 | for(int i = 1; i < s; ++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: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:11:22: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/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:11:22: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/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:11:22: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
11 | for(int i = 1; i < s; ++i)
| ^
/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:11:22: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
a.cc:11:22: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
a.cc:11:22: note: mismatched types 'const _CharT*' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
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:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2600 | operator<(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed:
a.cc:11:22: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int'
11 | for(int i = 1; i < s; ++i)
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)'
324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept
| ^~~~~~~~
/usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'int' to 'const std::error_code&'
324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept
| ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)'
507 | operator<(const error_condition& __lhs,
| ^~~~~~~~
/usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'int' to 'const std::error_condition&'
507 | operator<(const error_condition& __lhs,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
|
s147960454 | p03945 | C++ | #include <iosream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
int n = s.size();
int cnt = 0;
for(int i = 1; i < s; ++i)
{
if(s[i-1] != s[i]) cnt++;
}
cout << cnt << endl;
return 0;
}
| a.cc:1:10: fatal error: iosream: No such file or directory
1 | #include <iosream>
| ^~~~~~~~~
compilation terminated.
|
s767289157 | p03945 | C++ | #include <iostream>
using namespace std;
int main() {
string color="";
cin>>color;
int x=0;
for(int i=1;i<=color.length();i++){
if(color[i]==color[i-1]){
x=x+0
}
else{
x=x+1;
}
}
cout<<x;
} | a.cc: In function 'int main()':
a.cc:10:30: error: expected ';' before '}' token
10 | x=x+0
| ^
| ;
11 | }
| ~
|
s862576871 | p03945 | C++ | #include <iostream>
using namespace std;
int main() {
string color="";
cin>>color;
int x=0;
for(int i=1;i<=color.length();i++){
if(color[i]==color[i-1]){
x=x+0
}
else{
x=x+1
}
}
cout<<x;
} | a.cc: In function 'int main()':
a.cc:10:30: error: expected ';' before '}' token
10 | x=x+0
| ^
| ;
11 | }
| ~
a.cc:13:30: error: expected ';' before '}' token
13 | x=x+1
| ^
| ;
14 | }
| ~
|
s343170638 | p03945 | Java | S = input()
pre = "X"
B, W = 0, 0
for s in S:
if s != pre:
if s == "B":
B += 1
else:
W += 1
pre = s
if B == 0 or W == 0:
print(0)
elif B == W:
print(B * 2 - 1)
else:
x, y = min(B, W), max(B, W)
print(x * 2) | Main.java:1: error: class, interface, enum, or record expected
S = input()
^
1 error
|
s553619366 | p03945 | C++ | #include <bits/stdd++.h>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
int N = S.size();
for (int i = 0; i < N-1; i++) {
if (S[i] != S[i+1]) ans++;
}
cout << ans << endl;
} | a.cc:1:10: fatal error: bits/stdd++.h: No such file or directory
1 | #include <bits/stdd++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s032435651 | p03945 | Java | import java.util.Scanner;
public class Saburo{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
String v=sc.nextLine();
String s;
int g=0;
for(int index=0;index<v.length();index++){
if(v.charAt(index)!='W'&&v.charAt(index)!='B'){
g++;
}
}
if(g!=0){
s=sc.nextLine();
}else{
s=v;
}
int c=s.codePointAt(0);
int n=0;
for(int index=1;index<s.length();index++){
if(c!=s.codePointAt(index)){
n++;
c=s.codePointAt(index);
}
}
System.out.println(n);
}
} | Main.java:2: error: class Saburo is public, should be declared in a file named Saburo.java
public class Saburo{
^
1 error
|
s745903244 | p03945 | C++ | import numpy as np
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()
s = input()
ans = 1
tmp = s[0]
for i in s:
if i != tmp:
ans += 1
tmp = i
print(ans-1) | a.cc:1:1: error: 'import' does not name a type
1 | import numpy as np
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s690563789 | p03945 | C++ | #include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;
int main(){
int ans=0;
string s;
cin>>s;
for(int i=0;i<s.lengh()-1,i++){
if(s[i]!=s[i+1]){
ans++;
}
}
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:22:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lengh'; did you mean 'length'?
22 | for(int i=0;i<s.lengh()-1,i++){
| ^~~~~
| length
a.cc:22:32: error: expected ';' before ')' token
22 | for(int i=0;i<s.lengh()-1,i++){
| ^
| ;
|
s674769897 | p03945 | C++ | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;a
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
string s;
cin>>s;
ll count=0;
for(int i=0;i<s.length()-1;i++){
if(s[i+1]!=s[i])
count++;
}
cout<<count<<endl;
}
| a.cc:18:24: error: 'a' does not name a type
18 | typedef long double ld;a
| ^
|
s534669337 | p03945 | Java | import java.util.*;
public class Stp
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s="";
if(sc.hasNext())
s=sc.next();
char []ch=s.toCharArray();
int c=0;
for(int i=0; i<ch.length-1;i++)
{
if(ch[i] != ch[i+1])
c++;
}
System.out.println(c);
}
} | Main.java:2: error: class Stp is public, should be declared in a file named Stp.java
public class Stp
^
1 error
|
s898309259 | p03945 | Java | import java.util.*;
public class S
{
Scanner sc=new Scanner(System.in);
String s=sc.next();
char []ch=s.toCharArray();
int c=0;
for(int i=0; i<ch.length()-1;i++)
{
if(ch[i] != ch[i+1])
c++;
}
System.out.println(c);
} | Main.java:8: error: illegal start of type
for(int i=0; i<ch.length()-1;i++)
^
Main.java:8: error: > or ',' expected
for(int i=0; i<ch.length()-1;i++)
^
Main.java:8: error: ';' expected
for(int i=0; i<ch.length()-1;i++)
^
Main.java:8: error: <identifier> expected
for(int i=0; i<ch.length()-1;i++)
^
Main.java:13: error: <identifier> expected
System.out.println(c);
^
Main.java:13: error: <identifier> expected
System.out.println(c);
^
6 errors
|
s364896632 | p03945 | C | #include <stdio.h>
#include <string.h>
int main(void) {
char s[100001];
scanf("%s", s);
int count = 0;
for (int i = 1; i < strlen(s); i++) {
if (s[i] != s[i-1]) {
count++;
}
}
printf("%d\n", count);
| main.c: In function 'main':
main.c:14:3: error: expected declaration or statement at end of input
14 | printf("%d\n", count);
| ^~~~~~
|
s723658204 | p03945 | C++ | #include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
string s ;
cin >> s ;
int k=s.size() ;
int ans=0 ;
rep(i,k-1) {
if(s[i]!=s[i+1] ) ans ++ ;
}
cout <<ans <<endl ;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:8: error: '\U0000ff4b' was not declared in this scope
17 | rep(i,k-1) {
| ^~
a.cc:4:43: note: in definition of macro 'rep'
4 | #define rep(i,n) for (long long i=0; i < (n); ++i)
| ^
|
s192192008 | p03945 | C++ | #include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
string s ;
cin >> s ;
int k=s.size() ;
int ans=0 ;
rep(i,n-1) {
if(s[i]!=s[i+1] ) ans ++ ;
}
cout <<ans <<endl ;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:8: error: 'n' was not declared in this scope
17 | rep(i,n-1) {
| ^
a.cc:4:43: note: in definition of macro 'rep'
4 | #define rep(i,n) for (long long i=0; i < (n); ++i)
| ^
|
s645303286 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
string s;
cin >> s;
ll k=s.size();
ll cnt=0;
rep(i,k-1){
if(a[i]!=a[i+1]){
cnt++;
}
}
cout << cnt << endl;
}
| a.cc: In function 'int main()':
a.cc:21:8: error: 'a' was not declared in this scope
21 | if(a[i]!=a[i+1]){
| ^
|
s435213985 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
string s;
cin >> s;
ll k=s.size();
ll cnt=0;
rep(i,k){
if(a[i]!=a[i+1]){
cnt++;
}
}
cout << cnt << endl;
} | a.cc: In function 'int main()':
a.cc:21:8: error: 'a' was not declared in this scope
21 | if(a[i]!=a[i+1]){
| ^
|
s066871066 | p03945 | C++ | S = input()
before_stone = S[0]
count = 0
for i in S[1:]:
if i != before_stone:
count += 1
before_stone = i
print(count) | a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s404009421 | p03945 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
string S;
cin >> string;
N=S.size()
ll i;
ll cnt=0;
for(i=0;i<N-1;i++){
if(S[i]!=S[i+1])cnt++;
}
cout << cnt <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:18: error: expected primary-expression before ';' token
16 | cin >> string;
| ^
a.cc:17:5: error: 'N' was not declared in this scope
17 | N=S.size()
| ^
a.cc:20:9: error: 'i' was not declared in this scope
20 | for(i=0;i<N-1;i++){
| ^
|
s884115095 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
string board;
cin >> board;
char piece=board[0];
for(int i=1;i<board.size();i++){
if(piece!=board[i]) {
piece=board[i]
ans++;}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'ans'
12 | piece=board[i]
| ^
| ;
13 | ans++;}
| ~~~
|
s422040671 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
string board;
cin >> board;
char piece=board[0];
for(int i=1;i<board.size();i++){
if(piece!=board[i]) {
piece=board[i]
ans++;}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'ans'
12 | piece=board[i]
| ^
| ;
13 | ans++;}
| ~~~
|
s760014982 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
string board;
cin >> board;
char piece=board[0];
for(int i=1;i<board.size();i++){
if(piece!=board[i]) {
piece=board[i]
ans++;}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'ans'
12 | piece=board[i]
| ^
| ;
13 | ans++;}
| ~~~
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s936798599 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
string board;
cin >> board;
char piece=board[0];
for(int i=1;i<board.size();i++){
if(piece!=board[i]) {
piece=board[i]
ans++;}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'ans'
12 | piece=board[i]
| ^
| ;
13 | ans++;}
| ~~~
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s100703079 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
char hhj[100005],y;
int count,wb;
int main()
{
while(hhj[wb]=getchar(),hhj[wb]!='\n')
{
if(wb==0)
y=hhj[wb];
if(hhj[wb]!=y)
count++,y=hhj[wb];
wb++;
}
printf("%d\n",count);
return 0;
} | a.cc: In function 'int main()':
a.cc:15:11: error: reference to 'count' is ambiguous
15 | count++,y=hhj[wb];
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:5:5: note: 'int count'
5 | int count,wb;
| ^~~~~
a.cc:18:19: error: reference to 'count' is ambiguous
18 | printf("%d\n",count);
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:5:5: note: 'int count'
5 | int count,wb;
| ^~~~~
|
s187048109 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
char hhj[100005],y;
int count,wb;
int main()
{
while(hhj[wb]=getchar(),hhj[wb]!='\n')
{
if(z==0)
y=hhj[wb];
if(hhj[wb]!=y)
count++,y=hhj[wb];
wb++;
}
printf("%d\n",count);
return 0;
} | a.cc: In function 'int main()':
a.cc:12:12: error: 'z' was not declared in this scope
12 | if(z==0)
| ^
a.cc:15:11: error: reference to 'count' is ambiguous
15 | count++,y=hhj[wb];
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:5:5: note: 'int count'
5 | int count,wb;
| ^~~~~
a.cc:18:19: error: reference to 'count' is ambiguous
18 | printf("%d\n",count);
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:5:5: note: 'int count'
5 | int count,wb;
| ^~~~~
|
s714287319 | p03945 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);
//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
// ll a, b;
// cin >> a >> b;
// work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };
//最大公約数
ll gcd(ll x, ll y) {
return y ? gcd(y, x % y) : x;
}
ll lcm(ll x, ll y) {
if (x == 0 || y == 0)return 0;
return (x / gcd(x, y) * y);
}
//素因数分解
vector<pair<ll, int>>factorize(ll n) {
vector<pair<ll, int>>res;
for (ll i = 2;i * i <= n;++i) {
if (n % i)continue;
res.emplace_back(i, 0);
while (n % i == 0) {
n /= i;
res.back().second++;
}
}
if (n != 1)res.emplace_back(n, 1);
return res;
}
int bingo[3][3];
int cnt[2][105];
int h, w;
bool flag[110][110];
int main() {
string s;
cin >> s;
char target = s[0];
int n = s.length();
int ans = 0;
for (int i = 1;i < n;++i) {
if (target != s[i]) {
taget = s[i];
ans++;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:66:25: error: 'taget' was not declared in this scope; did you mean 'target'?
66 | taget = s[i];
| ^~~~~
| target
|
s790819567 | p03945 | C++ | #include<bits/stdc++.h>
string s;
int cnt,l;
int main(){
cin>>s;
l=s.size();
for(int i=1;i<l;++i)cnt+=(s[i]!=s[i-1]);
cout<<cnt<<endl;
return 0;
} | a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
2 | string s;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>s;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:10: error: 's' was not declared in this scope
5 | cin>>s;
| ^
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
8 | cout<<cnt<<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:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
8 | cout<<cnt<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s624591317 | p03945 | C++ | #include<bits/stdc++.h>
string srx[100001];
int cnt,l;
int main(){
cin>>s;
l=s.size();
for(int i=1;i<l;++i)cnt+=(s[i]!=s[i-1]);
cout<<cnt<<endl;
return 0;
} | a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
2 | string srx[100001];
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>s;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:10: error: 's' was not declared in this scope
5 | cin>>s;
| ^
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
8 | cout<<cnt<<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:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
8 | cout<<cnt<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s454794272 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int S;
cin >> S;
int ans=0;
for(int i = 0;i < S.size() - 1; i++){
ans+=(S.at(i) != S.at(i + 1));
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'size' in 'S', which is of non-class type 'int'
7 | for(int i = 0;i < S.size() - 1; i++){
| ^~~~
a.cc:8:13: error: request for member 'at' in 'S', which is of non-class type 'int'
8 | ans+=(S.at(i) != S.at(i + 1));
| ^~
a.cc:8:24: error: request for member 'at' in 'S', which is of non-class type 'int'
8 | ans+=(S.at(i) != S.at(i + 1));
| ^~
|
s417258662 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int S;
cin >> S;
int ans=0;
for(int i = 0;i < S.size() - 1; i++){
ans+=(S[i] != S[i + 1]);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'size' in 'S', which is of non-class type 'int'
7 | for(int i = 0;i < S.size() - 1; i++){
| ^~~~
a.cc:8:12: error: invalid types 'int[int]' for array subscript
8 | ans+=(S[i] != S[i + 1]);
| ^
a.cc:8:20: error: invalid types 'int[int]' for array subscript
8 | ans+=(S[i] != S[i + 1]);
| ^
|
s097323578 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int S;
cin >> S;
int ans=0;
for(int i = 0;i < S.size() - 1; i++){
ans+=(s[i] != s[i + 1]);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'size' in 'S', which is of non-class type 'int'
7 | for(int i = 0;i < S.size() - 1; i++){
| ^~~~
a.cc:8:11: error: 's' was not declared in this scope
8 | ans+=(s[i] != s[i + 1]);
| ^
|
s071588185 | p03945 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
string a;
int s=0;
cin>>a;
for(int i=1;i<s.size();i++)
if(a[i]!=a[i-1])
s++;
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:21: error: request for member 'size' in 's', which is of non-class type 'int'
9 | for(int i=1;i<s.size();i++)
| ^~~~
|
s126554278 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int l=S.length(), count=0;
for(int i=0; i < l-1; i++) {
if(s.at(i) != s.at(i+1)) count++;
}
cout << count << endl;
}
| a.cc: In function 'int main()':
a.cc:8:9: error: 's' was not declared in this scope
8 | if(s.at(i) != s.at(i+1)) count++;
| ^
|
s242705126 | p03945 | C++ | #include<bits/stdc++.h>
using namsespace std;
int main() {
string S;
cin >> S;
int l=S.length(), count=0;
for(int i=0; i < l-1; i++) {
if(s.at(i) != s.at(i+1)) count++;
}
cout << count << endl;
} | a.cc:2:7: error: expected nested-name-specifier before 'namsespace'
2 | using namsespace std;
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:4:3: error: 'string' was not declared in this scope
4 | string S;
| ^~~~~~
a.cc:4:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin >> S;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:10: error: 'S' was not declared in this scope
5 | cin >> S;
| ^
a.cc:8:9: error: 's' was not declared in this scope
8 | if(s.at(i) != s.at(i+1)) count++;
| ^
a.cc:8:31: error: 'count' was not declared in this scope; did you mean 'std::count'?
8 | if(s.at(i) != s.at(i+1)) count++;
| ^~~~~
| std::count
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
a.cc:10:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout << count << 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:10:11: error: 'count' was not declared in this scope; did you mean 'std::count'?
10 | cout << count << endl;
| ^~~~~
| std::count
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
a.cc:10:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
10 | cout << count << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s341962176 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
string jia(string a,string b)
{
int aa,bb;
int alen=a.length();
int blen=b.length();
if(alen<blen)
{
swap(a,b);
swap(alen,blen);
}
int bblen=blen;
blen--;
for(int i=alen-1; i>=1; i--)
{
if(blen>=0)
{
if(a[i]+b[blen]<106)
{
a[i]=a[i]+b[blen]-48;
}
else
{
a[i-1]++;
a[i]=a[i]+b[blen]-58;
}
blen--;
}
else
{
if(a[i]>'9')
a[i]=a[i]-10,a[i-1]++;
}
}
if(bblen==alen)
{
aa=(int)(a[0])-48,bb=(int)(b[0])-48;
if(aa+bb<10)
{
a[0]=(char)(aa+bb+48);
}
else
{
cout<<1;
a[0]=(char)(aa+bb+38);
}
}
else
{
if(a[0]>'9')
{
a[0]=a[0]-10;
cout<<1;
}
}
cout<<a<<endl;
}
int a[5001],b[5001],ans[5001];
int main()
{
int s;
cin>>s;
int ans=0;
for(int i=0;i<s.length();i++)
if(s[i]!=s[i-1])ans++;
cout<<ans;
return 0;
} | a.cc: In function 'std::string jia(std::string, std::string)':
a.cc:58:1: warning: no return statement in function returning non-void [-Wreturn-type]
58 | }
| ^
a.cc: In function 'int main()':
a.cc:66:19: error: request for member 'length' in 's', which is of non-class type 'int'
66 | for(int i=0;i<s.length();i++)
| ^~~~~~
a.cc:67:7: error: invalid types 'int[int]' for array subscript
67 | if(s[i]!=s[i-1])ans++;
| ^
a.cc:67:13: error: invalid types 'int[int]' for array subscript
67 | if(s[i]!=s[i-1])ans++;
| ^
|
s100373692 | p03945 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define adrep(i,s,n) for (int i=(s);i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
int S;
cin>>S;
int count=0;
int N=S.length()-1;
rep(i,N){
if(S[i]!=S[i+1])count++;
}
cout<<count<<endl;
}
| a.cc: In function 'int main()':
a.cc:14:11: error: request for member 'length' in 'S', which is of non-class type 'int'
14 | int N=S.length()-1;
| ^~~~~~
a.cc:17:9: error: invalid types 'int[int]' for array subscript
17 | if(S[i]!=S[i+1])count++;
| ^
a.cc:17:15: error: invalid types 'int[int]' for array subscript
17 | if(S[i]!=S[i+1])count++;
| ^
|
s023052117 | p03945 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define adrep(i,s,n) for (int i=(s);i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
int S;
cin>>S;
int count=0;
rep(i,S.length()-1){
if(S[i]!=S[i+1])count++;
}
cout<<count<<endl;
} | a.cc: In function 'int main()':
a.cc:14:11: error: request for member 'length' in 'S', which is of non-class type 'int'
14 | rep(i,S.length()-1){
| ^~~~~~
a.cc:2:34: note: in definition of macro 'rep'
2 | #define rep(i,n) for (int i=0;i<(n);i++)
| ^
a.cc:16:9: error: invalid types 'int[int]' for array subscript
16 | if(S[i]!=S[i+1])count++;
| ^
a.cc:16:15: error: invalid types 'int[int]' for array subscript
16 | if(S[i]!=S[i+1])count++;
| ^
|
s334253560 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; i < S.size() - 1; i++) {
if (S[i] == S[i + 1]) {
S = S.substr(0,i) + S.substr(i + 1,S.size() - 1 - i);
i--
}
}
cout << S.size() - 1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:10: error: expected ';' before '}' token
9 | i--
| ^
| ;
10 | }
| ~
|
s637039574 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; i < S.size() - 1; i++) {
if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
}
cout << S.size() - 1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:64: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ~ ^ ~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: mismatched types 'const std::complex<_Tp>' and 'int'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:7:66: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
7 | if (S[i] == S[i + 1]) S = S.substr(0,i) + S.substr(i + 1,S - 1 - i);
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:7:66: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valar |
s527395698 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define str(n) to_string(n)
#define int(w) stoi(w)
#define len(l) l.size()
#define append(l,i) l.push_back(i)
int main() {
string w;
cin>>w;
int ans=0;
rep(i,w.length()-1){
if (w.at(i)!=w.at(i+1)){
ans+=1;
})
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:10: error: expected primary-expression before ')' token
19 | })
| ^
|
s751133347 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int ret=0;
string s; cin>>s;
for(int i=1;i<s.size();++i)
if(s[i]!=s[i-1])
ret++;
cout<<r<<"\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'r' was not declared in this scope
10 | cout<<r<<"\n";
| ^
|
s178961374 | p03945 | Java | let ans s =
let n = String.length s in
let rec f i c ret =
if i = n then ret
else if s.[i] = c then f (i+1) c ret
else f (i+1) s.[i] (ret+1)
in f 1 s.[0] 0;;
Scanf.scanf "%s" (fun s -> print_int (ans s))
| Main.java:1: error: class, interface, enum, or record expected
let ans s =
^
Main.java:9: error: class, interface, enum, or record expected
Scanf.scanf "%s" (fun s -> print_int (ans s))
^
2 errors
|
s776483581 | p03945 | C++ | #include<bits/stdc++.h>
string s;
int ans;
int main()
{
cin>>s;
for(int i=1;i<s.size();i++)
if(s[i]!=s[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
2 | string s;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin>>s;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:10: error: 's' was not declared in this scope
6 | cin>>s;
| ^
|
s870766057 | p03945 | C++ | #include<bits/stdc++.h>
string s;
int ans;
int main()
{
cin>>s;
for(i=1;i<s.size();i++)
if(s[i]!=s[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
2 | string s;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin>>s;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:10: error: 's' was not declared in this scope
6 | cin>>s;
| ^
a.cc:7:9: error: 'i' was not declared in this scope
7 | for(i=1;i<s.size();i++)
| ^
|
s562492000 | p03945 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
int main()
{
string s; cin >> s;
if (s.size() == 1) {
cout << 0 << endl;
}
char cur = s[0];
ll c1 = 0, c2 = 0;
for (int i = 1; i < s.size(); i++) {
if (s[i] != cur) c1++;
cur = s[i];
}
reverse(all(s));
char cur = s[0];
for (int i = 1; i < s.size(); i++) {
if (s[i] != cur) c2++;
cur = s[i];
}
cout << min(c1, c2) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:10: error: redeclaration of 'char cur'
26 | char cur = s[0];
| ^~~
a.cc:18:10: note: 'char cur' previously declared here
18 | char cur = s[0];
| ^~~
|
s124956754 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
string s;
char te;
cin >> s;
te=s.at(0);
for(int i=1;i<s.size;i++){
if(te!=s.at(i)){
te=s.at(i);
ans++;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:10:21: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
10 | for(int i=1;i<s.size;i++){
| ~~^~~~
| ()
|
s619660814 | p03945 | C++ | #include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int main() {
string s;
cin >> s;
char pre = s[i];
int ans = 0;
for(int i = 0; i < s.size(); i++) {
if (s[i] != pre)
ans += 1;
pre = s[i];
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:22: error: 'i' was not declared in this scope
14 | char pre = s[i];
| ^
|
s505314660 | p03945 | C++ | #include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
#include <list>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
int main(void)
{
string s;
cin >> s;
long long ans = 0;
rep(i, 1, s.length())
{
if (s[i] != s[i - 1])
ans++;
}
cout << ans << endl;
| a.cc: In function 'int main()':
a.cc:35:25: error: expected '}' at end of input
35 | cout << ans << endl;
| ^
a.cc:26:1: note: to match this '{'
26 | {
| ^
|
s974663622 | p03945 | C++ | S = input()
ans = 0
coller = S[0]
for s in S[1:]:
if s != coller:
ans += 1
coller = s
print(ans) | a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s026673210 | p03945 | C++ | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main()
{
string s;
cin >> s;
int cnt = 0;
rep(i, s.size() - 1) if (s[i] != s[i + 1])
cnt++;
OP();
return 0;
} | a.cc: In function 'int main()':
a.cc:10:25: error: expected primary-expression before '<<' token
10 | #define OP(m) cout << m << endl
| ^~
a.cc:23:5: note: in expansion of macro 'OP'
23 | OP();
| ^~
|
s354888458 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S;
if(S.size()==0){
cout<<0<<endl;
}else{
int sum=0;
int n=S.size();
for(int i=0;i<n-1;i++){
if((S.at(i)=='W'&&S.at(i+1)=='B')||(S.at(i)=='B'&&S.at(i+1)=='W')){
sum+;
}
}
cout<<sum<<endl;
}
} | a.cc: In function 'int main()':
a.cc:14:13: error: expected primary-expression before ';' token
14 | sum+;
| ^
|
s475805058 | p03945 | Java | import java.util.Scanner;
public class MainC {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] s = sc.next().toCharArray();
int ans = 0;
for (int i = 1; i < s.length; i++) {
if(s[i] != s[i-1]) ans++;
}
System.out.println(ans);
sc.close();
}
} | Main.java:3: error: class MainC is public, should be declared in a file named MainC.java
public class MainC {
^
1 error
|
s022168305 | p03945 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
string s;
int l,ans;
int main()
{
l=strlen(s+1);
for(int i=1;i<l;i++)
{
if(s[i]!=s[i-1]) ans++;
}
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:19: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
12 | l=strlen(s+1);
| ~^~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
12 | l=strlen(s+1);
| ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const _CharT*' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: deduced conflicting types for parameter '_CharT' ('char' and 'int')
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: mismatched types 'const _CharT*' and 'int'
12 | l=strlen(s+1);
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: deduced conflicting types for parameter '_CharT' ('char' and 'int')
12 | l=strlen(s+1);
| ^
|
s091897908 | p03945 | C++ | /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll Len(ll n) {
ll s=0;
while(n!=0) s++, n/=10;
return s;
}
ll Sint(ll n) {
ll m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
return m;
}
ll Svec(vector<ll> v){
ll n=0;
for(ll i=0;i<v.size();i++) n+=v[i];
return n;
}
ll GCD(ll a,ll b) {
return b ? GCD(b,a%b) : a;
}
ll LCM(ll a,ll b){
return a/GCD(a,b)*b;
}
ll Factorial(ll n){
ll m=1;
while(n>=1) m*=n,n--;
return m;
}
void runlength(string s,vector<pair<char,ll>> &p){
ll x=1;
if(s.size()==1){
p.push_back(pair<char,ll>(s[0],1));
}
for(ll i=0;i<s.size()-1;i++){
if(s[i]==s[i+1]){
x++;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[i],x));
}
}else{
p.push_back(pair<char,ll>(s[i],x));
x=1;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[s.size()-1],x));
}
}
}
}
ll COM(ll n,ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
vector<bool> isPrime(MAX_N+1,true);
for(int i=2;i<=MAX_N;i++){
if(isPrime[i]){
for(int j=2*i;j<=MAX_N;j+=i){
isPrime[j]=false;
}
}
}
return isPrime;
}
vector<pint> prime_factorize(ll n){
vector<pint> ans;
for(ll p=2;p<=sqrt(n);p++){
if(n%p!=0) continue;
ll cnt=0;
while(n%p==0){
n/=p;
cnt++;
}
ans.push_back(make_pair(p,cnt));
}
if(n!=1) ans.push_back(make_pair(n,1));
return ans;
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
IOS;
string s;
cin>>s;
vector<pint> p;
runlength(s,p);
cout<<p.size()-1<<endl;
} | a.cc: In function 'int main()':
a.cc:143:15: error: invalid initialization of reference of type 'std::vector<std::pair<char, long long int> >&' from expression of type 'std::vector<std::pair<long long int, long long int> >'
143 | runlength(s,p);
| ^
a.cc:79:48: note: in passing argument 2 of 'void runlength(std::string, std::vector<std::pair<char, long long int> >&)'
79 | void runlength(string s,vector<pair<char,ll>> &p){
| ~~~~~~~~~~~~~~~~~~~~~~~^
|
s778544013 | p03945 | C++ | s = gets.chop
ans = 0
prev = s[0]
1.upto(s.length-1) do |i|
ans += 1 unless s[i] == prev
prev = s[i]
end
p ans | a.cc:1:1: error: 's' does not name a type
1 | s = gets.chop
| ^
|
s315655524 | p03945 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string s;
cin>>s;
int n=s.size();
int a=0;
for(int i=0;i<n-1;i++){
if(s[i]!=s[i+1]){
a++
}
}
cout<<a<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:10: error: expected ';' before '}' token
13 | a++
| ^
| ;
14 | }
| ~
|
s785956936 | p03945 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string s;
cin>>s;
int n=s.size();
int a;
for(int i=0;i<n-1;i++){
if(s[i]!=s[i+1]){
a++
}
}
cout<<a<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:10: error: expected ';' before '}' token
13 | a++
| ^
| ;
14 | }
| ~
|
s216807182 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
string S;
cin >> S;
ll ans = 0;
char c_before = S[0];
for (ll i = 1; i < N; ++i)
if (c_before != S[i]) {
ans++;
c_before = S[i];
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:21: error: 'N' was not declared in this scope
10 | for (ll i = 1; i < N; ++i)
| ^
|
s043625572 | p03945 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
string t[a];
int s=0;
gets(t);
for(int i=1;t[i]!='\0';i++)
if(t[i]!=t[i--])s++;
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:14: error: 'a' was not declared in this scope
7 | string t[a];
| ^
a.cc:9:10: error: 't' was not declared in this scope
9 | gets(t);
| ^
a.cc:9:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
9 | gets(t);
| ^~~~
| getw
|
s165708366 | p03945 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
int a=100000;
int main()
{
char t[a];
int s=0;
gets(t)
for(int i=1;t[i]!='\0';i++)
if(t[i]!=t[i--])s++;
cout<<s<<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(t)
| ^~~~
| getw
a.cc:10:19: error: 'i' was not declared in this scope
10 | for(int i=1;t[i]!='\0';i++)
| ^
|
s328159902 | p03945 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
int a=100000;
int main()
{
char t[a],s=0;
gets(t)
for(int i=1;t[i]!='\0';i++)
if(t[i]!=t[i--])s++;
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(t)
| ^~~~
| getw
a.cc:9:19: error: 'i' was not declared in this scope
9 | for(int i=1;t[i]!='\0';i++)
| ^
|
s084357081 | p03945 | C++ | #include<cstdio>
using namespace std;
int main()
{
char c,s;
int ans=0;
cin>>c;
for(int i=0;i<100000;i++)
{
cin>>s;
if(s!=c){ans++;c=s;}
if(s==EOF)break;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
7 | cin>>c;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<cstdio>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:14:5: error: 'cout' was not declared in this scope
14 | cout<<ans<<endl;
| ^~~~
a.cc:14:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:16: error: 'endl' was not declared in this scope
14 | cout<<ans<<endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include<cstdio>
+++ |+#include <ostream>
2 | using namespace std;
|
s083209269 | p03945 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char c,s;
int ans=0;
cin>>c;
for(cin>>s)
{
if(s!=c)ans++;
c=s;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:15: error: expected ';' before ')' token
9 | for(cin>>s)
| ^
| ;
a.cc:15:5: error: expected primary-expression before 'return'
15 | return 0;
| ^~~~~~
a.cc:14:21: error: expected ')' before 'return'
14 | cout<<ans<<endl;
| ^
| )
15 | return 0;
| ~~~~~~
a.cc:9:8: note: to match this '('
9 | for(cin>>s)
| ^
|
s106595211 | p03945 | C++ | #include<iostream>
using namespace std;
string s,k;
int main()
{
cin>>s;
for(int i=1;i<=s.size()-1;i++)
{
if(s[i]!=s[i-1])
k++;
}
cout<<k<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:2: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
10 | k++;
| ~^~
|
s032892098 | p03945 | C++ | #include<iostream>
using namespace std;
string s,k;
int main()
{
cin>>s;
for(int i=1;i<=s.size()-1;i++)
{
if(s[i]!=s[i-1]
k++;
}
cout<<k<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:16: error: expected ';' before 'k'
9 | if(s[i]!=s[i-1]
| ^
| ;
10 | k++;
| ~
a.cc:11:1: error: expected primary-expression before '}' token
11 | }
| ^
a.cc:10:5: error: expected ')' before '}' token
10 | k++;
| ^
| )
11 | }
| ~
a.cc:9:3: note: to match this '('
9 | if(s[i]!=s[i-1]
| ^
a.cc:11:1: error: expected primary-expression before '}' token
11 | }
| ^
|
s990993040 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int gcd(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
string s;
cin>>s;
vector<int> v;
int cnt=0,start;
bool flag=true;
for(long long int i=0;i<s.size();i++){
if(flag){
start=i;
flag=false;
}
if(s[i]==s[i+1]){
cnt++;
}else{
v.push_back(s.substr(start,cnt+1));
cnt=0;
flag=true;
}
}
cout<<v.size()-1<<endl;
}
/////////////////////////// | a.cc: In function 'int main()':
a.cc:84:18: error: no matching function for call to 'std::vector<int>::push_back(std::__cxx11::basic_string<char>)'
84 | v.push_back(s.substr(start,cnt+1));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
|
s736515497 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int gcd(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
string s;
cin>>s;
vector<int> v;
int cnt=0,start;
bool flag=true;
for(long long int=0;i<s.size();i++){
if(flag){
start=i;
flag=false;
}
if(s[i]==s[i+1]){
cnt++;
}else{
v.push_back(s.substr(start,cnt+1));
cnt=0;
flag=true;
}
}
cout<<v.size()-1<<endl;
}
/////////////////////////// | a.cc: In function 'int main()':
a.cc:76:20: error: expected unqualified-id before '=' token
76 | for(long long int=0;i<s.size();i++){
| ^
a.cc:76:20: error: expected ';' before '=' token
76 | for(long long int=0;i<s.size();i++){
| ^
| ;
a.cc:76:20: error: expected primary-expression before '=' token
a.cc:76:23: error: 'i' was not declared in this scope
76 | for(long long int=0;i<s.size();i++){
| ^
a.cc:76:33: error: expected ')' before ';' token
76 | for(long long int=0;i<s.size();i++){
| ~ ^
| )
a.cc:76:34: error: 'i' was not declared in this scope
76 | for(long long int=0;i<s.size();i++){
| ^
|
s784485896 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
char x[100005],y;
int g,z;
int main()
{
while(x[z]=getchar(),x[z]!='\n')
{
if(z==0),y=x[z];
if(x[z]!=y)g++,y=x[z];
z++;
}
cout<<g;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:25: error: expected primary-expression before ',' token
10 | if(z==0),y=x[z];
| ^
|
s357920110 | p03945 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
vector <char> S;
cin >> S;
int change = 0;
for(int i = 0; i < S.size()-1; i++){
if(S[i] != S[i+1]) change++;
}
cout << change;
}
| a.cc: In function 'int main()':
a.cc:8:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<char>')
8 | cin >> S;
| ~~~ ^~ ~
| | |
| | std::vector<char>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/os |
s060100142 | p03945 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
vector <char> S[];
cin >> S;
int change = 0;
for(int i = 0; i < S.size()-1; i++){
if(S[i] != S[i+1]) change++;
}
cout << change;
} | a.cc: In function 'int main()':
a.cc:7:17: error: array size missing in 'S'
7 | vector <char> S[];
| ^
a.cc:8:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<char> [1]')
8 | cin >> S;
| ~~~ ^~ ~
| | |
| | std::vector<char> [1]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::vector<char>*'
8 | cin >> S;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'short int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(short int)((std::vector<char>*)(& S))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'short unsigned int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(short unsigned int)((std::vector<char>*)(& S))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(int)((std::vector<char>*)(& S))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'unsigned int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(unsigned int)((std::vector<char>*)(& S))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'long int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(long int)((std::vector<char>*)(& S))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'long unsigned int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(long unsigned int)((std::vector<char>*)(& S))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'long long int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(long long int)((std::vector<char>*)(& S))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: invalid conversion from 'std::vector<char>*' to 'long long unsigned int' [-fpermissive]
8 | cin >> S;
| ^
| |
| std::vector<char>*
a.cc:8:10: error: cannot bind rvalue '(long long unsigned int)((std::vector<char>*)(& S))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:10: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
8 | cin >> S;
| ^
/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<char> [1]' 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<char> [1]' 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<char> [1]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<char> [1]' 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<char> [1]' to 'std::basic_istream<ch |
s000192510 | p03945 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
string s;
cin >> s;
bool f = false;
int ans = 0;
while(!f){
//先頭から同じ要素がいくつ続いているか
int cl = 1;
for(int i = 1; i < s.size(); i++){
if(s[0] != s[i]) break;
cl++;
}
if(cl == s.size()){
f = true;
continue;
}
cr = 1;
//末尾から(略
for(int i = s.size() -1 ; i >= 0; i--){
if(s[s.size() - 1] != s[i]) break;
cr++;
}
if(cr == s.size()){
f = true;
continue;
}
if(cl > cr){
ans++;
auto b = s.begin();
if(s[0] == 'B'){
s.insert(b,'W');
for(int i = 1; i < cl+1; i++) s[i] = 'W';
}else{
s.insert(b,'B');
for(int i = 1; i < cl+1; i++) s[i] = 'B';
}
}else{
ans++;
if(s[s.size()-1] == 'B'){
s.push_back('W');
for(int i = s.size()-1; i > s.size()-cr-1; i--) s[i] = 'W';
}else{
s.push_back('B');
for(int i = s.size()-1; i > s.size()-cr-1; i--) s[i] = 'B';
}
}
}
cout << ans;
}
| a.cc: In function 'int main()':
a.cc:24:5: error: 'cr' was not declared in this scope; did you mean 'cl'?
24 | cr = 1;
| ^~
| cl
|
s551258560 | p03945 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
vector<char> s;
cin >> s;
bool f = false;
int ans = 0;
while(!f){
//先頭から同じ要素がいくつ続いているか
int cl = 1;
for(int i = 1; i < s.size(); i++){
if(s[0] != s[i]) break;
cl++;
}
if(cl == s.size()){
f = true;
continue;
}
cr = 1;
//末尾から(略
for(int i = s.size() -1 ; i >= 0; i--){
if(s[s.size() - 1] != s[i]) break;
cr++;
}
if(cr == s.size()){
f = true;
continue;
}
if(cl > cr){
ans++;
auto b = s.begin();
if(s[0] == 'B'){
s.insert(b,'W');
for(int i = 1; i < cl+1; i++) s[i] = 'W';
}else{
s.insert(b,'B');
for(int i = 1; i < cl+1; i++) s[i] = 'B';
}
}else{
ans++;
if(s[s.size()-1] == 'B'){
s.push_back('W');
for(int i = s.size()-1; i > s.size()-cr-1; i--) s[i] = 'W';
}else{
s.push_back('B');
for(int i = s.size()-1; i > s.size()-cr-1; i--) s[i] = 'B';
}
}
}
cout << ans;
} | a.cc: In function 'int main()':
a.cc:8:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<char>')
8 | cin >> s;
| ~~~ ^~ ~
| | |
| | std::vector<char>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' 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<char>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/os |
s804781654 | p03945 | C++ | #include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
string a;
int sum=0;
cin>>a;
for(int i=1;i<a.length;i++){
if(a[i]!=a[i-1]){
sum++;
}
}
cout<<sum;
} | a.cc: In function 'int main()':
a.cc:9:21: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
9 | for(int i=1;i<a.length;i++){
| ~~^~~~~~
| ()
|
s111555459 | p03945 | C++ | #include<bits/stdc++.h>
#include<cstdio>
using namespace std;
char asd[100001];
int main()
{
gets(asd);
int zip,ppt=0;
for(zip=1;zip<strlen(asd);zip++)
if(asd[zip]!=asd[zip-1])
ppt++;
printf("%d\n",ppt);
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(asd);
| ^~~~
| getw
|
s961083125 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
char asd[100001];
int main()
{
gets(asd);
int zip,ppt=0;
for(zip=1;zip<strlen(asd);zip++)
if(asd[zip]!=asd[zip-1])
ppt++;
printf("%d\n",ppt);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(asd);
| ^~~~
| getw
|
s101158859 | p03945 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
char tmp = s[0];
int count = 0;
for(int i = 1; i < s.size(); i++){
if(s[i] != tmp) {
count++;
tmp = s[i];
}
}
cout << cont;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:17: error: 'cont' was not declared in this scope; did you mean 'count'?
16 | cout << cont;
| ^~~~
| count
|
s910987187 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int ans;
char a[100001];
scanf("%s",a);
for(int i=0;i<a-1;i++)
{
if(a[i]!=a[i+1])
ans++;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | for(int i=0;i<a-1;i++)
| ~^~~~
|
s806806014 | p03945 | C++ | #include<iostream>
#include<cstring>
using namespace std;
int main(){
char a[100010];
int ans=0;
gets(a);
for(int i=1;i<=strlen(a);i++){
if(a[i]!=a[i-1]) ans++;
}
cout<<ans-1;
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(a);
| ^~~~
| getw
|
s887202333 | p03945 | C++ | #include<vector>
#include<cstring>
#include<iostream>
using namespace std;
string s;
int main()
{
int ans=0;
getline(cin,s);
for(int i=1;i<s.size();i++)
if(s[i]!=s[i-1])ans++;
printf("%d\N",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:12:16: error: '\N' not followed by '{'
12 | printf("%d\N",ans);
| ^~~~~~
a.cc:12:16: error: incomplete universal character name \N
|
s978237560 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int cnt=0;
for(int i=0;i<s.size()-1;i++){
if(a[i]!=a[i+1]){
cnt++;
}
}
cout << cnt << endl;
} | a.cc: In function 'int main()':
a.cc:8:8: error: 'a' was not declared in this scope
8 | if(a[i]!=a[i+1]){
| ^
|
s458810003 | p03945 | C++ | #include<cstdio>
#include<cstring>
int main(){
char s[];
scanf("%s", s);
int n = 0;
for(int i=0; i<strlen(s); i++){
if(s[i] != s[i-1])
n++;
}
printf("%d", n);
return 0;
} | a.cc: In function 'int main()':
a.cc:4:8: error: storage size of 's' isn't known
4 | char s[];
| ^
|
s614387989 | p03945 | C++ | #include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;
int digitsum(int n,int b){
if(b<2) return -1;
if(n<b) return n;
return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n){return mpow(n,mod-2);}
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
signed main(){
string S;
cin>>S;
int ans=0;
rep(i,s.size()-1) if(s[i]!=s[i+1]) ans++;
cout<<ans<<endl;
}
int mpow(int a,int x){
int ans=1;
while(x>0){
if(x%2==1) (ans*=a)%=mod;
(a*=a)%=mod;
x>>=1;
}
return ans;
} | a.cc: In function 'int main()':
a.cc:29:11: error: 's' was not declared in this scope
29 | rep(i,s.size()-1) if(s[i]!=s[i+1]) ans++;
| ^
a.cc:5:38: note: in definition of macro 'repi'
5 | #define repi(i,a,b) for(int i=(a);i<(b);++i)
| ^
a.cc:3:39: note: in expansion of macro '_rep'
3 | #define _overload3(_1,_2,_3,name,...) name
| ^~~~
a.cc:29:5: note: in expansion of macro 'rep'
29 | rep(i,s.size()-1) if(s[i]!=s[i+1]) ans++;
| ^~~
|
s369432183 | p03945 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 0; i<= s.length()-2;i++){
char a = s[i];
char b = s[i+1]
if(a != b){
ans++;
}
}
cout << ans;
} | a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'if'
11 | if(a != b){
| ^~
|
s868162531 | p03945 | C++ | #include<bits/stdc++.h>
using nmaespace std;
int main(){
string input;
long long ans=0;
cin>>input;
for(int i=1;i<input.length();i++){
if(input[i-1]!=input[i]) ans++;
}
cout<<ans<<endl;
return 0;
} | a.cc:2:7: error: expected nested-name-specifier before 'nmaespace'
2 | using nmaespace std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:4:5: error: 'string' was not declared in this scope
4 | string input;
| ^~~~~~
a.cc:4:5: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin>>input;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:10: error: 'input' was not declared in this scope; did you mean 'int'?
6 | cin>>input;
| ^~~~~
| int
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<ans<<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:10:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
10 | cout<<ans<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s443581814 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
char srx[100001];
int main()
{
gets(srx);
int i,zjq=0;
for(i=1;i<strlen(srx);i++)//注意从1开始,不然就会多一个
if(srx[i]!=srx[i-1])
zjq++;//判断成功就加1(还是C语言的char好用~,可以当数组用)
printf("%d\n",zjq);//回车注意++
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(srx);
| ^~~~
| getw
|
s829130277 | p03945 | C++ | #include<iostream>
using namespace std;
int main()
{
char i[100001]="0",c=0;
cin>>i;
for(int j=1;i[j]!='\0';i++) if(i[j]!=i[j-1]) c++;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:32: error: lvalue required as increment operand
7 | for(int j=1;i[j]!='\0';i++) if(i[j]!=i[j-1]) c++;
| ^
|
s491032493 | p03945 | C++ | #include<bits/stdc++.h>
string st;
int ans;
int main()
{
cin>>st;
for(int i=1;i<st.size();i++)
if(st[i]!=st[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
2 | string st;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin>>st;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:10: error: 'st' was not declared in this scope; did you mean 'std'?
6 | cin>>st;
| ^~
| std
|
s211801416 | p03945 | C++ | #include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
char ch[100001];
int ans;
int main()
{
gets(ch);
for(int i=1;i<strlen(ch);i++)
if(ch[i]!=ch[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(ch);
| ^~~~
| getw
|
s141616930 | p03945 | C++ | #include<bits/stdc++.h>
char ch[100001];
int ans;
int main()
{
gets(ch);
for(int i=1;i<strlen(ch);i++)
if(ch[i]!=ch[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(ch);
| ^~~~
| getw
|
s439548121 | p03945 | C++ | #include<bits/stdc++.h>
char ch[100001];
int ans;
int main()
{
gets(ch):
for(int i=1;i<strlen(ch);i++)
if(ch[i]!=ch[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(ch):
| ^~~~
| getw
a.cc:7:17: error: 'i' was not declared in this scope
7 | for(int i=1;i<strlen(ch);i++)
| ^
|
s887618848 | p03945 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
char S[100000] = {};
cin >> S;
int S_len = 0;;
for (S_len = 0; S_len < 100000; S_len++)
{
if (S[S_len] == NULL)
{
break;
}
}
int now_index = 0;
int count = 0;
for (int i = 1; i < S_len; i++)
{
if (strcmp(&S[now_index], &S[i]) != 0)
{
for (int j = now_index+1; j <= i; j++)
{
S[j + 1] = S[now_index];
}
now_index = i;
count++;
}
}
cout << count;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:33: warning: NULL used in arithmetic [-Wpointer-arith]
15 | if (S[S_len] == NULL)
| ^~~~
a.cc:26:21: error: 'strcmp' was not declared in this scope
26 | if (strcmp(&S[now_index], &S[i]) != 0)
| ^~~~~~
a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s690054203 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int ans=0;
for(int i=0; i<s.length()-1; i++) {
if(s[i]!=s[i+1]) {
ans++;
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:13:2: error: expected '}' at end of input
13 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.