submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s058796034
p04047
C++
// ----- Author Info ------- // Khaled Alam - Ninjo // khaledalam.net@gmail.com //-------------------------- #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define ll long long #define sz size() #define all(a) (a).begin(), (a).end() #define rep(i,z) for(int i=0;i<(z);i++) #define ones __builtin_popcount //__popcnt #define iFile(a) freopen(#a, "r", stdin) #define oFile(a) freopen(#a, "w", stdout) #define ios ios_base::sync_with_stdio(0) #define tm cerr<<"Time elapsed: "<<clock()<<" ms\n" int main() { //iFile(input.txt); //oFile(output.txt); int n; cin > n; int a[n * 2]; for (int &it : a)cin >> it; sort(a, a + (n * 2)); int res = 0; rep(i,n)res += a[i]; cout << res << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:28:13: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 28 | cin > n; | ~~~ ^ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:28:13: note: candidate: 'operator>(int, int)' (built-in) 28 | cin > n; | ~~~~^~~ a.cc:28:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' 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:6: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | cin > n; | ^ /usr/include/c++/14/bits/regex.h:1236: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>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 28 | cin > n; | ^ /usr/include/c++/14/bits/regex.h:1329: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>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | cin > n; | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | cin > n; | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | cin > n; | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | cin > n; | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | cin > n; | ^ 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:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 28 | cin > n; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | cin > n; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | cin > n; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | cin > n; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | cin > n; | ^ 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:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 28 | cin > n; | ^ /usr/include/c++/14/string_view:702: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> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 28 | cin > n; | ^ /usr/include/c++/14/string_view:710: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>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 28 | cin > n; | ^ /usr/include/c++/14/bits/basic_string.h:3915: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>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | cin >
s770334565
p04047
C
include<stdio.h> int main(void) { int num; int length[100] = {}; int i, j; int temp; int sum=0; scanf("%d", &num); for (i=0;i<num*2;i++){ scanf("%d", &length[i]); } for(i=0;i<num*2;i++){ for(j=i+1;j<num*2;j++){ if(length[i] < length[j]){ temp = length[i]; length[i] = length[j]; length[j] = temp; } } } sum = length[1]; for(i=1;i<num+3;i+=2){ sum += length[i+2]; } printf("%d\n", sum); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^
s187089552
p04047
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); int n =sc.nextInt(); int[] l=new int[n*2]; for(int i=0; i<l.length; i++){ l[i]=sc.nextInt(); } Arrays.sort(l);    //昇順にソート int ans=0; for(int j=0; j<l.length; j+=2){ ans +=Math.min(l[j],l[j+1]);  } System.out.println(ans); } }
Main.java:13: error: illegal character: '\u3000' Arrays.sort(l); ???//?????? ^ Main.java:13: error: illegal character: '\u3000' Arrays.sort(l); ???//?????? ^ Main.java:13: error: illegal character: '\u3000' Arrays.sort(l); ???//?????? ^ Main.java:17: error: illegal character: '\u3000' ans +=Math.min(l[j],l[j+1]);? ^ 4 errors
s537382898
p04047
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); int n =sc.nextInt(); int[] l=new int[n*2]; for(int i=0; i<l.length; i++){ l[i]=sc.nextInt(); } Arrays.sort(l); int ans=0; for(int j=0; j<l.length; j+=2){ ans +=Math.min(l[j],l[i+1]); } System.out.println(ans); }}
Main.java:20: error: cannot find symbol ans +=Math.min(l[j],l[i+1]); ^ symbol: variable i location: class Main 1 error
s634329812
p04047
C++
#include <iostream> using namespace std; int main(int argc, const char * argv[]) { int N; cin >> N; int n = N*2; int L[n]; for(int i=0;i<n;i++){ cin >> L[i]; } sort(L,L+n); int maxFood = 0; for(int i=0;i<N;i++){ int index = i*2; maxFood += min(L[index],L[index+1]); } cout << maxFood << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(L,L+n); | ^~~~ | short
s469265599
p04047
Java
import java.util.*; class Main{ void main(String[]args){ Scanner sc=new Scanner(System.in); int yousosu =sc.nextInt(); int l[]=new int[yousosu]; for(int i=0; i<l.length; i++){ l[i]=sc.nextInt(); } Arrays.sort(l); for(int j=0; j<l.length-1; j++){ int ans=0; ans +=Math.min(l[j],l[j]+1]); System.out.println(ans); } }}
Main.java:18: error: ')' or ',' expected ans +=Math.min(l[j],l[j]+1]); ^ 1 error
s822405645
p04047
Java
import java.util.*; class Main{ void main(String[]args){ Scanner sc=new Scanner(System.in); int nagasa =sc.nextInt(); int l[]=new int[nagasa]; for(int i=0; i<length; i++){ l[i]=sc.nextInt(); } Arrays.sort(l); for(int i=0; i<length-1; i++){ int ans=0; ans +=Math.min(l[i],l[i+1]); System.out.println(ans); } }}
Main.java:11: error: cannot find symbol for(int i=0; i<length; i++){ ^ symbol: variable length location: class Main Main.java:16: error: cannot find symbol for(int i=0; i<length-1; i++){ ^ symbol: variable length location: class Main 2 errors
s646019263
p04047
Java
import java.util.*; class Main{ void main(String[]args){ Scanner sc=new Scanner(System.in); int nagasa =sc.nextInt(); int l[]=new int[nagasa]; for (int =0; i<length; i++){ l[i]=sc.nextInt(); } Arrays.sort(l); for(int i=0; i<length-1; i++){ int ans=0; ans +=Math.min(l[i],l[i+1]); System.out.println(ans); } }}
Main.java:11: error: not a statement for (int =0; i<length; i++){ ^ Main.java:11: error: ';' expected for (int =0; i<length; i++){ ^ Main.java:11: error: illegal start of expression for (int =0; i<length; i++){ ^ Main.java:11: error: not a statement for (int =0; i<length; i++){ ^ Main.java:11: error: ')' expected for (int =0; i<length; i++){ ^ Main.java:11: error: ';' expected for (int =0; i<length; i++){ ^ 6 errors
s283557879
p04047
Java
import java.util.*; class Main{ void main(String[]args){ Scanner sc=new Scanner(System.in); int nagasa =sc.nextInt(); int l[]=new int[nagasa]; for (int =0; i<length; i++){ l[i]=sc.nextInt(); } Arrays.sort(l); for(int i=0; i<length-1; i++){ int ans=0; ans +=<Math.min(l[i],l[i+1]); System.out.println(ans); } }}
Main.java:11: error: not a statement for (int =0; i<length; i++){ ^ Main.java:11: error: ';' expected for (int =0; i<length; i++){ ^ Main.java:11: error: illegal start of expression for (int =0; i<length; i++){ ^ Main.java:11: error: not a statement for (int =0; i<length; i++){ ^ Main.java:11: error: ')' expected for (int =0; i<length; i++){ ^ Main.java:11: error: ';' expected for (int =0; i<length; i++){ ^ Main.java:18: error: > or ',' expected ans +=<Math.min(l[i],l[i+1]); ^ Main.java:18: error: not a statement ans +=<Math.min(l[i],l[i+1]); ^ Main.java:18: error: ';' expected ans +=<Math.min(l[i],l[i+1]); ^ Main.java:18: error: not a statement ans +=<Math.min(l[i],l[i+1]); ^ Main.java:18: error: ';' expected ans +=<Math.min(l[i],l[i+1]); ^ 11 errors
s704768214
p04047
C++
#include <cstdio> #include <algorithm> using namespace std; int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); for(int i = 0;i < skw; i++) scanf("%d", &L[i]); sort(L[0], L[skw-1]); for(int j = 0; j < skw; j+2) sum = sum + min(L[j],L[j+1]); printf("%d\n", sum); return 0; }
In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:12:7: required from here 12 | sort(L[0], L[skw-1]); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:12:7: required from here 12 | sort(L[0], L[skw-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:12:7: required from here 12 | sort(L[0], L[skw-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:12:7: required from here 12 | sort(L[0], L[skw-1]); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 258 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 260 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:262:28: error: invalid type argument of unary '*' (have 'int') 262 | _ValueType __value = _GLIBCXX_MOVE(*__result); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:263:7: error: invalid type argument of unary '*' (have 'int') 263 | *__result = _GLIBCXX_MOVE(*__first); | ^~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:263:19: error: invalid type argument of unary '*' (have 'int') 263 | *
s799914217
p04047
C++
#include <cstdio> #include <algorithm> using namespace std; int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); for(int i = 0;i < skw; i++) scanf("%d", &L[i]); sort(L, skw); for(int j = 0; j < skw; j+2) sum = sum + min(L[j],L[j+1]); printf("%d\n", sum); return 0; }
a.cc: In function 'int main()': a.cc:12:6: error: no matching function for call to 'sort(int [200], int&)' 12 | sort(L, skw); | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed: a.cc:12:6: note: deduced conflicting types for parameter '_RAIter' ('int*' and 'int') 12 | sort(L, skw); | ~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' 4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)' 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)' 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
s548729938
p04047
C++
#include <cstdio> #include <algorithm> using namespace std; int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); //串の本数を取得(串焼きの数はこの半分) for(int i = 0;i < skw; i++) scanf("%d", &L[i]); //長さを取得 sort(L, skw); for(int j = 0; j < skw; j+2) sum = sum + min(L[j],L[j+1]); printf("%d\n", sum); return 0; }
a.cc: In function 'int main()': a.cc:12:6: error: no matching function for call to 'sort(int [200], int&)' 12 | sort(L, skw); | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed: a.cc:12:6: note: deduced conflicting types for parameter '_RAIter' ('int*' and 'int') 12 | sort(L, skw); | ~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' 4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)' 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)' 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
s566872602
p04047
C++
#include <cstdio> #include <cmath> using namespace std; void selectionSort(int L[], int N){ int minj, t; for(int i = 0; i < N; i++){ minj = i; for(int j = i; j < N; j++){ if(L[j] < L[minj]) minj = j; } t = L[i]; L[i] = L[minj]; L[minj] = t; } } int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); //串の本数を取得(串焼きの数はこの半分) for(int i = 0;i < skw; i++) scanf("%d", &L[i]); //長さを取得 selectionSort(L, skw); for(int j = 0; j < skw; j+2) sum = sum + min(L[j],L[j+1]); printf("%d\n", sum); rerutn 0; }
a.cc: In function 'int main()': a.cc:32:3: error: 'rerutn' was not declared in this scope 32 | rerutn 0; | ^~~~~~
s423389297
p04047
C++
#include <cstdio> #include <cmath> using namespace std; void selectionSort(int L[], int N){ int minj, t; for(int i = 0; i < N; i++){ minj = i; for(int j = i; j < N; j++){ if(L[j] < L[minj]) minj = j; } t = L[i]; L[i] = L[minj]; L[minj] = t; } } int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); //串の本数を取得(串焼きの数はこの半分) for(int i = 0;i < skw; i++) scanf("%d", &L[i]); //長さを取得 selectionSort(L, skw); for(int i = 0; i < skw; i+2) sum = sum + min(L[i],L[i+1]); printf("%d", sum); rerutn 0; }
a.cc: In function 'int main()': a.cc:32:3: error: 'rerutn' was not declared in this scope 32 | rerutn 0; | ^~~~~~
s769993046
p04047
C++
#include <cstdio> #include <cmath> using namespace std; void selectionSort(int L[], int N){ int minj, t; for(int i = 0; i < N; i++){ minj = i; for(int j = i; j < N; j++){ if(L[j] < L[minj]) minj = j; } t = L[i]; L[i] = L[minj]; L[minj] = t; } } int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); //串の本数を取得(串焼きの数はこの半分) for(int i = 0;i < skw; i++) scanf("%d", &L[i]); //長さを取得 selectionSort(L, skw); for(int i = 0; i < skw; i+2) sum = sum + min(L[i],L[i+1]); printf("%d", sum); rerutn 0; }
a.cc: In function 'int main()': a.cc:32:3: error: 'rerutn' was not declared in this scope 32 | rerutn 0; | ^~~~~~
s526217428
p04047
C++
#include <cstdio> using namespace std; int selectionSort(int L[], int N){ int minj, t, sw = 0; for(int i = 0; i < N; i++){ minj = i; for(int j = i; j < N; j++){ if(A[j] < A[minj]) minj = j; } t = A[i]; A[i] = A[minj]; A[minj] = t; if(i != minj) sw++; } return sw; } int main(){ int skw, L[200], sum = 0; scanf("%d", &skw); //串の本数を取得(串焼きの数はこの半分) for(int i = 0;i < skw; i++) scanf("%d", &L[i]); //長さを取得 selectionSort(L, skw); for(int i = 0; i < skw; i+2) sum = sum + min(L[i],L[i+1]); printf("%d", sum); rerutn 0; }
a.cc: In function 'int selectionSort(int*, int)': a.cc:9:10: error: 'A' was not declared in this scope 9 | if(A[j] < A[minj]) | ^ a.cc:12:9: error: 'A' was not declared in this scope 12 | t = A[i]; | ^ a.cc: In function 'int main()': a.cc:31:17: error: 'min' was not declared in this scope; did you mean 'main'? 31 | sum = sum + min(L[i],L[i+1]); | ^~~ | main a.cc:34:3: error: 'rerutn' was not declared in this scope 34 | rerutn 0; | ^~~~~~
s118203438
p04047
Java
import java.util.*; class Main{ void main(String[]args){ Scanner sc=new Scanner(System.in); int nagasa =sc.nextInt(); int i[]=new int[nagasa]; //要素数 for(int j=0; j<i.length; j++){ i[j]=sc.nextInt(); } for(int a=0; a< i.length-1; a++) { for(int b=0; b < i.length-a-1; b++) { if(i[b] < i[b+1]) { int asc = i[b]; i[b] = i[b+1]; i[b+1] = asc; } } } for(int n=0; n<i.length-1; n++){ int x=i[2*n+1]; int sum +=x; System.out.println(sum); } }}
Main.java:26: error: ';' expected int sum +=x; ^ Main.java:26: error: not a statement int sum +=x; ^ 2 errors
s582565278
p04047
Java
import java.util.*; class Main{ void main(String[]args){ Scanner sc=new Scanner(System.in); int nagasa =sc.nextInt(); int i[]=new int[nagasa]; //要素数 for(int j=0; j<i.length; j++){ i[j]=sc.nextInt(); } Arrays.sort(i,Comparator.reverseOrder()); for(int n=0; n<i.length-1; n++){ int x=i[2*n+1]; sum +=x; System.out.println(sum); } }}
Main.java:14: error: no suitable method found for sort(int[],Comparator<T#1>) Arrays.sort(i,Comparator.reverseOrder()); ^ method Arrays.<T#2>sort(T#2[],Comparator<? super T#2>) is not applicable (inference variable T#2 has incompatible bounds equality constraints: int upper bounds: Object) method Arrays.<T#3>sort(T#3[],int,int,Comparator<? super T#3>) is not applicable (cannot infer type-variable(s) T#3 (actual and formal argument lists differ in length)) where T#1,T#2,T#3 are type-variables: T#1 extends Comparable<? super T#1> T#2 extends Object declared in method <T#2>sort(T#2[],Comparator<? super T#2>) T#3 extends Object declared in method <T#3>sort(T#3[],int,int,Comparator<? super T#3>) Main.java:18: error: cannot find symbol sum +=x; ^ symbol: variable sum location: class Main Main.java:19: error: cannot find symbol System.out.println(sum); ^ symbol: variable sum location: class Main Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 3 errors
s773101316
p04047
C++
#include <cstdio> #include <vector> using namespace std; int main() { int N; scanf("%d", &N); vector<int> vec; for(int i=0; i<2*N; ++i) { int L; scanf("%d", &L); vec.push_back(L); } sort(vec.begin(), vec.end()); int sum = 0; for(int i=0; i<N; ++i) { sum += vec[i*2]; } printf("%d\n", sum); return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(vec.begin(), vec.end()); | ^~~~ | short
s121155576
p04047
C++
#include <cstdio> using namespace std; int main() { int N; scanf("%d", &N); vector<int> vec; for(int i=0; i<2*N; ++i) { int L; scanf("%d", &L); vec.push_back(L); } sort(vec.begin(), vec.end()); int sum = 0; for(int i=0; i<N; ++i) { sum += vec[i*2]; } printf("%d\n", sum); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'vector' was not declared in this scope 8 | vector<int> vec; | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <cstdio> +++ |+#include <vector> 2 | a.cc:8:16: error: expected primary-expression before 'int' 8 | vector<int> vec; | ^~~ a.cc:12:17: error: 'vec' was not declared in this scope 12 | vec.push_back(L); | ^~~ a.cc:14:14: error: 'vec' was not declared in this scope 14 | sort(vec.begin(), vec.end()); | ^~~ a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(vec.begin(), vec.end()); | ^~~~ | short
s353576285
p04047
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N ; vector<int> L; for (int i = 0; i <2*N; i++) { int m; cin >> m; L.push_back(m); } std::sort(L.begin(), L.end()); int Guzai =0; for(int i = 0; 2*i >2*N; i++){ Guzai += i; } cout << Guzai << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 15 | std::sort(L.begin(), L.end()); | ^~~~ | qsort
s139992927
p04047
Java
import java.util.*; public class Main_1 { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int n=sc.nextInt(); int kusim[]=new int[2*n]; int ans=0; for(int i=0;i<2*n;i++){ kusim[i]=sc.nextInt(); } int turn=kusim.length-1; for(int j=0;j<turn;j++){ for(int k=0;k<turn-j;k++){ if(kusim[k]>kusim[k+1]){ int a=kusim[k]; kusim[k]=kusim[k+1]; kusim[k+1]=a; } } } for(int l=0;l<n;l++){ ans+=kusim[2*l+1]; } } }
Main.java:2: error: class Main_1 is public, should be declared in a file named Main_1.java public class Main_1 { ^ 1 error
s001763386
p04047
C++
#include<bits/stdc++.h> using namespace std; typedef long long int64; int main() { int64 N, X; cin >> N >> X; int64 Line = (N - 1) * 3; if(N % X == 0) { cout << Line - (kyori - 1) * 3 << endl; } else { cout << Line << endl; } }
a.cc: In function 'int main()': a.cc:12:21: error: 'kyori' was not declared in this scope 12 | cout << Line - (kyori - 1) * 3 << endl; | ^~~~~
s386473276
p04047
C
#include <stdio.h> void Qsort(int x[], int left, int right); void Swap(int x[], int i, int j); int main(void) { int N, L[100], sum = 0; if (scanf("%d", &N) != 1)return 0; for (int i = 0; i < 2 * N; i++) { if (scanf("%d", &L[i]) != 1)return 0; } Qsort(L, 0, 2 * N - 1); for (int i = 0; i < N; i++) { sum += L[2 * i]; } printf("\n%d\n", sum); return 0; } void Swap(int x[], int i, int j) { int w; w = x[i]; x[i] = x[j]; x[j] = w; } void Qsort(int x[], int left, int right) { int i, j, pivot; i = left; j = right; pivot = x[(i + j) / 2]; while (1) { while (x[i] < pivot) i++; while (x[j] > pivot) j--; if (i >= j) break; Swap(x, i, j); i++; j--; } if (left < i - 1) Qsort(x, left, i - 1); if (right > j + 1) Qsort(x, j + 1, right); } /*
main.c:66:1: error: unterminated comment 66 | /* | ^
s569039486
p04047
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.stream.Stream; import java.util.Arrays; public class A { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); int N = Integer.parseInt(line); String readline = br.readLine(); readline = readline.trim(); String[] stra = readline.split(" "); int[] inta = Stream.of(stra).mapToInt(Integer::parseInt).toArray(); //for (int j = 0; j < inta.length; j++) { // System.out.println(j.class); //} Arrays.sort(inta); //System.out.println(Arrays.toString(inta)); int count = 0; for (int i = 0; i < N ; i++ ){ count = count + inta[2 * i]; } System.out.println(count); } }
Main.java:6: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s554265959
p04047
C++
#include <iostream> #include <sstream> #include <fstream> #include <string> #include <vector> #include <deque> #include <queue> #include <stack> #include <set> #include <map> #include <algorithm> #include <functional> #include <utility> #include <bitset> #include <cmath> #include <cstdlib> #include <ctime> #include <cstdio> using namespace std; int main() { int N; cin >> N; vector<int> L(2 * N); for (auto& li : L) cin >> li; int cnt = 0; while (L.size() > 0) { auto maxIt = max_element(L.begin(), L.end()), L.erase(maxIt); auto secondIt = max_element(L.begin(), L.end()); cnt += *secondIt, L.erase(secondIt); } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:34:64: error: expected initializer before '.' token 34 | auto maxIt = max_element(L.begin(), L.end()), L.erase(maxIt); | ^
s036509157
p04047
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; void main(void) { int n; cin >> n; n *= 2; vector<int> vec; for (int i = 0; i < n; i++) { int x; cin >> x; vec.push_back(x); } sort(vec.begin(), vec.end()); int sum = 0; for (int i = 0; i < n; i += 2) { sum += vec[i]; } cout << sum << endl; }
a.cc:5:1: error: '::main' must return 'int' 5 | void main(void) { | ^~~~
s978058453
p04047
C++
#include <stdio.h> int N = 0; int L[201]; int main(){ scanf_s("%d", &N); for (int i = 0; i < 2 * N; i++){ scanf_s("%d", &L[i]); } int temp; for (int i = 0; i < 2 * N; i++){ for (int j = 0; j < 2 * N - 1; j++){ if (L[j] < L[j + 1]){ temp = L[j]; L[j] = L[j + 1]; L[j + 1] = temp; } } } int answer = 0; for (int i = 0; i < N; i++){ answer += L[i*2 + 1]; } printf("%d\n", answer); return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 9 | scanf_s("%d", &N); | ^~~~~~~ | scanf
s987376016
p04047
C
#include <iostream> #include <cstdio> using namespace std; void sort(int *array, int num){ for(int i = 0; i < num - 1; i++){ for(int j = i + 1; j < num; j++){ if(array[i] < array[j]){ int temp = array[i]; array[i] = array[j]; array[j] = temp; } } } } int main(){ int N, result = 0; int L[200]; cin >> N; for(int i = 0; i < 2 * N; i++) cin >> L[i]; sort(L,2*N); for(int i = 0; 2*i + 1 <= 2*N; ++i){ result += L[2*i + 1]; } printf("%d\n",result); return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s684874332
p04047
Java
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int kushi = sc.nextInt(); ArrayList<Integer> lengthList = new ArrayList<Integer>(); for (int i = 0, max = kushi * 2; i < max; i++) { int n = sc.nextInt(); lengthList.add(n); } Collections.sort(lengthList); int tot = 0; for (int i = 0; i < lengthList.size(); i+=2) { tot += lengthList.get(i); } System.out.println(tot); } }
Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:8: error: cannot find symbol ArrayList<Integer> lengthList = new ArrayList<Integer>(); ^ symbol: class ArrayList location: class Main Main.java:8: error: cannot find symbol ArrayList<Integer> lengthList = new ArrayList<Integer>(); ^ symbol: class ArrayList location: class Main Main.java:14: error: cannot find symbol Collections.sort(lengthList); ^ symbol: variable Collections location: class Main 5 errors
s283734180
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector< int > A( N * 2 ); for( int i = 0; i < N * 2; ++i ) cin >> A[ i ]; int ans = 0; sort( A.begin(), A.end() ); for( int i = 0; i < N * 2; i += 2 ) ans += A[ i ]; cout << A[ i ] << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:13:16: error: 'i' was not declared in this scope 13 | cout << A[ i ] << "\n"; | ^
s557671162
p04047
Java
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String args[]){ int N = 0; int L[] = new int[200]; int ans = 0; Arrays.fill(L, 1000); Scanner scan = new Scanner(System.in); N = scan.next(); for(int i=0;i<2*N;i++){ L[i] = scan.next(); } Arrays.sort(a); for(int i=0;i<2*N;i=i+2){ add = add+L[i]; } System.out.println(add); } }
Main.java:11: error: incompatible types: String cannot be converted to int N = scan.next(); ^ Main.java:13: error: incompatible types: String cannot be converted to int L[i] = scan.next(); ^ Main.java:15: error: cannot find symbol Arrays.sort(a); ^ symbol: variable a location: class Main Main.java:17: error: cannot find symbol add = add+L[i]; ^ symbol: variable add location: class Main Main.java:17: error: cannot find symbol add = add+L[i]; ^ symbol: variable add location: class Main Main.java:19: error: cannot find symbol System.out.println(add); ^ symbol: variable add location: class Main 6 errors
s165797321
p04047
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class A001 { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); Integer[] L2 = new Integer[2*N]; String[] L = br.readLine().split(" "); for(int i=0;i<L.length;i++){ L2[i] = Integer.parseInt(L[i]); } int sum = 0; Arrays.sort(L2); for(int i=L2.length-1;i>0;i-=2){ sum += Math.min(L2[i], L2[i-1]); } System.out.println(sum); } }
Main.java:5: error: class A001 is public, should be declared in a file named A001.java public class A001 { ^ 1 error
s523640904
p04047
C++
#include <bits/stdc++.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define RI(X) scanf("%d", &(X)) #define RII(X, Y) scanf("%d%d", &(X), &(Y)) #define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z)) #define DRI(X) int (X); scanf("%d", &X) #define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y) #define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z) #define RS(X) scanf("%s", (X)) #define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0) #define MP make_pair #define PB push_back #define MS0(X) memset((X), 0, sizeof((X))) #define MS1(X) memset((X), -1, sizeof((X))) #define LEN(X) strlen(X) #define PII pair<int,int> #define VI vector<int> #define VPII vector<pair<int,int> > #define PLL pair<long long,long long> #define VPLL vector<pair<long long,long long> > #define F first #define S second typedef long long LL; using namespace std; const int MOD = 1e9+7; const int SIZE = 1e6+10; int a[111111]; int main(){ DRII(n); REP(i,N*2)RI(a[i]); sort(a,a+2*n); int an=0; REP(i,n)an+=a[i*2]; cout<<an<<endl; return 0; }
a.cc:32:11: error: macro "DRII" requires 2 arguments, but only 1 given 32 | DRII(n); | ^ a.cc:10:9: note: macro "DRII" defined here 10 | #define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y) | ^~~~ a.cc: In function 'int main()': a.cc:32:5: error: 'DRII' was not declared in this scope 32 | DRII(n); | ^~~~ a.cc:33:7: error: 'N' was not declared in this scope 33 | REP(i,N*2)RI(a[i]); | ^ a.cc:4:40: note: in definition of macro 'REP' 4 | #define REP(I, N) for (int I = 0; I < (N); ++I) | ^ a.cc:34:12: error: 'n' was not declared in this scope; did you mean 'yn'? 34 | sort(a,a+2*n); | ^ | yn
s903398645
p04047
C++
#include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <ctime> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <iostream> #include <algorithm> #include <functional> #include <numeric> #include <string> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define pb push_back #define mp make_pair #define debug(x) cout<<#x<<": "<<x<<endl #define MOD 1000000007 #define MAX_N 100 typedef long long ll; typedef unsigned long long ull; template <class T, class U> amax(T& x, U y) {if (x < y) x = y;} template <class T, class U> amin(T& x, U y) {if (x > y) x = y;} int main(void) { int N, L[2 * MAX_N]; cin >> N; REP(i, 2 * N) cin >> L[i]; sort(L, L + 2 * N); int ret = 0; REP(i, N) ret += L[2 * i]; cout << ret << endl; return 0; }
a.cc:34:29: error: ISO C++ forbids declaration of 'amax' with no type [-fpermissive] 34 | template <class T, class U> amax(T& x, U y) {if (x < y) x = y;} | ^~~~ a.cc: In function 'int amax(T&, U)': a.cc:34:63: warning: no return statement in function returning non-void [-Wreturn-type] 34 | template <class T, class U> amax(T& x, U y) {if (x < y) x = y;} | ^ a.cc: At global scope: a.cc:35:29: error: ISO C++ forbids declaration of 'amin' with no type [-fpermissive] 35 | template <class T, class U> amin(T& x, U y) {if (x > y) x = y;} | ^~~~ a.cc: In function 'int amin(T&, U)': a.cc:35:63: warning: no return statement in function returning non-void [-Wreturn-type] 35 | template <class T, class U> amin(T& x, U y) {if (x > y) x = y;} | ^
s727402936
p04047
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> L; for(int i = 0; i < 2*N; i++){ int tmp; cin >> tmp; L.push_back(tmp); } int ans; sort(L.begin(), L.end()); for(int i = 0; i < 2*N; i += 2){ ans += min(L[i], L[i+1]); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(L.begin(), L.end()); | ^~~~ | short
s032755417
p04047
C++
N=raw_input() up=raw_input().split() up=up.sort() count=0 for i in range(N): count+=int(up[i*2]) print count
a.cc:1:1: error: 'N' does not name a type 1 | N=raw_input() | ^
s991078055
p04047
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n * 2]; for (int i = 0; i < n * 2; i++) { cin >> a[i]; } sort(a, a + n*2); int cnt = 0; for (int i = 0; i < n; i++) { int x = a[2*i]; int y = a[2*i+1]; if (x > y) { cnt += y; } else { cnt += x; } } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(a, a + n*2); | ^~~~ | short
s296988079
p04047
C++
#include<iostream> #include<vector> using namespace std; #define all(c) ((c).begin()), ((c).end()) #define dump(c) cerr << "> " << #c << " = " << (c) << endl; #define REP(i, a, b) for (int i = (a); i < (int)(b); i++) #define rep(i, n) REP(i, 0, n) typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; const int INF = 1001001001; const double EPS = 1e-10; template<typename T1,typename T2> ostream& operator<<(ostream& os,const pair<T1,T2>& p){ return os<<'('<<p.first<<','<<p.second<<')'; } template<typename T> ostream& operator<<(ostream& os,const vector<T>& a){ os<<'['; rep(i,a.size()) os<<(i?" ":"")<<a[i]; return os<<']'; } int main() { int n; cin >> n; vector<int> li(n * 2); rep(i, n * 2) { cin >> li[i]; } sort(all(li)); int ans = 0; rep(i, n * 2) { int a = i * 2; ans += li[a]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:36:5: error: 'sort' was not declared in this scope; did you mean 'short'? 36 | sort(all(li)); | ^~~~ | short
s611821148
p04047
C++
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author rn4ru */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); TaskA solver = new TaskA(); solver.solve(1, in, out); out.close(); } static class TaskA { public void solve(int testNumber, InputReader in, OutputWriter out) { int N = in.readInt(); int[] L = IOUtils.readIntArray(in, 2 * N); Arrays.sort(L); int ans = 0; for (int i = 0; i < N; i++) { ans += L[i * 2]; } out.printLine(ans); } } static class IOUtils { public static int[] readIntArray(InputReader in, int size) { int[] array = new int[size]; for (int i = 0; i < size; i++) { array[i] = in.readInt(); } return array; } } static class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.writer = new PrintWriter(writer); } public void close() { writer.close(); } public void printLine(int i) { writer.println(i); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private InputReader.SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) { return -1; } } return buf[curChar++]; } public int readInt() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.OutputStream; | ^~~~~~ 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.io.IOException; | ^~~~~~ 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.io.InputStream; | ^~~~~~ 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 java.io.OutputStream; | ^~~~~~ 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 java.io.PrintWriter; | ^~~~~~ 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 java.util.Arrays; | ^~~~~~ 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 java.io.BufferedWriter; | ^~~~~~ 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 java.io.Writer; | ^~~~~~ 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 java.io.OutputStreamWriter; | ^~~~~~ 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 java.util.InputMismatchException; | ^~~~~~ 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 java.io.IOException; | ^~~~~~ 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 java.io.InputStream; | ^~~~~~ a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:20:1: error: expected unqualified-id before 'public' 20 | public class Main { | ^~~~~~
s923736902
p04047
C++
N = int(raw_input()) L = map(int,raw_input().split()) L.sort(reverse = True) ans = 0 for i in xrange(N): ans += min(L[2*i],L[2*i+1]) print ans
a.cc:1:1: error: 'N' does not name a type 1 | N = int(raw_input()) | ^
s036461967
p04047
C++
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int[] L = new int[2 * N]; for (int i = 0; i < 2 * N; ++i) { L[i] = sc.nextInt(); } Arrays.sort(L); int ans = 0; for (int i = 0; i < N; ++i) { ans += L[2 * i]; } System.out.println(ans); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Arrays; | ^~~~~~ 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.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s202148528
p04048
C++
#include <iostream> using namespace std; int main(){ ull N, X; cin >> N >> X; cout << N + 3 * X + X / 2; return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: 'ull' was not declared in this scope 5 | ull N, X; | ^~~ a.cc:6:10: error: 'N' was not declared in this scope 6 | cin >> N >> X; | ^ a.cc:6:15: error: 'X' was not declared in this scope 6 | cin >> N >> X; | ^
s469387535
p04048
C++
#include<bits/stdc++.h> using namespace std; int n,m; int a[225]; int main(){ cin>>n>>m; cout<<(6*x); }
a.cc: In function 'int main()': a.cc:7:18: error: 'x' was not declared in this scope 7 | cout<<(6*x); | ^
s558333013
p04048
C++
#include <bits/stdc++.h> #include <math.h> #include <list> #include <cmath> #include <queue> using namespace std; #define ll long long void sor(vector<ll> &x) { sort(x.begin(), x.end()); } ll gcd(ll x, ll y) { if (y == 0) { return x; } return gcd(y, x % y); } list<ll> a[5]; void bfs(int src) { queue<int> q; bool *vis = new bool[5 + 1]{0}; q.push(src); vis[src] = true; while (!q.empty()) { int node = q.front(); cout << node << " "; q.pop(); for (int n : a[node]) { if (!vis[n]) { q.push(n); vis[n] = true; } } } } ll min(ll x, ll y) { if (x > y) { return y; } else { return x; } } int main() { double n, x; cin >> n >> x; double ans = 2 * x + n + 3 * (gcd(n, x)); cout << ans; return 0; }
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/numeric: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]': a.cc:63:38: required from here 63 | double ans = 2 * x + n + 3 * (gcd(n, x)); | ~~~^~~~~~ /usr/include/c++/14/numeric:175:21: error: static assertion failed: std::gcd arguments must be integers 175 | static_assert(is_integral_v<_Mn> && is_integral_v<_Nn>, | ^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/numeric:175:21: note: 'std::is_integral_v<double>' evaluates to false In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In instantiation of 'struct std::make_unsigned<double>': /usr/include/c++/14/type_traits:2076:11: required by substitution of 'template<class _Tp> using std::make_unsigned_t = typename std::make_unsigned::type [with _Tp = double]' 2076 | using make_unsigned_t = typename make_unsigned<_Tp>::type; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/numeric:182:24: required from 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]' 182 | return __detail::__gcd<make_unsigned_t<_Ct>>(__m2, __n2); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:63:38: required from here 63 | double ans = 2 * x + n + 3 * (gcd(n, x)); | ~~~^~~~~~ /usr/include/c++/14/type_traits:1929:13: error: invalid use of incomplete type 'class std::__make_unsigned_selector<double, false, false>' 1929 | { using type = typename __make_unsigned_selector<_Tp>::__type; }; | ^~~~ /usr/include/c++/14/type_traits:1837:11: note: declaration of 'class std::__make_unsigned_selector<double, false, false>' 1837 | class __make_unsigned_selector; | ^~~~~~~~~~~~~~~~~~~~~~~~
s105287260
p04048
C++
n,x = map(int, input().split()) print(3*(n-1))
a.cc:1:1: error: 'n' does not name a type 1 | n,x = map(int, input().split()) | ^
s253302526
p04048
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define f(i,a,n) for(i=a;i<n;i++) #define in(x) scanf("%lld",&x) void solve() { ll n,x; in(n); in(x); if(n==2*x) ans=3*x; else ans=6*x; printf("%lld\n",ans); } int main() { ll t; // cin>>t; // while(t--) solve(); }
a.cc: In function 'void solve()': a.cc:12:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans=3*x; | ^~~ | abs a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans=6*x; | ^~~ | abs a.cc:15:21: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | printf("%lld\n",ans); | ^~~ | abs
s196140877
p04048
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fo(i,n) for(int i=0;i<n;i++) int ; ll a,b,x,n,ans; void solve() { ans=n; a=x,b=n-x; while(true){ if(a<b) swap(a,b); ans+=((a/b)*2)*b; if(a%b==0){ ans-=b; break; } a=a%b; } cout << ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> x; solve(); return 0; }
a.cc:8:1: error: declaration does not declare anything [-fpermissive] 8 | int ; | ^~~
s477984084
p04048
C++
#include <stdio.h> long long n, x, a, b, c, ans; int main() { scanf("%lld%lld", &n, &x); ans = n; if (x < n - x) { a = n - x; b = x; }# else { a = x; b = n - x; } while (true) { if (a % b == 0) { ans += (2 * a / b - 1) * b; break; } else { ans += 2 * (a / b) * b; c = a % b; a = b; b = c; } } printf("%lld\n", ans); }
a.cc:9:10: error: stray '#' in program 9 | }# | ^
s059811304
p04048
C++
include<iostream> #include<string> #include<iomanip> #include<cmath> #include<vector> #include<algorithm> #include<utility> using namespace std; #define int long long #define endl "\n" constexpr long long INF = (long long)1e18; constexpr long long MOD = 1'000'000'007; struct fast_io { fast_io(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); }; } fio; signed main(){ cout<<fixed<<setprecision(10); int N, X; int a, b; int ans = 0; cin>>N>>X; a = X; b = N - X; ans += X; ans += N - X; while(true){ if(a < b) swap(a, b); // cout<<"a = "<<a<<" b = "<<b<<" ans = "<<ans<<endl; ans += b; ans += 2 * (a/b - 1) * b; if(a%b == 0) { // ans += 2 * (a/b - 1) * b; cout<<ans<<endl; return 0; } ans += b; a = a % b; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type 198 | _GLIBCXX14_CONSTEXPR std::size_t |
s874114813
p04048
C++
#include <iostream> #include<bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,k; cin>>n>>k; int ans=3*(n-__gcd(n,k)); cout<<ans; return 0; } AC
a.cc:15:1: error: 'AC' does not name a type 15 | AC | ^~
s716856390
p04048
C++
#include<bits/stdc++.h> using namespace std; int gcd(int a,in b){ if(a==0)return b; if(b==0)return a; if(a>b) return gcd(a-b,b); return gcd(a,b-a); } int main() { long long int a,b; cin>>a>>b; long long int ans=0; ans=3*(a-gcd(a,b)); cout<<ans<<endl; return 0; }
a.cc:3:15: error: 'in' has not been declared 3 | int gcd(int a,in b){ | ^~
s479146373
p04048
C++
int gcd(int a,in b){ if(a==0)return b; if(b==0)return a; if(a>b) return gcd(a-b,b); return gcd(a,b-a); } int main() { long long int a,b; cin>>a>>b; long long int ans=0; ans=3*(a-gcd(a,b)); cout<<ans<<endl; return 0; }
a.cc:1:15: error: 'in' has not been declared 1 | int gcd(int a,in b){ | ^~ a.cc: In function 'int main()': a.cc:12:3: error: 'cin' was not declared in this scope 12 | cin>>a>>b; | ^~~ a.cc:15:3: error: 'cout' was not declared in this scope 15 | cout<<ans<<endl; | ^~~~ a.cc:15:14: error: 'endl' was not declared in this scope 15 | cout<<ans<<endl; | ^~~~
s563665007
p04048
C++
#include "bits/stdc++.h" using namespace std; int main() { // cout<<"Hello World!"; ll n,x; cin>>n>>x; cout<<n*x+x; }
a.cc: In function 'int main()': a.cc:5:4: error: 'll' was not declared in this scope 5 | ll n,x; | ^~ a.cc:6:9: error: 'n' was not declared in this scope; did you mean 'yn'? 6 | cin>>n>>x; | ^ | yn a.cc:6:12: error: 'x' was not declared in this scope 6 | cin>>n>>x; | ^
s518292659
p04048
C++
#include <bits/stdc++.h> #include <cstdlib> #include <cmath> #define rep(i,n) for (long long i=0; i < (n); ++i) #define rep2(i,n,m) for(long long i=n;i<=m;i++) using namespace std; using ll = long long; using P = pair<int,int>; const ll INF=1e18 ; inline void chmax(ll& a,ll b){a=max(a,b);} inline void chmin(ll& a,ll b){a=min(a,b);} int main(){ ll n ; cin>> n ; cout <<3*n<<endl ; } return 0; }
a.cc:18:5: error: expected unqualified-id before 'return' 18 | } return 0; | ^~~~~~ a.cc:19:1: error: expected declaration before '}' token 19 | } | ^
s324132687
p04048
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <queue> #include <stack> #include <set> #include <map> #include <iomanip> #include <utility> #include <tuple> #include <functional> #include <bitset> #include <cassert> #include <complex> #include <time.h> #define ll long long #define double long double #define itn int #define endl '\n' #define co(ans) cout<<ans<<endl; #define COYE cout<<"YES"<<endl; #define COYe cout<<"Yes"<<endl; #define COye cout<<"yes"<<endl; #define CONO cout<<"NO"<<endl; #define CONo cout<<"No"<<endl; #define COno cout<<"no"<<endl; #define 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 ALL(V) ((V).begin(),(V).end()) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define EPS 1e-10 #define PI 3.141592653589793238 #define MOD 1000000007 #define MAX 5100000 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;} const int vx[4]={0,1,0,-1},vy[4]={1,0,-1,0}; using namespace std; int main(){ ll N,X; cin>>N>>X; cout<<3*(N-gcd(N,X))<<endl; }
a.cc: In function 'int main()': a.cc:50:14: error: 'gcd' was not declared in this scope 50 | cout<<3*(N-gcd(N,X))<<endl; | ^~~
s993701018
p04048
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { std: ios_base::sync_with_stdio(0); cin.tie(0); int N,X; cin>>N>>X; cout<<3(N-__gcd(N,X))<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:10: error: expression cannot be used as a function 15 | cout<<3(N-__gcd(N,X))<<endl; | ~^~~~~~~~~~~~~~
s846698970
p04048
C++
#include <iostream> using namespace std; long long n, x, ans; long long cel(long long n, long long x) {     if(n % x == 0)         return 2 * n - x;     ans = n / x * 2 * x + cel(x, n % x);     return ans ; } int main() {     while(cin >> n >> x) {         ans = n + cel(n - x, x);         cout << ans << endl;     } }
a.cc:6:1: error: extended character   is not valid in an identifier 6 |     if(n % x == 0) | ^ a.cc:6:3: error: extended character   is not valid in an identifier 6 |     if(n % x == 0) | ^ a.cc:7:1: error: extended character   is not valid in an identifier 7 |         return 2 * n - x; | ^ a.cc:7:3: error: extended character   is not valid in an identifier 7 |         return 2 * n - x; | ^ a.cc:7:5: error: extended character   is not valid in an identifier 7 |         return 2 * n - x; | ^ a.cc:7:7: error: extended character   is not valid in an identifier 7 |         return 2 * n - x; | ^ a.cc:8:1: error: extended character   is not valid in an identifier 8 |     ans = n / x * 2 * x + cel(x, n % x); | ^ a.cc:8:3: error: extended character   is not valid in an identifier 8 |     ans = n / x * 2 * x + cel(x, n % x); | ^ a.cc:9:1: error: extended character   is not valid in an identifier 9 |     return ans ; | ^ a.cc:9:3: error: extended character   is not valid in an identifier 9 |     return ans ; | ^ a.cc:13:1: error: extended character   is not valid in an identifier 13 |     while(cin >> n >> x) { | ^ a.cc:13:3: error: extended character   is not valid in an identifier 13 |     while(cin >> n >> x) { | ^ a.cc:14:1: error: extended character   is not valid in an identifier 14 |         ans = n + cel(n - x, x); | ^ a.cc:14:3: error: extended character   is not valid in an identifier 14 |         ans = n + cel(n - x, x); | ^ a.cc:14:5: error: extended character   is not valid in an identifier 14 |         ans = n + cel(n - x, x); | ^ a.cc:14:7: error: extended character   is not valid in an identifier 14 |         ans = n + cel(n - x, x); | ^ a.cc:15:1: error: extended character   is not valid in an identifier 15 |         cout << ans << endl; | ^ a.cc:15:3: error: extended character   is not valid in an identifier 15 |         cout << ans << endl; | ^ a.cc:15:5: error: extended character   is not valid in an identifier 15 |         cout << ans << endl; | ^ a.cc:15:7: error: extended character   is not valid in an identifier 15 |         cout << ans << endl; | ^ a.cc:16:1: error: extended character   is not valid in an identifier 16 |     } | ^ a.cc:16:3: error: extended character   is not valid in an identifier 16 |     } | ^ a.cc: In function 'long long int cel(long long int, long long int)': a.cc:6:1: error: '\U000000a0' was not declared in this scope 6 |     if(n % x == 0) | ^ a.cc:8:2: error: expected ';' before '\U000000a0' 8 |     ans = n / x * 2 * x + cel(x, n % x); | ^~ | ; a.cc:9:2: error: expected ';' before '\U000000a0' 9 |     return ans ; | ^~ | ; a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type] 10 | } | ^ a.cc: In function 'int main()': a.cc:13:1: error: '\U000000a0' was not declared in this scope 13 |     while(cin >> n >> x) { | ^
s199595443
p04048
C++
п
a.cc:1:1: error: '\U0000043f' does not name a type 1 | п | ^
s964136884
p04048
C++
#include<bits/stdc++.h> using namespace std; using ll=long long; ll gcd(ll n,ll x){ if(!(n%x)) return n*2-x; return n/x*x*2+gcd(x,n%x); } int main(){ cin>>n>>x; cout<<gcd(n-x,x)+n<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:10: error: 'n' was not declared in this scope; did you mean 'yn'? 9 | cin>>n>>x; | ^ | yn a.cc:9:13: error: 'x' was not declared in this scope 9 | cin>>n>>x; | ^
s140376227
p04048
C++
#include<bits/stdc++.h> using namespace std; ll gcd(ll n,ll x){ if(!(n%x)) return n*2-x; return n/x*x*2+gcd(x,n%x); } int main(){ cin>>n>>x; cout<<gcd(n-x,x)+n<<endl; return 0; }
a.cc:3:1: error: 'll' does not name a type 3 | ll gcd(ll n,ll x){ | ^~ a.cc: In function 'int main()': a.cc:8:10: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | cin>>n>>x; | ^ | yn a.cc:8:13: error: 'x' was not declared in this scope 8 | cin>>n>>x; | ^
s853519552
p04048
C++
#include <iostream> using namespace std; long long int n, x; int main(){ cin>>n>>x; cout<<n+((7*x)/2) }
a.cc: In function 'int main()': a.cc:8:20: error: expected ';' before '}' token 8 | cout<<n+((7*x)/2) | ^ | ; 9 | } | ~
s789260691
p04048
C++
#include <bits/stdc++.h> using namespace std; int sum(a,b){ if(a==b){ return sum(a,b) + a; } if(a>b){ return sum(a-b,b) + 2*b; } if(a<b){ return sum(a,b-a) + 2*a; } } int main(){ int n,x; cin >> n >> x; cout << sum(x,n-x)+n << endl; }
a.cc:4:9: error: 'a' was not declared in this scope 4 | int sum(a,b){ | ^ a.cc:4:11: error: 'b' was not declared in this scope 4 | int sum(a,b){ | ^ a.cc:4:12: error: expression list treated as compound expression in initializer [-fpermissive] 4 | int sum(a,b){ | ^ a.cc: In function 'int main()': a.cc:19:14: error: 'sum' cannot be used as a function 19 | cout << sum(x,n-x)+n << endl; | ~~~^~~~~~~
s307292046
p04048
C++
#include<stdio.h> #include<iostream> int main(){ long long N,X; cin>>N>>X; cout<<(N-X)*X*X; }
a.cc: In function 'int main()': a.cc:8:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin>>N>>X; | ^~~ | std::cin In file included from a.cc:2: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:10:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 10 | cout<<(N-X)*X*X; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s936347153
p04048
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define repa(i,a,n) for(int i=(a);i<(n);i++) #define rrep(i,n) for(int i=(n)-1;i>=0;i--) #define rrepa(i,a,n) for(int i=(n)-1;i>=(a);i--) #define all(a) (a).begin(),(a).end() #define MOD 1000000007 typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; ll sol(ll a, ll b){ if(a<b)swap(a,b); if(a%b==0)return b*(2*b-1) ll t; t = a/b; return sol(b,a-b*t) + t*2*b; } int main(){ ll n,x; cin >> n >> x; // ll ans=n; // ll a=n-x,b=x; // if(a<b)swap(a,b); // ll tmp; // while(a%b != 0){ // tmp = a/b; // ans += 2*b*tmp; // a -= b*tmp; // swap(a,b); // } // ans += b*((a/b)*2-1); // cout << ans << endl; cout << sol(n-x,x) + n << endl; return 0; }
a.cc: In function 'll sol(ll, ll)': a.cc:21:31: error: expected ';' before 'll' 21 | if(a%b==0)return b*(2*b-1) | ^ | ; 22 | 23 | ll t; | ~~
s964429091
p04048
C
#include<stdio.h> int main (){ long long N=2,X=1,sum=0,y=0; scanf("%lld %lld",&N,&X); if(N-X<1){ X=N-1; } sum=N; if(N>=2*X){ if(N==2*X){ sum=X*3; }else y=X/(N-X); sum=(y+1)*y } else{ } printf("%lld\n",sum); return 0; }
main.c: In function 'main': main.c:20:16: error: expected ';' before '}' token 20 | sum=(y+1)*y | ^ | ; 21 | } | ~
s121507402
p04048
C
#include<stdio.h> int main (){ long long N=2,X=1,sum=0,y=0; scanf("%lld %lld",&N,&X); if(N-X<1){ X=N-1; } sum=N; if(N>2X){ sum+=X*2; y+=N-2*X; sum+=(X/y+1)*y; } else{ y+=X/(N-X); sum+=(y+1)*(N-X); } printf("%lld\n",sum); return 0; }
main.c: In function 'main': main.c:15:8: error: invalid suffix "X" on integer constant 15 | if(N>2X){ | ^~
s300129873
p04048
C
#include<stdio.h> int main (){ long long N=2,X=1,sum=0,y=0; scanf("%lld %lld",&N,&X); if(N-x>1){ X=N-1; } sum=N; if(N/2>X){ sum+=X*2; y+=N-2*X; sum+=(X/y+1)*y; } else{ y+=X/(N-X); sum+=(y+1)*(N-X); } printf("%lld\n",sum); return 0; }
main.c: In function 'main': main.c:9:8: error: 'x' undeclared (first use in this function) 9 | if(N-x>1){ | ^ main.c:9:8: note: each undeclared identifier is reported only once for each function it appears in
s531344144
p04048
C++
#include <bits/stdc++.h> #define st first #define nd second using namespace std; void debug_out() { cerr << endl; } template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;} template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); } template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); } template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); } template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);} #define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__) #define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0) #define dbg_ok cerr<<"OK!\n" // const long long N = ; long long n, x, ans; int main() { ios_base::sync_with_stdio(false); cin >> n >> x; ans += n; long long a = x; long long b = n - x; if(a < b) swap(a, b); while(b) { // if(a < b) swap(a, b); long long c = a % b; ans += 2 * (a / b) * b; dbg(a, b, ans); if(c == 0) ans -= bz; a = b; b = c; } // ans += b; cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:37:35: error: 'bz' was not declared in this scope; did you mean 'b'? 37 | if(c == 0) ans -= bz; | ^~ | b
s260316989
p04048
C++
#include "ccc.hpp" // http://drken1215.hatenablog.com/entry/2019/03/15/205900 // など ll calc(ll a, ll b) { if (a < b) swap(a, b); if (b == 0) return -a; // 最後2 * b * (q - 1) + bとしたい ll q = a / b; ll ret = 2 * b * q; ret += calc(b, a % b); return ret; } int main() { ll n, x; cin >> n >> x; out(n + calc(n - x, x)); }
a.cc:1:10: fatal error: ccc.hpp: No such file or directory 1 | #include "ccc.hpp" | ^~~~~~~~~ compilation terminated.
s740772027
p04048
C++
#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; //#ifndef rd #define endl '\n' //#endif #ifdef rd #define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__) template<typename Arg1> void __f(const char* name, Arg1&& arg1) { cout<<name<<" : "<<arg1<<endl; } template<typename Arg1, typename ... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma=strchr(names+1,','); cout.write(names,comma-names)<<" : "<<arg1<<" | "; __f(comma+1,args...); } #else #define trace(...) #endif #define pb push_back #define fi first #define se second #define mkp make_pair //#define int long long typedef long long ll; typedef long double f80; //#define double long double #define pii pair<int,int> #define pll pair<ll,ll> #define sz(x) ((long long)x.size()) #define fr(a,b,c) for(int a=b; a<=c; a++) #define frdec(a,b,c) for(int a=b; a>=c; a--) #define rep(a,b,c) for(int a=b; a<c; a++) #define trav(a,x) for(auto &a:x) #define all(con) con.begin(),con.end() const ll infl=2e18; const int infi=2e9; const int mod=1e9+7; typedef vector<int> vi; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset; mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); auto clk=clock(); int rng(int lim) { uniform_int_distribution<int> uid(0,lim-1); return uid(rang); } template<class t1, class t2, class t3> t1 fast_expo(t2 x, t3 p) { if(p == 0) return 1; t1 r = fast_expo(x,p/2); if(p%2 != 0) return r * r * x; return r * r; } // Code from here... void solve() { ll n ,x; cin >> n >> x; cout << ((n-2x) * (n-x) + (n + 2*x)); } signed main() { ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); srand(chrono::high_resolution_clock::now().time_since_epoch().count()); cout<<fixed<<setprecision(10); int t=1; // cin>>t; while(t--) solve(); #ifdef rd cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl; #endif return 0; }
a.cc: In function 'void solve()': a.cc:66:21: error: unable to find numeric literal operator 'operator""x' 66 | cout << ((n-2x) * (n-x) + (n + 2*x)); | ^~
s775044601
p04048
C++
#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; //#ifndef rd #define endl '\n' //#endif #ifdef rd #define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__) template<typename Arg1> void __f(const char* name, Arg1&& arg1) { cout<<name<<" : "<<arg1<<endl; } template<typename Arg1, typename ... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma=strchr(names+1,','); cout.write(names,comma-names)<<" : "<<arg1<<" | "; __f(comma+1,args...); } #else #define trace(...) #endif #define pb push_back #define fi first #define se second #define mkp make_pair //#define int long long typedef long long ll; typedef long double f80; //#define double long double #define pii pair<int,int> #define pll pair<ll,ll> #define sz(x) ((long long)x.size()) #define fr(a,b,c) for(int a=b; a<=c; a++) #define frdec(a,b,c) for(int a=b; a>=c; a--) #define rep(a,b,c) for(int a=b; a<c; a++) #define trav(a,x) for(auto &a:x) #define all(con) con.begin(),con.end() const ll infl=2e18; const int infi=2e9; const int mod=1e9+7; typedef vector<int> vi; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset; mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); auto clk=clock(); int rng(int lim) { uniform_int_distribution<int> uid(0,lim-1); return uid(rang); } template<class t1, class t2, class t3> t1 fast_expo(t2 x, t3 p) { if(p == 0) return 1; t1 r = fast_expo(x,p/2); if(p%2 != 0) return r * r * x; return r * r; } // Code from here... void solve() { ll n ,x; cin >> n >> x; cout << ((n-2x) * (n-x) + (n + 2x)); } signed main() { ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); srand(chrono::high_resolution_clock::now().time_since_epoch().count()); cout<<fixed<<setprecision(10); int t=1; // cin>>t; while(t--) solve(); #ifdef rd cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl; #endif return 0; }
a.cc: In function 'void solve()': a.cc:66:21: error: unable to find numeric literal operator 'operator""x' 66 | cout << ((n-2x) * (n-x) + (n + 2x)); | ^~ a.cc:66:40: error: unable to find numeric literal operator 'operator""x' 66 | cout << ((n-2x) * (n-x) + (n + 2x)); | ^~
s116036387
p04048
C++
#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; //#ifndef rd #define endl '\n' //#endif #ifdef rd #define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__) template<typename Arg1> void __f(const char* name, Arg1&& arg1) { cout<<name<<" : "<<arg1<<endl; } template<typename Arg1, typename ... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma=strchr(names+1,','); cout.write(names,comma-names)<<" : "<<arg1<<" | "; __f(comma+1,args...); } #else #define trace(...) #endif #define pb push_back #define fi first #define se second #define mkp make_pair //#define int long long typedef long long ll; typedef long double f80; //#define double long double #define pii pair<int,int> #define pll pair<ll,ll> #define sz(x) ((long long)x.size()) #define fr(a,b,c) for(int a=b; a<=c; a++) #define frdec(a,b,c) for(int a=b; a>=c; a--) #define rep(a,b,c) for(int a=b; a<c; a++) #define trav(a,x) for(auto &a:x) #define all(con) con.begin(),con.end() const ll infl=2e18; const int infi=2e9; const int mod=1e9+7; typedef vector<int> vi; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset; mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); auto clk=clock(); int rng(int lim) { uniform_int_distribution<int> uid(0,lim-1); return uid(rang); } template<class t1, class t2, class t3> t1 fast_expo(t2 x, t3 p) { if(p == 0) return 1; t1 r = fast_expo(x,p/2); if(p%2 != 0) return r * r * x; return r * r; } // Code from here... void solve() { ll n ,x; cin >> n >> x; cout << (n-2x) * (n-x) + (n + 2x); } signed main() { ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); srand(chrono::high_resolution_clock::now().time_since_epoch().count()); cout<<fixed<<setprecision(10); int t=1; // cin>>t; while(t--) solve(); #ifdef rd cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl; #endif return 0; }
a.cc: In function 'void solve()': a.cc:66:20: error: unable to find numeric literal operator 'operator""x' 66 | cout << (n-2x) * (n-x) + (n + 2x); | ^~ a.cc:66:39: error: unable to find numeric literal operator 'operator""x' 66 | cout << (n-2x) * (n-x) + (n + 2x); | ^~
s263221544
p04048
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) 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; if(a<b) swap(a,b); int c,d=1; while(d){ c=a%b; if(c==0){ int f=a; d--; } else{ a=b; b=c; } } return d*e/f; } signed main(){ int a,b; cin>>a>>b; cout<<3*a<<endl; }
a.cc: In function 'long long int lcm(long long int, long long int)': a.cc:24:9: error: redeclaration of 'long long int d' 24 | int c,d=1; | ^ a.cc:21:7: note: 'long long int d' previously declared here 21 | int d=a,e=b; | ^ a.cc:36:14: error: 'f' was not declared in this scope 36 | return d*e/f; | ^
s902424019
p04048
Java
import java.util.*; public class Main { static Scanner scanner = new Scanner(System.in); public static void main(String[]$) { long n = scanner.nextLong(); long x = scanner.nextLong(); long y = n - x; long ans = n; while (x != 0 && y != 0) { Utils.println(x, y, ans); if (x > y) { ans += x / y * y * 2; x %= y; } else { ans += y / x * x * 2; y %= x; } } System.out.println(ans - x - y); } }
Main.java:12: error: cannot find symbol Utils.println(x, y, ans); ^ symbol: variable Utils location: class Main 1 error
s713480602
p04048
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) int para(int a,int b){ else if(a%b==0)return b*(a/b*2-1); else return 2*b+para(b,a%b); } signed main(){ int n,x;cin>>n>>x; int ret=0; ret=n+para(max(x,n-x),min(x,n-x)); cout<<ret<<endl; }
a.cc: In function 'long long int para(long long int, long long int)': a.cc:7:9: error: 'else' without a previous 'if' 7 | else if(a%b==0)return b*(a/b*2-1); | ^~~~
s699317087
p04048
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) int para(int a,int b){ int ret=0; if(a%b==0)return 2*a-b; else return para(a/b*b,b)+para(b,a%b); } signed main(){ int n,x;cin>>n>>x; int ret=0 ret=n+para(max(x,n-x),min(x,n-x)); cout<<ret<<endl; }
a.cc: In function 'int main()': a.cc:16:9: error: expected ',' or ';' before 'ret' 16 | ret=n+para(max(x,n-x),min(x,n-x)); | ^~~
s444312290
p04048
C
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> long long getgcd(long long N,long long X); int main(void){ long long N,X; long long buf; long long buf2 long long cur; scanf("%lld %lld",&N,&X); buf=getgcd(N,X); buf2=N-buf; printf("%lld\n",3*buf2); } long long getgcd(long long N,long long X) { long long i; long long num; for (i=1;i<(long long)(sqrt(N)+1);i++){ if((fmodl(N,i)==0)&&(fmodl(X,i)==0)){ num=i; } } return num; }
main.c: In function 'main': main.c:11:19: error: expected ';' before 'long' 11 | long long buf2 | ^ | ; 12 | long long cur; | ~~~~ main.c:15:5: error: 'buf2' undeclared (first use in this function); did you mean 'buf'? 15 | buf2=N-buf; | ^~~~ | buf main.c:15:5: note: each undeclared identifier is reported only once for each function it appears in
s511610451
p04048
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define reps(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) reps(i,0,n) #define all(x) (x).begin(),(x).end() #define INF (1000000010) #define MOD (1000000007) #define PI (acos(-1)) #define int ll int ans; void rec(int x,int y){ if(y%x==0){ ans += 2*y-x; }else{ ans += 2*x*(y/x); rec(y%x,x); } } int main(){ int n,x; cin >> n >> x; ans = n; rec(min(x,n-x),max(x,n-x)); cout << ans << endl; }
a.cc:11:13: error: '::main' must return 'int' 11 | #define int ll | ^~ a.cc:23:1: note: in expansion of macro 'int' 23 | int main(){ | ^~~
s642038954
p04048
C++
#include<iostream> using namespace std; int main(){ int gcd(int a,int b){ if(a%b==0) return(b); else return(gcd(b,a%b)); } int N,K; cin>>N>>K; cout<<((N%gcd(N,K))*3-3)*gcd(N,K)<<endl; }
a.cc: In function 'int main()': a.cc:5:23: error: a function-definition is not allowed here before '{' token 5 | int gcd(int a,int b){ | ^ a.cc:12:13: error: 'gcd' was not declared in this scope 12 | cout<<((N%gcd(N,K))*3-3)*gcd(N,K)<<endl; | ^~~
s891640031
p04048
C++
#include <bits/stdc++.h> using namespace syd; typedef long long ll; int main(){ ll n,x; cin >> n >> x; ll ans = 0; ans = 3*(n-1); cout << ans << endl; }
a.cc:2:17: error: 'syd' is not a namespace-name 2 | using namespace syd; | ^~~ a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin >> n >> x; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:9:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout << ans << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:9:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout << ans << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s920845453
p04048
C++
#include <iostream> #include <algorithm> using namespace std; int main(void) { int N, X; cin >> N >> X; int ans = N; int a = max(N - X, X); int b = min(N - X, X); int q; while(b) { q = a % b; ans += (a - q) * 2; a = b; b = q; } ans -= a; cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:23:18: error: expected '}' at end of input 23 | return 0; | ^ a.cc:7:1: note: to match this '{' 7 | { | ^
s402334230
p04048
C
#include<stdio.h> long gcd2(long a, long b){ long t; if(a<b){ t = a; a = b; b = t; } r = a % b; while(r!=0){ a = b; b = r; r = a % b; } return b; } int n, x; int main(void){ scanf("%ld%ld"); printf("%ld\n", (n-*gcd2(n,x))*3); }
main.c: In function 'gcd2': main.c:9:9: error: 'r' undeclared (first use in this function) 9 | r = a % b; | ^ main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in main.c: In function 'main': main.c:20:22: error: invalid type argument of unary '*' (have 'long int') 20 | printf("%ld\n", (n-*gcd2(n,x))*3); | ^~~~~~~~~~
s713734130
p04048
C++
#include <bits/stdc++.h> using namespace std; long long int gcm(long long a,long long b){ long long r,tmp; if(a<b){ tmp=a; a=b; b=tmp; } r=a%b; while(r!=0){ a=b; b=r; r=a%b; } return b; } int main(){ long long N,X,ans; cin >> N >> X; if(X>N/2)X=N-X; long long g=gcm(N,X); N/=g;X/=g; ans=((N-X)/X)*3*X; if(N-X)%X>0)ans+=3*X; ans*=g; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:16: error: expected primary-expression before '%' token 30 | if(N-X)%X>0)ans+=3*X; | ^
s631613929
p04048
C++
#include<algorithm> #include<iostream> using namespace std; long test(long nokori, long now, long sum){ long count_node,tmp = 0; if(nokori % now != 0){ count_node = nokori / now; count_node = count_node * 2; sum = sum + now * count_node; tmp = nokori; nokori = now; now = tmp % now; }else if(nokori % now == 0){ count_node = nokori / now; count_node = count_node * 2 - 1; count_node = count_node * now; sum = sum + count_node; now = 0; } if(now != 0){ test(nokori, now, sum); } return sum; } int main(){ long x,n; cin >> n >> x; long sum,now,nokori = 0; nokori = n - x; sum = n; now = x; sum = test(nokori, now ,sum); cout << sum << "\n"; return 0; } ~
a.cc:37:2: error: expected class-name at end of input 37 | ~ | ^
s546431374
p04048
C++
/* , \ / , / \ )\__/( / \ / \ (_\ /_) / \ ____/_____\__\@ @/___/_____\____ | |\../| | | \VV/ | | ------hoi------- | |_________________________________| | /\ / \\ \ /\ | | / V )) V \ | |/ ` // ' \| ` V ' */ #include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define pb push_back #define f first #define se second #define mp make_pair #define Speedforce boost(); using namespace std; void boost(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const int N = 1e6; const int inf = 1e9 + 7; ll n, x, ans; ll rec(ll a, ll b){ if(b % a == 0){ return 2 * b - a; } return rec(b % a, a) + b / a * a * 2 } int main() { Speedforce cin >> n >> x; cout << rec(x, n); }
a.cc: In function 'long long int rec(long long int, long long int)': a.cc:43:41: error: expected ';' before '}' token 43 | return rec(b % a, a) + b / a * a * 2 | ^ | ; 44 | } | ~
s122994048
p04048
C++
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define pf push_front #define pbp pop_back #define pfp pop_front #define sz(x) x.size() #define all(x) x.begin(),x.end() #define ios_base ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define open(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout) #define F first #define S second using namespace std; typedef unsigned long long ul; typedef long long ll; typedef long double ld; const int mod = 1e9+7; const int N = 1e5+123; const int inf = 1e9+123; const long long INF = 1e18; const double eps = 1e-5; ll n, x, ans; void rec(ll a, ll b){ if(b % a == 0){ ans += b/a * (2*a) - a; return ; }else{ ans += b/a * (2*a); rec(b % a, a); } } int main (){ cin >> n >> x; rec(x, n-x); cout << ans + n;
a.cc: In function 'int main()': a.cc:41:18: error: expected '}' at end of input 41 | cout << ans + n; | ^ a.cc:38:12: note: to match this '{' 38 | int main (){ | ^
s398712140
p04048
C++
value = input() values = value.split() N = int( values[0] ) X = int( values[1] ) shorter = min([X,N-X]) longer = max([X,N-X]) length = 0 while shorter>0 and longer >0 : length = int(longer/shorter)*3*shorter sho = longer/shorter amari = longer%shorter longer = shorter shorter = amari print(length)
a.cc:1:1: error: 'value' does not name a type 1 | value = input() | ^~~~~
s378488676
p04048
C++
value = input() values = value.split() value = input() values = value.split() N = int( values[0] ) X = int( values[1] ) shorter = min([X,N-X]) longer = max([X,N-X]) length = 0 while shorter>0 and longer >0 : length = int(longer/shorter)*3*shorter sho = longer/shorter amari = longer%shorter longer = shorter shorter = amari print(length)
a.cc:1:1: error: 'value' does not name a type 1 | value = input() | ^~~~~
s786017996
p04048
C++
#include <bits/stdc++.h> #include <unordered_set> using namespace std; #define ll long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++) #define revrep(i,n) for(int (i)=(n)-1;i>=0; i--) ll f(ll a, ll b) { a=min(a,b); b = max(a,b); if(a==b) return a; // return 2*aa+f(aa,bb-aa); if(bb%aa!=0) return 2*(bb/aa)*aa+f(aa,bb%aa); return 2*aa+f(aa,bb-aa); } int main() { cin.tie(0); ios::sync_with_stdio(false); cout<<setprecision(std::numeric_limits<float>::max_digits10); ll n,x; cin>>n>>x; cout << n + f(n-x,x) << endl; return 0; }
a.cc: In function 'long long int f(long long int, long long int)': a.cc:15:6: error: 'bb' was not declared in this scope; did you mean 'b'? 15 | if(bb%aa!=0) | ^~ | b a.cc:15:9: error: 'aa' was not declared in this scope; did you mean 'a'? 15 | if(bb%aa!=0) | ^~ | a a.cc:17:12: error: 'aa' was not declared in this scope; did you mean 'a'? 17 | return 2*aa+f(aa,bb-aa); | ^~ | a a.cc:17:20: error: 'bb' was not declared in this scope; did you mean 'b'? 17 | return 2*aa+f(aa,bb-aa); | ^~ | b
s882687807
p04048
C++
n,x=map(int,input().split()) print(x+(n-x)+x+x+(n/2)*3)
a.cc:1:1: error: 'n' does not name a type 1 | n,x=map(int,input().split()) | ^
s408503815
p04048
C++
/****Author: Barish Namazov****/ #include <bits/stdc++.h> using namespace std; /***TEMPLATE***/ #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define endl '\n' const int max4 = 10004; const int maxx = 100005; const int max6 = 1000006; const int lg5 = 17; const int INF = 2 * 1000000007; const long long INFLL = 4LL * 1000000000 * 1000000000; /***************/ int powmod (int a, int b, int mod) { int res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1) { res = 1LL * res * a % mod; } a = 1LL * a * a % mod; } return res; } int gcd (int a, int b) { while (b > 0) { int t = a % b; a = b, b = t; } return a; } int lcm (int a, int b) { return (a / gcd (a, b)) * b; } int is_prime (int n) { if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0)) return 0; for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t) if (n % i == 0) return 0; return 1; } /******Don't forget to use long long when needed!!******/ int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); ios_base :: sync_with_stdio(0); cin.tie(0), cout.tie(0); long long n, k; cin >> n >> k; cout << 2 * (n - 1) + 2 * x << endl; return 0; }
a.cc: In function 'int main()': a.cc:67:31: error: 'x' was not declared in this scope 67 | cout << 2 * (n - 1) + 2 * x << endl; | ^
s861972918
p04048
C++
#include <bits/stdc++.h> using namespace std ; int main() { long long n , x ; cin>>n>>x ; return cout<<3ll * (n - __gcd(n , x) , 0 ; }
a.cc: In function 'int main()': a.cc:9:45: error: expected ')' before ';' token 9 | return cout<<3ll * (n - __gcd(n , x) , 0 ; | ~ ^~ | ) a.cc:9:16: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' in return 9 | return cout<<3ll * (n - __gcd(n , x) , 0 ; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
s228360699
p04048
C++
#include<bits/stdc++.h> using namespace std; #define LINE 8 #define st 1 #define YOKO 17 int main(){ long long N,X; cin>>N>>x; if(X==N/2){ cout<<3*X; }else if(X>=N/2){ cout<<3/2*X+N; }else{ cout<<(X+N)*X/(N-X)+N; } return 0; }
a.cc: In function 'int main()': a.cc:8:13: error: 'x' was not declared in this scope 8 | cin>>N>>x; | ^
s055189047
p04048
C++
#include <iostream> using namespace std; using llong = long long; llong length(llong K,llong X,llong L){ return (K==X)?(K:((K<X)?length(K,X-K,L+2*K):length(K-X,X,L+2*X))); // if( K == X ){ // return K; // }else if( K < X ){ // return 2*K + length( K , X - K ); // }else{ // return 2*X + length( K - X , X ); // } } int main(){ llong N , X; cin >> N >> X; cout << N + length( N - X , X ) << endl; }
a.cc: In function 'llong length(llong, llong, llong)': a.cc:7:19: error: expected ')' before ':' token 7 | return (K==X)?(K:((K<X)?length(K,X-K,L+2*K):length(K-X,X,L+2*X))); | ~ ^ | ) a.cc:7:68: error: expected ':' before ';' token 7 | return (K==X)?(K:((K<X)?length(K,X-K,L+2*K):length(K-X,X,L+2*X))); | ^ | : a.cc:7:68: error: expected primary-expression before ';' token a.cc: In function 'int main()': a.cc:20:21: error: too few arguments to function 'llong length(llong, llong, llong)' 20 | cout << N + length( N - X , X ) << endl; | ~~~~~~^~~~~~~~~~~~~ a.cc:6:7: note: declared here 6 | llong length(llong K,llong X,llong L){ | ^~~~~~
s840543005
p04048
C++
#include<bits/stdc++.h> using namespace std; int main() { long long n,x; cin>>n>>x; long long t=x,sum=n; x=min(t,n-t); long long y=max(t,n-t); while(x>=1) { if(y%x==0) { sum+=(y/x)*2*x; sum-=x; break; } else{ sum+=(y/x)*2*x; LL te=x; x=y%x; y=te; } } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:21:16: error: 'LL' was not declared in this scope 21 | LL te=x; | ^~ a.cc:23:18: error: 'te' was not declared in this scope; did you mean 't'? 23 | y=te; | ^~ | t
s054355093
p04048
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long n, x; cin>>x>>y; long long ans=4*x+4*(n-2*x); cout<<-1*ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'y' was not declared in this scope 5 | cin>>x>>y; | ^
s301746569
p04048
C++
#include <bits/stdc++.h> using namespace std; lint N, X; int main() { cin >> N >> X; lint gcd = __gcd(N, X); cout << gcd * (N / gcd - 1) * 3 << endl; }
a.cc:4:1: error: 'lint' does not name a type; did you mean 'uint'? 4 | lint N, X; | ^~~~ | uint a.cc: In function 'int main()': a.cc:8:12: error: 'N' was not declared in this scope 8 | cin >> N >> X; | ^ a.cc:8:17: error: 'X' was not declared in this scope 8 | cin >> N >> X; | ^ a.cc:9:5: error: 'lint' was not declared in this scope; did you mean 'uint'? 9 | lint gcd = __gcd(N, X); | ^~~~ | uint
s110857030
p04048
C++
#include <stdio.h> int main() { int N, X; scanf("%d", &N); scanf("%d", &X); if(N % 2 == 0) { //even int n = N / 2; printf("%d", 3 * n + abs(X - n) * 3); } else { //odd; int n = N / 2; printf("%d", n * 6); } return 0; }
a.cc: In function 'int main()': a.cc:13:30: error: 'abs' was not declared in this scope 13 | printf("%d", 3 * n + abs(X - n) * 3); | ^~~
s421847077
p04048
C
#include<stdio.h> int gcd(int n, int x){ int z=1; for(int i=1;i<x+1;i++){ if(((n%i)==0)&&((x%i)==0)) z=i; return z; } int main(void){ int n, x; scanf("%d%d", &n, &x); //三角形の辺の長さと始点の入力 int leng; leng = 3*(n-gcd(n, x)); printf("%d\n", leng); return 0; }
main.c: In function 'gcd': main.c:16:1: error: expected declaration or statement at end of input 16 | } | ^