why it give me wrong answer when i include #ifndef ONLINE_JUDGE //for getting i

it give me wrong answer why when i include this
#ifndef ONLINE_JUDGE
//for getting input from input.text
freopen(“input.txt”, “r”, stdin);
//for getting output from output.text
freopen(“output.txt”, “w”, stdout);
#endif
when i remove this give me write answer why?what is the reason?

#include<bits/stdc++.h>
#define ll long long int
#define w() int(tc);cin>>tc;while(tc–)
#define loop(i,n) for(int (i)=0;i<n;i++)
#define debuge(x) cout<<#x<<" “<<x<<”\n"

using namespace std;
int main() {

#ifndef ONLINE_JUDGE
//for getting input from input.text
freopen(“input.txt”, “r”, stdin);
//for getting output from output.text
freopen(“output.txt”, “w”, stdout);
#endif
int tc;
cin >> tc;
while (tc–) {
int a, b, c, x, y, z;
cin >> a >> b >> c >> x >> y >> z;
int answer = 0;
for (int ta = 0; ta <= 20; ta++) {
for (int tb = 0, tb <= 20; tb++) {
for (int tc = 0, tc <= 20; tc++) {
int total_time = ta * a + tb * b + tc * c;
if (total_time <= 240) {
answer = max(answer, ta * x + tb * y + tc * z);
}
}
}
}
cout << answer << “\n”;
}

return 0;

}

Please link to this WA submission; if it’s this one, it’s because you spelt JUDGE wrong.

2 Likes

thank you

1 Like