Language: C++

#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
    int n;
    double a=0,b=0,c=0,d=0;
    cin>>n;
    double x[n]={};
    double y[n]={};
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(double i=0;i<n;i++){
        cin>>y[i];
    }
    for(double i=0;i<n;i++){
        if(x[i]>=y[i]){
            a+=x[i]-y[i];
        }
        else if(x[i]<y[i]){
            a+=y[i]-x[i];
        }
    }
    printf("%.8lf\n", a);
    for(double i=0;i<n;i++){
        b+=(x[i]-y[i])*(x[i]-y[i]);
    }
    printf("%.8lf\n",sqrt(b));
    for(double i=0;i<n;i++){
        if(x[i]>=y[i]){
            c[i]=x[i]-y[i];
            if(c[i]>=c[i-1]){
                d=c[i];
            }
        }
        else{
            c[i]=y[i]-x[i];
            if(c[i]>=c[i-1]){
                d=c[i];
            }
        }
    }
    printf("%.8lf\n",d);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: invalid types 'double [n][double]' for array subscript
   15 |         cin>>y[i];
      |               ^
a.cc:18:13: error: invalid types 'double [n][double]' for array subscript
   18 |         if(x[i]>=y[i]){
      |             ^
a.cc:18:19: error: invalid types 'double [n][double]' for array subscript
   18 |         if(x[i]>=y[i]){
      |                   ^
a.cc:19:17: error: invalid types 'double [n][double]' for array subscript
   19 |             a+=x[i]-y[i];
      |                 ^
a.cc:19:22: error: invalid types 'double [n][double]' for array subscript
   19 |             a+=x[i]-y[i];
      |                      ^
a.cc:21:18: error: invalid types 'double [n][double]' for array subscript
   21 |         else if(x[i]<y[i]){
      |                  ^
a.cc:21:23: error: invalid types 'double [n][double]' for array subscript
   21 |         else if(x[i]<y[i]){
      |                       ^
a.cc:22:17: error: invalid types 'double [n][double]' for array subscript
   22 |             a+=y[i]-x[i];
      |                 ^
a.cc:22:22: error: invalid types 'double [n][double]' for array subscript
   22 |             a+=y[i]-x[i];
      |                      ^
a.cc:27:14: error: invalid types 'double [n][double]' for array subscript
   27 |         b+=(x[i]-y[i])*(x[i]-y[i]);
      |              ^
a.cc:27:19: error: invalid types 'double [n][double]' for array subscript
   27 |         b+=(x[i]-y[i])*(x[i]-y[i]);
      |                   ^
a.cc:27:26: error: invalid types 'double [n][double]' for array subscript
   27 |         b+=(x[i]-y[i])*(x[i]-y[i]);
      |                          ^
a.cc:27:31: error: invalid types 'double [n][double]' for array subscript
   27 |         b+=(x[i]-y[i])*(x[i]-y[i]);
      |                               ^
a.cc:31:13: error: invalid types 'double [n][double]' for array subscript
   31 |         if(x[i]>=y[i]){
      |             ^
a.cc:31:19: error: invalid types 'double [n][double]' for array subscript
   31 |         if(x[i]>=y[i]){
      |                   ^
a.cc:32:14: error: invalid types 'double[double]' for array subscript
   32 |             c[i]=x[i]-y[i];
      |              ^
a.cc:32:19: error: invalid types 'double [n][double]' for array subscript
   32 |             c[i]=x[i]-y[i];
      |                   ^
a.cc:32:24: error: invalid types 'double [n][double]' for array subscript
   32 |             c[i]=x[i]-y[i];
      |                        ^
a.cc:33:17: error: invalid types 'double[double]' for array subscript
   33 |             if(c[i]>=c[i-1]){
      |                 ^
a.cc:33:23: error: invalid types 'double[double]' for array subscript
   33 |             if(c[i]>=c[i-1]){
      |                       ^
a.cc:34:20: error: invalid types 'double[double]' for array subscript
   34 |                 d=c[i];
      |                    ^
a.cc:38:14: error: invalid types 'double[double]' for array subscript
   38 |             c[i]=y[i]-x[i];
      |              ^
a.cc:38:19: error: invalid types 'double [n][double]' for array subscript
   38 |             c[i]=y[i]-x[i];
      |                   ^
a.cc:38:24: error: invalid types 'double [n][double]' for array subscript
   38 |             c[i]=y[i]-x[i];
      |                        ^
a.cc:39:17: error: invalid types 'double[double]' for array subscript
   39 |             if(c[i]>=c[i-1]){
      |                 ^
a.cc:39:23: error: invalid types 'double[double]' for array subscript
   39 |             if(c[i]>=c[i-1]){
      |                       ^
a.cc:40:20: error: invalid types 'double[double]' for array subscript
   40 |                 d=c[i];
      |                    ^