Genius Needs Help

You all know Emrul bhai, right? He is a genius guy. He knows how to add two integer numbers and so d…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Run time for python should be increased.

Run time for python need to be increased

Why This code is causing Runtime error?While this code is working perfectly in my laptop!!!

import java.math.*;
import java.util.Scanner;
  
public class first {
  
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t!=0){
            Scanner inp=new Scanner(System.in);
            String s=inp.nextLine();
            String[] st=s.split(" ");
            BigInteger a=new BigInteger(st[0]);
            BigInteger b=new BigInteger(st[1]);
            BigInteger c=a.add(b);
            System.out.println(c);
            t--;
        }
    }
}
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
int main()
{
    int test,digsum = 0;
    string s;
    int sum,carry,i,j;
    carry = 0;
    cin >> test;
    for(int k =0;k<test;k++)
    {

    string n1,n2;
    cin >> n1 >> n2;
    if(n1.size()> n2.size())
    {

        swap(n1,n2);
    }
    int len1 = n1.size();
    int len2 = n2.size();
    int diff = len2 - len1;
    for(i=len1-1;i>=0;i--)
    {
        sum = (n1[i]-'0')+(n2[i+diff]-'0') + carry;
        s.push_back((sum%10)+'0');
        carry = sum/10;

    }
    for(i=diff-1;i>=0;i--)
    {
        sum = (n2[i]-'0')+ carry;
        s.push_back((sum%10)+'0');
        carry  =  sum/10;

    }
    if(carry==1)
    {
        s.push_back('1');

    }
    cout << "Case #"<<k+1 <<": ";
    for(i=s.size()-1;i>=0;i--)
    {
        cout << s[i] ;

    }
    s.clear();
    cout << endl;



    }

    return 0;


}

Couldn’t figure out why is this showing wrong answer in case 5,please help.