submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s564947759
p03816
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; map<int,int> m; for(int i=0;i<N;i++){ int x; cin>>x; if(m.count(x)){ m.at(x)++; }else{ m[x]=0; } } int sum=0; for(auto i:m){ sum+=i } cout<<sum/2+sum%2<<endl; }
a.cc: In function 'int main()': a.cc:20:8: error: no match for 'operator+=' (operand types are 'int' and 'std::pair<const int, int>') 20 | sum+=i | ~~~^~~
s665852480
p03816
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; map<int,int> m; for(int i=0;i<N;i++){ int x; cin>>x; if(m.count(x)){ m.at(x)++; }else{ m[x]=0; } } int sum=0; for(int i:m){ sum=sum+i; } cout<<sum/2+sum%2<<endl; }
a.cc: In function 'int main()': a.cc:19:13: error: cannot convert 'std::pair<const int, int>' to 'int' in initialization 19 | for(int i:m){ | ^
s662792615
p03816
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; map<int,int> m; for(int i=0;i<N;i++){ int x; cin>>x; if(m.count(x)){ m.at(x)++; }else{ m[x]=0; } } int sum=0; for(auto i:m){ sum=sum+i; } cout<<sum/2+sum%2<<endl; }
a.cc: In function 'int main()': a.cc:20:12: error: no match for 'operator+' (operand types are 'int' and 'std::pair<const int, int>') 20 | sum=sum+i; | ~~~^~ | | | | int std::pair<const int, int> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:20:13: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:20:13: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>' 20 | sum=sum+i; | ^ 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: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const _CharT*' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:20:13: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const _CharT*' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:20:13: note: 'std::pair<const int, int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 20 | sum=sum+i; | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::complex<_Tp>' and 'int' 20 | sum=sum+i; | ^ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)' 349 | operator+(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:349:5: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::complex<_Tp>' and 'int' 20 | sum=sum+i; | ^
s104857240
p03816
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; map<int,int> m; for(int i=0;i<N;i++){ int x; cin>>x; if(m.count(x)){ m.at(x)++; }else{ m[x]=0; } } int sum=0; for(auto i:m){ sum+=i; } cout<<sum/2+sum%2<<endl; }
a.cc: In function 'int main()': a.cc:20:8: error: no match for 'operator+=' (operand types are 'int' and 'std::pair<const int, int>') 20 | sum+=i; | ~~~^~~
s916325181
p03816
C++
#inlude<bits/stdc++.h> using namespace std; int a[100050],n,ans; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(int i=1;i<=n;i++) if(a[i]==a[i-1]) ans++; if(ans%2==1) ans++; cout<<n-ans<<endl; return 0; }
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include? 1 | #inlude<bits/stdc++.h> | ^~~~~~ | include a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope 6 | cin>>n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #inlude<bits/stdc++.h> a.cc:9:9: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(a+1,a+n+1); | ^~~~ | short a.cc:14:9: error: 'cout' was not declared in this scope 14 | cout<<n-ans<<endl; | ^~~~ a.cc:14:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:22: error: 'endl' was not declared in this scope 14 | cout<<n-ans<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #inlude<bits/stdc++.h>
s846485398
p03816
C++
#include<bits/stdc++.h> #define int long lnog using namespace std; const int N=100010; int n,a[N],ans; signed main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); for(int i=1;i<=n;i++) if(a[i]==a[i-1]) ans++; if(ans%2==1)ans++; cout<<n-ans<<"\n"; return 0; }
a.cc:4:11: error: expected initializer before 'N' 4 | const int N=100010; | ^ a.cc:5:5: error: expected initializer before 'n' 5 | int n,a[N],ans; | ^ a.cc: In function 'int main()': a.cc:8:10: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | cin>>n; | ^ | yn a.cc:9:13: error: expected ';' before 'i' 9 | for(int i=1;i<=n;i++) | ^ a.cc:9:13: error: 'i' was not declared in this scope a.cc:9:21: error: expected ')' before ';' token 9 | for(int i=1;i<=n;i++) | ~ ^ | ) a.cc:9:22: error: 'i' was not declared in this scope 9 | for(int i=1;i<=n;i++) | ^ a.cc:11:10: error: 'a' was not declared in this scope 11 | sort(a+1,a+1+n); | ^ a.cc:12:13: error: expected ';' before 'i' 12 | for(int i=1;i<=n;i++) | ^ a.cc:12:21: error: expected ')' before ';' token 12 | for(int i=1;i<=n;i++) | ~ ^ | ) a.cc:15:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | if(ans%2==1)ans++; | ^~~ | abs a.cc:16:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | cout<<n-ans<<"\n"; | ^~~ | abs
s516037096
p03816
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < n; i++) #define vi vector<int> #define all(a) (a).begin(),(a).end() int main(){ ll n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; // unique 真に unique にするための前処理で sort sort(all(a)); a.erase(unique(all(a)), a.end()); int ans = a.size(); if(ans%2 == 0) ans--; std::cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:8:3: error: 'll' was not declared in this scope; did you mean 'all'? 8 | ll n; cin >> n; | ^~ | all a.cc:8:16: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | ll n; cin >> n; | ^ | yn
s296616062
p03816
C++
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false); cin.tie(0); #define FOR(i,s,n) for(int i = s; i < (n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(n) (n).begin(), (n).end() #define RALL(n) (n).rbegin(), (n).rend() #define ATYN(n) cout << ( (n) ? "Yes":"No") << endl; #define CFYN(n) cout << ( (n) ? "YES":"NO") << endl; using ll = long long; using ull = unsigned long long; using pii = pair<int,int>; int main(void) { IOS const int N = 1e5+1 int n; cin >> n; vector<int> m(N); REP(i,n) { int x; cin >> x; m[x]++; } int cnt = 0; REP(i,N) if (m[i] != 0) cnt++; cout << ( cnt % 2 == 0 ? cnt -1 : cnt ) << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:5: error: expected ',' or ';' before 'int' 18 | int n; cin >> n; | ^~~ a.cc:18:19: error: 'n' was not declared in this scope 18 | int n; cin >> n; | ^
s851549140
p03816
C++
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 #define INF 1000000010 #define EPS 1e-9 #define fst first #define scd second #define debug(x) cout<<x<<endl; #define repi(i,x,n) for(int i=x;i<n;i++) #define rep(i,n) repi(i,0,n) #define lp(i,n) repi(i,0,n) #define repn(i,n) for(int i=n;i>=0;i--) #define int long long #define endl "\n" signed main(){ cin.tie(0); ios::sync_with_stdio(false); int n; int a[100000]; map<int,int> mp; int ans=0; cin>>n; rep(i,a){ cin>>a[i]; mp[a[i]]++; if(mp[a[i]]%3==2) ans++; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | #define repi(i,x,n) for(int i=x;i<n;i++) | ^ a.cc:11:18: note: in expansion of macro 'repi' 11 | #define rep(i,n) repi(i,0,n) | ^~~~ a.cc:26:3: note: in expansion of macro 'rep' 26 | rep(i,a){ | ^~~
s866107702
p03816
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { const int MOD = 1000000007; const int INF = 1 << 30; static void Main(string[] args) { Solve(); } static void Solve() { Scaner sc = new Scaner(); write wr = new write(); Math2 mmath = new Math2(); //ここから int N=sc.Int1; var A=sc.IntArr; var AA=A.Distinct(); int uni=AA.ToArray().Length; wr.wri(uni%2==0 ? uni:uni-1); } } class PriorityQueue<T> { private readonly List<T> heap; private readonly Comparison<T> compare; private int size; public PriorityQueue() : this(Comparer<T>.Default) {} public PriorityQueue(IComparer<T> comparer) : this(16, comparer.Compare) { } public PriorityQueue(Comparison<T> comparison) : this(16, comparison) { } public PriorityQueue(int capacity, Comparison<T> comparison) { this.heap = new List<T>(capacity); this.compare = comparison; } public void Enqueue(T item) { this.heap.Add(item); var i = size++; while (i > 0) { var p = (i - 1) >> 1; if (compare(this.heap[p], item) <= 0) break; this.heap[i] = heap[p]; i = p; } this.heap[i] = item; } public T Dequeue() { var ret = this.heap[0]; var x = this.heap[--size]; var i = 0; while ((i << 1) + 1 < size) { var a = (i << 1) + 1; var b = (i << 1) + 2; if (b < size && compare(heap[b], heap[a]) < 0) a = b; if (compare(heap[a], x) >= 0) break; heap[i] = heap[a]; i = a; } heap[i] = x; heap.RemoveAt(size); return ret; } public T Peek() { return heap[0]; } public int Count { get { return size; } } public bool Any() { return size > 0; } } class Math2 { public long[] Fact; //Nまでの階乗 public long[] invFact; //階乗の逆元 public void FactoricalModSet(long N,long MOD=1000000007) { Fact = new long[N + 1]; invFact = new long[N + 1]; Fact[0] = 1; for(long i = 1; i <= N; ++i) { Fact[i] = Fact[i - 1] * i%MOD; } invFact[N] = powMOD(Fact[N], MOD - 2); for (long i = N; i > 0; --i) { invFact[i - 1] = invFact[i] * i%MOD; } } public long nCrMod(long n,long r,long MOD=1000000007) { return (Fact[n] * invFact[r] % MOD * invFact[n-r]%MOD); } public long powMOD(long x,long n,long MOD = 1000000007) { long res = 1; while (n > 0) { if ((n & 1) != 0) res = res * x % MOD; x = x * x % MOD; n >>= 1; } return res; } static long GCD(long x, long y) { if (y == 0) return x; return GCD(y, x % y); } static long LCM(long x, long y) { return x * y / GCD(x, y); } } class Scaner { public string Str => Console.ReadLine(); public string[] StrArr => Str.Split(' '); public long[] LongArr => StrArr.Select(long.Parse).ToArray(); public int[] IntArr => StrArr.Select(int.Parse).ToArray(); public char[] CharArr => Str.ToArray(); public long Long1 => LongArr[0]; public int Int1 => IntArr[0]; } class write { public void wri<T>(T x) { Console.WriteLine(x); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.Threading.Tasks; | ^~~~~~ a.cc:16:22: error: 'string' has not been declared 16 | static void Main(string[] args) | ^~~~~~ a.cc:16:31: error: expected ',' or '...' before 'args' 16 | static void Main(string[] args) | ^~~~ a.cc:45:2: error: expected ';' after class definition 45 | } | ^ | ; a.cc: In static member function 'static void Program::Solve()': a.cc:25:9: error: 'Scaner' was not declared in this scope 25 | Scaner sc = new Scaner(); | ^~~~~~ a.cc:26:9: error: 'write' was not declared in this scope 26 | write wr = new write(); | ^~~~~ a.cc:27:9: error: 'Math2' was not declared in this scope 27 | Math2 mmath = new Math2(); | ^~~~~ a.cc:30:15: error: 'sc' was not declared in this scope 30 | int N=sc.Int1; | ^~ a.cc:31:9: error: 'var' was not declared in this scope 31 | var A=sc.IntArr; | ^~~ a.cc:32:13: error: expected ';' before 'AA' 32 | var AA=A.Distinct(); | ^~ a.cc:34:17: error: 'AA' was not declared in this scope 34 | int uni=AA.ToArray().Length; | ^~ a.cc:36:9: error: 'wr' was not declared in this scope 36 | wr.wri(uni%2==0 ? uni:uni-1); | ^~ a.cc: At global scope: a.cc:47:7: error: 'PriorityQueue' is not a class template 47 | class PriorityQueue<T> | ^~~~~~~~~~~~~ a.cc:47:21: error: 'T' was not declared in this scope 47 | class PriorityQueue<T> | ^ a.cc:49:12: error: expected ':' before 'readonly' 49 | private readonly List<T> heap; | ^~~~~~~~~ | : a.cc:49:13: error: 'readonly' does not name a type 49 | private readonly List<T> heap; | ^~~~~~~~ a.cc:50:12: error: expected ':' before 'readonly' 50 | private readonly Comparison<T> compare; | ^~~~~~~~~ | : a.cc:50:13: error: 'readonly' does not name a type 50 | private readonly Comparison<T> compare; | ^~~~~~~~ a.cc:51:12: error: expected ':' before 'int' 51 | private int size; | ^~~~ | : a.cc:52:11: error: expected ':' before 'PriorityQueue' 52 | public PriorityQueue() : this(Comparer<T>.Default) {} | ^~~~~~~~~~~~~~ | : a.cc:53:11: error: expected ':' before 'PriorityQueue' 53 | public PriorityQueue(IComparer<T> comparer) : this(16, comparer.Compare) { } | ^~~~~~~~~~~~~~ | : a.cc:53:35: error: expected ')' before '<' token 53 | public PriorityQueue(IComparer<T> comparer) : this(16, comparer.Compare) { } | ~ ^ | ) a.cc:54:11: error: expected ':' before 'PriorityQueue' 54 | public PriorityQueue(Comparison<T> comparison) : this(16, comparison) { } | ^~~~~~~~~~~~~~ | : a.cc:54:36: error: expected ')' before '<' token 54 | public PriorityQueue(Comparison<T> comparison) : this(16, comparison) { } | ~ ^ | ) a.cc:55:11: error: expected ':' before 'PriorityQueue' 55 | public PriorityQueue(int capacity, Comparison<T> comparison) | ^~~~~~~~~~~~~~ | : a.cc:55:40: error: 'Comparison' has not been declared 55 | public PriorityQueue(int capacity, Comparison<T> comparison) | ^~~~~~~~~~ a.cc:55:50: error: expected ',' or '...' before '<' token 55 | public PriorityQueue(int capacity, Comparison<T> comparison) | ^ a.cc:60:11: error: expected ':' before 'void' 60 | public void Enqueue(T item) | ^~~~~ | : a.cc:60:25: error: 'T' has not been declared 60 | public void Enqueue(T item) | ^ a.cc:75:11: error: expected ':' before 'T' 75 | public T Dequeue() | ^~ | : a.cc:75:12: error: 'T' does not name a type 75 | public T Dequeue() | ^ a.cc:94:11: error: expected ':' before 'T' 94 | public T Peek() { return heap[0]; } | ^~ | : a.cc:94:12: error: 'T' does not name a type 94 | public T Peek() { return heap[0]; } | ^ a.cc:95:11: error: expected ':' before 'int' 95 | public int Count { get { return size; } } | ^~~~ | : a.cc:95:45: error: expected ';' at end of member declaration 95 | public int Count { get { return size; } } | ^ | ; a.cc:96:11: error: expected ':' before 'bool' 96 | public bool Any() { return size > 0; } | ^~~~~ | : a.cc:97:2: error: expected ';' after class definition 97 | } | ^ | ; a.cc:95:24: error: 'get' was not declared in this scope 95 | public int Count { get { return size; } } | ^~~ a.cc:95:28: error: expected '}' before '{' token 95 | public int Count { get { return size; } } | ^ a.cc:95:22: note: to match this '{' 95 | public int Count { get { return size; } } | ^ a.cc:95:28: error: cannot convert '<brace-enclosed initializer list>' to 'int' in initialization 95 | public int Count { get { return size; } } | ^ a.cc:95:28: error: expected ';' before '{' token a.cc: In constructor 'PriorityQueue::PriorityQueue()': a.cc:52:30: error: expected identifier before 'this' 52 | public PriorityQueue() : this(Comparer<T>.Default) {} | ^~~~ a.cc:52:30: error: expected '{' before 'this' a.cc: In constructor 'PriorityQueue::PriorityQueue(int, int)': a.cc:57:14: error: request for member 'heap' in '(PriorityQueue*)this', which is of pointer type 'PriorityQueue*' (maybe you meant to use '->' ?) 57 | this.heap = new List<T>(capacity); | ^~~~ a.cc:57:25: error: 'List' does not name a type 57 | this.heap = new List<T>(capacity); | ^~~~ a.cc:57:30: error: 'T' was not declared in this scope 57 | this.heap = new List<T>(capacity); | ^ a.cc:58:14: error: request for member 'compare' in '(PriorityQueue*)this', which is of pointer type 'PriorityQueue*' (maybe you meant to use '->' ?) 58 | this.compare = comparison; | ^~~~~~~ a.cc:58:24: error: 'comparison' was not declared in this scope 58 | this.compare = comparison; | ^~~~~~~~~~ a.cc: In member function 'void PriorityQueue::Enqueue(int)': a.cc:62:14: error: request for member 'heap' in '(PriorityQueue*)this', which is of pointer type 'PriorityQueue*' (maybe you meant to use '->' ?) 62 | this.heap.Add(item); | ^~~~ a.cc:63:9: error: 'var' was not declared in this scope 63 | var i = size++; | ^~~ a.cc:64:16: error: 'i' was not declared in this scope 64 | while (i > 0) | ^ a.cc:66:17: error: expected ';' before 'p' 66 | var p = (i - 1) >> 1; | ^ a.cc:67:30: error: request for member 'heap' in '(PriorityQueue*)this', which is of pointer type 'PriorityQueue*' (maybe you meant to use '->' ?) 67 | if (compare(this.heap[p], item) <= 0) | ^~~~ a.cc:67:35: error: 'p' was not declared in this scope 67 | if (compare(this.heap[p], item) <= 0) | ^ a.cc:67:17: error: 'compare' was not declared in this scope 67 | if (compare(this.heap[p], item) <= 0) | ^~~~~~~ a.cc:69:18: error: request for member 'heap' in '(PriorityQueue*)this', which is of pointer type 'PriorityQueue*' (maybe you meant to use '->' ?) 69 | this.heap[i] = heap[p]; | ^~~~ a.cc:69:28: error: 'heap' was not declared in this scope 69 | this.heap[i] = heap[p]; | ^~~~ a.cc:69:33: error: 'p' was not declared in this scope 69 | this.heap[i] = heap[p]; | ^ a.cc:72:14: error: request for member 'heap' in '(PriorityQueue*)this', which is of pointer type 'PriorityQueue*' (maybe you meant to use '->' ?) 72 | this.heap[i] = item; | ^~~~ a.cc:72:19: error: 'i' was not declared in this scope 72 | this.heap[i] = item; | ^ a.cc: At global scope: a.cc:102:11: error: expected ':' before 'long' 102 | public long[] Fact; //Nまでの階乗 | ^~~~~ | : a.cc:102:16: error: expected unqualified-id before '[' token 102 | public long[] Fact; //Nまでの階乗 | ^ a.cc:103:11: error: expected ':' before 'long' 103 | public long[] invFact; //階乗の逆元 | ^~~~~ | : a.cc:103:16: error: expected unqualified-id before '[' token 103 | public long[] invFact; //階乗の逆元 | ^ a.cc:104:11: error: expected ':' before 'void' 104 | public void FactoricalModSet(long N,long MOD=
s841447487
p03816
C++
#include <bits/stdc++.h> #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) int a[110000]; map <int,int> b; int main(){ int n,c=0,d=0; std::cin>>n; rep(i,0,n){std::cin>>a[i];b[a[i]]++;} rep(i,0,b.size()){ if(b[i]>0)c++; if(b[i]>1)d+=b[i]-1; } std::cout<<c-d%2; }
a.cc:4:1: error: 'map' does not name a type 4 | map <int,int> b; | ^~~ a.cc: In function 'int main()': a.cc:2:24: error: 'll' was not declared in this scope 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) | ^~ a.cc:8:3: note: in expansion of macro 'rep' 8 | rep(i,0,n){std::cin>>a[i];b[a[i]]++;} | ^~~ a.cc:8:7: error: 'i' was not declared in this scope 8 | rep(i,0,n){std::cin>>a[i];b[a[i]]++;} | ^ a.cc:2:35: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) | ^ a.cc:8:29: error: 'b' was not declared in this scope 8 | rep(i,0,n){std::cin>>a[i];b[a[i]]++;} | ^ a.cc:2:24: error: 'll' was not declared in this scope 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) | ^~ a.cc:9:3: note: in expansion of macro 'rep' 9 | rep(i,0,b.size()){ | ^~~ a.cc:9:7: error: 'i' was not declared in this scope 9 | rep(i,0,b.size()){ | ^ a.cc:2:35: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) | ^ a.cc:9:11: error: 'b' was not declared in this scope 9 | rep(i,0,b.size()){ | ^ a.cc:2:40: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) | ^
s173480851
p03816
C++
// luogu-judger-enable-o2
/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
s162970112
p03816
C++
#include<bits/stdc++.h> using namespace std; const int maxn=100000+10; int a[maxn],n,vis[maxn]; int main(){ cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(!vis[a[i]]) vis[a[i]]++,ans++; } if(ans%2) cout<<ans; else cout<<ans-1; return 0; }
a.cc: In function 'int main()': a.cc:10:44: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | if(!vis[a[i]]) vis[a[i]]++,ans++; | ^~~ | abs a.cc:12:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | if(ans%2) cout<<ans; | ^~~ | abs
s937809070
p03816
C++
#include<bits/stdc++.h> using namespace std; const ll maxn=100000+10; int a[maxn],n,vis[maxn]; int main(){ cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(!vis[a[i]]) vis[a[i]]++,ans++; } if(ans%2) cout<<ans; else cout<<ans-1; return 0; }
a.cc:3:7: error: 'll' does not name a type 3 | const ll maxn=100000+10; | ^~ a.cc:4:7: error: 'maxn' was not declared in this scope 4 | int a[maxn],n,vis[maxn]; | ^~~~ a.cc:4:19: error: 'maxn' was not declared in this scope 4 | int a[maxn],n,vis[maxn]; | ^~~~ a.cc: In function 'int main()': a.cc:9:22: error: 'a' was not declared in this scope 9 | cin>>a[i]; | ^ a.cc:10:21: error: 'vis' was not declared in this scope 10 | if(!vis[a[i]]) vis[a[i]]++,ans++; | ^~~ a.cc:10:44: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | if(!vis[a[i]]) vis[a[i]]++,ans++; | ^~~ | abs a.cc:12:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | if(ans%2) cout<<ans; | ^~~ | abs
s974416687
p03816
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define vd(T) vector<vector<T>> #define v(T) vector<T> #define mod (ll)(1e9+7) #define pp(T) pair<T,T> #define pb push_back #define mp make_pair #define NN 100005 #define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0) #define loop(i,a,b) for(ll i=a;i<b;i++) #define DEBUG cout<<"***********DEBUGGING***********"<<endl #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;} ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;} inline int add(ll a,ll b,ll m=0){ if(m==0) return a+b; return (a%m+b%m)%m; } inline int sub(ll a,ll b ,ll m=0){ if(m==0) return a-b; return ((a%m-b%m)%m+m)%m; } inline int mul(ll a,ll b,ll m=0){ if(m==0)return (a*b); return ((a%m)*(b%m))%m; } inline int div(ll a,ll b,ll m=0){ if(m==0) return a/b; return ((a%m)*(powermod(a,b,m-2)%m))%m; } bool isopen(char c){ return ((c=='(')||(c=='{')||(c=='[')); } ll longest_balanced_parenthesis(string a,ll n){ stack<char> s; ll start=0; ll ans=0,m=0; for(ll i=0;i<n;i++){ if(isopen(a[i])){ s.push(a[i]); } else{ if(isopen(a[i])|| s.empty()){ m=max(m,ans); continue; } else{ s.pop(); ans+=2; m=max(ans,m); } } } return m; } ll setup_k(ll *a,ll k){ ordered_set x; // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1) } int main() { IO; ll n; cin>>n; ll a[n]; map<ll,ll> m; for(ll i=0;i<n;i++){ cin>>a[i]; m[a[i]]++; } sort(a,a+n); if(n==1){ cout<<1<<edl; return 0; } ll ans=0; for(auto i:m){ ans+=i.second-1; } if(ans%3==0)cout<<n-ans<<endl; else if(ans%3==1) cout<<n-ans-1<<endl; else cout<<n-ans<<endl; }
a.cc: In function 'long long int setup_k(long long int*, long long int)': a.cc:72:1: warning: no return statement in function returning non-void [-Wreturn-type] 72 | } | ^ a.cc: In function 'int main()': a.cc:88:18: error: 'edl' was not declared in this scope 88 | cout<<1<<edl; | ^~~
s337562695
p03816
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, i, count = 0; cin >> n; vevtor<int> a(n); for(i = 0; i < n; i++){ cin >> a.at(i); } for(i = 0; i < n - 1; i++){ if(a.at(i) == a.at(i + 1)){ count++; } } cout << (count + 1) / 2 << endl; }
a.cc: In function 'int main()': a.cc:8:3: error: 'vevtor' was not declared in this scope 8 | vevtor<int> a(n); | ^~~~~~ a.cc:8:10: error: expected primary-expression before 'int' 8 | vevtor<int> a(n); | ^~~ a.cc:10:12: error: 'a' was not declared in this scope 10 | cin >> a.at(i); | ^ a.cc:14:8: error: 'a' was not declared in this scope 14 | if(a.at(i) == a.at(i + 1)){ | ^
s236884308
p03816
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) long long inf=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int nmax=100010; int n; cin>>n; int a[n]; vector<int> counter(100010,0); REP(i,n){ cin>>a[i]; counter[a[i]]++; } int even=0; int ans=0 REP(i,nmax){ if(i%2==1){ ans++; }else if(i==0){ continue; }else{ even++; } } if(even%2==0){ ans += even; }else{ ans += even-1; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:2:18: error: expected ',' or ';' before 'for' 2 | #define REP(i,n) for(int i=0;i<n;i++) | ^~~ a.cc:83:3: note: in expansion of macro 'REP' 83 | REP(i,nmax){ | ^~~ a.cc:83:7: error: 'i' was not declared in this scope 83 | REP(i,nmax){ | ^ a.cc:2:30: note: in definition of macro 'REP' 2 | #define REP(i,n) for(int i=0;i<n;i++) | ^
s804756288
p03816
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) long long inf=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int n; cin>>n; int a[n]; vector<int> counter(100010,0); REP(i,n){ cin>>a[i]; counter[a[i]]++; } int even=0; int ans=0 REP(i,100010){ if(i%2==1){ ans++; }else if(i==0){ continue; }else{ even++; } } if(even%2==0){ ans += even; }else{ ans += even-1; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:2:18: error: expected ',' or ';' before 'for' 2 | #define REP(i,n) for(int i=0;i<n;i++) | ^~~ a.cc:82:3: note: in expansion of macro 'REP' 82 | REP(i,100010){ | ^~~ a.cc:82:7: error: 'i' was not declared in this scope 82 | REP(i,100010){ | ^ a.cc:2:30: note: in definition of macro 'REP' 2 | #define REP(i,n) for(int i=0;i<n;i++) | ^
s767384079
p03816
C++
#include <iostream> #include <utility> #include <vector> using namespace std; #define ll long long int main () { ll n; cin >> n; ll a[n]; for (ll i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); vector<pair<ll, ll> > box; ll now = 0; ll num = 0; for (ll i = 0; i < n; i++) { if (i == 0) { now = a[i]; num++; } else { if (now != a[i]) { box.push_back(make_pair(num, now)); now = a[i]; num = 1; } else { num++; } } if (i == n - 1) { box.push_back(make_pair(num, now)); } } sort(box.begin(), box.end()); for (ll i = 0; i < box.size(); i++) { ll j = box.size() - 1 - i; if (box[j].first >= 2) { box[j].first = box[j].first % 2; if (box[j].first == 0) { box[j].first = 2; } } } sort(box.begin(), box.end()); ll two = 0; for (ll i = 0; i < box.size(); i++) { if (box[i].first == 2) { two++; } } cout << box.size() - (two % 2) << endl; }
a.cc: In function 'int main()': a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(a, a + n); | ^~~~ | short
s188350922
p03816
C++
#include<cstdio> #include<iostream> #include<cmath> #include<cstring> #include<algorithm> #include<set> #define ll long long using namespace std; int main() { int n; set<int>s; cin>>n; for(int i = 0; i < n; i++){ int t; cin>>t; s.insert(t); } int num = s.size(); int ans; if(more % 2 != 0)ans = num+1; else ans = num; cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:21:8: error: 'more' was not declared in this scope 21 | if(more % 2 != 0)ans = num+1; | ^~~~
s362244692
p03816
C++
/*g++ file.cpp -o file.out*/ /*./file.out*/ #include <cmath> #include <queue> #include <stack> #include <cstdio> #include <string> #include <vector> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define LL long long #define Mod 1000000007 #define L_Mod 17100000013 #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) int a[100005]; int main() { int sov,tmp; scanf("%d",&sov); rep(i,sov){scanf("%d",&tmp);a[tmp]++;} rer(i,0,100000){sov-=(a[i]-1);} printf("%d\n",sov); return0; }
a.cc: In function 'int main()': a.cc:32:5: error: 'return0' was not declared in this scope 32 | return0; | ^~~~~~~
s310300366
p03816
C++
#include<cstdio> #include<algorithm> using namespace std; int arr[100005]; int main(){ int n, x; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&x); if(!arr[x]){ arr[x] = 1; cnt++;// 记录不重复的数字 } } printf("%d\n",(n-cnt)&1?cnt-1:cnt); return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'cnt' was not declared in this scope; did you mean 'int'? 13 | cnt++;// 记录不重复的数字 | ^~~ | int a.cc:16:22: error: 'cnt' was not declared in this scope; did you mean 'int'? 16 | printf("%d\n",(n-cnt)&1?cnt-1:cnt); | ^~~ | int
s281652861
p03816
C++
#include<cstdio> #include<algorithm> using namespace std; int arr[100005]; int main(){ int N, x; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&x); if(!arr[x]){ arr[x] = 1; cnt++;// 记录不重复的数字 } } printf("%d\n",(n-cnt)&1?cnt-1:cnt); return 0; }
a.cc: In function 'int main()': a.cc:8:17: error: 'n' was not declared in this scope 8 | scanf("%d",&n); | ^ a.cc:13:13: error: 'cnt' was not declared in this scope; did you mean 'int'? 13 | cnt++;// 记录不重复的数字 | ^~~ | int a.cc:16:22: error: 'cnt' was not declared in this scope; did you mean 'int'? 16 | printf("%d\n",(n-cnt)&1?cnt-1:cnt); | ^~~ | int
s791352609
p03816
Java
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashSet<Integer> set = new HashSet<>(); int count = 0; for (int i = 0; i < n; i++){ int x = sc.nextInt(); if (set.contains(x)){ count++; } else { set.add(x); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashSet<Integer> set = new HashSet<>(); int count = 0; for (int i = 0; i < n; i++){ int x = sc.nextInt(); if (set.contains(x)){ count++; } else { set.add(x); } } count++; count = count / 2 * 2; System.out.println(n - count); } } } } count++; count = count / 2 * 2; System.out.println(n - count); } }
Main.java:35: error: class, interface, enum, or record expected count++; ^ Main.java:36: error: class, interface, enum, or record expected count = count / 2 * 2; ^ Main.java:37: error: class, interface, enum, or record expected System.out.println(n - count); ^ Main.java:38: error: class, interface, enum, or record expected } ^ 4 errors
s597316982
p03816
C++
import collections N = int(input()) A = [int(i) for i in input().split()] con = collections.Counter(A) ans = len(set(A)) tmp = 0 for i in con.values(): if i % 2 == 0: tmp += 1 if tmp % 2 != 0: ans -= 1 print(ans)
a.cc:1:1: error: 'import' does not name a type 1 | import collections | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s257644130
p03816
C++
#include<iostream> #include<algorithm> #include<string> #include<math.h> #include<cmath> #include<vector> #include<stack> #include<queue> #include<functional> #include<map> #include<set> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define ll long long int main(){ int n; cin >> n; int a[(int)1e5+1]={}; int tmp,ans=0; for(int i=0;i<n;i++){ cin >> tmp; a[tmp]++; if(a[tmp] == 1) ans++; } int amari=0; for(int i=1;i<=(int)1e5;i++){ if(a[i] >= 3){ a[i] -= ((a[i]-1)/2)*2; } if(a[i] == 2) amari++; } cout << ans-(amari%2 == 1) << "\n"; return 0;
a.cc: In function 'int main()': a.cc:35:18: error: expected '}' at end of input 35 | return 0; | ^ a.cc:15:11: note: to match this '{' 15 | int main(){ | ^
s773700401
p03816
C++
#include<iostream> #include<algorithm> #include<string> #include<math.h> #include<cmath> #include<vector> #include<stack> #include<queue> #include<functional> #include<map> #include<set> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define ll long long int main(){ int n; cin >> n; int a[(int)1e5+1]={}; int tmp,ans=0; for(int i=0;i<n;i++){ cin >> tmp; a[tmp]++; if(a[tmp] == 1) ans++; } int amari=0; for(int i=1;i<=(int)1e5;i++){ if(a[i] >= 3){ a[i] -= ((a[i]-1)/2)*2; } if(a[i] == 2) amari++; } cout << ans-(amari%2 == 1) << "\n"; return 0;
a.cc: In function 'int main()': a.cc:35:18: error: expected '}' at end of input 35 | return 0; | ^ a.cc:15:11: note: to match this '{' 15 | int main(){ | ^
s542475964
p03816
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin >> n; vector<int> cnt(100001); rep(i,n){ int a; cin >> a; cnt[a]++; } int ans=0; rep(i,100001){ if(cnt[i]) ans++; } if(ans%2==0) cout << ans-1 << end; else cout << ans << endl; }
a.cc: In function 'int main()': a.cc:23:36: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 23 | if(ans%2==0) cout << ans-1 << end; | ~~~~~~~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nul
s549241661
p03816
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin >> n; vector<int> cnt(100001); rep(i,n){ int a; cin >> a; cnt[a]++; } int ans=0,two=0; rep(i,100001){ if(cnt[i]>2){ if(cnt[i]%2==1) cnt[i]=1; else cnt[i]=2; } if(cnt[i]==2){ two++; ans++; } else if(cnt[i]==1) ans++; } if(two==0){ cout << ans << emdl; return 0; } if(two%2==1){ ans--; cout << ans << endl; } else{ bool find=false; rep(i,10001){ if(cnt[i]==2){ for(int j=i+1;j<100001;++j){ if(cnt[j]==1){ find=true; break; } if(cnt[j]==2){ i=j-1; break; } } } } if(find) cout << ans << endl; else cout << ans-2 << endl; } }
a.cc: In function 'int main()': a.cc:32:32: error: 'emdl' was not declared in this scope 32 | cout << ans << emdl; | ^~~~
s437074737
p03816
Java
import java.util.LinkedList; import java.util.Scanner; public class Cards { public static void main(String[] args) { // TODO Auto-generated method stub @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); LinkedList<Integer> l = new LinkedList<Integer>(); int x = scan.nextInt(); int counter = 0; for (int i = 0; i < x; i++) { int z = scan.nextInt(); if (l.contains(z)) { counter++; } else { l.add(z); } } if(counter%2 == 1) { counter++; } System.out.print(x - counter); } }
Main.java:4: error: class Cards is public, should be declared in a file named Cards.java public class Cards { ^ 1 error
s650303697
p03816
Java
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.Scanner; import java.util.Stack; import javax.swing.ScrollPaneConstants; import org.omg.Messaging.SyncScopeHelper; public class Solution { static Scanner input = new Scanner(System.in); public static void main(String[] args) { int n = input.nextInt(); int[] a = new int [n]; for (int i = 0 ; i < n ; i++) a[i] = input.nextInt(); int [] freq = new int [100000]; for (int i = 0 ; i < n ; i++) { freq[a[i]]++; } Arrays.sort(freq); int sum = 0; int unique = 0 ; for (int i = 100000-1; i >= 0 ; i--) { if (freq[i]==0) { break; } unique++; sum+=(freq[i]-1); } if (sum%2==1) { unique-=1; } System.out.println(unique); } }
Main.java:11: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ Main.java:9: error: package org.omg.Messaging does not exist import org.omg.Messaging.SyncScopeHelper; ^ 2 errors
s438467120
p03816
Java
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.Scanner; import java.util.Stack; import javax.swing.ScrollPaneConstants; import javax.swing.text.AbstractDocument.LeafElement; public class main { static Scanner input = new Scanner(System.in); public static void main(String[] args) { int n = input.nextInt(); int[] a = new int [n]; for (int i = 0 ; i < n ; i++) a[i] = input.nextInt(); int [] freq = new int [100000]; for (int i = 0 ; i < n ; i++) { freq[a[i]]++; } Arrays.sort(freq); int sum = 0; int unique = 0 ; for (int i = 100000-1; i >= 0 ; i--) { if (freq[i]==0) { break; } unique++; sum+=(freq[i]-1); } if (sum%2==1) { unique-=1; } System.out.println(unique); } }
Main.java:10: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s913220006
p03816
C++
#include<iostream> #include<string> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<vector> #include<functional> #include<iomanip> #include<queue> #include<cassert> #include<tuple> #include<set> #include<map> #include<list> #include<bitset> #define PB push_back #define ALL(a) (a).begin(),(a).end() #define all(v) begin(v), end(v) #define DWN(a) (a).begin(),(a).end(), greater<int>() #define rep(i, m) for (int i = 0; i < m; i++) #define REP(i, n, m) for (int i = n; i < m; i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const int dx[4] = { 1, 0, -1, 0 }; const int dy[4] = { 0, 1, 0, -1 }; const int INF = (int)1e9; const ll inf = (ll)1e18; const ll MOD{ (ll)1e9 + 7 }; int n; set<int, int> st; int main() { cin >> n; rep(i, n) { int a; cin >> a; st.insert(a); } int k = st.size(); if (k % 2) { cout << k << endl; } else { cout << k - 1 << endl; } return 0; }
In file included from /usr/include/c++/14/set:62, from a.cc:13: /usr/include/c++/14/bits/stl_tree.h: In instantiation of 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; key_type = int]': /usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>]' 2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v)); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:514:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = int; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<int>, int>::rebind<int>; typename _Alloc::value_type = int; value_type = int]' 514 | _M_t._M_insert_unique(__x); | ~~~~~~~~~~~~~~~~~~~~~^~~~~ a.cc:45:12: required from here 45 | st.insert(a); | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_tree.h:2116:42: error: expression cannot be used as a function 2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x)); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:2127:33: error: expression cannot be used as a function 2127 | if (_M_impl._M_key_compare(_S_key(__j._M_node), __k)) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h: In instantiation of 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(_Base_ptr, _Base_ptr, _Arg&&, _NodeGen&) [with _Arg = const int&; _NodeGen = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::_Alloc_node; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::iterator; _Base_ptr = std::_Rb_tree_node_base*]': /usr/include/c++/14/bits/stl_tree.h:2174:26: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>]' 2174 | return _Res(_M_insert_(__res.first, __res.second, | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ 2175 | _GLIBCXX_FORWARD(_Arg, __v), __an), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:514:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = int; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<int>, int>::rebind<int>; typename _Alloc::value_type = int; value_type = int]' 514 | _M_t._M_insert_unique(__x); | ~~~~~~~~~~~~~~~~~~~~~^~~~~ a.cc:45:12: required from here 45 | st.insert(a); | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_tree.h:1824:56: error: expression cannot be used as a function 1824 | || _M_impl._M_key_compare(_KeyOfValue()(__v), | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ 1825 | _S_key(__p))); | ~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h: In instantiation of 'static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(_Const_Link_type) [with _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; _Const_Link_type = const std::_Rb_tree_node<int>*]': /usr/include/c++/14/bits/stl_tree.h:2116:47: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; key_type = int]' 2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x)); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>]' 2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v)); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:514:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = int; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<int>, int>::rebind<int>; typename _Alloc::value_type = int; value_type = int]' 514 | _M_t._M_insert_unique(__x); | ~~~~~~~~~~~~~~~~~~~~~^~~~~ a.cc:45:12: required from here 45 | st.insert(a); | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_tree.h:760:23: error: static assertion failed: comparison object must be invocable with two arguments of key type 760 | static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:760:23: note: 'std::__is_invocable<int&, const int&, const int&>()' evaluates to false
s493138100
p03816
C++
#include <bits/stdc++.h> using namespace std; int a[1000005]; int n,sum; int cmp(int a,int b) { return a>b; } int main() { int x; int t=0; cin>>n; for(int i=0; i<n; i++) { cin>>x; a[x]++; } int cnt=t; //cout<<t<<endl; for(int i=0; i<100000; i++) { if(a[i]) cnt++: int j,k; if(a[i]>1) { /*if(a[i+1]>1) { if(a[i+1]<a[i]) { a[i]=a[i]-(a[i+1]-1); a[i+1]=1; //cout<<a[i]<<a[i+1]<<endl; } else if(a[i+1]==a[i]) { a[i]=1; a[i+1]=1; continue; } else { a[i]=1; a[i+1]-=(a[i]-1); continue; } }*/ int q=0; for(j=i+1; j<100000; j++) { if(a[j]>1) { if(a[j]<a[i]) { a[j]=1; a[i]-=(a[j]-1); } else if(a[j]==a[i]) { a[i]=1; a[j]=1; break; } else { a[i]=1; a[j]-=(a[i]-1); break;; } } } if(a[i]>1) { if(a[i]>=3) { if(a[i]%2==0) { a[i]=2; cnt--; } else { a[i]=1; } } else { cnt--; } } /*cout<<"*************"<<endl; for(j=0; j<100000; j++) { if(a[j]>0) { cout<<a[j]<<endl; } }*/ } } cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:18: error: expected ';' before ':' token 25 | cnt++: | ^ | ; a.cc:51:21: error: 'j' was not declared in this scope 51 | for(j=i+1; j<100000; j++) | ^
s861418047
p03816
C++
// G++ MACRO.CPP -STD=C++17 #include <bits/stdc++.h> typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl #define possible(n) cout << ((n) ? "possible" : "impossible" ) << endl #define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]) #define SCOUT(x) cout<<(x)<<" " #define ENDL cout<<endl #define VECCIN(x) for(auto&youso_: (x) )cin>>youso_ #define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i] #define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;} #define ALL(obj) (obj).begin(),(obj).end() #define EXIST(n,x) (find(ALL(n),x)!=n.end()) #define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end()) #define EN(x) if(1){cout<<#x<<endl;return 0;} #define COUT(x) cout<<(x)<<endl void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){ cin>>head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) template <class T = ll> T IN(){T x;cin>>x;return (x);} template <class Head> void VT(Head head){} template <class Head,class Seco,class... Tail> void VT(Head&& head,Seco&& seco,Tail&&... tail){ seco.resize(head); VT(head,move(tail)...); } void VT2(){} template <class Head,class... Tail> void VT2(Head&& head,Tail&&... tail){ VECCIN(head); VT2(move(tail)...); } template <class Head> void VT3(Head&& head){} template <class Head,class Seco,class... Tail> void VT3(Head&& head,Seco&& seco,Tail&&... tail){ seco[head]=IN(); VT3(head,move(tail)...); } #define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc #define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; // cpp_int #define P pair<ll,ll> #define V vector<ll> #define M map<ll,ll> #define S set<ll> #define pb(a) push_back(a) #define mp make_pair int main(){ CIN(n);VC1(n,a); M m; REP(i,n) m[a[i]]++; ll count = n-m.size(); if(count %2 == 0) COUT(m); else COUT(m-1); return 0; }
a.cc: In function 'int main()': a.cc:38:21: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::map<long long int, long long int>') 38 | #define COUT(x) cout<<(x)<<endl | ~~~~^~~~~ | | | std::ostream {aka std::basic_ostream<char>} a.cc:97:5: note: in expansion of macro 'COUT' 97 | COUT(m); | ^~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:2: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits
s850161303
p03816
C++
// G++ MACRO.CPP -STD=C++17 #include <bits/stdc++.h> typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl #define possible(n) cout << ((n) ? "possible" : "impossible" ) << endl #define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]) #define SCOUT(x) cout<<(x)<<" " #define ENDL cout<<endl #define VECCIN(x) for(auto&youso_: (x) )cin>>youso_ #define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i] #define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;} #define ALL(obj) (obj).begin(),(obj).end() #define EXIST(n,x) (find(ALL(n),x)!=n.end()) #define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end()) #define EN(x) if(1){cout<<#x<<endl;return 0;} #define COUT(x) cout<<(x)<<endl void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){ cin>>head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) template <class T = ll> T IN(){T x;cin>>x;return (x);} template <class Head> void VT(Head head){} template <class Head,class Seco,class... Tail> void VT(Head&& head,Seco&& seco,Tail&&... tail){ seco.resize(head); VT(head,move(tail)...); } void VT2(){} template <class Head,class... Tail> void VT2(Head&& head,Tail&&... tail){ VECCIN(head); VT2(move(tail)...); } template <class Head> void VT3(Head&& head){} template <class Head,class Seco,class... Tail> void VT3(Head&& head,Seco&& seco,Tail&&... tail){ seco[head]=IN(); VT3(head,move(tail)...); } #define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc #define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; // cpp_int #define P pair<ll,ll> #define V vector<ll> #define M map<ll,ll> #define S set<ll> #define pb(a) push_back(a) #define mp make_pair int main(){ CIN(n);VC1(n,a); M m; REP(i,n) m[a[i]]++; ll count = n-m.size(); if(count %2 == 0) COUT(m); else COUT(m+1); return 0; }
a.cc: In function 'int main()': a.cc:38:21: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::map<long long int, long long int>') 38 | #define COUT(x) cout<<(x)<<endl | ~~~~^~~~~ | | | std::ostream {aka std::basic_ostream<char>} a.cc:97:5: note: in expansion of macro 'COUT' 97 | COUT(m); | ^~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:2: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::map<long long int, long long int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits
s526269786
p03816
C++
#include<iostream> #include<map> using namespace std; int main(){ int n,sum=0,a[100000]; map<int,bool> m={}; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; if(!m[a[i]]){ m[a[i]]=true; sum++; } cout<<(sum%2==0?sum:sum-1); }
a.cc: In function 'int main()': a.cc:15:2: error: expected '}' at end of input 15 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s769704465
p03816
C++
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) (x=min(x,y)) #define chmax(x,y) (x=max(x,y)) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 100010 ll c[N]; int main(){ int n; cin>>n; rep(i, n){ int x; cin>>x; c[x]++; } int res = 0; rep(i, N) res += max(0, c[i]-1); cout<<(res+1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:51:23: error: no matching function for call to 'max(int, ll)' 51 | rep(i, N) res += max(0, c[i]-1); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, 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:51:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 51 | rep(i, N) res += max(0, c[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:51:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 51 | rep(i, N) res += max(0, c[i]-1); | ~~~^~~~~~~~~~~
s266719703
p03816
C++
#include <stdio.h> int main(void) { // your code goes here int d[10000]; int N; scanf("%d",N); for(int i = 0; i < N; i++)scanf("%d",d[i]); sort(d, d+N); int ln = -1; int cout; for(int i = 0; i < N; i++)if(ln == d[i])cout++; if(cout % 2 != 0)printf("%d",cout); if(cout % 2 == 0)printf("%d",cout-1); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(d, d+N); | ^~~~ | short
s497348698
p03816
C++
#include <iostream> #include <algorithm> using namespace std ; int main(int argc, char** argv) { int n , elements ; cin >> n ; int arr[n] ; for ( int i = 0 ; i < n ; i++ ) { cin >> arr[i] ; } sort ( arr , arr + n ) ; elements = unique( arr , arr + n ) - arr ; if ( elements % 2 == 0 ) { elements -- ; } cout << elements return 0; }
a.cc: In function 'int main(int, char**)': a.cc:16:25: error: expected ';' before 'return' 16 | cout << elements | ^ | ; 17 | return 0; | ~~~~~~
s437140511
p03816
C++
#include <Bits/stdc++.h> using namespace std ; int main(int argc, char** argv) { int n , elements ; cin >> n ; int arr[n] ; for ( int i = 0 ; i < n ; i++ ) { cin >> arr[i] ; } sort ( arr , arr + n ) ; elements = unique( arr , arr + n ) - arr ; cout << elements ; return 0; }
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory 1 | #include <Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s511070478
p03816
C++
#include <bits/stdc++.h> using namespace std; int ar[1000000],cc[100050]; vector<pair<int,int> > gg[100050]; map<int,int> o; int main() { int n; cin>>n; for(int i=0;i<n;i++){ cin>>ar[i]; cc[ar[i]]++; } sort(ar,ar+n); long long h=0,l=0; for(int i=0;i<100050;i++){ int x; if(cc[i]!=0){ if(cc[i]%2==0) h++; else l++ } } if(h%2==0) cout<<l+h; else cout<<l+h-1; return 0; }
a.cc: In function 'int main()': a.cc:23:4: error: expected ';' before '}' token 23 | l++ | ^ | ; ...... 26 | } | ~
s011939971
p03816
Java
import java.util.Scanner; import java.math.*; public class Solve { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int counter = 0; int[] array = new int[N]; for (int i = 0; i < N; i++) { array[i] = scan.nextInt(); } Solve s = new Solve(); array = s.sort(array); for (int i = 0; i < N - 1; i++) { if (array[i] == array[i + 1]) { array[i + 2] = array[i + 1]; array[i] = 0; array[i + 1] = 0; i = i + 2; counter++; counter++; } } System.out.println(N - counter); } int[] spare; public int[] sort(int[] array) { spare = array; quickSort(spare, 0, spare.length - 1); return spare; } public void quickSort(int[] array, int low, int high) { if (low < high) { int p = partition(array, low, high); quickSort(array, low, p - 1); quickSort(array, p + 1, high); } } public int partition(int[] array, int low, int high) { int pivot = array[low]; int left = low + 1; int right = high; while (true) { while (array[left] <= pivot && left < high) { left = left + 1; } while (array[right] >= pivot && right > low) { right = right - 1; } if (left >= right) { int temp = array[low]; array[low] = array[right]; array[right] = temp; return right; } int temp = array[left]; array[left] = array[right]; array[right] = temp; } } }
Main.java:6: error: class Solve is public, should be declared in a file named Solve.java public class Solve { ^ 1 error
s845026873
p03816
C++
// 170516.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int>A(N); vector<int>cnt(100001); for (int i = 0; i < N; i++) { cin >> A[i]; cnt[A[i]]++; } int cnt2 = 0; int ans = 0; for (int i = 0; i < 100001; i++) { while (cnt[i] >= 3)cnt[i] -= 2; if (cnt[i] == 2) { ans++; cnt2++; } else if (cnt[i] == 1)ans++; } if (cnt2 % 2)ans--; cout << ans << endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s023844890
p03816
C++
#include<cstdio> #include<vector> #include<iostream> using namespace std; int gcd(int a,int b){if(a<b){swap(a,b);}if(b==0){return a;}return gcd(a%b,b);} int main(void){ int N,i,q,am=0; vector<bool> a; scanf("%d",&N); ans.resize(100000); for(;N>0;N--){ scanf("%d",&q); if(a[q]){am++;} a[q]=true; } if(am%2){am++;} cout<<(N-am)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | ans.resize(100000); | ^~~ | abs
s531056729
p03816
C++
#include<cstdio> #include<algorithm> #include<vetor> int N; std::vector<int> A; int lgd = 0; int lg, cnt = 0, ans, in; int main(){ scanf("%d", &N); ans = N; for(int l = 0; l < N; l++){ scanf("%d", &in); A.push_back(in); } std::sort(A.begin(), A.end()); lg = A[0]; for(int l = 1; l < N; l++){ if(lg == A[l]){ cnt++; }else{ lg = A[l]; if(cnt % 2 == 1){ ans -= (cnt - 1); }else{ lgd++; } } } printf("%d", ans - lgd); }
a.cc:3:9: fatal error: vetor: No such file or directory 3 | #include<vetor> | ^~~~~~~ compilation terminated.
s724039288
p03816
C++
#include<cstdio> #include<algorithm> #include<tuple> int N; int A[100002]; int lgd = 0; int lg, cnt = 0, ans; int main(){ scanf("%d", &N); ans = N; for(int l = 0; l < N; l++){ scanf("%d", &A[l]); } std::sort(A[0], A[N-1]); lg = A[0]; for(int l = 1; l < N; l++){ if(lg == A[l]){ cnt++; }else{ lg = A[l]; if(cnt % 2 == 1){ ans -= (cnt - 1); }else{ lgd++; } } } printf("%d", ans - lgd); }
In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:18:12: required from here 18 | std::sort(A[0], A[N-1]); | ~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:18:12: required from here 18 | std::sort(A[0], A[N-1]); | ~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int') 45 | { return *__it1 < *__it2; } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int') 45 | { return *__it1 < *__it2; } | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algo.h:61: /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:18:12: required from here 18 | std::sort(A[0], A[N-1]); | ~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1596 | std::__pop_heap(__first, __middle, __i, __comp); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:18:12: required from here 18 | std::sort(A[0], A[N-1]); | ~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 258 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 260 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:262:28: error: invalid type argument of unary '*' (have 'int') 262 | _ValueType __value = _GLIBCXX_MOVE(*__result); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:263:7: error: invalid type argument of unary '*' (have 'int') 263 | *__result = _GLIBCXX_MOVE(*__first); | ^~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:263:19: error: invalid type argument of unary '*'
s919101662
p03816
C++
#include<cstdio> #include<algorithm> #include<tuple> int N; int A[100002]; int lgd = 0; int lg, cnt = 0; int main(){ scanf("%d", &N); ans = N; for(int l = 0; l < N; l++){ scanf("%d", &A[l]); } std::sort(A); lg = A[0]; for(int l = 1; l < N; l++){ if(lg == A[l]){ cnt++; }else{ lg = A[l]; if(cnt % 2 == 1){ ans -= (cnt - 1); }else{ lgd++; } } } printf("%d", ans - lgd); }
a.cc: In function 'int main()': a.cc:13:3: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | ans = N; | ^~~ | abs a.cc:18:12: error: no matching function for call to 'sort(int [100002])' 18 | std::sort(A); | ~~~~~~~~~^~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' 4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)' 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)' 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
s415975800
p03816
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<stack> #include<queue> #include<vector> #include<algorithm> #include <iomanip> typedef long long int ll; using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define REP(i,n) for (int i=0;i<(n);i++) #define EREP(i,n) for (int i=1;i<=(n);i++) #define ALL(a) (a).begin(),(a).end() #define EVEL 1 #ifndef EVEL #define DEB(X) cout << #X << ":" <<X<<" " ; #define TF(f) f ? cout<<"true " : cout<<"false "; #define END cout<<"\n"; #else #define DEB(X) {X=X;} #define TF(f) {f=f;} #define END {} #endif const int MOD = 1000000007; const int INF = 1000000; #define NMAX 50 #define MAX 10 int N,M,A[100010],B; string S; ll X,ans=0; bool f[100010]; int main(){ ios_base::sync_with_stdio(false); cin>>N; REP(i,N)cin>>A[i]; REP(i,N){ if(!(f[A[i]])){f=true;ans++;} else {B++;} } cout<<ans-(B%2)<<endl; } //ABC057 Maximum Average Sets
a.cc: In function 'int main()': a.cc:46:23: error: incompatible types in assignment of 'bool' to 'bool [100010]' 46 | if(!(f[A[i]])){f=true;ans++;} | ~^~~~~
s627633946
p03816
C++
#include <cstdio> #include <iostream> #include <algorithm> #include <vector> #include <queue> using namespace std; int main(void) { int N; scanf("%d", &N); vector<int> a; vector<int> b; priority_queue<int> c; a.resize(N); for (int i = 0; i < N; i++) { scanf("%d", a.data() + i); } sort(a.begin(), a.end()); // unique_copy(a.begin(), a.end(),back_inserter(b)); // for (auto e: b) { // c.push(count(a.begin(), a.end(), e)); // } { int l = -1; int cnt = 0; for (auto e: a) { if (e == l) { cnt++; } else { c.push(cnt); l = e; cnt = 1; } } while (c.size() != 1) { int x,y; x = c.top(); c.pop(); while (x > (y = c.top())) { c.pop(); if (y == 1) { c.push(x); c.push(y); goto eol; } if (x == y) { x = 1; } else { x -= y - 1; } c.push(1); } c.push(x); } eol: int x = c.top(); c.pop(); x = x & 1 + (((x >> 1) * !(x & 1)) << 1); if (x != 1) { x -= 2; } c.push(x); int num = 0; while (!c.empty()) { num += c.top(); c.pop(); } printf("%d\n", num); return 0; }
a.cc: In function 'int main()': a.cc:74:2: error: expected '}' at end of input 74 | } | ^ a.cc:10:1: note: to match this '{' 10 | { | ^
s589458138
p03816
C++
#include<bits/stdc++.h> using namespace std; int N; int A[100005]; int B[100005]; int main() { scanf("%d", &N); int len = 0; for(int i=0;i<N:i++) { scanf("%d", &A[i]); B[A[i]]++; len = max(len, A[i]); } int flag = 0; int ans = 0; for(int i=1;i<=len;i++) { while(B[i]>2) B[i]-=2; if(B[i]==2) flag^=1; if(B[i]>0) ans++; } printf("%d\n", ans-flag); }
a.cc: In function 'int main()': a.cc:10:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 10 | for(int i=0;i<N:i++) | ^ a.cc:10:20: error: found ':' in nested-name-specifier, expected '::' 10 | for(int i=0;i<N:i++) | ^ | :: a.cc:10:19: error: 'N' is not a class, namespace, or enumeration 10 | for(int i=0;i<N:i++) | ^ a.cc:17:5: error: expected primary-expression before 'int' 17 | int ans = 0; | ^~~ a.cc:16:18: error: expected ')' before 'int' 16 | int flag = 0; | ^ | ) 17 | int ans = 0; | ~~~ a.cc:10:8: note: to match this '(' 10 | for(int i=0;i<N:i++) | ^ a.cc:21:22: error: 'flag' was not declared in this scope 21 | if(B[i]==2) flag^=1; | ^~~~ a.cc:22:21: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | if(B[i]>0) ans++; | ^~~ | abs a.cc:24:20: error: 'ans' was not declared in this scope; did you mean 'abs'? 24 | printf("%d\n", ans-flag); | ^~~ | abs a.cc:24:24: error: 'flag' was not declared in this scope 24 | printf("%d\n", ans-flag); | ^~~~
s422268666
p03816
C++
#include<bits/stdc++.h> using namespace std; int N; int A[100005]; int B[100005]; int main() { scanf("%d", &N); int len = 0; for(int i=0;i<N:i++;i++) { scanf("%d", &A[i]); B[A[i]]++; len = max(len, A[i]); } int flag = 0; int ans = 0; for(int i=1;i<=len;i++) { while(B[i]>2) B[i]-=2; if(B[i]==2) flag^=1; if(B[i]>0) ans++; } printf("%d\n", ans-flag); }
a.cc: In function 'int main()': a.cc:10:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 10 | for(int i=0;i<N:i++;i++) | ^ a.cc:10:20: error: found ':' in nested-name-specifier, expected '::' 10 | for(int i=0;i<N:i++;i++) | ^ | :: a.cc:10:19: error: 'N' is not a class, namespace, or enumeration 10 | for(int i=0;i<N:i++;i++) | ^ a.cc:10:28: error: expected ';' before ')' token 10 | for(int i=0;i<N:i++;i++) | ^ | ;
s004382767
p03816
C++
#include<bits/stdc++.h> using namespace std; int N; int A[100005]; int B[100005]; int main() { scanf("%d", &N); for(int i=0;i<N:i++;i++) { } }
a.cc: In function 'int main()': a.cc:9:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 9 | for(int i=0;i<N:i++;i++) | ^ a.cc:9:20: error: found ':' in nested-name-specifier, expected '::' 9 | for(int i=0;i<N:i++;i++) | ^ | :: a.cc:9:19: error: 'N' is not a class, namespace, or enumeration 9 | for(int i=0;i<N:i++;i++) | ^ a.cc:9:28: error: expected ';' before ')' token 9 | for(int i=0;i<N:i++;i++) | ^ | ;
s580021922
p03816
C++
#include <iostream> #include <cstring> #include <stdio.h> using namespace std; int a[100005]; int main(){ int n, i; cin>>n; for(i = 0; i<n; i++) cin>>a[i]; sort(a, a+n); int c = 1, e = 0, dis = 1; for(i = 0; i<n-1; i++){ if(a[i] != a[i+1]){ dis++; if(c%2 == 0) e++; c = 1; } else{ c++; } } if(e%2 == 0) cout<<dis<<endl; else cout<<dis-1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(a, a+n); | ^~~~ | short
s583913182
p03816
Java
import java.util.HashSet; public class Main { public static void main(String[] args) { HashSet<Integer> cards = new HashSet<Integer>(); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); for(int i = 0; i < num; i++) { cards.add(sc.nextInt()); } int res = cards.size(); if(res % 2 == 0) res--; System.out.println(res); } }
Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s089007285
p03816
C++
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #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> #include <fstream> #define _USE_MATH_DEFINES #include <math.h> 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(); } template<class T> inline T sqr(T x) { return x*x; } typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<long long int> vll; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define P(p) cout<<(p)<<endl; #define VEC_2D(a,b) vector<vector<int> >(a, vector<int>(b, 0)) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define INF (1100000000) #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define MOD 1000000007LL #define FSP(a) cout << fixed << setprecision(a) ll gcd(ll x, ll y) { if (y == 0) return x; else return gcd(y, x%y); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } bool is_prime(int n) { for (int i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return n != 1; } map<int, int> prime_factor(int n) { map<int, int> res; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { ++res[i]; n /= i; } } if (n != 1) res[n] = 1; return res; } int extgcd(int a, int b, int& x, int& y) {// int d = a; if (b != 0) { d = extgcd(b, a%b, y, x); y -= (a / b)*x; } else { x = 1; y = 0; } return d; } ll mod_pow(ll x, ll n, ll mod) { if (n == 0) return 1; ll res = mod_pow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } vector<string> split(const string &str, char delim) { vector<string> res; size_t current = 0, found; while ((found = str.find_first_of(delim, current)) != string::npos) { res.push_back(string(str, current, found - current)); current = found + 1; } res.push_back(string(str, current, str.size() - current)); return res; } bool is_kadomatsu(int a, int b, int c) { if (a == b || a == c || b == c)return false; if (a > b && c > b) return true; if (a < b && c < b)return true; return false; } struct UF { int n; vi d; UF() {} UF(int n) :n(n), d(n, -1) {} int root(int v) { if (d[v] < 0) return v; return d[v] = root(d[v]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (size(x) < size(y)) swap(x, y); d[x] += d[y]; d[y] = x; return true; } int size(int v) { return -d[root(v)]; } }; vector<int> divisor(int n) { if (n == 1) return{}; vi res; for (int i = 1; i*i <= n; i++) { if (n%i == 0) { res.emplace_back(i); if (i != 1 && i != n / i)res.emplace_back(n / i); } } return res; } //------------------------------------------------------------- double get_length(double x, double y) { return sqrt(x*x + y*y); } double product(double x1, double y1, double x2, double y2) { return x1*x2 + y1*y2; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; set<int> ans; rep(i, n) { int a; cin >> a; ans.insert(a); } if (ans.size() % 2 == 0) { P(ans.size()) - 1); } else { P(ans.size()); } return 0; }
a.cc: In function 'int main()': a.cc:177:34: error: expected ';' before ')' token 177 | P(ans.size()) - 1); | ^ | ;
s852870981
p03816
C
#include<iostream> #include<list> using namespace std; int main(void){ int i; int N; int A[100001]; int hoge[100001]={0}; int cnt=0; scanf("%d",&N); int ans = N; for(i=0;i<N;i++){ scanf("%d",&A[i]); hoge[A[i]]++; } for(i=1;i<N;i++){ if(hoge[i]>1)cnt+=(hoge[i] - 1); } if(cnt%2==0){ans -= cnt;} else{ans -= cnt-1;} printf("%d\n",ans); return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s711425657
p03816
C++
#include<iostream> #include<algorithm> #include<set> using namespace std; int main(void) { int n; while(cin>>n) { s.clear(); for(int i=0;i<n;i++) { int x; cin>>x; s.insert(x); } if(s.size()%2==0) cout<<s.size()-1<<endl; else cout<<s.size()<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 's' was not declared in this scope 10 | s.clear(); | ^
s172960802
p03816
C
int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} for(i=0;i<n;i++)ans+=f[i+1]; printf("%lld\n",ans-ans%2?0:1);return 0;} int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} for(i=0;i<n;i++)ans+=f[i+1]; printf("%lld\n",ans);return 0;}
main.c: In function 'main': main.c:2:56: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main.c:2:56: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} | ^~~~~ main.c:2:56: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:4:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 4 | printf("%lld\n",ans-ans%2?0:1);return 0;} | ^~~~~~ main.c:4:1: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:4:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:4:1: note: include '<stdio.h>' or provide a declaration of 'printf' main.c: At top level: main.c:6:5: error: redefinition of 'main' 6 | int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} | ^~~~ main.c:2:5: note: previous definition of 'main' with type 'int(void)' 2 | int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} | ^~~~ main.c: In function 'main': main.c:6:56: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 6 | int main(void){int a[100000],n,f[100001]={0},i,j,ans=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);f[a[i]]=1;} | ^~~~~ main.c:6:56: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:8:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 8 | printf("%lld\n",ans);return 0;} | ^~~~~~ main.c:8:1: note: include '<stdio.h>' or provide a declaration of 'printf'
s697339195
p03816
C++
/* template.cpp(shinobu_menkoi) {{{ */ #include <bits/stdc++.h> using namespace std; // clang-format off #define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME #define rep(...) GET_MACRO(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rep1(n) rep2(_, n) #define rep2(i, n) rep3(i, 0, n) #define rep3(i, a, n) rep4(i, a, n, 1) #define rep4(i, a, n, s) for (lint i = (a); i < (lint)(n); i += (s)) #define rrep(...) GET_MACRO(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__) #define rrep1(a) rrep2(_, a) #define rrep2(i, a) rrep3(i, a, 0) #define rrep3(i, a, n) rrep4(i, a, n, 1) #define rrep4(i, a, n, s) for (lint i = (a); i >= (lint)(n); i -= (s)) #define each(i, ctn) for (auto &&i : (ctn)) #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(v) begin(v), end(v) #define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n' #define TEMP_T template <class T> #define TEMP_TU template <class T, class U> TEMP_T using vec = vector<T>; TEMP_T using heap = priority_queue<T>; TEMP_T using minheap = priority_queue<T, vec<T>, greater<T>>; using lint = long long; using ulint = unsigned long long; using ld = long double; using vi = vec<int>; using vvi = vec<vi>; using vvvi = vec<vvi>; using pii = pair<int, int>; using vs = vec<string>; TEMP_TU ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << p.fi << " " << p.se; } TEMP_TU istream &operator>>(istream &is, pair<T, U> &p) { return is >> p.fi >> p.se; } const int INF{1001001001}; const lint LINF{1001001001001001001ll}; const int MOD{(int)1e9 + 7}; const double EPS{1e-9}; const double PI{acos(-1)}; const int dx[]{0, 1, 0, -1, 1, -1, 1, -1}, dy[]{1, 0, -1, 0, 1, -1, -1, 1}; inline bool inside(int y, int x, int h, int w) { return y >= 0 && x >= 0 && y < h && x < w; } TEMP_T inline bool chmin(T &a, const T &b) { if (a > b) a = b; return a > b; } TEMP_T inline bool chmax(T &a, const T &b) { if (a < b) a = b; return a < b; } TEMP_T inline void print(const T &x) { cout << x << '\n'; } TEMP_T inline void print(const vec<T> &v, string d = "\n") { rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? "\n" : d); } template <class T = int> inline T in() { T x; cin >> x; return x; } template <class T = string> vec<T> split(const string &s, char d = ',') { vec<T> v; stringstream ss(s); for (string b; getline(ss, b, d); ) { stringstream conv(b); T t; conv >> t; v.eb(t); } return v; } struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } pre__; // clang-format on /* }}} */ unordered_map<int, int> m; signed main() { int n = in(); rep(i, n) { int a = in(); m[a]++; } vi v; int sum = 0; each(t, m) { if (t.se > 1) { v.pb(t.se - 1); sum += t.se - 1; } } print(v - sum % 2); }
a.cc: In function 'int main()': a.cc:82:11: error: no match for 'operator-' (operand types are 'vi' {aka 'std::vector<int>'} and 'int') 82 | print(v - sum % 2); | ~ ^ ~~~~~~~ | | | | | int | vi {aka std::vector<int>} In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /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:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 82 | print(v - sum % 2); | ^ /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:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::move_iterator<_IteratorL>' 82 | print(v - sum % 2); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::complex<_Tp>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::complex<_Tp>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:82:19: note: mismatched types 'const std::complex<_Tp>' and 'int' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:82:19: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:82:19: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::valarray<_Tp>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:82:19: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::valarray<_Tp>' 82 | print(v - sum % 2); | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:82:19: note: mismatched types 'const std::valarray<_Tp>' and 'int' 82 | print(v - sum % 2); | ^
s641346586
p03816
C++
#include "iostream" #include "climits" #include "list" #include "queue" #include "set" #include "functional" #include "algorithm" #include "math.h" #include "utility" using namespace std; const long long int MOD = 1000000007; int N; int box; int num[100001]; int s, e; int box; int ans=0; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> box; num[box]++; } s = -1; for (int i = 1; i < 100001; i++) { if (s == -1) { if (num[i] > 1) { s = i; } } if (num[i] > 1)e = i; } if (s == -1) { cout << N << endl; } box = 0; while (1) { num[s]--; num[e]--; box += 2; for (int i = s; i <= e; i++) { s = -1; if (num[i] > 1) { s = i; break; } } if (s == -1) { break; } for (int i = e; i >= s; i--) { if (num[i] > 1) { e = i; break; } } } cout << N - box << endl; return 0; }
a.cc:18:5: error: redefinition of 'int box' 18 | int box; | ^~~ a.cc:15:5: note: 'int box' previously declared here 15 | int box; | ^~~
s998719894
p03816
C++
#include <iostream> #include <vector> #include <map> using namespace std; int main(){ int n; cin >> n; vector<int> v; for(int i = 0; i < n; i++){ int t; cin >> t; v.push_back(t); } sort(v.begin(),v.end()); vector<int> k; map<int, int> counter; for(int i = 0; i < n; i++){ if(counter.count(v[i]) != 0){ counter[v[i]]++; }else{ counter[v[i]] = 1; k.push_back(v[i]); } } int kl = k.size(); while(true){ int l = -1; int r = -1; for(int i = 0; i < kl; i++){ if(counter[k[i]] > 1){ if(l == -1){ l = k[i]; } r = k[i]; } } if(r == -1){ break; } counter[l]--; counter[r]--; } int result = 0; for(auto itr = counter.begin(); itr != counter.end(); ++itr){ if(itr->second > 0){ result++; } } cout << result << endl; }
a.cc: In function 'int main()': a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(v.begin(),v.end()); | ^~~~ | short
s005149749
p03816
C++
#include<iostream> using namespace std; int n, a, num[100001] = {}, max = 0, two = 0, ans = 0; int main(){ cin >> n; for (int i = 0; i < n; i++){ cin >> a; num[a]++; if (num[a] == 3){ num[a] = 1; } if (a > max){ max = a; } } for (int i = 1; i <= max; i++){ if (num[i] > 0){ ans++; } if (num[i] == 2){ two++; } } ans -= two % 2; cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:17:25: error: reference to 'max' is ambiguous 17 | if (a > max){ | ^~~ 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:303:5: note: candidates are: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:4:29: note: 'int max' 4 | int n, a, num[100001] = {}, max = 0, two = 0, ans = 0; | ^~~ a.cc:18:25: error: reference to 'max' is ambiguous 18 | max = a; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:4:29: note: 'int max' 4 | int n, a, num[100001] = {}, max = 0, two = 0, ans = 0; | ^~~ a.cc:22:30: error: reference to 'max' is ambiguous 22 | for (int i = 1; i <= max; i++){ | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:4:29: note: 'int max' 4 | int n, a, num[100001] = {}, max = 0, two = 0, ans = 0; | ^~~
s700816649
p03816
C++
#include <vector> #include <iostream> using namespace std; int main(){ int n; cin >> n; int a[n]; int i = 0, j = n-1, ans = n; while(i < n){ cin >> a[i]; i++; } sort(a, a+n); i = 0; while(i < j){ while(a[i] != a[i+1] && i < n) i++; while(a[j-1] != a[j] && j > 0) j--; if(i == n-1 && j == 1) break; ans -= 2; i++; j--; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(a, a+n); | ^~~~ | short
s692074052
p03816
C++
#include <algorithm>//min/max/sort(rand-access it)/merge #include <array> #include <bitset> // #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration #include <climits>//INT_MAX/INT_MIN/ULLONG_MAX #include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc #include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort // #include <fstream>//ifstream/ofstream #include <iomanip>//setfill/setw/setprecision/fixed/scientific #include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific #include <iterator> #include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN #include <list> #include <queue> #include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline #include <tuple> #include <utility>//pair #include <valarray> #include <vector> #define PRIME_SHORT 10007 #define PRIME 1000000007 using namespace std; typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, int> plli; typedef pair<ull, int> puli; typedef pair<double, int> pdi; typedef pair<ll, ll> pllll; typedef pair<ull, ull> pulul; typedef pair<double, double> pdd; typedef tuple<int, int, int> ti3; typedef tuple<int, int, int, int> ti4; const bool debug = false; template<typename T> void rar(size_t n, T* a); template<typename T> void rar2(size_t n, size_t m, T** a); template<typename T> T ipow(T base, T exp); inline size_t left(size_t current, bool swap); inline size_t right(size_t current, bool swap); template<typename T> inline T griddist(T x, T y, T s, T t); template<typename T> inline T griddist(pair<T, T> one, pair<T, T> two); template<typename T> inline T griddist(tuple<T, T> one, tuple<T, T> two); template<typename T> inline T sqeucldist(T x, T y, T s, T t); template<typename T> inline T sqeucldist(pair<T, T> one, pair<T, T> two); template<typename T> inline T sqeucldist(tuple<T, T> one, tuple<T, T> two); inline ull modadd(ull a, ull b, int mod); inline ull modmult(ull a, ull b, int mod); int main(void) { int n; cin >> n; int* arr = new int[n]; rar(n, arr); //debug output if (debug) { //1D cout << "arr" << endl; for (int i = 0; i < n; ++i) { cout << arr[i] << "\t"; } //2D cout << "\nrra" << endl; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cout << rra[i][j] << "\t"; } cout << endl; } } sort(arr.begin(), arr.end()); int mine = arr[0]; int maxe = arr[n-1]; vector<int> counter(maxe+1, 0); for (size_t i = 0; i < n; ++i) { ++counter[arr[i]]; } int totalcount = 0; for (size_t i = 0; i <= maxe; ++i) { if (counter[i] > 1) { totalcount += counter[i] - 1; } } cout << totalcount << endl; return 0; } template<typename T> void rar(size_t n, T* a) { for (size_t i = 0; i < n; ++i) cin >> a[i]; return; }
a.cc: In function 'int main()': a.cc:80:33: error: 'm' was not declared in this scope 80 | for (int j = 0; j < m; ++j) | ^ a.cc:82:25: error: 'rra' was not declared in this scope; did you mean 'rar'? 82 | cout << rra[i][j] << "\t"; | ^~~ | rar a.cc:88:14: error: request for member 'begin' in 'arr', which is of non-class type 'int*' 88 | sort(arr.begin(), arr.end()); | ^~~~~ a.cc:88:27: error: request for member 'end' in 'arr', which is of non-class type 'int*' 88 | sort(arr.begin(), arr.end()); | ^~~
s376632638
p03817
C++
#include <iostream> using ll = long long; using namespace std; int main(){ ll x; scanf("%lld", &x); ll ans = 2*x/11; x %= 11; ans += (x+5)/6 printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:9:23: error: expected ';' before 'printf' 9 | ans += (x+5)/6 | ^ | ; 10 | printf("%lld\n", ans); | ~~~~~~
s890737857
p03817
C++
#include <algorithm> #include <bitset> #include <tuple> #include <cstdint> #include <cstdio> #include <cctype> #include <assert.h> #include <stdlib.h> #include <stdio.h> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <limits> #include <map> #include <memory> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using ll = long long; using ld = long double; #define endl "\n" //#define int long long #define all(V) V.begin(),V.end() #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i,n) for(int i=1;i<=(n);i++) const int MOD = 1e9 + 7; const ll INF = 1LL << 60; const int inf = 1 << 25; constexpr long double pi = 3.141592653589793238462643383279; int dx[] = { 1,0,-1,0 }; int dy[] = { 0,1,0,-1 }; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } ll fact_mod(ll n, ll mod) { ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod; return f; } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } ll keta(ll n) { if (n == 0) return 1; ll count = 0; while (n != 0) { n /= 10; count++; } return count; } ll ketasum(ll n) { ll sum = 0; while (n != 0) { sum += n % 10; n /= 10; } return sum; } ll mch(ll n) { if (n == 1) return 1; else return n * mch(n - 1); } ll pow_mod(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき) x = (x * x) % mod; n >>= 1; //右シフト(n = n >> 1) } return res; } ll inv_mod(ll a, ll mod) { ll b = mod, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= mod; if (u < 0) u += mod; return u; } bool is_prime(const unsigned n) { switch (n) { case 0: // fall-through case 1: return false; case 2: // fall-through case 3: return true; } // n > 3 が保証された if (n % 2 == 0 || n % 3 == 0) return false; for (unsigned i = 5; i * i <= n; i += 6) { if (n % i == 0) return false; // (6の倍数)-1 if (n % (i + 2) == 0) return false; // (6の倍数)+1 } return true; } //関数とか //宣言とか /*signed*/int main(void) { ll x; cin >> x; if (x <= 6) cout << 1 << endl; else if (x <= 11) cout << 2 << endl; else { ll S = x / 11; ll A = x % 11; if (A == 0) cout << S * 2 << endl; else if (A <= 6) cout << S * 2 + 1 << endl; else cout << S * 2 + 2 << endl; }
a.cc: In function 'int main()': a.cc:144:2: error: expected '}' at end of input 144 | } | ^ a.cc:133:26: note: to match this '{' 133 | /*signed*/int main(void) { | ^
s029572944
p03817
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for (ll i = 0; i < (n); ++i) int main() { ll x; cin >> x; if(x<=6){ cout << 1 << endl; return(0); }else if(x<=11){ cout << 2 << endl; return(0); } ll q,r; q = x/11; r = x%11; if(r == 0){ cout << 2*q << endl; else if(r <= 6){ cout << 2*q+1 << endl; }else{ cout << 2*q+2 << endl; } return(0); }
a.cc: In function 'int main()': a.cc:22:3: error: expected '}' before 'else' 22 | else if(r <= 6){ | ^~~~ a.cc:20:13: note: to match this '{' 20 | if(r == 0){ | ^
s021167256
p03817
C++
#include<iostream> using namespace std; int main(){ long long x; cin >> x; if(x < 6) cout << 1 << endl; else if(x % 11 > 5) cout << (x / 11)*2 + 2 << endl; else cout << (x / 11) *2 + 1 << endl; return 0;
a.cc: In function 'int main()': a.cc:10:12: error: expected '}' at end of input 10 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s939673836
p03817
C++
#include<iostream> using namespace std; int main(){ long long x; cin >> x; if(x % 11 > 5) cout << (x / 11)*2 + 2 << endl; else if(x % 11 == 1) cout << (x / 11)*2 << endl; else cout << (x / 11) *2 + 1 << endl; return 0;
a.cc: In function 'int main()': a.cc:10:12: error: expected '}' at end of input 10 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s827911343
p03817
C++
#include<iostream> using namespace std; int main(){ long long x; cin >> x; if(x % 11 > 5) cout << (x / 11)*2 + 2 << endl; else id(x % 11 == 1) cout << (x / 11)*2 << endl; else cout << (x / 11) *2 + 1 << endl; return 0;
a.cc: In function 'int main()': a.cc:8:8: error: 'id' was not declared in this scope 8 | else id(x % 11 == 1) cout << (x / 11)*2 << endl; | ^~ a.cc:9:3: error: 'else' without a previous 'if' 9 | else cout << (x / 11) *2 + 1 << endl; | ^~~~ a.cc:10:12: error: expected '}' at end of input 10 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s886878206
p03817
C++
#include<stdio.h> #include<iostream> #include<vector> #include<math.h> #include<queue> #include<map> #include<algorithm> #include<string.h> #include<functional> #include<limits.h> #include<stdlib.h> #include<cmath> #include<cstring> #include<set> #include<climits> using namespace std; #define intmax INT_MAX #define lmax LONG_MAX #define uintmax UINT_MAX #define ulmax ULONG_MAX #define llmax LLONG_MAX #define ll long long #define rep(i,a,N) for((i)=(a);(i)<(N);(i)++) #define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--) #define llfor ll i,j #define sc(a) cin>>a #define pr(a) cout<<a<<endl #define pY puts("YES") #define pN puts("NO") #define py puts("Yes") #define pn puts("No") #define pnn printf("\n") #define all(a) a.begin(),a.end() #define push(a,b) (a).push_back(b) #define llvec vector<vector<ll>> #define charvec vector<vector<char>> #define size(a,b) (a,vector<ll>(b)) #define llpvec vector<pair<ll,ll>> /*pi*/double pi=acos(-1); /*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;} /*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;} /*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;} /*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;} /*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;} /*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);} /*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);} /*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;} /*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];} llfor;ll ans=0;//////////////////////////////////////////////////////////// int main(){ ll n; sc(n); ll cnt=0; cnt=(n/11)*2; n%=11; if(n>5)cnt++; if(n!=0%%n!=5)cnt++; pr(cnt); return 0;}
a.cc: In function 'int main()': a.cc:58:10: error: expected primary-expression before '%' token 58 | if(n!=0%%n!=5)cnt++; | ^
s248670208
p03817
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int,int>; const int INF=1000000007; int main() { ll n; cin >> n; ll ans = 2*(n/11); if(n%11==0) continue; else if(n%11<=6) ans++; else ans+=2; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:15: error: continue statement not within a loop 12 | if(n%11==0) continue; | ^~~~~~~~
s128442679
p03817
C++
#include <bits/stdc++.h> using namespace std; int main() { int A; cin >> A; if(A <= 6){ cout << 1 << endl; exit; } for(int YUNI = 0; YUNI < A; YUNI++){ }
a.cc: In function 'int main()': a.cc:16:4: error: expected '}' at end of input 16 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s603745225
p03817
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) typedef long long int ll; int main() { ll res = 0; res += (n/11)*2; n %= 11; if(n <= 5) res += 1; else res += 2; cout << res << endl; }
a.cc: In function 'int main()': a.cc:9:11: error: 'n' was not declared in this scope; did you mean 'yn'? 9 | res += (n/11)*2; | ^ | yn
s009797078
p03817
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { long long N; cin>>N; long long counter=0; cout<<1<<endl; if(N%11=0) cout<<N*2/11<<endl; else if(N%11<=6) cout<<(N/11)*2+1<<endl; else cout<<N/11+2<<endl;}
a.cc: In function 'int main()': a.cc:10:7: error: lvalue required as left operand of assignment 10 | if(N%11=0) | ~^~~
s080592562
p03817
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; const int N = pow(10,5); vector<bool> isp(N+1, true); void sieve() { isp[0] = false; isp[1] = false; for (int i=2; pow(i,2)<=N; i++) { if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false; } } int main() { long long N, cin>>N; long long counter=0; if(N<=6) cout<<1<<endl; else if(N%11<=6) cout<<(N/11)*2+1<<endl; else cout<<N/11+2<<endl;}
a.cc: In function 'int main()': a.cc:20:6: error: expected initializer before '>>' token 20 | cin>>N; | ^~
s664821901
p03817
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; const int N = pow(10,5); vector<bool> isp(N+1, true); void sieve() { isp[0] = false; isp[1] = false; for (int i=2; pow(i,2)<=N; i++) { if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false; } } int main() { long long N, long long a[N]; cin>>N; long long counter=0; if(N<=6) cout<<1<<endl; else if(N%11<=6) cout<<(N/11)*2+1<<endl; else cout<<N/11+2<<endl;}
a.cc: In function 'int main()': a.cc:20:3: error: expected unqualified-id before 'long' 20 | long long a[N]; | ^~~~
s895686210
p03817
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const long long INF= 1e+18+1; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000000007LL; string abc="abcdefghijklmnopqrstuvwxyz"; string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main(){ ll x;cin>>x; ll d=x/11; ll x%=11; if(x<=0)cout<<2*d<<endl; else if(x<=5)cout<<2*d+1<<endl; else cout<<2*d+2<<endl; }
a.cc: In function 'int main()': a.cc:18:7: error: expected initializer before '%=' token 18 | ll x%=11; | ^~
s175254636
p03817
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #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 sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } 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<<' '; } } } 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 gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;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; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ if(n<r) return 0; int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } int modinv(int a,int m){ int b=m,u=1,v=0; while(b){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } u%=m; if(u<0) u+=m; return u; } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; /* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(205); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; signed main(){ int x; cin>>x; int a=x; int cnt=0; fo(i,a){ if(x<=0) break; if(i%2==0){ cnt++; x-=6; } else{ cnt++; x-=5; } } cout<<cnt<endl; }
a.cc: In function 'int main()': a.cc:394:12: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 394 | cout<<cnt<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:394:13: note: couldn't deduce template parameter '_Bi_iter' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:394:13: note: couldn't deduce template parameter '_Bi_iter' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 394 | cout<<cnt<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 394 | cout<<cnt<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 394 | cout<<cnt<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:394:13: note: couldn't deduce template parameter '_CharT' 394 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:394:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 394 |
s643213642
p03817
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #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 sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } 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<<' '; } } } 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 gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;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; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ if(n<r) return 0; int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } int modinv(int a,int m){ int b=m,u=1,v=0; while(b){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } u%=m; if(u<0) u+=m; return u; } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; /* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(205); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; signed main(){ int x; cin>>x; int cnt=0; fo(i,n){ if(x<=0) break; if(i%2==0){ cnt++; x-=6; } else{ cnt++; x-=5 } } cout<<cnt<endl; }
a.cc: In function 'int main()': a.cc:380:8: error: 'n' was not declared in this scope 380 | fo(i,n){ | ^ a.cc:5:31: note: in definition of macro 'fo' 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^ a.cc:390:11: error: expected ';' before '}' token 390 | x-=5 | ^ | ; 391 | } | ~ a.cc:393:12: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 393 | cout<<cnt<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:393:13: note: couldn't deduce template parameter '_Bi_iter' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:393:13: note: couldn't deduce template parameter '_Bi_iter' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 393 | cout<<cnt<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 393 | cout<<cnt<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 393 | cout<<cnt<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:393:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:393:13: note: couldn't deduce template parameter '_CharT' 393 | cout<<cnt<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const
s121008790
p03817
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #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 sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } 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<<' '; } } } 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 gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;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; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ if(n<r) return 0; int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } int modinv(int a,int m){ int b=m,u=1,v=0; while(b){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } u%=m; if(u<0) u+=m; return u; } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; /* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(205); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; signed main(){ int x; cin>>x; int cnt=x%11; int ans+=(x/11)*2; if(cnt>0) ans++; if(cnt>6) ans++; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:380:10: error: expected initializer before '+=' token 380 | int ans+=(x/11)*2; | ^~ a.cc:382:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 382 | ans++; | ^~~ | abs a.cc:384:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 384 | ans++; | ^~~ | abs a.cc:385:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 385 | cout<<ans<<endl; | ^~~ | abs
s024780322
p03817
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #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 sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } 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<<' '; } } } 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 gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;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; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ if(n<r) return 0; int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } int modinv(int a,int m){ int b=m,u=1,v=0; while(b){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } u%=m; if(u<0) u+=m; return u; } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; /* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(205); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; signed main(){ int x; cin>>x; int a=6; int cnt=1; x-=6; fo(i,n){ if(a>=x){ break; } if(a==6){ a=5; cnt++; x-=5; } if(a==5){ a=6; cnt++; x-=6; } } cout<<cnt<<endl; }
a.cc: In function 'int main()': a.cc:382:8: error: 'n' was not declared in this scope 382 | fo(i,n){ | ^ a.cc:5:31: note: in definition of macro 'fo' 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^
s465310766
p03817
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define REPR(i,n) for(int i=n; i>-1; --i) #define ALL(a) (a).begin(),(a).end() #define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); } #define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; } #define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} } #define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} } #define Liny "Yes\n" #define Linn "No\n" #define LINY "YES\n" #define LINN "NO\n" #define umap unordered_map //cout << setfill('0') << right << setw(4) << 12; // "0012" int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}} int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} } int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );} ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);} ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;} int main(){ ll x; cin>>x; ll amari = x%11; ll r; if(amari==0){ r = (X*2)/11; }else if(amari<=5){ r = (x*2)/11 + 1; }else{ r = (x*2)/11 + 2; } cout << r; }
a.cc: In function 'int main()': a.cc:32:10: error: 'X' was not declared in this scope 32 | r = (X*2)/11; | ^
s804386597
p03817
C++
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define intll int long long int main() { intll n; cin >> n; if(n/11 == 0) cout << n/11 *2 << endl; else if(n/11 >=7) cout << n/11*2 +2 << endl; else cout << n.11*2+1 << endl; }
a.cc: In function 'int main()': a.cc:16:14: error: expected ';' before numeric constant 16 | cout << n.11*2+1 << endl; | ^~~ | ;
s723409875
p03817
C++
#include<bits/stdc++.h> using namespace std; int main() { long long x; cin >> x; ll ans = (x / 11) * 2; x %= 11; if (x > 0) ans++; if (x > 6) ans++; cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:6:3: error: 'll' was not declared in this scope 6 | ll ans = (x / 11) * 2; | ^~ a.cc:8:14: error: 'ans' was not declared in this scope; did you mean 'abs'? 8 | if (x > 0) ans++; | ^~~ | abs a.cc:9:14: error: 'ans' was not declared in this scope; did you mean 'abs'? 9 | if (x > 6) ans++; | ^~~ | abs a.cc:10:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | cout << ans << '\n'; | ^~~ | abs
s299320080
p03817
C++
#include<iosteam> using namespace std; int main(){ long long x; cin >> x; long long ans; ans = x*2/11; if(ans*11==x) cout << ans << endl; if(ans*11<x && ans*11<x-6) cout << ans+1 << endl; }
a.cc:1:9: fatal error: iosteam: No such file or directory 1 | #include<iosteam> | ^~~~~~~~~ compilation terminated.
s754080823
p03817
C
#include<stdio.h> int main(){ long long int x; scanf("%lld",&x); long long int ans; if(x11==0||x%11==6){ ans=x*2/11;; }else{ ans=(x*2)/11+1; } printf("%lld\n",ans); return 0; }
main.c: In function 'main': main.c:6:8: error: 'x11' undeclared (first use in this function) 6 | if(x11==0||x%11==6){ | ^~~ main.c:6:8: note: each undeclared identifier is reported only once for each function it appears in
s413630500
p03817
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long x; scanf("%lld",&x); x *= 2; x = (x/11) + min(1,x%11); printf("%lld",x); }
a.cc: In function 'int main()': a.cc:7:19: error: no matching function for call to 'min(int, long long int)' 7 | x = (x/11) + min(1,x%11); | ~~~^~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:7:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 7 | x = (x/11) + min(1,x%11); | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:7:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 7 | x = (x/11) + min(1,x%11); | ~~~^~~~~~~~
s801879493
p03817
C++
#include <bits/stdc++.h> using namespace std; using ll = unsigned long long; int main() { ll x; cin >> x; ll result = 0; ll div = x / 11; ll mod = x % 11; result += div * 2; if (mod == 0) { continue; } else if (5 < mod) { result += 2; } else { ++result; } cout << result << endl; }
a.cc: In function 'int main()': a.cc:13:5: error: continue statement not within a loop 13 | continue; | ^~~~~~~~
s228963949
p03817
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long x; cin>>x; cout<<x/11*2;<<endl; }
a.cc: In function 'int main()': a.cc:6:18: error: expected primary-expression before '<<' token 6 | cout<<x/11*2;<<endl; | ^~
s017327414
p03817
C++
#include <iostream> #include <vector> #include <cstring> #include <algorithm> // sort #define REP(i, n) for (long long i = 0; i < (n); i++) typedef long long ll; static const ll MOD = 1000000007; static const ll INF = 1000000000000000000LL; using namespace std; //arc068_c //サイコロの6と5を繰り返せば良い //x / 11 と x / 6 int main(){ ll X,res; cin >> X; res = (X / 11) * 2; X %= 11; if(X != 0) { if(X > 6)res+=2; else res++ } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:26:15: error: expected ';' before '}' token 26 | else res++ | ^ | ; 27 | } | ~
s043675545
p03817
C++
#include <bits/stdc++.h> using namespace std; int main() { long x; long sum=0; while(X>0){ if(sum%2==0)X-=6; else X-=5; sum++; } cout << sum; }
a.cc: In function 'int main()': a.cc:7:9: error: 'X' was not declared in this scope 7 | while(X>0){ | ^
s856981668
p03817
C++
#include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #define LL long long #define INF 0x3f3f3f3f using namespace std; const int N=2e5+100; int arr[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); LL n; while(cin>>n) { LL ans=0; if(n<7) { ans=0; } else if(n==7) { ans=2; } else if(n<=11) { ans=1; } else { ans=n/11*2-; if(n%11==0)ans+=0; else if(n%11<=6)ans+=1; else ans+=2; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:24: error: expected primary-expression before ';' token 26 | ans=n/11*2-; | ^
s779017401
p03817
C++
#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<utility> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #define EPS 1e-9 #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long const int MOD = 1E9+7; const int N = 1000+5; const int dx[] = {0,0,-1,1,-1,-1,1,1}; const int dy[] = {-1,1,0,0,-1,1,-1,1}; using namespace std; int main(){ LL x; scanf("%lld",&x); LL res; if(x<=6) res=1; else{ if(x%11==0) res=(x/11)*2; else{ LL before=(x/11)*2; x-=before*11; if(x<=6) res=before+1; else res=before+2; } } printf("%ll d\n",res); return 0; }
a.cc:44:12: warning: missing terminating " character 44 | printf("%ll | ^ a.cc:44:12: error: missing terminating " character 44 | printf("%ll | ^~~~ a.cc:45:13: error: stray '\' in program 45 | d\n",res); | ^ a.cc:45:15: warning: missing terminating " character 45 | d\n",res); | ^ a.cc:45:15: error: missing terminating " character 45 | d\n",res); | ^~~~~~~ a.cc: In function 'int main()': a.cc:45:12: error: 'd' was not declared in this scope 45 | d\n",res); | ^
s673897085
p03817
C++
#include <iostream> #include <cstdio> #include <cstring> #include <vector> using namespace std; #define INF 0x7fffffff #define PI acos(-1.0) #define MOD 2520 #define E 1e-12 #define ll long long using namespace std; #define N 1500 int a[N]; int main() { ll n; scanf("%lld",&n); if(n==6) { cout<<1<<endl; return; } if(n<=5) { cout<<1<<endl; } else { ll ans=1; n-=5; ll x=n/11; ll y=n%11; ans+=2*x; if(y<=6&&y>=1) { ans++; } else { ans+=2; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:17: error: return-statement with no value, in function returning 'int' [-fpermissive] 21 | return; | ^~~~~~
s308175409
p03817
C++
#include <bits/stdc++.h> using namespace std; int main(){ ll x,ans; cin >> x; ans = x/11; ans *= 2; x %= 11; if(x == 0); else if(x <= 5)ans++; else ans += 2; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:4:3: error: 'll' was not declared in this scope 4 | ll x,ans; | ^~ a.cc:5:10: error: 'x' was not declared in this scope 5 | cin >> x; | ^ a.cc:6:3: error: 'ans' was not declared in this scope; did you mean 'abs'? 6 | ans = x/11; | ^~~ | abs
s070134132
p03817
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long x, cnt = 0; cin >> x; if(x > 11){ cnt = x / 11; x %= 11; } if(x == 0) cout << cnt * 2 << endl; else if((x < 7) && (x > 0)) cout << 1 + cnt * 2 << endl; else if((x < 11) && (x > 0))cout << 2 + cnt * 2 << endl; return 0;
a.cc: In function 'int main()': a.cc:17:12: error: expected '}' at end of input 17 | return 0; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s359365158
p03817
C++
#include <bits/stdc++.h> using namespace std; int main() { long x; cin >> x; cout << max(1, min((x / 11) * 2 + 2, ((x + 4) / 11) * 2 + 1)) << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:16: error: no matching function for call to 'max(int, const long int&)' 7 | cout << max(1, min((x / 11) * 2 + 2, ((x + 4) / 11) * 2 + 1)) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:7:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 7 | cout << max(1, min((x / 11) * 2 + 2, ((x + 4) / 11) * 2 + 1)) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:7:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 7 | cout << max(1, min((x / 11) * 2 + 2, ((x + 4) / 11) * 2 + 1)) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s906962807
p03817
C++
#include <bits/stdc++.h> using namespace std; using lli = long long int; using Vint = vector<int>; using Vlli = vector<lli>; using Wint = vector<Vint>; using Wlli = vector<Vlli>; using pii = pair<int, int>; using pll = pair<lli, lli>; const int MOD = 1e9 + 7; const int INFi = 2e9 + 1; const lli INFl = (lli)(9e18) + 1; const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)}; #define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++) #define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++) #define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--) #define REP(i, n) FOR(i, 0, n) #define rREP(i, n) rFOR(i, 0, (n-1)) #define vREP(i, vec) for(auto &(i) : (vec)) template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();} template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();} template <class T> inline void chmax(T &a, T b){a = max(a, b);} template <class T> inline void chmin(T &a, T b){a = min(a, b);} // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int main(void){ lli x, q, p; cin >> x; p = x / 11; q = x % 11; if(q == 0) cout << 2 * p << "\n"; else cout << (2 * p + 1) + (q > 6) << "\n"; return 0;
a.cc: In function 'int main()': a.cc:39:12: error: expected '}' at end of input 39 | return 0; | ^ a.cc:34:15: note: to match this '{' 34 | int main(void){ | ^