Limits on contact interactions and leptoquarks at HERA