Language: Java

#include<stdio.h>
int main(){

  int i,j;
  int n,r,res;
  int min,min_n,max;
  int data[200000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&data[i]);  
  }
  min=data[0];
  min_n=0;
  for(i=0;i<n;i++){
    if(min>data[i]){
      min=data[i];
      min_n=i;
    }
  }
  if(min_n==n-1){
    res=min;
    min=data[0];
    for(i=0;i<min_n;i++){
      if(min>data[i]){
	min=data[i];
      }
    }
    res-=min;
    printf("%d\n",res);
  }
  else{
    max=data[0];
    for(i=min_n;i<n;i++){
      if(max<data[i]){
	max=data[i];
      }
    }
    res=max-min;
    printf("%d\n",res);
  }
  return 0;
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:5: error: class, interface, enum, or record expected
  int n,r,res;
  ^
Main.java:6: error: class, interface, enum, or record expected
  int min,min_n,max;
  ^
Main.java:7: error: class, interface, enum, or record expected
  int data[200000];
  ^
Main.java:9: error: class, interface, enum, or record expected
  scanf("%d",&n);
  ^
Main.java:10: error: class, interface, enum, or record expected
  for(i=0;i<n;i++){
  ^
Main.java:10: error: class, interface, enum, or record expected
  for(i=0;i<n;i++){
          ^
Main.java:10: error: class, interface, enum, or record expected
  for(i=0;i<n;i++){
              ^
Main.java:12: error: class, interface, enum, or record expected
  }
  ^
Main.java:14: error: class, interface, enum, or record expected
  min_n=0;
  ^
Main.java:15: error: class, interface, enum, or record expected
  for(i=0;i<n;i++){
  ^
Main.java:15: error: class, interface, enum, or record expected
  for(i=0;i<n;i++){
          ^
Main.java:15: error: class, interface, enum, or record expected
  for(i=0;i<n;i++){
              ^
Main.java:18: error: class, interface, enum, or record expected
      min_n=i;
      ^
Main.java:19: error: class, interface, enum, or record expected
    }
    ^
Main.java:23: error: class, interface, enum, or record expected
    min=data[0];
    ^
Main.java:24: error: class, interface, enum, or record expected
    for(i=0;i<min_n;i++){
    ^
Main.java:24: error: class, interface, enum, or record expected
    for(i=0;i<min_n;i++){
            ^
Main.java:24: error: class, interface, enum, or record expected
    for(i=0;i<min_n;i++){
                    ^
Main.java:27: error: class, interface, enum, or record expected
      }
      ^
Main.java:30: error: class, interface, enum, or record expected
    printf("%d\n",res);
    ^
Main.java:31: error: class, interface, enum, or record expected
  }
  ^
Main.java:34: error: class, interface, enum, or record expected
    for(i=min_n;i<n;i++){
    ^
Main.java:34: error: class, interface, enum, or record expected
    for(i=min_n;i<n;i++){
                ^
Main.java:34: error: class, interface, enum, or record expected
    for(i=min_n;i<n;i++){
                    ^
Main.java:37: error: class, interface, enum, or record expected
      }
      ^
Main.java:40: error: class, interface, enum, or record expected
    printf("%d\n",res);
    ^
Main.java:41: error: class, interface, enum, or record expected
  }
  ^
Main.java:43: error: class, interface, enum, or record expected
}
^
30 errors