My issue
cook your dish here
n=int(input())
arr=list(map(int,input().split()))
k=int(input())
for _ in range(k):
a,b=map(int,input().split())
sum_ele=0
for j in arr:
if a<=j<=b:
sum_ele+=j
print(sum_ele)
this code is executing correctly for custom test case but failed in hidden case please provide the hidden case so that i can improve my code
My code
# cook your dish here
n=int(input())
arr=list(map(int,input().split()))
k=int(input())
for _ in range(k):
a,b=map(int,input().split())
sum_ele=0
for j in arr:
if a<=j<=b:
sum_ele+=j
print(sum_ele)
Learning course: Data Structures and Algorithms
Problem Link: https://www.codechef.com/learn/course/dsa-detailed/DSAAG03/problems/DSAAGP16