func_code_string: #include <bits/stdc++.h>      using namespace std;      typedef long long ll;      const ll DIM = 1e6 + 7;   const ll INF = 1e16 + 7;   const ll MODULO = 1e9 + 7;      ll n,m,nt,k,q;      ll val,val1,last,res,c0,c1,c2;      int main()   {       ios_base::sync_with_stdio();       cin.tie();       cout.tie();          cin>>nt;       for(int t=1; t<=nt; t++)       {              cin>>n;              res=0;           c0=0;           c1=0;           c2=0;              for(int i=1; i<=n; i++)           {               cin>>val;                  if(val%3==0)c0++;               else if(val%3==1)c1++;               else c2++;           }              for(int i=1; i<=2; i++)           {                  if(c0>n/3)               {                   val=c0-n/3;                   res+=val;                   c1+=val;                   c0-=val;               }                  if(c1>n/3)               {                   val=c1-n/3;                   res+=val;                   c2+=val;                   c1-=val;               }                  if(c2>n/3)               {                   val=c2-n/3;                   res+=val;                   c0+=val;                   c2-=val;               }           }              cout<<res<<endl;       }          return 0;   }   