submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s132131047
p03701
C
#include <stdio.h> void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void bubbleSort(int arr[], int n) { int i, j; for (i = 0;i < n - 1; i++) for (j = 0; j < n - i - 1; j++) if (arr[j] > arr[j + 1]) swap(&arr[j], &arr[j + 1]); } int main(void) { int n; scanf("%d", &n); int s[n]; int i; for (i = 0; i < n; i++) scanf("%d", &s[i]); bubbleSort(s, n); int sum = 0; for (i = 0; i < n; i++) sum += s[i]; if (sum % 10 == 0) { printf("%d\n", sum); return 0; } else { for (i = 0; i < n; i++) if (s[i] % 10) { j = s[i]; printf("%d\n", sum - j); return 0; } } printf("0\n"); return 0; }
main.c: In function 'main': main.c:42:17: error: 'j' undeclared (first use in this function) 42 | j = s[i]; | ^ main.c:42:17: note: each undeclared identifier is reported only once for each function it appears in
s786110982
p03701
C++
#include <iostream> #include <string> #include <algorithm> #include <string> using namespace std; int main() { int n, ans = 0; cin >> n; int s[n]; for (int i = 0; i < n; i++) { cin >> s[i]; ans += s[i]; } sort(s, s + n); if (ans % 10 == 0){ for (i = 0; i < n; i++){ if (s[i] % 10 != 0){ ans -= s[i]; cout << ans << endl; return 0; } } } cout << 0 << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:14: error: 'i' was not declared in this scope 16 | for (i = 0; i < n; i++){ | ^
s782762242
p03701
C++
#include<iostream> #include<algorithm> using namespace std; int n; int a[101]; long long sum; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; sum+=a[i]; } sort(a+1,a+n+1); int k=1; while(sum%10==0&&k<=nd) { sum-=a[k]; k++; } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:17:29: error: 'nd' was not declared in this scope; did you mean 'n'? 17 | while(sum%10==0&&k<=nd) | ^~ | n
s718747890
p03701
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,sum=0; int s[100]={}; cin>>n; for(int i=0;i<n;i++){ cin>>s[i]; sum+=s[i]; } sort(s,s+n); if(sum%10==0){ for(int i=0;i<n;i++){ if(s[i]%10!=0){ sum-=s[i]; break; }}} if(sum%10==0)sum=0; cout<<sum<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:10: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 20 | cout<<sum<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 20 | cout<<sum<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:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 20 | cout<<sum<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:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 20 | cout<<sum<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:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 20 | cout<<sum<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 20 | cout<<sum<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:20:11: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 20 | cout<<sum<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:20:11: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 20 | cout<<sum<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:20:11: note: couldn't deduce template parameter '_CharT' 20 | cout<<sum<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:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 20 | cout<<sum<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 20 | cout<<sum<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:20:11: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 20 | cout<<sum<endl; | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:20:11: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>' 20 | cout<<sum<endl; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s463786201
p03701
C
// // Created by Akifumi Ohata on 2017/09/29. // #include<iostream> #include <vector> #include <numeric> using namespace std; int main(){ int N; cin >> N ; std::vector<int> scores; for(int n=0;n<N ;n++) { int tmp; cin >>tmp; scores.push_back(tmp); } std::sort(scores.begin(),scores.end()); ONEMOER: int score_sum =std::accumulate(scores.begin(), scores.end(), 0); if(score_sum%10 ==0 && score_sum !=0){ scores.erase(scores.begin()); goto ONEMOER; } cout << score_sum <<endl; return 0; }
main.c:6:9: fatal error: iostream: No such file or directory 6 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s892938679
p03701
C++
#include "IntMod.h" typedef IntMod<1000000007> MInt; //#include "Union_Find.h" #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <vector> #include <utility> #include <algorithm> #include <functional> #include <cmath> #include <stack> #include <queue> #include <set> #include <map> #include <iomanip> #include <sstream> #include <numeric> #include <list> #include <bitset> using namespace std; #define REP(i,a,n) for(int i = (a); i < (int)(n); ++i) #define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i) #define EPS 0.0001 #define INF 0x3FFFFFFF #define INFLL 0x3FFFFFFF3FFFFFFF #define INFD 1.0e+308 #define FLOAT setprecision(16) typedef long long LL; typedef unsigned long long ULL; typedef pair<LL, LL> PP; template <class T, class U> istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; } template <class T, class U> ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; } template <class T, class TCompatible, size_t N> void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); } template <class T, class TCompatible, size_t M, size_t N> void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); } //sum #if 1 #include <array> #include <unordered_set> #include <unordered_map> template<class T> using PriorityQ = priority_queue<T, vector<T>, greater<T> >; // コスト小を優先 #endif int N; set<int> s; LL sum = 0; int main() { cin >> N; REP(i, 0, N) { int a; cin >> a; s.insert(a); sum += a; } int d = INF; for (int a : s) { if (a % 10 != 0) { d = a; break; } } cout << (sum % 10 == 0 ? (d == INF ? 0 : sum - d) : sum) << endl; return 0; }
a.cc:1:10: fatal error: IntMod.h: No such file or directory 1 | #include "IntMod.h" | ^~~~~~~~~~ compilation terminated.
s036315383
p03701
C++
import sys N = int(input()) s = list() for i in range(N): s.append(int(input())) s.sort(reverse=True) print(s) point = sum(s) l = len(s) i = 0 while i < 1: if point % 10 != 0: print(point) sys.exit() if not s == []: point -= s.pop() i += 1 print("0")
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s135819098
p03701
C++
#include <bits/stdc++.h> #define ll long long using namespace std; int main(void){ int n; cin >> n; int m = INT_MAX, sum = 0; int s[n]; for(int i=0;i<n;i++){ cin >> s[i]; if (s[i] < m && s[i]%10) m = s[i]; sum += s[i]; } if (m == INT_MAX) ans = 0; else ans = sum - m; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:20: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | if (m == INT_MAX) ans = 0; else ans = sum - m; | ^~~ | abs a.cc:11:34: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | if (m == INT_MAX) ans = 0; else ans = sum - m; | ^~~ | abs a.cc:12:10: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | cout << ans << endl; | ^~~ | abs
s495646366
p03701
C++
#include<bits/stdc++.h> using namespace std; int main() { long long int i,n,a,b,low=0,high=2000000000,ans=2000000000,s[100009],mid,z; cin>>n>>a>>b; for(i=0;i<n;i++) cin>>s[i]; while(low<=high) { z=0; mid=(low+high)/2; for(i=0;i<n;i++) { if(a[i]>mid*b) { z=z+ceil((1.0*(s[i]-mid*b))/(s-b)); } } if(z<mid) { ans=min(ans,z); high=mid-1; } else low=mid+1; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: invalid types 'long long int[long long int]' for array subscript 15 | if(a[i]>mid*b) | ^ a.cc:17:35: error: invalid operands of types 'double' and 'long long int*' to binary 'operator/' 17 | z=z+ceil((1.0*(s[i]-mid*b))/(s-b)); | ~~~~~~~~~~~~~~~~~~^~~~~~ | | | | double long long int*
s634434318
p03701
C++
#include<bits/stdc++.h> using namespace std; int main() { long long int i,n,a,b,low=0,high=2000000000,ans=2000000000,s[100009],mid; cin>>n>>a>>b; for(i=0;i<n;i++) cin>>s[i]; while(low<=high) { z=0; mid=(low+high)/2; for(i=0;i<n;i++) { if(a[i]>mid*b) { z=z+ceil((1.0*(a[i]-mid*b))/(a-b)); } } if(z<mid) { ans=min(ans,z); high=mid-1; } else low=mid+1; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'z' was not declared in this scope 12 | z=0; | ^ a.cc:16:9: error: invalid types 'long long int[long long int]' for array subscript 16 | if(a[i]>mid*b) | ^ a.cc:18:24: error: invalid types 'long long int[long long int]' for array subscript 18 | z=z+ceil((1.0*(a[i]-mid*b))/(a-b)); | ^
s475926563
p03701
C++
#include<bits/stdc++.h> using namespace std; { long long int i,n,a,b,low=0,high=2000000000,ans=2000000000,s[100009],mid; cin>>n>>a>>b; for(i=0;i<n;i++) cin>>s[i]; while(low<=high) { z=0; mid=(low+high)/2; for(i=0;i<n;i++) { if(a[i]>mid*b) { z=z+ceil((1.0*(a[i]-mid*b))/(a-b)); } } if(z<mid) { ans=min(ans,z); high=mid-1; } else low=mid+1; } cout<<ans; return 0; }
a.cc:3:1: error: expected unqualified-id before '{' token 3 | { | ^
s317359195
p03701
C++
import std.algorithm; import std.array; import std.ascii; import std.bigint; import std.complex; import std.container; import std.conv; import std.functional; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; auto readInts() { return array(map!(to!int)(readln().strip().split())); } auto readInt() { return readInts()[0]; } auto readLongs() { return array(map!(to!long)(readln().strip().split())); } auto readLong() { return readLongs()[0]; } void readlnTo(T...)(ref T t) { auto s = readln().split(); assert(s.length == t.length); foreach(ref ti; t) { ti = s[0].to!(typeof(ti)); s = s[1..$]; } } const real eps = 1e-10; const long p = 1_000_000_000 + 7; void main(){ auto n = readLong(); long[] s; foreach(i; iota(n)) { s ~= readLong(); } auto ans = s.sum(); if(ans % 10 != 0) { writeln(ans); return; } s.sort(); auto t = s.filter!(a => a % 10 != 0)().array(); t.sort(); if(t.empty()) { writeln(0); return; } writeln(ans - t[0]); }
a.cc:33:15: error: too many decimal points in number 33 | s = s[1..$]; | ^~~~ a.cc:1:1: error: 'import' does not name a type 1 | import std.algorithm; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import std.array; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import std.ascii; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import std.bigint; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import std.complex; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import std.container; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import std.conv; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: 'import' does not name a type 8 | import std.functional; | ^~~~~~ a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: 'import' does not name a type 9 | import std.math; | ^~~~~~ a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:10:1: error: 'import' does not name a type 10 | import std.range; | ^~~~~~ a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:11:1: error: 'import' does not name a type 11 | import std.stdio; | ^~~~~~ a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:12:1: error: 'import' does not name a type 12 | import std.string; | ^~~~~~ a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:13:1: error: 'import' does not name a type 13 | import std.typecons; | ^~~~~~ a.cc:13:1: note: C++20 'import' only available with '-fmodules-ts' a.cc: In function 'auto readInts()': a.cc:16:22: error: 'map' was not declared in this scope 16 | return array(map!(to!int)(readln().strip().split())); | ^~~ a.cc:16:16: error: 'array' was not declared in this scope 16 | return array(map!(to!int)(readln().strip().split())); | ^~~~~ a.cc: In function 'auto readLongs()': a.cc:22:22: error: 'map' was not declared in this scope 22 | return array(map!(to!long)(readln().strip().split())); | ^~~ a.cc:22:16: error: 'array' was not declared in this scope 22 | return array(map!(to!long)(readln().strip().split())); | ^~~~~ a.cc: At global scope: a.cc:28:6: error: variable or field 'readlnTo' declared void 28 | void readlnTo(T...)(ref T t) { | ^~~~~~~~ a.cc:28:15: error: 'T' was not declared in this scope 28 | void readlnTo(T...)(ref T t) { | ^ a.cc:37:7: error: 'real' does not name a type 37 | const real eps = 1e-10; | ^~~~ a.cc:39:16: error: unable to find numeric literal operator 'operator""_000_000_000' 39 | const long p = 1_000_000_000 + 7; | ^~~~~~~~~~~~~ a.cc:41:1: error: '::main' must return 'int' 41 | void main(){ | ^~~~ a.cc: In function 'int main()': a.cc:43:9: error: structured binding declaration cannot have type 'long int' 43 | long[] s; | ^~ a.cc:43:9: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:43:9: error: empty structured binding declaration a.cc:43:12: error: expected initializer before 's' 43 | long[] s; | ^ a.cc:44:13: error: 'i' was not declared in this scope 44 | foreach(i; iota(n)) { | ^ a.cc:44:16: error: 'iota' was not declared in this scope 44 | foreach(i; iota(n)) { | ^~~~ a.cc:47:16: error: 's' was not declared in this scope 47 | auto ans = s.sum(); | ^ a.cc:49:9: error: 'writeln' was not declared in this scope 49 | writeln(ans); | ^~~~~~~ a.cc:50:9: error: return-statement with no value, in function returning 'int' [-fpermissive] 50 | return; | ^~~~~~ a.cc:56:9: error: 'writeln' was not declared in this scope 56 | writeln(0); | ^~~~~~~ a.cc:57:9: error: return-statement with no value, in function returning 'int' [-fpermissive] 57 | return; | ^~~~~~ a.cc:59:5: error: 'writeln' was not declared in this scope 59 | writeln(ans - t[0]); | ^~~~~~~
s869696072
p03701
C++
#include <bits/stdc++.h> using namespace std; //{{{ /********************************************************************/ struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int> > vii; typedef queue<int> qi; typedef stack<int> si; typedef deque<int> dqi; #define reps(i, a, b) for (int i = a; i < b; ++i) #define rep(i, n) reps(i, 0, n) #define REPS(i, a, b) reps(i, a, b) #define REP(i, n) rep(i, n) #define deps(i, a, b) for (int i = a; i >= b; --i) #define dep(i, n) deps(i, n, 0) #define DEPS(i, a, b) deps(i, a, b) #define DEP(i, n) dep(i, n) #define pf push_front #define pb push_back #define mp make_pair #define fst first #define FST fst #define sec second #define SEC sec #define sz(obj) ((int)(obj).size()) #define all(v) (v).begin(), (v).end() #define ALL(v) all(v) #define endl '\n' const int INF = 999999999; const int MOD = 1e9 + 7; 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; } inline int in() { int x; std::cin >> x; return x; } template <typename T> void print(std::vector<T>& v, char c = ' ') { REP(i, v.size()) { if (i != 0) std::cout << c; std::cout << v[i]; } std::cout << '\n'; } template <typename T> void print(T x) { std::cout << x << '\n'; } /****************************************************************/ //}}} signed main() { int n = in(); int sum = 0, cnt = 0; vi v(n); for (int i = 0; i < n; i++) { cin >> v[i]; sum += v[i]; if (v[i] % 10 == 0) cnt++; } if (cnt == n) ans = 0; sort(all(v)); for (int i = 0; sum % 10 == 0 and sum != 0; i++) { if (v[i] % 10 == 0) continue; sum -= v[i]; } cout << sum << endl; return (0); }
a.cc: In function 'int main()': a.cc:66:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 66 | if (cnt == n) ans = 0; | ^~~ | abs
s865676258
p03701
C++
using System; using System.Linq; class Program { public static void Main(string[] args) { int N = int.Parse(System.Console.ReadLine()); int total = 0, oddMin = int.MaxValue; for (int i = 0; i < N; i++) { int score = int.Parse(System.Console.ReadLine()); total += score; if (score<oddMin & score % 10 != 0) { oddMin = score; } } if (total % 10 == 0) { if (oddMin == int.MaxValue) { total = 0; } else { total -= oddMin; } } System.Console.WriteLine(total); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq; | ^~~~~~ a.cc:6:11: error: expected ':' before 'static' 6 | public static void Main(string[] args) | ^~~~~~~ | : a.cc:6:29: error: 'string' has not been declared 6 | public static void Main(string[] args) | ^~~~~~ a.cc:6:38: error: expected ',' or '...' before 'args' 6 | public static void Main(string[] args) | ^~~~ a.cc:36:2: error: expected ';' after class definition 36 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:8:17: error: expected primary-expression before 'int' 8 | int N = int.Parse(System.Console.ReadLine()); | ^~~ a.cc:10:33: error: expected primary-expression before 'int' 10 | int total = 0, oddMin = int.MaxValue; | ^~~ a.cc:13:25: error: expected primary-expression before 'int' 13 | int score = int.Parse(System.Console.ReadLine()); | ^~~ a.cc:24:27: error: expected primary-expression before 'int' 24 | if (oddMin == int.MaxValue) | ^~~ a.cc:24:27: error: expected ')' before 'int' a.cc:24:16: note: to match this '(' 24 | if (oddMin == int.MaxValue) | ^ a.cc:34:9: error: 'System' was not declared in this scope 34 | System.Console.WriteLine(total); | ^~~~~~
s791276196
p03701
C++
using System; using System.Linq; class Program { public static void Main(string[] args) { int N = int.Parse(System.Console.ReadLine()); int total = 0, oddMin = int.MaxValue; for (int i = 0; i < N; i++) { int score = int.Parse(System.Console.ReadLine()); total += score; if (score<oddMin & score % 10 != 0) { oddMin = score; } } if (total % 10 == 0) { if (oddMin == int.MaxValue) { total = 0; } else { total -= oddMin; } } System.Console.WriteLine(total); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq; | ^~~~~~ a.cc:6:11: error: expected ':' before 'static' 6 | public static void Main(string[] args) | ^~~~~~~ | : a.cc:6:29: error: 'string' has not been declared 6 | public static void Main(string[] args) | ^~~~~~ a.cc:6:38: error: expected ',' or '...' before 'args' 6 | public static void Main(string[] args) | ^~~~ a.cc:36:2: error: expected ';' after class definition 36 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:8:17: error: expected primary-expression before 'int' 8 | int N = int.Parse(System.Console.ReadLine()); | ^~~ a.cc:10:33: error: expected primary-expression before 'int' 10 | int total = 0, oddMin = int.MaxValue; | ^~~ a.cc:13:25: error: expected primary-expression before 'int' 13 | int score = int.Parse(System.Console.ReadLine()); | ^~~ a.cc:24:27: error: expected primary-expression before 'int' 24 | if (oddMin == int.MaxValue) | ^~~ a.cc:24:27: error: expected ')' before 'int' a.cc:24:16: note: to match this '(' 24 | if (oddMin == int.MaxValue) | ^ a.cc:34:9: error: 'System' was not declared in this scope 34 | System.Console.WriteLine(total); | ^~~~~~
s191122872
p03701
C++
#include <iostream> #include <algorithm> #include <map> #include <cmath> #include <climits> using namespace std; #define ll long long int bool bin (ll mid , vector<ll>arr , ll a ,ll b) { vector<ll>arr1(arr) ; for(ll i = 0 ; i < arr1.size() ; ++i) { arr1[i] -= ((mid) * b ) ; } ll c = 0 ; for(ll i = 0 ; i < arr1.size() ; ++i ) { if(arr1[i] > 0) { c += ceil( (float)arr1[i] /(a-b) ) ; // cout<<c<<"\n" ; } } if( c <= mid) return true ; return false ; } int main() { ios::sync_with_stdio(false);cin.tie(0) ; ll n ; cin>>n ; ll a , b ; cin>>a>>b ; vector<ll>arr ; ll v ; for(ll i = 0 ; i < n ; ++i) { cin>>v ; arr.push_back(v) ; } ll lo = 0 , hi = 10000000001 ; while( lo <hi) { ll mid = lo + (hi - lo)/2 ; if(bin(mid , arr,a,b)) hi = mid ; else lo = mid + 1 ; } cout<<lo<<"\n" ; return 0; }
a.cc:9:20: error: 'vector' has not been declared 9 | bool bin (ll mid , vector<ll>arr , ll a ,ll b) | ^~~~~~ a.cc:9:26: error: expected ',' or '...' before '<' token 9 | bool bin (ll mid , vector<ll>arr , ll a ,ll b) | ^ a.cc: In function 'bool bin(long long int, int)': a.cc:11:5: error: 'vector' was not declared in this scope 11 | vector<ll>arr1(arr) ; | ^~~~~~ a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 5 | #include <climits> +++ |+#include <vector> 6 | using namespace std; a.cc:7:12: error: expected primary-expression before 'long' 7 | #define ll long long int | ^~~~ a.cc:11:12: note: in expansion of macro 'll' 11 | vector<ll>arr1(arr) ; | ^~ a.cc:12:23: error: 'arr1' was not declared in this scope 12 | for(ll i = 0 ; i < arr1.size() ; ++i) | ^~~~ a.cc:14:30: error: 'b' was not declared in this scope 14 | arr1[i] -= ((mid) * b ) ; | ^ a.cc:18:26: error: 'arr1' was not declared in this scope 18 | for(ll i = 0 ; i < arr1.size() ; ++i ) | ^~~~ a.cc:23:41: error: 'a' was not declared in this scope 23 | c += ceil( (float)arr1[i] /(a-b) ) ; | ^ a.cc:23:43: error: 'b' was not declared in this scope 23 | c += ceil( (float)arr1[i] /(a-b) ) ; | ^ a.cc: In function 'int main()': a.cc:39:3: error: 'vector' was not declared in this scope 39 | vector<ll>arr ; | ^~~~~~ a.cc:39:3: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:7:12: error: expected primary-expression before 'long' 7 | #define ll long long int | ^~~~ a.cc:39:10: note: in expansion of macro 'll' 39 | vector<ll>arr ; | ^~ a.cc:44:9: error: 'arr' was not declared in this scope 44 | arr.push_back(v) ; | ^~~ a.cc:53:22: error: 'arr' was not declared in this scope 53 | if(bin(mid , arr,a,b)) | ^~~
s487989871
p03701
C++
#include<iostream> using namespace std; int main() { int n=0,k=0,r=0; int a[2*10^50]; cin >> n; cin >> k; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; ++i) { int z = 0; for (int j = i; j < n; ++j) { z += a[j]; r++ } } cout << r << endl; }
a.cc: In function 'int main()': a.cc:19:28: error: expected ';' before '}' token 19 | r++ | ^ | ; 20 | 21 | } | ~
s030569730
p03701
C++
#include<iostream> using namespace std; int main() { int n=0,k=0,r=0; int a[2*10^50]; cin >> n; cin >> k; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; ++i) { int z = 0; for (int j = i; j < n; ++j) { z += a[j]; r++ } } cout << r << endl; }
a.cc: In function 'int main()': a.cc:19:28: error: expected ';' before '}' token 19 | r++ | ^ | ; 20 | 21 | } | ~
s195802225
p03701
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n=0; vector<int> s; int inputS; int sum; bool tf=false; int search=0; cin>>n; for(int i=0;i<n;i++){ cin>>inputS; s.push_back(inputS); } for(int i=0;i<n;i++{ if(s[i]%10==0){ search++; } } if(search==n){ tf=true; } sort(s.begin(),s.end()); for(int j=0;j<n;j++){ if(j==0){ for(int i=0;i<n;i++){ sum+=s[i]; } } if(sum%10==0){ if(s[j]%10!=0||tf){ sum-=s[j]; } } else{ break; } } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:24: error: expected ')' before '{' token 22 | for(int i=0;i<n;i++{ | ~ ^ | )
s614933425
p03701
Java
import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[]; int s = 0; Arrays.sort(S); for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); s += S[i]; } if(s % 10 != 0) { System.out.println(s); return; }else { for(int i = 0; i < N; i++) if(S[i] % 10 != 0) { System.out.println(s -= S[i]); return; } } System.out.println(0); return ; } }
Main.java:11: error: variable S might not have been initialized Arrays.sort(S); ^ 1 error
s390528102
p03701
Java
import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[] = new int[N]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } System.out.println(0); return 0; } }
Main.java:28: error: incompatible types: unexpected return value return 0; ^ 1 error
s272147190
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[] = new int[N]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S[]); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } System.out.println(0); } }
Main.java:17: error: '.class' expected Arrays.sort(S[]); ^ 1 error
s616079564
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[] = new int[N]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } System.out.println(0); } }
Main.java:17: error: cannot find symbol Arrays.sort(S); ^ symbol: variable Arrays location: class Main 1 error
s542600500
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S[]); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } System.out.println(0); } }
Main.java:17: error: '.class' expected Arrays.sort(S[]); ^ 1 error
s883396353
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S[]); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } } }
Main.java:17: error: '.class' expected Arrays.sort(S[]); ^ 1 error
s453627810
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } } }
Main.java:17: error: cannot find symbol Arrays.sort(S); ^ symbol: variable Arrays location: class Main 1 error
s958959965
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } } }
Main.java:26: error: reached end of file while parsing } ^ 1 error
s279612669
p03701
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S[]; for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } int s = 0; for(int i = 0; i < N; i++) { s += S[i]; } Arrays.sort(S); for(int i = 0; i < N; i++) { if(s % 10 != 0) { System.out.println(s); return; }else { s -= S[i]; } }
Main.java:25: error: reached end of file while parsing } ^ 1 error
s945288205
p03701
Java
import java.util.Arrays; import java.util.Scanner;   public class Main{   public static void main(String[] args) { Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] arr = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); sum += arr[i]; }   if (sum % 10 != 0) System.out.println(sum); else { Arrays.sort(arr); for (int i : arr) { if (i % 10 != 0) { System.out.println(sum - i); return; } }   System.out.println(0); } } }  
Main.java:3: error: illegal character: '\u00a0' ? ^ Main.java:5: error: illegal character: '\u00a0' ? ^ Main.java:8: error: illegal character: '\u00a0' ? ^ Main.java:10: error: illegal character: '\u00a0' ? ^ Main.java:17: error: illegal character: '\u00a0' ? ^ Main.java:27: error: illegal character: '\u00a0' ? ^ Main.java:32: error: illegal character: '\u00a0' ? ^ Main.java:32: error: reached end of file while parsing ? ^ 8 errors
s308531814
p03701
C
#include<stdio.h> int main(void){ int N,i,min=101; int s[100]; int point; scanf("%d",&N); i=0; while(i<N){ scanf("%d",&s[i]); if(s[i]%10!=0 && min>s[i]){ min=s[i]; } i++; } for(i=0;i<N;i++){ sum+=s[i]; } if(point%10!=0){ printf("%d\n",point); }else if(min!=101){ printf("%d\n",point-min); }else{ printf("0\n"); } return 0; }
main.c: In function 'main': main.c:21:17: error: 'sum' undeclared (first use in this function) 21 | sum+=s[i]; | ^~~ main.c:21:17: note: each undeclared identifier is reported only once for each function it appears in
s398529933
p03701
C++
///#pragma GCC optimize ("O2") ///G++Ó㬠///#pragma comment(linker, "/STACK:36777216")///C++Óà ///#pragma comment(linker, "/STACK:102400000,102400000")///C++Ó㬷ÀÖ¹Õ»Òç³ö #include <bits/stdc++.h> //#include <unordered_map> //#include <unordered_set> using namespace std; #define debug cout << "***********************" << endl #define Bug(s) cout << "s = " << s << endl #define mem(a,b) memset(a, b, sizeof(a)) #define lson l, mid, rt<<1 #define rson mid + 1, r, rt<<1|1 #define For(i, x, n) for(int i = (x) ; i < (n) ; ++i) #define Forr(i, x, n) for(int i = (x) ; i <= (n) ; ++i) #define Rep(i, x, n) for(int i = (x) ; i > (n) ; --i) #define Repp(i, x, n) for(int i = (x) ; i >= (n) ; --i) #define highint( n ) ceil( n ) #define lowint( n ) floor( n ) #define SERU(x) floor((double) x + 0.5 ) #define lowbit(x) (x & (-x)) #define all(x) (x).begin(), (x).end() #define SZ(x) (int)(x).size() #define FA(i, a, x) for (__typeof((x).begin()) i=(a); i!=(x).end(); ++i) #define RA(i, x) FA(i, (x).begin(), x) #define FDA(i, a, x) for (__typeof((x).rbegin()) i=(x).rbegin(); i!=(a); ++i) #define RDA(i, x) FDA(i, (x).rend(), x) #define P(v, x) (v.find(x) != v.end()) #define Pos(v, x) (find(all(v), x) != v.end()) #define UN(a) sort(all(a)), a.erase(unique(all(a)), a.end()) #define REV(a) reverse(all(a)) #define mp(a, b) make_pair(a, b) #define p(a, b) pair<int, int>(a, b) #define sf1i(x) scanf("%d", &x) #define sf1l(x) scanf("%I64d", &x) #define sf2i(x, y) scanf("%d%d", &x, &y) #define sf2l(x, y) scanf("%I64d%I64d", &x, &y) #define pb push_back #define pf push_front #define fi first #define se second #define ll long long #define eps 1e-8 int a[101]; int v[12345]; int main(){ int n; cin >> n; int res = 0; int c = 0; memset(v, 0, sizeof(v)); For(i, 0, n){ cin >> a[i]; v[a[i]] = 1; } for(int i = 0; i < n; ++i){ for(int j = c; j >= 0; j --){ if(v[j]){ v[j + a[i]] = 1; } } c += a[i] ; } for(int i = c; i > 0; --i) if(v[i] && (i % 10 != 0){ res = i; break; } if(res % 10 == 0)cout << 0 << endl; else cout << res << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:70:29: error: expected ';' before '{' token 70 | if(v[i] && (i % 10 != 0){ | ^ | ; a.cc:74:5: error: expected primary-expression before 'if' 74 | if(res % 10 == 0)cout << 0 << endl; | ^~ a.cc:73:6: error: expected ')' before 'if' 73 | } | ^ | ) 74 | if(res % 10 == 0)cout << 0 << endl; | ~~ a.cc:70:7: note: to match this '(' 70 | if(v[i] && (i % 10 != 0){ | ^
s658856391
p03701
C++
#include <iostream> #include <vector> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> ss(n); for (int i = 0; i < n; i++) { cin >> ss[i]; } int sum = 0; int minNot10 = 1000]; for (int i = 0; i < n; i++) { sum += ss[i]; if (ss[i] % 10 != 0 && ss[i] < minNot10) minNot10 = ss[i]; } int ans; if (sum % 10 == 0 && minNot10 % 10 == 0) { ans = 0; } else if (sum % 10 == 0) { ans = sum - minNot10; } else { ans = sum; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:22: error: expected ',' or ';' before ']' token 19 | int minNot10 = 1000]; | ^
s281596744
p03701
C++
#include<bits/stdc++.h> #define maxn 100010 using namespace std; LL seg[maxn],a,b,d,n; bool ok(int k){ int ans=0; for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ ans+=((seg[i]-k*b-1)/d+1); if(ans>k) return false; } if(ans<=k) return true; return false; } int main(){ cin>>n>>a>>b; d=a-b; for(int i=1;i<=n;i++) scanf("%lld",&seg[i]); sort(seg+1,seg+1+n); int l=0,r=1002000009LL,mid,res; while(l<=r){ mid=(l+r)>>1; if(ok(mid)){ res=mid; r=mid-1; } else l=mid+1; } cout<<res<<endl; return 0; }
a.cc:4:1: error: 'LL' does not name a type 4 | LL seg[maxn],a,b,d,n; | ^~ a.cc: In function 'bool ok(int)': a.cc:7:19: error: 'n' was not declared in this scope 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ^ a.cc:7:27: error: 'seg' was not declared in this scope 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ^~~ a.cc:7:35: error: 'LL' was not declared in this scope 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ^~ a.cc:7:38: error: expected ';' before 'k' 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ^ | ; a.cc:7:40: error: 'b' was not declared in this scope 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ^ a.cc:7:41: error: expected ')' before ';' token 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ~ ^ | ) a.cc:7:42: error: 'i' was not declared in this scope 7 | for(int i=n;i>=1&&seg[i]>(LL)k*b;i--){ | ^ a.cc: In function 'int main()': a.cc:15:14: error: 'n' was not declared in this scope; did you mean 'yn'? 15 | cin>>n>>a>>b; | ^ | yn a.cc:15:17: error: 'a' was not declared in this scope 15 | cin>>n>>a>>b; | ^ a.cc:15:20: error: 'b' was not declared in this scope 15 | cin>>n>>a>>b; | ^ a.cc:16:9: error: 'd' was not declared in this scope 16 | d=a-b; | ^ a.cc:17:45: error: 'seg' was not declared in this scope 17 | for(int i=1;i<=n;i++) scanf("%lld",&seg[i]); | ^~~ a.cc:18:14: error: 'seg' was not declared in this scope 18 | sort(seg+1,seg+1+n); | ^~~
s626079908
p03701
Java
import java.util.Arrays; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); sum += arr[i]; } if (sum % 10 != 0) System.out.println(sum); else { Arrays.sort(arr); for (int i : arr) { if (i % 10 != 0) { System.out.println(sum - i); return; } } System.out.println(); } } }
Main.java:4: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s126538908
p03701
C++
#include <bits/stdc++.h> #define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++) #define REP(i,b) FOR(i,0,b) #define ALL(c) c.begin(),c.end() #define PB push_back #define cat //cout << __LINE__ << endl; using namespace std; typedef long long LL; typedef double ld; typedef LL ut; typedef vector<ut> VI; typedef pair<ut,ut> pr; typedef vector<pr> Vpr; typedef pair<ut,ut> prs; const int SIZE=2005; const LL p=7+1e9; const LL INF=1<<30; const LL INFLL=1LL<<30; inline void IN(ut &x){cin >> x;} inline void INA(ut n,ut x[]){REP(i,n) cin >> x[i];} inline void INE(ut m,VI edges[]){ ut a,b; REP(i,m){ cin >> a >> b; edges[a].PB(b); edges[b].PB(a); } } inline void INEC(ut m,Vpr edges[]){ ut a,b,c; REP(i,m){ cin >> a >> b >> c; edges[a].PB(pr(c,b)); edges[b].PB(pr(c,a)); } } LL es[20]; LL solve(LL D,LL s,LL t){ if(s==t) return (D==0)*10; else if(s>t) return D==0; LL dia=10; if(s==0) dia--; LL ans=0; if(t>=11) ans+=(dia-abs(0))*solve(D,s+1,t-1)); else FOR(i,-9,10){ if(dia==9 && i<0) continue; ans+=(dia-abs(i))*solve(D+(es[s]*i-es[t]*i),s+1,t-1); // cout << ans<< " "<< D << " " << i <<" " << s << " "<< t<< endl; } return ans; } string rev(string s){ reverse(ALL(s)); return s; } int main(){ LL D; cin >> D; //FOR(D,1,10000){ LL ans=0; es[0]=1; FOR(i,1,20) es[i]=es[i-1]*10; FOR(i,1,20) ans+=solve(D,0,i); int c=0; REP(i,100000) if(stoi(rev(to_string(i)))-i ==D) c++; if(c!=ans or D%100==0){ cout << c <<" " << ans << " " << D<< endl; //cout << ans << endl; } //} return 0; }
a.cc: In function 'LL solve(LL, LL, LL)': a.cc:44:53: error: expected ';' before ')' token 44 | if(t>=11) ans+=(dia-abs(0))*solve(D,s+1,t-1)); | ^ | ;
s551096056
p03701
C++
#include <bits/stdc++.h> using namespace std; int main() { int m,n,i; while(cin>>m) { int s=0; n=0; for(i=0;i<m;i++) { cin>>x; s+=x; if(x%10!=0) { n+=x; } } cout<<max(s,n)<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:18: error: 'x' was not declared in this scope 13 | cin>>x; | ^
s562668556
p03701
C++
#include <bits/stdc++.h> #define ALL(a) (a).begin(),(a).end() #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define rep(i,n) FOR(i,0,n) #define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--) #define rrep(i,n) RFOR(i,n,0) #define DEBUG(x) cout<<#x<<": "<<x<<endl #define vint vector<int> #define vdbl vector<double> #define vstr vector<string> using namespace std; typedef long long ll; typedef unsigned long long ull; ll N,A,B; ll h[100001]; ll sum; bool C(ll x){ ll l = x; rep(i,N){ ll a = h[i]; if(a <= B*x){ continue; } ll b = a - B*x; ll c = b % (A-B) == 0 ? b / (A-B) : b / (A-B) + 1; l -= c; if(l < 0) return false; } return true; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> A >> B; sum = 0; rep(i,N){ cin >> h[i]; sum += h[i]; } ll cnt = 0; rep(i,N) { if(h[i] <= B) cnt++; } if(cnt == N){ cout << 1 << end; return 0; } ll lb = 0; ll ub = 1e14; while(ub - lb > 1){ ll mid = (lb + ub) / 2; // cout << lb << "," << mid << "," << ub << "," << C(mid) << endl; if(C(mid)) ub = mid; else lb = mid; } cout << ub << endl; }
a.cc: In function 'int main()': a.cc:58:27: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 58 | cout << 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::nullptr_t = std::null
s478071337
p03701
C
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define eb emplece_back #define mp make_pair #define i_i pair<int, int> #define vi vector<int> #define vvi vector<vi > #define vb vector<bool> #define vvb vector<vb > #define vp vector< i_i > #define Edge pair< i_i, int> #define all(a) (a).begin(), (a).end() #define Int(x) int x; scanf("%lld", &x); #define int2(x, y) int x, y; scanf("%lld %lld", &x, &y); #define fir first #define sec second #define ffir first.first #define fsec first.second #define sfir second.first #define ssec second.second //int dxy[5] = {0, 1, 0, -1, 0}; // assign int rev(int n) { int ret = 0; while (n) { ret *= 10; ret += n % 10; n /= 10; } return ret; } int count(int n) { int ret = 1; n /= 10; while (n) { ret++; n /= 10; } return ret; } signed main() { Int(n); int ket = count(n); int ans = 0; for (int i = n + pow(10, ket-1); i < pow(10, ket); i++) { if (i % 10 && i - n == rev(i)) { ans++; // cout << i << endl; } } cout << ans << endl; return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s004393330
p03701
C++
///#pragma GCC optimize ("O2") ///G++Ó㬠///#pragma comment(linker, "/STACK:36777216")///C++Óà ///#pragma comment(linker, "/STACK:102400000,102400000")///C++Ó㬷ÀÖ¹Õ»Òç³ö #include <bits/stdc++.h> //#include <unordered_map> //#include <unordered_set> using namespace std; #define debug cout << "***********************" << endl #define Bug(s) cout << "s = " << s << endl #define mem(a,b) memset(a, b, sizeof(a)) #define lson l, mid, rt<<1 #define rson mid + 1, r, rt<<1|1 #define For(i, x, n) for(int i = (x) ; i < (n) ; ++i) #define Forr(i, x, n) for(int i = (x) ; i <= (n) ; ++i) #define Rep(i, x, n) for(int i = (x) ; i > (n) ; --i) #define Repp(i, x, n) for(int i = (x) ; i >= (n) ; --i) #define highint( n ) ceil( n ) #define lowint( n ) floor( n ) #define SERU(x) floor((double) x + 0.5 ) #define lowbit(x) (x & (-x)) #define all(x) (x).begin(), (x).end() #define SZ(x) (int)(x).size() #define FA(i, a, x) for (__typeof((x).begin()) i=(a); i!=(x).end(); ++i) #define RA(i, x) FA(i, (x).begin(), x) #define FDA(i, a, x) for (__typeof((x).rbegin()) i=(x).rbegin(); i!=(a); ++i) #define RDA(i, x) FDA(i, (x).rend(), x) #define P(v, x) (v.find(x) != v.end()) #define Pos(v, x) (find(all(v), x) != v.end()) #define UN(a) sort(all(a)), a.erase(unique(all(a)), a.end()) #define REV(a) reverse(all(a)) #define mp(a, b) make_pair(a, b) #define p(a, b) pair<int, int>(a, b) #define sf1i(x) scanf("%d", &x) #define sf1l(x) scanf("%I64d", &x) #define sf2i(x, y) scanf("%d%d", &x, &y) #define sf2l(x, y) scanf("%I64d%I64d", &x, &y) #define pb push_back #define pf push_front #define fi first #define se second #define ll long long #define eps 1e-8 int a[101]; int main(){ int T, n; cin >> n; int res = 0; For(i, 0, n){ cin >> a[i]; res += a[i]; } if(res % 10 != 0){ cout << res << endl; return 0; } int ans = 0; sort(a, a + n); For(i, 0, n){ if(res % 10 == 0)res -= a[i]; if(res % 10 != 0))break; } cout << res << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:65:26: error: expected primary-expression before ')' token 65 | if(res % 10 != 0))break; | ^
s953259611
p03701
C++
/* _oo0oo_ 088888880 88" . "88 (| -_- |) 0\ = /0 ___/'---'\___ .' \\\\| |// '. / \\\\||| : |||// \\ /_ ||||| -:- |||||- \\ | | \\\\\\ - /// | | | \_| ''\---/'' |_/ | \ .-\__ '-' __/-. / ___'. .' /--.--\ '. .'___ ."" '< '.___\_<|>_/___.' >' "". | | : '- \'.;'\ _ /';.'/ - ' : | | \ \ '_. \_ __\ /__ _/ .-' / / ====='-.____'.___ \_____/___.-'____.-'===== '=---=' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AC AC AC AC AC AC AC AC AC AC AC AC */ #define OJ #include <bits/stdc++.h> #define pb push_back #define _1 first #define _2 second #define FOR(i,a,b) for(int i=a;i<(b);i++) #define FORN(i,b) for(int i=0;i<(b);i++) #define reset(a,b) memset(a,b,sizeof(a)) #define MAX(a,b) a>b?a:b #define MIN(a,b) a>b?b:a using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int> > vii; struct cmp { bool operator()(const long int &a,const long int &b) { return a>b; } }; int main() { #ifndef OJ freopen("abc.in","r",stdin); freopen("abc.out","w",stdout); #endif long int n,ans=0; long int i,j,k,l; priority_queue <long int,vector <long int>,cmp>q; scanf("%ld",&n); for(i=1;i<=n;i++) { scanf("%ld",&j); ans+=j; q.push(j); } while(ans%10==0) { if(q.empty()) break; i=q.top(); q.pop(); if((ans-i)%10==0) continue ans-=i; } if(ans%10==0) printf("0"); else printf("%ld",ans); #ifndef OJ fclose(stdin); fclose(stdout); #endif }
a.cc: In function 'int main()': a.cc:71:31: error: expected ';' before 'ans' 71 | if((ans-i)%10==0) continue | ^ | ; 72 | ans-=i; | ~~~
s876684133
p03701
Java
public class Main { public static void main(String[] args) { Scanner sn = new Scanner(System.in); List<Integer> inputList = new ArrayList<Integer>(); while (sn.hasNextLine()) { String str = sn.nextLine(); inputList.add(Integer.parseInt(str)); } int num = inputList.get(0); List<Integer> pointList = inputList.subList(1, inputList.size()); int sum = 0; //sum all points for(int point: pointList){ sum += point; } if(sum % 10 == 0){ int min = calcMinNumber(inputList); if(min == -1){ sum = 0; }else{ sum -= min; } } System.out.println(sum); } private static int calcMinNumber(List<Integer> list){ int min = -1; for(int elem : list){ if((elem < min) && (elem % 10 != 0)){ min = elem; } } return min; } }
Main.java:36: error: cannot find symbol private static int calcMinNumber(List<Integer> list){ ^ symbol: class List location: class Main Main.java:3: error: cannot find symbol Scanner sn = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sn = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol List<Integer> inputList = new ArrayList<Integer>(); ^ symbol: class List location: class Main Main.java:4: error: cannot find symbol List<Integer> inputList = new ArrayList<Integer>(); ^ symbol: class ArrayList location: class Main Main.java:13: error: cannot find symbol List<Integer> pointList = inputList.subList(1, inputList.size()); ^ symbol: class List location: class Main 6 errors
s521579639
p03701
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sn = new Scanner(System.in); List<Integer> inputList = new ArrayList<Integer>(); while (sn.hasNextLine()) { String str = sn.nextLine(); inputList.add(Integer.parseInt(str)); } int num = inputList.get(0); List<Integer> pointList = inputList.subList(1, inputList.size()); int sum = 0; //sum all points for(int point: pointList){ sum += point; } if(sum % 10 == 0){ int min = calcMinNumber(inputList); if(min == -1){ sum = 0; }else{ sum -= min; } } System.out.println(sum); } private static int calcMinNumber(List<Integer> list){ int min = -1; for(int elem : list){ if((elem < min) && (elem % 10 != 0)){ min = elem; } } return min; } }
Main.java:5: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s656869452
p03701
Java
public class C_Bugged { public static void main(String[] args) { Scanner sn = new Scanner(System.in); List<Integer> inputList = new ArrayList<Integer>(); while (sn.hasNextLine()) { String str = sn.nextLine(); inputList.add(Integer.parseInt(str)); } int num = inputList.get(0); List<Integer> pointList = inputList.subList(1, inputList.size()); int sum = 0; //sum all points for(int point: pointList){ sum += point; } if(sum % 10 == 0){ int min = calcMinNumber(inputList); if(min == -1){ sum = 0; }else{ sum -= min; } } System.out.println(sum); } private static int calcMinNumber(List<Integer> list){ int min = -1; for(int elem : list){ if((elem < min) && (elem % 10 != 0)){ min = elem; } } return min; } }
Main.java:1: error: class C_Bugged is public, should be declared in a file named C_Bugged.java public class C_Bugged { ^ Main.java:36: error: cannot find symbol private static int calcMinNumber(List<Integer> list){ ^ symbol: class List location: class C_Bugged Main.java:3: error: cannot find symbol Scanner sn = new Scanner(System.in); ^ symbol: class Scanner location: class C_Bugged Main.java:3: error: cannot find symbol Scanner sn = new Scanner(System.in); ^ symbol: class Scanner location: class C_Bugged Main.java:4: error: cannot find symbol List<Integer> inputList = new ArrayList<Integer>(); ^ symbol: class List location: class C_Bugged Main.java:4: error: cannot find symbol List<Integer> inputList = new ArrayList<Integer>(); ^ symbol: class ArrayList location: class C_Bugged Main.java:13: error: cannot find symbol List<Integer> pointList = inputList.subList(1, inputList.size()); ^ symbol: class List location: class C_Bugged 7 errors
s639794568
p03701
C++
#include <iostream> #include<cstdio> #include<cstring> #include<cmath> #define N 300000 #define maxn 1000000000 using namespace std; int tt; int a[N]; struct ss{int i,x;}sum[N]; bool cmp(ss s1,ss s2){if(s1.x!=s2.x)return s1.x<s2.x;return s1.i<s2.i;} int lbt(int x){return x &(-x);} int s[N]; int n,k; long long ask(int x) { long long ret=0; for(int i=x;i;i-=lbt(i))ret+=s[i]; return ret; } void add(int x) { for(int i=x;i<=n;i+=lbt(i))s[i]++; } int main() { scanf("%d%d",&n,&k); sum[0].x=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); a[i]-=k; sum[i].x=sum[i-1].x+a[i]; sum[i].i=i+1; } n++; sum[n].i=1;sum[n].x=0; sort(sum+1,sum+n+1,cmp); long long ans=0; for(int i=1;i<=n;i++) { ans+=ask(sum[i].i); add(sum[i].i); } cout<<ans; } //a0,a1,a2,a3,a4,a5,a6 //f(a-b) //(a-b)^(c-b) /* 1 2 3 4 5 0 P (p+1,p+q) p q 0 1 2 3 4 5 6 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 2 3 4 5 6 7 8 ... 3 0 1 2 4 5 */
a.cc: In function 'int main()': a.cc:39:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 39 | sort(sum+1,sum+n+1,cmp); | ^~~~ | sqrt
s411980218
p03701
C++
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class C_Bugged { public static void main(String[] args) { Scanner sn = new Scanner(System.in); List<Integer> inputList = new ArrayList<Integer>(); while (sn.hasNextLine()) { String str = sn.nextLine(); inputList.add(Integer.parseInt(str)); } int num = inputList.get(0); List<Integer> pointList = inputList.subList(1, inputList.size()); int sum = 0; //sum all points for(int point: pointList){ sum += point; } if(sum % 10 == 0){ int min = calcMinNumber(inputList); if(min == -1){ sum = 0; }else{ sum -= min; } } System.out.println(sum); } private static int calcMinNumber(List<Integer> list){ int min = -1; for(int elem : list){ if((elem < min) && (elem % 10 != 0)){ min = elem; } } return min; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.ArrayList; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.List; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.Scanner; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class C_Bugged { | ^~~~~~
s141385118
p03701
C++
#include<iostream> #include<vector> #include<string> #include<map> #include<algorithm> using namespace std; int dp[105][15]; int n; vector<int> s; int dfs(int now, int keta); int main() { int input; memset(dp, -1, sizeof(dp)); cin >> n; for (int i = 0; i < n; i++) { cin >> input; s.push_back(input); } cout << max(0,dfs(0, 0)) << endl; } int dfs(int now, int keta) { if (now >= n) { if (keta != 0) { return 0; } else { return -1000000; } } else if (dp[now][keta] != -1) { return dp[now][keta]; } else { dp[now][keta] = max(dfs(now+1,keta), dfs(now+1,(keta+s[now])%10)+s[now]); } }
a.cc: In function 'int main()': a.cc:13:9: error: 'memset' was not declared in this scope 13 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include<algorithm> +++ |+#include <cstring> 6 | using namespace std; a.cc: In function 'int dfs(int, int)': a.cc:34:31: warning: control reaches end of non-void function [-Wreturn-type] 34 | dp[now][keta] = max(dfs(now+1,keta), dfs(now+1,(keta+s[now])%10)+s[now]); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s829052581
p03701
C++
#include <iostream> #include <vector> #include <cstdio> #include <cstdlib> #include <climits> #include <cassert> using namespace std; typedef unsigned int index; int main() { #ifdef ONPC : assert(freopen("a.in", "r", stdin)); : assert(freopen("a.out", "w", stdout)); #else #endif : size_t n; : cin >> n; : vector<int> a(n); : for (auto &i: a) : : cin >> i; : int sum = 0; : for (index i = 0; i < a.size(); i++) : : sum += a[i]; : if (sum % 10 != 0) : : cout << sum << endl; : else : { : : int m = (int)1e9 + 1; : : for (index i = 0; i < a.size(); i++) : : : if (a[i] % 10 != 0) : : : : m = min(m, a[i]); : : if (m == 1e9 + 1) : : : cout << 0 << endl; : : else : : : cout << sum - m << endl; : } }
a.cc: In function 'int main()': a.cc:19:1: error: expected primary-expression before ':' token 19 | : size_t n; | ^ a.cc:20:1: error: expected primary-expression before ':' token 20 | : cin >> n; | ^ a.cc:21:1: error: expected primary-expression before ':' token 21 | : vector<int> a(n); | ^ a.cc:22:1: error: expected primary-expression before ':' token 22 | : for (auto &i: a) | ^ a.cc:24:1: error: expected primary-expression before ':' token 24 | : int sum = 0; | ^ a.cc:25:1: error: expected primary-expression before ':' token 25 | : for (index i = 0; i < a.size(); i++) | ^ a.cc:25:23: error: 'i' was not declared in this scope 25 | : for (index i = 0; i < a.size(); i++) | ^ a.cc:25:27: error: 'a' was not declared in this scope 25 | : for (index i = 0; i < a.size(); i++) | ^ a.cc:27:1: error: expected primary-expression before ':' token 27 | : if (sum % 10 != 0) | ^ a.cc:29:1: error: expected primary-expression before ':' token 29 | : else | ^
s197198250
p03701
C++
3 10 20 30
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 | ^
s108075525
p03701
C++
#include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<vector> #include<array> #include<string> #include<stack> #include<queue> #include<algorithm> #include<cassert> #include<functional> #include<random> #include<complex> #include<bitset> #include<chrono> //#include<boost/multiprecision/cpp_int.hpp> #define int int64_t #define uint uint64_t #define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++) #define rep(i, a) REP(i, 0, a) #define EACH(i, a) for (auto i: a) #define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++) #define ALL(a) (a.begin()), (a.end()) #define HAS(a, x) (a.find(x) != a.end()) #define Min(x) *min_element(ALL(x)) #define Max(x) *max_element(ALL(x)) #define Unique(L) (L.erase(unique(ALL(L)), L.end())) #define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/) #define intmax (std::numeric_limits<int64_t>::max() / 4) using namespace std; //typedef boost::multiprecision::cpp_int bigint; const double EPS = 1e-9; const double PI = acos(-1.0); int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<int>s(N); rep(i, N)cin >> s[i]; int sum = 0; rep(i, N)sum += s[i]; if (sum % 10) { cout << sum << endl; return 0; } sort(ALL(s)); rep(i, N)if (s[i] % 10) { cout << sum - s[i] << endl; return 0; } cout << 0 << endl; return 0; }
a.cc:20:13: error: '::main' must return 'int' 20 | #define int int64_t | ^~~~~~~ a.cc:39:1: note: in expansion of macro 'int' 39 | int main() { | ^~~
s830776856
p03702
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <tuple> #include <utility> #include <vector> #define ll long long #define itn int #define endl '\n' #define co(ans) cout<<ans<<endl #define COYE cout<<"YES"<<endl #define COYe cout<<"Yes"<<endl #define COye cout<<"yes"<<endl #define CONO cout<<"NO"<<endl #define CONo cout<<"No"<<endl #define COno cout<<"no"<<endl #define FORE(i,a) for(auto &i:a) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define PB push_back #define MP make_pair #define ALL(V) (V).begin(),(V).end() #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i) #define equals(a,b) (fabs((a)-(b))<EPS) #define INF ((1LL<<62)-(1LL<<31)) #define EPS 1e-10 #define PI 3.141592653589793238 #define MOD 1000000007 #define MMOD 998244353 #define MAX 2010101 using namespace std; using Edge=pair<ll,ll>; using Graph=vector<vector<int>>; inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;} template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();} template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int,int> PII; typedef pair<ll,ll> PLL; typedef long long LL; const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0}; ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} int main(){ ll N,A,B; cin>>N>>A>>B; A-=B; ll H[N]; REP(i,N) cin>>H[i]; ll ok=INF,ng=-1ll; while(ok-ng>1){ ll mid=(ok+ng)/2; ll cnt=0ll; REP(i,N) cnt+=(max(H[i]-B*mid,0)+A-1)/A; if(cnt<=mid) ok=mid; else ng=mid; } cout<<ok<<endl; return 0; }
a.cc: In function 'int main()': a.cc:85:23: error: no matching function for call to 'max(long long int, int)' 85 | REP(i,N) cnt+=(max(H[i]-B*mid,0)+A-1)/A; | ~~~^~~~~~~~~~~~~~ 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:85:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 85 | REP(i,N) cnt+=(max(H[i]-B*mid,0)+A-1)/A; | ~~~^~~~~~~~~~~~~~ /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:85:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 85 | REP(i,N) cnt+=(max(H[i]-B*mid,0)+A-1)/A; | ~~~^~~~~~~~~~~~~~
s671008684
p03702
C++
/** * * Author : MeGa * */ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <unordered_map> #include <unordered_set> #include <string.h> using namespace std; vector<int>v; int n long long a,b; long long solve(long long mid){ long long aa = mid; long long dif = a-b; for(int i = 0; i < v.size(); i ++){ long long cur = v[i]-(b*mid); if(cur > 0){ long long val = (cur+dif -1)/ dif; if( val > aa) return false; else{ aa-= val; } } } return true; } int main(){ #ifndef ONLINE_JUDGE //freopen("in","r",stdin); #endif ios::sync_with_stdio(false); cin.tie(0); priority_queue<pair<int,int> >pq; cin>>n>>a>>b; for(int i = 0 ; i < n; i ++){ int s; cin>>s; v.push_back(s); } sort(v.begin(),v.end()); long long left = 0 , right = 2e15; long long ans = 0; while(left < right){ long long mid = left + (right - left)/2; // cerr<<mid<<endl; if(solve(mid)){ right = mid-1; ans = mid; }else{ left = mid + 1; } } if(solve(ans-1)){ cout<<ans-1<<endl; }else{ cout<<ans<<endl; } }
a.cc:47:1: error: expected initializer before 'long' 47 | long long a,b; | ^~~~ a.cc: In function 'long long int solve(long long int)': a.cc:51:21: error: 'a' was not declared in this scope; did you mean 'aa'? 51 | long long dif = a-b; | ^ | aa a.cc:51:23: error: 'b' was not declared in this scope 51 | long long dif = a-b; | ^ a.cc: In function 'int main()': a.cc:79:11: error: 'n' was not declared in this scope; did you mean 'yn'? 79 | cin>>n>>a>>b; | ^ | yn a.cc:79:14: error: 'a' was not declared in this scope 79 | cin>>n>>a>>b; | ^ a.cc:79:17: error: 'b' was not declared in this scope 79 | cin>>n>>a>>b; | ^
s072080809
p03702
C++
#include<cstdio> int n,use[100005]; long long a,b,f[100005]; int check(long long x) { long long k=a-b,t=0; for (int i=1;i<=n;i++) use[i]=b*x; for (int i=1;i<=n;i++) if (use[i]<f[i]) t=t+(f[i]-use[i])/k+!!((f[i]-use[i])%k); return x>=t; } long long bs(long long l,long long r) { if (l==r) return l;a long long mid=(l+r)/2; if (check(mid)) return bs(l,mid); return bs(mid+1,r); } int main() { scanf("%d%lld%lld",&n,&a,&b); for (int i=1;i<=n;i++) scanf("%lld",&f[i]); printf("%lld\n",bs(0ll,1000000000ll)); return 0; }
a.cc: In function 'long long int bs(long long int, long long int)': a.cc:13:29: error: expected ';' before 'long' 13 | if (l==r) return l;a | ^ | ; 14 | long long mid=(l+r)/2; | ~~~~ a.cc:15:19: error: 'mid' was not declared in this scope 15 | if (check(mid)) return bs(l,mid); | ^~~ a.cc:16:19: error: 'mid' was not declared in this scope 16 | return bs(mid+1,r); | ^~~
s795216190
p03702
C++
#include<iostream> #include<vector> #include<algorithm> #include<queue> #include<deque> #include<cmath> #include<map> #include<cstring> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LLINF = 1LL<<60; #define P pair<int, int> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define print(x) cout << (x) << endl class mint { long long x; public: mint(long long x=0) : x((x%MOD+MOD)%MOD) {} mint operator-() const { return mint(-x); } mint& operator+=(const mint& a) { if ((x += a.x) >= MOD) x -= MOD; return *this; } mint& operator-=(const mint& a) { if ((x += MOD-a.x) >= MOD) x -= MOD; return *this; } mint& operator*=(const mint& a) { (x *= a.x) %= MOD; return *this; } mint operator+(const mint& a) const { mint res(*this); return res+=a; } mint operator-(const mint& a) const { mint res(*this); return res-=a; } mint operator*(const mint& a) const { mint res(*this); return res*=a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime MOD mint inv() const { return pow(MOD-2); } mint& operator/=(const mint& a) { return (*this) *= a.inv(); } mint operator/(const mint& a) const { mint res(*this); return res/=a; } friend ostream& operator<<(ostream& os, const mint& m){ os << m.x; return os; } }; /* -- template -- */ ll f(ll a, ll b) { return ((a % b != 0) ? (a + b) / b : a / b); } int main() { ll N, A, B; cin >> N >> A >> B; ll maxv = 0; ll h[N]; rep(i, N) cin >> h[i], maxv = max(maxv, h[i]); ll ng = 0, ok = maxv / B; while(ng + 1 < ok) { ll mid = (ng + ok) / 2; ll cnt = 0; rep(i, N) { if(h[i] - mid * B > 0) { cnt += (h[i]-n*B+A-B-1)/(A - B); } } if(cnt > mid) { ng = mid; }else if(cnt <= mid) { ok = mid; } } cout << ok << endl; }
a.cc: In function 'int main()': a.cc:93:30: error: 'n' was not declared in this scope 93 | cnt += (h[i]-n*B+A-B-1)/(A - B); | ^
s235213855
p03702
C++
# include <bits/stdc++.h> using namespace std; typedef long long LL; #define maxn 1e5 int n, a, b, m[maxn+3]; bool judge(LL x) { LL sum = 0; for(int i=0; i<n; ++i) { LL t = (LL)m[i]-x*b; if(t>0) { sum += (int)ceil(t*1.0/(a-b)); if(sum > x || sum < 0) return false; } } return true; } int main() { while(~scanf("%d%d%d",&n,&a,&b)) { int imax = 0; for(int i=0; i<n; ++i) scanf("%d",&m[i]), imax = max(imax, m[i]); LL l=0, r=imax; while(l<r) { LL mid = l+r>>1; if(judge(mid)) r=mid; else l=mid+1; } printf("%lld\n",r); } return 0; }
a.cc:6:20: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 6 | int n, a, b, m[maxn+3]; | ^ a.cc:6:20: error: could not convert '(1.0e+5 + (double)3)' from 'double' to 'long unsigned int' 6 | int n, a, b, m[maxn+3]; | ^ | | | double a.cc:6:20: error: size of array 'm' has non-integral type 'double'
s566842855
p03702
C++
#include<iostream> using namespace std; typedef long long LL; #define maxn 1e5 int n, a, b, m[maxn+3]; bool judge(LL x) { LL sum = 0; for(int i=0; i<n; ++i) { LL t = (LL)m[i]-x*b; if(t>0) { sum += (int)ceil(t*1.0/(a-b)); if(sum > x || sum < 0) return false; } } return true; } int main() { while(scanf("%d%d%d",&n,&a,&b)) { int imax = 0; for(int i=0; i<n; ++i) scanf("%d",&m[i]), imax = max(imax, m[i]); LL l=0, r=imax; while(l<r) { LL mid = l+r>>1; if(judge(mid)) r=mid; else l=mid+1; } printf("%lld\n",r); } return 0; }
a.cc:6:20: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 6 | int n, a, b, m[maxn+3]; | ^ a.cc:6:20: error: could not convert '(1.0e+5 + (double)3)' from 'double' to 'long unsigned int' 6 | int n, a, b, m[maxn+3]; | ^ | | | double a.cc:6:20: error: size of array 'm' has non-integral type 'double' a.cc: In function 'bool judge(LL)': a.cc:16:25: error: 'ceil' was not declared in this scope 16 | sum += (int)ceil(t*1.0/(a-b)); | ^~~~
s865244255
p03702
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> #include<bitset> #define EPS 1e-9 #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long const int MOD = 1E9+7; const int N = 1000000+5; using namespace std; LL n,A,B; LL h[N]; bool check(LL x){ LL temp=x*B; LL sub=A-B; LL sum=0; for(LL i=n;i>=1;i--){ if(a[i]>temp){ if((h[i]-temp)%sub) sum+=(h[i]-temp)/sub+1; else sum+=(h[i]-temp)/sub; } } if(sum<=x) return true; return false; } int main() { scanf("%lld%lld%lld",&n,&A,&B); LL right=0; for(LL i=1;i<=n;i++){ scanf("%lld",&h[i]); right+=h[i]/B+1; } sort(h+1,h+1+n); LL left=1; while(left<right){ LL mid=(left+right)/2; if(check(mid)) right=mid; else left=mid+1; } printf("%lld\n",left); return 0; }
a.cc: In function 'bool check(long long int)': a.cc:30:12: error: 'a' was not declared in this scope 30 | if(a[i]>temp){ | ^
s155167183
p03702
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> #include<bitset> #define EPS 1e-9 #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long const int MOD = 1E9+7; const int N = 1000000+5; using namespace std; LL n,A,B; LL a[N]; bool check(LL x){ LL temp=x*B; LL sub=A-B; LL sum=0; for(LL i=n;i>=1;i--){ if(a[i]>temp){ if((h[i]-temp)%sub) sum+=(h[i]-temp)/sub+1; else sum+=(h[i]-temp)/sub; } } if(sum<=x) return true; return false; } int main() { scanf("%lld%lld%lld",&n,&A,&B); LL right=0; for(LL i=1;i<=n;i++){ scanf("%lld",&h[i]); right+=h[i]/B+1; } sort(h+1,h+1+n); LL left=1; while(left<right){ LL mid=(left+right)/2; if(check(mid)) right=mid; else left=mid+1; } printf("%lld\n",left); return 0; }
a.cc: In function 'bool check(long long int)': a.cc:31:17: error: 'h' was not declared in this scope 31 | if((h[i]-temp)%sub) | ^ a.cc: In function 'int main()': a.cc:46:23: error: 'h' was not declared in this scope 46 | scanf("%lld",&h[i]); | ^ a.cc:49:10: error: 'h' was not declared in this scope 49 | sort(h+1,h+1+n); | ^
s356733026
p03702
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> arr; ll n, a, b; int bul(ll x){ int ans = x; for (int i = 0; i < n; i++){ ll kes = arr[i] - b*x; kes = max(kes, 0); ans -= kes/a + (kes%a == 0); } if (ans < 0) return 0; return 1; } int main(){ cin >> n >> a >> b; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; ll l = 1; ll r = 1000000000; while (l < r){ int mid = (l+r)/2; if (bul(mid)) r = mid; else l = mid+1; } cout << l << endl; }
a.cc: In function 'int bul(ll)': a.cc:12:14: error: no matching function for call to 'max(ll&, int)' 12 | kes = max(kes, 0); | ~~~^~~~~~~~ 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:12:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 12 | kes = max(kes, 0); | ~~~^~~~~~~~ /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:12:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 12 | kes = max(kes, 0); | ~~~^~~~~~~~
s872200629
p03702
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> arr; ll n, a, b; int bul(ll x){ int ans = x; for (int i = 0; i < n; i++){ ll kes = arr[i] - b*x; kes = max(kes, 0); ans -= kes/a + (kes%a == 0); } if (ans < 0) return 0; return 1; } int main(){ cin >> n >> a >> b; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; ll l = 1; ll r = 1000000000; while (l < r){ int mid = (l+r)/2; if (bul(mid)) r = mid; else l = mid-1; } cout << l << endl; }
a.cc: In function 'int bul(ll)': a.cc:12:14: error: no matching function for call to 'max(ll&, int)' 12 | kes = max(kes, 0); | ~~~^~~~~~~~ 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:12:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 12 | kes = max(kes, 0); | ~~~^~~~~~~~ /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:12:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 12 | kes = max(kes, 0); | ~~~^~~~~~~~
s295274780
p03702
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll vector<ll> arr; ll n, a, b; int bul(ll x){ int ans = x; for (int i = 0; i < n; i++){ ll kes = arr[i] - b*x; kes = max(kes, 0); ans -= kes/a + (kes%a == 0); } if (ans < 0) return 0; return 1; } int main(){ cin >> n >> a >> b; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; ll l = 1; ll r = 1000000000; while (l < r){ int mid = (l+r)/2; if (bul(mid)) r = mid; else l = mid-1; } cout << l << endl; }
a.cc:6:1: error: expected initializer before 'vector' 6 | vector<ll> arr; | ^~~~~~ a.cc:7:1: error: 'll' does not name a type 7 | ll n, a, b; | ^~ a.cc:9:9: error: 'll' was not declared in this scope 9 | int bul(ll x){ | ^~ a.cc: In function 'int main()': a.cc:22:10: error: 'n' was not declared in this scope; did you mean 'yn'? 22 | cin >> n >> a >> b; | ^ | yn a.cc:22:15: error: 'a' was not declared in this scope 22 | cin >> n >> a >> b; | ^ a.cc:22:20: error: 'b' was not declared in this scope 22 | cin >> n >> a >> b; | ^ a.cc:23:3: error: 'arr' was not declared in this scope 23 | arr.resize(n); | ^~~ a.cc:26:3: error: 'll' was not declared in this scope 26 | ll l = 1; | ^~ a.cc:27:5: error: expected ';' before 'r' 27 | ll r = 1000000000; | ^~ | ; a.cc:28:10: error: 'l' was not declared in this scope 28 | while (l < r){ | ^ a.cc:28:14: error: 'r' was not declared in this scope 28 | while (l < r){ | ^ a.cc:30:12: error: 'bul' cannot be used as a function 30 | if (bul(mid)) r = mid; | ~~~^~~~~ a.cc:34:11: error: 'l' was not declared in this scope 34 | cout << l << endl; | ^
s426340828
p03702
C++
#include <bits/stdc++.h> using namespace std; vector<ll> arr; ll n, a, b; int bul(ll x){ int ans = x; for (int i = 0; i < n; i++){ ll kes = arr[i] - b*x; kes = max(kes, 0); ans -= kes/a + (kes%a == 0); } if (ans < 0) return 0; return 1; } int main(){ cin >> n >> a >> b; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; ll l = 1; ll r = 1000000000; while (l < r){ int mid = (l+r)/2; if (bul(mid)) r = mid; else l = mid-1; } cout << l << endl; }
a.cc:4:8: error: 'll' was not declared in this scope 4 | vector<ll> arr; | ^~ a.cc:4:10: error: template argument 1 is invalid 4 | vector<ll> arr; | ^ a.cc:4:10: error: template argument 2 is invalid a.cc:5:1: error: 'll' does not name a type 5 | ll n, a, b; | ^~ a.cc:7:9: error: 'll' was not declared in this scope 7 | int bul(ll x){ | ^~ a.cc: In function 'int main()': a.cc:20:10: error: 'n' was not declared in this scope; did you mean 'yn'? 20 | cin >> n >> a >> b; | ^ | yn a.cc:20:15: error: 'a' was not declared in this scope 20 | cin >> n >> a >> b; | ^ a.cc:20:20: error: 'b' was not declared in this scope 20 | cin >> n >> a >> b; | ^ a.cc:21:7: error: request for member 'resize' in 'arr', which is of non-class type 'int' 21 | arr.resize(n); | ^~~~~~ a.cc:22:41: error: invalid types 'int[int]' for array subscript 22 | for (int i = 0; i < n; i++) cin >> arr[i]; | ^ a.cc:24:3: error: 'll' was not declared in this scope 24 | ll l = 1; | ^~ a.cc:25:5: error: expected ';' before 'r' 25 | ll r = 1000000000; | ^~ | ; a.cc:26:10: error: 'l' was not declared in this scope 26 | while (l < r){ | ^ a.cc:26:14: error: 'r' was not declared in this scope 26 | while (l < r){ | ^ a.cc:28:12: error: 'bul' cannot be used as a function 28 | if (bul(mid)) r = mid; | ~~~^~~~~ a.cc:32:11: error: 'l' was not declared in this scope 32 | cout << l << endl; | ^
s372350982
p03702
C++
#include <bits/stdc++.h> using namespace std; vector<ll> arr; ll n, a, b; int bul(ll x){ int ans = x; for (int i = 0; i < n; i++){ ll kes = arr[i] - b*x; kes = max(kes, 0); ans -= kes/a + (kes%a == 0); } if (ans < 0) return 0; return 1; } int main(){ cin >> n >> a >> b; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; ll l = 0; ll r = 1000000000; while (l < r){ int mid = (l+r)/2; if (bul(mid)) r = mid; else l = mid-1; } cout << l << endl; }
a.cc:4:8: error: 'll' was not declared in this scope 4 | vector<ll> arr; | ^~ a.cc:4:10: error: template argument 1 is invalid 4 | vector<ll> arr; | ^ a.cc:4:10: error: template argument 2 is invalid a.cc:5:1: error: 'll' does not name a type 5 | ll n, a, b; | ^~ a.cc:7:9: error: 'll' was not declared in this scope 7 | int bul(ll x){ | ^~ a.cc: In function 'int main()': a.cc:20:10: error: 'n' was not declared in this scope; did you mean 'yn'? 20 | cin >> n >> a >> b; | ^ | yn a.cc:20:15: error: 'a' was not declared in this scope 20 | cin >> n >> a >> b; | ^ a.cc:20:20: error: 'b' was not declared in this scope 20 | cin >> n >> a >> b; | ^ a.cc:21:7: error: request for member 'resize' in 'arr', which is of non-class type 'int' 21 | arr.resize(n); | ^~~~~~ a.cc:22:41: error: invalid types 'int[int]' for array subscript 22 | for (int i = 0; i < n; i++) cin >> arr[i]; | ^ a.cc:24:3: error: 'll' was not declared in this scope 24 | ll l = 0; | ^~ a.cc:25:5: error: expected ';' before 'r' 25 | ll r = 1000000000; | ^~ | ; a.cc:26:10: error: 'l' was not declared in this scope 26 | while (l < r){ | ^ a.cc:26:14: error: 'r' was not declared in this scope 26 | while (l < r){ | ^ a.cc:28:12: error: 'bul' cannot be used as a function 28 | if (bul(mid)) r = mid; | ~~~^~~~~ a.cc:32:11: error: 'l' was not declared in this scope 32 | cout << l << endl; | ^
s014145062
p03702
C++
#include <iostream> #include <bits/stdc++.h> using namespace std; int N; long long A, B; long long H[210000]; int main() { cin >> N >> A >> B; for (int i = 0; i < N; ++i) cin >> H[i]; sort(H, H+N); long long lo = 0, hi = 1e16; while (hi - lo > 1) { long long mid = (lo + hi) / 2; long long need = 0; for (int i = 0; i < N; ++i) { long long rem = H[i] - mid * B; if (rem > 0) need += (rem + (A-B-1)) / (A-B); } if (need <= mid) hi = mid; else lo = mid; } cout << hi << endl; } }
a.cc:36:1: error: expected declaration before '}' token 36 | } | ^
s102919772
p03702
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N=sc.nextInt(); int A=sc.nextInt(); int B=sc.nextInt(); int[] h=new int[n]; int ans =0; for(int i=0;i<N;i++){ h[i]=sc.nextInt(); } while(h[N-1] < 0){ ans++; Arrays.sort(h); h[N-1] -= A; for(int i=0;i<N-1;i++){ h[i] -= B; } Arrays.sort(h); if(h[N-1] < 0){ break; } } System.out.println(ans); } }
Main.java:9: error: cannot find symbol int[] h=new int[n]; ^ symbol: variable n location: class Main 1 error
s331645175
p03702
C++
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N=sc.nextInt(); int A=sc.nextInt(); int B=sc.nextInt(); int[] h=new int[n]; int ans =0; for(int i=0;i<N;i++){ h[i]=sc.nextInt(); } while(h[N-1] < 0){ ans++; Arrays.sort(h); h[N-1] -= A; for(int i=0;i<N-1;i++){ h[i] -= B; } Arrays.sort(h); if(h[N-1] < 0){ break; } } System.out.println(ans); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s410747660
p03702
C++
#include <iostream> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; long long h[n], begin = 1, end = 0; for (int i = 0; cin >> h[i]; i++) { end = max(end, h[i]); } end = max(1, end / b); while (begin < end) { long long mid = (begin + end) / 2, count = 0; for (long long i = 0; i < n; i++) { if (h[i] - mid * b > 0) { count += (h[i] - mid * b - 1) / (a - b); } } if (count <= mid) { end = mid; } else { begin = mid + 1; } } cout << begin; return 0; }
a.cc: In function 'int main()': a.cc:11:14: error: no matching function for call to 'max(int, long long int)' 11 | end = max(1, end / b); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:11:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 11 | end = max(1, end / b); | ~~~^~~~~~~~~~~~ /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
s466942610
p03702
C++
#include<iostream> using namespace std; int main() { int N,A,B; cin >> N >> A >> B; int H[100010]; for(int i=0;i<N;i++){ cin >> H[i]; } sort(H,H+N-1); int isNG = 0; int isOK = (H[N-1]+B-1)/B; while(isOK-isNG>1){ int mid = (isOK+isNG)/2; int need = 0; for(int i=0;i<N;i++){ if(H[i]-B*mid>0){ need+=(H[i]-B*mid+A-B-1)/(A-B); if(need>mid){ isNG=mid; continue; } } } isOK=mid; } cout << isOK << endl; }
a.cc: In function 'int main()': a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(H,H+N-1); | ^~~~ | short
s094741324
p03702
C++
#include<iostream> using namespace std; int main() { int N,A,B; cin >> N >> A >> B; int H[100010]; for(int i=0;i<N;i++){ cin >> H[i]; } int isNG = 0; int isOK = (max(H)+B-1)/B; while(isOK-isNG>1){ int mid = (isOK+isNG)/2; int need = 0; for(int i=0;i<N;i++){ if(H[i]-B*mid>0){ need+=(H[i]-B*mid+A-B-1)/(A-B); if(need>mid){ isNG=mid; continue; } } } isOK=mid; } cout << isOK << endl; }
a.cc: In function 'int main()': a.cc:13:18: error: no matching function for call to 'max(int [100010])' 13 | int isOK = (max(H)+B-1)/B; | ~~~^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /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, 1 provided
s871392218
p03702
C++
#include <bits/stdc++.h> #define int long long using namespace std; const int MAXN = 100 * 1000 + 123; int n, A, B, a[MAXN]; int32_t main() { cin >> n >> A >> B; A -= B; for (int i = 0; i < n; i++) cin >> a[i]; int dw = -1, up = 1000 * 1000 * 1000 + 123; while (up - dw > 1) { int m = (up + dw) / 2, use = 0; for (int i = 0; i < n; i++) use += max((a[i] - m * B + A - 1) / A, 0); if (use > m) dw = m; else up = m; } cout << up; return 0; }
a.cc: In function 'int32_t main()': a.cc:28:23: error: no matching function for call to 'max(long long int, int)' 28 | use += max((a[i] - m * B + A - 1) / A, 0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 28 | use += max((a[i] - m * B + A - 1) / A, 0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | use += max((a[i] - m * B + A - 1) / A, 0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s823826423
p03702
C++
#include <bits/stdc++.h> using namespace std; const int N = 100 * 1000 + 10; long long h[N], n, a, b; bool is_val(long long t) { long long cnt = 0; for (int i = 0; i < n; i++) { long long x = h[i]; x -= t * b; if(x <= 0) continue; cnt += (x / (a - b)) + min(1, x % (a - b)); } return cnt <= t; } long long bin_search() { long long low = 0, high = 1000 * 1000 * 1000 + 5; while(high - low > 1) { long long mid = (low + high) / 2; if(is_val(mid)) high = mid; else low = mid; } return high; } int main() { cin >> n >> a >> b; for (int i = 0; i < n; i++) cin >> h[i]; cout << bin_search() << endl; }
a.cc: In function 'bool is_val(long long int)': a.cc:16:43: error: no matching function for call to 'min(int, long long int)' 16 | cnt += (x / (a - b)) + min(1, x % (a - b)); | ~~~^~~~~~~~~~~~~~~~ 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:16:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 16 | cnt += (x / (a - b)) + min(1, x % (a - b)); | ~~~^~~~~~~~~~~~~~~~ /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:16:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 16 | cnt += (x / (a - b)) + min(1, x % (a - b)); | ~~~^~~~~~~~~~~~~~~~
s472175370
p03702
C++
#include <stdio.h> #include <algorithm> using namespace std; #define ll long long ll n,a,b,c[100000+10]; bool f(ll x) { ll i,j,sum=0; for(i=1;i<=n;i++) { if(c[i]>b*x) sum+=(c[i]-b*x+a-1)/a; } return sum<=x; } int main() { ll m,i,j,k,s,t,r; scanf("%lld%lld%lld",&n,&a,&b) { a-=b;r=0; for(i=1;i<=n;i++) scanf("%lld",&c[i]),r+=(c[i]/b+1); ll mid,l=1; while(l<r) { int mid=(l+r)/2; if(f(mid)) r=mid; else l=mid+1; } printf("%lld\n",l); } return 0; }
a.cc: In function 'int main()': a.cc:18:37: error: expected ';' before '{' token 18 | scanf("%lld%lld%lld",&n,&a,&b) | ^ | ; 19 | { | ~
s225113094
p03702
C++
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<utility> #include<map> #include<set> #include<queue> #include<math.h> using namespace std; #define N (1000000000+7) #define INF 1e16 typedef long long ll; typedef pair<ll,ll> P; ll n,A,B; ll h[100010]; bool check(ll x){ ll res=0; for(ll i=0;i<n;i++){ ll t=h[i]-B*x; if(t<=0)continue; else{ res+=t/(A-B); if(t%(A-B)!=0)res++; } } return (res>x); } int main(void){ cin>>n>>A>>B; for(ll i=0;i<n;i++)cin>>h[i]; ll ng=0,ok=(ll)INF; while(ok-ng>1){ ll mid=(ok+ng)/2; if(check(mid))ng=mid; else okl=mid; } cout<<ok<<endl; return 0; }
a.cc: In function 'int main()': a.cc:39:14: error: 'okl' was not declared in this scope; did you mean 'ok'? 39 | else okl=mid; | ^~~ | ok
s326065205
p03702
C++
#include<bits/stdc++.h> using namespace std; bool et(vector<long long> &v,long long A,long long B,long long T) { long long bt=0; for(int i=0;i<v.size();i++) { long long tmp=max(0,(v[i]-B*T)); bt+=(tmp+(A-B)-1)/(A-B); } if(bt<=T) { return true; } else { return false; } } main() { long long N,A,B; cin>>N>>A>>B; vector<long long> v(N); long long mt=-1; for(int i=0;i<N;i++) {cin>>v[i]; mt=max(mt,v[i]); } long long l= 0; long long r= mt/B; r+=1; while(l<r) { long long mid=(l+r)/2; if(et(v,A,B,mid)) { r=mid-1; } else { l=mid+1; } } cout<<l<<"\n"; }
a.cc: In function 'bool et(std::vector<long long int>&, long long int, long long int, long long int)': a.cc:8:34: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 8 | long long tmp=max(0,(v[i]-B*T)); | ~~~^~~~~~~~~~~~~~ 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:8:34: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 8 | long long tmp=max(0,(v[i]-B*T)); | ~~~^~~~~~~~~~~~~~ /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:8:34: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 8 | long long tmp=max(0,(v[i]-B*T)); | ~~~^~~~~~~~~~~~~~ a.cc: At global scope: a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 24 | main() | ^~~~
s184371274
p03702
C++
// ConsoleApplication2.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 // #include <iostream> #include <stdlib.h> #include <algorithm> int main() { int amount, maxdamage, damage; int monsters[100001]; std::cin >> amount >> maxdamage >> damage; for (int i = 0; i < amount; i++) { std::cin >> monsters[i]; } std::sort(monsters[0], monsters[amount - 1]); int index = amount - 1; int attacked = 0; while (true) { if (monsters[index] <= 0 && monsters[index - 1] > 0) { index--; } else if (monsters[index] <= 0 && monsters[index - 1] <= 0) { break; } for (int i = 0; i < index; i++) { monsters[i] -= damage; } monsters[index] -= maxdamage; attacked++; } }
In file included from /usr/include/c++/14/algorithm:61, from a.cc:6: /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:17:11: required from here 17 | std::sort(monsters[0], monsters[amount - 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/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:4: /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, 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: /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:17:11: required from here 17 | std::sort(monsters[0], monsters[amount - 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:17:11: required from here 17 | std::sort(monsters[0], monsters[amount - 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:17:11: required from here 17 | std::sort(monsters[0], monsters[amount - 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 'differ
s979687074
p03702
Java
import java.util.function.IntPredicate; import java.util.*; public class Main { static Scanner scanner = new Scanner(System.in); public static void main(String[]$) { int n = scanner.nextInt(); long a = scanner.nextInt(); long b = scanner.nextInt(); int[] h = new int[n]; int max = 0; for (int i = 0; i < n; i++) { h[i] = scanner.nextInt(); max = Math.max(max, h[i]); } max = (int)Math.ceil((double)max / b) + 1; System.out.println(binarySearch(max, t -> { long count = 0; for (double i : h) { if (b * t < i) { count += Math.ceil((i - b * t) / (a - b)); } } Utils.println(t, count, count <= t); return count > t; })); } static int binarySearch(int max, IntPredicate predicate) { int ok = 0, ng = max; while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (predicate.test(mid)) { ok = mid; } else { ng = mid; } } return ok; } }
Main.java:25: error: cannot find symbol Utils.println(t, count, count <= t); ^ symbol: variable Utils location: class Main 1 error
s471691161
p03702
C++
from math import * s=raw_input().split(' ') n=int(s[0]) a=int(s[1]) b=int(s[2]) h=[] s=0 for i in range(n): k=raw_input() h.append(int(k)) s+=int(k) l=1; r=s; an=-1 while r>=l: m=(l+r)//2 c=0 for i in range(n): if (h[i]-b*m)%(a-b)==0: c=c+(h[i]-b*m)//(a-b) else: c=c+((h[i]-b*m)//(a-b)+1) if c<=m: an=m; r=m-1 else: l=m+1 #print(r,l) print(an)
a.cc:29:2: error: invalid preprocessing directive #print 29 | #print(r,l) | ^~~~~ a.cc:1:1: error: 'from' does not name a type 1 | from math import * | ^~~~ a.cc:14:6: error: 'r' does not name a type 14 | l=1; r=s; | ^ a.cc:15:1: error: 'an' does not name a type 15 | an=-1 | ^~ a.cc:26:17: error: 'r' does not name a type 26 | r=m-1 | ^
s015346102
p03702
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int N, A, B, h[100000]; int search(void){ int Min = -1, Max = 1000000000; while(Max > Min+1){ ll m = (Min + Max)/2, flag = 0, cnt = 0; for(int i=0; i<N; i++){ ll t = (h[i] - m*B + A - B - 1)/(A-B); t = max(0, t); cnt += t; } if(cnt <= m) Max = m; else Min = m; } return Max; } int main(){ cin >> N >> A >> B; for(int i=0; i<N; i++) cin >> h[i]; int ans = search(); cout << ans << endl; return 0; }
a.cc: In function 'int search()': a.cc:12:28: error: no matching function for call to 'max(int, ll&)' 12 | t = max(0, t); | ~~~^~~~~~ 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:12:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 12 | t = max(0, t); | ~~~^~~~~~ /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:12:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 12 | t = max(0, t); | ~~~^~~~~~
s757246654
p03702
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int N, A, B, h[100000]; int search(void){ int Min = -1, Max = 1000000000; while(Max > Min+1){ ll m = (Min + Max)/2, flag = 0, cnt = 0; for(int i=0; i<N; i++){ ll t = (h[i] - m*B + A - B - 1)/(A-B); t = max(0, t); cnt += t; } if(cnt <= m) max = m; else min = m; } return max; } int main(){ cin >> N >> A >> B; for(int i=0; i<N; i++) cin >> h[i]; int ans = search(); cout << ans << endl; return 0; }
a.cc: In function 'int search()': a.cc:12:28: error: no matching function for call to 'max(int, ll&)' 12 | t = max(0, t); | ~~~^~~~~~ 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:12:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 12 | t = max(0, t); | ~~~^~~~~~ /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:12:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 12 | t = max(0, t); | ~~~^~~~~~ a.cc:15:36: error: overloaded function with no contextual type information 15 | if(cnt <= m) max = m; | ^ a.cc:16:28: error: overloaded function with no contextual type information 16 | else min = m; | ^ a.cc:18:16: error: cannot resolve overloaded function 'max' based on conversion to type 'int' 18 | return max; | ^~~
s212882235
p03702
C++
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second #define FOR(i, a, b) for(int i=(a);i<(b);i++) #define REP(i, n) FOR(i, 0, n) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define RREP(i, n) RFOR(i, n, 0) #define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++) #define ALL(a) (a).begin(), (a).end() #define SZ(x) ((int)(x).size()) typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vll> vvll; const double eps = 1e-10; const int MOD = 1000000007; const int INF = 1000000000; const ll LINF = 1ll << 60; template<typename T> void printv(vector<T> const& s) { REP(i, SZ(s)) { cout << s[i] << " "; } cout << endl; } ll n, a, b; vll h; bool ok(ll k) { ll cnt = 0; // cout << "k:" << k << endl; REP(i, n) { if(h[i] > b * k) cnt += (h[i] - b * k + (a-b) - 1) / (a-b); } return cnt <= k; } int main () { cin.tie(0); cout << setprecision(10); cin >> n >> a >> b; h.resize(n); su = 0; REP(i, n) { cin >> h[i]; } if(n == 1) { cout << (h[0] + a - 1) / a << endl; return 0; } ll l = -1, r = 1e9+1; while(r - l > 1) { ll mid = (l + r) / 2; if(ok(mid)) r = mid; else l = mid; } cout << r << endl; }
a.cc: In function 'int main()': a.cc:56:3: error: 'su' was not declared in this scope; did you mean 'se'? 56 | su = 0; | ^~ | se
s162020467
p03702
C++
#include "bits/stdc++.h" #define fcout(d) cout << fixed << setprecision(d) #define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i) #define repD(i,t,s) for(int i = (int)(t); i >= (int)(s); --i) #define rep(i,n) repU(i,0,n - 1) #define rep1(i,n) repU(i,1,n) #define all(v) begin(v),end(v) #define vct vector #define prique priority_queue #define l_bnd lower_bound #define u_bnd upper_bound #define puf push_front #define pub push_back #define pof pop_front #define pob pop_back #define mkp make_pair #define mkt make_tuple #define fir first #define sec second #define q_ceil(n,d) ((n - 1) / (d) + 1) #define parity(a,b) (a & 1 == b & 1) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef pair<int,int> pii; const pii dir[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} }; const int inf32 = (1 << 30) - 1; const ll inf64 = (1LL << 62) - 1; const int mod = 1e9 + 7; ll N,A,B,h[100100]; bool judge(ll n){ ll s = 0; rep(i,N){ s += max(0,q_ceil(h[i] - n * B,A - B)); if(s > n) return 0; } return 1; } int solve(){ ll upper = inf32; ll lower = 0; while(upper - lower > 1){ ll mid = (upper + lower) / 2; if(judge(mid)) upper = mid; else lower = mid; } return upper; } int main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> N >> A >> B; rep(i,N) cin >> h[i]; cout << solve() << endl; }
a.cc: In function 'bool judge(ll)': a.cc:39:25: error: no matching function for call to 'max(int, ll)' 39 | s += max(0,q_ceil(h[i] - n * B,A - B)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:39:25: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 39 | s += max(0,q_ceil(h[i] - n * B,A - B)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:39:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 39 | s += max(0,q_ceil(h[i] - n * B,A - B)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s584892391
p03702
C
#include <bits/stdc++.h> using namespace std; int N; int h[100010]; int A,B; int ans; int main() { cin>>N>>A>>B; for(int i=1;i<=N;++i) { cin>>h[i]; } while(true) { int f=0; sort(h,h+N+1); for(int i=1;i<=N;i++) { if( i == N) h[i] -= A; else h[i] -= B; if(h[i]<=0) f++; } ans++; if(f==N) break; } cout<<ans<<endl; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s800031824
p03702
C++
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #define LL long long #define ull unsigned long long #define mp make_pair #define N 100009 const LL INF = 0x3f3f3f3f; using namespace std; int main() { LL h[N]; LL n, a, b; bool judge(LL mid) { LL ans = mid; for(int i = 1; i <= n; i++) { LL tm = h[i] - b*mid; if(tm > 0) { LL cnt = tm / (a - b) + (tm % (a - b) == 0 ? 0 : 1); ans -= cnt; if(ans < 0) return false; } } return true; } int main() { scanf("%lld%lld%lld", &n, &a, &b); for(int i = 1; i <= n; i++) scanf("%lld", &h[i]); LL l = 0, r = INF; LL ans = INF; while(l <= r) { LL mid = (l + r)>>1; if(judge(mid)) ans = mid, r = mid - 1; else l = mid + 1; } printf("%lld\n", ans); return 0; } return 0; }
a.cc: In function 'int main()': a.cc:96:5: error: a function-definition is not allowed here before '{' token 96 | { | ^ a.cc:112:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 112 | int main() | ^~ a.cc:112:13: note: remove parentheses to default-initialize a variable 112 | int main() | ^~ | -- a.cc:112:13: note: or replace parentheses with braces to value-initialize a variable a.cc:113:5: error: a function-definition is not allowed here before '{' token 113 | { | ^
s864365713
p03702
C++
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #define ll long long #define ull unsigned long long #define mp make_pair using namespace std; int main() { #include<bits/stdc++.h> #define N 100009 using namespace std; typedef long long LL; const LL INF = 0x3f3f3f3f; LL h[N]; LL n, a, b; bool judge(LL mid) { LL ans = mid; for(int i = 1; i <= n; i++) { LL tm = h[i] - b*mid; if(tm > 0) { LL cnt = tm / (a - b) + (tm % (a - b) == 0 ? 0 : 1); ans -= cnt; if(ans < 0) return false; } } return true; } int main() { scanf("%lld%lld%lld", &n, &a, &b); for(int i = 1; i <= n; i++) scanf("%lld", &h[i]); LL l = 0, r = INF; LL ans = INF; while(l <= r) { LL mid = (l + r)>>1; if(judge(mid)) ans = mid, r = mid - 1; else l = mid + 1; } printf("%lld\n", ans); return 0; } return 0; }
In file included from /usr/include/c++/14/cassert:43, from a.cc:2: /usr/include/c++/14/any: In function 'int main()': /usr/include/c++/14/any:45:15: error: expected '=' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/any:45:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77, from a.cc:91: /usr/include/c++/14/any:45:14: error: expected ';' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/any:46:1: error: expected primary-expression before '{' token 46 | { | ^ /usr/include/c++/14/optional:58:15: error: expected '=' before '__attribute__' 58 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/optional:58:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:79: /usr/include/c++/14/optional:58:14: error: expected ';' before '__attribute__' 58 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/optional:59:1: error: expected primary-expression before '{' token 59 | { | ^ /usr/include/c++/14/variant:59:15: error: expected '=' before '__attribute__' 59 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/variant:59:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80: /usr/include/c++/14/variant:59:14: error: expected ';' before '__attribute__' 59 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/variant:60:1: error: expected primary-expression before '{' token 60 | { | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683: /usr/include/uchar.h:56:1: error: expected unqualified-id before string constant 56 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/c++/14/cuchar:92:15: error: expected '=' before '__attribute__' 92 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/cuchar:92:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:134: /usr/include/c++/14/cuchar:92:14: error: expected ';' before '__attribute__' 92 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/cuchar:93:1: error: expected primary-expression before '{' token 93 | { | ^ /usr/include/c++/14/codecvt:43:15: error: expected '=' before '__attribute__' 43 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/codecvt:43:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:173: /usr/include/c++/14/codecvt:43:14: error: expected ';' before '__attribute__' 43 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/codecvt:44:1: error: expected primary-expression before '{' token 44 | { | ^ /usr/include/c++/14/shared_mutex:52:15: error: expected '=' before '__attribute__' 52 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/shared_mutex:52:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:193: /usr/include/c++/14/shared_mutex:52:14: error: expected ';' before '__attribute__' 52 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/shared_mutex:53:1: error: expected primary-expression before '{' token 53 | { | ^ /usr/include/c++/14/charconv:52:15: error: expected '=' before '__attribute__' 52 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/charconv:52:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:198: /usr/include/c++/14/charconv:52:14: error: expected ';' before '__attribute__' 52 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/charconv:53:1: error: expected primary-expression before '{' token 53 | { | ^ /usr/include/c++/14/bits/fs_fwd.h:39:15: error: expected '=' before '__attribute__' 39 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/fs_fwd.h:39:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200: /usr/include/c++/14/bits/fs_fwd.h:39:14: error: expected ';' before '__attribute__' 39 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/fs_fwd.h:40:1: error: expected primary-expression before '{' token 40 | { | ^ /usr/include/c++/14/bits/fs_path.h:57:15: error: expected '=' before '__attribute__' 57 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/fs_path.h:57:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/filesystem:52: /usr/include/c++/14/bits/fs_path.h:57:14: error: expected ';' before '__attribute__' 57 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/fs_path.h:58:1: error: expected primary-expression before '{' token 58 | { | ^ /usr/include/c++/14/bits/fs_dir.h:45:15: error: expected '=' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/fs_dir.h:45:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/filesystem:53: /usr/include/c++/14/bits/fs_dir.h:45:14: error: expected ';' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/fs_dir.h:46:1: error: expected primary-expression before '{' token 46 | { | ^ /usr/include/c++/14/bits/fs_ops.h:37:15: error: expected '=' before '__attribute__' 37 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/fs_ops.h:37:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/filesystem:54: /usr/include/c++/14/bits/fs_ops.h:37:14: error: expected ';' before '__attribute__' 37 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/fs_ops.h:38:1: error: expected primary-expression before '{' token 38 | { | ^ /usr/include/c++/14/memory_resource:70:15: error: expected '=' before '__attribute__' 70 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/memory_resource:70:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:202: /usr/include/c++/14/memory_resource:70:14: error: expected ';' before '__attribute__' 70 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/memory_resource:71:1: error: expected primary-expression before '{' token 71 | { | ^ a.cc:101:5: error: a function-definition is not allowed here before '{' token 101 | { | ^ a.cc:117:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 117 | int main() | ^~ a.cc:117:13: note: remove parentheses to default-initialize a variable 117 | int main() | ^~ | -- a.cc:117:13: note: or replace parentheses with braces to value-initialize a variable a.cc:118:5: error: a function-definition is not allowed here before '{' token 118 | { | ^
s566857321
p03702
C++
#include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> using namespace std; int A,B,N; int a[100005]; bool judge(long long x) { long long sum=0; for(int i=0;i<N;i++) { long long t=a[i]-B*x; if(t>0) sum+=(int)ceil(t*1.0/(A-B)); if(sum>x||sum<0) return false; } return true; } int main() { int imax=0; scanf("%d%d%d",&N,&A,&B); for(int i=0;i<N;i++) scanf("%d",&a[i]),imax=max(a[i],imax); long long l=0,r=imax; while(l<r) { long long mid=(l+r)/2; if(judge(mid)) r=mid; else l=mid+1; } printf("%lld\n",r); return 0; }
a.cc: In function 'bool judge(long long int)': a.cc:18:19: error: 'ceil' was not declared in this scope 18 | sum+=(int)ceil(t*1.0/(A-B)); | ^~~~
s243007368
p03702
C++
#include<iostream> #include<algorithm> #define ll long long using namespace std; int n, a, b, h[120000]; int main() { cin >> n >> a >> b ; for(int i = 1; i <= n; i ++ ) cin >> h[i]; sort(h+1, h+n+1); ll L = 0, R = 1e15; while(R-L > 1) { ll M = (L+F) >> 1; ll D = b*M; ll cnt = 0; for(int i = 0; i < n; i ++ ) { if(h[i] <= D) continue; cnt += (h[i]-D-1)/(a-b)+1; } if(cnt <= M) R = M; else L = M; } cout << R << endl; }
a.cc: In function 'int main()': a.cc:12:27: error: 'F' was not declared in this scope 12 | ll M = (L+F) >> 1; | ^
s849681993
p03702
C++
####################################### ####################################### v ####################################### ####################################### ####################################### ####################################### ####################################### ####################################### ####################################### ####################################### ####################################### #######################################
a.cc:2:1: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:3: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:5: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:7: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:9: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:11: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:13: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:15: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:17: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:19: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:21: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:23: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:25: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:27: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:29: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:31: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:33: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:35: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:37: error: stray '##' in program 2 | ####################################### | ^~ a.cc:2:39: error: stray '#' in program 2 | ####################################### | ^ a.cc:3:1: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:3: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:5: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:7: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:9: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:11: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:13: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:15: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:17: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:19: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:21: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:23: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:25: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:27: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:29: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:31: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:33: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:35: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:37: error: stray '##' in program 3 | ####################################### | ^~ a.cc:3:39: error: stray '#' in program 3 | ####################################### | ^ a.cc:5:1: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:3: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:5: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:7: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:9: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:11: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:13: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:15: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:17: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:19: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:21: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:23: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:25: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:27: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:29: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:31: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:33: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:35: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:37: error: stray '##' in program 5 | ####################################### | ^~ a.cc:5:39: error: stray '#' in program 5 | ####################################### | ^ a.cc:6:1: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:3: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:5: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:7: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:9: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:11: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:13: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:15: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:17: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:19: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:21: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:23: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:25: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:27: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:29: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:31: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:33: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:35: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:37: error: stray '##' in program 6 | ####################################### | ^~ a.cc:6:39: error: stray '#' in program 6 | ####################################### | ^ a.cc:7:1: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:3: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:5: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:7: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:9: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:11: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:13: error: stray '##' in program 7 | ####################################### | ^~ a.cc:7:15: error: stray '##' in program 7 | ####################################### |
s494755630
p03702
C++
#include<bits/stdc++.h> #define N 100009 using namespace std; typedef long long ll; const ll INF=1e18; ll h[100005]; ll n,a,b; bool judge(ll mid) { ll answ=mid; for(int i=1;i<=n;i++) { ll tm=h[i]-b*mid; if(tm>0) { ll cnt=tm/(a-b); if(tm%(a-b)!=0) cnt++; answ-=cnt; if(answ<0) return false; } } return true; } int main() { cin>>n>>a>>b; for(int i=1;i<=n;i++) cin>>h[i]; ll l=0,r=INF; ll mid; ll ans; while(l<=r) { mid=(l+r)/2; if(judge(mid)) { r=mid-1; ans=mid; } else l=mid+1; } cout<<ans; return 0; }#include<bits/stdc++.h> #define N 100009 using namespace std; typedef long long ll; const ll INF=1e18; ll h[100005]; ll n,a,b; bool judge(ll mid) { ll answ=mid; for(int i=1;i<=n;i++) { ll tm=h[i]-b*mid; if(tm>0) { ll cnt=tm/(a-b); if(tm%(a-b)!=0) cnt++; answ-=cnt; if(answ<0) return false; } } return true; } int main() { cin>>n>>a>>b; for(int i=1;i<=n;i++) cin>>h[i]; ll l=0,r=INF; ll mid; ll ans; while(l<=r) { mid=(l+r)/2; if(judge(mid)) { r=mid-1; ans=mid; } else l=mid+1; } cout<<ans; return 0; }
a.cc:48:2: error: stray '#' in program 48 | }#include<bits/stdc++.h> | ^ a.cc:48:3: error: 'include' does not name a type 48 | }#include<bits/stdc++.h> | ^~~~~~~ a.cc:52:10: error: redefinition of 'const ll INF' 52 | const ll INF=1e18; | ^~~ a.cc:5:10: note: 'const ll INF' previously defined here 5 | const ll INF=1e18; | ^~~ a.cc:53:4: error: redefinition of 'll h [100005]' 53 | ll h[100005]; | ^ a.cc:6:4: note: 'll h [100005]' previously declared here 6 | ll h[100005]; | ^ a.cc:54:4: error: redefinition of 'll n' 54 | ll n,a,b; | ^ a.cc:7:4: note: 'll n' previously declared here 7 | ll n,a,b; | ^ a.cc:54:6: error: redefinition of 'll a' 54 | ll n,a,b; | ^ a.cc:7:6: note: 'll a' previously declared here 7 | ll n,a,b; | ^ a.cc:54:8: error: redefinition of 'll b' 54 | ll n,a,b; | ^ a.cc:7:8: note: 'll b' previously declared here 7 | ll n,a,b; | ^ a.cc:55:6: error: redefinition of 'bool judge(ll)' 55 | bool judge(ll mid) | ^~~~~ a.cc:8:6: note: 'bool judge(ll)' previously defined here 8 | bool judge(ll mid) | ^~~~~ a.cc:74:5: error: redefinition of 'int main()' 74 | int main() | ^~~~ a.cc:27:5: note: 'int main()' previously defined here 27 | int main() | ^~~~
s046388869
p03702
C++
#include<bits/stdc++.h> #define N 100009 using namespace std; typedef __int64 ll; const ll INF=1e18; ll h[100005]; ll n,a,b; bool judge(ll mid) { ll ans=mid; for(int i=1;i<=n;i++) { ll tm=h[i]-b*mid; if(tm>0) { ll cnt=tm/(a-b); if(tm%(a-b)!=0) cnt++; ans-=cnt; if(ans<0) return false; } } return true; } int main() { cin>>n>>a>>b; for(int i=1;i<=n;i++) cin>>h[i]; ll l=0,r=INF; ll mid; while(l<=r) { mid=(l+r)/2; if(judge(mid)) r=mid-1; else l=mid+1; } cout<<l; return 0; }
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | typedef __int64 ll; | ^~~~~~~ | __int64_t a.cc:5:7: error: 'll' does not name a type 5 | const ll INF=1e18; | ^~ a.cc:6:1: error: 'll' does not name a type 6 | ll h[100005]; | ^~ a.cc:7:1: error: 'll' does not name a type 7 | ll n,a,b; | ^~ a.cc:8:12: error: 'll' was not declared in this scope 8 | bool judge(ll mid) | ^~ a.cc: In function 'int main()': a.cc:29:10: error: 'n' was not declared in this scope; did you mean 'yn'? 29 | cin>>n>>a>>b; | ^ | yn a.cc:29:13: error: 'a' was not declared in this scope 29 | cin>>n>>a>>b; | ^ a.cc:29:16: error: 'b' was not declared in this scope 29 | cin>>n>>a>>b; | ^ a.cc:31:22: error: 'h' was not declared in this scope 31 | cin>>h[i]; | ^ a.cc:32:5: error: 'll' was not declared in this scope 32 | ll l=0,r=INF; | ^~ a.cc:33:7: error: expected ';' before 'mid' 33 | ll mid; | ^~~~ | ; a.cc:34:11: error: 'l' was not declared in this scope 34 | while(l<=r) | ^ a.cc:34:14: error: 'r' was not declared in this scope 34 | while(l<=r) | ^ a.cc:36:9: error: 'mid' was not declared in this scope 36 | mid=(l+r)/2; | ^~~ a.cc:37:17: error: 'judge' cannot be used as a function 37 | if(judge(mid)) | ~~~~~^~~~~ a.cc:42:11: error: 'l' was not declared in this scope 42 | cout<<l; | ^
s418618025
p03702
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <queue> #include <sstream> #include <stack> #include <time.h> #include <vector> #include <complex> #include <map> #include <set> #include <iomanip> #include <math.h> #include <stdlib.h> #include <list> #include <utility> #include <memory> #include <cstring> #include <fstream> #include <numeric> using namespace std; long long monst[100003]; int main(){ long long n,a,b,ans=0; cin>>n>>a>>b; for (long long i=0;i<n;i++) cin>>monst[i]; sort (monst,monst+n); while (monst[n-1]>0){ ans++; monst[n-1]-=a; for (long long i=n-2;i>=0;i--){monst[i]<=0;monst.pop_back(monst[i]); sort (monst,monst+n); } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:37:58: error: request for member 'pop_back' in 'monst', which is of non-class type 'long long int [100003]' 37 | for (long long i=n-2;i>=0;i--){monst[i]<=0;monst.pop_back(monst[i]); | ^~~~~~~~ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:28:11: note: to match this '{' 28 | int main(){ | ^
s977005745
p03702
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <queue> #include <sstream> #include <stack> #include <time.h> #include <vector> #include <complex> #include <map> #include <set> #include <iomanip> #include <math.h> #include <stdlib.h> #include <list> #include <utility> #include <memory> #include <cstring> #include <fstream> #include <numeric> using namespace std; long long monst[100003]; int main(){ long long n,a,b,ans=0; cin>>n>>a>>b; for (long long i=0;i<n;i++) cin>>monst[i]; sort (monst,monst+n); while (monst[n-1]>0){ ans++; monst[n-1]-=a; for (long long i=n-2;i>=0;i--){monst[i]<=0;monst.pop_back(monst[i]); sort (monst,monst+n); } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:37:58: error: request for member 'pop_back' in 'monst', which is of non-class type 'long long int [100003]' 37 | for (long long i=n-2;i>=0;i--){monst[i]<=0;monst.pop_back(monst[i]); | ^~~~~~~~ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:28:11: note: to match this '{' 28 | int main(){ | ^
s693705944
p03702
C++
#include <bits/stdc++.h> #define FI first #define SE second #define VE vector<int> #define PB push_back #define PA pair<int,int> #define MA make_pair #define LLI long long int #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl #define Pos(i) cout<<(i?"Possible":"Impossible")<<endl #define co(i) cout<<i<<endl using namespace std; // const int INF=1e9+7; const int MOD=1e9+7; // LLI n,a,b,h[100003]; LLI om(LLI a,LLI b){ if(a<=0){ return -((-a)/b); }else{ return (a-1)/b+1; } } bool solve(LLI k){ LLI sum=0; FOR(i,0,n){ sum+=max(om(h[i]-b*k,a-b),0); } return (sum<=k); } int main(){ cin>>n>>a>>b; FOR(i,0,n) cin>>h[i]; int st=0,en=INF; while(st+1!=en){ int mid=(st+en)/2; if(solve(mid)){ en=mid; }else{ st=mid; } } co(en); }
a.cc: In function 'bool solve(long long int)': a.cc:33:17: error: no matching function for call to 'max(long long int, int)' 33 | sum+=max(om(h[i]-b*k,a-b),0); | ~~~^~~~~~~~~~~~~~~~~~~~ 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:33:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 33 | sum+=max(om(h[i]-b*k,a-b),0); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:33:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | sum+=max(om(h[i]-b*k,a-b),0); | ~~~^~~~~~~~~~~~~~~~~~~~
s528992094
p03702
C++
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <cstring> #include <map> #include <queue> #include <cmath> #include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3 using namespace std; #define MOD 1000000007 #define ll long long #define ld long double #define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++) #define rep(i,n) FOR(i,0,n) #define pb push_back #define mp make_pair #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end()) #define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;} #define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > #define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();} ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);} ll lcm(ll a, ll b){return a/gcd(a,b)*b;} ll N, A, B; vector<ll> h; bool solve(ll n ){ ll cnt = 0; rep(i,h.size()){ if(h[i] < B*n) continue; cnt + = ((h[i]- n*B)/ (A-B)); if((h[i]-n*B)%(A-B) != 0) cnt ++; } if(cnt > n) return false; else return true; } int main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> N >> A >> B; rep(i,N){ ll inp; cin >> inp; h.pb(inp); } ll l = 0; ll r = 1e14+1; while(l+1 < r){ ll m = (l+r)/2; if(solve(m)) r = m; else l = m; } cout << r << endl; //cout << fixed << setprecision(16) << ans << endl; return 0; }
a.cc: In function 'bool solve(long long int)': a.cc:37:15: error: expected primary-expression before '=' token 37 | cnt + = ((h[i]- n*B)/ (A-B)); | ^
s050380055
p03702
C++
#include<iostream> #include<cstdlib> #include<cmath> #define N 100100 using namespace std; long long n,a,b,c[N],l,r; bool check(int x) { long long ans=0; for(int i=1;i<=n;i++) ans+=((c[i]-x*b)>0)*ceil(1.0*(c[i]-x*b)/(a-b)); if (ans<=x) return true; else return false; } int main() { ios::sync_with_stdio(false); cin>>n>>a>>b; for(int i=1;i<=n;++i) cin>>c[i]; l=1;r=1000000000; while(l<=r) { int mid=(l+r)/2; if (check(mid)) r=mid-1; else l=mid+1; } cout<<l<<endl; return 0; }#include<iostream> #include<cstdlib> #include<cmath> #define N 100100 using namespace std; long long n,a,b,c[N],l,r; bool check(int x) { long long ans=0; for(int i=1;i<=n;i++) ans+=((c[i]-x*b)>0)*ceil(1.0*(c[i]-x*b)/(a-b)); if (ans<=x) return true; else return false; } int main() { ios::sync_with_stdio(false); cin>>n>>a>>b; for(int i=1;i<=n;++i) cin>>c[i]; l=1;r=1000000000; while(l<=r) { int mid=(l+r)/2; if (check(mid)) r=mid-1; else l=mid+1; } cout<<l<<endl; return 0; }
a.cc:32:2: error: stray '#' in program 32 | }#include<iostream> | ^ a.cc:32:3: error: 'include' does not name a type 32 | }#include<iostream> | ^~~~~~~ a.cc:37:12: error: redefinition of 'long long int n' 37 | long long n,a,b,c[N],l,r; | ^ a.cc:6:12: note: 'long long int n' previously declared here 6 | long long n,a,b,c[N],l,r; | ^ a.cc:37:14: error: redefinition of 'long long int a' 37 | long long n,a,b,c[N],l,r; | ^ a.cc:6:14: note: 'long long int a' previously declared here 6 | long long n,a,b,c[N],l,r; | ^ a.cc:37:16: error: redefinition of 'long long int b' 37 | long long n,a,b,c[N],l,r; | ^ a.cc:6:16: note: 'long long int b' previously declared here 6 | long long n,a,b,c[N],l,r; | ^ a.cc:37:18: error: redefinition of 'long long int c [100100]' 37 | long long n,a,b,c[N],l,r; | ^ a.cc:6:18: note: 'long long int c [100100]' previously declared here 6 | long long n,a,b,c[N],l,r; | ^ a.cc:37:23: error: redefinition of 'long long int l' 37 | long long n,a,b,c[N],l,r; | ^ a.cc:6:23: note: 'long long int l' previously declared here 6 | long long n,a,b,c[N],l,r; | ^ a.cc:37:25: error: redefinition of 'long long int r' 37 | long long n,a,b,c[N],l,r; | ^ a.cc:6:25: note: 'long long int r' previously declared here 6 | long long n,a,b,c[N],l,r; | ^ a.cc:38:6: error: redefinition of 'bool check(int)' 38 | bool check(int x) | ^~~~~ a.cc:7:6: note: 'bool check(int)' previously defined here 7 | bool check(int x) | ^~~~~ a.cc:46:5: error: redefinition of 'int main()' 46 | int main() | ^~~~ a.cc:15:5: note: 'int main()' previously defined here 15 | int main() | ^~~~
s418096543
p03702
C++
#include <cstdio> using namespace std; typedef long long ll; ll n, a, b, l, r=1e9, m, ans, h[100005];   bool f(ll p) { ll i, c=0; for(i=0; i<n; i++) c += h[i]>p*b ? (h[i]-p*b+a-1)/a : 0; return c<=p; }   int main() { scanf("%lld%lld%lld", &n, &a, &b); a -= b; for(ll i=0; i<n; i++) scanf("%lld", &h[i]); while(l<=r) { m = (l+r) / 2; if(f(m)) ans = m, r = m-1; else l = m+1; } printf("%lld", ans); return 0; }
a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:12:1: error: extended character   is not valid in an identifier 12 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^ a.cc:12:1: error: '\U000000a0' does not name a type 12 |   | ^
s574362318
p03702
C++
#include <cstdio> using namespace std; typedef long long ll; ll n, a, b, l, r=1e9, m, ans, h[100005];   bool f(ll p) { ll i, c=0; for(i=0; i<n; i++) c += h[i]>p*b ? (h[i]-p*b+a-1)/a : 0; return c<=p; }   int main() { scanf("%lld%lld%lld", &n, &a, &b); a -= b; for(ll i=0; i<n; i++) scanf("%lld", &h[i]); while(l<=r) { m = (l+r) / 2; if(f(m)) ans = m, r = m-1; else l = m+1; } printf("%lld", ans); return 0; }
a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:12:1: error: extended character   is not valid in an identifier 12 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^ a.cc:12:1: error: '\U000000a0' does not name a type 12 |   | ^
s127829797
p03702
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 #define int long long int int N, A, B; int h[100000]; bool isOk(int a) { int cnt = 0; int diff = A - B; rep(i, N) { int leave = h[i] - a * B; if (leave > 0) cnt += (leave + diff - 1) / diff; } return (cnt <= a); } int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> A >> B; rep(i, N) cin >> h[i]; int l = 0, r = 1073741824; int mid = (l + r) / 2; while (l < r) { mid = (l + r ) / 2; if (isOk(mid)) r = mid; else l = mid + 1; } cout << l << endl; return 0; }
a.cc:9:23: error: '::main' must return 'int' 9 | #define int long long int | ^~~ a.cc:25:1: note: in expansion of macro 'int' 25 | int main(void) | ^~~
s479542151
p03702
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <vector> #include <set> #include <cmath> #include <cstdlib> #define FOR(i,a,b) for(int i=a;i<b;i++) #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 #define PI 3.14159265358979323846 using namespace std; // int N,A,B; int H[100000]; bool check(int X){ int cnt=0; FOR(i,0,N){ long long G=H[i]-B*X; if(G<=0){ return true; }else{ cnt+=(G+(A-B)-1)/(A-B); } if(cnt>X){ return false; } } return true; } int main(){ cin>>N>>A>>B; FOR(i,0,N){ cin>>H[i]; } sort(H,H+N,greter<int>()); int lo=1,up=1e9; while(up-lo>1){ int md=(lo+up)/2; if(check(md)){ up=md; }else{ lo=md; } } cout<<up<<endl; return 0; }
a.cc: In function 'int main()': a.cc:49:14: error: 'greter' was not declared in this scope 49 | sort(H,H+N,greter<int>()); | ^~~~~~ a.cc:49:21: error: expected primary-expression before 'int' 49 | sort(H,H+N,greter<int>()); | ^~~
s402579362
p03702
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <vector> #include <set> #include <cmath> #include <cstdlib> #define FOR(i,a,b) for(int i=a;i<b;i++) #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 #define int long long #define PI 3.14159265358979323846 using namespace std; // int N,A,B; vector<long long> H; bool check(int X){ int cnt=0; FOR(i,0,N){ int G=H[i]-B*X; if(G<=0){ return true; }else{ cnt+=(G+(A-B)-1)/(A-B); } if(cnt>X){ return false; } } return true; } int main(){ cin>>N>>A>>B; FOR(i,0,N){ int h; cin>>h; H.PB(h); } sort(H.rbegin(),H.rend()); int lo=0,up=1e9; while(up-lo>1){ int md=(lo+up)/2; if(check(md)){ up=md; }else{ lo=md; } } cout<<up<<endl; return 0; }
cc1plus: error: '::main' must return 'int'
s495778815
p03702
C++
#include<iostream> #include<cstdio> #include<vector> #include<string> #include<functional> #include<queue> #include <iomanip> #include<map> #include<limits> #include<cmath> #include<algorithm> #include<bitset> #include<utility> #include<complex> #include<cstdlib> #include<set> #include<cctype> #define DBG cerr << '!' << endl; #define REP(i,n) for(int (i) = (0);(i) < (n);++i) #define rep(i,s,g) for(int (i) = (s);(i) < (g);++i) #define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i)) #define PB push_back #define MP make_pair #define FI first #define SE second #define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;} #define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;} #define ALL(v) v.begin(),v.end() using namespace std; typedef long long ll; typedef vector<int> iv; typedef vector<iv> iiv; typedef vector<string> sv; ll n,a,b; ll v[100010]; bool check(ll mid) { ll num = 0; REP(i,n) { ll tmp = b*mid; if((v[i] - tmp + a - 1) / a > 0) { num += (v[i] - tmp + a - 1) / a; } } return mid >= num; } int main() { cin >> n>> a>> b; a -= b; REP(i,n) { cin >> v[i]; } ll ub,tb; ub = 0;tb = 10000000000; while(tb - ub > 1) { cout << mid << endl; if(check(mid))tb = mid; else ub = mid; } cout << tb << endl; return 0; }
a.cc: In function 'int main()': a.cc:73:25: error: 'mid' was not declared in this scope 73 | cout << mid << endl; | ^~~
s552936847
p03702
C
n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);}
main.c:1:1: warning: data definition has no type or storage class 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] main.c:1:3: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:7: error: type defaults to 'int' in declaration of 'h' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:17: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:19: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:21: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:23: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:25: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:27: error: return type defaults to 'int' [-Wimplicit-int] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^~~~ main.c: In function 'main': main.c:1:38: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} main.c:1:38: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^~~~~ main.c:1:38: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:180: error: lvalue required as left operand of assignment 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^ main.c:1:186: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | n,a,b,h[100000],i,l,r,x,m;main(){for(scanf("%d%d%d",&n,&a,&b),a-=b;i<n;l=1,r=1e9)scanf("%d",h+i++);while(l<r){m=(l+r)/2;for(x=i=0;i<n;++i)h[i]>m*b?x+=(h[i]-m*b+a-1)/a:0;x<=m?r=m:l=m+1;}printf("%d",l);} | ^~~~~~ main.c:1:186: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:186: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:186: note: include '<stdio.h>' or provide a declaration of 'printf'