Part A — Log store with time-range queries: Implement a data structure that ingests log entries with ISO-8601 timestamps (e.g., YYYY-MM-DD HH:MM:SS) and unique IDs. Support add(id, timestamp) and query(start, end, granularity) where granularity ∈ {Year, Month, Day, Hour, Minute, Second}; query returns IDs whose timestamps fall within [start, end] at the specified granularity. Describe your data structures, update/query time and space complexities, and how you maintain ordering and memory usage. Part B — Buffered writer: Implement a BufferedWriter over an abstract sink write(bytes) that may accept partial writes. Support write(data), flush(), and close(); preserve ordering, chunk large inputs into fixed-size buffers, minimize system calls, and handle errors/partial writes. Discuss thread-safety options and complexity trade-offs.