Hinted Data Structures with Applications to Optimization and Learning