Created
May 15, 2026 04:54
-
-
Save omas-public/15d51128fb67b57f8922663e425b16db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bisect import bisect | |
| from sys import stdin | |
| # utility function | |
| identity = I = lambda x: x | |
| consistent = K = lambda x: lambda y: x | |
| # 辞書(d)を受取り,bisectを用いてvalue(v)に最も近いkeyを探し,そのkeyに対応するvalueを返す関数 | |
| bisect_pick = lambda d, v: list(d.values())[bisect(list(d.keys()), v) - 1] | |
| # sepで区切り,fnで加工して結合する関数 | |
| join = lambda sep="\n", fn=str: lambda values: sep.join(map(fn, values)) | |
| # sepを区切として分割し関数(fn)を適用したリストを返す関数 | |
| split = lambda sep=" ", fn=I: lambda v: list(map(fn, v.split(sep))) | |
| # 入力を受け取り改行で分割し関数(fn)を適用したリストを返す関数 | |
| gets = lambda n, fn=I: [fn(line) for line in stdin.read().split('\n')[:n]] | |
| # 出力関数 | |
| puts = lambda value: print(str(value)) | |
| # 入力データを受取り加工して返す関数 | |
| def main(p): | |
| buff = p | |
| return buff | |
| # 出力用に加工する関数 | |
| def transform(p): | |
| buff = p | |
| return buff | |
| if __name__ == "__main__": | |
| # preprocessing | |
| _in = gets(1)[0] | |
| # main function | |
| _out = main(_in) | |
| # display | |
| puts(transform(_out)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment