Once, a Yandex Ads anti-fraud intern joined the team. While the fraudster group was active, which simulated traffic on their sites through bot visits, and thus received money for ad impressions by bots, the intern's task was to find all such fraudulent sites with fake traffic.
Interestingly, all traffic on these sites was generated with IP substitution, making it seem as if a bot was visiting from city A, but in reality, the device was in a completely different location.
A lot of time passed, and the intern tried to cover this entire fraud group, even managing to catch some sites in parts. But the whole network could not be caught.
After some time, he noticed a news report: in city A, on 02.08.2025, mobile internet was completely absent. However, wired (home) internet continued to work.
Given this, how can the intern find all fake sites?
You have logs of sites in a table format for the period from 30.07.2025 to 10.08.2025:
timestamp | site_id | city_id
Each record corresponds to a visit to a site by one device.
It is known that bot traffic changes significantly less than real traffic per day.
Your task is to find all sites whose traffic was mainly composed of bots that faked their region to city A.
Note
The table containing the data is called logs.
Example of a table record:
timestamp | site_id | city_id
[phone]:13:53 | 6e84d9b71ca44aea | A