GITHUB link [](https://github.com/nick-mehta/codeforces/blob/master/1294A%20codeforces%20problem.cpp)
`#include <bits/stdc++.h>
using namespace std;
int main() { int t; cin>>t; int a,b,c,n;
for(int i=0;i<t;i++){ cin>>a>>b>>c>>n; if(a==b && b==c){ if(n%3==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else if (a==b && a>c){ if(n>=a-c){ n=n-(a-c); if(n%3==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else{ cout<<"NO"<<endl; } } else if (a==b && a<c){ if(n>=(2*(c-a))){ n=n-(2*(c-a)); if(n%3==0 ){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else{ cout<<"NO"<<endl; } } else if (c==b && b>a){ if(n>=b-a){ n=n-(b-a); if(n%3==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else{ cout<<"NO"<<endl; } } else if (c==b && b<a){ if(n>=(2*(a-b))){ n=n-(2*(a-c)); if(n%3==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else{ cout<<"NO"<<endl; } } else if (a==c && a>b){ if(n>=a-b){ n=n-(a-b); if(n%3==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else{ cout<<"NO"<<endl; } } else if (a==c && a<b){ if(n>=(2*(b-a))){ n=n-(2*(b-a)); if(n%3==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } else{ cout<<"NO"<<endl; } } else{ if(a>b && a>c){ if(n>=(a-b)+(a-c)){ n=n-(a-b)-(a-c); if(n%3==0){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } }else{ cout<<"NO"<<endl; } } else if(b>a && b>c){ if(n>=(b-a)+(b-c)){ n=n-(b-a)-(b-c); if(n%3==0){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } }else{ cout<<"NO"<<endl; } } else if(c>a && c>b){ if(n>=(c-b)+(c-a)){ n=n-(c-b)-(c-a); if(n%3==0){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } }else{ cout<<"NO"<<endl; } } } }
}`
I have another solution and it's much less then your.
Can you explain why did you use rall(a)?
Now we have a, b, c, a >= b >= c
And I supplemented b to a and c to a
So, it sorted the list in the opposite order?
It's define
Omg god tier coder, pls enlighten me
The number of all coins must be devidable by 3, and none of the sisters should have more than a third of all coins beforehand.