def parse_kv(text):
    result = {}
    for line in text.split('\n'):
        line = line.strip()
        if not line:
            continue
        if '=' in line:
            key, value = line.split('=', 1)
            key = key.strip()
            value = value.strip()
            if value.isdigit():
                result[key] = int(value)
            else:
                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!')