criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <utility>
using namespace System;
using namespace std;
const int MAX_W = 30;
int main()
{
    int w,n;
	int num[MAX_W+1]={};
	char c;
	cin>>w>>n;
	for(int i=0;i<w;i++){
		num[i]=i+1;
	}
	int a,b;
	for(int i=0;i<n;i++){
		cin>>a>>c>>b;
		swap(num[a-1],num[b-1]);
	}
	for(int i=0;i<w;i++){
		cout<<num[i]<<endl;
	}
    return 0;
}

Compiler output:
a.cc:3:17: error: 'System' is not a namespace-name
    3 | using namespace System;
      |                 ^~~~~~
Language: C++

#include<stdio.h>

int main(){

int x[32][2]={};
int w,n;

scanf("%d",&w);
scanf("%d",%n);
for(int i=0;i<=w;i++)
x[i][0]=i;

for(int i=0;i<n;i++)
{
int a1,a2;
scanf("%d,%d",&a1,&a2);
int t=x[a1][0];x[a1][0]=x[a2][0];x[a2][0]=t;
}

for(int i=1;i<=w;i++)
printf("%d\n",x[i][0]);

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected primary-expression before '%' token
    9 | scanf("%d",%n);
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main(){
int w = 0;
cin >> w ;
int n = 0;
cin >> n;
int i = 1;
int a[w];
loop(i = 0,i < w,i++){
a[i] = i + 1;
}
loop(i = 1,i <= n,i++){
int aa = 0;int bb = 0;
char split;
cin >> aa >> split >> bb ;
int c = 0;
c = a[aa - 1];
a[aa - 1] = a[bb - 1];
a[bb - 1] = c;
}
loop(i = 0,i < w, i++)
{
cout << a[i] << endl;
}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:1: error: 'loop' was not declared in this scope
   11 | loop(i = 0,i < w,i++){
      | ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int w = 0;
cin >> w ;
int n = 0;
cin >> n;
int i = 1;
int a[w];
for(i = 0,i < w,i++){
a[i] = i + 1;
}
for(i = 1,i <= n,i++){
int aa = 0;int bb = 0;
char split;
cin >> aa >> split >> bb ;
int c = 0;
c = a[aa - 1];
a[aa - 1] = a[bb - 1];
a[bb - 1] = c;
}
for(i = 0,i < w, i++){
cout << a[i] << endl;
}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: expected ';' before ')' token
   11 | for(i = 0,i < w,i++){
      |                    ^
      |                    ;
a.cc:14:1: error: expected primary-expression before 'for'
   14 | for(i = 1,i <= n,i++){
      | ^~~
a.cc:13:2: error: expected ';' before 'for'
   13 | }
      |  ^
      |  ;
   14 | for(i = 1,i <= n,i++){
      | ~~~
a.cc:14:1: error: expected primary-expression before 'for'
   14 | for(i = 1,i <= n,i++){
      | ^~~
a.cc:13:2: error: expected ')' before 'for'
   13 | }
      |  ^
      |  )
   14 | for(i = 1,i <= n,i++){
      | ~~~
a.cc:11:4: note: to match this '('
   11 | for(i = 0,i < w,i++){
      |    ^
a.cc:14:21: error: expected ';' before ')' token
   14 | for(i = 1,i <= n,i++){
      |                     ^
      |                     ;
a.cc:23:1: error: expected primary-expression before 'for'
   23 | for(i = 0,i < w, i++){
      | ^~~
a.cc:22:2: error: expected ';' before 'for'
   22 | }
      |  ^
      |  ;
   23 | for(i = 0,i < w, i++){
      | ~~~
a.cc:23:1: error: expected primary-expression before 'for'
   23 | for(i = 0,i < w, i++){
      | ^~~
a.cc:22:2: error: expected ')' before 'for'
   22 | }
      |  ^
      |  )
   23 | for(i = 0,i < w, i++){
      | ~~~
a.cc:14:4: note: to match this '('
   14 | for(i = 1,i <= n,i++){
      |    ^
a.cc:23:21: error: expected ';' before ')' token
   23 | for(i = 0,i < w, i++){
      |                     ^
      |                     ;
a.cc:26:5: error: expected primary-expression before 'return'
   26 |     return 0;
      |     ^~~~~~
a.cc:25:2: error: expected ';' before 'return'
   25 | }
      |  ^
      |  ;
   26 |     return 0;
      |     ~~~~~~
a.cc:26:5: error: expected primary-expression before 'return'
   26 |     return 0;
      |     ^~~~~~
a.cc:25:2: error: expected ')' before 'return'
   25 | }
      |  ^
      |  )
   26 |     return 0;
      |     ~~~~~~
a.cc:23:4: note: to match this '('
   23 | for(i = 0,i < w, i++){
      |    ^
Language: C++



#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

const int MAX_HORIZONTAL = 30;
const int MAX_VERTICAL = 30;

int main(){

	int VerticalLines;
	int HorizontalLines;
	int HorizonA[MAX_HORIZONTAL];
	int HorizonB[MAX_HORIZONTAL];
	int Results[MAX_VERTICAL];



	cin >> VerticalLines;
	cin >> HorizontalLines;
	for (int i = 0; i < HorizontalLines; ++i){ char c[32];  scanf_s("%d,%d", &HorizonA[i], &HorizonB[i]); }

	for (int i = 0; i < VerticalLines; ++i){ Results[i] = i + 1; }

	

	for (int i = 0; i < HorizontalLines; ++i){
		int Swap = Results[HorizonA[i] - 1];
		Results[HorizonA[i]-1] = Results[HorizonB[i] - 1];
		Results[HorizonB[i] - 1] = Swap;
	}

	
	for (int i = 0; i < VerticalLines; ++i){
		cout << Results[i] << endl;
	}





	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:65: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   26 |         for (int i = 0; i < HorizontalLines; ++i){ char c[32];  scanf_s("%d,%d", &HorizonA[i], &HorizonB[i]); }
      |                                                                 ^~~~~~~
      |                                                                 scanf
Language: C++


w = input()
n = input()
k = []
for i in range(w+1):
    k.append(i)
for i in range(n):
    l = raw_input()
    a = int(l[0])
    b = int(l[2])
    temp = k[a]
    k[a] = k[b]
    k[b] = temp

for i in range(w):
    print k[i+1]

Compiler output:
a.cc:2:1: error: 'w' does not name a type
    2 | w = input()
      | ^
Language: C++

int main(){

	int w, n;
	int num[30] = { 0 };
	int a, b;

	cin >> w;
	cin >> n;

	for (int i = 0; i<w; i++)
		num[i] = i + 1;

	for (int i = 0; i<n; i++){

		cin >> a >> b;

		int tmp = num[a-1];
		num[a-1] = num[b-1];
		num[b-1] = tmp;


	}


	for (int i = 0; i<w; i++)
		cout << num[i] << "\n";

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> w;
      |         ^~~
a.cc:26:17: error: 'cout' was not declared in this scope
   26 |                 cout << num[i] << "\n";
      |                 ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){

	int w, n;
	int num[30] = { 0 };
	int a, b;
	char c

	cin >> w;
	cin >> n;

	for (int i = 0; i<w; i++)
		num[i] = i + 1;

	for (int i = 0; i<n; i++){

		cin >> a >> c >> b;


		int tmp = num[a-1];
		num[a-1] = num[b-1];
		num[b-1] = tmp;


	}


	for (int i = 0; i<w; i++)
		cout << num[i] << "\n";

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: expected initializer before 'cin'
   11 |         cin >> w;
      |         ^~~
a.cc:19:29: error: 'c' was not declared in this scope
   19 |                 cin >> a >> c >> b;
      |                             ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS 1

#include <cstdio>

using namespace std;

int main()
{
	int W, N, A[31], B[31], C[31];

	cin >> W >> N;

	for (int i = 1; i <= N; i++)
	{
		scanf("%d,%d", &(A[i]), &(B[i]));
	}

	for (int i = 1; i <= W; i++)
	{
		int t = i;

		for (int j = 1; j <= N; j++)
		{
			if (A[j] == t)
			{
				t = B[j];
			}
			else if (B[j] == t)
			{
				t = A[j];
			}
		}

		C[t] = i;
	}

	for (int i = 1; i <= W; i++)
	{
		printf("%d\n", C[i]);
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> W >> N;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <cstdio>
  +++ |+#include <iostream>
    4 |
Language: C++

include<iostream>
#include<cstdio>

using namespace std;

void change(int *, int *);

int main(void){
	int w,n;
	int p[31];
	int a, b;
	cin >> w;
	cin >> n;
	
	for(int i = 1; i <= w; i++){
		p[i] = i;
	}
	
	for(int j = 0; j < n; j++){
		scanf("%d,%d", &a, &b);
		change(&p[a], &p[b]);
		
	}
	for(int i = 1; i <= w; i++){
		cout << p[i] << endl;
	}
	return 0;
}

void change(int *x, int *y){
	int type = *x;
	*x = *y;
	*y = type;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> w;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstdio>
  +++ |+#include <iostream>
    3 | 
a.cc:25:17: error: 'cout' was not declared in this scope
   25 |                 cout << p[i] << endl;
      |                 ^~~~
a.cc:25:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:33: error: 'endl' was not declared in this scope
   25 |                 cout << p[i] << endl;
      |                                 ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<cstdio>
  +++ |+#include <ostream>
    3 |
Language: C++

#include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;






int main()
{
	int n, w;
	int a[30], b[30],c[30];
	cin >> w;
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf_s("%d,%d", &a[i], &b[i]);
		
	}
	for (int i = 1; i <= w; i++) {
		c[i] = i;
	}
	for (int i = 0; i < n; i++) {
		swap(c[a[i]], c[b[i]]);
	}
	for (int i = 1; i <= w; i++) {
		cout << c[i] << endl;
	}
	

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   24 |                 scanf_s("%d,%d", &a[i], &b[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

ude <iostream>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

int main(void){
	std::ios_sync_with(false);
	std::cin.tie(0);

	std::cin >> w;
	std::cin >> n;

	for(int i = 0; i <= w; i++){
		out[i] = i;
	}

	for(int i = 1; i <= n; i++){
		std::cin >> a[i] >> b[i];
		chenge(&out[a[i]], &out[b[i]]);
	}
	
	for(int i = 1; i <= w; i++){
		std::cout << out[i] << ' ';
	}

	std::cout << '/n';

	return 0;
}

Compiler output:
a.cc:39:22: warning: multi-character character constant [-Wmultichar]
   39 |         std::cout << '/n';
      |                      ^~~~
a.cc:1:1: error: 'ude' does not name a type
    1 | ude <iostream>
      | ^~~
a.cc:10:9: error: 'W_MAX' was not declared in this scope; did you mean 'N_MAX'?
   10 | int out[W_MAX + 1];
      |         ^~~~~
      |         N_MAX
a.cc: In function 'int main()':
a.cc:20:14: error: 'ios_sync_with' is not a member of 'std'
   20 |         std::ios_sync_with(false);
      |              ^~~~~~~~~~~~~
a.cc:21:14: error: 'cin' is not a member of 'std'
   21 |         std::cin.tie(0);
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | ude <iostream>
a.cc:23:14: error: 'cin' is not a member of 'std'
   23 |         std::cin >> w;
      |              ^~~
a.cc:23:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:14: error: 'cin' is not a member of 'std'
   24 |         std::cin >> n;
      |              ^~~
a.cc:24:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:17: error: 'out' was not declared in this scope
   27 |                 out[i] = i;
      |                 ^~~
a.cc:31:22: error: 'cin' is not a member of 'std'
   31 |                 std::cin >> a[i] >> b[i];
      |                      ^~~
a.cc:31:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:25: error: 'out' was not declared in this scope
   32 |                 chenge(&out[a[i]], &out[b[i]]);
      |                         ^~~
a.cc:36:22: error: 'cout' is not a member of 'std'
   36 |                 std::cout << out[i] << ' ';
      |                      ^~~~
a.cc:36:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:30: error: 'out' was not declared in this scope
   36 |                 std::cout << out[i] << ' ';
      |                              ^~~
a.cc:39:14: error: 'cout' is not a member of 'std'
   39 |         std::cout << '/n';
      |              ^~~~
a.cc:39:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

int main(void){
	std::ios_sync_with(false);
	std::cin.tie(0);

	std::cin >> w;
	std::cin >> n;

	for(int i = 0; i <= w; i++){
		out[i] = i;
	}

	for(int i = 1; i <= n; i++){
		std::cin >> a[i] >> b[i];
		chenge(&out[a[i]], &out[b[i]]);
	}
	
	for(int i = 1; i <= w; i++){
		std::cout << out[i] << ' ';
	}

	std::cout << '/n';

	return 0;
}

Compiler output:
a.cc:39:22: warning: multi-character character constant [-Wmultichar]
   39 |         std::cout << '/n';
      |                      ^~~~
a.cc: In function 'int main()':
a.cc:20:14: error: 'ios_sync_with' is not a member of 'std'
   20 |         std::ios_sync_with(false);
      |              ^~~~~~~~~~~~~
Language: C++

#include <iostream>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

int main(void){
	ios::sync_with_stdio(false);
	std::cin.tie(0);

	std::cin >> w;
	std::cin >> n;

	for(int i = 0; i <= w; i++){
		out[i] = i;
	}

	for(int i = 1; i <= n; i++){
		std::cin >> a[i] >> b[i];
		chenge(&out[a[i]], &out[b[i]]);
	}
	
	for(int i = 1; i <= w; i++){
		std::cout << out[i] << ' ';
	}

	std::cout << '/n';

	return 0;
}

Compiler output:
a.cc:39:22: warning: multi-character character constant [-Wmultichar]
   39 |         std::cout << '/n';
      |                      ^~~~
a.cc: In function 'int main()':
a.cc:20:9: error: 'ios' has not been declared
   20 |         ios::sync_with_stdio(false);
      |         ^~~
Language: C++

w=gets.to_i
n=gets.to_i
a=[*0..w]
n.times{b,c=gets.chomp.split(',').map(&:to_i);a[b],a[c]=a[c],a[b]}
puts a[1..w]

Compiler output:
a.cc:3:5: error: too many decimal points in number
    3 | a=[*0..w]
      |     ^~~~
a.cc:5:8: error: too many decimal points in number
    5 | puts a[1..w]
      |        ^~~~
a.cc:1:1: error: 'w' does not name a type
    1 | w=gets.to_i
      | ^
a.cc:5:1: error: 'puts' does not name a type
    5 | puts a[1..w]
      | ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>
#include <cmath>

int main(void)
{
  int w, n;

  std::cin >> w >> n;

  std::vector<int> base;
  for (int i = 0; i < w; i++) {
    base.push_back(i + 1);
  }

  for (int i = 0; i < n; i++) {
    int a, b;
    scanf_s("%d,%d", &a, &b);
    std::swap(base[a - 1], base[b - 1]);
  }

  for (int i = 0; i < w; i++) {
    std::cout << base[i] << std::endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   22 |     scanf_s("%d,%d", &a, &b);
      |     ^~~~~~~
      |     scanf
Language: C++

w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]

Compiler output:
a.cc:1:10: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |          ^~~~~~~~~~~
a.cc:1:35: error: too many decimal points in number
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |                                   ^~~~
a.cc:1:112: error: too many decimal points in number
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |                                                                                                                ^~~~
a.cc:1:1: error: 'w' does not name a type
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      | ^
a.cc:1:22: error: 'n' does not name a type
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |                      ^
a.cc:1:31: error: 'a' does not name a type
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |                               ^
a.cc:1:41: error: 'n' does not name a type
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |                                         ^
a.cc:1:105: error: 'puts' does not name a type
    1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
      |                                                                                                         ^~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int w,n;
	cin>>w>>n;
	int c[31];
	for(int i=1;i<=w;i++)c[i]=i;
	for(int i=1;i<=n;i++){
		int a,b;
		scanf_s("%d,%d",&a,&b);
		swap(c[a],c[b]);
	}
	for(int i=1;i<=w;i++)cout<<c[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   20 |                 scanf_s("%d,%d",&a,&b);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int w,n;
	cin>>w>>n;
	int c[31];
	for(int i=1;i<=w;i++)c[i]=i;
	for(int i=1;i<=n;i++){
		int a,b;
		scanf_s("%d,%d",&a,&b);
		swap(c[a],c[b]);
	}
	for(int i=1;i<=w;i++)cout<<c[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   21 |                 scanf_s("%d,%d",&a,&b);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    // default
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    cin.ignore(INT_MAX, '\n');
    for (int i = 0; i < n; ++i) {
      string str, tmp_a, tmp_b;
      int a, b;
      getline(cin, str);
      istringstream iss(str);
      getline(iss, tmp_a, ',');
      getline(iss, tmp_b, ',');
      a = stoi(tmp_a) - 1;
      b = stoi(tmp_b) - 1;
      int tmp = vec[a];
      vec[a] = vec[b];
      vec[b] = tmp;
    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  } // while loop out
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'INT_MAX' was not declared in this scope
   16 |     cin.ignore(INT_MAX, '\n');
      |                ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <sstream>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    cin.ignore(INT_MAX, '\n');
    for (int i = 0; i < n; ++i) {
      string str, tmp_a, tmp_b;
      int a, b;
      getline(cin, str);
      istringstream iss(str);
      getline(iss, tmp_a, ',');
      getline(iss, tmp_b, ',');
      a = stoi(tmp_a) - 1;
      b = stoi(tmp_b) - 1;
      int tmp = vec[a];
      vec[a] = vec[b];
      vec[b] = tmp;
    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: 'INT_MAX' was not declared in this scope
   15 |     cin.ignore(INT_MAX, '\n');
      |                ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <sstream>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    // default
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    cin.ignore(INT_MAX, '\n');
    for (int i = 0; i < n; ++i) {

    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  } // while loop out
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'INT_MAX' was not declared in this scope
   16 |     cin.ignore(INT_MAX, '\n');
      |                ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <sstream>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main() {
	int w, n, i, x, y, z;
	char str[10], *a, *b;
	cin >> w >> n;
	vector<int> A(w);
	for (i = 0; i < w; i++) A[i] = i + 1;
	for (i = 0; i < n; i++) {
		cin >> str;
		a = strtok(str, ","); 
		x = atoi(a);
		b = strtok(NULL, ","); 
		y = atoi(b);
		z = A[x - 1];
		A[x-1] = A[y-1]; A[y-1] = z;
	}
	for (i = 0; i < w; i++) cout << A[i] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
   14 |                 a = strtok(str, ",");
      |                     ^~~~~~
      |                     strtoq
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main() {
	int w, n, i, x, y, z;
	char str[10], *a, *b;
	cin >> w >> n;
	vector<int> A(w);
	for (i = 0; i < w; i++) A[i] = i + 1;
	for (i = 0; i < n; i++) {
		cin >> str;
		a = strtok_s(str, ","); 
		x = atoi(a);
		b = strtok_s(NULL, ","); 
		y = atoi(b);
		z = A[x - 1];
		A[x-1] = A[y-1]; A[y-1] = z;
	}
	for (i = 0; i < w; i++) cout << A[i] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'strtok_s' was not declared in this scope; did you mean 'strtol_l'?
   14 |                 a = strtok_s(str, ",");
      |                     ^~~~~~~~
      |                     strtol_l
Language: C++

#include <iostream>

using namespace std;

int main(){
	int w, n;
	cin >> w >> n;
	int s[w];

	for(int i=0; i<w; i++){
		s[i] = i+1;
		while(n--){
		int a, b, c;
		cin >> a >> b;

		int tmp = s[a-1];
		s[a-1] = s[b-1];
		s[b-1] = tmp;
	}

	for(int i=0; i<w; i++){
		cout << s[i];
	}
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

a = (1..gets.to_i).to_a
gets.to_i.times{
	x,y = gets.split(",").map(&:to_i)
	a[x-1], a[y-1] = a[y-1], a[x-1]
}
puts a

Compiler output:
a.cc:1:6: error: too many decimal points in number
    1 | a = (1..gets.to_i).to_a
      |      ^~~~~~~~~~~~
a.cc:1:1: error: 'a' does not name a type
    1 | a = (1..gets.to_i).to_a
      | ^
a.cc:6:1: error: 'puts' does not name a type
    6 | puts a
      | ^~~~
Language: C++

#include<iostream>
#include<stdio.h>

using namespace std;

int main(void) {


	//0011
	int Line[31], w=0, n=0, a, b, tmp;
	cin >> w;
	cin >> n;
	for (int i=0; i < 30; i++) {
		Line[i] = i;
	}
	for (int j = 0; j < n; j++) {
		scanf_s("%d,%d", &a, &b);
		tmp = Line[a];
		Line[a] = Line[b];
		Line[b] = tmp;
	}
	for (int k = 1; k <= w; k++) {
		cout << Line[k] << endl;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   17 |                 scanf_s("%d,%d", &a, &b);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include<iostream>
#include<stdio.h>
#include<stdlib.h>

using namespace std;

int main(void) {


	//0011
	int Line[31], w=0, n=0, a, b, tmp;
	cin >> w;
	cin >> n;
	for (int i=0; i < 30; i++) {
		Line[i] = i;
	}
	for (int j = 0; j < n; j++) {
		scanf_s("%d,%d", &a, &b);
		tmp = Line[a];
		Line[a] = Line[b];
		Line[b] = tmp;
	}
	for (int k = 1; k <= w; k++) {
		cout << Line[k] << endl;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   18 |                 scanf_s("%d,%d", &a, &b);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int w,n; cin >> w >> n;
int a[31];
rep(i,0,w) a[i] = i+1;

rep(i,0,n) {
int x,y;
scanf("%d,%d",x,y);
swap(a[x-1],a[y-1]);
}
rep(i,0,n) cout << a[i] << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'i' was not declared in this scope
    7 | rep(i,0,w) a[i] = i+1;
      |     ^
a.cc:7:1: error: 'rep' was not declared in this scope
    7 | rep(i,0,w) a[i] = i+1;
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,n) for(inti =a; i<n; i++)
using namespace std;
 
int main() {
int w,n; cin >> w >> n;
int a[31];
rep(i,0,w) a[i] = i+1;
 
rep(i,0,n) {
int x,y;
scanf("%d,%d",&x,&y);
swap(a[x-1],a[y-1]);
}
rep(i,0,n) cout << a[i] << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:24: error: 'inti' was not declared in this scope; did you mean 'int'?
    2 | #define rep(i,a,n) for(inti =a; i<n; i++)
      |                        ^~~~
a.cc:8:1: note: in expansion of macro 'rep'
    8 | rep(i,0,w) a[i] = i+1;
      | ^~~
a.cc:8:5: error: 'i' was not declared in this scope
    8 | rep(i,0,w) a[i] = i+1;
      |     ^
a.cc:2:33: note: in definition of macro 'rep'
    2 | #define rep(i,a,n) for(inti =a; i<n; i++)
      |                                 ^
a.cc:2:24: error: 'inti' was not declared in this scope; did you mean 'int'?
    2 | #define rep(i,a,n) for(inti =a; i<n; i++)
      |                        ^~~~
a.cc:10:1: note: in expansion of macro 'rep'
   10 | rep(i,0,n) {
      | ^~~
a.cc:10:5: error: 'i' was not declared in this scope
   10 | rep(i,0,n) {
      |     ^
a.cc:2:33: note: in definition of macro 'rep'
    2 | #define rep(i,a,n) for(inti =a; i<n; i++)
      |                                 ^
a.cc:2:24: error: 'inti' was not declared in this scope; did you mean 'int'?
    2 | #define rep(i,a,n) for(inti =a; i<n; i++)
      |                        ^~~~
a.cc:15:1: note: in expansion of macro 'rep'
   15 | rep(i,0,n) cout << a[i] << endl;
      | ^~~
a.cc:15:5: error: 'i' was not declared in this scope
   15 | rep(i,0,n) cout << a[i] << endl;
      |     ^
a.cc:2:33: note: in definition of macro 'rep'
    2 | #define rep(i,a,n) for(inti =a; i<n; i++)
      |                                 ^
Language: C++

//#define scanf_s scanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 30
int main(void)
{
	int w, n, a, b, x;
	int list[MAX] = { 0 };
	scanf_s("%d", &w);
	scanf_s("%d", &n);
	for (int i = 0; i < w;++i) {
		list[i] = i + 1;
	}
	for (int i = 0; i < n; ++i) {
		scanf_s("%d,%d", &a, &b);
		x = list[a - 1]; list[a - 1] = list[b - 1]; list[b - 1] = x;
	}
	for (int i = 0; i < w; ++i) {
		printf("%d\n", list[i]);
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   12 |         scanf_s("%d", &w);
      |         ^~~~~~~
      |         scanf
Language: C++


#include <iostream>
#include<STRING>
using namespace std;
int main() {
    int line;
    int side;
    int sidenum1,sidenum2;
    int linenum[line];
    char waste;
    cin>>line>>side;
    for(int i=0; i<line; i++){
        linenum[i]=i+1;
    }
    for(int i=0; i<side; i++){
        cin>>sidenum1>>waste>>sidenum2;
        swap(linenum[sidenum1-1],linenum[sidenum2-1]);
    }
    for(int i=0; i<line; i++){
        cout<<linenum[i]<<endl;
    }
    return 0;
}

Compiler output:
a.cc:3:9: fatal error: STRING: No such file or directory
    3 | #include<STRING>
      |         ^~~~~~~~
compilation terminated.
Language: C++

 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 int v[35];
 
 int main()
 {
   int w,n;
   cin>>w>>n;
   for(int i=1;i<=w;i++) v[i]=i;
   while(n--)
   {
     int l,r;
     char temp
     cin>>l>>temp>>r;
     swap(v[l],v[r]);          
   } 
   for(int i=1;i<=w;i++)
   {
     cout<<v[i]<<endl;        
   }
   //while(1);      
   return 0;    
 }
 
 

Compiler output:
a.cc: In function 'int main()':
a.cc:27:6: error: expected initializer before 'cin'
   27 |      cin>>l>>temp>>r;
      |      ^~~
Language: C++

using namespace std;

pair<int, int> p;
int a[31];

int main()
{
	int w, n, r;
	cin >> w >> n;
	for (int i = 1; i < w + 1; i++)
		a[i] = i;
	for (int i = 0; i < n; i++)
	{
		scanf("%d,%d", p.first, p.second);
		r = a[p.first];
		a[p.first] = a[p.second];
		a[p.second] = r;
	}
	for (int i = 1; i < w + 1; i++)
	{
		cout << a[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc:3:1: error: 'pair' does not name a type
    3 | pair<int, int> p;
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> w >> n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:14:32: error: 'p' was not declared in this scope
   14 |                 scanf("%d,%d", p.first, p.second);
      |                                ^
a.cc:14:17: error: 'scanf' was not declared in this scope
   14 |                 scanf("%d,%d", p.first, p.second);
      |                 ^~~~~
a.cc:21:17: error: 'cout' was not declared in this scope
   21 |                 cout << a[i] << endl;
      |                 ^~~~
a.cc:21:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:33: error: 'endl' was not declared in this scope
   21 |                 cout << a[i] << endl;
      |                                 ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

pair<int, int> p;
int a[31];

int main()
{
	int w, n, r;
	cin >> w >> n;
	for (int i = 1; i < w + 1; i++)
		a[i] = i;
	for (int i = 0; i < n; i++)
	{
		scanf_s("%d,%d", &p.first, &p.second);
		r = a[p.first];
		a[p.first] = a[p.second];
		a[p.second] = r;
	}
	for (int i = 1; i < w + 1; i++)
	{
		cout << a[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   21 |                 scanf_s("%d,%d", &p.first, &p.second);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include<iostream>
void swap(int a,int b){
	int t=a;
	a=b;
	b=t;
	return ;
	}
int main(){
	int w;
	int n;
	int c[30];
	int a[30];
	int b[30];
	scanf("%d",&w);
	scanf("%d",&n);
	for(int i=0;i<w;i++){
		c[i]=i;
		}
	for(int i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
        swap(c[a[i]],c[b[i]]);
       }
     for(int i=0;i<w;i++){
     	cout<<c[i]<<endl;
     }
     return 0;
    }
	

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |         cout<<c[i]<<endl;
      |         ^~~~
      |         std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   24 |         cout<<c[i]<<endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

include <bits/stdc++.h>
using namespace std;

int main() {
	int w,n;
	scanf("%d %d",&w,&n);
	int a[n];
	int b[n];
	for(int i=0;i<n;i++){
		scanf("%d,%d",&a[i],&b[i]);
	}
	int ans[w+1];
	for(int i=1;i<=w;i++)ans[i]=i;
	int temp;
	for(int i=0;i<n;i++){
		temp=ans[a[i]];
		ans[a[i]]=ans[b[i]];
		ans[b[i]]=temp;
	}
	for(int i=1;i<=w;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
    6 |         scanf("%d %d",&w,&n);
      |         ^~~~~
a.cc:21:17: error: 'cout' was not declared in this scope
   21 |                 cout<<ans[i]<<endl;
      |                 ^~~~
a.cc:21:31: error: 'endl' was not declared in this scope
   21 |                 cout<<ans[i]<<endl;
      |                               ^~~~
Language: C++

/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

void out1(vector<int> a) {
	for (size_t i = 0; i < a.size(); i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}

int main() {
	int w, n;
	cin >> w;	// ???????????°
	cin >> n;	// ?¨?????????°
	vector<int> begin(n);
	vector<int> end(n);
	vector<int> location(w);
	int num1 = 0;
	int num2 = 0;

	// ??\???
	for (size_t i = 0; i < n; i++)
	{
		scanf_s("%d,%d", &begin[i], &end[i]);
		cout << begin[i] << end[i] << endl;
	}

	// location????????????
	for (size_t i = 0; i < w; i++)
	{
		location[i] = i + 1;
		
	}
	
	// ????????\??¬????????§????????????
	for (size_t i = 0; i < w; i++)
	{
		vector<int> tmp(w,0);
		out1(tmp);
		tmp[i] = location[i];
		cout << "----i = " << i << "?????¨???----" << endl;
		for (size_t j = 0; j < n; j++)
		{
			if (begin[j] == location[i])
			{
				
				cout << begin[j] << "???" << end[j] << "?????\???????????????" << endl;
				location[i] = end[j];
			}
			else if (end[j] == location[i])
			{
				cout << end[j] << "???" << begin[j] << "?????\???????????????" << endl;
				location[i] = begin[j];
			}
			out1(location);
		}
	}
	// ???????????????
	vector<int> output(w,0);
	for (size_t i = 0; i < w; i++)
	{
		output[location[i]-1] = i;
	}

	// ???????????¨???????????????????????°??????1????¶????
	for (size_t i = 0; i < w; i++)
	{
		cout << output[i]+1 << endl;
	}


	return 0;
}

Compiler output:
a.cc:61:52: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
   61 |                 cout << "----i = " << i << "?????¨???----" << endl;
a.cc: In function 'int main()':
a.cc:44:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   44 |                 scanf_s("%d,%d", &begin[i], &end[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>
#include <chrono>

using namespace std;

class amida
{
	int w;
	vector<int> va;
public:
	amida(int _w) : w(_w){
		for(int i = 0; i < w; i++){
			va.push_back(i);
		}
	}
	void swap(int, int);
	void output();
};

void amida::swap(int a1, int b1)
{
	int temp = va[a1-1];
	va[a1-1] = va[b1-1];
	va[b1-1] = temp;
}

void amida::output()
{
	for(int i = 0; i < w; i++)
		cout << va[i]+1 << '\n';
}

int main()
{
	int w, n;
	int a1, b1;
	cin >> w;
	amida am(w);
	cin >> n;
	for(int i = 0; i < n; i++){
		string str;
		cin >> str;
		const char* chtemp = str.c_str();
		char *ct;
		a1 = atoi(strtok_s((char*)chtemp, ",", &ct));
		b1 = atoi(strtok_s(NULL, ",", &ct));
		am.swap(a1, b1);
	}
	am.output();

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:27: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
   54 |                 a1 = atoi(strtok_s((char*)chtemp, ",", &ct));
      |                           ^~~~~~~~
      |                           strtok_r
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
    int a[100]={},w,n,a,b,i;
    cin >> w;
    for(i=1;i<=w;i++){
        a[i] = i;
    }
    cin >> n;
    for(i=1;i<=n;i++){
        scanf("%d,%d",&a,&b);
        swap(a[a],a[b]);
    }
    for(int i=1;i<=w;i++){
        cout << a[i] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: conflicting declaration 'int a'
    7 |     int a[100]={},w,n,a,b,i;
      |                       ^
a.cc:7:9: note: previous declaration as 'int a [100]'
    7 |     int a[100]={},w,n,a,b,i;
      |         ^
a.cc:15:15: error: invalid types 'int [100][int [100]]' for array subscript
   15 |         swap(a[a],a[b]);
      |               ^
Language: C++

#include<stdio.h>
using namespace std;
const int MAX = 100;
int main() {
	int W, N;
	int t[MAX];

	cin >> W >> N;
	for (int i = 0; i < W; i++) {
		t[i] = i;
	}
	for (int i = 0; i < N; i++) {
		int a, b;
		scanf("%d,%d", &a, &b); a--; b--;
		swap(t[a], t[b]);
	}
	for (int i = 0; i < W; i++) {
		printf("%d\n", t[i] + 1);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> W >> N;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:15:17: error: 'swap' was not declared in this scope
   15 |                 swap(t[a], t[b]);
      |                 ^~~~
Language: C++

#include <cmath>
#include <cstdio>

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[len];
    for(int i = 0; i < len; i++){
        array[i] = i+1;
    }
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'cin' was not declared in this scope
   26 |     cin >> len;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <cstdio>
  +++ |+#include <iostream>
    3 | 
a.cc:37:9: error: 'cout' was not declared in this scope
   37 |         cout << array[i] << endl;
      |         ^~~~
a.cc:37:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:29: error: 'endl' was not declared in this scope
   37 |         cout << array[i] << endl;
      |                             ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <cstdio>
  +++ |+#include <ostream>
    3 |
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
	int w, n;
	int change[30][2];
	int line[30];
	cin >> w >> n;
	for (int i = 0; i < n; ++i) {
		scanf_s("%d,%d", &change[i][0], &change[i][1]);
	}
	
	for (int i = 0; i < w; ++i) {
		line[i] = i + 1;
	}
	for (int i = 0; i < n; ++i) {
		swap(line[change[i][0] - 1], line[change[i][1] - 1]);
		//for (int i = 0; i < w; ++i) {
		//	cout << line[i] << " ";
		//}
		//cout << endl;
		//cout << "--------------------------" << endl;
	}
	for (int i = 0; i < w; ++i) {
		cout << line[i] << endl;;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   14 |                 scanf_s("%d,%d", &change[i][0], &change[i][1]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
int w, n; 
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		roop(i, 2) {
			swap[i] = stoi(d[i]);
		}
		int before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   42 |                 roop(i, s.length) {
      |                         ~~^~~~~~
a.cc:27:33: note: in definition of macro 'roop'
   27 | #define roop(a,t) for(int a=0;a<t;a++)
      |                                 ^
Language: C++

// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t)  for(ll a=0;a<t;a++)
int main()
{
	ll w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		ll swap[2];
		roop(i, 2) {
			swap[i] = stoi(d[i]);
		}
		ll before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}


Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t)  for(ll a=0;a<t;a++)
int main()
{
	ll w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		ll swap[2];
		roop(i, 2) {
			swap[i] = stoi(d[i]);
		}
		ll before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   46 |                 roop(i, s.length) {
      |                         ~~^~~~~~
a.cc:30:33: note: in definition of macro 'roop'
   30 | #define roop(a,t)  for(ll a=0;a<t;a++)
      |                                 ^
Language: C++

// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++)
int main()
{
	int w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	int a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		roop(i, 2) {
			swap[i] = stoi(d[i]);
		}
		int before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   44 |                 roop(i, s.length) {
      |                         ~~^~~~~~
a.cc:28:33: note: in definition of macro 'roop'
   28 | #define roop(a,t) for(int a=0;a<t;a++)
      |                                 ^