using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ActivityTracker_13 { class ActivityTracker_13 { static void Main(string[] args) { SortedDictionary> spyData = new SortedDictionary>(); SortedDictionary userData = new SortedDictionary(); int n = int.Parse(Console.ReadLine()); for (int a = 0; a < n; a++) { string[] inputData = Console.ReadLine().Split(); DateTime date = DateTime.Parse(inputData[0]); int month = date.Month; string userName = inputData[1]; int distance = int.Parse(inputData[2]); if (!spyData.ContainsKey(month)) { userData = new SortedDictionary(); userData.Add(userName, distance); spyData.Add(month, userData); } else { if (!userData.ContainsKey(userName)) { userData.Add(userName, distance); } else { int currentDist = userData[userName]; int newDistance = currentDist + distance; userData[userName] = newDistance; } spyData[month] = userData; } } foreach (var k in spyData.Keys) { Console.Write(k+":"); SortedDictionary data = spyData[k]; foreach (var c in data) { Console.Write("{0} ({1}),",c.Key, c.Value); } Console.WriteLine(); } } } }