Source Code
import java.io.*;
import java.util.*;

/**
 *
 * @author Reham
 */
public class Solution {
    static FastReader input = new FastReader();
    static final int INF = (int) 1e9 + 20;
    static long xe, ye, d;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws NumberFormatException, IOException {
        int n = input.nextInt();
        int[] first = new int[n];
        int[] second = new int[n];
        for(int i=0; i<first.length; i++){
            first[i] = input.nextInt();
        }
        long ans = 0;
        for(int i=0; i<second.length; i++){
            second[i] = input.nextInt();
            ans+= first[i] - second[i];
        }
        System.out.println(ans);
        
    }
    public static class Pair{
        int first;
        int second;
        public Pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    }
    
        static class FastReader {
 
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            /*try {
             br = new BufferedReader(new FileReader(new File("travel_restrictions_validation_input.txt")));
             } catch (FileNotFoundException e) {
             e.printStackTrace();
             }*/
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() throws IOException {
            while (st == null || !st.hasMoreElements()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }
 
        int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }
 
        long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
 
        double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
 
        String nextLine() throws IOException {
            String str = "";
            str = br.readLine();
            return str;
        }
 
        boolean hasNext() throws IOException {
            return br.ready();
        }
    }
 
    static class con {
 
        static int IINF = (int) 1e9;
        static int _IINF = (int) -1e9;
        static long LINF = (long) 1e15;
        static long _LINF = (long) -1e15;
        static double EPS = 1e-9;
    }
 
    static class Reader {
 
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException {
            byte[] buf = new byte[1024];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    break;
                }
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) {
                return -ret;
            }
            return ret;
        }
 
        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) {
                return -ret;
            }
            return ret;
        }
 
        // ddd
        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg) {
                return -ret;
            }
            return ret;
        }
 
        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) {
                buffer[0] = -1;
            }
        }
 
        private byte read() throws IOException {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException {
            if (din == null) {
                return;
            }
            din.close();
        }
    }
}

Copy
A Game of Darts Catwoman
Java 11
474 ms
34.6 MB
Accepted