def parse_kv(text):
    lines = text.split('\n')
    result = {}
    for line in lines:
        line = line.strip()
        if not line:
            continue
        if '=' in line:
            key, value = line.split('=', 1)
            if value.isdigit():
                value = int(value)
            result[key] = value
    return result

# Test
assert parse_kv('a=1\nb=hello\n\nc=42') == {'a': 1, 'b': 'hello', 'c': 42}
print('Test passed!')
