Pair of Rose - stl

I made an freq array which stores whether a number is there in price array or not .
Later ran loop over that array from 0- m , if i,m-i are present , then tried to found minimum difference between them,

But still getting a WA

@shivampandey9599,
Did you handle the case where i==m-i properly…??