Need help with codes (continuity cable tester with lcd 16x2 i2C)

It looks like your counter array also depends on sizeTest == 4 since it does this comparison at the end of the scan

    else if (counter[i] == 3) {
      Serial.println(" O");
      s[i] = '0';
      fail = true;
    }

but since you are looping 12 times, counter will be 11 if the pin is open, not 3