Submission CN8BM5

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['stream']].append((int(f['seq']), int(f['ts'])))
    result = {}
    for stream, rows in sorted(d.items()):
        values = [ts for _, ts in sorted(rows)]
        regressions = [a - b for a, b in zip(values, values[1:]) if b < a]
        result[stream] = {'out_of_order_events': len(regressions), 'largest_regression': max(regressions, default=0)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

stream=orders ts=100 seq=1
stream=orders ts=108 seq=2
stream=orders ts=105 seq=3
stream=orders ts=120 seq=4
stream=users ts=50 seq=1
stream=users ts=45 seq=2
stream=users ts=41 seq=3

Parse the supplied raw log text and compute out-of-order event count and largest timestamp regression per stream. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission Z2AE0A

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'exposed': set(), 'converted': set()})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); key = 'exposed' if f['event'] == 'expose' else 'converted'; d[f['variant']][key].add(f['user'])
    rates = {k: len(v['converted']) / len(v['exposed']) for k, v in d.items()}
    result = {'exposures': {k: len(d[k]['exposed']) for k in sorted(d)}, 'conversion_pct': {k: round(rates[k] * 100, 1) for k in sorted(d)}, 'test_lift_points': round((rates['test'] - rates['control']) * 100, 1)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

variant=control user=u1 event=expose
variant=control user=u1 event=convert
variant=control user=u2 event=expose
variant=test user=u3 event=expose
variant=test user=u4 event=expose
variant=test user=u4 event=convert
variant=test user=u5 event=expose
variant=test user=u5 event=convert

Parse the supplied raw log text and compute feature flag exposure imbalance and conversion lift. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission SRXX91

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'elapsed': 0, 'processed': 0, 'failed': 0})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); row = d[f['job']]
        for key in ('elapsed_s', 'processed', 'failed'): row[{'elapsed_s':'elapsed','processed':'processed','failed':'failed'}[key]] += int(f[key])
    result = {j: {'throughput_per_s': round(v['processed'] / v['elapsed'], 2), 'failed_pct': round(v['failed'] * 100 / v['processed'], 2)} for j, v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

job=import batch=1 elapsed_s=10 processed=500 failed=5
job=import batch=2 elapsed_s=15 processed=750 failed=15
job=export batch=1 elapsed_s=20 processed=600 failed=0
job=export batch=2 elapsed_s=25 processed=900 failed=9

Parse the supplied raw log text and compute batch job throughput and failed-record rate. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission QOVTQ7

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['sensor']].append(float(f['value']))
    result = {}
    for sensor, values in sorted(d.items()):
        anomalies = []
        for i in range(3, len(values)):
            baseline = sum(values[i-3:i]) / 3
            if abs(values[i] - baseline) >= 5: anomalies.append(i + 1)
        result[sensor] = {'anomaly_samples': anomalies, 'range': round(max(values) - min(values), 1)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

sensor=a value=20.0
sensor=a value=21.0
sensor=a value=20.5
sensor=a value=29.0
sensor=a value=21.5
sensor=b value=10.0
sensor=b value=10.5
sensor=b value=11.0
sensor=b value=12.0

Parse the supplied raw log text and compute rolling three-sample temperature anomaly count. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 7ICGGE

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: defaultdict(set))
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['provider']][f['event']].add(f['id'])
    result = {}
    for provider, e in sorted(d.items()):
        queued = len(e['queued']); delivered = len(e['delivered'])
        result[provider] = {'delivery_pct': round(delivered * 100 / queued, 1), 'unique_open_pct_of_delivered': round(len(e['open']) * 100 / delivered, 1) if delivered else 0.0, 'bounces': len(e['bounced'])}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

id=m1 event=queued provider=a
id=m1 event=delivered provider=a
id=m1 event=open provider=a
id=m2 event=queued provider=a
id=m2 event=bounced provider=a
id=m3 event=queued provider=b
id=m3 event=delivered provider=b
id=m3 event=open provider=b
id=m3 event=open provider=b

Parse the supplied raw log text and compute email delivery funnel with unique message ids. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission X5O2HS

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['trace']].append(f)
    result = {}
    for trace, spans in sorted(d.items()):
        roots = [s for s in spans if s['parent'] == '-']
        ids = {s['span'] for s in spans}; missing = sorted({s['parent'] for s in spans if s['parent'] != '-' and s['parent'] not in ids})
        duration = max(int(s['end']) for s in spans) - min(int(s['start']) for s in spans)
        result[trace] = {'complete_root': len(roots) == 1, 'missing_parents': missing, 'observed_duration_ms': duration}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

trace=t1 span=root parent=- start=0 end=120
trace=t1 span=db parent=root start=10 end=80
trace=t1 span=cache parent=root start=85 end=100
trace=t2 span=db parent=root start=5 end=55
trace=t2 span=render parent=root start=60 end=90

Parse the supplied raw log text and compute trace completeness and critical path duration. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission GOPMW1

import json

def transform(input):
    lines = input.strip().splitlines()
    windows = {}
    target = None
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split())
        if 'window' in f: windows[f['window']] = (int(f['good']), int(f['total']))
        else: target = float(f['target'])
    budget = 1 - target / 100
    burn = {w: round(((total - good) / total) / budget, 2) for w, (good, total) in windows.items()}
    result = {'burn_rate': dict(sorted(burn.items())), 'page': burn['5m'] >= 14 and burn['1h'] >= 6}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

window=5m good=940 total=1000
window=1h good=11900 total=12000
service=checkout target=99.9

Parse the supplied raw log text and compute sLO burn rate across short and long windows. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 95F25I

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'reserve': 0, 'release': 0, 'commit': 0})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['sku']][f['action']] += int(f['qty'])
    result = {sku: {'reserved': v['reserve'], 'accounted': v['release'] + v['commit'], 'leaked': v['reserve'] - v['release'] - v['commit']} for sku, v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

sku=A order=o1 action=reserve qty=3
sku=A order=o1 action=release qty=1
sku=A order=o1 action=commit qty=2
sku=A order=o2 action=reserve qty=5
sku=B order=o3 action=reserve qty=4
sku=B order=o3 action=commit qty=3
sku=B order=o3 action=release qty=1

Parse the supplied raw log text and compute inventory reservation leakage. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission TTR1JK

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'total': 0, 'failed': 0, 'versions': defaultdict(int), 'ok_ms': []})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); r = d[f['host']]; r['total'] += 1; r['versions'][f['tls']] += 1
        if f['outcome'] == 'fail': r['failed'] += 1
        else: r['ok_ms'].append(int(f['ms']))
    result = {h: {'failure_pct': round(v['failed'] * 100 / v['total'], 1), 'version_mix': dict(sorted(v['versions'].items())), 'avg_success_ms': round(sum(v['ok_ms']) / len(v['ok_ms']), 1)} for h, v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

host=api tls=1.3 outcome=ok ms=35
host=api tls=1.2 outcome=ok ms=55
host=api tls=1.2 outcome=fail ms=80
host=cdn tls=1.3 outcome=ok ms=20
host=cdn tls=1.3 outcome=ok ms=22
host=cdn tls=1.2 outcome=fail ms=100

Parse the supplied raw log text and compute tLS handshake version mix and failure rate. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission GW1LZE

import json

def transform(input):
    lines = input.strip().splitlines()
    from datetime import datetime
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        stamp, w = line.split(); d[w.split('=')[1]].append(datetime.fromisoformat(stamp.replace('Z', '+00:00')))
    result = {}
    for worker, times in sorted(d.items()):
        gaps = [int((b-a).total_seconds()) for a,b in zip(sorted(times), sorted(times)[1:])]
        result[worker] = {'max_gap_seconds': max(gaps), 'gaps_over_60s': sum(g > 60 for g in gaps)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

Parse the supplied raw log text and compute worker heartbeat gaps. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 246M5P

import json

def transform(input):
    lines = input.strip().splitlines()
    from decimal import Decimal
    from collections import defaultdict
    d = defaultdict(lambda: {'gross': Decimal('0'), 'fees': Decimal('0'), 'count': 0})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split())
        if f['outcome'] != 'settled': continue
        r = d[f['currency']]; r['gross'] += Decimal(f['refund']); r['fees'] += Decimal(f['fee']); r['count'] += 1
    result = {c: {'settled': v['count'], 'net': format(v['gross'] - v['fees'], '.2f'), 'fee_pct': float(round(v['fees'] * 100 / v['gross'], 2))} for c, v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

currency=USD refund=100.00 fee=2.50 outcome=settled
currency=USD refund=40.00 fee=1.00 outcome=failed
currency=USD refund=25.00 fee=0.75 outcome=settled
currency=EUR refund=80.00 fee=2.00 outcome=settled
currency=EUR refund=20.00 fee=0.50 outcome=settled

Parse the supplied raw log text and compute refund net amount by currency after fees. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission GFIIFL

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'hits': 0, 'total': 0, 'lat': []})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); r = d[f['type']]; r['total'] += 1; r['hits'] += f['cache'] == 'hit'; r['lat'].append(int(f['latency_ms']))
    result = {t: {'hit_pct': round(v['hits'] * 100 / v['total'], 1), 'mean_latency_ms': round(sum(v['lat']) / len(v['lat']), 1)} for t, v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

type=A cache=hit latency_ms=2
type=A cache=miss latency_ms=40
type=A cache=hit latency_ms=3
type=AAAA cache=miss latency_ms=55
type=AAAA cache=miss latency_ms=60
type=AAAA cache=hit latency_ms=4

Parse the supplied raw log text and compute dNS resolver cache effectiveness by record type. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission UBJJ8B

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['phase']].append(int(f['wait_ms']))
    result = {phase: {'avg_wait_ms': round(sum(v) / len(v), 1), 'blocked_over_100ms': sum(x > 100 for x in v)} for phase, v in sorted(d.items())}
    result['migration_added_avg_ms'] = round(result['during']['avg_wait_ms'] - result['before']['avg_wait_ms'], 1)
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

phase=before query=q1 wait_ms=5
phase=before query=q2 wait_ms=8
phase=during query=q3 wait_ms=450
phase=during query=q4 wait_ms=700
phase=during query=q5 wait_ms=20
phase=after query=q6 wait_ms=12
phase=after query=q7 wait_ms=9

Parse the supplied raw log text and compute schema migration lock impact. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission Y510KU

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    weights = {'low':1,'medium':2,'high':3}; d = defaultdict(lambda: {'drifted': [], 'score': 0, 'total': 0})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); r = d[f['env']]; r['total'] += 1
        if f['expected'] != f['actual']: r['drifted'].append(f['key']); r['score'] += weights[f['severity']]
    result = {e: {'drift_pct': round(len(v['drifted']) * 100 / v['total'], 1), 'weighted_score': v['score'], 'keys': sorted(v['drifted'])} for e,v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

env=prod key=timeout expected=30 actual=60 severity=high
env=prod key=retries expected=3 actual=3 severity=medium
env=stage key=timeout expected=30 actual=25 severity=high
env=stage key=region expected=us actual=us severity=low
env=stage key=debug expected=false actual=true severity=medium

Parse the supplied raw log text and compute configuration drift by environment and key severity. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission EI9PUN

import json

def transform(input):
    lines = input.strip().splitlines()
    import sqlite3
    db=sqlite3.connect(':memory:'); db.execute('create table logs(region text, amount integer, outcome text)')
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); db.execute('insert into logs values(?,?,?)',(f['region'],int(f['amount']),f['outcome']))
    rows=db.execute("select region,count(*),sum(outcome='commit'),sum(case when outcome='commit' then amount else 0 end) from logs group by region order by region").fetchall()
    result={r:{'transactions':n,'committed':c,'committed_amount':a} for r,n,c,a in rows}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

region=us amount=120 outcome=commit
region=us amount=50 outcome=rollback
region=us amount=80 outcome=commit
region=eu amount=200 outcome=commit
region=eu amount=100 outcome=rollback

Parse the supplied raw log text and compute sQL conditional aggregate for transaction outcomes. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 1V52UM

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'attempted': 0, 'protected': 0, 'ok_time': 0})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); r = d[f['target']]; size = int(f['bytes']); r['attempted'] += size
        if f['outcome'] == 'ok': r['protected'] += size; r['ok_time'] += int(f['duration_s'])
    result = {t: {'byte_success_pct': round(v['protected'] * 100 / v['attempted'], 1), 'successful_throughput': round(v['protected'] / v['ok_time'], 2)} for t, v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

target=db outcome=ok bytes=500 duration_s=50
target=db outcome=fail bytes=200 duration_s=40
target=files outcome=ok bytes=900 duration_s=120
target=files outcome=ok bytes=600 duration_s=90
target=files outcome=fail bytes=300 duration_s=60

Parse the supplied raw log text and compute backup reliability weighted by protected bytes. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission LASKP0

import json

def transform(input):
    lines = input.strip().splitlines()
    import sqlite3
    db=sqlite3.connect(':memory:');db.execute('create table logs(source text,severity text)')
    for line in lines:
        f=dict(x.split('=',1) for x in line.split());db.execute('insert into logs values(?,?)',(f['source'],f['severity']))
    rows=db.execute("select source,count(*) total,sum(severity='critical') critical from logs group by source having sum(severity='critical')>0 order by critical desc,source").fetchall()
    result=[{'source':s,'total':n,'critical':c,'critical_pct':round(c*100/n,1)} for s,n,c in rows]
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

source=cpu severity=warn
source=cpu severity=critical
source=cpu severity=critical
source=disk severity=warn
source=disk severity=info
source=network severity=critical

Parse the supplied raw log text and compute sQL group/HAVING for noisy alert sources. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission QPRA12

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['device']].append((int(f['minute']), int(f['battery'])))
    result = {}
    for device, rows in sorted(d.items()):
        rows.sort(); elapsed = rows[-1][0] - rows[0][0]; drain = rows[0][1] - rows[-1][1]
        crossing = next((m for m,b in rows if b < 20), None)
        result[device] = {'drain_pct_per_hour': round(drain * 60 / elapsed, 1), 'first_below_20_minute': crossing}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

device=d1 minute=0 battery=90
device=d1 minute=30 battery=75
device=d1 minute=60 battery=48
device=d2 minute=0 battery=50
device=d2 minute=20 battery=19
device=d2 minute=40 battery=15

Parse the supplied raw log text and compute battery drain and low-battery crossings by device. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission VEFZY1

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'clients': set(), 'reconnects': 0})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); r = d[f['version']]; r['clients'].add(f['client']); r['reconnects'] += f['event'] == 'reconnect'
    result = {v: {'clients': len(x['clients']), 'reconnects_per_client': round(x['reconnects']/len(x['clients']), 2)} for v,x in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

version=1.0 client=a event=connect
version=1.0 client=a event=reconnect
version=1.0 client=b event=connect
version=1.0 client=b event=reconnect
version=2.0 client=c event=connect
version=2.0 client=d event=connect
version=2.0 client=d event=reconnect
version=2.0 client=d event=reconnect

Parse the supplied raw log text and compute webSocket reconnect burden by client version. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission IGCSU3

import json

def transform(input):
    lines = input.strip().splitlines()
    result = {}
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); read = int(f['read_mb']); written = int(f['written_mb'])
        result[f['shard']] = {'reclaimed_mb': int(f['before_mb']) - int(f['after_mb']), 'write_amplification': round(written / read, 2) if read else None}
    result = dict(sorted(result.items()))
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

shard=s1 read_mb=500 written_mb=650 before_mb=900 after_mb=600
shard=s2 read_mb=400 written_mb=300 before_mb=700 after_mb=550
shard=s3 read_mb=0 written_mb=0 before_mb=200 after_mb=200

Parse the supplied raw log text and compute storage compaction amplification and reclaimed space. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission R2THFG

import json

def transform(input):
    lines = input.strip().splitlines()
    result={}
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); space=int(f['used_gb'])/int(f['total_gb']); inode=int(f['used_inodes'])/int(f['total_inodes']); limiting='space' if space>=inode else 'inodes'
        result[f['mount']]={'space_pct':round(space*100,1),'inode_pct':round(inode*100,1),'limiting_resource':limiting,'alert':max(space,inode)>=0.9}
    result=dict(sorted(result.items()))
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

mount=/data used_gb=850 total_gb=1000 used_inodes=40 total_inodes=100
mount=/tmp used_gb=20 total_gb=100 used_inodes=95 total_inodes=100
mount=/logs used_gb=450 total_gb=500 used_inodes=88 total_inodes=100

Parse the supplied raw log text and compute filesystem capacity risk using both bytes and inodes. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 82S5G3

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:defaultdict(int))
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); d[f['version']][f['session']]+=f['event']=='crash'
    result={v:{'sessions':len(s),'crash_free_pct':round(sum(x==0 for x in s.values())*100/len(s),1),'crash_events':sum(s.values())} for v,s in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

version=3.1 session=a event=start
version=3.1 session=a event=crash
version=3.1 session=b event=start
version=3.2 session=c event=start
version=3.2 session=d event=start
version=3.2 session=d event=crash
version=3.2 session=d event=crash

Parse the supplied raw log text and compute crash-free sessions by application version. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission C75NNZ

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:{'total':0,'fallback':0,'keys':[]})
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); r=d[f['locale']]; r['total']+=1
        if f['source']!=f['locale']:r['fallback']+=1;r['keys'].append(f['key'])
    result={l:{'fallback_pct':round(v['fallback']*100/v['total'],1),'fallback_keys':sorted(v['keys'])} for l,v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

locale=fr key=home.title source=fr
locale=fr key=home.cta source=en
locale=de key=home.title source=de
locale=de key=home.cta source=en
locale=de key=help source=en
locale=es key=home.title source=es

Parse the supplied raw log text and compute localization fallback rate by locale. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission R6BKYJ

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:{'requests':0,'errors':0,'clients':set()})
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); r=d[f['version']]; status=int(f['status']); r['requests']+=1;r['errors']+=status>=400;r['clients'].add(f['client'])
    total=sum(v['requests'] for v in d.values())
    result={v:{'traffic_share_pct':round(x['requests']*100/total,1),'error_pct':round(x['errors']*100/x['requests'],1),'unique_clients':len(x['clients'])} for v,x in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

version=v1 status=200 client=a
version=v1 status=500 client=b
version=v1 status=200 client=a
version=v2 status=200 client=c
version=v2 status=201 client=d
version=v2 status=400 client=e

Parse the supplied raw log text and compute aPI-version adoption and error rate. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission IKG5VO

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:{'delays':[],'missed':0})
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); r=d[f['job']]
        if f['actual']=='-':r['missed']+=1
        else:r['delays'].append(int(f['actual'])-int(f['scheduled']))
    result={j:{'missed':v['missed'],'max_lateness':max(v['delays'],default=None),'late_over_30':sum(x>30 for x in v['delays'])} for j,v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

job=hourly scheduled=100 actual=105
job=hourly scheduled=200 actual=260
job=hourly scheduled=300 actual=-
job=daily scheduled=1000 actual=1010
job=daily scheduled=2000 actual=2005

Parse the supplied raw log text and compute scheduled-job lateness and missed-run detection. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 87Z6QT

import json

def transform(input):
    lines = input.strip().splitlines()
    rates = {}
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); allowed = int(f['allowed']); limited = int(f['limited'])
        rates[f['client']] = allowed / (allowed + limited)
    values = list(rates.values()); fairness = sum(values) ** 2 / (len(values) * sum(x*x for x in values))
    result = {'allow_pct': {k: round(v * 100, 1) for k, v in sorted(rates.items())}, 'jain_fairness': round(fairness, 4), 'worst_client': min(rates, key=rates.get)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

client=a allowed=90 limited=10
client=b allowed=45 limited=5
client=c allowed=40 limited=40
client=d allowed=18 limited=2

Parse the supplied raw log text and compute rate-limit fairness across clients. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission WFCV3P

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:{'bytes':0,'parts':0,'terminal':None})
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); r=d[f['upload']]
        if f['state']=='stored':r['bytes']+=int(f['bytes']);r['parts']+=1
        else:r['terminal']=f['state']
    result={'completed_bytes':sum(v['bytes'] for v in d.values() if v['terminal']=='complete'),'orphaned_bytes':sum(v['bytes'] for v in d.values() if v['terminal'] is None),'aborted_uploads':sum(v['terminal']=='abort' for v in d.values())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

upload=u1 part=1 bytes=100 state=stored
upload=u1 part=2 bytes=120 state=stored
upload=u1 part=0 bytes=0 state=complete
upload=u2 part=1 bytes=200 state=stored
upload=u2 part=2 bytes=180 state=stored
upload=u3 part=1 bytes=90 state=stored
upload=u3 part=0 bytes=0 state=abort

Parse the supplied raw log text and compute multipart upload completion and orphaned-byte totals. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission M7ZFTS

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(dict)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['request']][f['stage']] = int(f['ms'])
    result = {}
    for req, stages in sorted(d.items()):
        total = sum(stages.values()); bottleneck = max(stages, key=stages.get)
        result[req] = {'total_ms': total, 'bottleneck': bottleneck, 'bottleneck_share_pct': round(stages[bottleneck] * 100 / total, 1)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

request=r1 stage=queue ms=20
request=r1 stage=compute ms=80
request=r1 stage=network ms=40
request=r2 stage=queue ms=60
request=r2 stage=compute ms=70
request=r2 stage=network ms=20

Parse the supplied raw log text and compute request stage contribution to end-to-end latency. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission FZ5JQH

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['hook']].append((int(f['attempt']), int(f['status'])))
    result = {}
    for hook, rows in sorted(d.items()):
        rows.sort(); success = next((a for a,s in rows if 200 <= s < 300), None)
        result[hook] = {'delivered': success is not None, 'attempts_to_delivery': success, 'retryable_failures': sum(s in (429,500,502,503,504) for _,s in rows)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

hook=h1 attempt=1 status=500
hook=h1 attempt=2 status=200
hook=h2 attempt=1 status=429
hook=h2 attempt=2 status=503
hook=h2 attempt=3 status=204
hook=h3 attempt=1 status=400
hook=h3 attempt=2 status=400

Parse the supplied raw log text and compute webhook eventual success and attempts-to-delivery. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission EZ9E6V

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(list)
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); d[f['pod']].append((int(f['throttled_ms']), int(f['latency_ms'])))
    result = {}
    for pod, rows in sorted(d.items()):
        throttled = [lat for throttle,lat in rows if throttle > 0]; baseline = [lat for throttle,lat in rows if throttle == 0]
        result[pod] = {'throttled_samples': len(throttled), 'latency_increase_ms': round(sum(throttled)/len(throttled) - sum(baseline)/len(baseline), 1) if throttled and baseline else None}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

pod=a throttled_ms=0 latency_ms=80
pod=a throttled_ms=20 latency_ms=120
pod=a throttled_ms=40 latency_ms=180
pod=b throttled_ms=0 latency_ms=70
pod=b throttled_ms=10 latency_ms=75

Parse the supplied raw log text and compute cPU throttling impact on latency. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 99QUKZ

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d = defaultdict(lambda: {'attempts': 0, 'denied': 0, 'actors': set()})
    for line in lines:
        f = dict(x.split('=', 1) for x in line.split()); kind = f['resource'].split('://')[0]; r=d[kind]; r['attempts']+=1
        if f['outcome']=='denied': r['denied']+=1; r['actors'].add(f['actor'])
    result={k:{'denial_pct':round(v['denied']*100/v['attempts'],1),'affected_actors':sorted(v['actors'])} for k,v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

actor=u1 resource=s3://a action=read outcome=denied
actor=u1 resource=s3://b action=write outcome=denied
actor=u2 resource=db://orders action=read outcome=allowed
actor=u2 resource=db://users action=write outcome=denied
actor=u3 resource=s3://c action=read outcome=allowed

Parse the supplied raw log text and compute permission-denied concentration by resource class. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission J8TF6S

import json

def transform(input):
    lines = input.strip().splitlines()
    from datetime import date
    rows=[]
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); days=(date.fromisoformat(f['expires'])-date.fromisoformat(f['observed'])).days
        rows.append({'host':f['host'],'days_remaining':days,'risk':'expired' if days<0 else 'urgent' if days<=14 else 'normal'})
    result={'certificates':sorted(rows,key=lambda x:x['days_remaining']),'urgent_or_expired':sum(x['risk']!='normal' for x in rows)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

observed=2026-08-18 host=api expires=2026-08-25 issuer=A
observed=2026-08-18 host=cdn expires=2026-10-01 issuer=B
observed=2026-08-18 host=old expires=2026-08-17 issuer=A

Parse the supplied raw log text and compute certificate expiry risk relative to observation time. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission JUM25A

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict,Counter
    order=['cart','shipping','payment','complete']; d=defaultdict(set)
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); d[f['session']].add(f['event'])
    abandon=Counter()
    for events in d.values():
        if 'complete' not in events: abandon[max((e for e in events),key=order.index)]+=1
    result={'sessions':len(d),'completed':sum('complete' in x for x in d.values()),'abandoned_after':dict(sorted(abandon.items(),key=lambda x:order.index(x[0])))}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

session=s1 event=cart
session=s1 event=shipping
session=s1 event=payment
session=s1 event=complete
session=s2 event=cart
session=s2 event=shipping
session=s3 event=cart
session=s3 event=shipping
session=s3 event=payment

Parse the supplied raw log text and compute checkout funnel abandonment stage. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 4NI4YC

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:{'correct':0,'total':0,'lat':[]})
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); r=d[f['model']]; r['total']+=1; r['correct']+=f['prediction']==f['truth']; r['lat'].append(int(f['latency']))
    result={m:{'accuracy_pct':round(v['correct']*100/v['total'],1),'median_latency_ms':__import__('statistics').median(v['lat'])} for m,v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

model=v1 prediction=cat truth=cat latency=40
model=v1 prediction=dog truth=cat latency=45
model=v1 prediction=dog truth=dog latency=50
model=v2 prediction=cat truth=cat latency=55
model=v2 prediction=dog truth=dog latency=60
model=v2 prediction=bird truth=bird latency=70

Parse the supplied raw log text and compute inference accuracy proxy and latency by model version. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 1QNH1A

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(lambda:[0,0,0,0.0])
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); r=d[f['campaign']]; vals=[int(f['impressions']),int(f['clicks']),int(f['conversions']),float(f['spend'])]
        for i,x in enumerate(vals):r[i]+=x
    result={c:{'ctr_pct':round(v[1]*100/v[0],2),'conversion_pct_of_clicks':round(v[2]*100/v[1],2),'cost_per_conversion':round(v[3]/v[2],2)} for c,v in sorted(d.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

campaign=a impressions=1000 clicks=50 conversions=5 spend=100
campaign=a impressions=500 clicks=20 conversions=2 spend=40
campaign=b impressions=800 clicks=80 conversions=4 spend=160
campaign=b impressions=200 clicks=10 conversions=1 spend=30

Parse the supplied raw log text and compute advertising click-through and spend per conversion. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission 8T2VY3

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    d=defaultdict(list); offenders=[]
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); offset=int(f['offset_ms']); d[f['source']].append(abs(offset))
        if abs(offset)>50: offenders.append(f['node'])
    result={'by_source':{s:{'mean_abs_skew_ms':round(sum(v)/len(v),1),'max_abs_skew_ms':max(v)} for s,v in sorted(d.items())},'outside_50ms':sorted(offenders)}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

node=n1 offset_ms=12 source=ntp-a
node=n2 offset_ms=-85 source=ntp-a
node=n3 offset_ms=140 source=ntp-b
node=n4 offset_ms=-20 source=ntp-b

Parse the supplied raw log text and compute clock-skew summary and nodes outside tolerance. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission PF8KUL

import json

def transform(input):
    lines = input.strip().splitlines()
    from collections import defaultdict
    starts={}; durations=defaultdict(list)
    for line in lines:
        f=dict(x.split('=',1) for x in line.split()); g=f['group']; t=int(f['ts'])
        if f['event']=='rebalance_start':starts[g]=t
        elif g in starts:durations[g].append(t-starts.pop(g))
    result={g:{'rebalances':len(v),'total_unavailable_s':sum(v),'max_rebalance_s':max(v)} for g,v in sorted(durations.items())}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

group=g1 event=rebalance_start ts=100
group=g1 event=rebalance_end ts=112
group=g1 event=rebalance_start ts=200
group=g1 event=rebalance_end ts=245
group=g2 event=rebalance_start ts=300
group=g2 event=rebalance_end ts=308

Parse the supplied raw log text and compute broker consumer-group rebalance stability. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission BXQLQL

import json

def transform(input):
    lines = input.strip().splitlines()
    import sqlite3
    db=sqlite3.connect(':memory:');db.execute('create table logs(product text,type text,amount integer)')
    for line in lines:
        f=dict(x.split('=',1) for x in line.split());db.execute('insert into logs values(?,?,?)',(f['product'],f['type'],int(f['amount'])))
    rows=db.execute("select product,sum(case when type='sale' then amount else 0 end),sum(case when type='refund' then amount else 0 end) from logs group by product order by product").fetchall()
    result={p:{'gross':gross,'refunds':refund,'net':gross-refund,'refund_pct':round(refund*100/gross,1)} for p,gross,refund in rows}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

product=a type=sale amount=100
product=a type=sale amount=80
product=a type=refund amount=30
product=b type=sale amount=200
product=b type=refund amount=50

Parse the supplied raw log text and compute sQL revenue and refund net by product. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.


Submission MY35XK

import json

def transform(input):
    lines = input.strip().splitlines()
    import sqlite3
    db=sqlite3.connect(':memory:');db.execute('create table logs(sensor text,ts integer,value integer)')
    for line in lines:
        f=dict(x.split('=',1) for x in line.split());db.execute('insert into logs values(?,?,?)',(f['sensor'],int(f['ts']),int(f['value'])))
    rows=db.execute('with d as (select sensor,ts,value-lag(value) over(partition by sensor order by ts) delta from logs) select sensor,ts,delta from d where delta is not null order by abs(delta) desc,sensor limit 1').fetchall()
    result={'sensor':rows[0][0],'timestamp':rows[0][1],'delta':rows[0][2]}
    return result if isinstance(result, str) else json.dumps(result, ensure_ascii=False)

sensor=a ts=1 value=10
sensor=a ts=2 value=12
sensor=a ts=3 value=30
sensor=b ts=1 value=50
sensor=b ts=2 value=40
sensor=b ts=3 value=43

Parse the supplied raw log text and compute sQL window function for largest reading jump. Ignore or specially handle the boundary cases encoded in the fixture, preserve deterministic ordering, and return the resulting metrics as a JSON string.