import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int cos(int l,int r,int []a) { int i;int or,max,min,and;or=max=min=and=a[l]; for(i=l+1;i<=r;i++) { if(maxa[i]) min=a[i]; or=or|a[i]; and=and&a[i]; } return ((or-and)-(max-min)); } static int[] costlyIntervals(int n, int k, int[] a) { int i,j;int []res=new int[n]; for(i=0;i