import json

teams = set()
with open('../data/nasouth/2026/nasouth26d1-event-feed.json', 'r') as f:
    for line in f:
        if not line.strip(): continue
        data = json.loads(line)
        if data.get('type') == 'teams':
            for t in data.get('data', []):
                if any('mid-atlantic' in g for g in t.get('group_ids', [])):
                    teams.add(t['id'])

before_freeze = 0
after_freeze = 0
with open('../data/nasouth/2026/nasouth26d1-event-feed.json', 'r') as f:
    for line in f:
        if not line.strip(): continue
        data = json.loads(line)
        if data.get('type') == 'submissions':
            for s in data.get('data', []):
                if s.get('team_id') in teams:
                    time_str = s.get('contest_time') # e.g. "4:15:23.123" or "0:15:23.123"
                    h = int(time_str.split(':')[0])
                    if h < 4:
                        before_freeze += 1
                    else:
                        after_freeze += 1
print(f"Before 4h: {before_freeze}, After 4h: {after_freeze}")
