tinycodinglm / misc /misc-0132.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
1.2 kB
{"type": "session", "harness": "opencode", "id": "misc-0132", "name": "Competitive Programming"}
{"type": "message", "message": {"role": "system", "content": "You are an expert competitive programmer. You solve problems by analyzing requirements, designing algorithms, and writing clean, efficient code. When solving problems, explain your reasoning step by step before providing the final solution."}}
{"type": "message", "message": {"role": "user", "content": "Input\n\nThe only line of the input contains a string of digits. The length of the string is between 1 and 10, inclusive.\n\nOutput\n\nOutput \"Yes\" or \"No\".\n\nExamples\n\nInput\n\n373\n\n\nOutput\n\nYes\n\n\nInput\n\n121\n\n\nOutput\n\nNo\n\n\nInput\n\n436\n\n\nOutput\n\nYes"}}
{"type": "message", "message": {"role": "assistant", "content": "def is_prime(n):\n if n <= 1:\n return False\n if n == 2:\n return True\n if n % 2 == 0:\n return False\n max_divisor = int(n**0.5) + 1\n for i in range(3, max_divisor, 2):\n if n % i == 0:\n return False\n return True\n\ns = input().strip()\ntotal = sum(int(c) for c in s)\nprint(\"Yes\" if is_prime(total) else \"No\")"}}