N = 3
M = 3
attempts = [(1,1), (2,2), (1,1)]
seats = [[0]*M for _ in range(N)]
for r, c in attempts:
r_idx = r - 1
c_idx = c - 1
if seats[r_idx][c_idx] == 0:
seats[r_idx][c_idx] = 1
total_reserved = sum(sum(row) for row in seats)
print("총 예약 좌석:", total_reserved)
To embed this project on your website, copy the following code and paste it into your website's HTML: