submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s038973671
p03965
C++
use std::io::stdin; fn main() { let mut st = String::new(); stdin().read_line(&mut st).unwrap(); let s:Vec<char> = st.trim().chars().collect(); let p:usize = s.iter().filter(|x| x==&&'p').count(); let n = s.len(); println!("{}", n/2 - p); }
a.cc:1:1: error: 'use' does not name a type 1 | use std::io::stdin; | ^~~ a.cc:2:1: error: 'fn' does not name a type 2 | fn main() { | ^~
s796420679
p03965
C++
#include<cstdio> #include<cstring> using namespace std; char c[100007]; int main(){ scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'min' was not declared in this scope; did you mean 'main'? 8 | printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); | ^~~ | main
s188906370
p03965
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const long long INF= 1e+18+1; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000000007LL; string abc="abcdefghijklmnopqrstuvwxyz"; string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main(){ ll score=0; string s;cin>>s; rep(i,n){ if(i%2==0){ if(s[i]=='p')score--; } else { if(s[i]=='g')score++; } } cout<<score<<endl; }
a.cc: In function 'int main()': a.cc:18:9: error: 'n' was not declared in this scope 18 | rep(i,n){ | ^ a.cc:5:43: note: in definition of macro 'rep' 5 | #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) | ^
s947339138
p03965
C++
#include <iostream> #include <string> using namespace std; int main(){ string a; cin>>a; int len=a.size(); int i; int x=0,y=0,ans=0; for(i=0;i<len;i++) if(x==y)x++;if (a[i]=='p') ans--;} else{y++;if (a[i]=='g') ans++;} cout<<ans<<endl; return 0; }
a.cc:12:9: error: expected unqualified-id before 'else' 12 | else{y++;if (a[i]=='g') ans++;} | ^~~~ a.cc:13:5: error: 'cout' does not name a type 13 | cout<<ans<<endl; | ^~~~ a.cc:14:5: error: expected unqualified-id before 'return' 14 | return 0; | ^~~~~~ a.cc:15:1: error: expected declaration before '}' token 15 | } | ^
s050644161
p03965
C++
#include<cstdio> #include<cstring> using namespace std; char c[100007]; int main(){ scanf("%s",c);int l=strlen(c),g=0;for(int i=0;i<l;++i)if(c[i]=='g')g++;printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0; }
a.cc: In function 'int main()': a.cc:6:90: error: 'min' was not declared in this scope; did you mean 'main'? 6 | scanf("%s",c);int l=strlen(c),g=0;for(int i=0;i<l;++i)if(c[i]=='g')g++;printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0; | ^~~ | main
s029320103
p03965
Java
import java.util.Scanner; import jdk.management.cmm.SystemResourcePressureMXBean; public class Main { public static void main(String[] args) { Scanner input=new Scanner( System.in); String string=input.next(); int len=string.length(); int ans=0; for(int i=0;i<len;i++) { if(i%2==0) { if(string.charAt(i)=='p') ans--; } else { if(string.charAt(i)=='g') ans++; } } System.out.println(ans); } }
Main.java:4: error: package jdk.management.cmm does not exist import jdk.management.cmm.SystemResourcePressureMXBean; ^ 1 error
s583204622
p03965
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<vector> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define sc(x) scanf("%d",&x); int main(){ string s; cin >> s; int ans = 0; int cnt = 0; for (int i = 0; i < s.size(); i++){ if (s[i] == 'g'){ cnt += 1; g += 1; }else{ if (cnt > 0) cnt -= 1; else ans -= 1; } } ans += cnt / 2; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:13: error: 'g' was not declared in this scope 19 | g += 1; | ^
s668150362
p03965
C++
#include<bits/stdc++.h> using namespace std; int main(){ string a; cin >> a; int len = strlen(a); int i; int x = 0,y = 0,ans = 0; for(i = 0;i < len;i++){ if (x == y){ x++; if(a[i] == 'p') ans--; } else{ y++; if (a[i] == 'g') ans++; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:22: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 6 | int len = strlen(a); | ^ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)' 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~
s951525476
p03965
C++
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <cstdio> #include <cmath> #include <tuple> #include <iomanip> #include <numeric> #include <unordered_map> #include <sstream> #include<limits.h> #include<list> #include <array> #include <complex> using namespace std; #define i64 long long #define int long long #define I32_MAX 2147483647 #define I64_MAX 9223372036854775807 #define INF I64_MAX #define MOD 1000000007 #define MEM_SIZE = 1e5+5; template<typename T> void DEBUG(T e){std::cout << e << std::endl;} template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;} template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;} template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } } template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}} //-----CODE------// void solve(void) { int N; int G = 0, P = 0; for (int i = 0; i < N; i++) { char c; cin>>c; if(c== 'g')G++; else P++; } cout<<(G-P)>>1<<endl; return; } int32_t main(int32_t argc, const char *argv[]) { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout << std::fixed; std::cout << std::setprecision(9); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:55:14: error: no match for 'operator>>' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'int') 55 | cout<<(G-P)>>1<<endl; | ~~~~~~~~~~~^~~ | | | | | int | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} a.cc:55:14: note: candidate: 'operator>>(int, int)' (built-in) 55 | cout<<(G-P)>>1<<endl; | ~~~~~~~~~~~^~~ a.cc:55:14: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' 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/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:55:7: note: cannot convert 'std::cout.std::basic_ostream<char>::operator<<((G - P))' (type 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 55 | cout<<(G-P)>>1<<endl; | ~~~~^~~~~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]': a.cc:55:16: required from here 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ In file included from a.cc:14: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)' 177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setprecision)' 207 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:207:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 55 | cout<<(G-P)>>1<<endl; | ^ /usr/include/c++/14/iomanip:237:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setw)' 237 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:237:5: note: template argument deduction/substitution failed: a.cc:55:16: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::b
s465913092
p03965
C++
V#include <bits/stdc++.h> #define MOD 1000000007 using namespace std; int main() { string s; cin >> s; int count = 0; for(int i = 0;i < s.size();i++) { if(s[i] == 'g') { count++; } } if(s.size() % 2 == 1) { cout << count - s.size() / 2 - 1; } else { cout << count - s.size() / 2; } return 0; }
a.cc:1:2: error: stray '#' in program 1 | V#include <bits/stdc++.h> | ^ a.cc:1:1: error: 'V' does not name a type 1 | V#include <bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:6:5: error: 'string' was not declared in this scope 6 | string s; | ^~~~~~ a.cc:7:5: error: 'cin' was not declared in this scope 7 | cin >> s; | ^~~ a.cc:7:12: error: 's' was not declared in this scope 7 | cin >> s; | ^ a.cc:18:5: error: 'cout' was not declared in this scope; did you mean 'count'? 18 | cout << count - s.size() / 2 - 1; | ^~~~ | count a.cc:22:5: error: 'cout' was not declared in this scope; did you mean 'count'? 22 | cout << count - s.size() / 2; | ^~~~ | count
s539868045
p03965
C++
#include <bits/stdc++.h> #define MOD 1000000007 using namespace std; int main() { string s; cin >> s; int count = 0; for(int i = 0;i < s.size();i++) { if(s[i] == 'g') { count++; } } if(s.size() % 2 == 1) { cout << count - s.size() / 2 - 1; } else { cout << count \ s.size() / 2; } return 0; }
a.cc:22:19: error: stray '\' in program 22 | cout << count \ s.size() / 2; | ^ a.cc: In function 'int main()': a.cc:22:18: error: expected ';' before 's' 22 | cout << count \ s.size() / 2; | ^ ~ | ;
s638769528
p03965
Java
import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String S = sc.next(); int G = 0,P = 0; for( int i=0; i<S.length(); i++ ){ S.charAt(i)=='g' ? G++ : P++; } System.out.println((G-P)/2); } }
Main.java:10: error: not a statement S.charAt(i)=='g' ? G++ : P++; ^ 1 error
s008035050
p03965
C++
#include<cstdio> #include<cstring> using namespace std;char c[100007];int main(){scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;}
a.cc: In function 'int main()': a.cc:3:138: error: 'min' was not declared in this scope; did you mean 'main'? 3 | using namespace std;char c[100007];int main(){scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;} | ^~~ | main
s929496532
p03965
C++
#include<cstdio> #include<cstring> using namespace std;char c[100007];int main(){scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;}
a.cc: In function 'int main()': a.cc:3:138: error: 'min' was not declared in this scope; did you mean 'main'? 3 | using namespace std;char c[100007];int main(){scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;} | ^~~ | main
s365869823
p03965
C++
s = input() g = 0 p = 0 ans = 0 for i in s: if i == "g": if p < g: ans += 1 p += 1 else: g += 1 else: if p < g: p += 1 else: g += 1 ans -= 1 print (ans)
a.cc:2:1: error: 's' does not name a type 2 | s = input() | ^
s348412969
p03965
C++
#include <bits/sstdc++.h> using namespace std; int main(){ string s; cin >> s; int ans = 0; for(int i=0;i<s.size();++i){ if(i%2 == 0 && s[i] == 'p') --ans; if(i%2 == 1 && s[i] == 'g') ++ans; } cout << ans << endl; return 0; }
a.cc:1:10: fatal error: bits/sstdc++.h: No such file or directory 1 | #include <bits/sstdc++.h> | ^~~~~~~~~~~~~~~~ compilation terminated.
s651769785
p03965
C++
S = input().strip() p, g = "pg" score = sum(1 if c==g else 0 for c in S) G, P = 0, 0 hands = [] lastp = None for c in S: if P == G: if c == g: hand = g score -= 1 else: hand = p hands[lastp] = g # c == p # 過去のP vs G を G vs G : +1 -> 0 = -1 # 過去のP vs P を G vs P : 0 -> -1 = -1 score -= 1 P-=1 G+=1 else: hand = p if hand == g: G += 1 else: P += 1 lastp = len(hands) hands.append(hand) #print(score, hand, "vs", c, P, G) #print(S) #print("".join(hands)) print(score)
a.cc:17:15: error: invalid preprocessing directive #c 17 | # c == p | ^ a.cc:18:15: error: invalid preprocessing directive #\U0000904e\U000053bb\U0000306eP 18 | # 過去のP vs G を G vs G : +1 -> 0 = -1 | ^~~~~~~ a.cc:19:15: error: invalid preprocessing directive #\U0000904e\U000053bb\U0000306eP 19 | # 過去のP vs P を G vs P : 0 -> -1 = -1 | ^~~~~~~ a.cc:31:6: error: invalid preprocessing directive #print 31 | #print(score, hand, "vs", c, P, G) | ^~~~~ a.cc:32:2: error: invalid preprocessing directive #print 32 | #print(S) | ^~~~~ a.cc:33:2: error: invalid preprocessing directive #print 33 | #print("".join(hands)) | ^~~~~ a.cc:1:1: error: 'S' does not name a type 1 | S = input().strip() | ^
s608617275
p03965
C++
#include <iostream> #include <cstring> using namespace std; char s[1000101]; int n,x,y,ans; int main(){ cin>>s; n=strlen(s); for(int i=0;i<n;i++){ if(s[i]=='p'){ if(x>y){ y++; }else{ x++; ans-—; } }else{ if(x>y){ y++; ans++; }else{ x++; } } } cout<<ans; }
a.cc:15:21: error: extended character — is not valid in an identifier 15 | ans-—; | ^ a.cc: In function 'int main()': a.cc:15:21: error: '\U00002014' was not declared in this scope 15 | ans-—; | ^
s390248978
p03965
C++
#include<bits/stdc++.h> using namespace std; string s;int x,y,ans; int main(){ cin>>s; for(register int i=0;i<s.size();i++){ if(x==y){x++;if(a[i]=='p') ans--;} else{y++;if(a[i]=='g') ans++;} } printf("%d",ans); return 0; }
a.cc: In function 'int main()': a.cc:6:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 6 | for(register int i=0;i<s.size();i++){ | ^ a.cc:7:25: error: 'a' was not declared in this scope 7 | if(x==y){x++;if(a[i]=='p') ans--;} | ^ a.cc:8:21: error: 'a' was not declared in this scope 8 | else{y++;if(a[i]=='g') ans++;} | ^
s319723958
p03965
C++
// luogu-judger-enable-o2 #include<bits/stdc++.h> using namespace std; string s;int x,y,ans; int main(){ cin>>s; for(register int i=0;i<s.size();i++){ if(x==y){x++;if(a[i]=='p') ans--;} else{y++;if(a[i]=='g') ans++;} } printf("%d",ans); return 0; }
a.cc: In function 'int main()': a.cc:7:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 7 | for(register int i=0;i<s.size();i++){ | ^ a.cc:8:25: error: 'a' was not declared in this scope 8 | if(x==y){x++;if(a[i]=='p') ans--;} | ^ a.cc:9:21: error: 'a' was not declared in this scope 9 | else{y++;if(a[i]=='g') ans++;} | ^
s863612163
p03965
C++
#include<cstdio> #include<cstring> using namespace std; char c[100007]; int main(){ scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'min' was not declared in this scope; did you mean 'main'? 8 | printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); | ^~~ | main
s975757510
p03965
C++
a#include <bits/stdc++.h> using namespace std; #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i) #define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i) #define per(i,N) for(int i=(N)-1;i>=0;--i) #define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i) #define all(arr) (arr).begin(), (arr).end() #define SP << " " << #define SPF << " " #define SPEEDUP cin.tie(0);ios::sync_with_stdio(false); #define MAX_I INT_MAX //1e9 #define MIN_I INT_MIN //-1e9 #define MAX_UI UINT_MAX //1e9 #define MAX_LL LLONG_MAX //1e18 #define MIN_LL LLONG_MIN //-1e18 #define MAX_ULL ULLONG_MAX //1e19 typedef long long ll; typedef pair<int,int> PII; typedef pair<char,char> PCC; typedef pair<ll,ll> PLL; typedef pair<char,int> PCI; typedef pair<int,char> PIC; typedef pair<ll,int> PLI; typedef pair<int,ll> PIL; typedef pair<ll,char> PLC; typedef pair<char,ll> PCL; inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;} inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;} inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;} int main(void){ SPEEDUP cout << setprecision(15); string s;cin >> s; int count = 0; rep(i,s.length()){ if(s[i] == 'p') ++count; } cout << s.length()/2 - count << endl; return 0; }
a.cc:1:2: error: stray '#' in program 1 | a#include <bits/stdc++.h> | ^ a.cc:1:1: error: 'a' does not name a type 1 | a#include <bits/stdc++.h> | ^ a.cc:18:11: error: 'pair' does not name a type 18 | typedef pair<int,int> PII; | ^~~~ a.cc:19:11: error: 'pair' does not name a type 19 | typedef pair<char,char> PCC; | ^~~~ a.cc:20:11: error: 'pair' does not name a type 20 | typedef pair<ll,ll> PLL; | ^~~~ a.cc:21:11: error: 'pair' does not name a type 21 | typedef pair<char,int> PCI; | ^~~~ a.cc:22:11: error: 'pair' does not name a type 22 | typedef pair<int,char> PIC; | ^~~~ a.cc:23:11: error: 'pair' does not name a type 23 | typedef pair<ll,int> PLI; | ^~~~ a.cc:24:11: error: 'pair' does not name a type 24 | typedef pair<int,ll> PIL; | ^~~~ a.cc:25:11: error: 'pair' does not name a type 25 | typedef pair<ll,char> PLC; | ^~~~ a.cc:26:11: error: 'pair' does not name a type 26 | typedef pair<char,ll> PCL; | ^~~~ a.cc: In function 'void YesNo(bool)': a.cc:28:28: error: 'cout' was not declared in this scope 28 | inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;} | ^~~~ a.cc:28:56: error: 'endl' was not declared in this scope 28 | inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;} | ^~~~ a.cc: In function 'void YESNO(bool)': a.cc:29:28: error: 'cout' was not declared in this scope 29 | inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;} | ^~~~ a.cc:29:56: error: 'endl' was not declared in this scope 29 | inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;} | ^~~~ a.cc: In function 'void Yay(bool)': a.cc:30:26: error: 'cout' was not declared in this scope 30 | inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;} | ^~~~ a.cc:30:55: error: 'endl' was not declared in this scope 30 | inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;} | ^~~~ a.cc: In function 'int main()': a.cc:10:17: error: 'cin' was not declared in this scope 10 | #define SPEEDUP cin.tie(0);ios::sync_with_stdio(false); | ^~~ a.cc:33:3: note: in expansion of macro 'SPEEDUP' 33 | SPEEDUP | ^~~~~~~ a.cc:10:28: error: 'ios' has not been declared 10 | #define SPEEDUP cin.tie(0);ios::sync_with_stdio(false); | ^~~ a.cc:33:3: note: in expansion of macro 'SPEEDUP' 33 | SPEEDUP | ^~~~~~~ a.cc:34:3: error: 'cout' was not declared in this scope 34 | cout << setprecision(15); | ^~~~ a.cc:34:11: error: 'setprecision' was not declared in this scope 34 | cout << setprecision(15); | ^~~~~~~~~~~~ a.cc:35:3: error: 'string' was not declared in this scope 35 | string s;cin >> s; | ^~~~~~ a.cc:35:19: error: 's' was not declared in this scope 35 | string s;cin >> s; | ^ a.cc:40:35: error: 'endl' was not declared in this scope 40 | cout << s.length()/2 - count << endl; | ^~~~
s075887648
p03965
C++
#include<cstdio> #include<cstring> using namespace std; char c[100007]; int main(){ scanf("%s",c);int l=strlen(c),g=0; for(int i=0;i<l;++i)if(c[i]=='g')g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'min' was not declared in this scope; did you mean 'main'? 8 | printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); | ^~~ | main
s032022250
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[100007]; int main() { scanf("%s",a); int l=strlen(a),x=0,i; for(i=0;i<l;i++) if(a[i]=='g') x++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); return 0; }
a.cc: In function 'int main()': a.cc:11:25: error: 'g' was not declared in this scope 11 | printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); | ^
s984401613
p03965
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; int ans=0,x=0,y=0; cin>>s; for(int i=0; i<s.size(); i++) { x==y?x++,s[i]=='p'?ans--:ans=ans:y++,s[i]=='g'?ans++:ans=ans; } cout<<asn<<endl; }
a.cc: In function 'int main()': a.cc:10:15: error: 'asn' was not declared in this scope; did you mean 'ans'? 10 | cout<<asn<<endl; | ^~~ | ans
s116227847
p03965
C++
//恶意评分++ #include<cstdio> #include<cstring> #define mian int main() char c[100007]; mian{ scanf("%s",c); int l=strlen(c),g=0; for(int i=0;i<l;++i) if(c[i]=='g') g++; printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); return 0; }
a.cc: In function 'int main()': a.cc:14:19: error: 'min' was not declared in this scope; did you mean 'main'? 14 | printf("%d\n",min(l/2,g)-min(l-l/2,l-g)); | ^~~ | main
s024491519
p03965
C++
#include<iostream> #include<string> using namespace std; int a1,a; int main(){ string s1,s2; cin>>s1; for(int i=0;i<s1.size();i++) { if(s[i]=='p') a1++; } a=s1.size()/2; cout<<a-a1; }
a.cc: In function 'int main()': a.cc:10:22: error: 's' was not declared in this scope 10 | if(s[i]=='p') a1++; | ^
s064507410
p03965
C++
#include <bits/stdc++.h> using namespace std; #define N 10001 char a[N]; int main() { gets(a); int l=strlen(a); int t1=0,t2=0,score=0; for(int i=0;i<l;i++) if(t1==t2) { t1++; if(a[i]=='p') score--; }else { t2++; if(a[i]=='g') score++; } printf("%d\n",score); 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
s635854117
p03965
C++
#include<bits/stdc++.h> using namespace std; bool b[26]={1,0,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1}; int main() { bool o=0,ok=0; string s; cin>>s; for(int i=0;i<s.size();i++) if(b[s[i]-'A']==1)ok1=1; else ok=1; if(o+ok==1)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:24: error: 'ok1' was not declared in this scope; did you mean 'ok'? 10 | if(b[s[i]-'A']==1)ok1=1; | ^~~ | ok
s572540320
p03965
C++
#include<bits/stdc++.h> string s; int main(){ cin>>s; cout<<s.size()/2-count(s.begin(),s.end(),'p')<<endl; }
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:4:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 4 | 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:4:8: error: 's' was not declared in this scope 4 | cin>>s; | ^ a.cc:5:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 5 | cout<<s.size()/2-count(s.begin(),s.end(),'p')<<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:5:20: error: 'count' was not declared in this scope; did you mean 'std::count'? 5 | cout<<s.size()/2-count(s.begin(),s.end(),'p')<<endl; | ^~~~~ | 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:5:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 5 | cout<<s.size()/2-count(s.begin(),s.end(),'p')<<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) | ^~~~
s450935125
p03965
C++
#include <algorithm> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <utility> #include <vector> using std::cerr; using std::cin; using std::cout; using std::endl; void OutputError(std::string s) { cerr << "\033[93m" << s << "\033[m" << endl; return; } int main(void) { cout << std::fixed << std::setprecision(10); cin.tie(0); std::ios::sync_with_stdio(false); std::string s; cin >> s; int g = 0, p = 0; std::string result; for (int i = 0; i < s.size; i++) { if (i % 2 == 0) { result.push_back('g'); } else { result.push_back('p'); } } cout << result << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:25: 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 '()' ?) 29 | for (int i = 0; i < s.size; i++) { | ~~^~~~ | ()
s438271921
p03965
C++
#include<bits/stdc++.h> using namespace std; string s; int x,y,ans; int main(){ cin>>s; for(int i=0;i<s.size();i++) if (x==y){ x++; if(a[i]=='p') ans--;} else{ y++; if(a[i]=='g') ans++;} cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:28: error: 'a' was not declared in this scope 8 | if (x==y){ x++; if(a[i]=='p') ans--;} | ^ a.cc:9:23: error: 'a' was not declared in this scope 9 | else{ y++; if(a[i]=='g') ans++;} | ^
s906769717
p03965
C++
string s; cin >> s; lnt ans = 0; FOR(i, 0, (s.size() + 1) / 2) { if (s.at(i) == 'p') { ans--; } } FOR(i, (s.size() + 1) / 2, s.size()) { if (s.at(i) == 'g') { ans++; } } printf("%lld\n", ans);
a.cc:2:3: error: 'string' does not name a type 2 | string s; | ^~~~~~ a.cc:3:3: error: 'cin' does not name a type 3 | cin >> s; | ^~~ a.cc:5:3: error: 'lnt' does not name a type; did you mean 'int'? 5 | lnt ans = 0; | ^~~ | int a.cc:6:6: error: expected constructor, destructor, or type conversion before '(' token 6 | FOR(i, 0, (s.size() + 1) / 2) { | ^ a.cc:11:6: error: expected constructor, destructor, or type conversion before '(' token 11 | FOR(i, (s.size() + 1) / 2, s.size()) { | ^ a.cc:16:9: error: expected constructor, destructor, or type conversion before '(' token 16 | printf("%lld\n", ans); | ^
s945482605
p03965
Java
/* * Author. Silviase(@silviasetitech) * For AtCoder */ import java.util.*; import java.lang.*; import java.math.*; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.nextInt(); int ans = 0; for (int i = 0; i < n; i++) { if (i % 2 == 0) { if (s.charAt(i) == 'p') { ans--; } } else { if (s.charAt(i) == 'g') { ans++; } } } System.out.println(ans); sc.close(); } private static long gcd(Long m, long n) { if(m < n) { return gcd(n, m); } if(n == 0){ return m; } return gcd(n, m % n); } private static long[][] Combination_nCk(long n, long k) { n++; k++; long[][] ans = new long[(int)n][(int)k]; for (int i = 0; i < n; i++) { ans[i][0] = 1; } for (int i = 0; i < n-1; i++) { for (int j = 0; j < k-1; j++) { if (i < j) { ans[i][j] = 0; }else{ ans[i+1][j+1] = ans[i][j] + ans[i][j+1]; } } } return ans; } private static double[][] Probability_nCk(int n, int k) { n++; k++; double[][] ans = new double[n][k]; for (int i = 0; i < n; i++) { if (i == 0) { ans[i][0] = 1; }else{ ans[i][0] = ans[i-1][0]/2; } } for (int i = 0; i < n-1; i++) { for (int j = 0; j < k-1; j++) { if (i < j) { ans[i][j] = 0; }else{ ans[i+1][j+1] = (ans[i][j] + ans[i][j+1])/2; } } } return ans; } }
Main.java:18: error: incompatible types: int cannot be converted to String String s = sc.nextInt(); ^ 1 error
s076822917
p03965
C++
#include <bits/stdc++.h> #define ll long long int main() { string s; cin>>s; int ans=0; int k=0;// for(int i=0;i<s.length();i++){ if(s[i]=='g'){ if(k>0){ ans++; k--; }else{ k++; } } else{ if(p>0){ k--; }else{ k++; ans--; } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:5: error: 'string' was not declared in this scope 5 | string s; | ^~~~~~ a.cc:5: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>>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:6:10: error: 's' was not declared in this scope 6 | cin>>s; | ^ a.cc:19:16: error: 'p' was not declared in this scope 19 | if(p>0){ | ^ a.cc:28:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 28 | 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:28:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 28 | 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) | ^~~~
s459010595
p03965
C++
clude <iostream> #include <string> using namespace std; #define REP(i, n) for(int i=0; i<(n); i++) #define SZ(x) ((int)(x).size()) int main() { string s; cin >> s; int n = SZ(s), p = 0; REP(i, n)if (s[i] == 'p')p++; cout << n / 2 - p << endl; }
a.cc:1:1: error: 'clude' does not name a type 1 | clude <iostream> | ^~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type 198 | _GLIBCXX14_CONSTEXPR std::size_t |
s010319481
p03965
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s;cin>>s; int sumg=0,sump=0; for(int i=0;i<n;i++){ if(s[i]=='g')sumg++; else sump++; } cout<<sumg-sump<<endl; }
a.cc: In function 'int main()': a.cc:6:17: error: 'n' was not declared in this scope 6 | for(int i=0;i<n;i++){ | ^
s714583102
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[100005]; int x=0,y=0,ans=0; int main() { scanf("%s",a); int mm=srelen(a); for (int i=0;i<=mm;i++) if (x==y) { x++; if(a[i]=='p') ans--; } else { y++; if(a[i]=='g') ans++; } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:10:12: error: 'srelen' was not declared in this scope; did you mean 'strnlen'? 10 | int mm=srelen(a); | ^~~~~~ | strnlen
s741973560
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[100005]; int x=0,y=0,ans=0; int main() { scanf("%s",a+1) int mm=srelen(a); for (int i=1;i<mm;i++) if (x==y) { x++; if(a[i]=='p') ans--; } else { y++; if(a[i]=='g') ans++; } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:9:20: error: expected ';' before 'int' 9 | scanf("%s",a+1) | ^ | ; 10 | int mm=srelen(a); | ~~~ a.cc:11:20: error: 'mm' was not declared in this scope; did you mean 'tm'? 11 | for (int i=1;i<mm;i++) | ^~ | tm
s965831845
p03965
C++
#include<iostream> #include<cstring> #include<cstdio> using namespace std; char s[1000000]; int a[1000000]={1,0},n,b[1000000]; int main() { gets(s); int lens=strlen(s); for(int i=0;i<=lens-1;i++) { if(s[i]=='g') b[i]=0; else b[i]=1; } for(int i=2;i<=lens;i++) { if(i%2==0) a[i]=0; else a[i]=1; } for(int i=0;i<=lens-1;i++) { if(a[i]<b[i]) n=n-1; if(a[i]>b[i]) n=n+1; } cout<<n; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets(s); | ^~~~ | getw
s783981429
p03965
C++
include <iostream> #include <vector> #include <string> #include <cmath> #include <set> #include <algorithm> #include <array> #include <complex> #include <string> #include <utility> #include <map> #include <queue> #include <list> int dx[4] = { -1,0,1,0 }; int dy[4] = { 0,1,0,-1 }; const int INF = 1 << 21; using pii = std::pair<int, int>; #define SORT(v) std::sort(v.begin(), v.end()) int F[100][15]; int main(void) { int N, g=0,p=0,win=0,drow=0,lose=0; std::string s; std::cin >> s; for (size_t i = 0; i < s.size(); i++) { if (p == g && s[i] == 'g') { drow++; g++; } else if (p < g && s[i] == 'g') { win++; p++; } else if (p == g && s[i] == 'p') { lose++; g++; } else if (p < g && s[i] == 'p') { drow++; p++; } } std::cout << win - lose << std::endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s517936262
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[100005]; int x=0,y=0,ans=0; int main() { cin>>a; for (int i=0;i<sizeof(a);i++) if (x==y) { x++; if(a[i]=='p') ans--; } else { y++; if(a[i]=='g') ans++; } printf("%d\n",ans); return 0; } }
a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s376669818
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[10005]; int len,i,j,score=0,rock=0,paper=0,a[10005]; int main() {gets(s); len=strlen(s); for(i=0;i<len;i++) if(s[i]=='g') a[i+1]=0;//0->rock else if(s[i]=='p') a[i+1]=1;//1->paper /*for(i=1;i<=len;i++) cout<<a[i]<<' '; cout<<endl;*/ rock++; if(a[1]==1) score--; for(i=2;i<=len;i++) if(a[i]==0) { if(paper<rock) {paper++; score++;} else {rock++; }} else { if(paper<rock) {paper++;} else{rock++; score--;} } cout<<score; return 0; }
a.cc: In function 'int main()': a.cc:6:2: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | {gets(s); | ^~~~ | getw
s312712965
p03965
C++
#include<stdio.h> char s[10001]; int main() { scanf("%s",s); int ans=0,x=0,y=0; for(int i=0;i<strlen(s);i++) { if(x==y) { x++; if(s[i]=='p') ans--; } else { y++; if(s[i]=='g') ans++; } } printf("%d",ans); }
a.cc: In function 'int main()': a.cc:7:19: error: 'strlen' was not declared in this scope 7 | for(int i=0;i<strlen(s);i++) | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<stdio.h> +++ |+#include <cstring> 2 | char s[10001];
s624698506
p03965
C++
#include<bits/stdc++.h> long long int q[24][24],j[24][24]; long long int n,m,x,y; bool jc(int a,int b) { if((a==x-1&&(b==y-2||b==y+2))||(a==x+1&&(b==y-2||b==y+2))) return 1; else return 0; } void dt(int a,int b) { if(jc(a,b)) { int h=(a+1)/n; a=(a+1)%n
a.cc: In function 'void dt(int, int)': a.cc:16:22: error: expected ';' at end of input 16 | a=(a+1)%n | ^ | ; a.cc:16:22: error: expected '}' at end of input a.cc:14:11: note: to match this '{' 14 | { | ^ a.cc:16:22: error: expected '}' at end of input 16 | a=(a+1)%n | ^ a.cc:12:1: note: to match this '{' 12 | { | ^
s545711163
p03965
C++
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char a[100001]; int main(){ int s=0,sn=0,x; //for(int i=1;i<=strlen(a);i++) gets(a); for(int i=0;i<strlen(a);i++) {if(a[i]=='p') s++; if(a[i]=='g') sn++; } x=(sn-s)/2; cout<<x; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets(a); | ^~~~ | getw
s540655491
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[100001]; int main(){ int s=0,sn=0,x; //for(int i=1;i<=strlen(a);i++) gets(a); for(int i=0;i<strlen(a);i++) {if(a[i]=='p') s++; if(a[i]=='g') sn++; } x=(sn-s)/2; cout<<x; 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
s807214256
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[106]; int main(){ int s=0,sn=0,x; //for(int i=1;i<=strlen(a);i++) gets(a); for(int i=0;i<strlen(a);i++) {if(a[i]=='p') s++; if(a[i]=='g') sn++; } x=(sn-s)/2; cout<<x; 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
s747051361
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[106]; int main(){ int s=0,sn=0,x; //for(int i=1;i<=strlen(a);i++) gets(a); for(int i=0;i<strlen(a);i++) {if(a[i]=='p') s++; if(a[i]=='g') sn++; } x=(sn-s)/2; cout<<x; 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
s265105135
p03965
C++
#include<bits/stdc++.h> using namespace std; char a[106]; int main(){ int s=0,sn=0,x; gets(a); for(int i=0;i<strlen(a);i++) {if(a[i]=='p') s++; if(a[i]=='g') sn++; } x=(sn-s)/2; cout<<x; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(a); | ^~~~ | getw
s852249300
p03965
C++
#include<bits/stdc++.h> using namespace std; string s; int x=0,y=0,ans=0; int main() { cin>>s; for (int i=0;i<s.size();i++) if (x==y){x++; if(a[i]=='p') ans--;} else{y++; if(a[i]=='g') ans++;} printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:9:24: error: 'a' was not declared in this scope 9 | if (x==y){x++; if(a[i]=='p') ans--;} | ^ a.cc:10:19: error: 'a' was not declared in this scope 10 | else{y++; if(a[i]=='g') ans++;} | ^
s139559759
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[100005]; int len,i,score=0,p=0; //g->rock p->paper p=rock-paper>=0 int main() {gets(s); len=strlen(s); for(i=0;i<len;i++) if(s[i]=='g') {if(p<1) p++; else {p--; score++;} } else{ if(p<1) {p++; score--;} else p--; } cout<<score; return 0; }
a.cc: In function 'int main()': a.cc:7:2: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | {gets(s); | ^~~~ | getw
s889258413
p03965
C
#include<iostream> #include<cstdio> #include<string> #include<cstring> using namespace std; char s[100010]; int main() { int len=0; int p=0,g=0; while(cin>>s[++len]) { if(s[len]=='p') p++; if(s[len]=='g') g++; } int num=len/2; if(p<g) cout<<num-p; if(p==g) cout<<0; if(p>g) cout<<num-p; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s620492661
p03965
C++
#include<iostream> #include<cstring> using namespace std; char s[100001]; int main() { gets(s); int sum=0,len=strlen(s),ans=0; int k=len/2;//布最多能出的次数 for(int i=0;i<=len-1;i++) if(s[i]=='p'||s[i]=='P') ans++; cout<<k-ans; return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(s); | ^~~~ | getw
s664336420
p03965
C++
#include<iostream> #include<cstring> using namespace std; char s[1000000]; int a[1000000]={1,0},n,b[1000000]; int main() { gets(s); int lens=strlen(s); for(int i=0;i<=lens-1;i++) { if(s[i]=='g') b[i]=0; else b[i]=1; } for(int i=2;i<=lens;i++) { if(i%2==0) a[i]=0; else a[i]=1; } for(int i=0;i<=lens-1;i++) { if(a[i]<b[i]) n=n-1; if(a[i]>b[i]) n=n+1; } cout<<n; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(s); | ^~~~ | getw
s946615139
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[1000000]; int a[1000000]={1,0},n,b[1000000]; int main() { gets(s); int lens=strlen(s); for(int i=0;i<=lens-1;i++) { if(s[i]=='g') b[i]=0; else b[i]=1; } for(int i=2;i<=lens;i++) { if(i%2==0) a[i]=0; else a[i]=1; } for(int i=0;i<=lens-1;i++) { if(a[i]<b[i]) n=n-1; if(a[i]>b[i]) n=n+1; } cout<<n; return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(s); | ^~~~ | getw
s822325315
p03965
C++
#include<iostream> #include<cstring> using namespace std; char s[1000000]; int a[1000000]={0,1,0},n,b[1000000]; int main() { gets(s); int lens=strlen(s); for(int i=1;i<=lens;i++) { if(s[i]=='g') b[i]=0; else b[i]=1; } for(int i=3;i<=lens;i++) { if(i%2==0) a[i]=1; else a[i]=0; } for(int i=1;i<=lens;i++) { if(a[i]<b[i]) n=n-1; if(a[i]>b[i]) n=n+1; } cout<<n+1; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(s); | ^~~~ | getw
s138682855
p03965
C++
#include<bits/stdc++.h> using namespace std; int main() { char s[100005]; gets(s); int sum=0, lens=strlen(s), p=0, g=0; for(int i=0;i<lens;i++){ if(s[i]=='g'){ if(g>p){ sum++; p++; } else g++; } else{ if(g>p) p++; else{ sum--; g++; } } } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(s); | ^~~~ | getw
s681685670
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[100006]; int i,len; int main(){ scanf("%s",s); len=strlen(s); int g=0,p=0,sum=0; for(i=1;i<=len;i++) { if(s[i]=='g') { if(g>p) { sum++; p++; } else g++; } else(s[i]=='p') { if(g>p) p++; else { sum--; g++; } } } printf("%d\n",sum); return 0; }
a.cc: In function 'int main()': a.cc:21:32: error: expected ';' before '{' token 21 | else(s[i]=='p') | ^ | ; 22 | { | ~
s999524680
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[100006]; int g,p,i,sum,len; int main(){ scanf("%s",s); len=strlen(s); for(i=1;i<=len;i++) { if(s[i]=='g') { if(g>p) { sum++; p++; } else g++; } if(s[i]=='p') { if(g>p) p++; else { sum--; g++; } } } prinf("%d\n",sum); return 0; }
a.cc: In function 'int main()': a.cc:31:9: error: 'prinf' was not declared in this scope; did you mean 'printf'? 31 | prinf("%d\n",sum); | ^~~~~ | printf
s107659557
p03965
C++
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<map> #include<stack> #include<set> #include<deque> #include<vector> #include<queue> #include<string> #include<fstream> #include<algorithm> using namespace std; char s[100006]; int g,p,i,sum,len; int main(){ scanf("%s",s); len=strlen(s); for(i=1;i<=len;i++) { if(s[i]=='g') { if(g>p) { sum++; p++; } else g++; } if(s[i]=='p') { if(g>p) p++; else { sum--; g++; } } } prinf("%d\n",sum); return 0; }
a.cc: In function 'int main()': a.cc:43:9: error: 'prinf' was not declared in this scope; did you mean 'printf'? 43 | prinf("%d\n",sum); | ^~~~~ | printf
s164230812
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[10005]; int n,delta=0,ans=0; bool a[10005]; int main() { scanf("%s",s+1),n=strlen(s+1); for(int i=1;i<=n;++i)a[i]=(s[i]=='p'); for(int i=1;i<=n;++i){ if(delta<=0)++delta,ans-=col[i]; else --delta,ans+=(!col[i]); } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:11:42: error: 'col' was not declared in this scope; did you mean 'cosl'? 11 | if(delta<=0)++delta,ans-=col[i]; | ^~~ | cosl a.cc:12:37: error: 'col' was not declared in this scope; did you mean 'cosl'? 12 | else --delta,ans+=(!col[i]); | ^~~ | cosl
s279308315
p03965
C++
#include<bits/stdc++.h> using namespace std; const int maxn=1e5+10; char str[maxn]; int main() { while(scanf("%s",str)!=EOF) { int gg=0,pp=0,ans=0; int len=strlen(str); for(int i=0; i<len; i++) { if(str[i]=='g') { if(pp<gg)ans++,pp++; else gg++; } else { if(pp<gg)pp++; else gg++,ans--; } } printf("%d\n",ans); } } --------------------- 本文来自 kuronekonano 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/kuronekonano/article/details/80518857?utm_source=copy
a.cc:28:1: error: expected unqualified-id before '--' token 28 | --------------------- | ^~
s437187512
p03965
C++
#include<bits/stdc++.h> using namespace std; char topco[10010]; //short topco_paper[10010],topco_rock[10010]; //int t_p_head,t_p_tail,t_r_tail,t_r_head; int t_p_top,t_r_top;//topco的指针; int t_lenp,t_lenr;//,a_lenp,a_lenr; int main() { gets(topco); int lent=strlen(topco); for(int i=1;i<=lent;i++) { if(topco[i]=='p') t_lenp++; else t_lenr++; } if(t_lenp==t_lenr || t_lenp+1==t_lenr && lent%2!=0) { cout<<0<<endl; return 0; } //判断特殊情况; else { int atco_p_maxn=lent/2; cout<<atco_p_maxn-t_lenp<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 10 | gets(topco); | ^~~~ | getw
s114717154
p03965
C++
#include<iostream> #include<cstring> using namespace std; char topco[10010]; //short topco_paper[10010],topco_rock[10010]; //int t_p_head,t_p_tail,t_r_tail,t_r_head; int t_p_top,t_r_top;//topco的指针; int t_lenp,t_lenr;//,a_lenp,a_lenr; int main() { gets(topco); int lent=strlen(topco); for(int i=1;i<=lent;i++) { if(topco[i]=='p') t_lenp++; else t_lenr++; } if(t_lenp==t_lenr || t_lenp+1==t_lenr && lent%2!=0) { cout<<0<<endl; return 0; } //判断特殊情况; else { int atco_p_maxn=lent/2; cout<<atco_p_maxn-t_lenp<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 11 | gets(topco); | ^~~~ | getw
s483310367
p03965
C++
#include<bits/stdc++.h> char s[100002]; using namespace std; int main() { gets(s); int len=strlen(s),z=0; for(int i=0;i<len;i++) { if(s[i]=='p') z++; } cout<<len/2-z; }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(s); | ^~~~ | getw
s702872863
p03965
C++
#include<bits/stdc++.h> using namespace std; int f; char c[100010]; int main(){ gets(c); for(int i=0;i<strlen(c);i++) { if(c[i]=='p') if(i%2==0) f--; if(c[i]=='g') if(i%2==1) f++; } cout<<f; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(c); | ^~~~ | getw
s088814567
p03965
C++
#include<bits/stdc++.h> using namespace std; int f; char c[100010]; int main(){ gets(c); for(int i=0;i<strlen(c);i++) { if(c[i]=='p') if(i%2==0) f--; if(c[i]=='g') if(i%2==1) f++; } cout<<f; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(c); | ^~~~ | getw
s104068894
p03965
C++
#include<bits/stdc++.h> using namespace std; char s[100001]; int main() { scanf("%s",s+1); register int sum=0,l=strlen(s+1),p=0,g=0; for(register int i=1;i<=len;++i) if(s[i]=='g') if(g>p) ++sum,++p; else ++g; else if(g>p) ++p; else --sum,g++; return printf("%d",sum),0; }
a.cc: In function 'int main()': a.cc:7:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 7 | register int sum=0,l=strlen(s+1),p=0,g=0; | ^~~ a.cc:7:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 7 | register int sum=0,l=strlen(s+1),p=0,g=0; | ^ a.cc:7:42: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 7 | register int sum=0,l=strlen(s+1),p=0,g=0; | ^ a.cc:7:46: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 7 | register int sum=0,l=strlen(s+1),p=0,g=0; | ^ a.cc:8:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 8 | for(register int i=1;i<=len;++i) | ^ a.cc:8:33: error: 'len' was not declared in this scope 8 | for(register int i=1;i<=len;++i) | ^~~
s626851211
p03965
C++
#include<bits/stdc++.h> char a; int b[2]; int main(){ while((a=getchar())!=EOF) b[a=='g']++; cout << (b[1]-b[0])>>1; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 6 | cout << (b[1]-b[0])>>1; | ^~~~ | std::cout 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:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s317787246
p03965
C++
//贪心出招,尽可能出布。 #include<bits/stdc++.h> using namespace std; int main(){ int s=0,b=0,an=0; string s; getling(cin,s); for(int i=0;i<s.size();i++){ if(s[i]=='g'){ if(b<s) b++,an++; else s++; }else{ if(b<s) b++; else s++,an--; } } cout<<an<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: conflicting declaration 'std::string s' 6 | string s; | ^ a.cc:5:13: note: previous declaration as 'int s' 5 | int s=0,b=0,an=0; | ^ a.cc:7:9: error: 'getling' was not declared in this scope; did you mean 'getline'? 7 | getling(cin,s); | ^~~~~~~ | getline a.cc:8:25: error: request for member 'size' in 's', which is of non-class type 'int' 8 | for(int i=0;i<s.size();i++){ | ^~~~ a.cc:9:21: error: invalid types 'int[int]' for array subscript 9 | if(s[i]=='g'){ | ^
s823240183
p03965
C++
//贪心出招,尽可能出布。 #include<bits/stdc++.h> using namespace std; int main(){ int s=0,b=0,an=0; string s; getling(cin,s); for(int i=0;i<s.size();i++){ if(s[i]=='g'){ if(b<s) b++,an++; else s++; }else{ if(b<s) b++; else s++,ans--; } } cout<<an<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: conflicting declaration 'std::string s' 6 | string s; | ^ a.cc:5:13: note: previous declaration as 'int s' 5 | int s=0,b=0,an=0; | ^ a.cc:7:9: error: 'getling' was not declared in this scope; did you mean 'getline'? 7 | getling(cin,s); | ^~~~~~~ | getline a.cc:8:25: error: request for member 'size' in 's', which is of non-class type 'int' 8 | for(int i=0;i<s.size();i++){ | ^~~~ a.cc:9:21: error: invalid types 'int[int]' for array subscript 9 | if(s[i]=='g'){ | ^ a.cc:14:34: error: 'ans' was not declared in this scope; did you mean 'an'? 14 | else s++,ans--; | ^~~ | an
s267999292
p03965
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int g=0,p=0; int ans=0; for(int i=0;i<s.size();i++) { if(s[i]=='g') { if(p<g)p++,ans++; else p++; } else { if(p<g)p++; else g++,ans--; } } cout<<ans<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:18: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 22 | cout<<ans<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 22 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 22 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 22 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:22:19: note: couldn't deduce template parameter '_Bi_iter' 22 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 22 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:22:19: note: couldn't deduce template parameter '_Bi_iter' 22 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 22 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 22 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 22 | cout<<ans<endl; | ^~~~ /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:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 22 | cout<<ans<endl; | ^~~~ /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:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 22 | cout<<ans<endl; | ^~~~ /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:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 22 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:22:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 22 | cout<<ans<endl; | ^~~~ /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:22:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 22 | cout<<ans<endl; | ^~~~ /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:22:19: note: couldn't deduce template parameter '_CharT' 22 | cout<<ans<endl; | ^~~~ /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:22:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 22 | cout<<ans<endl; | ^~~~ /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: not
s721965423
p03965
C++
#include<bits/stdc++.h> using namespace std; int a[100000]; int main() { char t; while((t=getchar())!=EOF) { a[t]++; } cout<<(a['p']-a['g'])>>1; }
a.cc: In function 'int main()': a.cc:11:30: error: no match for 'operator>>' (operand types are 'std::basic_ostream<char>' and 'int') 11 | cout<<(a['p']-a['g'])>>1; | ~~~~~~~~~~~~~~~~~~~~~^~~ | | | | | int | std::basic_ostream<char> a.cc:11:30: note: candidate: 'operator>>(int, int)' (built-in) 11 | cout<<(a['p']-a['g'])>>1; | ~~~~~~~~~~~~~~~~~~~~~^~~ a.cc:11:30: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:11:13: note: cannot convert 'std::cout.std::basic_ostream<char>::operator<<((a[112] - a[103]))' (type 'std::basic_ostream<char>') to type 'std::byte' 11 | cout<<(a['p']-a['g'])>>1; | ~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)' 1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) | ^~~~~~~~ /usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]': a.cc:11:25: required from here 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)' 177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed: a.cc:11:32: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout<<(a['p']-a['g'])>>1; | ^ /usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Trait
s534036847
p03965
C++
#include <iostream> #include <cmath> #include <vector> #include <bitset> #include <algorithm> #include <stack> #include <queue> #include <map> #include <climits> #include <set> #include <map> #include <iomanip> #include <cassert> #include <functional> #include <cstring> using namespace std; typedef pair<int, int> P; #define mp make_pair #define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i)) #define rep(i, n) FOR(i,0,n) #define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--) #define vsort(v) sort((v).begin(), (v).end()); //小さい順 #define rvsort(v) sort(v.begin(), v.end(),greater<int>()); //大きい順 #define YES cout<<"YES"<< endl #define NO cout<<"NO"<<endl #define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl #define yes cout<<"yes"<<endl #define no cout<<"no"<<endl #define all(c) (c).begin(),(c).end() #define ll long long #define vi vector<int> #define vvi vector<vector<int>> #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vvb vector<vector<bool>> #define vs vector<string> #define vc vector<char> #define vvc vector<vector<char>> #define Print(p) cout<<(p)<<endl #define F first #define S second #define pb1 push_back #define mod 1000000007LL #define INF 1234567890 const int maxn = 2e5 + 10; //initialization here // ll dp[55][55][3000]; //i番目までのカードからj枚使って総和をkにできる総数 // //initialization finish // your function is here // // // your function finished int main() { cin.tie(0); ios::sync_with_stdio(false); // your code is here // string s; cin >> s; int n = s.size(); int sum = 0; rep(i, n) { if (s[i] == 'g') sum++; } Print((-n + 2 * sum) / 2); // // your code finished return 0; }#include <iostream> #include <cmath> #include <vector> #include <bitset> #include <algorithm> #include <stack> #include <queue> #include <map> #include <climits> #include <set> #include <map> #include <iomanip> #include <cassert> #include <functional> #include <cstring> using namespace std; typedef pair<int, int> P; #define mp make_pair #define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i)) #define rep(i, n) FOR(i,0,n) #define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--) #define vsort(v) sort((v).begin(), (v).end()); //小さい順 #define rvsort(v) sort(v.begin(), v.end(),greater<int>()); //大きい順 #define YES cout<<"YES"<< endl #define NO cout<<"NO"<<endl #define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl #define yes cout<<"yes"<<endl #define no cout<<"no"<<endl #define all(c) (c).begin(),(c).end() #define ll long long #define vi vector<int> #define vvi vector<vector<int>> #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vvb vector<vector<bool>> #define vs vector<string> #define vc vector<char> #define vvc vector<vector<char>> #define Print(p) cout<<(p)<<endl #define F first #define S second #define pb1 push_back #define mod 1000000007LL #define INF 1234567890 const int maxn = 2e5 + 10; //initialization here // ll dp[55][55][3000]; //i番目までのカードからj枚使って総和をkにできる総数 // //initialization finish // your function is here // // // your function finished int main() { cin.tie(0); ios::sync_with_stdio(false); // your code is here // string s; cin >> s; int n = s.size(); int sum = 0; rep(i, n) { if (s[i] == 'g') sum++; } Print((-n + 2 * sum) / 2); // // your code finished return 0; }
a.cc:91:2: error: stray '#' in program 91 | }#include <iostream> | ^ a.cc:91:3: error: 'include' does not name a type 91 | }#include <iostream> | ^~~~~~~ a.cc:140:11: error: redefinition of 'const int maxn' 140 | const int maxn = 2e5 + 10; | ^~~~ a.cc:50:11: note: 'const int maxn' previously defined here 50 | const int maxn = 2e5 + 10; | ^~~~ a.cc:145:4: error: redefinition of 'long long int dp [55][55][3000]' 145 | ll dp[55][55][3000]; //i番目までのカードからj枚使って総和をkにできる総数 | ^~ a.cc:55:4: note: 'long long int dp [55][55][3000]' previously declared here 55 | ll dp[55][55][3000]; //i番目までのカードからj枚使って総和をkにできる総数 | ^~ a.cc:160:5: error: redefinition of 'int main()' 160 | int main() { | ^~~~ a.cc:70:5: note: 'int main()' previously defined here 70 | int main() { | ^~~~
s185391229
p03965
C++
#include<stdio.h> int main(void){ scanf("%s",str); }
a.cc: In function 'int main()': a.cc:6:16: error: 'str' was not declared in this scope; did you mean 'std'? 6 | scanf("%s",str); | ^~~ | std
s552410981
p03965
C++
#define SORT(v) sort(v.begin(), v.end()) #include <iostream> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <cstdlib> #include <cstdarg> #include <cstdio> #include <cmath> #include <numeric> #include <utility> // #include "ane.cpp" #define INF (int)1e9 #define INFLL (long long)1e18 #define NMAX 100002 #define MMAX 100005 #define MOD 100000 using namespace std; // コメントアウトするとdebug()を実行しない #define DEBUG // // ライブラリ // // frequent used aliases typedef long long ll; typedef pair<int, int> p; typedef pair<ll, int> lp; typedef pair<ll, ll> llp; typedef vector<int> vec; typedef vector<vec> mat; // frequent used constants static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1}; static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1}; // デバッグ用printf void debug(const char* format, ...){ #ifndef DEBUG return; #endif va_list arg; va_start(arg, format); vprintf(format, arg); // コンソールに出力 va_end(arg); } // n次元配列の初期化。第2引数の型のサイズごとに初期化していく。 template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } // Union-Find Tree class UnionFindTree{ struct node{ int par; }; std::vector<node> T; public: void init(int num){ T.resize(num+1); // ignore T[0] for (int i = 1; i <= num; ++i) { T[i].par = i; } } void unite(int x, int y){ T[find(y)].par = find(x); } int find(int x){ if (T[x].par == x) return x; else return T[x].par = find(T[x].par); } bool same(int x, int y){ return find(x) == find(y); } }; // Segment Tree for Range Minimum Query // ********************************************************** // *** important: all functions' variable, *** // *** such as "index", "l", "r", etc., must be 0-origin. *** // ********************************************************** // ******************************************** // *** important: NMAX must be power of 2. *** // ******************************************** template<typename T> class SegmentTree{ private: ll N; T INF_VAL; T dat[NMAX * 2]; // 0 origin, A[i] = dat[i + N] T _query(ll l, ll r, ll l_resp, ll r_resp, ll i_dat){ debug("query(%lld, %lld, %lld, %lld, %lld) called\n", l, r, l_resp, r_resp, i_dat); if (r < l_resp || r_resp < l) return INF_VAL; else if(l <= l_resp && r_resp <= r) return dat[i_dat]; else return min(_query(l ,r, l_resp, (l_resp + r_resp) / 2, i_dat * 2), _query(l, r, (l_resp + r_resp) / 2 + 1, r_resp, i_dat * 2 + 1)); } public: void init(ll _N, T _inf_val){ N = 1; while(N < _N) N *= 2; INF_VAL = _inf_val; Fill(dat, _inf_val); } T get(ll index){ return dat[index + N]; } void set(int index, T val){ int i_dat = index + N; dat[i_dat] = val; for (i_dat /= 2; i_dat > 0; i_dat /= 2) { dat[i_dat] = min(dat[i_dat * 2], dat[i_dat * 2 + 1]); } } T query(ll l, ll r){ return _query(l, r, 0, N - 1, 1); } void dump(){ cout << "*** SegTree dump begin ***\n"; cout << "N = " << N << ", INF_VAL = " << INF_VAL << endl; for (int i = 1; i < N * 2; i *= 2) { for (int j = i; j < i * 2; ++j) { if(dat[j] == INF_VAL) cout << "INF "; else cout << dat[j] << " "; } cout << endl; } cout << "*** SegTree dump end ***\n"; } }; // Binary Indexed Tree for Range Sum Query // ******************************************* // *** important: all functions' variable, *** // *** such as "i", must be 1-origin. *** // ******************************************* template<typename T> class BinaryIndexedTree{ private: ll N; T dat[NMAX + 1]; // 1 origin, A[i] = sum(i) - sum(i-1) public: void init(ll _N){ N = _N; Fill(dat, 0); } void add(int i, T val){ while(i <= N) { dat[i] += val; i += i & -i; } } T sum(ll i){ T ret = 0; while(i > 0) { ret += dat[i]; i -= i & -i; // set last HIGH bit to LOW } return ret; } T sum(ll left, ll right){ return sum(right) - sum(left - 1); } void dump(){ cout << "*** BITree dump begin ***\n"; cout << "N = " << N << endl; for (int i = 1; i <= N; i *= 2) { cout << dat[i] << " "; } cout << "*** BITree dump end ***\n"; } }; // // ライブラリ終了 // ll N,M,K,A,B,C,D,E; int dp[NMAX][NMAX / 2 + 1] = {}; string Str; ll ans = 0; inline int battle(int index, char hand){ if (Str[index] == hand) { return 0; }else if(Str[index] == 'p' && hand == 'g'){ return -1; }else{ return 1; } } ll solve(int index, int restPs){ debug("solve(%d, %d)\n", index, restPs); if(dp[index][restPs] != -1) return dp[index][restPs]; if(restPs < 0) return -INF; if(index >= N) return 0; dp[index][restPs] = max( solve(index+1, min(restPs+1, NMAX / 2)) + battle(index, 'g'), solve(index+1, restPs-1) + battle(index, 'p')); debug("dp[%d][%d] = %d\n", index, restPs, dp[index][restPs]); return dp[index][restPs]; } void debug(){ // デバッグ用出力 } void answer(){ // 解答出力 printf("%lld\n", ans); } int main(int argc, char const *argv[]) { // 入力の読み込み,番兵法 Fill(dp, -1); cin >> Str; N = Str.size(); ans = solve(0, 0); #ifdef DEBUG debug(); #endif answer(); return 0; }
/tmp/cc0IKoJy.o: in function `answer()': a.cc:(.text+0x293): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc0IKoJy.o /tmp/cc0IKoJy.o: in function `main': a.cc:(.text+0x2e0): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/cc0IKoJy.o a.cc:(.text+0x2f9): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/cc0IKoJy.o a.cc:(.text+0x31e): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc0IKoJy.o /tmp/cc0IKoJy.o: in function `__static_initialization_and_destruction_0()': a.cc:(.text+0x33a): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/cc0IKoJy.o a.cc:(.text+0x353): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/cc0IKoJy.o /tmp/cc0IKoJy.o: in function `battle(int, char)': a.cc:(.text._Z6battleic[_Z6battleic]+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/cc0IKoJy.o a.cc:(.text._Z6battleic[_Z6battleic]+0x46): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/cc0IKoJy.o collect2: error: ld returned 1 exit status
s678409268
p03965
C++
#define SORT(v) sort(v.begin(), v.end()) #include <iostream> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <cstdlib> #include <cstdarg> #include <cstdio> #include <cmath> #include <numeric> #include <utility> // #include "ane.cpp" #define INF (int)1e9 #define INFLL (long long)1e18 #define NMAX 100002 #define MMAX 100005 #define MOD 100000 using namespace std; // コメントアウトするとdebug()を実行しない #define DEBUG // // ライブラリ // // frequent used aliases typedef long long ll; typedef pair<int, int> p; typedef pair<ll, int> lp; typedef pair<ll, ll> llp; typedef vector<int> vec; typedef vector<vec> mat; // frequent used constants static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1}; static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1}; // デバッグ用printf void debug(const char* format, ...){ #ifndef DEBUG return; #endif va_list arg; va_start(arg, format); vprintf(format, arg); // コンソールに出力 va_end(arg); } // n次元配列の初期化。第2引数の型のサイズごとに初期化していく。 template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } // Union-Find Tree class UnionFindTree{ struct node{ int par; }; std::vector<node> T; public: void init(int num){ T.resize(num+1); // ignore T[0] for (int i = 1; i <= num; ++i) { T[i].par = i; } } void unite(int x, int y){ T[find(y)].par = find(x); } int find(int x){ if (T[x].par == x) return x; else return T[x].par = find(T[x].par); } bool same(int x, int y){ return find(x) == find(y); } }; // Segment Tree for Range Minimum Query // ********************************************************** // *** important: all functions' variable, *** // *** such as "index", "l", "r", etc., must be 0-origin. *** // ********************************************************** // ******************************************** // *** important: NMAX must be power of 2. *** // ******************************************** template<typename T> class SegmentTree{ private: ll N; T INF_VAL; T dat[NMAX * 2]; // 0 origin, A[i] = dat[i + N] T _query(ll l, ll r, ll l_resp, ll r_resp, ll i_dat){ debug("query(%lld, %lld, %lld, %lld, %lld) called\n", l, r, l_resp, r_resp, i_dat); if (r < l_resp || r_resp < l) return INF_VAL; else if(l <= l_resp && r_resp <= r) return dat[i_dat]; else return min(_query(l ,r, l_resp, (l_resp + r_resp) / 2, i_dat * 2), _query(l, r, (l_resp + r_resp) / 2 + 1, r_resp, i_dat * 2 + 1)); } public: void init(ll _N, T _inf_val){ N = 1; while(N < _N) N *= 2; INF_VAL = _inf_val; Fill(dat, _inf_val); } T get(ll index){ return dat[index + N]; } void set(int index, T val){ int i_dat = index + N; dat[i_dat] = val; for (i_dat /= 2; i_dat > 0; i_dat /= 2) { dat[i_dat] = min(dat[i_dat * 2], dat[i_dat * 2 + 1]); } } T query(ll l, ll r){ return _query(l, r, 0, N - 1, 1); } void dump(){ cout << "*** SegTree dump begin ***\n"; cout << "N = " << N << ", INF_VAL = " << INF_VAL << endl; for (int i = 1; i < N * 2; i *= 2) { for (int j = i; j < i * 2; ++j) { if(dat[j] == INF_VAL) cout << "INF "; else cout << dat[j] << " "; } cout << endl; } cout << "*** SegTree dump end ***\n"; } }; // Binary Indexed Tree for Range Sum Query // ******************************************* // *** important: all functions' variable, *** // *** such as "i", must be 1-origin. *** // ******************************************* template<typename T> class BinaryIndexedTree{ private: ll N; T dat[NMAX + 1]; // 1 origin, A[i] = sum(i) - sum(i-1) public: void init(ll _N){ N = _N; Fill(dat, 0); } void add(int i, T val){ while(i <= N) { dat[i] += val; i += i & -i; } } T sum(ll i){ T ret = 0; while(i > 0) { ret += dat[i]; i -= i & -i; // set last HIGH bit to LOW } return ret; } T sum(ll left, ll right){ return sum(right) - sum(left - 1); } void dump(){ cout << "*** BITree dump begin ***\n"; cout << "N = " << N << endl; for (int i = 1; i <= N; i *= 2) { cout << dat[i] << " "; } cout << "*** BITree dump end ***\n"; } }; // // ライブラリ終了 // ll N,M,K,A,B,C,D,E; int dp[NMAX][NMAX / 2 + 1] = {}; string Str; ll ans = 0; inline int battle(int index, char hand){ if (Str[index] == hand) { return 0; }else if(Str[index] == 'p' && hand == 'g'){ return -1; }else{ return 1; } } ll solve(int index, int restPs){ debug("solve(%d, %d)\n", index, restPs); if(dp[index][restPs] != -1) return dp[index][restPs]; if(restPs < 0) return -INF; if(index >= N) return 0; dp[index][restPs] = max( solve(index+1, min(restPs+1, NMAX / 2)) + battle(index, 'g'), solve(index+1, restPs-1) + battle(index, 'p')); debug("dp[%d][%d] = %d\n", index, restPs, dp[index][restPs]); return dp[index][restPs]; } void debug(){ // デバッグ用出力 } void answer(){ // 解答出力 printf("%lld\n", ans); } int main(int argc, char const *argv[]) { // 入力の読み込み,番兵法 Fill(dp, -1); cin >> Str; N = Str.size(); ans = solve(0, 0); #ifdef DEBUG debug(); #endif answer(); return 0; }
/tmp/ccoh2VwO.o: in function `answer()': a.cc:(.text+0x293): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoh2VwO.o /tmp/ccoh2VwO.o: in function `main': a.cc:(.text+0x2e0): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/ccoh2VwO.o a.cc:(.text+0x2f9): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/ccoh2VwO.o a.cc:(.text+0x31e): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoh2VwO.o /tmp/ccoh2VwO.o: in function `__static_initialization_and_destruction_0()': a.cc:(.text+0x33a): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/ccoh2VwO.o a.cc:(.text+0x353): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/ccoh2VwO.o /tmp/ccoh2VwO.o: in function `battle(int, char)': a.cc:(.text._Z6battleic[_Z6battleic]+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/ccoh2VwO.o a.cc:(.text._Z6battleic[_Z6battleic]+0x46): relocation truncated to fit: R_X86_64_PC32 against symbol `Str[abi:cxx11]' defined in .bss section in /tmp/ccoh2VwO.o collect2: error: ld returned 1 exit status
s709663727
p03965
C++
#define SORT(v) sort(v.begin(), v.end()) #include <iostream> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <cstdlib> #include <cstdarg> #include <cstdio> #include <cmath> #include <numeric> #include <utility> // #include "ane.cpp" #define INF (int)1e9 #define INFLL (long long)1e18 #define NMAX 100002 #define MMAX 100005 #define MOD 100000 using namespace std; // コメントアウトするとdebug()を実行しない #define DEBUG // // ライブラリ // // frequent used aliases typedef long long ll; typedef pair<int, int> p; typedef pair<ll, int> lp; typedef pair<ll, ll> llp; typedef vector<int> vec; typedef vector<vec> mat; // frequent used constants static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1}; static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1}; // デバッグ用printf void debug(const char* format, ...){ #ifndef DEBUG return; #endif va_list arg; va_start(arg, format); vprintf(format, arg); // コンソールに出力 va_end(arg); } // n次元配列の初期化。第2引数の型のサイズごとに初期化していく。 template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } // Union-Find Tree class UnionFindTree{ struct node{ int par; }; std::vector<node> T; public: void init(int num){ T.resize(num+1); // ignore T[0] for (int i = 1; i <= num; ++i) { T[i].par = i; } } void unite(int x, int y){ T[find(y)].par = find(x); } int find(int x){ if (T[x].par == x) return x; else return T[x].par = find(T[x].par); } bool same(int x, int y){ return find(x) == find(y); } }; // Segment Tree for Range Minimum Query // ********************************************************** // *** important: all functions' variable, *** // *** such as "index", "l", "r", etc., must be 0-origin. *** // ********************************************************** // ******************************************** // *** important: NMAX must be power of 2. *** // ******************************************** template<typename T> class SegmentTree{ private: ll N; T INF_VAL; T dat[NMAX * 2]; // 0 origin, A[i] = dat[i + N] T _query(ll l, ll r, ll l_resp, ll r_resp, ll i_dat){ debug("query(%lld, %lld, %lld, %lld, %lld) called\n", l, r, l_resp, r_resp, i_dat); if (r < l_resp || r_resp < l) return INF_VAL; else if(l <= l_resp && r_resp <= r) return dat[i_dat]; else return min(_query(l ,r, l_resp, (l_resp + r_resp) / 2, i_dat * 2), _query(l, r, (l_resp + r_resp) / 2 + 1, r_resp, i_dat * 2 + 1)); } public: void init(ll _N, T _inf_val){ N = 1; while(N < _N) N *= 2; INF_VAL = _inf_val; Fill(dat, _inf_val); } T get(ll index){ return dat[index + N]; } void set(int index, T val){ int i_dat = index + N; dat[i_dat] = val; for (i_dat /= 2; i_dat > 0; i_dat /= 2) { dat[i_dat] = min(dat[i_dat * 2], dat[i_dat * 2 + 1]); } } T query(ll l, ll r){ return _query(l, r, 0, N - 1, 1); } void dump(){ cout << "*** SegTree dump begin ***\n"; cout << "N = " << N << ", INF_VAL = " << INF_VAL << endl; for (int i = 1; i < N * 2; i *= 2) { for (int j = i; j < i * 2; ++j) { if(dat[j] == INF_VAL) cout << "INF "; else cout << dat[j] << " "; } cout << endl; } cout << "*** SegTree dump end ***\n"; } }; // Binary Indexed Tree for Range Sum Query // ******************************************* // *** important: all functions' variable, *** // *** such as "i", must be 1-origin. *** // ******************************************* template<typename T> class BinaryIndexedTree{ private: ll N; T dat[NMAX + 1]; // 1 origin, A[i] = sum(i) - sum(i-1) public: void init(ll _N){ N = _N; Fill(dat, 0); } void add(int i, T val){ while(i <= N) { dat[i] += val; i += i & -i; } } T sum(ll i){ T ret = 0; while(i > 0) { ret += dat[i]; i -= i & -i; // set last HIGH bit to LOW } return ret; } T sum(ll left, ll right){ return sum(right) - sum(left - 1); } void dump(){ cout << "*** BITree dump begin ***\n"; cout << "N = " << N << endl; for (int i = 1; i <= N; i *= 2) { cout << dat[i] << " "; } cout << "*** BITree dump end ***\n"; } }; // // ライブラリ終了 // ll N,M,K,A,B,C,D,E; int dp[NMAX][NMAX / 2 + 1] = {}; string S; ll ans = 0; inline int battle(int index, char hand){ if (S[index] == hand) { return 0; }else if(S[index] == 'p' && hand == 'g'){ return -1; }else{ return 1; } } ll solve(int index, int restPs){ debug("solve(%d, %d)\n", index, restPs); if(dp[index][restPs] != -1) return dp[index][restPs]; if(restPs < 0) return -INF; if(index >= N) return 0; dp[index][restPs] = max( solve(index+1, min(restPs+1, NMAX / 2)) + battle(index, 'g'), solve(index+1, restPs-1) + battle(index, 'p')); debug("dp[%d][%d] = %d\n", index, restPs, dp[index][restPs]); return dp[index][restPs]; } void debug(){ // デバッグ用出力 } void answer(){ // 解答出力 printf("%lld\n", ans); } int main(int argc, char const *argv[]) { // 入力の読み込み,番兵法 Fill(dp, -1); cin >> S; N = S.size(); ans = solve(0, 0); #ifdef DEBUG debug(); #endif answer(); return 0; }
/tmp/ccnHXVvz.o: in function `answer()': a.cc:(.text+0x293): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccnHXVvz.o /tmp/ccnHXVvz.o: in function `main': a.cc:(.text+0x2e0): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccnHXVvz.o a.cc:(.text+0x2f9): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccnHXVvz.o a.cc:(.text+0x31e): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccnHXVvz.o /tmp/ccnHXVvz.o: in function `__static_initialization_and_destruction_0()': a.cc:(.text+0x33a): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccnHXVvz.o a.cc:(.text+0x353): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccnHXVvz.o /tmp/ccnHXVvz.o: in function `battle(int, char)': a.cc:(.text._Z6battleic[_Z6battleic]+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccnHXVvz.o a.cc:(.text._Z6battleic[_Z6battleic]+0x46): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccnHXVvz.o collect2: error: ld returned 1 exit status
s785681280
p03965
C++
#include <iostream> #include <string> #include <vector> #define ll long long using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; cout << S.length() / 2 - count(S.begin(), S.end(), 'p') << endl; }
a.cc: In function 'int main()': a.cc:9:34: error: 'count' was not declared in this scope 9 | cout << S.length() / 2 - count(S.begin(), S.end(), 'p') << endl; | ^~~~~
s101958989
p03965
C++
#include <iostream> #include <string> using namespace std; int main() { int p = 0; int n = 0; string s; cin >> s; for(int i = 0; i < s.size(); i++){ if(s[i] == "p") p++; } n = s.size() / 2; cout << (int) n - p << endl; }
a.cc: In function 'int main()': a.cc:11:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(s[i] == "p") p++;
s118755081
p03965
C++
// // main.cpp // BC20161109 // // Created by TA on 2016/11/09. // Copyright © 2016年 TA. All rights reserved. // #include <iostream> #include <list> #include <String> using namespace std; int main(int argc, const char * argv[]) { string str; int p = 0,g = 0,count = 0 ,point = 0; while (cin >> str) { for (int i =0; i < str.length() ; i++) { if (str[i] == 'g') { if (count > 0) { point ++ ; count--; } else count ++; } else {if (count > 0) { count --; } else point --; count ++; } } } cout << point << endl; }
a.cc:11:10: fatal error: String: No such file or directory 11 | #include <String> | ^~~~~~~~ compilation terminated.
s031930782
p03965
C++
include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <math.h> using namespace std; int main(void){ int i,j,k,t,tmp; string s; int N; int a,b,c; a=b=c=0; cin>>s; N=s.length(); for(i=0;i<N;i++){ if(s[i]=='g'){ if(a<b){ a++; c++; } else{ b++; } } else{ if(a<b){ a++; } else{ b++; c--; } } } cout<<c<<endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <cstdio> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s564139959
p03965
C++
#include<bits/stdc++.h> using namespace std; string S; int main(){ cin>>S;int pos=(S.size()+1)/2; for(int i=0;i<pos;i++){if(S[i]=='p')cnt--;} for(int i=pos;i<S.size();i++){if(S[i]=='g')cnt++;} cout<<cnt<<endl; }
a.cc: In function 'int main()': a.cc:6:45: error: 'cnt' was not declared in this scope; did you mean 'int'? 6 | for(int i=0;i<pos;i++){if(S[i]=='p')cnt--;} | ^~~ | int a.cc:7:52: error: 'cnt' was not declared in this scope; did you mean 'int'? 7 | for(int i=pos;i<S.size();i++){if(S[i]=='g')cnt++;} | ^~~ | int a.cc:8:15: error: 'cnt' was not declared in this scope; did you mean 'int'? 8 | cout<<cnt<<endl; | ^~~ | int
s109673377
p03965
C++
#include<iostream> #include<string> using namespace std; string s; int p; int main() { cin>>s; for(int i=0;i<s.length;i++){ if(s[i]=='p') p++; } cout <<s.length/2-p<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:17: 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 '()' ?) 8 | for(int i=0;i<s.length;i++){ | ~~^~~~~~ | () a.cc:11:10: 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 '()' ?) 11 | cout <<s.length/2-p<<endl; | ~~^~~~~~ | ()
s913449365
p03965
C++
#include<iostream> #include<string> string s; int p; int main() { cin>>s; for(int i=0;i<s.length;i++){ if(s[i]=='p') p++; } cout <<s.length/2-p<<endl; return 0; }
a.cc:3:1: error: 'string' does not name a type; did you mean 'stdin'? 3 | string s; | ^~~~~~ | stdin a.cc: In function 'int main()': a.cc:6:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin>>s; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:6:6: error: 's' was not declared in this scope 6 | cin>>s; | ^ a.cc:10:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 10 | cout <<s.length/2-p<<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:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 10 | cout <<s.length/2-p<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s383119577
p03965
C++
#include<iostream> string s; int p; int main() { cin>>s; for(int i=0;i<s.length;i++){ if(s[i]=='p') p++; } cout <<s.length/2-p<<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:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | cin>>s; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:5:6: error: 's' was not declared in this scope 5 | cin>>s; | ^ a.cc:9:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout <<s.length/2-p<<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:9:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout <<s.length/2-p<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s909891954
p03965
Java
Scanner sc = new Scanner(System.in); String s = sc.nextLine(); char[] rp = s.toCharArray(); int paper = 0; int rock = 0; int win = 0; int lose = 0; int turn = 0; while(turn<rp.length){ if (rp[turn]=='g'){ if (paper<rock){ paper++; win++; } else{ rock++; } } else if (rp[turn]=='p'){ if (paper<rock){ paper++; } else{ rock++; lose++; } } turn++; } System.out.println(win-lose);
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. Scanner sc = new Scanner(System.in); ^ (use --enable-preview to enable unnamed classes) Main.java:9: error: class, interface, enum, or record expected while(turn<rp.length){ ^ Main.java:13: error: class, interface, enum, or record expected win++; ^ Main.java:14: error: class, interface, enum, or record expected } ^ Main.java:17: error: class, interface, enum, or record expected } ^ Main.java:22: error: class, interface, enum, or record expected } ^ Main.java:25: error: class, interface, enum, or record expected lose++; ^ Main.java:26: error: class, interface, enum, or record expected } ^ Main.java:29: error: class, interface, enum, or record expected } ^ 9 errors
s500878054
p03965
C++
#include<stdio.h> char a[100010]; int main(){ int s=0,i; scanf("%s",a); for(i=0;i!='\0';i++){ if(a[i]=='g')s++; } prinf("%d",s-(i+1)/2); }
a.cc: In function 'int main()': a.cc:9:9: error: 'prinf' was not declared in this scope; did you mean 'printf'? 9 | prinf("%d",s-(i+1)/2); | ^~~~~ | printf
s647263956
p03965
C++
#include<stdio.h> char a[100010]; int main(){ int s=0 scanf("%s",a); for(i=0;a[i]!='\0';i++){ if(a[i]=='g')s++; } printf("%d",s-(i+1)/2); }
a.cc: In function 'int main()': a.cc:5:9: error: expected ',' or ';' before 'scanf' 5 | scanf("%s",a); | ^~~~~ a.cc:6:13: error: 'i' was not declared in this scope 6 | for(i=0;a[i]!='\0';i++){ | ^ a.cc:9:24: error: 'i' was not declared in this scope 9 | printf("%d",s-(i+1)/2); | ^
s926366986
p03965
C++
#include<stdio.h> char a[100100]; int main() { int z,i,p=0; scanf("%s",a); z=strlen(a); for(i=0;i<z;i++) { if(a[i]=='p')p++; } printf("%d",(z/2)-p); }
a.cc: In function 'int main()': a.cc:7:3: error: 'strlen' was not declared in this scope 7 | z=strlen(a); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<stdio.h> +++ |+#include <cstring> 2 | char a[100100];
s000730168
p03965
C++
#include <stdio.h> char a[100010] int main(){ int s=0 scanf("%s",a); for(i=0;a[i]!='\0';i++){ if(a[i]=='g') s++; } printf("%d",s-i/2); }
a.cc:3:1: error: expected initializer before 'int' 3 | int main(){ | ^~~
s476731549
p03965
C++
#include<stdio.h> #include<string.h> char a[100100]; int main() { int z,i,p=0; gets(a); z=strlen(a); for(i=0;i<z;i++) { if(a[i]=='p')p++; } printf("%d",(z/2)-p); }
a.cc: In function 'int main()': a.cc:7:1: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s964057974
p03965
C++
#include<stdio.h> #include<cstring> char a[100100]; int main() { int z,i,p=0; gets(a); z=strlen(a); for(i=0;i<z;i++) { if(a[i]=='p')p++; } printf("%d",(z/2)-p); }
a.cc: In function 'int main()': a.cc:7:1: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s279756839
p03965
C++
#include<bits/stdc++.h> #define MP make_pair #define PB push_back #define PP pop_back() #define set(x,y) memset(x,y,sizeof(x)) #define MIN3(x,y,z) min(min(x,y),z) #define MAX3(x,y,z) max(max(x,y),z) #define ALL(x) x.begin(),x.end() #define sz(x) (int) x.size() #define sag(x) 2*x+1 #define sol(x) 2*x #define FOR(i,j,k) for(int i=j;i<=k;i++) #define ROF(i,j,k) for(int i=j;i>=k;i--) #define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" " #define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar() #define pii pair<int,int> #define st first #define nd second #define ll long long #define llu long long unsigned #define lf double #define orta (bas+son)/2 #define MOD 1000000007 #define inf 1000000000 #define N 200005 using namespace std; map<int,int> dp[N],vis[N]; char s[N]; int dfs(int n,int b) { if(n>len) return 0; if(vis[n][b]==1) return dp[n][b]; int ret1=0,ret2=0; if(b) ret1=dfs(n+1,b-1)+(s[n]=='g'),ret2=dfs(n+1,b+1)-(s[n]=='p'); else ret2=dfs(n+1,b+1)-(s[n]=='p'); vis[n][b]=1; return dp[n][b]=max(ret1,ret2); } int main() { scanf("%s",s+1); len=strlen(s+1); printf("%d",dfs(1,0)); }
a.cc: In function 'int dfs(int, int)': a.cc:30:10: error: 'len' was not declared in this scope 30 | if(n>len) return 0; | ^~~ a.cc: In function 'int main()': a.cc:42:5: error: 'len' was not declared in this scope 42 | len=strlen(s+1); | ^~~
s673916872
p03965
C++
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; long long g, p = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'g') g++; else p++; } long long my_p = s.size() / 2; long long my_g = s.size() - my_p; if (my_p > g) { long long ans = g - my_g; } else { long long ans = my_p - p; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 32 | cout << ans << endl; | ^~~ | abs
s953274595
p03965
C++
#include <stdio.h> #define MAX 10000 int main() { int n = 0; char c[MAX]; c[0] = getchar(); int i=0,ans = 0; for(n = 1;c[n-1] != '\n';n++){ c[n]=getchar(); if(c[n] == 'g'){ if(i <= 0){ ans += 1 i -= 1; }else i +=1; } if(c[n] == 'p'){ if(i <= 0){ i -= 1; }else i +=1; } } printf("%d",answer); return 0; }
a.cc: In function 'int main()': a.cc:14:41: error: expected ';' before 'i' 14 | ans += 1 | ^ | ; 15 | i -= 1; | ~ a.cc:25:21: error: 'answer' was not declared in this scope 25 | printf("%d",answer); | ^~~~~~
s216649733
p03965
C++
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = a; i < (int)(b); i++) #define rep(i, n) REP(i, 0, n) using namespace std; const int INF = 1 << 7; const int M = 100000; string s; int n; int a[M][M]; int dp(int i, int j) { if (i == n) { return 0; } if (a[i][j] != INF) { return a[i][j]; } if (j == 0) { a[i][j] = dp(i + 1, 1) + ((s[i] == 'g') ? 0 : -1); // gを出す return a[i][j]; } else { ll x = dp(i + 1, j + 1) + ((s[i] == 'g') ? 0 : -1); // gを出す ll y = dp(i + 1, j - 1) + ((s[i] == 'g') ? 1 : 0); // pを出す a[i][j] = max(x, y); return a[i][j]; } } int main() { cin >> s; n = s.size(); rep(i, n) { rep(j, n) { a[i][j] = INF; } } cout << dp(0, 0) << endl; return 0; }
a.cc: In function 'int dp(int, int)': a.cc:23:5: error: 'll' was not declared in this scope 23 | ll x = dp(i + 1, j + 1) + ((s[i] == 'g') ? 0 : -1); // gを出す | ^~ a.cc:24:7: error: expected ';' before 'y' 24 | ll y = dp(i + 1, j - 1) + ((s[i] == 'g') ? 1 : 0); // pを出す | ^~ | ; a.cc:25:19: error: 'x' was not declared in this scope 25 | a[i][j] = max(x, y); | ^ a.cc:25:22: error: 'y' was not declared in this scope 25 | a[i][j] = max(x, y); | ^
s931956093
p03965
C++
// C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <unordered_map> #include <utility> #include <valarray> #include <vector> // // Iteration // #define REP(i, a, b) for (int i = a; i < (int)(b); i++) #define rep(i, n) REP(i, 0, n) #define each(x, v) for (auto &&x : v) // as if v.each // // Debug // #define dump(c) cerr << "> " << #c << " = " << (c) << endl; // // Vector // #define sort(v) sort(v.begin(), v.end()) // unique should be used with sort #define unique(v) unique(v.begin(), v.end()) - v.begin() #define lower_bound(v, x) lower_bound(v.begin(), v.end(), x); #define upper_bound(v, x) upper_bound(v.begin(), v.end(), x); // // Namespace // using namespace std; // // Type // typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<string> vs; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1 << 10; const int M = 100100; const double EPS = 1e-10; static const double pi = 3.1415926535897932; string s; ll n; ll a[M][M]; ll x, y; ll dp(ll i, ll j) { if (i == n) { return 0; } if (a[i][j] != INF) { return a[i][j]; } if (j == 0) { a[i][j] = dp(i + 1, 1) + ((s[i] == 'g') ? 0 : -1); // gを出す return a[i][j]; } else { x = dp(i + 1, j + 1) + ((s[i] == 'g') ? 0 : -1); // gを出す y = dp(i + 1, j - 1) + ((s[i] == 'g') ? 1 : 0); // pを出す a[i][j] = max(x, y); return a[i][j]; } } int main() { cin >> s; n = s.size(); rep(i, n) { rep(j, n) { a[i][j] = INF; } } cout << dp(0, 0) << endl; return 0; }
/tmp/ccE4NREg.o: in function `dp(long long, long long)': a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccE4NREg.o a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccE4NREg.o a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccE4NREg.o a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccE4NREg.o collect2: error: ld returned 1 exit status
s636033519
p03965
C++
// C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <unordered_map> #include <utility> #include <valarray> #include <vector> // // Iteration // #define REP(i, a, b) for (int i = a; i < (int)(b); i++) #define rep(i, n) REP(i, 0, n) #define each(x, v) for (auto &&x : v) // as if v.each // // Debug // #define dump(c) cerr << "> " << #c << " = " << (c) << endl; // // Vector // #define sort(v) sort(v.begin(), v.end()) // unique should be used with sort #define unique(v) unique(v.begin(), v.end()) - v.begin() #define lower_bound(v, x) lower_bound(v.begin(), v.end(), x); #define upper_bound(v, x) upper_bound(v.begin(), v.end(), x); // // Namespace // using namespace std; // // Type // typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<string> vs; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1 << 10; const int M = 100100; const double EPS = 1e-10; static const double pi = 3.1415926535897932; string str; ll n; ll a[M][M]; ll x, y; ll dp(ll i, ll j) { if (i == n) { return 0; } if (a[i][j] != INF) { return a[i][j]; } if (j == 0) { a[i][j] = dp(i + 1, 1) + ((str[i] == 'g') ? 0 : -1); // gを出す return a[i][j]; } else { x = dp(i + 1, j + 1) + ((str[i] == 'g') ? 0 : -1); // gを出す y = dp(i + 1, j - 1) + ((str[i] == 'g') ? 1 : 0); // pを出す a[i][j] = max(x, y); return a[i][j]; } } int main() { cin >> str; n = str.size(); rep(i, n) { rep(j, n) { a[i][j] = INF; } } cout << dp(0, 0) << endl; return 0; }
/tmp/cc89DrEL.o: in function `dp(long long, long long)': a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc89DrEL.o a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/cc89DrEL.o a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/cc89DrEL.o a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc89DrEL.o collect2: error: ld returned 1 exit status