Opening K stores – i think the ootimal approach is to greedily take those foods where p and v are high. Take the highest such K untaken food.
You should do cin >> s >> p >> v
Read the order of input

why is this code giving WA?
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n; cin>>n;
vector op;
while(n–)
{
int num; cin>>num;
while(num–)
{
float s,p,v;
cin>>s>>p>>v;
op.push_back(v*(floor(p/(s+1))));
}
cout<<*max_element(op.begin(), op.end())<<endl;
op.clear();
}
return 0;
}
The problem was good. But I found the explanation a bit confusing. The order for the three variabels s,v and p was mentioned to be different at different places. Iin the constraints, something else was written instead of what was written in the problem statement.
The same error has also been done by @vaibhav120, I hope the problem setters would keep this in mind from the next time. Even after having the correct logic, having a WA just because of the input and the output comes out to be a bit annoying.
You are not outputting your answer in new line
Just add that and you will get AC

As you have done in your earlier submission , you should do P/(S+1) not P/S

Finally worked, thanks mate! 
Can anyone help me with what is wrong in this solution: CodeChef: Practical coding for everyone
I checked the order of inputs for S, P, V is correct
I used the same approach solving the problem but why I am getting a WA
include “\n” in cout statement …you get right answer.
cout << high<<"\n"; since for every test case you need to show answer in seperate line.
// Problem : Chef and Street Food
// Contest : CodeChef - DSA Learning Series - Week 2
// URL : CodeChef: Practical coding for everyone
// Memory Limit : 256 MB
// Time Limit : 1000 ms
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
#define mod 1000000007
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int ans=0;
while(n--){
int d=0;
int s,v,p;
cin>>s>>v>>p;
d=v*(p/(s+1));
ans=max(ans,d);
}
cout<<ans<<endl;
}
return 0;
}
> my code is correct.But why showing WA?
There is something wrong here
Check the order of input

#include<bits/stdc++.h>
using namespace std;
#define loop for (int i = 0; i < N; i++)
int main()
{
int T, N;
int S, P, V;
cin >> T;
long int chefMaxProfit = 0;
while(T- -) {
cin >> N;
loop // i=0; to N;
{
cin >>S>>P>>V;
//long int totalProfit = P * V;
int totalShops = S + 1;
long int profit = (P/totalShops) * V;
if(chefMaxProfit < profit) chefMaxProfit = profit;
}
cout<< chefMaxProfit << endl;
}
return 0;
}
My code is returning WA can someone tell me why?Preformatted text
you have not submitted this is in codechef
How do u know it is giving WA ?

Why do we have to add 1 to s?
That ‘1’ is chef shop .
(Shops+ chef shop)
