I am trying out this problem on Codeforces. https://codeforces.me/contest/478/problem/C
I get the correct output for the test case 5 4 3 as 4 in my system, which is also the output of the sample test case.
Here is my code. Could someone please tell where I am going wrong ?
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int r,g,b;
cin>>r>>g>>b;
int mini=min(min(r,g),b);
int ans=mini;
int maxi=max(max(r,g),b);
int sma;
if(r!=maxi && r!=mini)
r=sma;
else if(g!=maxi && g!=mini)
g=sma;
else
b=sma;
if(maxi > 2*sma)
{
ans+=sma;
}
else
{
ans+=((sma+maxi)/3);
}
cout<<ans<<endl;
return 0;
}
But the online judge shows my answer as 3 and hence failed in the first test case.



