 # My code is not accepted. Please review it

You are not checking for others.
This might help----> Code

1 Like

Pls Help me with this code, Why is it not working?
https://www.codechef.com/viewsolution/41880380

1 Like

my code is not accepted please review it

my code is not accepted please see it

T=int(input())
list1=[]
list2=[]
for i in range (T):
A,B=map(int,input().split())
if A>B:
a=(A-B)
list1.append(a)
else:
b=(B-A)
list2.append(b)
a=max(list1)
b=max(list2)
if a>b:
print(“1”,a)
else:
print(“2”,b)

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! Also - what Problem are you trying to solve? 1 Like

It’s showing:wrong solution
https://www.codechef.com/viewsolution/46691814

1 Like

Thanks My Solution is not being accepted. Can please someone tell me what’s wrong with my code
https://www.codechef.com/viewsolution/48520015

#include
#include
#include
#include <bits/stdc++.h>
#include
#include

using namespace std;
// return 0;

int main()
{
int T,a,b,x,counter=0 ;

``````// int x;
// float y;

// cin>>x>>y;
cin>>T;
//  cin>>k;

for (int i = 0; i < T; i++)
{
cin>>a[i];
cin>>b[i];

}

for (int i = 0; i < T; i++)
{

if (a[i] > b[i])
{
x[i] = a[i] -b[i];
// cout<<"1 "<<x[i]<<endl;
}

else
{
x[i] = b[i] -a[i];
// cout<<"2 "<<x[i]<<endl;
}

}
sort(x, x+T, greater<int>());
for (int i=0;i<T;i++)
{
if (a[i] - b[i] == x)
{
cout<<"1 "<<x<<endl;
break;

}
else
{

cout<<"2 "<<x<<endl;
break;
}
}

return 0;
``````

}

``````import math