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

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	int x[100] = {};
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	int y[100] = {};
	for(int i - 0; i < n; i++){
		cin >> y[i];
	}
	
	/*p=1*/
	double d1 = 0;
	for(int i = 0; i < n; i++){
		d1 += abs(x[i]-y[i]);
	}
	
	/*p=2*/
	double d2 = 0;
	for(int i = 0; i < n; i++){
		d2 += pow(abs(x[i]-y[i]),2.0);
	}
	d2 = sqrt(d2);
	
	/*p=3*/
	double d3 = 0;
	for(int i = 0; i < n; i++){
		d3 += pow(abs(x[[i]-y[i]),3.0);
	}
	d3 = pow(d2 , 1.0/3.0);
	
	/*p=infinite*/
	double d4 = abs(x[0]-y[0]);
	for(int i = 0; i < n-1; i++){
		d4 = max(d4,abs(x[i+1]-y[i+1]));
	}
	
	cout << fixed << setprecision(6) << d1 << endl;
	cout << fixed << setprecision(6) << d2 << endl;
	cout << fixed << setprecision(6) << d3 << endl;
	cout << fixed << setprecision(6) << d4 << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: expected ';' before '-' token
   18 |         for(int i - 0; i < n; i++){
      |                  ^~
      |                  ;
a.cc:18:29: error: expected ')' before ';' token
   18 |         for(int i - 0; i < n; i++){
      |            ~                ^
      |                             )
a.cc:18:31: error: 'i' was not declared in this scope
   18 |         for(int i - 0; i < n; i++){
      |                               ^
a.cc:38:32: error: two consecutive '[' shall only introduce an attribute before '[' token
   38 |                 d3 += pow(abs(x[[i]-y[i]),3.0);
      |                                ^
a.cc:45:25: error: no matching function for call to 'max(double&, int)'
   45 |                 d4 = max(d4,abs(x[i+1]-y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:45:25: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   45 |                 d4 = max(d4,abs(x[i+1]-y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	int x[100] = {0};
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	int y[100] = {0};
	for(int i = 0; i < n; i++){
		cin >> y[i];
	}
	
	/*p=1*/
	double d1 = 0;
	for(int i = 0; i < n; i++){
		d1 += abs(x[i]-y[i]);
	}
	
	/*p=2*/
	double d2 = 0;
	for(int i = 0; i < n; i++){
		d2 += pow(abs(x[i]-y[i]),2.0);
	}
	d2 = sqrt(d2);
	
	/*p=3*/
	double d3 = 0;
	for(int i = 0; i < n; i++){
		d3 += pow(abs(x[[i]-y[i]),3.0);
	}
	d3 = pow(d2 , 1.0/3.0);
	
	/*p=infinite*/
	double d4 = abs(x[0]-y[0]);
	for(int i = 0; i < n-1; i++){
		d4 = max(d4,abs(x[i+1]-y[i+1]));
	}
	
	cout << fixed << setprecision(6) << d1 << endl;
	cout << fixed << setprecision(6) << d2 << endl;
	cout << fixed << setprecision(6) << d3 << endl;
	cout << fixed << setprecision(6) << d4 << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:32: error: two consecutive '[' shall only introduce an attribute before '[' token
   38 |                 d3 += pow(abs(x[[i]-y[i]),3.0);
      |                                ^
a.cc:45:25: error: no matching function for call to 'max(double&, int)'
   45 |                 d4 = max(d4,abs(x[i+1]-y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:45:25: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   45 |                 d4 = max(d4,abs(x[i+1]-y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	int x[100] = {0};
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	
	int y[100] = {0};
	for(int j = 0; j < n; j++){
		cin >> y[j];
	}
	
	/*p=1*/
	double d1 = 0;
	for(int i = 0; i < n; i++){
		d1 += abs(x[i] - y[i]);
	}
	
	/*p=2*/
	double d2 = 0;
	for(int i = 0; i < n; i++){
		d2 += pow(abs(x[i] - y[i]), 2.0);
	}
	d2 = sqrt(d2);
	
	/*p=3*/
	double d3 = 0;
	for(int i = 0; i < n; i++){
		d3 += pow(abs(x[[i] - y[i]), 3.0);
	}
	d3 = pow(d2, 1.0/3.0);
	
	/*p=infinite*/
	double d4 = abs(x[0] - y[0]);
	for(int i = 0; i < n-1; i++){
		d4 = max(d4, abs(x[i+1] - y[i+1]));
	}
	
	cout << fixed << setprecision(6) << d1 << endl;
	cout << fixed << setprecision(6) << d2 << endl;
	cout << fixed << setprecision(6) << d3 << endl;
	cout << fixed << setprecision(6) << d4 << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:32: error: two consecutive '[' shall only introduce an attribute before '[' token
   39 |                 d3 += pow(abs(x[[i] - y[i]), 3.0);
      |                                ^
a.cc:46:25: error: no matching function for call to 'max(double&, int)'
   46 |                 d4 = max(d4, abs(x[i+1] - y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:46:25: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   46 |                 d4 = max(d4, abs(x[i+1] - y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	int x[100] = {0};
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	
	int y[100] = {0};
	for(int j = 0; j < n; j++){
		cin >> y[j];
	}
	
	double d1 = 0;
	for(int i = 0; i < n; i++){
		d1 += abs(x[i] - y[i]);
	}
	
	double d2 = 0;
	for(int i = 0; i < n; i++){
		d2 += pow(abs(x[i] - y[i]), 2.0);
	}
	d2 = sqrt(d2);
	
	double d3 = 0;
	for(int i = 0; i < n; i++){
		d3 += pow(abs(x[[i] - y[i]), 3.0);
	}
	d3 = pow(d2, 1.0/3.0);
	
	double d4 = abs(x[0] - y[0]);
	for(int i = 0; i < n-1; i++){
		d4 = max(d4, abs(x[i+1] - y[i+1]));
	}
	
	cout << fixed << setprecision(6) << d1 << endl;
	cout << fixed << setprecision(6) << d2 << endl;
	cout << fixed << setprecision(6) << d3 << endl;
	cout << fixed << setprecision(6) << d4 << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:32: error: two consecutive '[' shall only introduce an attribute before '[' token
   36 |                 d3 += pow(abs(x[[i] - y[i]), 3.0);
      |                                ^
a.cc:42:25: error: no matching function for call to 'max(double&, int)'
   42 |                 d4 = max(d4, abs(x[i+1] - y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:42:25: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   42 |                 d4 = max(d4, abs(x[i+1] - y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	int x[100] = {0};
	for(int i = 0; i < n; i++) cin >> x[i];
	
	int y[100] = {0};
	for(int j = 0; j < n; j++) cin >> y[j];
	
	double d1 = 0;
	for(int i = 0; i < n; i++)
		d1 += abs(x[i] - y[i]);
	
	double d2 = 0;
	for(int i = 0; i < n; i++)
		d2 += pow(abs(x[i] - y[i]), 2.0);
	d2 = sqrt(d2);
	
	double d3 = 0;
	for(int i = 0; i < n; i++)
		d3 += pow(abs(x[[i] - y[i]), 3.0);
	d3 = pow(d2, 1.0/3.0);
	
	double d4 = abs(x[0] - y[0]);
	for(int i = 0; i < n-1; i++)
		d4 = max(d4, abs(x[i+1] - y[i+1]));
	
	cout << fixed << setprecision(6) << d1 << endl;
	cout << fixed << setprecision(6) << d2 << endl;
	cout << fixed << setprecision(6) << d3 << endl;
	cout << fixed << setprecision(6) << d4 << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:32: error: two consecutive '[' shall only introduce an attribute before '[' token
   30 |                 d3 += pow(abs(x[[i] - y[i]), 3.0);
      |                                ^
a.cc:35:25: error: no matching function for call to 'max(double&, int)'
   35 |                 d4 = max(d4, abs(x[i+1] - y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:35:25: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   35 |                 d4 = max(d4, abs(x[i+1] - y[i+1]));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

int main(){
	
	int n,i;
	cin >> n;
	
	int x[n];
	for(i = 0; i < n; i++) cin >> x[i];
	
	int y[n];
	for(i = 0; i < n; i++) cin >> y[i];
	
	double d1;
	for(i = 0; i < n; i++)
		d1 += abs(x[i] - y[i]);
	cout << fixed << setprecision(6) << d1 << endl;	
	
	double d2;
	for(i = 0; i < n; i++)
		d2 += pow(abs(x[i] - y[i]), 2.0);
	d2 = sqrt(d2);
	cout << fixed << setprecision(6) << d2 << endl;
	
	double d3;
	for(int i = 0; i < n; i++)
		d3 += pow(abs(x[[i] - y[i]), 3.0);
	d3 = pow(d3, 1.0/3.0);
	cout << fixed << setprecision(6) << d3 << endl;	
	
	double d = abs(x[0] - y[0]);
	for(int i = 0; i < n-1; i++)
		d = max(d, abs(x[i+1] - y[i+1]));
	cout << fixed << setprecision(6) << d << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:32: error: two consecutive '[' shall only introduce an attribute before '[' token
   32 |                 d3 += pow(abs(x[[i] - y[i]), 3.0);
      |                                ^
a.cc:38:24: error: no matching function for call to 'max(double&, int)'
   38 |                 d = max(d, abs(x[i+1] - y[i+1]));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:38:24: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   38 |                 d = max(d, abs(x[i+1] - y[i+1]));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

int main()
{
	const int MAX_N = 1000;
	int n;
	cin >> n;
	int x[MAX_N] = { 0 };
	int y[MAX_N] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> y[i];
	}
	//p=1 ???????????????????????¢
	double md = 0.0;
	for (int i = 0; i < n; i++) {
		md += abs(x[i] - y[i]);
	}
	
	//p=2 ???????????????????????¢
	double ed = 0.0;
	for (int i = 0; i < n; i++) {
		ed += pow(abs(x[i] - y[i]), 2);
	}
	ed = sqrt(ed);
	
	//p=3
	double a = 0.0;
	for (int i = 0; i < n; i++) {
		a += pow(abs(x[i] - y[i]), 3);
	}
	a = pow(a, 1 / 3.0);
	
	//p=INF
	double b = abs(x[0] - y[0]);
	for (int i = 1; i < n; i++) {
		b = max<double>(b, abs(x[i] - y[i]));
	}

	printf("%.6f\n%.6f\n%.6f\n%.6f\n", md, ed, a, b);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: 'pow' was not declared in this scope
   28 |                 ed += pow(abs(x[i] - y[i]), 2);
      |                       ^~~
a.cc:30:14: error: 'sqrt' was not declared in this scope
   30 |         ed = sqrt(ed);
      |              ^~~~
a.cc:35:22: error: 'pow' was not declared in this scope
   35 |                 a += pow(abs(x[i] - y[i]), 3);
      |                      ^~~
a.cc:37:13: error: 'pow' was not declared in this scope
   37 |         a = pow(a, 1 / 3.0);
      |             ^~~
Language: C++

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

int main()
{
	const int MAX_N = 1000;
	int n;
	cin >> n;
	int x[MAX_N] = { 0 };
	int y[MAX_N] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> y[i];
	}
	//p=1 ???????????????????????¢
	double md = 0.0;
	for (int i = 0; i < n; i++) {
		md += abs(x[i] - y[i]);
	}
	
	//p=2 ???????????????????????¢
	double ed = 0.0;
	for (int i = 0; i < n; i++) {
		ed += pow(abs(x[i] - y[i]), 2);
	}
	ed = sqrt(ed);
	
	//p=3
	double a = 0.0;
	for (int i = 0; i < n; i++) {
		a += pow(abs(x[i] - y[i]), 3);
	}
	a = pow(a, 1 / 3.0);
	
	//p=INF
	double b = abs(x[0] - y[0]);
	for (int i = 1; i < n; i++) {
		b = max<double>(b, abs(x[i] - y[i]));
	}

	printf("%.6f\n%.6f\n%.6f\n%.6f\n", md, ed, a, b);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: 'pow' was not declared in this scope
   29 |                 ed += pow(abs(x[i] - y[i]), 2);
      |                       ^~~
a.cc:31:14: error: 'sqrt' was not declared in this scope
   31 |         ed = sqrt(ed);
      |              ^~~~
a.cc:36:22: error: 'pow' was not declared in this scope
   36 |                 a += pow(abs(x[i] - y[i]), 3);
      |                      ^~~
a.cc:38:13: error: 'pow' was not declared in this scope
   38 |         a = pow(a, 1 / 3.0);
      |             ^~~
Language: C++

#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    double x[100]={},y[100]={};
    double d1=0,d2=0,d3=0,dinf=0;

    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> x[i];
    }
    for (int i = 0; i < n; ++i)
    {
        cin >> y[i];
    }

    for (int i = 0; i < n; ++i)
    {
        d1 += fabs(x[i]-y[i]);
        d2 += (x[i]*x[i] + y[i]*y[i])
        d3 += (x[i]*x[i]*x[i] + y[i]*y[i]*y[i])
        if(dinf < fabs(x[i]) dinf = fabs(x[i]);
    }
    d2 = sqrt(d2);
    d3 = pow(d3,(1.0/3));
    printf("%lf\n%lf\n%lf\n%lf\n", d1,d2,d3,dinf);

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:26:38: error: expected ';' before 'd3'
   26 |         d2 += (x[i]*x[i] + y[i]*y[i])
      |                                      ^
      |                                      ;
   27 |         d3 += (x[i]*x[i]*x[i] + y[i]*y[i]*y[i])
      |         ~~
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int    n;
    double p1 = 0, p2 = 0, p3 = 0, p_inf = 0;
    double p_inf_max = 0;

    do {
        cin >> n; 
    } while (n < 0 || n > 1000);
       
    int* x = new int[n];
    int* y = new int[n]; 
    
    for (int i = 0; i < n; i++) {
         do {
             cin >> x[i];	    
         } while (x[i] < 0 || x[i] > 100);
    }

    for (int i = 0; i < n; i++) {
         do {
             cin >> y[i];
         } while (y[i] < 0 || y[i] > 100);
    }

    for (int i = 0; i < n; i++) {
         p1 += abs(x[i] - y[i]);
         p2 += pow(abs(x[i] - y[i]), 2);
         p3 += pow(abs(x[i] - y[i]), 3);

         if (x[i] - y[i] > p_inf_max) {
             p_inf = x[i] - y[i];
         }

         if (i == n - 1) {
	     p2 = sqrt(p2);
             p3 = pow(p3, 1.0 / 3.0);
         }
    }
   
    cout << setprecision(6) << p1 endl;
    cout << setprecision(6) << p2 endl;
    cout << setprecision(6) << p3 endl;
    cout << setprecision(6) << p_inf endl;
   
    delete[] x;
    delete[] y;

    return (0);
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'setprecision' was not declared in this scope
   46 |     cout << setprecision(6) << p1 endl;
      |             ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <cmath>
  +++ |+#include <iomanip>
    3 |
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int    n;
    double p1 = 0, p2 = 0, p3 = 0, p_inf = 0;
    double p_inf_max = 0;

    do {
        cin >> n; 
    } while (n < 0 || n > 1000);
       
    int* x = new int[n];
    int* y = new int[n]; 
    
    for (int i = 0; i < n; i++) {
         do {
             cin >> x[i];	    
         } while (x[i] < 0 || x[i] > 100);
    }

    for (int i = 0; i < n; i++) {
         do {
             cin >> y[i];
         } while (y[i] < 0 || y[i] > 100);
    }

    for (int i = 0; i < n; i++) {
         p1 += abs(x[i] - y[i]);
         p2 += pow(abs(x[i] - y[i]), 2);
         p3 += pow(abs(x[i] - y[i]), 3);

         if (x[i] - y[i] > p_inf_max) {
             p_inf = x[i] - y[i];
         }

         if (i == n - 1) {
	     p2 = sqrt(p2);
             p3 = pow(p3, 1.0 / 3.0);
         }
    }
   
    cout << setprecision(6) << p1 << endl;
    cout << setprecision(6) << p2 << endl;
    cout << setprecision(6) << p3 << endl;
    cout << setprecision(6) << p_inf << endl;
   
    delete[] x;
    delete[] y;

    return (0);
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'setprecision' was not declared in this scope
   46 |     cout << setprecision(6) << p1 << endl;
      |             ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <cmath>
  +++ |+#include <iomanip>
    3 |
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

double power(double x,int n)
{
  double y=1;
  for(int i=0;i<n;i++)
    y*=x;
  return y;
}

int main()
{
  int n;
  int x[100],y[100];
  int p;
  unsigned long long sum;
  cin >> n;
  for(int i=0;i<n;i++)
    cin >> x[i];
  for(int i=0;i<n;i++)
    cin >> y[i];

  for(p=1;p<=3;p++)
    {
      sum=0.0;
      for(int i=0;i<n;i++)
	sum+=power((x[i]-y[i]<0)?(y[i]-x[i]):(x[i]-y[i]),p);
    
      cout.precision(10);
      cout.setf(ios::fixed);
      cout << pow(sum,1.0/p) << endl;
    }

  sum=0.0;
 
  
    
 
  int max=0.0;
  for(int i=0;i<n;i++)
    {
      sum=(x[i]-y[i]<0)?(y[i]-x[i]):(x[i]-y[i]);
      if(sum>max)
	max=sum;
    }
  cout.precisioin(10);
  cout.setf(ios::fixed);
  cout << max << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:8: error: 'std::ostream' {aka 'class std::basic_ostream<char>'} has no member named 'precisioin'; did you mean 'precision'?
   48 |   cout.precisioin(10);
      |        ^~~~~~~~~~
      |        precision
Language: C++

#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;

int mail(){
     int n,man,max;
     double you;
     cin>>n;
     int x[n],y[n];
     for(int i=0;i<n;i++) cin>>x[i];
     for(int i=0;i<n;i++) cin>>y[i];
     
     for(int i=0;i<n;i++) man+=abs(x[i]-y[i]);

     for(int i=0;i<n;i++) you+=(x[i]-y[i])(x[i]-y[i]);
     you=sqrt(you);
     
     max=abs(x[0]-y[0]);
     for(int i=0;i<n;i++) if(max<abs(x[i]-y[i])) max=abs(x[i]-y[i]);

     cout<<man<<endl<<you<<endl<<max;
}
          
          
     
     

Compiler output:
a.cc: In function 'int mail()':
a.cc:16:43: error: expression cannot be used as a function
   16 |      for(int i=0;i<n;i++) you+=(x[i]-y[i])(x[i]-y[i]);
      |                                ~~~~~~~~~~~^~~~~~~~~~~
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
Language: C++

#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;

int main(){
     int n,man,max;
     double you;
     cin>>n;
     int x[n],y[n];
     for(int i=0;i<n;i++) cin>>x[i];
     for(int i=0;i<n;i++) cin>>y[i];
     
     for(int i=0;i<n;i++) man+=abs(x[i]-y[i]);

     for(int i=0;i<n;i++) you+=(x[i]-y[i])(x[i]-y[i]);
     you=sqrt(you);
     
     max=abs(x[0]-y[0]);
     for(int i=0;i<n;i++) if(max<abs(x[i]-y[i])) max=abs(x[i]-y[i]);

     cout<<man<<endl<<you<<endl<<max;
}
          
          
     
     

Compiler output:
a.cc: In function 'int main()':
a.cc:16:43: error: expression cannot be used as a function
   16 |      for(int i=0;i<n;i++) you+=(x[i]-y[i])(x[i]-y[i]);
      |                                ~~~~~~~~~~~^~~~~~~~~~~
Language: C++

gets
d=gets.split.map(&:to_f).zip(gets.split.map(&:to_f)).map{|a,b|(a-b).abs}
(1..3).each {|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
puts d.max

Compiler output:
a.cc:3:2: error: too many decimal points in number
    3 | (1..3).each {|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
      |  ^~~~
a.cc:1:1: error: 'gets' does not name a type
    1 | gets
      | ^~~~
a.cc:3:2: error: expected unqualified-id before numeric constant
    3 | (1..3).each {|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
      |  ^~~~
a.cc:3:2: error: expected ')' before numeric constant
    3 | (1..3).each {|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
      | ~^~~~
      |  )
a.cc:4:1: error: 'puts' does not name a type
    4 | puts d.max
      | ^~~~
Language: C++

gets
d=gets.split.map(&:to_f).zip(gets.split.map(&:to_f)).map{|a,b|(a-b).abs}
(1..3).each{|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
puts d.max

Compiler output:
a.cc:3:2: error: too many decimal points in number
    3 | (1..3).each{|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
      |  ^~~~
a.cc:1:1: error: 'gets' does not name a type
    1 | gets
      | ^~~~
a.cc:3:2: error: expected unqualified-id before numeric constant
    3 | (1..3).each{|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
      |  ^~~~
a.cc:3:2: error: expected ')' before numeric constant
    3 | (1..3).each{|e| puts d.map{|t|t**e}.reduce(:+)**(1.0/e)}
      | ~^~~~
      |  )
a.cc:4:1: error: 'puts' does not name a type
    4 | puts d.max
      | ^~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
    
int main()
{
	float p2=0, p3=0;
	int n, p1=0, p4=0;
	cin >> n;
	int *x = new int[n];
	int *y = new int[n];
	for (int i = 0; i < n; i++)
		cin >> x[i];
	for (int i = 0; i < n; i++)
		cin >> y[i];
	for (int i = 0; i < n; i++) {
		if (x[i] > y[i])
			x[i] -= y[i];
		else
			x[i] = y[i] - x[i];
		p1 += x[i];
		p2 += pow(x[i],2); 
		p3 += pow(x[i],3);
		if (p4 < x[i])
			p4 = x[i];
	}		
	cout << fixed << setprecision(4)
		 << p1 << endl
		 << sqrt(p2) << endl
		 << pow(p3,1.0/3.0) << endl
		 << p4 << endl;
        delete x [];
        delete y [];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: expected primary-expression before ']' token
   33 |         delete x [];
      |                   ^
a.cc:34:19: error: expected primary-expression before ']' token
   34 |         delete y [];
      |                   ^
Language: C++

#include<iostream>
using namespace std;
#include<cmath>
#include<stdlib.h>
#include<algorithm>

int main() {
        int n;
        double x[100], y[100], one, two, three, inf, maxD, temp;
        cin >> n;
        for(int i = 0; i < n; i++) {
                cin >> x[i];
        }
        for(int i = 0; i < n; i++) {
                cin >> y[i];
        }
        inf = abs(x[0] - y[0])
        for(int i = 0; i < n; i++) {
                temp = abs(x[i] - y[i]);
                one += abs(temp);
                two += pow(temp, 2);
                three += pow(abs(temp), 3);
                inf = max(inf, abs(temp));
        }
        cout << fixed;
        cout << one << endl;
        cout << sqrt(two) << endl;
        cout << cbrt(three) << endl;
        cout << inf << endl;
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:31: error: expected ';' before 'for'
   17 |         inf = abs(x[0] - y[0])
      |                               ^
      |                               ;
   18 |         for(int i = 0; i < n; i++) {
      |         ~~~                    
a.cc:18:24: error: 'i' was not declared in this scope
   18 |         for(int i = 0; i < n; i++) {
      |                        ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <iomanip>

int main(){
    int n;
    std::cin >> n;

    std::vector<int> x(n), y(n);

    for (int i = 0; i < n; i++) {
        std::cin >> x[i];
    }

    for (int i = 0; i < n; i++) {
        std::cin >> y[i];
    }

    double p1, p2, p3, pinf;

    p1 = p2 = p3 = pinf = 0;

    for (int i = 0; i < n; i++) {
        p1 += std::abs(x[i] - y[i]);
    }

    for (int i = 0; i < n; i++) {
        p2 += std::abs(x[i] - y[i]) * std::abs(x[i] - y[i]);
    }
    p2 = std::sqrt(p2);

    for (int i = 0; i < n; i++) {
        p3 += std::abs(x[i] - y[i]) * std::abs(x[i] - y[i]) * std::abs(x[i] - y[i]);
    }

    double low = 0, high = 100000000000;
    for (int i = 0; i < 1000; i++) {
        double mid = (low + high) / 2;
        if (mid * mid * mid <= p3) {
            low = mid;
        } else {
            high = mid;
        }
    }

    p3 = low;

    for (int i = 0; i < n; i++) {
        pinf = std::max(pinf, std::abs(1.0 * x[i] - y[i]));
    }

    std::cout << std::fixed << std::setprecision(10);
    std::cout << p1 << std::endl << p2 << std::endl << p3 << std::endl << pinf << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   34 |     p2 = std::sqrt(p2);
      |               ^~~~
      |               sort
Language: C++

n = int(input())
x = [0] + list(map(int, input().split()))
y = [0] + list(map(int, input().split()))
tmp = [[0 for i in range(3)] for j in range(n+1)]
max = 0
for i in range(1, n+1, 1):
    absDiff = abs(x[i]-y[i])
    tmp[i][0] = tmp[i-1][0] + absDiff
    tmp[i][1] = tmp[i-1][1] + absDiff ** 2
    tmp[i][2] = tmp[i-1][2] + tmp[i][1] * absDiff
    if absDiff > max:
        max = absDiff
print(tmp[n][0])
print(tmp[n][1] ** (1/2))
print(tmp[n][2] ** (1/3))
print(max)

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

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

int main() {
	int n, x[100], y[100];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> x[i];
	for (int i = 0; i < n; i++)cin >> y[i];

	double d[4];
	for (int i = 0; i < 4; i++)d[i] = 0.0;

	for (int p = 1; p <= 3; p++) {
		for (int i = 0; i < n; i++) {
			d[p] += pow(fabs(x[i] - y[i]), p);
		}
		d[p] = pow(d[p], 1.0 / p);
	}
	for (int i = 0; i < n; i++) {
		d[0] = (d[0] < fabs(x[i] - y[i]) ? fabs(x[i] - y[i]) : d[0]);
	}
	printf("%1f\n".d[1]);
	printf("%1f\n".d[2]);
	printf("%1f\n".d[3]);
	printf("%1f\n".d[0]);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: request for member 'd' in '"%1f\012"', which is of non-class type 'const char [5]'
   24 |         printf("%1f\n".d[1]);
      |                        ^
a.cc:25:24: error: request for member 'd' in '"%1f\012"', which is of non-class type 'const char [5]'
   25 |         printf("%1f\n".d[2]);
      |                        ^
a.cc:26:24: error: request for member 'd' in '"%1f\012"', which is of non-class type 'const char [5]'
   26 |         printf("%1f\n".d[3]);
      |                        ^
a.cc:27:24: error: request for member 'd' in '"%1f\012"', which is of non-class type 'const char [5]'
   27 |         printf("%1f\n".d[0]);
      |                        ^
Language: C++

/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_10_D
 */
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <numeric>

using namespace std;

double
cubic(const double a)
{
    return a * a * a;
}

double
square(const double a)
{
    return a * a;
}

int
main()
{
    ios::sync_with_stdio(false);

    int n;
    cin >> n; cin.ignore();

    vector<double> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i]; cin.ignore();
    }
    vector<double> y(n);
    for (int i = 0; i < n; i++) {
        cin >> y[i]; cin.ignore();
    }

    vector<double> d;
    for (int i = 0; i < n; i++) {
        d.push_back( abs( x[i] - y[i] ) );
    }
    x.clear();
    y.clear();

    cout << setprecision(6) << fixed;

    cout << accumulate(d.cbegin(), d.cend(), 0.0) << endl;

    vector<double> d2;
    transform(d.begin(), d.end(), back_inserter(d2), square);
    cout << sqrt( accumulate(d2.cbegin(), d2.cend(), 0.0) ) << endl;
    d2.clear();

    transform(d.cbegin(), d.cend(), back_inserter(d2), cubic);
    cout << cbrt( accumulate(d2.cbegin(), d2.cend(), 0.0) ) << endl;
    d2.clear();

    sort(d.begin(), d.end(), greater<double>());
    auto it = d.cbegin(); 
    cout << *it << endl;
    d.clear();

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:5: error: 'transform' was not declared in this scope
   53 |     transform(d.begin(), d.end(), back_inserter(d2), square);
      |     ^~~~~~~~~
a.cc:61:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   61 |     sort(d.begin(), d.end(), greater<double>());
      |     ^~~~
      |     sqrt
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int main(){
 int n,sum,max=-INT_MAX;
 double p[3],p4; 

 cin >> n ;
 int x[n],y[n];
 for(int i=0;i<n;i++){
  cin >> x[i] ;
 }
 for(int i=0;i<n;i++){
  cin >> y[i] ;
 }

 for(int j=1;j<4;j++){
  for(int i=0;i<n;i++){
   sum+=pow(abs(x[i]-y[i]),j) ;
  }
  p[j]=pow(sum,1/j);
 }

 for(int i=0;i<n;i++){
  if(x[i]-y[i]>max)max=x[i]-y[i];
 }

 cout << fixed << p1 << endl << p2 << endl << p3 << endl <<max << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'INT_MAX' was not declared in this scope
    6 |  int n,sum,max=-INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cmath>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc:29:19: error: 'p1' was not declared in this scope; did you mean 'p4'?
   29 |  cout << fixed << p1 << endl << p2 << endl << p3 << endl <<max << endl;
      |                   ^~
      |                   p4
a.cc:29:33: error: 'p2' was not declared in this scope; did you mean 'p4'?
   29 |  cout << fixed << p1 << endl << p2 << endl << p3 << endl <<max << endl;
      |                                 ^~
      |                                 p4
a.cc:29:47: error: 'p3' was not declared in this scope; did you mean 'p4'?
   29 |  cout << fixed << p1 << endl << p2 << endl << p3 << endl <<max << endl;
      |                                               ^~
      |                                               p4
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int main(){
 int n,sum,max=-INT_MAX;
 double p[3],p4; 

 cin >> n ;
 int x[n],y[n];
 for(int i=0;i<n;i++){
  cin >> x[i] ;
 }
 for(int i=0;i<n;i++){
  cin >> y[i] ;
 }

 for(int j=1;j<4;j++){
  for(int i=0;i<n;i++){
   sum+=pow(abs(x[i]-y[i]),j) ;
  }
  p[j]=pow(sum,1/j);
 }

 for(int i=0;i<n;i++){
  if(x[i]-y[i]>max)max=x[i]-y[i];
 }

 cout << fixed << p[0] << endl << p[1] << endl << p[2] << endl <<max << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'INT_MAX' was not declared in this scope
    6 |  int n,sum,max=-INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cmath>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int main(){
 int n,sum,max=-INT_MAX;
 double p[3],p4; 

 cin >> n ;
 int x[n],y[n];
 for(int i=0;i<n;i++){
  cin >> x[i] ;
 }
 for(int i=0;i<n;i++){
  cin >> y[i] ;
 }

 for(int j=1;j<4;j++){
  for(int i=0;i<n;i++){
   sum+=pow(abs(x[i]-y[i]),j) ;
  }
  p[j-1]=pow(sum,1/j);
 }

 for(int i=0;i<n;i++){
  if(x[i]-y[i]>max)max=x[i]-y[i];
 }

 cout << fixed << p[0] << endl << p[1] << endl << p[2] << endl <<max << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'INT_MAX' was not declared in this scope
    6 |  int n,sum,max=-INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cmath>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int main(){
 int n;
 double p[3],max=0,sum; 

 cin >> n ;
 double x[n],y[n];
 for(int i=0;i<n;i++){
  cin >> x[i] ;
 }
 for(int i=0;i<n;i++){
  cin >> y[i] ;
 }

 for(double j=1.0;j<4;j++){
  for(int i=0,sum=0;i<n;i++){
   sum+=pow(fabs(x[i]-y[i]),j) ;
  }
  p[j-1]=pow(sum,1.0/j);
 }

 for(int i=0;i<n;i++){
  if(fabs(x[i]-y[i])>max) max=fabs(x[i]-y[i]);
 }

 cout << fixed << p[0] << endl << p[1] << endl << p[2] << endl << max << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:4: error: invalid types 'double [3][double]' for array subscript
   22 |   p[j-1]=pow(sum,1.0/j);
      |    ^
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int main(){
 int n;
 double p[3],max=0,sum; 

 cin >> n ;
 double x[n],y[n];
 for(int i=0;i<n;i++){
  cin >> x[i] ;
 }
 for(int i=0;i<n;i++){
  cin >> y[i] ;
 }

 for(double j=1;j<4;j++){
  for(int i=0,sum=0;i<n;i++){
   sum+=pow(fabs(x[i]-y[i]),j) ;
  }
  p[j-1]=pow(sum,1.0/j);
 }

 for(int i=0;i<n;i++){
  if(fabs(x[i]-y[i])>max) max=fabs(x[i]-y[i]);
 }

 cout << fixed << p[0] << endl << p[1] << endl << p[2] << endl << max << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:4: error: invalid types 'double [3][double]' for array subscript
   22 |   p[j-1]=pow(sum,1.0/j);
      |    ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <string.h>
#include <map>
#include <math.h>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
int main (void)
{
	double x[1000],y[1000],p1,p2,P2,p3,P3,p00;
	int n;

	for (int A = 0; A < n; A++)
	{
		cin >> x[A];
	}
	
	for (int A = 0; A < n; A++)
	{
		cin >> y[A];
	}
	
	for (int A = 0; A < n; A++)
	{
		P2 += (x[A] - y[A]) * (x[A] - y[A]);
		P3 += (x[A] - y[A]) * (x[A] - y[A]) * (x[A] - y[A]);
	} 
	
	
	
	for (int A = 0; A < n; A++)
	{
		if (x{A} < y[A])
		{ 
			y[A] = -y[A];
		}
		
		p1 += x[A] - y[A];
		
		p2 += sqrt(P2);
		
		p3 += pow(P3,1.0 / 3.0);
	}
	
	cout << p1 << endl;
	cout << p2 << endl;
	cout << p3 << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:22: error: expected ')' before '{' token
   65 |                 if (x{A} < y[A])
      |                    ~ ^
      |                      )
Language: C++

#include<iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main() {
    int n;
    cin >> n;
    int arrayX[n] = {};
    int arrayY[n] = {};
    for (int i = 0; i < n; i++) {
        cin >> arrayX[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> arrayY[i];
    }
    for (int x = 1; x < 5; x++) {
        double sum = 0;
        if (x == 4) {
            double lowest = 0;
            for (int i = 0; i < n; i++) {
                if (abs(arrayX[i] - arrayY[i]) > lowest) {
                    lowest = abs(arrayX[i] - arrayY[i]);
                }
            }
            cout << fixed << setprecision(10) << lowest << endl;

        } else {
            for (int i = 0; i < n; i++) {
                sum += pow(abs(arrayX[i] - arrayY[i]), x);
            }
            sum = pow(sum, (1.0 / x));
            cout << fixed << setprecision(10) << sum << endl;
        }

    }


Compiler output:
a.cc: In function 'int main()':
a.cc:37:6: error: expected '}' at end of input
   37 |     }
      |      ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

#include <stdio.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; ++i)

typedef double llb;

llb abs(llb a) {
  return a > 0 ? a : -a;
}

int main(void) {
  int i, n, j;
  scanf("%d", &n);
  llb x[n], y[n], d[n], max;
  rep(i, n) scanf("%llf", &x[i]);
  rep(i, n) scanf("%llf", &y[i]);
  rep(i, p) d[i] = abs(x[i] - y[i]);
  rep(i, n) if(max < d[i]) max = d[i];
  llb ans = 0;
  for(i = 1; i <= 3; ++i) {
    ans = 0;
    rep(j, n) ans += pow(d[i], i);
    ans = pow(ans, 1 / i);
    if(max < ans) max = ans;
    printf("%f\n", ans);
  }
  printf("%f\n", max);
  return 0;
}


Compiler output:
a.cc:7:14: error: 'llb abs(llb)' conflicts with a previous declaration
    7 | llb abs(llb a) {
      |              ^
In file included from /usr/include/c++/14/cmath:49,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:2:
/usr/include/c++/14/bits/std_abs.h:71:3: note: previous declaration 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
a.cc: In function 'int main()':
a.cc:17:10: error: 'p' was not declared in this scope
   17 |   rep(i, p) d[i] = abs(x[i] - y[i]);
      |          ^
a.cc:3:38: note: in definition of macro 'rep'
    3 | #define rep(i, n) for(int i = 0; i < n; ++i)
      |                                      ^
a.cc:17:23: error: call of overloaded 'abs(llb)' is ambiguous
   17 |   rep(i, p) d[i] = abs(x[i] - y[i]);
      |                    ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/std_abs.h:38:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:7:5: note: candidate: 'llb abs(llb)'
    7 | llb abs(llb a) {
      |     ^~~
Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

int main() {
	
	int n;
	
	while( cin >> n ) {
		
		int A[100] = {};
		int B[100] = {};
		int C[100] = {};
		int P[3] = {};
		
		for(int i=0;i<n;i++)
		cin >> A[i];
		for(int i=0;i<n;i++)
		cin >> B[i];
		
		for(int i=0;i<n;i++) {
			
			P[0] += abs( A[i] - B[i] );
			P[1] += pow(abs( A[i] - B[i] ), 2);
			P[2] += pow(abs( A[i] - B[i] ), 3);
			C[i] = abs(A[i] - B[i]);
		}
		sort(C, C+n);
		cout << fixed << setprecision(8) << (double) P[0] << "\n"
		 	 << sqrt(P[1]) << "\n"
		 	 << cbrt(P[2]) << "\n"
		 	 << (double) C[n-1] << "\n";
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:34: error: 'setprecision' was not declared in this scope
   31 |                 cout << fixed << setprecision(8) << (double) P[0] << "\n"
      |                                  ^~~~~~~~~~~~
a.cc:4:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    3 | #include<algorithm>
  +++ |+#include <iomanip>
    4 |
Language: C++

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

int main(){
	int n;
	cin >> n;
	int x[n] = {};
	int y[n] = {};

	for (int i = 0; i < n; i++){
		cin >> x[i];
	}

	for (int i = 0; i < n; i++){
		cin >> y[i];
	}

	double d1 = 0, d2 = 0, d3 = 0, dm = 0;
	for (int i = 0; i < n; i++){
		d1 += fabs(x[i] - y[i]);
	}

	for (int i = 0; i < n; i++){
		d2 += pow(x[i] - y[i], 2);
	}
	d2 = sqrt(d2);

	for (int i = 0; i < n; i++){
		d3 += pow(fabs(x[i] - y[i]), 3);
	}
	double r = 1/3:
	d3 = pow(d3, r);

	for (int i = 0; i < n; i++){
		if (dm < fabs(x[i] - y[i])) dm = fabs(x[i] - y[i]);
	}

	printf("%lf\n%lf\n%lf\n%lf\n", d1, d2, d3, dm);

	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:23: error: expected ',' or ';' before ':' token
   33 |         double r = 1/3:
      |                       ^
Language: C++

#include<iostream>
#include<cmath>
#include<cstdlib>

double distance(const int x[],const int y[],int n,int p){
    double ans=0;
    for(int i=0;i<n;i++){
        ans+=pow(abs(x[i]-y[i]),p);
    }
    return pow(ans,1/p);

}

double c_D(const int x[],const int y[],int n){
    double ans=0;
    for(int i=0;i<n;i++){
        ans=(ans>=abs(x[i]-y[i]))?ans:abs(x[i]-y[i]);
    }
    return ans;
}

int main(void){
    int n;
    double x[n],y[n];
    for(int i=0;i<n;i++){
         std::cin>>x[i];
    }
    for(int i=0;i<n;i++){
        std::cin>>y[i];
    }

    for(int i=1;i<4;i++)
        std::cout<<distance(x,y,n,i)<<std::endl;

     std::cout<<c_D(x,y,n)<<std::endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: cannot convert 'double*' to 'const int*'
   33 |         std::cout<<distance(x,y,n,i)<<std::endl;
      |                             ^
      |                             |
      |                             double*
a.cc:5:27: note:   initializing argument 1 of 'double distance(const int*, const int*, int, int)'
    5 | double distance(const int x[],const int y[],int n,int p){
      |                 ~~~~~~~~~~^~~
a.cc:35:21: error: cannot convert 'double*' to 'const int*'
   35 |      std::cout<<c_D(x,y,n)<<std::endl;
      |                     ^
      |                     |
      |                     double*
a.cc:14:22: note:   initializing argument 1 of 'double c_D(const int*, const int*, int)'
   14 | double c_D(const int x[],const int y[],int n){
      |            ~~~~~~~~~~^~~
Language: C++

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

int n;
double x[100],y[100];

double distance(double p){
double sum=0;
for(int i=0;i<n;i++){
double w=abs(x[i]-y[i]);
sum+=pow(w,p);
}
return pow(sum,1/p);
}

int main(){
cout<<fixed<<setprecision(12);
cin>>n;
for(int i=0;i<n;i++){
cin>>x[i];
}
for(int i=0;i<n;i++){
cin>>y[i];
}
cout<<distance(1)<<endl;
cout<<distance(2)<<endl;
cout<<distance(3)<<endl;

double mx=0;
for(int i=0;i<n;i++){
mx=max(mx,abs(a[i]-y[i]);
}
cout<<mx;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:15: error: 'a' was not declared in this scope
   31 | mx=max(mx,abs(a[i]-y[i]);
      |               ^