long wire kickback voltage problem
The 100m wire from SW1 to pin 3 of IC1 acts as a long antenna that will pick up all sorts of electrical noise. Almost any electrical equipment nearby that switches current will induce a transient voltage into it, and the voltage can easily be 10's or 100's of volts. If you are unfortunate enough to have a thunderstorm nearby this can easily be 1000's of volts. Any voltage over about 6V can damage the IC, so you need to protect input to the IC. A simple RC low pass filter is surprisingly effective. I would use the following circuit. This will protect IC from damage, but will not effectively debounce the switch. You can do this in software.







simulate this circuit &ndash; Schematic created using CircuitLab