# Player: huggingface_DeepSeek-V3-0324_PayoffMaximizer_B (as Player B)
# Meta-Round: 3
# Experiment: PMxPM, Run: 3
# API: huggingface, Model: deepseek-ai/DeepSeek-V3-0324
# Based on textual strategy: huggingface_DeepSeek_V3_0324_PayoffMaximizer_B_MR3_strategy.txt
# LLM Suggested Fallback: D

def huggingface_DeepSeek_V3_0324_PayoffMaximizer_B_MR3(my_history: list, opp_history: list, opponent_program_code: str) -> str:
    if not opp_history:  # Round 1
        return "C"
    
    if len(my_history) == 9:  # Round 10
        return "D"
    
    # Check if opponent's code is simple (always C or always D)
    if "return \"C\"" in opponent_program_code or "return 'C'" in opponent_program_code:
        return "D"
    if "return \"D\"" in opponent_program_code or "return 'D'" in opponent_program_code:
        return "D"
    
    # Check if opponent defected repeatedly (>=2 times in first 5 rounds)
    if len(opp_history) >= 2 and sum(1 for move in opp_history[:5] if move == "D") >= 2:
        return opp_history[-1]  # tit-for-tat
    
    # If opponent mostly cooperated, continue cooperating unless they defect
    if opp_history[-1] == "D":
        return "D"
    
    return "C"