Help me in solving PREFPRO2 problem

My issue

Why it shows run time error

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
    public static void main(String[] args) throws java.lang.Exception
    {
        // your code goes here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[10];
        for (int i = 0; i < n; i++)
        {
            arr[i] = sc.nextInt();
        }

        int prefix[] = new int[10];
        prefix[0]=arr[0];
        for (int i = 1; i < n; i++)
        {
prefix[i]=prefix[i-1]+arr[i];
        }
        int t = sc.nextInt();
        for (int i = 0; i < t; i++)
        {
            int count = 0;
            int a = sc.nextInt();
            int b = sc.nextInt();
System.out.println(prefix[b-1]-prefix[a-1]+arr[a-1]);
        }
  
    }
}

Learning course: Design and analysis of Algorithms
Problem Link: https://www.codechef.com/learn/course/abesit-daa/ABESITDA32/problems/PREFPRO2