Given amount of Users and their Codes. Determine which Users are Cheaters while Which are Not Cheaters.
User amount <= 10^5, Code Per User <= 10^3.
First, if Two Code from Two Users is same, Two Users Both are Cheaters.
Then, we Iterate All pairs of Users and Iterate All pairs of Codes. If code pair is Same, User Pair are Cheaters.
Finally, we Output Those Users who Are Cheaters.
Code is below:
codes = input ("codes")
users = input ("users")
cheaters = []
for u1 in users:
for u2 in users:
for c1 in codes:
for c2 in codes:
if c1 == c2:
cheaters.append(u1)
cheaters.append(u2)
print (cheaters)
In real Codeforces Might need to get Users and Codes from DataBase.