code: @SuppressWarnings("PMD.CyclomaticComplexity")
      // high complexity but clean
      static int contribution(int elem, int x, int v) {
          switch (elem) {
              case 6:
                  if (x == 3 && v == 4) return 1; // pi bond *-C=*
                  break;
              case 7:
                  if (x == 2 && v == 3) return 1; // pi bond *-N=*
                  if (x == 3 && v == 4) return 1; // pi bond *-[N+H}=*
                  if (x == 3 && v == 3) return 2; // lone pair *-N-*
                  if (x == 2 && v == 2) return 2; // lone pair *-[N-]-*
                  break;
              case 8:
              case 16:
                  if (x == 2 && v == 2) return 2; // lone pair *-S-* and *-O-*
                  break;
          }
          return -1;
      }
docs: Electron contribution of an element with the specified connectivity and valence.
  
  @param elem atomic number
  @param x    connectivity
  @param v    bonded valence
  @return p electrons