Efficient Discrepancy Testing for Learning with Distribution Shift