Heavy flavor production with polarized beam and target