submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s630801251 | p02259 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n;i>0;i--)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define DREP(i,b,n) for(int i=n;i>b;i--)
const float PI =... | a.cc: In function 'int main()':
a.cc:31:7: error: 'tmp' was not declared in this scope; did you mean 'tm'?
31 | tmp = a[j];
| ^~~
| tm
|
s494645518 | p02259 | C++ | #include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a[], int n, int cnt){
bool flag = true;
while(flag){
flag = false;
for(int j = n-1; j =1; i--){
if(a[j-1] > a[j]){
swap(a[j-1], a[j]);
cnt++;
flag = true;
}
}
}
int main(){
int n;
cin >> n;
int a[n];
for(int i = 0;... | a.cc: In function 'void bubbleSort(int*, int, int)':
a.cc:8:40: error: 'i' was not declared in this scope
8 | for(int j = n-1; j =1; i--){
| ^
a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
16 | int ... |
s127496883 | p02259 | C++ | #include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a[], int n, int cnt){
bool flag = true;
while( flag ){
flag = false;
for( int j = n-1; j =1; i-- ){
if(a[ j-1 ] > a[ j ]){
swap(a[ j-1 ], a[ j ]);
cnt++;
flag = true;
}
}
}
int main(){
int n;
cin >> n;
int a[ n ];
... | a.cc: In function 'void bubbleSort(int*, int, int)':
a.cc:8:41: error: 'i' was not declared in this scope
8 | for( int j = n-1; j =1; i-- ){
| ^
a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
16 | i... |
s366874209 | p02259 | C++ | #include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a[], int n, int cnt){
bool flag = true;
while( flag ){
flag = false;
for( int j = n-1; j =1; i-- ){
if(a[ j-1 ] > a[ j ]){
swap(a[ j-1 ], a[ j ]);
cnt++;
flag = true;
}
}
}
}
int main(){
int n;
cin >> n;
int a[ n ]... | a.cc: In function 'void bubbleSort(int*, int, int)':
a.cc:8:41: error: 'i' was not declared in this scope
8 | for( int j = n-1; j =1; i-- ){
| ^
a.cc: In function 'int main()':
a.cc:25:23: error: invalid conversion from 'int' to 'int*' [-fpermissive]
... |
s645560115 | p02259 | C++ | #include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a[], int n, int cnt){
bool flag = true;
while( flag ){
flag = false;
for( int j = n-1; j =1; j-- ){
if(a[ j-1 ] > a[ j ]){
swap(a[ j-1 ], a[ j ]);
cnt++;
flag = true;
}
}
}
}
int main(){
int n;
cin >> n;
int a[ n ]... | a.cc: In function 'int main()':
a.cc:25:23: error: invalid conversion from 'int' to 'int*' [-fpermissive]
25 | bubbleSort(a[n], n, cnt);
| ~~~^
| |
| int
a.cc:4:21: note: initializing argument 1 of 'void bubbleSort(int*, int, ... |
s431196149 | p02259 | C++ | #include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a, int n, int cnt){
bool flag = true;
while( flag ){
flag = false;
for( int j = n-1; j =1; j-- ){
if(a[ j-1 ] > a[ j ]){
swap(a[ j-1 ], a[ j ]);
cnt++;
flag = true;
}
}
}
}
int main(){
int n;
cin >> n;
int a[ n ];
... | a.cc: In function 'void bubbleSort(int, int, int)':
a.cc:9:29: error: invalid types 'int[int]' for array subscript
9 | if(a[ j-1 ] > a[ j ]){
| ^
a.cc:9:40: error: invalid types 'int[int]' for array subscript
9 | if(a[ j-1 ] > a[ ... |
s840889735 | p02259 | C++ | #include <bits/stdc++.h>
using namespace std;
int count = 0;
void swap(int a[], int i, int j) {
int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
count++;
}
int main() {
int n;
cin >> n;
int a[n];
for (int i=0; i<n; i++) {
cin >> a[i];
}
for (int i=0; i<n; i++) {
f... | a.cc: In function 'void swap(int*, int, int)':
a.cc:10:5: error: reference to 'count' is ambiguous
10 | count++;
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14... |
s077646073 | p02259 | C++ | #include <iostream>
using namespace std;
int bubblesort(int A[], int N) {
/* code */
int sw = 0;
bool flag = 1;
for (i = 0; flag; i++) {
/* code */
flag = 0;
for (int j = 0; j >= i + 1; j--) {
/* code */
if (A[j]< A[j -1] ) {
/* code */
swap(A[j], A[j-1]);
f... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
8 | for (i = 0; flag; i++) {
| ^
a.cc: In function 'int main(int, const char**)':
a.cc:35:8: error: 'i' was not declared in this scope
35 | for (i = 0; i < N; i++) {
| ^
|
s012719196 | p02259 | C++ |
#include <math.h>
int isPrime(int a[]);
int n,p;
int count = 0;
int main(){
int a[10000], i, count =0,x[200000];
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &x[i]);
}
p = isPrime(x);
for (i = 0; i < n; i++){
if (i != 0){ printf(" "); }
printf("%d", x[i]);
}
printf("\n");
printf("%d",p);
... | a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf' was not declared in this scope
10 | scanf("%d", &n);
| ^~~~~
a.cc:19:30: error: 'printf' was not declared in this scope
19 | if (i != 0){ printf(" "); }
| ^~~~~~
a.cc:3:1: note: 'prin... |
s997555517 | p02259 | C++ | #include <bits/stdc++.h>
using namespace std;
int N, A[100];
void Out() {
cout << A[0];
for (int i = 1; i < N; i++)
cout << ' ' << A[i];
cout << endl;
}
void BubbleSort() {
bool flag = true;
while (flag) {
flag = false;
for (int i = N - 1; i >= 0; i--) {
if (A[j] < A[j - 1]) {
int tmp = A[j];
A[... | a.cc: In function 'void BubbleSort()':
a.cc:17:31: error: 'j' was not declared in this scope
17 | if (A[j] < A[j - 1]) {
| ^
|
s612873948 | p02259 | C++ | #include<iostream>
using namespace std;
int main (){
int n,a[100],i,j,v,flag,count=0;
cin>>n;
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<n;i++){
for(j=0;j<n-1;j++){
if(a[j]>a[j+1]){
v=a[j];
a[j]=a[j+1];
a[j+1]=v;
count++;
}
}
}
for(i=0;i<n;i++){
if(i<n-1){
cout<<... | a.cc: In function 'int main()':
a.cc:30:2: error: expected '}' at end of input
30 | }
| ^
a.cc:3:12: note: to match this '{'
3 | int main (){
| ^
|
s701587668 | 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;
... | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:13:17: error: 'swap' was not declared in this scope; did you mean 'sw'?
13 | swap(A[j], A[j - 1]);
| ^~~~
| sw
a.cc... |
s155545964 | p02259 | C++ | #include <bits/stdc++.h>
using namespace std;
int Bubble(vector<int>& A) {
int cnt=0;
bool flag = 1; // ????????£??\????´?????????¨??????
while(flag) {
flag = 0;
for(int j=N-1; j>=1; j--){
if(A[j] < A[j-1]) {
swap(A[j],A[j-1]);
flag = 1;
cnt++;
}
}
}
}
int main() {
int n; cin >>... | a.cc: In function 'int Bubble(std::vector<int>&)':
a.cc:9:19: error: 'N' was not declared in this scope
9 | for(int j=N-1; j>=1; j--){
| ^
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
17 | }
| ^
a.cc: In function 'int main()':
a.cc:2... |
s306639074 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[],int N){
int sw=0;
bool flg = 1;
for(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]);
flg=1;
sw++;
}
}
}
return sw;
}
int main(){
... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
8 | for(i=0;flag;i++){
| ^
a.cc:8:12: error: 'flag' was not declared in this scope; did you mean 'flg'?
8 | for(i=0;flag;i++){
| ^~~~
| flg
a.cc: In function 'i... |
s765622874 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[],int N){
int sw=0;
bool flag = 1;
for(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]);
flg=1;
sw++;
}
}
}
return sw;
}
int main(){... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
8 | for(i=0;flag;i++){
| ^
a.cc:13:13: error: 'flg' was not declared in this scope; did you mean 'flag'?
13 | flg=1;
| ^~~
| flag
a.cc: In function 'i... |
s127224153 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[],int N){
int sw=0;
bool flag = 1;
for(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()... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
8 | for(i=0;flag;i++){
| ^
a.cc: In function 'int main()':
a.cc:25:8: error: 'i' was not declared in this scope
25 | for(i=0;i<N;i++)cin>>A[i];
| ^
a.cc:29:8: error: 'i' was not decl... |
s508178943 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[],int N){
int sw=0;
bool flag = 1;
for(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()... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
8 | for(i=0;flag;i++){
| ^
|
s806458170 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[],int N){
int sw=0;
bool flag = 1;
for(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()... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
8 | for(i=0;flag;i++){
| ^
|
s510982271 | p02259 | C++ | #include<stdio.h>
int main(void) {
int i, j, n, temp, flag = 1, count = 0;
scanf("%d", &n);
for (i = 0; i < n; ++i)
{
scanf("%d", &a[i]);
}
while (flag)
{
flag = 0;
for (j = n - 1; n > 0; --n)
{
if (a[j] < a[j-1])
{
temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
flag = 1;
++... | a.cc: In function 'int main()':
a.cc:9:30: error: 'a' was not declared in this scope
9 | scanf("%d", &a[i]);
| ^
a.cc:18:29: error: 'a' was not declared in this scope
18 | if (a[j] < a[j-1])
| ^
a.cc:29:3... |
s829300796 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[], int N)
{
int sw = 0;
bool flag = 1;
int i, j;
for(i=0; flag; i++) {
flag = 0;
for(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 main()':
a.cc:32:4: error: 'sw' was not declared in this scope
32 | sw = bubbleSort(A, N);
| ^~
a.cc:38:12: error: 'end1' was not declared in this scope
38 | cout << end1;
| ^~~~
|
s009646357 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[], int N)
{
int sw = 0;
bool flag = 1;
int i, j;
for(i=0; flag; i++) {
flag = 0;
for(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 main()':
a.cc:32:4: error: 'sw' was not declared in this scope
32 | sw = bubbleSort(A, N);
| ^~
|
s787957522 | 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;
... | a.cc: In function 'int main()':
a.cc:39:9: error: 'end1' was not declared in this scope
39 | cout << end1;
| ^~~~
|
s266452699 | p02259 | C++ | #include <iostream>
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:14:18: error: 'swap' was not declared in this scope
14 | swap(A[j], A[j - 1]);
| ^~~~
a.cc:14:18: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/i... |
s973194244 | p02259 | C++ | #include <stdio.h>
int int main(int argc, char const *argv[]) {
int flag=1;
int nums[101];
int sorted[101];
int n;
int i=0;
int count=0;
int temp;
scanf("%d\n",&n );
while (i<n) {
scanf("%d",&nums[i]);
i++;
}
while (flag) {
/* code */
flag=0;
for (i =n-1; i < n; i++) {
if... | a.cc:2:1: error: two or more data types in declaration of 'main'
2 | int int main(int argc, char const *argv[]) {
| ^~~
|
s888686584 | p02259 | C++ | #include <stdio.h>
int int main(int argc, char const *argv[]) {
int flag=1;
int nums[101];
int sorted[101];
int n;
int i=0;
int k;
int count=0;
int temp;
scanf("%d\n",&n );
while (i<n) {
scanf("%d",&nums[i]);
i++;
}
while (flag) {
/* code */
flag=0;
for (i =n-1; i < n; i++) {... | a.cc:2:1: error: two or more data types in declaration of 'main'
2 | int int main(int argc, char const *argv[]) {
| ^~~
|
s710469393 | 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... | a.cc: In function 'int bubblesort(int*, int*)':
a.cc:10:18: error: invalid conversion from 'int*' to 'int' [-fpermissive]
10 | for(int j = N-1; j >= i+1; j--){
| ~^~
| |
| int*
a.cc: In function 'int main()':
a.cc:29:9: error: 'end1' was not dec... |
s959139765 | 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, ... | a.cc: In function 'int main()':
a.cc:29:9: error: 'end1' was not declared in this scope
29 | cout << end1;
| ^~~~
|
s561297475 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s795335828 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s992711007 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s924343796 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s307282330 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s712263582 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s603091589 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s176264070 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++) {
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++) {
| ^~
| ;
a.cc:25:10: error: expected primary-expression befor... |
s985755213 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++)cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++)cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected prim... |
s002151176 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++;)cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++;)cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected pr... |
s847246362 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++)cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++)cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected prim... |
s238664943 | 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, ... | a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
25 | for( int = 0; i < N; i++)cin >> A[i];
| ^
a.cc:25:9: error: expected ';' before '=' token
25 | for( int = 0; i < N; i++)cin >> A[i];
| ^~
| ;
a.cc:25:10: error: expected prim... |
s883899271 | p02259 | C++ | #include<iostream>
int bubbleSort(int A[],int N){
int sw=0,i,j,temp;
bool flag=1;
for(i=0;flag;i++){
flag=0;
for(j=N-1;j>=i+1;j--){
if(A[j]<A[j-1]){
temp=A[j];
A[j]=A[j-1];
A[j-1]=temp;
sw++;
flag=1;
}
}
}
return sw;
}
int main(){
int A[100],N,sw,i;
cin >> N;
for(i=0;i<N;i++)... | a.cc: In function 'int main()':
a.cc:24:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
24 | 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; ... |
s905025120 | p02259 | C++ | #include <stdio.h>
#define scanf scanf_s
int bubbleSort(int A[], int N) {
int sw, flag, i, j, e;
sw = 0; flag = 1;
while (flag) {
flag = 0;
for (i = 0; i < N; i++) {
for (j = N - 1; j > i; j--) {
if (A[j] < A[j - 1]) {
e = A[j]; A[j] = A[j - 1]; A[j - 1] = e;
flag = 1;
sw++;
}
}
... | a.cc: In function 'int main()':
a.cc:2:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
2 | #define scanf scanf_s
| ^~~~~~~
a.cc:27:9: note: in expansion of macro 'scanf'
27 | scanf("%d", &N);
| ^~~~~
|
s737085499 | p02259 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
const int MAX = 101;
const int MAXN = 100000;
int n;
int a[MAX];
int bit[MAXN];
void add(int i, int x) {
while (i < MAXN) {
bit[i] += x;
i += i & (-i);
}
}
int sum(int i) {
int s = 0;
while (i > 0) {
s += bit[i];
... | a.cc: In function 'int main()':
a.cc:31:5: error: 'memset' was not declared in this scope
31 | memset(bit, 0, sizeof(bit));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdio>
+++ |+#include <cstring>
... |
s818560259 | p02259 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX = 101;
const int MAXN = 100000;
int n;
int a[MAX];
int bit[MAXN];
void add(int i, int x) {
while (i < MAXN) {
bit[i] += x;
i += i & (-i);
}
}
int sum(int i) {
int s = 0;
while (i > 0) {
... | a.cc: In function 'int main()':
a.cc:32:5: error: 'memset' was not declared in this scope
32 | memset(bit, 0, sizeof(bit));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <algorithm>
+++ |+#include <cstring>... |
s468865734 | 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 bubbleSort(int*, int)':
a.cc:13:37: error: expected ';' before '}' token
13 | sw++
| ^
| ;
14 | }
| ~
|
s415766671 | p02259 | C++ | #include "stdafx.h"
#include<iostream>
int bubbleSort(int[], int N) {
int sw = 0;
bool flag = true;
for (i = 0; i < N; i++) {
flag = false;
for (int j = 0; j < N - 1; j++) {
if (A[j] < A[j - 1]) {
swap(A[j], A[j - 1]);
flag = true;
sw++;
}
}
}
return sw;
}
int main()
{
int A[100], N, sw;... | a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s642069770 | p02259 | C++ | #include<iostream>
int bubbleSort(int[], int N) {
int sw = 0;
bool flag = true;
for (i = 0; i < N; i++) {
flag = false;
for (int j = 0; j < N - 1; j++) {
if (A[j] < A[j - 1]) {
swap(A[j], A[j - 1]);
flag = true;
sw++;
}
}
}
return sw;
}
int main()
{
int A[100], N, sw;
cin >> N;
for (in... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:6:14: error: 'i' was not declared in this scope
6 | for (i = 0; i < N; i++) {
| ^
a.cc:9:29: error: 'A' was not declared in this scope
9 | if (A[j] < A[j - 1]) {
| ^
a.cc:10:3... |
s621440086 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int[], int N) {
int sw = 0;
bool flag = true;
for (int i = 0; i < N; i++) {
flag = false;
for (int j = 0; j < N - 1; j++) {
if (A[j] < A[j - 1]) {
swap(A[j], A[j - 1]);
flag = true;
sw++;
}
}
}
return sw;
}
int main()
{
int A[100], N... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:10:29: error: 'A' was not declared in this scope
10 | if (A[j] < A[j - 1]) {
| ^
|
s351244123 | 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 ... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:11:45: error: expected ';' before 'flag'
11 | swap(A[j], A[j - 1])
| ^
| ;
12 | flag = 1;
| ... |
s955861577 | p02259 | C++ | #include<algorithm>
#include<stdio.h>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cnt >> n;
for (int i = 0; i < n; i++){
cnt >> R[i];
}
int k = 0;
for (int i = 0; i < n; i++){
for (int j = n - 1; i > i; j--){
if (R[j - 1] > R[j]){
swap(R[j - 1], R[j... | a.cc: In function 'int main()':
a.cc:8:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
8 | cnt >> n;
| ^~~
| int
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
24 | printd("%d", R[i]);
| ... |
s783777469 | p02259 | C++ | #include<algorithm>
#include<stdio.h>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cin>> n;
for (int i = 0; i < n; i++){
cin >> R[i];
}
int k = 0;
for (int i = 0; i < n; i++){
for (int j = n - 1; i > i; j--){
if (R[j - 1] > R[j]){
swap(R[j - 1], R[j]... | a.cc: In function 'int main()':
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
24 | printd("%d", R[i]);
| ^~~~~~
| printf
|
s480651778 | p02259 | C++ | #include<algorithm>
#include<stdio.h>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cnt >> n;
for (int i = 0; i < n; i++){
cnt >> R[i];
}
int k = 0;
for (int i = 0; i < n; i++){
for (int j = n - 1; i > i; j--){
if (R[j - 1] > R[j]){
swap(R[j - 1], R[j... | a.cc: In function 'int main()':
a.cc:8:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
8 | cnt >> n;
| ^~~
| int
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
24 | printd("%d", R[i]);
| ... |
s108822094 | p02259 | C++ | #include<algorithm>
#include<stdio.h>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++){
cin >> R[i];
}
int k = 0;
for (int i = 0; i < n; i++){
for (int j = n - 1; i > i; j--){
if (R[j - 1] > R[j]){
swap(R[j - 1], R[j... | a.cc: In function 'int main()':
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
24 | printd("%d", R[i]);
| ^~~~~~
| printf
|
s376729096 | p02259 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main()
{
int dataset;
cin >> dataset;
int a[100];
for (int i = 0; i < dataset; i++)
{
cin >> a[i];
}
int flag = 1;
int kaisuu = 0;
while (flag) {
flag = 0;
for (int i = 1; i < dataset; i++)
{
if (a[i - 1] > a[i]) {
reverse(a[i - 1... | 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::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:21:12: required from here
21 | reverse(a[i - 1], a[i]);
| ... |
s291196025 | p02259 | C++ | #include <stdio.h>
#define N 100
int main(){
int n,i,j,temp,flag=0;
int array[N];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&array[i]);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(array[j]<array[j-1]){
temp=array[j];
array[j]=array[j-1];
array[j-1]=temp;
flag++;
}
}
}
f... | a.cc: In function 'int main()':
a.cc:31:15: error: expected ';' before 'printf'
31 | printf("\n")
| ^
| ;
32 | printf("%d\n",flag);
| ~~~~~~
|
s114092084 | p02259 | C++ | #include<iostream>
int Sort(int arr[],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(arr[j]<arr[j-1]){
swap(arr[j],arr[j-1]);
flag=1;
sw++;
}
}
}
return sw;
int main(){
int arr[100],N,sw;
cin>>N;
for(int i=0;i<N;i++)cin>>arr[i];
sw=Sort(arr,N);
for(int i=0;i<N;i++){
if(i)... | a.cc: In function 'int Sort(int*, int)':
a.cc:10:1: error: 'swap' was not declared in this scope
10 | swap(arr[j],arr[j-1]);
| ^~~~
a.cc:10:1: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68,
... |
s135437621 | p02259 | C++ | #include<iostream>
using namespace std;
int Sort(int arr[],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(arr[j]<arr[j-1]){
swap(arr[j],arr[j-1]);
flag=1;
sw++;
}
}
}
return sw;
int main(){
int arr[100],N,sw;
cin>>N;
for(int i=0;i<N;i++)cin>>arr[i];
sw=Sort(arr,N);
for(in... | a.cc: In function 'int Sort(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:19:9: no... |
s613566016 | p02259 | C++ | #include<iostream>
using namespace std;
int Sort(int arr[],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(arr[j]<arr[j-1]){
swap(arr[j],arr[j-1]);
flag=1;
sw++;
}
}
}
return sw;
}
int main(){
int arr[100],N,sw;
cin>>N;
for(int i=0;i<N;i++)cin>>arr[i];
sw=Sort(arr,N);
for(... | a.cc: In function 'int main()':
a.cc:30:7: error: 'end1' was not declared in this scope
30 | cout<<end1;
| ^~~~
|
s275036857 | p02259 | C++ | #include<iostream>
using namespace std;
int Sort(int arr[],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(arr[j]<arr[j-1]){
swap(arr[j],arr[j-1]);
flag=1;
sw++;
}
}
}
return sw;
}
int main(){
int arr[100],N,sw;
cin>>N;
for(int i=0;i<N;i++)cin>>arr[i];
sw=Sort(arr,N);
for(... | a.cc: In function 'int main()':
a.cc:30:7: error: 'end1' was not declared in this scope
30 | cout<<end1;
| ^~~~
|
s002404717 | p02259 | C++ | #include<stdio.h>
int main()
{
int A[100], N, sw, i;
scanf("%d",&N);
for(i = 1 ; i < N + 1 ; i++)
{
scanf("%d",&A[i]);
}
sw = bubbleSort(A,N);
printf("%d\n",sw);
return 0;
}
int bubbleSort(int A[],int N){
int sw = 0, i, j, temp;
for(i = 1 ; i < N + 1 ; i++)
{
for(j =... | a.cc: In function 'int main()':
a.cc:14:8: error: 'bubbleSort' was not declared in this scope
14 | sw = bubbleSort(A,N);
| ^~~~~~~~~~
|
s259450382 | p02259 | C++ | #include <stdio.h>
#define N 100
void swap(int *,int *);
void BubbleSort(int *,int);
int main(){
int a,*number,i;
number = (int*)malloc(a*sizeof(int));
scanf("%d",&a);
for(i = 0;i < a;i++){
scanf("%d",&number[i]);
}
BubbleSort(number,a);
free(number);
return 0;
}
void swap(int *a,int *b){
int... | a.cc: In function 'int main()':
a.cc:10:18: error: 'malloc' was not declared in this scope
10 | number = (int*)malloc(a*sizeof(int));
| ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
1 | #include <stdio.h>
+++ |... |
s672229035 | p02259 | C++ | #include <iostream>
#include <vector>
void trace(std::vector<int> v) {
std::string s;
for (std::vector<int>::iterator i = v.begin(); i != v.end(); ++i) {
if (i != v.end() - 1)
std::cout << *i << " ";
else
std::cout << *i;
}
std::cout << std::endl;
}
int main() {
{
using namespace std;
int n;
... | a.cc: In function 'int main()':
a.cc:41:23: error: 'v' was not declared in this scope
41 | trace(v);
| ^
|
s089723052 | p02259 | C++ | #include<iostream>
using namespace std;
int BubbleSort(int A[],int N){
int a=0;
bool flag=1;
while(flag){
flag=0;
for(int j=N-1;j<=a+1;j++){
if(A[j]<A[j-1]){
swap(A[j],A[j-1]);
a++;
flag=1;
}
}
}
return... | a.cc: In function 'int BubbleSort(int*, int)':
a.cc:17:12: error: 'i' was not declared in this scope
17 | return i;
| ^
a.cc: In function 'int main()':
a.cc:31:37: error: 'a' was not declared in this scope
31 | cout << array[num-1] << endl << a << endl;
| ... |
s373358478 | p02259 | C++ | #include<iostream>
using namespace std;
int BubbleSort(int A[],int N){
int a=0;
bool flag=1;
while(flag){
flag=0;
for(int j=N-1;j<=a+1;j++){
if(A[j]<A[j-1]){
swap(A[j],A[j-1]);
a++;
flag=1;
}
}
}
return... | a.cc: In function 'int main()':
a.cc:31:37: error: 'a' was not declared in this scope
31 | cout << array[num-1] << endl << a << endl;
| ^
|
s857338410 | p02259 | C++ | #include<iostream>
using namespace std;
int BubbleSort(int A[],int N){
int count=0;
bool flag=1;
while(flag){
flag=0;
for(int j=N-1;j>=count+1;j--){
if(A[j]<A[j-1]){
swap(A[j],A[j-1]);
count++;
flag=1;
}
}
... | a.cc: In function 'int main()':
a.cc:31:37: error: 'count' was not declared in this scope
31 | cout << array[num-1] << endl << count << endl;
| ^~~~~
|
s628122326 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSor(int A[],int N){
int sw=0;
bool flag=1;
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(int i=0;i<N;++){
if(i) cout << " ";
cout << A[i];
}
cout << end... | a.cc: In function 'int bubbleSor(int*, int)':
a.cc:7:26: error: 'i' was not declared in this scope
7 | for(int j=N-1;j>=i+1;j--){
| ^
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
14 | }
| ^
a.cc: At global scope:
a.cc:15:1: er... |
s998369791 | p02259 | C++ | #include<iostream>
using name space 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( int i =0; i<N;i+... | a.cc:2:7: error: expected nested-name-specifier before 'name'
2 | using name space std;
| ^~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:6:12: error: expected initializer before numeric constant
6 | bool flag 1;
| ^
a.cc:7:17: error: 'flag' was not declared in this scope
... |
s252665852 | p02259 | C++ | #include<iostream>
using name space 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( int i =0; i<N... | a.cc:2:7: error: expected nested-name-specifier before 'name'
2 | using name space std;
| ^~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:7: error: expected ';' before numeric constant
8 | flag 0;
| ^~
| ;
a.cc:10:12: error: ISO C++ forbids comparison between poi... |
s392559903 | 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( int i =0; i<N;... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:7: error: expected ';' before numeric constant
8 | flag 0;
| ^~
| ;
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(A[j]<A{j-1}){
| ~~~~^~
a.cc:10:14: error: expected ... |
s232222552 | 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( ... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:13:11: error: expected ';' before ':' token
13 | sw++:
| ^
| ;
|
s453469387 | p02259 | C++ | #include <stdio.h>
int bubbleSort(int A[], int N) {
int i, j;
int sw = 0;
int flag = 1;
for ( i = 0; flag; i++ ) {
flag = 0;
for ( 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 N;
int A[100];
int... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:11:33: error: 'swap' was not declared in this scope; did you mean 'sw'?
11 | swap(&A[j], &A[j - 1]);
| ^~~~
| sw
|
s695791736 | p02259 | C++ | #include <iostream>
using namespace std;
int bubbleSort(int A[], int N) {
int i, j;
int sw = 0;
int flag = 1;
for ( i = 0; flag; i++ ) {
flag = 0;
for ( 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) {
in... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:12:37: error: no matching function for call to 'swap(int*, int*)'
12 | swap(&A[j], &A[j - 1]);
| ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
... |
s598853866 | p02259 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int C;
void bubbleSort(int A[],int N){
bool flag=true;
whlie(flag){
flag=false;
for(int j=N-1;j>=1;j--){
if(A[j]<a[j-1]){
swap(A[j],A[j-1);
C++;
flag=true;
}
}
}
}
int main()
{
int N;
cin>>N;
int A[100];
for(int i=0;i<N;i++){
cin... | a.cc: In function 'void bubbleSort(int*, int)':
a.cc:9:9: error: 'whlie' was not declared in this scope
9 | whlie(flag){
| ^~~~~
a.cc: In function 'int main()':
a.cc:42:2: error: expected '}' at end of input
42 | }
| ^
a.cc:22:1: note: to match this '{'
22 | {
| ^
|
s896949757 | p02259 | C++ | #include <iostream>
using namespace std;
int Count;
void BubbleSort(int A[],int N){
bool flag=true;
while(flag){
flag=false;
for(int j=N-1;j>=1;j--){
if(A[j]<A[j-1]){
swap(A[j],A[j-1]);
count++;
flag=true;
}
}
}
}
int main(){
int N;
cin>>N;
int A[100];
for(int i=0;i<N;i++){
cin... | a.cc: In function 'void BubbleSort(int*, int)':
a.cc:15:33: error: 'count' was not declared in this scope; did you mean 'Count'?
15 | count++;
| ^~~~~
| Count
a.cc: In function 'int main()':
a.cc:31:9: error: ... |
s027294811 | p02259 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int x;
void BubbleSort(int A[],int N){
bool flag = true;
while(flag){
flag = false;
for(int j = N-1; j>=1; j--){
if(A[j]<A[j-1]){
swap(A[j],A[j-1]);
x++;
flag = true;
}
}
}
int main(){
int N;
cin ... | a.cc: In function 'void BubbleSort(int*, int)':
a.cc:21:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
21 | int main(){
| ^~
a.cc:21:9: note: remove parentheses to default-initialize a variable
21 | int main(){
| ^~
| --
a.cc:2... |
s043413642 | 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(){
inta[100],n,sw;
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
s... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:9:25: error: expected primary-expression before '<' token
9 | if(a[j])<a[j-1]){
| ^
a.cc:15:11: error: expected ';' before '}' token
15 | }return sw
| ^
| ;
16 | }
| ~ ... |
s020939424 | 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(){
inta[100],n,sw;
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
s... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:9:25: error: expected primary-expression before '<' token
9 | if(a[j])<a[j-1]){
| ^
a.cc:15:11: error: expected ';' before '}' token
15 | }return sw
| ^
| ;
16 | }
| ~ ... |
s980050367 | 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(int i=0;i<n;i++)cin>>a[i];
... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:9:25: error: expected primary-expression before '<' token
9 | if(a[j])<a[j-1]){
| ^
|
s760863440 | 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>=i1;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];
sw = bubblesort(A... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:7:21: error: expected ';' before ')' token
7 | for(int i=0;flag+i++){
| ^
| ;
a.cc:9:18: error: 'i1' was not declared in this scope; did you mean 'i'?
9 | for(int j=N-1;j>=i1;j--){
| ^~... |
s754385861 | 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>=i1;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];
sw = bubblesort(A... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:7:21: error: expected ';' before ')' token
7 | for(int i=0;flag+i++){
| ^
| ;
a.cc:9:18: error: 'i1' was not declared in this scope; did you mean 'i'?
9 | for(int j=N-1;j>=i1;j--){
| ^~... |
s895348591 | p02259 | C++ | #include<iostream>
using namespaca std;
int bubbleSort(int A[],int N){
int sw = 0;
bool flag = 1;
for(int i=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<... | a.cc:2:7: error: expected nested-name-specifier before 'namespaca'
2 | using namespaca std;
| ^~~~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:9:29: error: 'intj' was not declared in this scope; did you mean 'int'?
9 | for(intj=N-1;j>=i+1;j--){
| ... |
s801944577 | p02259 | C++ | #include<iostream>
using namespaca std;
int bubbleSort(int A[],int N){
int sw = 0;
bool flag = 1;
for(int i=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+... | a.cc:2:7: error: expected nested-name-specifier before 'namespaca'
2 | using namespaca std;
| ^~~~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:9:21: error: 'intj' was not declared in this scope; did you mean 'int'?
9 | for(intj=N-1;j>=i+1;j--){
| ... |
s073987613 | p02259 | C++ | #include<iostream>
using namespaca std;
int bubbleSort(int A[],int N){
int sw = 0;
bool flag = 1;
for(int i=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+... | a.cc:2:7: error: expected nested-name-specifier before 'namespaca'
2 | using namespaca std;
| ^~~~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:9:21: error: 'intj' was not declared in this scope; did you mean 'int'?
9 | for(intj=N-1;j>=i+1;j--){
| ... |
s248622011 | p02259 | C++ | #include<iostream>
using namespace std;
int bubblesort(int A[],int N){
int sw=0;
bool flag=1;
for(int i=0;frag;i++){
frag=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(int i=0;i<N;i++)cin>>A[i]... | a.cc: In function 'int bubblesort(int*, int)':
a.cc:7:21: error: 'frag' was not declared in this scope; did you mean 'flag'?
7 | for(int i=0;frag;i++){
| ^~~~
| flag
a.cc: In function 'int main()':
a.cc:25:22: error: 'cont' was not declared in this scope; ... |
s184439540 | p02259 | C++ | #inclide<stdio.h>
int main(void)
{
int i, j, temp;
scanf("5d)
for (i = 0; i < (array_size - 1); i++) {
for (j = (array_size - 1); j > i; j--) {
if (numbers[j-1] > numbers[j]) {
temp = numbers[j-1];
numbers[j-1] = numbers[j];
numbers[j] = temp;
printf("%d" ,temp);
}
}
}
retur... | a.cc:1:2: error: invalid preprocessing directive #inclide; did you mean #include?
1 | #inclide<stdio.h>
| ^~~~~~~
| include
a.cc:5:7: warning: missing terminating " character
5 | scanf("5d)
| ^
a.cc:5:7: error: missing terminating " character
5 | scanf("5d)
| ^~~~
a.cc:... |
s426815162 | p02259 | C++ | #include<iostream>
using namespace std;
int bubbleSort(int A[],int N){
int sw=0;
bool flag=1;
for(int i=0;frag;i++){
frag=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(int i=0;i<N;i++)cin>>A[i]... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:7:21: error: 'frag' was not declared in this scope; did you mean 'flag'?
7 | for(int i=0;frag;i++){
| ^~~~
| flag
a.cc: In function 'int main()':
a.cc:25:22: error: 'cont' was not declared in this scope; ... |
s529754211 | p02259 | C++ | #include<iostream>
using namespaca std;
int bubbleSort(int A[],int N){
int sw = 0;
bool flag = 1;
for(int i=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+... | a.cc:2:7: error: expected nested-name-specifier before 'namespaca'
2 | using namespaca std;
| ^~~~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:9:21: error: 'intj' was not declared in this scope; did you mean 'int'?
9 | for(intj=N-1;j>=i+1;j--){
| ... |
s742478950 | p02259 | C++ | #include<iostream>
using namespaca std;
int bubbleSort(int A[],int N){
int sw = 0;
bool flag = 1;
for(int i=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+... | a.cc:2:7: error: expected nested-name-specifier before 'namespaca'
2 | using namespaca std;
| ^~~~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:9:21: error: 'intj' was not declared in this scope; did you mean 'int'?
9 | for(intj=N-1;j>=i+1;j--){
| ... |
s655995913 | p02259 | C++ | #include<iostream>
using namespaca 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(int i = 0; i ... | a.cc:2:7: error: expected nested-name-specifier before 'namespaca'
2 | using namespaca std;
| ^~~~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:11:33: error: 'swap' was not declared in this scope
11 | swap(A[j],A[j-1]);
| ... |
s470907993 | 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(int i=0;i<N;i++)cin >> A[... | a.cc: In function 'int main()':
a.cc:25:5: error: 'bobbleSort' was not declared in this scope; did you mean 'bubbleSort'?
25 | sw=bobbleSort(A,N);
| ^~~~~~~~~~
| bubbleSort
|
s876782946 | 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(int... | a.cc:23:17: error: extended character is not valid in an identifier
23 | if (i) cout << " ";
| ^
a.cc:23:24: error: extended character is not valid in an identifier
23 | if (i) cout << " ";
| ^
a.cc: In function 'int main()':
a... |
s452386657 | 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(int i=;i<N;i++)cin<<A[... | a.cc: In function 'int main()':
a.cc:22:12: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
22 | cin<<N;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:22:12... |
s451570776 | 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(int i=;i<N;i++)cin>>A[... | a.cc: In function 'int main()':
a.cc:23:19: error: expected primary-expression before ';' token
23 | for(int i=;i<N;i++)cin>>A[i];
| ^
a.cc:27:19: error: expected primary-expression before ';' token
27 | for(int i=;i<N;i++){
| ^
a.cc:31:15: error: 'e... |
s526203959 | 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(int i=0;i<N;i++)cin>>A... | a.cc: In function 'int main()':
a.cc:31:15: error: 'end1' was not declared in this scope
31 | cout<<end1;
| ^~~~
|
s917918226 | 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(int i=0;i<N;i++)c... | a.cc: In function 'int main()':
a.cc:32:17: error: 'end1' was not declared in this scope
32 | cout << end1;
| ^~~~
|
s734972364 | 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(int i=0;i<N;++){
... | a.cc: In function 'int bubbleSort(int*, int)':
a.cc:13:51: error: expected primary-expression before '?' token
13 | swap(A[j],A[j-1])???
| ^
a.cc:13:52: error: expected primary-expression before '?' token
13 | ... |
s988312244 | 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:... |
s878931143 | 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:... |
s908279873 | 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:... |
s488334209 | 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:... |
s075962784 | 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:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.