submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s437329215
p03687
C++
#include <bits/stdc++.h> #include <array> using namespace std; using ULL = unsigned long long; using UL = unsigned; using LL = long long; #define rep(i, n) for(UL i = 0; i < (n); i++) struct Problem { void Solve() { vector<UL> ans; ans.assign(26, 0); vector<UL> prev; prev.assign(26, (UL)-1); string S; cin >> S; rep(i, S.size()) { UL p = S[i] - 'a'; if (prev[p] == (UL)-1) { ans[p] = max(ans[p], i); } else { ans[p] = max(ans[p], i - prev[p] - 1); } prev[p] = i; } UL ans2 = 10000000; rep(i, 26) { if (prev[i] == (UL)-1) continue; ans[i] = max(ans[i], S.size() - 1 - prev[i]); ans2 = min(ans2, ans[i]); } cout << ans2 << endl; } Problem(); }; int main() { unique_ptr<Problem> p(new Problem()); p->Solve(); return 0; } Problem::Problem() { cout << fixed << setprecision(10); }
a.cc: In member function 'void Problem::Solve()': a.cc:28:37: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<unsigned int>, unsigned int>::value_type&, std::__cxx11::basic_string<char>::size_type)' 28 | ans[i] = max(ans[i], S.size() - 1 - prev[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:37: note: deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 28 | ans[i] = max(ans[i], S.size() - 1 - prev[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:37: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned int' 28 | ans[i] = max(ans[i], S.size() - 1 - prev[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s140403939
p03687
C++
#include <bits/stdc++.h> #define rep(i,n)for(long long i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { string s; cin >> s; int alp[26]={}; rep(i,s.size()){ alp[s[i]-'a']++; } int M=0; char c=s[s.size()/2]; rep(i,26){ if(M<alp[i]){ c=char('a'+i); M=alp[i]; } } vector<char>word; word.push_back(c); rep(i,26){ if(alp[i]==M) word.push_back('a'+i); } int now=0; vector<int>num; rep(i,s.size()){ if(s[i]==word[j]){ num.push_back(now); now=0; } else now++; } sort(num.begin(),num.end()); cout << max(now-1,num[num.size()-1]) << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:19: error: 'j' was not declared in this scope 30 | if(s[i]==word[j]){ | ^
s428908122
p03687
Java
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.Scanner; class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; }else{ ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();} public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while(true){ if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; }else if(b == -1 || !isPrintableChar(b)){ return minus ? -n : n; }else{ throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} } public class Main { static FastScanner scan=new FastScanner(); static Scanner scanner=new Scanner(System.in); static long mod=1000000007; static double eps=0.0000000001; static int big=Integer.MAX_VALUE; static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;} static long lcm (long a, long b) {return a*b/gcd(a,b);} static int max(int a,int b) {return a>b?a:b;} static int min(int a,int b) {return a<b?a:b;} static long factorial(int i) {return i==1?1:i*factorial(i-1);} static int lower_bound(int a[],int key) { int low=0,high=a.length; while(low<high) { int mid=((high-low)/2)+low; if(a[mid]<=key)low=mid+1; else high=mid; } return high; } static int upper_bound(int a[],int key) { int low=0,high=a.length; while(low<high) { int mid=((high-low)/2)+low; if(a[mid]<key)low=mid+1; else high=mid; } return high; } static boolean isPrime (long n) { if (n==2) return true; if (n<2 || n%2==0) return false; double d = Math.sqrt(n); for (int i=3; i<=d; i+=2)if(n%i==0){return false;} return true; } static int upper_division(int a,int b) { if(a%b==0) { return a/b; } else { return a/b+1; } } static long lupper_division(long a,long b) { if(a%b==0) { return a/b; } else { return a/b+1; } } static long lmax(long a,long b) {return Math.max(a, b);} static long lmin(long a,long b) {return Math.min(a, b);} static int[] setArray(int a) { int b[]=new int[a]; for(int i=0;i<a;i++) { b[i]=scan.nextInt(); } return b; } static String reverce(String str) { String strr=""; for(int i=str.length()-1;i>=0;i--) { strr+=str.charAt(i); } return strr; } public static void printArray(int[] b) { for(int i=0;i<b.length-1;i++) { System.out.print(b[i]+" "); } System.out.println(b[b.length-1]); } public static int[][] doublesort(int[][]a) { Arrays.sort(a,(x,y)->Integer.compare(x[0],y[0])); return a; } static long modpow(long x,long n,long mo) { long sum=1; while(n>0) { if((n&1)==1) { sum=sum*x%mo; } x=x*x%mo; n>>=1; } return sum; } public static char[] revch(char ch[]) { char ret[]=new char[ch.length]; for(int i=ch.length-1,j=0;i>=0;i--,j++) { ret[j]=ch[i]; } return ret; } public static int[] revint(int ch[]) { int ret[]=new int[ch.length]; for(int i=ch.length-1,j=0;i>=0;i--,j++) { ret[j]=ch[i]; } return ret; } public static void warshall_floyd(int v[][],int n) { for(int k=0;k<n;k++) for(int i=0;i<n;i++) for(int j=0;j<n;j++) v[i][j]=min(v[i][j],v[i][k]+v[k][j]); } public static void main(String[] args) { String str=scan.next(); int cnt[]=new int [300]; for(int i=0;i<str.length();i++)cnt[str.charAt(i)-'a']++; int cnn=0; for(int i=0;i<300;i++)cnn=max(cnn,cnt[i]); System.out.println(upper_division(str.length()-max,2)); } }
Main.java:186: error: cannot find symbol System.out.println(upper_division(str.length()-max,2)); ^ symbol: variable max location: class Main 1 error
s714091098
p03687
Java
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.Scanner; class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; }else{ ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();} public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while(true){ if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; }else if(b == -1 || !isPrintableChar(b)){ return minus ? -n : n; }else{ throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} } public class Main { static FastScanner scan=new FastScanner(); static Scanner scanner=new Scanner(System.in); static long mod=1000000007; static double eps=0.0000000001; static int big=Integer.MAX_VALUE; static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;} static long lcm (long a, long b) {return a*b/gcd(a,b);} static int max(int a,int b) {return a>b?a:b;} static int min(int a,int b) {return a<b?a:b;} static long factorial(int i) {return i==1?1:i*factorial(i-1);} static int lower_bound(int a[],int key) { int low=0,high=a.length; while(low<high) { int mid=((high-low)/2)+low; if(a[mid]<=key)low=mid+1; else high=mid; } return high; } static int upper_bound(int a[],int key) { int low=0,high=a.length; while(low<high) { int mid=((high-low)/2)+low; if(a[mid]<key)low=mid+1; else high=mid; } return high; } static boolean isPrime (long n) { if (n==2) return true; if (n<2 || n%2==0) return false; double d = Math.sqrt(n); for (int i=3; i<=d; i+=2)if(n%i==0){return false;} return true; } static int upper_division(int a,int b) { if(a%b==0) { return a/b; } else { return a/b+1; } } static long lupper_division(long a,long b) { if(a%b==0) { return a/b; } else { return a/b+1; } } static long lmax(long a,long b) {return Math.max(a, b);} static long lmin(long a,long b) {return Math.min(a, b);} static int[] setArray(int a) { int b[]=new int[a]; for(int i=0;i<a;i++) { b[i]=scan.nextInt(); } return b; } static String reverce(String str) { String strr=""; for(int i=str.length()-1;i>=0;i--) { strr+=str.charAt(i); } return strr; } public static void printArray(int[] b) { for(int i=0;i<b.length-1;i++) { System.out.print(b[i]+" "); } System.out.println(b[b.length-1]); } public static int[][] doublesort(int[][]a) { Arrays.sort(a,(x,y)->Integer.compare(x[0],y[0])); return a; } static long modpow(long x,long n,long mo) { long sum=1; while(n>0) { if((n&1)==1) { sum=sum*x%mo; } x=x*x%mo; n>>=1; } return sum; } public static char[] revch(char ch[]) { char ret[]=new char[ch.length]; for(int i=ch.length-1,j=0;i>=0;i--,j++) { ret[j]=ch[i]; } return ret; } public static int[] revint(int ch[]) { int ret[]=new int[ch.length]; for(int i=ch.length-1,j=0;i>=0;i--,j++) { ret[j]=ch[i]; } return ret; } public static void warshall_floyd(int v[][],int n) { for(int k=0;k<n;k++) for(int i=0;i<n;i++) for(int j=0;j<n;j++) v[i][j]=min(v[i][j],v[i][k]+v[k][j]); } public static void main(String[] args) { String str=scan.next(); int cnt[]=new int [300]; for(int i=0;i<str.length();i++)cnt[str.charAt-'a']++; int cnn=0; for(int i=0;i<300;i++)cnn=max(cnn,cnt[i]); System.out.println(upper_division(str.length-max,2)); } }
Main.java:183: error: cannot find symbol for(int i=0;i<str.length();i++)cnt[str.charAt-'a']++; ^ symbol: variable charAt location: variable str of type String Main.java:186: error: cannot find symbol System.out.println(upper_division(str.length-max,2)); ^ symbol: variable length location: variable str of type String Main.java:186: error: cannot find symbol System.out.println(upper_division(str.length-max,2)); ^ symbol: variable max location: class Main 3 errors
s972197507
p03687
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; string t = "abcdefghijklmnopqrstuvwxyz"; vector<int> b; for(string j : t){ vector<int> a; int count = 0; for(int i = 0; i < s.size(); i++){ if(s.at(i) != j) count++; if(s.at(i) == j){ a.push_back(count); count = 0; } if(i == s.size() - 1){ a.push_back(count); } } sort(a.rbegin(), a.rend()); b.push_back(a.at(0)); } sort(b.begin(), b.end()); cout << b.at(0); }
a.cc: In function 'int main()': a.cc:9:18: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 9 | for(string j : t){ | ^ a.cc:13:18: error: no match for 'operator!=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 13 | if(s.at(i) != j) count++; | ~~~~~~~ ^~ ~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1212: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>&)' 1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1305: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>&)' 1305 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed: a.cc:13:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1473 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed: a.cc:13:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1647 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allo
s234286022
p03687
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; string t = "abcdefghijklmnopqrstuvwxyz"; vector<int> b; for(string j : t){ vector<int> a; int count = 0; for(int i = 0; i < s.size(); s++){ if(s.at(i) != j) count++; if(s.at(i) == j){ a.push_back(count); count = 0; } if(i == s.size() - 1){ a.push_back(count); } } sort(a.rbegin(), a.rend()); b.push_back(a.at(0)); } sort(b.begin(), b.end()); cout << b.at(0); }
a.cc: In function 'int main()': a.cc:9:18: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 9 | for(string j : t){ | ^ a.cc:12:35: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 12 | for(int i = 0; i < s.size(); s++){ | ~^~ a.cc:13:18: error: no match for 'operator!=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 13 | if(s.at(i) != j) count++; | ~~~~~~~ ^~ ~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1212: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>&)' 1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1305: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>&)' 1305 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed: a.cc:13:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1473 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed: a.cc:13:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1647 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:13:21: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 13 | if(s.at(i) != j) count++; | ^ In file included from /usr/inc
s116995537
p03687
Java
// serval // srrva // rrrv // rrr import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); Map<Character, List<Integer>> map = new HashMap<>(); for (int i = 0; i < S.length(); i++) { char c = S.charAt(i); List<Integer> list = map.get(c); if (list == null) { list = new ArrayList(); map.put(c, list); } list.add(i); } int ans = 1000; for (List<Integer> list : map.values()) { int diffMax = 0; int prev = -1; for (int idx : list) { int diff = prev == -1 ? idx : idx-prev-1; diffMax = Math.max(diffMax, diff); prev = idx; } diffMax = Math.max(diffMax, S.length()-list.get(list.length()-1)); ans = Math.min(ans, diffMax); } System.out.println(ans); } }
Main.java:32: error: cannot find symbol diffMax = Math.max(diffMax, S.length()-list.get(list.length()-1)); ^ symbol: method length() location: variable list of type List<Integer> Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s519075378
p03687
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); Map<Character, List<Integer>> map = new HasMap<>(); for (int i = 0; i < S.length(); i++) { char c = S.charAt(i); List<Integer> list = map.get(c); if (list == null) { list = new ArrayList(); map.put(c, list); } list.add(i); } int ans = 1000; for (List<Integer> list : map.values()) { int diffMax = 0; int prev = -1; for (int idx : list) { diffMax = Math.max(diffMax, idx-prev-1); prev = idx; } ans = Math.min(ans, diffMax); } System.out.println(ans); } }
Main.java:7: error: cannot find symbol Map<Character, List<Integer>> map = new HasMap<>(); ^ symbol: class HasMap location: class Main Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s845730156
p03687
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); Map<Character, List<Integer>> map = new HasMap<>(); for (int i = 0; S.length(); i++) { char c = S.charAt(i); List<Integer> list = map.get(c); if (list == null) { list = new ArrayList(); map.put(c, list); } list.add(i); } int ans = 1000; for (List<Integer> list : map.values()) { int diffMax = 0; int prev = -1; for (int idx : list) { diffMax = Math.max(diffMax, idx-prev-1); prev = idx; } ans = Math.min(ans, diffMax); } System.out.println(ans); } }
Main.java:7: error: cannot find symbol Map<Character, List<Integer>> map = new HasMap<>(); ^ symbol: class HasMap location: class Main Main.java:8: error: incompatible types: int cannot be converted to boolean for (int i = 0; S.length(); i++) { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s183874277
p03687
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.nextInt(); Map<Character, List<Integer>> map = new HasMap<>(); for (int i = 0; S.length(); i++) { char c = S.charAt(i); List<Integer> list = map.get(c); if (list == null) { list = new ArrayList(); map.put(c, list); } list.add(i); } int ans = 1000; for (List<Integer> list : map.values()) { int diffMax = 0; int prev = -1; for (int idx : list) { diffMax = Math.max(diffMax, idx-prev-1); prev = idx; } ans = Math.min(ans, diffMax); } System.out.println(ans); } }
Main.java:6: error: incompatible types: int cannot be converted to String String S = sc.nextInt(); ^ Main.java:7: error: cannot find symbol Map<Character, List<Integer>> map = new HasMap<>(); ^ symbol: class HasMap location: class Main Main.java:8: error: incompatible types: int cannot be converted to boolean for (int i = 0; S.length(); i++) { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors
s932957795
p03687
C++
///supercalifragilisticexpialidocious. #include <cstdio> #include <cstring> #include <cmath> #include <cassert> #include <cstdlib> #include <cctype> #include <ctime> #include <iostream> #include <iomanip> #include <sstream> #include <numeric> #include <utility> #include <string> #include <algorithm> #include <vector> #include <map> #include <queue> #include <set> #include <list> #include <bitset> #include <complex> using namespace std; #define f first //#define s second #define PB pop_back #define pb push_back #define mp make_pair #define int long long #define y1 y_golabi #define sz(s) (int)s.size() #define seper(n) setprecision(n) #define all(v) v.begin(),v.end() #define mem(a,b) memset(a,b,sizeof a) #define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); typedef long long ll; typedef map<int , int> mii; typedef pair<int , int> pii; typedef map<string , int> msi; typedef pair<int , string> pis; typedef pair<int , pair<int , int> > piii; int mn = INT_MAX , cnt; string s , t , str; bool is_Same(string s) { for(int i = 0 ; i < sz(s) ; i ++) if(s[i] != s[0]) return false; return true; } int32_t main() { cin >> str; for(char ch = 'a' ; ch <= 'z' ; ch ++) { t = "" , s = str , cnt = 0; while(!is_Same(s)) { t.clear(); for(int i = 0 ; i < sz(s) - 1 ; i ++) if(s[i] == ch or s[i + 1] == ch) t += ch; else t += s[i]; s = t , cnt ++; } mn = min(mn , cnt); } return cout << mn << endl , 0; }
a.cc:42:10: error: 'INT_MAX' was not declared in this scope 42 | int mn = INT_MAX , cnt; | ^~~~~~~ a.cc:23:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 22 | #include <complex> +++ |+#include <climits> 23 | using namespace std; a.cc: In function 'int32_t main()': a.cc:56:36: error: 'cnt' was not declared in this scope; did you mean 'int'? 56 | t = "" , s = str , cnt = 0; | ^~~ | int
s549689651
p03687
C++
include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int ans = s.size(); for (int i = 0; i < s.size(); i++) { char c = s[i]; int cnt=0,temp=0; for (int j = 0; j < s.size(); j++) { if (s[s.size() - j - 1] != c) { cnt++; } else { cnt=0; } temp = max(temp, cnt); } ans = min(ans, temp); } cout << ans << endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include <bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:4:3: error: 'string' was not declared in this scope 4 | string s; | ^~~~~~ a.cc:5:3: error: 'cin' was not declared in this scope 5 | cin >> s; | ^~~ a.cc:5:10: error: 's' was not declared in this scope 5 | cin >> s; | ^ a.cc:17:24: error: 'max' was not declared in this scope 17 | temp = max(temp, cnt); | ^~~ a.cc:19:17: error: 'min' was not declared in this scope; did you mean 'main'? 19 | ans = min(ans, temp); | ^~~ | main a.cc:21:3: error: 'cout' was not declared in this scope 21 | cout << ans << endl; | ^~~~ a.cc:21:18: error: 'endl' was not declared in this scope 21 | cout << ans << endl; | ^~~~
s881183994
p03687
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define co(a) cout<<a<<endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp pop_back() #define V vector #define P pair #define V2(a,b,c) V<V<int>> a(b,V<int>(c)) #define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d)) #define incin(a) int a; cin>>a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) //#define min min<int> //#define max max<int> template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; }*/ bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } struct Union{ vector<int> par; Union(int a){ par= vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); } int lcm(int a,int b){ return a/gcm(a,b)*b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ signed main(){ string a,c; cin>>a; int b=1000000,d,e; for(char i='a';i<'z';i++){ a=c; d=1; e=0; for(int j=0;j<a.sz;j++){ Sort(a); if(a[0]==a[a.sz-1]){ b=min(b,e); break; } if(a[j]==i){ a[j-1]=i; d=0; } if(j==a.sz-1){ if(d) break; else{ d=0; e++; a.pp; } } } } cout<<e<<endl; } #define se second #define co(a) cout<<a<<endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp pop_back() #define V vector #define P pair #define V2(a,b,c) V<V<int>> a(b,V<int>(c)) #define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d)) #define incin(a) int a; cin>>a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) //#define min min<int> //#define max max<int> template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; }*/ bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } struct Union{ vector<int> par; Union(int a){ par= vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); } int lcm(int a,int b){ return a/gcm(a,b)*b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ signed main(){ string a,c; cin>>a; int b=1000000,d,e; for(char i='a';i<'z';i++){ a=c; d=1; e=0; for(int j=0;j<a.sz;j++){ Sort(a); if(a[0]==a[a.sz-1])a{ b=min(b,e); break; } if(a[j]==i){ a[j-1]=i; d=0; } if(j==a.sz-1){ if(d) break; else{ d=0; e++; a.pp; } } } } cout<<e<<endl; }
a.cc:13:9: warning: "fi" redefined 13 | #define fi first | ^~ a.cc:7:9: note: this is the location of the previous definition 7 | #define fi first#include<bits/stdc++.h> | ^~ a.cc:241:7: error: redefinition of 'template<class T> void cou(std::vector<std::vector<_Tp> >)' 241 | void cou(vector<vector<T>> a){ | ^~~ a.cc:31:7: note: 'template<class T> void cou(std::vector<std::vector<_Tp> >)' previously declared here 31 | void cou(vector<vector<T>> a){ | ^~~ a.cc:268:6: error: redefinition of 'long long int wari(long long int, long long int)' 268 | int wari(int a,int b) { | ^~~~ a.cc:58:6: note: 'long long int wari(long long int, long long int)' previously defined here 58 | int wari(int a,int b) { | ^~~~ a.cc:274:6: error: redefinition of 'long long int keta(long long int)' 274 | int keta(int a){ | ^~~~ a.cc:64:6: note: 'long long int keta(long long int)' previously defined here 64 | int keta(int a){ | ^~~~ a.cc:280:6: error: redefinition of 'long long int souwa(long long int)' 280 | int souwa(int a){ | ^~~~~ a.cc:70:6: note: 'long long int souwa(long long int)' previously defined here 70 | int souwa(int a){ | ^~~~~ a.cc:319:7: error: redefinition of 'bool prime(long long int)' 319 | bool prime(int a){ | ^~~~~ a.cc:109:7: note: 'bool prime(long long int)' previously defined here 109 | bool prime(int a){ | ^~~~~ a.cc:334:8: error: redefinition of 'struct Union' 334 | struct Union{ | ^~~~~ a.cc:124:8: note: previous definition of 'struct Union' 124 | struct Union{ | ^~~~~ a.cc:362:5: error: redefinition of 'long long int ketas(long long int)' 362 | int ketas(int a){ | ^~~~~ a.cc:152:5: note: 'long long int ketas(long long int)' previously defined here 152 | int ketas(int a){ | ^~~~~ a.cc:370:5: error: redefinition of 'long long int gcm(long long int, long long int)' 370 | int gcm(int a,int b){ | ^~~ a.cc:160:5: note: 'long long int gcm(long long int, long long int)' previously defined here 160 | int gcm(int a,int b){ | ^~~ a.cc:375:5: error: redefinition of 'long long int lcm(long long int, long long int)' 375 | int lcm(int a,int b){ | ^~~ a.cc:165:5: note: 'long long int lcm(long long int, long long int)' previously defined here 165 | int lcm(int a,int b){ | ^~~ a.cc:403:8: error: redefinition of 'int main()' 403 | signed main(){ | ^~~~ a.cc:193:8: note: 'int main()' previously defined here 193 | signed main(){ | ^~~~ a.cc: In function 'int main()': a.cc:413:41: error: expected ';' before '{' token 413 | if(a[0]==a[a.sz-1])a{ | ^ | ;
s819669014
p03687
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define co(a) cout<<a<<endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp pop_back() #define V vector #define P pair #define V2(a,b,c) V<V<int>> a(b,V<int>(c)) #define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d)) #define incin(a) int a; cin>>a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) //#define min min<int> //#define max max<int> template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; }*/ bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } struct Union{ vector<int> par; Union(int a){ par= vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); } int lcm(int a,int b){ return a/gcm(a,b)*b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ signed main(){ string a,c; cin>>a; int b=1000000,d,e; for(char i='a';i<'z';i++){ a=c; d=1; e=0; for(int j=0;j<a.sz;j++){ Sort(a); if(a[0]==a[a.sz-1])a{ b=min(b,e); break; } if(a[j]==i){ a[j-1]=i; d=0; } if(j==a.sz-1){ if(d) break; else{ d=0; e++; a.pp; } } } } cout<<e<<endl; }
a.cc: In function 'int main()': a.cc:197:41: error: expected ';' before '{' token 197 | if(a[0]==a[a.sz-1])a{ | ^ | ;
s005811679
p03687
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { vector<string> s(100); cin >> s; int ans = 1000; for(char c = 'a'; c <= 'z'; c++) { int t = 0; while(1) { rep(j, s.size()-1) { if(s[j] == c || s[j+1] == c) { s[j] = c; } } s.pop_back(); if(s.size() == 1) { ans = min(ans, t); break; } int k; for(k = 0; k <= s.size()-2; k++) { if(s[k] != s[k+1]) { break; } } if(k == s.size()-1) { ans = min(ans, t); break; } t++; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 13 | cin >> s; | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352
s020773043
p03687
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { vector<string> s; cin >> s; int ans = 1000; for(char c = 'a'; c <= 'z'; c++) { int t = 0; while(1) { rep(j, s.size()-1) { if(s[j] == c || s[j+1] == c) { s[j] = c; } } s.pop_back(); if(s.size() == 1) { ans = min(ans, t); break; } int k; for(k = 0; k <= s.size()-2; k++) { if(s[k] != s[k+1]) { break; } } if(k == s.size()-1) { ans = min(ans, t); break; } t++; } } cout << ans; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 13 | cin >> s; | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352
s289930736
p03687
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { vector<string> s(110); cin >> s; int ans = 1000; for(char c = 'a'; c <= 'z'; c++) { int t = 0; while(1) { rep(j, s.size()-1) { if(s[j] == c || s[j+1] == c) { s[j] = c; } } s.pop_back(); if(s.size() == 1) { ans = min(ans, t); break; } int k; for(k = 0; k <= s.size()-2; k++) { if(s[k] != s[k+1]) { break; } } if(k == s.size()-1) { ans = min(ans, t); break; } t++; } } cout << ans; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 13 | cin >> s; | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352
s755351566
p03687
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { vector<string> s; cin >> s; int ans = 1000; for(char c = 'a'; c <= 'z'; c++) { int t = 0; while(1) { rep(j, s.size()-1) { if(s[j] == c || s[j+1] == c) { s[j] = c; } } s.pop_back(); if(s.size() == 1) { ans = min(ans, t); break; } int k; for(k = 0; k <= s.size()-2; k++) { if(s[k] != s[k+1]) { break; } } if(k == s.size()-1) { ans = min(ans, t); break; } t++; } } cout << ans; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 13 | cin >> s; | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352
s789726717
p03687
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { vector<string> s; cin >> s; int ans = 1000; for(char c = 'a'; c <= 'z'; c++) { int t = 0; while(1) { rep(j, s.size()-1) { if(s[j] == c || s[j+1] == c) { s[j] = c; } } s.pop_back(); if(s.size() == 1) { ans = min(ans, t); break; } int k; for(k = 0; k <= s.size()-2; k++) { if(s[k] != s[k+1]) { break; } } if(k == s.size()-1) { ans = min(ans, t); break; } t++; } } cout << ans; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 13 | cin >> s; | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352
s911327903
p03687
C++
#include <iostream> using namespace std; int main(){ string s;cin>>s; int ret = 1000; for(char i = 'a';'z' >= i; i++){ int mx=0; int nw = 0 for(int j = 0; s.size() > j; j++){ if(s[j]!=i){ nw++; }else{ mx = max(mx,nw); nw = 0; } } ret = min(ret,mx); } cout << ret << endl; }
a.cc: In function 'int main()': a.cc:9:5: error: expected ',' or ';' before 'for' 9 | for(int j = 0; s.size() > j; j++){ | ^~~ a.cc:9:31: error: 'j' was not declared in this scope 9 | for(int j = 0; s.size() > j; j++){ | ^
s793198589
p03687
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main () { string s; cin >> s; int ans = INT_MAX; for (char c = 'a'; c <= 'z'; c++) { int cnt = 0; while (count(s.begin(), s.end(), c) != s.size()) { string ns = ""; rep (j, s.size()-1) { if (s[j] == c || s[j+1] == c) ns += c; else ns += s[i]; } s = ns; cnt++; } ans = min(ans, cnt); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:15:30: error: 'i' was not declared in this scope 15 | else ns += s[i]; | ^
s125007585
p03687
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main () { string s; cin >> s; int ans = INT_MAX; for (char c = 'a'; c <= 'z'; c++) { int cnt = 0; while (count(s.begin(), s.end(), c) != s.size()) { string ns = ""; rep (j, s.size()-1) { if (s[j] == c || s[i+1] == c) ns += c; else ns += s[i]; } s = ns; cnt++; } ans = min(ans, cnt); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:36: error: 'i' was not declared in this scope 14 | if (s[j] == c || s[i+1] == c) ns += c; | ^
s983575378
p03687
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s;cin>>s; int ans=1e9,tmp1=0,tmp0=0; for(int i=0;i<26;i++){ char c='a'+i; tmp1=0;tmp0=0; for(int j=0;j<s.size();j++){ if(s[j]!=c)tmp0++; else{ tmp1=max(tmp1,tmp0);tmp0=0; } } tmp1=max(tmp1,tmp0); } ans=min(ans,tmp1); } cout<<ans<<endl; }
a.cc:20:9: error: 'cout' does not name a type 20 | cout<<ans<<endl; | ^~~~ a.cc:21:1: error: expected declaration before '}' token 21 | } | ^
s525044324
p03687
C++
#include<iostream> #include<cmath> #include<numeric> #include<string> #include<algorithm> #include<vector> #include<map> #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<n;i++) #define int64 long long #define yokuwaruprime (10*10*10*10*10*10*10*10*10+7) using namespace std; int main(){ string s; cin>>s; int l=s.length(),ans=0; for(char moji='a';moji<='z';moji++){ int count=0; rep(i,l){ if(s[i]==moji){ count++; } } if(count!=0){ vector<string> v; rep(i,l){ if(s[i]==moji){ v.push_back(i); } } int maxwidth=max(v[0],l-1-v[count-1]); rep(i,count-1){ maxwidth=max(maxwidth,v[i+1]-v[i]-1); } ans=min(ans,maxwidth); } } cout<<ans; }
a.cc: In function 'int main()': a.cc:29:22: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(int&)' 29 | v.push_back(i); | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from a.cc:6: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:32:32: error: no match for 'operator-' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 32 | int maxwidth=max(v[0],l-1-v[count-1]); In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:32:42: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 32 | int maxwidth=max(v[0],l-1-v[count-1]); | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:32:42: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 32 | int maxwidth=max(v[0],l-1-v[count-1]); | ^ a.cc:34:37: error: no match for 'operator-' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 34 | maxwidth=max(maxwidth,v[i+1]-v[i]-1); /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:34:41: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 34 | maxwidth=max(maxwidth,v[i+1]-v[i]-1); | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:34:41: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 34 | maxwidth=max(maxwidth,v[i+1]-v[i]-1); | ^
s064513112
p03687
C++
#include <bits/stdc++.h> using namespace std; using int64 = long long; #define int int64 constexpr int INF = 1LL<<60; signed main() { string s; cin>>s; vector<int> cnt(26,0); REP(i,s.size()){ // 出現する文字数をカウント ++cnt[s[i]-'a']; } int ans = INF; for(int i=0;i<26;++i){ // 出現しなかった文字はスルー if(!cnt[i]) continue; string cpy_s = s; int cnt = 0; // breakを含んでいるので, 兵庫県警には捕まりません while(true){ // 全ての文字が同じ文字の時はbreak if(string(cpy_s.size(), cpy_s[0])==cpy_s) break; // i文字目かi+1文字目に'a'+iがあれば, それに変更(操作) for(int j=0;j<cpy_s.size();++j){ if(cpy_s[j+1]=='a'+i || cpy_s[j]=='a'+i) cpy_s[j]='a'+i; } // 末尾を削除 cpy_s.pop_back(); ++cnt; } ans = min(ans,cnt); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:10:7: error: 'i' was not declared in this scope 10 | REP(i,s.size()){ | ^ a.cc:10:3: error: 'REP' was not declared in this scope 10 | REP(i,s.size()){ | ^~~
s396904324
p03687
C++
#include <bits/stdc++.h> using namespace std; using int64 = long long; #define int int64 signed main() { string s; cin>>s; vector<int> cnt(26,0); REP(i,s.size()){ // 出現する文字数をカウント ++cnt[s[i]-'a']; } int ans = INF; for(int i=0;i<26;++i){ // 出現しなかった文字はスルー if(!cnt[i]) continue; string cpy_s = s; int cnt = 0; // breakを含んでいるので, 兵庫県警には捕まりません while(true){ // 全ての文字が同じ文字の時はbreak if(string(cpy_s.size(), cpy_s[0])==cpy_s) break; // i文字目かi+1文字目に'a'+iがあれば, それに変更(操作) for(int j=0;j<cpy_s.size();++j){ if(cpy_s[j+1]=='a'+i || cpy_s[j]=='a'+i) cpy_s[j]='a'+i; } // 末尾を削除 cpy_s.pop_back(); ++cnt; } ans = min(ans,cnt); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:9:7: error: 'i' was not declared in this scope 9 | REP(i,s.size()){ | ^ a.cc:9:3: error: 'REP' was not declared in this scope 9 | REP(i,s.size()){ | ^~~ a.cc:14:13: error: 'INF' was not declared in this scope 14 | int ans = INF; | ^~~
s072176603
p03687
C++
//In The Name of Beauty #include <bits/stdc++.h> using namespace std; typedef int ll; typedef vector<ll> vll; #define IB std::ios::sync_with_stdio(0); #define pb(x) push_back(x); #define mp(x,y) make_pair(x,y) #define pll pair<ll,ll> #define F first #define S second ll const MAXN = 1e5 + 8; ll const INF = 1e12 + 8; ll const delta = 1000000007; ll last[30]; int main() { IB; cin.tie(0); cout.tie(0); string s; cin >> s; ll ans = s.size() - 1; for(ll i = 0;i < 30;i++)last[i] = -1; for(ll i = 0;i < 30;i++){ ll temp = 0; for(ll j = 0;j < s.size();j++){ if(s[j] != 'a' + i)continue; if(last[i] == -1)temp = max(temp,j); else temp = max(temp,j - last[i] - 1); last[i] = j; } if(last[i] == -1)continue; temp = max(temp,s.size() - last[i] - 1); ans = min(ans,temp); } cout << ans; return 0; } //Written by M_H_H_7
a.cc:13:22: warning: overflow in conversion from 'double' to 'll' {aka 'int'} changes value from '1.000000000008e+12' to '2147483647' [-Woverflow] 13 | ll const INF = 1e12 + 8; | ~~~~~^~~ a.cc: In function 'int main()': a.cc:34:19: error: no matching function for call to 'max(ll&, std::__cxx11::basic_string<char>::size_type)' 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:34:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:34:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s403160569
p03687
C++
//In The Name of Beauty #include <bits/stdc++.h> using namespace std; typedef int ll; typedef vector<ll> vll; #define IB std::ios::sync_with_stdio(0); #define pb(x) push_back(x); #define mp(x,y) make_pair(x,y) #define pll pair<ll,ll> #define F first #define S second ll const MAXN = 1e5 + 8; ll const INF = 1e12 + 8; ll const delta = 1000000007; ll last[30]; int main() { IB; cin.tie(0); cout.tie(0); string s; cin >> s; ll ans = s.size() - 1; for(ll i = 0;i < 30;i++)last[i] = -1; for(ll i = 0;i < 30;i++){ ll temp = 0; for(ll j = 0;j < s.size();j++){ if(s[j] != 'a' + i)continue; if(last[i] == -1)temp = max(temp,j); else temp = max(temp,j - last[i] - 1); last[i] = j; } if(last[i] == -1)continue; temp = max(temp,s.size() - last[i] - 1); ans = min(ans,temp); } cout << ans; return 0; } //Written by M_H_H_7
a.cc:13:22: warning: overflow in conversion from 'double' to 'll' {aka 'int'} changes value from '1.000000000008e+12' to '2147483647' [-Woverflow] 13 | ll const INF = 1e12 + 8; | ~~~~~^~~ a.cc: In function 'int main()': a.cc:34:19: error: no matching function for call to 'max(ll&, std::__cxx11::basic_string<char>::size_type)' 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:34:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:34:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s933187238
p03687
C++
//In The Name of Beauty #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; #define IB std::ios::sync_with_stdio(0); #define pb(x) push_back(x); #define mp(x,y) make_pair(x,y) #define pll pair<ll,ll> #define F first #define S second ll const MAXN = 1e5 + 8; ll const INF = 1e12 + 8; ll const delta = 1000000007; ll last[30]; int main() { IB; cin.tie(0); cout.tie(0); string s; cin >> s; ll ans = s.size() - 1; for(ll i = 0;i < 30;i++)last[i] = -1; for(ll i = 0;i < 30;i++){ ll temp = 0; for(ll j = 0;j < s.size();j++){ if(s[j] != 'a' + i)continue; if(last[i] == -1)temp = max(temp,j); else temp = max(temp,j - last[i] - 1); last[i] = j; } if(last[i] == -1)continue; temp = max(temp,s.size() - last[i] - 1); ans = min(ans,temp); } cout << ans; return 0; } //Written by M_H_H_7
a.cc: In function 'int main()': a.cc:34:19: error: no matching function for call to 'max(ll&, long long unsigned int)' 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:34:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:34:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | temp = max(temp,s.size() - last[i] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s282779518
p03687
C++
#include <bits/stdc++.h> #define int long long //#define double long double #define endre getchar();getchar();return 0 #define moder (int)(1e9+7) #define inf (int)(3e18+7) #define rep(i,n) for(int i=0;i<n;i++) #define REP(i,n) for(int i=1;i<n;i++) #define P pair<int,int> #define all(v) v.begin(),v.end() #define prique(T) priority_queue<T,vector<T>,greater<T>> #define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end()) using namespace std; int gcd(int x, int y) { if (y == 0)return x; return gcd(y, x%y); } int lcm(int x, int y) { return x * y / gcd(x, y); } int kai(int x) { if (x == 0)return 1; return kai(x - 1)*x; } int mod_pow(int x, int y, int mod) { int res = 1; while (y > 0) { if (y & 1) { res = res * x%mod; } x = x * x%mod; y >>= 1; } return res; } int comb(int x, int y) { return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder; } /*--------Library Zone!--------*/ string s; int a[30], b[30]; signed main() { cin >> s; fill(a, a + 30, -1); rep(i, s.size()) { b[s[i] - 'a'] = max(b[s[i] - 'a'], i - a[s[i] - 'a']); a[s[i] - 'a'] = i; } rep(i, 26) { b[i] = max(b[i], s.size() - a[i]); } int ans = inf; rep(i, 26) { ans = min(ans, b[i] - 1); } cout << ans << endl; endre; }
a.cc: In function 'int main()': a.cc:52:27: error: no matching function for call to 'max(long long int&, long long unsigned int)' 52 | b[i] = max(b[i], s.size() - a[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:52:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 52 | b[i] = max(b[i], s.size() - a[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:52:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 52 | b[i] = max(b[i], s.size() - a[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s393434415
p03687
C++
ソースコード Copy Copy #include<bits/stdc++.h> #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #include<bits/stdc++.h> #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<58; int main(){ string s; cin >> s; set<char> chars; for(ll i = 0; i < s.length(); ++i) chars.insert(s[i]); if(chars.size() == 1){ cout << 0 << endl; return 0; } ll res = 100, times; for(auto key = chars.begin(); key != chars.end(); ++key){ string str = s; bool flag = true; times = 1; while(flag){ string vacant; flag = false; for(ll i = 0; i < str.length()-1; ++i){ // shrink if(str[i] == *key || str[i+1] == *key){ vacant += *key; } else { vacant += str[i]; flag = true; } } if(flag) { str = vacant; times++; } } chmin(res,times); } cout << res << endl; }
a.cc:1:1: error: '\U000030bd\U000030fc\U000030b9\U000030b3\U000030fc\U000030c9' does not name a type 1 | ソースコード | ^~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:5: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__exter
s812576139
p03687
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #include<bits/stdc++.h> #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<58; int main(){ string s; cin >> s; set<char> chars; for(ll i = 0; i < s.length(); ++i) chars.insert(S[i]); if(chars.size() == 1){ cout << 0 << endl; return 0; } ll res = 100, times; for(auto key = chars.begin(); key != chars.end(); ++key){ string str = s; bool flag = true; times = 1; while(flag){ string vacant; flag = false; for(ll i = 0; i < str.length()-1; ++i){ // shrink if (str[i] == *key || str[i+1] == *key){ vacant += *key; } else { vacant += str[i]; flag = true; } } if(flag) { str = vacant; times++; } } chmin(res,times); } cout << res << endl; }
a.cc:50:26: error: extended character   is not valid in an identifier 50 | if (str[i] == *key || str[i+1] == *key){ | ^ a.cc: In function 'int main()': a.cc:32:57: error: 'S' was not declared in this scope 32 | for(ll i = 0; i < s.length(); ++i) chars.insert(S[i]); | ^ a.cc:50:26: error: 'key\U00003000' was not declared in this scope 50 | if (str[i] == *key || str[i+1] == *key){ | ^~~~~
s503264562
p03687
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int c=0; while(true){ map<char,int> m; bool f=true; for(int i=0;i<s.size();i++){ m[s[i]]++; if(i>0){ if(s[i]!=s[i-1]) f=false; } } if(f){ cout<<c; return 0; } string t(s.size()-1,''); for(int i=0;i<s.size()-1;i++){ if(m[s[i]]<m[s[i+1]]) t[i]=s[i+1]; else t[i]=s[i]; } s=t; c++; } }
a.cc:20:25: error: empty character constant 20 | string t(s.size()-1,''); | ^~
s616349171
p03687
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int c=0; while(true){ map<char,int> m; bool f=true; for(int i=0;i<s.size();i++){ m[s[i]]++; if(i>0){ if(s[i]!=s[i-1]) f=false; } } if(f){ cout<<c; return 0; } string t(s.size()-1); for(int i=0;i<s.size()-1;i++){ if(m[s[i]]<m[s[i+1]]) t[i]=s[i+1]; else t[i]=s[i]; } s=t; c++; } }
a.cc: In function 'int main()': a.cc:20:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(std::__cxx11::basic_string<char>::size_type)' 20 | string t(s.size()-1); | ^ In file included 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, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, 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/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = long unsigned int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:20:22: note: cannot convert '(s.std::__cxx11::basic_string<char>::size() - 1)' (type 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) to type 'const char*' 20 | string t(s.size()-1); | ~~~~~~~~^~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/
s262855878
p03687
C++
using System; using System.Linq;//リストの使用 using System.Collections.Generic; using System.Text;//テキストの高速出力に必要 class Program { static void Main() { string s = Console.ReadLine(); string alphabets = "abcdefghijklmnopqrstuvwxyz";//26文字 int n = s.Length; long answer = 1000; long answerMemo = 0; long answerMemoMax = 0; for(int i = 0; i < 26; i++) { for(int j = 0; j < n; j++) { if(s[j] == alphabets[i]) { answerMemoMax = Math.Max(answerMemoMax, answerMemo); answerMemo = 0; }else { answerMemo++; } answerMemoMax = Math.Max(answerMemoMax, answerMemo); } //Console.WriteLine(i + " " +answerMemoMax); answer = Math.Min(answer, answerMemoMax); answerMemo = 0; answerMemoMax = 0; } Console.WriteLine(answer); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq;//リストの使用 | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Collections.Generic; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text;//テキストの高速出力に必要 | ^~~~~~ a.cc:39:2: error: expected ';' after class definition 39 | } | ^ | ; a.cc: In static member function 'static void Program::Main()': a.cc:9:17: error: 'string' was not declared in this scope 9 | string s = Console.ReadLine(); | ^~~~~~ a.cc:10:12: error: expected ';' before 'alphabets' 10 | string alphabets = "abcdefghijklmnopqrstuvwxyz";//26文字 | ^~~~~~~~~ a.cc:11:13: error: 's' was not declared in this scope 11 | int n = s.Length; | ^ a.cc:20:20: error: 'alphabets' was not declared in this scope 20 | if(s[j] == alphabets[i]) | ^~~~~~~~~ a.cc:22:27: error: 'Math' was not declared in this scope 22 | answerMemoMax = Math.Max(answerMemoMax, answerMemo); | ^~~~ a.cc:28:25: error: 'Math' was not declared in this scope 28 | answerMemoMax = Math.Max(answerMemoMax, answerMemo); | ^~~~ a.cc:31:16: error: 'Math' was not declared in this scope 31 | answer = Math.Min(answer, answerMemoMax); | ^~~~ a.cc:37:17: error: 'Console' was not declared in this scope 37 | Console.WriteLine(answer); | ^~~~~~~
s047849951
p03687
C++
#include <bits/stdc++.h> using namespace std; #define uint unsigned int #define llong long long int #define ullong unsigned long long int #define rep(i, n) for (int i = 0; i < n; ++i) const static long long int MOD = 1000000000 + 7; const static int dy[] = {0, 1, 0, -1}; const static int dx[] = {1, 0, -1, 0}; int main(int argc, char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); int ret = 99; for (int i = 0 ; i < 26 ; i ++){ char c = 'a' + i; int pre = -1; int cnt = 0; for (int j = 0 ; j < s.size() ; ++j){ if(s[j] == c){ cnt = max(cnt, j - pre); pre = j; } } cnt = max(cnt ,(int)s.size() - pre); ret = min(ret, cnt - 1); } cout << ret << endl; }
a.cc: In function 'int main(int, char**)': a.cc:20:38: error: 's' was not declared in this scope 20 | for (int j = 0 ; j < s.size() ; ++j){ | ^ a.cc:26:37: error: 's' was not declared in this scope 26 | cnt = max(cnt ,(int)s.size() - pre); | ^
s942913050
p03687
C++
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <iomanip> #include <queue> #include <unordered_map> #include <unordered_set> #include <map> #include <set> using namespace std; #define INF (1ll<<60) long long M = 1000000007; int main(int argc, char const *argv[]) { string s;cin>>s; int n=s.length(); int res = 1<<30; for(int i=0;i<n;++i){ char c = s[i]; int ma = 0,tmp = 0; for(int i=0;i<n;++i){ if(s[i]!=c)tmp++; else tmp = 0; ma = max(ma,tmp); } res = min(ma,res); } cout<<res<<endl; return 0; }#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <iomanip> #include <queue> #include <unordered_map> #include <unordered_set> #include <map> #include <set> using namespace std; #define INF (1ll<<60) long long M = 1000000007; int main(int argc, char const *argv[]) { string s;cin>>s; int n=s.length(); int res = 1<<30; for(int i=0;i<n;++i){ char c = s[i]; int ma = 0,tmp = 0; for(int i=0;i<n;++i){ if(s[i]!=c)tmp++; else tmp = 0; ma = max(ma,tmp); } res = min(ma,res); } cout<<res<<endl; return 0; }
a.cc:36:2: error: stray '#' in program 36 | }#include <cmath> | ^ a.cc:36:3: error: 'include' does not name a type 36 | }#include <cmath> | ^~~~~~~ a.cc:52:11: error: redefinition of 'long long int M' 52 | long long M = 1000000007; | ^ a.cc:17:11: note: 'long long int M' previously defined here 17 | long long M = 1000000007; | ^ a.cc:55:5: error: redefinition of 'int main(int, const char**)' 55 | int main(int argc, char const *argv[]) { | ^~~~ a.cc:20:5: note: 'int main(int, const char**)' previously defined here 20 | int main(int argc, char const *argv[]) { | ^~~~
s053593316
p03687
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int cnt=0,c=0,mi=10000; for(int i=0;i<s.size();i++){ for(int j=0;j<s.size();j++){ if(s[i]==s[j]){ c=max(c,cnt); cnt=0; }else{ cnt++; } } c=max(mc,cnt); cnt=0; mi=min(mc,mi); c=0; } cout<<mi<<endl; }
a.cc: In function 'int main()': a.cc:16:11: error: 'mc' was not declared in this scope; did you mean 'mi'? 16 | c=max(mc,cnt); | ^~ | mi
s223533536
p03687
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int cnt=0,c=0,mi=10000; for(int i=0;i<s.size();i++){ for(int j=0;j<s.size();j++){ if(s[i]==s[j]){ mc=max(c,cnt); cnt=0; }else{ cnt++; } } c=max(mc,cnt); cnt=0; mi=min(mc,mi); c=0; } cout<<mi<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'mc' was not declared in this scope; did you mean 'mi'? 10 | mc=max(c,cnt); | ^~ | mi a.cc:16:11: error: 'mc' was not declared in this scope; did you mean 'mi'? 16 | c=max(mc,cnt); | ^~ | mi
s950789852
p03687
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int cnt=0,c=0,mi=10000; for(int i=0;i<s.size();i++){ for(int j=0;j<s.size();j++){ if(s[i]==s[j]){ mc=max(c,cnt); cnt=0; }else{ cnt++; } } mc=max(mc,cnt); cnt=0; mi=min(mc,mi); c=0; } cout<<mi<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'mc' was not declared in this scope; did you mean 'mi'? 10 | mc=max(c,cnt); | ^~ | mi a.cc:16:5: error: 'mc' was not declared in this scope; did you mean 'mi'? 16 | mc=max(mc,cnt); | ^~ | mi
s890188368
p03687
C++
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type Abbreviation ---------- */ template <typename T> using PQ = priority_queue<T>; template <typename T> using GPQ = priority_queue<T, vector<T>, greater<T>>; using ll = long long; #define fst first #define snd second #define mp make_pair #define mt make_tuple #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) /* ---------- conversion ---------- */ #define INT(c) static_cast<int>(c) #define CHAR(n) static_cast<char>(n) #define LL(n) static_cast<ll>(n) #define DOUBLE(n) static_cast<double>(n) /* ---------- container ---------- */ #define ALL(v) (v).begin(), (v).end() #define SIZE(v) (LL((v).size())) #define FIND(v, k) (v).find(k) != (v).end() #define VFIND(v, k) find(ALL(v), k) != (v).end() #define gsort(b, e) sort(b, e, greater<decltype(*b)>()) /* ----------- debug ---------- */ template <class T> ostream& operator<<(ostream& os, vector<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class T> ostream& operator<<(ostream& os, set<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fst << "," << p.snd << ")"; } /* ---------- Constants ---------- */ // const ll MOD = 1e9 + 7; // const int INF = 1 << 25; // const ll INF = 1LL << 50; // const double PI = acos(-1); // const double EPS = 1e-10; // mt19937 mert(LL(time(0))); /* ---------- Short Functions ---------- */ template <typename T> T sq(T a) { return a * a; } template <typename T> T gcd(T a, T b) { if (a > b) return gcd(b, a); return a == 0 ? b : gcd(b % a, a); } template <typename T, typename U> T mypow(T b, U n) { if (n == 0) return 1; if (n == 1) return b /* % MOD */; if (n % 2 == 0) { return mypow(b * b /* % MOD */, n / 2); } else { return mypow(b, n - 1) * b /* % MOD */; } } ll pcnt(ll b) { return __builtin_popcountll(b); } // const ll dx[4] = {0, -1, 1, 0}; // const ll dy[4] = {-1, 0, 0, 1}; // const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; // const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; char alphabet[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; string A; A = S; int cnt[26] = {}; REP(j, 26) { char c = A[i]; int n = 0; while (0) { string B; REP(i, A.size() - 1) { if (A[i] == c || A[i + 1] == c) { B[i] = c; } else { B[i] = A[i]; } } set<char> st; REP(i,B.size()) st.insert(B[i]); if (st.size() == 1) { cnt[j] = n; break; } else { n++; A = B; } } } sort(cnt, cnt + 26); cout << cnt[0] << endl; return 0; }
a.cc: In function 'int main()': a.cc:146:28: error: 'i' was not declared in this scope 146 | char c = A[i]; | ^
s906332216
p03687
C++
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type Abbreviation ---------- */ template <typename T> using PQ = priority_queue<T>; template <typename T> using GPQ = priority_queue<T, vector<T>, greater<T>>; using ll = long long; #define fst first #define snd second #define mp make_pair #define mt make_tuple #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) /* ---------- conversion ---------- */ #define INT(c) static_cast<int>(c) #define CHAR(n) static_cast<char>(n) #define LL(n) static_cast<ll>(n) #define DOUBLE(n) static_cast<double>(n) /* ---------- container ---------- */ #define ALL(v) (v).begin(), (v).end() #define SIZE(v) (LL((v).size())) #define FIND(v, k) (v).find(k) != (v).end() #define VFIND(v, k) find(ALL(v), k) != (v).end() #define gsort(b, e) sort(b, e, greater<decltype(*b)>()) /* ----------- debug ---------- */ template <class T> ostream& operator<<(ostream& os, vector<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class T> ostream& operator<<(ostream& os, set<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fst << "," << p.snd << ")"; } /* ---------- Constants ---------- */ // const ll MOD = 1e9 + 7; // const int INF = 1 << 25; // const ll INF = 1LL << 50; // const double PI = acos(-1); // const double EPS = 1e-10; // mt19937 mert(LL(time(0))); /* ---------- Short Functions ---------- */ template <typename T> T sq(T a) { return a * a; } template <typename T> T gcd(T a, T b) { if (a > b) return gcd(b, a); return a == 0 ? b : gcd(b % a, a); } template <typename T, typename U> T mypow(T b, U n) { if (n == 0) return 1; if (n == 1) return b /* % MOD */; if (n % 2 == 0) { return mypow(b * b /* % MOD */, n / 2); } else { return mypow(b, n - 1) * b /* % MOD */; } } ll pcnt(ll b) { return __builtin_popcountll(b); } // const ll dx[4] = {0, -1, 1, 0}; // const ll dy[4] = {-1, 0, 0, 1}; // const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; // const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; char alphabet[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; string A; A = S; int cnt[26] = {}; REP(j, 26) { char c = A[i]; int n = 0; while (0) { string B; REP(i, A.size() - 1) { if (A[i] == c || A[i + 1] == c) { B[i] = c; } else { B[i] = A[i]; } } set<char> st; REP(i, N - 1) st.insert(B[i]); if (st.size() == 1) { cnt[j] = n; break; } else { n++; A = B; } } } sort(cnt, cnt + 26); cout << cnt[0] << endl; return 0; }
a.cc: In function 'int main()': a.cc:146:28: error: 'i' was not declared in this scope 146 | char c = A[i]; | ^ a.cc:160:32: error: 'N' was not declared in this scope 160 | REP(i, N - 1) st.insert(B[i]); | ^ a.cc:45:44: note: in definition of macro 'FOR' 45 | #define FOR(i, a, b) for (ll i = (a); i < (b); i++) | ^ a.cc:160:25: note: in expansion of macro 'REP' 160 | REP(i, N - 1) st.insert(B[i]); | ^~~
s514660907
p03687
C++
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type Abbreviation ---------- */ template <typename T> using PQ = priority_queue<T>; template <typename T> using GPQ = priority_queue<T, vector<T>, greater<T>>; using ll = long long; #define fst first #define snd second #define mp make_pair #define mt make_tuple #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) /* ---------- conversion ---------- */ #define INT(c) static_cast<int>(c) #define CHAR(n) static_cast<char>(n) #define LL(n) static_cast<ll>(n) #define DOUBLE(n) static_cast<double>(n) /* ---------- container ---------- */ #define ALL(v) (v).begin(), (v).end() #define SIZE(v) (LL((v).size())) #define FIND(v, k) (v).find(k) != (v).end() #define VFIND(v, k) find(ALL(v), k) != (v).end() #define gsort(b, e) sort(b, e, greater<decltype(*b)>()) /* ----------- debug ---------- */ template <class T> ostream& operator<<(ostream& os, vector<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class T> ostream& operator<<(ostream& os, set<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fst << "," << p.snd << ")"; } /* ---------- Constants ---------- */ // const ll MOD = 1e9 + 7; // const int INF = 1 << 25; // const ll INF = 1LL << 50; // const double PI = acos(-1); // const double EPS = 1e-10; // mt19937 mert(LL(time(0))); /* ---------- Short Functions ---------- */ template <typename T> T sq(T a) { return a * a; } template <typename T> T gcd(T a, T b) { if (a > b) return gcd(b, a); return a == 0 ? b : gcd(b % a, a); } template <typename T, typename U> T mypow(T b, U n) { if (n == 0) return 1; if (n == 1) return b /* % MOD */; if (n % 2 == 0) { return mypow(b * b /* % MOD */, n / 2); } else { return mypow(b, n - 1) * b /* % MOD */; } } ll pcnt(ll b) { return __builtin_popcountll(b); } // const ll dx[4] = {0, -1, 1, 0}; // const ll dy[4] = {-1, 0, 0, 1}; // const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; // const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; string A; A = S; int cnt[26] = {}; REP(j, 26) { char c = A[i]; int n = 0; while (0) { string B; REP(i, A.size() - 1) { if (A[i] == c || A[i + 1] == c) { B[i] = c; } else { B[i] = A[i]; } } set<char> st; REP(i, N - 1) st.insert(B[i]); if (st.size() == 1) { cnt[j] = n; break; } else { n++; A = B; } } } sort(cnt, cnt + 26); cout << cnt[0] << endl; return 0; }
a.cc: In function 'int main()': a.cc:141:31: error: 'a' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:33: error: 'b' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:35: error: 'c' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:37: error: 'd' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:39: error: 'e' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:41: error: 'f' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:43: error: 'g' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:45: error: 'h' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:47: error: 'i' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:49: error: 'j' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:51: error: 'k' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:53: error: 'l' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:55: error: 'm' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:57: error: 'n' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:59: error: 'o' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:61: error: 'p' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:63: error: 'q' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:65: error: 'r' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:67: error: 's' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:69: error: 't' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:71: error: 'u' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:73: error: 'v' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:75: error: 'w' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:77: error: 'x' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:79: error: 'y' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:141:81: error: 'z' was not declared in this scope 141 | char alphabet[26] = { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, }; | ^ a.cc:160:32: error: 'N' was not declared in this scope 160 | REP(i, N - 1) st.insert(B[i]); | ^ a.cc:45:44: note: in definition of macro 'FOR' 45 | #define FOR(i, a, b) for (ll i = (a); i < (b); i++) | ^ a.cc:160:25: note: in expansion of macro 'REP' 160 | REP(i, N - 1) st.insert(B[i]); | ^~~
s004232386
p03687
C++
123
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 123 | ^~~
s836991146
p03687
C++
fsdfsd
a.cc:1:1: error: 'fsdfsd' does not name a type 1 | fsdfsd | ^~~~~~
s754203239
p03687
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main() { string s; cin >> s; int ans = 110; for (char a = 'a'; a <= 'z'; a++) { string t = s, now = ""; for (int i = 0; i < s.size(); i++) { bool flag = true; for (int j = 0; j < t.size() - 1; j++) { if (t[j] != a && t[j + 1] == a)now = now + a; else now = now + t[j]; if (t[j] != a && t[j + 1] != a)flag = false; } if (flag == true) { ans = min(i, ans); //if(ans == s.size() - i)cout << a << endl; break; } t = now, now = ""; } } if (ans == 0)cout << ans << endla; else cout << ans + 1 << endl; }
a.cc: In function 'int main()': a.cc:27:37: error: 'endla' was not declared in this scope 27 | if (ans == 0)cout << ans << endla; | ^~~~~
s655491215
p03687
Java
import java.lang.reflect.Array; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; import java.io.*; public class Noureldin { public static void main(String[] args) throws Exception { IO io; try{ io = new IO("in.in",null); } catch (IOException e) { io = new IO(null,null); } char [] S = io.getNext().toCharArray(); int [] [] pref = new int[S.length][26]; int [] [] suff = new int[S.length][26]; for (char c = 'a';c <= 'z';c++){ int r = 1 << 20; for (int i = 0;i < S.length;i++) { if (c == S[i]) r = 0; pref[i][c - 'a'] = r; r++; } } for (char c = 'a';c <= 'z';c++){ int r = 1 << 20; for (int i = S.length-1;i >= 0;i--) { if (c == S[i]) r = 0; suff[i][c - 'a'] = r; r++; } } int ans = 1 << 20; for (char c = 'a';c <= 'z';c++){ int tmp = 0; for (int i = 0;i < S.length;i++){ int remLen = S.length - tmp; if (i < remLen) tmp = Math.max(tmp,suff[i][c - 'a']); } ans = Math.min(ans,tmp); } io.println(ans); io.close(); } private static final int onebillion7 = 1000000007; } class IO{ private BufferedReader br; private StringTokenizer st; private PrintWriter writer; private String inputFile,outputFile; public boolean hasMore() throws IOException{ if(st != null && st.hasMoreTokens()) return true; if(br != null && br.ready()) return true; return false; } public String getNext() throws FileNotFoundException, IOException{ while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public String getNextLine() throws FileNotFoundException, IOException{ return br.readLine().trim(); } public int getNextInt() throws FileNotFoundException, IOException{ return Integer.parseInt(getNext()); } public long getNextLong() throws FileNotFoundException, IOException{ return Long.parseLong(getNext()); } public void print(double x,int num_digits) throws IOException{ writer.printf("%." + num_digits + "f" ,x); } public void println(double x,int num_digits) throws IOException{ writer.printf("%." + num_digits + "f\n" ,x); } public void print(Object o) throws IOException{ writer.print(o.toString()); } public void println(Object o) throws IOException{ writer.println(o.toString()); } public IO(String x,String y) throws FileNotFoundException, IOException{ inputFile = x; outputFile = y; if(x != null) br = new BufferedReader(new FileReader(inputFile)); else br = new BufferedReader(new InputStreamReader(System.in)); if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile))); else writer = new PrintWriter(new OutputStreamWriter(System.out)); } protected void close() throws IOException{ br.close(); writer.close(); } public void outputArr(Object [] A) throws IOException{ int L = A.length; for (int i = 0;i < L;i++) { if(i > 0) writer.print(" "); writer.print(A[i]); } writer.print("\n"); } }
Main.java:9: error: class Noureldin is public, should be declared in a file named Noureldin.java public class Noureldin { ^ 1 error
s696202114
p03687
C++
#include <bits/stdc++.h> #define INT INT_MAX #define LONG LLONG_MAX #define f(i,n) for(int i=0;i<(n);i++) #define P pair<int,int> typedef long long ll; using namespace std; ll GCD(ll a, ll b) { if (b == 0)return a; return GCD(b, a%b); } ll LCM(ll a, ll b) { return a / GCD(a, b)*b; } ll mypow(ll a, ll b, ll c) { if (b == 0)return 1; if (b % 2)return mypow(a, b - 1, c)*a%c; else return mypow(a, b / 2, c)*mypow(a, b / 2, c) % c; } ll longmax(ll a,ll b){ if(a>b) return a; else return b; } ll longmin(ll a,ll b){ if(a<b) return a; else return b; } signed main(){ string s; map<char,int> m; cin>>s; int ans=INT; for(int j=0;j<26;j++){ int b[a+1],d=0,e=0; f(i,s.size()){ if(s[i]=='a'+j){ b[d]=i; d++; } } b[a]=s.size(); for(int i=a;i>=0;i--){ if(i) b[i]-=b[i-1]+1; e=max(e,b[i]); } ans=min(ans,e); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:40:23: error: 'a' was not declared in this scope 40 | int b[a+1],d=0,e=0; | ^ a.cc:43:33: error: 'b' was not declared in this scope 43 | b[d]=i; | ^ a.cc:47:17: error: 'b' was not declared in this scope 47 | b[a]=s.size(); | ^
s519886670
p03687
C++
#include <bits/stdc++.h> using namespace std; int main() { long n,c=1,r=0; cin>>n; vector<long>v(n); for(int i=0;i<n;i++)cin>>v.at(i); sort(v.begin(),v.end()); for(int i=0;i<n-1;i++){ if(v.at(i)!=v.at(i+1)){ c++; r=(i+1); } } if(n>=3){ if(c==1){ if(v.at(0)==(n-1)||v.at(0)<=n/2){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } } else if(c==2){ if((2*v.at(0)+2)<=(r+n)&&r<=v.at(0)&&v.at(1)!=1){ if(v.at(0)!=1){ cout<<"Yes"<<endl; } else if(v.at(0)==1){ if(v.at(1)==2){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl;        } } else{ cout<<"No"<<endl; } } else{ cout<<"No"<<endl; } } else{ cout<<"No"<<endl; } } else{ if(v.at(0)==v.at(1)&&v.at(1)==1){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } } return 0; }
a.cc:39:25: error: extended character   is not valid in an identifier 39 |        | ^ a.cc:39:25: error: extended character   is not valid in an identifier a.cc:39:25: error: extended character   is not valid in an identifier a.cc:39:25: error: extended character   is not valid in an identifier a.cc:39:25: error: extended character   is not valid in an identifier a.cc:39:25: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:39:25: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope 39 |        | ^~~~~~~~~~~~
s579582560
p03687
Java
****
Main.java:1: error: class, interface, enum, or record expected **** ^ 1 error
s081116486
p03687
C++
#include <bits/stdc++.h> #define int long long #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,m,n) for(int i=m;i<n;i++) #define FORR(i,m,n) for(int i=m;i>=n;i--) #define pb(x) push_back(x) #define SORT(x) sort((x).begin(),(x).end()) #define INF 999999999999 using namespace std; int32_t main(){ string str; cin >> str; int n=str.length(); int m=('z'-'a'); vector<int> memo(26, 0); REP(i, m){ vector<int> v(1, -1); REP(j, n){ if((char)('a'+i) == str[j]){ v.pb(j); } } v.pb(n); REP(j, v.size()-1){ memo[i]=max(memo[i], v[j+1]-v[j]); } } SORT(v); cout << v[0]-1 << endl; }
a.cc: In function 'int32_t main()': a.cc:36:10: error: 'v' was not declared in this scope 36 | SORT(v); | ^ a.cc:9:23: note: in definition of macro 'SORT' 9 | #define SORT(x) sort((x).begin(),(x).end()) | ^
s448647918
p03687
C++
def solve( s , c ): cnt = int(0) while 1 : if len(s) == 0 : return cnt f = True for i in range(len(s)): if s[i] != c: f = False break if f : return cnt s2 = "" for i in range(len(s)-1): if s[i] == c or s[i+1] == c: s2 += c else: s2 += s[i] s = s2 cnt += 1 return cnt; s = input() a = [0 for i in range(26)] for i in range(len(s)): a[ord(s[i])-ord('a')] += 1 ans = 0x7FFFFFFF for i in range(26): if(a[i] > 0 ): ans = min( ans , solve(s, chr( i + ord('a') ) ) ) print(ans)
a.cc:1:1: error: 'def' does not name a type 1 | def solve( s , c ): | ^~~ a.cc:33:1: error: 's' does not name a type 33 | s = input() | ^
s324064129
p03687
C++
#include <bits/stdc++.h> using namespace std; string s; int solve(vector<int> x){ int ret = 0; if (x.empty()) ret = s.size(); else{ for(int i=0;i+1<x.size();i++){ ret = max(ret, x[i+1] - x[i] - 1); } ret = max(ret, x[0]); ret = max(ret, s.size() - x[x.size()-1] - 1); } return ret; } int main(void){ cin >> s; int ans = INT_MAX; for(int i=0;i<26;i++){ vector<int> idx; for(int j=0;j<s.size();j++){ if (s[j]=='a'+i) idx.push_back(j); } ans = min(ans, solve(idx)); } cout << ans << endl; return 0; }
a.cc: In function 'int solve(std::vector<int>)': a.cc:14:14: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 14 | ret = max(ret, s.size() - x[x.size()-1] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 14 | ret = max(ret, s.size() - x[x.size()-1] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | ret = max(ret, s.size() - x[x.size()-1] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s261052797
p03687
C++
#include <iostream> #include <sstream> #include <string> #include <algorithm> using namespace std; int sub(const string& s, char c) { stringstream ss(c + s + c); int mx = 0; string buf; while(getline(ss, buf, c)) { mx = max(mx, buf.size()); } return mx; } int main() { string s; cin >> s; int mn = 1e9; for(char c = 'a'; c <= 'z'; ++c) { mn = min(mn, sub(s, c)); } cout << mn << endl; return 0; }
a.cc: In function 'int sub(const std::string&, char)': a.cc:12:13: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 12 | mx = max(mx, buf.size()); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:12:13: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 12 | mx = max(mx, buf.size()); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 12 | mx = max(mx, buf.size()); | ~~~^~~~~~~~~~~~~~~~
s306134347
p03687
C++
#include "bits/stdc++.h" #include <windows.h> using namespace std; int main(){ string z; cin>>z; int ans=1e9+7; for(int i=0;i<26;i++){ int exflag=1; for(int j=0;j<z.size();j++)if(z[j]!=char('a'+i))exflag=0; if(exflag==1)ans=0;; string s=z; int ssi=s.size(); int flag=1; while(1){ string ns(ssi-1,'0'); for(int k=0;k<ssi;k++){ if(s[k]==char('a'+i)||s[k+1]==char('a'+i)){ ns[k]=('a'+i); }else{ ns[k]='0'; } } ssi--; //cout<<char('a'+i)<<endl; //cout<<s<<endl; //cout<<ssi<<endl; flag=1; for(int j=0;j<ssi;j++)if(ns[j]!=char('a'+i))flag=0; if(flag==1||ssi<=1)break; s=ns; } int aaaa=z.size()-ssi; ans=min(ans,aaaa); } cout<<ans<<endl; return 0; }
a.cc:2:10: fatal error: windows.h: No such file or directory 2 | #include <windows.h> | ^~~~~~~~~~~ compilation terminated.
s717247440
p03687
C++
from collections import Counter s = input() count = Counter(s).most_common() ans = 100 for c,n in count: ss = s cnt = 0 while any(ssi != ss[0] for ssi in ss): ss_new = "" for i in range(len(ss)-1): if ss[i] != c and ss[i+1] == c: ss_new += c else: ss_new += ss[i] ss = ss_new cnt += 1 if cnt < ans: ans = cnt print(ans)
a.cc:1:1: error: 'from' does not name a type 1 | from collections import Counter | ^~~~
s962737942
p03687
Java
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int mi = 200; for (char i = 'a'; i <= 'z'; i++) { int m = 0; String[] ws = s.split("" + i); for (String w : ws) { m = Math.max(m, w.length()); } mi = Math.min(m, mi); } System.out.println(mi); } }
Main.java:3: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s928951661
p03687
C
include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <string.h> char s[100]; char orgS[100]; int shim(char x){ int ans = 101; int L = strlen(s); int check; for (int i=0;i<100;i++){ check = 0; for (int j=0;j<L-1;j++){ if (s[j+1] == x)s[j] = s[j+1]; if (s[j+1] != x&&s[j] !=x){ check++; } } if (check == 0){ ans = i; break; } L--; } for (int i=0;i<100;i++){ s[i]=orgS[i]; } return ans; } int main(){ scanf("%s",s); for (int i=0;i<100;i++){ orgS[i] = s[i]; } int best = 101; for (char x = 'a';x <= 'z';x++){ if (best > shim(x))best = shim(x); } printf("%d\n",best+1); }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^ In file included from main.c:2: /usr/include/stdlib.h:98:8: error: unknown type name 'size_t' 98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; | ^~~~~~ /usr/include/stdlib.h:57:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 56 | #include <bits/floatn.h> +++ |+#include <stddef.h> 57 | /usr/include/stdlib.h:531:25: error: unknown type name 'size_t' 531 | size_t __statelen) __THROW __nonnull ((2)); | ^~~~~~ /usr/include/stdlib.h:531:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:561:25: error: unknown type name 'size_t' 561 | size_t __statelen, | ^~~~~~ /usr/include/stdlib.h:561:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:661:42: error: unknown type name 'size_t' 661 | extern void arc4random_buf (void *__buf, size_t __size) | ^~~~~~ /usr/include/stdlib.h:661:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:672:22: error: unknown type name 'size_t' 672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ | ^~~~~~ /usr/include/stdlib.h:672:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:675:22: error: unknown type name 'size_t' 675 | extern void *calloc (size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:675:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:675:38: error: unknown type name 'size_t' 675 | extern void *calloc (size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:675:38: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:683:36: error: unknown type name 'size_t' 683 | extern void *realloc (void *__ptr, size_t __size) | ^~~~~~ /usr/include/stdlib.h:683:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:695:41: error: unknown type name 'size_t' 695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:695:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:695:57: error: unknown type name 'size_t' 695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:695:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:701:41: error: unknown type name 'size_t' 701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:701:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:701:57: error: unknown type name 'size_t' 701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:701:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/stdlib.h:706: /usr/include/alloca.h:32:22: error: unknown type name 'size_t' 32 | extern void *alloca (size_t __size) __THROW; | ^~~~~~ /usr/include/alloca.h:25:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 24 | #include <stddef.h> +++ |+#include <stddef.h> 25 | /usr/include/stdlib.h:712:22: error: unknown type name 'size_t' 712 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ | ^~~~~~ /usr/include/stdlib.h:712:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:718:45: error: unknown type name 'size_t' 718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:718:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:718:65: error: unknown type name 'size_t' 718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:718:65: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:724:29: error: unknown type name 'size_t' 724 | extern void *aligned_alloc (size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:724:29: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:724:49: error: unknown type name 'size_t' 724 | extern void *aligned_alloc (size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:724:49: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:961:23: error: unknown type name 'size_t' 961 | size_t __nmemb, size_t __size, __compar_fn_t __compar) | ^~~~~~ /usr/include/stdlib.h:961:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:961:39: error: unknown type name 'size_t' 961 | size_t __nmemb, size_t __size, __compar_fn_t __compar) | ^~~~~~ /usr/include/stdlib.h:961:39: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:970:34: error: unknown type name 'size_t' 970 | extern void qsort (void *__base, size_t __nmemb, size_t __size, | ^~~~~~ /usr/include/stdlib.h:970:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:970:50: error: unknown type name 'size_t' 970 | extern void qsort (void *__base, size_t __nmemb, size_t __size, | ^~~~~~ /usr/include/stdlib.h:970:50: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1044:20: error: unknown type name 'size_t' 1044 | size_t __len) __THROW __nonnull ((3, 4, 5)); | ^~~~~~ /usr/include/stdlib.h:1044:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1047:20: error: unknown type name 'size_t' 1047 | size_t __len) __THROW __nonnull ((3, 4, 5)); | ^~~~~~ /usr/include/stdlib.h:1047:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1051:45: error: unknown type name 'size_t' 1051 | char *__restrict __buf, size_t __len) | ^~~~~~ /usr/include/stdlib.h:1051:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1055:45: error: unknown type name 'size_t' 1055 | char *__restrict __buf, size_t __len) | ^~~~~~ /usr/include/stdlib.h:1055:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1062:36: error: unknown type name 'size_t' 1062 | extern int mblen (const char *__s, size_t __n) __THROW; | ^~~~~~ /usr/include/stdlib.h:1062:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1066:48: error: unknown type name 'size_t' 1066 | const char *__restrict __s, size_t __n) __THROW; | ^~~~~~ /usr/include/stdlib.h:1066:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1073:8: error: unknown type name 'size_t' 1073 | extern size_t mbstowcs (wchar_t *__restrict __pwcs, | ^~~~~~ /usr/include/stdlib.h:1073:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1074:53: error: unknown type name 'size_t' 1074 | const char *__restrict __s, size_t __n) __THROW | ^~~~~~ /usr/include/stdlib.h:1074:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1077:8: error: unknown type name 'size_t' 1077 | extern size_t wcstombs (char *__restrict __s, | ^~~~~~ /usr/include/stdlib.h:1077:8: note: 'size_t' is defined in header '<stddef.h>'; this is probab
s021664925
p03687
C++
w#include <bits/stdc++.h> using namespace std; string s; int MIN = 1000; int main() { cin >> s; for(int i = 0; i < 26; i++) { string aa = s; string tmp(aa.size(),'a'+i); int ans = 0; while(true) { if(tmp == aa) break; for(int j = 0; j < aa.size(); j++) { if(aa[j+1] == 'a'+i) aa[j] = aa[j+1]; } aa.pop_back(); tmp.pop_back(); ans++; } MIN = min(MIN,ans); } cout << MIN << endl; }
a.cc:1:2: error: stray '#' in program 1 | w#include <bits/stdc++.h> | ^ a.cc:1:1: error: 'w' does not name a type 1 | w#include <bits/stdc++.h> | ^ a.cc:4:1: error: 'string' does not name a type 4 | string s; | ^~~~~~ a.cc: In function 'int main()': a.cc:7:3: error: 'cin' was not declared in this scope 7 | cin >> s; | ^~~ a.cc:7:10: error: 's' was not declared in this scope 7 | cin >> s; | ^ a.cc:10:5: error: 'string' was not declared in this scope 10 | string aa = s; | ^~~~~~ a.cc:11:11: error: expected ';' before 'tmp' 11 | string tmp(aa.size(),'a'+i); | ^~~~ | ; a.cc:14:10: error: 'tmp' was not declared in this scope 14 | if(tmp == aa) break; | ^~~ a.cc:14:17: error: 'aa' was not declared in this scope 14 | if(tmp == aa) break; | ^~ a.cc:16:26: error: 'aa' was not declared in this scope 16 | for(int j = 0; j < aa.size(); j++) { | ^~ a.cc:19:7: error: 'aa' was not declared in this scope 19 | aa.pop_back(); | ^~ a.cc:20:7: error: 'tmp' was not declared in this scope 20 | tmp.pop_back(); | ^~~ a.cc:23:11: error: 'min' was not declared in this scope; did you mean 'main'? 23 | MIN = min(MIN,ans); | ^~~ | main a.cc:25:3: error: 'cout' was not declared in this scope 25 | cout << MIN << endl; | ^~~~ a.cc:25:18: error: 'endl' was not declared in this scope 25 | cout << MIN << endl; | ^~~~
s076579351
p03687
C++
#include <bits/stdc++.h> char str[110]; char tr[110]; int L; int ans = 1000; int main () { gets (str); L = int (strlen (str)); for (char c = 'a'; c <= 'z'; ++c) { for (int i = 0; i < L; ++i) tr[i] = str[i]; for (int i = 0; i < L; ++i) { for (int j = 0; j < L - i; ++j) if (c != tr[j]) goto con; if (ans > i) ans = i; break; con:; for (int j = 0; j < L - 1 - i; ++j) { if (tr[j] == c || tr[j + 1] == c) tr[j] = c; } } } printf ("%d\n", ans); }
a.cc: In function 'int main()': a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets (str); | ^~~~ | getw
s700224620
p03687
C++
#include <iostream> using namespace std; int calc_max_part(const string& s, char target) { int maxl = 0; for (size_t pos = 0, nextpos;; pos = nextpos + 1) { nextpos = s.find(target, pos); int l; if (nextpos == string::npos) { l = s.size() - pos; } else { l = nextpos - pos; } if (maxl < l) maxl = l; if (nextpos == string::npos) break; } return maxl; } int main(int argc, char *argv[]) { string s; cin >> s; int count[26] = {0}; for (string::iterator c = s.begin(); c != s.end(); ++c) { count[*c - 'a']++; } int minl = INT_MAX; for (char target = 'a'; target <= 'z'; ++target) { if (count[target - 'a'] > 0) { int l = calc_max_part(s, target); minl = (minl < l)? minl : l; } } cout << minl << endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:30:14: error: 'INT_MAX' was not declared in this scope 30 | int minl = INT_MAX; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | using namespace std;
s070684198
p03687
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main (){ string in; cin >> in; int ans = in.size(); for(char c = 'a';c <= 'z';c++){ string temp = in; if(temp.find(c) != string::npos){ int prev = -1; int dist = 0; for(int i = 0;i < temp.size();i++){ if(temp[i] == c){ dist = max(dist,i-prev+1); prev = i; } } dist = max(dist,temp.size()-prev+1); ans = min(ans,dist); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:23: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 22 | dist = max(dist,temp.size()-prev+1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:22:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 22 | dist = max(dist,temp.size()-prev+1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | dist = max(dist,temp.size()-prev+1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s650228940
p03687
C++
#include <assert.h> #include <ctype.h> #include <errno.h> #include <float.h> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <map> #include <ios> #include <iosfwd> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <complex.h> #include <fenv.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> #include <tgmath.h> #include <conio.h> #include <numeric> #include <list> #include <windows.h> #include <cfloat> #include <climits> using namespace std; int ans=1e9; string s; inline bool finish(string cur) { for(int i=1;i<cur.size();i++) if(cur[i]!=cur[i-1]) return 0; return 1; } inline int solve(string cur,char fin) { if(finish(cur)) return (s.size()-cur.size()); for(int i=1;i<cur.size();i++) if(cur[i]==fin) cur[i-1]=fin; cur=cur.substr(0,cur.size()-1); return solve(cur,fin); } int main() { cin>>s; for(int i=1;i<s.size();i++) ans=min(ans,solve(s,s[i])); cout<<ans; return 0; }
a.cc:53:10: fatal error: conio.h: No such file or directory 53 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s221030995
p03687
C++
#include <cstdio> #include <algorithm> #include <cstring> using namespace std; char sir[110]; int main() { //freopen("file.in","r",stdin); //freopen("file.out","w",stdout); gets(sir+1); int l=strlen(sir+1),sol=1e9; for(char i='a';i<='z';i++) { sir[l+1]=i; int c=0,r=0; for(int j=1;j<=l+1;j++) if(sir[j]==i) {r=max(r,c);c=0;} else c++; sol=min(sol,r); } printf("%d",sol); return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 13 | gets(sir+1); | ^~~~ | getw
s298044396
p03687
C++
#include<bits/stdc++.h> using namespace std; const long long INF = 1e7+1; const long long MOD = 1000000007; const long double PI = 3.1415926; #define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++) #define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(x) x.begin(),x.end() #define RALL(x) x.rbegin(),x.rend() typedef long long int ll; typedef vector<ll> vi; typedef vector < pair<ll, ll > > vp; typedef vector <string> vs; typedef vector <char> vc; typedef list <ll> lst; ll n, k, ans = 0, sum = 0, cnt = 0; string s; char c; /*--------------------template--------------------*/ int main() { ans = 100; cin >> s; REP(i, s.size()) { vi v; REP(j, s.size()) { if (s[j] == s[i]) { v.push_back(j); } } sum = 0; sum = max(sum, v[0]); REP(j, v.size() - 1) { sum = max(sum, v[j + 1] - v[j] - 1); } sum = max(sum, (s.size() - 1 - v[v.size() - 1])); ans = min(ans, sum); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:44:26: error: no matching function for call to 'max(ll&, long long unsigned int)' 44 | sum = max(sum, (s.size() - 1 - v[v.size() - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:44:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 44 | sum = max(sum, (s.size() - 1 - v[v.size() - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:44:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 44 | sum = max(sum, (s.size() - 1 - v[v.size() - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s164766401
p03687
C++
#include"vector" #include"cmath" #include"iostream" #include"list" #include"stack" #include "queue" #include"set" #include "unordered_set" #include "map" #include"unordered_map" #include"algorithm" #include "cstring" #include"string" using namespace std; #define all(v) v.begin(),v.end() #define forn(n) for(auto i=n;i<n;++i) typedef long long ll; typedef long double ld; string x;int n; bool solv(int m) { multiset<char>my; for(char ch='a';ch<='z';++ch) { my.clear(); bool a=true; for(int i=0;i<m;++i) { my.insert(x[i]); } for(int i=m;i<n;++i) { if(my.find(ch)==my.end()) { a=false;break; } my.erase(my.find(x[i-m])); my.insert(x[i]); } if(my.find(ch)==my.end()) { a=false; } if(a)return true; } return false; } class TaskA { public: void solve(std::istream& cin, std::ostream& cout) { ios_base::sync_with_stdio(false); cin>>x; n=x.length(); int l=0,h=n,m; while(l<h-1) { m=(l+h)/2; if(solv(m)) { h=m; } else { l=m; } } cout<<h-1<<'\n'; } };
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s991282733
p03687
C++
#include <iostream> #include <string> #include <limits> int main() { int min = INT_MAX, nrMax = INT_MAX; std::string str; std::getline(std::cin, str); for (int i = 0; i < 26; ++i) { int nr = 0; bool flag = false, flag2 = true; for (int j = 0; j < str.length(); ++j) if (str[j] != 'a' + i) flag = true; for (int j = 0; j < str.length(); ++j) if (str[j] == 'a' + i) flag2 = false; if (flag2) continue; if (!flag) { std::cout << 0; return 0; } std::string str2 = str; while (flag) { bool flag3 = false; for (int j = 0; j < str.length() - nr; ++j) { if (str2[j] == 'a' + i && j != 0 && str2[std::max(j - 1, 0)] != 'a' + i) { str2[j - 1] = 'a' + i; flag3 = true; } // getch(); } ++nr; flag = false; for (int j = 0; j < str.length() - nr; ++j) if (str2[j] != 'a' + i) flag = true; // std::cout << str2 << " "; } if (nr < nrMax) nrMax = nr; } std::cout << nrMax; }
a.cc: In function 'int main()': a.cc:8:19: error: 'INT_MAX' was not declared in this scope 8 | int min = INT_MAX, nrMax = INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <limits> +++ |+#include <climits> 4 | a.cc:59:26: error: 'nrMax' was not declared in this scope 59 | if (nr < nrMax) | ^~~~~ a.cc:63:22: error: 'nrMax' was not declared in this scope 63 | std::cout << nrMax; | ^~~~~
s769550353
p03687
C++
#include <iostream> #include <string> #include <limits> #include <conio.h> int main() { int min = INT_MAX, nrMax = INT_MAX; std::string str; std::getline(std::cin, str); for (int i = 0; i < 26; ++i) { int nr = 0; bool flag = false, flag2 = true; for (int j = 0; j < str.length(); ++j) if (str[j] != 'a' + i) flag = true; for (int j = 0; j < str.length(); ++j) if (str[j] == 'a' + i) flag2 = false; if (flag2) continue; if (!flag) { std::cout << 0; return 0; } std::string str2 = str; while (flag) { bool flag3 = false; for (int j = 0; j < str.length() - nr; ++j) { if (str2[j] == 'a' + i && j != 0 && str2[std::max(j - 1, 0)] != 'a' + i) { str2[j - 1] = 'a' + i; flag3 = true; } // getch(); } ++nr; flag = false; for (int j = 0; j < str.length() - nr; ++j) if (str2[j] != 'a' + i) flag = true; // std::cout << str2 << " "; } if (nr < nrMax) nrMax = nr; } std::cout << nrMax; }
a.cc:4:10: fatal error: conio.h: No such file or directory 4 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s153859580
p03687
C++
#include<cstdio> #include<cstring> #include<vector> #include<algorithm> using namespace std; int main(void) { vector<char> s(100+2); while(scanf("%100[a-z]\n", &s[0])==1) { int l=strlen(&s[0]); vector<char> t(l+1), t_(l+1); int c, ans; ans=l; for(int i=0;i<l;i++) { if(s[i]!=s[0]) break; } if(i==l) ans=0; t=s; for(int i=0;i<l;i++) { int x=s[i]; t_=s; for(int l_=l;l_>1;l_--) { c=0; t=t_; for(int j=0;j<l_-1;j++) { if(t[j]==x) { t_[j]=x; c++; } else if(t[j+1]==x) { t_[j]=x; c++; } else { t_[j]=t[j]; } } t[l_-1]='\0'; if(c>=l_-1) { ans=min(ans, l-l_+1); break; } } } printf("%d\n", ans); } return 0; }
a.cc: In function 'int main()': a.cc:25:20: error: 'i' was not declared in this scope 25 | if(i==l) ans=0; | ^
s107086634
p03687
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespace std; char s[150]; int qm[150],maxn=0,m[150],numm=0; int ans[150],anss=999999; bool eend=1,end=1; int work(int i) { for(int j=1;j<=strlen(s+1);j++) if(s[j]!=s[j+1]) eend=0; if(eend==1) { ans[i]=0; return ans[i]; } else { for(int k=1;k<=strlen(s+1);k++) { if(s[k]==m[i] || s[k+1]==m[i]) s[k]=m[i]; if(s[k]!=m[i] && k!=strlen(s+1)) end=0; } if(end==0) { ans[i]++; work(i); } if(end==1) { ans[i]++; return ans[i]; } } } int main() { scanf("%s",s+1); for(int i=1;i<=strlen(s+1);i++) for(int j=i+1;j<=strlen(s+1);j++) if(s[i]==s[j]) qm[(int)s[i]]++; for(int i=97;i<=122;i++) if(qm[i]>maxn) maxn=qm[i]; for(int i=97;i<=122;i++) if(qm[i]==maxn) m[++numm]=i; for(int i=1;i<=numm;i++) work(i); for(int i=1;i<=numm;i++) if(ans[i]<anss) anss=ans[i]; printf("%d",anss); return 0; }
a.cc: In function 'int work(int)': a.cc:30:33: error: reference to 'end' is ambiguous 30 | end=0; | ^~~ In file included from /usr/include/c++/14/string:53, 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/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/14/bits/range_access.h:36: /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:11:13: note: 'bool end' 11 | bool eend=1,end=1; | ^~~ a.cc:32:20: error: reference to 'end' is ambiguous 32 | if(end==0) | ^~~ /usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:11:13: note: 'bool end' 11 | bool eend=1,end=1; | ^~~ a.cc:37:20: error: reference to 'end' is ambiguous 37 | if(end==1) | ^~~ /usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept; | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:11:13: note: 'bool end' 11 | bool eend=1,end=1; | ^~~ a.cc:43:1: warning: control reaches end of non-void function [-Wreturn-type] 43 | } | ^
s316515852
p03687
C++
#include<bits/stdc++.h> using namespace std; const long long INF = 1e7+1; const long long MOD = 1000000007; const long double PI = 3.1415926; #define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++) #define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(x) x.begin(),x.end() #define RALL(x) x.rbegin(),x.rend() typedef long long int ll; typedef vector<ll> vi; typedef vector < pair<ll, ll > > vp; typedef vector <string> vs; typedef vector <char> vc; typedef list <ll> lst; ll n, k, ans = 0, sum = 0, cnt = 0; string s; char c; /*--------------------template--------------------*/ ll a[50] = { 0 }; int main() { cin >> s; vi vll, vans, vv; vc v; REP(i, s.size()) { v.push_back(s[i]); ll b = v[i] - 97; a[b]++; } REP(i, 26) { ans = max(ans, a[i]); } if (ans == 1) { cout << (s.size()) / 2 << endl; return 0; } REP(i, 26) { if (a[i] == ans) { vll.push_back(i); } } REP(i, vll.size()) { cnt = 0; ll q[50] = { 0 }; REP(j, v.size()) { if (vll[i] + 97 == v[j]) { q[cnt] = j; cnt++; } } /*REP(t, cnt) { cout << q[t] << endl; }*/ sum = q[0]; REP(t, cnt) { ll z = q[t + 1] - q[t] - 1; sum = max(sum, z); } sum = max(sum, s.size() - q[cnt - 1]); vv.push_back(sum); } sort(ALL(vv)); cout << vv[0] << endl; }
a.cc: In function 'int main()': a.cc:73:26: error: no matching function for call to 'max(ll&, long long unsigned int)' 73 | sum = max(sum, s.size() - q[cnt - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:73:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 73 | sum = max(sum, s.size() - q[cnt - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:73:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 73 | sum = max(sum, s.size() - q[cnt - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
s181190069
p03687
C++
#include<iostream> using namespace std; #include<map> #include<vector> int main(){ string s; cin>>s; int b; int c; int m=0; int ans=101; for(int i=-0;i<s.size();i++){ mp[s[i]]++; } int bb=0; for(auto &el:mp){ if(bb<el.second){ bb=el.second; } } if(bb<2){ cout<<bb<<endl; return 0; } for(int i=0;i<s.size();i++){ char x=s[i]; b=0; c=0; int j; for(j=0;j<s.size();j++){ if(b=0&&s[j]==x){ b=j; }else if(s[j]==x){ c=j; m=max(m,c-b-1); b=c; } } ans=min(ans,m); } int ansa=m/3; if(m%3!=0)ansa++; cout<<ansa<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: 'mp' was not declared in this scope; did you mean 'm'? 17 | mp[s[i]]++; | ^~ | m a.cc:21:22: error: 'mp' was not declared in this scope; did you mean 'm'? 21 | for(auto &el:mp){ | ^~ | m
s483375779
p03687
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define PB push_back #define MP make_pair #define FI first #define SE second static const int INF = 1ll<<60; typedef pair<int,int> P1; typedef pair<int,pair<int,int> > P2; string s; int ans = INF; vector<int> v[26]; signed main(){ cin>>s; for(int i=0;i<s.size();++i)v[s[i]-'a'].PB(i + 1); for(int i = 0;i<26;++i){ if(v[i].size()){ int res = 0; for(int j=0;j<v[i].size();++j){ int length; if(j == 0)length = v[i][j] - 1; else length = v[i][j] - v[i][j-1] - 1; res = max(res,length); } res = max(res,s.size()-v[i][v[i].size() -1]); ans = min(ans,res); } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:28:22: error: no matching function for call to 'max(long long int&, long long unsigned int)' 28 | res = max(res,s.size()-v[i][v[i].size() -1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 28 | res = max(res,s.size()-v[i][v[i].size() -1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | res = max(res,s.size()-v[i][v[i].size() -1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s603130739
p03687
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define PB push_back #define MP make_pair #define FI first #define SE second static const int INF = 1ll<<60; typedef pair<int,int> P1; typedef pair<int,pair<int,int> > P2; string s; int ans = INF; vector<int> v[26]; signed main(){ cin>>s; for(int i=0;i<s.size();++i)v[s[i]-'a'].PB(i + 1); for(int i = 0;i<26;++i){ if(v[i].size()){ int res = 0; for(int j=0;j<v[i].size();++j){ int length; if(j == 0)length = v[i][j] - 1; else length = v[i][j] - v[i][j-1] - 1; res = max(res,length); } res = max(res,s.size()-v[i][v[i].size() -1]); ans = min(ans,res); } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:28:22: error: no matching function for call to 'max(long long int&, long long unsigned int)' 28 | res = max(res,s.size()-v[i][v[i].size() -1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 28 | res = max(res,s.size()-v[i][v[i].size() -1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | res = max(res,s.size()-v[i][v[i].size() -1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s240268236
p03687
C++
#include <bits\stdc++.h> using namespace std; #define long long ll; bool checkStr(const string &str, const char c) { for (int i=0; i<(int)str.length(); i++) { if (c != str[i]) return false; } return true; } void replaceChar(string &str, const char c) { string t=""; for (int i=0; i<(int)str.length()-1; i++) { if (str[i] == c || str[i+1] == c) { t += c; } else { t += str[i]; } } str = t; } int main() { string s; cin >> s; int min=100; for (int i=0; i<(int)s.length(); i++) { int ans=0; string tmp = s; while(!checkStr(tmp, s[i])) { //cout << tmp << endl; replaceChar(tmp, s[i]); ans++; } min = (min>ans)?ans:min; } cout << min << endl; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s733906503
p03687
C++
#include<stdio.h> #include<string.h> struct{ char c; int time[100],max,k; }temp[30]; int main () { int i; char s[105]; while(gets(s)){for(i=0;i<26;i++){ temp[i].c='a'+i; temp[i].time[0]=0; temp[i].max=0; temp[i].k=1; } int len=0,j; len=strlen(s); for(i=0;i<len;i++) for(j=0;j<26;j++){ if(s[i]==temp[j].c){ temp[j].time[temp[j].k]=i+1; temp[j].k++; break; } } for(i=0;i<26;i++) temp[i].time[temp[i].k]=len+1; for(i=0;i<26;i++) for(j=1;j<=temp[i].k;j++){ if(temp[i].max<(temp[i].time[j]-temp[i].time[j-1])) temp[i].max=temp[i].time[j]-temp[i].time[j-1]; } int answer; answer=temp[0].max; for(i=0;i<26;i++) if(answer>temp[i].max) answer= temp[i].max; printf("%d\n",answer-1); } }
a.cc: In function 'int main()': a.cc:12:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 12 | while(gets(s)){for(i=0;i<26;i++){ | ^~~~ | getw
s723031677
p03687
C++
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<vector> #include<cstdlib>5 #include<string> #include<algorithm> #define LL long long #define INF 1000000009 using namespace std; int main() { char s[1000]; int vis[30]; for(int i=0;i<29;i++) vis[i]=INF; gets(s); int len=strlen(s); int ans=len/2; //printf("%d\n",ans); for(int i=0;i<26;i++) { int a=-1; for(int j=0;j<len;j++) { if(s[j]-'a'==i||j==len-1) { int b=0; if(j==len-1&&s[j]-'a'!=i) b=1; if(vis[i]==INF) vis[i]=j-a-1+b; else vis[i]=max(vis[i],j-a-1+b); a=j; // printf("vis[%c]=%d\n",i+'a',vis[i]); } } } for(int i=0;i<26;i++) { ans=min(ans,vis[i]); } printf("%d\n",ans); }
a.cc:7:18: warning: extra tokens at end of #include directive 7 | #include<cstdlib>5 | ^ a.cc: In function 'int main()': a.cc:19:4: error: 'gets' was not declared in this scope; did you mean 'getw'? 19 | gets(s); | ^~~~ | getw
s978429360
p03687
C++
#include <iostream> #include <fstream> #include <cstdio> #include <cassert> #include <complex> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <cstdlib> #include <cstring> #include <iomanip> #include <numeric> #include <sstream> #include <ctime> #include <cctype> #include <set> #include <map> #include <queue> #include <bitset> #include <deque> #include <stack> #include <memory.h> #include <_mingw.h> using namespace std; #define ll long long int use[26]; bool p[26]; string s; bool check(string d){ char o=d[0]; for(int i=0;i<d.size();i++){ if(d[i]!=o){ return 0; } } return 1; } int main() { cin>>s; for(int i=0;i<s.size();i++){ use[s[i]-'a']++; } int mx=-999,maxd=0,maxh=0; for(int i=0;i<26;i++){ if(max(mx,use[i])==use[i]){ mx=use[i]; maxd=i; //cout<<maxd<<" "; } } p[maxd]=1; char mai=maxd+'a'; /*for(int i=0;i<26;i++){ cout<<use[i]<<" "; }*/ //cout<<mai<<" "; if(s[0]==mai){ for(int i=0;i<26;i++){ if(max(mx,use[i])==use[i]){ maxd=i; break; } } } mai=maxd+'a'; int cnt=0; while(!check(s)){ bool ok=0; bool ok1=0; cnt++; for(int i=1;i<s.size()-1;i++){ if(s[i]!=mai&&s[i+1]!=mai&&s[i-1]!=mai){ s.erase(i,1); ok=1; break; } } if(!ok){ for(int i=1;i<s.size()-1;i++){ if(s[i]!=mai){ s.erase(i,1); ok1=1; break; } } } if(!ok1){ if(s[0]==mai){ s.erase(s.size()-1,1); } else s.erase(0,1); } for(int i=0;i<s.size();i++){ if(s[i+1]==mai){ s[i]=mai; } } } cout<<cnt; return 0; }
a.cc:24:10: fatal error: _mingw.h: No such file or directory 24 | #include <_mingw.h> | ^~~~~~~~~~ compilation terminated.
s886907468
p03687
Java
/** * Created by yoshiwaratomohiro on 2017/06/18. */ import java.util.Scanner; public class Agc16A { public static void main(String[] args){ Scanner scan = new Scanner(System.in); String s = scan.next(); int[] snum = new int[s.length()]; for(int i=0;i<s.length();i++){ snum[i]=s.charAt(i)-'a'; } int min=10000; for(int i=0;i<26;i++){ int[] ans = new int[s.length()]; for(int j=0;j<s.length();j++){ ans[j]=i; } int s_[] = new int[s.length()]; for(int j=0;j<s.length();j++){ s_[j]=snum[j]; } inside: for(int j=0;j<s.length();j++){ for(int k=0;k<s_.length;k++){ if(s_[k]!=i){ break; } if(k==s_.length-1){ min=Math.min(min,j); break inside; } } int[] conv=new int[s.length()-j-1]; for(int k=1;k<s.length()-j;k++){ if(s_[k-1]==i||s_[k]==i){ conv[k-1]=i; }else{ conv[k-1]=s_[k-1]; } } s_=new int[s.length()-j-1]; for(int k=0;k<s.length()-j-1;k++){ s_[k]=conv[k]; } } } System.out.println(min); } }
Main.java:5: error: class Agc16A is public, should be declared in a file named Agc16A.java public class Agc16A { ^ 1 error
s795808975
p03687
C++
/** * Created by yoshiwaratomohiro on 2017/06/18. */ import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scan = new Scanner(System.in); String s = scan.next(); int[] snum = new int[s.length()]; for(int i=0;i<s.length();i++){ snum[i]=s.charAt(i)-'a'; } int min=10000; for(int i=0;i<26;i++){ int[] ans = new int[s.length()]; for(int j=0;j<s.length();j++){ ans[j]=i; } int s_[] = new int[s.length()]; for(int j=0;j<s.length();j++){ s_[j]=snum[j]; } inside: for(int j=0;j<s.length();j++){ for(int k=0;k<s_.length;k++){ if(s_[k]!=i){ break; } if(k==s_.length-1){ min=Math.min(min,j); break inside; } } int[] conv=new int[s.length()-j-1]; for(int k=1;k<s.length()-j;k++){ if(s_[k-1]==i||s_[k]==i){ conv[k-1]=i; }else{ conv[k-1]=s_[k-1]; } } s_=new int[s.length()-j-1]; for(int k=0;k<s.length()-j-1;k++){ s_[k]=conv[k]; } } } System.out.println(min); } }
a.cc:4:1: error: 'import' does not name a type 4 | import java.util.Scanner; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s602100256
p03687
C++
#define _USE_MATH_DEFINES #include<iostream> #include <math.h> #include <algorithm> #include <vector> #include <queue> #include <string> using namespace std; /* sample input */ int n; string str; int main() { cin >> str; int len = str.length(); int count = 0; int answer = INT_MAX; for (int i = 0; i < 26; i++){ count = 0; int tmax = 0; for (int j = 0; j < len; j++){ if (str[j] != char('a' + i)){ count++; tmax = max(tmax, count); } else{ count = 0; } } answer = min(tmax, answer); } cout << answer; return 0; }
a.cc: In function 'int main()': a.cc:22:22: error: 'INT_MAX' was not declared in this scope 22 | int answer = INT_MAX; | ^~~~~~~ a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 6 | #include <queue> +++ |+#include <climits> 7 | #include <string>
s237004010
p03687
C++
A = input() B = [] for i in range(len(A)): B.append( max([len(x) for x in A.split(A[i])])) print(min(B))
a.cc:1:1: error: 'A' does not name a type 1 | A = input() | ^
s479370811
p03687
C++
import org.omg.CORBA.MARSHAL; import java.util.*; public class Main { //-------------------------------------------------------------// public static final void main(String[] args) { new Main().solve(); } //-------------------------------------------------------------// private final Scanner sc = new Scanner(System.in); void solve() { char[] s = sc.next().toCharArray(); Set<Character> set = new HashSet<>(); for (int i = 0; i < s.length; i++) { set.add(s[i]); } int ans = Integer.MAX_VALUE; for (char c = 'a'; c <= 'z'; c++) { if (set.contains(c)) { int count = 0; int maxCount = 0; for (int i = 0; i < s.length; i++) { if (s[i] != c) count++; if (s[i] == c) { maxCount = Math.max(maxCount, count); count = 0; } } maxCount = Math.max(maxCount, count); ans = Math.min(ans, maxCount); } } System.out.println(ans); } }
a.cc:1:1: error: 'import' does not name a type 1 | import org.omg.CORBA.MARSHAL; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s547878294
p03687
C++
#include<bist/stdc++.h> using namespace std; int a[29]; int main() { int c=0,i; string s; cin>>s; for(i=0;i<s.length();i++) { if(a[s[i]-'a']!=1) { a[s[i]-'a']==1; c++; } } cout<<c/2<<endl;
a.cc:1:9: fatal error: bist/stdc++.h: No such file or directory 1 | #include<bist/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s761508892
p03687
Java
import org.omg.PortableServer.POA; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Stress { BufferedReader br; StringTokenizer sc; PrintWriter out; public static void main(String[] args) throws IOException { Locale.setDefault(Locale.US); new Stress().run(); } void run() throws IOException { try { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); // br = new BufferedReader(new FileReader("field.in")); // out = new PrintWriter(new File("field.out")); solve(); out.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } String nextToken() throws IOException { while (sc == null || !sc.hasMoreTokens()) { try { sc = new StringTokenizer(br.readLine()); } catch (Exception e) { return null; } } return sc.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } void solve() throws IOException { char c[] = nextToken().toCharArray(); int n = c.length; int gMax = Integer.MAX_VALUE; for (int i = 0; i < 26; i++) { int max = 0; int cnt = 0; for (int j = 0; j < n; j++) { if(c[j] - 'a' != i){ cnt++; }else{ max = Math.max(max, cnt); cnt = 0; } } if(cnt <= max){ gMax = Math.min(gMax, max); } } out.print(gMax); } }
Main.java:8: error: class Stress is public, should be declared in a file named Stress.java public class Stress { ^ Main.java:1: error: package org.omg.PortableServer does not exist import org.omg.PortableServer.POA; ^ 2 errors
s283346096
p03687
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(in, out); out.close(); } } class Task { public void solve(InputReader in, PrintWriter out) { String str = in.next(); int ans = Integer.MAX_VALUE; for (char ch : str.toCharArray()) { String s = str; int cnt = 0; while (true) { boolean go = false; for (int i = 0; i < s.length(); i++) if (s.charAt(i) != ch) { go = true; break; } if (!go) break; cnt++; StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length() - 1; i++) { if (s.charAt(i) == ch || s.charAt(i + 1) == ch) { sb.append(ch); } else { sb.append(s.charAt(i)); } } s = sb.toString(); } ans = Math.min(ans, cnt); } out.println(ans); } } class InputReader { private final BufferedReader reader; private StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public String nextLine() { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(nextLine()); } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } }
Main.java:10: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s754633321
p03687
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(ll i=a;i<b;i++) #define re(i,b) for(ll i=0;i<b;i++) #define repr(i,n) for(ll i=n-1;i>=0;i--) #define ll long long #define ld long double #define llu long long unsigned #define vll std::vector<ll> #define mll std::map<ll, ll> #define pll std::pair<ll, ll> #define mpll std::map<pair<ll,ll>, ll> #define sll std::set<ll> #define ff first #define ss second #define msll std::multiset<ll> #define all(c) c.begin(), c.end() #define allr(c) c.rbegin(), c.rend() #define srt(x) sort(all(x)) #define rsrt(x) sort(allr(x)) #define mp make_pair #define mt make_tuple #define eb emplace_back #define pb push_back #define s(yy) ll yy;cin>>yy #define mod 1e9+7 #define maxlong 1e18+5 /* ###################################################### # # # @author # # Parth Lathiya # # https://www.cse.iitb.ac.in/~parthiitb/ # # # ###################################################### */ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifdef PARTH_LATHIYA_HOME freopen("A_in.txt","r",stdin); ll ttt,bkkk; cin>>ttt; bkkk=ttt; while(ttt--) { cout<<"Testcase - "<<bkkk-ttt<<"\n"; #endif //-------------------------------------------------------------------------------------- // whbrjpjyhsrywlqjxdbrbaomnw string s; cin>>s; ll prev[26]; ll ma[26]; re(i,26){ prev[i]=-1; ma[i]=-1; } re(i,s.length()){ ma[s[i]-'a']=max(ma[s[i]-'a'],i-prev[s[i]-'a']-1); prev[s[i]-'a']=i; } re(i,26) { ma[s[i]-'a']=max(ma[s[i]-'a'],s.length()-prev[s[i]-'a']-1); } ll ans=101; re(i,26) if(ma[i]!=-1)ans=min(ans,ma[i]); cout<<ans; //-------------------------------------------------------------------------------------- #ifdef PARTH_LATHIYA_HOME cout<<"\n"; } #endif return 0; }
a.cc: In function 'int main()': a.cc:76:33: error: no matching function for call to 'max(long long int&, long long unsigned int)' 76 | ma[s[i]-'a']=max(ma[s[i]-'a'],s.length()-prev[s[i]-'a']-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:76:33: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 76 | ma[s[i]-'a']=max(ma[s[i]-'a'],s.length()-prev[s[i]-'a']-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:76:33: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 76 | ma[s[i]-'a']=max(ma[s[i]-'a'],s.length()-prev[s[i]-'a']-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s643312511
p03687
Java
import java.io.*; import java.util.*; import java.text.*; import java.math.*; public class main { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter pw = new PrintWriter(System.out); public static String line; public static StringTokenizer st; public static ArrayList<ArrayList<Integer>> adjList; public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1}; public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1}; public static int INF = 0x3f3f3f3f; public static long LINF = 0x3f3f3f3f3f3f3f3fL; public static int MOD = 1000000007; public static void main(String[] args) throws Exception{ String s = br.readLine(); TreeSet<Character> d = new TreeSet<Character>(); for(int i = 0; i < s.length(); i++){ d.add(s.charAt(i)); } int best = INF; if(d.size() == 1){ best = 0; } for(Character t : d){ boolean f = true; char[] A = s.toCharArray(); int ans = 0; while(f){ f = false; char[] B = new char[A.length-1]; for(int i = 0; i < B.length; i++){ if(A[i] == t || A[i+1] == t){ B[i] = t; } else{ B[i] = A[i]; f = true; } } ans++; A = B; } best = Math.min(best, ans); } pw.print(best + "\n"); pw.close(); br.close(); } }
Main.java:6: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s972050898
p03687
C++
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define MP make_pair #define MT make_tuple #define EACH(i,c) for(auto i: c) #define SORT(c) sort((c).begin(),(c).end()) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; map<char, int> m; EACH(c, S) m[c]++; int ret = 0, d = 0; char pre = 0; EACH(a, m){ if(pre != a) d++; ret = max(ret, a.second); pre = a; } // cout << S.size() << " " << ret << endl; cout << (S.size() - ret + 1) / max(2, ret - d) << endl; return 0; }
a.cc: In function 'int main()': a.cc:59:24: error: no match for 'operator!=' (operand types are 'char' and 'std::pair<const char, int>') 59 | if(pre != a) d++; | ~~~ ^~ ~ | | | | char std::pair<const char, int> In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/vector:62, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::pair<_T1, _T2>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'char' 59 | if(pre != a) d++; | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'char' 59 | if(pre != a) d++; | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'char' 59 | if(pre != a) d++; | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/vector:63: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_Tp1>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::allocator<_Tp1>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:2096:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2096 | operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2096:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/vector:87: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::tuple<_UTypes ...>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/list:65, from a.cc:2: /usr/include/c++/14/bits/stl_list.h:2196:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const __cxx11::list<_Tp, _Alloc>&, const __cxx11::list<_Tp, _Alloc>&)' 2196 | operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_list.h:2196:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::__cxx11::list<_Tp, _Alloc>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/map:63, from a.cc:3: /usr/include/c++/14/bits/stl_map.h:1557:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)' 1557 | operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:1557:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::map<_Key, _Tp, _Compare, _Allocator>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/map:64: /usr/include/c++/14/bits/stl_multimap.h:1179:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)' 1179 | operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_multimap.h:1179:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::multimap<_Key, _Tp, _Compare, _Allocator>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/set:63, from a.cc:4: /usr/include/c++/14/bits/stl_set.h:1032:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator!=(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)' 1032 | operator!=(const set<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_set.h:1032:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::set<_Key, _Compare, _Allocator>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/set:64: /usr/include/c++/14/bits/stl_multiset.h:1018:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator!=(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)' 1018 | operator!=(const multiset<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_multiset.h:1018:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::multiset<_Key, _Compare, _Allocator>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/deque:66, from a.cc:5: /usr/include/c++/14/bits/stl_deque.h:2342:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)' 2342 | operator!=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_deque.h:2342:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::deque<_Tp, _Alloc>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/stack:63, from a.cc:6: /usr/include/c++/14/bits/stl_stack.h:380:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator!=(const stack<_Tp, _Seq>&, const stack<_Tp, _Seq>&)' 380 | operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_stack.h:380:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::stack<_Tp, _Seq>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/include/c++/14/queue:66, from a.cc:7: /usr/include/c++/14/bits/stl_queue.h:404:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator!=(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)' 404 | operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:404:5: note: template argument deduction/substitution failed: a.cc:59:27: note: mismatched types 'const std::queue<_Tp, _Seq>' and 'char' 59 | if(pre != a) d++; | ^ In file included from /usr/in
s082219353
p03687
C++
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <limits> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 int main() { string s; cin>>s; ll n = s.sz; ll mn = 10000000; rep(i,0,26){ char c = 'a'+i; string s1 = s; ll e = 0; rep(j,0,n-1){ ll flag = 1; rep(k,0,s1.sz){ if(s1[k]!=c)flag = 0; } if(flag == 1){ mn = min(mn,e); break; } string s2; rep(k,0,s1.sz-1){ if(s1[k]==c||s1[k+1]==c){ s2 += ctos(c); } else{ s2 += "+"; } } s1 = s2; e++; } } cout << mn << endl; return 0; }#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <limits> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 int main() { string s; cin>>s; ll n = s.sz; ll mn = 10000000; rep(i,0,26){ char c = 'a'+i; string s1 = s; ll e = 0; rep(j,0,n-1){ ll flag = 1; rep(k,0,s1.sz){ if(s1[k]!=c)flag = 0; } if(flag == 1){ mn = min(mn,e); break; } string s2; rep(k,0,s1.sz-1){ if(s1[k]==c||s1[k+1]==c){ s2 += ctos(c); } else{ s2 += "+"; } } s1 = s2; e++; } } cout << mn << endl; return 0; }
a.cc:73:2: error: stray '#' in program 73 | }#include <algorithm> | ^ a.cc:73:3: error: 'include' does not name a type 73 | }#include <algorithm> | ^~~~~~~ a.cc:112:5: error: redefinition of 'int main()' 112 | int main() { | ^~~~ a.cc:40:5: note: 'int main()' previously defined here 40 | int main() { | ^~~~
s569605911
p03687
C++
using namespace std; #define fo(i,a,b) for(int i=(a);i<(b);i++) #define MP make_pair #define PB push_back #define SZ(a) ((int)a.size()) typedef long long ll; int mn = 110; string s; int main () { cin >> s; for (char i = 'a'; i <= 'z'; i++) { int mx = 0, l = 0; for (int j = 0; j < SZ(s); j++) { if (s[j] == i) { mx = max(mx, j-l); l = j+1; } } mx = max(mx, SZ(s)-l); mn = min(mn, mx); //printf("%c %d\n", i, mx); } printf("%d\n", mn); return 0; }
a.cc:9:1: error: 'string' does not name a type 9 | string s; | ^~~~~~ a.cc: In function 'int main()': a.cc:12:9: error: 'cin' was not declared in this scope 12 | cin >> s; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:12:16: error: 's' was not declared in this scope 12 | cin >> s; | ^ a.cc:17:38: error: 'max' was not declared in this scope; did you mean 'mx'? 17 | mx = max(mx, j-l); | ^~~ | mx a.cc:21:22: error: 'max' was not declared in this scope; did you mean 'mx'? 21 | mx = max(mx, SZ(s)-l); | ^~~ | mx a.cc:22:22: error: 'min' was not declared in this scope; did you mean 'mn'? 22 | mn = min(mn, mx); | ^~~ | mn a.cc:25:9: error: 'printf' was not declared in this scope 25 | printf("%d\n", mn); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | using namespace std;
s090159187
p03687
Java
import java.awt.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; import static java.lang.Math.max; import static java.lang.Math.min; public class A implements Runnable{ // SOLUTION!!! // HACK ME PLEASE IF YOU CAN!!! // PLEASE!!! // PLEASE!!! // PLEASE!!! private final static Random rnd = new Random(); private final static String fileName = ""; private void solve() { char[] s = readCharArray(); int answer = s.length; for (char letter = 'a'; letter <= 'z'; ++letter) { char[] x = s.clone(); int result = 0; while (x.length > 0 && !check(x, letter)) { ++result; x = change(x, letter); } if (check(x, letter)) { answer = Math.min(result, answer); } } out.println(answer); } boolean check(char[] s, char letter) { for (char ch : s) if (ch != letter) return false; return true; } char[] change(char[] s, char letter) { char[] t = new char[s.length - 1]; for (int i = 0; i < t.length; ++i) { if (s[i + 1] == letter) { t[i] = letter; } else { t[i] = s[i]; } } return t; } ///////////////////////////////////////////////////////////////////// private final static boolean FIRST_INPUT_STRING = true; private final static boolean MULTIPLE_TESTS = true; private final boolean ONLINE_JUDGE = !new File("input.txt").exists(); private final static int MAX_STACK_SIZE = 128; private final static boolean OPTIMIZE_READ_NUMBERS = false; ///////////////////////////////////////////////////////////////////// public void run(){ try{ timeInit(); Locale.setDefault(Locale.US); init(); if (ONLINE_JUDGE) { solve(); } else { do { try { timeInit(); solve(); time(); out.println(); } catch (NumberFormatException e) { break; } catch (NullPointerException e) { if (FIRST_INPUT_STRING) break; else throw e; } } while (MULTIPLE_TESTS); } out.close(); time(); }catch (Exception e){ e.printStackTrace(System.err); System.exit(-1); } } ///////////////////////////////////////////////////////////////////// private BufferedReader in; private OutputWriter out; private StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args){ new Thread(null, new A(), "", MAX_STACK_SIZE * (1L << 20)).start(); } ///////////////////////////////////////////////////////////////////// private void init() throws FileNotFoundException{ Locale.setDefault(Locale.US); if (ONLINE_JUDGE){ if (fileName.isEmpty()) { in = new BufferedReader(new InputStreamReader(System.in)); out = new OutputWriter(System.out); } else { in = new BufferedReader(new FileReader(fileName + ".in")); out = new OutputWriter(fileName + ".out"); } }else{ in = new BufferedReader(new FileReader("input.txt")); out = new OutputWriter("output.txt"); } } //////////////////////////////////////////////////////////////// private long timeBegin; private void timeInit() { this.timeBegin = System.currentTimeMillis(); } private void time(){ long timeEnd = System.currentTimeMillis(); System.err.println("Time = " + (timeEnd - timeBegin)); } private void debug(Object... objects){ if (ONLINE_JUDGE){ for (Object o: objects){ System.err.println(o.toString()); } } } ///////////////////////////////////////////////////////////////////// private String delim = " "; private String readLine() { try { return in.readLine(); } catch (IOException e) { throw new RuntimeIOException(e); } } private String readString() { try { while(!tok.hasMoreTokens()){ tok = new StringTokenizer(readLine()); } return tok.nextToken(delim); } catch (NullPointerException e) { return null; } } ///////////////////////////////////////////////////////////////// private final char NOT_A_SYMBOL = '\0'; private char readChar() { try { int intValue = in.read(); if (intValue == -1){ return NOT_A_SYMBOL; } return (char) intValue; } catch (IOException e) { throw new RuntimeIOException(e); } } private char[] readCharArray() { return readLine().toCharArray(); } private char[][] readCharField(int rowsCount) { char[][] field = new char[rowsCount][]; for (int row = 0; row < rowsCount; ++row) { field[row] = readCharArray(); } return field; } ///////////////////////////////////////////////////////////////// private long optimizedReadLong() { int sign = 1; long result = 0; boolean started = false; while (true) { try { int j = in.read(); if (-1 == j) { if (started) return sign * result; throw new NumberFormatException(); } if (j == '-') { if (started) throw new NumberFormatException(); sign = -sign; } if ('0' <= j && j <= '9') { result = result * 10 + j - '0'; started = true; } else if (started) { return sign * result; } } catch (IOException e) { throw new RuntimeIOException(e); } } } private int readInt() { if (!OPTIMIZE_READ_NUMBERS) { return Integer.parseInt(readString()); } else { return (int) optimizedReadLong(); } } private int[] readIntArray(int size) { int[] array = new int[size]; for (int index = 0; index < size; ++index){ array[index] = readInt(); } return array; } private int[] readSortedIntArray(int size) { Integer[] array = new Integer[size]; for (int index = 0; index < size; ++index) { array[index] = readInt(); } Arrays.sort(array); int[] sortedArray = new int[size]; for (int index = 0; index < size; ++index) { sortedArray[index] = array[index]; } return sortedArray; } private int[] readIntArrayWithDecrease(int size) { int[] array = readIntArray(size); for (int i = 0; i < size; ++i) { array[i]--; } return array; } /////////////////////////////////////////////////////////////////// private int[][] readIntMatrix(int rowsCount, int columnsCount) { int[][] matrix = new int[rowsCount][]; for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) { matrix[rowIndex] = readIntArray(columnsCount); } return matrix; } private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) { int[][] matrix = new int[rowsCount][]; for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) { matrix[rowIndex] = readIntArrayWithDecrease(columnsCount); } return matrix; } /////////////////////////////////////////////////////////////////// private long readLong() { if (!OPTIMIZE_READ_NUMBERS) { return Long.parseLong(readString()); } else { return optimizedReadLong(); } } private long[] readLongArray(int size) { long[] array = new long[size]; for (int index = 0; index < size; ++index){ array[index] = readLong(); } return array; } //////////////////////////////////////////////////////////////////// private double readDouble() { return Double.parseDouble(readString()); } private double[] readDoubleArray(int size) { double[] array = new double[size]; for (int index = 0; index < size; ++index){ array[index] = readDouble(); } return array; } //////////////////////////////////////////////////////////////////// private BigInteger readBigInteger() { return new BigInteger(readString()); } private BigDecimal readBigDecimal() { return new BigDecimal(readString()); } ///////////////////////////////////////////////////////////////////// private Point readPoint() { int x = readInt(); int y = readInt(); return new Point(x, y); } private Point[] readPointArray(int size) { Point[] array = new Point[size]; for (int index = 0; index < size; ++index){ array[index] = readPoint(); } return array; } ///////////////////////////////////////////////////////////////////// @Deprecated private List<Integer>[] readGraph(int vertexNumber, int edgeNumber) { @SuppressWarnings("unchecked") List<Integer>[] graph = new List[vertexNumber]; for (int index = 0; index < vertexNumber; ++index){ graph[index] = new ArrayList<>(); } while (edgeNumber-- > 0){ int from = readInt() - 1; int to = readInt() - 1; graph[from].add(to); graph[to].add(from); } return graph; } private static class GraphBuilder { final int size; final List<Integer>[] edges; static GraphBuilder createInstance(int size) { List<Integer>[] edges = new List[size]; for (int v = 0; v < size; ++v) { edges[v] = new ArrayList<>(); } return new GraphBuilder(edges); } private GraphBuilder(List<Integer>[] edges) { this.size = edges.length; this.edges = edges; } public void addEdge(int from, int to) { addDirectedEdge(from, to); addDirectedEdge(to, from); } public void addDirectedEdge(int from, int to) { edges[from].add(to); } public int[][] build() { int[][] graph = new int[size][]; for (int v = 0; v < size; ++v) { List<Integer> vEdges = edges[v]; graph[v] = castInt(vEdges); } return graph; } } ///////////////////////////////////////////////////////////////////// private static class IntIndexPair { static Comparator<IntIndexPair> increaseComparator = new Comparator<A.IntIndexPair>() { @Override public int compare(A.IntIndexPair indexPair1, A.IntIndexPair indexPair2) { int value1 = indexPair1.value; int value2 = indexPair2.value; if (value1 != value2) return value1 - value2; int index1 = indexPair1.index; int index2 = indexPair2.index; return index1 - index2; } }; static Comparator<IntIndexPair> decreaseComparator = new Comparator<A.IntIndexPair>() { @Override public int compare(A.IntIndexPair indexPair1, A.IntIndexPair indexPair2) { int value1 = indexPair1.value; int value2 = indexPair2.value; if (value1 != value2) return -(value1 - value2); int index1 = indexPair1.index; int index2 = indexPair2.index; return index1 - index2; } }; static IntIndexPair[] from(int[] array) { IntIndexPair[] iip = new IntIndexPair[array.length]; for (int i = 0; i < array.length; ++i) { iip[i] = new IntIndexPair(array[i], i); } return iip; } int value, index; IntIndexPair(int value, int index) { super(); this.value = value; this.index = index; } int getRealIndex() { return index + 1; } } private IntIndexPair[] readIntIndexArray(int size) { IntIndexPair[] array = new IntIndexPair[size]; for (int index = 0; index < size; ++index) { array[index] = new IntIndexPair(readInt(), index); } return array; } ///////////////////////////////////////////////////////////////////// private static class OutputWriter extends PrintWriter { final int DEFAULT_PRECISION = 12; private int precision; private String format, formatWithSpace; { precision = DEFAULT_PRECISION; format = createFormat(precision); formatWithSpace = format + " "; } OutputWriter(OutputStream out) { super(out); } OutputWriter(String fileName) throws FileNotFoundException { super(fileName); } int getPrecision() { return precision; } void setPrecision(int precision) { precision = max(0, precision); this.precision = precision; format = createFormat(precision); formatWithSpace = format + " "; } String createFormat(int precision){ return "%." + precision + "f"; } @Override public void print(double d){ printf(format, d); } void printWithSpace(double d){ printf(formatWithSpace, d); } void printAll(double...d){ for (int i = 0; i < d.length - 1; ++i){ printWithSpace(d[i]); } print(d[d.length - 1]); } @Override public void println(double d){ printlnAll(d); } void printlnAll(double... d){ printAll(d); println(); } } ///////////////////////////////////////////////////////////////////// private static class RuntimeIOException extends RuntimeException { /** * */ private static final long serialVersionUID = -6463830523020118289L; RuntimeIOException(Throwable cause) { super(cause); } } ///////////////////////////////////////////////////////////////////// //////////////// Some useful constants and functions //////////////// ///////////////////////////////////////////////////////////////////// private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; private static final int[][] steps8 = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {-1, -1}, {1, 1}, {1, -1}, {-1, 1} }; private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) { return checkIndex(row, rowsCount) && checkIndex(column, columnsCount); } private static boolean checkIndex(int index, int lim){ return (0 <= index && index < lim); } ///////////////////////////////////////////////////////////////////// private static boolean checkBit(int mask, int bit){ return (mask & (1 << bit)) != 0; } private static boolean checkBit(long mask, int bit){ return (mask & (1L << bit)) != 0; } ///////////////////////////////////////////////////////////////////// private static long getSum(int[] array) { long sum = 0; for (int value: array) { sum += value; } return sum; } private static Point getMinMax(int[] array) { int min = array[0]; int max = array[0]; for (int index = 0, size = array.length; index < size; ++index, ++index) { int value = array[index]; if (index == size - 1) { min = min(min, value); max = max(max, value); } else { int otherValue = array[index + 1]; if (value <= otherValue) { min = min(min, value); max = max(max, otherValue); } else { min = min(min, otherValue); max = max(max, value); } } } return new Point(min, max); } ///////////////////////////////////////////////////////////////////// private static int[] getPrimes(int n) { boolean[] used = new boolean[n]; used[0] = used[1] = true; int size = 0; for (int i = 2; i < n; ++i) { if (!used[i]) { ++size; for (int j = 2 * i; j < n; j += i) { used[j] = true; } } } int[] primes = new int[size]; for (int i = 0, cur = 0; i < n; ++i) { if (!used[i]) { primes[cur++] = i; } } return primes; } ///////////////////////////////////////////////////////////////////// int[] getDivisors(int value) { List<Integer> divisors = new ArrayList<>(); for (int divisor = 1; divisor * divisor <= value; ++divisor) { if (value % divisor == 0) { divisors.add(divisor); if (divisor * divisor != value) { divisors.add(value / divisor); } } } return castInt(divisors); } ///////////////////////////////////////////////////////////////////// private static long lcm(long a, long b) { return a / gcd(a, b) * b; } private static long gcd(long a, long b) { return (a == 0 ? b : gcd(b % a, a)); } ///////////////////////////////////////////////////////////////////// private static class MultiSet<ValueType> { public static <ValueType> MultiSet<ValueType> createMultiSet() { Map<ValueType, Integer> multiset = new HashMap<>(); return new MultiSet<>(multiset); } private final Map<ValueType, Integer> multiset; private int size; public MultiSet(Map<ValueType, Integer> multiset) { this.multiset = multiset; this.size = 0; } public int size() { return size; } public void inc(ValueType value) { int count = get(value); multiset.put(value, count + 1); ++size; } public void dec(ValueType value) { int count = get(value); if (count == 0) return; if (count == 1) multiset.remove(value); else multiset.put(value, count - 1); --size; } public int get(ValueType value) { Integer count = multiset.get(value); return (count == null ? 0 : count); } } ///////////////////////////////////////////////////////////////////// private static class IdMap<KeyType> extends HashMap<KeyType, Integer> { /** * */ private static final long serialVersionUID = -3793737771950984481L; public IdMap() { super(); } int getId(KeyType key) { Integer id = super.get(key); if (id == null) { super.put(key, id = size()); } return id; } } ///////////////////////////////////////////////////////////////////// private static int[] castInt(List<Integer> list) { int[] array = new int[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.get(i); } return array; } private static long[] castLong(List<Long> list) { long[] array = new long[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.get(i); } return array; } ///////////////////////////////////////////////////////////////////// /** * Generates list with values 0..<n * @param n - exclusive limit of sequence */ private static List<Integer> order(int n) { List<Integer> sequence = new ArrayList<>(); for (int i = 0; i < n; ++i) { sequence.add(i); } return sequence; } }
Main.java:12: error: class A is public, should be declared in a file named A.java public class A implements Runnable{ ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s733744129
p03688
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define REP(i,n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define debug(var) do{cout << #var << " : "; view(var);}while(0) template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;} template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;} using namespace std; template<class T> void view(T e) {cout << e << endl;} template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;} template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}} using vint = vector<int>; using vvint = vector<vector<int>>; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using P = pair<int,int>; const int inf = 1e9; const ll inf_l = 1e18; const int MAX = 1e5; int main() { int n; cin >> n; vint a(n); rep(i,n) cin >> a[i]; bool ans = false; int mx = *max_element(all(a)); int mn = *min_element(all(a)); if (mx - mn == 1) { int ct_mx = 0, ct_mn = 0; rep(i,n) { if (a[i] == mx) ct_mx++; else ct_mn++; } if (ct_mn <= k && n + ct_mn >= 2 * mx) ans = true; } if (mx - mn == 0) { if (mx + 1 == n || n >= 2 * mx) ans = true; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:36:22: error: 'k' was not declared in this scope 36 | if (ct_mn <= k && n + ct_mn >= 2 * mx) ans = true; | ^
s623471276
p03688
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++){ cin >> a[i]; } sort(a.begin(), a.end()); if (a[N - 1] - a[0] > 1){ cout << "No" << endl; } else if (a[0] == a[N - 1]){ if (a[0] * 2 <= N || a[0] == N - 1){ cout << "Yes" << endl; } else { cout << "No" << endl; } } else { if (a[0] == a[a[0]]){ cout << "No" << endl; } else if (a[N - 2] != a[N - 1]{ cout << "No" << endl; } else { assert(false); } } }
a.cc: In function 'int main()': a.cc:22:36: error: expected ')' before '{' token 22 | } else if (a[N - 2] != a[N - 1]{ | ~ ^ | ) a.cc:27:3: error: expected primary-expression before '}' token 27 | } | ^
s349307785
p03688
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <tuple> #include <utility> #include <vector> #define ll long long #define double long double #define itn int #define endl '\n' #define co(ans) cout<<ans<<endl #define COYE cout<<"YES"<<endl #define COYe cout<<"Yes"<<endl #define COye cout<<"yes"<<endl #define CONO cout<<"NO"<<endl #define CONo cout<<"No"<<endl #define COno cout<<"no"<<endl #define FORE(i,a) for(auto &i:a) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define PB push_back #define MP make_pair #define ALL(V) (V).begin(),(V).end() #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i) #define INF ((1LL<<62)-(1LL<<31)) #define EPS 1e-10 #define PI 3.141592653589793238 #define MOD 1000000007 #define MAX 5100000 using namespace std; using Graph=vector<vector<int>>; inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;} template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();} template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0}; ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} int main(){ int N; cin>>N; vectro<int> L; REP(i,N){ int a; cin>>a; L.PB(a); } SORT(L); bool CAN=true; if(L.at(N-1)==L.at(0)){ if(L.at(0)!=N-1) CAN=false; } else if(L.at(N-1)==L.at(0)+1){ if(L.at(N-2)==L.at(0)) CAN=false; } else CAN=false; if(CAN) COYe; else CONo; return 0; }
a.cc: In function 'int main()': a.cc:72:3: error: 'vectro' was not declared in this scope 72 | vectro<int> L; | ^~~~~~ a.cc:72:10: error: expected primary-expression before 'int' 72 | vectro<int> L; | ^~~ a.cc:76:5: error: 'L' was not declared in this scope 76 | L.PB(a); | ^ a.cc:78:8: error: 'L' was not declared in this scope 78 | SORT(L); | ^ a.cc:46:23: note: in definition of macro 'SORT' 46 | #define SORT(V) sort((V).begin(),(V).end()) | ^
s150441314
p03688
C++
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; constexpr int MOD = 1000000007; constexpr int INF = numeric_limits<int>::max() / 2; typedef pair<int,int> P; using Graph = vector<vector<int>>; signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int N; cin >> N; int A[N]; bool ok = true; rep(i,N){ cin >> A[i]; } sort(A, A+N); if(N == 2){ rep(i,N){ if(A[i] != 1){ ok = false; } } } else if(N == 3){ for(int i=1;i<N;i++){ if(A[i] != 2){ ok = false; } } } else{ if(A[0] == A[N-1]){ if(A[0] == N-1){ cout << "Yes" << endl; return 0; } else if(N/A[0] == 1){ cout << "No" << endl; return 0; } else{ cout << "Yes" << endl; return 0; } } else{ if(A[N-1] - A[0] >= 2){ cout << "No" << endl; reutrn 0; } for(int i=1;i<N;i++){ if(A[i] != A[i-1]){ if(i == A[i-1]){ cout << "Yes" << endl; return 0; } else{ cout << "No" << endl; return 0; } } } } } cout << (ok ? "Yes" : "No") << endl; }
a.cc: In function 'int main()': a.cc:55:33: error: 'reutrn' was not declared in this scope 55 | reutrn 0; | ^~~~~~
s371311077
p03688
C++
#include<bits/stdc++.h> #include<unordered_set> #include<unordered_map> #include <algorithm> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (ll)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; using vc = vector<char>; using vvc = vector<vc>; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } ll dx[4]={0,1,0,-1}; ll dy[4]={1,0,-1,0}; int main(){ ll n; cin>>n; vll a(n); set<ll> s; rep(i,n){ cin>>a[i]; s.insert(a[i]); } if(sz(s)>2){ COUT("No"); return 0; } else if(sz(s)==1){ ll cu=a[0]; if(cu*2<=n||n==cu+1){ COUT("Yes"); return 0; } else{ COUT("No"); return 0; } } else{ ll cu=*rbegin(s); ll j=*begin(); if(cu!=j+1){ COUT("No"); return 0; } ll m=0; rep(i,n){ if(a[i]!=cu) m++; } if(m>=cu){ COUT("No"); return 0; } if(m+(cu-m)*2<=n){ COUT("Yes"); return 0; } else{ COUT("No"); return 0; } } }
a.cc: In function 'int main()': a.cc:75:16: error: no matching function for call to 'begin()' 75 | ll j=*begin(); | ~~~~~^~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)' 88 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/14/initializer_list:88:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:52:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 95 | begin(_Tp (&__arr)[_Nm]) noexcept | ^~~~~ /usr/include/c++/14/bits/range_access.h:95:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)' 1227 | begin(valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1227:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1238:5: note: candidate expects 1 argument, 0 provided
s786885504
p03688
C++
#include <bits/stdc++.h> #include <cstdlib> #include <cmath> #define rep(i,n) for (long long i=0; i < (n); ++i) #define rep2(i,n,m) for(long long i=n;i<=m;i++) #define rep3(i,n,m) for(long long i=n;i>=m;i--) using namespace std; using ll = long long; using P = pair<int,int>; using graph= vector<vector<int>>; const ll INF=1e18 ; inline void chmax(ll& a,ll b){a=max(a,b);} inline void chmin(ll& a,ll b){a=min(a,b);} int main(){ ll n; cin >> n ; vector<ll> A(n) ; rep(i,n) cin>> A[i] ; sort(A.begimn(),A.end()) ; int sakai=0 ; int ans=0 ; if(A[0]==A[n-1]){ if(A[0]==n-1||A[0]*2<=n) ans=1 ; } if(A[0]+1==A[n-1]){ rep(i,n-1){ if(A[i]!=A[i+1]){ sakai =i+1 ; break ; } } if(sakai+(n-sakai)*2<=n) ans =1 ; } if(ans=1) cout <<"Yes"<<endl ; else cout <<"No"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'class std::vector<long long int>' has no member named 'begimn'; did you mean 'begin'? 19 | sort(A.begimn(),A.end()) ; | ^~~~~~ | begin
s945252193
p03688
C++
#include <iostream> using namespace std; int main() { cout<<"Hello World"; cin >> n; int Arr[2][n], Sum = 0, flag = 0, temp = 0; for(int i = 0; i < n; i++){ cin >> A[0][i]; Sum += A[0][i]; } for(int i = 0; i < n; i++){ if(!flag){ if(int((Sum - A[0][i])/(n - 1)) >= A[0][i]) flag = 1; } } if(flag == 1) cout << "Yes"; else cout << "No"; return 0; }
a.cc: In function 'int main()': a.cc:9:12: error: 'n' was not declared in this scope 9 | cin >> n; | ^ a.cc:12:16: error: 'A' was not declared in this scope 12 | cin >> A[0][i]; | ^ a.cc:19:27: error: 'A' was not declared in this scope 19 | if(int((Sum - A[0][i])/(n - 1)) >= A[0][i]) | ^
s988345853
p03688
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int>a(N); for(int i=0;i<N;i++) cin>>a.at(i); sort(a.begin(),a.end()); if(a.at(0)==a.at(N-1)){ if(a.at(0)==N-1 || 2*a.at(0)<=N) cout<<"Yes"<<endl; else cout<<"No"<<endl; }else if(a.at(N-1)-a.at(0)==1){ int A=a.at(0); int B=a.at(N-1); map<int,int>M; M[A]=0; M[B]=0; for(int i=0;i<N;i++) if(a.at(i)==A) M.at(A)++; else M.at(B)++; int k=M.at(A); if(B-K<=0) cout<<"No"<<endl; else{ if(2*B-k<=N) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }else cout<<"No"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'K' was not declared in this scope 24 | if(B-K<=0) | ^