Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    List<Integer> P = new ArrayList<Integer>();
    List<Integer> Q = new ArrayList<Integer>();
    List<Integer> Ps = new ArrayList<Integer>();
    List<Integer> Qs = new ArrayList<Integer>();   
    int a = 0; 
    int b = 0;
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        P.add(x);
        Ps.add(x);
    }
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        Q.add(x);
        Qs.add(x);
    } 
    Arrays.sort(Ps);
    Arrays.sort(Qs);
      
   for(int i=0; i<N-1;i++){
     int searchNumber = P.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Ps.size(); j++){
     	if(searchNumber == Ps.get(j)){
          x = j;
          Ps.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
   for(int i=0; i<N-1;i++){
     int searchNumber = Q.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Qs.size(); j++){
     	if(searchNumber == Qs.get(j)){
          x = j;
          Qs.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
	if(a == 0) a =1;
    if(b == 0) b =1;
      
   int answer = a - b;
   if(answer < 0) answer = -answer;
   System.out.println(answer);   
    }
}


Compiler output:
Main.java:25: error: no suitable method found for sort(List<Integer>)
    Arrays.sort(Ps);
          ^
    method Arrays.sort(int[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to int[])
    method Arrays.sort(long[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to long[])
    method Arrays.sort(short[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to short[])
    method Arrays.sort(char[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to char[])
    method Arrays.sort(byte[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to byte[])
    method Arrays.sort(float[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to float[])
    method Arrays.sort(double[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to double[])
    method Arrays.sort(Object[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to Object[])
    method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable
      (cannot infer type-variable(s) T#1
        (actual and formal argument lists differ in length))
    method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>)
    T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>)
Main.java:26: error: no suitable method found for sort(List<Integer>)
    Arrays.sort(Qs);
          ^
    method Arrays.sort(int[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to int[])
    method Arrays.sort(long[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to long[])
    method Arrays.sort(short[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to short[])
    method Arrays.sort(char[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to char[])
    method Arrays.sort(byte[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to byte[])
    method Arrays.sort(float[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to float[])
    method Arrays.sort(double[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to double[])
    method Arrays.sort(Object[]) is not applicable
      (argument mismatch; List<Integer> cannot be converted to Object[])
    method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable
      (cannot infer type-variable(s) T#1
        (actual and formal argument lists differ in length))
    method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>)
    T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>)
Main.java:39: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
Main.java:54: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors