fork download
  1. {
  2. "read_stdin": {"def": [["read", 0, 9999]]},
  3. "char2int": {"params": ["c"], "def": [
  4. ["if",
  5. ["=", "c", {"lit":"0"}], [0],
  6. ["=", "c", {"lit":"1"}], [1],
  7. ["=", "c", {"lit":"2"}], [2],
  8. ["=", "c", {"lit":"3"}], [3],
  9. ["=", "c", {"lit":"4"}], [4],
  10. ["=", "c", {"lit":"5"}], [5],
  11. ["=", "c", {"lit":"6"}], [6],
  12. ["=", "c", {"lit":"7"}], [7],
  13. ["=", "c", {"lit":"8"}], [8],
  14. ["=", "c", {"lit":"9"}], [9],
  15. ["c"]
  16. ]
  17. ]},
  18. "str2int": {"params": ["s"], "def": [
  19. ["fold",
  20. {"params": ["x", "y"], "def": [
  21. ["+", ["*", ["char2int", "x"], 10], ["char2int", "y"]]
  22. ]},
  23. "s"
  24. ]
  25. ]},
  26. "mod": {"params": ["a","b"], "def": [
  27. ["-", "a", ["*", ["/", "a", "b"], "b"]]
  28. ]},
  29. "solve": {"params": ["n"], "def": [
  30. {"has13": {"params": ["b", "n"], "def": [
  31. ["if",
  32. [">", "b", "n"], [0],
  33. ["=", ["mod", "n", ["*", "b", "b"]], ["+", "b", 3]], [1],
  34. [["has13", "b", ["/", "n", "b"]]]
  35. ]
  36. ]},
  37. "rec": {"params": ["b"], "def": [
  38. ["if",
  39. [">", "b", "n"], [0],
  40. ["has13", "b", "n"], [["+", 1, ["rec", ["+", 1, "b"]]]],
  41. [["rec", ["+", 1, "b"]]]
  42. ]
  43. ]}
  44. },
  45. ["rec", 4]
  46. ]},
  47. "main": { "def": [
  48. ["import", {"lit": "file"}],
  49. {"n": ["str2int", ["read_stdin"]]},
  50. ["println", ["solve", "n"]]
  51. ]}
  52. }
  53.  
Success #stdin #stdout 0.09s 8832KB
stdin
Standard input is empty
stdout
Standard output is empty