My code is not accepted. Please review it

https://www.codechef.com/viewsolution/25680178

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

cook your dish here

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! :slight_smile:

Also - what Problem are you trying to solve? :slight_smile:

1 Like

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

1 Like

Thanks :slight_smile:

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

what is the problem with my code, please help and thanks in advance.

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

using namespace std;
// return 0;

int main()
{
int T,a[100000],b[100000],x[100000],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[0])
       {
            cout<<"1 "<<x[0]<<endl;
            break;

       }
        else
        {
             
            cout<<"2 "<<x[0]<<endl;
            break;
        }
    }
   
     
return 0;

}

import math
lead = []
winner=0
for i in range (int(input())):
    a,b = map(int,input().split())
    lead.append(a-b)
if max(lead)>abs(min(lead)):
    print(1, max(lead))
else:
    print(2, abs(min(lead)))

it gives the expected output but i am not able to submit it