paizaとか競技プログラミングやっている時用の標準入力受け取り&int化。
入力値は1 2 3
の様に間にスペースが入ってたりすることを想定してます。
input使うのがなんか嫌なのでsys
使ってます。実行速度もsys使った方が速いのでいいのかなぁと。
実行時間の比較は別記事にしてます。pythonの標準入力受け取りinput()とsys.stdinはどっちがいいの?
1行の場合.py
data = [int(s) for s in sys.stdin.readline().split()]
複数行の場合.py
data = list()
for l in sys.stdin:
data.append([int(i) for i in l.split()])
#1行で書くと↓
data = [ [int(s) for s in line.split()] for line in sys.stdin ]