icpc probs

This commit is contained in:
Barrett Ruth 2026-01-07 12:30:51 -06:00
parent 4c531b965f
commit 69d48861b1
17 changed files with 448 additions and 2 deletions

View file

@ -0,0 +1,32 @@
import sys
from collections import Counter
def solve() -> None:
counter: Counter[str] = Counter()
ans = []
lines = sys.stdin.readlines()
for line in lines:
first, last = line.split()
counter[first] += 1
ans.append((last, first))
ans.sort()
for last, first in ans:
if counter[first] > 1:
print(f"{first} {last}")
else:
print(first)
def main() -> None:
solve()
if __name__ == "__main__":
main()