title: Count Possible Groups Size 2 3 Sum Multiple 3
signature: count_possible_groups_size_2_3_sum_multiple_3 <- function(arr, n) {
source_py: def count_possible_groups_size_2_3_sum_multiple_3(arr, n):
      c = [0, 0, 0]
      res = 0
      for i in range(0, n):
          c[(arr[i] % 3)] += 1
      res += ((c[0] * (c[0] - 1)) >> 1)
      res += (c[1] * c[2])
      res += (((c[0] * (c[0] - 1)) * (c[0] - 2)) / 6)
      res += (((c[1] * (c[1] - 1)) * (c[1] - 2)) / 6)
      res += (((c[2] * (c[2] - 1)) * (c[2] - 2)) / 6)
      res += ((c[0] * c[1]) * c[2])
      return res
source_cpp: int count_possible_groups_size_2_3_sum_multiple_3(vector<int> arr, int n) {
    int c [ 3 ] = {
      0 },
      i;
      int res = 0;
      for ( i = 0;
      i < n;
      i ++ ) c [ arr [ i ] % 3 ] ++;
      res += ( ( c [ 0 ] * ( c [ 0 ] - 1 ) ) >> 1 );
      res += c [ 1 ] * c [ 2 ];
      res += ( c [ 0 ] * ( c [ 0 ] - 1 ) * ( c [ 0 ] - 2 ) ) / 6;
      res += ( c [ 1 ] * ( c [ 1 ] - 1 ) * ( c [ 1 ] - 2 ) ) / 6;
      res += ( ( c [ 2 ] * ( c [ 2 ] - 1 ) * ( c [ 2 ] - 2 ) ) / 6 );
      res += c [ 0 ] * c [ 1 ] * c [ 2 ];
      return res;
    }