I remember reading a sci-fi short story where society was controlled by a computer where any human thought was known by the computer and people were arrested even if they thought about something that was a crime.
It reminded me one of the Multivac stories from Isaac Asimov.
I made a quick search and it's probably All the Troubles of the World
Multivac, the world's largest supercomputer, is given the responsibility of analyzing the entire sum of data on the planet Earth. It is used to determine solutions to economic, social and political problems, as well as more specific crises as they arise. It receives a precise set of data on every citizen of the world, extrapolating the future actions of humanity based upon personality, history, and desires of every human being; leading to an almost complete cessation of poverty, war and political crisis.
Recently, however, it has been given the new responsibility of producing a list of crimes predicted to be carried out by individuals, ranging from murder to domestic abuse. Analyzing the probability of each crime coming up, Multivac informs law enforcement, who make sure the crimes do not occur. Murder has been largely eradicated and, though it is impossible to stop all crime across the planet, the increased capability of the government has led to a drastic decrease in offences. The success of Multivac has been so great, in fact, that the government is considering expanding its responsibilities beyond even predicting crime; the government hopes to program Multivac to even predict the occurrence of disease among the populace, eventually foreseeing every harmful event on the planet.
Looks like “Minority Report”, except that this is not a super-computer, but pre-cogs. This is quite a thick book by Philip K. Dick, not a short story. And then the Spielberg film with Tom Cruise, of course.