# Help me in solving DICEGAME2 problem anyone?

### My code

#include <iostream>
#include <math.h>
using namespace std;

void check(){
int s1,s2;
if(s1>s2){
cout<<"alice"<<endl;
}
else if(s2>s1)
cout<<"bob"<<endl;
else
cout<<"tie"<<endl;
}

int main() {
int s1=0;
int s2=0;
int t;
cin>>t;
while(t--){
for(int i=0;i<3;i++){
int a[3];
cin>>a[i];
for (int n=0;n<2;n++){
if(a[i]>a[i+1]){
s1= a[i];
}
else{
s1= a[i+1];
}

}

}
for(int j=0;j<3;j++){
int b[3];
cin>>b[j];
for (int m=0;m<2;m++){
if(b[j]>b[j+1]){
s2= b[j];
}
else{
s2= b[j+1];
}

}
}
check();

}
return 0;
}

Problem Link: DICEGAME2 Problem - CodeChef

my solution

#include <iostream>
#include<bits/stdc++.h>
#include<limits.h>
using namespace std;

int main() {
int test;
cin>>test;
while(test--){
int a1,a2,a3;
int b1,b2,b3;
cin>>a1>>a2>>a3>>b1>>b2>>b3;
int mani= std::min({a1, a2, a3});
int mani1= (a1+a2+a3)-mani ;
int manii= std::min({b1, b2, b3});
int mani2= (b1+b2+b3)-manii ;

if(mani1<mani2){
cout<<"BOB"<<endl;
}
if(mani1>mani2){
cout<<"ALICE"<<endl;
}
if(mani1==mani2){
cout<<"TIE"<<endl;
}

}

return 0;
}

dont initialize value of s1,s2 outside of while loop
to know more read this discussion page—