submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s484974807
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],intN){ int sw=0; bool flag=1; for(inti=0;flag;i++){ flag=0; for(intj=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>N; for(int i=0;i<N;i++)cin>>A[i...
a.cc:4:24: error: 'intN' has not been declared 4 | int bubbleSort(int A[],intN){ | ^~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:6: error: 'inti' was not declared in this scope; did you mean 'int'? 7 | for(inti=0;flag;i++){ | ^~~~ | int a.cc:7:18:...
s119338896
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],intN){ int sw=0; bool flag=1; for(inti=0;flag;i++){ flag=0; for(intj=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>N; for(inti=0;i<N;i++)cin>>A[i]...
a.cc:4:24: error: 'intN' has not been declared 4 | int bubbleSort(int A[],intN){ | ^~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:6: error: 'inti' was not declared in this scope; did you mean 'int'? 7 | for(inti=0;flag;i++){ | ^~~~ | int a.cc:7:18:...
s566732931
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],intN){ int sw=0; bool flag=1; for(inti=0;flag;i++){ flag=0; for(intj=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>N; for(inti=0;i<N;i++)cin>>A[i]...
a.cc:4:24: error: 'intN' has not been declared 4 | int bubbleSort(int A[],intN){ | ^~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:6: error: 'inti' was not declared in this scope; did you mean 'int'? 7 | for(inti=0;flag;i++){ | ^~~~ | int a.cc:7:18:...
s437698746
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],intN){ int sw=0; bool flag=1; for(inti=0;flag;i++){ flag=0; for(intj=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>N; for(inti=0;i<N;i++)cin>>A[i]...
a.cc:4:24: error: 'intN' has not been declared 4 | int bubbleSort(int A[],intN){ | ^~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:6: error: 'inti' was not declared in this scope; did you mean 'int'? 7 | for(inti=0;flag;i++){ | ^~~~ | int a.cc:7:18:...
s863420832
p02259
C++
#include<iostream> using namespace std; void print(int a[],int n) { for(int i=0;i<n;i++) { cout<<a[i]; if(i!=n-1) cout<<" "; } cout<<endl; } int main() { int n,i,j,v=0; int a[100]; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } ...
a.cc: In function 'int main()': a.cc:32:17: error: 'temp' was not declared in this scope; did you mean 'tm'? 32 | temp = A[j]; | ^~~~ | tm a.cc:32:24: error: 'A' was not declared in this scope 32 | temp = A[j]; | ...
s882468009
p02259
C++
#include<iostream> using namespace std; void print(int a[],int n) { for(int i=0;i<n;i++) { cout<<a[i]; if(i!=n-1) cout<<" "; } cout<<endl; } int main() { int n,i,j,v=0,temp; int a[100]; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; ...
a.cc: In function 'int main()': a.cc:32:24: error: 'A' was not declared in this scope 32 | temp = A[j]; | ^
s074132784
p02259
C++
#include<iostream> using namespace std; void print(int a[],int n) { for(int i=0;i<n;i++) { cout<<a[i]; if(i!=n-1) cout<<" "; } cout<<endl; } int main() { int n,i,j,v=0; int a[100]; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } ...
a.cc: In function 'int main()': a.cc:32:17: error: 'temp' was not declared in this scope; did you mean 'tm'? 32 | temp = a[j]; | ^~~~ | tm
s906214964
p02259
C++
#include<iostream> using namespace std; /*void print(int a[],int n) { for(int i=0;i<n;i++) { cout<<a[i]; if(i!=n-1) cout<<" "; } cout<<endl; } */ int main() { int n,i,j,v=0,temp; int a[100]; cin>>n; for(i=0;i<n;i++) { cin>>a[i...
a.cc: In function 'int main()': a.cc:32:24: error: 'A' was not declared in this scope 32 | temp = A[j]; | ^ a.cc:41:15: error: 'N' was not declared in this scope 41 | for(i =0;i<N;i++){ | ^ a.cc:43:15: error: 'A' was not declared in this scope ...
s529464856
p02259
C++
#include <iostream> #include <utility> #define MAX_N 100 void bubble_sort(int*,int); int A[MAX_N]; int count = 0; void solve(){ int n; scanf("%d",&n); for(int i = 0; i < n; i++){ scanf("%d",&A[i]); } bubble_sort(A,n); for(int i = 0; i < n; i++){ printf("%d ",A[i]); } ...
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s889385414
p02259
C++
#include <iostream> using namespace std; int bubbleSort(int A[],int N) { int sw = 0; // ???????????° 0??§????????? bool flag = 1; while(int i=0; flag; i++) { flag = 0; for(int j=N-1;j>=i+1;j--) { if(A[j]<A[j-1]) { swap(A[j],A[j-1]); flag = 1; sw++; } } } return sw; } int main(void) { int...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:22: error: expected ')' before ';' token 7 | while(int i=0; flag; i++) { | ~ ^ | ) a.cc:7:30: error: 'i' was not declared in this scope 7 | while(int i=0; flag; i++) { | ...
s121775543
p02259
C++
#include <iostream> using namespace std; int bubbleSort(int A[],int N) { int sw = 0; bool flag = 1; while(int i=0; flag; i++) { flag = 0; for(int j=N-1;j>=i+1;j--) { if(A[j]<A[j-1]) { swap(A[j],A[j-1]); flag = 1; sw++; } } } return sw; } int main(void) { int A[100], N, sw; cin >> N; fo...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:22: error: expected ')' before ';' token 7 | while(int i=0; flag; i++) { | ~ ^ | ) a.cc:7:30: error: 'i' was not declared in this scope 7 | while(int i=0; flag; i++) { | ...
s053050566
p02259
C++
int bubbleSort(int A[], int N) { int flag, j, num; flag = 1; num = 0; while ( flag ) { flag = 0; for ( j = N - 1; j >= 1; j-- ) { if ( A[j] < A[j - 1]) { int v = A[j]; A[j] = A[j - 1]; A[j - 1] = v; num++; flag = 1; } } } return num; } int mai...
a.cc: In function 'int main()': a.cc:24:3: error: 'scanf' was not declared in this scope 24 | scanf("%d", &N); | ^~~~~ a.cc:28:29: error: 'printf' was not declared in this scope 28 | for ( i = 0; i < N; i++ ) printf("%d", A[i]); | ^~~~~~ a.cc:1:1: note: 'printf' is de...
s222651223
p02259
C++
int bubbleSort(int A[], int N) { int flag, j, num; flag = 1; num = 0; while ( flag ) { flag = 0; for ( j = N - 1; j >= 1; j-- ) { if ( A[j] < A[j - 1]) { int v = A[j]; A[j] = A[j - 1]; A[j - 1] = v; num++; flag = 1; } } } return num; } int mai...
a.cc: In function 'int main()': a.cc:24:3: error: 'scanf' was not declared in this scope 24 | scanf("%d", &N); | ^~~~~ a.cc:28:29: error: 'printf' was not declared in this scope 28 | for ( i = 0; i < N; i++ ) printf("%d", A[i]); | ^~~~~~ a.cc:1:1: note: 'printf' is de...
s737358958
p02259
C++
#include <iostream> using namespace std; int main() { int N, count=0; const int MAX_N = 100; int a[MAX_N]; cin >> N; for(int i=0; i<N; i++){ cin >> a[i]; } int tmp; for(int i=0; i<N-1; i++){ for(int j=N-1; j>=i+1; j--){ if(a[j-1]>a[j]){ ...
a.cc:50:12: error: extended character ± is not valid in an identifier 50 | ???????????±????????????????????? | ^ a.cc:51:6: error: stray '#' in program 51 | Case # Verdict CPU Time Memory In Out Case Name | ^ a.cc:52:7: error: stray '#' in program 52 | Case #1: : Accepted 00.00 se...
s207283013
p02259
C++
#include <cstdio> #include <iostream> using namespace std; const int N = 1000; int BubbleSort(int a[], int n) { int ans = 0; bool flag = 1; while (flag) { flag = 0; for (int j = n - 1; j >= i+1; j--) { if (a[j] < a[j - 1]) { swap(a[j], a[j - 1]); ans++; flag = 1; } } } return ans; } ...
a.cc: In function 'int BubbleSort(int*, int)': a.cc:13:42: error: 'i' was not declared in this scope 13 | for (int j = n - 1; j >= i+1; j--) | ^
s828087754
p02259
C++
#include <iostream> using namespace std; //bubble sort int main() { int n, tmp; int a[100]; int count = 0; int flag = 1; cin >> n; for(int i=0; i<n; i++) { cin >> a[i] } while (flag) { flag = 0; for (int j=n-1; j>=1; j--){ if (a[j] < a[j-1]) {...
a.cc: In function 'int main()': a.cc:17:20: error: expected ';' before '}' token 17 | cin >> a[i] | ^ | ; 18 | 19 | } | ~
s260032115
p02259
C++
#include<iostream> #include<algorithm> static const int N = 100000; using namespace std; int a[N]; int main() { int n; cin>>n; for (int i =0;i<n;i++){ cin>> a[i]; } int cnt; int flag; for (int i=0;i<n;i++){ for (int j=i;j>0;j--){ flag = 0; if (a[j]<a[j-1]){ ...
a.cc: In function 'int main()': a.cc:30:13: error: 'j' was not declared in this scope 30 | if (a[j]<a[j-1]){ | ^
s678172027
p02259
C++
#include<iostream> #include<algorithm> static const int N = 100000; using namespace std; int a[N]; int main() { int n; cin>>n; for (int i =0;i<n;i++){ cin>> a[i]; } int cnt; int flag; for (int i=0;i<n;i++){ for (int j=i;j>0;j--){ flag = 0; if (a[j]<a[j-1]){ ...
a.cc: In function 'int main()': a.cc:28:16: error: 'i' was not declared in this scope 28 | for (int j=0;i<n;i++){ | ^
s512090422
p02259
C++
#include <stdio.h> #include <iostream> using namespace std; int main(void) { int n, a[100]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int num = sort(a, n); for (int i = 0; i < n; i++) { cout << a[i]; if (i < n - 1) cout << " "; else cout << endl; } cout << num << endl; return 0; } int so...
a.cc: In function 'int main()': a.cc:11:19: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | int num = sort(a, n); | ^~~~ | short a.cc: In function 'int sort(int*, int)': a.cc:28:22: error: 'j' was not declared in this scope 28 | ...
s182431238
p02259
C++
#include <stdio.h> #include <iostream> using namespace std; int sort(int a[], int n); int main(void) { int n, a[100]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int num = sort(a, n); for (int i = 0; i < n; i++) { cout << a[i]; if (i < n - 1) cout << " "; else cout << endl; } cout << num << e...
a.cc: In function 'int sort(int*, int)': a.cc:30:22: error: 'j' was not declared in this scope 30 | for (j = n - 1; j >= 1; j--) { | ^
s039133851
p02259
C++
#include <stdio.h> #include <iostream> using namespace std; inline void swap(int *a, int *b); int sort(int a[], int n); int main(void) { int n; cin >> n; a = new int[n]; for (int i = 0; i < n; i++) cin >> a[i]; int num = sort(a, n); for (int i = 0; i < n; i++) { cout << a[i]; if (i < n - 1) cout << " "...
a.cc: In function 'int main()': a.cc:12:9: error: 'a' was not declared in this scope 12 | a = new int[n]; | ^ a.cc:24:9: error: type '<type error>' argument given to 'delete', expected pointer 24 | delete[] a; | ^~~~~~~~~~
s451787684
p02259
C++
#include<iostream> #include<algorithm> using namespace std; int partition(int A[],int p,int r){ int x=A[r]; int i=p-1; for(int j=p;j<=r-1;j++){ if(A[j]<=x){ i++; swap(A[i],A[j]); } } swap(A[i+1],A[r]); return i+1; } int main(){ int n; cin>>n; Card A[100000]; for(int i=0;i<n;i++){ cin>>A[i...
a.cc: In function 'int main()': a.cc:25:9: error: 'Card' was not declared in this scope 25 | Card A[100000]; | ^~~~ a.cc:27:22: error: 'A' was not declared in this scope 27 | cin>>A[i]; | ^ a.cc:30:25: error: 'A' was not declared in this scope 30...
s092451006
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],int N){ int sw=0; bool flag=1; for(int i=0;flag;i++){ flag=0; for(int j=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin >>N; for(i=0;i<N;i++) cin >>A[i]; sw=bubbleSort(A,N); for(int i=0...
a.cc: In function 'int main()': a.cc:22:5: error: 'i' was not declared in this scope 22 | for(i=0;i<N;i++) cin >>A[i]; | ^
s813043048
p02259
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,count = 0; cin >> n; vector <int> a(n) for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < n; i++){ for(int j = n; j > i; j--){ if(a[j] < a[j-1]){ int b = a[j]; ...
a.cc: In function 'int main()': a.cc:9:5: error: expected ',' or ';' before 'for' 9 | for(int i = 0; i < n; i++){ | ^~~ a.cc:9:20: error: 'i' was not declared in this scope 9 | for(int i = 0; i < n; i++){ | ^ a.cc:18:24: error: expected ';' before '}' token 18 | ...
s225328874
p02259
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,count = 0; cin >> n; vector <int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < n; i++){ for(int j = n; j > i; j--){ if(a[j] < a[j-1]){ int b = a[j]; ...
a.cc: In function 'int main()': a.cc:18:24: error: expected ';' before '}' token 18 | count++ | ^ | ; 19 | } | ~
s290043809
p02259
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,count = 0,b; cin >> n; vector <int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < n; i++){ for(int j = n; j > i; j--){ if(a[j] < a[j-1]){ b = a[j]; ...
a.cc: In function 'int main()': a.cc:18:24: error: expected ';' before '}' token 18 | count++ | ^ | ; 19 | } | ~
s077186828
p02259
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,h,count=0; cin >> n; int a[n]; for(int i=0;i<n;i++) { cin >> a[i]; } for(int i=0;i<n;i++){ for(int j=n;j>i;j--){ if(a[j] < a[j-1]){ h = a[j]; a[j] = a[j-1]; a[j-1] =...
a.cc: In function 'int main()': a.cc:29:15: error: 'N' was not declared in this scope 29 | if(i != N)cout << " "; | ^
s314044603
p02259
C++
#include <iostream> #include <vector> using namespace std; using std::vector; #define MAX_N 100 void print(vector<int>& A, int N) { for (int i = 0; i < N - 1; i++) cout << A[i] << " "; cout << A[N-1] << endl; } int bubbleSort(vector<int>& A, int N) { int sw = 0; bool flag = true; for (int i = 0; flag;...
a.cc: In function 'int bubbleSort(std::vector<int>&, int)': a.cc:20:39: error: 'aA' was not declared in this scope; did you mean 'A'? 20 | for (int j = N - 1; j >= 1; j--) {aA | ^~ | A
s490425668
p02259
C++
#include<iostream> #include<algorithm> using namespace std; static const int MAX=200000; int mian() { int n,R[MAX]; cin>>n; for(int i=0;i<n;i++) cin>>R[i]; int maxv=-2000000000; int minv=2000000000; for(int i=0;i,n;i++) { maxv=max(maxv,R[i]-minv); minv=min(minv,R[i]); } cout<<maxv<<endl; return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s735584529
p02259
C++
#include <iostream> #include <fstream> #include <vector> using namespace std; void print_vector(vector<int>& v) { for (vector<int>::iterator it = v.begin(); it != v.end(); it++) { std::cout << *it << " "; } std::cout << endl; } int main() { #ifdef LOCAL // ??\??? cin ?????\????????? 'xxx.t...
a.cc: In function 'int main()': a.cc:52:23: error: expected ';' before 'return' 52 | cout << change_num | ^ | ; 53 | return 0; | ~~~~~~
s044285539
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:17: error: need 'typename' before 'std::__cxx11::list<T>::iterator' because 'std::__cxx11::list<T>' is a dependent scope 39 | list<T>::iterator it1 = arr.begin(), it2 = arr.begin(); | ^~~~~~~ a.cc:39:34: er...
s371971256
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:17: error: need 'typename' before 'std::__cxx11::list<T>::iterator' because 'std::__cxx11::list<T>' is a dependent scope 39 | list<T>::iterator it1 = arr.begin(), it2 = arr.begin(); | ^~~~~~~ a.cc:39:34: er...
s223331373
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:17: error: need 'typename' before 'std::__cxx11::list<T>::iterator' because 'std::__cxx11::list<T>' is a dependent scope 39 | list<T>::iterator it1 = arr.begin(), it2 = arr.begin(); | ^~~~~~~ a.cc:39:34: er...
s595976743
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:17: error: need 'typename' before 'std::__cxx11::list<T>::iterator' because 'std::__cxx11::list<T>' is a dependent scope 39 | list<T>::iterator it1 = arr.begin(), it2 = arr.begin(); | ^~~~~~~ a.cc:39:34: er...
s201474429
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:17: error: need 'typename' before 'std::__cxx11::list<T>::iterator' because 'std::__cxx11::list<T>' is a dependent scope 39 | list<T>::iterator it1 = arr.begin(), it2 = arr.begin(); | ^~~~~~~ a.cc:39:34: er...
s805847860
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:17: error: a template declaration cannot appear at block scope 39 | template<typename T> | ^~~~~~~~ a.cc:43:53: error: 'it1' was not declared in this scope 43 | for (int i = 1; i < n; ++i...
s154278589
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int bubbleSort(std::__cxx11::list<T>&, int)': a.cc:39:32: error: template argument 1 is invalid 39 | list<typename T>::iterator it1 = arr.begin(), it2 = arr.begin(); | ^ a.cc:39:32: error: template argument 2 is invalid a.cc:39:44: error: qualif...
s507352202
p02259
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; #define A struct card { card(const card&a) { mark = a.mark; num = a.num; } card(const char* str) { *this = str; } card() {} char mark; int num; void operator = (const char * str) { mark = str[0]; num = str[1] - 0x30; } ...
a.cc: In function 'int selectionSort(std::__cxx11::list<T>&, int)': a.cc:58:9: error: need 'typename' before 'std::__cxx11::list<T>::iterator' because 'std::__cxx11::list<T>' is a dependent scope 58 | list<T>::iterator it1, it2, min, itend = arr.end(); | ^~~~~~~ a.cc:58:26: error: expected ';' ...
s834595458
p02259
C++
#include <iostream> const int MAX = 110; int count = 0; void bubble_sort(int a[], int n) { for (int i = 0; i < n-1; ++i) { for (int j = i+1; j < n; ++j) { if (a[j] < a[i]) { int t = a[j]; a[j] = a[i]; a[i] = t; ++count; } } } } int main...
a.cc: In function 'int main()': a.cc:21:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 21 | cin >> N; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked...
s361280819
p02259
C++
int bubbleSort(int A[], int n){ int sw = 0; bool flag = 1; for(int i=0; flag; i++){ flag = 0; for(int j=n-1; j>=i+1; i--){ if(A[j] < A[j-1]){ swap(A[j], A[j-1]); flag = 1; sw++; } } } return sw; } i...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:8:17: error: 'swap' was not declared in this scope; did you mean 'sw'? 8 | swap(A[j], A[j-1]); | ^~~~ | sw a.cc: In function 'int main()': a.cc:20:5: error: 'cin' was not declared in this scope 20 | ...
s777021548
p02259
C++
#include <iostream> #include <algorithm> using namespace std; int counter = 0; //count???????´???????????????¨??? void bubbleSort(int A[], int N) { int flag = 1; int tmp; while (flag) { flag = 0; for(int j=N-1;j>=1;j--) if (A[j] < A[j - 1]) { tmp = A[j - 1]; A[j - 1] = A[j]; A[j] = tmp; ...
a.cc:36:15: warning: multi-character character constant [-Wmultichar] 36 | cout<<'\n '<<counter; | ^~~~~ a.cc:38:2: error: expected declaration before '}' token 38 | }} | ^
s427325711
p02259
C++
#include<stdio.h> #include<stdlib.h> #include<stdio.h> #include<stdlib.h> void int_display(int *A,int n) { int i; for(i=0;i<n;i++){ printf("%d",A[i]); if(i<n-1) printf(" "); } printf("\n"); } int bubble_sort(int *A,int n) { int i,j,Aj,swap; swap=0; for(i=0;i<n;i++){ for(j=n-1;j>i;j--){ ...
a.cc: In function 'int main()': a.cc:38:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive] 38 | A=malloc(n*sizeof(int)); | ~~~~~~^~~~~~~~~~~~~~~ | | | void*
s244190299
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],int N){ int sw=0; bool flag=1; for(int i=0;flag;i++){ flag=0; for(int j=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>...
a.cc: In function 'int main()': a.cc:33:3: error: 'coutVVsw' was not declared in this scope 33 | coutVVsw<<endl; | ^~~~~~~~
s343983112
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],int N){ int sw=0; bool flag=1; for(int i=0;flag;i++){ flag=0; for(int j=N-1;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>...
a.cc: In function 'int main()': a.cc:33:3: error: 'coutVVsw' was not declared in this scope 33 | coutVVsw<<endl; | ^~~~~~~~
s866618240
p02259
C++
#include <iostream> using namespace std; int bubbleSort(int A[], N){ int swapNumber = 0; int flag = 1; int i, j; for(i = 0; flag; i++){ flag = 0; for(j = N-1, j >= i+1; j--){ if(A[j - 1] > A[j]){ swap(A[j], A[j - 1]); swapNumber++; } } } return swapNumber; } int main(int argc, char const *arg...
a.cc:4:25: error: 'N' has not been declared 4 | int bubbleSort(int A[], N){ | ^ a.cc: In function 'int bubbleSort(int*, int)': a.cc:10:25: error: 'N' was not declared in this scope 10 | for(j = N-1, j >= i+1; j--){ | ^ a.cc:10:43: error:...
s249639002
p02259
C++
#include <iostream> using namespace std; int bubbleSort(int A[], int N){ int swapNumber = 0; int flag = 1; int i, j; for(i = 0; flag; i++){ flag = 0; for(j = N-1, j >= i+1; j--){ if(A[j - 1] > A[j]){ swap(A[j], A[j - 1]); swapNumber++; } } } return swapNumber; } int main(int argc, char const ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:10:43: error: expected ';' before ')' token 10 | for(j = N-1, j >= i+1; j--){ | ^ | ;
s631895155
p02259
C++
// bubblesort.cpp : ??????????????? ??¢????????±????????§????????¨????????? ????????????????????????????????? // #include "stdafx.h" int main() { int N, a, A[1000],j,x; scanf("%d", &N); for (a = 0; a <= N - 1; a++) scanf("%d", &A[a]); int flag = 1; while (flag) { flag = 0; ...
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s538567435
p02259
C++
#include<iostream> using namespace std; int bubbleSort (int A[], int n) { int i = 0, j, v, count = 0, flag = 1; while (flag) { flag = 0; for (j = n - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { v = A[j]; A[j] = A[j - 1]; A[j -...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:24:24: error: expected ';' before ':' token 24 | count++: | ^ | ; a.cc: At global scope: a.cc:69:1: error: expected declaration before '}' token 69 | } | ^
s470718259
p02259
C++
#include<iostream> using namespace std; int bubbleSort (int A[], int n) { int i = 0, j, v, count = 0, flag = 1; while (flag) { flag = 0; for (j = n - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { v = A[j]; A[j] = A[j - 1]; A[j -...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:24:27: error: expected ';' before ':' token 24 | count += 1: | ^ | ;
s801011477
p02259
C++
#include<iostream> using namespace std; int bubbleSort (int A[], int n) { int i = 0, j, v, count = 0; bool flag = 1; while (flag) { flag = 0; for (j = n - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { v = A[j]; A[j] = A[j - 1]; ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:25:27: error: expected ';' before ':' token 25 | count += 1: | ^ | ;
s003035100
p02259
C++
#include<iostream> using namespace std; int bubbleSort (int A[], int n) { int i = 0, j, v, count = 0; bool flag = 1; while (flag) { flag = 0; for (j = n - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { v = A[j]; A[j] = A[j - 1]; ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:25:27: error: expected ';' before ':' token 25 | count += 1: | ^ | ;
s158725705
p02259
C++
#include<iostream> using namespace std; int bubbleSort (int A[], int n) { int i = 0, j, v, count = 0; bool flag = 1; while (flag) { flag = 0; for (j = n - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { v = A[j]; A[j] = A[j - 1]; ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:25:27: error: expected ';' before ':' token 25 | count += 1: | ^ | ;
s933680742
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = N - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { swap(A[j], A[j - 1]); flag = 1; sw++; ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:19:4: error: 'retun' was not declared in this scope 19 | retun sw; | ^~~~~ a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type] 20 | } | ^
s555864261
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = N - 1; j >= i + 1; j--) { if (A[j] < A[j - 1]) { swap(A[j], A[j - 1]); flag = 1; sw++; ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:19:4: error: 'retun' was not declared in this scope 19 | retun sw; | ^~~~~ a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type] 20 | } | ^
s759667172
p02259
C++
#include<stdio.h> void bubbleSort(int A[], int N){ int i, j, k, count = 0; for( i = 0; i < N; i++ ){ for(j = i + 1 ; j < N; j++ ){ if(A[i] > A[j]){ k = A[j]; A[j] = A[i]; A[i] = k; count += 1; } } } space(A, N); printf("%d\n",count); } void space(int A[], ...
a.cc: In function 'void bubbleSort(int*, int)': a.cc:15:3: error: 'space' was not declared in this scope 15 | space(A, N); | ^~~~~
s051957286
p02259
C++
#include "stdafx.h" #include <iostream> #include <cmath> #include <vector> #include <string> #include <map> #include <algorithm> #include <tuple> #include <set> #include <stack> #include <queue> #include <functional> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; u...
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s441783499
p02259
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> v; for(int i=0; i<N; i++){ int a; cin >> a; v.push_back(a); } int flag = 1, cnt = 0; while(flag){ flag = 0; for(int j = N-1; j >= 1; j--){ if(v[j] < v[j-1]){ ...
a.cc: In function 'int main()': a.cc:29:11: error: expected primary-expression at end of input 29 | return | ^ a.cc:29:11: error: expected ';' at end of input 29 | return | ^ | ; a.cc:29:11: error: expected '}' at end of input a.cc:3:11: note: to match this ...
s199461834
p02259
C++
#include <algorithm> #include <iostream> template <typename T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) { if(!v.empty()) { std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(out, " ")); out << v.back(); } else { out << ""; } return out; } int bubblesort(std::vec...
a.cc:5:56: error: 'vector' in namespace 'std' does not name a template type 5 | std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) { | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by addi...
s659515005
p02259
C++
package main import ( "fmt" ) func main() { var n int fmt.Scan(&n) a := make([]int, n) for i := range a { fmt.Scan(&a[i]) } flag := true sortedIndex := 0 swapCount := 0 for flag { flag = false for i := n - 1; i > sortedIndex; i-- { if a[i] < a[i-1] { a[i], a[i-1] = a[i-1], a[i] flag = tr...
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~
s217674235
p02259
C++
#include<bits/stdc++.h> using namespace std; int main() { int n,cnt=0; scanf("%d",&n); int arr[n]; for(int i=0;i<n;i++) scanf("%d",&arr[i]); for(int i=0;i<n;i++) for(int j=0;j<n-i;j++) { if(arr[j]>arr[j+1]) { swap(arr[j],arr[j+1]); ...
a.cc: In function 'int main()': a.cc:21:21: error: expected ')' before ';' token 21 | printf("%d",arr[n-1]; | ~ ^ | )
s744224535
p02259
C++
#define _CRT_SECURE_NO_WARNINGS #include <vector> #include <deque> #include <list> #include <forward_list> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <algorithm> #include <numeric> #include <cmath> #include <tuple> #include <functional> #include <limits> #include <utility>...
a.cc: In function 'int main()': a.cc:77:15: error: 'selectionSort' was not declared in this scope 77 | int count(selectionSort(v)); | ^~~~~~~~~~~~~
s352824249
p02259
C++
#include<iostream> using namespace std; void bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for ( int i = 0; flag; i++){ flag = 0; for ( int j = N - 1; j >= i; j-- ){ if (A[j] < A[j-1]) { swap(A[j], A[j-1]); flag = 1; sw++; } } } return sw; } ...
a.cc: In function 'void bubbleSort(int*, int)': a.cc:17:10: error: return-statement with a value, in function returning 'void' [-fpermissive] 17 | return sw; | ^~ a.cc: In function 'int main()': a.cc:26:9: error: 'i' was not declared in this scope 26 | for ( i = 0; i < N; i++) cin >> A[i] ...
s871962124
p02259
C++
#include<iostream> using namespace std; void bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for ( int i = 0; flag; i++){ flag = 0; for ( int j = N - 1; j >= i; j-- ){ if ( A[j] < A[j-1] ) { swap(A[j], A[j-1]); flag = 1; sw++; } } } return sw; } ...
a.cc: In function 'void bubbleSort(int*, int)': a.cc:17:10: error: return-statement with a value, in function returning 'void' [-fpermissive] 17 | return sw; | ^~ a.cc: In function 'int main()': a.cc:26:9: error: 'i' was not declared in this scope 26 | for ( i = 0; i < N; i++) cin >> A[i] ...
s871416212
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for ( int i = 0; flag; i++){ flag = 0; for ( int j = N - 1; j >= i; j-- ){ if ( A[j] < A[j-1] ) { swap(A[j], A[j-1]); flag = 1; sw++; } } } return sw; } ...
a.cc: In function 'int main()': a.cc:26:9: error: 'i' was not declared in this scope 26 | for ( i = 0; i < N; i++) cin >> A[i] | ^
s452058971
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for ( int i = 0; flag; i++){ flag = 0; for ( int j = N - 1; j >= i; j-- ){ if ( A[j] < A[j-1] ) { swap(A[j], A[j-1]); flag = 1; sw++; } } } return sw; } ...
a.cc: In function 'int main()': a.cc:26:9: error: 'i' was not declared in this scope 26 | for ( i = 0; i < N; i++) cin >> A[i]; | ^
s382811757
p02259
C++
include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; bool flag = 1; for ( int i = 0; flag; i++){ flag = 0; for ( int j = N - 1; j >= i + 1; j-- ){ if ( A[j] < A[j-1] ) { swap(A[j], A[j-1]); flag = 1; sw++; } } } return sw; } ...
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:11:9: error: 'swap' was not declared in this scope; did you mean 'sw'? 11 | swap(A[j], A[j-1]); | ^~~~ | sw a.cc: In function 'int main()':...
s045432036
p02259
C++
#include <iostream> using namespace std; int bubblesort(int a[], int n) { bool flag=1; int sw = 0; for (int i = 0;flag; i++) { flag = 0; for (int j = n - 1; j >=i+1; j--) { if (a[j] < a[j - 1]) swap(a[j], a[j - 1]); sw++; flag = 1; } return sw; } int main() { int a[100]; int n; int sw; cin >> ...
a.cc: In function 'int bubblesort(int*, int)': a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 17 | int main() | ^~ a.cc:17:9: note: remove parentheses to default-initialize a variable 17 | int main() | ^~ | -- a.cc:17:9...
s561793329
p02259
C++
bubble(a,n) t = 0 for i in 0..n-1 j = 0 while a[i-j] < a[i-j-1] and j <= i-1 k = a[i-j] a[i-j] = a[i-j-1] a[i-j-1] = k j += 1 t += 1 end end print (a) print ("\n") print (t) print("\stimes_exhange\n") return 0
a.cc:3:12: error: too many decimal points in number 3 | for i in 0..n-1 | ^~~~ a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token 1 | bubble(a,n) | ^
s097412846
p02259
C++
def bubble(A,n) t = 0 for i in 0..n-1 j = 0 while A[i-j] < A[i-j-1] and j <= i-1 k = A[i-j] A[i-j] = A[i-j-1] A[i-j-1] = k j += 1 t += 1 end end
a.cc:3:13: error: too many decimal points in number 3 | for i in 0..n-1 | ^~~~ a.cc:1:1: error: 'def' does not name a type 1 | def bubble(A,n) | ^~~
s179538736
p02259
C++
#include<stdio.h> using namespace std; int bubbleSort(int A[],int N){ int sw = 0; bool flag = 1; for(int i = 0; flag; i++){ flag = 0; for(int j = N -1; j >= i + 1;j--){ if(A[j] < A[j-1]){ swap(A[j] < A[j - 1]); flag = 1; sw++; } } } return sw } int main(){ int A[100],N,sw; cin >> N; ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:12:33: error: 'swap' was not declared in this scope; did you mean 'sw'? 12 | swap(A[j] < A[j - 1]); | ^~~~ | sw a.cc:18:18: error: expected ';' before '}' to...
s433822218
p02259
C++
#include<iostream> #include<cstdio> //バブルソート in:配列、要素数 out:ソート回数 int bubble_sort(int *A,int N){ int sw=0; int i,j; bool flag=1; for(i=0;flag;i++){ flag=0; for(j=N;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); ...
a.cc: In function 'int bubble_sort(int*, int)': a.cc:13:17: error: 'swap' was not declared in this scope 13 | swap(A[j],A[j-1]); | ^~~~ a.cc:13:17: note: suggested alternatives: In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/inclu...
s699703265
p02259
C++
#include<iostream> #include<cstdio> using namespace std; //バブルソート in:配列、要素数 out:ソート回数 int bubble_sort(int *A,int N){ int sw=0; int i,j; bool flag=1; for(i=0;flag;i++){ flag=0; for(j=N;j>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; ...
a.cc: In function 'int main()': a.cc:40:14: error: expected '}' at end of input 40 | return 0; | ^ a.cc:23:15: note: to match this '{' 23 | int main(void){ | ^
s447456493
p02259
C++
#include <stdio.h> #define rep(i, n) for(int i = 0; i < n; ++i) #define repi(i, n, a) for(int i = a; i < n; ++i) int main(void) { int n, i, j, ans = 0; scanf("%d", &n); int a[n]; rep(i, n) scanf("%d", &a[i]); int flag = 0; while(flag) for(j = n - 1; j > 0; --j) if(a[j] < a[j - 1]) { int t = a[j], a[j] ...
a.cc: In function 'int main()': a.cc:12:33: error: array must be initialized with a brace-enclosed initializer 12 | int t = a[j], a[j] = a[j - 1], a[j - 1] = t; | ~~~~~~~^ a.cc:12:36: error: conflicting declaration 'int a [(j + -1)]' 12 | int t = a[j], a[j] = a[j - 1], a[j -...
s884512582
p02259
C++
#include<iostream> using namespace std; int main() { int n; cin >> n; int *A = new int[n]; for (int i = 0; i < n; i++) { cin >> A[i]; } int c = 0,temp; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if (A[i] > A[j]) { temp = A[i]; A[i] = A[j]; A[j] = temp; ++c; } ...
a.cc: In function 'int main()': a.cc:29:20: error: expected '}' at end of input 29 | delete[] A; | ^ a.cc:3:12: note: to match this '{' 3 | int main() { | ^
s426500614
p02259
C++
#include <iostream> using namespace std; void trace(int A[], int n) { for (int i = 0; i < n; i++) { if (i > 0) cout << " "; cout << A[i]; } cout << endl; } int main() { int maxN = 1000; int A[maxN]; int N; cin >> N; for (int i = 0; i < N; i++) { cin >>...
a.cc: In function 'int main()': a.cc:38:22: error: expected ';' before '\U0000ff1b' 38 | swp++; | ^~ | ; a.cc:46:2: error: expected '}' at end of input 46 | } | ^ a.cc:16:1: note: to match this '{' 16 | { | ^
s774946321
p02259
C++
#include <iostream> using namespace std; void trace(int A[], int n) { for (int i = 0; i < n; i++) { if (i > 0) cout << " "; cout << A[i]; } cout << endl; } int main() { int maxN = 1000; int A[maxN]; int N; cin >> N; for (int i = 0; i < N; i++) { cin >>...
a.cc: In function 'int main()': a.cc:46:2: error: expected '}' at end of input 46 | } | ^ a.cc:16:1: note: to match this '{' 16 | { | ^
s118586830
p02259
C++
#include <stdio.h> #include <iostream> using namespace std; void bubbleprint(int A[], int N,int replace) { for (int i = 0; i < N; i++) { if (i > 0) { printf(" "); } printf("%d", A[i]); } printf("\r\n"); printf("%d", replace); } void bubbleSort(int A[], int N) { int flg = 1; int replace=0; while ...
a.cc: In function 'int main()': a.cc:55:18: error: expected '}' at end of input 55 | return 0; | ^ a.cc:44:1: note: to match this '{' 44 | { | ^
s331663913
p02259
C++
#include<stdio.h> #include<stdlib.h> int bubblesort(int a[],int n){ int i,j,tmp,count; for(i=0; i<n-1; i++){ for(j=n-1; j>i; j--){ if(a[j]<a[j-1]){ tmp = a[j]; a[j] = a[j-1]; a[j-1] = tmp; count++; } } } return count; } int main(){ int num,i,result; int *A; ...
a.cc: In function 'int main()': a.cc:26:13: error: invalid conversion from 'void*' to 'int*' [-fpermissive] 26 | A = calloc(num,sizeof(int)); | ~~~~~~^~~~~~~~~~~~~~~~~ | | | void*
s992808803
p02259
C++
#include<iostream> using namespace std; //flagを用いたバブルソート int bubbleSort(int A[], int N){ int sw = 0; bool flag = 1; for(int i = 0; flag; i++){ flag = 0; for(int j = N - 1; j >= i; j==){ if(A[j] < A[j - 1]){ //隣接要素を交換する swap(A[j], A[j-1]); ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:10:39: error: expected primary-expression before ')' token 10 | for(int j = N - 1; j >= i; j==){ | ^ a.cc: In function 'int main()': a.cc:32:10: error: no match for 'operator<' (operand types are 'std::ostream' {a...
s085874622
p02259
C++
#include<iostream> using namespace std; //flagを用いたバブルソート int bubbleSort(int A[], int N){ int sw = 0; bool flag = 1; for(int i = 0; flag; i++){ flag = 0; for(int j = N - 1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ //隣接要素を交換する swap(A[j], A[j-1]); ...
a.cc: In function 'int main()': a.cc:32:10: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 32 | cout < endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/string:48, from /usr/inc...
s481533161
p02259
C++
#include<iostream> #include<utility> using namespace std; //flagを用いたバブルソート int bubbleSort(int A[], int N){ int sw = 0; bool flag = 1; for(int i = 0; flag; i++){ flag = 0; for(int j = N - 1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ //隣接要素を交換する swap(A...
a.cc: In function 'int main()': a.cc:33:10: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 33 | cout < endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/string:48, from /usr/inc...
s450236688
p02259
C++
#include <iostream> #include <algorithm> using namespace std; int bubble_sort(int *data, int n) { int flag = 1; int count = 0; int i = 0; while(flag) { flag = 0; for(int j = n-1; j > i; j--) { if(data[j] < data[j-1]) { swap(data[j], data[j-1]); flag = 1; count++; } } i++; } return count...
a.cc:46:2: error: stray '#' in program 46 | }#include <iostream> | ^ a.cc:91:2: error: stray '#' in program 91 | }#include <iostream> | ^ a.cc:46:3: error: 'include' does not name a type 46 | }#include <iostream> | ^~~~~~~ a.cc:50:5: error: redefinition of 'int bubble_sort(int*, int)' ...
s447305383
p02259
C++
#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; int bubble_sort(int *data, int n) { int flag = 1; int count = 0; int i = 0; while(flag) { flag = 0; for(int j = n-1; j > i; j--) { if(data[j] < data[j-1]) { swap(data[j], data[j-1]); flag = 1; count++; } } i+...
a.cc:47:2: error: stray '#' in program 47 | }#include <iostream> | ^ a.cc:92:2: error: stray '#' in program 92 | }#include <iostream> | ^ a.cc:47:3: error: 'include' does not name a type 47 | }#include <iostream> | ^~~~~~~ a.cc:51:5: error: redefinition of 'int bubble_sort(int*, int)' ...
s778669559
p02259
C++
##include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0 int flag = 1; while flag { flag = 0; for ( int j = N - 1; 0 < j; j--) { if (A[j] < A[j-1]) { swap(A[j-1], A[j]); sw++; flag = 1; } return sw; } int main() { int A[100], N, sw; ...
a.cc:1:1: error: stray '##' in program 1 | ##include<iostream> | ^~ a.cc:1:3: error: 'include' does not name a type 1 | ##include<iostream> | ^~~~~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:6:3: error: expected ',' or ';' before 'int' 6 | int flag = 1; | ^~~ a.cc:7:9: err...
s455390182
p02259
C++
##include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; int flag = 1; while flag { flag = 0; for ( int j = N - 1; 0 < j; j--) { if (A[j] < A[j-1]) { swap(A[j-1], A[j]); sw++; flag = 1; } return sw; } int main() { int A[100], N, sw; ...
a.cc:1:1: error: stray '##' in program 1 | ##include<iostream> | ^~ a.cc:1:3: error: 'include' does not name a type 1 | ##include<iostream> | ^~~~~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:9: error: expected '(' before 'flag' 7 | while flag { | ^~~~ | ...
s656645629
p02259
C++
##include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; int flag = 1; while flag { flag = 0; for ( int j = N - 1; 0 < j; j--) { if (A[j] < A[j-1]) { swap(A[j-1], A[j]); sw++; flag = 1; } } return sw; } int main() { int A[100], N, s...
a.cc:1:1: error: stray '##' in program 1 | ##include<iostream> | ^~ a.cc:1:3: error: 'include' does not name a type 1 | ##include<iostream> | ^~~~~~~ a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:9: error: expected '(' before 'flag' 7 | while flag { | ^~~~ | ...
s265516326
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; int flag = 1; while flag { flag = 0; for ( int j = N - 1; 0 < j; j--) { if (A[j] < A[j-1]) { swap(A[j-1], A[j]); sw++; flag = 1; } } return sw; } int main() { int A[100], N, sw...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:9: error: expected '(' before 'flag' 7 | while flag { | ^~~~ | ( a.cc:7:13: error: expected ')' before '{' token 7 | while flag { | ~~~~^~ | ) a.cc:19:9: warning: empty parentheses were disambig...
s391306711
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N) { int sw = 0; int flag = 1; while(flag) { flag = 0; for ( int j = N - 1; 0 < j; j--) { if (A[j] < A[j-1]) { swap(A[j-1], A[j]); sw++; flag = 1; } } return sw; } int main() { int A[100], N, s...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:19:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 19 | int main() { | ^~ a.cc:19:9: note: remove parentheses to default-initialize a variable 19 | int main() { | ^~ | -- a.cc:...
s126217145
p02259
C++
#include<vector> #include<iostream> using namespace std; int main() { int n; cin>>n; vector<int> numbers; numbers.resize(n); for(int i=0;i<numbers;i++) cin>>numbers[i]; bool flag=true; int times=0; for(int i=0;flag;i++) { flag=false; for(int j=n-1;j>=i+1;j--) { if(numbers[j]<numbers[j-1]) { int a=numbers[j]; numbers[...
a.cc: In function 'int main()': a.cc:10:14: error: no match for 'operator<' (operand types are 'int' and 'std::vector<int>') 10 | for(int i=0;i<numbers;i++) | ~^~~~~~~~ | | | | | std::vector<int> | int In file included from /usr/include/c++/14/b...
s434542692
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],int N){ int sw = o; bool flog = 1; for(int i = 0; flag; i++){ flog = 0; for(int j = N -1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ swap(A[j],A[j - 1]); flog = 1; sw++; } } } return sw; } int main(){ int A[100], ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:4:11: error: 'o' was not declared in this scope 4 | int sw = o; | ^ a.cc:6:17: error: 'flag' was not declared in this scope; did you mean 'flog'? 6 | for(int i = 0; flag; i++){ | ^~~~ | flog a.cc: I...
s509712432
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[],int N){ int sw = o; bool flog = 1; for(int i = 0; flag; i++){ flog = 0; for(int j = N -1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ swap(A[j],A[j - 1]); flog = 1; sw++; } } } return sw; } int main(){ int A[100], ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:4:11: error: 'o' was not declared in this scope 4 | int sw = o; | ^ a.cc:6:17: error: 'flag' was not declared in this scope; did you mean 'flog'? 6 | for(int i = 0; flag; i++){ | ^~~~ | flog
s356685207
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N){ int sw = 0; bool flog = 1; for(int i = 0; flag; i++){ flog = 0; for(int j = N -1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ swap(A[j],A[j - 1]); flog = 1; sw++; } } } return sw; } int main(){ int A[100]...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:17: error: 'flag' was not declared in this scope; did you mean 'flog'? 7 | for(int i = 0; flag; i++){ | ^~~~ | flog a.cc: In function 'int main()': a.cc:27:13: error: 'endi' was not declared in this scope 27 | ...
s326814819
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N){ int sw = 0; bool flag = 1; for(int i = 0; flag; i++){ flog = 0; for(int j = N -1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ swap(A[j],A[j - 1]); flog = 1; sw++; } } } return sw; } int main(){ int A[100]...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:8:4: error: 'flog' was not declared in this scope; did you mean 'flag'? 8 | flog = 0; | ^~~~ | flag a.cc: In function 'int main()': a.cc:27:13: error: 'endi' was not declared in this scope 27 | cout <<endi; | ^~~~
s383817797
p02259
C++
#include<iostream> using namespace std; int bubbleSort(int A[], int N){ int sw = 0; bool flag = 1; for(int i = 0; flag; i++){ flog = 0; for(int j = N -1; j >= i + 1; j--){ if(A[j] < A[j - 1]){ swap(A[j],A[j - 1]); flog = 1; sw++; } } } return sw; } int main(){ int A[100]...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:8:4: error: 'flog' was not declared in this scope; did you mean 'flag'? 8 | flog = 0; | ^~~~ | flag
s618332281
p02259
C++
#include<iostream> using namespace std; int bubblesort(int A[], int N){ int sw=0; bool flag=1; for(int i=0; flag; i++){ flag = 0; for(int j=N-1;i>=i+1;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; sw++; } } } return sw; } int main(){ int A[100],N,sw; cin>>N; for(int i=0;i<n;i++)cin>>A[i...
a.cc: In function 'int main()': a.cc:22:16: error: 'n' was not declared in this scope 22 | for(int i=0;i<n;i++)cin>>A[i]; | ^
s938676658
p02259
C++
#include<iostream> using namespace std; // bubbleSort:BBS int BBS(int A[10000],int N){ int sw=0;//ソートの回数 bool FLAG=1; for(int i=0;flag;i++){ flag=0; for(int j=N-1;j>=i;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; } sw++; } } return sw; } int main{ int N,sw,A[10000...
a.cc: In function 'int BBS(int*, int)': a.cc:13:21: error: 'flag' was not declared in this scope 13 | for(int i=0;flag;i++){ | ^~~~ a.cc: At global scope: a.cc:39:5: error: cannot declare '::main' to be a global variable 39 | int main{ | ^~~~ a.cc:41:9: error: expected ...
s892532881
p02259
C++
#include<iostream> using namespace std; int BBS(int A[10000],int N){ int sw=0; bool flag=1; for(int i=0;flag;i++){ flag=0; for(int j=N-1;j>=i;j--){ if(A[j]<A[j-1]){ swap(A[j],A[j-1]); flag=1; } sw++; } } return sw; } int main{ int N,sw,A[10000]; cin >> N; for(int i=0;i<N...
a.cc:32:5: error: cannot declare '::main' to be a global variable 32 | int main{ | ^~~~ a.cc:34:9: error: expected primary-expression before 'int' 34 | int N,sw,A[10000]; | ^~~ a.cc:34:9: error: expected '}' before 'int' a.cc:32:9: note: to match this '{' 32 | int main{ | ...
s184924215
p02259
C++
#include<iostream> #include<vector> using namespace std; void trace(const vector<int>& A) { for(int i = 0; i < A.size(); i++) { if (i > 0) { cout << " "; } cout << A[i]; } cout << endl; } int bubbleSort(vector<int>& A) { int sw = 0; bool flag = 1; for (int i = 0; flag; i++...
a.cc: In function 'int main()': a.cc:46:11: error: 'sw' was not declared in this scope 46 | cout << sw << endl; | ^~
s145741116
p02259
C++
# include <stdio.h> int bubbleSort(int *A, int N) { int flag = 1, count=0; while(flag) { flag = 0; for (int j=N-1; J>0; j--) { if (A[j] < A[j-1]) { int tmp = A[j]; A[j] = A[j-1]; A[j-1] = tmp; count++; } ...
a.cc: In function 'int bubbleSort(int*, int)': a.cc:7:25: error: 'J' was not declared in this scope 7 | for (int j=N-1; J>0; j--) { | ^ a.cc: In function 'int main()': a.cc:36:5: error: 'outputArray' was not declared in this scope; did you mean 'outoutArray'? 36 | output...
s505810918
p02259
C++
#include <iostream> #include "algorithm" using namespace std; int main() { int n; int *a; cin >> n; a = new int [n]; for ( int i = 0; i <n ; i++ ) { cin >> a[i] ; } int sw = 0; for (int i = 0; i < n; i++) { for (int j = n -1; j >= i + 1; j--) { if (a[j] < a...
a.cc: In function 'int main()': a.cc:26:27: error: expected ';' before 'cout' 26 | if (i) cout << " " | ^ | ; 27 | cout << a[i] ; | ~~~~