# I have query with my solution in august cook ,coke

```#include
#include
#include
#include
using namespace __gnu_pbds;
using namespace std;
#define i insert
#define pb push_back
#define pp pop_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define LL long long
#define M 10000000007LL
#define c cin
#define o cout
typedef map mii;
typedef pair pii;
typedef vector v;
typedef tree<int, null_type, less, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;
#define fast  ios_base::sync_with_stdio(false),cin.tie(NULL);
int main()
{
fast;
int t;
cin>>t;
while(t--)
{
LL n,m,k,l,r;

cin>>n>>m>>k>>l>>r;
LL A[n],B[n];
for(int i=0;i>A[i];
cin>>B[i];
}
for(int i=0;i<n;i++)
{
for(int j=0;jk+1)
{
A[i]-=1;

}
if(A[i]=k+1 && A[i]<=k-1 )
{
A[i]=k;
}
}
}

LL y=987455;
for(int i=0;i=l && A[i]<=r)
{

y=min(B[i],y);

}
}
if(y>0 && y!=987455)
{
cout<<y<<endl;
}
else
cout<<-1<<endl;

}

}
```

``````#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define tc int t ;cin>>t ;while(t--)
#define pb push_back
#define FOR(i,y) for(int i =0;i<y;i++)
#define Sort(v) sort(v.begin() ,v.end())
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0) ; cout.tie(0) ;
tc
{
ll n,m,k,l,r ;
cin>>n>>m>>k>>l>>r ;
ll z = 1000010 ;
ll c , p ;
ll tfinal = 0 ;
FOR(i,n)
{
cin>>c >> p ;
tfinal = c ;
for(int j =0;j<m;j++)
{
if(tfinal<=k+1 && tfinal>=k-1 )
{ tfinal = k ;
break ; }
else if(tfinal>k+1 )
tfinal-- ;
else if (tfinal<k+1)
tfinal ++ ;

}
if(tfinal>=l && tfinal<=r)
z = min(z , p) ;
}
if(z<1000010)
cout<< z <<"\n" ;
else
cout<<"-1" <<"\n" ;

}

return 0;
}
``````

The price of a coke can go as high as 10^6. So you should have taken the value of y as 10^6 +1 .

1 Like

It give a wrong a answer but i am unable to find the solustion where i am wrong in my program

What is this ?

this one also temp should belong to temp>=k-1 && temp<=k+1 this will be the condition
One kind suggestion read ques again properly .

``indent preformatted text by 4 spaces``

By mistake the greater than symbol got omitted
this one is original code

```#include
#include
#include
#include
using namespace __gnu_pbds;
using namespace std;
#define i insert
#define pb push_back
#define pp pop_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define LL long long
#define M 10000000007LL
#define c cin
#define o cout
typedef map mii;
typedef pair pii;
typedef vector v;
typedef tree<int, null_type, less, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;
#define fast  ios_base::sync_with_stdio(false),cin.tie(NULL);
int main()
{
fast;
int t;
cin>>t;
while(t--)
{
LL n,m,k,l,r;

cin>>n>>m>>k>>l>>r;
LL A[n],B[n];
for(int i=0;i>A[i];
cin>>B[i];
}
for(int i=0;i<n;i++)
{
for(int j=0;jk+1)
{
A[i]-=1;

}
if(A[i]=k+1 && A[i]<=k-1 )
{
A[i]=k;
}
}
}

LL y=987455;
for(int i=0;i=l && A[i]<=r)
{

y=min(B[i],y);

}
}
if(y>0 && y!=987455)
{
cout<<y<<endl;
}
else
cout<<-1<<endl;

}

}
```

sir due to html syntax it taken by their own

tried
same output

i have written same
due to html it takes wrong

a few symbols are missingâ€¦
for(int j=0;jk+1)
i hope this is not in actual submission
https://www.codechef.com/viewsolution/25992170
hereâ€™s my solution
we have similar approach

please can you go throuh it

Click on the this is my link

suppose there is only one valid coke and it has price 10^6 . check with your code .

that also i have tried