submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s993695744
p03644
C++
#include <iostream> using namespace std; int main(){ int N; cin >> N; int max; int A[0] = 0; for (int i = 1; i < N+1; ++i){ int A[i] = 0; if (i % 2 == 0){ while (i % 2 == 0){ i = i/2; ++A[i]; } if (A[i] > A[i-1]) max = i; else break; } else break; } cout << max << endl; }
a.cc: In function 'int main()': a.cc:8:16: error: array must be initialized with a brace-enclosed initializer 8 | int A[0] = 0; | ^ a.cc:10:20: error: array must be initialized with a brace-enclosed initializer 10 | int A[i] = 0; | ^
s213567945
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int kai; int maxN = 0; for(int i=1; i <=N; i++){ int j = i int res = 0; while(true){ bool fl = false ; if( j%2==1){ fl = true ; } else{ j = j/2; res = res + 1; } if(fl) break; } if(maxN < res) kai = i ; } cout << maxN << endl; }
a.cc: In function 'int main()': a.cc:12:8: error: expected ',' or ';' before 'int' 12 | int res = 0; | ^~~ a.cc:20:29: error: 'res' was not declared in this scope 20 | res = res + 1; | ^~~ a.cc:24:18: error: 'res' was not declared in this scope 24 | if(maxN < res) kai = i ; | ^~~
s834442273
p03644
C++
#include <iostream> using namespace std; int main(){ int N; cin >> N; int A[N+10] = {0}; int max; for (int i = 1; i < N+1; ++i){ while (i % 2 == 0){ i = i/2; ++A[i]; } if (A[i] > A[i-1]) max = i; else break; } cout << max << endl;
a.cc: In function 'int main()': a.cc:17:25: error: expected '}' at end of input 17 | cout << max << endl; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s533865911
p03644
C++
#include <iostream> using namespace std; int main(){ int N; cin >> N; int A[N+10] = 0; int max; for (int i = 1; i < N+1; ++i){ while (i % 2 == 0){ i = i/2; ++A[i]; } if (A[i] > A[i-1]) max = i; else break; } cout << max << endl; }
a.cc: In function 'int main()': a.cc:7:19: error: array must be initialized with a brace-enclosed initializer 7 | int A[N+10] = 0; | ^
s494671002
p03644
C++
#include <iostream> using namespace std; int main(){ cin>>N; int i=2; while(i<=N){ i=i*2; } cout<<i<<endl; }
a.cc: In function 'int main()': a.cc:5:8: error: 'N' was not declared in this scope 5 | cin>>N; | ^
s463766647
p03644
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; count=0; while (N%2==0){ count++; break; } cout << N << endl; }
a.cc: In function 'int main()': a.cc:8:9: error: overloaded function with no contextual type information 8 | count=0; | ^ a.cc:10:10: error: no post-increment operator for type 10 | count++; | ^~
s251084301
p03644
C++
N = int(input()) def cal(n): cnt = 0 while n % 2 == 0: n = n//2 cnt += 1 return cnt ans = -1 for i in range(N,0,-1): if ans < cal(i): ans = cal(i) ans_n = i print(ans_n)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s989835683
p03644
C++
#include <bits/stdc++.h> using namespace std; int main(){ int ans[7]={1,2,4,8,16,32,64} int n; cin >> n; for(int i=0;i<7;i++){ if(ans[i]>n){ cout << ans[i-1] << endl; break; } } }
a.cc: In function 'int main()': a.cc:6:3: error: expected ',' or ';' before 'int' 6 | int n; | ^~~ a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'? 7 | cin >> n; | ^ | yn
s545147327
p03644
C++
#include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <vector> // vector #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <utility> // pair, make_pair #include <tuple> // tuple, make_tuple #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <map> // map #include <queue> // queue, priority_queue #include <set> // set #include <stack> // stack #include <deque> // deque #include <unordered_map> // unordered_map #include <unordered_set> // unordered_set #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <math.h> #include <iomanip> //setprecision #include <limits> using namespace std; int main(){ int n; cin >> n; if(n<2) cout << 1 << endl: else if(n<4) cout << 2 << endl; else if(n<8) cout << 4 << endl; else if(n<16) cout << 8 << endl; else if(n<32) cout << 16 << endl; else if(n<64) cout << 32 << endl; else cout << 64 << endl; }
a.cc: In function 'int main()': a.cc:25:30: error: expected ';' before ':' token 25 | if(n<2) cout << 1 << endl: | ^ | ;
s811518899
p03644
C++
#include<bits/stdc++.h> using namespace std; int a[8]={1,2,4,8,16,32,64,128}; int main(){ int n; cin>>n; for(int i=0;i<8;i++){ if(a[i]>n){ i--; break; } } cout<<a[i]<<endl; }
a.cc: In function 'int main()': a.cc:13:17: error: 'i' was not declared in this scope 13 | cout<<a[i]<<endl; | ^
s866031150
p03644
C++
#include<bits/stdc++.h> using namespace std; int a[8]={1,2,4,8,16,32,64,128} int main(){ int n; cin>>n; for(int i=0;i<8;i++){ if(a[i]>n){ i--; break; } } cout<<a[i]<<endl; }
a.cc:4:1: error: expected ',' or ';' before 'int' 4 | int main(){ | ^~~
s283540634
p03644
Java
import java.utli.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n<=2){ System.out.println(2); }else if(2<n&&n<=4){ System.out.println(4); }else if(2<n&&n<=8){ System.out.println(8); }else if(2<n&&n<=16){ System.out.println(16); }else if(2<n&&n<=32){ System.out.println(32); }else{ System.out.println(64); } } }
Main.java:1: error: package java.utli does not exist import java.utli.*; ^ Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 3 errors
s628831334
p03644
C++
#include <string> #include <algorithm> using namespace std; int main() { int n; cin >> n; int cnt = 0; while(true){ if(n == 1) break; n /= 2; cnt++; } cout << (1 << cnt) << endl; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <algorithm> +++ |+#include <iostream> 3 | using namespace std; a.cc:13:9: error: 'cout' was not declared in this scope 13 | cout << (1 << cnt) << endl; | ^~~~ a.cc:13:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:13:31: error: 'endl' was not declared in this scope 13 | cout << (1 << cnt) << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <algorithm> +++ |+#include <ostream> 3 | using namespace std;
s194806627
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int i=0; for (i,i<8,i++){ if (N >= 2^(i)) continue; else { cout << 2^(i-1) <<endl; break; } } }
a.cc: In function 'int main()': a.cc:9:17: error: expected ';' before ')' token 9 | for (i,i<8,i++){ | ^ | ; a.cc:20:1: error: expected primary-expression before '}' token 20 | } | ^ a.cc:18:4: error: expected ';' before '}' token 18 | } | ^ | ; 19 | 20 | } | ~ a.cc:20:1: error: expected primary-expression before '}' token 20 | } | ^ a.cc:18:4: error: expected ')' before '}' token 18 | } | ^ | ) 19 | 20 | } | ~ a.cc:9:7: note: to match this '(' 9 | for (i,i<8,i++){ | ^ a.cc:20:1: error: expected primary-expression before '}' token 20 | } | ^
s383416282
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int i=0; for (i,i<8,i++){ if (N >= 2^(i)) continue; else cout << 2^(i-1) << endl; } }
a.cc: In function 'int main()': a.cc:9:17: error: expected ';' before ')' token 9 | for (i,i<8,i++){ | ^ | ; a.cc:13:1: error: expected primary-expression before '}' token 13 | } | ^ a.cc:12:4: error: expected ';' before '}' token 12 | } | ^ | ; 13 | } | ~ a.cc:13:1: error: expected primary-expression before '}' token 13 | } | ^ a.cc:12:4: error: expected ')' before '}' token 12 | } | ^ | ) 13 | } | ~ a.cc:9:7: note: to match this '(' 9 | for (i,i<8,i++){ | ^ a.cc:13:1: error: expected primary-expression before '}' token 13 | } | ^
s661650346
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int i=0 for (i,i<8,i++){ if (N >= 2^(i)) continue; else cout << 2^(i-1) << endl; } }
a.cc: In function 'int main()': a.cc:9:3: error: expected ',' or ';' before 'for' 9 | for (i,i<8,i++){ | ^~~
s785371357
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; for (int i=0,i<8,i++){ if (N >= 2^(i)) continue; else cout << 2^(i-1) << endl; } }
a.cc: In function 'int main()': a.cc:8:17: error: expected ';' before '<' token 8 | for (int i=0,i<8,i++){ | ^ | ; a.cc:8:17: error: expected primary-expression before '<' token a.cc:8:23: error: expected ';' before ')' token 8 | for (int i=0,i<8,i++){ | ^ | ; a.cc:10:26: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 10 | else cout << 2^(i-1) << endl; | ~~~~~~^~~~~~~
s773149734
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N = 1) { out = 1; } if (1 < N < 4) { out = 2; } if (4 =< N < 8) { out = 4; } if (8 =< N < 16) { out = 8; } if (16 =< N < 32) { out = 16; } if (32 =< N < 64) { out = 32; } if (64 =< N) { out = 64; } cout << out << endl; }
a.cc: In function 'int main()': a.cc:12:5: error: 'out' was not declared in this scope 12 | out = 1; | ^~~ a.cc:17:5: error: 'out' was not declared in this scope 17 | out = 2; | ^~~ a.cc:20:8: error: expected primary-expression before '<' token 20 | if (4 =< N < 8) | ^ a.cc:22:5: error: 'out' was not declared in this scope 22 | out = 4; | ^~~ a.cc:25:8: error: expected primary-expression before '<' token 25 | if (8 =< N < 16) | ^ a.cc:27:5: error: 'out' was not declared in this scope 27 | out = 8; | ^~~ a.cc:30:9: error: expected primary-expression before '<' token 30 | if (16 =< N < 32) | ^ a.cc:32:5: error: 'out' was not declared in this scope 32 | out = 16; | ^~~ a.cc:35:9: error: expected primary-expression before '<' token 35 | if (32 =< N < 64) | ^ a.cc:37:5: error: 'out' was not declared in this scope 37 | out = 32; | ^~~ a.cc:40:9: error: expected primary-expression before '<' token 40 | if (64 =< N) | ^ a.cc:42:5: error: 'out' was not declared in this scope 42 | out = 64; | ^~~ a.cc:45:9: error: 'out' was not declared in this scope 45 | cout << out << endl; | ^~~
s248821522
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int a[7]={1,2,4,8,16,32,64} int n; cin>>n; int i; for(i=0;i<7;++i) { if(a[i]>n) break; } printf("%d",a[i-1]); }
a.cc: In function 'int main()': a.cc:8:4: error: expected ',' or ';' before 'int' 8 | int n; | ^~~ a.cc:9:8: error: 'n' was not declared in this scope 9 | cin>>n; | ^
s934798720
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int a[7]={1,2,4,8,16,32,64} int n; cin>>n; int i; for(i=0;i<8;++i) { if(a[i]>n) break; } printf("%d",a[i-1]); }
a.cc: In function 'int main()': a.cc:8:4: error: expected ',' or ';' before 'int' 8 | int n; | ^~~ a.cc:9:8: error: 'n' was not declared in this scope 9 | cin>>n; | ^
s369893516
p03644
C++
#include<iostream> using namespace std; int main(){ int n; cin>>n; if(n==1){ cout<<"1"; retutn 0; } if(n==2){ cout<<"2"; return 0; } if(n<=7 && n>2) { cout<<"4"; return 0; } if(n<=15) { cout<<"8"; return 0; } if(n<=31) { cout<<"16"; return 0; } if(n<=63) { cout<<"32"; return 0; } if(n<=100) { cout<<"64"; return 0; } return 0; }
a.cc: In function 'int main()': a.cc:9:6: error: 'retutn' was not declared in this scope 9 | retutn 0; | ^~~~~~
s724500572
p03644
C++
#include<iostream> using namespace std; int main(){ cin>>n; if(n<=7) { cout<<"4"; return 0; } if(n<=15) { cout<<"8"; return 0; } if(n<=31) { cout<<"16"; return 0; } if(n<=63) { cout<<"32"; return 0; } if(n<=100) { cout<<"64"; return 0; } return 0; }
a.cc: In function 'int main()': a.cc:5:11: error: 'n' was not declared in this scope 5 | cin>>n; | ^
s002985190
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >>N; if(N==1){ cout <<1<<endl; } else if(N<4){ cout <<2<<endl; } else if(N<8){ cout <<4<<endl; }else if(N<16){ cout <<2<<endl; }else if(N<32){ cout <<16<<endl; }else if(N<64){ cout <<32<<endl; } else if(N>=64){ cout <<64<endl; } }
a.cc: In function 'int main()': a.cc:25:10: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 25 | cout <<64<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:25:11: note: couldn't deduce template parameter '_Bi_iter' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:25:11: note: couldn't deduce template parameter '_Bi_iter' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 25 | cout <<64<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 25 | cout <<64<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout <<64<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:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout <<64<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:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout <<64<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:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout <<64<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:25:11: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 25 | cout <<64<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:25:11: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 25 | cout <<64<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:25:11: note: couldn't deduce template parameter '_CharT' 25 | cout <<64<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:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 25 | cout <<64<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:25:11: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 25 | cout <<64<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:
s842675513
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >>N; if(N==1){ cout <<1<<endl; } else(N<4){ cout <<2<<endl; } else(N<8){ cout <<4<<endl; }else(N<16){ cout <<2<<endl; }else(N<32){ cout <<16<<endl; }else(N<64){ cout <<32<<endl; } else(N>=64){ cout <<264<endl; } }
a.cc: In function 'int main()': a.cc:12:10: error: expected ';' before '{' token 12 | else(N<4){ | ^ | ; a.cc:15:1: error: 'else' without a previous 'if' 15 | else(N<8){ | ^~~~ a.cc:15:10: error: expected ';' before '{' token 15 | else(N<8){ | ^ | ; a.cc:17:2: error: 'else' without a previous 'if' 17 | }else(N<16){ | ^~~~ a.cc:17:12: error: expected ';' before '{' token 17 | }else(N<16){ | ^ | ; a.cc:19:2: error: 'else' without a previous 'if' 19 | }else(N<32){ | ^~~~ a.cc:19:12: error: expected ';' before '{' token 19 | }else(N<32){ | ^ | ; a.cc:21:2: error: 'else' without a previous 'if' 21 | }else(N<64){ | ^~~~ a.cc:21:12: error: expected ';' before '{' token 21 | }else(N<64){ | ^ | ; a.cc:24:1: error: 'else' without a previous 'if' 24 | else(N>=64){ | ^~~~ a.cc:24:12: error: expected ';' before '{' token 24 | else(N>=64){ | ^ | ;
s959054758
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >>N; if(N==1) cout <<1<<endl; } else(N<4) cout <<2<<endl; } else(N<8) cout <<4<<endl; }else(N<16) cout <<2<<endl; }else(N<32) cout <<16<<endl; }else(N<64) cout <<32<<endl; } else(N>=64) cout <<264<endl; } }
a.cc:12:1: error: expected unqualified-id before 'else' 12 | else(N<4) | ^~~~ a.cc:14:1: error: expected declaration before '}' token 14 | } | ^ a.cc:15:1: error: expected unqualified-id before 'else' 15 | else(N<8) | ^~~~ a.cc:17:1: error: expected declaration before '}' token 17 | }else(N<16) | ^ a.cc:17:2: error: expected unqualified-id before 'else' 17 | }else(N<16) | ^~~~ a.cc:19:1: error: expected declaration before '}' token 19 | }else(N<32) | ^ a.cc:19:2: error: expected unqualified-id before 'else' 19 | }else(N<32) | ^~~~ a.cc:21:1: error: expected declaration before '}' token 21 | }else(N<64) | ^ a.cc:21:2: error: expected unqualified-id before 'else' 21 | }else(N<64) | ^~~~ a.cc:23:1: error: expected declaration before '}' token 23 | } | ^ a.cc:24:1: error: expected unqualified-id before 'else' 24 | else(N>=64) | ^~~~ a.cc:26:1: error: expected declaration before '}' token 26 | } | ^ a.cc:27:1: error: expected declaration before '}' token 27 | } | ^
s269915211
p03644
C++
#include <iostream> #include<string.h> #include<algorithm> using namespace std; int main() { int N; cin >> N; int a[110]; for (int i = 0; i < N; ++i) a[i]=i+1; int c = 0; int c_MAX = -1; int a_MAX=-1; for (int i = 0; i < N; ++i) { while (true) { if (a[i] % 2 != 0)break; else a[i] = a[i] / 2; c = c + 1; } if (c > c_MAX) { c_MAX = c; } c = 0; } cout << pow(2,c_MAX) << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:17: error: 'pow' was not declared in this scope 29 | cout << pow(2,c_MAX) << endl; | ^~~
s833516156
p03644
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; int result = 1; int max_count = 0; for (int i = 1; i <= n; i++){ int count = 0; while (true){ if (i % 2 != 0) break; i /= 2; ++count; } if (count > max_count){ max_division = count; result = i; } } cout << result << endl; }
a.cc: In function 'int main()': a.cc:18:7: error: 'max_division' was not declared in this scope 18 | max_division = count; | ^~~~~~~~~~~~
s946626476
p03644
C++
#include <iostream> #include<algorithm> #include<sstream> #include<cmath> #include<vector> #include<iomanip> #include<map> #include<set> #include<queue> using namespace std; typedef long long ll; #define rep(i,n) for(int i = 0; i < n;i++) vector<bool> b(1000001,false); int main(void) { int n, m; cin >> n; if (n == 1) cout << 1 << endl; else if (n < 4) cout << 2 << endl; else if (n < 8) cout << 4 << endl; else if (n < 16) cout << 8 << endl; else if (n < 32) cout << 16 << endl; else if (n < 64) cout << 32 << endl; else cout << 64 << endl; }
a.cc: In function 'int main()': a.cc:16:29: error: '\U0000ff11' was not declared in this scope 16 | if (n == 1) cout << 1 << endl; | ^~
s552569239
p03644
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) using ll = long long; int main() { int n; cin >> n; int i = 0; int ans = 0; while(1) { int x = pow(2,i); if (x > n) break ans = x; i++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:21: error: expected ';' before 'ans' 12 | if (x > n) break | ^ | ; 13 | ans = x; | ~~~
s336519477
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int ans = 0; int List[9] = {-1,1,2,4,8,16,32,64,128}; for (int i = 8; i >= 1 i--) { if (List[i] > N && N >= List[i - 1]) { ans = List[i - 1]; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:25: error: expected ';' before 'i' 8 | for (int i = 8; i >= 1 i--) { | ^~ | ;
s006230604
p03644
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> using namespace std; typedef long long llint; #define inf 1e18 llint n,m; void solve(){ cin >> n; int ans = 0; for(; n; n/=2) ans++; cout << (1<<(ans-1)) << endl; return 0; } int main(int argc, char *argv[]) { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:18:16: error: return-statement with a value, in function returning 'void' [-fpermissive] 18 | return 0; | ^
s773344564
p03644
C++
#include<iostream> using namespace std; int main(){ int N; int i; cin>>N; int a[N]; for(i=0;i<=N;i++){ int count=0; while(i%2){ i/=2; count++; } a[i]=count; } cout<<sort(a);
a.cc: In function 'int main()': a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | cout<<sort(a); | ^~~~ | short a.cc:16:17: error: expected '}' at end of input 16 | cout<<sort(a); | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s921223492
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); int i,max=0,cnt=0; for(i=1;i<=n;++i) { cnt=0; while(i%2==0 && i>0) { i/=2; cnt+++; } if(max<cnt) max=cnt; } printf("%d",max); }
a.cc: In function 'int main()': a.cc:16:15: error: expected primary-expression before ';' token 16 | cnt+++; | ^
s469621813
p03644
C++
#include <bits/stdc++.h> using namespace std; int main( { int n; scanf("%d",&n); int i,max=0,cnt=0; for(i=1;i<=n;++i) { cnt=0; while(i%2==0 && i>0) { i/=2; cnt+++; } if(max<cnt) max=cnt; } printf("%d",max); }
a.cc:5:5: error: cannot declare '::main' to be a global variable 5 | int main( | ^~~~ a.cc:7:5: error: expected primary-expression before 'int' 7 | int n; | ^~~ a.cc:7:5: error: expected '}' before 'int' a.cc:6:3: note: to match this '{' 6 | { | ^ a.cc:6:4: error: expected ')' before 'int' 6 | { | ^ | ) 7 | int n; | ~~~ a.cc:5:9: note: to match this '(' 5 | int main( | ^ a.cc:8:10: error: expected constructor, destructor, or type conversion before '(' token 8 | scanf("%d",&n); | ^ a.cc:10:5: error: expected unqualified-id before 'for' 10 | for(i=1;i<=n;++i) | ^~~ a.cc:10:13: error: 'i' does not name a type 10 | for(i=1;i<=n;++i) | ^ a.cc:10:18: error: expected unqualified-id before '++' token 10 | for(i=1;i<=n;++i) | ^~ a.cc:21:11: error: expected constructor, destructor, or type conversion before '(' token 21 | printf("%d",max); | ^ a.cc:22:3: error: expected declaration before '}' token 22 | } | ^
s238349889
p03644
C++
#include <stdio.h> int main(void) { int n,max=0,cnt=0; scanf("%d",&n); for(i=1;i<=n;++i) { cnt=0; while(i%2==0) { i/=2; cnt++; } if(max<cnt) max=cnt; } printf("%d",max); return 0; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=1;i<=n;++i) | ^
s541388903
p03644
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int max_count = -1; int n; for(int i=1;i<=N;i=i+1){ int count = 0; int x = i; while(x%2 = 0){ x = x/2; count = count + 1; } if(max_count < count){ max_count = count; n = i; } } cout << n << endl; }
a.cc: In function 'int main()': a.cc:12:12: error: lvalue required as left operand of assignment 12 | while(x%2 = 0){ | ~^~
s855737436
p03644
C++
#include<iostream> using namespace std; int main(){ long long a[8]={0,1,2,4,8,16,32,64}; long long n; cin>>n; for(int i=7;i;i--){ if(a[i]<=n){ cout<<a[i]<<endl; return 0; } }
a.cc: In function 'int main()': a.cc:12:6: error: expected '}' at end of input 12 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s464719628
p03644
C++
#include<iostream> using namespace std; int main() { int N, max, count, num; cin >> N; max = 0; count = 0; while (true){ if(N == 0){ break; } if(N % 2 != 0){ N--; continue; } while(N % 2 == 0){ N /= 2; count++; } if(count > max){ max = count; } } for(int i = 0; i > max; i++) { num *= 2 } cout << num << endl; }
a.cc: In function 'int main()': a.cc:29:13: error: expected ';' before '}' token 29 | num *= 2 | ^ | ; 30 | } | ~
s192199529
p03644
C++
#include<iostream> using namespace std; int main() { int N, max, count; cin >> N; max = 0; count = 0; while (true){ if(N % 2 != 0){ N--; continue; } while(N % 2 == 0){ N / 2; count++; } if(count > max){ max = count; } if(N == 0){ break; } cout << max <<endl; }
a.cc: In function 'int main()': a.cc:25:4: error: expected '}' at end of input 25 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s866194605
p03644
C++
#include<iostream> using namespace std; int main() { int N, count; cin >> N; count = 0; while (true){ bool check = false; if (N % 2 != 0) {check = true;} if (check == ture){break;} N /= 2; count++; } cout << count << endl; }
a.cc: In function 'int main()': a.cc:11:18: error: 'ture' was not declared in this scope 11 | if (check == ture){break;} | ^~~~
s714966464
p03644
C++
#include<iostream> using namespace std; int main() { int N, count; cin >> N; count = 0; while (true){ bool check = false; if (N % 2 != 0) check = true; if check == ture break; N /= 2; count++; } cout << count << endl; }
a.cc: In function 'int main()': a.cc:11:8: error: expected '(' before 'check' 11 | if check == ture break; | ^~~~~ | (
s731438725
p03644
C++
#include<iostream> using namespace std; int main() { int N, count; cin >> N; count = 0; while (true){ bool check = false; if (N % 2 != 0) check = true; if check == ture break; N /= 2; count++ } cout << count << endl; }
a.cc: In function 'int main()': a.cc:11:8: error: expected '(' before 'check' 11 | if check == ture break; | ^~~~~ | ( a.cc:13:12: error: expected ';' before '}' token 13 | count++ | ^ | ; 14 | } | ~
s390555994
p03644
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; if(a==2||a==4||a==16||a==32||a==64)cout<<a<<endl; if(a>2&&a<4)cout<<"2"<<endl; if(a>4&&a<16)cout<<"4"<<endl; if(a>16&&a<32)cout<<"16"<<endl; if(a>32&&a<64)cout<<"32"<<endl; if(a>64&&a<=100)cout<<"64"<<endl; if(a<2)cout<<"1"<<endl; return 0;
a.cc: In function 'int main()': a.cc:14:18: error: expected '}' at end of input 14 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s562232754
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, ret = 0; cin >> n; while (1) { if (n%2 == 0) { ret++; n =/ 2; } else { break; } } cout << ret << endl; }
a.cc: In function 'int main()': a.cc:10:16: error: expected primary-expression before '/' token 10 | n =/ 2; | ^
s147605640
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int count = 0; while ((N / 2) != 0) { count++; } cout << 2**count << endl; }
a.cc: In function 'int main()': a.cc:11:13: error: invalid type argument of unary '*' (have 'int') 11 | cout << 2**count << endl; | ^~~~~~
s404920112
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int n cin >> n; int t=1; while(t<=n){ t*=2; } cout << max(t/2,1) << endl; }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'cin' 6 | cin >> n; | ^~~ a.cc:8:14: error: 'n' was not declared in this scope 8 | while(t<=n){ | ^
s053004706
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int n cin >> n; int t=1 while(t<=n){ t*=2; } cout << max(t/2,1) << endl; }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'cin' 6 | cin >> n; | ^~~ a.cc:8:5: error: expected ',' or ';' before 'while' 8 | while(t<=n){ | ^~~~~
s597281133
p03644
C++
#include <iostream> using namespace std; int n; int main(){ cin >> n; for(int i = 0 ; i < 8; i++){ if(n < (1<<(i+1))){ cout << (1<<i) << endl; break ; }  } return 0; }
a.cc:13:1: error: extended character   is not valid in an identifier 13 |  } | ^ a.cc: In function 'int main()': a.cc:13:1: error: '\U00003000' was not declared in this scope 13 |  } | ^~
s805597762
p03644
C++
#include <iostream> using namespace std; int n; int count=0; int main(){ cin >> n; for(int i = 0 ; i < 8; i++) { if(n < (1<<(i+1))) { cout << (1<<i) << endl; break ; }  } return 0; }
a.cc:14:1: error: extended character   is not valid in an identifier 14 |  } | ^ a.cc: In function 'int main()': a.cc:14:1: error: '\U00003000' was not declared in this scope 14 |  } | ^~
s881386164
p03644
C++
#include <iostream> using namespace std; int N; int count=0; int main(){ cin >> N; for(int i = 0 ; i < 8; i++) { if(n < (1<<(i+1))) { cout << (1<<i) << endl; break ; }  } return 0; }
a.cc:14:1: error: extended character   is not valid in an identifier 14 |  } | ^ a.cc: In function 'int main()': a.cc:10:8: error: 'n' was not declared in this scope 10 | if(n < (1<<(i+1))) { | ^ a.cc:14:1: error: '\U00003000' was not declared in this scope 14 |  } | ^~
s011149469
p03644
C++
#include <iostream> using namespace std; int N; int count=0; int main(){ cin >> N; while(true){ for(int i=0;i<N;++i){ if(pow(2, i) < N) ++count; else break; } } int max = pow(2, count); cout << max << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:10: error: 'pow' was not declared in this scope 11 | if(pow(2, i) < N) ++count; | ^~~ a.cc:15:13: error: 'pow' was not declared in this scope 15 | int max = pow(2, count); | ^~~
s304054097
p03644
C++
#include <iostream> using namespace std; int main() { int N; cin >> N; // 操作が行える限り操作を繰り返す for (i = 0; i < N ; i++) { if (N % 2 == 0) { N /= 2; } else break; } cout << N << endl; }
a.cc: In function 'int main()': a.cc:9:10: error: 'i' was not declared in this scope 9 | for (i = 0; i < N ; i++) { | ^
s218061615
p03644
C++
#include <iostream> using namespace std; int N; int count=0; int main(){ cin >> N; while(true){ for(int i=0;i<N;++i){ if(pow(2, i) < N) ++count; else break; } } cout << pow(2, count) << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:10: error: 'pow' was not declared in this scope 11 | if(pow(2, i) < N) ++count; | ^~~ a.cc:15:11: error: 'pow' was not declared in this scope 15 | cout << pow(2, count) << endl; | ^~~
s459407957
p03644
C++
#include <iostream> using namespace std; int N; int A[110]; // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです int main() { cin >> N; for (int i = 0; i < N; ++i) cin >> A[i]; // 操作が行える限り操作を繰り返す while (true) { bool exist_odd = false; // A[i] がすべて偶数かどうかを判定するフラグ for (int i = 0; i < N; ++i) { if (A[i] % 2 != 0) exist_odd = true; // 奇数があったらフラグを立てる } if (exist_odd) break; // 奇数があったら break // 操作を行えるなら操作を実際に行う for (int i = 0; i < N; ++i) { A[i] /= 2; } cout << A[i] << endl; } }
a.cc: In function 'int main()': a.cc:24:21: error: 'i' was not declared in this scope 24 | cout << A[i] << endl; | ^
s867342982
p03644
C++
#include <iostream> using namespace std; int N; int A[110]; // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです int main() { cin >> N; for (int i = 0; i < N; ++i) cin >> A[i]; // 操作が行える限り操作を繰り返す while (true) { bool exist_odd = false; // A[i] がすべて偶数かどうかを判定するフラグ for (int i = 0; i < N; ++i) { if (A[i] % 2 != 0) exist_odd = true; // 奇数があったらフラグを立てる } if (exist_odd) break; // 奇数があったら break // 操作を行えるなら操作を実際に行う for (int i = 0; i < N; ++i) { A[i] /= 2; } } cout << A[i] << endl; }
a.cc: In function 'int main()': a.cc:26:15: error: 'i' was not declared in this scope 26 | cout << A[i] << endl; | ^
s670820517
p03644
C++
#include <iostream> using namespace std; int N; int A[110]; // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです int main() { cin >> N; for (int i = 0; i < N; ++i) cin >> A[i]; // 操作が行える限り操作を繰り返す while (true) { bool exist_odd = false; // A[i] がすべて偶数かどうかを判定するフラグ for (int i = 0; i < N; ++i) { if (A[i] % 2 != 0) exist_odd = true; // 奇数があったらフラグを立てる } if (exist_odd) break; // 奇数があったら break // 操作を行えるなら操作を実際に行う for (int i = 0; i < N; ++i) { A[i] /= 2; } } cout << i << endl; }
a.cc: In function 'int main()': a.cc:27:13: error: 'i' was not declared in this scope 27 | cout << i << endl; | ^
s970036466
p03644
C++
#include <bits/stdc++.h> using namespace std; #define lli long long int #define LLI(n) \ lli n; \ cin >> n; #define LLIV(a, n) \ vector<lli> a(n); \ for (lli i = 0; i < n; i++) \ { \ cin >> a.at(i); \ }; #define STR(n) \ string n; \ cin >> n; #define Sort(n) sort(n.begin(), n.end()); #define Reve(n) reverse(n.begin(), n.end()); #define yes cout << "Yes" << endl; #define no cout << "No" << endl; #define C45(n) (n + 1) / 2 #define OUT(n) cout << n << endl; #define SRC(n, c) \ for (lli i = 0; i < s.size(); i++) \ { \ if (s.at(i) == c) \ { \ n++; \ } \ }; //こぴー /*#define ZISYO(s, S) \ for (lli i = 0; i < s.size(); i++) \ { \ S.at(i) = s.at(i); \ } \ Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); }; */ //素数 bool IsPrime(lli num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; long double sqrtNum = sqrt(num); for (lli i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) return false; } return true; } //各桁の和 lli Sum(lli n) { lli sum = 0; if (n < 0) return 0; while (n > 0) { sum += n % 10; n /= 10; } return sum; } int main(void) { ios::sync_with_stdio(false); LLI(n) if(n >= 64) { OUT(64) } else if(n => 32) { OUT(32) } else if(n >= 16) { OUT(16) } else if(n >= 8) { OUT(8) } else if(n >= 4) { OUT(4) } else if(n >= 2) { OUT(2) } else { OUT(1) } }
a.cc: In function 'int main()': a.cc:79:14: error: expected primary-expression before '>' token 79 | else if(n => 32) { | ^
s500662994
p03644
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; if(N >= 64){ cout << 64 << endl: } if(N >= 32 && N < 64){ cout << 32 << endl; } if(N >= 16 && N < 32){ cout << 16 << endl; } if(N >= 8 && N < 16){ cout << 8 << endl; } if(N >= 4 && N < 8){ cout << 4 << endl; } if(N == 2 || N == 3){ cout << 2 << endl; } if(N == 1){ cout << 1 << endl; } }
a.cc: In function 'int main()': a.cc:8:23: error: expected ';' before ':' token 8 | cout << 64 << endl: | ^ | ;
s869240530
p03644
C++
#include<iostream> int arr[7]={1,2,4,8,16,32,64,128}; int main() { int n; std::cin>>n; for(int i=0;i<7;i++) { if(arr[i]>=n) { std::cout<<arr[n-1];break; } }return 0; }
a.cc:2:33: error: too many initializers for 'int [7]' 2 | int arr[7]={1,2,4,8,16,32,64,128}; | ^
s599607993
p03644
C++
#include<iostream> int arr[7]={1,2,4,8,16,32,64,128}; int main() { int n; std::cin>>n; for(int i=0;i<7;i++) { if(arr[i]>=n) { std::cout<<arr[n-1];break; } }return 0; }
a.cc:2:33: error: too many initializers for 'int [7]' 2 | int arr[7]={1,2,4,8,16,32,64,128}; | ^
s334401753
p03644
C++
#include <iostream> #include <cmath> using namespace std; int N; int main() { cin >> N; int beki = log2(N); cout << int pow(2, beki) << endl; }
a.cc: In function 'int main()': a.cc:10:13: error: expected primary-expression before 'int' 10 | cout << int pow(2, beki) << endl; | ^~~
s760642720
p03644
C++
#include <iostream> using namespace std; int N; int A[210]; int main() { cin >> N; int beki = log2(N); cout << pow(2, beki) << endl; }
a.cc: In function 'int main()': a.cc:9:16: error: 'log2' was not declared in this scope 9 | int beki = log2(N); | ^~~~ a.cc:10:13: error: 'pow' was not declared in this scope 10 | cout << pow(2, beki) << endl; | ^~~
s964525214
p03644
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int ans=0; for(int i=1;i<n;i++){ int t=0; int j=i while(j%2==0){ j=j/2; t++; } ans=max(ans,t); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: expected ',' or ';' before 'while' 10 | while(j%2==0){ | ^~~~~
s108037593
p03644
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int ans=0; for(int i=1;i<n;i++){ int t=0; int j=i while(j%2==0||j=0){ j=j/2; t++; } ans=max(ans,t); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: expected ',' or ';' before 'while' 10 | while(j%2==0||j=0){ | ^~~~~
s218417623
p03644
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int ans=0; for(int i=1;i<n;i++){ int t=0; int j=i while(j%2==0){ j=j/2; t++; } ans=max(ans,t); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: expected ',' or ';' before 'while' 10 | while(j%2==0){ | ^~~~~
s222831997
p03644
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define co(a) cout<<a<<endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp() pop_back() #define V vector #define P pair #define V2(a,b,c) V<V<int>> a(b,V<int>(c)) #define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d)) #define incin(a) int a; cin>>a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) //#define min min<int> //#define max max<int> template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; }*/ bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } struct Union{ vector<int> par; Union(int a){ par= vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); } int lcm(int a,int b){ return a/gcm(a,b)*b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ */ signed main(){ int n; cin>>n; int a=0; if(n==1) cout<<1<<endl; else{ while(n){ n/=2; a++; } cout<<pow(2,a)<<endl; }
a.cc: In function 'int main()': a.cc:201:2: error: expected '}' at end of input 201 | } | ^ a.cc:188:14: note: to match this '{' 188 | signed main(){ | ^
s870451276
p03644
C
#include<bits/stdc++.h> using namespace std; int main () { int n; cin>>n; double ans=0; for (int i=0;i<n;i++){ ans = pow(2,i); if(ans>n){ ans = ans/2; break; } } cout<<ans<<endl; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s764620945
p03644
C++
#include <bits/stdc++.h> using namespace std; long long a[1005]={1},b[1000]={1,2}; int main(){ int n; cin >> n; if (n==1) { cout << 1 << endl; return ; } for (int i=2;i<=100;i++) { b[i]=b[i-1]*2; } for (int i=1;i<=100;i++) if (b[i]<=n&&b[i+1]>n) { cout << b[i] << endl; return 0; } }
a.cc: In function 'int main()': a.cc:10:1: error: return-statement with no value, in function returning 'int' [-fpermissive] 10 | return ; | ^~~~~~
s679317664
p03644
C++
#include <iostream> using namespace std; int main() { int N; int answer; cin >> N; if ( N == 1 ) { answer=1 } else if ( 2 <= N && N < 4 ) { answer=2 } else if ( 4 <= N && N < 8 ) { answer=4 } else if ( 8 <= N && N < 16 ) { answer=8 } else if (16 <= N && N < 32 ) { answer=16} else if (32 <= N && N < 64 ) { answer=32} else if (64 <= N ) { answer=64 } cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:44: error: expected ';' before '}' token 11 | if ( N == 1 ) { answer=1 } | ^~ | ; a.cc:12:44: error: expected ';' before '}' token 12 | else if ( 2 <= N && N < 4 ) { answer=2 } | ^~ | ; a.cc:13:44: error: expected ';' before '}' token 13 | else if ( 4 <= N && N < 8 ) { answer=4 } | ^~ | ; a.cc:14:44: error: expected ';' before '}' token 14 | else if ( 8 <= N && N < 16 ) { answer=8 } | ^~ | ; a.cc:15:45: error: expected ';' before '}' token 15 | else if (16 <= N && N < 32 ) { answer=16} | ^ | ; a.cc:16:49: error: expected ';' before '}' token 16 | else if (32 <= N && N < 64 ) { answer=32} | ^ | ; a.cc:17:39: error: expected ';' before '}' token 17 | else if (64 <= N ) { answer=64 } | ^~ | ;
s987626815
p03644
C++
#include <iostream> using namespace std; int main() { int N; int temp; int tempCounter; int answerCounter; cin >> N;  // 1,2,4,8,16,32,64 // 0,1,2,3, 4, 5, 6 if ( N == 1 ) { answerCounter=0; } else if ( 2 <= N && N < 4 ) { answerCounter=1; } else if ( 4 <= N && N < 8 ) { answerCounter=2; } else if ( 8 <= N && N < 16 ) { answerCounter=3; } else if (16 <= N && N < 32 ) { answerCounter=4; } else if (32 <= N && N < 64 ) { answerCounter=5; } else if (64 <= N ) { answerCounter=6; } cout << answerCounter << endl; return 0; }
a.cc:13:3: error: extended character   is not valid in an identifier 13 |  // 1,2,4,8,16,32,64 | ^ a.cc: In function 'int main()': a.cc:13:3: error: '\U00003000' was not declared in this scope 13 |  // 1,2,4,8,16,32,64 | ^~ a.cc:17:5: error: 'else' without a previous 'if' 17 | else if ( 2 <= N && N < 4 ) { answerCounter=1; } | ^~~~
s059773246
p03644
C++
int N; int temp; int tempCounter; int answerCounter=0; cin >> N; for (int i = 0; i < N; i++) { temp = i + 1; tempCounter = 0; while(true){ if (temp % 2 != 0 ) break; else { temp = temp * 0.5; tempCounter++; } } if (answerCounter <= tempCounter ) { answerCounter = tempCounter; } } cout << answerCounter << endl; return 0;
a.cc:7:9: error: 'cin' does not name a type 7 | cin >> N; | ^~~ a.cc:9:9: error: expected unqualified-id before 'for' 9 | for (int i = 0; i < N; i++) { | ^~~ a.cc:9:25: error: 'i' does not name a type 9 | for (int i = 0; i < N; i++) { | ^ a.cc:9:32: error: 'i' does not name a type 9 | for (int i = 0; i < N; i++) { | ^ a.cc:27:9: error: 'cout' does not name a type 27 | cout << answerCounter << endl; | ^~~~ a.cc:28:9: error: expected unqualified-id before 'return' 28 | return 0; | ^~~~~~
s864600240
p03644
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> using namespace std; int main(){ int N; cin >> N; for(int k=0; k<7; k++){ if(2^k <= N < 2^(k+1) ){ int ans = 2^k; } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:14:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs
s832904780
p03644
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> using namespace std; int main(){ int N; cin >> N; for(int k=0; k<7; k++){ if(2^k <= N < 2^(k+1) ) cout << int 2^k << endl; } }
a.cc: In function 'int main()': a.cc:11:49: error: expected primary-expression before 'int' 11 | if(2^k <= N < 2^(k+1) ) cout << int 2^k << endl; | ^~~
s331361928
p03644
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> using namespace std; int main(){ int N; cin >> N; for(int k=0; k<7; k++){ if(2^k <= N < 2^(k+1) ) cout << pow(2, int k) << endl; } }
a.cc: In function 'int main()': a.cc:11:56: error: expected primary-expression before 'int' 11 | if(2^k <= N < 2^(k+1) ) cout << pow(2, int k) << endl; | ^~~
s710476532
p03644
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int main(){ int N; cin >> N; for(int k=0; k<7; k++){ if(2^k <= N < 2^(k+1) ) cout << 2**k << endl; } }
a.cc: In function 'int main()': a.cc:10:51: error: invalid type argument of unary '*' (have 'int') 10 | if(2^k <= N < 2^(k+1) ) cout << 2**k << endl; | ^~
s093985024
p03644
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int main(){ int N; cin >> N; for(int k=0; k<7; k++){ if(2^k <= N < 2^(k+1) ) cout << 2^k << endl; } }
a.cc: In function 'int main()': a.cc:10:53: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 10 | if(2^k <= N < 2^(k+1) ) cout << 2^k << endl; | ~~^~~~~~~
s236370330
p03644
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int main(){ int N; cin >> N; for(int k=0; k<7; k++){ if(2**k <= N < 2**(k+1) ) cout << k << endl; } }
a.cc: In function 'int main()': a.cc:10:22: error: invalid type argument of unary '*' (have 'int') 10 | if(2**k <= N < 2**(k+1) ) cout << k << endl; | ^~ a.cc:10:34: error: invalid type argument of unary '*' (have 'int') 10 | if(2**k <= N < 2**(k+1) ) cout << k << endl; | ^~~~~~
s566573376
p03644
C++
#include<bits/stdc++.h> using namespace std; //size_t f = string::npos //make pair int main(){ int n;cin >> n; int ans = 1; while(ans <= n){ ans = ans << 1; } cout << ans >> 1; }
a.cc: In function 'int main()': a.cc:12:19: error: no match for 'operator>>' (operand types are 'std::basic_ostream<char>' and 'int') 12 | cout << ans >> 1; | ~~~~~~~~~~~ ^~ ~ | | | | | int | std::basic_ostream<char> a.cc:12:19: note: candidate: 'operator>>(int, int)' (built-in) 12 | cout << ans >> 1; | ~~~~~~~~~~~~^~~~ a.cc:12:19: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:12:12: note: cannot convert 'std::cout.std::basic_ostream<char>::operator<<(ans)' (type 'std::basic_ostream<char>') to type 'std::byte' 12 | cout << ans >> 1; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)' 1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) | ^~~~~~~~ /usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<char, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]': a.cc:12:22: required from here 12 | cout << ans >> 1; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)' 177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; | ^ /usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setprecision)' 207 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:207:5: note: template argument deduction/substitution failed: a.cc:12:22: note: 'std::basic_ostream<char>' is not derived from 'std::basic_istream<_CharT, _Traits>' 12 | cout << ans >> 1; |
s241029765
p03644
C++
fn main() { let n: u32 = read(); let mut p = 1; while p <= n { p *= 2; } println!("{}", p/2); } // 以下関数 use std::io::*; use std::str::FromStr; pub fn read<T: FromStr>() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } pub const MOD: u64 = 1_000_000_007; pub fn is_prime(n: i32) -> bool { if n < 2 { return false; } else if n == 2 { return true; } let mut i = 2; while i * i < n { if n % i == 0 { return false; } else { i += 1; continue; } } true } pub fn lcm(mut n: i32, mut m: i32) -> i32 { n = if n > m { m } else { n }; m = if n > m { n } else { m }; let mut i = n; while i % m != 0 { i += n; } i } pub fn abs(n: i32) -> i32 { if n >= 0 { n } else { -n } } pub fn max(n: i32, m: i32) -> i32 { if n >= m { n } else { m } } pub fn min(n: i32, m: i32) -> i32 { if n <= m { n } else { m } } pub fn factorial(n: u32) -> u32 { if n == 0 { return 1 } let mut r = n; for i in 0..n-1{ r *= n-i-1; } r } pub fn combination(n: u32, m: u32) -> u32 { factorial(n) / factorial(m) / factorial(n-m) }
a.cc:88:14: error: too many decimal points in number 88 | for i in 0..n-1{ | ^~~~ a.cc:3:1: error: 'fn' does not name a type 3 | fn main() { | ^~ a.cc:15:1: error: 'use' does not name a type 15 | use std::io::*; | ^~~ a.cc:16:1: error: 'use' does not name a type 16 | use std::str::FromStr; | ^~~ a.cc:17:1: error: 'pub' does not name a type 17 | pub fn read<T: FromStr>() -> T { | ^~~ a.cc:29:1: error: 'pub' does not name a type 29 | pub const MOD: u64 = 1_000_000_007; | ^~~ a.cc:31:1: error: 'pub' does not name a type 31 | pub fn is_prime(n: i32) -> bool { | ^~~ a.cc:49:1: error: 'pub' does not name a type 49 | pub fn lcm(mut n: i32, mut m: i32) -> i32 { | ^~~ a.cc:59:1: error: 'pub' does not name a type 59 | pub fn abs(n: i32) -> i32 { | ^~~ a.cc:67:1: error: 'pub' does not name a type 67 | pub fn max(n: i32, m: i32) -> i32 { | ^~~ a.cc:75:1: error: 'pub' does not name a type 75 | pub fn min(n: i32, m: i32) -> i32 { | ^~~ a.cc:83:1: error: 'pub' does not name a type 83 | pub fn factorial(n: u32) -> u32 { | ^~~ a.cc:94:1: error: 'pub' does not name a type 94 | pub fn combination(n: u32, m: u32) -> u32 { | ^~~
s122157451
p03644
C
#include <stdio.h> #include <string.h> int main(void){ int count=1; int n; scanf("%d",&n); for(;;){ count=count*2; if(count>n){printf("%d",count/2);break;} } } return 0; }
main.c:13:1: error: expected identifier or '(' before 'return' 13 | return 0; | ^~~~~~ main.c:14:1: error: expected identifier or '(' before '}' token 14 | } | ^
s991712184
p03644
C++
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 1; int nmax = 0; for (int i = 1; i <= n; i++) { int cnt = 0; int j = i; while (j % 2 == 0) { j /= 2; cnt++; } if (cnt > nmax) { nmax = cnt; ans = i; } } cout << i << endl; }
a.cc: In function 'int main()': a.cc:19:11: error: 'i' was not declared in this scope 19 | cout << i << endl; | ^
s546453640
p03644
Java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int max = 1; for (int i = 0; i < N; i++){ max = Math.pow(2, i); if (max > N){ break; } } max = max / 2; System.out.println(max); } }
Main.java:10: error: incompatible types: possible lossy conversion from double to int max = Math.pow(2, i); ^ 1 error
s975424112
p03644
Java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int max = 1; for (int i = 0; i < N; i++){ max = 2**i; if (max > N){ break; } } max = max / 2; System.out.println(max); } }
Main.java:10: error: illegal start of expression max = 2**i; ^ 1 error
s690348734
p03644
C++
#include <iostream> #include <cmath> using namespace std; int main(){ int N; cin >> N; int i = 0; int n = 1; while (true){ n *= 2; if (n >= N){ break; } i += 1; }
a.cc: In function 'int main()': a.cc:17:6: error: expected '}' at end of input 17 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s562859696
p03644
C++
#include<iostream> #include <bits/stdc++.h> #include<vector> using namespace std; int main() { int N,n = 2,count = 0; cin >>N; for(int i=0;i<N;i++){ if(i == n){ count++; n *=2; } } } cout << count <<endl; }
a.cc:17:5: error: 'cout' does not name a type 17 | cout << count <<endl; | ^~~~ a.cc:18:1: error: expected declaration before '}' token 18 | } | ^
s368056252
p03644
C++
#include<iostream> #include <bits/stdc++.h> #include<vector> int main() { int N,max = 0; for(int i=0;i<N;i++){ int count = 0; while(i%2 == 0){ count++; i = i/2; } if(count<max)max = count; } cout << max <<endl; }
a.cc: In function 'int main()': a.cc:16:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | cout << max <<endl; | ^~~~ | std::cout In file included from a.cc:1: /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:16:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 16 | cout << max <<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s766985643
p03644
C++
#include <bits/stdc++.h> #include <vector> using namespace std; int breaknumber(int n){ int count = 0; while(){ if(n%2 == 0){ count++; n = n/2; } else break; } return count; } int main(){ int N,max = 0; cin >> N; for(int i=0;i<N;i++){ if(max < breaknumber(i))max = breaknumber(i); } cout << max <<endl; }
a.cc: In function 'int breaknumber(int)': a.cc:7:11: error: expected primary-expression before ')' token 7 | while(){ | ^
s910206409
p03644
C++
#include <bits/stdc++.h> #include <vector> using namespace std; int breaknumber(int n;){ int count = 0; while(){ if(n%2 == 0){ count++; n = n/2; } else break; } return count; } int main(){ int N,max = 0; cin >> N; for(int i=0;i<N;i++){ if(max < breaknumber(i))max = breaknumber(i); } cout << max <<endl; }
a.cc:5:22: error: expected ')' before ';' token 5 | int breaknumber(int n;){ | ~ ^ | ) a.cc:5:23: error: expected unqualified-id before ')' token 5 | int breaknumber(int n;){ | ^
s533612354
p03644
C++
#include <iostream> using namespace std; int N; int main() { cin >> N; int res = 1; while (true) { if (i < N) res = res * 2; else cout << res << endl; }
a.cc: In function 'int main()': a.cc:15:13: error: 'i' was not declared in this scope 15 | if (i < N) res = res * 2; | ^ a.cc:17:2: error: expected '}' at end of input 17 | } | ^ a.cc:7:12: note: to match this '{' 7 | int main() { | ^
s549605789
p03644
C++
N = int(input()) num_list = [64, 32, 16, 8, 4, 2] for i in num_list: if N>=i: print(i) exit(0) print(0)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s841268473
p03644
C++
#include<bits/stdc++.h> using namespace std; int n; int main(){ cin>>n; if(n>=64) cout<<64<<endl; if(n>=32&&n<64) cout<<32<<endl; if(n>=16&&n<32) cout<<16<<end; if(n>=8&&n<16) cout<<8<<endl; if(n>=4&&n<8) cout<<4<<endl; if(n>=2&&n<4) cout<<2<<endl; if(n==1) cout<<1<<end; if(n==0) cout<<0<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 11 | cout<<16<<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::nullptr_t]' 306 |
s967109933
p03644
C++
#include<iostream> int main () { int N; std::cin >> N; out = 1; while (out*2 < N+1) { out *= 2; } std::cout << out << std::endl; }
a.cc: In function 'int main()': a.cc:6:3: error: 'out' was not declared in this scope 6 | out = 1; | ^~~
s003071232
p03644
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int a = 1; while(true){ if(a > N ) flag = true; if(flag) break; a *= 2 } cout << a << endl; }
a.cc: In function 'int main()': a.cc:9:18: error: 'flag' was not declared in this scope 9 | if(a > N ) flag = true; | ^~~~ a.cc:10:10: error: 'flag' was not declared in this scope 10 | if(flag) break; | ^~~~ a.cc:12:13: error: expected ';' before '}' token 12 | a *= 2 | ^ | ; 13 | } | ~
s755137812
p03644
C++
#include <iostream> #include <vector> int main(){ int n; std::cin >> n; std::vector<int> numbers(n, 1); for(int i=0; i < numbers.size(); i++) numbers.at(i) += i; int answer = 1; int power = 0; for(int i=0; i < numbers.size(); i++){ int dividend = numbers.at(i); int count = 0; while(dividend % 2 == 0){ count++; dividend /= 2; } if(power < count){ power = count; answer = numbers.at(i) } } std::cout << answer << std::endl; }
a.cc: In function 'int main()': a.cc:23:29: error: expected ';' before '}' token 23 | answer = numbers.at(i) | ^ | ; 24 | } | ~
s041125846
p03644
C++
using namespace std; #define rep(i, n) for (int i=0; i<(int)(n); i++) int main(){ int n; cin >> n; int k=0; //if(n==1)cout << 1 << endl; for(;;){ if(n<=pow(2,k)){cout << k << endl;return 0;} k++; } return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:10:11: error: 'pow' was not declared in this scope 10 | if(n<=pow(2,k)){cout << k << endl;return 0;} | ^~~ a.cc:10:21: error: 'cout' was not declared in this scope 10 | if(n<=pow(2,k)){cout << k << endl;return 0;} | ^~~~ a.cc:10:21: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:10:34: error: 'endl' was not declared in this scope 10 | if(n<=pow(2,k)){cout << k << endl;return 0;} | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s488676534
p03644
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int a; for(int i = 1;i <= N;i++){ if(i >= 2 && i< 4){ a = 2; }else if(i >=4 && i<8){ a = 4; }else if(i >=8 && i < 16){ a = 8; }else if(i >= 16 && i < 32){ a = 32; }else if(i == 1){ a = 1; }else{ a = 64 } } cout << a << endl; }
a.cc: In function 'int main()': a.cc:21:13: error: expected ';' before '}' token 21 | a = 64 | ^ | ; 22 | } | ~
s381890163
p03644
C++
N = int(input()) k = 1 while 2**k <= N: k += 1 print(2**(k-1))
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s399377722
p03644
C++
#include<bits/stdc++.h> using namespace std; main(){ int n; cin>>n; int ans,t; ans=t=0; for(int i=1;i<=n;++i){ if(x%2==0){ int cnt=0; while( } }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:9:8: error: 'x' was not declared in this scope 9 | if(x%2==0){ | ^ a.cc:12:5: error: expected primary-expression before '}' token 12 | } | ^ a.cc:11:13: error: expected ')' before '}' token 11 | while( | ~^ | ) 12 | } | ~ a.cc:12:5: error: expected primary-expression before '}' token 12 | } | ^ a.cc:13:4: error: expected '}' at end of input 13 | } | ^ a.cc:3:7: note: to match this '{' 3 | main(){ | ^
s795324639
p03644
C++
#include<bits/stdc++.h> using namespace std; map<int,int> diviosr(int n){ map<int,int> mp; for(int p=2;p*p<=n;++p){ while(n%p==0){ mp[p]++; n/=p; } } return mp; } main(){ int n; cin>>n; int ans=0; for(int i=0;i<=n;++i){ auto div = divisor(i); ans=max(ans,div[2]); } cout<<ans<<endl; }
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 13 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:18:16: error: 'divisor' was not declared in this scope; did you mean 'diviosr'? 18 | auto div = divisor(i); | ^~~~~~~ | diviosr
s651900359
p03644
C++
#include<bits/stdc++.h> using namespace std; map<int,int> diviosr(int n){ map<int,int> mp; for(int p=2;p*p<=n){ while(n%p==0){ mp[p]++; n/=p; } } return mp; } main(){ int n; cin>>n; int ans=0; for(int i=0;i<=n;++i){ auto div = divisor(i); ans=max(ans,div[2]); } cout<<ans<<endl; }
a.cc: In function 'std::map<int, int> diviosr(int)': a.cc:5:21: error: expected ';' before ')' token 5 | for(int p=2;p*p<=n){ | ^ | ; a.cc: At global scope: a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 13 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:18:16: error: 'divisor' was not declared in this scope; did you mean 'diviosr'? 18 | auto div = divisor(i); | ^~~~~~~ | diviosr